@gofynd/fdk-client-javascript 1.1.2 → 1.1.3

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 (117) hide show
  1. package/README.md +1 -2
  2. package/index.d.ts +4 -7
  3. package/index.js +5 -12
  4. package/package.json +1 -1
  5. package/sdk/application/ApplicationClient.d.ts +20 -20
  6. package/sdk/application/ApplicationClient.js +26 -26
  7. package/sdk/application/Cart/CartApplicationClient.d.ts +36 -6
  8. package/sdk/application/Cart/CartApplicationClient.js +105 -10
  9. package/sdk/application/Cart/CartApplicationModel.d.ts +9 -0
  10. package/sdk/application/Cart/CartApplicationModel.js +105 -1
  11. package/sdk/application/Cart/CartApplicationValidator.d.ts +1 -0
  12. package/sdk/application/Cart/CartApplicationValidator.js +15 -1
  13. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +1 -0
  14. package/sdk/application/Catalog/CatalogApplicationModel.js +13 -0
  15. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +14 -10
  16. package/sdk/application/Configuration/ConfigurationApplicationClient.js +16 -10
  17. package/sdk/application/Configuration/ConfigurationApplicationModel.js +1 -0
  18. package/sdk/application/Configuration/ConfigurationApplicationValidator.js +1 -0
  19. package/sdk/application/Content/ContentApplicationModel.js +3 -1
  20. package/sdk/application/Logistic/LogisticApplicationModel.js +3 -2
  21. package/sdk/application/Order/OrderApplicationClient.d.ts +2 -2
  22. package/sdk/application/Order/OrderApplicationClient.js +2 -2
  23. package/sdk/application/Order/OrderApplicationModel.js +18 -8
  24. package/sdk/application/Payment/PaymentApplicationClient.d.ts +35 -0
  25. package/sdk/application/Payment/PaymentApplicationClient.js +200 -0
  26. package/sdk/application/Payment/PaymentApplicationModel.d.ts +4 -0
  27. package/sdk/application/Payment/PaymentApplicationModel.js +58 -7
  28. package/sdk/application/Payment/PaymentApplicationValidator.d.ts +3 -0
  29. package/sdk/application/Payment/PaymentApplicationValidator.js +19 -0
  30. package/sdk/application/PosCart/PosCartApplicationClient.d.ts +16 -3
  31. package/sdk/application/PosCart/PosCartApplicationClient.js +39 -6
  32. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +6 -0
  33. package/sdk/application/PosCart/PosCartApplicationModel.js +63 -1
  34. package/sdk/application/PosCart/PosCartApplicationValidator.js +6 -0
  35. package/sdk/application/index.d.ts +10 -10
  36. package/sdk/application/index.js +13 -13
  37. package/sdk/common/Constant.d.ts +5 -0
  38. package/sdk/common/Constant.js +5 -0
  39. package/sdk/platform/Billing/BillingPlatformModel.js +6 -1
  40. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +459 -2
  41. package/sdk/platform/Cart/CartPlatformApplicationClient.js +2480 -340
  42. package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +29 -0
  43. package/sdk/platform/Cart/CartPlatformApplicationValidator.js +250 -0
  44. package/sdk/platform/Cart/CartPlatformModel.d.ts +52 -0
  45. package/sdk/platform/Cart/CartPlatformModel.js +580 -2
  46. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +8 -2
  47. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +10 -0
  48. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +1 -0
  49. package/sdk/platform/Catalog/CatalogPlatformClient.js +2 -2
  50. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +1 -0
  51. package/sdk/platform/Catalog/CatalogPlatformModel.js +41 -29
  52. package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +1 -0
  53. package/sdk/platform/Communication/CommunicationPlatformModel.js +9 -0
  54. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +2 -2
  55. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +2 -2
  56. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +5 -4
  57. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +99 -78
  58. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +99 -78
  59. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +87 -71
  60. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +87 -71
  61. package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +2 -0
  62. package/sdk/platform/Configuration/ConfigurationPlatformModel.js +26 -0
  63. package/sdk/platform/Content/ContentPlatformModel.js +3 -1
  64. package/sdk/platform/Finance/FinancePlatformClient.d.ts +135 -0
  65. package/sdk/platform/Finance/FinancePlatformClient.js +853 -0
  66. package/sdk/platform/Finance/FinancePlatformModel.d.ts +51 -0
  67. package/sdk/platform/Finance/FinancePlatformModel.js +342 -0
  68. package/sdk/platform/Finance/FinancePlatformValidator.d.ts +16 -0
  69. package/sdk/platform/Finance/FinancePlatformValidator.js +84 -0
  70. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +11 -1
  71. package/sdk/platform/Order/OrderPlatformApplicationClient.js +66 -2
  72. package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -0
  73. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +6 -0
  74. package/sdk/platform/Order/OrderPlatformClient.d.ts +159 -79
  75. package/sdk/platform/Order/OrderPlatformClient.js +541 -114
  76. package/sdk/platform/Order/OrderPlatformModel.d.ts +42 -6
  77. package/sdk/platform/Order/OrderPlatformModel.js +569 -159
  78. package/sdk/platform/Order/OrderPlatformValidator.d.ts +6 -0
  79. package/sdk/platform/Order/OrderPlatformValidator.js +51 -9
  80. package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +22 -0
  81. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +127 -0
  82. package/sdk/platform/Partner/PartnerPlatformApplicationValidator.d.ts +2 -0
  83. package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +13 -0
  84. package/sdk/platform/Partner/PartnerPlatformClient.d.ts +145 -0
  85. package/sdk/platform/Partner/PartnerPlatformClient.js +799 -0
  86. package/sdk/platform/Partner/PartnerPlatformModel.d.ts +39 -0
  87. package/sdk/platform/Partner/PartnerPlatformModel.js +367 -0
  88. package/sdk/platform/Partner/PartnerPlatformValidator.d.ts +14 -0
  89. package/sdk/platform/Partner/PartnerPlatformValidator.js +87 -0
  90. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +221 -0
  91. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +1476 -190
  92. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +20 -0
  93. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +126 -0
  94. package/sdk/platform/Payment/PaymentPlatformModel.d.ts +44 -0
  95. package/sdk/platform/Payment/PaymentPlatformModel.js +410 -0
  96. package/sdk/platform/PlatformApplicationClient.d.ts +1149 -938
  97. package/sdk/platform/PlatformApplicationClient.js +1259 -1035
  98. package/sdk/platform/PlatformClient.d.ts +9888 -8286
  99. package/sdk/platform/PlatformClient.js +10960 -9038
  100. package/sdk/platform/index.d.ts +15 -14
  101. package/sdk/platform/index.js +20 -18
  102. package/sdk/public/PublicClient.d.ts +2 -2
  103. package/sdk/public/PublicClient.js +4 -4
  104. package/sdk/public/index.d.ts +1 -1
  105. package/sdk/public/index.js +2 -2
  106. package/partner.d.ts +0 -4
  107. package/partner.js +0 -7
  108. package/sdk/partner/OAuthClient.d.ts +0 -14
  109. package/sdk/partner/OAuthClient.js +0 -112
  110. package/sdk/partner/PartnerAPIClient.d.ts +0 -12
  111. package/sdk/partner/PartnerAPIClient.js +0 -42
  112. package/sdk/partner/PartnerClient.d.ts +0 -6
  113. package/sdk/partner/PartnerClient.js +0 -17
  114. package/sdk/partner/PartnerConfig.d.ts +0 -30
  115. package/sdk/partner/PartnerConfig.js +0 -39
  116. package/sdk/partner/index.d.ts +0 -3
  117. package/sdk/partner/index.js +0 -5
@@ -12,6 +12,70 @@ class Payment {
12
12
  this.applicationId = applicationId;
13
13
  }
14
14
 
