@gofynd/fdk-client-javascript 1.1.3 → 1.1.5

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.
Files changed (51) hide show
  1. package/README.md +1 -0
  2. package/index.d.ts +4 -1
  3. package/index.js +7 -0
  4. package/package.json +1 -1
  5. package/partner.d.ts +4 -0
  6. package/partner.js +7 -0
  7. package/sdk/application/Common/CommonApplicationModel.js +4 -0
  8. package/sdk/application/Configuration/ConfigurationApplicationModel.js +5 -5
  9. package/sdk/application/Lead/LeadApplicationModel.js +4 -1
  10. package/sdk/partner/OAuthClient.d.ts +14 -0
  11. package/sdk/partner/OAuthClient.js +112 -0
  12. package/sdk/partner/PartnerAPIClient.d.ts +12 -0
  13. package/sdk/partner/PartnerAPIClient.js +42 -0
  14. package/sdk/partner/PartnerClient.d.ts +6 -0
  15. package/sdk/partner/PartnerClient.js +17 -0
  16. package/sdk/partner/PartnerConfig.d.ts +30 -0
  17. package/sdk/partner/PartnerConfig.js +39 -0
  18. package/sdk/partner/index.d.ts +3 -0
  19. package/sdk/partner/index.js +5 -0
  20. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +32 -0
  21. package/sdk/platform/Cart/CartPlatformApplicationClient.js +184 -0
  22. package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +3 -0
  23. package/sdk/platform/Cart/CartPlatformApplicationValidator.js +19 -0
  24. package/sdk/platform/Cart/CartPlatformModel.d.ts +6 -0
  25. package/sdk/platform/Cart/CartPlatformModel.js +72 -1
  26. package/sdk/platform/Catalog/CatalogPlatformModel.js +2 -2
  27. package/sdk/platform/Common/CommonPlatformModel.js +4 -0
  28. package/sdk/platform/Configuration/ConfigurationPlatformModel.js +8 -7
  29. package/sdk/platform/Order/OrderPlatformClient.d.ts +3 -1
  30. package/sdk/platform/Order/OrderPlatformClient.js +5 -0
  31. package/sdk/platform/Order/OrderPlatformModel.js +1 -1
  32. package/sdk/platform/Order/OrderPlatformValidator.js +1 -0
  33. package/sdk/platform/Payment/PaymentPlatformModel.d.ts +4 -0
  34. package/sdk/platform/Payment/PaymentPlatformModel.js +42 -7
  35. package/sdk/platform/PlatformApplicationClient.d.ts +103 -2
  36. package/sdk/platform/PlatformApplicationClient.js +109 -0
  37. package/sdk/platform/PlatformClient.d.ts +642 -36
  38. package/sdk/platform/PlatformClient.js +773 -18
  39. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.d.ts +134 -0
  40. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +852 -0
  41. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.d.ts +16 -0
  42. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.js +81 -0
  43. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +223 -0
  44. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +1296 -0
  45. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +97 -0
  46. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +776 -0
  47. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.d.ts +21 -0
  48. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.js +130 -0
  49. package/sdk/platform/index.d.ts +1 -0
  50. package/sdk/platform/index.js +2 -0
  51. package/sdk/public/Configuration/ConfigurationPublicModel.js +5 -0
