mirror of
https://github.com/dromara/payment-spring-boot.git
synced 2026-03-13 21:33:41 +08:00
feat: 服务商V3分账
This commit is contained in:
@@ -605,6 +605,12 @@ public enum WechatPayV3Type {
|
||||
* @since 1.0.11.RELEASE
|
||||
*/
|
||||
PROFITSHARING_AMOUNTS(HttpMethod.GET, "%s/v3/profitsharing/transactions/{transaction_id}/amounts"),
|
||||
/**
|
||||
* 服务商专用-查询最大分账比例API.
|
||||
*
|
||||
* @since 1.0.11.RELEASE
|
||||
*/
|
||||
PROFITSHARING_MCH_CONFIG(HttpMethod.GET, "%s/v3/profitsharing/merchant-configs/{sub_mchid}"),
|
||||
/**
|
||||
* 添加分账接收方API.
|
||||
*
|
||||
|
||||
@@ -123,7 +123,7 @@ public class WechatApiProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量转账到零钱.
|
||||
* 批量转账到零钱.
|
||||
* <p>
|
||||
* 批量转账到零钱提供商户同时向多个用户微信零钱转账的能力。商户可以使用批量转账到零钱用于费用报销、员工福利发放、合作伙伴货款或服务款项支付等场景,提高转账效率。
|
||||
*
|
||||
@@ -193,4 +193,23 @@ public class WechatApiProvider {
|
||||
return new WechatAllocationApi(wechatV2Client);
|
||||
}
|
||||
|
||||
/**
|
||||
* 直连商户微信支付分账,基于V3
|
||||
*
|
||||
* @param tenantId the tenant id
|
||||
* @return the wechat profitsharing api
|
||||
*/
|
||||
public WechatProfitsharingApi profitsharingApi(String tenantId) {
|
||||
return new WechatProfitsharingApi(wechatPayClient, tenantId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务商微信支付分账,基于V3
|
||||
*
|
||||
* @param tenantId the tenant id
|
||||
* @return the wechat partner profitsharing api
|
||||
*/
|
||||
public WechatPartnerProfitsharingApi partnerProfitsharingApi(String tenantId) {
|
||||
return new WechatPartnerProfitsharingApi(wechatPayClient, tenantId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public class WechatBatchTransferApi extends AbstractApi {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
this.client().withType(WechatPayV3Type.BATCH_TRANSFER_DETAIL_WECHAT, queryBatchTransferDetailParams)
|
||||
.function((type, params) -> {
|
||||
Map<String, String> queryParams = new HashMap<>();
|
||||
Map<String, String> queryParams = new HashMap<>(2);
|
||||
queryParams.put("batch_id", params.getBatchIdOrOutBatchNo());
|
||||
queryParams.put("detail_id", params.getDetailIdOrOutDetailNo());
|
||||
|
||||
@@ -195,7 +195,7 @@ public class WechatBatchTransferApi extends AbstractApi {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
this.client().withType(WechatPayV3Type.BATCH_TRANSFER_DETAIL_MCH, queryBatchTransferDetailParams)
|
||||
.function((type, params) -> {
|
||||
Map<String, String> queryParams = new HashMap<>();
|
||||
Map<String, String> queryParams = new HashMap<>(2);
|
||||
queryParams.put("batch_id", params.getBatchIdOrOutBatchNo());
|
||||
queryParams.put("detail_id", params.getDetailIdOrOutDetailNo());
|
||||
|
||||
|
||||
@@ -353,9 +353,9 @@ public class WechatMarketingFavorApi extends AbstractApi {
|
||||
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
queryParams.add("appid", v3.getAppId());
|
||||
|
||||
MultiValueMap<String, String> pathParams = new LinkedMultiValueMap<>();
|
||||
pathParams.add("openid", params.getOpenId());
|
||||
pathParams.add("coupon_id", params.getCouponId());
|
||||
Map<String, String> pathParams = new HashMap<>(2);
|
||||
pathParams.put("openid", params.getOpenId());
|
||||
pathParams.put("coupon_id", params.getCouponId());
|
||||
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
|
||||
.queryParams(queryParams)
|
||||
.build()
|
||||
|
||||
@@ -0,0 +1,318 @@
|
||||
package cn.felord.payment.wechat.v3;
|
||||
|
||||
import cn.felord.payment.wechat.WechatPayProperties;
|
||||
import cn.felord.payment.wechat.enumeration.WeChatServer;
|
||||
import cn.felord.payment.wechat.enumeration.WechatPayV3Type;
|
||||
import cn.felord.payment.wechat.v3.model.profitsharing.*;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import java.net.URI;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 微信V3服务商分账
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.11.RELEASE
|
||||
*/
|
||||
public class WechatPartnerProfitsharingApi extends AbstractApi {
|
||||
|
||||
/**
|
||||
* Instantiates a new Abstract api.
|
||||
*
|
||||
* @param wechatPayClient the wechat pay client
|
||||
* @param tenantId the tenant id
|
||||
*/
|
||||
public WechatPartnerProfitsharingApi(WechatPayClient wechatPayClient, String tenantId) {
|
||||
super(wechatPayClient, tenantId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求分账API
|
||||
* <p>
|
||||
* 微信订单支付成功后,商户发起分账请求,将结算后的资金分到分账接收方
|
||||
* <p>
|
||||
* 注意:
|
||||
* <ul>
|
||||
* <li>对同一笔订单最多能发起20次分账请求,每次请求最多分给50个接收方</li>
|
||||
* <li>此接口采用异步处理模式,即在接收到商户请求后,优先受理请求再异步处理,最终的分账结果可以通过查询分账接口获取</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param profitSharingOrder the profit sharing order
|
||||
* @return the wechat response entity
|
||||
*/
|
||||
public WechatResponseEntity<ObjectNode> profitsharingOrders(PartnerProfitSharingOrder profitSharingOrder) {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
this.client().withType(WechatPayV3Type.PROFITSHARING_ORDERS, profitSharingOrder)
|
||||
.function((wechatPayV3Type, params) -> {
|
||||
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
|
||||
SignatureProvider signatureProvider = this.client().signatureProvider();
|
||||
X509WechatCertificateInfo certificate = signatureProvider.getCertificate();
|
||||
final X509Certificate x509Certificate = certificate.getX509Certificate();
|
||||
params.setAppid(v3.getAppId());
|
||||
List<Receiver> receivers = params.getReceivers();
|
||||
if (!CollectionUtils.isEmpty(receivers)) {
|
||||
List<Receiver> encrypted = receivers.stream()
|
||||
.peek(receiversItem -> {
|
||||
String name = receiversItem.getName();
|
||||
if (StringUtils.hasText(name)) {
|
||||
String encryptedName = signatureProvider.encryptRequestMessage(name, x509Certificate);
|
||||
receiversItem.setName(encryptedName);
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
params.setReceivers(encrypted);
|
||||
}
|
||||
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
|
||||
.build()
|
||||
.toUri();
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
httpHeaders.add("Wechatpay-Serial", certificate.getWechatPaySerial());
|
||||
return Post(uri, params, httpHeaders);
|
||||
})
|
||||
.consumer(wechatResponseEntity::convert)
|
||||
.request();
|
||||
return wechatResponseEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分账结果API
|
||||
* <p>
|
||||
* 发起分账请求后,可调用此接口查询分账结果
|
||||
* <p>
|
||||
* 注意:
|
||||
* <ul>
|
||||
* <li>发起解冻剩余资金请求后,可调用此接口查询解冻剩余资金的结果</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param queryOrderParams the query order params
|
||||
* @return the wechat response entity
|
||||
*/
|
||||
public WechatResponseEntity<ObjectNode> queryProfitsharingOrder(PartnerQueryOrderParams queryOrderParams) {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
this.client().withType(WechatPayV3Type.PROFITSHARING_ORDERS_RESULT, queryOrderParams)
|
||||
.function((wechatPayV3Type, params) -> {
|
||||
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
queryParams.add("transaction_id", params.getTransactionId());
|
||||
Optional.ofNullable(params.getSubMchid())
|
||||
.ifPresent(mchId -> queryParams.add("sub_mchid", params.getSubMchid()));
|
||||
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
|
||||
.queryParams(queryParams)
|
||||
.build()
|
||||
.expand(params.getOutOrderNo())
|
||||
.toUri();
|
||||
return Get(uri);
|
||||
})
|
||||
.consumer(wechatResponseEntity::convert)
|
||||
.request();
|
||||
return wechatResponseEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求分账回退API
|
||||
* <p>
|
||||
* 如果订单已经分账,在退款时,可以先调此接口,将已分账的资金从分账接收方的账户回退给分账方,再发起退款
|
||||
* <p>
|
||||
* 注意:
|
||||
* <ul>
|
||||
* <li>分账回退以原分账单为依据,支持多次回退,申请回退总金额不能超过原分账单分给该接收方的金额</li>
|
||||
* <li>此接口采用同步处理模式,即在接收到商户请求后,会实时返回处理结果</li>
|
||||
* <li>对同一笔分账单最多能发起20次分账回退请求</li>
|
||||
* <li>退款和分账回退没有耦合,分账回退可以先于退款请求,也可以后于退款请求</li>
|
||||
* <li>此功能需要接收方在商户平台-交易中心-分账-分账接收设置下,开启同意分账回退后,才能使用</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param returnOrdersParams the return orders params
|
||||
* @return the wechat response entity
|
||||
*/
|
||||
public WechatResponseEntity<ObjectNode> returnOrders(PartnerReturnOrdersParams returnOrdersParams) {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
this.client().withType(WechatPayV3Type.PROFITSHARING_RETURN_ORDERS, returnOrdersParams)
|
||||
.function((wechatPayV3Type, params) -> {
|
||||
|
||||
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
|
||||
.build()
|
||||
.toUri();
|
||||
return Post(uri, params);
|
||||
})
|
||||
.consumer(wechatResponseEntity::convert)
|
||||
.request();
|
||||
return wechatResponseEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分账回退结果API
|
||||
* <p>
|
||||
* 商户需要核实回退结果,可调用此接口查询回退结果
|
||||
* <p>
|
||||
* 注意:
|
||||
* <ul>
|
||||
* <li>如果分账回退接口返回状态为处理中,可调用此接口查询回退结果</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param queryReturnOrderParams the query return order params
|
||||
* @return the wechat response entity
|
||||
*/
|
||||
public WechatResponseEntity<ObjectNode> queryReturnOrders(PartnerQueryReturnOrderParams queryReturnOrderParams) {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
this.client().withType(WechatPayV3Type.PROFITSHARING_RETURN_ORDERS_RESULT, queryReturnOrderParams)
|
||||
.function((wechatPayV3Type, params) -> {
|
||||
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
queryParams.add("out_order_no", params.getOutOrderNo());
|
||||
Optional.ofNullable(params.getSubMchid())
|
||||
.ifPresent(mchId -> queryParams.add("sub_mchid", params.getSubMchid()));
|
||||
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
|
||||
.queryParams(queryParams)
|
||||
.build()
|
||||
.expand(params.getOutReturnNo())
|
||||
.toUri();
|
||||
return Get(uri);
|
||||
})
|
||||
.consumer(wechatResponseEntity::convert)
|
||||
.request();
|
||||
return wechatResponseEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解冻剩余资金API
|
||||
* <p>
|
||||
* 不需要进行分账的订单,可直接调用本接口将订单的金额全部解冻给特约商户
|
||||
* <p>
|
||||
* 注意:
|
||||
* <ul>
|
||||
* <li>调用分账接口后,需要解冻剩余资金时,调用本接口将剩余的分账金额全部解冻给特约商户</li>
|
||||
* <li>此接口采用异步处理模式,即在接收到商户请求后,优先受理请求再异步处理,最终的分账结果可以通过查询分账接口获取</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param unfreezeParams the unfreeze params
|
||||
* @return the wechat response entity
|
||||
*/
|
||||
public WechatResponseEntity<ObjectNode> unfreeze(PartnerUnfreezeParams unfreezeParams) {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
this.client().withType(WechatPayV3Type.PROFITSHARING_ORDERS_UNFREEZE, unfreezeParams)
|
||||
.function((wechatPayV3Type, params) -> {
|
||||
|
||||
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
|
||||
.build()
|
||||
.toUri();
|
||||
return Post(uri, params);
|
||||
})
|
||||
.consumer(wechatResponseEntity::convert)
|
||||
.request();
|
||||
return wechatResponseEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询剩余待分金额API
|
||||
* <p>
|
||||
* 可调用此接口查询订单剩余待分金额
|
||||
*
|
||||
* @param transactionId the transaction id
|
||||
* @return the wechat response entity
|
||||
*/
|
||||
public WechatResponseEntity<ObjectNode> queryAmounts(String transactionId) {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
this.client().withType(WechatPayV3Type.PROFITSHARING_AMOUNTS, transactionId)
|
||||
.function((wechatPayV3Type, id) -> {
|
||||
|
||||
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
|
||||
.build()
|
||||
.expand(id)
|
||||
.toUri();
|
||||
return Get(uri);
|
||||
})
|
||||
.consumer(wechatResponseEntity::convert)
|
||||
.request();
|
||||
return wechatResponseEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* (服务商)查询剩余待分金额API
|
||||
* <p>
|
||||
* 可调用此接口查询订单剩余待分金额
|
||||
*
|
||||
* @param subMchid the sub mchid
|
||||
* @return the wechat response entity
|
||||
*/
|
||||
public WechatResponseEntity<ObjectNode> queryMchConfigs(String subMchid) {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
this.client().withType(WechatPayV3Type.PROFITSHARING_MCH_CONFIG, subMchid)
|
||||
.function((wechatPayV3Type, id) -> {
|
||||
|
||||
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
|
||||
.build()
|
||||
.expand(id)
|
||||
.toUri();
|
||||
return Get(uri);
|
||||
})
|
||||
.consumer(wechatResponseEntity::convert)
|
||||
.request();
|
||||
return wechatResponseEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加分账接收方API
|
||||
* <p>
|
||||
* 商户发起添加分账接收方请求,建立分账接收方列表。后续可通过发起分账请求,将分账方商户结算后的资金,分到该分账接收方
|
||||
*
|
||||
* @param addReceiversParams the add receivers params
|
||||
* @return wechat response entity
|
||||
*/
|
||||
public WechatResponseEntity<ObjectNode> addReceivers(PartnerAddReceiversParams addReceiversParams) {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
this.client().withType(WechatPayV3Type.PROFITSHARING_RECEIVERS_ADD, addReceiversParams)
|
||||
.function((wechatPayV3Type, params) -> {
|
||||
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
|
||||
SignatureProvider signatureProvider = this.client().signatureProvider();
|
||||
X509WechatCertificateInfo certificate = signatureProvider.getCertificate();
|
||||
final X509Certificate x509Certificate = certificate.getX509Certificate();
|
||||
params.setAppid(v3.getAppId());
|
||||
String name = params.getName();
|
||||
if (StringUtils.hasText(name)) {
|
||||
String encryptedName = signatureProvider.encryptRequestMessage(name, x509Certificate);
|
||||
params.setName(encryptedName);
|
||||
}
|
||||
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
|
||||
.build()
|
||||
.toUri();
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
httpHeaders.add("Wechatpay-Serial", certificate.getWechatPaySerial());
|
||||
return Post(uri, params, httpHeaders);
|
||||
})
|
||||
.consumer(wechatResponseEntity::convert)
|
||||
.request();
|
||||
return wechatResponseEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分账接收方API
|
||||
* <p>
|
||||
* 商户发起删除分账接收方请求。删除后,不支持将分账方商户结算后的资金,分到该分账接收方
|
||||
*
|
||||
* @param delReceiversParams the del receivers params
|
||||
* @return the wechat response entity
|
||||
*/
|
||||
public WechatResponseEntity<ObjectNode> deleteReceivers(PartnerDelReceiversParams delReceiversParams) {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
this.client().withType(WechatPayV3Type.PROFITSHARING_RECEIVERS_DELETE, delReceiversParams)
|
||||
.function((wechatPayV3Type, params) -> {
|
||||
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
|
||||
params.setAppid(v3.getAppId());
|
||||
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
|
||||
.build()
|
||||
.toUri();
|
||||
return Post(uri, params);
|
||||
})
|
||||
.consumer(wechatResponseEntity::convert)
|
||||
.request();
|
||||
return wechatResponseEntity;
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,8 @@ import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 微信支付分API.
|
||||
@@ -63,10 +65,10 @@ public class WechatPayScoreApi extends AbstractApi {
|
||||
.function((wechatPayV3Type, userServiceStateParams) -> {
|
||||
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
|
||||
|
||||
MultiValueMap<String, String> expandParams = new LinkedMultiValueMap<>();
|
||||
expandParams.add("appid", v3.getAppId());
|
||||
expandParams.add("service_id", params.getServiceId());
|
||||
expandParams.add("openid", params.getOpenId());
|
||||
Map<String, String> expandParams = new HashMap<>(3);
|
||||
expandParams.put("appid", v3.getAppId());
|
||||
expandParams.put("service_id", params.getServiceId());
|
||||
expandParams.put("openid", params.getOpenId());
|
||||
|
||||
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
|
||||
.build()
|
||||
|
||||
@@ -4,7 +4,7 @@ import cn.felord.payment.wechat.enumeration.ReceiverType;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 添加分账接收方API-请求参数
|
||||
* 直连商户-添加分账接收方API-请求参数
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.11.RELEASE
|
||||
|
||||
@@ -4,7 +4,7 @@ import cn.felord.payment.wechat.enumeration.ReceiverType;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 删除分账接收方API-请求参数
|
||||
* 直连商户-删除分账接收方API-请求参数
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.11.RELEASE
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
package cn.felord.payment.wechat.v3.model.profitsharing;
|
||||
|
||||
import cn.felord.payment.wechat.enumeration.ReceiverType;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 服务商-添加分账接收方API-请求参数
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.11.RELEASE
|
||||
*/
|
||||
@Data
|
||||
public class PartnerAddReceiversParams {
|
||||
/**
|
||||
* 子商户号,选填
|
||||
*/
|
||||
private String subMchid;
|
||||
/**
|
||||
* 应用ID,自动注入
|
||||
*/
|
||||
private String appid;
|
||||
/**
|
||||
* 子商户应用ID,选填
|
||||
* <p>
|
||||
* 分账接收方类型包含{@code PERSONAL_SUB_OPENID}时必填
|
||||
*/
|
||||
private String subAppid;
|
||||
/**
|
||||
* 分账接收方类型,必填
|
||||
*/
|
||||
private ReceiverType type;
|
||||
/**
|
||||
* 分账接收方帐号,必填
|
||||
*/
|
||||
private String account;
|
||||
/**
|
||||
* 分账个人接收方姓名,选填
|
||||
* <p>
|
||||
* 分账接收方类型是{@code MERCHANT_ID}时,是商户全称(必传),当商户是小微商户或个体户时,是开户人姓名 分账接收方类型是{@code PERSONAL_OPENID}时,是个人姓名(选传,传则校验)
|
||||
* <ol>
|
||||
* <li>分账接收方类型是{@code PERSONAL_OPENID},是个人姓名的密文(选传,传则校验) 此字段的加密方法详见:敏感信息加密说明</li>
|
||||
* <li>使用微信支付平台证书中的公钥</li>
|
||||
* <li>使用RSAES-OAEP算法进行加密</li>
|
||||
* <li>将请求中HTTP头部的Wechatpay-Serial设置为证书序列号</li>
|
||||
* </ol>
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 与分账方的关系类型,必填
|
||||
*/
|
||||
private RelationType relationType;
|
||||
/**
|
||||
* 自定义的分账关系,选填
|
||||
*/
|
||||
private String customRelation;
|
||||
|
||||
/**
|
||||
* 子商户与接收方的关系
|
||||
*/
|
||||
public enum RelationType {
|
||||
/**
|
||||
* 门店.
|
||||
*/
|
||||
STORE,
|
||||
/**
|
||||
* 员工.
|
||||
*/
|
||||
STAFF,
|
||||
/**
|
||||
* 店主.
|
||||
*/
|
||||
STORE_OWNER,
|
||||
/**
|
||||
* 合作伙伴.
|
||||
*/
|
||||
PARTNER,
|
||||
/**
|
||||
* 总部.
|
||||
*/
|
||||
HEADQUARTER,
|
||||
/**
|
||||
* 品牌方.
|
||||
*/
|
||||
BRAND,
|
||||
/**
|
||||
* 分销商.
|
||||
*/
|
||||
DISTRIBUTOR,
|
||||
/**
|
||||
* 用户.
|
||||
*/
|
||||
USER,
|
||||
/**
|
||||
* 供应商.
|
||||
*/
|
||||
SUPPLIER,
|
||||
/**
|
||||
* 自定义.
|
||||
*/
|
||||
CUSTOM
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package cn.felord.payment.wechat.v3.model.profitsharing;
|
||||
|
||||
import cn.felord.payment.wechat.enumeration.ReceiverType;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 服务商-删除分账接收方API-请求参数
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.11.RELEASE
|
||||
*/
|
||||
@Data
|
||||
public class PartnerDelReceiversParams {
|
||||
/**
|
||||
* 子商户号,选填
|
||||
*/
|
||||
private String subMchid;
|
||||
/**
|
||||
* 应用ID,自动注入
|
||||
*/
|
||||
private String appid;
|
||||
/**
|
||||
* 子商户应用ID,选填
|
||||
* <p>
|
||||
* 分账接收方类型包含{@code PERSONAL_SUB_OPENID}时必填
|
||||
*/
|
||||
private String subAppid;
|
||||
/**
|
||||
* 分账接收方类型,必填
|
||||
*/
|
||||
private ReceiverType type;
|
||||
/**
|
||||
* 分账接收方帐号,必填
|
||||
*/
|
||||
private String account;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package cn.felord.payment.wechat.v3.model.profitsharing;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 服务商请求分账API-请求参数
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.11.RELEASE
|
||||
*/
|
||||
@Data
|
||||
public class PartnerProfitSharingOrder {
|
||||
/**
|
||||
* 子商户号,选填
|
||||
*/
|
||||
private String subMchid;
|
||||
/**
|
||||
* 服务商应用ID,自动注入
|
||||
*/
|
||||
private String appid;
|
||||
/**
|
||||
* 子商户应用ID,选填
|
||||
* <p>
|
||||
* 分账接收方类型包含{@code PERSONAL_SUB_OPENID}时必填
|
||||
*/
|
||||
private String subAppid;
|
||||
/**
|
||||
* 微信订单号,必填
|
||||
*/
|
||||
private String transactionId;
|
||||
/**
|
||||
* 商户分账单号,必填
|
||||
* <p>
|
||||
* 商户系统内部的分账单号,在商户系统内部唯一,同一分账单号多次请求等同一次。
|
||||
* 只能是数字、大小写字母_-|*@
|
||||
*/
|
||||
private String outOrderNo;
|
||||
/**
|
||||
* 分账接收方列表,选填
|
||||
* <p>
|
||||
* 可以设置出资商户作为分账接受方,最多可有50个分账接收方
|
||||
*/
|
||||
private List<Receiver> receivers;
|
||||
/**
|
||||
* 是否解冻剩余未分资金,必填
|
||||
* <p>
|
||||
* <ol>
|
||||
* <li>如果为{@code true},该笔订单剩余未分账的金额会解冻回分账方商户;</li>
|
||||
* <li>如果为{@code false},该笔订单剩余未分账的金额不会解冻回分账方商户,可以对该笔订单再次进行分账。</li>
|
||||
* </ol>
|
||||
*/
|
||||
private Boolean unfreezeUnsplit;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2019-2020 felord.cn
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* Website:
|
||||
* https://felord.cn
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package cn.felord.payment.wechat.v3.model.profitsharing;
|
||||
|
||||
import cn.felord.payment.wechat.v2.model.allocation.Receiver;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 服务商-微信支付分账动账通知参数
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.11.RELEASE
|
||||
*/
|
||||
@Data
|
||||
public class PartnerProfitsharingConsumeData {
|
||||
|
||||
/**
|
||||
* 服务商商户号.
|
||||
* <p>
|
||||
* 服务商模式分账发起商户
|
||||
*/
|
||||
private String mchid;
|
||||
/**
|
||||
* 子商户号
|
||||
* <p>
|
||||
* 服务商模式分账出资商户
|
||||
*/
|
||||
private String subMchid;
|
||||
|
||||
/**
|
||||
* 微信订单号.
|
||||
* <p>
|
||||
* 微信支付订单号
|
||||
*/
|
||||
private String transactionId;
|
||||
|
||||
/**
|
||||
* 微信分账/回退单号.
|
||||
*/
|
||||
private String orderId;
|
||||
|
||||
/**
|
||||
* 商户分账/回退单号.
|
||||
* <p>
|
||||
* 分账方系统内部的分账/回退单号
|
||||
*/
|
||||
private String outOrderNo;
|
||||
|
||||
/**
|
||||
* 分账接收方.
|
||||
* <p>
|
||||
* 分账接收方对象
|
||||
*/
|
||||
private List<Receiver> receivers;
|
||||
|
||||
/**
|
||||
* 成功时间.
|
||||
* <p>
|
||||
* Rfc3339标准
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX", timezone = "GMT+8")
|
||||
private LocalDateTime successTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.felord.payment.wechat.v3.model.profitsharing;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 服务商-查询分账结果API-请求参数
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.11.RELEASE
|
||||
*/
|
||||
@Data
|
||||
public class PartnerQueryOrderParams {
|
||||
/**
|
||||
* 子商户号,选填
|
||||
*/
|
||||
private String subMchid;
|
||||
/**
|
||||
* 商户分账单号,必填
|
||||
*/
|
||||
private String outOrderNo;
|
||||
/**
|
||||
* 微信订单号,必填
|
||||
*/
|
||||
private String transactionId;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.felord.payment.wechat.v3.model.profitsharing;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 服务商-查询分账回退结果API-请求参数
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.11.RELEASE
|
||||
*/
|
||||
@Data
|
||||
public class PartnerQueryReturnOrderParams {
|
||||
/**
|
||||
* 子商户号,选填
|
||||
*/
|
||||
private String subMchid;
|
||||
/**
|
||||
* 商户回退单号,必填
|
||||
*/
|
||||
private String outReturnNo;
|
||||
/**
|
||||
* 商户分账单号,必填
|
||||
*/
|
||||
private String outOrderNo;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package cn.felord.payment.wechat.v3.model.profitsharing;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 服务商-请求分账回退API-请求参数
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.11.RELEASE
|
||||
*/
|
||||
@Data
|
||||
public class PartnerReturnOrdersParams {
|
||||
/**
|
||||
* 子商户号,选填
|
||||
*/
|
||||
private String subMchid;
|
||||
/**
|
||||
* 微信分账单号,同{@link #outOrderNo} 二选一
|
||||
*/
|
||||
private String orderId;
|
||||
/**
|
||||
* 商户分账单号,同{@link #orderId} 二选一
|
||||
*/
|
||||
private String outOrderNo;
|
||||
/**
|
||||
* 商户回退单号,必填
|
||||
*/
|
||||
private String outReturnNo;
|
||||
/**
|
||||
* 回退商户号,必填
|
||||
* <p>
|
||||
* 分账回退的出资商户,只能对原分账请求中成功分给商户接收方进行回退
|
||||
*/
|
||||
private String returnMchid;
|
||||
/**
|
||||
* 回退金额,必填
|
||||
* <p>
|
||||
* 需要从分账接收方回退的金额,单位为分,只能为整数,不能超过原始分账单分出给该接收方的金额
|
||||
*/
|
||||
private Integer amount;
|
||||
/**
|
||||
* 回退描述,必填
|
||||
*/
|
||||
private String description;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.felord.payment.wechat.v3.model.profitsharing;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 服务商-解冻剩余资金API-请求参数
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.11.RELEASE
|
||||
*/
|
||||
@Data
|
||||
public class PartnerUnfreezeParams {
|
||||
/**
|
||||
* 子商户号,选填
|
||||
*/
|
||||
private String subMchid;
|
||||
/**
|
||||
* 微信订单号,必填
|
||||
*/
|
||||
private String transactionId;
|
||||
/**
|
||||
* 商户分账单号,必填
|
||||
*/
|
||||
private String outOrderNo;
|
||||
/**
|
||||
* 分账描述,必填
|
||||
*/
|
||||
private String description;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 直连商户请求分账API-请求参数
|
||||
* 直连商户-请求分账API-请求参数
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.11.RELEASE
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 微信支付分账通知参数
|
||||
* 直连商户-微信支付分账动账通知参数
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.11.RELEASE
|
||||
|
||||
@@ -3,7 +3,7 @@ package cn.felord.payment.wechat.v3.model.profitsharing;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 查询分账结果API-请求参数
|
||||
* 直连商户-查询分账结果API-请求参数
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.11.RELEASE
|
||||
|
||||
@@ -3,7 +3,7 @@ package cn.felord.payment.wechat.v3.model.profitsharing;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 查询分账回退结果API-请求参数
|
||||
* 直连商户-查询分账回退结果API-请求参数
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.11.RELEASE
|
||||
|
||||
@@ -3,7 +3,7 @@ package cn.felord.payment.wechat.v3.model.profitsharing;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 请求分账回退API-请求参数
|
||||
* 直连商户-请求分账回退API-请求参数
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.11.RELEASE
|
||||
|
||||
@@ -3,7 +3,7 @@ package cn.felord.payment.wechat.v3.model.profitsharing;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 解冻剩余资金API-请求参数
|
||||
* 直连商户-解冻剩余资金API-请求参数
|
||||
*
|
||||
* @author felord.cn
|
||||
* @since 1.0.11.RELEASE
|
||||
|
||||
Reference in New Issue
Block a user