Skip to content

Add integration example#198

Merged
jmalloc merged 3 commits intomainfrom
add-integration-example
Apr 4, 2026
Merged

Add integration example#198
jmalloc merged 3 commits intomainfrom
add-integration-example

Conversation

@jmalloc
Copy link
Copy Markdown
Member

@jmalloc jmalloc commented Apr 4, 2026

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +212 to +218
// compensate the initial debit after ending the process
s.ExecuteCommand(&commands.CreditAccount{
TransactionID: x.TransactionID,
AccountID: t.FromAccountID,
TransactionType: messages.Transfer,
Amount: t.Amount,
})
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot remove comment mentioned in this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the misleading comment in commit 008eb22.

@jmalloc jmalloc enabled auto-merge April 4, 2026 22:29
@jmalloc jmalloc disabled auto-merge April 4, 2026 22:29
@jmalloc jmalloc enabled auto-merge April 4, 2026 22:29
@jmalloc jmalloc merged commit ea5bd97 into main Apr 4, 2026
10 checks passed
@jmalloc jmalloc deleted the add-integration-example branch April 4, 2026 22:37
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.

3 participants