Conversation
There was a problem hiding this comment.
Pull request overview
Adds a third-party bank integration example to the Dogma sample banking app, extending transfers to support routing credits to an external system and handling operational failures.
Changes:
- Introduces third-party credit command/event types plus an integration handler that records success/failure outcomes.
- Extends the transfer command/event/process to support third-party destinations and to model operational transfer failures (with refund).
- Updates and expands tests (transfer scenarios, integration handler, daily debit limit behavior) and fixes a few message strings.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| messages/transaction.go | Fixes DebitFailureReason string and improves validation error text. |
| messages/events/transfer.go | Adds third-party flag to TransferStarted and introduces TransferFailed event. |
| messages/events/thirdpartycredit.go | Adds events representing third-party credit success/failure. |
| messages/events/dailydebitlimit.go | Fixes argument order in DailyDebitLimitConsumed description. |
| messages/commands/transfer.go | Adds third-party flag to Transfer and introduces MarkTransferAsFailed command. |
| messages/commands/thirdpartycredit.go | Adds CreditThirdPartyAccount command used by the integration example. |
| integrations/thirdpartybank.go | Implements an integration handler simulating a third-party bank credit API. |
| integrations/thirdpartybank_test.go | Adds tests for the third-party bank integration behavior. |
| integrations/doc.go | Adds package documentation for integrations. |
| domain/withdrawal_test.go | Adds coverage for cumulative daily debit limit enforcement across multiple withdrawals. |
| domain/transfer.go | Extends transfer process to execute third-party credits and handle operational failures with refund. |
| domain/transfer_test.go | Refactors transfer tests into shared cases and adds third-party failure/refund scenario. |
| domain/transaction.go | Records TransferStarted with third-party flag and handles MarkTransferAsFailed. |
| domain/deposit_test.go | Fixes a comment typo. |
| domain/dailydebitlimit.go | Fixes daily debit limit state update to use TotalDebitsForDay from the event. |
| app.go | Registers the new third-party integration handler in the application configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
domain/transfer.go
Outdated
| // compensate the initial debit after ending the process | ||
| s.ExecuteCommand(&commands.CreditAccount{ | ||
| TransactionID: x.TransactionID, | ||
| AccountID: t.FromAccountID, | ||
| TransactionType: messages.Transfer, | ||
| Amount: t.Amount, | ||
| }) |
There was a problem hiding this comment.
This comment is misleading: the refund credit is executed immediately here, but the process is only ended later when the TransferFailed event is handled. Consider rewording to avoid implying the compensation happens after the process has ended, or adjust control flow so the comment matches the behavior.
There was a problem hiding this comment.
@copilot remove comment mentioned in this feedback
There was a problem hiding this comment.
Removed the misleading comment in commit 008eb22.
…ends Agent-Logs-Url: https://github.com/dogmatiq/example/sessions/21c89216-cbb8-4a4f-8ba2-091a2651a8ee Co-authored-by: jmalloc <761536+jmalloc@users.noreply.github.com>
No description provided.