| | |
| | | * @param notify_url 通知地址 |
| | | * @throws IllegalAccessException |
| | | */ |
| | | public UnifiedorderReqData(String out_trade_no, String body, Double total_fee, String notify_url,String trade_type,String openid) throws IllegalAccessException{ |
| | | /* public UnifiedorderReqData(String out_trade_no, String body, Double total_fee, String notify_url,String trade_type,String openid) throws IllegalAccessException{ |
| | | |
| | | //appID与商户号 |
| | | this.appid = Configure.getGappid(); |
| | | |
| | | //微信支付分配的商户号ID(开通公众号的微信支付功能之后可以获取到) |
| | | this.mch_id = Configure.getGmchid(); |
| | | |
| | | //随机字符串,不长于32 位 |
| | | // setNonce_str(RandomStringGenerator.getRandomStringByLength(32)); |
| | | this.nonce_str = RandomStringGenerator.getRandomStringByLength(32); |
| | | |
| | | |
| | | // setBody(body);// 商品描述 |
| | | this.body = body; |
| | | |
| | | // setOut_trade_no(out_trade_no);// 商户订单号 |
| | | this.out_trade_no = out_trade_no; |
| | | |
| | | // setTotal_fee();// 总金额 |
| | | String money=SinataUtil.doubleRetainTwo(total_fee*100d); |
| | | this.total_fee = Integer.parseInt(money.substring(0,money.length()-3)); |
| | | //this.total_fee = (int)(total_fee * 100); |
| | | |
| | | // setNotify_url(notify_url);// 通知地址 |
| | | this.notify_url = notify_url; |
| | | *//*trade_type 交易类型JSAPI--公众号支付、NATIVE--原生扫码支付、APP--app支付,统一下单接口trade_type的传参可参考这里 |
| | | MICROPAY--刷卡支付,刷卡支付有单独的支付接口,不调用统一下单接口*//* |
| | | |
| | | this.trade_type = trade_type; |
| | | this.openid = openid; |
| | | // 根据API给的签名规则进行签名 |
| | | this.sign = Signature.getSign(1,toMap()); |
| | | |
| | | } |
| | | */ |
| | | /** |
| | | * 预支付请求需要的参数(获取微信统一下单-必填参数)(小程序) |
| | | * 公众账号ID appid (内置) |
| | | * 商户号 mch_id (内置) |
| | | * 随机字符串 nonce_str (内置) |
| | | * 签名 sign (内置) |
| | | * @param body 商品描述 |
| | | * @param out_trade_no 商户订单号 |
| | | * @param total_fee 总金额 (单位:分) |
| | | * @param notify_url 通知地址 |
| | | * @throws IllegalAccessException |
| | | */ |
| | | public UnifiedorderReqData(String out_trade_no, String body, Double total_fee, String notify_url,String trade_type,String openid) throws IllegalAccessException{ |
| | | |
| | | //appID与商户号 |
| | | this.appid = Configure.getXappid(); |
| | | |
| | | //微信支付分配的商户号ID(开通公众号的微信支付功能之后可以获取到) |
| | | this.mch_id = Configure.getXmchid(); |
| | | |
| | | //随机字符串,不长于32 位 |
| | | // setNonce_str(RandomStringGenerator.getRandomStringByLength(32)); |
| | |
| | | this.sign = Signature.getSign(1,toMap()); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 预支付请求需要的参数(获取微信统一下单-必填参数)(小程序) |
| | | * 公众账号ID appid (内置) |
| | | * 商户号 mch_id (内置) |
| | | * 随机字符串 nonce_str (内置) |
| | | * 签名 sign (内置) |
| | | * @param body 商品描述 |
| | | * @param out_trade_no 商户订单号 |
| | | * @param total_fee 总金额 (单位:分) |
| | | * @param notify_url 通知地址 |
| | | * @throws IllegalAccessException |
| | | */ |
| | | public UnifiedorderReqData(String out_trade_no, Double total_fee, String notify_url,String trade_type,String openid) throws IllegalAccessException{ |
| | | |
| | | //appID与商户号 |
| | | this.appid = Configure.getXappid(); |
| | | |
| | | //微信支付分配的商户号ID(开通公众号的微信支付功能之后可以获取到) |
| | | this.mch_id = Configure.getXmchid(); |
| | | |
| | | //随机字符串,不长于32 位 |
| | | // setNonce_str(RandomStringGenerator.getRandomStringByLength(32)); |
| | | this.nonce_str = RandomStringGenerator.getRandomStringByLength(32); |
| | | |
| | | |
| | | // setBody(body);// 商品描述 |
| | | this.body = "小程序支付"; |
| | | |
| | | // setOut_trade_no(out_trade_no);// 商户订单号 |
| | | this.out_trade_no = out_trade_no; |
| | | |
| | | // setTotal_fee();// 总金额 |
| | | String money=SinataUtil.doubleRetainTwo(total_fee*100d); |
| | | this.total_fee = Integer.parseInt(money.substring(0,money.length()-3)); |
| | | //this.total_fee = (int)(total_fee * 100); |
| | | |
| | | // setNotify_url(notify_url);// 通知地址 |
| | | this.notify_url = notify_url; |
| | | /*trade_type 交易类型JSAPI--公众号支付、NATIVE--原生扫码支付、APP--app支付,统一下单接口trade_type的传参可参考这里 |
| | | MICROPAY--刷卡支付,刷卡支付有单独的支付接口,不调用统一下单接口*/ |
| | | |
| | | this.trade_type = trade_type; |
| | | this.openid = openid; |
| | | // 根据API给的签名规则进行签名 |
| | | this.sign = Signature.getSign(1,toMap()); |
| | | |
| | | } |
| | | |
| | | public Map<String,Object> toMap(){ |
| | | Map<String,Object> map = new HashMap<String, Object>(); |