feat(checkout): 支持聚合支付条码支付

This commit is contained in:
DaxPay
2024-12-05 15:31:16 +08:00
parent 1270288c2f
commit 334af5b5f1
9 changed files with 148 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
package org.dromara.daxpay.channel.alipay.strategy;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.daxpay.core.enums.ChannelEnum;
@@ -15,6 +16,7 @@ import org.springframework.stereotype.Component;
@Component
@RequiredArgsConstructor
public class AliPayCheckoutStrategy extends AbsCheckoutStrategy {
/**
* 策略标识, 可以自行进行扩展
*
@@ -24,4 +26,13 @@ public class AliPayCheckoutStrategy extends AbsCheckoutStrategy {
public String getChannel() {
return ChannelEnum.ALI.getCode();
}
/**
* 检测付款码
*/
@Override
public boolean checkBarCode(String barCode){
String[] ali = { "25", "26", "27", "28", "29", "30" };
return StrUtil.startWithAny(barCode.substring(0, 2), ali);
}
}

View File

@@ -45,6 +45,14 @@ public class WechatCheckoutStrategy extends AbsCheckoutStrategy {
return wechatAuthService.generateInnerAuthUrl(redirectUrl);
}
/**
* 检测付款码
*/
@Override
public boolean checkBarCode(String barCode){
String[] wx = { "10", "11", "12", "13", "14", "15" };
return StrUtil.startWithAny(barCode.substring(0, 2), wx);
}
/**
* 获取认证结果
*/