feat 演示示例支持分账, 微信分账签名错误修复

This commit is contained in:
bootx
2024-04-14 12:27:23 +08:00
parent 625c5c301a
commit 1deee49edb
6 changed files with 13 additions and 1 deletions

View File

@@ -21,6 +21,9 @@ public class AggregatePayInfo {
@Schema(description = "订单业务号")
private String businessNo;
@Schema(description = "是否分账")
private boolean allocation;
/** 支付金额 */
@Schema(description = "支付金额")
private Integer amount;

View File

@@ -20,6 +20,9 @@ public class AggregateSimplePayParam {
@NotNull
private String businessNo;
@Schema(description = "是否分账")
private boolean allocation;
@Schema(description = "标题")
@NotNull
private String title;

View File

@@ -22,6 +22,9 @@ public class CashierSimplePayParam {
@NotNull
private String businessNo;
@Schema(description = "是否分账")
private boolean allocation;
@Schema(description = "标题")
@NotNull
private String title;

View File

@@ -58,6 +58,7 @@ public class AggregateService {
AggregatePayInfo aggregatePayInfo = new AggregatePayInfo()
.setTitle(param.getTitle())
.setBusinessNo(param.getBusinessNo())
.setAllocation(param.isAllocation())
.setAmount(amount);
String code = IdUtil.getSnowflakeNextIdStr();
String serverUrl = daxPayDemoProperties.getServerUrl();
@@ -218,6 +219,7 @@ public class AggregateService {
SimplePayParam simplePayParam = new SimplePayParam();
simplePayParam.setBusinessNo(param.getBusinessNo());
simplePayParam.setAllocation(param.isAllocation());
simplePayParam.setTitle(param.getTitle());
simplePayParam.setAmount(amount);
simplePayParam.setChannel(payChannel.getCode());

View File

@@ -52,6 +52,7 @@ public class CashierService {
// 将参数转换为简单支付参数
SimplePayParam simplePayParam = new SimplePayParam();
simplePayParam.setBusinessNo(param.getBusinessNo());
simplePayParam.setAllocation(param.isAllocation());
int amount = param.getAmount()
.multiply(BigDecimal.valueOf(100))
.intValue();

View File

@@ -96,9 +96,9 @@ public class WeChatPayAllocationService {
* 查询分账状态
*/
public void queryStatus(AllocationOrder allocationOrder, WeChatPayConfig config){
// 不要传输AppId参数, 否则会失败
Map<String, String> params = ProfitSharingModel.builder()
.mch_id(config.getWxMchId())
.appid(config.getWxAppId())
.nonce_str(WxPayKit.generateStr())
.transaction_id(allocationOrder.getGatewayPayOrderNo())
.out_order_no(allocationOrder.getOrderNo())