@crmcom/self-service-sdk 3.0.0-build.28 → 3.0.0-build.30

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/index.d.ts CHANGED
@@ -369,6 +369,7 @@ export declare const subscriptions: {
369
369
  updateSubscription(params?: { action?: string; payment_method_id?: string; billing_day?: number; funding_source?: string }, id?: string): Promise<SDKResult>;
370
370
  getServiceRescommendation(params: Record<string, any>): Promise<SDKResult>;
371
371
  getSubscriptionAction(params: { action_id: string }): Promise<SDKResult>;
372
+ listSubscriptionActions(params?: PaginationParams & { cancelled_on?: string; cancelled_on_gt?: string; cancelled_on_gte?: string; cancelled_on_lt?: string; cancelled_on_lte?: string; scheduled_on?: string; scheduled_on_gt?: string; scheduled_on_gte?: string; scheduled_on_lt?: string; scheduled_on_lte?: string; state?: string; subscription_id?: string; behaviour_code?: string; business_classification_code?: string }): Promise<SDKResult>;
372
373
  };
373
374
 
374
375
  // ============================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crmcom/self-service-sdk",
3
- "version": "3.0.0-build.28",
3
+ "version": "3.0.0-build.30",
4
4
  "description": "Official CRM.COM Self-Service JavaScript SDK for consumer-facing API integration",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/subscriptions.js CHANGED
@@ -52,6 +52,7 @@ async function getServiceDevices({
52
52
  sort,
53
53
  state
54
54
  }={}, id) {
55
+ console.log("ms id", id)
55
56
  try {
56
57
  let response = await httpUtil.get({
57
58
  resourcePath: "/v2/services/" + id + "/devices",
@@ -425,3 +426,60 @@ async function getSubscriptionAction({
425
426
  return createResult(ErrorCodes.UNKNOWN, e);
426
427
  }
427
428
  }
429
+
430
+ async function listSubscriptionActions({
431
+ sort,
432
+ order,
433
+ page = 1,
434
+ size = 20,
435
+ include_total,
436
+ behaviour_code,
437
+ business_classification_code,
438
+ cancelled_on,
439
+ cancelled_on_gt,
440
+ cancelled_on_gte,
441
+ cancelled_on_lt,
442
+ cancelled_on_lte,
443
+ scheduled_on,
444
+ scheduled_on_gt,
445
+ scheduled_on_gte,
446
+ scheduled_on_lt,
447
+ scheduled_on_lte,
448
+ state,
449
+ subscription_id,
450
+ } = {}) {
451
+ try {
452
+ let id = httpUtil.getSession().sub;
453
+ let response = await httpUtil.get({
454
+ resourcePath: "/v2/contacts/" + id + "/subscriptions/actions",
455
+ queryParams: {
456
+ sort,
457
+ order,
458
+ page,
459
+ size,
460
+ behaviour_code,
461
+ business_classification_code,
462
+ cancelled_on,
463
+ "cancelled_on[gt]":cancelled_on_gt,
464
+ "cancelled_on[gte]": cancelled_on_gte,
465
+ "cancelled_on[lt]":cancelled_on_lt,
466
+ "cancelled_on[lte]":cancelled_on_lte,
467
+ scheduled_on,
468
+ "scheduled_on[gt]":scheduled_on_gt,
469
+ "scheduled_on[gte]":scheduled_on_gte,
470
+ "scheduled_on[lt]":scheduled_on_lt,
471
+ "scheduled_on[lte]":scheduled_on_lte,
472
+ state,
473
+ subscription_id,
474
+ include_total,
475
+ },
476
+ withAccessToken: true,
477
+ });
478
+ //check return code here instead of put as there would be different intepretation for different API
479
+ return createCommonResult(response);
480
+ } catch (e) {
481
+ logger.error("Exception listSubscriptionActions:", e);
482
+ return createResult(ErrorCodes.UNKNOWN, e);
483
+ }
484
+ }
485
+