Skip to content

feat(webhook): publish OPERATION_COMPLETED and OPERATION_FAILED#21

Merged
marioalvial merged 2 commits intomainfrom
feat/operation-terminal-webhooks
May 6, 2026
Merged

feat(webhook): publish OPERATION_COMPLETED and OPERATION_FAILED#21
marioalvial merged 2 commits intomainfrom
feat/operation-terminal-webhooks

Conversation

@marioalvial
Copy link
Copy Markdown
Contributor

Description

Add webhook events for terminal operation transitions. OPERATION_COMPLETED and OPERATION_FAILED deliver the same OperationEvent payload as OPERATION_REQUESTED, with currentState.status set to the new status (and currentState.reason populated on failure). This lets integrators react to the terminal outcome via webhooks instead of polling.

While here, also corrects the published name of the account event from ACCOUNT_ASSET_ACTIVATED to ASSET_ACTIVATED — the spec invented an ACCOUNT_ prefix that is not on the wire (live producer in fx-account/Constants.kt defines const val ASSET_ACTIVATED = "ASSET_ACTIVATED").

Key Changes

  • apis/fx-webhook/openapi.yml:
    • EventType enum: + OPERATION_COMPLETED, OPERATION_FAILED
    • OperationEvent: rewrote description, customerId is now format: uuid with example, added required currentState field
    • New schemas: OperationStatus, Reason, OperationState (matches Kotlin source + fx-payment spec naming)
    • New webhook paths: OPERATION_COMPLETED, OPERATION_FAILED — both reference OperationEvent
    • Renamed ACCOUNT_ASSET_ACTIVATEDASSET_ACTIVATED (enum entry + path key)
  • New MDX pages: api-reference/fx-webhook/events/operation/operation-completed.mdx, operation-failed.mdx
  • docs.json: both new pages added under Operation
  • webhooks/overview.mdx: Operation row now lists 3 events; Note rewritten to scope poll-vs-webhook clearly per resource
  • journeys/{deposit,swap,transfer,withdrawal}.mdx: tracking step rewritten to push subscribing to terminal events first
  • api-reference/fx-webhook/events/account/asset-activated.mdx: title and openapi reference updated to ASSET_ACTIVATED

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Unit Test
  • Integration Test

mint validate and mint broken-links both pass locally.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Backend follow-ups

The live fx-payment OperationEvent does not yet carry currentState, and OperationProducerAdapter only emits REQUESTED / ACTION_EXECUTED today — OPERATION_COMPLETED / OPERATION_FAILED are documented aspirationally per repo policy and need a producer change to go live.

Add webhook events for terminal operation transitions, sharing the
OperationEvent payload shape with OPERATION_REQUESTED. Use
currentState.status to distinguish outcomes; reason is populated on
FAILED.

Intermediate statuses (PROCESSING, ON_HOLD, ACTION_REQUIRED) remain
poll-only via GET /api/operations/{operationId}. Journey pages and
webhooks overview updated to push subscribing to terminal events
first and only fall back to polling for intermediate statuses.
The spec exposed the account event as ACCOUNT_ASSET_ACTIVATED, but
the live producer publishes it as ASSET_ACTIVATED — fx-account
Constants.kt defines const ASSET_ACTIVATED = "ASSET_ACTIVATED" and
emits it via that exact string. The ACCOUNT_ prefix was never on
the wire.

Renames the EventType enum entry, the webhooks path key, the page
title, and the webhooks overview reference. The MDX filename and
URL slug stay as-is (already in URL-friendly short form).
@mintlify
Copy link
Copy Markdown

mintlify Bot commented May 6, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
tracefinance 🟢 Ready View Preview May 6, 2026, 7:19 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@marioalvial marioalvial merged commit 920e4cb into main May 6, 2026
9 checks passed
@marioalvial marioalvial deleted the feat/operation-terminal-webhooks branch May 6, 2026 19:51
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.

2 participants