优化结构

This commit is contained in:
Yvan
2026-08-28 09:44:11 +08:00
parent 279692375b
commit e997d9718e
26 changed files with 106 additions and 129 deletions
+2 -8
View File
@@ -388,12 +388,8 @@ func NewPaymentUsecase(repo PaymentRepo, orders PaymentOrderRepo, hooks PaymentH
}
func NewConfiguredPaymentUsecase(repo PaymentRepo, orders PaymentOrderRepo, hooks PaymentHooks, sources *PaymentOrderSourceRegistry, fulfillments *PaymentFulfillmentRegistry, appLogger *slog.Logger) (*PaymentUsecase, error) {
if sources == nil || sources.Len() == 0 {
return nil, errors.New("支付业务订单来源未注册,无法启动支付服务")
}
if fulfillments == nil || fulfillments.Len() == 0 {
return nil, errors.New("支付发货 handler 未注册,无法启动支付服务")
}
// Business modules are optional in the template. Missing modules are
// reported when the corresponding payment operation is invoked.
return NewPaymentUsecase(repo, orders, hooks, sources, fulfillments, appLogger), nil
}
@@ -924,8 +920,6 @@ func (uc *PaymentUsecase) refundWithOrder(ctx context.Context, provider, tradeNo
message := ""
if providerErr != nil {
message = providerErr.Error()
} else if !accepted {
message = "支付平台未接受退款请求"
}
order, err = uc.orders.CompletePaymentRefundRequest(ctx, provider, tradeNo, token, accepted, message)
if err != nil {