DiTOS Middleware — Overview
On this page
- What it is
- How calls flow
- Config pages (admin UI)
- Scheduled jobs
- Messaging
- Adding a NEW store/outlet from the ERP
- Making an EXISTING store go live on Unicommerce
- Lambdas (standalone AWS functions, separate from this app)
- In one line
What it is
- A middleware that sits between the ERP and external systems — mainly Unicommerce (OMS/WMS) and Google BigQuery (reports/data).
- The ERP never calls those systems directly — it calls the middleware, which does the integration, scheduling, and messaging.
ERP ──(X-Secret-Token)──► DITOS Middleware ──► Unicommerce
──► BigQuery
──► SMS / WhatsApp / Email
How calls flow
- Outbound (middleware → Unicommerce):
- Unicommerce accepts calls only from a whitelisted IP → the middleware’s outbound IP is added to Unicommerce’s allowlist (one-time, infra side).
- The Unicommerce page stores the Unicommerce credentials (token URL, client id, username, password); the token is fetched/cached automatically.
- Inbound (ERP → middleware):
- Every
/api/client/**call needs a whitelisted source IP + a validX-Secret-Token. - IPs and tokens are managed on the Client access page.
- IP check can be turned off (token-only) via
CLIENT_IP_CHECK_ENABLED(Secrets Manager / env).
- Every
Config pages (admin UI)
- Unicommerce — Unicommerce API credentials + token status.
- Client access — allowed client IPs +
X-Secret-Tokenvalues for the ERP. - BigQuery — service-account JSON; source
aws-rds-replication.publicis rewritten to your project + dataset. - Outlets — stores/facilities; synced from BigQuery (manual), Unicommerce-enabled by default; per-outlet toggle to call Unicommerce or not.
- Operations — on/off switches for each background job (manifest, WMS, inventory snapshot, reports, e-bill, messaging, …).
- Messaging — provider credentials + templates for SMS / WhatsApp / Email.
- Others — TaxPro (e-Invoice/e-Way Bill), URL shortener, Malls.
Scheduled jobs
- Jobs: shipping manifest (default every 30 min, interval configurable), inventory snapshot, WMS (sale-order / GRN / returns), report exports, e-bill.
- A job runs only if its Operations toggle is ON.
- A job calls a store only if the outlet is Active AND Unicommerce-enabled.
Messaging
- Sends SMS, WhatsApp, Email.
- Add the provider credentials + templates on the Messaging page.
- The ERP triggers sends / OTPs via a client endpoint; the middleware delivers through the channel’s active provider.
Adding a NEW store/outlet from the ERP
- Add the store in the ERP → it lands in BigQuery with its Unicommerce facility id.
- Outlets → Sync from ERP → the store appears as an outlet, Unicommerce-enabled by default.
- Check: facility code = real Unicommerce facility id, and outlet is Active + Unicommerce-enabled.
- Done — the scheduler picks it up on the next run. Verify once on the Manifest sync page.
Making an EXISTING store go live on Unicommerce
(The store is already in the ERP but was not calling Unicommerce yet.)
- The facility must exist and be live in Unicommerce, and the Unicommerce API user must have access to that facility (otherwise
403 Illegal Access). - In the middleware, make sure the outlet’s facility code = that Unicommerce facility id (not the short code / placeholder).
- Turn the outlet Unicommerce-enabled ON (and it must be Active).
- Verify with a manual run; check the Manifest sync page.
403/ quarantined row → facility code or Unicommerce access is wrong → fix, then Retry.- Need older data → one-time windowed backfill.
- Once a run succeeds, the scheduler includes it automatically; the ERP reads/writes via the client endpoints (e.g.
GET /api/client/store/{storeCode}) using the store’s short code.
Lambdas (standalone AWS functions, separate from this app)
- einvoice — NIC e-Invoice (IRN) auth + generation via the encrypted NIC handshake (sandbox).
- prod-einvoice — same as above, the production build (correct prod key + prod host).
- unicommerce-inventory — Unicommerce inventory proxy (adjust/bulk, inventory-snapshot get, markQuantityFound), sent from the whitelisted static IP.
- clevertap — pushes customer profiles/events to CleverTap (batched
/1/upload).
In one line
- The middleware is the single authenticated gateway between the ERP and Unicommerce + BigQuery: ERP calls it with a token, it calls Unicommerce from a whitelisted IP, reads BigQuery with a service account, runs scheduled syncs for enabled stores, and handles messaging — all configured and toggled from the admin pages, with secrets in config / AWS Secrets Manager.