Skip to content

persist external scheduler events to add or remove schedule - add Ext…#4

Merged
fupelaqu merged 2 commits into
mainfrom
feature/message
Jan 13, 2023
Merged

persist external scheduler events to add or remove schedule - add Ext…#4
fupelaqu merged 2 commits into
mainfrom
feature/message

Conversation

@fupelaqu

Copy link
Copy Markdown
Contributor

…ernalEntityToPaymentEvent to allow external entity to persist payment command event

…ernalEntityToPaymentEvent to allow external entity to persist payment command event
@fupelaqu fupelaqu merged commit fc6e5f4 into main Jan 13, 2023
fupelaqu added a commit that referenced this pull request Jun 15, 2026
…metadata (Story 13.7 gate #4)

Emit structured payment audit lines and carry a single correlation id end-to-end (HTTP origin -> command -> persisted event -> licensing pod -> notification), with a stable orderUuid fallback so no event/line is ever untraceable.

Audit emission (PaymentAuditLog = AuditLog("payment")): charge_succeeded/charge_failed (PayIn), subscription_charged/subscription_charge_failed (recurring), refund/refund_failed, preauthorization_succeeded/failed/canceled, payout_succeeded/failed.

Coherence: each command handler shadows the threaded cid with effectiveCorrelationId = cid.getOrElse(<businessKey: orderUuid / transaction.orderUuid / recurringPayment.externalReference>), stamped on EVERY event in the persist batch and used for the audit line, so event.correlationId (read by the licensing pod) and the audit line always agree.

Stripe WRITE side: providers stamp metadata.correlation_id on object creation (PayIn/PayOut/PreAuth/Refund/Transfer/DirectDebit); RecurringPayment carries it via its metadata map, falling back to the subscription id when no explicit cid.

Stripe READ side (StripeEventHandler): webhook_received audit line + resolveCorrelationId(obj,event) = metadata.correlation_id -> external_reference -> order_uuid -> backing subscription id -> event id; all webhook-driven command stamps routed through it.

Protos: correlation_id on transaction/payment events + AuditableEvent; commands extend AuditableCommand. Endpoints: correlationInput wired across all payment endpoints (origin at the HTTP request). BasicPaymentService.run stamps the MDC cid on synchronous routes.

Tests: AuditableCommandSpec (chill/Kryo cid round-trip), StripeWebhookCorrelationSpec (metadata resolution + subscription-id fallback + webhook_received), PaymentHandlerSpec charge_succeeded capture. scalafmt clean; cross-compiles 2.12 + 2.13.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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