feat: 实名即生效套餐沉默期、延期办理与资产出库时间
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Failing after 8m39s
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Failing after 8m39s
- 迁移 000259~000265:套餐记录沉默期字段与扫描索引、套餐默认沉默期、延期政策/流水/订单/批次/明细 5 张表、默认政策与系统配置(总开关默认关闭)、企微审批白名单、卡与设备出库时间及出库记录 - 沉默期设置(订单发放、自动购包、钱包续费)、后台购买时调整(超默认值按政策免审或企微审批)、统一判定与激活闸门、排队与孤儿扫描跳过过期套餐、过期套餐禁止退款、每 10 分钟扫描 - 总开关专用接口与打开前 4 项检查;延期政策;延期资格与计费;H5 自助与后台二维码在线支付(商户池路由)、支付回调与查单恢复、线下登记、特殊/批量延期、异常重试与原路退款;沉默期审批场景与终态处理 - 换货沉默期流水与出库时间;卡/设备列表、详情、导出与出库记录接口;延期订单与即将过期套餐列表及导出;财务流水纳入延期支付 - 沉默期与出库时间回填工具 cmd/silence-backfill;前端接口变更说明 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"go.uber.org/zap"
|
||||
|
||||
agentrechargeApp "github.com/break/junhong_cmp_fiber/internal/application/agentrecharge"
|
||||
packagesilenceApp "github.com/break/junhong_cmp_fiber/internal/application/packagesilence"
|
||||
"github.com/break/junhong_cmp_fiber/internal/infrastructure/integrationlog"
|
||||
"github.com/break/junhong_cmp_fiber/internal/model"
|
||||
orderService "github.com/break/junhong_cmp_fiber/internal/service/order"
|
||||
@@ -52,6 +53,17 @@ type PaymentHandler struct {
|
||||
agentPaymentConfirm *agentrechargeApp.ConfirmOnlinePaymentService
|
||||
integration *integrationlog.Repository
|
||||
logger *zap.Logger
|
||||
silence SilencePaymentConfirmer
|
||||
}
|
||||
|
||||
// SilencePaymentConfirmer 确认沉默期延期订单支付(order_type = silence_extension)。
|
||||
type SilencePaymentConfirmer interface {
|
||||
ConfirmPayment(ctx context.Context, command packagesilenceApp.PaymentConfirmCommand) error
|
||||
}
|
||||
|
||||
// SetSilencePaymentConfirmer 注入沉默期延期支付确认用例。
|
||||
func (h *PaymentHandler) SetSilencePaymentConfirmer(confirmer SilencePaymentConfirmer) {
|
||||
h.silence = confirmer
|
||||
}
|
||||
|
||||
func NewPaymentHandler(
|
||||
@@ -197,6 +209,19 @@ func (h *PaymentHandler) dispatchPaymentRecordCallback(ctx context.Context, call
|
||||
}
|
||||
case model.PaymentOrderTypeAgentRecharge:
|
||||
return true, h.confirmAgentRechargePayment(ctx, callback, log)
|
||||
case constants.PaymentOrderTypeSilenceExtension:
|
||||
// 沉默期延期:回调按支付单冻结商户已验签,金额由用例按订单冻结金额核对;总开关关闭也照常处理。
|
||||
if h.silence == nil {
|
||||
processErr = errors.New(errors.CodeInternalError, "沉默期延期支付确认未配置")
|
||||
} else {
|
||||
processErr = h.silence.ConfirmPayment(auditcontext.With(ctx, auditcontext.Context{
|
||||
ActorKind: constants.AuditActorExternalSystem, ActorID: callback.Provider, ActorName: "支付渠道回调",
|
||||
Source: constants.AuditSourceCallback, CorrelationID: callback.PaymentNo,
|
||||
}), packagesilenceApp.PaymentConfirmCommand{
|
||||
PaymentNo: callback.PaymentNo, ThirdPartyTradeNo: callback.TransactionID,
|
||||
Amount: callback.Amount, PaidAt: callback.PaidAt,
|
||||
})
|
||||
}
|
||||
default:
|
||||
processErr = errors.New(errors.CodeInvalidStatus, "未知支付记录类型")
|
||||
}
|
||||
@@ -538,7 +563,7 @@ func (h *PaymentHandler) AlipayCallback(c *fiber.Ctx) error {
|
||||
MerchantIdentity: notification.AppId, Provider: constants.IntegrationProviderAlipay,
|
||||
RawPayload: c.Body(), ContentType: c.Get("Content-Type"),
|
||||
}
|
||||
if payment.OrderType == model.PaymentOrderTypeAgentRecharge {
|
||||
if payment.OrderType == model.PaymentOrderTypeAgentRecharge || payment.OrderType == constants.PaymentOrderTypeSilenceExtension {
|
||||
paidAt, parseErr := time.ParseInLocation("2006-01-02 15:04:05", notification.GmtPayment, time.Local)
|
||||
if parseErr != nil {
|
||||
h.logger.Error("支付宝回调:付款时间格式无效",
|
||||
|
||||
Reference in New Issue
Block a user