钱包。删除不需要的类

This commit is contained in:
jason 2023-09-06 08:50:22 +08:00
parent f99e2aec2d
commit 3f51be6a2d
5 changed files with 5 additions and 95 deletions

View File

@ -1,63 +0,0 @@
package cn.iocoder.yudao.framework.pay.core.client.impl.delegate;
import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
import java.util.Map;
// TODO @jason其它模块主要是无法 pay client 初始化存在问题所以我感觉是不是可以搞个 PayClientInitializer 接口这样PayClientFactory get 这个支付模式对应的 PayClientInitializer通过它来创建具体注入的地方可以在 PayChannel init 方法那
/**
* 代理支付 Client 的抽象类
*
* 用于支付 Client 由其它模块实现例如钱包支付
*
* @author jason
*/
public abstract class DelegatePayClient<Config extends PayClientConfig> extends AbstractPayClient<PayClientConfig> {
private final DelegatePayClient<Config> delegate;
public DelegatePayClient(Long channelId, String channelCode, PayClientConfig config) {
super(channelId, channelCode, config);
delegate = this;
}
@Override
protected void doInit() {
delegate.doInit();
}
@Override
protected PayOrderRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
return delegate.doUnifiedOrder(reqDTO);
}
@Override
protected PayOrderRespDTO doGetOrder(String outTradeNo) {
return delegate.doGetOrder(outTradeNo);
}
@Override
protected PayRefundRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
return delegate.doUnifiedRefund(reqDTO);
}
@Override
protected PayRefundRespDTO doGetRefund(String outTradeNo, String outRefundNo) {
return delegate.doGetRefund(outTradeNo, outRefundNo);
}
@Override
protected PayRefundRespDTO doParseRefundNotify(Map<String,String> params, String body) {
return delegate.doParseRefundNotify(params, body);
}
@Override
protected PayOrderRespDTO doParseOrderNotify(Map<String,String> params, String body) {
return delegate.doParseOrderNotify(params, body);
}
}

View File

@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDT
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
import cn.iocoder.yudao.framework.pay.core.client.impl.NonePayClientConfig;
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
import java.time.LocalDateTime;
@ -17,11 +18,11 @@ import java.util.Map;
*
* @author jason
*/
public class MockPayClient extends AbstractPayClient<MockPayClientConfig> {
public class MockPayClient extends AbstractPayClient<NonePayClientConfig> {
private static final String MOCK_RESP_SUCCESS_DATA = "MOCK_SUCCESS";
public MockPayClient(Long channelId, MockPayClientConfig config) {
public MockPayClient(Long channelId, NonePayClientConfig config) {
super(channelId, PayChannelEnum.MOCK.getCode(), config);
}

View File

@ -1,28 +0,0 @@
package cn.iocoder.yudao.framework.pay.core.client.impl.mock;
import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
import lombok.Data;
import javax.validation.Validator;
/**
* 模拟支付的 PayClientConfig 实现类
*
* @author jason
*/
@Data
public class MockPayClientConfig implements PayClientConfig {
/**
* 配置名称
*
* 如果不加任何属性JsonUtils.parseObject2 解析会报错所以暂时加个名称
*/
private String name;
@Override
public void validate(Validator validator) {
// 模拟支付配置无需校验
}
}

View File

@ -4,7 +4,6 @@ import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.pay.core.client.impl.NonePayClientConfig;
import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig;
import cn.iocoder.yudao.framework.pay.core.client.impl.mock.MockPayClientConfig;
import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPayClientConfig;
import lombok.AllArgsConstructor;
import lombok.Getter;
@ -30,7 +29,7 @@ public enum PayChannelEnum {
ALIPAY_QR("alipay_qr", "支付宝扫码支付", AlipayPayClientConfig.class),
ALIPAY_BAR("alipay_bar", "支付宝条码支付", AlipayPayClientConfig.class),
MOCK("mock", "模拟支付", MockPayClientConfig.class),
MOCK("mock", "模拟支付", NonePayClientConfig.class),
WALLET("wallet", "钱包支付", NonePayClientConfig.class);

View File

@ -70,6 +70,7 @@ public class PayOrderController {
@PostMapping("/submit")
@Operation(summary = "提交支付订单")
public CommonResult<PayOrderSubmitRespVO> submitPayOrder(@RequestBody PayOrderSubmitReqVO reqVO) {
// 钱包支付需要 额外传 user_id user_type
if (Objects.equals(reqVO.getChannelCode(), PayChannelEnum.WALLET.getCode())) {
Map<String, String> channelExtras = reqVO.getChannelExtras() == null ? new HashMap<>(8) : reqVO.getChannelExtras();
channelExtras.put("user_id", String.valueOf(WebFrameworkUtils.getLoginUserId()));