@gofynd/fdk-client-javascript 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/documentation/application/CART.md +251 -251
  2. package/documentation/application/CATALOG.md +414 -414
  3. package/documentation/application/CONTENT.md +15 -1
  4. package/documentation/application/ORDER.md +290 -290
  5. package/documentation/application/PAYMENT.md +255 -255
  6. package/documentation/application/POSCART.md +297 -297
  7. package/documentation/platform/CART.md +499 -499
  8. package/documentation/platform/CATALOG.md +3088 -2702
  9. package/documentation/platform/COMPANYPROFILE.md +201 -201
  10. package/documentation/platform/CONTENT.md +123 -1
  11. package/documentation/platform/ORDER.md +1233 -1158
  12. package/documentation/platform/PARTNER.md +7 -7
  13. package/documentation/platform/PAYMENT.md +83 -83
  14. package/package.json +1 -1
  15. package/sdk/application/ApplicationConfig.js +1 -1
  16. package/sdk/application/Cart/CartApplicationClient.js +619 -108
  17. package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
  18. package/sdk/application/Cart/CartApplicationModel.js +335 -335
  19. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
  20. package/sdk/application/Catalog/CatalogApplicationClient.js +730 -134
  21. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +21 -21
  22. package/sdk/application/Catalog/CatalogApplicationModel.js +547 -547
  23. package/sdk/application/Common/CommonApplicationClient.js +48 -8
  24. package/sdk/application/Communication/CommunicationApplicationClient.js +75 -14
  25. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
  26. package/sdk/application/Configuration/ConfigurationApplicationClient.js +392 -66
  27. package/sdk/application/Content/ContentApplicationClient.js +444 -76
  28. package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
  29. package/sdk/application/Content/ContentApplicationModel.js +11 -1
  30. package/sdk/application/FileStorage/FileStorageApplicationClient.js +74 -12
  31. package/sdk/application/Lead/LeadApplicationClient.js +164 -30
  32. package/sdk/application/Logistic/LogisticApplicationClient.js +98 -16
  33. package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
  34. package/sdk/application/Order/OrderApplicationClient.js +287 -54
  35. package/sdk/application/Order/OrderApplicationModel.d.ts +19 -19
  36. package/sdk/application/Order/OrderApplicationModel.js +357 -357
  37. package/sdk/application/Payment/PaymentApplicationClient.js +961 -186
  38. package/sdk/application/Payment/PaymentApplicationModel.d.ts +3 -3
  39. package/sdk/application/Payment/PaymentApplicationModel.js +352 -352
  40. package/sdk/application/PosCart/PosCartApplicationClient.js +645 -114
  41. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
  42. package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
  43. package/sdk/application/Rewards/RewardsApplicationClient.js +168 -28
  44. package/sdk/application/Share/ShareApplicationClient.js +157 -32
  45. package/sdk/application/Theme/ThemeApplicationClient.js +94 -16
  46. package/sdk/application/User/UserApplicationClient.js +806 -148
  47. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
  48. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +191 -34
  49. package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
  50. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
  51. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
  52. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +103 -16
  53. package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
  54. package/sdk/platform/Billing/BillingPlatformClient.js +299 -54
  55. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
  56. package/sdk/platform/Cart/CartPlatformApplicationClient.js +409 -72
  57. package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
  58. package/sdk/platform/Cart/CartPlatformModel.js +617 -617
  59. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +167 -114
  60. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1562 -453
  61. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +8 -8
  62. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +39 -39
  63. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +314 -196
  64. package/sdk/platform/Catalog/CatalogPlatformClient.js +2459 -718
  65. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +103 -94
  66. package/sdk/platform/Catalog/CatalogPlatformModel.js +2063 -1797
  67. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +17 -15
  68. package/sdk/platform/Catalog/CatalogPlatformValidator.js +95 -76
  69. package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
  70. package/sdk/platform/Common/CommonPlatformClient.js +51 -8
  71. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
  72. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1000 -168
  73. package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
  74. package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
  75. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
  76. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +335 -54
  77. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +10 -10
  78. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +278 -278
  79. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
  80. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +702 -118
  81. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
  82. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +457 -82
  83. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
  84. package/sdk/platform/Content/ContentPlatformApplicationClient.js +1724 -284
  85. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
  86. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
  87. package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
  88. package/sdk/platform/Content/ContentPlatformModel.js +43 -1
  89. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
  90. package/sdk/platform/Discount/DiscountPlatformClient.js +270 -44
  91. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
  92. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +102 -16
  93. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
  94. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +150 -24
  95. package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
  96. package/sdk/platform/Inventory/InventoryPlatformClient.js +316 -52
  97. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
  98. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +311 -52
  99. package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
  100. package/sdk/platform/Lead/LeadPlatformClient.js +266 -44
  101. package/sdk/platform/OAuthClient.js +8 -8
  102. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
  103. package/sdk/platform/Order/OrderPlatformApplicationClient.js +78 -14
  104. package/sdk/platform/Order/OrderPlatformClient.d.ts +95 -43
  105. package/sdk/platform/Order/OrderPlatformClient.js +1062 -180
  106. package/sdk/platform/Order/OrderPlatformModel.d.ts +64 -60
  107. package/sdk/platform/Order/OrderPlatformModel.js +1481 -1425
  108. package/sdk/platform/Order/OrderPlatformValidator.js +5 -0
  109. package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
  110. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
  111. package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
  112. package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
  113. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
  114. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +287 -56
  115. package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
  116. package/sdk/platform/Payment/PaymentPlatformClient.js +263 -48
  117. package/sdk/platform/Payment/PaymentPlatformModel.js +122 -122
  118. package/sdk/platform/PlatformApplicationClient.d.ts +2959 -2787
  119. package/sdk/platform/PlatformApplicationClient.js +3420 -3212
  120. package/sdk/platform/PlatformClient.d.ts +2959 -2787
  121. package/sdk/platform/PlatformClient.js +3420 -3212
  122. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
  123. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +308 -54
  124. package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
  125. package/sdk/platform/Share/SharePlatformApplicationClient.js +94 -16
  126. package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
  127. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +571 -96
  128. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
  129. package/sdk/platform/User/UserPlatformApplicationClient.js +296 -48
  130. package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
  131. package/sdk/platform/Webhook/WebhookPlatformClient.js +157 -30
  132. package/sdk/public/Configuration/ConfigurationPublicClient.js +51 -8
  133. package/sdk/public/Inventory/InventoryPublicClient.js +149 -26
  134. package/sdk/public/Webhook/WebhookPublicClient.js +51 -10
@@ -3,6 +3,8 @@ const constructUrl = require("../constructUrl");
3
3
  const Paginator = require("../../common/Paginator");
4
4
  const { FDKClientValidationError } = require("../../common/FDKError");
5
5
  const PaymentValidator = require("./PaymentApplicationValidator");
6
+ const PaymentModel = require("./PaymentApplicationModel");
7
+ const { Logger } = require("./../../common/Logger");
6
8
 
