getWalletRechargePackagePage(Long userId, Integer userType,
+ PageParam pageReqVO, Boolean payStatus);
+
+ /**
+ * 更新钱包充值成功
+ *
+ * @param id 钱包充值记录编号
+ * @param payOrderId 支付订单编号
+ */
+ void updateWalletRechargerPaid(Long id, Long payOrderId);
+
+ /**
+ * 发起钱包充值退款
+ *
+ * @param id 钱包充值编号
+ * @param userIp 用户 ip 地址
+ */
+ void refundWalletRecharge(Long id, String userIp);
+
+ /**
+ * 更新钱包充值记录为已退款
+ *
+ * @param id 钱包充值记录编号
+ * @param refundId 钱包充值退款编号(实际和 id 相同)
+ * @param payRefundId 退款单id
+ */
+ void updateWalletRechargeRefunded(Long id, Long refundId, Long payRefundId);
+
+}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java b/yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java
index e4cda98..e4cda98 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java
+++ b/yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java
diff --git a/yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java b/yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java
new file mode 100644
index 0000000..6efdc92
--- /dev/null
+++ b/yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java
@@ -0,0 +1,99 @@
+package cn.iocoder.yudao.module.pay.service.wallet;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO;
+import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
+import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
+import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
+
+/**
+ * 钱包 Service 接口
+ *
+ * @author jason
+ */
+public interface PayWalletService {
+
+ /**
+ * 获取钱包信息
+ *
+ * 如果不存在,则创建钱包。由于用户注册时候不会创建钱包
+ *
+ * @param userId 用户编号
+ * @param userType 用户类型
+ */
+ PayWalletDO getOrCreateWallet(Long userId, Integer userType);
+
+ /**
+ * 获取钱包信息
+ *
+ * @param walletId 钱包 id
+ */
+ PayWalletDO getWallet(Long walletId);
+
+ /**
+ * 获得会员钱包分页
+ *
+ * @param pageReqVO 分页查询
+ * @return 会员钱包分页
+ */
+ PageResult getWalletPage(PayWalletPageReqVO pageReqVO);
+
+ /**
+ * 钱包订单支付
+ *
+ * @param walletId 钱包编号
+ * @param outTradeNo 外部订单号
+ * @param price 金额
+ */
+ PayWalletTransactionDO orderPay(Long walletId, String outTradeNo, Integer price);
+
+ /**
+ * 钱包订单支付退款
+ *
+ * @param outRefundNo 外部退款号
+ * @param refundPrice 退款金额
+ * @param reason 退款原因
+ */
+ PayWalletTransactionDO orderRefund(String outRefundNo, Integer refundPrice, String reason);
+
+ /**
+ * 扣减钱包余额
+ *
+ * @param walletId 钱包编号
+ * @param bizId 业务关联编号
+ * @param bizType 业务关联分类
+ * @param price 扣减金额
+ * @return 钱包流水
+ */
+ PayWalletTransactionDO reduceWalletBalance(Long walletId, Long bizId,
+ PayWalletBizTypeEnum bizType, Integer price);
+
+ /**
+ * 增加钱包余额
+ *
+ * @param walletId 钱包编号
+ * @param bizId 业务关联编号
+ * @param bizType 业务关联分类
+ * @param price 增加金额
+ * @return 钱包流水
+ */
+ PayWalletTransactionDO addWalletBalance(Long walletId, String bizId,
+ PayWalletBizTypeEnum bizType, Integer price);
+
+ /**
+ * 冻结钱包部分余额
+ *
+ * @param id 钱包编号
+ * @param price 冻结金额
+ */
+ void freezePrice(Long id, Integer price);
+
+ /**
+ * 解冻钱包余额
+ *
+ * @param id 钱包编号
+ * @param price 解冻金额
+ */
+ void unfreezePrice(Long id, Integer price);
+
+}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java b/yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java
index 0005ace..0005ace 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java
+++ b/yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java
diff --git a/yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionService.java b/yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionService.java
new file mode 100644
index 0000000..af9c6a8
--- /dev/null
+++ b/yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionService.java
@@ -0,0 +1,74 @@
+package cn.iocoder.yudao.module.pay.service.wallet;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionPageReqVO;
+import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO;
+import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionSummaryRespVO;
+import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
+import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
+import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO;
+
+import jakarta.validation.Valid;
+
+import java.time.LocalDateTime;
+
+/**
+ * 钱包余额流水 Service 接口
+ *
+ * @author jason
+ */
+public interface PayWalletTransactionService {
+
+ /**
+ * 查询钱包余额流水分页
+ *
+ * @param userId 用户编号
+ * @param userType 用户类型
+ * @param pageVO 分页查询参数
+ */
+ PageResult getWalletTransactionPage(Long userId, Integer userType,
+ AppPayWalletTransactionPageReqVO pageVO);
+
+ /**
+ * 查询钱包余额流水分页
+ *
+ * @param pageVO 分页查询参数
+ */
+ PageResult getWalletTransactionPage(PayWalletTransactionPageReqVO pageVO);
+
+ /**
+ * 新增钱包余额流水
+ *
+ * @param bo 创建钱包流水 bo
+ * @return 新建的钱包 do
+ */
+ PayWalletTransactionDO createWalletTransaction(@Valid WalletTransactionCreateReqBO bo);
+
+ /**
+ * 根据 no,获取钱包余流水
+ *
+ * @param no 流水号
+ */
+ PayWalletTransactionDO getWalletTransactionByNo(String no);
+
+ /**
+ * 获取钱包流水
+ *
+ * @param bizId 业务编号
+ * @param type 业务类型
+ * @return 钱包流水
+ */
+ PayWalletTransactionDO getWalletTransaction(String bizId, PayWalletBizTypeEnum type);
+
+ /**
+ * 获得钱包流水统计
+ *
+ * @param userId 用户编号
+ * @param userType 用户类型
+ * @param createTime 时间段
+ * @return 钱包流水统计
+ */
+ AppPayWalletTransactionSummaryRespVO getWalletTransactionSummary(Long userId, Integer userType,
+ LocalDateTime[] createTime);
+
+}
diff --git a/yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionServiceImpl.java b/yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionServiceImpl.java
new file mode 100644
index 0000000..4c01cd8
--- /dev/null
+++ b/yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionServiceImpl.java
@@ -0,0 +1,95 @@
+package cn.iocoder.yudao.module.pay.service.wallet;
+
+import cn.hutool.core.util.ObjectUtil;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionPageReqVO;
+import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO;
+import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionSummaryRespVO;
+import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert;
+import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
+import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
+import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletTransactionMapper;
+import cn.iocoder.yudao.module.pay.dal.redis.no.PayNoRedisDAO;
+import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
+import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO;
+import jakarta.annotation.Resource;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import java.time.LocalDateTime;
+
+import static cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO.TYPE_EXPENSE;
+import static cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO.TYPE_INCOME;
+
+/**
+ * 钱包流水 Service 实现类
+ *
+ * @author jason
+ */
+@Service
+@Slf4j
+@Validated
+public class PayWalletTransactionServiceImpl implements PayWalletTransactionService {
+
+ /**
+ * 钱包流水的 no 前缀
+ */
+ private static final String WALLET_NO_PREFIX = "W";
+
+ @Resource
+ private PayWalletService payWalletService;
+ @Resource
+ private PayWalletTransactionMapper payWalletTransactionMapper;
+ @Resource
+ private PayNoRedisDAO noRedisDAO;
+
+ @Override
+ public PageResult getWalletTransactionPage(Long userId, Integer userType,
+ AppPayWalletTransactionPageReqVO pageVO) {
+ PayWalletDO wallet = payWalletService.getOrCreateWallet(userId, userType);
+ return payWalletTransactionMapper.selectPage(wallet.getId(), pageVO.getType(), pageVO, pageVO.getCreateTime());
+ }
+
+ @Override
+ public PageResult getWalletTransactionPage(PayWalletTransactionPageReqVO pageVO) {
+ // 基于 userId + userType 查询钱包
+ if (pageVO.getWalletId() == null
+ && ObjectUtil.isAllNotEmpty(pageVO.getUserId(), pageVO.getUserType())) {
+ PayWalletDO wallet = payWalletService.getOrCreateWallet(pageVO.getUserId(), pageVO.getUserType());
+ if (wallet != null) {
+ pageVO.setWalletId(wallet.getId());
+ }
+ }
+
+ // 查询分页
+ return payWalletTransactionMapper.selectPage(pageVO.getWalletId(), null, pageVO, null);
+ }
+
+ @Override
+ public PayWalletTransactionDO createWalletTransaction(WalletTransactionCreateReqBO bo) {
+ PayWalletTransactionDO transaction = PayWalletTransactionConvert.INSTANCE.convert(bo)
+ .setNo(noRedisDAO.generate(WALLET_NO_PREFIX));
+ payWalletTransactionMapper.insert(transaction);
+ return transaction;
+ }
+
+ @Override
+ public PayWalletTransactionDO getWalletTransactionByNo(String no) {
+ return payWalletTransactionMapper.selectByNo(no);
+ }
+
+ @Override
+ public PayWalletTransactionDO getWalletTransaction(String bizId, PayWalletBizTypeEnum type) {
+ return payWalletTransactionMapper.selectByBiz(bizId, type.getType());
+ }
+
+ @Override
+ public AppPayWalletTransactionSummaryRespVO getWalletTransactionSummary(Long userId, Integer userType, LocalDateTime[] createTime) {
+ PayWalletDO wallet = payWalletService.getOrCreateWallet(userId, userType);
+ return new AppPayWalletTransactionSummaryRespVO()
+ .setTotalExpense(payWalletTransactionMapper.selectPriceSum(wallet.getId(), TYPE_EXPENSE, createTime))
+ .setTotalIncome(payWalletTransactionMapper.selectPriceSum(wallet.getId(), TYPE_INCOME, createTime));
+ }
+
+}
diff --git a/yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/bo/WalletTransactionCreateReqBO.java b/yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/bo/WalletTransactionCreateReqBO.java
new file mode 100644
index 0000000..cde57f1
--- /dev/null
+++ b/yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/bo/WalletTransactionCreateReqBO.java
@@ -0,0 +1,59 @@
+package cn.iocoder.yudao.module.pay.service.wallet.bo;
+
+import cn.iocoder.yudao.framework.common.validation.InEnum;
+import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
+import lombok.Data;
+
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+
+/**
+ * 创建钱包流水 BO
+ *
+ * @author jason
+ */
+@Data
+public class WalletTransactionCreateReqBO {
+
+ /**
+ * 钱包编号
+ *
+ */
+ @NotNull(message = "钱包编号不能为空")
+ private Long walletId;
+
+ /**
+ * 交易金额,单位分
+ *
+ * 正值表示余额增加,负值表示余额减少
+ */
+ @NotNull(message = "交易金额不能为空")
+ private Integer price;
+
+ /**
+ * 交易后余额,单位分
+ */
+ @NotNull(message = "交易后余额不能为空")
+ private Integer balance;
+
+ /**
+ * 关联业务分类
+ *
+ * 枚举 {@link PayWalletBizTypeEnum#getType()}
+ */
+ @NotNull(message = "关联业务分类不能为空")
+ @InEnum(PayWalletBizTypeEnum.class)
+ private Integer bizType;
+
+ /**
+ * 关联业务编号
+ */
+ @NotEmpty(message = "关联业务编号不能为空")
+ private String bizId;
+
+ /**
+ * 流水说明
+ */
+ @NotEmpty(message = "流水说明不能为空")
+ private String title;
+}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/PayClientFactoryImplIntegrationTest.java b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/PayClientFactoryImplIntegrationTest.java
index 20a4b70..20a4b70 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/PayClientFactoryImplIntegrationTest.java
+++ b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/PayClientFactoryImplIntegrationTest.java
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AbstractAlipayClientTest.java b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AbstractAlipayClientTest.java
index cb723c9..cb723c9 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AbstractAlipayClientTest.java
+++ b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AbstractAlipayClientTest.java
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayBarPayClientTest.java b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayBarPayClientTest.java
index 3e6dda1..3e6dda1 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayBarPayClientTest.java
+++ b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayBarPayClientTest.java
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayPcPayClientTest.java b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayPcPayClientTest.java
index 62041f9..62041f9 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayPcPayClientTest.java
+++ b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayPcPayClientTest.java
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayQrPayClientTest.java b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayQrPayClientTest.java
index c82a004..c82a004 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayQrPayClientTest.java
+++ b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayQrPayClientTest.java
diff --git a/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayWapPayClientTest.java b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayWapPayClientTest.java
new file mode 100644
index 0000000..a094b68
--- /dev/null
+++ b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayWapPayClientTest.java
@@ -0,0 +1,111 @@
+package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay;
+
+import cn.hutool.http.Method;
+import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO;
+import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
+import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum;
+import com.alipay.api.AlipayApiException;
+import com.alipay.api.domain.AlipayTradeWapPayModel;
+import com.alipay.api.request.AlipayTradeWapPayRequest;
+import com.alipay.api.response.AlipayTradeWapPayResponse;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.mockito.ArgumentMatcher;
+import org.mockito.InjectMocks;
+
+import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
+import static cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum.CLOSED;
+import static cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum.WAITING;
+import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.when;
+
+/**
+ * {@link AlipayWapPayClient} 单元测试
+ *
+ * @author jason
+ */
+public class AlipayWapPayClientTest extends AbstractAlipayClientTest {
+
+ /**
+ * 支付宝 H5 支付 Client
+ */
+ @InjectMocks
+ private AlipayWapPayClient client = new AlipayWapPayClient(randomLongId(), config);
+
+ @BeforeEach
+ public void setUp() {
+ setClient(client);
+ }
+
+ @Test
+ @DisplayName("支付宝 H5 支付:下单成功")
+ public void testUnifiedOrder_success() throws AlipayApiException {
+ // mock 方法
+ String h5Body = randomString();
+ Integer price = randomInteger();
+ AlipayTradeWapPayResponse response = randomPojo(AlipayTradeWapPayResponse.class, o -> {
+ o.setSubCode("");
+ o.setBody(h5Body);
+ });
+ String notifyUrl = randomURL();
+ when(defaultAlipayClient.pageExecute(argThat((ArgumentMatcher) request -> {
+ assertInstanceOf(AlipayTradeWapPayModel.class, request.getBizModel());
+ AlipayTradeWapPayModel bizModel = (AlipayTradeWapPayModel) request.getBizModel();
+ assertEquals(String.valueOf(price / 100.0), bizModel.getTotalAmount());
+ assertEquals(notifyUrl, request.getNotifyUrl());
+ return true;
+ }), eq(Method.GET.name()))).thenReturn(response);
+ // 准备请求参数
+ String outTradeNo = randomString();
+ PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(notifyUrl, outTradeNo, price);
+
+ // 调用
+ PayOrderRespDTO resp = client.unifiedOrder(reqDTO);
+ // 断言
+ assertEquals(WAITING.getStatus(), resp.getStatus());
+ assertEquals(outTradeNo, resp.getOutTradeNo());
+ assertNull(resp.getChannelOrderNo());
+ assertNull(resp.getChannelUserId());
+ assertNull(resp.getSuccessTime());
+ assertEquals(PayOrderDisplayModeEnum.URL.getMode(), resp.getDisplayMode());
+ assertEquals(response.getBody(), resp.getDisplayContent());
+ assertSame(response, resp.getRawData());
+ assertNull(resp.getChannelErrorCode());
+ assertNull(resp.getChannelErrorMsg());
+ }
+
+ @Test
+ @DisplayName("支付宝 H5 支付:渠道返回失败")
+ public void test_unified_order_channel_failed() throws AlipayApiException {
+ // mock 方法
+ String subCode = randomString();
+ String subMsg = randomString();
+ AlipayTradeWapPayResponse response = randomPojo(AlipayTradeWapPayResponse.class, o -> {
+ o.setSubCode(subCode);
+ o.setSubMsg(subMsg);
+ });
+ when(defaultAlipayClient.pageExecute(argThat((ArgumentMatcher) request -> true),
+ eq(Method.GET.name()))).thenReturn(response);
+ String outTradeNo = randomString();
+ PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(randomURL(), outTradeNo, randomInteger());
+
+ // 调用
+ PayOrderRespDTO resp = client.unifiedOrder(reqDTO);
+ // 断言
+ assertEquals(CLOSED.getStatus(), resp.getStatus());
+ assertEquals(outTradeNo, resp.getOutTradeNo());
+ assertNull(resp.getChannelOrderNo());
+ assertNull(resp.getChannelUserId());
+ assertNull(resp.getSuccessTime());
+ assertNull(resp.getDisplayMode());
+ assertNull(resp.getDisplayContent());
+ assertSame(response, resp.getRawData());
+ assertEquals(subCode, resp.getChannelErrorCode());
+ assertEquals(subMsg, resp.getChannelErrorMsg());
+ }
+
+}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxBarPayClientIntegrationTest.java b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxBarPayClientIntegrationTest.java
index 9e79bb3..9e79bb3 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxBarPayClientIntegrationTest.java
+++ b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxBarPayClientIntegrationTest.java
diff --git a/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxNativePayClientIntegrationTest.java b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxNativePayClientIntegrationTest.java
new file mode 100644
index 0000000..4dd13eb
--- /dev/null
+++ b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxNativePayClientIntegrationTest.java
@@ -0,0 +1,84 @@
+package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin;
+
+import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
+import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
+import com.github.binarywang.wxpay.bean.request.WxPayRefundV3Request;
+import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request;
+import com.github.binarywang.wxpay.bean.result.WxPayRefundV3Result;
+import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum;
+import com.github.binarywang.wxpay.config.WxPayConfig;
+import com.github.binarywang.wxpay.exception.WxPayException;
+import com.github.binarywang.wxpay.service.WxPayService;
+import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+import java.time.Duration;
+
+import static cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin.AbstractWxPayClient.formatDateV3;
+
+
+/**
+ * {@link WxNativePayClient} 的集成测试,用于快速调试微信扫码支付
+ *
+ * @author 芋道源码
+ */
+@Disabled
+public class WxNativePayClientIntegrationTest {
+
+ @Test
+ public void testPayV3() throws WxPayException {
+ // 创建 config 配置
+ WxPayConfig config = buildWxPayConfigV3();
+ // 创建 WxPayService 客户端
+ WxPayService client = new WxPayServiceImpl();
+ client.setConfig(config);
+
+ // 执行发起支付
+ WxPayUnifiedOrderV3Request request = new WxPayUnifiedOrderV3Request()
+ .setOutTradeNo(String.valueOf(System.currentTimeMillis()))
+ .setDescription("测试支付-body")
+ .setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(1)) // 单位分
+ .setTimeExpire(formatDateV3(LocalDateTimeUtils.addTime(Duration.ofMinutes(2))))
+ .setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp("127.0.0.1"))
+ .setNotifyUrl("http://127.0.0.1:48080");
+ System.out.println("========= request ==========");
+ System.out.println(JsonUtils.toJsonPrettyString(request));
+ String response = client.createOrderV3(TradeTypeEnum.NATIVE, request);
+ System.out.println("========= response ==========");
+ System.out.println(JsonUtils.toJsonPrettyString(response));
+ }
+
+ @Test
+ public void testRefundV3() throws WxPayException {
+ // 创建 config 配置
+ WxPayConfig config = buildWxPayConfigV3();
+ // 创建 WxPayService 客户端
+ WxPayService client = new WxPayServiceImpl();
+ client.setConfig(config);
+
+ // 执行发起退款
+ WxPayRefundV3Request request = new WxPayRefundV3Request()
+ .setOutTradeNo("1689545729695")
+ .setOutRefundNo(String.valueOf(System.currentTimeMillis()))
+ .setAmount(new WxPayRefundV3Request.Amount().setTotal(1).setRefund(1).setCurrency("CNY"))
+ .setReason("就是想退了");
+ System.out.println("========= request ==========");
+ System.out.println(JsonUtils.toJsonPrettyString(request));
+ WxPayRefundV3Result response = client.refundV3(request);
+ System.out.println("========= response ==========");
+ System.out.println(JsonUtils.toJsonPrettyString(response));
+ }
+
+ private WxPayConfig buildWxPayConfigV3() {
+ WxPayConfig config = new WxPayConfig();
+ config.setAppId("wx62056c0d5e8db250");
+ config.setMchId("1545083881");
+ config.setApiV3Key("459arNsYHl1mgkiO6H9ZH5KkhFXSxaA4");
+// config.setCertSerialNo(serialNo);
+ config.setPrivateCertPath("/Users/yunai/Downloads/wx_pay/apiclient_cert.pem");
+ config.setPrivateKeyPath("/Users/yunai/Downloads/wx_pay/apiclient_key.pem");
+ return config;
+ }
+
+}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/app/PayAppServiceTest.java b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/app/PayAppServiceTest.java
index 326d586..326d586 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/app/PayAppServiceTest.java
+++ b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/app/PayAppServiceTest.java
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java
index 4e05b87..4e05b87 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java
+++ b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/channel/PayChannelServiceTest.java
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyServiceTest.java b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyServiceTest.java
index cfd01ae..cfd01ae 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyServiceTest.java
+++ b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyServiceTest.java
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java
index d5e449a..d5e449a 100755
--- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java
+++ b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceTest.java
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java
index 87c4cdb..87c4cdb 100755
--- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java
+++ b/yudao-module-pay/src/test/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceTest.java
diff --git a/yudao-module-pay/src/test/resources/application-unit-test.yaml b/yudao-module-pay/src/test/resources/application-unit-test.yaml
new file mode 100644
index 0000000..f05f050
--- /dev/null
+++ b/yudao-module-pay/src/test/resources/application-unit-test.yaml
@@ -0,0 +1,48 @@
+spring:
+ main:
+ lazy-initialization: true # 开启懒加载,加快速度
+ banner-mode: off # 单元测试,禁用 Banner
+
+--- #################### 数据库相关配置 ####################
+
+spring:
+ # 数据源配置项
+ datasource:
+ name: ruoyi-vue-pro
+ url: jdbc:h2:mem:testdb;MODE=MYSQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=value; # MODE 使用 MySQL 模式;DATABASE_TO_UPPER 配置表和字段使用小写
+ driver-class-name: org.h2.Driver
+ username: sa
+ password:
+ druid:
+ async-init: true # 单元测试,异步初始化 Druid 连接池,提升启动速度
+ initial-size: 1 # 单元测试,配置为 1,提升启动速度
+ sql:
+ init:
+ schema-locations: classpath:/sql/create_tables.sql
+
+ # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
+ data:
+ redis:
+ host: 127.0.0.1 # 地址
+ port: 16379 # 端口(单元测试,使用 16379 端口)
+ database: 0 # 数据库索引
+
+mybatis:
+ lazy-initialization: true # 单元测试,设置 MyBatis Mapper 延迟加载,加速每个单元测试
+
+--- #################### 定时任务相关配置 ####################
+
+--- #################### 配置中心相关配置 ####################
+
+--- #################### 服务保障相关配置 ####################
+
+# Lock4j 配置项(单元测试,禁用 Lock4j)
+
+--- #################### 监控相关配置 ####################
+
+--- #################### 芋道相关配置 ####################
+
+# 芋道配置项,设置当前项目所有自定义的配置
+yudao:
+ info:
+ base-package: cn.iocoder.yudao.module
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/resources/logback.xml b/yudao-module-pay/src/test/resources/logback.xml
index daf756b..daf756b 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/test/resources/logback.xml
+++ b/yudao-module-pay/src/test/resources/logback.xml
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/resources/sql/clean.sql b/yudao-module-pay/src/test/resources/sql/clean.sql
index 91fff0c..91fff0c 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/test/resources/sql/clean.sql
+++ b/yudao-module-pay/src/test/resources/sql/clean.sql
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/resources/sql/create_tables.sql b/yudao-module-pay/src/test/resources/sql/create_tables.sql
index 3f9f764..3f9f764 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/test/resources/sql/create_tables.sql
+++ b/yudao-module-pay/src/test/resources/sql/create_tables.sql
diff --git a/yudao-module-pay/yudao-module-pay-api/pom.xml b/yudao-module-pay/yudao-module-pay-api/pom.xml
deleted file mode 100644
index 0903abe..0000000
--- a/yudao-module-pay/yudao-module-pay-api/pom.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
- yudao-module-pay
- cn.iocoder.boot
- ${revision}
-
- 4.0.0
- yudao-module-pay-api
- jar
-
- ${project.artifactId}
-
- pay 模块 API,暴露给其它模块调用
-
-
-
-
- cn.iocoder.boot
- yudao-common
-
-
-
-
- org.springframework.boot
- spring-boot-starter-validation
- true
-
-
-
-
diff --git a/yudao-module-pay/yudao-module-pay-biz/pom.xml b/yudao-module-pay/yudao-module-pay-biz/pom.xml
deleted file mode 100644
index 6089d53..0000000
--- a/yudao-module-pay/yudao-module-pay-biz/pom.xml
+++ /dev/null
@@ -1,93 +0,0 @@
-
-
-
- cn.iocoder.boot
- yudao-module-pay
- ${revision}
-
- 4.0.0
- yudao-module-pay-biz
- jar
-
- ${project.artifactId}
-
- pay 模块,我们放支付业务,提供业务的支付能力。
- 例如说:商户、应用、支付、退款等等
-
-
-
-
- cn.iocoder.boot
- yudao-module-system-api
- ${revision}
-
-
- cn.iocoder.boot
- yudao-module-pay-api
- ${revision}
-
-
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-biz-tenant
-
-
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-security
-
-
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-mybatis
-
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-redis
-
-
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-job
-
-
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-test
- test
-
-
-
-
- cn.iocoder.boot
- yudao-spring-boot-starter-excel
-
-
-
-
- com.alipay.sdk
- alipay-sdk-java
- 4.35.79.ALL
-
-
- org.bouncycastle
- bcprov-jdk15on
-
-
-
-
- com.github.binarywang
- weixin-java-pay
-
-
-
-
-
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoOrderService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoOrderService.java
deleted file mode 100644
index 18de7b9..0000000
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoOrderService.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package cn.iocoder.yudao.module.pay.service.demo;
-
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.order.PayDemoOrderCreateReqVO;
-import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoOrderDO;
-
-import jakarta.validation.Valid;
-
-/**
- * 示例订单 Service 接口
- *
- * @author 芋道源码
- */
-public interface PayDemoOrderService {
-
- /**
- * 创建示例订单
- *
- * @param userId 用户编号
- * @param createReqVO 创建信息
- * @return 编号
- */
- Long createDemoOrder(Long userId, @Valid PayDemoOrderCreateReqVO createReqVO);
-
- /**
- * 获得示例订单
- *
- * @param id 编号
- * @return 示例订单
- */
- PayDemoOrderDO getDemoOrder(Long id);
-
- /**
- * 获得示例订单分页
- *
- * @param pageReqVO 分页查询
- * @return 示例订单分页
- */
- PageResult getDemoOrderPage(PageParam pageReqVO);
-
- /**
- * 更新示例订单为已支付
- *
- * @param id 编号
- * @param payOrderId 支付订单号
- */
- void updateDemoOrderPaid(Long id, Long payOrderId);
-
- /**
- * 发起示例订单的退款
- *
- * @param id 编号
- * @param userIp 用户编号
- */
- void refundDemoOrder(Long id, String userIp);
-
- /**
- * 更新示例订单为已退款
- *
- * @param id 编号
- * @param refundId 退款编号
- * @param payRefundId 退款订单号
- */
- void updateDemoOrderRefunded(Long id, String refundId, Long payRefundId);
-
-}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoWithdrawService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoWithdrawService.java
deleted file mode 100644
index e8a5980..0000000
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/demo/PayDemoWithdrawService.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package cn.iocoder.yudao.module.pay.service.demo;
-
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.withdraw.PayDemoWithdrawCreateReqVO;
-import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoWithdrawDO;
-
-import jakarta.validation.Valid;
-
-/**
- * 示例提现单 Service 接口
- *
- * @author jason
- */
-public interface PayDemoWithdrawService {
-
- /**
- * 创建示例提现单
- *
- * @param createReqVO 创建信息
- * @return 编号
- */
- Long createDemoWithdraw(@Valid PayDemoWithdrawCreateReqVO createReqVO);
-
- /**
- * 提现单转账
- *
- * @param id 提现单编号
- * @return 转账编号
- */
- Long transferDemoWithdraw(Long id);
-
- /**
- * 获得示例提现单分页
- *
- * @param pageVO 分页查询参数
- */
- PageResult getDemoWithdrawPage(PageParam pageVO);
-
- /**
- * 更新示例提现单的状态
- *
- * @param id 编号
- * @param payTransferId 转账单编号
- */
- void updateDemoWithdrawTransferred(Long id, Long payTransferId);
-
-}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyService.java
deleted file mode 100644
index ed93997..0000000
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyService.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package cn.iocoder.yudao.module.pay.service.notify;
-
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.pay.controller.admin.notify.vo.PayNotifyTaskPageReqVO;
-import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyLogDO;
-import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyTaskDO;
-
-import java.util.List;
-
-/**
- * 回调通知 Service 接口
- *
- * @author 芋道源码
- */
-public interface PayNotifyService {
-
- /**
- * 创建回调通知任务
- *
- * @param type 类型
- * @param dataId 数据编号
- */
- void createPayNotifyTask(Integer type, Long dataId);
-
- /**
- * 执行回调通知
- *
- * 注意,该方法提供给定时任务调用。目前是 yudao-server 进行调用
- * @return 通知数量
- */
- int executeNotify() throws InterruptedException;
-
- /**
- * 获得回调通知
- *
- * @param id 编号
- * @return 回调通知
- */
- PayNotifyTaskDO getNotifyTask(Long id);
-
- /**
- * 获得回调通知分页
- *
- * @param pageReqVO 分页查询
- * @return 回调通知分页
- */
- PageResult getNotifyTaskPage(PayNotifyTaskPageReqVO pageReqVO);
-
- /**
- * 获得回调日志列表
- *
- * @param taskId 任务编号
- * @return 日志列表
- */
- List getNotifyLogList(Long taskId);
-
-}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundService.java
deleted file mode 100755
index 38b6e15..0000000
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundService.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package cn.iocoder.yudao.module.pay.service.refund;
-
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.refund.PayRefundRespDTO;
-import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO;
-import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO;
-import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundPageReqVO;
-import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
-
-import java.util.List;
-
-/**
- * 退款订单 Service 接口
- *
- * @author aquan
- */
-public interface PayRefundService {
-
- /**
- * 获得退款订单
- *
- * @param id 编号
- * @return 退款订单
- */
- PayRefundDO getRefund(Long id);
-
- /**
- * 获得退款订单
- *
- * @param no 外部退款单号
- * @return 退款订单
- */
- PayRefundDO getRefundByNo(String no);
-
- /**
- * 获得指定应用的退款数量
- *
- * @param appId 应用编号
- * @return 退款数量
- */
- Long getRefundCountByAppId(Long appId);
-
- /**
- * 获得退款订单分页
- *
- * @param pageReqVO 分页查询
- * @return 退款订单分页
- */
- PageResult getRefundPage(PayRefundPageReqVO pageReqVO);
-
- /**
- * 获得退款订单列表, 用于 Excel 导出
- *
- * @param exportReqVO 查询条件
- * @return 退款订单列表
- */
- List getRefundList(PayRefundExportReqVO exportReqVO);
-
- /**
- * 创建退款申请
- *
- * @param reqDTO 退款申请信息
- * @return 退款单号
- */
- Long createRefund(PayRefundCreateReqDTO reqDTO);
-
- /**
- * 渠道的退款通知
- *
- * @param channelId 渠道编号
- * @param notify 通知
- */
- void notifyRefund(Long channelId, PayRefundRespDTO notify);
-
- /**
- * 同步渠道退款的退款状态
- *
- * @return 同步到状态的退款数量,包括退款成功、退款失败
- */
- int syncRefund();
-
-}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/transfer/PayTransferService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/transfer/PayTransferService.java
deleted file mode 100644
index e2a1dbd..0000000
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/transfer/PayTransferService.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package cn.iocoder.yudao.module.pay.service.transfer;
-
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.transfer.PayTransferRespDTO;
-import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferCreateReqDTO;
-import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferCreateRespDTO;
-import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferPageReqVO;
-import cn.iocoder.yudao.module.pay.dal.dataobject.transfer.PayTransferDO;
-import jakarta.validation.Valid;
-
-/**
- * 转账 Service 接口
- *
- * @author jason
- */
-public interface PayTransferService {
-
- /**
- * 创建转账单,并发起转账
- *
- * @param reqDTO 创建请求
- * @return 转账单编号
- */
- PayTransferCreateRespDTO createTransfer(@Valid PayTransferCreateReqDTO reqDTO);
-
- /**
- * 获取转账单
- * @param id 转账单编号
- */
- PayTransferDO getTransfer(Long id);
-
- /**
- * 根据转账单号获取转账单
- *
- * @param no 转账单号
- * @return 转账单
- */
- PayTransferDO getTransferByNo(String no);
-
- /**
- * 获得转账单分页
- *
- * @param pageReqVO 分页查询
- * @return 转账单分页
- */
- PageResult getTransferPage(PayTransferPageReqVO pageReqVO);
-
- /**
- * 同步渠道转账单状态
- *
- * @return 同步到状态的转账数量,包括转账成功、转账失败、转账中的
- */
- int syncTransfer();
-
- /**
- * 【单个】同步渠道转账单状态
- *
- * @param id 转账单编号
- */
- void syncTransfer(Long id);
-
- /**
- * 渠道的转账通知
- *
- * @param channelId 渠道编号
- * @param notify 通知
- */
- void notifyTransfer(Long channelId, PayTransferRespDTO notify);
-
-}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargePackageService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargePackageService.java
deleted file mode 100644
index 06e4632..0000000
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargePackageService.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package cn.iocoder.yudao.module.pay.service.wallet;
-
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageCreateReqVO;
-import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackagePageReqVO;
-import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageUpdateReqVO;
-import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO;
-
-import jakarta.validation.Valid;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * 钱包充值套餐 Service 接口
- *
- * @author jason
- */
-public interface PayWalletRechargePackageService {
-
- /**
- * 获取钱包充值套餐
- * @param packageId 充值套餐编号
- */
- PayWalletRechargePackageDO getWalletRechargePackage(Long packageId);
-
- /**
- * 校验钱包充值套餐的有效性, 无效的话抛出 ServiceException 异常
- *
- * @param packageId 充值套餐编号
- */
- PayWalletRechargePackageDO validWalletRechargePackage(Long packageId);
-
- /**
- * 创建充值套餐
- *
- * @param createReqVO 创建信息
- * @return 编号
- */
- Long createWalletRechargePackage(@Valid WalletRechargePackageCreateReqVO createReqVO);
-
- /**
- * 更新充值套餐
- *
- * @param updateReqVO 更新信息
- */
- void updateWalletRechargePackage(@Valid WalletRechargePackageUpdateReqVO updateReqVO);
-
- /**
- * 删除充值套餐
- *
- * @param id 编号
- */
- void deleteWalletRechargePackage(Long id);
-
- /**
- * 获得充值套餐分页
- *
- * @param pageReqVO 分页查询
- * @return 充值套餐分页
- */
- PageResult getWalletRechargePackagePage(WalletRechargePackagePageReqVO pageReqVO);
-
- /**
- * 获得充值套餐列表
- *
- * @param status 状态
- * @return 充值套餐列表
- */
- List getWalletRechargePackageList(Integer status);
-
-}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargePackageServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargePackageServiceImpl.java
deleted file mode 100644
index 82fa676..0000000
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargePackageServiceImpl.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package cn.iocoder.yudao.module.pay.service.wallet;
-
-import cn.hutool.core.util.StrUtil;
-import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageCreateReqVO;
-import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackagePageReqVO;
-import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageUpdateReqVO;
-import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletRechargePackageConvert;
-import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO;
-import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletRechargePackageMapper;
-import org.springframework.stereotype.Service;
-
-import jakarta.annotation.Resource;
-
-import java.util.List;
-
-import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
-import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*;
-
-/**
- * 钱包充值套餐 Service 实现类
- *
- * @author jason
- */
-@Service
-public class PayWalletRechargePackageServiceImpl implements PayWalletRechargePackageService {
-
- @Resource
- private PayWalletRechargePackageMapper walletRechargePackageMapper;
-
- @Override
- public PayWalletRechargePackageDO getWalletRechargePackage(Long packageId) {
- return walletRechargePackageMapper.selectById(packageId);
- }
-
- @Override
- public PayWalletRechargePackageDO validWalletRechargePackage(Long packageId) {
- PayWalletRechargePackageDO rechargePackageDO = walletRechargePackageMapper.selectById(packageId);
- if (rechargePackageDO == null) {
- throw exception(WALLET_RECHARGE_PACKAGE_NOT_FOUND);
- }
- if (CommonStatusEnum.DISABLE.getStatus().equals(rechargePackageDO.getStatus())) {
- throw exception(WALLET_RECHARGE_PACKAGE_IS_DISABLE);
- }
- return rechargePackageDO;
- }
-
- @Override
- public Long createWalletRechargePackage(WalletRechargePackageCreateReqVO createReqVO) {
- // 校验套餐名是否唯一
- validateRechargePackageNameUnique(null, createReqVO.getName());
-
- // 插入
- PayWalletRechargePackageDO walletRechargePackage = PayWalletRechargePackageConvert.INSTANCE.convert(createReqVO);
- walletRechargePackageMapper.insert(walletRechargePackage);
- // 返回
- return walletRechargePackage.getId();
- }
-
- @Override
- public void updateWalletRechargePackage(WalletRechargePackageUpdateReqVO updateReqVO) {
- // 校验存在
- validateWalletRechargePackageExists(updateReqVO.getId());
- // 校验套餐名是否唯一
- validateRechargePackageNameUnique(updateReqVO.getId(), updateReqVO.getName());
-
- // 更新
- PayWalletRechargePackageDO updateObj = PayWalletRechargePackageConvert.INSTANCE.convert(updateReqVO);
- walletRechargePackageMapper.updateById(updateObj);
- }
-
- private void validateRechargePackageNameUnique(Long id, String name) {
- if (StrUtil.isBlank(name)) {
- return;
- }
- PayWalletRechargePackageDO rechargePackage = walletRechargePackageMapper.selectByName(name);
- if (rechargePackage == null) {
- return ;
- }
- if (id == null) {
- throw exception(WALLET_RECHARGE_PACKAGE_NAME_EXISTS);
- }
- if (!id.equals(rechargePackage.getId())) {
- throw exception(WALLET_RECHARGE_PACKAGE_NAME_EXISTS);
- }
- }
-
- @Override
- public void deleteWalletRechargePackage(Long id) {
- // 校验存在
- validateWalletRechargePackageExists(id);
- // 删除
- walletRechargePackageMapper.deleteById(id);
- }
-
- private void validateWalletRechargePackageExists(Long id) {
- if (walletRechargePackageMapper.selectById(id) == null) {
- throw exception(WALLET_RECHARGE_PACKAGE_NOT_FOUND);
- }
- }
-
- @Override
- public PageResult getWalletRechargePackagePage(WalletRechargePackagePageReqVO pageReqVO) {
- return walletRechargePackageMapper.selectPage(pageReqVO);
- }
-
- @Override
- public List getWalletRechargePackageList(Integer status) {
- return walletRechargePackageMapper.selectListByStatus(status);
- }
-
-}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeService.java
deleted file mode 100644
index f2ab50e..0000000
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeService.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package cn.iocoder.yudao.module.pay.service.wallet;
-
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateReqVO;
-import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO;
-
-/**
- * 钱包充值 Service 接口
- *
- * @author jason
- */
-public interface PayWalletRechargeService {
-
- /**
- * 创建钱包充值记录(发起充值)
- *
- * @param userId 用户编号
- * @param userType 用户类型
- * @param createReqVO 钱包充值请求 VO
- * @param userIp 用户Ip
- * @return 钱包充值记录
- */
- PayWalletRechargeDO createWalletRecharge(Long userId, Integer userType, String userIp,
- AppPayWalletRechargeCreateReqVO createReqVO);
-
- /**
- * 获得钱包充值记录分页
- *
- * @param userId 用户编号
- * @param userType 用户类型
- * @param pageReqVO 分页请求
- * @param payStatus 是否支付
- * @return 钱包充值记录分页
- */
- PageResult getWalletRechargePackagePage(Long userId, Integer userType,
- PageParam pageReqVO, Boolean payStatus);
-
- /**
- * 更新钱包充值成功
- *
- * @param id 钱包充值记录编号
- * @param payOrderId 支付订单编号
- */
- void updateWalletRechargerPaid(Long id, Long payOrderId);
-
- /**
- * 发起钱包充值退款
- *
- * @param id 钱包充值编号
- * @param userIp 用户 ip 地址
- */
- void refundWalletRecharge(Long id, String userIp);
-
- /**
- * 更新钱包充值记录为已退款
- *
- * @param id 钱包充值记录编号
- * @param refundId 钱包充值退款编号(实际和 id 相同)
- * @param payRefundId 退款单id
- */
- void updateWalletRechargeRefunded(Long id, Long refundId, Long payRefundId);
-
-}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java
deleted file mode 100644
index 6efdc92..0000000
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package cn.iocoder.yudao.module.pay.service.wallet;
-
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO;
-import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
-import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
-import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
-
-/**
- * 钱包 Service 接口
- *
- * @author jason
- */
-public interface PayWalletService {
-
- /**
- * 获取钱包信息
- *
- * 如果不存在,则创建钱包。由于用户注册时候不会创建钱包
- *
- * @param userId 用户编号
- * @param userType 用户类型
- */
- PayWalletDO getOrCreateWallet(Long userId, Integer userType);
-
- /**
- * 获取钱包信息
- *
- * @param walletId 钱包 id
- */
- PayWalletDO getWallet(Long walletId);
-
- /**
- * 获得会员钱包分页
- *
- * @param pageReqVO 分页查询
- * @return 会员钱包分页
- */
- PageResult getWalletPage(PayWalletPageReqVO pageReqVO);
-
- /**
- * 钱包订单支付
- *
- * @param walletId 钱包编号
- * @param outTradeNo 外部订单号
- * @param price 金额
- */
- PayWalletTransactionDO orderPay(Long walletId, String outTradeNo, Integer price);
-
- /**
- * 钱包订单支付退款
- *
- * @param outRefundNo 外部退款号
- * @param refundPrice 退款金额
- * @param reason 退款原因
- */
- PayWalletTransactionDO orderRefund(String outRefundNo, Integer refundPrice, String reason);
-
- /**
- * 扣减钱包余额
- *
- * @param walletId 钱包编号
- * @param bizId 业务关联编号
- * @param bizType 业务关联分类
- * @param price 扣减金额
- * @return 钱包流水
- */
- PayWalletTransactionDO reduceWalletBalance(Long walletId, Long bizId,
- PayWalletBizTypeEnum bizType, Integer price);
-
- /**
- * 增加钱包余额
- *
- * @param walletId 钱包编号
- * @param bizId 业务关联编号
- * @param bizType 业务关联分类
- * @param price 增加金额
- * @return 钱包流水
- */
- PayWalletTransactionDO addWalletBalance(Long walletId, String bizId,
- PayWalletBizTypeEnum bizType, Integer price);
-
- /**
- * 冻结钱包部分余额
- *
- * @param id 钱包编号
- * @param price 冻结金额
- */
- void freezePrice(Long id, Integer price);
-
- /**
- * 解冻钱包余额
- *
- * @param id 钱包编号
- * @param price 解冻金额
- */
- void unfreezePrice(Long id, Integer price);
-
-}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionService.java
deleted file mode 100644
index af9c6a8..0000000
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionService.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package cn.iocoder.yudao.module.pay.service.wallet;
-
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionPageReqVO;
-import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO;
-import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionSummaryRespVO;
-import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
-import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
-import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO;
-
-import jakarta.validation.Valid;
-
-import java.time.LocalDateTime;
-
-/**
- * 钱包余额流水 Service 接口
- *
- * @author jason
- */
-public interface PayWalletTransactionService {
-
- /**
- * 查询钱包余额流水分页
- *
- * @param userId 用户编号
- * @param userType 用户类型
- * @param pageVO 分页查询参数
- */
- PageResult getWalletTransactionPage(Long userId, Integer userType,
- AppPayWalletTransactionPageReqVO pageVO);
-
- /**
- * 查询钱包余额流水分页
- *
- * @param pageVO 分页查询参数
- */
- PageResult getWalletTransactionPage(PayWalletTransactionPageReqVO pageVO);
-
- /**
- * 新增钱包余额流水
- *
- * @param bo 创建钱包流水 bo
- * @return 新建的钱包 do
- */
- PayWalletTransactionDO createWalletTransaction(@Valid WalletTransactionCreateReqBO bo);
-
- /**
- * 根据 no,获取钱包余流水
- *
- * @param no 流水号
- */
- PayWalletTransactionDO getWalletTransactionByNo(String no);
-
- /**
- * 获取钱包流水
- *
- * @param bizId 业务编号
- * @param type 业务类型
- * @return 钱包流水
- */
- PayWalletTransactionDO getWalletTransaction(String bizId, PayWalletBizTypeEnum type);
-
- /**
- * 获得钱包流水统计
- *
- * @param userId 用户编号
- * @param userType 用户类型
- * @param createTime 时间段
- * @return 钱包流水统计
- */
- AppPayWalletTransactionSummaryRespVO getWalletTransactionSummary(Long userId, Integer userType,
- LocalDateTime[] createTime);
-
-}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionServiceImpl.java
deleted file mode 100644
index 4c01cd8..0000000
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionServiceImpl.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package cn.iocoder.yudao.module.pay.service.wallet;
-
-import cn.hutool.core.util.ObjectUtil;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionPageReqVO;
-import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO;
-import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionSummaryRespVO;
-import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert;
-import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
-import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
-import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletTransactionMapper;
-import cn.iocoder.yudao.module.pay.dal.redis.no.PayNoRedisDAO;
-import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
-import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO;
-import jakarta.annotation.Resource;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-import org.springframework.validation.annotation.Validated;
-
-import java.time.LocalDateTime;
-
-import static cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO.TYPE_EXPENSE;
-import static cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO.TYPE_INCOME;
-
-/**
- * 钱包流水 Service 实现类
- *
- * @author jason
- */
-@Service
-@Slf4j
-@Validated
-public class PayWalletTransactionServiceImpl implements PayWalletTransactionService {
-
- /**
- * 钱包流水的 no 前缀
- */
- private static final String WALLET_NO_PREFIX = "W";
-
- @Resource
- private PayWalletService payWalletService;
- @Resource
- private PayWalletTransactionMapper payWalletTransactionMapper;
- @Resource
- private PayNoRedisDAO noRedisDAO;
-
- @Override
- public PageResult getWalletTransactionPage(Long userId, Integer userType,
- AppPayWalletTransactionPageReqVO pageVO) {
- PayWalletDO wallet = payWalletService.getOrCreateWallet(userId, userType);
- return payWalletTransactionMapper.selectPage(wallet.getId(), pageVO.getType(), pageVO, pageVO.getCreateTime());
- }
-
- @Override
- public PageResult getWalletTransactionPage(PayWalletTransactionPageReqVO pageVO) {
- // 基于 userId + userType 查询钱包
- if (pageVO.getWalletId() == null
- && ObjectUtil.isAllNotEmpty(pageVO.getUserId(), pageVO.getUserType())) {
- PayWalletDO wallet = payWalletService.getOrCreateWallet(pageVO.getUserId(), pageVO.getUserType());
- if (wallet != null) {
- pageVO.setWalletId(wallet.getId());
- }
- }
-
- // 查询分页
- return payWalletTransactionMapper.selectPage(pageVO.getWalletId(), null, pageVO, null);
- }
-
- @Override
- public PayWalletTransactionDO createWalletTransaction(WalletTransactionCreateReqBO bo) {
- PayWalletTransactionDO transaction = PayWalletTransactionConvert.INSTANCE.convert(bo)
- .setNo(noRedisDAO.generate(WALLET_NO_PREFIX));
- payWalletTransactionMapper.insert(transaction);
- return transaction;
- }
-
- @Override
- public PayWalletTransactionDO getWalletTransactionByNo(String no) {
- return payWalletTransactionMapper.selectByNo(no);
- }
-
- @Override
- public PayWalletTransactionDO getWalletTransaction(String bizId, PayWalletBizTypeEnum type) {
- return payWalletTransactionMapper.selectByBiz(bizId, type.getType());
- }
-
- @Override
- public AppPayWalletTransactionSummaryRespVO getWalletTransactionSummary(Long userId, Integer userType, LocalDateTime[] createTime) {
- PayWalletDO wallet = payWalletService.getOrCreateWallet(userId, userType);
- return new AppPayWalletTransactionSummaryRespVO()
- .setTotalExpense(payWalletTransactionMapper.selectPriceSum(wallet.getId(), TYPE_EXPENSE, createTime))
- .setTotalIncome(payWalletTransactionMapper.selectPriceSum(wallet.getId(), TYPE_INCOME, createTime));
- }
-
-}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/bo/WalletTransactionCreateReqBO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/bo/WalletTransactionCreateReqBO.java
deleted file mode 100644
index cde57f1..0000000
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/bo/WalletTransactionCreateReqBO.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package cn.iocoder.yudao.module.pay.service.wallet.bo;
-
-import cn.iocoder.yudao.framework.common.validation.InEnum;
-import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
-import lombok.Data;
-
-import jakarta.validation.constraints.NotEmpty;
-import jakarta.validation.constraints.NotNull;
-
-/**
- * 创建钱包流水 BO
- *
- * @author jason
- */
-@Data
-public class WalletTransactionCreateReqBO {
-
- /**
- * 钱包编号
- *
- */
- @NotNull(message = "钱包编号不能为空")
- private Long walletId;
-
- /**
- * 交易金额,单位分
- *
- * 正值表示余额增加,负值表示余额减少
- */
- @NotNull(message = "交易金额不能为空")
- private Integer price;
-
- /**
- * 交易后余额,单位分
- */
- @NotNull(message = "交易后余额不能为空")
- private Integer balance;
-
- /**
- * 关联业务分类
- *
- * 枚举 {@link PayWalletBizTypeEnum#getType()}
- */
- @NotNull(message = "关联业务分类不能为空")
- @InEnum(PayWalletBizTypeEnum.class)
- private Integer bizType;
-
- /**
- * 关联业务编号
- */
- @NotEmpty(message = "关联业务编号不能为空")
- private String bizId;
-
- /**
- * 流水说明
- */
- @NotEmpty(message = "流水说明不能为空")
- private String title;
-}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayWapPayClientTest.java b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayWapPayClientTest.java
deleted file mode 100644
index a094b68..0000000
--- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/alipay/AlipayWapPayClientTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.alipay;
-
-import cn.hutool.http.Method;
-import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderRespDTO;
-import cn.iocoder.yudao.module.pay.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
-import cn.iocoder.yudao.module.pay.framework.pay.core.enums.PayOrderDisplayModeEnum;
-import com.alipay.api.AlipayApiException;
-import com.alipay.api.domain.AlipayTradeWapPayModel;
-import com.alipay.api.request.AlipayTradeWapPayRequest;
-import com.alipay.api.response.AlipayTradeWapPayResponse;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentMatcher;
-import org.mockito.InjectMocks;
-
-import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
-import static cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum.CLOSED;
-import static cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum.WAITING;
-import static org.junit.jupiter.api.Assertions.*;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.mockito.ArgumentMatchers.argThat;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.when;
-
-/**
- * {@link AlipayWapPayClient} 单元测试
- *
- * @author jason
- */
-public class AlipayWapPayClientTest extends AbstractAlipayClientTest {
-
- /**
- * 支付宝 H5 支付 Client
- */
- @InjectMocks
- private AlipayWapPayClient client = new AlipayWapPayClient(randomLongId(), config);
-
- @BeforeEach
- public void setUp() {
- setClient(client);
- }
-
- @Test
- @DisplayName("支付宝 H5 支付:下单成功")
- public void testUnifiedOrder_success() throws AlipayApiException {
- // mock 方法
- String h5Body = randomString();
- Integer price = randomInteger();
- AlipayTradeWapPayResponse response = randomPojo(AlipayTradeWapPayResponse.class, o -> {
- o.setSubCode("");
- o.setBody(h5Body);
- });
- String notifyUrl = randomURL();
- when(defaultAlipayClient.pageExecute(argThat((ArgumentMatcher) request -> {
- assertInstanceOf(AlipayTradeWapPayModel.class, request.getBizModel());
- AlipayTradeWapPayModel bizModel = (AlipayTradeWapPayModel) request.getBizModel();
- assertEquals(String.valueOf(price / 100.0), bizModel.getTotalAmount());
- assertEquals(notifyUrl, request.getNotifyUrl());
- return true;
- }), eq(Method.GET.name()))).thenReturn(response);
- // 准备请求参数
- String outTradeNo = randomString();
- PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(notifyUrl, outTradeNo, price);
-
- // 调用
- PayOrderRespDTO resp = client.unifiedOrder(reqDTO);
- // 断言
- assertEquals(WAITING.getStatus(), resp.getStatus());
- assertEquals(outTradeNo, resp.getOutTradeNo());
- assertNull(resp.getChannelOrderNo());
- assertNull(resp.getChannelUserId());
- assertNull(resp.getSuccessTime());
- assertEquals(PayOrderDisplayModeEnum.URL.getMode(), resp.getDisplayMode());
- assertEquals(response.getBody(), resp.getDisplayContent());
- assertSame(response, resp.getRawData());
- assertNull(resp.getChannelErrorCode());
- assertNull(resp.getChannelErrorMsg());
- }
-
- @Test
- @DisplayName("支付宝 H5 支付:渠道返回失败")
- public void test_unified_order_channel_failed() throws AlipayApiException {
- // mock 方法
- String subCode = randomString();
- String subMsg = randomString();
- AlipayTradeWapPayResponse response = randomPojo(AlipayTradeWapPayResponse.class, o -> {
- o.setSubCode(subCode);
- o.setSubMsg(subMsg);
- });
- when(defaultAlipayClient.pageExecute(argThat((ArgumentMatcher) request -> true),
- eq(Method.GET.name()))).thenReturn(response);
- String outTradeNo = randomString();
- PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(randomURL(), outTradeNo, randomInteger());
-
- // 调用
- PayOrderRespDTO resp = client.unifiedOrder(reqDTO);
- // 断言
- assertEquals(CLOSED.getStatus(), resp.getStatus());
- assertEquals(outTradeNo, resp.getOutTradeNo());
- assertNull(resp.getChannelOrderNo());
- assertNull(resp.getChannelUserId());
- assertNull(resp.getSuccessTime());
- assertNull(resp.getDisplayMode());
- assertNull(resp.getDisplayContent());
- assertSame(response, resp.getRawData());
- assertEquals(subCode, resp.getChannelErrorCode());
- assertEquals(subMsg, resp.getChannelErrorMsg());
- }
-
-}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxNativePayClientIntegrationTest.java b/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxNativePayClientIntegrationTest.java
deleted file mode 100644
index 4dd13eb..0000000
--- a/yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/framework/pay/core/client/impl/weixin/WxNativePayClientIntegrationTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin;
-
-import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
-import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
-import com.github.binarywang.wxpay.bean.request.WxPayRefundV3Request;
-import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request;
-import com.github.binarywang.wxpay.bean.result.WxPayRefundV3Result;
-import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum;
-import com.github.binarywang.wxpay.config.WxPayConfig;
-import com.github.binarywang.wxpay.exception.WxPayException;
-import com.github.binarywang.wxpay.service.WxPayService;
-import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-
-import java.time.Duration;
-
-import static cn.iocoder.yudao.module.pay.framework.pay.core.client.impl.weixin.AbstractWxPayClient.formatDateV3;
-
-
-/**
- * {@link WxNativePayClient} 的集成测试,用于快速调试微信扫码支付
- *
- * @author 芋道源码
- */
-@Disabled
-public class WxNativePayClientIntegrationTest {
-
- @Test
- public void testPayV3() throws WxPayException {
- // 创建 config 配置
- WxPayConfig config = buildWxPayConfigV3();
- // 创建 WxPayService 客户端
- WxPayService client = new WxPayServiceImpl();
- client.setConfig(config);
-
- // 执行发起支付
- WxPayUnifiedOrderV3Request request = new WxPayUnifiedOrderV3Request()
- .setOutTradeNo(String.valueOf(System.currentTimeMillis()))
- .setDescription("测试支付-body")
- .setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(1)) // 单位分
- .setTimeExpire(formatDateV3(LocalDateTimeUtils.addTime(Duration.ofMinutes(2))))
- .setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp("127.0.0.1"))
- .setNotifyUrl("http://127.0.0.1:48080");
- System.out.println("========= request ==========");
- System.out.println(JsonUtils.toJsonPrettyString(request));
- String response = client.createOrderV3(TradeTypeEnum.NATIVE, request);
- System.out.println("========= response ==========");
- System.out.println(JsonUtils.toJsonPrettyString(response));
- }
-
- @Test
- public void testRefundV3() throws WxPayException {
- // 创建 config 配置
- WxPayConfig config = buildWxPayConfigV3();
- // 创建 WxPayService 客户端
- WxPayService client = new WxPayServiceImpl();
- client.setConfig(config);
-
- // 执行发起退款
- WxPayRefundV3Request request = new WxPayRefundV3Request()
- .setOutTradeNo("1689545729695")
- .setOutRefundNo(String.valueOf(System.currentTimeMillis()))
- .setAmount(new WxPayRefundV3Request.Amount().setTotal(1).setRefund(1).setCurrency("CNY"))
- .setReason("就是想退了");
- System.out.println("========= request ==========");
- System.out.println(JsonUtils.toJsonPrettyString(request));
- WxPayRefundV3Result response = client.refundV3(request);
- System.out.println("========= response ==========");
- System.out.println(JsonUtils.toJsonPrettyString(response));
- }
-
- private WxPayConfig buildWxPayConfigV3() {
- WxPayConfig config = new WxPayConfig();
- config.setAppId("wx62056c0d5e8db250");
- config.setMchId("1545083881");
- config.setApiV3Key("459arNsYHl1mgkiO6H9ZH5KkhFXSxaA4");
-// config.setCertSerialNo(serialNo);
- config.setPrivateCertPath("/Users/yunai/Downloads/wx_pay/apiclient_cert.pem");
- config.setPrivateKeyPath("/Users/yunai/Downloads/wx_pay/apiclient_key.pem");
- return config;
- }
-
-}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/test/resources/application-unit-test.yaml b/yudao-module-pay/yudao-module-pay-biz/src/test/resources/application-unit-test.yaml
deleted file mode 100644
index f05f050..0000000
--- a/yudao-module-pay/yudao-module-pay-biz/src/test/resources/application-unit-test.yaml
+++ /dev/null
@@ -1,48 +0,0 @@
-spring:
- main:
- lazy-initialization: true # 开启懒加载,加快速度
- banner-mode: off # 单元测试,禁用 Banner
-
---- #################### 数据库相关配置 ####################
-
-spring:
- # 数据源配置项
- datasource:
- name: ruoyi-vue-pro
- url: jdbc:h2:mem:testdb;MODE=MYSQL;DATABASE_TO_UPPER=false;NON_KEYWORDS=value; # MODE 使用 MySQL 模式;DATABASE_TO_UPPER 配置表和字段使用小写
- driver-class-name: org.h2.Driver
- username: sa
- password:
- druid:
- async-init: true # 单元测试,异步初始化 Druid 连接池,提升启动速度
- initial-size: 1 # 单元测试,配置为 1,提升启动速度
- sql:
- init:
- schema-locations: classpath:/sql/create_tables.sql
-
- # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
- data:
- redis:
- host: 127.0.0.1 # 地址
- port: 16379 # 端口(单元测试,使用 16379 端口)
- database: 0 # 数据库索引
-
-mybatis:
- lazy-initialization: true # 单元测试,设置 MyBatis Mapper 延迟加载,加速每个单元测试
-
---- #################### 定时任务相关配置 ####################
-
---- #################### 配置中心相关配置 ####################
-
---- #################### 服务保障相关配置 ####################
-
-# Lock4j 配置项(单元测试,禁用 Lock4j)
-
---- #################### 监控相关配置 ####################
-
---- #################### 芋道相关配置 ####################
-
-# 芋道配置项,设置当前项目所有自定义的配置
-yudao:
- info:
- base-package: cn.iocoder.yudao.module
diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/SocialUserController.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/SocialUserController.java
index 643e465..77a77da 100644
--- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/SocialUserController.java
+++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/SocialUserController.java
@@ -4,11 +4,11 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO;
import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUserBindReqVO;
import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUserPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUserRespVO;
import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUserUnbindReqVO;
-import cn.iocoder.yudao.module.system.convert.social.SocialUserConvert;
import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO;
import cn.iocoder.yudao.module.system.service.social.SocialUserService;
import io.swagger.v3.oas.annotations.Operation;
@@ -38,8 +38,8 @@ public class SocialUserController {
@PostMapping("/bind")
@Operation(summary = "社交绑定,使用 code 授权码")
public CommonResult socialBind(@RequestBody @Valid SocialUserBindReqVO reqVO) {
- socialUserService.bindSocialUser(SocialUserConvert.INSTANCE.convert(
- getLoginUserId(), UserTypeEnum.ADMIN.getValue(), reqVO));
+ socialUserService.bindSocialUser(BeanUtils.toBean(reqVO, SocialUserBindReqDTO.class)
+ .setUserId(getLoginUserId()).setUserType(UserTypeEnum.ADMIN.getValue()));
return CommonResult.success(true);
}
diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/convert/social/SocialUserConvert.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/convert/social/SocialUserConvert.java
deleted file mode 100644
index 9e679a2..0000000
--- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/convert/social/SocialUserConvert.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package cn.iocoder.yudao.module.system.convert.social;
-
-import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO;
-import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUserBindReqVO;
-import org.mapstruct.Mapper;
-import org.mapstruct.Mapping;
-import org.mapstruct.factory.Mappers;
-
-@Mapper
-public interface SocialUserConvert {
-
- SocialUserConvert INSTANCE = Mappers.getMapper(SocialUserConvert.class);
-
- @Mapping(source = "reqVO.type", target = "socialType")
- SocialUserBindReqDTO convert(Long userId, Integer userType, SocialUserBindReqVO reqVO);
-
-}
diff --git a/yudao-server/pom.xml b/yudao-server/pom.xml
index 0c4e549..6d5ee9c 100644
--- a/yudao-server/pom.xml
+++ b/yudao-server/pom.xml
@@ -54,7 +54,7 @@
-
+