@gofynd/fdk-client-javascript 1.0.0 → 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 (156) hide show
  1. package/documentation/application/CART.md +251 -251
  2. package/documentation/application/CATALOG.md +393 -393
  3. package/documentation/application/CONTENT.md +15 -1
  4. package/documentation/application/ORDER.md +268 -268
  5. package/documentation/application/PAYMENT.md +249 -249
  6. package/documentation/application/POSCART.md +297 -297
  7. package/documentation/platform/CART.md +499 -499
  8. package/documentation/platform/CATALOG.md +3497 -3097
  9. package/documentation/platform/COMPANYPROFILE.md +207 -207
  10. package/documentation/platform/CONTENT.md +123 -1
  11. package/documentation/platform/ORDER.md +1518 -1324
  12. package/documentation/platform/PARTNER.md +7 -7
  13. package/documentation/platform/PAYMENT.md +96 -96
  14. package/index.js +7 -1
  15. package/package.json +1 -1
  16. package/sdk/application/ApplicationConfig.js +1 -1
  17. package/sdk/application/Cart/CartApplicationClient.js +865 -52
  18. package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
  19. package/sdk/application/Cart/CartApplicationModel.js +335 -335
  20. package/sdk/application/Cart/CartApplicationValidator.js +1 -0
  21. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
  22. package/sdk/application/Catalog/CatalogApplicationClient.js +1034 -60
  23. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +19 -19
  24. package/sdk/application/Catalog/CatalogApplicationModel.js +532 -532
  25. package/sdk/application/Catalog/CatalogApplicationValidator.js +1 -0
  26. package/sdk/application/Common/CommonApplicationClient.js +66 -4
  27. package/sdk/application/Common/CommonApplicationValidator.js +1 -0
  28. package/sdk/application/Communication/CommunicationApplicationClient.js +108 -6
  29. package/sdk/application/Communication/CommunicationApplicationValidator.js +1 -0
  30. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
  31. package/sdk/application/Configuration/ConfigurationApplicationClient.js +558 -32
  32. package/sdk/application/Configuration/ConfigurationApplicationValidator.js +1 -0
  33. package/sdk/application/Content/ContentApplicationClient.js +621 -38
  34. package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
  35. package/sdk/application/Content/ContentApplicationModel.js +11 -1
  36. package/sdk/application/Content/ContentApplicationValidator.js +1 -0
  37. package/sdk/application/FileStorage/FileStorageApplicationClient.js +101 -6
  38. package/sdk/application/FileStorage/FileStorageApplicationValidator.js +1 -0
  39. package/sdk/application/Lead/LeadApplicationClient.js +229 -14
  40. package/sdk/application/Lead/LeadApplicationValidator.js +1 -0
  41. package/sdk/application/Logistic/LogisticApplicationClient.js +134 -8
  42. package/sdk/application/Logistic/LogisticApplicationValidator.js +1 -0
  43. package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
  44. package/sdk/application/Order/OrderApplicationClient.js +403 -24
  45. package/sdk/application/Order/OrderApplicationModel.d.ts +20 -20
  46. package/sdk/application/Order/OrderApplicationModel.js +334 -334
  47. package/sdk/application/Order/OrderApplicationValidator.js +1 -0
  48. package/sdk/application/Payment/PaymentApplicationClient.js +1381 -78
  49. package/sdk/application/Payment/PaymentApplicationModel.d.ts +2 -2
  50. package/sdk/application/Payment/PaymentApplicationModel.js +350 -350
  51. package/sdk/application/Payment/PaymentApplicationValidator.js +1 -0
  52. package/sdk/application/PosCart/PosCartApplicationClient.js +914 -54
  53. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
  54. package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
  55. package/sdk/application/PosCart/PosCartApplicationValidator.js +1 -0
  56. package/sdk/application/Rewards/RewardsApplicationClient.js +235 -14
  57. package/sdk/application/Rewards/RewardsApplicationValidator.js +1 -0
  58. package/sdk/application/Share/ShareApplicationClient.js +226 -14
  59. package/sdk/application/Share/ShareApplicationValidator.js +1 -0
  60. package/sdk/application/Theme/ThemeApplicationClient.js +130 -8
  61. package/sdk/application/Theme/ThemeApplicationValidator.js +1 -0
  62. package/sdk/application/User/UserApplicationClient.js +1133 -70
  63. package/sdk/application/User/UserApplicationValidator.js +1 -0
  64. package/sdk/common/AxiosHelper.js +1 -1
  65. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
  66. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +287 -16
  67. package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
  68. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +153 -8
  69. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
  70. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +141 -8
  71. package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
  72. package/sdk/platform/Billing/BillingPlatformClient.js +429 -24
  73. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
  74. package/sdk/platform/Cart/CartPlatformApplicationClient.js +617 -34
  75. package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
  76. package/sdk/platform/Cart/CartPlatformModel.js +617 -617
  77. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +191 -138
  78. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2202 -302
  79. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +11 -11
  80. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +45 -45
  81. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +344 -226
  82. package/sdk/platform/Catalog/CatalogPlatformClient.js +3282 -488
  83. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +110 -100
  84. package/sdk/platform/Catalog/CatalogPlatformModel.js +2073 -1795
  85. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +23 -21
  86. package/sdk/platform/Catalog/CatalogPlatformValidator.js +103 -84
  87. package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
  88. package/sdk/platform/Common/CommonPlatformClient.js +73 -4
  89. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
  90. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1499 -80
  91. package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
  92. package/sdk/platform/Communication/CommunicationPlatformClient.js +41 -2
  93. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
  94. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +486 -26
  95. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +9 -9
  96. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +274 -274
  97. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
  98. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1022 -56
  99. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
  100. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +693 -36
  101. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
  102. package/sdk/platform/Content/ContentPlatformApplicationClient.js +2446 -140
  103. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
  104. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
  105. package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
  106. package/sdk/platform/Content/ContentPlatformModel.js +43 -1
  107. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
  108. package/sdk/platform/Discount/DiscountPlatformClient.js +400 -22
  109. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
  110. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +148 -8
  111. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
  112. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +214 -12
  113. package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
  114. package/sdk/platform/Inventory/InventoryPlatformClient.js +449 -24
  115. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
  116. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +447 -26
  117. package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
  118. package/sdk/platform/Lead/LeadPlatformClient.js +384 -22
  119. package/sdk/platform/OAuthClient.js +8 -8
  120. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
  121. package/sdk/platform/Order/OrderPlatformApplicationClient.js +125 -6
  122. package/sdk/platform/Order/OrderPlatformClient.d.ts +108 -47
  123. package/sdk/platform/Order/OrderPlatformClient.js +1641 -100
  124. package/sdk/platform/Order/OrderPlatformModel.d.ts +69 -58
  125. package/sdk/platform/Order/OrderPlatformModel.js +1485 -1493
  126. package/sdk/platform/Order/OrderPlatformValidator.d.ts +2 -1
  127. package/sdk/platform/Order/OrderPlatformValidator.js +15 -4
  128. package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
  129. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +74 -4
  130. package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
  131. package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
  132. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
  133. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +418 -22
  134. package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
  135. package/sdk/platform/Payment/PaymentPlatformClient.js +374 -20
  136. package/sdk/platform/Payment/PaymentPlatformModel.js +139 -139
  137. package/sdk/platform/PlatformApplicationClient.d.ts +2973 -2827
  138. package/sdk/platform/PlatformApplicationClient.js +3461 -3263
  139. package/sdk/platform/PlatformClient.d.ts +2973 -2827
  140. package/sdk/platform/PlatformClient.js +3461 -3263
  141. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
  142. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +449 -26
  143. package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
  144. package/sdk/platform/Share/SharePlatformApplicationClient.js +139 -8
  145. package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
  146. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +816 -48
  147. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
  148. package/sdk/platform/User/UserPlatformApplicationClient.js +417 -24
  149. package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
  150. package/sdk/platform/Webhook/WebhookPlatformClient.js +229 -12
  151. package/sdk/public/Configuration/ConfigurationPublicClient.js +72 -4
  152. package/sdk/public/Configuration/ConfigurationPublicValidator.js +3 -1
  153. package/sdk/public/Inventory/InventoryPublicClient.js +210 -12
  154. package/sdk/public/Inventory/InventoryPublicValidator.js +3 -1
  155. package/sdk/public/Webhook/WebhookPublicClient.js +74 -4
  156. package/sdk/public/Webhook/WebhookPublicValidator.js +3 -1
