Stock (PowerBiz WMS)
Stock is not stored in Exsport. It comes from the PowerBiz warehouse system (WMS), which the backend queries for quantity and tells about orders.
How this page was verified
Read on 2026-09-15 from src/catalogs/services/wms.service.ts and webhook-wms.service.ts.
Backend
WmsService (src/catalogs/services/wms.service.ts) lives in the catalogs module. Base URL WMS_ENDPOINT_BASE_URL. It logs in on boot (WMS_USERNAME / WMS_PASSWORD) for a bearer token and re-logs in automatically on a 401. It is scoped by WMS_BUSINESS_ID and WMS_WAREHOUSE_ID. Methods:
wmsLogingetInventoryDataFromArticleNo— quantity for an article (feedsproductArticleQuantity/frontProductSizes, so a PDP shows real stock).getOrderDetail,createOrder,cancelOrder,updateOrderStatus— the order side, called during checkout, cancel, and the expiry cron.
Inbound events
webhook-wms.service.ts handles inbound WMS sales-order events (route webhooks/wms): it moves the order to shipped and the delivery to processing. In production the callback arrives through the webhook receiver → SNS on POST /inventory.
Where stock shows up
- Storefront — the PDP shows per-size availability from
frontProductSizes, which reflects WMS quantity. - Admin — product quantity is read through the same path; the product form's
update-quantityREST endpoint exists but the source of truth is the WMS.
Gotchas
- There is no local stock table. A "stock is wrong" bug is usually a WMS lookup or mapping issue, not a database row.
- The bearer token is fetched at boot. If the WMS credentials or endpoint are wrong, the service fails to log in and every quantity lookup fails.
- In dev, the WMS is the simulator, which can force
/order/createto 500.