mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
#392 微信支付增加企业付款到银行卡的相关接口
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
package com.github.binarywang.wxpay.bean.entpay;
|
||||
|
||||
import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.chanjar.weixin.common.annotation.Required;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 企业付款到银行卡的请求对象类
|
||||
* Created by BinaryWang on 2017/12/20.
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Builder
|
||||
@XStreamAlias("xml")
|
||||
public class EntPayBankRequest extends BaseWxPayRequest {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:商户企业付款单号
|
||||
* 变量名:partner_trade_no
|
||||
* 是否必填:是
|
||||
* 示例值:1212121221227
|
||||
* 类型:string(32)
|
||||
* 描述:商户订单号,需保持唯一(只允许数字[0~9]或字母[A~Z]和[a~z],最短8位,最长32位)
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("partner_trade_no")
|
||||
private String partnerTradeNo;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:收款方银行卡号
|
||||
* 变量名:enc_bank_no
|
||||
* 是否必填:是
|
||||
* 示例值:8609cb22e1774a50a930e414cc71eca06121bcd266335cda230d24a7886a8d9f
|
||||
* 类型:string(64)
|
||||
* 描述:收款方银行卡号(采用标准RSA算法,公钥由微信侧提供),详见获取RSA加密公钥API
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("enc_bank_no")
|
||||
private String encBankNo;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:收款方用户名
|
||||
* 变量名:enc_true_name
|
||||
* 是否必填:是
|
||||
* 示例值:ca775af5f841bdf424b2e6eb86a6e21e
|
||||
* 类型:string(64)
|
||||
* 描述:收款方用户名(采用标准RSA算法,公钥由微信侧提供)详见获取RSA加密公钥API
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("enc_true_name")
|
||||
private String encTrueName;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:收款方开户行
|
||||
* 变量名:bank_code
|
||||
* 是否必填:是
|
||||
* 示例值:1001
|
||||
* 类型:string(64)
|
||||
* 描述:银行卡所在开户行编号,详见银行编号列表
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("bank_code")
|
||||
private String bankCode;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:付款金额
|
||||
* 变量名:amount
|
||||
* 是否必填:是
|
||||
* 示例值:100000
|
||||
* 类型:int
|
||||
* 描述:付款金额:RMB分(支付总额,不含手续费) 注:大于0的整数
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("amount")
|
||||
private Integer amount;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:付款说明
|
||||
* 变量名:desc
|
||||
* 是否必填:否
|
||||
* 示例值:理财
|
||||
* 类型:string
|
||||
* 描述:企业付款到银行卡付款说明,即订单备注(UTF8编码,允许100个字符以内)
|
||||
*/
|
||||
@Required
|
||||
@XStreamAlias("desc")
|
||||
private String description;
|
||||
|
||||
@Override
|
||||
protected void checkConstraints() throws WxPayException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean ignoreAppid() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
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 2017/12/21.
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@NoArgsConstructor
|
||||
@XStreamAlias("xml")
|
||||
public class EntPayBankResult extends BaseWxPayResult {
|
||||
/**
|
||||
* 代付金额.
|
||||
*/
|
||||
@XStreamAlias("amount")
|
||||
private Integer amount;
|
||||
|
||||
/**
|
||||
* 商户企业付款单号.
|
||||
*/
|
||||
@XStreamAlias("partner_trade_no")
|
||||
private String partnerTradeNo;
|
||||
|
||||
//############以下字段在return_code 和result_code都为SUCCESS的时候有返回##############
|
||||
/**
|
||||
* 微信企业付款单号.
|
||||
* 代付成功后,返回的内部业务单号
|
||||
*/
|
||||
@XStreamAlias("payment_no")
|
||||
private String paymentNo;
|
||||
|
||||
/**
|
||||
* 手续费金额.
|
||||
* RMB:分
|
||||
*/
|
||||
@XStreamAlias("cmms_amt")
|
||||
private String cmmsAmount;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 企业付款获取RSA加密公钥接口返回结果类
|
||||
* Created by BinaryWang on 2017/12/20.
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@XStreamAlias("xml")
|
||||
public class GetPublicKeyResult extends BaseWxPayResult {
|
||||
/**
|
||||
* 商户号.
|
||||
*/
|
||||
@XStreamAlias("mch_id")
|
||||
private String mchId;
|
||||
|
||||
/**
|
||||
* 密钥
|
||||
*/
|
||||
@XStreamAlias("pub_key")
|
||||
private String pubKey;
|
||||
}
|
||||
@@ -182,6 +182,20 @@ public abstract class BaseWxPayRequest {
|
||||
return xstream.toXML(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 签名时,是否忽略signType
|
||||
*/
|
||||
protected boolean ignoreSignType() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 签名时,是否忽略appid
|
||||
*/
|
||||
protected boolean ignoreAppid() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 检查参数,并设置签名
|
||||
@@ -190,14 +204,15 @@ public abstract class BaseWxPayRequest {
|
||||
* 3、生成签名,并设置进去
|
||||
* </pre>
|
||||
*
|
||||
* @param config 支付配置对象,用于读取相应系统配置信息
|
||||
* @param isIgnoreSignType 签名时,是否忽略signType
|
||||
* @param config 支付配置对象,用于读取相应系统配置信息
|
||||
*/
|
||||
public void checkAndSign(WxPayConfig config, boolean isIgnoreSignType) throws WxPayException {
|
||||
public void checkAndSign(WxPayConfig config) throws WxPayException {
|
||||
this.checkFields();
|
||||
|
||||
if (StringUtils.isBlank(getAppid())) {
|
||||
this.setAppid(config.getAppId());
|
||||
if (!ignoreAppid()) {
|
||||
if (StringUtils.isBlank(getAppid())) {
|
||||
this.setAppid(config.getAppId());
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(getMchId())) {
|
||||
@@ -229,7 +244,6 @@ public abstract class BaseWxPayRequest {
|
||||
|
||||
//设置签名字段的值
|
||||
this.setSign(SignUtils.createSign(this, this.getSignType(), config.getMchKey(),
|
||||
isIgnoreSignType));
|
||||
this.ignoreSignType()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,11 @@ import me.chanjar.weixin.common.annotation.Required;
|
||||
@AllArgsConstructor
|
||||
@XStreamAlias("xml")
|
||||
public class WxPayQueryCommentRequest extends BaseWxPayRequest {
|
||||
@Override
|
||||
protected boolean ignoreSignType() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:开始时间
|
||||
|
||||
@@ -157,12 +157,12 @@ public class WxPayRefundRequest extends BaseWxPayRequest {
|
||||
private String refundDesc;
|
||||
|
||||
@Override
|
||||
public void checkAndSign(WxPayConfig config, boolean isIgnoreSignType) throws WxPayException {
|
||||
public void checkAndSign(WxPayConfig config) throws WxPayException {
|
||||
if (StringUtils.isBlank(this.getOpUserId())) {
|
||||
this.setOpUserId(config.getMchId());
|
||||
}
|
||||
|
||||
super.checkAndSign(config, isIgnoreSignType);
|
||||
super.checkAndSign(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -349,7 +349,7 @@ public class WxPayUnifiedOrderRequest extends BaseWxPayRequest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkAndSign(WxPayConfig config, boolean isIgnoreSignType) throws WxPayException {
|
||||
public void checkAndSign(WxPayConfig config) throws WxPayException {
|
||||
if (StringUtils.isBlank(this.getNotifyURL())) {
|
||||
this.setNotifyURL(config.getNotifyUrl());
|
||||
}
|
||||
@@ -358,7 +358,7 @@ public class WxPayUnifiedOrderRequest extends BaseWxPayRequest {
|
||||
this.setTradeType(config.getTradeType());
|
||||
}
|
||||
|
||||
super.checkAndSign(config, isIgnoreSignType);
|
||||
super.checkAndSign(config);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user