@unboundcx/sdk 2.4.2 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/services/phoneNumbers.js +23 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
package/services/phoneNumbers.js
CHANGED
|
@@ -206,21 +206,32 @@ export class PhoneNumbersService {
|
|
|
206
206
|
// Porting Methods
|
|
207
207
|
|
|
208
208
|
/**
|
|
209
|
-
* Check portability of phone numbers
|
|
209
|
+
* Check portability of phone numbers using two-phase validation
|
|
210
|
+
*
|
|
211
|
+
* Phase 1 (Default): Internal validation using LRN lookup
|
|
212
|
+
* - Validates ownership, duplicates, and carrier compatibility
|
|
213
|
+
* - Sets portabilityStatus to 'pending'
|
|
214
|
+
*
|
|
215
|
+
* Phase 2 (runPortabilityCheck: true): External validation
|
|
216
|
+
* - Runs full portability check with carrier
|
|
217
|
+
* - Updates portabilityStatus to 'portable', 'not-portable', or 'error'
|
|
218
|
+
*
|
|
210
219
|
* @param {Object} params
|
|
211
220
|
* @param {string[]} params.phoneNumbers - Array of +E.164 formatted phone numbers
|
|
212
221
|
* @param {string} [params.portingOrderId] - Optional porting order ID to save results to
|
|
222
|
+
* @param {boolean} [params.runPortabilityCheck=false] - Run external portability validation
|
|
213
223
|
* @returns {Promise<Object>} Portability check results
|
|
214
224
|
*/
|
|
215
|
-
async checkPortability({ phoneNumbers, portingOrderId }) {
|
|
225
|
+
async checkPortability({ phoneNumbers, portingOrderId, runPortabilityCheck = false }) {
|
|
216
226
|
this.sdk.validateParams(
|
|
217
|
-
{ phoneNumbers },
|
|
227
|
+
{ phoneNumbers, runPortabilityCheck },
|
|
218
228
|
{
|
|
219
229
|
phoneNumbers: { type: 'array', required: true },
|
|
230
|
+
runPortabilityCheck: { type: 'boolean', required: false },
|
|
220
231
|
},
|
|
221
232
|
);
|
|
222
233
|
|
|
223
|
-
const body = { phoneNumbers };
|
|
234
|
+
const body = { phoneNumbers, runPortabilityCheck };
|
|
224
235
|
if (portingOrderId) body.portingOrderId = portingOrderId;
|
|
225
236
|
|
|
226
237
|
const result = await this.sdk._fetch(
|
|
@@ -265,11 +276,18 @@ export class PhoneNumbersService {
|
|
|
265
276
|
* endUser: { admin: { entityName: "My Company" } }
|
|
266
277
|
* });
|
|
267
278
|
*
|
|
268
|
-
* // Add
|
|
279
|
+
* // Phase 1: Add numbers with internal validation (pending status)
|
|
269
280
|
* await sdk.phoneNumbers.checkPortability({
|
|
270
281
|
* phoneNumbers: ["+15551234567"],
|
|
271
282
|
* portingOrderId: order.id
|
|
272
283
|
* });
|
|
284
|
+
*
|
|
285
|
+
* // Phase 2: Run external portability check when ready
|
|
286
|
+
* await sdk.phoneNumbers.checkPortability({
|
|
287
|
+
* phoneNumbers: ["+15551234567"],
|
|
288
|
+
* portingOrderId: order.id,
|
|
289
|
+
* runPortabilityCheck: true
|
|
290
|
+
* });
|
|
273
291
|
*/
|
|
274
292
|
async createPortingOrder({
|
|
275
293
|
customerReference,
|