@@ -2,6 +2,8 @@ const Paginator = require("../../common/Paginator");
2
2
  const PlatformAPIClient = require("../PlatformAPIClient");
3
3
  const { FDKClientValidationError } = require("../../common/FDKError");
4
4
  const PaymentValidator = require("./PaymentPlatformApplicationValidator");
5
+ const PaymentModel = require("./PaymentPlatformModel");
6
+ const { Logger } = require("./../../common/Logger");
5
7
 
6
8
  class Payment {
7
9
  constructor(config, applicationId) {
@@ -11,10 +13,11 @@ class Payment {
11
13
 
12
14
  /**
13
15
  * @param {Object} arg - Arg object.
16
+ * @returns {Promise<PaymentGatewayConfigResponse>} - Success response
14
17
  * @summary: Get All Brand Payment Gateway Config Secret
15
18
  * @description: Get All Brand Payment Gateway Config Secret
16
19
  */
17
- getBrandPaymentGatewayConfig({} = {}) {
20
+ async getBrandPaymentGatewayConfig({} = {}) {
18
21
  const { error } = PaymentValidator.getBrandPaymentGatewayConfig().validate(
19
22
  {},
20
23
  { abortEarly: false, allowUnknown: true }
@@ -23,24 +26,59 @@ class Payment {
23
26
  return Promise.reject(new FDKClientValidationError(error));
24
27
  }
25
28
 
29
+ // Showing warrnings if extra unknown parameters are found
30
+ const {
31
+ error: warrning,
32
+ } = PaymentValidator.getBrandPaymentGatewayConfig().validate(
33
+ {},
34
+ { abortEarly: false, allowUnknown: false }
35
+ );
36
+ if (warrning) {
37
+ Logger({
38
+ level: "WARN",
39
+ message:
40
+ "Parameter Validation warrnings for getBrandPaymentGatewayConfig",
41
+ });
42
+ Logger({ level: "WARN", message: warrning });
43
+ }
44
+
26
45
  const query_params = {};
27
46
 
28
- return PlatformAPIClient.execute(
47
+ const response = await PlatformAPIClient.execute(
29
48
  this.config,
30
49
  "get",
31
50
  `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/aggregator/request`,
32
51
  query_params,
33
52
  undefined
34
53
  );
54
+
55
+ const {
56
+ error: res_error,
57
+ } = PaymentModel.PaymentGatewayConfigResponse().validate(response, {
58
+ abortEarly: false,
59
+ allowUnknown: false,
60
+ });
61
+
62
+ if (res_error) {
63
+ Logger({
64
+ level: "WARN",
65
+ message:
66
+ "Response Validation Warnnings for getBrandPaymentGatewayConfig",
67
+ });
68
+ Logger({ level: "WARN", message: res_error });
69
+ }
70
+
71
+ return response;
35
72
  }
36
73
 
37
74
  /**
38
75
  * @param {Object} arg - Arg object.
39
76
  * @param {PaymentGatewayConfigRequest} arg.body
77
+ * @returns {Promise<PaymentGatewayToBeReviewed>} - Success response
40
78
  * @summary: Save Config Secret For Brand Payment Gateway
41
79
  * @description: Save Config Secret For Brand Payment Gateway
42
80
  */
43
- saveBrandPaymentGatewayConfig({ body } = {}) {
81
+ async saveBrandPaymentGatewayConfig({ body } = {}) {
44
82
  const { error } = PaymentValidator.saveBrandPaymentGatewayConfig().validate(
45
83
  {
46
84
  body,
@@ -51,24 +89,61 @@ class Payment {
51
89
  return Promise.reject(new FDKClientValidationError(error));
52
90
  }
53
91
 
92
+ // Showing warrnings if extra unknown parameters are found
93
+ const {
94
+ error: warrning,
95
+ } = PaymentValidator.saveBrandPaymentGatewayConfig().validate(
96
+ {
97
+ body,
98
+ },
99
+ { abortEarly: false, allowUnknown: false }
100
+ );
101
+ if (warrning) {
102
+ Logger({
103
+ level: "WARN",
104
+ message:
105
+ "Parameter Validation warrnings for saveBrandPaymentGatewayConfig",
106
+ });
107
+ Logger({ level: "WARN", message: warrning });
108
+ }
109
+
54
110
  const query_params = {};
55
111
 
56
- return PlatformAPIClient.execute(
112
+ const response = await PlatformAPIClient.execute(
57
113
  this.config,
58
114
  "post",
59
115
  `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/aggregator/request`,
60
116
  query_params,
61
117
  body
62
118
  );
119
+
120
+ const {
121
+ error: res_error,
122
+ } = PaymentModel.PaymentGatewayToBeReviewed().validate(response, {
123
+ abortEarly: false,
124
+ allowUnknown: false,
125
+ });
126
+
127
+ if (res_error) {
128
+ Logger({
129
+ level: "WARN",
130
+ message:
131
+ "Response Validation Warnnings for saveBrandPaymentGatewayConfig",
132
+ });
133
+ Logger({ level: "WARN", message: res_error });
134
+ }
135
+
136
+ return response;
63
137
  }
64
138
 
65
139
  /**
66
140
  * @param {Object} arg - Arg object.
67
141
  * @param {PaymentGatewayConfigRequest} arg.body
142
+ * @returns {Promise<PaymentGatewayToBeReviewed>} - Success response
68
143
  * @summary: Save Config Secret For Brand Payment Gateway
69
144
  * @description: Save Config Secret For Brand Payment Gateway
70
145
  */
71
- updateBrandPaymentGatewayConfig({ body } = {}) {
146
+ async updateBrandPaymentGatewayConfig({ body } = {}) {
72
147
  const {
73
148
  error,
74
149
  } = PaymentValidator.updateBrandPaymentGatewayConfig().validate(
@@ -81,25 +156,62 @@ class Payment {
81
156
  return Promise.reject(new FDKClientValidationError(error));
82
157
  }
83
158
 
159
+ // Showing warrnings if extra unknown parameters are found
160
+ const {
161
+ error: warrning,
162
+ } = PaymentValidator.updateBrandPaymentGatewayConfig().validate(
163
+ {
164
+ body,
165
+ },
166
+ { abortEarly: false, allowUnknown: false }
167
+ );
168
+ if (warrning) {
169
+ Logger({
170
+ level: "WARN",
171
+ message:
172
+ "Parameter Validation warrnings for updateBrandPaymentGatewayConfig",
173
+ });
174
+ Logger({ level: "WARN", message: warrning });
175
+ }
176
+
84
177
  const query_params = {};
85
178
 
86
- return PlatformAPIClient.execute(
179
+ const response = await PlatformAPIClient.execute(
87
180
  this.config,
88
181
  "put",
89
182
  `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/aggregator/request`,
90
183
  query_params,
91
184
  body
92
185
  );
186
+
187
+ const {
188
+ error: res_error,
189
+ } = PaymentModel.PaymentGatewayToBeReviewed().validate(response, {
190
+ abortEarly: false,
191
+ allowUnknown: false,
192
+ });
193
+
194
+ if (res_error) {
195
+ Logger({
196
+ level: "WARN",
197
+ message:
198
+ "Response Validation Warnnings for updateBrandPaymentGatewayConfig",
199
+ });
200
+ Logger({ level: "WARN", message: res_error });
201
+ }
202
+
203
+ return response;
93
204
  }
94
205
 
95
206
  /**
96
207
  * @param {Object} arg - Arg object.
97
208
  * @param {boolean} arg.refresh -
98
209
  * @param {string} arg.requestType -
210
+ * @returns {Promise<PaymentOptionsResponse>} - Success response
99
211
  * @summary: Get All Valid Payment Options
100
212
  * @description: Use this API to get Get All Valid Payment Options for making payment
101
213
  */
102
- getPaymentModeRoutes({ refresh, requestType } = {}) {
214
+ async getPaymentModeRoutes({ refresh, requestType } = {}) {
103
215
  const { error } = PaymentValidator.getPaymentModeRoutes().validate(
104
216
  {
105
217
  refresh,
@@ -111,27 +223,63 @@ class Payment {
111
223
  return Promise.reject(new FDKClientValidationError(error));
112
224
  }
113
225
 
226
+ // Showing warrnings if extra unknown parameters are found
227
+ const {
228
+ error: warrning,
229
+ } = PaymentValidator.getPaymentModeRoutes().validate(
230
+ {
231
+ refresh,
232
+ requestType,
233
+ },
234
+ { abortEarly: false, allowUnknown: false }
235
+ );
236
+ if (warrning) {
237
+ Logger({
238
+ level: "WARN",
239
+ message: "Parameter Validation warrnings for getPaymentModeRoutes",
240
+ });
241
+ Logger({ level: "WARN", message: warrning });
242
+ }
243
+
114
244
  const query_params = {};
115
245
  query_params["refresh"] = refresh;
116
246
  query_params["request_type"] = requestType;
117
247
 
118
- return PlatformAPIClient.execute(
248
+ const response = await PlatformAPIClient.execute(
119
249
  this.config,
120
250
  "get",
121
251
  `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/options`,
122
252
  query_params,
123
253
  undefined
124
254
  );
255
+
256
+ const {
257
+ error: res_error,
258
+ } = PaymentModel.PaymentOptionsResponse().validate(response, {
259
+ abortEarly: false,
260
+ allowUnknown: false,
261
+ });
262
+
263
+ if (res_error) {
264
+ Logger({
265
+ level: "WARN",
266
+ message: "Response Validation Warnnings for getPaymentModeRoutes",
267
+ });
268
+ Logger({ level: "WARN", message: res_error });
269
+ }
270
+
271
+ return response;
125
272
  }
126
273
 
127
274
  /**
128
275
  * @param {Object} arg - Arg object.
129
276
  * @param {string} arg.orderId -
130
277
  * @param {string} [arg.requestHash] -
278
+ * @returns {Promise<RefundAccountResponse>} - Success response
131
279
  * @summary: Get bank details
132
280
  * @description: Use this API to get saved bank details for returned/cancelled order using order id.
133
281
  */
134
- getBankAccountDetailsOpenAPI({ orderId, requestHash } = {}) {
282
+ async getBankAccountDetailsOpenAPI({ orderId, requestHash } = {}) {
135
283
  const { error } = PaymentValidator.getBankAccountDetailsOpenAPI().validate(
136
284
  {
137
285
  orderId,
@@ -143,26 +291,64 @@ class Payment {
143
291
  return Promise.reject(new FDKClientValidationError(error));
144
292
  }
145
293
 
294
+ // Showing warrnings if extra unknown parameters are found
295
+ const {
296
+ error: warrning,
297
+ } = PaymentValidator.getBankAccountDetailsOpenAPI().validate(
298
+ {
299
+ orderId,
300
+ requestHash,
301
+ },
302
+ { abortEarly: false, allowUnknown: false }
303
+ );
304
+ if (warrning) {
305
+ Logger({
306
+ level: "WARN",
307
+ message:
308
+ "Parameter Validation warrnings for getBankAccountDetailsOpenAPI",
309
+ });
310
+ Logger({ level: "WARN", message: warrning });
311
+ }
312
+
146
313
  const query_params = {};
147
314
  query_params["order_id"] = orderId;
148
315
  query_params["request_hash"] = requestHash;
149
316
 
150
- return PlatformAPIClient.execute(
317
+ const response = await PlatformAPIClient.execute(
151
318
  this.config,
152
319
  "get",
153
320
  `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/refund/account`,
154
321
  query_params,
155
322
  undefined
156
323
  );
324
+
325
+ const {
326
+ error: res_error,
327
+ } = PaymentModel.RefundAccountResponse().validate(response, {
328
+ abortEarly: false,
329
+ allowUnknown: false,
330
+ });
331
+
332
+ if (res_error) {
333
+ Logger({
334
+ level: "WARN",
335
+ message:
336
+ "Response Validation Warnnings for getBankAccountDetailsOpenAPI",
337
+ });
338
+ Logger({ level: "WARN", message: res_error });
339
+ }
340
+
341
+ return response;
157
342
  }
158
343
 
159
344
  /**
160
345
  * @param {Object} arg - Arg object.
161
346
  * @param {AddBeneficiaryDetailsOTPRequest} arg.body
347
+ * @returns {Promise<RefundAccountResponse>} - Success response
162
348
  * @summary: Save bank details for cancelled/returned order
163
349
  * @description: Use this API to save bank details for returned/cancelled order to refund amount in his account.
164
350
  */
165
- addRefundBankAccountUsingOTP({ body } = {}) {
351
+ async addRefundBankAccountUsingOTP({ body } = {}) {
166
352
  const { error } = PaymentValidator.addRefundBankAccountUsingOTP().validate(
167
353
  {
168
354
  body,
@@ -173,24 +359,61 @@ class Payment {
173
359
  return Promise.reject(new FDKClientValidationError(error));
174
360
  }
175
361
 
362
+ // Showing warrnings if extra unknown parameters are found
363
+ const {
364
+ error: warrning,
365
+ } = PaymentValidator.addRefundBankAccountUsingOTP().validate(
366
+ {
367
+ body,
368
+ },
369
+ { abortEarly: false, allowUnknown: false }
370
+ );
371
+ if (warrning) {
372
+ Logger({
373
+ level: "WARN",
374
+ message:
375
+ "Parameter Validation warrnings for addRefundBankAccountUsingOTP",
376
+ });
377
+ Logger({ level: "WARN", message: warrning });
378
+ }
379
+
176
380
  const query_params = {};
177
381
 
178
- return PlatformAPIClient.execute(
382
+ const response = await PlatformAPIClient.execute(
179
383
  this.config,
180
384
  "post",
181
385
  `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/refund/account`,
182
386
  query_params,
183
387
  body
184
388
  );
389
+
390
+ const {
391
+ error: res_error,
392
+ } = PaymentModel.RefundAccountResponse().validate(response, {
393
+ abortEarly: false,
394
+ allowUnknown: false,
395
+ });
396
+
397
+ if (res_error) {
398
+ Logger({
399
+ level: "WARN",
400
+ message:
401
+ "Response Validation Warnnings for addRefundBankAccountUsingOTP",
402
+ });
403
+ Logger({ level: "WARN", message: res_error });
404
+ }
405
+
406
+ return response;
185
407
  }
186
408
 
187
409
  /**
188
410
  * @param {Object} arg - Arg object.
189
411
  * @param {string} arg.orderId -
412
+ * @returns {Promise<OrderBeneficiaryResponse>} - Success response
190
413
  * @summary: List Order Beneficiary
191
414
  * @description: Get all active beneficiary details added by the user for refund
192
415
  */
193
- getUserOrderBeneficiaries({ orderId } = {}) {
416
+ async getUserOrderBeneficiaries({ orderId } = {}) {
194
417
  const { error } = PaymentValidator.getUserOrderBeneficiaries().validate(
195
418
  {
196
419
  orderId,
@@ -201,25 +424,60 @@ class Payment {
201
424
  return Promise.reject(new FDKClientValidationError(error));
202
425
  }
203
426
 
427
+ // Showing warrnings if extra unknown parameters are found
428
+ const {
429
+ error: warrning,
430
+ } = PaymentValidator.getUserOrderBeneficiaries().validate(
431
+ {
432
+ orderId,
433
+ },
434
+ { abortEarly: false, allowUnknown: false }
435
+ );
436
+ if (warrning) {
437
+ Logger({
438
+ level: "WARN",
439
+ message: "Parameter Validation warrnings for getUserOrderBeneficiaries",
440
+ });
441
+ Logger({ level: "WARN", message: warrning });
442
+ }
443
+
204
444
  const query_params = {};
205
445
  query_params["order_id"] = orderId;
206
446
 
207
- return PlatformAPIClient.execute(
447
+ const response = await PlatformAPIClient.execute(
208
448
  this.config,
209
449
  "get",
210
450
  `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/refund/accounts/order`,
211
451
  query_params,
212
452
  undefined
213
453
  );
454
+
455
+ const {
456
+ error: res_error,
457
+ } = PaymentModel.OrderBeneficiaryResponse().validate(response, {
458
+ abortEarly: false,
459
+ allowUnknown: false,
460
+ });
461
+
462
+ if (res_error) {
463
+ Logger({
464
+ level: "WARN",
465
+ message: "Response Validation Warnnings for getUserOrderBeneficiaries",
466
+ });
467
+ Logger({ level: "WARN", message: res_error });
468
+ }
469
+
470
+ return response;
214
471
  }
215
472
 
216
473
  /**
217
474
  * @param {Object} arg - Arg object.
218
475
  * @param {string} arg.orderId -
476
+ * @returns {Promise<OrderBeneficiaryResponse>} - Success response
219
477
  * @summary: List User Beneficiary
220
478
  * @description: Get all active beneficiary details added by the user for refund
221
479
  */
222
- getUserBeneficiaries({ orderId } = {}) {
480
+ async getUserBeneficiaries({ orderId } = {}) {
223
481
  const { error } = PaymentValidator.getUserBeneficiaries().validate(
224
482
  {
225
483
  orderId,
@@ -230,25 +488,60 @@ class Payment {
230
488
  return Promise.reject(new FDKClientValidationError(error));
231
489
  }
232
490
 
491
+ // Showing warrnings if extra unknown parameters are found
492
+ const {
493
+ error: warrning,
494
+ } = PaymentValidator.getUserBeneficiaries().validate(
495
+ {
496
+ orderId,
497
+ },
498
+ { abortEarly: false, allowUnknown: false }
499
+ );
500
+ if (warrning) {
501
+ Logger({
502
+ level: "WARN",
503
+ message: "Parameter Validation warrnings for getUserBeneficiaries",
504
+ });
505
+ Logger({ level: "WARN", message: warrning });
506
+ }
507
+
233
508
  const query_params = {};
234
509
  query_params["order_id"] = orderId;
235
510
 
236
- return PlatformAPIClient.execute(
511
+ const response = await PlatformAPIClient.execute(
237
512
  this.config,
238
513
  "get",
239
514
  `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/refund/accounts/user`,
240
515
  query_params,
241
516
  undefined
242
517
  );
518
+
519
+ const {
520
+ error: res_error,
521
+ } = PaymentModel.OrderBeneficiaryResponse().validate(response, {
522
+ abortEarly: false,
523
+ allowUnknown: false,
524
+ });
525
+
526
+ if (res_error) {
527
+ Logger({
528
+ level: "WARN",
529
+ message: "Response Validation Warnnings for getUserBeneficiaries",
530
+ });
531
+ Logger({ level: "WARN", message: res_error });
532
+ }
533
+
534
+ return response;
243
535
  }
244
536
 
245
537
  /**
246
538
  * @param {Object} arg - Arg object.
247
539
  * @param {PaymentConfirmationRequest} arg.body
540
+ * @returns {Promise<PaymentConfirmationResponse>} - Success response
248
541
  * @summary: Confirm payment after successful payment from payment gateway
249
542
  * @description: Use this API to confirm payment after payment gateway accepted payment.
250
543
  */
251
- confirmPayment({ body } = {}) {
544
+ async confirmPayment({ body } = {}) {
252
545
  const { error } = PaymentValidator.confirmPayment().validate(
253
546
  {
254
547
  body,
@@ -259,25 +552,58 @@ class Payment {
259
552
  return Promise.reject(new FDKClientValidationError(error));
260
553
  }
261
554
 
555
+ // Showing warrnings if extra unknown parameters are found
556
+ const { error: warrning } = PaymentValidator.confirmPayment().validate(
557
+ {
558
+ body,
559
+ },
560
+ { abortEarly: false, allowUnknown: false }
561
+ );
562
+ if (warrning) {
563
+ Logger({
564
+ level: "WARN",
565
+ message: "Parameter Validation warrnings for confirmPayment",
566
+ });
567
+ Logger({ level: "WARN", message: warrning });
568
+ }
569
+
262
570
  const query_params = {};
263
571
 
264
- return PlatformAPIClient.execute(
572
+ const response = await PlatformAPIClient.execute(
265
573
  this.config,
266
574
  "post",
267
575
  `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/confirm`,
268
576
  query_params,
269
577
  body
270
578
  );
579
+
580
+ const {
581
+ error: res_error,
582
+ } = PaymentModel.PaymentConfirmationResponse().validate(response, {
583
+ abortEarly: false,
584
+ allowUnknown: false,
585
+ });
586
+
587
+ if (res_error) {
588
+ Logger({
589
+ level: "WARN",
590
+ message: "Response Validation Warnnings for confirmPayment",
591
+ });
592
+ Logger({ level: "WARN", message: res_error });
593
+ }
594
+
595
+ return response;
271
596
  }
272
597
 
273
598
  /**
274
599
  * @param {Object} arg - Arg object.
275
600
  * @param {string} arg.merchantUserId -
276
601
  * @param {string} arg.mobileNo -
602
+ * @returns {Promise<GetUserCODLimitResponse>} - Success response
277
603
  * @summary: Get COD limit for user
278
604
  * @description: Use this API to get user cod limit and reamining limit for the payment
279
605
  */
280
- getUserCODlimitRoutes({ merchantUserId, mobileNo } = {}) {
606
+ async getUserCODlimitRoutes({ merchantUserId, mobileNo } = {}) {
281
607
  const { error } = PaymentValidator.getUserCODlimitRoutes().validate(
282
608
  {
283
609
  merchantUserId,
@@ -289,26 +615,62 @@ class Payment {
289
615
  return Promise.reject(new FDKClientValidationError(error));
290
616
  }
291
617
 
618
+ // Showing warrnings if extra unknown parameters are found
619
+ const {
620
+ error: warrning,
621
+ } = PaymentValidator.getUserCODlimitRoutes().validate(
622
+ {
623
+ merchantUserId,
624
+ mobileNo,
625
+ },
626
+ { abortEarly: false, allowUnknown: false }
627
+ );
628
+ if (warrning) {
629
+ Logger({
630
+ level: "WARN",
631
+ message: "Parameter Validation warrnings for getUserCODlimitRoutes",
632
+ });
633
+ Logger({ level: "WARN", message: warrning });
634
+ }
635
+
292
636
  const query_params = {};
293
637
  query_params["merchant_user_id"] = merchantUserId;
294
638
  query_params["mobile_no"] = mobileNo;
295
639
 
296
- return PlatformAPIClient.execute(
640
+ const response = await PlatformAPIClient.execute(
297
641
  this.config,
298
642
  "get",
299
643
  `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/user-cod`,
300
644
  query_params,
301
645
  undefined
302
646
  );
647
+
648
+ const {
649
+ error: res_error,
650
+ } = PaymentModel.GetUserCODLimitResponse().validate(response, {
651
+ abortEarly: false,
652
+ allowUnknown: false,
653
+ });
654
+
655
+ if (res_error) {
656
+ Logger({
657
+ level: "WARN",
658
+ message: "Response Validation Warnnings for getUserCODlimitRoutes",
659
+ });
660
+ Logger({ level: "WARN", message: res_error });
661
+ }
662
+
663
+ return response;
303
664
  }
304
665
 
305
666
  /**
306
667
  * @param {Object} arg - Arg object.
307
668
  * @param {SetCODForUserRequest} arg.body
669
+ * @returns {Promise<SetCODOptionResponse>} - Success response
308
670
  * @summary: Set COD option for user for payment
309
671
  * @description: Use this API to set cod option as true or false for the payment
310
672
  */
311
- setUserCODlimitRoutes({ body } = {}) {
673
+ async setUserCODlimitRoutes({ body } = {}) {
312
674
  const { error } = PaymentValidator.setUserCODlimitRoutes().validate(
313
675
  {
314
676
  body,
@@ -319,15 +681,49 @@ class Payment {
319
681
  return Promise.reject(new FDKClientValidationError(error));
320
682
  }
321
683
 
684
+ // Showing warrnings if extra unknown parameters are found
685
+ const {
686
+ error: warrning,
687
+ } = PaymentValidator.setUserCODlimitRoutes().validate(
688
+ {
689
+ body,
690
+ },
691
+ { abortEarly: false, allowUnknown: false }
692
+ );
693
+ if (warrning) {
694
+ Logger({
695
+ level: "WARN",
696
+ message: "Parameter Validation warrnings for setUserCODlimitRoutes",
697
+ });
698
+ Logger({ level: "WARN", message: warrning });
699
+ }
700
+
322
701
  const query_params = {};
323
702
 
324
- return PlatformAPIClient.execute(
703
+ const response = await PlatformAPIClient.execute(
325
704
  this.config,
326
705
  "put",
327
706
  `/service/platform/payment/v1.0/company/${this.config.companyId}/application/${this.applicationId}/payment/user-cod`,
328
707
  query_params,
329
708
  body
330
709
  );
710
+
711
+ const {
712
+ error: res_error,
713
+ } = PaymentModel.SetCODOptionResponse().validate(response, {
714
+ abortEarly: false,
715
+ allowUnknown: false,
716
+ });
717
+
718
+ if (res_error) {
719
+ Logger({
720
+ level: "WARN",
721
+ message: "Response Validation Warnnings for setUserCODlimitRoutes",
722
+ });
723
+ Logger({ level: "WARN", message: res_error });
724
+ }
725
+
726
+ return response;
331
727
  }
332
728
  }
333
729
  module.exports = Payment;