feat 流水记录功能微调、新增组合支付样例

This commit is contained in:
bootx
2024-02-19 22:39:15 +08:00
parent aa77586656
commit e55e845adb
8 changed files with 96 additions and 9 deletions

View File

@@ -5,12 +5,15 @@ import cn.bootx.platform.daxpay.sdk.code.PayWayEnum;
import cn.bootx.platform.daxpay.sdk.model.pay.PayOrderModel;
import cn.bootx.platform.daxpay.sdk.net.DaxPayConfig;
import cn.bootx.platform.daxpay.sdk.net.DaxPayKit;
import cn.bootx.platform.daxpay.sdk.param.channel.VoucherPayParam;
import cn.bootx.platform.daxpay.sdk.param.channel.WalletPayParam;
import cn.bootx.platform.daxpay.sdk.param.pay.PayChannelParam;
import cn.bootx.platform.daxpay.sdk.param.pay.PayParam;
import cn.bootx.platform.daxpay.sdk.response.DaxPayResult;
import org.junit.Before;
import org.junit.Test;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -56,10 +59,47 @@ public class PayOrderTest {
}
/**
* 多通道支付
* 多通道支付. 全部为同步支付方式
*/
@Test
public void multiPay() {
PayParam param = new PayParam();
param.setClientIp("127.0.0.1");
param.setNotNotify(true);
param.setBusinessNo("P0002");
param.setTitle("测试组合支付");
// 现金支付
PayChannelParam cash = new PayChannelParam();
cash.setChannel(PayChannelEnum.CASH.getCode());
cash.setWay(PayWayEnum.NORMAL.getCode());
cash.setAmount(10);
// 储值卡支付
PayChannelParam card = new PayChannelParam();
card.setChannel(PayChannelEnum.VOUCHER.getCode());
card.setWay(PayWayEnum.NORMAL.getCode());
card.setAmount(10);
// 储值卡通道参数
VoucherPayParam voucherPayParam = new VoucherPayParam();
voucherPayParam.setCardNo("123456");
card.setChannelParam(voucherPayParam);
// 钱包支付
PayChannelParam wallet = new PayChannelParam();
wallet.setChannel(PayChannelEnum.WALLET.getCode());
wallet.setWay(PayWayEnum.NORMAL.getCode());
wallet.setAmount(10);
// 钱包通道支付参数
WalletPayParam walletPayParam = new WalletPayParam();
walletPayParam.setUserId("1");
wallet.setChannelParam(walletPayParam);
// 组装组合支付的参数
List<PayChannelParam> payChannels = Arrays.asList(cash, card, wallet);
param.setPayChannels(payChannels);
DaxPayResult<PayOrderModel> execute = DaxPayKit.execute(param);
System.out.println(execute);
System.out.println(execute.getData());
}
}