15
+ /**
16
+ * @param {Object} arg - Arg object.
17
+ * @param {string} arg.terminalUniqueIdentifier - Terminal unique identifier
18
+ * @param {EdcUpdateRequest} arg.body
19
+ * @returns {Promise<EdcDeviceUpdateResponse>} - Success response
20
+ * @summary: Update store id and device tag of edc device
21
+ * @description: Use this API to Update store id and device tag of edc device
22
+ */
23
+ async addEdcDevice({ terminalUniqueIdentifier, body } = {}) {
24
+ const { error } = PaymentValidator.addEdcDevice().validate(
25
+ {
26
+ terminalUniqueIdentifier,
27
+ body,
28
+ },
29
+ { abortEarly: false, allowUnknown: true }
30
+ );
31
+ if (error) {
32
+ return Promise.reject(new FDKClientValidationError(error));
33
+ }
34
+
35
+ // Showing warrnings if extra unknown parameters are found
36
+ const { error: warrning } = PaymentValidator.addEdcDevice().validate(
37
+ {
38
+ terminalUniqueIdentifier,
39
+ body,
40
+ },
41
+ { abortEarly: false, allowUnknown: false }
42
+ );
43
+ if (warrning) {
44
+ Logger({
45
+ level: "WARN",
46
+ message: "Parameter Validation warrnings for addEdcDevice",
47
+ });
48
+ Logger({ level: "WARN", message: warrning });
49
+ }
50
+
51
+ const query_params = {};
52
+
53
+ const response = await PlatformAPIClient.execute(
54
+ this.config,
55
+ "put",
56
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/edc-device/${terminalUniqueIdentifier}`,
57
+ query_params,
58
+ body
59
+ );
60
+
61
+ const {
62
+ error: res_error,
63
+ } = PaymentModel.EdcDeviceUpdateResponse().validate(response, {
64
+ abortEarly: false,
65
+ allowUnknown: false,
66
+ });
67
+
68
+ if (res_error) {
69
+ Logger({
70
+ level: "WARN",
71
+ message: "Response Validation Warnnings for addEdcDevice",
72
+ });
73
+ Logger({ level: "WARN", message: res_error });
74
+ }
75
+
76
+ return response;
77
+ }
78
+
15
79
  /**
16
80
  * @param {Object} arg - Arg object.
17
81
  * @param {AddBeneficiaryDetailsOTPRequest} arg.body
@@ -77,6 +141,132 @@ class Payment {
77
141
  return response;
78
142
  }
79
143
 
144
+ /**
145
+ * @param {Object} arg - Arg object.
146
+ * @param {CancelOrResendPaymentLinkRequest} arg.body
147
+ * @returns {Promise<CancelPaymentLinkResponse>} - Success response
148
+ * @summary: Cancel payment link
149
+ * @description: Use this API to cancel a payment link for the customer
150
+ */
151
+ async cancelPaymentLink({ body } = {}) {
152
+ const { error } = PaymentValidator.cancelPaymentLink().validate(
153
+ {
154
+ body,
155
+ },
156
+ { abortEarly: false, allowUnknown: true }
157
+ );
158
+ if (error) {
159
+ return Promise.reject(new FDKClientValidationError(error));
160
+ }
161
+
162
+ // Showing warrnings if extra unknown parameters are found
163
+ const { error: warrning } = PaymentValidator.cancelPaymentLink().validate(
164
+ {
165
+ body,
166
+ },
167
+ { abortEarly: false, allowUnknown: false }
168
+ );
169
+ if (warrning) {
170
+ Logger({
171
+ level: "WARN",
172
+ message: "Parameter Validation warrnings for cancelPaymentLink",
173
+ });
174
+ Logger({ level: "WARN", message: warrning });
175
+ }
176
+
177
+ const query_params = {};
178
+
179
+ const response = await PlatformAPIClient.execute(
180
+ this.config,
181
+ "post",
182
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cancel-payment-link/`,
183
+ query_params,
184
+ body
185
+ );
186
+
187
+ const {
188
+ error: res_error,
189
+ } = PaymentModel.CancelPaymentLinkResponse().validate(response, {
190
+ abortEarly: false,
191
+ allowUnknown: false,
192
+ });
193
+
194
+ if (res_error) {
195
+ Logger({
196
+ level: "WARN",
197
+ message: "Response Validation Warnnings for cancelPaymentLink",
198
+ });
199
+ Logger({ level: "WARN", message: res_error });
200
+ }
201
+
202
+ return response;
203
+ }
204
+
205
+ /**
206
+ * @param {Object} arg - Arg object.
207
+ * @param {PaymentStatusUpdateRequest} arg.body
208
+ * @returns {Promise<PaymentStatusUpdateResponse>} - Success response
209
+ * @summary: Performs continuous polling to check status of payment on the server
210
+ * @description: Use this API to perform continuous polling at intervals to check the status of payment until timeout.
211
+ */
212
+ async checkAndUpdatePaymentStatus({ body } = {}) {
213
+ const { error } = PaymentValidator.checkAndUpdatePaymentStatus().validate(
214
+ {
215
+ body,
216
+ },
217
+ { abortEarly: false, allowUnknown: true }
218
+ );
219
+ if (error) {
220
+ return Promise.reject(new FDKClientValidationError(error));
221
+ }
222
+
223
+ // Showing warrnings if extra unknown parameters are found
224
+ const {
225
+ error: warrning,
226
+ } = PaymentValidator.checkAndUpdatePaymentStatus().validate(
227
+ {
228
+ body,
229
+ },
230
+ { abortEarly: false, allowUnknown: false }
231
+ );
232
+ if (warrning) {
233
+ Logger({
234
+ level: "WARN",
235
+ message:
236
+ "Parameter Validation warrnings for checkAndUpdatePaymentStatus",
237
+ });
238
+ Logger({ level: "WARN", message: warrning });
239
+ }
240
+
241
+ const query_params = {};
242
+
243
+ const response = await PlatformAPIClient.execute(
244
+ this.config,
245
+ "post",
246
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/confirm/polling`,
247
+ query_params,
248
+ body
249
+ );
250
+
251
+ const {
252
+ error: res_error,
253
+ } = PaymentModel.PaymentStatusUpdateResponse().validate(response, {
254
+ abortEarly: false,
255
+ allowUnknown: false,
256
+ });
257
+
258
+ if (res_error) {
259
+ Logger({
260
+ level: "WARN",
261
+ message:
262
+ "Response Validation Warnnings for checkAndUpdatePaymentStatus",
263
+ });
264
+ Logger({ level: "WARN", message: res_error });
265
+ }
266
+
267
+ return response;
268
+ }
269
+
80
270
  /**
81
271
  * @param {Object} arg - Arg object.
82
272
  * @param {PaymentConfirmationRequest} arg.body
@@ -140,22 +330,1144 @@ class Payment {
140
330
 
141
331
  /**
142
332
  * @param {Object} arg - Arg object.
143
- * @param {string} arg.orderId -
144
- * @param {string} [arg.requestHash] -
145
- * @returns {Promise<RefundAccountResponse>} - Success response
146
- * @summary: Get bank details
147
- * @description: Use this API to get saved bank details for returned/cancelled order using order id.
333
+ * @param {CreatePaymentLinkRequest} arg.body
334
+ * @returns {Promise<CreatePaymentLinkResponse>} - Success response
335
+ * @summary: Create payment link
336
+ * @description: Use this API to create a payment link for the customer
148
337
  */
149
- async getBankAccountDetailsOpenAPI({
150
- orderId,
338
+ async createPaymentLink({ body } = {}) {
339
+ const { error } = PaymentValidator.createPaymentLink().validate(
340
+ {
341
+ body,
342
+ },
343
+ { abortEarly: false, allowUnknown: true }
344
+ );
345
+ if (error) {
346
+ return Promise.reject(new FDKClientValidationError(error));
347
+ }
151
348
 
152
- requestHash,
153
- } = {}) {
154
- const { error } = PaymentValidator.getBankAccountDetailsOpenAPI().validate(
349
+ // Showing warrnings if extra unknown parameters are found
350
+ const { error: warrning } = PaymentValidator.createPaymentLink().validate(
155
351
  {
156
- orderId,
352
+ body,
353
+ },
354
+ { abortEarly: false, allowUnknown: false }
355
+ );
356
+ if (warrning) {
357
+ Logger({
358
+ level: "WARN",
359
+ message: "Parameter Validation warrnings for createPaymentLink",
360
+ });
361
+ Logger({ level: "WARN", message: warrning });
362
+ }
157
363
 
158
- requestHash,
364
+ const query_params = {};
365
+
366
+ const response = await PlatformAPIClient.execute(
367
+ this.config,
368
+ "post",
369
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/create-payment-link/`,
370
+ query_params,
371
+ body
372
+ );
373
+
374
+ const {
375
+ error: res_error,
376
+ } = PaymentModel.CreatePaymentLinkResponse().validate(response, {
377
+ abortEarly: false,
378
+ allowUnknown: false,
379
+ });
380
+
381
+ if (res_error) {
382
+ Logger({
383
+ level: "WARN",
384
+ message: "Response Validation Warnnings for createPaymentLink",
385
+ });
386
+ Logger({ level: "WARN", message: res_error });
387
+ }
388
+
389
+ return response;
390
+ }
391
+
392
+ /**
393
+ * @param {Object} arg - Arg object.
394
+ * @returns {Promise<EdcAggregatorAndModelListResponse>} - Success response
395
+ * @summary: get some information about the store and edc device
396
+ * @description: Use this API to get info of devices linked to a particular app.
397
+ */
398
+ async edcAggregatorsAndModelList({} = {}) {
399
+ const { error } = PaymentValidator.edcAggregatorsAndModelList().validate(
400
+ {},
401
+ { abortEarly: false, allowUnknown: true }
402
+ );
403
+ if (error) {
404
+ return Promise.reject(new FDKClientValidationError(error));
405
+ }
406
+
407
+ // Showing warrnings if extra unknown parameters are found
408
+ const {
409
+ error: warrning,
410
+ } = PaymentValidator.edcAggregatorsAndModelList().validate(
411
+ {},
412
+ { abortEarly: false, allowUnknown: false }
413
+ );
414
+ if (warrning) {
415
+ Logger({
416
+ level: "WARN",
417
+ message:
418
+ "Parameter Validation warrnings for edcAggregatorsAndModelList",
419
+ });
420
+ Logger({ level: "WARN", message: warrning });
421
+ }
422
+
423
+ const query_params = {};
424
+
425
+ const response = await PlatformAPIClient.execute(
426
+ this.config,
427
+ "get",
428
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/edc-aggregator-list`,
429
+ query_params,
430
+ undefined
431
+ );
432
+
433
+ const {
434
+ error: res_error,
435
+ } = PaymentModel.EdcAggregatorAndModelListResponse().validate(response, {
436
+ abortEarly: false,
437
+ allowUnknown: false,
438
+ });
439
+
440
+ if (res_error) {
441
+ Logger({
442
+ level: "WARN",
443
+ message: "Response Validation Warnnings for edcAggregatorsAndModelList",
444
+ });
445
+ Logger({ level: "WARN", message: res_error });
446
+ }
447
+
448
+ return response;
449
+ }
450
+
451
+ /**
452
+ * @param {Object} arg - Arg object.
453
+ * @param {number} [arg.pageNo] -
454
+ * @param {number} [arg.pageSize] -
455
+ * @param {boolean} [arg.isActive] -
456
+ * @param {number} [arg.storeId] -
457
+ * @param {string} [arg.deviceTag] -
458
+ * @returns {Promise<EdcDeviceListResponse>} - Success response
459
+ * @summary: get all the device list of an app
460
+ * @description: Use this API to get all devices linked to a particular app.
461
+ */
462
+ async edcDeviceList({ pageNo, pageSize, isActive, storeId, deviceTag } = {}) {
463
+ const { error } = PaymentValidator.edcDeviceList().validate(
464
+ {
465
+ pageNo,
466
+ pageSize,
467
+ isActive,
468
+ storeId,
469
+ deviceTag,
470
+ },
471
+ { abortEarly: false, allowUnknown: true }
472
+ );
473
+ if (error) {
474
+ return Promise.reject(new FDKClientValidationError(error));
475
+ }
476
+
477
+ // Showing warrnings if extra unknown parameters are found
478
+ const { error: warrning } = PaymentValidator.edcDeviceList().validate(
479
+ {
480
+ pageNo,
481
+ pageSize,
482
+ isActive,
483
+ storeId,
484
+ deviceTag,
485
+ },
486
+ { abortEarly: false, allowUnknown: false }
487
+ );
488
+ if (warrning) {
489
+ Logger({
490
+ level: "WARN",
491
+ message: "Parameter Validation warrnings for edcDeviceList",
492
+ });
493
+ Logger({ level: "WARN", message: warrning });
494
+ }
495
+
496
+ const query_params = {};
497
+ query_params["page_no"] = pageNo;
498
+ query_params["page_size"] = pageSize;
499
+ query_params["is_active"] = isActive;
500
+ query_params["store_id"] = storeId;
501
+ query_params["device_tag"] = deviceTag;
502
+
503
+ const response = await PlatformAPIClient.execute(
504
+ this.config,
505
+ "get",
506
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/edc-device-list`,
507
+ query_params,
508
+ undefined
509
+ );
510
+
511
+ const {
512
+ error: res_error,
513
+ } = PaymentModel.EdcDeviceListResponse().validate(response, {
514
+ abortEarly: false,
515
+ allowUnknown: false,
516
+ });
517
+
518
+ if (res_error) {
519
+ Logger({
520
+ level: "WARN",
521
+ message: "Response Validation Warnnings for edcDeviceList",
522
+ });
523
+ Logger({ level: "WARN", message: res_error });
524
+ }
525
+
526
+ return response;
527
+ }
528
+
529
+ /**
530
+ * @param {Object} arg - Arg object.
531
+ * @returns {Promise<EdcDeviceStatsResponse>} - Success response
532
+ * @summary: get some information about the store and edc device
533
+ * @description: Use this API to get info of devices linked to a particular app.
534
+ */
535
+ async edcDeviceStats({} = {}) {
536
+ const { error } = PaymentValidator.edcDeviceStats().validate(
537
+ {},
538
+ { abortEarly: false, allowUnknown: true }
539
+ );
540
+ if (error) {
541
+ return Promise.reject(new FDKClientValidationError(error));
542
+ }
543
+
544
+ // Showing warrnings if extra unknown parameters are found
545
+ const { error: warrning } = PaymentValidator.edcDeviceStats().validate(
546
+ {},
547
+ { abortEarly: false, allowUnknown: false }
548
+ );
549
+ if (warrning) {
550
+ Logger({
551
+ level: "WARN",
552
+ message: "Parameter Validation warrnings for edcDeviceStats",
553
+ });
554
+ Logger({ level: "WARN", message: warrning });
555
+ }
556
+
557
+ const query_params = {};
558
+
559
+ const response = await PlatformAPIClient.execute(
560
+ this.config,
561
+ "get",
562
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/edc-device-stats`,
563
+ query_params,
564
+ undefined
565
+ );
566
+
567
+ const {
568
+ error: res_error,
569
+ } = PaymentModel.EdcDeviceStatsResponse().validate(response, {
570
+ abortEarly: false,
571
+ allowUnknown: false,
572
+ });
573
+
574
+ if (res_error) {
575
+ Logger({
576
+ level: "WARN",
577
+ message: "Response Validation Warnnings for edcDeviceStats",
578
+ });
579
+ Logger({ level: "WARN", message: res_error });
580
+ }
581
+
582
+ return response;
583
+ }
584
+
585
+ /**
586
+ * @param {Object} arg - Arg object.
587
+ * @param {string} arg.orderId -
588
+ * @param {string} [arg.requestHash] -
589
+ * @returns {Promise<RefundAccountResponse>} - Success response
590
+ * @summary: Get bank details
591
+ * @description: Use this API to get saved bank details for returned/cancelled order using order id.
592
+ */
593
+ async getBankAccountDetailsOpenAPI({
594
+ orderId,
595
+
596
+ requestHash,
597
+ } = {}) {
598
+ const { error } = PaymentValidator.getBankAccountDetailsOpenAPI().validate(
599
+ {
600
+ orderId,
601
+
602
+ requestHash,
603
+ },
604
+ { abortEarly: false, allowUnknown: true }
605
+ );
606
+ if (error) {
607
+ return Promise.reject(new FDKClientValidationError(error));
608
+ }
609
+
610
+ // Showing warrnings if extra unknown parameters are found
611
+ const {
612
+ error: warrning,
613
+ } = PaymentValidator.getBankAccountDetailsOpenAPI().validate(
614
+ {
615
+ orderId,
616
+
617
+ requestHash,
618
+ },
619
+ { abortEarly: false, allowUnknown: false }
620
+ );
621
+ if (warrning) {
622
+ Logger({
623
+ level: "WARN",
624
+ message:
625
+ "Parameter Validation warrnings for getBankAccountDetailsOpenAPI",
626
+ });
627
+ Logger({ level: "WARN", message: warrning });
628
+ }
629
+
630
+ const query_params = {};
631
+ query_params["order_id"] = orderId;
632
+ query_params["request_hash"] = requestHash;
633
+
634
+ const response = await PlatformAPIClient.execute(
635
+ this.config,
636
+ "get",
637
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/refund/account`,
638
+ query_params,
639
+ undefined
640
+ );
641
+
642
+ const {
643
+ error: res_error,
644
+ } = PaymentModel.RefundAccountResponse().validate(response, {
645
+ abortEarly: false,
646
+ allowUnknown: false,
647
+ });
648
+
649
+ if (res_error) {
650
+ Logger({
651
+ level: "WARN",
652
+ message:
653
+ "Response Validation Warnnings for getBankAccountDetailsOpenAPI",
654
+ });
655
+ Logger({ level: "WARN", message: res_error });
656
+ }
657
+
658
+ return response;
659
+ }
660
+
661
+ /**
662
+ * @param {Object} arg - Arg object.
663
+ * @returns {Promise<PaymentGatewayConfigResponse>} - Success response
664
+ * @summary: Get All Brand Payment Gateway Config Secret
665
+ * @description: Get All Brand Payment Gateway Config Secret
666
+ */
667
+ async getBrandPaymentGatewayConfig({} = {}) {
668
+ const { error } = PaymentValidator.getBrandPaymentGatewayConfig().validate(
669
+ {},
670
+ { abortEarly: false, allowUnknown: true }
671
+ );
672
+ if (error) {
673
+ return Promise.reject(new FDKClientValidationError(error));
674
+ }
675
+
676
+ // Showing warrnings if extra unknown parameters are found
677
+ const {
678
+ error: warrning,
679
+ } = PaymentValidator.getBrandPaymentGatewayConfig().validate(
680
+ {},
681
+ { abortEarly: false, allowUnknown: false }
682
+ );
683
+ if (warrning) {
684
+ Logger({
685
+ level: "WARN",
686
+ message:
687
+ "Parameter Validation warrnings for getBrandPaymentGatewayConfig",
688
+ });
689
+ Logger({ level: "WARN", message: warrning });
690
+ }
691
+
692
+ const query_params = {};
693
+
694
+ const response = await PlatformAPIClient.execute(
695
+ this.config,
696
+ "get",
697
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/aggregator/request`,
698
+ query_params,
699
+ undefined
700
+ );
701
+
702
+ const {
703
+ error: res_error,
704
+ } = PaymentModel.PaymentGatewayConfigResponse().validate(response, {
705
+ abortEarly: false,
706
+ allowUnknown: false,
707
+ });
708
+
709
+ if (res_error) {
710
+ Logger({
711
+ level: "WARN",
712
+ message:
713
+ "Response Validation Warnnings for getBrandPaymentGatewayConfig",
714
+ });
715
+ Logger({ level: "WARN", message: res_error });
716
+ }
717
+
718
+ return response;
719
+ }
720
+
721
+ /**
722
+ * @param {Object} arg - Arg object.
723
+ * @param {string} arg.terminalUniqueIdentifier - Terminal unique identifier
724
+ * @returns {Promise<EdcDeviceDetailsResponse>} - Success response
725
+ * @summary: get details of a single edc device
726
+ * @description: Use this API to get details of a single edc device
727
+ */
728
+ async getEdcDevice({ terminalUniqueIdentifier } = {}) {
729
+ const { error } = PaymentValidator.getEdcDevice().validate(
730
+ {
731
+ terminalUniqueIdentifier,
732
+ },
733
+ { abortEarly: false, allowUnknown: true }
734
+ );
735
+ if (error) {
736
+ return Promise.reject(new FDKClientValidationError(error));
737
+ }
738
+
739
+ // Showing warrnings if extra unknown parameters are found
740
+ const { error: warrning } = PaymentValidator.getEdcDevice().validate(
741
+ {
742
+ terminalUniqueIdentifier,
743
+ },
744
+ { abortEarly: false, allowUnknown: false }
745
+ );
746
+ if (warrning) {
747
+ Logger({
748
+ level: "WARN",
749
+ message: "Parameter Validation warrnings for getEdcDevice",
750
+ });
751
+ Logger({ level: "WARN", message: warrning });
752
+ }
753
+
754
+ const query_params = {};
755
+
756
+ const response = await PlatformAPIClient.execute(
757
+ this.config,
758
+ "get",
759
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/edc-device/${terminalUniqueIdentifier}`,
760
+ query_params,
761
+ undefined
762
+ );
763
+
764
+ const {
765
+ error: res_error,
766
+ } = PaymentModel.EdcDeviceDetailsResponse().validate(response, {
767
+ abortEarly: false,
768
+ allowUnknown: false,
769
+ });
770
+
771
+ if (res_error) {
772
+ Logger({
773
+ level: "WARN",
774
+ message: "Response Validation Warnnings for getEdcDevice",
775
+ });
776
+ Logger({ level: "WARN", message: res_error });
777
+ }
778
+
779
+ return response;
780
+ }
781
+
782
+ /**
783
+ * @param {Object} arg - Arg object.
784
+ * @returns {Promise<GetPaymentCodeResponse>} - Success response
785
+ * @summary: List Payment Options Method Codes
786
+ * @description: Get all active List Payment Options Method Codes
787
+ */
788
+ async getPaymentCodeOption({} = {}) {
789
+ const { error } = PaymentValidator.getPaymentCodeOption().validate(
790
+ {},
791
+ { abortEarly: false, allowUnknown: true }
792
+ );
793
+ if (error) {
794
+ return Promise.reject(new FDKClientValidationError(error));
795
+ }
796
+
797
+ // Showing warrnings if extra unknown parameters are found
798
+ const {
799
+ error: warrning,
800
+ } = PaymentValidator.getPaymentCodeOption().validate(
801
+ {},
802
+ { abortEarly: false, allowUnknown: false }
803
+ );
804
+ if (warrning) {
805
+ Logger({
806
+ level: "WARN",
807
+ message: "Parameter Validation warrnings for getPaymentCodeOption",
808
+ });
809
+ Logger({ level: "WARN", message: warrning });
810
+ }
811
+
812
+ const query_params = {};
813
+
814
+ const response = await PlatformAPIClient.execute(
815
+ this.config,
816
+ "get",
817
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/codes`,
818
+ query_params,
819
+ undefined
820
+ );
821
+
822
+ const {
823
+ error: res_error,
824
+ } = PaymentModel.GetPaymentCodeResponse().validate(response, {
825
+ abortEarly: false,
826
+ allowUnknown: false,
827
+ });
828
+
829
+ if (res_error) {
830
+ Logger({
831
+ level: "WARN",
832
+ message: "Response Validation Warnnings for getPaymentCodeOption",
833
+ });
834
+ Logger({ level: "WARN", message: res_error });
835
+ }
836
+
837
+ return response;
838
+ }
839
+
840
+ /**
841
+ * @param {Object} arg - Arg object.
842
+ * @param {string} [arg.paymentLinkId] -
843
+ * @returns {Promise<GetPaymentLinkResponse>} - Success response
844
+ * @summary: Get payment link
845
+ * @description: Use this API to get a payment link
846
+ */
847
+ async getPaymentLink({ paymentLinkId } = {}) {
848
+ const { error } = PaymentValidator.getPaymentLink().validate(
849
+ {
850
+ paymentLinkId,
851
+ },
852
+ { abortEarly: false, allowUnknown: true }
853
+ );
854
+ if (error) {
855
+ return Promise.reject(new FDKClientValidationError(error));
856
+ }
857
+
858
+ // Showing warrnings if extra unknown parameters are found
859
+ const { error: warrning } = PaymentValidator.getPaymentLink().validate(
860
+ {
861
+ paymentLinkId,
862
+ },
863
+ { abortEarly: false, allowUnknown: false }
864
+ );
865
+ if (warrning) {
866
+ Logger({
867
+ level: "WARN",
868
+ message: "Parameter Validation warrnings for getPaymentLink",
869
+ });
870
+ Logger({ level: "WARN", message: warrning });
871
+ }
872
+
873
+ const query_params = {};
874
+ query_params["payment_link_id"] = paymentLinkId;
875
+
876
+ const response = await PlatformAPIClient.execute(
877
+ this.config,
878
+ "get",
879
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/create-payment-link/`,
880
+ query_params,
881
+ undefined
882
+ );
883
+
884
+ const {
885
+ error: res_error,
886
+ } = PaymentModel.GetPaymentLinkResponse().validate(response, {
887
+ abortEarly: false,
888
+ allowUnknown: false,
889
+ });
890
+
891
+ if (res_error) {
892
+ Logger({
893
+ level: "WARN",
894
+ message: "Response Validation Warnnings for getPaymentLink",
895
+ });
896
+ Logger({ level: "WARN", message: res_error });
897
+ }
898
+
899
+ return response;
900
+ }
901
+
902
+ /**
903
+ * @param {Object} arg - Arg object.
904
+ * @param {boolean} arg.refresh -
905
+ * @param {string} arg.requestType -
906
+ * @returns {Promise<PaymentOptionsResponse>} - Success response
907
+ * @summary: Get All Valid Payment Options
908
+ * @description: Use this API to get Get All Valid Payment Options for making payment
909
+ */
910
+ async getPaymentModeRoutes({ refresh, requestType } = {}) {
911
+ const { error } = PaymentValidator.getPaymentModeRoutes().validate(
912
+ {
913
+ refresh,
914
+ requestType,
915
+ },
916
+ { abortEarly: false, allowUnknown: true }
917
+ );
918
+ if (error) {
919
+ return Promise.reject(new FDKClientValidationError(error));
920
+ }
921
+
922
+ // Showing warrnings if extra unknown parameters are found
923
+ const {
924
+ error: warrning,
925
+ } = PaymentValidator.getPaymentModeRoutes().validate(
926
+ {
927
+ refresh,
928
+ requestType,
929
+ },
930
+ { abortEarly: false, allowUnknown: false }
931
+ );
932
+ if (warrning) {
933
+ Logger({
934
+ level: "WARN",
935
+ message: "Parameter Validation warrnings for getPaymentModeRoutes",
936
+ });
937
+ Logger({ level: "WARN", message: warrning });
938
+ }
939
+
940
+ const query_params = {};
941
+ query_params["refresh"] = refresh;
942
+ query_params["request_type"] = requestType;
943
+
944
+ const response = await PlatformAPIClient.execute(
945
+ this.config,
946
+ "get",
947
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/options`,
948
+ query_params,
949
+ undefined
950
+ );
951
+
952
+ const {
953
+ error: res_error,
954
+ } = PaymentModel.PaymentOptionsResponse().validate(response, {
955
+ abortEarly: false,
956
+ allowUnknown: false,
957
+ });
958
+
959
+ if (res_error) {
960
+ Logger({
961
+ level: "WARN",
962
+ message: "Response Validation Warnnings for getPaymentModeRoutes",
963
+ });
964
+ Logger({ level: "WARN", message: res_error });
965
+ }
966
+
967
+ return response;
968
+ }
969
+
970
+ /**
971
+ * @param {Object} arg - Arg object.
972
+ * @param {number} arg.amount - Payable amount.
973
+ * @param {string} arg.cartId - Identifier of the cart.
974
+ * @param {string} arg.pincode - The PIN Code of the destination address, e.g. 400059
975
+ * @param {string} arg.checkoutMode - Option to checkout for self or for others.
976
+ * @param {boolean} [arg.refresh] - This is a boolean value. Select `true`
977
+ * to remove temporary cache files on payment gateway and replace with the
978
+ * latest one.
979
+ * @param {string} [arg.cardReference] - Card reference id of user's debit
980
+ * or credit card.
981
+ * @param {string} arg.orderType - The order type of shipment * HomeDelivery
982
+ * - If the customer wants the order home-delivered * PickAtStore - If the
983
+ * customer wants the handover of an order at the store itself.
984
+ * @param {string} [arg.userDetails] - URIencoded JSON containing details of
985
+ * an anonymous user.
986
+ * @returns {Promise<PaymentOptionsResponse>} - Success response
987
+ * @summary: Get All Valid Payment Options
988
+ * @description: Use this API to get Get All Valid Payment Options for making payment
989
+ */
990
+ async getPosPaymentModeRoutes({
991
+ amount,
992
+ cartId,
993
+ pincode,
994
+ checkoutMode,
995
+ orderType,
996
+ refresh,
997
+ cardReference,
998
+ userDetails,
999
+ } = {}) {
1000
+ const { error } = PaymentValidator.getPosPaymentModeRoutes().validate(
1001
+ {
1002
+ amount,
1003
+ cartId,
1004
+ pincode,
1005
+ checkoutMode,
1006
+ orderType,
1007
+ refresh,
1008
+ cardReference,
1009
+ userDetails,
1010
+ },
1011
+ { abortEarly: false, allowUnknown: true }
1012
+ );
1013
+ if (error) {
1014
+ return Promise.reject(new FDKClientValidationError(error));
1015
+ }
1016
+
1017
+ // Showing warrnings if extra unknown parameters are found
1018
+ const {
1019
+ error: warrning,
1020
+ } = PaymentValidator.getPosPaymentModeRoutes().validate(
1021
+ {
1022
+ amount,
1023
+ cartId,
1024
+ pincode,
1025
+ checkoutMode,
1026
+ orderType,
1027
+ refresh,
1028
+ cardReference,
1029
+ userDetails,
1030
+ },
1031
+ { abortEarly: false, allowUnknown: false }
1032
+ );
1033
+ if (warrning) {
1034
+ Logger({
1035
+ level: "WARN",
1036
+ message: "Parameter Validation warrnings for getPosPaymentModeRoutes",
1037
+ });
1038
+ Logger({ level: "WARN", message: warrning });
1039
+ }
1040
+
1041
+ const query_params = {};
1042
+ query_params["amount"] = amount;
1043
+ query_params["cart_id"] = cartId;
1044
+ query_params["pincode"] = pincode;
1045
+ query_params["checkout_mode"] = checkoutMode;
1046
+ query_params["refresh"] = refresh;
1047
+ query_params["card_reference"] = cardReference;
1048
+ query_params["order_type"] = orderType;
1049
+ query_params["user_details"] = userDetails;
1050
+
1051
+ const response = await PlatformAPIClient.execute(
1052
+ this.config,
1053
+ "get",
1054
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/options/pos`,
1055
+ query_params,
1056
+ undefined
1057
+ );
1058
+
1059
+ const {
1060
+ error: res_error,
1061
+ } = PaymentModel.PaymentOptionsResponse().validate(response, {
1062
+ abortEarly: false,
1063
+ allowUnknown: false,
1064
+ });
1065
+
1066
+ if (res_error) {
1067
+ Logger({
1068
+ level: "WARN",
1069
+ message: "Response Validation Warnnings for getPosPaymentModeRoutes",
1070
+ });
1071
+ Logger({ level: "WARN", message: res_error });
1072
+ }
1073
+
1074
+ return response;
1075
+ }
1076
+
1077
+ /**
1078
+ * @param {Object} arg - Arg object.
1079
+ * @param {string} arg.orderId -
1080
+ * @returns {Promise<OrderBeneficiaryResponse>} - Success response
1081
+ * @summary: List User Beneficiary
1082
+ * @description: Get all active beneficiary details added by the user for refund
1083
+ */
1084
+ async getUserBeneficiaries({ orderId } = {}) {
1085
+ const { error } = PaymentValidator.getUserBeneficiaries().validate(
1086
+ { orderId },
1087
+ { abortEarly: false, allowUnknown: true }
1088
+ );
1089
+ if (error) {
1090
+ return Promise.reject(new FDKClientValidationError(error));
1091
+ }
1092
+
1093
+ // Showing warrnings if extra unknown parameters are found
1094
+ const {
1095
+ error: warrning,
1096
+ } = PaymentValidator.getUserBeneficiaries().validate(
1097
+ { orderId },
1098
+ { abortEarly: false, allowUnknown: false }
1099
+ );
1100
+ if (warrning) {
1101
+ Logger({
1102
+ level: "WARN",
1103
+ message: "Parameter Validation warrnings for getUserBeneficiaries",
1104
+ });
1105
+ Logger({ level: "WARN", message: warrning });
1106
+ }
1107
+
1108
+ const query_params = {};
1109
+ query_params["order_id"] = orderId;
1110
+
1111
+ const response = await PlatformAPIClient.execute(
1112
+ this.config,
1113
+ "get",
1114
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/refund/accounts/user`,
1115
+ query_params,
1116
+ undefined
1117
+ );
1118
+
1119
+ const {
1120
+ error: res_error,
1121
+ } = PaymentModel.OrderBeneficiaryResponse().validate(response, {
1122
+ abortEarly: false,
1123
+ allowUnknown: false,
1124
+ });
1125
+
1126
+ if (res_error) {
1127
+ Logger({
1128
+ level: "WARN",
1129
+ message: "Response Validation Warnnings for getUserBeneficiaries",
1130
+ });
1131
+ Logger({ level: "WARN", message: res_error });
1132
+ }
1133
+
1134
+ return response;
1135
+ }
1136
+
1137
+ /**
1138
+ * @param {Object} arg - Arg object.
1139
+ * @param {string} arg.merchantUserId -
1140
+ * @param {string} arg.mobileNo -
1141
+ * @returns {Promise<GetUserCODLimitResponse>} - Success response
1142
+ * @summary: Get COD limit for user
1143
+ * @description: Use this API to get user cod limit and reamining limit for the payment
1144
+ */
1145
+ async getUserCODlimitRoutes({ merchantUserId, mobileNo } = {}) {
1146
+ const { error } = PaymentValidator.getUserCODlimitRoutes().validate(
1147
+ {
1148
+ merchantUserId,
1149
+ mobileNo,
1150
+ },
1151
+ { abortEarly: false, allowUnknown: true }
1152
+ );
1153
+ if (error) {
1154
+ return Promise.reject(new FDKClientValidationError(error));
1155
+ }
1156
+
1157
+ // Showing warrnings if extra unknown parameters are found
1158
+ const {
1159
+ error: warrning,
1160
+ } = PaymentValidator.getUserCODlimitRoutes().validate(
1161
+ {
1162
+ merchantUserId,
1163
+ mobileNo,
1164
+ },
1165
+ { abortEarly: false, allowUnknown: false }
1166
+ );
1167
+ if (warrning) {
1168
+ Logger({
1169
+ level: "WARN",
1170
+ message: "Parameter Validation warrnings for getUserCODlimitRoutes",
1171
+ });
1172
+ Logger({ level: "WARN", message: warrning });
1173
+ }
1174
+
1175
+ const query_params = {};
1176
+ query_params["merchant_user_id"] = merchantUserId;
1177
+ query_params["mobile_no"] = mobileNo;
1178
+
1179
+ const response = await PlatformAPIClient.execute(
1180
+ this.config,
1181
+ "get",
1182
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/user-cod`,
1183
+ query_params,
1184
+ undefined
1185
+ );
1186
+
1187
+ const {
1188
+ error: res_error,
1189
+ } = PaymentModel.GetUserCODLimitResponse().validate(response, {
1190
+ abortEarly: false,
1191
+ allowUnknown: false,
1192
+ });
1193
+
1194
+ if (res_error) {
1195
+ Logger({
1196
+ level: "WARN",
1197
+ message: "Response Validation Warnnings for getUserCODlimitRoutes",
1198
+ });
1199
+ Logger({ level: "WARN", message: res_error });
1200
+ }
1201
+
1202
+ return response;
1203
+ }
1204
+
1205
+ /**
1206
+ * @param {Object} arg - Arg object.
1207
+ * @param {string} arg.orderId -
1208
+ * @returns {Promise<OrderBeneficiaryResponse>} - Success response
1209
+ * @summary: List Order Beneficiary
1210
+ * @description: Get all active beneficiary details added by the user for refund
1211
+ */
1212
+ async getUserOrderBeneficiaries({ orderId } = {}) {
1213
+ const { error } = PaymentValidator.getUserOrderBeneficiaries().validate(
1214
+ { orderId },
1215
+ { abortEarly: false, allowUnknown: true }
1216
+ );
1217
+ if (error) {
1218
+ return Promise.reject(new FDKClientValidationError(error));
1219
+ }
1220
+
1221
+ // Showing warrnings if extra unknown parameters are found
1222
+ const {
1223
+ error: warrning,
1224
+ } = PaymentValidator.getUserOrderBeneficiaries().validate(
1225
+ { orderId },
1226
+ { abortEarly: false, allowUnknown: false }
1227
+ );
1228
+ if (warrning) {
1229
+ Logger({
1230
+ level: "WARN",
1231
+ message: "Parameter Validation warrnings for getUserOrderBeneficiaries",
1232
+ });
1233
+ Logger({ level: "WARN", message: warrning });
1234
+ }
1235
+
1236
+ const query_params = {};
1237
+ query_params["order_id"] = orderId;
1238
+
1239
+ const response = await PlatformAPIClient.execute(
1240
+ this.config,
1241
+ "get",
1242
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/refund/accounts/order`,
1243
+ query_params,
1244
+ undefined
1245
+ );
1246
+
1247
+ const {
1248
+ error: res_error,
1249
+ } = PaymentModel.OrderBeneficiaryResponse().validate(response, {
1250
+ abortEarly: false,
1251
+ allowUnknown: false,
1252
+ });
1253
+
1254
+ if (res_error) {
1255
+ Logger({
1256
+ level: "WARN",
1257
+ message: "Response Validation Warnnings for getUserOrderBeneficiaries",
1258
+ });
1259
+ Logger({ level: "WARN", message: res_error });
1260
+ }
1261
+
1262
+ return response;
1263
+ }
1264
+
1265
+ /**
1266
+ * @param {Object} arg - Arg object.
1267
+ * @param {PaymentInitializationRequest} arg.body
1268
+ * @returns {Promise<PaymentInitializationResponse>} - Success response
1269
+ * @summary: Initialize a payment (server-to-server) for UPI and BharatQR
1270
+ * @description: PUse this API to inititate payment using UPI, BharatQR, wherein the UPI requests are send to the app and QR code is displayed on the screen.
1271
+ */
1272
+ async initialisePayment({ body } = {}) {
1273
+ const { error } = PaymentValidator.initialisePayment().validate(
1274
+ {
1275
+ body,
1276
+ },
1277
+ { abortEarly: false, allowUnknown: true }
1278
+ );
1279
+ if (error) {
1280
+ return Promise.reject(new FDKClientValidationError(error));
1281
+ }
1282
+
1283
+ // Showing warrnings if extra unknown parameters are found
1284
+ const { error: warrning } = PaymentValidator.initialisePayment().validate(
1285
+ {
1286
+ body,
1287
+ },
1288
+ { abortEarly: false, allowUnknown: false }
1289
+ );
1290
+ if (warrning) {
1291
+ Logger({
1292
+ level: "WARN",
1293
+ message: "Parameter Validation warrnings for initialisePayment",
1294
+ });
1295
+ Logger({ level: "WARN", message: warrning });
1296
+ }
1297
+
1298
+ const query_params = {};
1299
+
1300
+ const response = await PlatformAPIClient.execute(
1301
+ this.config,
1302
+ "post",
1303
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/request`,
1304
+ query_params,
1305
+ body
1306
+ );
1307
+
1308
+ const {
1309
+ error: res_error,
1310
+ } = PaymentModel.PaymentInitializationResponse().validate(response, {
1311
+ abortEarly: false,
1312
+ allowUnknown: false,
1313
+ });
1314
+
1315
+ if (res_error) {
1316
+ Logger({
1317
+ level: "WARN",
1318
+ message: "Response Validation Warnnings for initialisePayment",
1319
+ });
1320
+ Logger({ level: "WARN", message: res_error });
1321
+ }
1322
+
1323
+ return response;
1324
+ }
1325
+
1326
+ /**
1327
+ * @param {Object} arg - Arg object.
1328
+ * @param {MerchantOnBoardingRequest} arg.body
1329
+ * @returns {Promise<MerchantOnBoardingResponse>} - Success response
1330
+ * @summary: API to push Ajiodhan merchant data to Gringotts system
1331
+ * @description: Use this API to push Ajiodhan merchant data to Gringotts system
1332
+ */
1333
+ async merchantOnBoarding({ body } = {}) {
1334
+ const { error } = PaymentValidator.merchantOnBoarding().validate(
1335
+ {
1336
+ body,
1337
+ },
1338
+ { abortEarly: false, allowUnknown: true }
1339
+ );
1340
+ if (error) {
1341
+ return Promise.reject(new FDKClientValidationError(error));
1342
+ }
1343
+
1344
+ // Showing warrnings if extra unknown parameters are found
1345
+ const { error: warrning } = PaymentValidator.merchantOnBoarding().validate(
1346
+ {
1347
+ body,
1348
+ },
1349
+ { abortEarly: false, allowUnknown: false }
1350
+ );
1351
+ if (warrning) {
1352
+ Logger({
1353
+ level: "WARN",
1354
+ message: "Parameter Validation warrnings for merchantOnBoarding",
1355
+ });
1356
+ Logger({ level: "WARN", message: warrning });
1357
+ }
1358
+
1359
+ const query_params = {};
1360
+
1361
+ const response = await PlatformAPIClient.execute(
1362
+ this.config,
1363
+ "post",
1364
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/merchant-onboarding`,
1365
+ query_params,
1366
+ body
1367
+ );
1368
+
1369
+ const {
1370
+ error: res_error,
1371
+ } = PaymentModel.MerchantOnBoardingResponse().validate(response, {
1372
+ abortEarly: false,
1373
+ allowUnknown: false,
1374
+ });
1375
+
1376
+ if (res_error) {
1377
+ Logger({
1378
+ level: "WARN",
1379
+ message: "Response Validation Warnnings for merchantOnBoarding",
1380
+ });
1381
+ Logger({ level: "WARN", message: res_error });
1382
+ }
1383
+
1384
+ return response;
1385
+ }
1386
+
1387
+ /**
1388
+ * @param {Object} arg - Arg object.
1389
+ * @param {string} arg.aggregator - Aggregator
1390
+ * @param {string} [arg.successRedirectUrl] -
1391
+ * @param {string} [arg.failureRedirectUrl] -
1392
+ * @returns {Promise<GetOauthUrlResponse>} - Success response
1393
+ * @summary: API to Get the url to call for oauth
1394
+ * @description: Use this API to Get the url to call for oauth.
1395
+ */
1396
+ async oauthGetUrl({
1397
+ aggregator,
1398
+ successRedirectUrl,
1399
+ failureRedirectUrl,
1400
+ } = {}) {
1401
+ const { error } = PaymentValidator.oauthGetUrl().validate(
1402
+ {
1403
+ aggregator,
1404
+ successRedirectUrl,
1405
+ failureRedirectUrl,
1406
+ },
1407
+ { abortEarly: false, allowUnknown: true }
1408
+ );
1409
+ if (error) {
1410
+ return Promise.reject(new FDKClientValidationError(error));
1411
+ }
1412
+
1413
+ // Showing warrnings if extra unknown parameters are found
1414
+ const { error: warrning } = PaymentValidator.oauthGetUrl().validate(
1415
+ {
1416
+ aggregator,
1417
+ successRedirectUrl,
1418
+ failureRedirectUrl,
1419
+ },
1420
+ { abortEarly: false, allowUnknown: false }
1421
+ );
1422
+ if (warrning) {
1423
+ Logger({
1424
+ level: "WARN",
1425
+ message: "Parameter Validation warrnings for oauthGetUrl",
1426
+ });
1427
+ Logger({ level: "WARN", message: warrning });
1428
+ }
1429
+
1430
+ const query_params = {};
1431
+ query_params["success_redirect_url"] = successRedirectUrl;
1432
+ query_params["failure_redirect_url"] = failureRedirectUrl;
1433
+
1434
+ const response = await PlatformAPIClient.execute(
1435
+ this.config,
1436
+ "get",
1437
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/onboard/${aggregator}/`,
1438
+ query_params,
1439
+ undefined
1440
+ );
1441
+
1442
+ const {
1443
+ error: res_error,
1444
+ } = PaymentModel.GetOauthUrlResponse().validate(response, {
1445
+ abortEarly: false,
1446
+ allowUnknown: false,
1447
+ });
1448
+
1449
+ if (res_error) {
1450
+ Logger({
1451
+ level: "WARN",
1452
+ message: "Response Validation Warnnings for oauthGetUrl",
1453
+ });
1454
+ Logger({ level: "WARN", message: res_error });
1455
+ }
1456
+
1457
+ return response;
1458
+ }
1459
+
1460
+ /**
1461
+ * @param {Object} arg - Arg object.
1462
+ * @param {PaymentStatusBulkHandlerRequest} arg.body
1463
+ * @returns {Promise<PaymentStatusBulkHandlerResponse>} - Success response
1464
+ * @summary: Get Payment status and information for a list of order_ids
1465
+ * @description: Use this API to get Payment status and information for a list of order_ids
1466
+ */
1467
+ async paymentStatusBulk({ body } = {}) {
1468
+ const { error } = PaymentValidator.paymentStatusBulk().validate(
1469
+ {
1470
+ body,
159
1471
  },
160
1472
  { abortEarly: false, allowUnknown: true }
161
1473
  );
@@ -164,40 +1476,33 @@ class Payment {
164
1476
  }
165
1477
 
166
1478
  // Showing warrnings if extra unknown parameters are found
167
- const {
168
- error: warrning,
169
- } = PaymentValidator.getBankAccountDetailsOpenAPI().validate(
1479
+ const { error: warrning } = PaymentValidator.paymentStatusBulk().validate(
170
1480
  {
171
- orderId,
172
-
173
- requestHash,
1481
+ body,
174
1482
  },
175
1483
  { abortEarly: false, allowUnknown: false }
176
1484
  );
177
1485
  if (warrning) {
178
1486
  Logger({
179
1487
  level: "WARN",
180
- message:
181
- "Parameter Validation warrnings for getBankAccountDetailsOpenAPI",
1488
+ message: "Parameter Validation warrnings for paymentStatusBulk",
182
1489
  });
183
1490
  Logger({ level: "WARN", message: warrning });
184
1491
  }
185
1492
 
186
1493
  const query_params = {};
187
- query_params["order_id"] = orderId;
188
- query_params["request_hash"] = requestHash;
189
1494
 
190
1495
  const response = await PlatformAPIClient.execute(
191
1496
  this.config,
192
- "get",
193
- `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/refund/account`,
1497
+ "post",
1498
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/payment-status-bulk/`,
194
1499
  query_params,
195
- undefined
1500
+ body
196
1501
  );
197
1502
 
198
1503
  const {
199
1504
  error: res_error,
200
- } = PaymentModel.RefundAccountResponse().validate(response, {
1505
+ } = PaymentModel.PaymentStatusBulkHandlerResponse().validate(response, {
201
1506
  abortEarly: false,
202
1507
  allowUnknown: false,
203
1508
  });
@@ -205,8 +1510,7 @@ class Payment {
205
1510
  if (res_error) {
206
1511
  Logger({
207
1512
  level: "WARN",
208
- message:
209
- "Response Validation Warnnings for getBankAccountDetailsOpenAPI",
1513
+ message: "Response Validation Warnnings for paymentStatusBulk",
210
1514
  });
211
1515
  Logger({ level: "WARN", message: res_error });
212
1516
  }
@@ -216,13 +1520,16 @@ class Payment {
216
1520
 
217
1521
  /**
218
1522
  * @param {Object} arg - Arg object.
219
- * @returns {Promise<PaymentGatewayConfigResponse>} - Success response
220
- * @summary: Get All Brand Payment Gateway Config Secret
221
- * @description: Get All Brand Payment Gateway Config Secret
1523
+ * @param {string} [arg.paymentLinkId] -
1524
+ * @returns {Promise<PollingPaymentLinkResponse>} - Success response
1525
+ * @summary: Used for polling if payment successful or not
1526
+ * @description: Use this API to poll if payment through payment was successful or not
222
1527
  */
223
- async getBrandPaymentGatewayConfig({} = {}) {
224
- const { error } = PaymentValidator.getBrandPaymentGatewayConfig().validate(
225
- {},
1528
+ async pollingPaymentLink({ paymentLinkId } = {}) {
1529
+ const { error } = PaymentValidator.pollingPaymentLink().validate(
1530
+ {
1531
+ paymentLinkId,
1532
+ },
226
1533
  { abortEarly: false, allowUnknown: true }
227
1534
  );
228
1535
  if (error) {
@@ -230,34 +1537,34 @@ class Payment {
230
1537
  }
231
1538
 
232
1539
  // Showing warrnings if extra unknown parameters are found
233
- const {
234
- error: warrning,
235
- } = PaymentValidator.getBrandPaymentGatewayConfig().validate(
236
- {},
1540
+ const { error: warrning } = PaymentValidator.pollingPaymentLink().validate(
1541
+ {
1542
+ paymentLinkId,
1543
+ },
237
1544
  { abortEarly: false, allowUnknown: false }
238
1545
  );
239
1546
  if (warrning) {
240
1547
  Logger({
241
1548
  level: "WARN",
242
- message:
243
- "Parameter Validation warrnings for getBrandPaymentGatewayConfig",
1549
+ message: "Parameter Validation warrnings for pollingPaymentLink",
244
1550
  });
245
1551
  Logger({ level: "WARN", message: warrning });
246
1552
  }
247
1553
 
248
1554
  const query_params = {};
1555
+ query_params["payment_link_id"] = paymentLinkId;
249
1556
 
250
1557
  const response = await PlatformAPIClient.execute(
251
1558
  this.config,
252
1559
  "get",
253
- `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/aggregator/request`,
1560
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/polling-payment-link/`,
254
1561
  query_params,
255
1562
  undefined
256
1563
  );
257
1564
 
258
1565
  const {
259
1566
  error: res_error,
260
- } = PaymentModel.PaymentGatewayConfigResponse().validate(response, {
1567
+ } = PaymentModel.PollingPaymentLinkResponse().validate(response, {
261
1568
  abortEarly: false,
262
1569
  allowUnknown: false,
263
1570
  });
@@ -265,8 +1572,7 @@ class Payment {
265
1572
  if (res_error) {
266
1573
  Logger({
267
1574
  level: "WARN",
268
- message:
269
- "Response Validation Warnnings for getBrandPaymentGatewayConfig",
1575
+ message: "Response Validation Warnnings for pollingPaymentLink",
270
1576
  });
271
1577
  Logger({ level: "WARN", message: res_error });
272
1578
  }
@@ -276,17 +1582,15 @@ class Payment {
276
1582
 
277
1583
  /**
278
1584
  * @param {Object} arg - Arg object.
279
- * @param {boolean} arg.refresh -
280
- * @param {string} arg.requestType -
281
- * @returns {Promise<PaymentOptionsResponse>} - Success response
282
- * @summary: Get All Valid Payment Options
283
- * @description: Use this API to get Get All Valid Payment Options for making payment
1585
+ * @param {RepaymentDetailsSerialiserPayAll} arg.body
1586
+ * @returns {Promise<RepaymentResponse>} - Success response
1587
+ * @summary: API to register repayment details
1588
+ * @description: Use this API to register any repayment record in the db and notify the aggrgator
284
1589
  */
285
- async getPaymentModeRoutes({ refresh, requestType } = {}) {
286
- const { error } = PaymentValidator.getPaymentModeRoutes().validate(
1590
+ async repaymentDetails({ body } = {}) {
1591
+ const { error } = PaymentValidator.repaymentDetails().validate(
287
1592
  {
288
- refresh,
289
- requestType,
1593
+ body,
290
1594
  },
291
1595
  { abortEarly: false, allowUnknown: true }
292
1596
  );
@@ -295,38 +1599,33 @@ class Payment {
295
1599
  }
296
1600
 
297
1601
  // Showing warrnings if extra unknown parameters are found
298
- const {
299
- error: warrning,
300
- } = PaymentValidator.getPaymentModeRoutes().validate(
1602
+ const { error: warrning } = PaymentValidator.repaymentDetails().validate(
301
1603
  {
302
- refresh,
303
- requestType,
1604
+ body,
304
1605
  },
305
1606
  { abortEarly: false, allowUnknown: false }
306
1607
  );
307
1608
  if (warrning) {
308
1609
  Logger({
309
1610
  level: "WARN",
310
- message: "Parameter Validation warrnings for getPaymentModeRoutes",
1611
+ message: "Parameter Validation warrnings for repaymentDetails",
311
1612
  });
312
1613
  Logger({ level: "WARN", message: warrning });
313
1614
  }
314
1615
 
315
1616
  const query_params = {};
316
- query_params["refresh"] = refresh;
317
- query_params["request_type"] = requestType;
318
1617
 
319
1618
  const response = await PlatformAPIClient.execute(
320
1619
  this.config,
321
- "get",
322
- `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/options`,
1620
+ "post",
1621
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/repayment-details`,
323
1622
  query_params,
324
- undefined
1623
+ body
325
1624
  );
326
1625
 
327
1626
  const {
328
1627
  error: res_error,
329
- } = PaymentModel.PaymentOptionsResponse().validate(response, {
1628
+ } = PaymentModel.RepaymentResponse().validate(response, {
330
1629
  abortEarly: false,
331
1630
  allowUnknown: false,
332
1631
  });
@@ -334,7 +1633,7 @@ class Payment {
334
1633
  if (res_error) {
335
1634
  Logger({
336
1635
  level: "WARN",
337
- message: "Response Validation Warnnings for getPaymentModeRoutes",
1636
+ message: "Response Validation Warnnings for repaymentDetails",
338
1637
  });
339
1638
  Logger({ level: "WARN", message: res_error });
340
1639
  }
@@ -344,14 +1643,16 @@ class Payment {
344
1643
 
345
1644
  /**
346
1645
  * @param {Object} arg - Arg object.
347
- * @param {string} arg.orderId -
348
- * @returns {Promise<OrderBeneficiaryResponse>} - Success response
349
- * @summary: List User Beneficiary
350
- * @description: Get all active beneficiary details added by the user for refund
1646
+ * @param {ResendOrCancelPaymentRequest} arg.body
1647
+ * @returns {Promise<ResendOrCancelPaymentResponse>} - Success response
1648
+ * @summary: API to resend and cancel a payment link which was already generated.
1649
+ * @description: Use this API to perform resend or cancel a payment link based on request payload.
351
1650
  */
352
- async getUserBeneficiaries({ orderId } = {}) {
353
- const { error } = PaymentValidator.getUserBeneficiaries().validate(
354
- { orderId },
1651
+ async resendOrCancelPayment({ body } = {}) {
1652
+ const { error } = PaymentValidator.resendOrCancelPayment().validate(
1653
+ {
1654
+ body,
1655
+ },
355
1656
  { abortEarly: false, allowUnknown: true }
356
1657
  );
357
1658
  if (error) {
@@ -361,32 +1662,33 @@ class Payment {
361
1662
  // Showing warrnings if extra unknown parameters are found
362
1663
  const {
363
1664
  error: warrning,
364
- } = PaymentValidator.getUserBeneficiaries().validate(
365
- { orderId },
1665
+ } = PaymentValidator.resendOrCancelPayment().validate(
1666
+ {
1667
+ body,
1668
+ },
366
1669
  { abortEarly: false, allowUnknown: false }
367
1670
  );
368
1671
  if (warrning) {
369
1672
  Logger({
370
1673
  level: "WARN",
371
- message: "Parameter Validation warrnings for getUserBeneficiaries",
1674
+ message: "Parameter Validation warrnings for resendOrCancelPayment",
372
1675
  });
373
1676
  Logger({ level: "WARN", message: warrning });
374
1677
  }
375
1678
 
376
1679
  const query_params = {};
377
- query_params["order_id"] = orderId;
378
1680
 
379
1681
  const response = await PlatformAPIClient.execute(
380
1682
  this.config,
381
- "get",
382
- `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/refund/accounts/user`,
1683
+ "post",
1684
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/cancel`,
383
1685
  query_params,
384
- undefined
1686
+ body
385
1687
  );
386
1688
 
387
1689
  const {
388
1690
  error: res_error,
389
- } = PaymentModel.OrderBeneficiaryResponse().validate(response, {
1691
+ } = PaymentModel.ResendOrCancelPaymentResponse().validate(response, {
390
1692
  abortEarly: false,
391
1693
  allowUnknown: false,
392
1694
  });
@@ -394,7 +1696,7 @@ class Payment {
394
1696
  if (res_error) {
395
1697
  Logger({
396
1698
  level: "WARN",
397
- message: "Response Validation Warnnings for getUserBeneficiaries",
1699
+ message: "Response Validation Warnnings for resendOrCancelPayment",
398
1700
  });
399
1701
  Logger({ level: "WARN", message: res_error });
400
1702
  }
@@ -404,17 +1706,15 @@ class Payment {
404
1706
 
405
1707
  /**
406
1708
  * @param {Object} arg - Arg object.
407
- * @param {string} arg.merchantUserId -
408
- * @param {string} arg.mobileNo -
409
- * @returns {Promise<GetUserCODLimitResponse>} - Success response
410
- * @summary: Get COD limit for user
411
- * @description: Use this API to get user cod limit and reamining limit for the payment
1709
+ * @param {CancelOrResendPaymentLinkRequest} arg.body
1710
+ * @returns {Promise<ResendPaymentLinkResponse>} - Success response
1711
+ * @summary: Resend payment link
1712
+ * @description: Use this API to resend a payment link for the customer
412
1713
  */
413
- async getUserCODlimitRoutes({ merchantUserId, mobileNo } = {}) {
414
- const { error } = PaymentValidator.getUserCODlimitRoutes().validate(
1714
+ async resendPaymentLink({ body } = {}) {
1715
+ const { error } = PaymentValidator.resendPaymentLink().validate(
415
1716
  {
416
- merchantUserId,
417
- mobileNo,
1717
+ body,
418
1718
  },
419
1719
  { abortEarly: false, allowUnknown: true }
420
1720
  );
@@ -423,38 +1723,33 @@ class Payment {
423
1723
  }
424
1724
 
425
1725
  // Showing warrnings if extra unknown parameters are found
426
- const {
427
- error: warrning,
428
- } = PaymentValidator.getUserCODlimitRoutes().validate(
1726
+ const { error: warrning } = PaymentValidator.resendPaymentLink().validate(
429
1727
  {
430
- merchantUserId,
431
- mobileNo,
1728
+ body,
432
1729
  },
433
1730
  { abortEarly: false, allowUnknown: false }
434
1731
  );
435
1732
  if (warrning) {
436
1733
  Logger({
437
1734
  level: "WARN",
438
- message: "Parameter Validation warrnings for getUserCODlimitRoutes",
1735
+ message: "Parameter Validation warrnings for resendPaymentLink",
439
1736
  });
440
1737
  Logger({ level: "WARN", message: warrning });
441
1738
  }
442
1739
 
443
1740
  const query_params = {};
444
- query_params["merchant_user_id"] = merchantUserId;
445
- query_params["mobile_no"] = mobileNo;
446
1741
 
447
1742
  const response = await PlatformAPIClient.execute(
448
1743
  this.config,
449
- "get",
450
- `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/user-cod`,
1744
+ "post",
1745
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/resend-payment-link/`,
451
1746
  query_params,
452
- undefined
1747
+ body
453
1748
  );
454
1749
 
455
1750
  const {
456
1751
  error: res_error,
457
- } = PaymentModel.GetUserCODLimitResponse().validate(response, {
1752
+ } = PaymentModel.ResendPaymentLinkResponse().validate(response, {
458
1753
  abortEarly: false,
459
1754
  allowUnknown: false,
460
1755
  });
@@ -462,7 +1757,7 @@ class Payment {
462
1757
  if (res_error) {
463
1758
  Logger({
464
1759
  level: "WARN",
465
- message: "Response Validation Warnnings for getUserCODlimitRoutes",
1760
+ message: "Response Validation Warnnings for resendPaymentLink",
466
1761
  });
467
1762
  Logger({ level: "WARN", message: res_error });
468
1763
  }
@@ -472,14 +1767,16 @@ class Payment {
472
1767
 
473
1768
  /**
474
1769
  * @param {Object} arg - Arg object.
475
- * @param {string} arg.orderId -
476
- * @returns {Promise<OrderBeneficiaryResponse>} - Success response
477
- * @summary: List Order Beneficiary
478
- * @description: Get all active beneficiary details added by the user for refund
1770
+ * @param {string} arg.aggregator - Aggregator_slug
1771
+ * @returns {Promise<RevokeOAuthToken>} - Success response
1772
+ * @summary: API to Revoke oauth for razorpay partnership
1773
+ * @description: Use this API to Revoke oauth for razorpay partnership
479
1774
  */
480
- async getUserOrderBeneficiaries({ orderId } = {}) {
481
- const { error } = PaymentValidator.getUserOrderBeneficiaries().validate(
482
- { orderId },
1775
+ async revokeOauthToken({ aggregator } = {}) {
1776
+ const { error } = PaymentValidator.revokeOauthToken().validate(
1777
+ {
1778
+ aggregator,
1779
+ },
483
1780
  { abortEarly: false, allowUnknown: true }
484
1781
  );
485
1782
  if (error) {
@@ -487,34 +1784,33 @@ class Payment {
487
1784
  }
488
1785
 
489
1786
  // Showing warrnings if extra unknown parameters are found
490
- const {
491
- error: warrning,
492
- } = PaymentValidator.getUserOrderBeneficiaries().validate(
493
- { orderId },
1787
+ const { error: warrning } = PaymentValidator.revokeOauthToken().validate(
1788
+ {
1789
+ aggregator,
1790
+ },
494
1791
  { abortEarly: false, allowUnknown: false }
495
1792
  );
496
1793
  if (warrning) {
497
1794
  Logger({
498
1795
  level: "WARN",
499
- message: "Parameter Validation warrnings for getUserOrderBeneficiaries",
1796
+ message: "Parameter Validation warrnings for revokeOauthToken",
500
1797
  });
501
1798
  Logger({ level: "WARN", message: warrning });
502
1799
  }
503
1800
 
504
1801
  const query_params = {};
505
- query_params["order_id"] = orderId;
506
1802
 
507
1803
  const response = await PlatformAPIClient.execute(
508
1804
  this.config,
509
- "get",
510
- `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/refund/accounts/order`,
1805
+ "post",
1806
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/revoke/${aggregator}/`,
511
1807
  query_params,
512
1808
  undefined
513
1809
  );
514
1810
 
515
1811
  const {
516
1812
  error: res_error,
517
- } = PaymentModel.OrderBeneficiaryResponse().validate(response, {
1813
+ } = PaymentModel.RevokeOAuthToken().validate(response, {
518
1814
  abortEarly: false,
519
1815
  allowUnknown: false,
520
1816
  });
@@ -522,7 +1818,7 @@ class Payment {
522
1818
  if (res_error) {
523
1819
  Logger({
524
1820
  level: "WARN",
525
- message: "Response Validation Warnnings for getUserOrderBeneficiaries",
1821
+ message: "Response Validation Warnnings for revokeOauthToken",
526
1822
  });
527
1823
  Logger({ level: "WARN", message: res_error });
528
1824
  }
@@ -532,23 +1828,15 @@ class Payment {
532
1828
 
533
1829
  /**
534
1830
  * @param {Object} arg - Arg object.
535
- * @param {string} arg.aggregator - Aggregator
536
- * @param {string} [arg.successRedirectUrl] -
537
- * @param {string} [arg.failureRedirectUrl] -
538
- * @returns {Promise<GetOauthUrlResponse>} - Success response
539
- * @summary: API to Get the url to call for oauth
540
- * @description: Use this API to Get the url to call for oauth.
1831
+ * @param {PaymentGatewayConfigRequest} arg.body
1832
+ * @returns {Promise<PaymentGatewayToBeReviewed>} - Success response
1833
+ * @summary: Save Config Secret For Brand Payment Gateway
1834
+ * @description: Save Config Secret For Brand Payment Gateway
541
1835
  */
542
- async oauthGetUrl({
543
- aggregator,
544
- successRedirectUrl,
545
- failureRedirectUrl,
546
- } = {}) {
547
- const { error } = PaymentValidator.oauthGetUrl().validate(
1836
+ async saveBrandPaymentGatewayConfig({ body } = {}) {
1837
+ const { error } = PaymentValidator.saveBrandPaymentGatewayConfig().validate(
548
1838
  {
549
- aggregator,
550
- successRedirectUrl,
551
- failureRedirectUrl,
1839
+ body,
552
1840
  },
553
1841
  { abortEarly: false, allowUnknown: true }
554
1842
  );
@@ -557,37 +1845,36 @@ class Payment {
557
1845
  }
558
1846
 
559
1847
  // Showing warrnings if extra unknown parameters are found
560
- const { error: warrning } = PaymentValidator.oauthGetUrl().validate(
1848
+ const {
1849
+ error: warrning,
1850
+ } = PaymentValidator.saveBrandPaymentGatewayConfig().validate(
561
1851
  {
562
- aggregator,
563
- successRedirectUrl,
564
- failureRedirectUrl,
1852
+ body,
565
1853
  },
566
1854
  { abortEarly: false, allowUnknown: false }
567
1855
  );
568
1856
  if (warrning) {
569
1857
  Logger({
570
1858
  level: "WARN",
571
- message: "Parameter Validation warrnings for oauthGetUrl",
1859
+ message:
1860
+ "Parameter Validation warrnings for saveBrandPaymentGatewayConfig",
572
1861
  });
573
1862
  Logger({ level: "WARN", message: warrning });
574
1863
  }
575
1864
 
576
1865
  const query_params = {};
577
- query_params["success_redirect_url"] = successRedirectUrl;
578
- query_params["failure_redirect_url"] = failureRedirectUrl;
579
1866
 
580
1867
  const response = await PlatformAPIClient.execute(
581
1868
  this.config,
582
- "get",
583
- `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/onboard/${aggregator}/`,
1869
+ "post",
1870
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/aggregator/request`,
584
1871
  query_params,
585
- undefined
1872
+ body
586
1873
  );
587
1874
 
588
1875
  const {
589
1876
  error: res_error,
590
- } = PaymentModel.GetOauthUrlResponse().validate(response, {
1877
+ } = PaymentModel.PaymentGatewayToBeReviewed().validate(response, {
591
1878
  abortEarly: false,
592
1879
  allowUnknown: false,
593
1880
  });
@@ -595,7 +1882,8 @@ class Payment {
595
1882
  if (res_error) {
596
1883
  Logger({
597
1884
  level: "WARN",
598
- message: "Response Validation Warnnings for oauthGetUrl",
1885
+ message:
1886
+ "Response Validation Warnnings for saveBrandPaymentGatewayConfig",
599
1887
  });
600
1888
  Logger({ level: "WARN", message: res_error });
601
1889
  }
@@ -605,15 +1893,15 @@ class Payment {
605
1893
 
606
1894
  /**
607
1895
  * @param {Object} arg - Arg object.
608
- * @param {string} arg.aggregator - Aggregator_slug
609
- * @returns {Promise<RevokeOAuthToken>} - Success response
610
- * @summary: API to Revoke oauth for razorpay partnership
611
- * @description: Use this API to Revoke oauth for razorpay partnership
1896
+ * @param {SetCODForUserRequest} arg.body
1897
+ * @returns {Promise<SetCODOptionResponse>} - Success response
1898
+ * @summary: Set COD option for user for payment
1899
+ * @description: Use this API to set cod option as true or false for the payment
612
1900
  */
613
- async revokeOauthToken({ aggregator } = {}) {
614
- const { error } = PaymentValidator.revokeOauthToken().validate(
1901
+ async setUserCODlimitRoutes({ body } = {}) {
1902
+ const { error } = PaymentValidator.setUserCODlimitRoutes().validate(
615
1903
  {
616
- aggregator,
1904
+ body,
617
1905
  },
618
1906
  { abortEarly: false, allowUnknown: true }
619
1907
  );
@@ -622,16 +1910,18 @@ class Payment {
622
1910
  }
623
1911
 
624
1912
  // Showing warrnings if extra unknown parameters are found
625
- const { error: warrning } = PaymentValidator.revokeOauthToken().validate(
1913
+ const {
1914
+ error: warrning,
1915
+ } = PaymentValidator.setUserCODlimitRoutes().validate(
626
1916
  {
627
- aggregator,
1917
+ body,
628
1918
  },
629
1919
  { abortEarly: false, allowUnknown: false }
630
1920
  );
631
1921
  if (warrning) {
632
1922
  Logger({
633
1923
  level: "WARN",
634
- message: "Parameter Validation warrnings for revokeOauthToken",
1924
+ message: "Parameter Validation warrnings for setUserCODlimitRoutes",
635
1925
  });
636
1926
  Logger({ level: "WARN", message: warrning });
637
1927
  }
@@ -640,15 +1930,15 @@ class Payment {
640
1930
 
641
1931
  const response = await PlatformAPIClient.execute(
642
1932
  this.config,
643
- "post",
644
- `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/revoke/${aggregator}/`,
1933
+ "put",
1934
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/user-cod`,
645
1935
  query_params,
646
- undefined
1936
+ body
647
1937
  );
648
1938
 
649
1939
  const {
650
1940
  error: res_error,
651
- } = PaymentModel.RevokeOAuthToken().validate(response, {
1941
+ } = PaymentModel.SetCODOptionResponse().validate(response, {
652
1942
  abortEarly: false,
653
1943
  allowUnknown: false,
654
1944
  });
@@ -656,7 +1946,7 @@ class Payment {
656
1946
  if (res_error) {
657
1947
  Logger({
658
1948
  level: "WARN",
659
- message: "Response Validation Warnnings for revokeOauthToken",
1949
+ message: "Response Validation Warnnings for setUserCODlimitRoutes",
660
1950
  });
661
1951
  Logger({ level: "WARN", message: res_error });
662
1952
  }
@@ -666,13 +1956,13 @@ class Payment {
666
1956
 
667
1957
  /**
668
1958
  * @param {Object} arg - Arg object.
669
- * @param {PaymentGatewayConfigRequest} arg.body
670
- * @returns {Promise<PaymentGatewayToBeReviewed>} - Success response
671
- * @summary: Save Config Secret For Brand Payment Gateway
672
- * @description: Save Config Secret For Brand Payment Gateway
1959
+ * @param {EdcAddRequest} arg.body
1960
+ * @returns {Promise<EdcDeviceAddResponse>} - Success response
1961
+ * @summary: map new edc device to the terminal
1962
+ * @description: Use this API to map new edc device to the terminal
673
1963
  */
674
- async saveBrandPaymentGatewayConfig({ body } = {}) {
675
- const { error } = PaymentValidator.saveBrandPaymentGatewayConfig().validate(
1964
+ async updateEdcDevice({ body } = {}) {
1965
+ const { error } = PaymentValidator.updateEdcDevice().validate(
676
1966
  {
677
1967
  body,
678
1968
  },
@@ -683,9 +1973,7 @@ class Payment {
683
1973
  }
684
1974
 
685
1975
  // Showing warrnings if extra unknown parameters are found
686
- const {
687
- error: warrning,
688
- } = PaymentValidator.saveBrandPaymentGatewayConfig().validate(
1976
+ const { error: warrning } = PaymentValidator.updateEdcDevice().validate(
689
1977
  {
690
1978
  body,
691
1979
  },
@@ -694,8 +1982,7 @@ class Payment {
694
1982
  if (warrning) {
695
1983
  Logger({
696
1984
  level: "WARN",
697
- message:
698
- "Parameter Validation warrnings for saveBrandPaymentGatewayConfig",
1985
+ message: "Parameter Validation warrnings for updateEdcDevice",
699
1986
  });
700
1987
  Logger({ level: "WARN", message: warrning });
701
1988
  }
@@ -705,14 +1992,14 @@ class Payment {
705
1992
  const response = await PlatformAPIClient.execute(
706
1993
  this.config,
707
1994
  "post",
708
- `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/aggregator/request`,
1995
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/edc-device`,
709
1996
  query_params,
710
1997
  body
711
1998
  );
712
1999
 
713
2000
  const {
714
2001
  error: res_error,
715
- } = PaymentModel.PaymentGatewayToBeReviewed().validate(response, {
2002
+ } = PaymentModel.EdcDeviceAddResponse().validate(response, {
716
2003
  abortEarly: false,
717
2004
  allowUnknown: false,
718
2005
  });
@@ -720,8 +2007,7 @@ class Payment {
720
2007
  if (res_error) {
721
2008
  Logger({
722
2009
  level: "WARN",
723
- message:
724
- "Response Validation Warnnings for saveBrandPaymentGatewayConfig",
2010
+ message: "Response Validation Warnnings for updateEdcDevice",
725
2011
  });
726
2012
  Logger({ level: "WARN", message: res_error });
727
2013
  }
@@ -731,13 +2017,13 @@ class Payment {
731
2017
 
732
2018
  /**
733
2019
  * @param {Object} arg - Arg object.
734
- * @param {SetCODForUserRequest} arg.body
735
- * @returns {Promise<SetCODOptionResponse>} - Success response
736
- * @summary: Set COD option for user for payment
737
- * @description: Use this API to set cod option as true or false for the payment
2020
+ * @param {ValidateCustomerRequest} arg.body
2021
+ * @returns {Promise<ValidateCustomerResponse>} - Success response
2022
+ * @summary: Validate customer for payment
2023
+ * @description: Use this API to check if the customer is eligible to use credit-line facilities such as Simpl Pay Later and Rupifi.
738
2024
  */
739
- async setUserCODlimitRoutes({ body } = {}) {
740
- const { error } = PaymentValidator.setUserCODlimitRoutes().validate(
2025
+ async verifyCustomerForPayment({ body } = {}) {
2026
+ const { error } = PaymentValidator.verifyCustomerForPayment().validate(
741
2027
  {
742
2028
  body,
743
2029
  },
@@ -750,7 +2036,7 @@ class Payment {
750
2036
  // Showing warrnings if extra unknown parameters are found
751
2037
  const {
752
2038
  error: warrning,
753
- } = PaymentValidator.setUserCODlimitRoutes().validate(
2039
+ } = PaymentValidator.verifyCustomerForPayment().validate(
754
2040
  {
755
2041
  body,
756
2042
  },
@@ -759,7 +2045,7 @@ class Payment {
759
2045
  if (warrning) {
760
2046
  Logger({
761
2047
  level: "WARN",
762
- message: "Parameter Validation warrnings for setUserCODlimitRoutes",
2048
+ message: "Parameter Validation warrnings for verifyCustomerForPayment",
763
2049
  });
764
2050
  Logger({ level: "WARN", message: warrning });
765
2051
  }
@@ -768,15 +2054,15 @@ class Payment {
768
2054
 
769
2055
  const response = await PlatformAPIClient.execute(
770
2056
  this.config,
771
- "put",
772
- `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/user-cod`,
2057
+ "post",
2058
+ `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/customer/validation`,
773
2059
  query_params,
774
2060
  body
775
2061
  );
776
2062
 
777
2063
  const {
778
2064
  error: res_error,
779
- } = PaymentModel.SetCODOptionResponse().validate(response, {
2065
+ } = PaymentModel.ValidateCustomerResponse().validate(response, {
780
2066
  abortEarly: false,
781
2067
  allowUnknown: false,
782
2068
  });
@@ -784,7 +2070,7 @@ class Payment {
784
2070
  if (res_error) {
785
2071
  Logger({
786
2072
  level: "WARN",
787
- message: "Response Validation Warnnings for setUserCODlimitRoutes",
2073
+ message: "Response Validation Warnnings for verifyCustomerForPayment",
788
2074
  });
789
2075
  Logger({ level: "WARN", message: res_error });
790
2076
  }