mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-25 10:08:16 +08:00
new:电商收付通商户、平台提现
This commit is contained in:
parent
9b20c749ce
commit
00bc9656b6
@ -69,7 +69,7 @@ public class CombineTransactionsResult implements Serializable {
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "scene_info")
|
||||
private CombineTransactionsNotifyResult.SceneInfo sceneInfo;
|
||||
private CombineTransactionsResult.SceneInfo sceneInfo;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@ -83,7 +83,7 @@ public class CombineTransactionsResult implements Serializable {
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "sub_orders")
|
||||
private List<CombineTransactionsNotifyResult.SubOrders> subOrders;
|
||||
private List<CombineTransactionsResult.SubOrders> subOrders;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@ -95,7 +95,7 @@ public class CombineTransactionsResult implements Serializable {
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "combine_payer_info")
|
||||
private CombineTransactionsNotifyResult.CombinePayerInfo combinePayerInfo;
|
||||
private CombineTransactionsResult.CombinePayerInfo combinePayerInfo;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ -248,7 +248,7 @@ public class CombineTransactionsResult implements Serializable {
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "amount")
|
||||
private CombineTransactionsNotifyResult.Amount amount;
|
||||
private CombineTransactionsResult.Amount amount;
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,89 @@
|
||||
package com.github.binarywang.wxpay.bean.ecommerce;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 二级商户账户余额提现
|
||||
* <pre>
|
||||
* 文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/combine/chapter3_3.shtml
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class EcommerceWithdrawRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:二级商户号
|
||||
* 变量名:sub_mchid
|
||||
* 是否必填:是
|
||||
* 类型:string(32)
|
||||
* 描述:
|
||||
* 电商平台二级商户号,由微信支付生成并下发。
|
||||
* 示例值:1900000109
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "sub_mchid")
|
||||
private String subMchid;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:商户提现单号
|
||||
* 变量名:out_request_no
|
||||
* 是否必填:是
|
||||
* 类型:string(32)
|
||||
* 描述:
|
||||
* 必须是字母数字
|
||||
* 示例值: 20190611222222222200000000012122
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "out_request_no")
|
||||
private String outRequestNo;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:提现金额
|
||||
* 变量名:amount
|
||||
* 是否必填:是
|
||||
* 类型:int64
|
||||
* 描述:
|
||||
* 提现金额(单位:分)
|
||||
* 示例值:100
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "amount")
|
||||
private Integer amount;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:备注
|
||||
* 变量名:remark
|
||||
* 是否必填:否
|
||||
* 类型:string(56)
|
||||
* 描述:
|
||||
* 商户对提现单的备注
|
||||
* 示例值:交易提现
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "remark")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:银行附言
|
||||
* 变量名:bank_memo
|
||||
* 是否必填:否
|
||||
* 类型:string(32)
|
||||
* 描述:
|
||||
* 展示在收款银行系统中的附言,数字、字母最长32个汉字(能否成功展示依赖银行系统支持)。
|
||||
* 示例值:微信支付提现
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "bank_memo")
|
||||
private String bankMemo;
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.github.binarywang.wxpay.bean.ecommerce;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 二级商户账户余额提现 结果
|
||||
* <pre>
|
||||
* 文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_2.shtml
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class EcommerceWithdrawResult implements Serializable {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:二级商户号
|
||||
* 变量名:sub_mchid
|
||||
* 是否必填:是
|
||||
* 类型:string(32)
|
||||
* 描述:
|
||||
* 电商平台二级商户号,由微信支付生成并下发。
|
||||
* 示例值:1900000109
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "sub_mchid")
|
||||
private String subMchid;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:微信支付提现单号
|
||||
* 变量名:withdraw_id
|
||||
* 是否必填:是
|
||||
* 类型:string(128)
|
||||
* 描述:
|
||||
* 电商平台提交二级商户提现申请后,由微信支付返回的申请单号,作为查询申请状态的唯一标识。
|
||||
* 示例值: 12321937198237912739132791732912793127931279317929791239112123
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "withdraw_id")
|
||||
private String withdrawId;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:商户提现单号
|
||||
* 变量名:out_request_no
|
||||
* 是否必填:否
|
||||
* 类型:string(32)
|
||||
* 描述:
|
||||
* 必须是字母数字
|
||||
* 示例值: 20190611222222222200000000012122
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "out_request_no")
|
||||
private String outRequestNo;
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package com.github.binarywang.wxpay.bean.ecommerce;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 电商平台提现
|
||||
* <pre>
|
||||
* 文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_5.shtml
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class MerchantWithdrawRequest implements Serializable {
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:商户提现单号
|
||||
* 变量名:out_request_no
|
||||
* 是否必填:是
|
||||
* 类型:string(32)
|
||||
* 描述:
|
||||
* 商户提现单号,由商户自定义生成。
|
||||
* 示例值:20190611222222222200000000012122
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "out_request_no")
|
||||
private String outRequestNo;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:提现金额
|
||||
* 变量名:amount
|
||||
* 是否必填:是
|
||||
* 类型:int64
|
||||
* 描述:
|
||||
* 提现金额,单位:分(RMB)
|
||||
* 示例值:1
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "amount")
|
||||
private Integer amount;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:备注
|
||||
* 变量名:remark
|
||||
* 是否必填:否
|
||||
* 类型:string(56)
|
||||
* 描述:
|
||||
* 商户对提现单的备注
|
||||
* 示例值:交易提现
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "remark")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:银行附言
|
||||
* 变量名:bank_memo
|
||||
* 是否必填:否
|
||||
* 类型:string(32)
|
||||
* 描述:
|
||||
* 展示在收款银行系统中的附言,数字、字母最长32个汉字(能否成功展示依赖银行系统支持)。
|
||||
* 示例值:xx平台提现
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "bank_memo")
|
||||
private String bankMemo;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:账户类型
|
||||
* 变量名:account_type
|
||||
* 是否必填:是
|
||||
* 类型:string(16)
|
||||
* 描述:
|
||||
* 枚举值:
|
||||
* BASIC:基本账户
|
||||
* OPERATION:运营账户
|
||||
* FEES:手续费账户
|
||||
* 示例值:BASIC
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "account_type")
|
||||
private String accountType;
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.github.binarywang.wxpay.bean.ecommerce;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 电商平台提现 结果
|
||||
* <pre>
|
||||
* 文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_5.shtml
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class MerchantWithdrawResult implements Serializable {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:微信支付提现单号
|
||||
* 变量名:withdraw_id
|
||||
* 是否必填:否 (文档里面是【否】,理论上应该都有值)
|
||||
* 类型:string(128)
|
||||
* 描述:
|
||||
* 微信支付系统生成的提现单号。
|
||||
* 示例值:12321937198237912739132791732912793127931279317929791239112123
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "withdraw_id")
|
||||
private String withdrawId;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:商户提现单号
|
||||
* 变量名:out_request_no
|
||||
* 是否必填:是
|
||||
* 类型:string(32)
|
||||
* 描述:
|
||||
* 必须是字母数字
|
||||
* 示例值: 20190611222222222200000000012122
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "out_request_no")
|
||||
private String outRequestNo;
|
||||
}
|
@ -203,7 +203,7 @@ public class PartnerTransactionsResult implements Serializable {
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "combine_payer_info")
|
||||
private PartnerTransactionsNotifyResult.CombinePayerInfo combinePayerInfo;
|
||||
private PartnerTransactionsResult.CombinePayerInfo combinePayerInfo;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@ -215,7 +215,7 @@ public class PartnerTransactionsResult implements Serializable {
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "amount")
|
||||
private PartnerTransactionsNotifyResult.Amount amount;
|
||||
private PartnerTransactionsResult.Amount amount;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@ -227,7 +227,7 @@ public class PartnerTransactionsResult implements Serializable {
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "scene_info")
|
||||
private PartnerTransactionsNotifyResult.SceneInfo sceneInfo;
|
||||
private PartnerTransactionsResult.SceneInfo sceneInfo;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@ -239,7 +239,7 @@ public class PartnerTransactionsResult implements Serializable {
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "promotion_detail")
|
||||
private List<PartnerTransactionsNotifyResult.PromotionDetail> promotionDetails;
|
||||
private List<PartnerTransactionsResult.PromotionDetail> promotionDetails;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ -507,7 +507,7 @@ public class PartnerTransactionsResult implements Serializable {
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "goods_detail")
|
||||
private List<PartnerTransactionsNotifyResult.GoodsDetail> goodsDetails;
|
||||
private List<PartnerTransactionsResult.GoodsDetail> goodsDetails;
|
||||
|
||||
|
||||
}
|
||||
|
@ -261,4 +261,27 @@ public interface EcommerceService {
|
||||
*/
|
||||
RefundsResult refunds(RefundsRequest request) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 二级商户账户余额提现API
|
||||
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_2.shtml
|
||||
* </pre>
|
||||
*
|
||||
* @param request 提现请求
|
||||
* @return 返回数据 return withdraw result
|
||||
* @throws WxPayException the wx pay exception
|
||||
*/
|
||||
EcommerceWithdrawResult withdraw(EcommerceWithdrawRequest request) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 电商平台提现API
|
||||
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_5.shtml
|
||||
* </pre>
|
||||
*
|
||||
* @param request 提现请求
|
||||
* @return 返回数据 return withdraw result
|
||||
* @throws WxPayException the wx pay exception
|
||||
*/
|
||||
MerchantWithdrawResult withdraw(MerchantWithdrawRequest request) throws WxPayException;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import java.util.Objects;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class EcommerceServiceImpl implements EcommerceService {
|
||||
|
||||
private static final Gson GSON = new GsonBuilder().create();
|
||||
private final WxPayService payService;
|
||||
|
||||
@ -201,6 +202,26 @@ public class EcommerceServiceImpl implements EcommerceService {
|
||||
return GSON.fromJson(response, RefundsResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EcommerceWithdrawResult withdraw(EcommerceWithdrawRequest request) throws WxPayException {
|
||||
String url = String.format("%s/v3/ecommerce/fund/withdraw", this.payService.getPayBaseUrl());
|
||||
String response = this.payService.postV3(url, GSON.toJson(request));
|
||||
return GSON.fromJson(response, EcommerceWithdrawResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MerchantWithdrawResult withdraw(MerchantWithdrawRequest request) throws WxPayException {
|
||||
String url = String.format("%s/v3/merchant/fund/withdraw", this.payService.getPayBaseUrl());
|
||||
String response = this.payService.postV3(url, GSON.toJson(request));
|
||||
return GSON.fromJson(response, MerchantWithdrawResult.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验通知签名
|
||||
* @param header 通知头信息
|
||||
* @param data 通知数据
|
||||
* @return true:校验通过 false:校验不通过
|
||||
*/
|
||||
private boolean verifyNotifySign(SignatureHeader header, String data) {
|
||||
String beforeSign = String.format("%s\n%s\n%s\n",
|
||||
header.getTimeStamp(),
|
||||
|
Loading…
Reference in New Issue
Block a user