Dev tools
Probe the real Bertus API and generate mock orders that exercise every state.
Real Bertus probes
live APIHits the live Bertus API directly. Does not write to the database. Use to validate credentials and DTO shapes before enabling automated polling.
1. Ping account
GET /combinedOrderStatus?take=1
2. Lookup article
GET /articles/{id}
3. Dry-run create order
POST /articleIdOrders · qty 1 · no backorder
Bertus open queue
read-onlyLive snapshot of every order Bertus currently has in combinedOrderStatus. Use this to verify whether a Shopify order's article-mix is actually present at the supplier — if it isn't here, discovery cannot find it.
Discovery candidate inspector
debugPaste an internal bertus_orders.id (UUID) and we will scan Bertus open queue, packed (ready-to-ship) and the most recent shipments (paged) to show every candidate group whose articles overlap with your order's SKUs. Lets you see exactly why discovery doesn't match.
Shipping feeds raw probe
500 debugHits the readyToShipItems and shipments endpoints directly (and tries swapped path spellings) so we can see the raw HTTP status + body Bertus returns. Use this to confirm whether the 500 errors are coming from Bertus's server or from a path we're constructing wrong.
Per-article shipments probe
fallbackHits /accounts/{acct}/articles/{articleId}/shipments — confirmed working even when the global /shipments feed returns 500. Optionally filter by Shopify order name (matched against PoReference) to verify a specific order's shipment data.
Discover via /orderResults
alt strategyMirrors the working sibling app. Pages through /accounts/{acc}/orderResults, fetches the detail for each, and matches your Shopify order name against OrderResultItems[].PoReference. Slow (~1s per detail call) but bypasses the broken readyToShipItems / shipments endpoints. Use a Shopify order name you know already exists in Bertus (e.g. DJ11171).
Order discovery probes
phase 2Verify how to match a Shopify order to a Bertus order created by the OTHER app. Use a Shopify order number you know already exists in Bertus. Inspect the responses to determine the right field names for discovery + sync.
E1. Lookup by reference
Tries ?externalReference, ?reference, ?id, ?Id, plus a full-list fallback filtered client-side by Id.
E2. List recent orders
GET /combinedOrderStatus?take=N — shows field names so we can spot the Bertus order ID / external reference column.
Backfill from Shopify
read-onlyImports historical Shopify orders for a date range so the cron sweep can attempt to discover the Bertus order(s) the OTHER app already created. Never sends anything to Bertus. Use dry-run first to preview.
- Fetches orders from Shopify Admin REST.
- Inserts into our DB the same way the webhook does.
- Bertus-flagged lines create
awaiting_bertusrows. - The cron sweep then discovers + syncs against Bertus.
Hitta saknade Shopify-ordrar
guardrailJämför de senaste N ordrarna i Shopify mot vår DB. Fyller luckor när webhooks tappats eller backfill missat ett intervall.
Reparera ohanterade Bertus-rader
self-healHittar Shopify-ordrar där shopify_order_lines.is_bertus = true men där bertus_orders saknas eller line_tracking.is_bertus fortfarande är false. Kör om ingest mot sparad raw_payload — vanligt för mixed orders som klassades innan custom.lager-metafältet kunde läsas.
Backfill Shopify-fulfillments
manuellHämtar fulfillments från Shopify Admin för ordrar där dispatched_to_customer_at är NULL och tillämpar samma patch som webhooken — för ordrar som blev fulfilled innan webhooken var på plats. Idempotent.
Backfill line_tracking
one-shotCreates a line_tracking row for every existing Shopify order line that doesn't already have one, using the order's received_at as shopify_received_at. Idempotent — safe to re-run. Run once after deploy, then the per-article view at artikellistan will show the four-date timeline.
Bertus world sweep (article-first)
newPulls open queue + recent order results + per-article shipments from Bertus, writes everything to bertus_article_events, then joins events to line_tracking rows by PoReference and SKU+date. This is the new sync — replaces per-order discovery. Cron runs this every 5 minutes; use the buttons here for manual triggers.
Auth diagnostics
debugBertus requires both a bearer token (from login.bertus.com) and the Ocp-Apim-Subscription-Key header. Use Step D first to confirm login works, then re-run Ping.
A. Inspect credentials
Masked view of secrets — no full key is logged.
D. Test login
POST {loginUrl} with username/password. Clears the cached token first.
C. Probe without account
Tries /accounts, /, /health, /ping, /articles.
Cron setup
One-time: copy CRON_SECRET to Supabase Vault so the every-minute pg_cron sweep (bertus-sync-open-orders) can authenticate.
Mock scenarios
Successful order
All lines progress to shipped.
Validation error (400)
createOrder fails non-retriably → fails.
Transient 5XX
createOrder fails retriably → needs_attention.
Partial shipment
Some lines ship, others stay picking.
Backorder
Line stays on backorder — needs_attention.
Removed line
A line is removed by Bertus.