refactor(pay): 移除未使用的支付插件扩展点(AbsPayPluginStrategy/PayPluginAssistService)

- 删除零实现的 AbsPayPluginStrategy 接口与 PayPluginAssistService(运行时注入 List 永远为空)

- TradeUniHandleService 移除支付成功/失败/关闭三处插件调用

- MerchantCallbackSendService.sendData 简化为直接走系统回调(noticeType 恒为 SYSTEM, 插件分支不可达)
This commit is contained in:
DaxPay Dev
2026-07-02 18:29:48 +08:00
parent 617927b1d1
commit 1b95beb6d9
4 changed files with 1 additions and 108 deletions

View File

@@ -1,66 +0,0 @@
package cn.daxpay.open.payment.old.pay.service.assist;
import cn.daxpay.open.payment.old.pay.entity.notice.callback.MerchantCallbackTask;
import cn.daxpay.open.payment.old.pay.entity.order.pay.PayOrder;
import cn.daxpay.open.payment.old.pay.entity.order.pay.PayOrderExpand;
import cn.daxpay.open.payment.strategy.pay.AbsPayPluginStrategy;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
/// # 支付插件辅助服务类
///
@Slf4j
@Service
@RequiredArgsConstructor
public class PayPluginAssistService {
private final List<AbsPayPluginStrategy> absPayPluginStrategies;
/// 支付成功处理
public void paySuccess(PayOrder payOrder, PayOrderExpand orderExpand){
for (var strategy : absPayPluginStrategies) {
try {
strategy.paySuccess(payOrder, orderExpand);
} catch (Exception e) {
log.error("支付成功处理失败: {}:", e.getMessage());
}
}
}
/// 支付失败处理
public void payFail(PayOrder order){
for (var strategy : absPayPluginStrategies) {
try {
strategy.payFail(order);
} catch (Exception e) {
log.error("支付失败处理失败: {}:", e.getMessage());
}
}
}
/// 支付关闭处理
public void payClose(PayOrder order){
for (var strategy : absPayPluginStrategies) {
try {
strategy.payClose(order);
} catch (Exception e) {
log.error("支付关闭处理失败: {}:", e.getMessage());
}
}
}
/// 通知发送处理
public void noticeSend(MerchantCallbackTask task, boolean autoSend){
for (var strategy : absPayPluginStrategies){
try {
strategy.noticeSend(task, autoSend);
} catch (Exception e) {
log.error("通知发送处理失败: {}:", e.getMessage());
}
}
}
}

View File

@@ -9,9 +9,7 @@ import cn.daxpay.open.payment.old.pay.dao.notice.callback.MerchantCallbackRecord
import cn.daxpay.open.payment.old.pay.dao.notice.callback.MerchantCallbackTaskManager;
import cn.daxpay.open.payment.old.pay.entity.notice.callback.MerchantCallbackRecord;
import cn.daxpay.open.payment.old.pay.entity.notice.callback.MerchantCallbackTask;
import cn.daxpay.open.platform.core.enums.pay.notice.CallbackNoticeTypeEnum;
import cn.daxpay.open.platform.core.enums.pay.notice.NoticeSendTypeEnum;
import cn.daxpay.open.payment.old.pay.service.assist.PayPluginAssistService;
import cn.daxpay.open.payment.common.context.PaymentAssistService;
import cn.daxpay.open.payment.old.pay.service.notice.MerchantNoticeAssistService;
import cn.hutool.core.util.StrUtil;
@@ -46,17 +44,9 @@ public class MerchantCallbackSendService {
// private final DelayJobService delayJobService;
private final PayPluginAssistService pluginAssistService;
/// 发送通知数据, 如果失败, 注册下次重发的任务
public void sendData(MerchantCallbackTask task, boolean autoSend){
if (Objects.equals(task.getNoticeType(), CallbackNoticeTypeEnum.SYSTEM.getCode())){
// 系统内部的回调通知处理
this.sendDataBySystem(task, autoSend);
} else {
// 插件类型的回调通知处理
pluginAssistService.noticeSend(task, autoSend);
}
this.sendDataBySystem(task, autoSend);
}
/// 发送通知数据, 如果失败, 注册下次重发的任务

View File

@@ -8,7 +8,6 @@ import cn.daxpay.open.payment.old.pay.entity.order.pay.PayOrderExpand;
import cn.daxpay.open.platform.core.enums.pay.pay.PayStatusEnum;
import cn.daxpay.open.payment.old.pay.service.notice.MerchantNoticeService;
import cn.daxpay.open.payment.old.pay.service.record.flow.TradeFlowRecordService;
import cn.daxpay.open.payment.old.pay.service.assist.PayPluginAssistService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -28,7 +27,6 @@ public class TradeUniHandleService {
private final PayOrderExpandManager payOrderExpandManager;
private final TradeFlowRecordService tradeFlowRecordService;
private final MerchantNoticeService merchantNoticeService;
private final PayPluginAssistService payPluginAssistService;
/// 支付成功发起后处理
public void payAfterHandel(PayOrder payOrder, PayOrderExpand orderExpand){
@@ -40,8 +38,6 @@ public class TradeUniHandleService {
// 相关操作
tradeFlowRecordService.savePay(payOrder);
merchantNoticeService.registerPayNotice(payOrder);
// 处理插件策略
payPluginAssistService.paySuccess(payOrder, orderExpand);
}
}
@@ -54,8 +50,6 @@ public class TradeUniHandleService {
.setCloseTime(OffsetDateTime.now(ZoneOffset.UTC));
payOrderManager.updateById(payOrder);
merchantNoticeService.registerPayNotice(payOrder);
// 处理插件策略
payPluginAssistService.payFail(payOrder);
}
/// 支付关闭处理
@@ -66,8 +60,6 @@ public class TradeUniHandleService {
payOrderManager.updateById(order);
// 发送通知
merchantNoticeService.registerPayNotice(order);
// 处理插件策略
payPluginAssistService.payClose(order);
}
}

View File

@@ -1,23 +0,0 @@
package cn.daxpay.open.payment.strategy.pay;
import cn.daxpay.open.payment.old.pay.entity.notice.callback.MerchantCallbackTask;
import cn.daxpay.open.payment.old.pay.entity.order.pay.PayOrder;
import cn.daxpay.open.payment.old.pay.entity.order.pay.PayOrderExpand;
/// # 支付插件
///
public interface AbsPayPluginStrategy {
/// 支付成功
default void paySuccess(PayOrder payOrder, PayOrderExpand expand){}
/// 支付失败
default void payFail(PayOrder payOrder){}
/// 支付关闭
default void payClose(PayOrder payOrder){}
/// 回调消息发送
default void noticeSend(MerchantCallbackTask task, boolean autoSend){}
}