All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hn.pay.wxpay.domain.WxPayParam Maven / Gradle / Ivy

There is a newer version: 1.0.18
Show newest version
package com.hn.pay.wxpay.domain;

import cn.hutool.json.JSONUtil;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

/**
 * 描述:
 * 微信支付参数
 *
 * @author fei
 *  2019-08-21 16:34
 */
@Data
public class WxPayParam {
    /**
     * 附加数据
     */
    private String attach;
    /**
     * [必填]商品简单描述
     *
     */
    private String body;
    /**
     * [必填]订单总金额,单位为分
     */
    private String totalFee;
    /**
     * [必填]商户订单号
     */
    private String outTradeNo;

    /**
     *  h5支付[必填]
     *
     */
    private H5Info h5Info;

    /**
     *  H5支付不建议在APP端使用,针对场景1,2请接入APP支付,不然可能会出现兼容性问题
     * # IOS移动应用
     * {"h5_info": {"type":"IOS","app_name": "王者荣耀","bundle_id": "com.tencent.wzryIOS"}}
     *
     * # 安卓移动应用
     * {"h5_info": {"type":"Android","app_name": "王者荣耀","package_name": "com.tencent.tmgp.sgame"}}
     *
     * # WAP网站应用
     * {"h5_info": {"type":"Wap","wap_url": "https://pay.qq.com","wap_name": "腾讯充值"}}
     */
    @Data
    public static class H5Info {
        private String type;
        private String app_name;
        private String bundle_id;
        private String package_name;
        private String wap_url;
        private String wap_name;

        public void setType(H5Type type) {
            this.type = String.valueOf(type);
        }

        public String toJson(){
            Map map = new HashMap(2);
            map.put("h5_info",this);
            return JSONUtil.toJsonStr(map);
        }

        public static enum H5Type {
            // IOS移动应用
            IOS,
            // 安卓移动应用
            Android,
            // WAP网站应用
            Wap,
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy