wbxcallprov/test
jmcqueen 3daf2fcdc5
Some checks failed
CI / verify (push) Has been cancelled
Verify (don't order) phone number; fix DECT location lookup endpoint
Two bugs surfaced by the same failed finalize run for store 7311.

1. addPhoneNumbersToLocation was POSTing to /locations/{id}/numbers,
   which Webex treats as "provision a NEW number" — that triggered
   duplicate PSTN orders against numbers AE had already manually
   ordered through Control Hub, and the provider rejected them with
   ORDER_CREATION_FAILED. AE's workflow is manual ordering, so this
   step now VERIFIES the number's current state in the org via
   GET /telephony/config/numbers?phoneNumber=..., classifies the
   outcome (already here / pending / wrong location / not in org),
   and either succeeds silently or throws with a specific
   Control-Hub fix-it instruction. The bot never triggers a PSTN
   order now.

2. findDectNetworkInLocation was hitting
   GET /telephony/config/locations/{id}/dectNetworks, which Webex
   does not implement (returns HTTP 404 "No static resource ..."
   unconditionally). That silently broke both the finalize
   idempotency pre-check and the /provisionDect fallback, so
   /provisionDect kept showing the "create network" card for stores
   that already had one, then 409'd on the create attempt. Switched
   to the real endpoint GET /telephony/config/dectNetworks with a
   locationId filter. Also added translateCreateDectError to
   rewrite the deeply-nested 27453 "access code in use" 409 blob
   into an actionable "already exists, re-run /provisionDect"
   message.

Extracted both error/state translators as pure exported functions
(classifyNumberAssignment, translateCreateDectError) with unit-test
coverage locking down the exact Webex payload shapes.

README: updated /finalizeStore to reflect the manual-order
expectation and specific fix-it instructions on mismatch.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-09 13:53:38 -04:00
..
dect.test.js Verify (don't order) phone number; fix DECT location lookup endpoint 2026-07-09 13:53:38 -04:00
google.test.js Add node:test suite and Gitea Actions CI 2026-07-06 16:07:02 -04:00
greetingSelector.test.js Add node:test suite and Gitea Actions CI 2026-07-06 16:07:02 -04:00
helpers.test.js Add /provisionPhone for wired desk phones (7841/7821) 2026-07-07 12:39:06 -04:00
http.test.js Fix requestJson dropping Content-Type on POSTs (HTTP 415) 2026-07-09 12:07:15 -04:00
locations.test.js Verify (don't order) phone number; fix DECT location lookup endpoint 2026-07-09 13:53:38 -04:00
mac.test.js Add /provisionPhone for wired desk phones (7841/7821) 2026-07-07 12:39:06 -04:00
phones.test.js Add /provisionPhone for wired desk phones (7841/7821) 2026-07-07 12:39:06 -04:00
setup.js Add node:test suite and Gitea Actions CI 2026-07-06 16:07:02 -04:00
stepRunner.test.js Add node:test suite and Gitea Actions CI 2026-07-06 16:07:02 -04:00
webexClient.test.js Add node:test suite and Gitea Actions CI 2026-07-06 16:07:02 -04:00