Skip to content

Integration

1. Sister Services

SisterDirectionSurfaceAuthFailure ModeIdempotency
@nx/mq-payHTTP webhook /webhooks/paymentnone (trusted)MQ-Pay retries 5xxwebhook handlers no-op on already-applied transitions
@nx/inventoryKafka payment.successpost-commit fire-and-forgetper (saleOrderId, stockId) consumer-side
@nx/inventoryKafka kitchen-ticket-item.status-changedpost-commit fire-and-forgetper (saleOrderId, kitchenTicketItemId, materialId) consumer-side
@nx/inventoryKafka material.stock-changed(sale not currently consumes — produced for UI consumers)
@nx/financeKafka payment.successpost-commit fire-and-forgetper saleOrderId consumer-side
@nx/commerceHTTP — read ProductVariant, ProductInfo, SaleChannel, Category for snapshotsJWT (service-to-service)retry 3xsnapshot stored on order
@nx/pricingHTTP — PricingNetworkService.calculate() + calculateV2()JWTretry; checkout fails on persistent errorcheckout request idempotent (no side-effect on retry)
@nx/identityHTTP — JWT verification via JWKS (/jw-certs)JWTretry / circuit-breakrequest-id propagated
@nx/identityHTTP — PolicyDefinitionService permission lookupJWTRedis cache fallbackper (role, action)
@nx/signalWebSocket emission via ApplicationWebSocketComponentbest-effort deliverybroadcast

2. External Systems

Direct external integrations: none. Sale uses MQ-Pay (sister) for payment provider abstraction. Third-party payment providers (VNPay, etc.) are owned by @nx/mq-pay.

3. Critical Cross-Service Flows

3.1 Payment Success → Stock Deduct + Finance Income

Contract:

  • Sale guarantees PAYMENT_SUCCESS is emitted exactly once per status transition (post-commit).
  • Webhook is the source-of-truth for status — Sale does not poll MQ-Pay.
  • Idempotency: webhook handler short-circuits if order already at target status.

3.2 Kitchen Item READY → Material Consume

3.3 Checkout Pricing Fan-out

3.4 MQ-Pay Webhook Retries (Sale's safety net)

4. Contract Stability

SurfaceStabilityVersioning
HTTP /v1/api/sale/*stableURL prefix /v1/
HTTP webhook /webhooks/paymentstablerequest schema versioned via eventType namespace
Kafka topic payment.successstablepayload field-additive only
Kafka topic kitchen-ticket-item.status-changedstablepayload field-additive only
WebSocket topics observation/sale/*stablepayload field-additive

5. Cross-cutting concerns

ConcernHandling
Trust boundaryWebhook endpoint trusts MQ-Pay (no auth). Network-level isolation via Cilium policy enforces this.
Race protectionSELECT FOR UPDATE on order rows during checkout + add-item.
Snapshot captureAt checkout, sale snapshots: pricing (v1+v2), allocation state, product variant metadata, recipe id. Lifetime = order.
CurrencyStored at order level. Multi-currency requires exchangeRate snapshot per order.

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.