校验分账金额测试方法

This commit is contained in:
Guoqs
2024-12-19 16:47:40 +08:00
parent 9b08105c5f
commit d96060da9a
3 changed files with 23 additions and 1 deletions

View File

@@ -16,9 +16,11 @@ import com.jsowell.adapay.response.PaymentConfirmResponse;
import com.jsowell.adapay.response.PaymentReverseResponse;
import com.jsowell.adapay.response.QueryPaymentConfirmDetailResponse;
import com.jsowell.adapay.service.AdapayService;
import com.jsowell.adapay.vo.OrderSplitResult;
import com.jsowell.common.enums.ykc.ScenarioEnum;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.AdapayMemberAccount;
import com.jsowell.pile.service.OrderBasicInfoService;
import org.apache.commons.collections4.CollectionUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -53,6 +55,9 @@ public class PaymentTestController {
@Autowired
private AdapayService adapayService;
@Autowired
private OrderBasicInfoService orderBasicInfoService;
public List<String> getPaymentIdList() {
List<String> resultList = Lists.newArrayList();
// List<String> paymentIdList1 = getPaymentIdList1();
@@ -468,4 +473,17 @@ public class PaymentTestController {
String wechatAppId = wechatAppId1; // 万车充id
adapayService.createBalancePaymentRequest(outMemberId, inMemberId, transAmt, title, desc, wechatAppId);
}
/**
* 校验订单分账金额
*/
@Test
public void verifyOrderConfirmAmountTest() throws BaseAdaPayException {
String orderCode = "C21960272918";
List<String> paymentIds = Lists.newArrayList("002212024121307453510713429549121368064");
BigDecimal settleAmount = new BigDecimal("19.37");
String wechatAppId = wechatAppId1;
OrderSplitResult orderSplitResult = orderBasicInfoService.verifyOrderConfirmAmount(paymentIds, orderCode, settleAmount, wechatAppId);
System.out.println(JSON.toJSONString(orderSplitResult));
}
}

View File

@@ -203,6 +203,8 @@ public interface OrderBasicInfoService{
OrderSplitResult doBalancePaymentWithDelay(OrderBasicInfo orderBasicInfo, AdapayMemberAccount adapayMemberAccount, String wechatAppId) throws BaseAdaPayException;
OrderSplitResult verifyOrderConfirmAmount(List<String> paymentIds, String orderCode, BigDecimal settleAmount, String wechatAppId) throws BaseAdaPayException;
/**
* 批量查询订单
* @param orderCodeList

View File

@@ -1469,6 +1469,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
* @param orderBasicInfo 订单
* @param adapayMemberAccount 结算账户
*/
@Override
public OrderSplitResult doPaymentConfirmWithDelay(OrderBasicInfo orderBasicInfo, AdapayMemberAccount adapayMemberAccount, String wechatAppId) throws BaseAdaPayException {
// 订单编号
String orderCode = orderBasicInfo.getOrderCode();
@@ -1569,7 +1570,8 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
* @param orderCode 订单编号
* @param settleAmount 结算金额
*/
private OrderSplitResult verifyOrderConfirmAmount(List<String> paymentIds, String orderCode, BigDecimal settleAmount, String wechatAppId) throws BaseAdaPayException {
@Override
public OrderSplitResult verifyOrderConfirmAmount(List<String> paymentIds, String orderCode, BigDecimal settleAmount, String wechatAppId) throws BaseAdaPayException {
// 分账金额
BigDecimal totalConfirmAmt = BigDecimal.ZERO;
// 手续费