feat: 充值支持支付宝充值

This commit is contained in:
2024-11-05 16:31:23 +08:00
parent 306f34a30e
commit 7b793bb9f2
2 changed files with 14 additions and 2 deletions

View File

@@ -23,4 +23,6 @@ public class MemberInDTO {
private Integer userCouponId; private Integer userCouponId;
// 是否使用积分抵扣 // 是否使用积分抵扣
private Integer pointsNum ; private Integer pointsNum ;
private String payType;
} }

View File

@@ -1087,6 +1087,11 @@ public class PayService {
return Result.fail("支付通道不存在"); return Result.fail("支付通道不存在");
} }
if ("aliPay".equals(memberInDTO.getPayType()) && StrUtil.isBlank(thirdApply.getAlipaySmallAppid())) {
return Result.fail("店铺未配置支付宝小程序appId");
}
// 霸王餐活动充值 // 霸王餐活动充值
BigDecimal payAmount; BigDecimal payAmount;
TbMemberIn memberIn = new TbMemberIn(); TbMemberIn memberIn = new TbMemberIn();
@@ -1142,12 +1147,17 @@ public class PayService {
} }
} }
} else { } else {
String smallAppid = thirdApply.getSmallAppid();
if ("aliPay".equals(memberInDTO.getPayType())) {
smallAppid = thirdApply.getAlipaySmallAppid();
}
String convertPayType = "aliPay".equals(memberInDTO.getPayType()) ? "ALIPAY" : "WECHAT";
String orderNo = DateUtils.getsdfTimesSS(); String orderNo = DateUtils.getsdfTimesSS();
PublicResp<WxScanPayResp> publicResp = thirdPayService PublicResp<WxScanPayResp> publicResp = thirdPayService
.scanpay(thirdUrl, thirdApply.getAppId(), .scanpay(thirdUrl, thirdApply.getAppId(),
"会员充值", "会员充值", payAmount "会员充值", "会员充值", payAmount
.multiply(new BigDecimal(100)).longValue(), "WECHAT", .multiply(new BigDecimal(100)).longValue(), convertPayType,
thirdApply.getSmallAppid(), memberInDTO.getOpenId(), ip, orderNo, thirdApply.getStoreId(), smallAppid, memberInDTO.getOpenId(), ip, orderNo, thirdApply.getStoreId(),
callInBack, null, thirdApply.getAppToken()); callInBack, null, thirdApply.getAppToken());
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) { if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
if ("000000".equals(publicResp.getCode())) { if ("000000".equals(publicResp.getCode())) {