feat(v2): outbox 退款感知(refund_id 进唯一键)+ 投递门禁放行退款态 + Enqueue 贯通 refundID
This commit is contained in:
@@ -33,8 +33,9 @@ type ProductResolver interface {
|
||||
}
|
||||
|
||||
// WebhookEnqueuer receives a domain payload to deliver to the business system.
|
||||
// refundID 为退款事件的幂等维度(payment 事件传 "")。
|
||||
type WebhookEnqueuer interface {
|
||||
Enqueue(outTradeNo, bizSystem, eventType string, data map[string]any) error
|
||||
Enqueue(outTradeNo, bizSystem, eventType, refundID string, data map[string]any) error
|
||||
}
|
||||
|
||||
type Gateway struct {
|
||||
|
||||
@@ -38,7 +38,7 @@ type spyEnqueuer struct {
|
||||
failNext bool // 置 true 模拟 outbox 入队失败(settle 崩溃窗口测试用)
|
||||
}
|
||||
|
||||
func (s *spyEnqueuer) Enqueue(outTradeNo, bizSystem, eventType string, data map[string]any) error {
|
||||
func (s *spyEnqueuer) Enqueue(outTradeNo, bizSystem, eventType, refundID string, data map[string]any) error {
|
||||
if s.failNext {
|
||||
s.failNext = false
|
||||
return errors.New("outbox down")
|
||||
|
||||
@@ -92,7 +92,7 @@ func (g *Gateway) enqueuePaymentSucceeded(att *model.Attempt, paidAt time.Time)
|
||||
"channel": att.Channel,
|
||||
"paid_at": paidAt.Format(time.RFC3339),
|
||||
}
|
||||
return g.webhook.Enqueue(o.OutTradeNo, o.BizSystem, "payment.succeeded", data)
|
||||
return g.webhook.Enqueue(o.OutTradeNo, o.BizSystem, "payment.succeeded", "", data)
|
||||
}
|
||||
|
||||
// HandleCallback runs a channel's raw callback through its Provider.VerifyCallback
|
||||
|
||||
Reference in New Issue
Block a user