---
title: Building Block View Level 3
summary: Level-3 view of Finance workflow coordination.
owners:
  - architecture-enabling-team
badges:
  - content: Architecture
    backgroundColor: blue
    textColor: blue
---

Finance merits a deeper view because its post-checkout workflow must reconcile asynchronous basket deletion, authoritative order completion or cancellation, timeout retries, and compensating actions. Correctness depends on legal terminal-state transitions and safe recovery when a side effect succeeds but its confirmation is delayed.

## Structure

The first view captures stable domain and workflow relationships; the second locates those responsibilities within Finance and its external partners.

<MermaidFileLoader file="mermaids/003-level-3-diagram-1.mmd" />

<LikeC4View viewId="financeComponents" project="deployment" />

## Core Elements

| Class / Interface                             | Role & Invariants                                                                                                                                                                                                                                                   | Extension / Modification Point                                                                                                               |
| :-------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------- |
| **`Order`**                                   | Workflow-local aggregate for basket, customer contact, total, retry count, and coordination status. Identifiers must be non-empty, the retry limit positive, and terminal states cannot transition again. Ordering remains authoritative for official order status. | Route lifecycle changes through `OrderLifecycleDecider`; keep Finance coordination status distinct from Ordering's business status.          |
| **`OrderLifecycleDecider` / `OrderStatus`**   | Enforces legal state transitions, prevents duplicate basket-deletion completion, and bounds retry-driven cancellation.                                                                                                                                              | Add lifecycle actions and terminal-state rules here so every transition follows the same invariant checks.                                   |
| **`OrderOrchestrator`**                       | Starts placement, waits for external outcomes, delegates each outcome to a workflow step, and ends on a terminal result or exhausted retry limit.                                                                                                                   | Change sequencing and timeout policy here; keep orchestration replay-safe and domain rules in the aggregate and decider.                     |
| **`IOrderWorkflowStep` / `OrderStepContext`** | Provides the strategy boundary for handling a winning event or timer with access to the current workflow state and recovery actions. The timeout step is the fallback and must not shadow specific event handlers.                                                  | Add a focused step for a new outcome and preserve dispatch precedence, especially the fallback timeout behavior.                             |
| **`OrderSagaCompensations`**                  | Registers recovery actions before forward side effects and executes them in reverse order when coordination fails. A failed compensation is logged without preventing remaining actions.                                                                            | Pair each new reversible side effect with its recovery action; preserve completion semantics for normal, exhausted-retry, and failure paths. |
| **`Money` / `CustomerContact`**               | `Money` rejects negative totals. Notifications are eligible only when both a customer name and email are available.                                                                                                                                                 | Keep amount and contact eligibility rules in these value objects rather than scattering them through workflow steps.                         |

## Related Resources

- [[service\|order-orchestration]] — Finance ownership and integration boundary.
- [[event\|UserCheckedOutIntegrationEvent]], [[event\|BasketDeletedCompleteIntegrationEvent]], [[event\|BasketDeletedFailedIntegrationEvent]], [[event\|OrderStatusChangedToCompleteIntegrationEvent]], and [[event\|OrderStatusChangedToCancelIntegrationEvent]] — workflow inputs.
- [[adr\|adr-005-finance-separate-workflow-and-order-status]] — separates Finance coordination outcomes from authoritative Ordering status.
- [[doc\|arc42/06-runtime-view/001-checkout-and-order-coordination]] — checkout coordination sequence.
