Skip to content

feat(payments): consome StockReserved e cobra por regra determinística (fase 4a) - #5

Merged
thomasmoreira merged 1 commit into
mainfrom
feat/payments-charge
Jun 8, 2026
Merged

thomasmoreira merged 1 commit into
mainfrom
feat/payments-charge

Conversation

@thomasmoreira

Copy link
Copy Markdown
Owner

…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).
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@thomasmoreira, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 198eefd8-dce9-4536-8408-ca41e40045c0

📥 Commits

Reviewing files that changed from the base of the PR and between d9945d9 and 7301c3c.

📒 Files selected for processing (16)
  • src/Contracts/CheckoutEvents.cs
  • src/Services/Inventory/Consumers/OrderPlacedConsumer.cs
  • src/Services/Payments/Consumers/StockReservedConsumer.cs
  • src/Services/Payments/Domain/IPaymentGateway.cs
  • src/Services/Payments/Domain/Payment.cs
  • src/Services/Payments/Infrastructure/PaymentConfiguration.cs
  • src/Services/Payments/Infrastructure/PaymentsDbContext.cs
  • src/Services/Payments/Infrastructure/PaymentsDbContextFactory.cs
  • src/Services/Payments/Migrations/20260608170924_InitialCreate.Designer.cs
  • src/Services/Payments/Migrations/20260608170924_InitialCreate.cs
  • src/Services/Payments/Migrations/PaymentsDbContextModelSnapshot.cs
  • src/Services/Payments/PaymentsConsumerHost.cs
  • src/Services/Payments/Program.cs
  • src/Services/Payments/Services.Payments.csproj
  • src/Services/Payments/appsettings.json
  • tests/Integration/PaymentsChargeTests.cs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/payments-charge

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@thomasmoreira
thomasmoreira merged commit 590b2bb into main Jun 8, 2026
2 checks passed
@thomasmoreira
thomasmoreira deleted the feat/payments-charge branch June 8, 2026 17:16
thomasmoreira added a commit that referenced this pull request Jun 10, 2026
…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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant