mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🆕 #1923 【微信支付】电商收付通增加添加、删除分账接收方等接口
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
package com.github.binarywang.wxpay.bean.ecommerce;
|
||||
|
||||
import com.github.binarywang.wxpay.v3.SpecEncrypt;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 添加分账接收方API
|
||||
* <pre>
|
||||
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/profitsharing/chapter3_7.shtml
|
||||
* </pre>
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class ProfitSharingReceiverRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:公众账号ID
|
||||
* 变量名:appid
|
||||
* 是否必填:是
|
||||
* 类型:string(32)
|
||||
* 描述:
|
||||
* 电商平台的appid(公众号APPID或者小程序APPID)
|
||||
* 示例值:wx8888888888888888
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "appid")
|
||||
private String appid;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:接收方类型
|
||||
* 变量名:type
|
||||
* 是否必填:是
|
||||
* 类型:string(32)
|
||||
* 描述:
|
||||
* 分账接收方的类型,枚举值:
|
||||
* MERCHANT_ID:商户
|
||||
* PERSONAL_OPENID:个人
|
||||
* 示例值:MERCHANT_ID
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "type")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:接收方账号
|
||||
* 变量名:account
|
||||
* 是否必填:是
|
||||
* 类型:string(64)
|
||||
* 描述:
|
||||
* 分账接收方的账号
|
||||
* 类型是MERCHANT_ID时,是商户号
|
||||
* 类型是PERSONAL_OPENID时,是个人openid,openid获取方法
|
||||
* 示例值:190001001
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "account")
|
||||
private String account;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:接收方名称
|
||||
* 变量名:name
|
||||
* 是否必填:是
|
||||
* 类型:string(256)
|
||||
* 描述:
|
||||
* 分账接收方的名称,当type为MERCHANT_ID时,接收方名称是商户全称。
|
||||
* 示例值:张三网络公司
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:接收方名称的密文
|
||||
* 变量名:encrypted_name
|
||||
* 是否必填:否
|
||||
* 类型:string(10240)
|
||||
* 描述:
|
||||
* 1、分账接收方类型是PERSONAL_OPENID时,是个人姓名的密文(选传,传则校验)
|
||||
* 此字段的加密的方式为:
|
||||
* 2、使用微信支付平台证书中的公钥
|
||||
* 3、使用RSAES-OAEP算法进行加密
|
||||
* 4、将请求中HTTP头部的Wechatpay-Serial设置为证书序列号
|
||||
* 字段加密: 使用APIv3定义的方式加密
|
||||
* 示例值:hu89ohu89ohu89o
|
||||
* </pre>
|
||||
*/
|
||||
@SpecEncrypt
|
||||
@SerializedName(value = "encrypted_name")
|
||||
private String encryptedName;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:与分账方的关系类型
|
||||
* 变量名:relation_type
|
||||
* 是否必填:是
|
||||
* 类型:string(32)
|
||||
* 描述:
|
||||
* 子商户与接收方的关系。
|
||||
* 枚举值:
|
||||
* SUPPLIER:供应商
|
||||
* DISTRIBUTOR:分销商
|
||||
* SERVICE_PROVIDER:服务商
|
||||
* PLATFORM:平台
|
||||
* OTHERS:其他
|
||||
* 示例值:SUPPLIER
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "relation_type")
|
||||
private String relationType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.github.binarywang.wxpay.bean.ecommerce;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class ProfitSharingReceiverResult implements Serializable {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:接收方类型
|
||||
* 变量名:type
|
||||
* 是否必填:是
|
||||
* 类型:string(32)
|
||||
* 描述:
|
||||
* 分账接收方的类型,枚举值:
|
||||
* MERCHANT_ID:商户
|
||||
* PERSONAL_OPENID:个人
|
||||
* 示例值:MERCHANT_ID
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "type")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:接收方账号
|
||||
* 变量名:account
|
||||
* 是否必填:是
|
||||
* 类型:string(64)
|
||||
* 描述:
|
||||
* 分账接收方的账号
|
||||
* 类型是MERCHANT_ID时,是商户号
|
||||
* 类型是PERSONAL_OPENID时,是个人openid,openid获取方法
|
||||
* 示例值:190001001
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "account")
|
||||
private String account;
|
||||
}
|
||||
@@ -251,6 +251,30 @@ public interface EcommerceService {
|
||||
*/
|
||||
ProfitSharingResult queryProfitSharing(ProfitSharingQueryRequest request) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 添加分账接收方API
|
||||
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/profitsharing/chapter3_7.shtml
|
||||
* </pre>
|
||||
*
|
||||
* @param request 添加分账接收方
|
||||
* @return 返回数据 profit sharing result
|
||||
* @throws WxPayException the wx pay exception
|
||||
*/
|
||||
ProfitSharingReceiverResult addReceivers(ProfitSharingReceiverRequest request) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 删除分账接收方API
|
||||
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/profitsharing/chapter3_8.shtml
|
||||
* </pre>
|
||||
*
|
||||
* @param request 删除分账接收方
|
||||
* @return 返回数据 profit sharing result
|
||||
* @throws WxPayException the wx pay exception
|
||||
*/
|
||||
ProfitSharingReceiverResult deleteReceivers(ProfitSharingReceiverRequest request) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 请求分账回退API
|
||||
|
||||
@@ -203,6 +203,20 @@ public class EcommerceServiceImpl implements EcommerceService {
|
||||
return GSON.fromJson(response, ProfitSharingResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProfitSharingReceiverResult addReceivers(ProfitSharingReceiverRequest request) throws WxPayException {
|
||||
String url = String.format("%s/v3/ecommerce/profitsharing/receivers/add", this.payService.getPayBaseUrl());
|
||||
String response = this.payService.postV3(url, GSON.toJson(request));
|
||||
return GSON.fromJson(response, ProfitSharingReceiverResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProfitSharingReceiverResult deleteReceivers(ProfitSharingReceiverRequest request) throws WxPayException {
|
||||
String url = String.format("%s/v3/ecommerce/profitsharing/receivers/delete", this.payService.getPayBaseUrl());
|
||||
String response = this.payService.postV3(url, GSON.toJson(request));
|
||||
return GSON.fromJson(response, ProfitSharingReceiverResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReturnOrdersResult returnOrders(ReturnOrdersRequest request) throws WxPayException {
|
||||
String url = String.format("%s/v3/ecommerce/profitsharing/returnorders", this.payService.getPayBaseUrl());
|
||||
|
||||
Reference in New Issue
Block a user