优化扫码支付(Native)
This commit is contained in:
parent
26a2d4eaeb
commit
0da10d4491
@ -75,7 +75,7 @@ weixin4j
|
|||||||
|
|
||||||
* [微信门店](http://mp.weixin.qq.com/wiki/11/081986f089826bf94393bef9bf287b8b.html)
|
* [微信门店](http://mp.weixin.qq.com/wiki/11/081986f089826bf94393bef9bf287b8b.html)
|
||||||
|
|
||||||
* [微信摇一摇周边](http://mp.weixin.qq.com/wiki/19/9fe9fdbb50fee9f9660438c551142ccf.html)
|
* [微信摇一摇](http://mp.weixin.qq.com/wiki/19/9fe9fdbb50fee9f9660438c551142ccf.html)
|
||||||
|
|
||||||
* [微信连WI-FI](http://mp.weixin.qq.com/wiki/9/fd2d692e28b938a8d618f57cf9c79fb1.html)
|
* [微信连WI-FI](http://mp.weixin.qq.com/wiki/9/fd2d692e28b938a8d618f57cf9c79fb1.html)
|
||||||
|
|
||||||
|
|||||||
@ -34,6 +34,7 @@ import com.foxinmy.weixin4j.payment.mch.JSAPIPayRequest;
|
|||||||
import com.foxinmy.weixin4j.payment.mch.MchPayPackage;
|
import com.foxinmy.weixin4j.payment.mch.MchPayPackage;
|
||||||
import com.foxinmy.weixin4j.payment.mch.MchPayRequest;
|
import com.foxinmy.weixin4j.payment.mch.MchPayRequest;
|
||||||
import com.foxinmy.weixin4j.payment.mch.NATIVEPayRequest;
|
import com.foxinmy.weixin4j.payment.mch.NATIVEPayRequest;
|
||||||
|
import com.foxinmy.weixin4j.payment.mch.NativePayResponse;
|
||||||
import com.foxinmy.weixin4j.payment.mch.Order;
|
import com.foxinmy.weixin4j.payment.mch.Order;
|
||||||
import com.foxinmy.weixin4j.payment.mch.PrePay;
|
import com.foxinmy.weixin4j.payment.mch.PrePay;
|
||||||
import com.foxinmy.weixin4j.payment.mch.RefundRecord;
|
import com.foxinmy.weixin4j.payment.mch.RefundRecord;
|
||||||
@ -290,6 +291,38 @@ public class Pay3Api {
|
|||||||
timestamp, noncestr);
|
timestamp, noncestr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建Native支付(扫码支付)回调对象【模式一】
|
||||||
|
*
|
||||||
|
* @param productId
|
||||||
|
* 商品ID
|
||||||
|
* @param body
|
||||||
|
* 商品描述
|
||||||
|
* @param outTradeNo
|
||||||
|
* 商户内部唯一订单号
|
||||||
|
* @param totalFee
|
||||||
|
* 商品总额 单位元
|
||||||
|
* @param notifyUrl
|
||||||
|
* 支付回调URL
|
||||||
|
* @param createIp
|
||||||
|
* 订单生成的机器 IP
|
||||||
|
* @return Native回调对象
|
||||||
|
* @see com.foxinmy.weixin4j.payment.mch.NativePayResponse
|
||||||
|
* @see <a href="http://pay.weixin.qq.com/wiki/doc/api/native.php">扫码支付</a>
|
||||||
|
* @see <a
|
||||||
|
* href="https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_4">模式一</a>
|
||||||
|
* @throws WeixinPayException
|
||||||
|
*/
|
||||||
|
public NativePayResponse createNativePayResponse(String productId,
|
||||||
|
String body, String outTradeNo, double totalFee, String notifyUrl,
|
||||||
|
String createIp) throws WeixinPayException {
|
||||||
|
MchPayPackage payPackage = new MchPayPackage(weixinAccount, null, body,
|
||||||
|
outTradeNo, totalFee, notifyUrl, createIp, TradeType.NATIVE);
|
||||||
|
payPackage.setProductId(productId);
|
||||||
|
PrePay prePay = createPrePay(payPackage);
|
||||||
|
return new NativePayResponse(weixinAccount, prePay.getPrepayId());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建Native支付(扫码支付)链接【模式二】
|
* 创建Native支付(扫码支付)链接【模式二】
|
||||||
*
|
*
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import javax.xml.bind.annotation.XmlAccessType;
|
|||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlTransient;
|
||||||
|
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
import com.foxinmy.weixin4j.type.SignType;
|
import com.foxinmy.weixin4j.type.SignType;
|
||||||
@ -92,6 +93,7 @@ public class PayBaseInfo implements Serializable {
|
|||||||
return signType;
|
return signType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@XmlTransient
|
||||||
@JSONField(serialize = false)
|
@JSONField(serialize = false)
|
||||||
public SignType getFormatSignType() {
|
public SignType getFormatSignType() {
|
||||||
return signType != null ? SignType.valueOf(signType.toUpperCase())
|
return signType != null ? SignType.valueOf(signType.toUpperCase())
|
||||||
|
|||||||
@ -36,8 +36,8 @@ public class PayRequest extends PayBaseInfo {
|
|||||||
@JSONField(serialize = false)
|
@JSONField(serialize = false)
|
||||||
private String partnerId;
|
private String partnerId;
|
||||||
|
|
||||||
public PayRequest() {
|
protected PayRequest() {
|
||||||
super(null, DateUtil.timestamp2string(), RandomUtil.generateString(16));
|
// jaxb required
|
||||||
}
|
}
|
||||||
|
|
||||||
public PayRequest(String appId, String packageInfo) {
|
public PayRequest(String appId, String packageInfo) {
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import com.foxinmy.weixin4j.payment.mch.MPPaymentRecord;
|
|||||||
import com.foxinmy.weixin4j.payment.mch.MPPaymentResult;
|
import com.foxinmy.weixin4j.payment.mch.MPPaymentResult;
|
||||||
import com.foxinmy.weixin4j.payment.mch.MchPayPackage;
|
import com.foxinmy.weixin4j.payment.mch.MchPayPackage;
|
||||||
import com.foxinmy.weixin4j.payment.mch.MchPayRequest;
|
import com.foxinmy.weixin4j.payment.mch.MchPayRequest;
|
||||||
|
import com.foxinmy.weixin4j.payment.mch.NativePayResponse;
|
||||||
import com.foxinmy.weixin4j.payment.mch.Order;
|
import com.foxinmy.weixin4j.payment.mch.Order;
|
||||||
import com.foxinmy.weixin4j.payment.mch.PrePay;
|
import com.foxinmy.weixin4j.payment.mch.PrePay;
|
||||||
import com.foxinmy.weixin4j.payment.mch.Redpacket;
|
import com.foxinmy.weixin4j.payment.mch.Redpacket;
|
||||||
@ -237,6 +238,36 @@ public class WeixinPayProxy {
|
|||||||
return pay3Api.createNativePayRequestURL(productId);
|
return pay3Api.createNativePayRequestURL(productId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建Native支付(扫码支付)回调对象【模式一】
|
||||||
|
*
|
||||||
|
* @param productId
|
||||||
|
* 商品ID
|
||||||
|
* @param body
|
||||||
|
* 商品描述
|
||||||
|
* @param outTradeNo
|
||||||
|
* 商户内部唯一订单号
|
||||||
|
* @param totalFee
|
||||||
|
* 商品总额 单位元
|
||||||
|
* @param notifyUrl
|
||||||
|
* 支付回调URL
|
||||||
|
* @param createIp
|
||||||
|
* 订单生成的机器 IP
|
||||||
|
* @return Native回调对象
|
||||||
|
* @see com.foxinmy.weixin4j.api.Pay3Api
|
||||||
|
* @see com.foxinmy.weixin4j.payment.mch.NativePayResponse
|
||||||
|
* @see <a href="http://pay.weixin.qq.com/wiki/doc/api/native.php">扫码支付</a>
|
||||||
|
* @see <a
|
||||||
|
* href="https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_4">模式一</a>
|
||||||
|
* @throws WeixinPayException
|
||||||
|
*/
|
||||||
|
public NativePayResponse createNativePayResponse(String productId,
|
||||||
|
String body, String outTradeNo, double totalFee, String notifyUrl,
|
||||||
|
String createIp) throws WeixinPayException {
|
||||||
|
return pay3Api.createNativePayResponse(productId, body, outTradeNo,
|
||||||
|
totalFee, notifyUrl, createIp);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建Native支付(扫码支付)链接【模式二】
|
* 创建Native支付(扫码支付)链接【模式二】
|
||||||
*
|
*
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import javax.xml.bind.annotation.XmlAccessType;
|
|||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.XmlTransient;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
import com.foxinmy.weixin4j.exception.WeixinPayException;
|
import com.foxinmy.weixin4j.exception.WeixinPayException;
|
||||||
@ -12,7 +11,6 @@ import com.foxinmy.weixin4j.model.Consts;
|
|||||||
import com.foxinmy.weixin4j.model.WeixinPayAccount;
|
import com.foxinmy.weixin4j.model.WeixinPayAccount;
|
||||||
import com.foxinmy.weixin4j.util.DigestUtil;
|
import com.foxinmy.weixin4j.util.DigestUtil;
|
||||||
import com.foxinmy.weixin4j.util.RandomUtil;
|
import com.foxinmy.weixin4j.util.RandomUtil;
|
||||||
import com.foxinmy.weixin4j.xml.XmlStream;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Native支付时的回调响应
|
* Native支付时的回调响应
|
||||||
@ -33,10 +31,6 @@ public class NativePayResponse extends ApiResult {
|
|||||||
@JSONField(name = "prepay_id")
|
@JSONField(name = "prepay_id")
|
||||||
private String prepayId;
|
private String prepayId;
|
||||||
|
|
||||||
@XmlTransient
|
|
||||||
@JSONField(serialize = false)
|
|
||||||
private WeixinPayAccount weixinAccount;
|
|
||||||
|
|
||||||
protected NativePayResponse() {
|
protected NativePayResponse() {
|
||||||
// jaxb required
|
// jaxb required
|
||||||
}
|
}
|
||||||
@ -44,21 +38,17 @@ public class NativePayResponse extends ApiResult {
|
|||||||
/**
|
/**
|
||||||
* 作为return_code 为 FAIL 的时候返回
|
* 作为return_code 为 FAIL 的时候返回
|
||||||
*
|
*
|
||||||
* @param weixinAccount
|
|
||||||
* 商户信息
|
|
||||||
* @param returnMsg
|
* @param returnMsg
|
||||||
* 失败消息
|
* 失败消息
|
||||||
* @param resultMsg
|
* @param resultMsg
|
||||||
* 结果消息
|
* 结果消息
|
||||||
* @throws WeixinPayException
|
* @throws WeixinPayException
|
||||||
*/
|
*/
|
||||||
public NativePayResponse(WeixinPayAccount weixinAccount, String returnMsg,
|
public NativePayResponse(String returnMsg, String resultMsg) {
|
||||||
String resultMsg) {
|
|
||||||
super.setReturnMsg(returnMsg);
|
super.setReturnMsg(returnMsg);
|
||||||
super.setReturnCode(Consts.FAIL);
|
super.setReturnCode(Consts.FAIL);
|
||||||
super.setErrCodeDes(resultMsg);
|
super.setErrCodeDes(resultMsg);
|
||||||
super.setResultCode(Consts.FAIL);
|
super.setResultCode(Consts.FAIL);
|
||||||
this.weixinAccount = weixinAccount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,27 +67,13 @@ public class NativePayResponse extends ApiResult {
|
|||||||
this.setAppId(weixinAccount.getId());
|
this.setAppId(weixinAccount.getId());
|
||||||
this.setNonceStr(RandomUtil.generateString(16));
|
this.setNonceStr(RandomUtil.generateString(16));
|
||||||
this.prepayId = prepayId;
|
this.prepayId = prepayId;
|
||||||
this.weixinAccount = weixinAccount;
|
this.setSign(DigestUtil.paysignMd5(this, weixinAccount.getPaySignKey()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPrepayId() {
|
public String getPrepayId() {
|
||||||
return prepayId;
|
return prepayId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 生成 回调字符串
|
|
||||||
*
|
|
||||||
* @param paySignKey
|
|
||||||
* 支付签名密钥
|
|
||||||
* @return native回调字符串
|
|
||||||
*/
|
|
||||||
@XmlTransient
|
|
||||||
@JSONField(serialize = false)
|
|
||||||
public String asRequestXml() {
|
|
||||||
this.setSign(DigestUtil.paysignMd5(this, weixinAccount.getPaySignKey()));
|
|
||||||
return XmlStream.toXML(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "NativePayResponse [prepayId=" + prepayId + ", "
|
return "NativePayResponse [prepayId=" + prepayId + ", "
|
||||||
|
|||||||
@ -171,10 +171,9 @@ public class Pay2Api extends MpApi {
|
|||||||
map.put("productid", productId);
|
map.put("productid", productId);
|
||||||
map.put("appkey", weixinAccount.getPaySignKey());
|
map.put("appkey", weixinAccount.getPaySignKey());
|
||||||
String sign = DigestUtil.paysignSha(map, null);
|
String sign = DigestUtil.paysignSha(map, null);
|
||||||
return String
|
String ordernative_v2_uri = getRequestUri("ordernative_v2_uri");
|
||||||
.format("weixin://wxpay/bizpayurl?sign=%s&appid=%s&productid=%s×tamp=%s&nocestr=%s",
|
return String.format(ordernative_v2_uri, sign, weixinAccount.getId(),
|
||||||
sign, weixinAccount.getId(), productId, timestamp,
|
productId, timestamp, noncestr);
|
||||||
noncestr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
# ----------------------------------------------------------------------------
|
|
||||||
# \u5fae\u4fe1\u516c\u4f17\u5e73\u53f0\u6587\u6863\u8bf4\u660e
|
# \u5fae\u4fe1\u516c\u4f17\u5e73\u53f0\u6587\u6863\u8bf4\u660e
|
||||||
# http://mp.weixin.qq.com/wiki/index.php
|
# http://mp.weixin.qq.com/wiki/index.php
|
||||||
# http://mp.weixin.qq.com/wiki/0/2e2239fa5f49388d5b5136ecc8e0e440.html
|
# http://mp.weixin.qq.com/wiki/0/2e2239fa5f49388d5b5136ecc8e0e440.html
|
||||||
@ -130,6 +129,8 @@ getcallbackip_uri={api_cgi_url}/getcallbackip?access_token=%s
|
|||||||
|
|
||||||
# v2\u8ba2\u5355\u67e5\u8be2
|
# v2\u8ba2\u5355\u67e5\u8be2
|
||||||
orderquery_v2_uri={api_base_url}/pay/orderquery?access_token=%s
|
orderquery_v2_uri={api_base_url}/pay/orderquery?access_token=%s
|
||||||
|
# v2native\u652f\u4ed8
|
||||||
|
ordernative_v2_uri=weixin://wxpay/bizpayurl?sign=%s&appid=%s&productid=%s×tamp=%s&nocestr=%s\udbff\udce0\udbff\udce0\udbff\udce0\udbff\udce0\udbff\udc57\udbff\udc57\udbff\udc57\udbff\udc57\udbff\udc71\udbff\udc71\udbff\udc71\udbff\udc71\udbff\udc54\udbff\udc54\udbff\udc54\udbff\udc54\udbff\udc53\udbff\udc53\udbff\udc53\udbff\udc53\udbff\udce0\udbff\udce0\udbff\udce0\udbff\udce0\udbff\udc76\udbff\udc76\udbff\udc76\udbff\udc76\udbff\udcdc\udbff\udcdc\udbff\udcdc\udbff\udcdc\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcde\udbff\udcde\udbff\udcde\udbff\udcde\udbff\udc69\udbff\udc69\udbff\udc69\udbff\udc69\udbff\udcdf\udbff\udcdf\udbff\udcdf\udbff\udcdf\udbff\udc69\udbff\udc69\udbff\udc69\udbff\udc69\udbff\udc77\udbff\udc77\udbff\udc77\udbff\udc77\udbff\udc57\udbff\udc57\udbff\udc57\udbff\udc57\udbff\udc71\udbff\udc71\udbff\udc71\udbff\udc71\udbff\udc54\udbff\udc54\udbff\udc54\udbff\udc54\udbff\udc68\udbff\udc68\udbff\udc68\udbff\udc68\udbff\udcdc\udbff\udcdc\udbff\udcdc\udbff\udcdc\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd\udbff\udcdd
|
||||||
# \u53d1\u8d27\u901a\u77e5
|
# \u53d1\u8d27\u901a\u77e5
|
||||||
delivernotify_uri={api_base_url}/pay/delivernotify?access_token=%s
|
delivernotify_uri={api_base_url}/pay/delivernotify?access_token=%s
|
||||||
# \u7ef4\u6743\u5904\u7406
|
# \u7ef4\u6743\u5904\u7406
|
||||||
|
|||||||
@ -37,7 +37,7 @@ public class JsPayRequestV2 extends PayRequest {
|
|||||||
|
|
||||||
public JsPayRequestV2(WeixinPayAccount weixinAccount,
|
public JsPayRequestV2(WeixinPayAccount weixinAccount,
|
||||||
PayPackageV2 payPackage) {
|
PayPackageV2 payPackage) {
|
||||||
this.setAppId(weixinAccount.getId());
|
super(weixinAccount.getId(), "");
|
||||||
this.setPackageInfo(package2string(payPackage,
|
this.setPackageInfo(package2string(payPackage,
|
||||||
weixinAccount.getPartnerKey()));
|
weixinAccount.getPartnerKey()));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,14 +7,10 @@ import javax.xml.bind.annotation.XmlAccessType;
|
|||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.XmlTransient;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
import com.foxinmy.weixin4j.model.WeixinPayAccount;
|
import com.foxinmy.weixin4j.model.WeixinPayAccount;
|
||||||
import com.foxinmy.weixin4j.util.DateUtil;
|
|
||||||
import com.foxinmy.weixin4j.util.DigestUtil;
|
import com.foxinmy.weixin4j.util.DigestUtil;
|
||||||
import com.foxinmy.weixin4j.util.RandomUtil;
|
|
||||||
import com.foxinmy.weixin4j.xml.XmlStream;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* V2 Native支付时的回调响应
|
* V2 Native支付时的回调响应
|
||||||
@ -43,58 +39,52 @@ public class NativePayResponseV2 extends JsPayRequestV2 {
|
|||||||
@XmlElement(name = "RetErrMsg")
|
@XmlElement(name = "RetErrMsg")
|
||||||
private String retMsg;
|
private String retMsg;
|
||||||
|
|
||||||
@XmlTransient
|
|
||||||
@JSONField(serialize = false)
|
|
||||||
private WeixinPayAccount weixinAccount;
|
|
||||||
|
|
||||||
protected NativePayResponseV2() {
|
protected NativePayResponseV2() {
|
||||||
// jaxb required
|
// jaxb required
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应错误信息
|
||||||
|
*
|
||||||
|
* @param errorMsg
|
||||||
|
* 错误信息
|
||||||
|
*/
|
||||||
|
public NativePayResponseV2(String errorMsg) {
|
||||||
|
this.retCode = "-1";
|
||||||
|
this.retMsg = errorMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 正确响应
|
||||||
|
*
|
||||||
|
* @param weixinAccount
|
||||||
|
* @param payPackage
|
||||||
|
* 订单信息
|
||||||
|
*/
|
||||||
public NativePayResponseV2(WeixinPayAccount weixinAccount,
|
public NativePayResponseV2(WeixinPayAccount weixinAccount,
|
||||||
PayPackageV2 payPackage) {
|
PayPackageV2 payPackage) {
|
||||||
super(weixinAccount, payPackage);
|
super(weixinAccount, payPackage);
|
||||||
this.retCode = "0";
|
this.retCode = "0";
|
||||||
this.retMsg = "OK";
|
this.retMsg = "OK";
|
||||||
this.weixinAccount = weixinAccount;
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
|
map.put("appid", weixinAccount.getId());
|
||||||
|
map.put("appkey", weixinAccount.getPaySignKey());
|
||||||
|
map.put("timestamp", getTimeStamp());
|
||||||
|
map.put("noncestr", getNonceStr());
|
||||||
|
map.put("package", getPackageInfo());
|
||||||
|
map.put("retcode", getRetCode());
|
||||||
|
map.put("reterrmsg", getRetMsg());
|
||||||
|
this.setPaySign(DigestUtil.paysignSha(map, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRetCode() {
|
public String getRetCode() {
|
||||||
return retCode;
|
return retCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRetCode(String retCode) {
|
|
||||||
this.retCode = retCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRetMsg() {
|
public String getRetMsg() {
|
||||||
return retMsg;
|
return retMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRetMsg(String retMsg) {
|
|
||||||
this.retMsg = retMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生成 回调字符串
|
|
||||||
*
|
|
||||||
* @return native回调字符串
|
|
||||||
*/
|
|
||||||
@XmlTransient
|
|
||||||
@JSONField(serialize = false)
|
|
||||||
public String asReqeustXml() {
|
|
||||||
Map<String, String> map = new HashMap<String, String>();
|
|
||||||
map.put("appid", weixinAccount.getId());
|
|
||||||
map.put("appkey", weixinAccount.getPaySignKey());
|
|
||||||
map.put("timestamp", DateUtil.timestamp2string());
|
|
||||||
map.put("noncestr", RandomUtil.generateString(16));
|
|
||||||
map.put("package", getPackageInfo());
|
|
||||||
map.put("retcode", getRetCode());
|
|
||||||
map.put("reterrmsg", getRetMsg());
|
|
||||||
this.setPaySign(DigestUtil.paysignSha(map, null));
|
|
||||||
return XmlStream.toXML(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "NativePayResponseV2 [retCode=" + retCode + ", retMsg=" + retMsg
|
return "NativePayResponseV2 [retCode=" + retCode + ", retMsg=" + retMsg
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user