mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
#319 增加“退款结果通知“处理方法,并优化调整微信支付相关代码
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package com.github.binarywang.wxpay.bean;
|
||||
package com.github.binarywang.wxpay.bean.notify;
|
||||
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
@@ -7,8 +7,11 @@ import com.thoughtworks.xstream.annotations.XStreamOmitField;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
|
||||
|
||||
/**
|
||||
* 微信支付订单和退款的异步通知共用的响应类
|
||||
*/
|
||||
@XStreamAlias("xml")
|
||||
public class WxPayOrderNotifyResponse {
|
||||
public class WxPayNotifyResponse {
|
||||
@XStreamOmitField
|
||||
private transient static final String FAIL = "FAIL";
|
||||
@XStreamOmitField
|
||||
@@ -21,25 +24,25 @@ public class WxPayOrderNotifyResponse {
|
||||
@XStreamAlias("return_msg")
|
||||
private String returnMsg;
|
||||
|
||||
public WxPayOrderNotifyResponse() {
|
||||
public WxPayNotifyResponse() {
|
||||
super();
|
||||
}
|
||||
|
||||
public WxPayOrderNotifyResponse(String returnCode, String returnMsg) {
|
||||
public WxPayNotifyResponse(String returnCode, String returnMsg) {
|
||||
super();
|
||||
this.returnCode = returnCode;
|
||||
this.returnMsg = returnMsg;
|
||||
}
|
||||
|
||||
public static String fail(String msg) {
|
||||
WxPayOrderNotifyResponse response = new WxPayOrderNotifyResponse(FAIL, msg);
|
||||
WxPayNotifyResponse response = new WxPayNotifyResponse(FAIL, msg);
|
||||
XStream xstream = XStreamInitializer.getInstance();
|
||||
xstream.autodetectAnnotations(true);
|
||||
return xstream.toXML(response);
|
||||
}
|
||||
|
||||
public static String success(String msg) {
|
||||
WxPayOrderNotifyResponse response = new WxPayOrderNotifyResponse(SUCCESS, msg);
|
||||
WxPayNotifyResponse response = new WxPayNotifyResponse(SUCCESS, msg);
|
||||
XStream xstream = XStreamInitializer.getInstance();
|
||||
xstream.autodetectAnnotations(true);
|
||||
return xstream.toXML(response);
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.github.binarywang.wxpay.bean;
|
||||
package com.github.binarywang.wxpay.bean.notify;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.github.binarywang.wxpay.bean.result;
|
||||
package com.github.binarywang.wxpay.bean.notify;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.WxPayOrderNotifyCoupon;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayBaseResult;
|
||||
import com.github.binarywang.wxpay.converter.WxPayOrderNotifyResultConverter;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
@@ -20,7 +20,6 @@ import java.util.Map;
|
||||
*/
|
||||
@XStreamAlias("xml")
|
||||
public class WxPayOrderNotifyResult extends WxPayBaseResult implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 5389718115223345496L;
|
||||
|
||||
/**
|
||||
@@ -0,0 +1,372 @@
|
||||
package com.github.binarywang.wxpay.bean.notify;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayBaseResult;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigInteger;
|
||||
import java.security.MessageDigest;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 退款结果通知对象
|
||||
* Created by BinaryWang on 2017/8/27.
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@XStreamAlias("xml")
|
||||
public class WxPayRefundNotifyResult extends WxPayBaseResult implements Serializable {
|
||||
private static final long serialVersionUID = 4651725860079259186L;
|
||||
|
||||
/**
|
||||
* 从xml字符串创建bean对象
|
||||
*
|
||||
* @param xmlString xml字符串
|
||||
* @param mchKey 商户密钥
|
||||
*/
|
||||
public static WxPayRefundNotifyResult fromXML(String xmlString, String mchKey) throws WxPayException {
|
||||
WxPayRefundNotifyResult result = WxPayBaseResult.fromXML(xmlString, WxPayRefundNotifyResult.class);
|
||||
String reqInfoString = result.getReqInfoString();
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
|
||||
|
||||
final MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
md5.update(mchKey.getBytes());
|
||||
final String keyMd5String = new BigInteger(1, md5.digest()).toString(16).toLowerCase();
|
||||
SecretKeySpec key = new SecretKeySpec(keyMd5String.getBytes(), "AES");
|
||||
cipher.init(Cipher.DECRYPT_MODE, key);
|
||||
result.setReqInfo(ReqInfo.fromXML(new String(cipher.doFinal(Base64.decodeBase64(reqInfoString)))));
|
||||
} catch (Exception e) {
|
||||
throw new WxPayException("解密退款通知加密信息时出错", e);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:加密信息
|
||||
* 变量名:req_info
|
||||
* 是否必填:是
|
||||
* 类型:String(1024)
|
||||
* 描述:加密信息请用商户证书与商户秘钥进行解密
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("req_info")
|
||||
private String reqInfoString;
|
||||
|
||||
private ReqInfo reqInfo;
|
||||
|
||||
/**
|
||||
* 加密信息字段解密后的内容
|
||||
*/
|
||||
@XStreamAlias("root")
|
||||
public static class ReqInfo {
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringUtils.toSimpleString(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:微信订单号
|
||||
* 变量名:transaction_id
|
||||
* 是否必填:是
|
||||
* 类型:String(32)
|
||||
* 示例值:1217752501201407033233368018
|
||||
* 描述:微信订单号
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("transaction_id")
|
||||
private String transactionId;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:商户订单号
|
||||
* 变量名:out_trade_no
|
||||
* 是否必填:是
|
||||
* 类型:String(32)
|
||||
* 示例值:1217752501201407033233368018
|
||||
* 描述:商户系统内部的订单号
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("out_trade_no")
|
||||
private String outTradeNo;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:微信退款单号
|
||||
* 变量名:refund_id
|
||||
* 是否必填:是
|
||||
* 类型:String(28)
|
||||
* 示例值:1217752501201407033233368018
|
||||
* 描述:微信退款单号
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("refund_id")
|
||||
private String refundId;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:商户退款单号
|
||||
* 变量名:out_refund_no
|
||||
* 是否必填:是
|
||||
* 类型:String(64)
|
||||
* 示例值:1217752501201407033233368018
|
||||
* 描述:商户退款单号
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("out_refund_no")
|
||||
private String outRefundNo;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:订单金额
|
||||
* 变量名:total_fee
|
||||
* 是否必填:是
|
||||
* 类型:Int
|
||||
* 示例值:100
|
||||
* 描述:订单总金额,单位为分,只能为整数,详见支付金额
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("total_fee")
|
||||
private Integer totalFee;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:结订单金额
|
||||
* 变量名:settlement_total_fee
|
||||
* 是否必填:否
|
||||
* 类型:Int
|
||||
* 示例值:100
|
||||
* 描述:当该订单有使用非充值券时,返回此字段。应结订单金额=订单金额-非充值代金券金额,应结订单金额<=订单金额。
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("settlement_total_fee")
|
||||
private Integer settlementTotalFee;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:申请退款金额
|
||||
* 变量名:refund_fee
|
||||
* 是否必填:是
|
||||
* 类型:Int
|
||||
* 示例值:100
|
||||
* 描述:退款总金额,单位为分
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("refund_fee")
|
||||
private Integer refundFee;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:退款金额
|
||||
* 变量名:settlement_refund_fee
|
||||
* 是否必填:是
|
||||
* 类型:Int
|
||||
* 示例值:100
|
||||
* 描述:退款金额=申请退款金额-非充值代金券退款金额,退款金额<=申请退款金额
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("settlement_refund_fee")
|
||||
private Integer settlementRefundFee;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:退款状态
|
||||
* 变量名:refund_status
|
||||
* 是否必填:是
|
||||
* 类型:String(16)
|
||||
* 示例值:SUCCESS
|
||||
* 描述:SUCCESS-退款成功,CHANGE-退款异常,REFUNDCLOSE—退款关闭
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("refund_status")
|
||||
private String refundStatus;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:退款成功时间
|
||||
* 变量名:success_time
|
||||
* 是否必填:否
|
||||
* 类型: String(20)
|
||||
* 示例值:20160725152626
|
||||
* 描述:-
|
||||
*/
|
||||
@XStreamAlias("success_time")
|
||||
private String successTime;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:退款入账账户
|
||||
* 变量名:refund_recv_accout
|
||||
* 是否必填:是
|
||||
* 类型:String(64)
|
||||
* 示例值:招商银行信用卡0403
|
||||
* 描述:取当前退款单的退款入账方,1)退回银行卡:{银行名称}{卡类型}{卡尾号},2)退回支付用户零钱:支付用户零钱 ,3)退还商户: 商户基本账户,商户结算银行账户,4)退回支付用户零钱通: 支付用户零钱通
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("refund_recv_accout")
|
||||
private String refundRecvAccout;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:退款资金来源
|
||||
* 变量名:refund_account
|
||||
* 是否必填:是
|
||||
* 类型:String(30)
|
||||
* 示例值:REFUND_SOURCE_RECHARGE_FUNDS
|
||||
* 描述:REFUND_SOURCE_RECHARGE_FUNDS 可用余额退款/基本账户,REFUND_SOURCE_UNSETTLED_FUNDS 未结算资金退款
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("refund_account")
|
||||
private String refundAccount;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:退款发起来源
|
||||
* 变量名:refund_request_source
|
||||
* 是否必填:是
|
||||
* 类型:String(30)
|
||||
* 示例值:API
|
||||
* 描述:API接口,VENDOR_PLATFORM商户平台
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("refund_request_source")
|
||||
private String refundRequestSource;
|
||||
|
||||
public String getTransactionId() {
|
||||
return transactionId;
|
||||
}
|
||||
|
||||
public void setTransactionId(String transactionId) {
|
||||
this.transactionId = transactionId;
|
||||
}
|
||||
|
||||
public String getOutTradeNo() {
|
||||
return outTradeNo;
|
||||
}
|
||||
|
||||
public void setOutTradeNo(String outTradeNo) {
|
||||
this.outTradeNo = outTradeNo;
|
||||
}
|
||||
|
||||
public String getRefundId() {
|
||||
return refundId;
|
||||
}
|
||||
|
||||
public void setRefundId(String refundId) {
|
||||
this.refundId = refundId;
|
||||
}
|
||||
|
||||
public String getOutRefundNo() {
|
||||
return outRefundNo;
|
||||
}
|
||||
|
||||
public void setOutRefundNo(String outRefundNo) {
|
||||
this.outRefundNo = outRefundNo;
|
||||
}
|
||||
|
||||
public Integer getTotalFee() {
|
||||
return totalFee;
|
||||
}
|
||||
|
||||
public void setTotalFee(Integer totalFee) {
|
||||
this.totalFee = totalFee;
|
||||
}
|
||||
|
||||
public Integer getSettlementTotalFee() {
|
||||
return settlementTotalFee;
|
||||
}
|
||||
|
||||
public void setSettlementTotalFee(Integer settlementTotalFee) {
|
||||
this.settlementTotalFee = settlementTotalFee;
|
||||
}
|
||||
|
||||
public Integer getRefundFee() {
|
||||
return refundFee;
|
||||
}
|
||||
|
||||
public void setRefundFee(Integer refundFee) {
|
||||
this.refundFee = refundFee;
|
||||
}
|
||||
|
||||
public Integer getSettlementRefundFee() {
|
||||
return settlementRefundFee;
|
||||
}
|
||||
|
||||
public void setSettlementRefundFee(Integer settlementRefundFee) {
|
||||
this.settlementRefundFee = settlementRefundFee;
|
||||
}
|
||||
|
||||
public String getRefundStatus() {
|
||||
return refundStatus;
|
||||
}
|
||||
|
||||
public void setRefundStatus(String refundStatus) {
|
||||
this.refundStatus = refundStatus;
|
||||
}
|
||||
|
||||
public String getSuccessTime() {
|
||||
return successTime;
|
||||
}
|
||||
|
||||
public void setSuccessTime(String successTime) {
|
||||
this.successTime = successTime;
|
||||
}
|
||||
|
||||
public String getRefundRecvAccout() {
|
||||
return refundRecvAccout;
|
||||
}
|
||||
|
||||
public void setRefundRecvAccout(String refundRecvAccout) {
|
||||
this.refundRecvAccout = refundRecvAccout;
|
||||
}
|
||||
|
||||
public String getRefundAccount() {
|
||||
return refundAccount;
|
||||
}
|
||||
|
||||
public void setRefundAccount(String refundAccount) {
|
||||
this.refundAccount = refundAccount;
|
||||
}
|
||||
|
||||
public String getRefundRequestSource() {
|
||||
return refundRequestSource;
|
||||
}
|
||||
|
||||
public void setRefundRequestSource(String refundRequestSource) {
|
||||
this.refundRequestSource = refundRequestSource;
|
||||
}
|
||||
|
||||
public static ReqInfo fromXML(String xmlString) {
|
||||
XStream xstream = XStreamInitializer.getInstance();
|
||||
xstream.processAnnotations(ReqInfo.class);
|
||||
return (ReqInfo) xstream.fromXML(xmlString);
|
||||
}
|
||||
}
|
||||
|
||||
public String getReqInfoString() {
|
||||
return reqInfoString;
|
||||
}
|
||||
|
||||
public void setReqInfoString(String reqInfoString) {
|
||||
this.reqInfoString = reqInfoString;
|
||||
}
|
||||
|
||||
public ReqInfo getReqInfo() {
|
||||
return reqInfo;
|
||||
}
|
||||
|
||||
public void setReqInfo(ReqInfo reqInfo) {
|
||||
this.reqInfo = reqInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.github.binarywang.wxpay.bean.order;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* APP支付调用统一下单接口后的组装所需参数的实现类
|
||||
* 参考 https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_12
|
||||
* Created by Binary Wang on 2017-9-1.
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
public class WxPayAppOrderResult {
|
||||
private String sign;
|
||||
private String prepayId;
|
||||
private String partnerId;
|
||||
private String appId;
|
||||
private String packageValue;
|
||||
private String timeStamp;
|
||||
private String nonceStr;
|
||||
|
||||
public WxPayAppOrderResult() {
|
||||
}
|
||||
|
||||
private WxPayAppOrderResult(Builder builder) {
|
||||
setSign(builder.sign);
|
||||
setPrepayId(builder.prepayId);
|
||||
setPartnerId(builder.partnerId);
|
||||
setAppId(builder.appId);
|
||||
setPackageValue(builder.packageValue);
|
||||
setTimeStamp(builder.timeStamp);
|
||||
setNonceStr(builder.nonceStr);
|
||||
}
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public String getSign() {
|
||||
return this.sign;
|
||||
}
|
||||
|
||||
public void setSign(String sign) {
|
||||
this.sign = sign;
|
||||
}
|
||||
|
||||
public String getPrepayId() {
|
||||
return this.prepayId;
|
||||
}
|
||||
|
||||
public void setPrepayId(String prepayId) {
|
||||
this.prepayId = prepayId;
|
||||
}
|
||||
|
||||
public String getPartnerId() {
|
||||
return this.partnerId;
|
||||
}
|
||||
|
||||
public void setPartnerId(String partnerId) {
|
||||
this.partnerId = partnerId;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return this.appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getPackageValue() {
|
||||
return this.packageValue;
|
||||
}
|
||||
|
||||
public void setPackageValue(String packageValue) {
|
||||
this.packageValue = packageValue;
|
||||
}
|
||||
|
||||
public String getTimeStamp() {
|
||||
return this.timeStamp;
|
||||
}
|
||||
|
||||
public void setTimeStamp(String timeStamp) {
|
||||
this.timeStamp = timeStamp;
|
||||
}
|
||||
|
||||
public String getNonceStr() {
|
||||
return this.nonceStr;
|
||||
}
|
||||
|
||||
public void setNonceStr(String nonceStr) {
|
||||
this.nonceStr = nonceStr;
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
private String sign;
|
||||
private String prepayId;
|
||||
private String partnerId;
|
||||
private String appId;
|
||||
private String packageValue;
|
||||
private String timeStamp;
|
||||
private String nonceStr;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
public Builder sign(String sign) {
|
||||
this.sign = sign;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder prepayId(String prepayId) {
|
||||
this.prepayId = prepayId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder partnerId(String partnerId) {
|
||||
this.partnerId = partnerId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder appId(String appId) {
|
||||
this.appId = appId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder packageValue(String packageValue) {
|
||||
this.packageValue = packageValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder timeStamp(String timeStamp) {
|
||||
this.timeStamp = timeStamp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder nonceStr(String nonceStr) {
|
||||
this.nonceStr = nonceStr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WxPayAppOrderResult build() {
|
||||
return new WxPayAppOrderResult(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.github.binarywang.wxpay.bean.order;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 微信公众号支付进行统一下单后组装所需参数的类
|
||||
* 文档地址:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_7&index=6
|
||||
* Created by Binary Wang on 2017-9-1.
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
public class WxPayMpOrderResult {
|
||||
private String appId;
|
||||
private String timeStamp;
|
||||
private String nonceStr;
|
||||
/**
|
||||
* 由于package为java保留关键字,因此改为packageValue
|
||||
*/
|
||||
private String packageValue;
|
||||
private String signType;
|
||||
private String paySign;
|
||||
|
||||
private WxPayMpOrderResult(Builder builder) {
|
||||
setAppId(builder.appId);
|
||||
setTimeStamp(builder.timeStamp);
|
||||
setNonceStr(builder.nonceStr);
|
||||
setPackageValue(builder.packageValue);
|
||||
setSignType(builder.signType);
|
||||
setPaySign(builder.paySign);
|
||||
}
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return this.appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getTimeStamp() {
|
||||
return this.timeStamp;
|
||||
}
|
||||
|
||||
public void setTimeStamp(String timeStamp) {
|
||||
this.timeStamp = timeStamp;
|
||||
}
|
||||
|
||||
public String getNonceStr() {
|
||||
return this.nonceStr;
|
||||
}
|
||||
|
||||
public void setNonceStr(String nonceStr) {
|
||||
this.nonceStr = nonceStr;
|
||||
}
|
||||
|
||||
public String getPackageValue() {
|
||||
return this.packageValue;
|
||||
}
|
||||
|
||||
public void setPackageValue(String packageValue) {
|
||||
this.packageValue = packageValue;
|
||||
}
|
||||
|
||||
public String getSignType() {
|
||||
return this.signType;
|
||||
}
|
||||
|
||||
public void setSignType(String signType) {
|
||||
this.signType = signType;
|
||||
}
|
||||
|
||||
public String getPaySign() {
|
||||
return this.paySign;
|
||||
}
|
||||
|
||||
public void setPaySign(String paySign) {
|
||||
this.paySign = paySign;
|
||||
}
|
||||
|
||||
public WxPayMpOrderResult() {
|
||||
}
|
||||
|
||||
|
||||
public static final class Builder {
|
||||
private String appId;
|
||||
private String timeStamp;
|
||||
private String nonceStr;
|
||||
private String packageValue;
|
||||
private String signType;
|
||||
private String paySign;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
public Builder appId(String appId) {
|
||||
this.appId = appId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder timeStamp(String timeStamp) {
|
||||
this.timeStamp = timeStamp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder nonceStr(String nonceStr) {
|
||||
this.nonceStr = nonceStr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder packageValue(String packageValue) {
|
||||
this.packageValue = packageValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder signType(String signType) {
|
||||
this.signType = signType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder paySign(String paySign) {
|
||||
this.paySign = paySign;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WxPayMpOrderResult build() {
|
||||
return new WxPayMpOrderResult(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.github.binarywang.wxpay.bean.order;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 微信扫码支付统一下单后发起支付拼接所需参数实现类
|
||||
* Created by Binary Wang on 2017-9-1.
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
public class WxPayNativeOrderResult {
|
||||
private String codeUrl;
|
||||
|
||||
private WxPayNativeOrderResult(Builder builder) {
|
||||
setCodeUrl(builder.codeUrl);
|
||||
}
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public String getCodeUrl() {
|
||||
return this.codeUrl;
|
||||
}
|
||||
|
||||
public void setCodeUrl(String codeUrl) {
|
||||
this.codeUrl = codeUrl;
|
||||
}
|
||||
|
||||
public WxPayNativeOrderResult() {
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
private String codeUrl;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
public Builder codeUrl(String codeUrl) {
|
||||
this.codeUrl = codeUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WxPayNativeOrderResult build() {
|
||||
return new WxPayNativeOrderResult(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
/**
|
||||
* <pre>
|
||||
* 在发起微信支付前,需要调用统一下单接口,获取"预支付交易会话标识"返回的结果
|
||||
* 统一下单(详见http://com.github.binarywang.wechat.pay.bean.pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1)
|
||||
* 统一下单(详见https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1)
|
||||
* </pre>
|
||||
*
|
||||
* @author chanjarster
|
||||
|
||||
Reference in New Issue
Block a user