@gofynd/fdk-client-javascript 1.0.1 → 1.0.2
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/documentation/application/CART.md +251 -251
- package/documentation/application/CATALOG.md +414 -414
- package/documentation/application/CONTENT.md +15 -1
- package/documentation/application/ORDER.md +290 -290
- package/documentation/application/PAYMENT.md +255 -255
- package/documentation/application/POSCART.md +297 -297
- package/documentation/platform/CART.md +499 -499
- package/documentation/platform/CATALOG.md +3088 -2702
- package/documentation/platform/COMPANYPROFILE.md +201 -201
- package/documentation/platform/CONTENT.md +123 -1
- package/documentation/platform/ORDER.md +1233 -1158
- package/documentation/platform/PARTNER.md +7 -7
- package/documentation/platform/PAYMENT.md +83 -83
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +619 -108
- package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationModel.js +335 -335
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +730 -134
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +21 -21
- package/sdk/application/Catalog/CatalogApplicationModel.js +547 -547
- package/sdk/application/Common/CommonApplicationClient.js +48 -8
- package/sdk/application/Communication/CommunicationApplicationClient.js +75 -14
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +392 -66
- package/sdk/application/Content/ContentApplicationClient.js +444 -76
- package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +11 -1
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +74 -12
- package/sdk/application/Lead/LeadApplicationClient.js +164 -30
- package/sdk/application/Logistic/LogisticApplicationClient.js +98 -16
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +287 -54
- package/sdk/application/Order/OrderApplicationModel.d.ts +19 -19
- package/sdk/application/Order/OrderApplicationModel.js +357 -357
- package/sdk/application/Payment/PaymentApplicationClient.js +961 -186
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +3 -3
- package/sdk/application/Payment/PaymentApplicationModel.js +352 -352
- package/sdk/application/PosCart/PosCartApplicationClient.js +645 -114
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
- package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
- package/sdk/application/Rewards/RewardsApplicationClient.js +168 -28
- package/sdk/application/Share/ShareApplicationClient.js +157 -32
- package/sdk/application/Theme/ThemeApplicationClient.js +94 -16
- package/sdk/application/User/UserApplicationClient.js +806 -148
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +191 -34
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +103 -16
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
- package/sdk/platform/Billing/BillingPlatformClient.js +299 -54
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +409 -72
- package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
- package/sdk/platform/Cart/CartPlatformModel.js +617 -617
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +167 -114
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1562 -453
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +8 -8
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +39 -39
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +314 -196
- package/sdk/platform/Catalog/CatalogPlatformClient.js +2459 -718
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +103 -94
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2063 -1797
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +17 -15
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +95 -76
- package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
- package/sdk/platform/Common/CommonPlatformClient.js +51 -8
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1000 -168
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +335 -54
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +10 -10
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +278 -278
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +702 -118
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +457 -82
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +1724 -284
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
- package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
- package/sdk/platform/Content/ContentPlatformModel.js +43 -1
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
- package/sdk/platform/Discount/DiscountPlatformClient.js +270 -44
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +102 -16
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +150 -24
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
- package/sdk/platform/Inventory/InventoryPlatformClient.js +316 -52
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +311 -52
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +266 -44
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +78 -14
- package/sdk/platform/Order/OrderPlatformClient.d.ts +95 -43
- package/sdk/platform/Order/OrderPlatformClient.js +1062 -180
- package/sdk/platform/Order/OrderPlatformModel.d.ts +64 -60
- package/sdk/platform/Order/OrderPlatformModel.js +1481 -1425
- package/sdk/platform/Order/OrderPlatformValidator.js +5 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
- package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +287 -56
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
- package/sdk/platform/Payment/PaymentPlatformClient.js +263 -48
- package/sdk/platform/Payment/PaymentPlatformModel.js +122 -122
- package/sdk/platform/PlatformApplicationClient.d.ts +2959 -2787
- package/sdk/platform/PlatformApplicationClient.js +3420 -3212
- package/sdk/platform/PlatformClient.d.ts +2959 -2787
- package/sdk/platform/PlatformClient.js +3420 -3212
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +308 -54
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/Share/SharePlatformApplicationClient.js +94 -16
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +571 -96
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
- package/sdk/platform/User/UserPlatformApplicationClient.js +296 -48
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
- package/sdk/platform/Webhook/WebhookPlatformClient.js +157 -30
- package/sdk/public/Configuration/ConfigurationPublicClient.js +51 -8
- package/sdk/public/Inventory/InventoryPublicClient.js +149 -26
- package/sdk/public/Webhook/WebhookPublicClient.js +51 -10
|
@@ -2,6 +2,9 @@ const Paginator = require("../../common/Paginator");
|
|
|
2
2
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
3
3
|
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
4
4
|
const BillingValidator = require("./BillingPlatformValidator");
|
|
5
|
+
const BillingModel = require("./BillingPlatformModel");
|
|
6
|
+
const { Logger } = require("./../../common/Logger");
|
|
7
|
+
|
|
5
8
|
class Billing {
|
|
6
9
|
constructor(config) {
|
|
7
10
|
this.config = config;
|
|
@@ -11,10 +14,11 @@ class Billing {
|
|
|
11
14
|
* @param {Object} arg - Arg object.
|
|
12
15
|
* @param {string} arg.plan - ID of the plan.
|
|
13
16
|
* @param {string} arg.couponCode - Coupon code.
|
|
17
|
+
* @returns {Promise<CheckValidityResponse>} - Success response
|
|
14
18
|
* @summary: Check coupon validity
|
|
15
19
|
* @description: Check coupon validity.
|
|
16
20
|
*/
|
|
17
|
-
checkCouponValidity({ plan, couponCode } = {}) {
|
|
21
|
+
async checkCouponValidity({ plan, couponCode } = {}) {
|
|
18
22
|
const { error } = BillingValidator.checkCouponValidity().validate(
|
|
19
23
|
{
|
|
20
24
|
plan,
|
|
@@ -35,8 +39,11 @@ class Billing {
|
|
|
35
39
|
{ abortEarly: false, allowUnknown: false }
|
|
36
40
|
);
|
|
37
41
|
if (warrning) {
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
Logger({
|
|
43
|
+
level: "WARN",
|
|
44
|
+
message: "Parameter Validation warrnings for checkCouponValidity",
|
|
45
|
+
});
|
|
46
|
+
Logger({ level: "WARN", message: warrning });
|
|
40
47
|
}
|
|
41
48
|
|
|
42
49
|
const query_params = {};
|
|
@@ -45,7 +52,7 @@ class Billing {
|
|
|
45
52
|
|
|
46
53
|
const xHeaders = {};
|
|
47
54
|
|
|
48
|
-
|
|
55
|
+
const response = await PlatformAPIClient.execute(
|
|
49
56
|
this.config,
|
|
50
57
|
"get",
|
|
51
58
|
`/service/platform/billing/v1.0/company/${this.config.companyId}/coupon/check-validity`,
|
|
@@ -53,16 +60,34 @@ class Billing {
|
|
|
53
60
|
undefined,
|
|
54
61
|
xHeaders
|
|
55
62
|
);
|
|
63
|
+
|
|
64
|
+
const {
|
|
65
|
+
error: res_error,
|
|
66
|
+
} = BillingModel.CheckValidityResponse().validate(response, {
|
|
67
|
+
abortEarly: false,
|
|
68
|
+
allowUnknown: false,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
if (res_error) {
|
|
72
|
+
Logger({
|
|
73
|
+
level: "WARN",
|
|
74
|
+
message: "Response Validation Warnnings for checkCouponValidity",
|
|
75
|
+
});
|
|
76
|
+
Logger({ level: "WARN", message: res_error });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return response;
|
|
56
80
|
}
|
|
57
81
|
|
|
58
82
|
/**
|
|
59
83
|
* @param {Object} arg - Arg object.
|
|
60
84
|
* @param {string} arg.extensionId - Extension _id
|
|
61
85
|
* @param {CreateSubscriptionCharge} arg.body
|
|
86
|
+
* @returns {Promise<CreateSubscriptionResponse>} - Success response
|
|
62
87
|
* @summary: Create subscription charge
|
|
63
88
|
* @description: Register subscription charge for a seller of your extension.
|
|
64
89
|
*/
|
|
65
|
-
createSubscriptionCharge({ extensionId, body } = {}) {
|
|
90
|
+
async createSubscriptionCharge({ extensionId, body } = {}) {
|
|
66
91
|
const { error } = BillingValidator.createSubscriptionCharge().validate(
|
|
67
92
|
{
|
|
68
93
|
extensionId,
|
|
@@ -85,17 +110,18 @@ class Billing {
|
|
|
85
110
|
{ abortEarly: false, allowUnknown: false }
|
|
86
111
|
);
|
|
87
112
|
if (warrning) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
113
|
+
Logger({
|
|
114
|
+
level: "WARN",
|
|
115
|
+
message: "Parameter Validation warrnings for createSubscriptionCharge",
|
|
116
|
+
});
|
|
117
|
+
Logger({ level: "WARN", message: warrning });
|
|
92
118
|
}
|
|
93
119
|
|
|
94
120
|
const query_params = {};
|
|
95
121
|
|
|
96
122
|
const xHeaders = {};
|
|
97
123
|
|
|
98
|
-
|
|
124
|
+
const response = await PlatformAPIClient.execute(
|
|
99
125
|
this.config,
|
|
100
126
|
"post",
|
|
101
127
|
`/service/platform/billing/v1.0/company/${this.config.companyId}/extension/${extensionId}/subscription`,
|
|
@@ -103,16 +129,34 @@ class Billing {
|
|
|
103
129
|
body,
|
|
104
130
|
xHeaders
|
|
105
131
|
);
|
|
132
|
+
|
|
133
|
+
const {
|
|
134
|
+
error: res_error,
|
|
135
|
+
} = BillingModel.CreateSubscriptionResponse().validate(response, {
|
|
136
|
+
abortEarly: false,
|
|
137
|
+
allowUnknown: false,
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
if (res_error) {
|
|
141
|
+
Logger({
|
|
142
|
+
level: "WARN",
|
|
143
|
+
message: "Response Validation Warnnings for createSubscriptionCharge",
|
|
144
|
+
});
|
|
145
|
+
Logger({ level: "WARN", message: res_error });
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return response;
|
|
106
149
|
}
|
|
107
150
|
|
|
108
151
|
/**
|
|
109
152
|
* @param {Object} arg - Arg object.
|
|
110
153
|
* @param {string} arg.extensionId - Extension _id
|
|
111
154
|
* @param {string} arg.subscriptionId - Subscription charge _id
|
|
155
|
+
* @returns {Promise<EntitySubscription>} - Success response
|
|
112
156
|
* @summary: Get subscription charge details
|
|
113
157
|
* @description: Get created subscription charge details
|
|
114
158
|
*/
|
|
115
|
-
getSubscriptionCharge({ extensionId, subscriptionId } = {}) {
|
|
159
|
+
async getSubscriptionCharge({ extensionId, subscriptionId } = {}) {
|
|
116
160
|
const { error } = BillingValidator.getSubscriptionCharge().validate(
|
|
117
161
|
{
|
|
118
162
|
extensionId,
|
|
@@ -135,15 +179,18 @@ class Billing {
|
|
|
135
179
|
{ abortEarly: false, allowUnknown: false }
|
|
136
180
|
);
|
|
137
181
|
if (warrning) {
|
|
138
|
-
|
|
139
|
-
|
|
182
|
+
Logger({
|
|
183
|
+
level: "WARN",
|
|
184
|
+
message: "Parameter Validation warrnings for getSubscriptionCharge",
|
|
185
|
+
});
|
|
186
|
+
Logger({ level: "WARN", message: warrning });
|
|
140
187
|
}
|
|
141
188
|
|
|
142
189
|
const query_params = {};
|
|
143
190
|
|
|
144
191
|
const xHeaders = {};
|
|
145
192
|
|
|
146
|
-
|
|
193
|
+
const response = await PlatformAPIClient.execute(
|
|
147
194
|
this.config,
|
|
148
195
|
"get",
|
|
149
196
|
`/service/platform/billing/v1.0/company/${this.config.companyId}/extension/${extensionId}/subscription/${subscriptionId}`,
|
|
@@ -151,16 +198,34 @@ class Billing {
|
|
|
151
198
|
undefined,
|
|
152
199
|
xHeaders
|
|
153
200
|
);
|
|
201
|
+
|
|
202
|
+
const {
|
|
203
|
+
error: res_error,
|
|
204
|
+
} = BillingModel.EntitySubscription().validate(response, {
|
|
205
|
+
abortEarly: false,
|
|
206
|
+
allowUnknown: false,
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
if (res_error) {
|
|
210
|
+
Logger({
|
|
211
|
+
level: "WARN",
|
|
212
|
+
message: "Response Validation Warnnings for getSubscriptionCharge",
|
|
213
|
+
});
|
|
214
|
+
Logger({ level: "WARN", message: res_error });
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return response;
|
|
154
218
|
}
|
|
155
219
|
|
|
156
220
|
/**
|
|
157
221
|
* @param {Object} arg - Arg object.
|
|
158
222
|
* @param {string} arg.extensionId - Extension _id
|
|
159
223
|
* @param {string} arg.subscriptionId - Subscription charge _id
|
|
224
|
+
* @returns {Promise<EntitySubscription>} - Success response
|
|
160
225
|
* @summary: Cancel subscription charge
|
|
161
226
|
* @description: Cancel subscription and attached charges.
|
|
162
227
|
*/
|
|
163
|
-
cancelSubscriptionCharge({ extensionId, subscriptionId } = {}) {
|
|
228
|
+
async cancelSubscriptionCharge({ extensionId, subscriptionId } = {}) {
|
|
164
229
|
const { error } = BillingValidator.cancelSubscriptionCharge().validate(
|
|
165
230
|
{
|
|
166
231
|
extensionId,
|
|
@@ -183,17 +248,18 @@ class Billing {
|
|
|
183
248
|
{ abortEarly: false, allowUnknown: false }
|
|
184
249
|
);
|
|
185
250
|
if (warrning) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
251
|
+
Logger({
|
|
252
|
+
level: "WARN",
|
|
253
|
+
message: "Parameter Validation warrnings for cancelSubscriptionCharge",
|
|
254
|
+
});
|
|
255
|
+
Logger({ level: "WARN", message: warrning });
|
|
190
256
|
}
|
|
191
257
|
|
|
192
258
|
const query_params = {};
|
|
193
259
|
|
|
194
260
|
const xHeaders = {};
|
|
195
261
|
|
|
196
|
-
|
|
262
|
+
const response = await PlatformAPIClient.execute(
|
|
197
263
|
this.config,
|
|
198
264
|
"post",
|
|
199
265
|
`/service/platform/billing/v1.0/company/${this.config.companyId}/extension/${extensionId}/subscription/${subscriptionId}/cancel`,
|
|
@@ -201,14 +267,32 @@ class Billing {
|
|
|
201
267
|
undefined,
|
|
202
268
|
xHeaders
|
|
203
269
|
);
|
|
270
|
+
|
|
271
|
+
const {
|
|
272
|
+
error: res_error,
|
|
273
|
+
} = BillingModel.EntitySubscription().validate(response, {
|
|
274
|
+
abortEarly: false,
|
|
275
|
+
allowUnknown: false,
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
if (res_error) {
|
|
279
|
+
Logger({
|
|
280
|
+
level: "WARN",
|
|
281
|
+
message: "Response Validation Warnnings for cancelSubscriptionCharge",
|
|
282
|
+
});
|
|
283
|
+
Logger({ level: "WARN", message: res_error });
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return response;
|
|
204
287
|
}
|
|
205
288
|
|
|
206
289
|
/**
|
|
207
290
|
* @param {Object} arg - Arg object.
|
|
291
|
+
* @returns {Promise<Invoices>} - Success response
|
|
208
292
|
* @summary: Get invoices
|
|
209
293
|
* @description: Get invoices.
|
|
210
294
|
*/
|
|
211
|
-
getInvoices({} = {}) {
|
|
295
|
+
async getInvoices({} = {}) {
|
|
212
296
|
const { error } = BillingValidator.getInvoices().validate(
|
|
213
297
|
{},
|
|
214
298
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -223,15 +307,18 @@ class Billing {
|
|
|
223
307
|
{ abortEarly: false, allowUnknown: false }
|
|
224
308
|
);
|
|
225
309
|
if (warrning) {
|
|
226
|
-
|
|
227
|
-
|
|
310
|
+
Logger({
|
|
311
|
+
level: "WARN",
|
|
312
|
+
message: "Parameter Validation warrnings for getInvoices",
|
|
313
|
+
});
|
|
314
|
+
Logger({ level: "WARN", message: warrning });
|
|
228
315
|
}
|
|
229
316
|
|
|
230
317
|
const query_params = {};
|
|
231
318
|
|
|
232
319
|
const xHeaders = {};
|
|
233
320
|
|
|
234
|
-
|
|
321
|
+
const response = await PlatformAPIClient.execute(
|
|
235
322
|
this.config,
|
|
236
323
|
"get",
|
|
237
324
|
`/service/platform/billing/v1.0/company/${this.config.companyId}/invoice/list`,
|
|
@@ -239,15 +326,31 @@ class Billing {
|
|
|
239
326
|
undefined,
|
|
240
327
|
xHeaders
|
|
241
328
|
);
|
|
329
|
+
|
|
330
|
+
const { error: res_error } = BillingModel.Invoices().validate(response, {
|
|
331
|
+
abortEarly: false,
|
|
332
|
+
allowUnknown: false,
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
if (res_error) {
|
|
336
|
+
Logger({
|
|
337
|
+
level: "WARN",
|
|
338
|
+
message: "Response Validation Warnnings for getInvoices",
|
|
339
|
+
});
|
|
340
|
+
Logger({ level: "WARN", message: res_error });
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
return response;
|
|
242
344
|
}
|
|
243
345
|
|
|
244
346
|
/**
|
|
245
347
|
* @param {Object} arg - Arg object.
|
|
246
348
|
* @param {string} arg.invoiceId - Invoice id
|
|
349
|
+
* @returns {Promise<Invoice>} - Success response
|
|
247
350
|
* @summary: Get invoice by id
|
|
248
351
|
* @description: Get invoice by id.
|
|
249
352
|
*/
|
|
250
|
-
getInvoiceById({ invoiceId } = {}) {
|
|
353
|
+
async getInvoiceById({ invoiceId } = {}) {
|
|
251
354
|
const { error } = BillingValidator.getInvoiceById().validate(
|
|
252
355
|
{
|
|
253
356
|
invoiceId,
|
|
@@ -266,15 +369,18 @@ class Billing {
|
|
|
266
369
|
{ abortEarly: false, allowUnknown: false }
|
|
267
370
|
);
|
|
268
371
|
if (warrning) {
|
|
269
|
-
|
|
270
|
-
|
|
372
|
+
Logger({
|
|
373
|
+
level: "WARN",
|
|
374
|
+
message: "Parameter Validation warrnings for getInvoiceById",
|
|
375
|
+
});
|
|
376
|
+
Logger({ level: "WARN", message: warrning });
|
|
271
377
|
}
|
|
272
378
|
|
|
273
379
|
const query_params = {};
|
|
274
380
|
|
|
275
381
|
const xHeaders = {};
|
|
276
382
|
|
|
277
|
-
|
|
383
|
+
const response = await PlatformAPIClient.execute(
|
|
278
384
|
this.config,
|
|
279
385
|
"get",
|
|
280
386
|
`/service/platform/billing/v1.0/company/${this.config.companyId}/invoice/${invoiceId}`,
|
|
@@ -282,14 +388,30 @@ class Billing {
|
|
|
282
388
|
undefined,
|
|
283
389
|
xHeaders
|
|
284
390
|
);
|
|
391
|
+
|
|
392
|
+
const { error: res_error } = BillingModel.Invoice().validate(response, {
|
|
393
|
+
abortEarly: false,
|
|
394
|
+
allowUnknown: false,
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
if (res_error) {
|
|
398
|
+
Logger({
|
|
399
|
+
level: "WARN",
|
|
400
|
+
message: "Response Validation Warnnings for getInvoiceById",
|
|
401
|
+
});
|
|
402
|
+
Logger({ level: "WARN", message: res_error });
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
return response;
|
|
285
406
|
}
|
|
286
407
|
|
|
287
408
|
/**
|
|
288
409
|
* @param {Object} arg - Arg object.
|
|
410
|
+
* @returns {Promise<SubscriptionCustomer>} - Success response
|
|
289
411
|
* @summary: Get subscription customer detail
|
|
290
412
|
* @description: Get subscription customer detail.
|
|
291
413
|
*/
|
|
292
|
-
getCustomerDetail({} = {}) {
|
|
414
|
+
async getCustomerDetail({} = {}) {
|
|
293
415
|
const { error } = BillingValidator.getCustomerDetail().validate(
|
|
294
416
|
{},
|
|
295
417
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -304,15 +426,18 @@ class Billing {
|
|
|
304
426
|
{ abortEarly: false, allowUnknown: false }
|
|
305
427
|
);
|
|
306
428
|
if (warrning) {
|
|
307
|
-
|
|
308
|
-
|
|
429
|
+
Logger({
|
|
430
|
+
level: "WARN",
|
|
431
|
+
message: "Parameter Validation warrnings for getCustomerDetail",
|
|
432
|
+
});
|
|
433
|
+
Logger({ level: "WARN", message: warrning });
|
|
309
434
|
}
|
|
310
435
|
|
|
311
436
|
const query_params = {};
|
|
312
437
|
|
|
313
438
|
const xHeaders = {};
|
|
314
439
|
|
|
315
|
-
|
|
440
|
+
const response = await PlatformAPIClient.execute(
|
|
316
441
|
this.config,
|
|
317
442
|
"get",
|
|
318
443
|
`/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/customer-detail`,
|
|
@@ -320,15 +445,33 @@ class Billing {
|
|
|
320
445
|
undefined,
|
|
321
446
|
xHeaders
|
|
322
447
|
);
|
|
448
|
+
|
|
449
|
+
const {
|
|
450
|
+
error: res_error,
|
|
451
|
+
} = BillingModel.SubscriptionCustomer().validate(response, {
|
|
452
|
+
abortEarly: false,
|
|
453
|
+
allowUnknown: false,
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
if (res_error) {
|
|
457
|
+
Logger({
|
|
458
|
+
level: "WARN",
|
|
459
|
+
message: "Response Validation Warnnings for getCustomerDetail",
|
|
460
|
+
});
|
|
461
|
+
Logger({ level: "WARN", message: res_error });
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
return response;
|
|
323
465
|
}
|
|
324
466
|
|
|
325
467
|
/**
|
|
326
468
|
* @param {Object} arg - Arg object.
|
|
327
469
|
* @param {SubscriptionCustomerCreate} arg.body
|
|
470
|
+
* @returns {Promise<SubscriptionCustomer>} - Success response
|
|
328
471
|
* @summary: Upsert subscription customer detail
|
|
329
472
|
* @description: Upsert subscription customer detail.
|
|
330
473
|
*/
|
|
331
|
-
upsertCustomerDetail({ body } = {}) {
|
|
474
|
+
async upsertCustomerDetail({ body } = {}) {
|
|
332
475
|
const { error } = BillingValidator.upsertCustomerDetail().validate(
|
|
333
476
|
{
|
|
334
477
|
body,
|
|
@@ -349,15 +492,18 @@ class Billing {
|
|
|
349
492
|
{ abortEarly: false, allowUnknown: false }
|
|
350
493
|
);
|
|
351
494
|
if (warrning) {
|
|
352
|
-
|
|
353
|
-
|
|
495
|
+
Logger({
|
|
496
|
+
level: "WARN",
|
|
497
|
+
message: "Parameter Validation warrnings for upsertCustomerDetail",
|
|
498
|
+
});
|
|
499
|
+
Logger({ level: "WARN", message: warrning });
|
|
354
500
|
}
|
|
355
501
|
|
|
356
502
|
const query_params = {};
|
|
357
503
|
|
|
358
504
|
const xHeaders = {};
|
|
359
505
|
|
|
360
|
-
|
|
506
|
+
const response = await PlatformAPIClient.execute(
|
|
361
507
|
this.config,
|
|
362
508
|
"post",
|
|
363
509
|
`/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/customer-detail`,
|
|
@@ -365,14 +511,32 @@ class Billing {
|
|
|
365
511
|
body,
|
|
366
512
|
xHeaders
|
|
367
513
|
);
|
|
514
|
+
|
|
515
|
+
const {
|
|
516
|
+
error: res_error,
|
|
517
|
+
} = BillingModel.SubscriptionCustomer().validate(response, {
|
|
518
|
+
abortEarly: false,
|
|
519
|
+
allowUnknown: false,
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
if (res_error) {
|
|
523
|
+
Logger({
|
|
524
|
+
level: "WARN",
|
|
525
|
+
message: "Response Validation Warnnings for upsertCustomerDetail",
|
|
526
|
+
});
|
|
527
|
+
Logger({ level: "WARN", message: res_error });
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
return response;
|
|
368
531
|
}
|
|
369
532
|
|
|
370
533
|
/**
|
|
371
534
|
* @param {Object} arg - Arg object.
|
|
535
|
+
* @returns {Promise<SubscriptionStatus>} - Success response
|
|
372
536
|
* @summary: Get current subscription detail
|
|
373
537
|
* @description: If subscription is active then it will return is_enabled true and return subscription object. If subscription is not active then is_enabled false and message.
|
|
374
538
|
*/
|
|
375
|
-
getSubscription({} = {}) {
|
|
539
|
+
async getSubscription({} = {}) {
|
|
376
540
|
const { error } = BillingValidator.getSubscription().validate(
|
|
377
541
|
{},
|
|
378
542
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -387,15 +551,18 @@ class Billing {
|
|
|
387
551
|
{ abortEarly: false, allowUnknown: false }
|
|
388
552
|
);
|
|
389
553
|
if (warrning) {
|
|
390
|
-
|
|
391
|
-
|
|
554
|
+
Logger({
|
|
555
|
+
level: "WARN",
|
|
556
|
+
message: "Parameter Validation warrnings for getSubscription",
|
|
557
|
+
});
|
|
558
|
+
Logger({ level: "WARN", message: warrning });
|
|
392
559
|
}
|
|
393
560
|
|
|
394
561
|
const query_params = {};
|
|
395
562
|
|
|
396
563
|
const xHeaders = {};
|
|
397
564
|
|
|
398
|
-
|
|
565
|
+
const response = await PlatformAPIClient.execute(
|
|
399
566
|
this.config,
|
|
400
567
|
"get",
|
|
401
568
|
`/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/current`,
|
|
@@ -403,14 +570,32 @@ class Billing {
|
|
|
403
570
|
undefined,
|
|
404
571
|
xHeaders
|
|
405
572
|
);
|
|
573
|
+
|
|
574
|
+
const {
|
|
575
|
+
error: res_error,
|
|
576
|
+
} = BillingModel.SubscriptionStatus().validate(response, {
|
|
577
|
+
abortEarly: false,
|
|
578
|
+
allowUnknown: false,
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
if (res_error) {
|
|
582
|
+
Logger({
|
|
583
|
+
level: "WARN",
|
|
584
|
+
message: "Response Validation Warnnings for getSubscription",
|
|
585
|
+
});
|
|
586
|
+
Logger({ level: "WARN", message: res_error });
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
return response;
|
|
406
590
|
}
|
|
407
591
|
|
|
408
592
|
/**
|
|
409
593
|
* @param {Object} arg - Arg object.
|
|
594
|
+
* @returns {Promise<SubscriptionLimit>} - Success response
|
|
410
595
|
* @summary: Get subscription subscription limits
|
|
411
596
|
* @description: Get subscription subscription limits.
|
|
412
597
|
*/
|
|
413
|
-
getFeatureLimitConfig({} = {}) {
|
|
598
|
+
async getFeatureLimitConfig({} = {}) {
|
|
414
599
|
const { error } = BillingValidator.getFeatureLimitConfig().validate(
|
|
415
600
|
{},
|
|
416
601
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -427,15 +612,18 @@ class Billing {
|
|
|
427
612
|
{ abortEarly: false, allowUnknown: false }
|
|
428
613
|
);
|
|
429
614
|
if (warrning) {
|
|
430
|
-
|
|
431
|
-
|
|
615
|
+
Logger({
|
|
616
|
+
level: "WARN",
|
|
617
|
+
message: "Parameter Validation warrnings for getFeatureLimitConfig",
|
|
618
|
+
});
|
|
619
|
+
Logger({ level: "WARN", message: warrning });
|
|
432
620
|
}
|
|
433
621
|
|
|
434
622
|
const query_params = {};
|
|
435
623
|
|
|
436
624
|
const xHeaders = {};
|
|
437
625
|
|
|
438
|
-
|
|
626
|
+
const response = await PlatformAPIClient.execute(
|
|
439
627
|
this.config,
|
|
440
628
|
"get",
|
|
441
629
|
`/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/current-limit`,
|
|
@@ -443,15 +631,33 @@ class Billing {
|
|
|
443
631
|
undefined,
|
|
444
632
|
xHeaders
|
|
445
633
|
);
|
|
634
|
+
|
|
635
|
+
const {
|
|
636
|
+
error: res_error,
|
|
637
|
+
} = BillingModel.SubscriptionLimit().validate(response, {
|
|
638
|
+
abortEarly: false,
|
|
639
|
+
allowUnknown: false,
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
if (res_error) {
|
|
643
|
+
Logger({
|
|
644
|
+
level: "WARN",
|
|
645
|
+
message: "Response Validation Warnnings for getFeatureLimitConfig",
|
|
646
|
+
});
|
|
647
|
+
Logger({ level: "WARN", message: res_error });
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
return response;
|
|
446
651
|
}
|
|
447
652
|
|
|
448
653
|
/**
|
|
449
654
|
* @param {Object} arg - Arg object.
|
|
450
655
|
* @param {SubscriptionActivateReq} arg.body
|
|
656
|
+
* @returns {Promise<SubscriptionActivateRes>} - Success response
|
|
451
657
|
* @summary: Activate subscription
|
|
452
658
|
* @description: It will activate subscription plan for customer
|
|
453
659
|
*/
|
|
454
|
-
activateSubscriptionPlan({ body } = {}) {
|
|
660
|
+
async activateSubscriptionPlan({ body } = {}) {
|
|
455
661
|
const { error } = BillingValidator.activateSubscriptionPlan().validate(
|
|
456
662
|
{
|
|
457
663
|
body,
|
|
@@ -472,17 +678,18 @@ class Billing {
|
|
|
472
678
|
{ abortEarly: false, allowUnknown: false }
|
|
473
679
|
);
|
|
474
680
|
if (warrning) {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
681
|
+
Logger({
|
|
682
|
+
level: "WARN",
|
|
683
|
+
message: "Parameter Validation warrnings for activateSubscriptionPlan",
|
|
684
|
+
});
|
|
685
|
+
Logger({ level: "WARN", message: warrning });
|
|
479
686
|
}
|
|
480
687
|
|
|
481
688
|
const query_params = {};
|
|
482
689
|
|
|
483
690
|
const xHeaders = {};
|
|
484
691
|
|
|
485
|
-
|
|
692
|
+
const response = await PlatformAPIClient.execute(
|
|
486
693
|
this.config,
|
|
487
694
|
"post",
|
|
488
695
|
`/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/activate`,
|
|
@@ -490,15 +697,33 @@ class Billing {
|
|
|
490
697
|
body,
|
|
491
698
|
xHeaders
|
|
492
699
|
);
|
|
700
|
+
|
|
701
|
+
const {
|
|
702
|
+
error: res_error,
|
|
703
|
+
} = BillingModel.SubscriptionActivateRes().validate(response, {
|
|
704
|
+
abortEarly: false,
|
|
705
|
+
allowUnknown: false,
|
|
706
|
+
});
|
|
707
|
+
|
|
708
|
+
if (res_error) {
|
|
709
|
+
Logger({
|
|
710
|
+
level: "WARN",
|
|
711
|
+
message: "Response Validation Warnnings for activateSubscriptionPlan",
|
|
712
|
+
});
|
|
713
|
+
Logger({ level: "WARN", message: res_error });
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
return response;
|
|
493
717
|
}
|
|
494
718
|
|
|
495
719
|
/**
|
|
496
720
|
* @param {Object} arg - Arg object.
|
|
497
721
|
* @param {CancelSubscriptionReq} arg.body
|
|
722
|
+
* @returns {Promise<CancelSubscriptionRes>} - Success response
|
|
498
723
|
* @summary: Cancel subscription
|
|
499
724
|
* @description: It will cancel current active subscription.
|
|
500
725
|
*/
|
|
501
|
-
cancelSubscriptionPlan({ body } = {}) {
|
|
726
|
+
async cancelSubscriptionPlan({ body } = {}) {
|
|
502
727
|
const { error } = BillingValidator.cancelSubscriptionPlan().validate(
|
|
503
728
|
{
|
|
504
729
|
body,
|
|
@@ -519,15 +744,18 @@ class Billing {
|
|
|
519
744
|
{ abortEarly: false, allowUnknown: false }
|
|
520
745
|
);
|
|
521
746
|
if (warrning) {
|
|
522
|
-
|
|
523
|
-
|
|
747
|
+
Logger({
|
|
748
|
+
level: "WARN",
|
|
749
|
+
message: "Parameter Validation warrnings for cancelSubscriptionPlan",
|
|
750
|
+
});
|
|
751
|
+
Logger({ level: "WARN", message: warrning });
|
|
524
752
|
}
|
|
525
753
|
|
|
526
754
|
const query_params = {};
|
|
527
755
|
|
|
528
756
|
const xHeaders = {};
|
|
529
757
|
|
|
530
|
-
|
|
758
|
+
const response = await PlatformAPIClient.execute(
|
|
531
759
|
this.config,
|
|
532
760
|
"post",
|
|
533
761
|
`/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/cancel`,
|
|
@@ -535,6 +763,23 @@ class Billing {
|
|
|
535
763
|
body,
|
|
536
764
|
xHeaders
|
|
537
765
|
);
|
|
766
|
+
|
|
767
|
+
const {
|
|
768
|
+
error: res_error,
|
|
769
|
+
} = BillingModel.CancelSubscriptionRes().validate(response, {
|
|
770
|
+
abortEarly: false,
|
|
771
|
+
allowUnknown: false,
|
|
772
|
+
});
|
|
773
|
+
|
|
774
|
+
if (res_error) {
|
|
775
|
+
Logger({
|
|
776
|
+
level: "WARN",
|
|
777
|
+
message: "Response Validation Warnnings for cancelSubscriptionPlan",
|
|
778
|
+
});
|
|
779
|
+
Logger({ level: "WARN", message: res_error });
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
return response;
|
|
538
783
|
}
|
|
539
784
|
}
|
|
540
785
|
|