This commit is contained in:
@@ -112,6 +112,11 @@ func (s *OnlineCreationService) Execute(ctx context.Context, command CreateOnlin
|
||||
ExpireAt: *result.Payment.ExpireAt, PayerClientIP: command.PayerClientIP, Config: config,
|
||||
})
|
||||
if err != nil {
|
||||
if merchantpayment.ShouldDisableMerchant(err) {
|
||||
if disableErr := merchantpayment.DisableMerchantAfterExplicitFailure(ctx, s.db, result.Payment, "payment_precreate_failed", time.Now()); disableErr != nil {
|
||||
return nil, disableErr
|
||||
}
|
||||
}
|
||||
if !isUnknownPaymentResult(err) {
|
||||
if closeErr := s.closeFailedCreation(ctx, result); closeErr != nil {
|
||||
return nil, apperrors.Wrap(apperrors.CodeDatabaseError, closeErr, "支付链接生成失败且关闭本地订单失败")
|
||||
@@ -286,10 +291,13 @@ func (s *OnlineCreationService) createLocalFacts(
|
||||
if err := tx.Create(payment).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
return s.audit.WriteAgentRechargePayment(ctx, tx, PaymentAudit{
|
||||
if err := s.audit.WriteAgentRechargePayment(ctx, tx, PaymentAudit{
|
||||
ActionCode: constants.AuditActionPaymentCreated, Summary: "创建代理充值支付记录",
|
||||
Payment: payment, Recharge: record, AfterData: map[string]any{"status": payment.Status},
|
||||
})
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return merchantpayment.RecordRoutingAttempt(ctx, tx, payment)
|
||||
})
|
||||
if err != nil {
|
||||
var appErr *apperrors.AppError
|
||||
|
||||
Reference in New Issue
Block a user