feat(v2): order 补 biz_code + webhook payload 带 product_biz_code(收口 P2 延后项)

This commit is contained in:
wangjia
2026-07-10 14:12:44 +08:00
parent c06f6d3a3c
commit 7a27a6223a
5 changed files with 53 additions and 11 deletions
+23
View File
@@ -53,6 +53,29 @@ func TestSettleHappyIdempotentAndWebhook(t *testing.T) {
}
}
func TestSettleWebhookCarriesProductBizCode(t *testing.T) {
g, fp, spy, orders := newGateway(t)
ctx := context.Background()
res, _ := g.CreateOrder(ctx, gateway.CreateOrderInput{
SKU: "pro_year", Method: "fake", BizSystem: "pangolin", BizRef: "u-9",
})
ref := attemptRef(t, orders)
fp.SetQueryResult(ref, provider.PaidEvent{
ProviderRef: ref, Status: provider.PaidSucceeded,
PaidAmountMinor: 29990000, PaidCurrency: "USDT",
})
if _, err := g.SyncPendingAttempts(ctx, 10); err != nil {
t.Fatalf("sync: %v", err)
}
if len(spy.calls) != 1 {
t.Fatalf("want 1 webhook, got %d", len(spy.calls))
}
if spy.calls[0]["product_biz_code"] != "pro_year" {
t.Fatalf("payload product_biz_code = %v, want pro_year", spy.calls[0]["product_biz_code"])
}
_ = res
}
func TestSettleGuards(t *testing.T) {
g, _, spy, orders := newGateway(t)
ctx := context.Background()