mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
企业付款相关接口抽取为一个独立的接口实现类
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
package com.github.binarywang.wxpay.bean.entpay;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.*;
|
||||
import me.chanjar.weixin.common.annotation.Required;
|
||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 企业付款请求对象
|
||||
* Created by Binary Wang on 2016/10/19.
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Builder(builderMethodName = "newBuilder")
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@XStreamAlias("xml")
|
||||
public class EntPayQueryRequest extends BaseWxPayRequest {
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:商户订单号.
|
||||
* 变量名:partner_trade_no
|
||||
* 是否必填:是
|
||||
* 示例值:10000098201411111234567890
|
||||
* 类型:String
|
||||
* 描述商户订单号
|
||||
* </pre>
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("partner_trade_no")
|
||||
private String partnerTradeNo;
|
||||
|
||||
@Override
|
||||
protected void checkConstraints() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringUtils.toSimpleString(this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.github.binarywang.wxpay.bean.entpay;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.result.BaseWxPayResult;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 企业付款查询返回结果.
|
||||
* Created by Binary Wang on 2016/10/19.
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@NoArgsConstructor
|
||||
@XStreamAlias("xml")
|
||||
public class EntPayQueryResult extends BaseWxPayResult {
|
||||
|
||||
/**
|
||||
* 商户订单号
|
||||
*/
|
||||
@XStreamAlias("partner_trade_no")
|
||||
private String partnerTradeNo;
|
||||
|
||||
/**
|
||||
* 付款单号
|
||||
*/
|
||||
@XStreamAlias("detail_id")
|
||||
private String detailId;
|
||||
|
||||
/**
|
||||
* 转账状态
|
||||
*/
|
||||
@XStreamAlias("status")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 失败原因
|
||||
*/
|
||||
@XStreamAlias("reason")
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 收款用户openid
|
||||
*/
|
||||
@XStreamAlias("openid")
|
||||
private String openid;
|
||||
|
||||
/**
|
||||
* 收款用户姓名
|
||||
*/
|
||||
@XStreamAlias("transfer_name")
|
||||
private String transferName;
|
||||
|
||||
/**
|
||||
* 付款金额
|
||||
*/
|
||||
@XStreamAlias("payment_amount")
|
||||
private Integer paymentAmount;
|
||||
|
||||
/**
|
||||
* 转账时间
|
||||
*/
|
||||
@XStreamAlias("transfer_time")
|
||||
private String transferTime;
|
||||
|
||||
/**
|
||||
* 付款描述
|
||||
*/
|
||||
@XStreamAlias("desc")
|
||||
private String desc;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
package com.github.binarywang.wxpay.bean.entpay;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.*;
|
||||
import me.chanjar.weixin.common.annotation.Required;
|
||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 企业付款请求对象.
|
||||
* Created by Binary Wang on 2016/10/02.
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Builder(builderMethodName = "newBuilder")
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@XStreamAlias("xml")
|
||||
public class EntPayRequest extends BaseWxPayRequest {
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:公众账号appid
|
||||
* 变量名:mch_appid
|
||||
* 是否必填:是
|
||||
* 示例值:wx8888888888888888
|
||||
* 类型:String
|
||||
* 描述:微信分配的公众账号ID(企业号corpid即为此appId)
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("mch_appid")
|
||||
private String mchAppid;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:商户号
|
||||
* 变量名:mchid
|
||||
* 是否必填:是
|
||||
* 示例值:1900000109
|
||||
* 类型:String(32)
|
||||
* 描述:微信支付分配的商户号
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("mchid")
|
||||
private String mchId;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:设备号
|
||||
* 变量名:device_info
|
||||
* 是否必填:否
|
||||
* 示例值:13467007045764
|
||||
* 类型:String(32)
|
||||
* 描述:微信支付分配的终端设备号
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("device_info")
|
||||
private String deviceInfo;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:商户订单号
|
||||
* 变量名:partner_trade_no
|
||||
* 是否必填:是
|
||||
* 示例值:10000098201411111234567890
|
||||
* 类型:String
|
||||
* 描述:商户订单号
|
||||
* </pre>
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("partner_trade_no")
|
||||
private String partnerTradeNo;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:需保持唯一性 用户openid
|
||||
* 变量名:openid
|
||||
* 是否必填:是
|
||||
* 示例值:oxTWIuGaIt6gTKsQRLau2M0yL16E
|
||||
* 类型:String
|
||||
* 描述:商户appid下,某用户的openid
|
||||
* </pre>
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("openid")
|
||||
private String openid;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:校验用户姓名选项
|
||||
* 变量名:check_name
|
||||
* 是否必填:是
|
||||
* 示例值:OPTION_CHECK
|
||||
* 类型:String
|
||||
* 描述:NO_CHECK:不校验真实姓名
|
||||
* FORCE_CHECK:强校验真实姓名(未实名认证的用户会校验失败,无法转账)
|
||||
* OPTION_CHECK:针对已实名认证的用户才校验真实姓名(未实名认证用户不校验,可以转账成功)
|
||||
* </pre>
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("check_name")
|
||||
private String checkName;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:收款用户姓名
|
||||
* 变量名:re_user_name
|
||||
* 是否必填:可选
|
||||
* 示例值:马花花
|
||||
* 类型:String
|
||||
* 描述:收款用户真实姓名。
|
||||
* 如果check_name设置为FORCE_CHECK或OPTION_CHECK, 则必填用户真实姓名
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("re_user_name")
|
||||
private String reUserName;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:金额
|
||||
* 变量名:amount
|
||||
* 是否必填:是
|
||||
* 示例值:10099
|
||||
* 类型:int
|
||||
* 描述:企业付款金额, 单位为分
|
||||
* </pre>
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("amount")
|
||||
private Integer amount;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:企业付款描述信息
|
||||
* 变量名:desc
|
||||
* 是否必填:是
|
||||
* 示例值:理赔
|
||||
* 类型:String
|
||||
* 描述:企业付款操作说明信息。必填。
|
||||
* </pre>
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("desc")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:Ip地址
|
||||
* 变量名:spbill_create_ip
|
||||
* 是否必填:是
|
||||
* 示例值:192.168.0.1
|
||||
* 类型:String(32)
|
||||
* 描述:调用接口的机器Ip地址
|
||||
* </pre>
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("spbill_create_ip")
|
||||
private String spbillCreateIp;
|
||||
|
||||
@Override
|
||||
protected void checkConstraints() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppid() {
|
||||
return this.mchAppid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAppid(String appid) {
|
||||
this.mchAppid = appid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMchId() {
|
||||
return this.mchId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMchId(String mchId) {
|
||||
this.mchId = mchId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringUtils.toSimpleString(this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.github.binarywang.wxpay.bean.entpay;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.result.BaseWxPayResult;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 企业付款返回结果
|
||||
* Created by Binary Wang on 2016/10/02.
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@NoArgsConstructor
|
||||
@XStreamAlias("xml")
|
||||
public class EntPayResult extends BaseWxPayResult {
|
||||
|
||||
/**
|
||||
* 商户appid
|
||||
*/
|
||||
@XStreamAlias("mch_appid")
|
||||
private String mchAppid;
|
||||
|
||||
/**
|
||||
* 设备号
|
||||
*/
|
||||
@XStreamAlias("device_info")
|
||||
private String deviceInfo;
|
||||
|
||||
//############以下字段在return_code 和result_code都为SUCCESS的时候有返回##############
|
||||
/**
|
||||
* 商户订单号
|
||||
*/
|
||||
@XStreamAlias("partner_trade_no")
|
||||
private String partnerTradeNo;
|
||||
|
||||
/**
|
||||
* 微信订单号
|
||||
*/
|
||||
@XStreamAlias("payment_no")
|
||||
private String paymentNo;
|
||||
|
||||
/**
|
||||
* 微信支付成功时间
|
||||
*/
|
||||
@XStreamAlias("payment_time")
|
||||
private String paymentTime;
|
||||
|
||||
}
|
||||
@@ -2,12 +2,12 @@ package com.github.binarywang.wxpay.bean.notify;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.result.BaseWxPayResult;
|
||||
import com.github.binarywang.wxpay.converter.WxPayOrderNotifyResultConverter;
|
||||
import com.github.binarywang.wxpay.util.SignUtils;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import me.chanjar.weixin.common.util.BeanUtils;
|
||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
|
||||
|
||||
@@ -270,7 +270,7 @@ public class WxPayOrderNotifyResult extends BaseWxPayResult implements Serializa
|
||||
|
||||
@Override
|
||||
public Map<String, String> toMap() {
|
||||
Map<String, String> resultMap = BeanUtils.xmlBean2Map(this);
|
||||
Map<String, String> resultMap = SignUtils.xmlBean2Map(this);
|
||||
if (this.getCouponCount() != null && this.getCouponCount() > 0) {
|
||||
for (int i = 0; i < this.getCouponCount(); i++) {
|
||||
WxPayOrderNotifyCoupon coupon = couponList.get(i);
|
||||
|
||||
@@ -1,54 +1,15 @@
|
||||
package com.github.binarywang.wxpay.bean.request;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayQueryRequest;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.*;
|
||||
import me.chanjar.weixin.common.annotation.Required;
|
||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 企业付款请求对象
|
||||
* 注释中各行每个字段描述对应如下:
|
||||
* <li>字段名
|
||||
* <li>变量名
|
||||
* <li>是否必填
|
||||
* <li>类型
|
||||
* <li>示例值
|
||||
* <li>描述
|
||||
* </pre>
|
||||
* Created by Binary Wang on 2016/10/19.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* 请使用 {@link EntPayQueryRequest}
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Builder(builderMethodName = "newBuilder")
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@XStreamAlias("xml")
|
||||
public class WxEntPayQueryRequest extends BaseWxPayRequest {
|
||||
/**
|
||||
* <pre>
|
||||
* 商户订单号
|
||||
* partner_trade_no
|
||||
* 是
|
||||
* 10000098201411111234567890
|
||||
* String
|
||||
* 商户订单号
|
||||
* </pre>
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("partner_trade_no")
|
||||
private String partnerTradeNo;
|
||||
|
||||
@Override
|
||||
protected void checkConstraints() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringUtils.toSimpleString(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public class WxEntPayQueryRequest extends EntPayQueryRequest {
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.github.binarywang.wxpay.bean.request;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayQueryRequest;
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.*;
|
||||
import me.chanjar.weixin.common.annotation.Required;
|
||||
@@ -8,186 +10,140 @@ import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
/**
|
||||
* <pre>
|
||||
* 企业付款请求对象
|
||||
* 请使用 {@link EntPayRequest}
|
||||
* </pre>
|
||||
* Created by Binary Wang on 2016/10/02.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Builder(builderMethodName = "newBuilder")
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@XStreamAlias("xml")
|
||||
public class WxEntPayRequest extends BaseWxPayRequest {
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:公众账号appid
|
||||
* 变量名:mch_appid
|
||||
* 是否必填:是
|
||||
* 示例值:wx8888888888888888
|
||||
* 类型:String
|
||||
* 描述:微信分配的公众账号ID(企业号corpid即为此appId)
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("mch_appid")
|
||||
private String mchAppid;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:商户号
|
||||
* 变量名:mchid
|
||||
* 是否必填:是
|
||||
* 示例值:1900000109
|
||||
* 类型:String(32)
|
||||
* 描述:微信支付分配的商户号
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("mchid")
|
||||
private String mchId;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:设备号
|
||||
* 变量名:device_info
|
||||
* 是否必填:否
|
||||
* 示例值:13467007045764
|
||||
* 类型:String(32)
|
||||
* 描述:微信支付分配的终端设备号
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("device_info")
|
||||
private String deviceInfo;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:商户订单号
|
||||
* 变量名:partner_trade_no
|
||||
* 是否必填:是
|
||||
* 示例值:10000098201411111234567890
|
||||
* 类型:String
|
||||
* 描述:商户订单号
|
||||
* </pre>
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("partner_trade_no")
|
||||
private String partnerTradeNo;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:需保持唯一性 用户openid
|
||||
* 变量名:openid
|
||||
* 是否必填:是
|
||||
* 示例值:oxTWIuGaIt6gTKsQRLau2M0yL16E
|
||||
* 类型:String
|
||||
* 描述:商户appid下,某用户的openid
|
||||
* </pre>
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("openid")
|
||||
private String openid;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:校验用户姓名选项
|
||||
* 变量名:check_name
|
||||
* 是否必填:是
|
||||
* 示例值:OPTION_CHECK
|
||||
* 类型:String
|
||||
* 描述:NO_CHECK:不校验真实姓名
|
||||
* FORCE_CHECK:强校验真实姓名(未实名认证的用户会校验失败,无法转账)
|
||||
* OPTION_CHECK:针对已实名认证的用户才校验真实姓名(未实名认证用户不校验,可以转账成功)
|
||||
* </pre>
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("check_name")
|
||||
private String checkName;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:收款用户姓名
|
||||
* 变量名:re_user_name
|
||||
* 是否必填:可选
|
||||
* 示例值:马花花
|
||||
* 类型:String
|
||||
* 描述:收款用户真实姓名。
|
||||
* 如果check_name设置为FORCE_CHECK或OPTION_CHECK, 则必填用户真实姓名
|
||||
* </pre>
|
||||
*/
|
||||
@XStreamAlias("re_user_name")
|
||||
private String reUserName;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:金额
|
||||
* 变量名:amount
|
||||
* 是否必填:是
|
||||
* 示例值:10099
|
||||
* 类型:int
|
||||
* 描述:企业付款金额, 单位为分
|
||||
* </pre>
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("amount")
|
||||
private Integer amount;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:企业付款描述信息
|
||||
* 变量名:desc
|
||||
* 是否必填:是
|
||||
* 示例值:理赔
|
||||
* 类型:String
|
||||
* 描述:企业付款操作说明信息。必填。
|
||||
* </pre>
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("desc")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:Ip地址
|
||||
* 变量名:spbill_create_ip
|
||||
* 是否必填:是
|
||||
* 示例值:192.168.0.1
|
||||
* 类型:String(32)
|
||||
* 描述:调用接口的机器Ip地址
|
||||
* </pre>
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("spbill_create_ip")
|
||||
private String spbillCreateIp;
|
||||
|
||||
@Override
|
||||
protected void checkConstraints() {
|
||||
@Deprecated
|
||||
public class WxEntPayRequest extends EntPayRequest {
|
||||
|
||||
private WxEntPayRequest(Builder builder) {
|
||||
setAppid(builder.appid);
|
||||
setMchId(builder.mchId);
|
||||
setSubAppId(builder.subAppId);
|
||||
setSubMchId(builder.subMchId);
|
||||
setNonceStr(builder.nonceStr);
|
||||
setSign(builder.sign);
|
||||
setSignType(builder.signType);
|
||||
setMchAppid(builder.mchAppid);
|
||||
setMchId(builder.mchId);
|
||||
setDeviceInfo(builder.deviceInfo);
|
||||
setPartnerTradeNo(builder.partnerTradeNo);
|
||||
setOpenid(builder.openid);
|
||||
setCheckName(builder.checkName);
|
||||
setReUserName(builder.reUserName);
|
||||
setAmount(builder.amount);
|
||||
setDescription(builder.description);
|
||||
setSpbillCreateIp(builder.spbillCreateIp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppid() {
|
||||
return this.mchAppid;
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAppid(String appid) {
|
||||
this.mchAppid = appid;
|
||||
}
|
||||
public static final class Builder {
|
||||
private String appid;
|
||||
private String mchId;
|
||||
private String deviceInfo;
|
||||
private String partnerTradeNo;
|
||||
private String openid;
|
||||
private String checkName;
|
||||
private String reUserName;
|
||||
private Integer amount;
|
||||
private String description;
|
||||
private String spbillCreateIp;
|
||||
private String subAppId;
|
||||
private String subMchId;
|
||||
private String nonceStr;
|
||||
private String sign;
|
||||
private String signType;
|
||||
private String mchAppid;
|
||||
|
||||
@Override
|
||||
public String getMchId() {
|
||||
return this.mchId;
|
||||
}
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMchId(String mchId) {
|
||||
this.mchId = mchId;
|
||||
}
|
||||
public Builder appid(String appid) {
|
||||
this.appid = appid;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringUtils.toSimpleString(this);
|
||||
}
|
||||
public Builder mchId(String mchId) {
|
||||
this.mchId = mchId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder deviceInfo(String deviceInfo) {
|
||||
this.deviceInfo = deviceInfo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder partnerTradeNo(String partnerTradeNo) {
|
||||
this.partnerTradeNo = partnerTradeNo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder openid(String openid) {
|
||||
this.openid = openid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder checkName(String checkName) {
|
||||
this.checkName = checkName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder reUserName(String reUserName) {
|
||||
this.reUserName = reUserName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder amount(Integer amount) {
|
||||
this.amount = amount;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder description(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder spbillCreateIp(String spbillCreateIp) {
|
||||
this.spbillCreateIp = spbillCreateIp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WxEntPayRequest build() {
|
||||
return new WxEntPayRequest(this);
|
||||
}
|
||||
|
||||
public Builder subAppId(String subAppId) {
|
||||
this.subAppId = subAppId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder subMchId(String subMchId) {
|
||||
this.subMchId = subMchId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder nonceStr(String nonceStr) {
|
||||
this.nonceStr = nonceStr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder sign(String sign) {
|
||||
this.sign = sign;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder signType(String signType) {
|
||||
this.signType = signType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder mchAppid(String mchAppid) {
|
||||
this.mchAppid = mchAppid;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.github.binarywang.wxpay.bean.result;
|
||||
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import com.github.binarywang.wxpay.service.impl.BaseWxPayServiceImpl;
|
||||
import com.github.binarywang.wxpay.util.SignUtils;
|
||||
import com.google.common.base.Joiner;
|
||||
@@ -219,7 +220,7 @@ public abstract class BaseWxPayResult {
|
||||
* @param signType 签名类型
|
||||
* @param checkSuccess 是否同时检查结果是否成功
|
||||
*/
|
||||
public void checkResult(BaseWxPayServiceImpl wxPayService, String signType, boolean checkSuccess) throws WxPayException {
|
||||
public void checkResult(WxPayService wxPayService, String signType, boolean checkSuccess) throws WxPayException {
|
||||
//校验返回结果签名
|
||||
Map<String, String> map = toMap();
|
||||
if (getSign() != null && !SignUtils.checkSign(map, signType, wxPayService.getConfig().getMchKey())) {
|
||||
|
||||
@@ -1,74 +1,27 @@
|
||||
package com.github.binarywang.wxpay.bean.result;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayQueryResult;
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayResult;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
|
||||
/**
|
||||
* 企业付款查询返回结果
|
||||
* Created by Binary Wang on 2016/10/19.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* 请使用{@link EntPayQueryResult}
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@NoArgsConstructor
|
||||
@XStreamAlias("xml")
|
||||
public class WxEntPayQueryResult extends BaseWxPayResult {
|
||||
|
||||
/**
|
||||
* 商户订单号
|
||||
*/
|
||||
@XStreamAlias("partner_trade_no")
|
||||
private String partnerTradeNo;
|
||||
|
||||
/**
|
||||
* 付款单号
|
||||
*/
|
||||
@XStreamAlias("detail_id")
|
||||
private String detailId;
|
||||
|
||||
/**
|
||||
* 转账状态
|
||||
*/
|
||||
@XStreamAlias("status")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 失败原因
|
||||
*/
|
||||
@XStreamAlias("reason")
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 收款用户openid
|
||||
*/
|
||||
@XStreamAlias("openid")
|
||||
private String openid;
|
||||
|
||||
/**
|
||||
* 收款用户姓名
|
||||
*/
|
||||
@XStreamAlias("transfer_name")
|
||||
private String transferName;
|
||||
|
||||
/**
|
||||
* 付款金额
|
||||
*/
|
||||
@XStreamAlias("payment_amount")
|
||||
private Integer paymentAmount;
|
||||
|
||||
/**
|
||||
* 转账时间
|
||||
*/
|
||||
@XStreamAlias("transfer_time")
|
||||
private String transferTime;
|
||||
|
||||
/**
|
||||
* 付款描述
|
||||
*/
|
||||
@XStreamAlias("desc")
|
||||
private String desc;
|
||||
|
||||
@Deprecated
|
||||
public class WxEntPayQueryResult extends EntPayQueryResult {
|
||||
public static WxEntPayQueryResult createFrom(EntPayQueryResult entPayQueryResult) {
|
||||
WxEntPayQueryResult result = new WxEntPayQueryResult();
|
||||
try {
|
||||
BeanUtils.copyProperties(result, entPayQueryResult);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,51 +1,25 @@
|
||||
package com.github.binarywang.wxpay.bean.result;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.entpay.EntPayResult;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
/**
|
||||
* 企业付款返回结果
|
||||
* Created by Binary Wang on 2016/10/02.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* 请使用{@link EntPayResult}
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@NoArgsConstructor
|
||||
@XStreamAlias("xml")
|
||||
public class WxEntPayResult extends BaseWxPayResult {
|
||||
|
||||
/**
|
||||
* 商户appid
|
||||
*/
|
||||
@XStreamAlias("mch_appid")
|
||||
private String mchAppid;
|
||||
|
||||
/**
|
||||
* 设备号
|
||||
*/
|
||||
@XStreamAlias("device_info")
|
||||
private String deviceInfo;
|
||||
|
||||
//############以下字段在return_code 和result_code都为SUCCESS的时候有返回##############
|
||||
/**
|
||||
* 商户订单号
|
||||
*/
|
||||
@XStreamAlias("partner_trade_no")
|
||||
private String partnerTradeNo;
|
||||
|
||||
/**
|
||||
* 微信订单号
|
||||
*/
|
||||
@XStreamAlias("payment_no")
|
||||
private String paymentNo;
|
||||
|
||||
/**
|
||||
* 微信支付成功时间
|
||||
*/
|
||||
@XStreamAlias("payment_time")
|
||||
private String paymentTime;
|
||||
|
||||
@Deprecated
|
||||
public class WxEntPayResult extends EntPayResult {
|
||||
public static WxEntPayResult createFrom(EntPayResult entPayResult) {
|
||||
WxEntPayResult result = new WxEntPayResult();
|
||||
try {
|
||||
BeanUtils.copyProperties(result, entPayResult);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user