You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement domain event publication in financial-accounting service (#402)
* feat: implement LedgerPostingCapturedEvent publication
Implement event publication for LedgerPostingCapturedEvent in
CaptureLedgerPosting() method after successful SavePosting() call.
Changes:
- Add imports for eventsv1 and timestamppb
- Update DomainEvent type to be proto.Message for protobuf compatibility
- Publish LedgerPostingCapturedEvent with all required fields:
* PostingId, BookingLogId, PostingDirection, PostingAmount
* AccountId, ValueDate, Status
* CorrelationId, CausationId, Timestamp, Version
- Use best-effort error handling (log errors, don't fail operation)
Follows existing pattern from payment-order service for protobuf event
publication. Event publishing enables inter-service coordination and
audit trail for ledger postings.
* feat: implement LedgerPostingAmendedEvent publication in UpdateLedgerPosting
Implement event publication for LedgerPostingAmendedEvent in
UpdateLedgerPosting() method after successful UpdatePosting() call.
Changes:
- Extract correlation ID from idempotency key for event tracing
- Capture previous amount and status BEFORE update operation
- Publish LedgerPostingAmendedEvent with all required fields:
* PostingId, BookingLogId
* PreviousAmount, NewAmount (same value for status transitions)
* Reason (status change description), AmendedBy (system)
* CorrelationId, CausationId, Timestamp, Version
- Use best-effort error handling (log errors, don't fail operation)
- Remove TODO comment
Note: UpdateLedgerPosting changes status, not amount. Event captures
amount for audit purposes even though it doesn't change during status
transitions. The Reason field describes the status change.
Follows existing pattern from LedgerPostingCapturedEvent for protobuf
event publication. Event publishing enables inter-service coordination
and audit trail for ledger posting modifications.
* feat: publish FinancialBookingLogInitiatedEvent in InitiateFinancialBookingLog
Implement event publication for FinancialBookingLogInitiatedEvent after
successful SaveBookingLog() call. The event captures booking log creation
with all required fields including booking log ID, account type, product
service reference, business unit reference, and base currency.
Event publishing follows the existing best-effort pattern - errors are
logged but do not fail the operation. Uses helper functions toProtoAccountType()
and toProtoCurrency() for domain-to-proto translation.
This enables inter-service coordination for financial booking log lifecycle
tracking.
* feat: implement FinancialBookingLogUpdatedEvent publication
Implements event publication for FinancialBookingLogUpdatedEvent in
UpdateFinancialBookingLog() method with proper previous status capture.
Changes:
- Capture previous status BEFORE repository update operation
- Publish FinancialBookingLogUpdatedEvent after successful update
- Include all required fields: status, previous_status, correlation_id,
chart_of_accounts_rules, reason, updated_by, timestamp, version
- Follow best-effort pattern: log errors but don't fail operation
- Use existing toProtoTransactionStatus() converter
Related: Task 18.4 - Domain events implementation
---------
Co-authored-by: Ben Coombs <bjcoombs@users.noreply.github.com>
0 commit comments