feat(payments): consome StockReserved e cobra por regra determinística (fase 4a) - #5
Conversation
thomasmoreira
commented
Jun 8, 2026
…a (fase 4a) Terceiro participante do checkout: Payments consome StockReserved (via a infra de consumo idempotente), cobra via um gateway fake determinístico e emite o próximo evento da saga. - Contracts: StockReserved passa a carregar Amount (Inventory propaga o valor do OrderPlaced) para o Payments cobrar sem refetch — Inventory atualizado - Domain: agregado Payment (Charged/Failed) + IPaymentGateway/FakePaymentGateway (recusa acima de DeclineAboveAmount, default 1000 — determinístico p/ testar happy path e compensação) - Infrastructure: PaymentsDbContext (payments + outbox + inbox no schema payments), config snake_case, design-time factory, migration InitialCreate - Consumers: StockReservedConsumer cobra e emite PaymentCharged (ok) ou PaymentFailed (acima do limite) via outbox — tudo na transação do inbox - Host: substitui o placeholder; wire DbContext + outbox/inbox + publisher + dispatcher + gateway + consumer; migrate no startup - Testes: cobrança idempotente (redelivery cobra 1x + emite PaymentCharged 1x) e recusa acima do limite (PaymentFailed) Build limpo (0/0); unit 4/4; integration 8 passam + 2 skipped (F1/F4).
|
Warning Review limit reached
More reviews will be available in 4 minutes and 37 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (16)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…a (fase 4a) (#5) Terceiro participante do checkout: Payments consome StockReserved (via a infra de consumo idempotente), cobra via um gateway fake determinístico e emite o próximo evento da saga. - Contracts: StockReserved passa a carregar Amount (Inventory propaga o valor do OrderPlaced) para o Payments cobrar sem refetch — Inventory atualizado - Domain: agregado Payment (Charged/Failed) + IPaymentGateway/FakePaymentGateway (recusa acima de DeclineAboveAmount, default 1000 — determinístico p/ testar happy path e compensação) - Infrastructure: PaymentsDbContext (payments + outbox + inbox no schema payments), config snake_case, design-time factory, migration InitialCreate - Consumers: StockReservedConsumer cobra e emite PaymentCharged (ok) ou PaymentFailed (acima do limite) via outbox — tudo na transação do inbox - Host: substitui o placeholder; wire DbContext + outbox/inbox + publisher + dispatcher + gateway + consumer; migrate no startup - Testes: cobrança idempotente (redelivery cobra 1x + emite PaymentCharged 1x) e recusa acima do limite (PaymentFailed) Build limpo (0/0); unit 4/4; integration 8 passam + 2 skipped (F1/F4).