Skip to content

Integration

1. Sister Services

Direction: calls / called by / bidir.

SisterDirectionSurfaceContractAuthFailure ModeIdempotency
@nx/saleHTTP POST /simulation/calculate (v1)@nx/pricing/contracts types via PricingNetworkService.calculate()BASIC (service-to-service)sale propagates upstream 4xx (e.g. no active fare); throws on network/5xxrequest side-effect-free, safe to retry
@nx/saleHTTP POST /simulation-v2/calculate (v2)@nx/pricing/contracts types via PricingNetworkService.calculateV2()BASICsamesame
@nx/commerceKafka CDCKafkaTopics.PRODUCT_VARIANT (Debezium)@nx/core TProductVariantPgRowat-least-once, manual commitper (productVariantId)
@nx/identityHTTP — JWT verification via JWKSJWT (ES256)retry / Redis cache fallbackper request

Commerce does not depend on pricing directly. The only commerce → pricing coupling is the ProductVariant row landing in the CDC stream that pricing's worker consumes.

2. The @nx/pricing/contracts Boundary

Sale consumes pricing through the dedicated ./contracts subpath export (src/contracts/index.ts), not the package root. The export is mostly export type declarations plus a small set of runtime const containers that sale needs at runtime for snapshot interpretation.

KindSymbols (from contracts)
Request typesTSimulationCalculateRequest, TPricingContext, TPricingV2CalculateRequest, TPricingV2ContextRequest, TPricingV2ItemContext, TPricingV2ItemRequest
Response typesTSimulationCalculateResponse, TPricingV2CalculateResponse
Snapshot typesTAppliedPrice/Tax/Discount/Fee/Rule, TLineItemPricingSnapshot, TOrderPricingSnapshot, TByBearerTotals, TFareSource(Type), TPartyRole, TRuleBasis, TMoney, TCurrencyCode, TTransactionDirection, TSnapshot{Discount,Fee,Tax}Type, TFeeScope
Runtime const containersAppliedRuleSourceTypes, FareSourceTypes, FeeScopes, PartyRoles, RuleBasises, SnapshotDiscountTypes, SnapshotFeeTypes, SnapshotTaxTypes, TransactionDirections

Verified consumers:

  • sale/src/services/pricing-network.service.ts — imports the request/response types (import type { ... }) to type its Axios calls.
  • sale/src/services/checkout.service.ts — imports TPricingV2CalculateResponse (type) and TransactionDirections (runtime value, to set direction: TransactionDirections.SALE on the request and to narrow the snapshot's byBearer ledger).

This keeps sale free of any runtime dependency on pricing's engine — it ships only erasable types plus a handful of frozen const tables. Sale never mounts pricing as an IGNIS component. See ADR-0001.

3. Critical Cross-Service Flows

3.1 Checkout Pricing Fan-out

Contract:

  • Pricing is stateless — it returns the snapshot; sale persists it. Pricing keeps no order record.
  • An upstream 4xx (e.g. variant with no ACTIVATED FareSet) is surfaced by sale with the upstream status, not masked as 500.
  • v2 is canonical; sale persists the v2 snapshot as the audit/refund source-of-truth.

3.2 ProductVariant CDC → Fare Seeding

4. Contract Stability

SurfaceStabilityVersioning
HTTP /simulation/calculate (v1)stable, in maintenanceURL /v1/; v2 is canonical for new work
HTTP /simulation-v2/calculate (v2)stableURL /v1/; snapshot envelopes carry their own v: 1 literal
@nx/pricing/contracts snapshot typesstableper-envelope v literal (Order / LineItem / per-applied-rule independently versioned)
Kafka PRODUCT_VARIANTstableDebezium schema; field-additive

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