1
0
mirror of synced 2025-12-23 10:39:27 +08:00

#1010 增加微信分账相关接口

* 微信单次分账接口

* - 微信多次分账
- 微信完结分账
- 添加分账接受方
- 删除分账接受方
- 查询分账结果【未能完成单元测试,微信返回签名失败】
- 分账回退【未能完成单元测试,使用真实数据返回“参数不正确”,我对比官方文档除了缺少`sub_mch_id`和`sub_appid`之外其他相同,当我随便填了一个商户id的时候,提示“回退方没有开通分账回退功能”】
- 回退结果查询【未能完成单元测试,因分账回退无法进行,模拟数据返回”记录不存在“】
This commit is contained in:
王广鑫
2019-10-24 09:23:56 +08:00
committed by Binary Wang
parent 81df397536
commit d184ff8303
14 changed files with 977 additions and 16 deletions

View File

@@ -1,6 +1,7 @@
package com.github.binarywang.wxpay.service.impl;
import com.github.binarywang.wxpay.bean.profitsharing.ProfitsharingRequest;
import com.github.binarywang.wxpay.bean.profitsharing.*;
import com.github.binarywang.wxpay.bean.profitsharing.ProfitSharingRequest;
import com.github.binarywang.wxpay.bean.profitsharing.Receiver;
import com.github.binarywang.wxpay.bean.profitsharing.ReceiverList;
import com.github.binarywang.wxpay.constant.WxPayConstants;
@@ -26,15 +27,105 @@ public class ProfitSharingServiceImplTest {
ReceiverList instance = ReceiverList.getInstance();
instance.add(new Receiver(WxPayConstants.ReceiverType.PERSONAL_OPENID,
"oyOUE5ql4TtzrBg5cVOwxq6tbjOs",
100,
"分到用户"));
ProfitsharingRequest request = ProfitsharingRequest
20,
"***"));
//30000002922019102310811092093
ProfitSharingRequest request = ProfitSharingRequest
.newBuilder()
.outOrderNo("P20150806125346")
.transactionId("4208450740201411110007820472")
// .receivers("[{\"type\": \"PERSONAL_OPENID\",\"account\":\"oyOUE5ql4TtzrBg5cVOwxq6tbjOs\",\"amount\":100,\"description\": \"分到用户\"}]")
.outOrderNo("20191023112023031060677")
.transactionId("4200000431201910234736634272")
.receivers(instance.toJSONString())
.build();
this.logger.info(this.payService.getProfitSharingService().profitsharing(request).toString());
}
@Test
public void testMultiprofitsharing() throws WxPayException {
ReceiverList instance = ReceiverList.getInstance();
instance.add(new Receiver(WxPayConstants.ReceiverType.MERCHANT_ID,
"86693852",
1,
"***"));
ProfitSharingRequest request = ProfitSharingRequest
.newBuilder()
.outOrderNo("20191023154723316420060")
.transactionId("4200000448201910238249687345")//order_id=30000102922019102310821824010
.receivers(instance.toJSONString())
.build();
this.logger.info(this.payService.getProfitSharingService().multiprofitsharing(request).toString());
}
@Test
public void testProfitsharingFinish() throws WxPayException {
ProfitSharingFinishRequest request = ProfitSharingFinishRequest
.newBuilder()
.outOrderNo("20191023103251431856285")
.transactionId("4200000441201910238267278073")
.description("分账完成")
.build();
this.logger.info(this.payService.getProfitSharingService().profitsharingfinish(request).toString());
}
@Test
public void testAddreceiver() throws WxPayException {
Receiver receiver = new Receiver(WxPayConstants.ReceiverType.PERSONAL_OPENID,
"oyOUE5ql4TtzrBg5cVOwxq6tbjOs",
"***",
"STORE_OWNER",
null);
ProfitSharingReceiverRequest request = ProfitSharingReceiverRequest
.newBuilder()
.receiver(receiver.toJSONString())
.build();
this.logger.info(this.payService.getProfitSharingService().addReceiver(request).toString());
}
@Test
public void testRemoveReceiver() throws WxPayException {
Receiver receiver = new Receiver(WxPayConstants.ReceiverType.PERSONAL_OPENID,
"oyOUE5ql4TtzrBg5cVOwxq6tbjOs");
ProfitSharingReceiverRequest request = ProfitSharingReceiverRequest
.newBuilder()
.receiver(receiver.toJSONString())
.build();
this.logger.info(this.payService.getProfitSharingService().removeReceiver(request).toString());
}
@Test
public void testProfitsharingQuery() throws WxPayException {
ProfitSharingQueryRequest request = ProfitSharingQueryRequest
.newBuilder()
.outOrderNo("20191023112023031060677")
.transactionId("4200000431201910234736634272")
.build();
ProfitSharingQueryResult result = this.payService.getProfitSharingService().profitsharingQuery(request);
this.logger.info(result.formatReceivers().toString());
this.logger.info(result.toString());
}
@Test
public void testProfitsharingReturn() throws WxPayException {
ProfitSharingReturnRequest request = ProfitSharingReturnRequest
.newBuilder()
.outOrderNo("20191023154723316420060")
.outReturnNo("R2019102315")
.returnAccountType("MERCHANT_ID")
.returnAccount("86693852")
.returnAmount(2)
.description("用户退款")
.build();
this.logger.info(this.payService.getProfitSharingService().profitsharingReturn(request).toString());
}
@Test
public void testProfitsharingReturnQuery() throws WxPayException {
ProfitSharingReturnQueryRequest request = ProfitSharingReturnQueryRequest
.newBuilder()
.outOrderNo("20191023154723316420060")
.outReturnNo("R2019102315")
.build();
this.logger.info(this.payService.getProfitSharingService().profitsharingReturnQuery(request).toString());
}
}