Integrations overview
Provider code lives in src/integrations. Feature modules must not import provider SDKs. The architecture check enforces that.
Registration
| Kind | How it is discovered |
|---|---|
| Marketplace | Class names {Provider}OrderService and {Provider}CatalogService. Optional: Customer, Settlement, OutboundOrder, Inventory, Webhook, WebhookHealth. Prefix must be Shopify, WooCommerce, Amazon, Flipkart, BigCommerce, or Meesho |
| Courier | Duck typing: integrationCode, ship, cancel, track |
Not this regex. Agent module plus meta-commerce | |
CUSTOM | Seed only. Scheduler skips it |
Registry seed: src/migrations/seed/integration-registry.seed.ts. Runtime: IntegrationAutoRegistrationService.
Direction
| Flow | Direction |
|---|---|
| Order, product, customer, settlement pull | Channel → PointNXT on the scheduler |
| Inventory publish | PointNXT → channel |
| Order status push | PointNXT → channel when Channel.manageState is true. A change the channel itself reported (source: CHANNEL_SYNC on order.status.changed) is never pushed back |
| Price push | channel-price-push.adapter.ts exists. Call sites were not fully traced |
| Labels and tracking | PointNXT → courier, then courier → PointNXT by webhook or poll |
Marketplace pattern
Every marketplace integration is a translator: it reads the channel and maps what it reads, and leaves every decision about orders to the shared code below. Nothing in an integration writes Order.orderStatus, decides a hold, or stores an address itself.
| Concern | Shared code | Integration supplies |
|---|---|---|
| Channel and seller | loadSyncChannel / resolveChannelSeller (marketplace/utils/channel-sync-context.util.ts): the channel of the integration's type, and the tenant's first seller | The channel type |
| Poll loop | ChannelOrderSyncRun (order/services/channel-order-sync-run.ts): each order imported on its own, counted, failures kept in ChannelOrderRetryList (<channel>:order-sync:failed:<channelId>, 25 re-read a run, 7 days) and re-read by id; finish() says whether the watermark may move | How a page is fetched, and how one order is read by id |
| Creating and updating an order | MarketplaceOrderIngestionService.create / update: fields, payment hold, lines, status through transitionFromChannel, customer note, outbox events in the same transaction | orderData, a replaceItems callback, the channel's own hold (resolveChannelHold), events to raise (an AWB report) |
| A deleted order | MarketplaceOrderIngestionService.cancelRemoved | The channel order id |
| Addresses | processAddresses (OrderAddressHandler): updates before shipment, keeps an operator's correction and a shipped order's address, records a conflict; an address with no street line (redacted PII) never replaces a full one | The address in ChannelAddressInput shape |
| Customers | upsertChannelCustomer, channelCustomerKey (customer/utils/channel-customer.util.ts) | The customer fields |
| Order lines | OrderItemSyncService.sync: lines matched by id, stock released for removed or cancelled lines | The lines |
| Reporting parcels back | channelReportableShipmentsWhere (shipment/domain): forward, PointNXT-made, live, with an AWB | What the channel calls a fulfilment |
| Webhook deliveries | webhook_queue → WebhookProcessor → the channel's registered {Provider}WebhookService | processWebhook(job) |
| Payload helpers | toJson, parseMoney (common/utils/channel-payload.util.ts), normalizeCurrency, booleanSetting |
The watermark rule is the same everywhere: it moves only when the window was read to the end and no failed order would be lost. Each failure is either kept to re-read by id, or, for a channel that cannot read an order by id (Meesho), holds the watermark. Flipkart needs neither: open shipments are searched every run, and orders already held are re-read by shipment id.
Shared failure behavior
sync_queue attempts 3, exponential backoff 5 seconds. Circuit breaker writes SUSPENDED, not INACTIVE. Outbox retries then DEAD, with no replay API identified. Inventory feed poll reaper runs every 10 minutes. Stale outbox PROCESSING locks return to PENDING after 5 minutes.
Credentials
Encrypted on IntegrationConnection with CREDENTIAL_VAULT_KEY_V1. Not stored in Channel.config.
Pages
Shopify, WooCommerce, Amazon, Flipkart, BigCommerce, Meesho, WhatsApp, Couriers, Payments, Payment gateway settlements, Accounting systems, Platform services.