@@ -0,0 +1,852 @@
1
+ const PlatformAPIClient = require("../PlatformAPIClient");
2
+ const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
+ const ServiceabilityValidator = require("./ServiceabilityPlatformApplicationValidator");
5
+ const ServiceabilityModel = require("./ServiceabilityPlatformModel");
6
+ const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
8
+
9
+ class Serviceability {
10
+ constructor(config, applicationId) {
11
+ this.config = config;
12
+ this.applicationId = applicationId;
13
+ }
14
+
15
+ /**
16
+ * @param {Object} arg - Arg object.
17
+ * @param {ApplicationCompanyDpViewRequest} arg.body
18
+ * @returns {Promise<ApplicationCompanyDpViewResponse>} - Success response
19
+ * @summary: Add application dp data
20
+ * @description: This API add application dp data.
21
+ */
22
+ async addAppDp({ body } = {}) {
23
+ const { error } = ServiceabilityValidator.addAppDp().validate(
24
+ {
25
+ body,
26
+ },
27
+ { abortEarly: false, allowUnknown: true }
28
+ );
29
+ if (error) {
30
+ return Promise.reject(new FDKClientValidationError(error));
31
+ }
32
+
33
+ // Showing warrnings if extra unknown parameters are found
34
+ const { error: warrning } = ServiceabilityValidator.addAppDp().validate(
35
+ {
36
+ body,
37
+ },
38
+ { abortEarly: false, allowUnknown: false }
39
+ );
40
+ if (warrning) {
41
+ Logger({
42
+ level: "WARN",
43
+ message: "Parameter Validation warrnings for addAppDp",
44
+ });
45
+ Logger({ level: "WARN", message: warrning });
46
+ }
47
+
48
+ const query_params = {};
49
+
50
+ const response = await PlatformAPIClient.execute(
51
+ this.config,
52
+ "post",
53
+ `/service/platform/logistics/v1.0/company/${this.config.companyId}/application/${this.applicationId}`,
54
+ query_params,
55
+ body
56
+ );
57
+
58
+ const {
59
+ error: res_error,
60
+ } = ServiceabilityModel.ApplicationCompanyDpViewResponse().validate(
61
+ response,
62
+ { abortEarly: false, allowUnknown: false }
63
+ );
64
+
65
+ if (res_error) {
66
+ Logger({
67
+ level: "WARN",
68
+ message: "Response Validation Warnnings for addAppDp",
69
+ });
70
+ Logger({ level: "WARN", message: res_error });
71
+ }
72
+
73
+ return response;
74
+ }
75
+
76
+ /**
77
+ * @param {Object} arg - Arg object.
78
+ * @param {number} arg.courierPartnerId - A `courier_partner_id` is a unique
79
+ * identifier of a particular delivery partner.
80
+ * @returns {Promise<ApplicationCompanyDpViewResponse>} - Success response
81
+ * @summary: Delete application dp data
82
+ * @description: This API remove application dp data.
83
+ */
84
+ async deleteAppDp({ courierPartnerId } = {}) {
85
+ const { error } = ServiceabilityValidator.deleteAppDp().validate(
86
+ {
87
+ courierPartnerId,
88
+ },
89
+ { abortEarly: false, allowUnknown: true }
90
+ );
91
+ if (error) {
92
+ return Promise.reject(new FDKClientValidationError(error));
93
+ }
94
+
95
+ // Showing warrnings if extra unknown parameters are found
96
+ const { error: warrning } = ServiceabilityValidator.deleteAppDp().validate(
97
+ {
98
+ courierPartnerId,
99
+ },
100
+ { abortEarly: false, allowUnknown: false }
101
+ );
102
+ if (warrning) {
103
+ Logger({
104
+ level: "WARN",
105
+ message: "Parameter Validation warrnings for deleteAppDp",
106
+ });
107
+ Logger({ level: "WARN", message: warrning });
108
+ }
109
+
110
+ const query_params = {};
111
+
112
+ const response = await PlatformAPIClient.execute(
113
+ this.config,
114
+ "delete",
115
+ `/service/platform/logistics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/courier-partner/${courierPartnerId}`,
116
+ query_params,
117
+ undefined
118
+ );
119
+
120
+ const {
121
+ error: res_error,
122
+ } = ServiceabilityModel.ApplicationCompanyDpViewResponse().validate(
123
+ response,
124
+ { abortEarly: false, allowUnknown: false }
125
+ );
126
+
127
+ if (res_error) {
128
+ Logger({
129
+ level: "WARN",
130
+ message: "Response Validation Warnnings for deleteAppDp",
131
+ });
132
+ Logger({ level: "WARN", message: res_error });
133
+ }
134
+
135
+ return response;
136
+ }
137
+
138
+ /**
139
+ * @param {Object} arg - Arg object.
140
+ * @returns {Promise<ApplicationServiceabilityConfigResponse>} - Success response
141
+ * @summary: Zone configuration of application.
142
+ * @description: This API returns serviceability config of the application.
143
+ */
144
+ async getApplicationServiceability({} = {}) {
145
+ const {
146
+ error,
147
+ } = ServiceabilityValidator.getApplicationServiceability().validate(
148
+ {},
149
+ { abortEarly: false, allowUnknown: true }
150
+ );
151
+ if (error) {
152
+ return Promise.reject(new FDKClientValidationError(error));
153
+ }
154
+
155
+ // Showing warrnings if extra unknown parameters are found
156
+ const {
157
+ error: warrning,
158
+ } = ServiceabilityValidator.getApplicationServiceability().validate(
159
+ {},
160
+ { abortEarly: false, allowUnknown: false }
161
+ );
162
+ if (warrning) {
163
+ Logger({
164
+ level: "WARN",
165
+ message:
166
+ "Parameter Validation warrnings for getApplicationServiceability",
167
+ });
168
+ Logger({ level: "WARN", message: warrning });
169
+ }
170
+
171
+ const query_params = {};
172
+
173
+ const response = await PlatformAPIClient.execute(
174
+ this.config,
175
+ "get",
176
+ `/service/platform/logistics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/serviceability`,
177
+ query_params,
178
+ undefined
179
+ );
180
+
181
+ const {
182
+ error: res_error,
183
+ } = ServiceabilityModel.ApplicationServiceabilityConfigResponse().validate(
184
+ response,
185
+ { abortEarly: false, allowUnknown: false }
186
+ );
187
+
188
+ if (res_error) {
189
+ Logger({
190
+ level: "WARN",
191
+ message:
192
+ "Response Validation Warnnings for getApplicationServiceability",
193
+ });
194
+ Logger({ level: "WARN", message: res_error });
195
+ }
196
+
197
+ return response;
198
+ }
199
+
200
+ /**
201
+ * @param {Object} arg - Arg object.
202
+ * @returns {Promise<ApplicationSelfShipConfigResponse>} - Success response
203
+ * @summary: Self-ship configuration of application.
204
+ * @description: This API returns Self-ship configuration of the application.
205
+ */
206
+ async getApplicationServiceabilitySelfShipment({} = {}) {
207
+ const {
208
+ error,
209
+ } = ServiceabilityValidator.getApplicationServiceabilitySelfShipment().validate(
210
+ {},
211
+ { abortEarly: false, allowUnknown: true }
212
+ );
213
+ if (error) {
214
+ return Promise.reject(new FDKClientValidationError(error));
215
+ }
216
+
217
+ // Showing warrnings if extra unknown parameters are found
218
+ const {
219
+ error: warrning,
220
+ } = ServiceabilityValidator.getApplicationServiceabilitySelfShipment().validate(
221
+ {},
222
+ { abortEarly: false, allowUnknown: false }
223
+ );
224
+ if (warrning) {
225
+ Logger({
226
+ level: "WARN",
227
+ message:
228
+ "Parameter Validation warrnings for getApplicationServiceabilitySelfShipment",
229
+ });
230
+ Logger({ level: "WARN", message: warrning });
231
+ }
232
+
233
+ const query_params = {};
234
+
235
+ const response = await PlatformAPIClient.execute(
236
+ this.config,
237
+ "get",
238
+ `/service/platform/logistics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/selfship`,
239
+ query_params,
240
+ undefined
241
+ );
242
+
243
+ const {
244
+ error: res_error,
245
+ } = ServiceabilityModel.ApplicationSelfShipConfigResponse().validate(
246
+ response,
247
+ { abortEarly: false, allowUnknown: false }
248
+ );
249
+
250
+ if (res_error) {
251
+ Logger({
252
+ level: "WARN",
253
+ message:
254
+ "Response Validation Warnnings for getApplicationServiceabilitySelfShipment",
255
+ });
256
+ Logger({ level: "WARN", message: res_error });
257
+ }
258
+
259
+ return response;
260
+ }
261
+
262
+ /**
263
+ * @param {Object} arg - Arg object.
264
+ * @returns {Promise<DPApplicationRuleResponse>} - Success response
265
+ * @summary: Get All DpApplicationRules rules added at application level from database.
266
+ * @description: This API returns response of all rules of DpApplicationRules from mongo database.
267
+ */
268
+ async getDpApplicationRules({} = {}) {
269
+ const { error } = ServiceabilityValidator.getDpApplicationRules().validate(
270
+ {},
271
+ { abortEarly: false, allowUnknown: true }
272
+ );
273
+ if (error) {
274
+ return Promise.reject(new FDKClientValidationError(error));
275
+ }
276
+
277
+ // Showing warrnings if extra unknown parameters are found
278
+ const {
279
+ error: warrning,
280
+ } = ServiceabilityValidator.getDpApplicationRules().validate(
281
+ {},
282
+ { abortEarly: false, allowUnknown: false }
283
+ );
284
+ if (warrning) {
285
+ Logger({
286
+ level: "WARN",
287
+ message: "Parameter Validation warrnings for getDpApplicationRules",
288
+ });
289
+ Logger({ level: "WARN", message: warrning });
290
+ }
291
+
292
+ const query_params = {};
293
+
294
+ const response = await PlatformAPIClient.execute(
295
+ this.config,
296
+ "get",
297
+ `/service/platform/logistics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/courier/priority`,
298
+ query_params,
299
+ undefined
300
+ );
301
+
302
+ const {
303
+ error: res_error,
304
+ } = ServiceabilityModel.DPApplicationRuleResponse().validate(response, {
305
+ abortEarly: false,
306
+ allowUnknown: false,
307
+ });
308
+
309
+ if (res_error) {
310
+ Logger({
311
+ level: "WARN",
312
+ message: "Response Validation Warnnings for getDpApplicationRules",
313
+ });
314
+ Logger({ level: "WARN", message: res_error });
315
+ }
316
+
317
+ return response;
318
+ }
319
+
320
+ /**
321
+ * @param {Object} arg - Arg object.
322
+ * @param {GetZoneFromPincodeViewRequest} arg.body
323
+ * @returns {Promise<GetZoneFromPincodeViewResponse>} - Success response
324
+ * @summary: GET zone from the Pincode.
325
+ * @description: This API returns zone from the Pincode View.
326
+ */
327
+ async getZoneFromPincodeView({ body } = {}) {
328
+ const { error } = ServiceabilityValidator.getZoneFromPincodeView().validate(
329
+ {
330
+ body,
331
+ },
332
+ { abortEarly: false, allowUnknown: true }
333
+ );
334
+ if (error) {
335
+ return Promise.reject(new FDKClientValidationError(error));
336
+ }
337
+
338
+ // Showing warrnings if extra unknown parameters are found
339
+ const {
340
+ error: warrning,
341
+ } = ServiceabilityValidator.getZoneFromPincodeView().validate(
342
+ {
343
+ body,
344
+ },
345
+ { abortEarly: false, allowUnknown: false }
346
+ );
347
+ if (warrning) {
348
+ Logger({
349
+ level: "WARN",
350
+ message: "Parameter Validation warrnings for getZoneFromPincodeView",
351
+ });
352
+ Logger({ level: "WARN", message: warrning });
353
+ }
354
+
355
+ const query_params = {};
356
+
357
+ const response = await PlatformAPIClient.execute(
358
+ this.config,
359
+ "post",
360
+ `/service/platform/logistics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/zones`,
361
+ query_params,
362
+ body
363
+ );
364
+
365
+ const {
366
+ error: res_error,
367
+ } = ServiceabilityModel.GetZoneFromPincodeViewResponse().validate(
368
+ response,
369
+ { abortEarly: false, allowUnknown: false }
370
+ );
371
+
372
+ if (res_error) {
373
+ Logger({
374
+ level: "WARN",
375
+ message: "Response Validation Warnnings for getZoneFromPincodeView",
376
+ });
377
+ Logger({ level: "WARN", message: res_error });
378
+ }
379
+
380
+ return response;
381
+ }
382
+
383
+ /**
384
+ * @param {Object} arg - Arg object.
385
+ * @param {number} [arg.pageNo] - Index of the item to start returning with
386
+ * @param {number} [arg.pageSize] - Determines the items to be displayed in a page
387
+ * @param {string[]} [arg.zoneId] - List of zones to query for
388
+ * @param {string} [arg.q] - Search with name as a free text
389
+ * @returns {Promise<GetZoneFromApplicationIdViewResponse>} - Success response
390
+ * @summary: GET zones from the application_id.
391
+ * @description: This API returns zones from the application_id View.
392
+ */
393
+ async getZonesFromApplicationIdView({ pageNo, pageSize, zoneId, q } = {}) {
394
+ const {
395
+ error,
396
+ } = ServiceabilityValidator.getZonesFromApplicationIdView().validate(
397
+ {
398
+ pageNo,
399
+ pageSize,
400
+ zoneId,
401
+ q,
402
+ },
403
+ { abortEarly: false, allowUnknown: true }
404
+ );
405
+ if (error) {
406
+ return Promise.reject(new FDKClientValidationError(error));
407
+ }
408
+
409
+ // Showing warrnings if extra unknown parameters are found
410
+ const {
411
+ error: warrning,
412
+ } = ServiceabilityValidator.getZonesFromApplicationIdView().validate(
413
+ {
414
+ pageNo,
415
+ pageSize,
416
+ zoneId,
417
+ q,
418
+ },
419
+ { abortEarly: false, allowUnknown: false }
420
+ );
421
+ if (warrning) {
422
+ Logger({
423
+ level: "WARN",
424
+ message:
425
+ "Parameter Validation warrnings for getZonesFromApplicationIdView",
426
+ });
427
+ Logger({ level: "WARN", message: warrning });
428
+ }
429
+
430
+ const query_params = {};
431
+ query_params["page_no"] = pageNo;
432
+ query_params["page_size"] = pageSize;
433
+ query_params["zone_id"] = zoneId;
434
+ query_params["q"] = q;
435
+
436
+ const response = await PlatformAPIClient.execute(
437
+ this.config,
438
+ "get",
439
+ `/service/platform/logistics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/zones`,
440
+ query_params,
441
+ undefined
442
+ );
443
+
444
+ const {
445
+ error: res_error,
446
+ } = ServiceabilityModel.GetZoneFromApplicationIdViewResponse().validate(
447
+ response,
448
+ { abortEarly: false, allowUnknown: false }
449
+ );
450
+
451
+ if (res_error) {
452
+ Logger({
453
+ level: "WARN",
454
+ message:
455
+ "Response Validation Warnnings for getZonesFromApplicationIdView",
456
+ });
457
+ Logger({ level: "WARN", message: res_error });
458
+ }
459
+
460
+ return response;
461
+ }
462
+
463
+ /**
464
+ * @param {Object} arg - Arg object.
465
+ * @param {SelfShipResponse} arg.body
466
+ * @returns {Promise<ApplicationSelfShipConfigResponse>} - Success response
467
+ * @summary: Self-ship configuration of application.
468
+ * @description: This API updates Self-ship configuration of the application.
469
+ */
470
+ async patchApplicationServiceabilitySelfShipment({ body } = {}) {
471
+ const {
472
+ error,
473
+ } = ServiceabilityValidator.patchApplicationServiceabilitySelfShipment().validate(
474
+ {
475
+ body,
476
+ },
477
+ { abortEarly: false, allowUnknown: true }
478
+ );
479
+ if (error) {
480
+ return Promise.reject(new FDKClientValidationError(error));
481
+ }
482
+
483
+ // Showing warrnings if extra unknown parameters are found
484
+ const {
485
+ error: warrning,
486
+ } = ServiceabilityValidator.patchApplicationServiceabilitySelfShipment().validate(
487
+ {
488
+ body,
489
+ },
490
+ { abortEarly: false, allowUnknown: false }
491
+ );
492
+ if (warrning) {
493
+ Logger({
494
+ level: "WARN",
495
+ message:
496
+ "Parameter Validation warrnings for patchApplicationServiceabilitySelfShipment",
497
+ });
498
+ Logger({ level: "WARN", message: warrning });
499
+ }
500
+
501
+ const query_params = {};
502
+
503
+ const response = await PlatformAPIClient.execute(
504
+ this.config,
505
+ "patch",
506
+ `/service/platform/logistics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/selfship`,
507
+ query_params,
508
+ body
509
+ );
510
+
511
+ const {
512
+ error: res_error,
513
+ } = ServiceabilityModel.ApplicationSelfShipConfigResponse().validate(
514
+ response,
515
+ { abortEarly: false, allowUnknown: false }
516
+ );
517
+
518
+ if (res_error) {
519
+ Logger({
520
+ level: "WARN",
521
+ message:
522
+ "Response Validation Warnnings for patchApplicationServiceabilitySelfShipment",
523
+ });
524
+ Logger({ level: "WARN", message: res_error });
525
+ }
526
+
527
+ return response;
528
+ }
529
+
530
+ /**
531
+ * @param {Object} arg - Arg object.
532
+ * @param {PincodeMopUpdateAuditHistoryRequest} arg.body
533
+ * @returns {Promise<PincodeMopUpdateAuditHistoryResponseData>} - Success response
534
+ * @summary: Auditlog configuration of application.
535
+ * @description: This API returns Audit logs of Pincode.
536
+ */
537
+ async updatePincodeAuditHistory({ body } = {}) {
538
+ const {
539
+ error,
540
+ } = ServiceabilityValidator.updatePincodeAuditHistory().validate(
541
+ {
542
+ body,
543
+ },
544
+ { abortEarly: false, allowUnknown: true }
545
+ );
546
+ if (error) {
547
+ return Promise.reject(new FDKClientValidationError(error));
548
+ }
549
+
550
+ // Showing warrnings if extra unknown parameters are found
551
+ const {
552
+ error: warrning,
553
+ } = ServiceabilityValidator.updatePincodeAuditHistory().validate(
554
+ {
555
+ body,
556
+ },
557
+ { abortEarly: false, allowUnknown: false }
558
+ );
559
+ if (warrning) {
560
+ Logger({
561
+ level: "WARN",
562
+ message: "Parameter Validation warrnings for updatePincodeAuditHistory",
563
+ });
564
+ Logger({ level: "WARN", message: warrning });
565
+ }
566
+
567
+ const query_params = {};
568
+
569
+ const response = await PlatformAPIClient.execute(
570
+ this.config,
571
+ "post",
572
+ `/service/platform/logistics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/history`,
573
+ query_params,
574
+ body
575
+ );
576
+
577
+ const {
578
+ error: res_error,
579
+ } = ServiceabilityModel.PincodeMopUpdateAuditHistoryResponseData().validate(
580
+ response,
581
+ { abortEarly: false, allowUnknown: false }
582
+ );
583
+
584
+ if (res_error) {
585
+ Logger({
586
+ level: "WARN",
587
+ message: "Response Validation Warnnings for updatePincodeAuditHistory",
588
+ });
589
+ Logger({ level: "WARN", message: res_error });
590
+ }
591
+
592
+ return response;
593
+ }
594
+
595
+ /**
596
+ * @param {Object} arg - Arg object.
597
+ * @param {PincodeMopBulkData} arg.body
598
+ * @returns {Promise<PincodeBulkViewResponse>} - Success response
599
+ * @summary: Bulk Update of pincode in the application.
600
+ * @description: This API constructs bulk write operations to update the MOP data for each pincode in the payload.
601
+ */
602
+ async updatePincodeBulkView({ body } = {}) {
603
+ const { error } = ServiceabilityValidator.updatePincodeBulkView().validate(
604
+ {
605
+ body,
606
+ },
607
+ { abortEarly: false, allowUnknown: true }
608
+ );
609
+ if (error) {
610
+ return Promise.reject(new FDKClientValidationError(error));
611
+ }
612
+
613
+ // Showing warrnings if extra unknown parameters are found
614
+ const {
615
+ error: warrning,
616
+ } = ServiceabilityValidator.updatePincodeBulkView().validate(
617
+ {
618
+ body,
619
+ },
620
+ { abortEarly: false, allowUnknown: false }
621
+ );
622
+ if (warrning) {
623
+ Logger({
624
+ level: "WARN",
625
+ message: "Parameter Validation warrnings for updatePincodeBulkView",
626
+ });
627
+ Logger({ level: "WARN", message: warrning });
628
+ }
629
+
630
+ const query_params = {};
631
+
632
+ const response = await PlatformAPIClient.execute(
633
+ this.config,
634
+ "post",
635
+ `/service/platform/logistics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pincode-mop-bulk-update`,
636
+ query_params,
637
+ body
638
+ );
639
+
640
+ const {
641
+ error: res_error,
642
+ } = ServiceabilityModel.PincodeBulkViewResponse().validate(response, {
643
+ abortEarly: false,
644
+ allowUnknown: false,
645
+ });
646
+
647
+ if (res_error) {
648
+ Logger({
649
+ level: "WARN",
650
+ message: "Response Validation Warnnings for updatePincodeBulkView",
651
+ });
652
+ Logger({ level: "WARN", message: res_error });
653
+ }
654
+
655
+ return response;
656
+ }
657
+
658
+ /**
659
+ * @param {Object} arg - Arg object.
660
+ * @param {PincodeCodStatusListingRequest} arg.body
661
+ * @returns {Promise<PincodeCodStatusListingResponse>} - Success response
662
+ * @summary: Pincode count view of application.
663
+ * @description: This API returns count of active pincode.
664
+ */
665
+ async updatePincodeCoDListing({ body } = {}) {
666
+ const {
667
+ error,
668
+ } = ServiceabilityValidator.updatePincodeCoDListing().validate(
669
+ {
670
+ body,
671
+ },
672
+ { abortEarly: false, allowUnknown: true }
673
+ );
674
+ if (error) {
675
+ return Promise.reject(new FDKClientValidationError(error));
676
+ }
677
+
678
+ // Showing warrnings if extra unknown parameters are found
679
+ const {
680
+ error: warrning,
681
+ } = ServiceabilityValidator.updatePincodeCoDListing().validate(
682
+ {
683
+ body,
684
+ },
685
+ { abortEarly: false, allowUnknown: false }
686
+ );
687
+ if (warrning) {
688
+ Logger({
689
+ level: "WARN",
690
+ message: "Parameter Validation warrnings for updatePincodeCoDListing",
691
+ });
692
+ Logger({ level: "WARN", message: warrning });
693
+ }
694
+
695
+ const query_params = {};
696
+
697
+ const response = await PlatformAPIClient.execute(
698
+ this.config,
699
+ "post",
700
+ `/service/platform/logistics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pincode-mop-data`,
701
+ query_params,
702
+ body
703
+ );
704
+
705
+ const {
706
+ error: res_error,
707
+ } = ServiceabilityModel.PincodeCodStatusListingResponse().validate(
708
+ response,
709
+ { abortEarly: false, allowUnknown: false }
710
+ );
711
+
712
+ if (res_error) {
713
+ Logger({
714
+ level: "WARN",
715
+ message: "Response Validation Warnnings for updatePincodeCoDListing",
716
+ });
717
+ Logger({ level: "WARN", message: res_error });
718
+ }
719
+
720
+ return response;
721
+ }
722
+
723
+ /**
724
+ * @param {Object} arg - Arg object.
725
+ * @param {PincodeMopData} arg.body
726
+ * @returns {Promise<PincodeMOPresponse>} - Success response
727
+ * @summary: PincodeView update of MOP.
728
+ * @description: This API updates Pincode method of payment.
729
+ */
730
+ async updatePincodeMopView({ body } = {}) {
731
+ const { error } = ServiceabilityValidator.updatePincodeMopView().validate(
732
+ {
733
+ body,
734
+ },
735
+ { abortEarly: false, allowUnknown: true }
736
+ );
737
+ if (error) {
738
+ return Promise.reject(new FDKClientValidationError(error));
739
+ }
740
+
741
+ // Showing warrnings if extra unknown parameters are found
742
+ const {
743
+ error: warrning,
744
+ } = ServiceabilityValidator.updatePincodeMopView().validate(
745
+ {
746
+ body,
747
+ },
748
+ { abortEarly: false, allowUnknown: false }
749
+ );
750
+ if (warrning) {
751
+ Logger({
752
+ level: "WARN",
753
+ message: "Parameter Validation warrnings for updatePincodeMopView",
754
+ });
755
+ Logger({ level: "WARN", message: warrning });
756
+ }
757
+
758
+ const query_params = {};
759
+
760
+ const response = await PlatformAPIClient.execute(
761
+ this.config,
762
+ "post",
763
+ `/service/platform/logistics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pincode-mop-update`,
764
+ query_params,
765
+ body
766
+ );
767
+
768
+ const {
769
+ error: res_error,
770
+ } = ServiceabilityModel.PincodeMOPresponse().validate(response, {
771
+ abortEarly: false,
772
+ allowUnknown: false,
773
+ });
774
+
775
+ if (res_error) {
776
+ Logger({
777
+ level: "WARN",
778
+ message: "Response Validation Warnnings for updatePincodeMopView",
779
+ });
780
+ Logger({ level: "WARN", message: res_error });
781
+ }
782
+
783
+ return response;
784
+ }
785
+
786
+ /**
787
+ * @param {Object} arg - Arg object.
788
+ * @param {DPApplicationRuleRequest} arg.body
789
+ * @returns {Promise<DPApplicationRuleResponse>} - Success response
790
+ * @summary: Upsert of DpApplicationRules in database.
791
+ * @description: This API returns response of upsert of DpApplicationRules in mongo database.
792
+ */
793
+ async upsertDpApplicationRules({ body } = {}) {
794
+ const {
795
+ error,
796
+ } = ServiceabilityValidator.upsertDpApplicationRules().validate(
797
+ {
798
+ body,
799
+ },
800
+ { abortEarly: false, allowUnknown: true }
801
+ );
802
+ if (error) {
803
+ return Promise.reject(new FDKClientValidationError(error));
804
+ }
805
+
806
+ // Showing warrnings if extra unknown parameters are found
807
+ const {
808
+ error: warrning,
809
+ } = ServiceabilityValidator.upsertDpApplicationRules().validate(
810
+ {
811
+ body,
812
+ },
813
+ { abortEarly: false, allowUnknown: false }
814
+ );
815
+ if (warrning) {
816
+ Logger({
817
+ level: "WARN",
818
+ message: "Parameter Validation warrnings for upsertDpApplicationRules",
819
+ });
820
+ Logger({ level: "WARN", message: warrning });
821
+ }
822
+
823
+ const query_params = {};
824
+
825
+ const response = await PlatformAPIClient.execute(
826
+ this.config,
827
+ "put",
828
+ `/service/platform/logistics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/courier/priority`,
829
+ query_params,
830
+ body
831
+ );
832
+
833
+ const {
834
+ error: res_error,
835
+ } = ServiceabilityModel.DPApplicationRuleResponse().validate(response, {
836
+ abortEarly: false,
837
+ allowUnknown: false,
838
+ });
839
+
840
+ if (res_error) {
841
+ Logger({
842
+ level: "WARN",
843
+ message: "Response Validation Warnnings for upsertDpApplicationRules",
844
+ });
845
+ Logger({ level: "WARN", message: res_error });
846
+ }
847
+
848
+ return response;
849
+ }
850
+ }
851
+
852
+ module.exports = Serviceability;