7
9
  class Payment {
8
10
  constructor(_conf) {
@@ -100,7 +102,7 @@ class Payment {
100
102
  * @summary: Get payment gateway keys
101
103
  * @description: Use this API to retrieve the payment gateway key, secrets, merchant, SDK/API details to complete a payment at front-end.
102
104
  */
103
- getAggregatorsConfig({ xApiToken, refresh } = {}) {
105
+ async getAggregatorsConfig({ xApiToken, refresh } = {}) {
104
106
  const { error } = PaymentValidator.getAggregatorsConfig().validate(
105
107
  { xApiToken, refresh },
106
108
  { abortEarly: false, allowUnknown: true }
@@ -117,8 +119,11 @@ class Payment {
117
119
  { abortEarly: false, allowUnknown: false }
118
120
  );
119
121
  if (warrning) {
120
- console.log("Parameter Validation warrnings for getAggregatorsConfig");
121
- console.log(warrning);
122
+ Logger({
123
+ level: "WARN",
124
+ message: "Parameter Validation warrnings for getAggregatorsConfig",
125
+ });
126
+ Logger({ level: "WARN", message: warrning });
122
127
  }
123
128
 
124
129
  const query_params = {};
@@ -127,7 +132,7 @@ class Payment {
127
132
  const xHeaders = {};
128
133
  xHeaders["x-api-token"] = xApiToken;
129
134
 
130
- return APIClient.execute(
135
+ const response = await APIClient.execute(
131
136
  this._conf,
132
137
  "get",
133
138
  constructUrl({
@@ -138,6 +143,23 @@ class Payment {
138
143
  undefined,
139
144
  xHeaders
140
145
  );
146
+
147
+ const {
148
+ error: res_error,
149
+ } = PaymentModel.AggregatorsConfigDetailResponse().validate(response, {
150
+ abortEarly: false,
151
+ allowUnknown: false,
152
+ });
153
+
154
+ if (res_error) {
155
+ Logger({
156
+ level: "WARN",
157
+ message: "Response Validation Warnnings for getAggregatorsConfig",
158
+ });
159
+ Logger({ level: "WARN", message: res_error });
160
+ }
161
+
162
+ return response;
141
163
  }
142
164
 
143
165
  /**
@@ -147,7 +169,7 @@ class Payment {
147
169
  * @summary: Attach a saved card to customer.
148
170
  * @description: Use this API to attach a customer's saved card at the payment gateway, such as Stripe, Juspay.
149
171
  */
150
- attachCardToCustomer({ body } = {}) {
172
+ async attachCardToCustomer({ body } = {}) {
151
173
  const { error } = PaymentValidator.attachCardToCustomer().validate(
152
174
  { body },
153
175
  { abortEarly: false, allowUnknown: true }
@@ -164,15 +186,18 @@ class Payment {
164
186
  { abortEarly: false, allowUnknown: false }
165
187
  );
166
188
  if (warrning) {
167
- console.log("Parameter Validation warrnings for attachCardToCustomer");
168
- console.log(warrning);
189
+ Logger({
190
+ level: "WARN",
191
+ message: "Parameter Validation warrnings for attachCardToCustomer",
192
+ });
193
+ Logger({ level: "WARN", message: warrning });
169
194
  }
170
195
 
171
196
  const query_params = {};
172
197
 
173
198
  const xHeaders = {};
174
199
 
175
- return APIClient.execute(
200
+ const response = await APIClient.execute(
176
201
  this._conf,
177
202
  "post",
178
203
  constructUrl({
@@ -183,6 +208,23 @@ class Payment {
183
208
  body,
184
209
  xHeaders
185
210
  );
211
+
212
+ const {
213
+ error: res_error,
214
+ } = PaymentModel.AttachCardsResponse().validate(response, {
215
+ abortEarly: false,
216
+ allowUnknown: false,
217
+ });
218
+
219
+ if (res_error) {
220
+ Logger({
221
+ level: "WARN",
222
+ message: "Response Validation Warnnings for attachCardToCustomer",
223
+ });
224
+ Logger({ level: "WARN", message: res_error });
225
+ }
226
+
227
+ return response;
186
228
  }
187
229
 
188
230
  /**
@@ -192,7 +234,7 @@ class Payment {
192
234
  * @summary: Fetch active payment gateway for card payments
193
235
  * @description: Use this API to retrieve an active payment aggregator along with the Customer ID. This is applicable for cards payments only.
194
236
  */
195
- getActiveCardAggregator({ refresh } = {}) {
237
+ async getActiveCardAggregator({ refresh } = {}) {
196
238
  const { error } = PaymentValidator.getActiveCardAggregator().validate(
197
239
  { refresh },
198
240
  { abortEarly: false, allowUnknown: true }
@@ -209,8 +251,11 @@ class Payment {
209
251
  { abortEarly: false, allowUnknown: false }
210
252
  );
211
253
  if (warrning) {
212
- console.log("Parameter Validation warrnings for getActiveCardAggregator");
213
- console.log(warrning);
254
+ Logger({
255
+ level: "WARN",
256
+ message: "Parameter Validation warrnings for getActiveCardAggregator",
257
+ });
258
+ Logger({ level: "WARN", message: warrning });
214
259
  }
215
260
 
216
261
  const query_params = {};
@@ -218,7 +263,7 @@ class Payment {
218
263
 
219
264
  const xHeaders = {};
220
265
 
221
- return APIClient.execute(
266
+ const response = await APIClient.execute(
222
267
  this._conf,
223
268
  "get",
224
269
  constructUrl({
@@ -229,6 +274,23 @@ class Payment {
229
274
  undefined,
230
275
  xHeaders
231
276
  );
277
+
278
+ const {
279
+ error: res_error,
280
+ } = PaymentModel.ActiveCardPaymentGatewayResponse().validate(response, {
281
+ abortEarly: false,
282
+ allowUnknown: false,
283
+ });
284
+
285
+ if (res_error) {
286
+ Logger({
287
+ level: "WARN",
288
+ message: "Response Validation Warnnings for getActiveCardAggregator",
289
+ });
290
+ Logger({ level: "WARN", message: res_error });
291
+ }
292
+
293
+ return response;
232
294
  }
233
295
 
234
296
  /**
@@ -238,7 +300,7 @@ class Payment {
238
300
  * @summary: Fetch the list of cards saved by the user
239
301
  * @description: Use this API to retrieve a list of cards stored by user from an active payment gateway.
240
302
  */
241
- getActiveUserCards({ forceRefresh } = {}) {
303
+ async getActiveUserCards({ forceRefresh } = {}) {
242
304
  const { error } = PaymentValidator.getActiveUserCards().validate(
243
305
  { forceRefresh },
244
306
  { abortEarly: false, allowUnknown: true }
@@ -253,8 +315,11 @@ class Payment {
253
315
  { abortEarly: false, allowUnknown: false }
254
316
  );
255
317
  if (warrning) {
256
- console.log("Parameter Validation warrnings for getActiveUserCards");
257
- console.log(warrning);
318
+ Logger({
319
+ level: "WARN",
320
+ message: "Parameter Validation warrnings for getActiveUserCards",
321
+ });
322
+ Logger({ level: "WARN", message: warrning });
258
323
  }
259
324
 
260
325
  const query_params = {};
@@ -262,7 +327,7 @@ class Payment {
262
327
 
263
328
  const xHeaders = {};
264
329
 
265
- return APIClient.execute(
330
+ const response = await APIClient.execute(
266
331
  this._conf,
267
332
  "get",
268
333
  constructUrl({
@@ -273,6 +338,23 @@ class Payment {
273
338
  undefined,
274
339
  xHeaders
275
340
  );
341
+
342
+ const {
343
+ error: res_error,
344
+ } = PaymentModel.ListCardsResponse().validate(response, {
345
+ abortEarly: false,
346
+ allowUnknown: false,
347
+ });
348
+
349
+ if (res_error) {
350
+ Logger({
351
+ level: "WARN",
352
+ message: "Response Validation Warnnings for getActiveUserCards",
353
+ });
354
+ Logger({ level: "WARN", message: res_error });
355
+ }
356
+
357
+ return response;
276
358
  }
277
359
 
278
360
  /**
@@ -282,7 +364,7 @@ class Payment {
282
364
  * @summary: Delete a card
283
365
  * @description: Use this API to delete a card added by a user on the payment gateway and clear the cache.
284
366
  */
285
- deleteUserCard({ body } = {}) {
367
+ async deleteUserCard({ body } = {}) {
286
368
  const { error } = PaymentValidator.deleteUserCard().validate(
287
369
  { body },
288
370
  { abortEarly: false, allowUnknown: true }
@@ -297,15 +379,18 @@ class Payment {
297
379
  { abortEarly: false, allowUnknown: false }
298
380
  );
299
381
  if (warrning) {
300
- console.log("Parameter Validation warrnings for deleteUserCard");
301
- console.log(warrning);
382
+ Logger({
383
+ level: "WARN",
384
+ message: "Parameter Validation warrnings for deleteUserCard",
385
+ });
386
+ Logger({ level: "WARN", message: warrning });
302
387
  }
303
388
 
304
389
  const query_params = {};
305
390
 
306
391
  const xHeaders = {};
307
392
 
308
- return APIClient.execute(
393
+ const response = await APIClient.execute(
309
394
  this._conf,
310
395
  "post",
311
396
  constructUrl({
@@ -316,6 +401,23 @@ class Payment {
316
401
  body,
317
402
  xHeaders
318
403
  );
404
+
405
+ const {
406
+ error: res_error,
407
+ } = PaymentModel.DeleteCardsResponse().validate(response, {
408
+ abortEarly: false,
409
+ allowUnknown: false,
410
+ });
411
+
412
+ if (res_error) {
413
+ Logger({
414
+ level: "WARN",
415
+ message: "Response Validation Warnnings for deleteUserCard",
416
+ });
417
+ Logger({ level: "WARN", message: res_error });
418
+ }
419
+
420
+ return response;
319
421
  }
320
422
 
321
423
  /**
@@ -325,7 +427,7 @@ class Payment {
325
427
  * @summary: Validate customer for payment
326
428
  * @description: Use this API to check if the customer is eligible to use credit-line facilities such as Simpl Pay Later and Rupifi.
327
429
  */
328
- verifyCustomerForPayment({ body } = {}) {
430
+ async verifyCustomerForPayment({ body } = {}) {
329
431
  const { error } = PaymentValidator.verifyCustomerForPayment().validate(
330
432
  { body },
331
433
  { abortEarly: false, allowUnknown: true }
@@ -342,17 +444,18 @@ class Payment {
342
444
  { abortEarly: false, allowUnknown: false }
343
445
  );
344
446
  if (warrning) {
345
- console.log(
346
- "Parameter Validation warrnings for verifyCustomerForPayment"
347
- );
348
- console.log(warrning);
447
+ Logger({
448
+ level: "WARN",
449
+ message: "Parameter Validation warrnings for verifyCustomerForPayment",
450
+ });
451
+ Logger({ level: "WARN", message: warrning });
349
452
  }
350
453
 
351
454
  const query_params = {};
352
455
 
353
456
  const xHeaders = {};
354
457
 
355
- return APIClient.execute(
458
+ const response = await APIClient.execute(
356
459
  this._conf,
357
460
  "post",
358
461
  constructUrl({
@@ -363,6 +466,23 @@ class Payment {
363
466
  body,
364
467
  xHeaders
365
468
  );
469
+
470
+ const {
471
+ error: res_error,
472
+ } = PaymentModel.ValidateCustomerResponse().validate(response, {
473
+ abortEarly: false,
474
+ allowUnknown: false,
475
+ });
476
+
477
+ if (res_error) {
478
+ Logger({
479
+ level: "WARN",
480
+ message: "Response Validation Warnnings for verifyCustomerForPayment",
481
+ });
482
+ Logger({ level: "WARN", message: res_error });
483
+ }
484
+
485
+ return response;
366
486
  }
367
487
 
368
488
  /**
@@ -372,7 +492,7 @@ class Payment {
372
492
  * @summary: Verify and charge payment
373
493
  * @description: Use this API to verify and check the status of a payment transaction (server-to-server) made through aggregators like Simpl and Mswipe.
374
494
  */
375
- verifyAndChargePayment({ body } = {}) {
495
+ async verifyAndChargePayment({ body } = {}) {
376
496
  const { error } = PaymentValidator.verifyAndChargePayment().validate(
377
497
  { body },
378
498
  { abortEarly: false, allowUnknown: true }
@@ -389,15 +509,18 @@ class Payment {
389
509
  { abortEarly: false, allowUnknown: false }
390
510
  );
391
511
  if (warrning) {
392
- console.log("Parameter Validation warrnings for verifyAndChargePayment");
393
- console.log(warrning);
512
+ Logger({
513
+ level: "WARN",
514
+ message: "Parameter Validation warrnings for verifyAndChargePayment",
515
+ });
516
+ Logger({ level: "WARN", message: warrning });
394
517
  }
395
518
 
396
519
  const query_params = {};
397
520
 
398
521
  const xHeaders = {};
399
522
 
400
- return APIClient.execute(
523
+ const response = await APIClient.execute(
401
524
  this._conf,
402
525
  "post",
403
526
  constructUrl({
@@ -408,6 +531,23 @@ class Payment {
408
531
  body,
409
532
  xHeaders
410
533
  );
534
+
535
+ const {
536
+ error: res_error,
537
+ } = PaymentModel.ChargeCustomerResponse().validate(response, {
538
+ abortEarly: false,
539
+ allowUnknown: false,
540
+ });
541
+
542
+ if (res_error) {
543
+ Logger({
544
+ level: "WARN",
545
+ message: "Response Validation Warnnings for verifyAndChargePayment",
546
+ });
547
+ Logger({ level: "WARN", message: res_error });
548
+ }
549
+
550
+ return response;
411
551
  }
412
552
 
413
553
  /**
@@ -417,7 +557,7 @@ class Payment {
417
557
  * @summary: Initialize a payment (server-to-server) for UPI and BharatQR
418
558
  * @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.
419
559
  */
420
- initialisePayment({ body } = {}) {
560
+ async initialisePayment({ body } = {}) {
421
561
  const { error } = PaymentValidator.initialisePayment().validate(
422
562
  { body },
423
563
  { abortEarly: false, allowUnknown: true }
@@ -432,15 +572,18 @@ class Payment {
432
572
  { abortEarly: false, allowUnknown: false }
433
573
  );
434
574
  if (warrning) {
435
- console.log("Parameter Validation warrnings for initialisePayment");
436
- console.log(warrning);
575
+ Logger({
576
+ level: "WARN",
577
+ message: "Parameter Validation warrnings for initialisePayment",
578
+ });
579
+ Logger({ level: "WARN", message: warrning });
437
580
  }
438
581
 
439
582
  const query_params = {};
440
583
 
441
584
  const xHeaders = {};
442
585
 
443
- return APIClient.execute(
586
+ const response = await APIClient.execute(
444
587
  this._conf,
445
588
  "post",
446
589
  constructUrl({
@@ -451,6 +594,23 @@ class Payment {
451
594
  body,
452
595
  xHeaders
453
596
  );
597
+
598
+ const {
599
+ error: res_error,
600
+ } = PaymentModel.PaymentInitializationResponse().validate(response, {
601
+ abortEarly: false,
602
+ allowUnknown: false,
603
+ });
604
+
605
+ if (res_error) {
606
+ Logger({
607
+ level: "WARN",
608
+ message: "Response Validation Warnnings for initialisePayment",
609
+ });
610
+ Logger({ level: "WARN", message: res_error });
611
+ }
612
+
613
+ return response;
454
614
  }
455
615
 
456
616
  /**
@@ -460,7 +620,7 @@ class Payment {
460
620
  * @summary: Performs continuous polling to check status of payment on the server
461
621
  * @description: Use this API to perform continuous polling at intervals to check the status of payment until timeout.
462
622
  */
463
- checkAndUpdatePaymentStatus({ body } = {}) {
623
+ async checkAndUpdatePaymentStatus({ body } = {}) {
464
624
  const { error } = PaymentValidator.checkAndUpdatePaymentStatus().validate(
465
625
  { body },
466
626
  { abortEarly: false, allowUnknown: true }
@@ -477,17 +637,19 @@ class Payment {
477
637
  { abortEarly: false, allowUnknown: false }
478
638
  );
479
639
  if (warrning) {
480
- console.log(
481
- "Parameter Validation warrnings for checkAndUpdatePaymentStatus"
482
- );
483
- console.log(warrning);
640
+ Logger({
641
+ level: "WARN",
642
+ message:
643
+ "Parameter Validation warrnings for checkAndUpdatePaymentStatus",
644
+ });
645
+ Logger({ level: "WARN", message: warrning });
484
646
  }
485
647
 
486
648
  const query_params = {};
487
649
 
488
650
  const xHeaders = {};
489
651
 
490
- return APIClient.execute(
652
+ const response = await APIClient.execute(
491
653
  this._conf,
492
654
  "post",
493
655
  constructUrl({
@@ -498,6 +660,24 @@ class Payment {
498
660
  body,
499
661
  xHeaders
500
662
  );
663
+
664
+ const {
665
+ error: res_error,
666
+ } = PaymentModel.PaymentStatusUpdateResponse().validate(response, {
667
+ abortEarly: false,
668
+ allowUnknown: false,
669
+ });
670
+
671
+ if (res_error) {
672
+ Logger({
673
+ level: "WARN",
674
+ message:
675
+ "Response Validation Warnnings for checkAndUpdatePaymentStatus",
676
+ });
677
+ Logger({ level: "WARN", message: res_error });
678
+ }
679
+
680
+ return response;
501
681
  }
502
682
 
503
683
  /**
@@ -517,7 +697,7 @@ class Payment {
517
697
  * @summary: Get applicable payment options
518
698
  * @description: Use this API to get all valid payment options for doing a payment.
519
699
  */
520
- getPaymentModeRoutes({
700
+ async getPaymentModeRoutes({
521
701
  amount,
522
702
  cartId,
523
703
  pincode,
@@ -558,8 +738,11 @@ class Payment {
558
738
  { abortEarly: false, allowUnknown: false }
559
739
  );
560
740
  if (warrning) {
561
- console.log("Parameter Validation warrnings for getPaymentModeRoutes");
562
- console.log(warrning);
741
+ Logger({
742
+ level: "WARN",
743
+ message: "Parameter Validation warrnings for getPaymentModeRoutes",
744
+ });
745
+ Logger({ level: "WARN", message: warrning });
563
746
  }
564
747
 
565
748
  const query_params = {};
@@ -573,7 +756,7 @@ class Payment {
573
756
 
574
757
  const xHeaders = {};
575
758
 
576
- return APIClient.execute(
759
+ const response = await APIClient.execute(
577
760
  this._conf,
578
761
  "get",
579
762
  constructUrl({
@@ -584,6 +767,23 @@ class Payment {
584
767
  undefined,
585
768
  xHeaders
586
769
  );
770
+
771
+ const {
772
+ error: res_error,
773
+ } = PaymentModel.PaymentModeRouteResponse().validate(response, {
774
+ abortEarly: false,
775
+ allowUnknown: false,
776
+ });
777
+
778
+ if (res_error) {
779
+ Logger({
780
+ level: "WARN",
781
+ message: "Response Validation Warnnings for getPaymentModeRoutes",
782
+ });
783
+ Logger({ level: "WARN", message: res_error });
784
+ }
785
+
786
+ return response;
587
787
  }
588
788
 
589
789
  /**
@@ -606,7 +806,7 @@ class Payment {
606
806
  * @summary: Get applicable payment options for Point-of-Sale (POS)
607
807
  * @description: Use this API to get all valid payment options for doing a payment in POS.
608
808
  */
609
- getPosPaymentModeRoutes({
809
+ async getPosPaymentModeRoutes({
610
810
  amount,
611
811
  cartId,
612
812
  pincode,
@@ -650,8 +850,11 @@ class Payment {
650
850
  { abortEarly: false, allowUnknown: false }
651
851
  );
652
852
  if (warrning) {
653
- console.log("Parameter Validation warrnings for getPosPaymentModeRoutes");
654
- console.log(warrning);
853
+ Logger({
854
+ level: "WARN",
855
+ message: "Parameter Validation warrnings for getPosPaymentModeRoutes",
856
+ });
857
+ Logger({ level: "WARN", message: warrning });
655
858
  }
656
859
 
657
860
  const query_params = {};
@@ -666,7 +869,7 @@ class Payment {
666
869
 
667
870
  const xHeaders = {};
668
871
 
669
- return APIClient.execute(
872
+ const response = await APIClient.execute(
670
873
  this._conf,
671
874
  "get",
672
875
  constructUrl({
@@ -677,6 +880,23 @@ class Payment {
677
880
  undefined,
678
881
  xHeaders
679
882
  );
883
+
884
+ const {
885
+ error: res_error,
886
+ } = PaymentModel.PaymentModeRouteResponse().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 getPosPaymentModeRoutes",
895
+ });
896
+ Logger({ level: "WARN", message: res_error });
897
+ }
898
+
899
+ return response;
680
900
  }
681
901
 
682
902
  /**
@@ -685,7 +905,7 @@ class Payment {
685
905
  * @summary: Get CreditLine Offer
686
906
  * @description: Get CreditLine Offer if user is tentatively approved by rupifi
687
907
  */
688
- getRupifiBannerDetails({} = {}) {
908
+ async getRupifiBannerDetails({} = {}) {
689
909
  const { error } = PaymentValidator.getRupifiBannerDetails().validate(
690
910
  {},
691
911
  { abortEarly: false, allowUnknown: true }
@@ -702,15 +922,18 @@ class Payment {
702
922
  { abortEarly: false, allowUnknown: false }
703
923
  );
704
924
  if (warrning) {
705
- console.log("Parameter Validation warrnings for getRupifiBannerDetails");
706
- console.log(warrning);
925
+ Logger({
926
+ level: "WARN",
927
+ message: "Parameter Validation warrnings for getRupifiBannerDetails",
928
+ });
929
+ Logger({ level: "WARN", message: warrning });
707
930
  }
708
931
 
709
932
  const query_params = {};
710
933
 
711
934
  const xHeaders = {};
712
935
 
713
- return APIClient.execute(
936
+ const response = await APIClient.execute(
714
937
  this._conf,
715
938
  "get",
716
939
  constructUrl({
@@ -721,6 +944,23 @@ class Payment {
721
944
  undefined,
722
945
  xHeaders
723
946
  );
947
+
948
+ const {
949
+ error: res_error,
950
+ } = PaymentModel.RupifiBannerResponse().validate(response, {
951
+ abortEarly: false,
952
+ allowUnknown: false,
953
+ });
954
+
955
+ if (res_error) {
956
+ Logger({
957
+ level: "WARN",
958
+ message: "Response Validation Warnnings for getRupifiBannerDetails",
959
+ });
960
+ Logger({ level: "WARN", message: res_error });
961
+ }
962
+
963
+ return response;
724
964
  }
725
965
 
726
966
  /**
@@ -729,7 +969,7 @@ class Payment {
729
969
  * @summary: Get Epaylater Enabled
730
970
  * @description: Get Epaylater Enabled if user is tentatively approved by epaylater
731
971
  */
732
- getEpaylaterBannerDetails({} = {}) {
972
+ async getEpaylaterBannerDetails({} = {}) {
733
973
  const { error } = PaymentValidator.getEpaylaterBannerDetails().validate(
734
974
  {},
735
975
  { abortEarly: false, allowUnknown: true }
@@ -746,17 +986,18 @@ class Payment {
746
986
  { abortEarly: false, allowUnknown: false }
747
987
  );
748
988
  if (warrning) {
749
- console.log(
750
- "Parameter Validation warrnings for getEpaylaterBannerDetails"
751
- );
752
- console.log(warrning);
989
+ Logger({
990
+ level: "WARN",
991
+ message: "Parameter Validation warrnings for getEpaylaterBannerDetails",
992
+ });
993
+ Logger({ level: "WARN", message: warrning });
753
994
  }
754
995
 
755
996
  const query_params = {};
756
997
 
757
998
  const xHeaders = {};
758
999
 
759
- return APIClient.execute(
1000
+ const response = await APIClient.execute(
760
1001
  this._conf,
761
1002
  "get",
762
1003
  constructUrl({
@@ -767,6 +1008,23 @@ class Payment {
767
1008
  undefined,
768
1009
  xHeaders
769
1010
  );
1011
+
1012
+ const {
1013
+ error: res_error,
1014
+ } = PaymentModel.EpaylaterBannerResponse().validate(response, {
1015
+ abortEarly: false,
1016
+ allowUnknown: false,
1017
+ });
1018
+
1019
+ if (res_error) {
1020
+ Logger({
1021
+ level: "WARN",
1022
+ message: "Response Validation Warnnings for getEpaylaterBannerDetails",
1023
+ });
1024
+ Logger({ level: "WARN", message: res_error });
1025
+ }
1026
+
1027
+ return response;
770
1028
  }
771
1029
 
772
1030
  /**
@@ -776,7 +1034,7 @@ class Payment {
776
1034
  * @summary: API to resend and cancel a payment link which was already generated.
777
1035
  * @description: Use this API to perform resend or cancel a payment link based on request payload.
778
1036
  */
779
- resendOrCancelPayment({ body } = {}) {
1037
+ async resendOrCancelPayment({ body } = {}) {
780
1038
  const { error } = PaymentValidator.resendOrCancelPayment().validate(
781
1039
  { body },
782
1040
  { abortEarly: false, allowUnknown: true }
@@ -793,15 +1051,18 @@ class Payment {
793
1051
  { abortEarly: false, allowUnknown: false }
794
1052
  );
795
1053
  if (warrning) {
796
- console.log("Parameter Validation warrnings for resendOrCancelPayment");
797
- console.log(warrning);
1054
+ Logger({
1055
+ level: "WARN",
1056
+ message: "Parameter Validation warrnings for resendOrCancelPayment",
1057
+ });
1058
+ Logger({ level: "WARN", message: warrning });
798
1059
  }
799
1060
 
800
1061
  const query_params = {};
801
1062
 
802
1063
  const xHeaders = {};
803
1064
 
804
- return APIClient.execute(
1065
+ const response = await APIClient.execute(
805
1066
  this._conf,
806
1067
  "post",
807
1068
  constructUrl({
@@ -812,6 +1073,23 @@ class Payment {
812
1073
  body,
813
1074
  xHeaders
814
1075
  );
1076
+
1077
+ const {
1078
+ error: res_error,
1079
+ } = PaymentModel.ResendOrCancelPaymentResponse().validate(response, {
1080
+ abortEarly: false,
1081
+ allowUnknown: false,
1082
+ });
1083
+
1084
+ if (res_error) {
1085
+ Logger({
1086
+ level: "WARN",
1087
+ message: "Response Validation Warnnings for resendOrCancelPayment",
1088
+ });
1089
+ Logger({ level: "WARN", message: res_error });
1090
+ }
1091
+
1092
+ return response;
815
1093
  }
816
1094
 
817
1095
  /**
@@ -821,7 +1099,7 @@ class Payment {
821
1099
  * @summary: Convert base64 string to HTML form
822
1100
  * @description: Use this API to decode base64 html form to plain HTML string.
823
1101
  */
824
- renderHTML({ body } = {}) {
1102
+ async renderHTML({ body } = {}) {
825
1103
  const { error } = PaymentValidator.renderHTML().validate(
826
1104
  { body },
827
1105
  { abortEarly: false, allowUnknown: true }
@@ -836,15 +1114,18 @@ class Payment {
836
1114
  { abortEarly: false, allowUnknown: false }
837
1115
  );
838
1116
  if (warrning) {
839
- console.log("Parameter Validation warrnings for renderHTML");
840
- console.log(warrning);
1117
+ Logger({
1118
+ level: "WARN",
1119
+ message: "Parameter Validation warrnings for renderHTML",
1120
+ });
1121
+ Logger({ level: "WARN", message: warrning });
841
1122
  }
842
1123
 
843
1124
  const query_params = {};
844
1125
 
845
1126
  const xHeaders = {};
846
1127
 
847
- return APIClient.execute(
1128
+ const response = await APIClient.execute(
848
1129
  this._conf,
849
1130
  "post",
850
1131
  constructUrl({
@@ -855,6 +1136,23 @@ class Payment {
855
1136
  body,
856
1137
  xHeaders
857
1138
  );
1139
+
1140
+ const {
1141
+ error: res_error,
1142
+ } = PaymentModel.renderHTMLResponse().validate(response, {
1143
+ abortEarly: false,
1144
+ allowUnknown: false,
1145
+ });
1146
+
1147
+ if (res_error) {
1148
+ Logger({
1149
+ level: "WARN",
1150
+ message: "Response Validation Warnnings for renderHTML",
1151
+ });
1152
+ Logger({ level: "WARN", message: res_error });
1153
+ }
1154
+
1155
+ return response;
858
1156
  }
859
1157
 
860
1158
  /**
@@ -864,7 +1162,7 @@ class Payment {
864
1162
  * @summary: API to Validate UPI ID
865
1163
  * @description: API to Validate UPI ID
866
1164
  */
867
- validateVPA({ body } = {}) {
1165
+ async validateVPA({ body } = {}) {
868
1166
  const { error } = PaymentValidator.validateVPA().validate(
869
1167
  { body },
870
1168
  { abortEarly: false, allowUnknown: true }
@@ -879,15 +1177,18 @@ class Payment {
879
1177
  { abortEarly: false, allowUnknown: false }
880
1178
  );
881
1179
  if (warrning) {
882
- console.log("Parameter Validation warrnings for validateVPA");
883
- console.log(warrning);
1180
+ Logger({
1181
+ level: "WARN",
1182
+ message: "Parameter Validation warrnings for validateVPA",
1183
+ });
1184
+ Logger({ level: "WARN", message: warrning });
884
1185
  }
885
1186
 
886
1187
  const query_params = {};
887
1188
 
888
1189
  const xHeaders = {};
889
1190
 
890
- return APIClient.execute(
1191
+ const response = await APIClient.execute(
891
1192
  this._conf,
892
1193
  "post",
893
1194
  constructUrl({
@@ -898,6 +1199,23 @@ class Payment {
898
1199
  body,
899
1200
  xHeaders
900
1201
  );
1202
+
1203
+ const {
1204
+ error: res_error,
1205
+ } = PaymentModel.ValidateVPAResponse().validate(response, {
1206
+ abortEarly: false,
1207
+ allowUnknown: false,
1208
+ });
1209
+
1210
+ if (res_error) {
1211
+ Logger({
1212
+ level: "WARN",
1213
+ message: "Response Validation Warnnings for validateVPA",
1214
+ });
1215
+ Logger({ level: "WARN", message: res_error });
1216
+ }
1217
+
1218
+ return response;
901
1219
  }
902
1220
 
903
1221
  /**
@@ -906,7 +1224,7 @@ class Payment {
906
1224
  * @summary: Lists the mode of refund
907
1225
  * @description: Use this API to retrieve eligible refund modes (such as Netbanking) and add the beneficiary details.
908
1226
  */
909
- getActiveRefundTransferModes({} = {}) {
1227
+ async getActiveRefundTransferModes({} = {}) {
910
1228
  const { error } = PaymentValidator.getActiveRefundTransferModes().validate(
911
1229
  {},
912
1230
  { abortEarly: false, allowUnknown: true }
@@ -923,17 +1241,19 @@ class Payment {
923
1241
  { abortEarly: false, allowUnknown: false }
924
1242
  );
925
1243
  if (warrning) {
926
- console.log(
927
- "Parameter Validation warrnings for getActiveRefundTransferModes"
928
- );
929
- console.log(warrning);
1244
+ Logger({
1245
+ level: "WARN",
1246
+ message:
1247
+ "Parameter Validation warrnings for getActiveRefundTransferModes",
1248
+ });
1249
+ Logger({ level: "WARN", message: warrning });
930
1250
  }
931
1251
 
932
1252
  const query_params = {};
933
1253
 
934
1254
  const xHeaders = {};
935
1255
 
936
- return APIClient.execute(
1256
+ const response = await APIClient.execute(
937
1257
  this._conf,
938
1258
  "get",
939
1259
  constructUrl({
@@ -944,6 +1264,24 @@ class Payment {
944
1264
  undefined,
945
1265
  xHeaders
946
1266
  );
1267
+
1268
+ const {
1269
+ error: res_error,
1270
+ } = PaymentModel.TransferModeResponse().validate(response, {
1271
+ abortEarly: false,
1272
+ allowUnknown: false,
1273
+ });
1274
+
1275
+ if (res_error) {
1276
+ Logger({
1277
+ level: "WARN",
1278
+ message:
1279
+ "Response Validation Warnnings for getActiveRefundTransferModes",
1280
+ });
1281
+ Logger({ level: "WARN", message: res_error });
1282
+ }
1283
+
1284
+ return response;
947
1285
  }
948
1286
 
949
1287
  /**
@@ -953,7 +1291,7 @@ class Payment {
953
1291
  * @summary: Enable/Disable a mode for transferring a refund
954
1292
  * @description: Activate or Deactivate Transfer Mode to collect Beneficiary Details for Refund
955
1293
  */
956
- enableOrDisableRefundTransferMode({ body } = {}) {
1294
+ async enableOrDisableRefundTransferMode({ body } = {}) {
957
1295
  const {
958
1296
  error,
959
1297
  } = PaymentValidator.enableOrDisableRefundTransferMode().validate(
@@ -972,17 +1310,19 @@ class Payment {
972
1310
  { abortEarly: false, allowUnknown: false }
973
1311
  );
974
1312
  if (warrning) {
975
- console.log(
976
- "Parameter Validation warrnings for enableOrDisableRefundTransferMode"
977
- );
978
- console.log(warrning);
1313
+ Logger({
1314
+ level: "WARN",
1315
+ message:
1316
+ "Parameter Validation warrnings for enableOrDisableRefundTransferMode",
1317
+ });
1318
+ Logger({ level: "WARN", message: warrning });
979
1319
  }
980
1320
 
981
1321
  const query_params = {};
982
1322
 
983
1323
  const xHeaders = {};
984
1324
 
985
- return APIClient.execute(
1325
+ const response = await APIClient.execute(
986
1326
  this._conf,
987
1327
  "put",
988
1328
  constructUrl({
@@ -993,6 +1333,24 @@ class Payment {
993
1333
  body,
994
1334
  xHeaders
995
1335
  );
1336
+
1337
+ const {
1338
+ error: res_error,
1339
+ } = PaymentModel.UpdateRefundTransferModeResponse().validate(response, {
1340
+ abortEarly: false,
1341
+ allowUnknown: false,
1342
+ });
1343
+
1344
+ if (res_error) {
1345
+ Logger({
1346
+ level: "WARN",
1347
+ message:
1348
+ "Response Validation Warnnings for enableOrDisableRefundTransferMode",
1349
+ });
1350
+ Logger({ level: "WARN", message: res_error });
1351
+ }
1352
+
1353
+ return response;
996
1354
  }
997
1355
 
998
1356
  /**
@@ -1003,7 +1361,7 @@ class Payment {
1003
1361
  * @summary: Lists the beneficiary of a refund
1004
1362
  * @description: Use this API to get the details of all active beneficiary added by a user for refund.
1005
1363
  */
1006
- getUserBeneficiariesDetail({ orderId } = {}) {
1364
+ async getUserBeneficiariesDetail({ orderId } = {}) {
1007
1365
  const { error } = PaymentValidator.getUserBeneficiariesDetail().validate(
1008
1366
  { orderId },
1009
1367
  { abortEarly: false, allowUnknown: true }
@@ -1020,10 +1378,12 @@ class Payment {
1020
1378
  { abortEarly: false, allowUnknown: false }
1021
1379
  );
1022
1380
  if (warrning) {
1023
- console.log(
1024
- "Parameter Validation warrnings for getUserBeneficiariesDetail"
1025
- );
1026
- console.log(warrning);
1381
+ Logger({
1382
+ level: "WARN",
1383
+ message:
1384
+ "Parameter Validation warrnings for getUserBeneficiariesDetail",
1385
+ });
1386
+ Logger({ level: "WARN", message: warrning });
1027
1387
  }
1028
1388
 
1029
1389
  const query_params = {};
@@ -1031,7 +1391,7 @@ class Payment {
1031
1391
 
1032
1392
  const xHeaders = {};
1033
1393
 
1034
- return APIClient.execute(
1394
+ const response = await APIClient.execute(
1035
1395
  this._conf,
1036
1396
  "get",
1037
1397
  constructUrl({
@@ -1042,6 +1402,23 @@ class Payment {
1042
1402
  undefined,
1043
1403
  xHeaders
1044
1404
  );
1405
+
1406
+ const {
1407
+ error: res_error,
1408
+ } = PaymentModel.OrderBeneficiaryResponse().validate(response, {
1409
+ abortEarly: false,
1410
+ allowUnknown: false,
1411
+ });
1412
+
1413
+ if (res_error) {
1414
+ Logger({
1415
+ level: "WARN",
1416
+ message: "Response Validation Warnnings for getUserBeneficiariesDetail",
1417
+ });
1418
+ Logger({ level: "WARN", message: res_error });
1419
+ }
1420
+
1421
+ return response;
1045
1422
  }
1046
1423
 
1047
1424
  /**
@@ -1052,7 +1429,7 @@ class Payment {
1052
1429
  * @summary: Verify IFSC Code
1053
1430
  * @description: Use this API to check whether the 11-digit IFSC code is valid and to fetch the bank details for refund.
1054
1431
  */
1055
- verifyIfscCode({ ifscCode } = {}) {
1432
+ async verifyIfscCode({ ifscCode } = {}) {
1056
1433
  const { error } = PaymentValidator.verifyIfscCode().validate(
1057
1434
  { ifscCode },
1058
1435
  { abortEarly: false, allowUnknown: true }
@@ -1067,8 +1444,11 @@ class Payment {
1067
1444
  { abortEarly: false, allowUnknown: false }
1068
1445
  );
1069
1446
  if (warrning) {
1070
- console.log("Parameter Validation warrnings for verifyIfscCode");
1071
- console.log(warrning);
1447
+ Logger({
1448
+ level: "WARN",
1449
+ message: "Parameter Validation warrnings for verifyIfscCode",
1450
+ });
1451
+ Logger({ level: "WARN", message: warrning });
1072
1452
  }
1073
1453
 
1074
1454
  const query_params = {};
@@ -1076,7 +1456,7 @@ class Payment {
1076
1456
 
1077
1457
  const xHeaders = {};
1078
1458
 
1079
- return APIClient.execute(
1459
+ const response = await APIClient.execute(
1080
1460
  this._conf,
1081
1461
  "get",
1082
1462
  constructUrl({
@@ -1087,6 +1467,23 @@ class Payment {
1087
1467
  undefined,
1088
1468
  xHeaders
1089
1469
  );
1470
+
1471
+ const {
1472
+ error: res_error,
1473
+ } = PaymentModel.IfscCodeResponse().validate(response, {
1474
+ abortEarly: false,
1475
+ allowUnknown: false,
1476
+ });
1477
+
1478
+ if (res_error) {
1479
+ Logger({
1480
+ level: "WARN",
1481
+ message: "Response Validation Warnnings for verifyIfscCode",
1482
+ });
1483
+ Logger({ level: "WARN", message: res_error });
1484
+ }
1485
+
1486
+ return response;
1090
1487
  }
1091
1488
 
1092
1489
  /**
@@ -1097,7 +1494,7 @@ class Payment {
1097
1494
  * @summary: Lists the beneficiary of a refund
1098
1495
  * @description: Use this API to get the details of all active beneficiary added by a user for refund.
1099
1496
  */
1100
- getOrderBeneficiariesDetail({ orderId } = {}) {
1497
+ async getOrderBeneficiariesDetail({ orderId } = {}) {
1101
1498
  const { error } = PaymentValidator.getOrderBeneficiariesDetail().validate(
1102
1499
  { orderId },
1103
1500
  { abortEarly: false, allowUnknown: true }
@@ -1114,10 +1511,12 @@ class Payment {
1114
1511
  { abortEarly: false, allowUnknown: false }
1115
1512
  );
1116
1513
  if (warrning) {
1117
- console.log(
1118
- "Parameter Validation warrnings for getOrderBeneficiariesDetail"
1119
- );
1120
- console.log(warrning);
1514
+ Logger({
1515
+ level: "WARN",
1516
+ message:
1517
+ "Parameter Validation warrnings for getOrderBeneficiariesDetail",
1518
+ });
1519
+ Logger({ level: "WARN", message: warrning });
1121
1520
  }
1122
1521
 
1123
1522
  const query_params = {};
@@ -1125,7 +1524,7 @@ class Payment {
1125
1524
 
1126
1525
  const xHeaders = {};
1127
1526
 
1128
- return APIClient.execute(
1527
+ const response = await APIClient.execute(
1129
1528
  this._conf,
1130
1529
  "get",
1131
1530
  constructUrl({
@@ -1136,6 +1535,24 @@ class Payment {
1136
1535
  undefined,
1137
1536
  xHeaders
1138
1537
  );
1538
+
1539
+ const {
1540
+ error: res_error,
1541
+ } = PaymentModel.OrderBeneficiaryResponse().validate(response, {
1542
+ abortEarly: false,
1543
+ allowUnknown: false,
1544
+ });
1545
+
1546
+ if (res_error) {
1547
+ Logger({
1548
+ level: "WARN",
1549
+ message:
1550
+ "Response Validation Warnnings for getOrderBeneficiariesDetail",
1551
+ });
1552
+ Logger({ level: "WARN", message: res_error });
1553
+ }
1554
+
1555
+ return response;
1139
1556
  }
1140
1557
 
1141
1558
  /**
@@ -1145,7 +1562,7 @@ class Payment {
1145
1562
  * @summary: Verify the beneficiary details using OTP
1146
1563
  * @description: Use this API to perform an OTP validation before saving the beneficiary details added for a refund.
1147
1564
  */
1148
- verifyOtpAndAddBeneficiaryForBank({ body } = {}) {
1565
+ async verifyOtpAndAddBeneficiaryForBank({ body } = {}) {
1149
1566
  const {
1150
1567
  error,
1151
1568
  } = PaymentValidator.verifyOtpAndAddBeneficiaryForBank().validate(
@@ -1164,17 +1581,19 @@ class Payment {
1164
1581
  { abortEarly: false, allowUnknown: false }
1165
1582
  );
1166
1583
  if (warrning) {
1167
- console.log(
1168
- "Parameter Validation warrnings for verifyOtpAndAddBeneficiaryForBank"
1169
- );
1170
- console.log(warrning);
1584
+ Logger({
1585
+ level: "WARN",
1586
+ message:
1587
+ "Parameter Validation warrnings for verifyOtpAndAddBeneficiaryForBank",
1588
+ });
1589
+ Logger({ level: "WARN", message: warrning });
1171
1590
  }
1172
1591
 
1173
1592
  const query_params = {};
1174
1593
 
1175
1594
  const xHeaders = {};
1176
1595
 
1177
- return APIClient.execute(
1596
+ const response = await APIClient.execute(
1178
1597
  this._conf,
1179
1598
  "post",
1180
1599
  constructUrl({
@@ -1185,6 +1604,24 @@ class Payment {
1185
1604
  body,
1186
1605
  xHeaders
1187
1606
  );
1607
+
1608
+ const {
1609
+ error: res_error,
1610
+ } = PaymentModel.AddBeneficiaryViaOtpVerificationResponse().validate(
1611
+ response,
1612
+ { abortEarly: false, allowUnknown: false }
1613
+ );
1614
+
1615
+ if (res_error) {
1616
+ Logger({
1617
+ level: "WARN",
1618
+ message:
1619
+ "Response Validation Warnnings for verifyOtpAndAddBeneficiaryForBank",
1620
+ });
1621
+ Logger({ level: "WARN", message: res_error });
1622
+ }
1623
+
1624
+ return response;
1188
1625
  }
1189
1626
 
1190
1627
  /**
@@ -1194,7 +1631,7 @@ class Payment {
1194
1631
  * @summary: Save bank details for cancelled/returned order
1195
1632
  * @description: Use this API to save the bank details for a returned or cancelled order to refund the amount.
1196
1633
  */
1197
- addBeneficiaryDetails({ body } = {}) {
1634
+ async addBeneficiaryDetails({ body } = {}) {
1198
1635
  const { error } = PaymentValidator.addBeneficiaryDetails().validate(
1199
1636
  { body },
1200
1637
  { abortEarly: false, allowUnknown: true }
@@ -1211,15 +1648,18 @@ class Payment {
1211
1648
  { abortEarly: false, allowUnknown: false }
1212
1649
  );
1213
1650
  if (warrning) {
1214
- console.log("Parameter Validation warrnings for addBeneficiaryDetails");
1215
- console.log(warrning);
1651
+ Logger({
1652
+ level: "WARN",
1653
+ message: "Parameter Validation warrnings for addBeneficiaryDetails",
1654
+ });
1655
+ Logger({ level: "WARN", message: warrning });
1216
1656
  }
1217
1657
 
1218
1658
  const query_params = {};
1219
1659
 
1220
1660
  const xHeaders = {};
1221
1661
 
1222
- return APIClient.execute(
1662
+ const response = await APIClient.execute(
1223
1663
  this._conf,
1224
1664
  "post",
1225
1665
  constructUrl({
@@ -1230,6 +1670,23 @@ class Payment {
1230
1670
  body,
1231
1671
  xHeaders
1232
1672
  );
1673
+
1674
+ const {
1675
+ error: res_error,
1676
+ } = PaymentModel.RefundAccountResponse().validate(response, {
1677
+ abortEarly: false,
1678
+ allowUnknown: false,
1679
+ });
1680
+
1681
+ if (res_error) {
1682
+ Logger({
1683
+ level: "WARN",
1684
+ message: "Response Validation Warnnings for addBeneficiaryDetails",
1685
+ });
1686
+ Logger({ level: "WARN", message: res_error });
1687
+ }
1688
+
1689
+ return response;
1233
1690
  }
1234
1691
 
1235
1692
  /**
@@ -1239,7 +1696,7 @@ class Payment {
1239
1696
  * @summary: Save bank details for cancelled/returned order
1240
1697
  * @description: Use this API to save bank details for returned/cancelled order to refund amount in his account.
1241
1698
  */
1242
- addRefundBankAccountUsingOTP({ body } = {}) {
1699
+ async addRefundBankAccountUsingOTP({ body } = {}) {
1243
1700
  const { error } = PaymentValidator.addRefundBankAccountUsingOTP().validate(
1244
1701
  { body },
1245
1702
  { abortEarly: false, allowUnknown: true }
@@ -1256,17 +1713,19 @@ class Payment {
1256
1713
  { abortEarly: false, allowUnknown: false }
1257
1714
  );
1258
1715
  if (warrning) {
1259
- console.log(
1260
- "Parameter Validation warrnings for addRefundBankAccountUsingOTP"
1261
- );
1262
- console.log(warrning);
1716
+ Logger({
1717
+ level: "WARN",
1718
+ message:
1719
+ "Parameter Validation warrnings for addRefundBankAccountUsingOTP",
1720
+ });
1721
+ Logger({ level: "WARN", message: warrning });
1263
1722
  }
1264
1723
 
1265
1724
  const query_params = {};
1266
1725
 
1267
1726
  const xHeaders = {};
1268
1727
 
1269
- return APIClient.execute(
1728
+ const response = await APIClient.execute(
1270
1729
  this._conf,
1271
1730
  "post",
1272
1731
  constructUrl({
@@ -1277,6 +1736,24 @@ class Payment {
1277
1736
  body,
1278
1737
  xHeaders
1279
1738
  );
1739
+
1740
+ const {
1741
+ error: res_error,
1742
+ } = PaymentModel.RefundAccountResponse().validate(response, {
1743
+ abortEarly: false,
1744
+ allowUnknown: false,
1745
+ });
1746
+
1747
+ if (res_error) {
1748
+ Logger({
1749
+ level: "WARN",
1750
+ message:
1751
+ "Response Validation Warnnings for addRefundBankAccountUsingOTP",
1752
+ });
1753
+ Logger({ level: "WARN", message: res_error });
1754
+ }
1755
+
1756
+ return response;
1280
1757
  }
1281
1758
 
1282
1759
  /**
@@ -1286,7 +1763,7 @@ class Payment {
1286
1763
  * @summary: Send OTP on adding a wallet beneficiary
1287
1764
  * @description: Use this API to send an OTP while adding a wallet beneficiary by mobile no. verification.
1288
1765
  */
1289
- verifyOtpAndAddBeneficiaryForWallet({ body } = {}) {
1766
+ async verifyOtpAndAddBeneficiaryForWallet({ body } = {}) {
1290
1767
  const {
1291
1768
  error,
1292
1769
  } = PaymentValidator.verifyOtpAndAddBeneficiaryForWallet().validate(
@@ -1305,17 +1782,19 @@ class Payment {
1305
1782
  { abortEarly: false, allowUnknown: false }
1306
1783
  );
1307
1784
  if (warrning) {
1308
- console.log(
1309
- "Parameter Validation warrnings for verifyOtpAndAddBeneficiaryForWallet"
1310
- );
1311
- console.log(warrning);
1785
+ Logger({
1786
+ level: "WARN",
1787
+ message:
1788
+ "Parameter Validation warrnings for verifyOtpAndAddBeneficiaryForWallet",
1789
+ });
1790
+ Logger({ level: "WARN", message: warrning });
1312
1791
  }
1313
1792
 
1314
1793
  const query_params = {};
1315
1794
 
1316
1795
  const xHeaders = {};
1317
1796
 
1318
- return APIClient.execute(
1797
+ const response = await APIClient.execute(
1319
1798
  this._conf,
1320
1799
  "post",
1321
1800
  constructUrl({
@@ -1326,6 +1805,24 @@ class Payment {
1326
1805
  body,
1327
1806
  xHeaders
1328
1807
  );
1808
+
1809
+ const {
1810
+ error: res_error,
1811
+ } = PaymentModel.WalletOtpResponse().validate(response, {
1812
+ abortEarly: false,
1813
+ allowUnknown: false,
1814
+ });
1815
+
1816
+ if (res_error) {
1817
+ Logger({
1818
+ level: "WARN",
1819
+ message:
1820
+ "Response Validation Warnnings for verifyOtpAndAddBeneficiaryForWallet",
1821
+ });
1822
+ Logger({ level: "WARN", message: res_error });
1823
+ }
1824
+
1825
+ return response;
1329
1826
  }
1330
1827
 
1331
1828
  /**
@@ -1335,7 +1832,7 @@ class Payment {
1335
1832
  * @summary: Set a default beneficiary for a refund
1336
1833
  * @description: Use this API to set a default beneficiary for getting a refund.
1337
1834
  */
1338
- updateDefaultBeneficiary({ body } = {}) {
1835
+ async updateDefaultBeneficiary({ body } = {}) {
1339
1836
  const { error } = PaymentValidator.updateDefaultBeneficiary().validate(
1340
1837
  { body },
1341
1838
  { abortEarly: false, allowUnknown: true }
@@ -1352,17 +1849,18 @@ class Payment {
1352
1849
  { abortEarly: false, allowUnknown: false }
1353
1850
  );
1354
1851
  if (warrning) {
1355
- console.log(
1356
- "Parameter Validation warrnings for updateDefaultBeneficiary"
1357
- );
1358
- console.log(warrning);
1852
+ Logger({
1853
+ level: "WARN",
1854
+ message: "Parameter Validation warrnings for updateDefaultBeneficiary",
1855
+ });
1856
+ Logger({ level: "WARN", message: warrning });
1359
1857
  }
1360
1858
 
1361
1859
  const query_params = {};
1362
1860
 
1363
1861
  const xHeaders = {};
1364
1862
 
1365
- return APIClient.execute(
1863
+ const response = await APIClient.execute(
1366
1864
  this._conf,
1367
1865
  "post",
1368
1866
  constructUrl({
@@ -1373,6 +1871,23 @@ class Payment {
1373
1871
  body,
1374
1872
  xHeaders
1375
1873
  );
1874
+
1875
+ const {
1876
+ error: res_error,
1877
+ } = PaymentModel.SetDefaultBeneficiaryResponse().validate(response, {
1878
+ abortEarly: false,
1879
+ allowUnknown: false,
1880
+ });
1881
+
1882
+ if (res_error) {
1883
+ Logger({
1884
+ level: "WARN",
1885
+ message: "Response Validation Warnnings for updateDefaultBeneficiary",
1886
+ });
1887
+ Logger({ level: "WARN", message: res_error });
1888
+ }
1889
+
1890
+ return response;
1376
1891
  }
1377
1892
 
1378
1893
  /**
@@ -1382,7 +1897,7 @@ class Payment {
1382
1897
  * @summary: Get payment link
1383
1898
  * @description: Use this API to get a payment link
1384
1899
  */
1385
- getPaymentLink({ paymentLinkId } = {}) {
1900
+ async getPaymentLink({ paymentLinkId } = {}) {
1386
1901
  const { error } = PaymentValidator.getPaymentLink().validate(
1387
1902
  { paymentLinkId },
1388
1903
  { abortEarly: false, allowUnknown: true }
@@ -1397,8 +1912,11 @@ class Payment {
1397
1912
  { abortEarly: false, allowUnknown: false }
1398
1913
  );
1399
1914
  if (warrning) {
1400
- console.log("Parameter Validation warrnings for getPaymentLink");
1401
- console.log(warrning);
1915
+ Logger({
1916
+ level: "WARN",
1917
+ message: "Parameter Validation warrnings for getPaymentLink",
1918
+ });
1919
+ Logger({ level: "WARN", message: warrning });
1402
1920
  }
1403
1921
 
1404
1922
  const query_params = {};
@@ -1406,7 +1924,7 @@ class Payment {
1406
1924
 
1407
1925
  const xHeaders = {};
1408
1926
 
1409
- return APIClient.execute(
1927
+ const response = await APIClient.execute(
1410
1928
  this._conf,
1411
1929
  "get",
1412
1930
  constructUrl({
@@ -1417,6 +1935,23 @@ class Payment {
1417
1935
  undefined,
1418
1936
  xHeaders
1419
1937
  );
1938
+
1939
+ const {
1940
+ error: res_error,
1941
+ } = PaymentModel.GetPaymentLinkResponse().validate(response, {
1942
+ abortEarly: false,
1943
+ allowUnknown: false,
1944
+ });
1945
+
1946
+ if (res_error) {
1947
+ Logger({
1948
+ level: "WARN",
1949
+ message: "Response Validation Warnnings for getPaymentLink",
1950
+ });
1951
+ Logger({ level: "WARN", message: res_error });
1952
+ }
1953
+
1954
+ return response;
1420
1955
  }
1421
1956
 
1422
1957
  /**
@@ -1426,7 +1961,7 @@ class Payment {
1426
1961
  * @summary: Create payment link
1427
1962
  * @description: Use this API to create a payment link for the customer
1428
1963
  */
1429
- createPaymentLink({ body } = {}) {
1964
+ async createPaymentLink({ body } = {}) {
1430
1965
  const { error } = PaymentValidator.createPaymentLink().validate(
1431
1966
  { body },
1432
1967
  { abortEarly: false, allowUnknown: true }
@@ -1441,15 +1976,18 @@ class Payment {
1441
1976
  { abortEarly: false, allowUnknown: false }
1442
1977
  );
1443
1978
  if (warrning) {
1444
- console.log("Parameter Validation warrnings for createPaymentLink");
1445
- console.log(warrning);
1979
+ Logger({
1980
+ level: "WARN",
1981
+ message: "Parameter Validation warrnings for createPaymentLink",
1982
+ });
1983
+ Logger({ level: "WARN", message: warrning });
1446
1984
  }
1447
1985
 
1448
1986
  const query_params = {};
1449
1987
 
1450
1988
  const xHeaders = {};
1451
1989
 
1452
- return APIClient.execute(
1990
+ const response = await APIClient.execute(
1453
1991
  this._conf,
1454
1992
  "post",
1455
1993
  constructUrl({
@@ -1460,6 +1998,23 @@ class Payment {
1460
1998
  body,
1461
1999
  xHeaders
1462
2000
  );
2001
+
2002
+ const {
2003
+ error: res_error,
2004
+ } = PaymentModel.CreatePaymentLinkResponse().validate(response, {
2005
+ abortEarly: false,
2006
+ allowUnknown: false,
2007
+ });
2008
+
2009
+ if (res_error) {
2010
+ Logger({
2011
+ level: "WARN",
2012
+ message: "Response Validation Warnnings for createPaymentLink",
2013
+ });
2014
+ Logger({ level: "WARN", message: res_error });
2015
+ }
2016
+
2017
+ return response;
1463
2018
  }
1464
2019
 
1465
2020
  /**
@@ -1469,7 +2024,7 @@ class Payment {
1469
2024
  * @summary: Resend payment link
1470
2025
  * @description: Use this API to resend a payment link for the customer
1471
2026
  */
1472
- resendPaymentLink({ body } = {}) {
2027
+ async resendPaymentLink({ body } = {}) {
1473
2028
  const { error } = PaymentValidator.resendPaymentLink().validate(
1474
2029
  { body },
1475
2030
  { abortEarly: false, allowUnknown: true }
@@ -1484,15 +2039,18 @@ class Payment {
1484
2039
  { abortEarly: false, allowUnknown: false }
1485
2040
  );
1486
2041
  if (warrning) {
1487
- console.log("Parameter Validation warrnings for resendPaymentLink");
1488
- console.log(warrning);
2042
+ Logger({
2043
+ level: "WARN",
2044
+ message: "Parameter Validation warrnings for resendPaymentLink",
2045
+ });
2046
+ Logger({ level: "WARN", message: warrning });
1489
2047
  }
1490
2048
 
1491
2049
  const query_params = {};
1492
2050
 
1493
2051
  const xHeaders = {};
1494
2052
 
1495
- return APIClient.execute(
2053
+ const response = await APIClient.execute(
1496
2054
  this._conf,
1497
2055
  "post",
1498
2056
  constructUrl({
@@ -1503,6 +2061,23 @@ class Payment {
1503
2061
  body,
1504
2062
  xHeaders
1505
2063
  );
2064
+
2065
+ const {
2066
+ error: res_error,
2067
+ } = PaymentModel.ResendPaymentLinkResponse().validate(response, {
2068
+ abortEarly: false,
2069
+ allowUnknown: false,
2070
+ });
2071
+
2072
+ if (res_error) {
2073
+ Logger({
2074
+ level: "WARN",
2075
+ message: "Response Validation Warnnings for resendPaymentLink",
2076
+ });
2077
+ Logger({ level: "WARN", message: res_error });
2078
+ }
2079
+
2080
+ return response;
1506
2081
  }
1507
2082
 
1508
2083
  /**
@@ -1512,7 +2087,7 @@ class Payment {
1512
2087
  * @summary: Cancel payment link
1513
2088
  * @description: Use this API to cancel a payment link for the customer
1514
2089
  */
1515
- cancelPaymentLink({ body } = {}) {
2090
+ async cancelPaymentLink({ body } = {}) {
1516
2091
  const { error } = PaymentValidator.cancelPaymentLink().validate(
1517
2092
  { body },
1518
2093
  { abortEarly: false, allowUnknown: true }
@@ -1527,15 +2102,18 @@ class Payment {
1527
2102
  { abortEarly: false, allowUnknown: false }
1528
2103
  );
1529
2104
  if (warrning) {
1530
- console.log("Parameter Validation warrnings for cancelPaymentLink");
1531
- console.log(warrning);
2105
+ Logger({
2106
+ level: "WARN",
2107
+ message: "Parameter Validation warrnings for cancelPaymentLink",
2108
+ });
2109
+ Logger({ level: "WARN", message: warrning });
1532
2110
  }
1533
2111
 
1534
2112
  const query_params = {};
1535
2113
 
1536
2114
  const xHeaders = {};
1537
2115
 
1538
- return APIClient.execute(
2116
+ const response = await APIClient.execute(
1539
2117
  this._conf,
1540
2118
  "post",
1541
2119
  constructUrl({
@@ -1546,6 +2124,23 @@ class Payment {
1546
2124
  body,
1547
2125
  xHeaders
1548
2126
  );
2127
+
2128
+ const {
2129
+ error: res_error,
2130
+ } = PaymentModel.CancelPaymentLinkResponse().validate(response, {
2131
+ abortEarly: false,
2132
+ allowUnknown: false,
2133
+ });
2134
+
2135
+ if (res_error) {
2136
+ Logger({
2137
+ level: "WARN",
2138
+ message: "Response Validation Warnnings for cancelPaymentLink",
2139
+ });
2140
+ Logger({ level: "WARN", message: res_error });
2141
+ }
2142
+
2143
+ return response;
1549
2144
  }
1550
2145
 
1551
2146
  /**
@@ -1555,7 +2150,7 @@ class Payment {
1555
2150
  * @summary: Get applicable payment options for payment link
1556
2151
  * @description: Use this API to get all valid payment options for doing a payment through payment link
1557
2152
  */
1558
- getPaymentModeRoutesPaymentLink({ paymentLinkId } = {}) {
2153
+ async getPaymentModeRoutesPaymentLink({ paymentLinkId } = {}) {
1559
2154
  const {
1560
2155
  error,
1561
2156
  } = PaymentValidator.getPaymentModeRoutesPaymentLink().validate(
@@ -1574,10 +2169,12 @@ class Payment {
1574
2169
  { abortEarly: false, allowUnknown: false }
1575
2170
  );
1576
2171
  if (warrning) {
1577
- console.log(
1578
- "Parameter Validation warrnings for getPaymentModeRoutesPaymentLink"
1579
- );
1580
- console.log(warrning);
2172
+ Logger({
2173
+ level: "WARN",
2174
+ message:
2175
+ "Parameter Validation warrnings for getPaymentModeRoutesPaymentLink",
2176
+ });
2177
+ Logger({ level: "WARN", message: warrning });
1581
2178
  }
1582
2179
 
1583
2180
  const query_params = {};
@@ -1585,7 +2182,7 @@ class Payment {
1585
2182
 
1586
2183
  const xHeaders = {};
1587
2184
 
1588
- return APIClient.execute(
2185
+ const response = await APIClient.execute(
1589
2186
  this._conf,
1590
2187
  "get",
1591
2188
  constructUrl({
@@ -1596,6 +2193,24 @@ class Payment {
1596
2193
  undefined,
1597
2194
  xHeaders
1598
2195
  );
2196
+
2197
+ const {
2198
+ error: res_error,
2199
+ } = PaymentModel.PaymentModeRouteResponse().validate(response, {
2200
+ abortEarly: false,
2201
+ allowUnknown: false,
2202
+ });
2203
+
2204
+ if (res_error) {
2205
+ Logger({
2206
+ level: "WARN",
2207
+ message:
2208
+ "Response Validation Warnnings for getPaymentModeRoutesPaymentLink",
2209
+ });
2210
+ Logger({ level: "WARN", message: res_error });
2211
+ }
2212
+
2213
+ return response;
1599
2214
  }
1600
2215
 
1601
2216
  /**
@@ -1605,7 +2220,7 @@ class Payment {
1605
2220
  * @summary: Used for polling if payment successful or not
1606
2221
  * @description: Use this API to poll if payment through payment was successful or not
1607
2222
  */
1608
- pollingPaymentLink({ paymentLinkId } = {}) {
2223
+ async pollingPaymentLink({ paymentLinkId } = {}) {
1609
2224
  const { error } = PaymentValidator.pollingPaymentLink().validate(
1610
2225
  { paymentLinkId },
1611
2226
  { abortEarly: false, allowUnknown: true }
@@ -1620,8 +2235,11 @@ class Payment {
1620
2235
  { abortEarly: false, allowUnknown: false }
1621
2236
  );
1622
2237
  if (warrning) {
1623
- console.log("Parameter Validation warrnings for pollingPaymentLink");
1624
- console.log(warrning);
2238
+ Logger({
2239
+ level: "WARN",
2240
+ message: "Parameter Validation warrnings for pollingPaymentLink",
2241
+ });
2242
+ Logger({ level: "WARN", message: warrning });
1625
2243
  }
1626
2244
 
1627
2245
  const query_params = {};
@@ -1629,7 +2247,7 @@ class Payment {
1629
2247
 
1630
2248
  const xHeaders = {};
1631
2249
 
1632
- return APIClient.execute(
2250
+ const response = await APIClient.execute(
1633
2251
  this._conf,
1634
2252
  "get",
1635
2253
  constructUrl({
@@ -1640,6 +2258,23 @@ class Payment {
1640
2258
  undefined,
1641
2259
  xHeaders
1642
2260
  );
2261
+
2262
+ const {
2263
+ error: res_error,
2264
+ } = PaymentModel.PollingPaymentLinkResponse().validate(response, {
2265
+ abortEarly: false,
2266
+ allowUnknown: false,
2267
+ });
2268
+
2269
+ if (res_error) {
2270
+ Logger({
2271
+ level: "WARN",
2272
+ message: "Response Validation Warnnings for pollingPaymentLink",
2273
+ });
2274
+ Logger({ level: "WARN", message: res_error });
2275
+ }
2276
+
2277
+ return response;
1643
2278
  }
1644
2279
 
1645
2280
  /**
@@ -1649,7 +2284,7 @@ class Payment {
1649
2284
  * @summary: Create Order user
1650
2285
  * @description: Use this API to create a order and payment on aggregator side
1651
2286
  */
1652
- createOrderHandlerPaymentLink({ body } = {}) {
2287
+ async createOrderHandlerPaymentLink({ body } = {}) {
1653
2288
  const { error } = PaymentValidator.createOrderHandlerPaymentLink().validate(
1654
2289
  { body },
1655
2290
  { abortEarly: false, allowUnknown: true }
@@ -1666,17 +2301,19 @@ class Payment {
1666
2301
  { abortEarly: false, allowUnknown: false }
1667
2302
  );
1668
2303
  if (warrning) {
1669
- console.log(
1670
- "Parameter Validation warrnings for createOrderHandlerPaymentLink"
1671
- );
1672
- console.log(warrning);
2304
+ Logger({
2305
+ level: "WARN",
2306
+ message:
2307
+ "Parameter Validation warrnings for createOrderHandlerPaymentLink",
2308
+ });
2309
+ Logger({ level: "WARN", message: warrning });
1673
2310
  }
1674
2311
 
1675
2312
  const query_params = {};
1676
2313
 
1677
2314
  const xHeaders = {};
1678
2315
 
1679
- return APIClient.execute(
2316
+ const response = await APIClient.execute(
1680
2317
  this._conf,
1681
2318
  "post",
1682
2319
  constructUrl({
@@ -1687,6 +2324,24 @@ class Payment {
1687
2324
  body,
1688
2325
  xHeaders
1689
2326
  );
2327
+
2328
+ const {
2329
+ error: res_error,
2330
+ } = PaymentModel.CreateOrderUserResponse().validate(response, {
2331
+ abortEarly: false,
2332
+ allowUnknown: false,
2333
+ });
2334
+
2335
+ if (res_error) {
2336
+ Logger({
2337
+ level: "WARN",
2338
+ message:
2339
+ "Response Validation Warnnings for createOrderHandlerPaymentLink",
2340
+ });
2341
+ Logger({ level: "WARN", message: res_error });
2342
+ }
2343
+
2344
+ return response;
1690
2345
  }
1691
2346
 
1692
2347
  /**
@@ -1696,7 +2351,7 @@ class Payment {
1696
2351
  * @summary: Initialize a payment (server-to-server) for UPI and BharatQR
1697
2352
  * @description: Use 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.
1698
2353
  */
1699
- initialisePaymentPaymentLink({ body } = {}) {
2354
+ async initialisePaymentPaymentLink({ body } = {}) {
1700
2355
  const { error } = PaymentValidator.initialisePaymentPaymentLink().validate(
1701
2356
  { body },
1702
2357
  { abortEarly: false, allowUnknown: true }
@@ -1713,17 +2368,19 @@ class Payment {
1713
2368
  { abortEarly: false, allowUnknown: false }
1714
2369
  );
1715
2370
  if (warrning) {
1716
- console.log(
1717
- "Parameter Validation warrnings for initialisePaymentPaymentLink"
1718
- );
1719
- console.log(warrning);
2371
+ Logger({
2372
+ level: "WARN",
2373
+ message:
2374
+ "Parameter Validation warrnings for initialisePaymentPaymentLink",
2375
+ });
2376
+ Logger({ level: "WARN", message: warrning });
1720
2377
  }
1721
2378
 
1722
2379
  const query_params = {};
1723
2380
 
1724
2381
  const xHeaders = {};
1725
2382
 
1726
- return APIClient.execute(
2383
+ const response = await APIClient.execute(
1727
2384
  this._conf,
1728
2385
  "post",
1729
2386
  constructUrl({
@@ -1734,6 +2391,24 @@ class Payment {
1734
2391
  body,
1735
2392
  xHeaders
1736
2393
  );
2394
+
2395
+ const {
2396
+ error: res_error,
2397
+ } = PaymentModel.PaymentInitializationResponse().validate(response, {
2398
+ abortEarly: false,
2399
+ allowUnknown: false,
2400
+ });
2401
+
2402
+ if (res_error) {
2403
+ Logger({
2404
+ level: "WARN",
2405
+ message:
2406
+ "Response Validation Warnnings for initialisePaymentPaymentLink",
2407
+ });
2408
+ Logger({ level: "WARN", message: res_error });
2409
+ }
2410
+
2411
+ return response;
1737
2412
  }
1738
2413
 
1739
2414
  /**
@@ -1743,7 +2418,7 @@ class Payment {
1743
2418
  * @summary: Performs continuous polling to check status of payment on the server
1744
2419
  * @description: Use this API to perform continuous polling at intervals to check the status of payment until timeout.
1745
2420
  */
1746
- checkAndUpdatePaymentStatusPaymentLink({ body } = {}) {
2421
+ async checkAndUpdatePaymentStatusPaymentLink({ body } = {}) {
1747
2422
  const {
1748
2423
  error,
1749
2424
  } = PaymentValidator.checkAndUpdatePaymentStatusPaymentLink().validate(
@@ -1762,17 +2437,19 @@ class Payment {
1762
2437
  { abortEarly: false, allowUnknown: false }
1763
2438
  );
1764
2439
  if (warrning) {
1765
- console.log(
1766
- "Parameter Validation warrnings for checkAndUpdatePaymentStatusPaymentLink"
1767
- );
1768
- console.log(warrning);
2440
+ Logger({
2441
+ level: "WARN",
2442
+ message:
2443
+ "Parameter Validation warrnings for checkAndUpdatePaymentStatusPaymentLink",
2444
+ });
2445
+ Logger({ level: "WARN", message: warrning });
1769
2446
  }
1770
2447
 
1771
2448
  const query_params = {};
1772
2449
 
1773
2450
  const xHeaders = {};
1774
2451
 
1775
- return APIClient.execute(
2452
+ const response = await APIClient.execute(
1776
2453
  this._conf,
1777
2454
  "post",
1778
2455
  constructUrl({
@@ -1783,6 +2460,24 @@ class Payment {
1783
2460
  body,
1784
2461
  xHeaders
1785
2462
  );
2463
+
2464
+ const {
2465
+ error: res_error,
2466
+ } = PaymentModel.PaymentStatusUpdateResponse().validate(response, {
2467
+ abortEarly: false,
2468
+ allowUnknown: false,
2469
+ });
2470
+
2471
+ if (res_error) {
2472
+ Logger({
2473
+ level: "WARN",
2474
+ message:
2475
+ "Response Validation Warnnings for checkAndUpdatePaymentStatusPaymentLink",
2476
+ });
2477
+ Logger({ level: "WARN", message: res_error });
2478
+ }
2479
+
2480
+ return response;
1786
2481
  }
1787
2482
 
1788
2483
  /**
@@ -1792,7 +2487,7 @@ class Payment {
1792
2487
  * @summary: API to fetch the customer credit summary
1793
2488
  * @description: Use this API to fetch the customer credit summary.
1794
2489
  */
1795
- customerCreditSummary({ aggregator } = {}) {
2490
+ async customerCreditSummary({ aggregator } = {}) {
1796
2491
  const { error } = PaymentValidator.customerCreditSummary().validate(
1797
2492
  { aggregator },
1798
2493
  { abortEarly: false, allowUnknown: true }
@@ -1809,8 +2504,11 @@ class Payment {
1809
2504
  { abortEarly: false, allowUnknown: false }
1810
2505
  );
1811
2506
  if (warrning) {
1812
- console.log("Parameter Validation warrnings for customerCreditSummary");
1813
- console.log(warrning);
2507
+ Logger({
2508
+ level: "WARN",
2509
+ message: "Parameter Validation warrnings for customerCreditSummary",
2510
+ });
2511
+ Logger({ level: "WARN", message: warrning });
1814
2512
  }
1815
2513
 
1816
2514
  const query_params = {};
@@ -1818,7 +2516,7 @@ class Payment {
1818
2516
 
1819
2517
  const xHeaders = {};
1820
2518
 
1821
- return APIClient.execute(
2519
+ const response = await APIClient.execute(
1822
2520
  this._conf,
1823
2521
  "get",
1824
2522
  constructUrl({
@@ -1829,6 +2527,23 @@ class Payment {
1829
2527
  undefined,
1830
2528
  xHeaders
1831
2529
  );
2530
+
2531
+ const {
2532
+ error: res_error,
2533
+ } = PaymentModel.CustomerCreditSummaryResponse().validate(response, {
2534
+ abortEarly: false,
2535
+ allowUnknown: false,
2536
+ });
2537
+
2538
+ if (res_error) {
2539
+ Logger({
2540
+ level: "WARN",
2541
+ message: "Response Validation Warnnings for customerCreditSummary",
2542
+ });
2543
+ Logger({ level: "WARN", message: res_error });
2544
+ }
2545
+
2546
+ return response;
1832
2547
  }
1833
2548
 
1834
2549
  /**
@@ -1841,7 +2556,7 @@ class Payment {
1841
2556
  * @summary: API to get the redirect url to redirect the user to aggregator's page
1842
2557
  * @description: Use this API to get the redirect url to redirect the user to aggregator's page
1843
2558
  */
1844
- redirectToAggregator({ source, aggregator } = {}) {
2559
+ async redirectToAggregator({ source, aggregator } = {}) {
1845
2560
  const { error } = PaymentValidator.redirectToAggregator().validate(
1846
2561
  { source, aggregator },
1847
2562
  { abortEarly: false, allowUnknown: true }
@@ -1858,8 +2573,11 @@ class Payment {
1858
2573
  { abortEarly: false, allowUnknown: false }
1859
2574
  );
1860
2575
  if (warrning) {
1861
- console.log("Parameter Validation warrnings for redirectToAggregator");
1862
- console.log(warrning);
2576
+ Logger({
2577
+ level: "WARN",
2578
+ message: "Parameter Validation warrnings for redirectToAggregator",
2579
+ });
2580
+ Logger({ level: "WARN", message: warrning });
1863
2581
  }
1864
2582
 
1865
2583
  const query_params = {};
@@ -1868,7 +2586,7 @@ class Payment {
1868
2586
 
1869
2587
  const xHeaders = {};
1870
2588
 
1871
- return APIClient.execute(
2589
+ const response = await APIClient.execute(
1872
2590
  this._conf,
1873
2591
  "get",
1874
2592
  constructUrl({
@@ -1879,6 +2597,23 @@ class Payment {
1879
2597
  undefined,
1880
2598
  xHeaders
1881
2599
  );
2600
+
2601
+ const {
2602
+ error: res_error,
2603
+ } = PaymentModel.RedirectToAggregatorResponse().validate(response, {
2604
+ abortEarly: false,
2605
+ allowUnknown: false,
2606
+ });
2607
+
2608
+ if (res_error) {
2609
+ Logger({
2610
+ level: "WARN",
2611
+ message: "Response Validation Warnnings for redirectToAggregator",
2612
+ });
2613
+ Logger({ level: "WARN", message: res_error });
2614
+ }
2615
+
2616
+ return response;
1882
2617
  }
1883
2618
 
1884
2619
  /**
@@ -1888,7 +2623,7 @@ class Payment {
1888
2623
  * @summary: API to fetch the customer credit summary
1889
2624
  * @description: Use this API to fetch the customer credit summary.
1890
2625
  */
1891
- checkCredit({ aggregator } = {}) {
2626
+ async checkCredit({ aggregator } = {}) {
1892
2627
  const { error } = PaymentValidator.checkCredit().validate(
1893
2628
  { aggregator },
1894
2629
  { abortEarly: false, allowUnknown: true }
@@ -1903,8 +2638,11 @@ class Payment {
1903
2638
  { abortEarly: false, allowUnknown: false }
1904
2639
  );
1905
2640
  if (warrning) {
1906
- console.log("Parameter Validation warrnings for checkCredit");
1907
- console.log(warrning);
2641
+ Logger({
2642
+ level: "WARN",
2643
+ message: "Parameter Validation warrnings for checkCredit",
2644
+ });
2645
+ Logger({ level: "WARN", message: warrning });
1908
2646
  }
1909
2647
 
1910
2648
  const query_params = {};
@@ -1912,7 +2650,7 @@ class Payment {
1912
2650
 
1913
2651
  const xHeaders = {};
1914
2652
 
1915
- return APIClient.execute(
2653
+ const response = await APIClient.execute(
1916
2654
  this._conf,
1917
2655
  "get",
1918
2656
  constructUrl({
@@ -1923,6 +2661,23 @@ class Payment {
1923
2661
  undefined,
1924
2662
  xHeaders
1925
2663
  );
2664
+
2665
+ const {
2666
+ error: res_error,
2667
+ } = PaymentModel.CheckCreditResponse().validate(response, {
2668
+ abortEarly: false,
2669
+ allowUnknown: false,
2670
+ });
2671
+
2672
+ if (res_error) {
2673
+ Logger({
2674
+ level: "WARN",
2675
+ message: "Response Validation Warnnings for checkCredit",
2676
+ });
2677
+ Logger({ level: "WARN", message: res_error });
2678
+ }
2679
+
2680
+ return response;
1926
2681
  }
1927
2682
 
1928
2683
  /**
@@ -1932,7 +2687,7 @@ class Payment {
1932
2687
  * @summary: API to fetch the customer credit summary
1933
2688
  * @description: Use this API to fetch the customer credit summary.
1934
2689
  */
1935
- customerOnboard({ body } = {}) {
2690
+ async customerOnboard({ body } = {}) {
1936
2691
  const { error } = PaymentValidator.customerOnboard().validate(
1937
2692
  { body },
1938
2693
  { abortEarly: false, allowUnknown: true }
@@ -1947,15 +2702,18 @@ class Payment {
1947
2702
  { abortEarly: false, allowUnknown: false }
1948
2703
  );
1949
2704
  if (warrning) {
1950
- console.log("Parameter Validation warrnings for customerOnboard");
1951
- console.log(warrning);
2705
+ Logger({
2706
+ level: "WARN",
2707
+ message: "Parameter Validation warrnings for customerOnboard",
2708
+ });
2709
+ Logger({ level: "WARN", message: warrning });
1952
2710
  }
1953
2711
 
1954
2712
  const query_params = {};
1955
2713
 
1956
2714
  const xHeaders = {};
1957
2715
 
1958
- return APIClient.execute(
2716
+ const response = await APIClient.execute(
1959
2717
  this._conf,
1960
2718
  "post",
1961
2719
  constructUrl({
@@ -1966,6 +2724,23 @@ class Payment {
1966
2724
  body,
1967
2725
  xHeaders
1968
2726
  );
2727
+
2728
+ const {
2729
+ error: res_error,
2730
+ } = PaymentModel.CustomerOnboardingResponse().validate(response, {
2731
+ abortEarly: false,
2732
+ allowUnknown: false,
2733
+ });
2734
+
2735
+ if (res_error) {
2736
+ Logger({
2737
+ level: "WARN",
2738
+ message: "Response Validation Warnnings for customerOnboard",
2739
+ });
2740
+ Logger({ level: "WARN", message: res_error });
2741
+ }
2742
+
2743
+ return response;
1969
2744
  }
1970
2745
  }
1971
2746