mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-06-28 13:16:19 +08:00
🆕 #1978 【微信支付】电商支付通增加查询分账回退结果的接口方法
This commit is contained in:
parent
ce62d1c01b
commit
13b484a071
@ -0,0 +1,76 @@
|
||||
package com.github.binarywang.wxpay.bean.ecommerce;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 查询分账回退结果请求
|
||||
* * <pre>
|
||||
* * 文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/profitsharing/chapter3_3.shtml
|
||||
* * </pre>
|
||||
* @author: wangrui
|
||||
* @date: 2021/02/20
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
@AllArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class ReturnOrdersQueryRequest implements Serializable {
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:二级商户号
|
||||
* 变量名:sub_mchid
|
||||
* 是否必填:是
|
||||
* 类型:string(32)
|
||||
* 描述:
|
||||
* 分账出资的电商平台二级商户,填写微信支付分配的商户号。
|
||||
* 示例值:1900000109
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "sub_mchid")
|
||||
private String subMchid;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:微信分账单号
|
||||
* 变量名:order_id
|
||||
* 是否必填:与out_order_no二选一
|
||||
* 类型:string(64)
|
||||
* 描述:
|
||||
* 微信分账单号,微信系统返回的唯一标识。微信分账单号和商户分账单号二选一填写。
|
||||
* 示例值:3008450740201411110007820472
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "order_id")
|
||||
private String orderId;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:商户分账单号
|
||||
* 变量名:out_order_no
|
||||
* 是否必填:与order_id二选一
|
||||
* 类型:string(64)
|
||||
* 描述:
|
||||
* 商户系统内部的分账单号,在商户系统内部唯一(单次分账、多次分账、完结分账应使用不同的商户分账单号),同一分账单号多次请求等同一次。
|
||||
* 示例值:P20150806125346
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "out_order_no")
|
||||
private String outOrderNo;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 字段名:商户回退单号
|
||||
* 变量名:out_return_no
|
||||
* 是否必填:是
|
||||
* 类型:string(64)
|
||||
* 描述:
|
||||
* 此回退单号是商户在自己后台生成的一个新的回退单号,在商户后台唯一。
|
||||
* 示例值:P20150806125346
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName(value = "out_return_no")
|
||||
private String outReturnNo;
|
||||
}
|
@ -287,6 +287,18 @@ public interface EcommerceService {
|
||||
*/
|
||||
ReturnOrdersResult returnOrders(ReturnOrdersRequest request) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 查询分账回退API
|
||||
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/profitsharing/chapter3_3.shtml
|
||||
* </pre>
|
||||
*
|
||||
* @param request 查询分账回退请求
|
||||
* @return 返回数据 return orders result
|
||||
* @throws WxPayException the wx pay exception
|
||||
*/
|
||||
ReturnOrdersResult queryReturnOrders(ReturnOrdersQueryRequest request) throws WxPayException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 完结分账API
|
||||
|
@ -12,6 +12,7 @@ import com.github.binarywang.wxpay.v3.util.RsaCryptoUtil;
|
||||
import com.google.common.base.CaseFormat;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.beanutils.BeanMap;
|
||||
|
||||
@ -224,6 +225,24 @@ public class EcommerceServiceImpl implements EcommerceService {
|
||||
return GSON.fromJson(response, ReturnOrdersResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReturnOrdersResult queryReturnOrders(ReturnOrdersQueryRequest request) throws WxPayException {
|
||||
String subMchid = request.getSubMchid();
|
||||
String orderId = request.getOrderId();
|
||||
String outOrderNo = request.getOutOrderNo();
|
||||
String outReturnNo = request.getOutReturnNo();
|
||||
String url = null;
|
||||
if (StringUtils.isBlank(orderId)) {
|
||||
url = String.format("%s/v3/ecommerce/profitsharing/returnorders?sub_mchid=%s&out_order_no=%s&out_return_no=%s",
|
||||
this.payService.getPayBaseUrl(), subMchid, outOrderNo, outReturnNo);
|
||||
} else {
|
||||
url = String.format("%s/v3/ecommerce/profitsharing/returnorders?sub_mchid=%s&order_id=%s&out_return_no=%s",
|
||||
this.payService.getPayBaseUrl(), subMchid, orderId, outReturnNo);
|
||||
}
|
||||
String response = this.payService.getV3(URI.create(url));
|
||||
return GSON.fromJson(response, ReturnOrdersResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProfitSharingResult finishOrder(FinishOrderRequest request) throws WxPayException {
|
||||
String url = String.format("%s/v3/ecommerce/profitsharing/finish-order", this.payService.getPayBaseUrl());
|
||||
|
Loading…
Reference in New Issue
Block a user