@crmcom/self-service-sdk 3.0.0-build.27 → 3.0.0-build.29
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 +2 -1
- package/package.json +1 -1
- package/subscriptions.js +59 -2
package/index.d.ts
CHANGED
|
@@ -356,7 +356,7 @@ export declare const payment: {
|
|
|
356
356
|
|
|
357
357
|
export declare const subscriptions: {
|
|
358
358
|
getListSubscriptions(params?: { page?: number; size?: number; include_terms?: boolean; include_billing_info?: boolean }): Promise<SDKResult>;
|
|
359
|
-
getServiceDevices(params?: PaginationParams & { state?: string; }): Promise<SDKResult>;
|
|
359
|
+
getServiceDevices(params?: PaginationParams & { state?: string; }, id?: string): Promise<SDKResult>;
|
|
360
360
|
getListContactServices(params?: PaginationParams & { classification?: string; include_future_info?: boolean; include_order_info?: boolean; include_subscription?: boolean; subscription_id?: string }): Promise<SDKResult>;
|
|
361
361
|
getListContactDevices(params?: PaginationParams & { owned_by_contact?: boolean; search_value?: string; serial_number?: string; include_custom_fields?: boolean; include_subscription?: boolean; include_characteristics?: boolean }): Promise<SDKResult>;
|
|
362
362
|
getListContactSharedDevices(params?: PaginationParams & { search_value?: string; serial_number?: string; include_custom_fields?: boolean; include_subscription?: boolean; include_characteristics?: boolean }): Promise<SDKResult>;
|
|
@@ -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; cancelled_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
package/subscriptions.js
CHANGED
|
@@ -51,9 +51,9 @@ async function getServiceDevices({
|
|
|
51
51
|
size=20,
|
|
52
52
|
sort,
|
|
53
53
|
state
|
|
54
|
-
}={}) {
|
|
54
|
+
}={}, id) {
|
|
55
|
+
console.log("ms id", id)
|
|
55
56
|
try {
|
|
56
|
-
let id = httpUtil.getSession().sub;
|
|
57
57
|
let response = await httpUtil.get({
|
|
58
58
|
resourcePath: "/v2/services/" + id + "/devices",
|
|
59
59
|
queryParams: {
|
|
@@ -426,3 +426,60 @@ async function getSubscriptionAction({
|
|
|
426
426
|
return createResult(ErrorCodes.UNKNOWN, e);
|
|
427
427
|
}
|
|
428
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
|
+
|