@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.
- package/documentation/application/CART.md +251 -251
- package/documentation/application/CATALOG.md +393 -393
- package/documentation/application/CONTENT.md +15 -1
- package/documentation/application/ORDER.md +268 -268
- package/documentation/application/PAYMENT.md +249 -249
- package/documentation/application/POSCART.md +297 -297
- package/documentation/platform/CART.md +499 -499
- package/documentation/platform/CATALOG.md +3497 -3097
- package/documentation/platform/COMPANYPROFILE.md +207 -207
- package/documentation/platform/CONTENT.md +123 -1
- package/documentation/platform/ORDER.md +1518 -1324
- package/documentation/platform/PARTNER.md +7 -7
- package/documentation/platform/PAYMENT.md +96 -96
- package/index.js +7 -1
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +865 -52
- package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationModel.js +335 -335
- package/sdk/application/Cart/CartApplicationValidator.js +1 -0
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +1034 -60
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +19 -19
- package/sdk/application/Catalog/CatalogApplicationModel.js +532 -532
- package/sdk/application/Catalog/CatalogApplicationValidator.js +1 -0
- package/sdk/application/Common/CommonApplicationClient.js +66 -4
- package/sdk/application/Common/CommonApplicationValidator.js +1 -0
- package/sdk/application/Communication/CommunicationApplicationClient.js +108 -6
- package/sdk/application/Communication/CommunicationApplicationValidator.js +1 -0
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +558 -32
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +1 -0
- package/sdk/application/Content/ContentApplicationClient.js +621 -38
- package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +11 -1
- package/sdk/application/Content/ContentApplicationValidator.js +1 -0
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +101 -6
- package/sdk/application/FileStorage/FileStorageApplicationValidator.js +1 -0
- package/sdk/application/Lead/LeadApplicationClient.js +229 -14
- package/sdk/application/Lead/LeadApplicationValidator.js +1 -0
- package/sdk/application/Logistic/LogisticApplicationClient.js +134 -8
- package/sdk/application/Logistic/LogisticApplicationValidator.js +1 -0
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +403 -24
- package/sdk/application/Order/OrderApplicationModel.d.ts +20 -20
- package/sdk/application/Order/OrderApplicationModel.js +334 -334
- package/sdk/application/Order/OrderApplicationValidator.js +1 -0
- package/sdk/application/Payment/PaymentApplicationClient.js +1381 -78
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +2 -2
- package/sdk/application/Payment/PaymentApplicationModel.js +350 -350
- package/sdk/application/Payment/PaymentApplicationValidator.js +1 -0
- package/sdk/application/PosCart/PosCartApplicationClient.js +914 -54
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
- package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
- package/sdk/application/PosCart/PosCartApplicationValidator.js +1 -0
- package/sdk/application/Rewards/RewardsApplicationClient.js +235 -14
- package/sdk/application/Rewards/RewardsApplicationValidator.js +1 -0
- package/sdk/application/Share/ShareApplicationClient.js +226 -14
- package/sdk/application/Share/ShareApplicationValidator.js +1 -0
- package/sdk/application/Theme/ThemeApplicationClient.js +130 -8
- package/sdk/application/Theme/ThemeApplicationValidator.js +1 -0
- package/sdk/application/User/UserApplicationClient.js +1133 -70
- package/sdk/application/User/UserApplicationValidator.js +1 -0
- package/sdk/common/AxiosHelper.js +1 -1
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +287 -16
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +153 -8
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +141 -8
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
- package/sdk/platform/Billing/BillingPlatformClient.js +429 -24
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +617 -34
- package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
- package/sdk/platform/Cart/CartPlatformModel.js +617 -617
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +191 -138
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2202 -302
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +11 -11
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +45 -45
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +344 -226
- package/sdk/platform/Catalog/CatalogPlatformClient.js +3282 -488
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +110 -100
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2073 -1795
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +23 -21
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +103 -84
- package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
- package/sdk/platform/Common/CommonPlatformClient.js +73 -4
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1499 -80
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +41 -2
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +486 -26
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +9 -9
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +274 -274
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1022 -56
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +693 -36
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +2446 -140
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
- package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
- package/sdk/platform/Content/ContentPlatformModel.js +43 -1
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
- package/sdk/platform/Discount/DiscountPlatformClient.js +400 -22
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +148 -8
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +214 -12
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
- package/sdk/platform/Inventory/InventoryPlatformClient.js +449 -24
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +447 -26
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +384 -22
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +125 -6
- package/sdk/platform/Order/OrderPlatformClient.d.ts +108 -47
- package/sdk/platform/Order/OrderPlatformClient.js +1641 -100
- package/sdk/platform/Order/OrderPlatformModel.d.ts +69 -58
- package/sdk/platform/Order/OrderPlatformModel.js +1485 -1493
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +2 -1
- package/sdk/platform/Order/OrderPlatformValidator.js +15 -4
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +74 -4
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
- package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +418 -22
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
- package/sdk/platform/Payment/PaymentPlatformClient.js +374 -20
- package/sdk/platform/Payment/PaymentPlatformModel.js +139 -139
- package/sdk/platform/PlatformApplicationClient.d.ts +2973 -2827
- package/sdk/platform/PlatformApplicationClient.js +3461 -3263
- package/sdk/platform/PlatformClient.d.ts +2973 -2827
- package/sdk/platform/PlatformClient.js +3461 -3263
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +449 -26
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/Share/SharePlatformApplicationClient.js +139 -8
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +816 -48
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
- package/sdk/platform/User/UserPlatformApplicationClient.js +417 -24
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
- package/sdk/platform/Webhook/WebhookPlatformClient.js +229 -12
- package/sdk/public/Configuration/ConfigurationPublicClient.js +72 -4
- package/sdk/public/Configuration/ConfigurationPublicValidator.js +3 -1
- package/sdk/public/Inventory/InventoryPublicClient.js +210 -12
- package/sdk/public/Inventory/InventoryPublicValidator.js +3 -1
- package/sdk/public/Webhook/WebhookPublicClient.js +74 -4
- package/sdk/public/Webhook/WebhookPublicValidator.js +3 -1
|
@@ -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 }
|
|
@@ -108,13 +110,29 @@ class Payment {
|
|
|
108
110
|
if (error) {
|
|
109
111
|
return Promise.reject(new FDKClientValidationError(error));
|
|
110
112
|
}
|
|
113
|
+
|
|
114
|
+
// Showing warrnings if extra unknown parameters are found
|
|
115
|
+
const {
|
|
116
|
+
error: warrning,
|
|
117
|
+
} = PaymentValidator.getAggregatorsConfig().validate(
|
|
118
|
+
{ xApiToken, refresh },
|
|
119
|
+
{ abortEarly: false, allowUnknown: false }
|
|
120
|
+
);
|
|
121
|
+
if (warrning) {
|
|
122
|
+
Logger({
|
|
123
|
+
level: "WARN",
|
|
124
|
+
message: "Parameter Validation warrnings for getAggregatorsConfig",
|
|
125
|
+
});
|
|
126
|
+
Logger({ level: "WARN", message: warrning });
|
|
127
|
+
}
|
|
128
|
+
|
|
111
129
|
const query_params = {};
|
|
112
130
|
query_params["refresh"] = refresh;
|
|
113
131
|
|
|
114
132
|
const xHeaders = {};
|
|
115
133
|
xHeaders["x-api-token"] = xApiToken;
|
|
116
134
|
|
|
117
|
-
|
|
135
|
+
const response = await APIClient.execute(
|
|
118
136
|
this._conf,
|
|
119
137
|
"get",
|
|
120
138
|
constructUrl({
|
|
@@ -125,6 +143,23 @@ class Payment {
|
|
|
125
143
|
undefined,
|
|
126
144
|
xHeaders
|
|
127
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;
|
|
128
163
|
}
|
|
129
164
|
|
|
130
165
|
/**
|
|
@@ -134,7 +169,7 @@ class Payment {
|
|
|
134
169
|
* @summary: Attach a saved card to customer.
|
|
135
170
|
* @description: Use this API to attach a customer's saved card at the payment gateway, such as Stripe, Juspay.
|
|
136
171
|
*/
|
|
137
|
-
attachCardToCustomer({ body } = {}) {
|
|
172
|
+
async attachCardToCustomer({ body } = {}) {
|
|
138
173
|
const { error } = PaymentValidator.attachCardToCustomer().validate(
|
|
139
174
|
{ body },
|
|
140
175
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -142,11 +177,27 @@ class Payment {
|
|
|
142
177
|
if (error) {
|
|
143
178
|
return Promise.reject(new FDKClientValidationError(error));
|
|
144
179
|
}
|
|
180
|
+
|
|
181
|
+
// Showing warrnings if extra unknown parameters are found
|
|
182
|
+
const {
|
|
183
|
+
error: warrning,
|
|
184
|
+
} = PaymentValidator.attachCardToCustomer().validate(
|
|
185
|
+
{ body },
|
|
186
|
+
{ abortEarly: false, allowUnknown: false }
|
|
187
|
+
);
|
|
188
|
+
if (warrning) {
|
|
189
|
+
Logger({
|
|
190
|
+
level: "WARN",
|
|
191
|
+
message: "Parameter Validation warrnings for attachCardToCustomer",
|
|
192
|
+
});
|
|
193
|
+
Logger({ level: "WARN", message: warrning });
|
|
194
|
+
}
|
|
195
|
+
|
|
145
196
|
const query_params = {};
|
|
146
197
|
|
|
147
198
|
const xHeaders = {};
|
|
148
199
|
|
|
149
|
-
|
|
200
|
+
const response = await APIClient.execute(
|
|
150
201
|
this._conf,
|
|
151
202
|
"post",
|
|
152
203
|
constructUrl({
|
|
@@ -157,6 +208,23 @@ class Payment {
|
|
|
157
208
|
body,
|
|
158
209
|
xHeaders
|
|
159
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;
|
|
160
228
|
}
|
|
161
229
|
|
|
162
230
|
/**
|
|
@@ -166,7 +234,7 @@ class Payment {
|
|
|
166
234
|
* @summary: Fetch active payment gateway for card payments
|
|
167
235
|
* @description: Use this API to retrieve an active payment aggregator along with the Customer ID. This is applicable for cards payments only.
|
|
168
236
|
*/
|
|
169
|
-
getActiveCardAggregator({ refresh } = {}) {
|
|
237
|
+
async getActiveCardAggregator({ refresh } = {}) {
|
|
170
238
|
const { error } = PaymentValidator.getActiveCardAggregator().validate(
|
|
171
239
|
{ refresh },
|
|
172
240
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -174,12 +242,28 @@ class Payment {
|
|
|
174
242
|
if (error) {
|
|
175
243
|
return Promise.reject(new FDKClientValidationError(error));
|
|
176
244
|
}
|
|
245
|
+
|
|
246
|
+
// Showing warrnings if extra unknown parameters are found
|
|
247
|
+
const {
|
|
248
|
+
error: warrning,
|
|
249
|
+
} = PaymentValidator.getActiveCardAggregator().validate(
|
|
250
|
+
{ refresh },
|
|
251
|
+
{ abortEarly: false, allowUnknown: false }
|
|
252
|
+
);
|
|
253
|
+
if (warrning) {
|
|
254
|
+
Logger({
|
|
255
|
+
level: "WARN",
|
|
256
|
+
message: "Parameter Validation warrnings for getActiveCardAggregator",
|
|
257
|
+
});
|
|
258
|
+
Logger({ level: "WARN", message: warrning });
|
|
259
|
+
}
|
|
260
|
+
|
|
177
261
|
const query_params = {};
|
|
178
262
|
query_params["refresh"] = refresh;
|
|
179
263
|
|
|
180
264
|
const xHeaders = {};
|
|
181
265
|
|
|
182
|
-
|
|
266
|
+
const response = await APIClient.execute(
|
|
183
267
|
this._conf,
|
|
184
268
|
"get",
|
|
185
269
|
constructUrl({
|
|
@@ -190,6 +274,23 @@ class Payment {
|
|
|
190
274
|
undefined,
|
|
191
275
|
xHeaders
|
|
192
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;
|
|
193
294
|
}
|
|
194
295
|
|
|
195
296
|
/**
|
|
@@ -199,7 +300,7 @@ class Payment {
|
|
|
199
300
|
* @summary: Fetch the list of cards saved by the user
|
|
200
301
|
* @description: Use this API to retrieve a list of cards stored by user from an active payment gateway.
|
|
201
302
|
*/
|
|
202
|
-
getActiveUserCards({ forceRefresh } = {}) {
|
|
303
|
+
async getActiveUserCards({ forceRefresh } = {}) {
|
|
203
304
|
const { error } = PaymentValidator.getActiveUserCards().validate(
|
|
204
305
|
{ forceRefresh },
|
|
205
306
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -207,12 +308,26 @@ class Payment {
|
|
|
207
308
|
if (error) {
|
|
208
309
|
return Promise.reject(new FDKClientValidationError(error));
|
|
209
310
|
}
|
|
311
|
+
|
|
312
|
+
// Showing warrnings if extra unknown parameters are found
|
|
313
|
+
const { error: warrning } = PaymentValidator.getActiveUserCards().validate(
|
|
314
|
+
{ forceRefresh },
|
|
315
|
+
{ abortEarly: false, allowUnknown: false }
|
|
316
|
+
);
|
|
317
|
+
if (warrning) {
|
|
318
|
+
Logger({
|
|
319
|
+
level: "WARN",
|
|
320
|
+
message: "Parameter Validation warrnings for getActiveUserCards",
|
|
321
|
+
});
|
|
322
|
+
Logger({ level: "WARN", message: warrning });
|
|
323
|
+
}
|
|
324
|
+
|
|
210
325
|
const query_params = {};
|
|
211
326
|
query_params["force_refresh"] = forceRefresh;
|
|
212
327
|
|
|
213
328
|
const xHeaders = {};
|
|
214
329
|
|
|
215
|
-
|
|
330
|
+
const response = await APIClient.execute(
|
|
216
331
|
this._conf,
|
|
217
332
|
"get",
|
|
218
333
|
constructUrl({
|
|
@@ -223,6 +338,23 @@ class Payment {
|
|
|
223
338
|
undefined,
|
|
224
339
|
xHeaders
|
|
225
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;
|
|
226
358
|
}
|
|
227
359
|
|
|
228
360
|
/**
|
|
@@ -232,7 +364,7 @@ class Payment {
|
|
|
232
364
|
* @summary: Delete a card
|
|
233
365
|
* @description: Use this API to delete a card added by a user on the payment gateway and clear the cache.
|
|
234
366
|
*/
|
|
235
|
-
deleteUserCard({ body } = {}) {
|
|
367
|
+
async deleteUserCard({ body } = {}) {
|
|
236
368
|
const { error } = PaymentValidator.deleteUserCard().validate(
|
|
237
369
|
{ body },
|
|
238
370
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -240,11 +372,25 @@ class Payment {
|
|
|
240
372
|
if (error) {
|
|
241
373
|
return Promise.reject(new FDKClientValidationError(error));
|
|
242
374
|
}
|
|
375
|
+
|
|
376
|
+
// Showing warrnings if extra unknown parameters are found
|
|
377
|
+
const { error: warrning } = PaymentValidator.deleteUserCard().validate(
|
|
378
|
+
{ body },
|
|
379
|
+
{ abortEarly: false, allowUnknown: false }
|
|
380
|
+
);
|
|
381
|
+
if (warrning) {
|
|
382
|
+
Logger({
|
|
383
|
+
level: "WARN",
|
|
384
|
+
message: "Parameter Validation warrnings for deleteUserCard",
|
|
385
|
+
});
|
|
386
|
+
Logger({ level: "WARN", message: warrning });
|
|
387
|
+
}
|
|
388
|
+
|
|
243
389
|
const query_params = {};
|
|
244
390
|
|
|
245
391
|
const xHeaders = {};
|
|
246
392
|
|
|
247
|
-
|
|
393
|
+
const response = await APIClient.execute(
|
|
248
394
|
this._conf,
|
|
249
395
|
"post",
|
|
250
396
|
constructUrl({
|
|
@@ -255,6 +401,23 @@ class Payment {
|
|
|
255
401
|
body,
|
|
256
402
|
xHeaders
|
|
257
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;
|
|
258
421
|
}
|
|
259
422
|
|
|
260
423
|
/**
|
|
@@ -264,7 +427,7 @@ class Payment {
|
|
|
264
427
|
* @summary: Validate customer for payment
|
|
265
428
|
* @description: Use this API to check if the customer is eligible to use credit-line facilities such as Simpl Pay Later and Rupifi.
|
|
266
429
|
*/
|
|
267
|
-
verifyCustomerForPayment({ body } = {}) {
|
|
430
|
+
async verifyCustomerForPayment({ body } = {}) {
|
|
268
431
|
const { error } = PaymentValidator.verifyCustomerForPayment().validate(
|
|
269
432
|
{ body },
|
|
270
433
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -272,11 +435,27 @@ class Payment {
|
|
|
272
435
|
if (error) {
|
|
273
436
|
return Promise.reject(new FDKClientValidationError(error));
|
|
274
437
|
}
|
|
438
|
+
|
|
439
|
+
// Showing warrnings if extra unknown parameters are found
|
|
440
|
+
const {
|
|
441
|
+
error: warrning,
|
|
442
|
+
} = PaymentValidator.verifyCustomerForPayment().validate(
|
|
443
|
+
{ body },
|
|
444
|
+
{ abortEarly: false, allowUnknown: false }
|
|
445
|
+
);
|
|
446
|
+
if (warrning) {
|
|
447
|
+
Logger({
|
|
448
|
+
level: "WARN",
|
|
449
|
+
message: "Parameter Validation warrnings for verifyCustomerForPayment",
|
|
450
|
+
});
|
|
451
|
+
Logger({ level: "WARN", message: warrning });
|
|
452
|
+
}
|
|
453
|
+
|
|
275
454
|
const query_params = {};
|
|
276
455
|
|
|
277
456
|
const xHeaders = {};
|
|
278
457
|
|
|
279
|
-
|
|
458
|
+
const response = await APIClient.execute(
|
|
280
459
|
this._conf,
|
|
281
460
|
"post",
|
|
282
461
|
constructUrl({
|
|
@@ -287,6 +466,23 @@ class Payment {
|
|
|
287
466
|
body,
|
|
288
467
|
xHeaders
|
|
289
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;
|
|
290
486
|
}
|
|
291
487
|
|
|
292
488
|
/**
|
|
@@ -296,7 +492,7 @@ class Payment {
|
|
|
296
492
|
* @summary: Verify and charge payment
|
|
297
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.
|
|
298
494
|
*/
|
|
299
|
-
verifyAndChargePayment({ body } = {}) {
|
|
495
|
+
async verifyAndChargePayment({ body } = {}) {
|
|
300
496
|
const { error } = PaymentValidator.verifyAndChargePayment().validate(
|
|
301
497
|
{ body },
|
|
302
498
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -304,11 +500,27 @@ class Payment {
|
|
|
304
500
|
if (error) {
|
|
305
501
|
return Promise.reject(new FDKClientValidationError(error));
|
|
306
502
|
}
|
|
503
|
+
|
|
504
|
+
// Showing warrnings if extra unknown parameters are found
|
|
505
|
+
const {
|
|
506
|
+
error: warrning,
|
|
507
|
+
} = PaymentValidator.verifyAndChargePayment().validate(
|
|
508
|
+
{ body },
|
|
509
|
+
{ abortEarly: false, allowUnknown: false }
|
|
510
|
+
);
|
|
511
|
+
if (warrning) {
|
|
512
|
+
Logger({
|
|
513
|
+
level: "WARN",
|
|
514
|
+
message: "Parameter Validation warrnings for verifyAndChargePayment",
|
|
515
|
+
});
|
|
516
|
+
Logger({ level: "WARN", message: warrning });
|
|
517
|
+
}
|
|
518
|
+
|
|
307
519
|
const query_params = {};
|
|
308
520
|
|
|
309
521
|
const xHeaders = {};
|
|
310
522
|
|
|
311
|
-
|
|
523
|
+
const response = await APIClient.execute(
|
|
312
524
|
this._conf,
|
|
313
525
|
"post",
|
|
314
526
|
constructUrl({
|
|
@@ -319,6 +531,23 @@ class Payment {
|
|
|
319
531
|
body,
|
|
320
532
|
xHeaders
|
|
321
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;
|
|
322
551
|
}
|
|
323
552
|
|
|
324
553
|
/**
|
|
@@ -328,7 +557,7 @@ class Payment {
|
|
|
328
557
|
* @summary: Initialize a payment (server-to-server) for UPI and BharatQR
|
|
329
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.
|
|
330
559
|
*/
|
|
331
|
-
initialisePayment({ body } = {}) {
|
|
560
|
+
async initialisePayment({ body } = {}) {
|
|
332
561
|
const { error } = PaymentValidator.initialisePayment().validate(
|
|
333
562
|
{ body },
|
|
334
563
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -336,11 +565,25 @@ class Payment {
|
|
|
336
565
|
if (error) {
|
|
337
566
|
return Promise.reject(new FDKClientValidationError(error));
|
|
338
567
|
}
|
|
568
|
+
|
|
569
|
+
// Showing warrnings if extra unknown parameters are found
|
|
570
|
+
const { error: warrning } = PaymentValidator.initialisePayment().validate(
|
|
571
|
+
{ body },
|
|
572
|
+
{ abortEarly: false, allowUnknown: false }
|
|
573
|
+
);
|
|
574
|
+
if (warrning) {
|
|
575
|
+
Logger({
|
|
576
|
+
level: "WARN",
|
|
577
|
+
message: "Parameter Validation warrnings for initialisePayment",
|
|
578
|
+
});
|
|
579
|
+
Logger({ level: "WARN", message: warrning });
|
|
580
|
+
}
|
|
581
|
+
|
|
339
582
|
const query_params = {};
|
|
340
583
|
|
|
341
584
|
const xHeaders = {};
|
|
342
585
|
|
|
343
|
-
|
|
586
|
+
const response = await APIClient.execute(
|
|
344
587
|
this._conf,
|
|
345
588
|
"post",
|
|
346
589
|
constructUrl({
|
|
@@ -351,6 +594,23 @@ class Payment {
|
|
|
351
594
|
body,
|
|
352
595
|
xHeaders
|
|
353
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;
|
|
354
614
|
}
|
|
355
615
|
|
|
356
616
|
/**
|
|
@@ -360,7 +620,7 @@ class Payment {
|
|
|
360
620
|
* @summary: Performs continuous polling to check status of payment on the server
|
|
361
621
|
* @description: Use this API to perform continuous polling at intervals to check the status of payment until timeout.
|
|
362
622
|
*/
|
|
363
|
-
checkAndUpdatePaymentStatus({ body } = {}) {
|
|
623
|
+
async checkAndUpdatePaymentStatus({ body } = {}) {
|
|
364
624
|
const { error } = PaymentValidator.checkAndUpdatePaymentStatus().validate(
|
|
365
625
|
{ body },
|
|
366
626
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -368,11 +628,28 @@ class Payment {
|
|
|
368
628
|
if (error) {
|
|
369
629
|
return Promise.reject(new FDKClientValidationError(error));
|
|
370
630
|
}
|
|
631
|
+
|
|
632
|
+
// Showing warrnings if extra unknown parameters are found
|
|
633
|
+
const {
|
|
634
|
+
error: warrning,
|
|
635
|
+
} = PaymentValidator.checkAndUpdatePaymentStatus().validate(
|
|
636
|
+
{ body },
|
|
637
|
+
{ abortEarly: false, allowUnknown: false }
|
|
638
|
+
);
|
|
639
|
+
if (warrning) {
|
|
640
|
+
Logger({
|
|
641
|
+
level: "WARN",
|
|
642
|
+
message:
|
|
643
|
+
"Parameter Validation warrnings for checkAndUpdatePaymentStatus",
|
|
644
|
+
});
|
|
645
|
+
Logger({ level: "WARN", message: warrning });
|
|
646
|
+
}
|
|
647
|
+
|
|
371
648
|
const query_params = {};
|
|
372
649
|
|
|
373
650
|
const xHeaders = {};
|
|
374
651
|
|
|
375
|
-
|
|
652
|
+
const response = await APIClient.execute(
|
|
376
653
|
this._conf,
|
|
377
654
|
"post",
|
|
378
655
|
constructUrl({
|
|
@@ -383,6 +660,24 @@ class Payment {
|
|
|
383
660
|
body,
|
|
384
661
|
xHeaders
|
|
385
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;
|
|
386
681
|
}
|
|
387
682
|
|
|
388
683
|
/**
|
|
@@ -402,7 +697,7 @@ class Payment {
|
|
|
402
697
|
* @summary: Get applicable payment options
|
|
403
698
|
* @description: Use this API to get all valid payment options for doing a payment.
|
|
404
699
|
*/
|
|
405
|
-
getPaymentModeRoutes({
|
|
700
|
+
async getPaymentModeRoutes({
|
|
406
701
|
amount,
|
|
407
702
|
cartId,
|
|
408
703
|
pincode,
|
|
@@ -426,6 +721,30 @@ class Payment {
|
|
|
426
721
|
if (error) {
|
|
427
722
|
return Promise.reject(new FDKClientValidationError(error));
|
|
428
723
|
}
|
|
724
|
+
|
|
725
|
+
// Showing warrnings if extra unknown parameters are found
|
|
726
|
+
const {
|
|
727
|
+
error: warrning,
|
|
728
|
+
} = PaymentValidator.getPaymentModeRoutes().validate(
|
|
729
|
+
{
|
|
730
|
+
amount,
|
|
731
|
+
cartId,
|
|
732
|
+
pincode,
|
|
733
|
+
checkoutMode,
|
|
734
|
+
refresh,
|
|
735
|
+
cardReference,
|
|
736
|
+
userDetails,
|
|
737
|
+
},
|
|
738
|
+
{ abortEarly: false, allowUnknown: false }
|
|
739
|
+
);
|
|
740
|
+
if (warrning) {
|
|
741
|
+
Logger({
|
|
742
|
+
level: "WARN",
|
|
743
|
+
message: "Parameter Validation warrnings for getPaymentModeRoutes",
|
|
744
|
+
});
|
|
745
|
+
Logger({ level: "WARN", message: warrning });
|
|
746
|
+
}
|
|
747
|
+
|
|
429
748
|
const query_params = {};
|
|
430
749
|
query_params["amount"] = amount;
|
|
431
750
|
query_params["cart_id"] = cartId;
|
|
@@ -437,7 +756,7 @@ class Payment {
|
|
|
437
756
|
|
|
438
757
|
const xHeaders = {};
|
|
439
758
|
|
|
440
|
-
|
|
759
|
+
const response = await APIClient.execute(
|
|
441
760
|
this._conf,
|
|
442
761
|
"get",
|
|
443
762
|
constructUrl({
|
|
@@ -448,6 +767,23 @@ class Payment {
|
|
|
448
767
|
undefined,
|
|
449
768
|
xHeaders
|
|
450
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;
|
|
451
787
|
}
|
|
452
788
|
|
|
453
789
|
/**
|
|
@@ -470,7 +806,7 @@ class Payment {
|
|
|
470
806
|
* @summary: Get applicable payment options for Point-of-Sale (POS)
|
|
471
807
|
* @description: Use this API to get all valid payment options for doing a payment in POS.
|
|
472
808
|
*/
|
|
473
|
-
getPosPaymentModeRoutes({
|
|
809
|
+
async getPosPaymentModeRoutes({
|
|
474
810
|
amount,
|
|
475
811
|
cartId,
|
|
476
812
|
pincode,
|
|
@@ -496,6 +832,31 @@ class Payment {
|
|
|
496
832
|
if (error) {
|
|
497
833
|
return Promise.reject(new FDKClientValidationError(error));
|
|
498
834
|
}
|
|
835
|
+
|
|
836
|
+
// Showing warrnings if extra unknown parameters are found
|
|
837
|
+
const {
|
|
838
|
+
error: warrning,
|
|
839
|
+
} = PaymentValidator.getPosPaymentModeRoutes().validate(
|
|
840
|
+
{
|
|
841
|
+
amount,
|
|
842
|
+
cartId,
|
|
843
|
+
pincode,
|
|
844
|
+
checkoutMode,
|
|
845
|
+
orderType,
|
|
846
|
+
refresh,
|
|
847
|
+
cardReference,
|
|
848
|
+
userDetails,
|
|
849
|
+
},
|
|
850
|
+
{ abortEarly: false, allowUnknown: false }
|
|
851
|
+
);
|
|
852
|
+
if (warrning) {
|
|
853
|
+
Logger({
|
|
854
|
+
level: "WARN",
|
|
855
|
+
message: "Parameter Validation warrnings for getPosPaymentModeRoutes",
|
|
856
|
+
});
|
|
857
|
+
Logger({ level: "WARN", message: warrning });
|
|
858
|
+
}
|
|
859
|
+
|
|
499
860
|
const query_params = {};
|
|
500
861
|
query_params["amount"] = amount;
|
|
501
862
|
query_params["cart_id"] = cartId;
|
|
@@ -508,7 +869,7 @@ class Payment {
|
|
|
508
869
|
|
|
509
870
|
const xHeaders = {};
|
|
510
871
|
|
|
511
|
-
|
|
872
|
+
const response = await APIClient.execute(
|
|
512
873
|
this._conf,
|
|
513
874
|
"get",
|
|
514
875
|
constructUrl({
|
|
@@ -519,6 +880,23 @@ class Payment {
|
|
|
519
880
|
undefined,
|
|
520
881
|
xHeaders
|
|
521
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;
|
|
522
900
|
}
|
|
523
901
|
|
|
524
902
|
/**
|
|
@@ -527,7 +905,7 @@ class Payment {
|
|
|
527
905
|
* @summary: Get CreditLine Offer
|
|
528
906
|
* @description: Get CreditLine Offer if user is tentatively approved by rupifi
|
|
529
907
|
*/
|
|
530
|
-
getRupifiBannerDetails({} = {}) {
|
|
908
|
+
async getRupifiBannerDetails({} = {}) {
|
|
531
909
|
const { error } = PaymentValidator.getRupifiBannerDetails().validate(
|
|
532
910
|
{},
|
|
533
911
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -535,11 +913,27 @@ class Payment {
|
|
|
535
913
|
if (error) {
|
|
536
914
|
return Promise.reject(new FDKClientValidationError(error));
|
|
537
915
|
}
|
|
916
|
+
|
|
917
|
+
// Showing warrnings if extra unknown parameters are found
|
|
918
|
+
const {
|
|
919
|
+
error: warrning,
|
|
920
|
+
} = PaymentValidator.getRupifiBannerDetails().validate(
|
|
921
|
+
{},
|
|
922
|
+
{ abortEarly: false, allowUnknown: false }
|
|
923
|
+
);
|
|
924
|
+
if (warrning) {
|
|
925
|
+
Logger({
|
|
926
|
+
level: "WARN",
|
|
927
|
+
message: "Parameter Validation warrnings for getRupifiBannerDetails",
|
|
928
|
+
});
|
|
929
|
+
Logger({ level: "WARN", message: warrning });
|
|
930
|
+
}
|
|
931
|
+
|
|
538
932
|
const query_params = {};
|
|
539
933
|
|
|
540
934
|
const xHeaders = {};
|
|
541
935
|
|
|
542
|
-
|
|
936
|
+
const response = await APIClient.execute(
|
|
543
937
|
this._conf,
|
|
544
938
|
"get",
|
|
545
939
|
constructUrl({
|
|
@@ -550,6 +944,23 @@ class Payment {
|
|
|
550
944
|
undefined,
|
|
551
945
|
xHeaders
|
|
552
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;
|
|
553
964
|
}
|
|
554
965
|
|
|
555
966
|
/**
|
|
@@ -558,7 +969,7 @@ class Payment {
|
|
|
558
969
|
* @summary: Get Epaylater Enabled
|
|
559
970
|
* @description: Get Epaylater Enabled if user is tentatively approved by epaylater
|
|
560
971
|
*/
|
|
561
|
-
getEpaylaterBannerDetails({} = {}) {
|
|
972
|
+
async getEpaylaterBannerDetails({} = {}) {
|
|
562
973
|
const { error } = PaymentValidator.getEpaylaterBannerDetails().validate(
|
|
563
974
|
{},
|
|
564
975
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -566,11 +977,27 @@ class Payment {
|
|
|
566
977
|
if (error) {
|
|
567
978
|
return Promise.reject(new FDKClientValidationError(error));
|
|
568
979
|
}
|
|
980
|
+
|
|
981
|
+
// Showing warrnings if extra unknown parameters are found
|
|
982
|
+
const {
|
|
983
|
+
error: warrning,
|
|
984
|
+
} = PaymentValidator.getEpaylaterBannerDetails().validate(
|
|
985
|
+
{},
|
|
986
|
+
{ abortEarly: false, allowUnknown: false }
|
|
987
|
+
);
|
|
988
|
+
if (warrning) {
|
|
989
|
+
Logger({
|
|
990
|
+
level: "WARN",
|
|
991
|
+
message: "Parameter Validation warrnings for getEpaylaterBannerDetails",
|
|
992
|
+
});
|
|
993
|
+
Logger({ level: "WARN", message: warrning });
|
|
994
|
+
}
|
|
995
|
+
|
|
569
996
|
const query_params = {};
|
|
570
997
|
|
|
571
998
|
const xHeaders = {};
|
|
572
999
|
|
|
573
|
-
|
|
1000
|
+
const response = await APIClient.execute(
|
|
574
1001
|
this._conf,
|
|
575
1002
|
"get",
|
|
576
1003
|
constructUrl({
|
|
@@ -581,6 +1008,23 @@ class Payment {
|
|
|
581
1008
|
undefined,
|
|
582
1009
|
xHeaders
|
|
583
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;
|
|
584
1028
|
}
|
|
585
1029
|
|
|
586
1030
|
/**
|
|
@@ -590,7 +1034,7 @@ class Payment {
|
|
|
590
1034
|
* @summary: API to resend and cancel a payment link which was already generated.
|
|
591
1035
|
* @description: Use this API to perform resend or cancel a payment link based on request payload.
|
|
592
1036
|
*/
|
|
593
|
-
resendOrCancelPayment({ body } = {}) {
|
|
1037
|
+
async resendOrCancelPayment({ body } = {}) {
|
|
594
1038
|
const { error } = PaymentValidator.resendOrCancelPayment().validate(
|
|
595
1039
|
{ body },
|
|
596
1040
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -598,11 +1042,27 @@ class Payment {
|
|
|
598
1042
|
if (error) {
|
|
599
1043
|
return Promise.reject(new FDKClientValidationError(error));
|
|
600
1044
|
}
|
|
1045
|
+
|
|
1046
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1047
|
+
const {
|
|
1048
|
+
error: warrning,
|
|
1049
|
+
} = PaymentValidator.resendOrCancelPayment().validate(
|
|
1050
|
+
{ body },
|
|
1051
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1052
|
+
);
|
|
1053
|
+
if (warrning) {
|
|
1054
|
+
Logger({
|
|
1055
|
+
level: "WARN",
|
|
1056
|
+
message: "Parameter Validation warrnings for resendOrCancelPayment",
|
|
1057
|
+
});
|
|
1058
|
+
Logger({ level: "WARN", message: warrning });
|
|
1059
|
+
}
|
|
1060
|
+
|
|
601
1061
|
const query_params = {};
|
|
602
1062
|
|
|
603
1063
|
const xHeaders = {};
|
|
604
1064
|
|
|
605
|
-
|
|
1065
|
+
const response = await APIClient.execute(
|
|
606
1066
|
this._conf,
|
|
607
1067
|
"post",
|
|
608
1068
|
constructUrl({
|
|
@@ -613,6 +1073,23 @@ class Payment {
|
|
|
613
1073
|
body,
|
|
614
1074
|
xHeaders
|
|
615
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;
|
|
616
1093
|
}
|
|
617
1094
|
|
|
618
1095
|
/**
|
|
@@ -622,7 +1099,7 @@ class Payment {
|
|
|
622
1099
|
* @summary: Convert base64 string to HTML form
|
|
623
1100
|
* @description: Use this API to decode base64 html form to plain HTML string.
|
|
624
1101
|
*/
|
|
625
|
-
renderHTML({ body } = {}) {
|
|
1102
|
+
async renderHTML({ body } = {}) {
|
|
626
1103
|
const { error } = PaymentValidator.renderHTML().validate(
|
|
627
1104
|
{ body },
|
|
628
1105
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -630,11 +1107,25 @@ class Payment {
|
|
|
630
1107
|
if (error) {
|
|
631
1108
|
return Promise.reject(new FDKClientValidationError(error));
|
|
632
1109
|
}
|
|
1110
|
+
|
|
1111
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1112
|
+
const { error: warrning } = PaymentValidator.renderHTML().validate(
|
|
1113
|
+
{ body },
|
|
1114
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1115
|
+
);
|
|
1116
|
+
if (warrning) {
|
|
1117
|
+
Logger({
|
|
1118
|
+
level: "WARN",
|
|
1119
|
+
message: "Parameter Validation warrnings for renderHTML",
|
|
1120
|
+
});
|
|
1121
|
+
Logger({ level: "WARN", message: warrning });
|
|
1122
|
+
}
|
|
1123
|
+
|
|
633
1124
|
const query_params = {};
|
|
634
1125
|
|
|
635
1126
|
const xHeaders = {};
|
|
636
1127
|
|
|
637
|
-
|
|
1128
|
+
const response = await APIClient.execute(
|
|
638
1129
|
this._conf,
|
|
639
1130
|
"post",
|
|
640
1131
|
constructUrl({
|
|
@@ -645,6 +1136,23 @@ class Payment {
|
|
|
645
1136
|
body,
|
|
646
1137
|
xHeaders
|
|
647
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;
|
|
648
1156
|
}
|
|
649
1157
|
|
|
650
1158
|
/**
|
|
@@ -654,7 +1162,7 @@ class Payment {
|
|
|
654
1162
|
* @summary: API to Validate UPI ID
|
|
655
1163
|
* @description: API to Validate UPI ID
|
|
656
1164
|
*/
|
|
657
|
-
validateVPA({ body } = {}) {
|
|
1165
|
+
async validateVPA({ body } = {}) {
|
|
658
1166
|
const { error } = PaymentValidator.validateVPA().validate(
|
|
659
1167
|
{ body },
|
|
660
1168
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -662,11 +1170,25 @@ class Payment {
|
|
|
662
1170
|
if (error) {
|
|
663
1171
|
return Promise.reject(new FDKClientValidationError(error));
|
|
664
1172
|
}
|
|
1173
|
+
|
|
1174
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1175
|
+
const { error: warrning } = PaymentValidator.validateVPA().validate(
|
|
1176
|
+
{ body },
|
|
1177
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1178
|
+
);
|
|
1179
|
+
if (warrning) {
|
|
1180
|
+
Logger({
|
|
1181
|
+
level: "WARN",
|
|
1182
|
+
message: "Parameter Validation warrnings for validateVPA",
|
|
1183
|
+
});
|
|
1184
|
+
Logger({ level: "WARN", message: warrning });
|
|
1185
|
+
}
|
|
1186
|
+
|
|
665
1187
|
const query_params = {};
|
|
666
1188
|
|
|
667
1189
|
const xHeaders = {};
|
|
668
1190
|
|
|
669
|
-
|
|
1191
|
+
const response = await APIClient.execute(
|
|
670
1192
|
this._conf,
|
|
671
1193
|
"post",
|
|
672
1194
|
constructUrl({
|
|
@@ -677,6 +1199,23 @@ class Payment {
|
|
|
677
1199
|
body,
|
|
678
1200
|
xHeaders
|
|
679
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;
|
|
680
1219
|
}
|
|
681
1220
|
|
|
682
1221
|
/**
|
|
@@ -685,7 +1224,7 @@ class Payment {
|
|
|
685
1224
|
* @summary: Lists the mode of refund
|
|
686
1225
|
* @description: Use this API to retrieve eligible refund modes (such as Netbanking) and add the beneficiary details.
|
|
687
1226
|
*/
|
|
688
|
-
getActiveRefundTransferModes({} = {}) {
|
|
1227
|
+
async getActiveRefundTransferModes({} = {}) {
|
|
689
1228
|
const { error } = PaymentValidator.getActiveRefundTransferModes().validate(
|
|
690
1229
|
{},
|
|
691
1230
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -693,11 +1232,28 @@ class Payment {
|
|
|
693
1232
|
if (error) {
|
|
694
1233
|
return Promise.reject(new FDKClientValidationError(error));
|
|
695
1234
|
}
|
|
1235
|
+
|
|
1236
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1237
|
+
const {
|
|
1238
|
+
error: warrning,
|
|
1239
|
+
} = PaymentValidator.getActiveRefundTransferModes().validate(
|
|
1240
|
+
{},
|
|
1241
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1242
|
+
);
|
|
1243
|
+
if (warrning) {
|
|
1244
|
+
Logger({
|
|
1245
|
+
level: "WARN",
|
|
1246
|
+
message:
|
|
1247
|
+
"Parameter Validation warrnings for getActiveRefundTransferModes",
|
|
1248
|
+
});
|
|
1249
|
+
Logger({ level: "WARN", message: warrning });
|
|
1250
|
+
}
|
|
1251
|
+
|
|
696
1252
|
const query_params = {};
|
|
697
1253
|
|
|
698
1254
|
const xHeaders = {};
|
|
699
1255
|
|
|
700
|
-
|
|
1256
|
+
const response = await APIClient.execute(
|
|
701
1257
|
this._conf,
|
|
702
1258
|
"get",
|
|
703
1259
|
constructUrl({
|
|
@@ -708,6 +1264,24 @@ class Payment {
|
|
|
708
1264
|
undefined,
|
|
709
1265
|
xHeaders
|
|
710
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;
|
|
711
1285
|
}
|
|
712
1286
|
|
|
713
1287
|
/**
|
|
@@ -717,7 +1291,7 @@ class Payment {
|
|
|
717
1291
|
* @summary: Enable/Disable a mode for transferring a refund
|
|
718
1292
|
* @description: Activate or Deactivate Transfer Mode to collect Beneficiary Details for Refund
|
|
719
1293
|
*/
|
|
720
|
-
enableOrDisableRefundTransferMode({ body } = {}) {
|
|
1294
|
+
async enableOrDisableRefundTransferMode({ body } = {}) {
|
|
721
1295
|
const {
|
|
722
1296
|
error,
|
|
723
1297
|
} = PaymentValidator.enableOrDisableRefundTransferMode().validate(
|
|
@@ -727,11 +1301,28 @@ class Payment {
|
|
|
727
1301
|
if (error) {
|
|
728
1302
|
return Promise.reject(new FDKClientValidationError(error));
|
|
729
1303
|
}
|
|
1304
|
+
|
|
1305
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1306
|
+
const {
|
|
1307
|
+
error: warrning,
|
|
1308
|
+
} = PaymentValidator.enableOrDisableRefundTransferMode().validate(
|
|
1309
|
+
{ body },
|
|
1310
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1311
|
+
);
|
|
1312
|
+
if (warrning) {
|
|
1313
|
+
Logger({
|
|
1314
|
+
level: "WARN",
|
|
1315
|
+
message:
|
|
1316
|
+
"Parameter Validation warrnings for enableOrDisableRefundTransferMode",
|
|
1317
|
+
});
|
|
1318
|
+
Logger({ level: "WARN", message: warrning });
|
|
1319
|
+
}
|
|
1320
|
+
|
|
730
1321
|
const query_params = {};
|
|
731
1322
|
|
|
732
1323
|
const xHeaders = {};
|
|
733
1324
|
|
|
734
|
-
|
|
1325
|
+
const response = await APIClient.execute(
|
|
735
1326
|
this._conf,
|
|
736
1327
|
"put",
|
|
737
1328
|
constructUrl({
|
|
@@ -742,6 +1333,24 @@ class Payment {
|
|
|
742
1333
|
body,
|
|
743
1334
|
xHeaders
|
|
744
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;
|
|
745
1354
|
}
|
|
746
1355
|
|
|
747
1356
|
/**
|
|
@@ -752,7 +1361,7 @@ class Payment {
|
|
|
752
1361
|
* @summary: Lists the beneficiary of a refund
|
|
753
1362
|
* @description: Use this API to get the details of all active beneficiary added by a user for refund.
|
|
754
1363
|
*/
|
|
755
|
-
getUserBeneficiariesDetail({ orderId } = {}) {
|
|
1364
|
+
async getUserBeneficiariesDetail({ orderId } = {}) {
|
|
756
1365
|
const { error } = PaymentValidator.getUserBeneficiariesDetail().validate(
|
|
757
1366
|
{ orderId },
|
|
758
1367
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -760,12 +1369,29 @@ class Payment {
|
|
|
760
1369
|
if (error) {
|
|
761
1370
|
return Promise.reject(new FDKClientValidationError(error));
|
|
762
1371
|
}
|
|
1372
|
+
|
|
1373
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1374
|
+
const {
|
|
1375
|
+
error: warrning,
|
|
1376
|
+
} = PaymentValidator.getUserBeneficiariesDetail().validate(
|
|
1377
|
+
{ orderId },
|
|
1378
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1379
|
+
);
|
|
1380
|
+
if (warrning) {
|
|
1381
|
+
Logger({
|
|
1382
|
+
level: "WARN",
|
|
1383
|
+
message:
|
|
1384
|
+
"Parameter Validation warrnings for getUserBeneficiariesDetail",
|
|
1385
|
+
});
|
|
1386
|
+
Logger({ level: "WARN", message: warrning });
|
|
1387
|
+
}
|
|
1388
|
+
|
|
763
1389
|
const query_params = {};
|
|
764
1390
|
query_params["order_id"] = orderId;
|
|
765
1391
|
|
|
766
1392
|
const xHeaders = {};
|
|
767
1393
|
|
|
768
|
-
|
|
1394
|
+
const response = await APIClient.execute(
|
|
769
1395
|
this._conf,
|
|
770
1396
|
"get",
|
|
771
1397
|
constructUrl({
|
|
@@ -776,6 +1402,23 @@ class Payment {
|
|
|
776
1402
|
undefined,
|
|
777
1403
|
xHeaders
|
|
778
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;
|
|
779
1422
|
}
|
|
780
1423
|
|
|
781
1424
|
/**
|
|
@@ -786,7 +1429,7 @@ class Payment {
|
|
|
786
1429
|
* @summary: Verify IFSC Code
|
|
787
1430
|
* @description: Use this API to check whether the 11-digit IFSC code is valid and to fetch the bank details for refund.
|
|
788
1431
|
*/
|
|
789
|
-
verifyIfscCode({ ifscCode } = {}) {
|
|
1432
|
+
async verifyIfscCode({ ifscCode } = {}) {
|
|
790
1433
|
const { error } = PaymentValidator.verifyIfscCode().validate(
|
|
791
1434
|
{ ifscCode },
|
|
792
1435
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -794,12 +1437,26 @@ class Payment {
|
|
|
794
1437
|
if (error) {
|
|
795
1438
|
return Promise.reject(new FDKClientValidationError(error));
|
|
796
1439
|
}
|
|
1440
|
+
|
|
1441
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1442
|
+
const { error: warrning } = PaymentValidator.verifyIfscCode().validate(
|
|
1443
|
+
{ ifscCode },
|
|
1444
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1445
|
+
);
|
|
1446
|
+
if (warrning) {
|
|
1447
|
+
Logger({
|
|
1448
|
+
level: "WARN",
|
|
1449
|
+
message: "Parameter Validation warrnings for verifyIfscCode",
|
|
1450
|
+
});
|
|
1451
|
+
Logger({ level: "WARN", message: warrning });
|
|
1452
|
+
}
|
|
1453
|
+
|
|
797
1454
|
const query_params = {};
|
|
798
1455
|
query_params["ifsc_code"] = ifscCode;
|
|
799
1456
|
|
|
800
1457
|
const xHeaders = {};
|
|
801
1458
|
|
|
802
|
-
|
|
1459
|
+
const response = await APIClient.execute(
|
|
803
1460
|
this._conf,
|
|
804
1461
|
"get",
|
|
805
1462
|
constructUrl({
|
|
@@ -810,6 +1467,23 @@ class Payment {
|
|
|
810
1467
|
undefined,
|
|
811
1468
|
xHeaders
|
|
812
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;
|
|
813
1487
|
}
|
|
814
1488
|
|
|
815
1489
|
/**
|
|
@@ -820,7 +1494,7 @@ class Payment {
|
|
|
820
1494
|
* @summary: Lists the beneficiary of a refund
|
|
821
1495
|
* @description: Use this API to get the details of all active beneficiary added by a user for refund.
|
|
822
1496
|
*/
|
|
823
|
-
getOrderBeneficiariesDetail({ orderId } = {}) {
|
|
1497
|
+
async getOrderBeneficiariesDetail({ orderId } = {}) {
|
|
824
1498
|
const { error } = PaymentValidator.getOrderBeneficiariesDetail().validate(
|
|
825
1499
|
{ orderId },
|
|
826
1500
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -828,12 +1502,29 @@ class Payment {
|
|
|
828
1502
|
if (error) {
|
|
829
1503
|
return Promise.reject(new FDKClientValidationError(error));
|
|
830
1504
|
}
|
|
1505
|
+
|
|
1506
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1507
|
+
const {
|
|
1508
|
+
error: warrning,
|
|
1509
|
+
} = PaymentValidator.getOrderBeneficiariesDetail().validate(
|
|
1510
|
+
{ orderId },
|
|
1511
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1512
|
+
);
|
|
1513
|
+
if (warrning) {
|
|
1514
|
+
Logger({
|
|
1515
|
+
level: "WARN",
|
|
1516
|
+
message:
|
|
1517
|
+
"Parameter Validation warrnings for getOrderBeneficiariesDetail",
|
|
1518
|
+
});
|
|
1519
|
+
Logger({ level: "WARN", message: warrning });
|
|
1520
|
+
}
|
|
1521
|
+
|
|
831
1522
|
const query_params = {};
|
|
832
1523
|
query_params["order_id"] = orderId;
|
|
833
1524
|
|
|
834
1525
|
const xHeaders = {};
|
|
835
1526
|
|
|
836
|
-
|
|
1527
|
+
const response = await APIClient.execute(
|
|
837
1528
|
this._conf,
|
|
838
1529
|
"get",
|
|
839
1530
|
constructUrl({
|
|
@@ -844,6 +1535,24 @@ class Payment {
|
|
|
844
1535
|
undefined,
|
|
845
1536
|
xHeaders
|
|
846
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;
|
|
847
1556
|
}
|
|
848
1557
|
|
|
849
1558
|
/**
|
|
@@ -853,7 +1562,7 @@ class Payment {
|
|
|
853
1562
|
* @summary: Verify the beneficiary details using OTP
|
|
854
1563
|
* @description: Use this API to perform an OTP validation before saving the beneficiary details added for a refund.
|
|
855
1564
|
*/
|
|
856
|
-
verifyOtpAndAddBeneficiaryForBank({ body } = {}) {
|
|
1565
|
+
async verifyOtpAndAddBeneficiaryForBank({ body } = {}) {
|
|
857
1566
|
const {
|
|
858
1567
|
error,
|
|
859
1568
|
} = PaymentValidator.verifyOtpAndAddBeneficiaryForBank().validate(
|
|
@@ -863,11 +1572,28 @@ class Payment {
|
|
|
863
1572
|
if (error) {
|
|
864
1573
|
return Promise.reject(new FDKClientValidationError(error));
|
|
865
1574
|
}
|
|
1575
|
+
|
|
1576
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1577
|
+
const {
|
|
1578
|
+
error: warrning,
|
|
1579
|
+
} = PaymentValidator.verifyOtpAndAddBeneficiaryForBank().validate(
|
|
1580
|
+
{ body },
|
|
1581
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1582
|
+
);
|
|
1583
|
+
if (warrning) {
|
|
1584
|
+
Logger({
|
|
1585
|
+
level: "WARN",
|
|
1586
|
+
message:
|
|
1587
|
+
"Parameter Validation warrnings for verifyOtpAndAddBeneficiaryForBank",
|
|
1588
|
+
});
|
|
1589
|
+
Logger({ level: "WARN", message: warrning });
|
|
1590
|
+
}
|
|
1591
|
+
|
|
866
1592
|
const query_params = {};
|
|
867
1593
|
|
|
868
1594
|
const xHeaders = {};
|
|
869
1595
|
|
|
870
|
-
|
|
1596
|
+
const response = await APIClient.execute(
|
|
871
1597
|
this._conf,
|
|
872
1598
|
"post",
|
|
873
1599
|
constructUrl({
|
|
@@ -878,6 +1604,24 @@ class Payment {
|
|
|
878
1604
|
body,
|
|
879
1605
|
xHeaders
|
|
880
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;
|
|
881
1625
|
}
|
|
882
1626
|
|
|
883
1627
|
/**
|
|
@@ -887,7 +1631,7 @@ class Payment {
|
|
|
887
1631
|
* @summary: Save bank details for cancelled/returned order
|
|
888
1632
|
* @description: Use this API to save the bank details for a returned or cancelled order to refund the amount.
|
|
889
1633
|
*/
|
|
890
|
-
addBeneficiaryDetails({ body } = {}) {
|
|
1634
|
+
async addBeneficiaryDetails({ body } = {}) {
|
|
891
1635
|
const { error } = PaymentValidator.addBeneficiaryDetails().validate(
|
|
892
1636
|
{ body },
|
|
893
1637
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -895,11 +1639,27 @@ class Payment {
|
|
|
895
1639
|
if (error) {
|
|
896
1640
|
return Promise.reject(new FDKClientValidationError(error));
|
|
897
1641
|
}
|
|
1642
|
+
|
|
1643
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1644
|
+
const {
|
|
1645
|
+
error: warrning,
|
|
1646
|
+
} = PaymentValidator.addBeneficiaryDetails().validate(
|
|
1647
|
+
{ body },
|
|
1648
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1649
|
+
);
|
|
1650
|
+
if (warrning) {
|
|
1651
|
+
Logger({
|
|
1652
|
+
level: "WARN",
|
|
1653
|
+
message: "Parameter Validation warrnings for addBeneficiaryDetails",
|
|
1654
|
+
});
|
|
1655
|
+
Logger({ level: "WARN", message: warrning });
|
|
1656
|
+
}
|
|
1657
|
+
|
|
898
1658
|
const query_params = {};
|
|
899
1659
|
|
|
900
1660
|
const xHeaders = {};
|
|
901
1661
|
|
|
902
|
-
|
|
1662
|
+
const response = await APIClient.execute(
|
|
903
1663
|
this._conf,
|
|
904
1664
|
"post",
|
|
905
1665
|
constructUrl({
|
|
@@ -910,6 +1670,23 @@ class Payment {
|
|
|
910
1670
|
body,
|
|
911
1671
|
xHeaders
|
|
912
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;
|
|
913
1690
|
}
|
|
914
1691
|
|
|
915
1692
|
/**
|
|
@@ -919,7 +1696,7 @@ class Payment {
|
|
|
919
1696
|
* @summary: Save bank details for cancelled/returned order
|
|
920
1697
|
* @description: Use this API to save bank details for returned/cancelled order to refund amount in his account.
|
|
921
1698
|
*/
|
|
922
|
-
addRefundBankAccountUsingOTP({ body } = {}) {
|
|
1699
|
+
async addRefundBankAccountUsingOTP({ body } = {}) {
|
|
923
1700
|
const { error } = PaymentValidator.addRefundBankAccountUsingOTP().validate(
|
|
924
1701
|
{ body },
|
|
925
1702
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -927,11 +1704,28 @@ class Payment {
|
|
|
927
1704
|
if (error) {
|
|
928
1705
|
return Promise.reject(new FDKClientValidationError(error));
|
|
929
1706
|
}
|
|
1707
|
+
|
|
1708
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1709
|
+
const {
|
|
1710
|
+
error: warrning,
|
|
1711
|
+
} = PaymentValidator.addRefundBankAccountUsingOTP().validate(
|
|
1712
|
+
{ body },
|
|
1713
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1714
|
+
);
|
|
1715
|
+
if (warrning) {
|
|
1716
|
+
Logger({
|
|
1717
|
+
level: "WARN",
|
|
1718
|
+
message:
|
|
1719
|
+
"Parameter Validation warrnings for addRefundBankAccountUsingOTP",
|
|
1720
|
+
});
|
|
1721
|
+
Logger({ level: "WARN", message: warrning });
|
|
1722
|
+
}
|
|
1723
|
+
|
|
930
1724
|
const query_params = {};
|
|
931
1725
|
|
|
932
1726
|
const xHeaders = {};
|
|
933
1727
|
|
|
934
|
-
|
|
1728
|
+
const response = await APIClient.execute(
|
|
935
1729
|
this._conf,
|
|
936
1730
|
"post",
|
|
937
1731
|
constructUrl({
|
|
@@ -942,6 +1736,24 @@ class Payment {
|
|
|
942
1736
|
body,
|
|
943
1737
|
xHeaders
|
|
944
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;
|
|
945
1757
|
}
|
|
946
1758
|
|
|
947
1759
|
/**
|
|
@@ -951,7 +1763,7 @@ class Payment {
|
|
|
951
1763
|
* @summary: Send OTP on adding a wallet beneficiary
|
|
952
1764
|
* @description: Use this API to send an OTP while adding a wallet beneficiary by mobile no. verification.
|
|
953
1765
|
*/
|
|
954
|
-
verifyOtpAndAddBeneficiaryForWallet({ body } = {}) {
|
|
1766
|
+
async verifyOtpAndAddBeneficiaryForWallet({ body } = {}) {
|
|
955
1767
|
const {
|
|
956
1768
|
error,
|
|
957
1769
|
} = PaymentValidator.verifyOtpAndAddBeneficiaryForWallet().validate(
|
|
@@ -961,11 +1773,28 @@ class Payment {
|
|
|
961
1773
|
if (error) {
|
|
962
1774
|
return Promise.reject(new FDKClientValidationError(error));
|
|
963
1775
|
}
|
|
1776
|
+
|
|
1777
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1778
|
+
const {
|
|
1779
|
+
error: warrning,
|
|
1780
|
+
} = PaymentValidator.verifyOtpAndAddBeneficiaryForWallet().validate(
|
|
1781
|
+
{ body },
|
|
1782
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1783
|
+
);
|
|
1784
|
+
if (warrning) {
|
|
1785
|
+
Logger({
|
|
1786
|
+
level: "WARN",
|
|
1787
|
+
message:
|
|
1788
|
+
"Parameter Validation warrnings for verifyOtpAndAddBeneficiaryForWallet",
|
|
1789
|
+
});
|
|
1790
|
+
Logger({ level: "WARN", message: warrning });
|
|
1791
|
+
}
|
|
1792
|
+
|
|
964
1793
|
const query_params = {};
|
|
965
1794
|
|
|
966
1795
|
const xHeaders = {};
|
|
967
1796
|
|
|
968
|
-
|
|
1797
|
+
const response = await APIClient.execute(
|
|
969
1798
|
this._conf,
|
|
970
1799
|
"post",
|
|
971
1800
|
constructUrl({
|
|
@@ -976,6 +1805,24 @@ class Payment {
|
|
|
976
1805
|
body,
|
|
977
1806
|
xHeaders
|
|
978
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;
|
|
979
1826
|
}
|
|
980
1827
|
|
|
981
1828
|
/**
|
|
@@ -985,7 +1832,7 @@ class Payment {
|
|
|
985
1832
|
* @summary: Set a default beneficiary for a refund
|
|
986
1833
|
* @description: Use this API to set a default beneficiary for getting a refund.
|
|
987
1834
|
*/
|
|
988
|
-
updateDefaultBeneficiary({ body } = {}) {
|
|
1835
|
+
async updateDefaultBeneficiary({ body } = {}) {
|
|
989
1836
|
const { error } = PaymentValidator.updateDefaultBeneficiary().validate(
|
|
990
1837
|
{ body },
|
|
991
1838
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -993,11 +1840,27 @@ class Payment {
|
|
|
993
1840
|
if (error) {
|
|
994
1841
|
return Promise.reject(new FDKClientValidationError(error));
|
|
995
1842
|
}
|
|
1843
|
+
|
|
1844
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1845
|
+
const {
|
|
1846
|
+
error: warrning,
|
|
1847
|
+
} = PaymentValidator.updateDefaultBeneficiary().validate(
|
|
1848
|
+
{ body },
|
|
1849
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1850
|
+
);
|
|
1851
|
+
if (warrning) {
|
|
1852
|
+
Logger({
|
|
1853
|
+
level: "WARN",
|
|
1854
|
+
message: "Parameter Validation warrnings for updateDefaultBeneficiary",
|
|
1855
|
+
});
|
|
1856
|
+
Logger({ level: "WARN", message: warrning });
|
|
1857
|
+
}
|
|
1858
|
+
|
|
996
1859
|
const query_params = {};
|
|
997
1860
|
|
|
998
1861
|
const xHeaders = {};
|
|
999
1862
|
|
|
1000
|
-
|
|
1863
|
+
const response = await APIClient.execute(
|
|
1001
1864
|
this._conf,
|
|
1002
1865
|
"post",
|
|
1003
1866
|
constructUrl({
|
|
@@ -1008,6 +1871,23 @@ class Payment {
|
|
|
1008
1871
|
body,
|
|
1009
1872
|
xHeaders
|
|
1010
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;
|
|
1011
1891
|
}
|
|
1012
1892
|
|
|
1013
1893
|
/**
|
|
@@ -1017,7 +1897,7 @@ class Payment {
|
|
|
1017
1897
|
* @summary: Get payment link
|
|
1018
1898
|
* @description: Use this API to get a payment link
|
|
1019
1899
|
*/
|
|
1020
|
-
getPaymentLink({ paymentLinkId } = {}) {
|
|
1900
|
+
async getPaymentLink({ paymentLinkId } = {}) {
|
|
1021
1901
|
const { error } = PaymentValidator.getPaymentLink().validate(
|
|
1022
1902
|
{ paymentLinkId },
|
|
1023
1903
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1025,12 +1905,26 @@ class Payment {
|
|
|
1025
1905
|
if (error) {
|
|
1026
1906
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1027
1907
|
}
|
|
1908
|
+
|
|
1909
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1910
|
+
const { error: warrning } = PaymentValidator.getPaymentLink().validate(
|
|
1911
|
+
{ paymentLinkId },
|
|
1912
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1913
|
+
);
|
|
1914
|
+
if (warrning) {
|
|
1915
|
+
Logger({
|
|
1916
|
+
level: "WARN",
|
|
1917
|
+
message: "Parameter Validation warrnings for getPaymentLink",
|
|
1918
|
+
});
|
|
1919
|
+
Logger({ level: "WARN", message: warrning });
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1028
1922
|
const query_params = {};
|
|
1029
1923
|
query_params["payment_link_id"] = paymentLinkId;
|
|
1030
1924
|
|
|
1031
1925
|
const xHeaders = {};
|
|
1032
1926
|
|
|
1033
|
-
|
|
1927
|
+
const response = await APIClient.execute(
|
|
1034
1928
|
this._conf,
|
|
1035
1929
|
"get",
|
|
1036
1930
|
constructUrl({
|
|
@@ -1041,6 +1935,23 @@ class Payment {
|
|
|
1041
1935
|
undefined,
|
|
1042
1936
|
xHeaders
|
|
1043
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;
|
|
1044
1955
|
}
|
|
1045
1956
|
|
|
1046
1957
|
/**
|
|
@@ -1050,7 +1961,7 @@ class Payment {
|
|
|
1050
1961
|
* @summary: Create payment link
|
|
1051
1962
|
* @description: Use this API to create a payment link for the customer
|
|
1052
1963
|
*/
|
|
1053
|
-
createPaymentLink({ body } = {}) {
|
|
1964
|
+
async createPaymentLink({ body } = {}) {
|
|
1054
1965
|
const { error } = PaymentValidator.createPaymentLink().validate(
|
|
1055
1966
|
{ body },
|
|
1056
1967
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1058,11 +1969,25 @@ class Payment {
|
|
|
1058
1969
|
if (error) {
|
|
1059
1970
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1060
1971
|
}
|
|
1972
|
+
|
|
1973
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1974
|
+
const { error: warrning } = PaymentValidator.createPaymentLink().validate(
|
|
1975
|
+
{ body },
|
|
1976
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1977
|
+
);
|
|
1978
|
+
if (warrning) {
|
|
1979
|
+
Logger({
|
|
1980
|
+
level: "WARN",
|
|
1981
|
+
message: "Parameter Validation warrnings for createPaymentLink",
|
|
1982
|
+
});
|
|
1983
|
+
Logger({ level: "WARN", message: warrning });
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1061
1986
|
const query_params = {};
|
|
1062
1987
|
|
|
1063
1988
|
const xHeaders = {};
|
|
1064
1989
|
|
|
1065
|
-
|
|
1990
|
+
const response = await APIClient.execute(
|
|
1066
1991
|
this._conf,
|
|
1067
1992
|
"post",
|
|
1068
1993
|
constructUrl({
|
|
@@ -1073,6 +1998,23 @@ class Payment {
|
|
|
1073
1998
|
body,
|
|
1074
1999
|
xHeaders
|
|
1075
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;
|
|
1076
2018
|
}
|
|
1077
2019
|
|
|
1078
2020
|
/**
|
|
@@ -1082,7 +2024,7 @@ class Payment {
|
|
|
1082
2024
|
* @summary: Resend payment link
|
|
1083
2025
|
* @description: Use this API to resend a payment link for the customer
|
|
1084
2026
|
*/
|
|
1085
|
-
resendPaymentLink({ body } = {}) {
|
|
2027
|
+
async resendPaymentLink({ body } = {}) {
|
|
1086
2028
|
const { error } = PaymentValidator.resendPaymentLink().validate(
|
|
1087
2029
|
{ body },
|
|
1088
2030
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1090,11 +2032,25 @@ class Payment {
|
|
|
1090
2032
|
if (error) {
|
|
1091
2033
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1092
2034
|
}
|
|
2035
|
+
|
|
2036
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2037
|
+
const { error: warrning } = PaymentValidator.resendPaymentLink().validate(
|
|
2038
|
+
{ body },
|
|
2039
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2040
|
+
);
|
|
2041
|
+
if (warrning) {
|
|
2042
|
+
Logger({
|
|
2043
|
+
level: "WARN",
|
|
2044
|
+
message: "Parameter Validation warrnings for resendPaymentLink",
|
|
2045
|
+
});
|
|
2046
|
+
Logger({ level: "WARN", message: warrning });
|
|
2047
|
+
}
|
|
2048
|
+
|
|
1093
2049
|
const query_params = {};
|
|
1094
2050
|
|
|
1095
2051
|
const xHeaders = {};
|
|
1096
2052
|
|
|
1097
|
-
|
|
2053
|
+
const response = await APIClient.execute(
|
|
1098
2054
|
this._conf,
|
|
1099
2055
|
"post",
|
|
1100
2056
|
constructUrl({
|
|
@@ -1105,6 +2061,23 @@ class Payment {
|
|
|
1105
2061
|
body,
|
|
1106
2062
|
xHeaders
|
|
1107
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;
|
|
1108
2081
|
}
|
|
1109
2082
|
|
|
1110
2083
|
/**
|
|
@@ -1114,7 +2087,7 @@ class Payment {
|
|
|
1114
2087
|
* @summary: Cancel payment link
|
|
1115
2088
|
* @description: Use this API to cancel a payment link for the customer
|
|
1116
2089
|
*/
|
|
1117
|
-
cancelPaymentLink({ body } = {}) {
|
|
2090
|
+
async cancelPaymentLink({ body } = {}) {
|
|
1118
2091
|
const { error } = PaymentValidator.cancelPaymentLink().validate(
|
|
1119
2092
|
{ body },
|
|
1120
2093
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1122,11 +2095,25 @@ class Payment {
|
|
|
1122
2095
|
if (error) {
|
|
1123
2096
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1124
2097
|
}
|
|
2098
|
+
|
|
2099
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2100
|
+
const { error: warrning } = PaymentValidator.cancelPaymentLink().validate(
|
|
2101
|
+
{ body },
|
|
2102
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2103
|
+
);
|
|
2104
|
+
if (warrning) {
|
|
2105
|
+
Logger({
|
|
2106
|
+
level: "WARN",
|
|
2107
|
+
message: "Parameter Validation warrnings for cancelPaymentLink",
|
|
2108
|
+
});
|
|
2109
|
+
Logger({ level: "WARN", message: warrning });
|
|
2110
|
+
}
|
|
2111
|
+
|
|
1125
2112
|
const query_params = {};
|
|
1126
2113
|
|
|
1127
2114
|
const xHeaders = {};
|
|
1128
2115
|
|
|
1129
|
-
|
|
2116
|
+
const response = await APIClient.execute(
|
|
1130
2117
|
this._conf,
|
|
1131
2118
|
"post",
|
|
1132
2119
|
constructUrl({
|
|
@@ -1137,6 +2124,23 @@ class Payment {
|
|
|
1137
2124
|
body,
|
|
1138
2125
|
xHeaders
|
|
1139
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;
|
|
1140
2144
|
}
|
|
1141
2145
|
|
|
1142
2146
|
/**
|
|
@@ -1146,7 +2150,7 @@ class Payment {
|
|
|
1146
2150
|
* @summary: Get applicable payment options for payment link
|
|
1147
2151
|
* @description: Use this API to get all valid payment options for doing a payment through payment link
|
|
1148
2152
|
*/
|
|
1149
|
-
getPaymentModeRoutesPaymentLink({ paymentLinkId } = {}) {
|
|
2153
|
+
async getPaymentModeRoutesPaymentLink({ paymentLinkId } = {}) {
|
|
1150
2154
|
const {
|
|
1151
2155
|
error,
|
|
1152
2156
|
} = PaymentValidator.getPaymentModeRoutesPaymentLink().validate(
|
|
@@ -1156,12 +2160,29 @@ class Payment {
|
|
|
1156
2160
|
if (error) {
|
|
1157
2161
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1158
2162
|
}
|
|
2163
|
+
|
|
2164
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2165
|
+
const {
|
|
2166
|
+
error: warrning,
|
|
2167
|
+
} = PaymentValidator.getPaymentModeRoutesPaymentLink().validate(
|
|
2168
|
+
{ paymentLinkId },
|
|
2169
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2170
|
+
);
|
|
2171
|
+
if (warrning) {
|
|
2172
|
+
Logger({
|
|
2173
|
+
level: "WARN",
|
|
2174
|
+
message:
|
|
2175
|
+
"Parameter Validation warrnings for getPaymentModeRoutesPaymentLink",
|
|
2176
|
+
});
|
|
2177
|
+
Logger({ level: "WARN", message: warrning });
|
|
2178
|
+
}
|
|
2179
|
+
|
|
1159
2180
|
const query_params = {};
|
|
1160
2181
|
query_params["payment_link_id"] = paymentLinkId;
|
|
1161
2182
|
|
|
1162
2183
|
const xHeaders = {};
|
|
1163
2184
|
|
|
1164
|
-
|
|
2185
|
+
const response = await APIClient.execute(
|
|
1165
2186
|
this._conf,
|
|
1166
2187
|
"get",
|
|
1167
2188
|
constructUrl({
|
|
@@ -1172,6 +2193,24 @@ class Payment {
|
|
|
1172
2193
|
undefined,
|
|
1173
2194
|
xHeaders
|
|
1174
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;
|
|
1175
2214
|
}
|
|
1176
2215
|
|
|
1177
2216
|
/**
|
|
@@ -1181,7 +2220,7 @@ class Payment {
|
|
|
1181
2220
|
* @summary: Used for polling if payment successful or not
|
|
1182
2221
|
* @description: Use this API to poll if payment through payment was successful or not
|
|
1183
2222
|
*/
|
|
1184
|
-
pollingPaymentLink({ paymentLinkId } = {}) {
|
|
2223
|
+
async pollingPaymentLink({ paymentLinkId } = {}) {
|
|
1185
2224
|
const { error } = PaymentValidator.pollingPaymentLink().validate(
|
|
1186
2225
|
{ paymentLinkId },
|
|
1187
2226
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1189,12 +2228,26 @@ class Payment {
|
|
|
1189
2228
|
if (error) {
|
|
1190
2229
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1191
2230
|
}
|
|
2231
|
+
|
|
2232
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2233
|
+
const { error: warrning } = PaymentValidator.pollingPaymentLink().validate(
|
|
2234
|
+
{ paymentLinkId },
|
|
2235
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2236
|
+
);
|
|
2237
|
+
if (warrning) {
|
|
2238
|
+
Logger({
|
|
2239
|
+
level: "WARN",
|
|
2240
|
+
message: "Parameter Validation warrnings for pollingPaymentLink",
|
|
2241
|
+
});
|
|
2242
|
+
Logger({ level: "WARN", message: warrning });
|
|
2243
|
+
}
|
|
2244
|
+
|
|
1192
2245
|
const query_params = {};
|
|
1193
2246
|
query_params["payment_link_id"] = paymentLinkId;
|
|
1194
2247
|
|
|
1195
2248
|
const xHeaders = {};
|
|
1196
2249
|
|
|
1197
|
-
|
|
2250
|
+
const response = await APIClient.execute(
|
|
1198
2251
|
this._conf,
|
|
1199
2252
|
"get",
|
|
1200
2253
|
constructUrl({
|
|
@@ -1205,6 +2258,23 @@ class Payment {
|
|
|
1205
2258
|
undefined,
|
|
1206
2259
|
xHeaders
|
|
1207
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;
|
|
1208
2278
|
}
|
|
1209
2279
|
|
|
1210
2280
|
/**
|
|
@@ -1214,7 +2284,7 @@ class Payment {
|
|
|
1214
2284
|
* @summary: Create Order user
|
|
1215
2285
|
* @description: Use this API to create a order and payment on aggregator side
|
|
1216
2286
|
*/
|
|
1217
|
-
createOrderHandlerPaymentLink({ body } = {}) {
|
|
2287
|
+
async createOrderHandlerPaymentLink({ body } = {}) {
|
|
1218
2288
|
const { error } = PaymentValidator.createOrderHandlerPaymentLink().validate(
|
|
1219
2289
|
{ body },
|
|
1220
2290
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1222,11 +2292,28 @@ class Payment {
|
|
|
1222
2292
|
if (error) {
|
|
1223
2293
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1224
2294
|
}
|
|
2295
|
+
|
|
2296
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2297
|
+
const {
|
|
2298
|
+
error: warrning,
|
|
2299
|
+
} = PaymentValidator.createOrderHandlerPaymentLink().validate(
|
|
2300
|
+
{ body },
|
|
2301
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2302
|
+
);
|
|
2303
|
+
if (warrning) {
|
|
2304
|
+
Logger({
|
|
2305
|
+
level: "WARN",
|
|
2306
|
+
message:
|
|
2307
|
+
"Parameter Validation warrnings for createOrderHandlerPaymentLink",
|
|
2308
|
+
});
|
|
2309
|
+
Logger({ level: "WARN", message: warrning });
|
|
2310
|
+
}
|
|
2311
|
+
|
|
1225
2312
|
const query_params = {};
|
|
1226
2313
|
|
|
1227
2314
|
const xHeaders = {};
|
|
1228
2315
|
|
|
1229
|
-
|
|
2316
|
+
const response = await APIClient.execute(
|
|
1230
2317
|
this._conf,
|
|
1231
2318
|
"post",
|
|
1232
2319
|
constructUrl({
|
|
@@ -1237,6 +2324,24 @@ class Payment {
|
|
|
1237
2324
|
body,
|
|
1238
2325
|
xHeaders
|
|
1239
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;
|
|
1240
2345
|
}
|
|
1241
2346
|
|
|
1242
2347
|
/**
|
|
@@ -1246,7 +2351,7 @@ class Payment {
|
|
|
1246
2351
|
* @summary: Initialize a payment (server-to-server) for UPI and BharatQR
|
|
1247
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.
|
|
1248
2353
|
*/
|
|
1249
|
-
initialisePaymentPaymentLink({ body } = {}) {
|
|
2354
|
+
async initialisePaymentPaymentLink({ body } = {}) {
|
|
1250
2355
|
const { error } = PaymentValidator.initialisePaymentPaymentLink().validate(
|
|
1251
2356
|
{ body },
|
|
1252
2357
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1254,11 +2359,28 @@ class Payment {
|
|
|
1254
2359
|
if (error) {
|
|
1255
2360
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1256
2361
|
}
|
|
2362
|
+
|
|
2363
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2364
|
+
const {
|
|
2365
|
+
error: warrning,
|
|
2366
|
+
} = PaymentValidator.initialisePaymentPaymentLink().validate(
|
|
2367
|
+
{ body },
|
|
2368
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2369
|
+
);
|
|
2370
|
+
if (warrning) {
|
|
2371
|
+
Logger({
|
|
2372
|
+
level: "WARN",
|
|
2373
|
+
message:
|
|
2374
|
+
"Parameter Validation warrnings for initialisePaymentPaymentLink",
|
|
2375
|
+
});
|
|
2376
|
+
Logger({ level: "WARN", message: warrning });
|
|
2377
|
+
}
|
|
2378
|
+
|
|
1257
2379
|
const query_params = {};
|
|
1258
2380
|
|
|
1259
2381
|
const xHeaders = {};
|
|
1260
2382
|
|
|
1261
|
-
|
|
2383
|
+
const response = await APIClient.execute(
|
|
1262
2384
|
this._conf,
|
|
1263
2385
|
"post",
|
|
1264
2386
|
constructUrl({
|
|
@@ -1269,6 +2391,24 @@ class Payment {
|
|
|
1269
2391
|
body,
|
|
1270
2392
|
xHeaders
|
|
1271
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;
|
|
1272
2412
|
}
|
|
1273
2413
|
|
|
1274
2414
|
/**
|
|
@@ -1278,7 +2418,7 @@ class Payment {
|
|
|
1278
2418
|
* @summary: Performs continuous polling to check status of payment on the server
|
|
1279
2419
|
* @description: Use this API to perform continuous polling at intervals to check the status of payment until timeout.
|
|
1280
2420
|
*/
|
|
1281
|
-
checkAndUpdatePaymentStatusPaymentLink({ body } = {}) {
|
|
2421
|
+
async checkAndUpdatePaymentStatusPaymentLink({ body } = {}) {
|
|
1282
2422
|
const {
|
|
1283
2423
|
error,
|
|
1284
2424
|
} = PaymentValidator.checkAndUpdatePaymentStatusPaymentLink().validate(
|
|
@@ -1288,11 +2428,28 @@ class Payment {
|
|
|
1288
2428
|
if (error) {
|
|
1289
2429
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1290
2430
|
}
|
|
2431
|
+
|
|
2432
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2433
|
+
const {
|
|
2434
|
+
error: warrning,
|
|
2435
|
+
} = PaymentValidator.checkAndUpdatePaymentStatusPaymentLink().validate(
|
|
2436
|
+
{ body },
|
|
2437
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2438
|
+
);
|
|
2439
|
+
if (warrning) {
|
|
2440
|
+
Logger({
|
|
2441
|
+
level: "WARN",
|
|
2442
|
+
message:
|
|
2443
|
+
"Parameter Validation warrnings for checkAndUpdatePaymentStatusPaymentLink",
|
|
2444
|
+
});
|
|
2445
|
+
Logger({ level: "WARN", message: warrning });
|
|
2446
|
+
}
|
|
2447
|
+
|
|
1291
2448
|
const query_params = {};
|
|
1292
2449
|
|
|
1293
2450
|
const xHeaders = {};
|
|
1294
2451
|
|
|
1295
|
-
|
|
2452
|
+
const response = await APIClient.execute(
|
|
1296
2453
|
this._conf,
|
|
1297
2454
|
"post",
|
|
1298
2455
|
constructUrl({
|
|
@@ -1303,6 +2460,24 @@ class Payment {
|
|
|
1303
2460
|
body,
|
|
1304
2461
|
xHeaders
|
|
1305
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;
|
|
1306
2481
|
}
|
|
1307
2482
|
|
|
1308
2483
|
/**
|
|
@@ -1312,7 +2487,7 @@ class Payment {
|
|
|
1312
2487
|
* @summary: API to fetch the customer credit summary
|
|
1313
2488
|
* @description: Use this API to fetch the customer credit summary.
|
|
1314
2489
|
*/
|
|
1315
|
-
customerCreditSummary({ aggregator } = {}) {
|
|
2490
|
+
async customerCreditSummary({ aggregator } = {}) {
|
|
1316
2491
|
const { error } = PaymentValidator.customerCreditSummary().validate(
|
|
1317
2492
|
{ aggregator },
|
|
1318
2493
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1320,12 +2495,28 @@ class Payment {
|
|
|
1320
2495
|
if (error) {
|
|
1321
2496
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1322
2497
|
}
|
|
2498
|
+
|
|
2499
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2500
|
+
const {
|
|
2501
|
+
error: warrning,
|
|
2502
|
+
} = PaymentValidator.customerCreditSummary().validate(
|
|
2503
|
+
{ aggregator },
|
|
2504
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2505
|
+
);
|
|
2506
|
+
if (warrning) {
|
|
2507
|
+
Logger({
|
|
2508
|
+
level: "WARN",
|
|
2509
|
+
message: "Parameter Validation warrnings for customerCreditSummary",
|
|
2510
|
+
});
|
|
2511
|
+
Logger({ level: "WARN", message: warrning });
|
|
2512
|
+
}
|
|
2513
|
+
|
|
1323
2514
|
const query_params = {};
|
|
1324
2515
|
query_params["aggregator"] = aggregator;
|
|
1325
2516
|
|
|
1326
2517
|
const xHeaders = {};
|
|
1327
2518
|
|
|
1328
|
-
|
|
2519
|
+
const response = await APIClient.execute(
|
|
1329
2520
|
this._conf,
|
|
1330
2521
|
"get",
|
|
1331
2522
|
constructUrl({
|
|
@@ -1336,6 +2527,23 @@ class Payment {
|
|
|
1336
2527
|
undefined,
|
|
1337
2528
|
xHeaders
|
|
1338
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;
|
|
1339
2547
|
}
|
|
1340
2548
|
|
|
1341
2549
|
/**
|
|
@@ -1348,7 +2556,7 @@ class Payment {
|
|
|
1348
2556
|
* @summary: API to get the redirect url to redirect the user to aggregator's page
|
|
1349
2557
|
* @description: Use this API to get the redirect url to redirect the user to aggregator's page
|
|
1350
2558
|
*/
|
|
1351
|
-
redirectToAggregator({ source, aggregator } = {}) {
|
|
2559
|
+
async redirectToAggregator({ source, aggregator } = {}) {
|
|
1352
2560
|
const { error } = PaymentValidator.redirectToAggregator().validate(
|
|
1353
2561
|
{ source, aggregator },
|
|
1354
2562
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1356,13 +2564,29 @@ class Payment {
|
|
|
1356
2564
|
if (error) {
|
|
1357
2565
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1358
2566
|
}
|
|
2567
|
+
|
|
2568
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2569
|
+
const {
|
|
2570
|
+
error: warrning,
|
|
2571
|
+
} = PaymentValidator.redirectToAggregator().validate(
|
|
2572
|
+
{ source, aggregator },
|
|
2573
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2574
|
+
);
|
|
2575
|
+
if (warrning) {
|
|
2576
|
+
Logger({
|
|
2577
|
+
level: "WARN",
|
|
2578
|
+
message: "Parameter Validation warrnings for redirectToAggregator",
|
|
2579
|
+
});
|
|
2580
|
+
Logger({ level: "WARN", message: warrning });
|
|
2581
|
+
}
|
|
2582
|
+
|
|
1359
2583
|
const query_params = {};
|
|
1360
2584
|
query_params["source"] = source;
|
|
1361
2585
|
query_params["aggregator"] = aggregator;
|
|
1362
2586
|
|
|
1363
2587
|
const xHeaders = {};
|
|
1364
2588
|
|
|
1365
|
-
|
|
2589
|
+
const response = await APIClient.execute(
|
|
1366
2590
|
this._conf,
|
|
1367
2591
|
"get",
|
|
1368
2592
|
constructUrl({
|
|
@@ -1373,6 +2597,23 @@ class Payment {
|
|
|
1373
2597
|
undefined,
|
|
1374
2598
|
xHeaders
|
|
1375
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;
|
|
1376
2617
|
}
|
|
1377
2618
|
|
|
1378
2619
|
/**
|
|
@@ -1382,7 +2623,7 @@ class Payment {
|
|
|
1382
2623
|
* @summary: API to fetch the customer credit summary
|
|
1383
2624
|
* @description: Use this API to fetch the customer credit summary.
|
|
1384
2625
|
*/
|
|
1385
|
-
checkCredit({ aggregator } = {}) {
|
|
2626
|
+
async checkCredit({ aggregator } = {}) {
|
|
1386
2627
|
const { error } = PaymentValidator.checkCredit().validate(
|
|
1387
2628
|
{ aggregator },
|
|
1388
2629
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1390,12 +2631,26 @@ class Payment {
|
|
|
1390
2631
|
if (error) {
|
|
1391
2632
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1392
2633
|
}
|
|
2634
|
+
|
|
2635
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2636
|
+
const { error: warrning } = PaymentValidator.checkCredit().validate(
|
|
2637
|
+
{ aggregator },
|
|
2638
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2639
|
+
);
|
|
2640
|
+
if (warrning) {
|
|
2641
|
+
Logger({
|
|
2642
|
+
level: "WARN",
|
|
2643
|
+
message: "Parameter Validation warrnings for checkCredit",
|
|
2644
|
+
});
|
|
2645
|
+
Logger({ level: "WARN", message: warrning });
|
|
2646
|
+
}
|
|
2647
|
+
|
|
1393
2648
|
const query_params = {};
|
|
1394
2649
|
query_params["aggregator"] = aggregator;
|
|
1395
2650
|
|
|
1396
2651
|
const xHeaders = {};
|
|
1397
2652
|
|
|
1398
|
-
|
|
2653
|
+
const response = await APIClient.execute(
|
|
1399
2654
|
this._conf,
|
|
1400
2655
|
"get",
|
|
1401
2656
|
constructUrl({
|
|
@@ -1406,6 +2661,23 @@ class Payment {
|
|
|
1406
2661
|
undefined,
|
|
1407
2662
|
xHeaders
|
|
1408
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;
|
|
1409
2681
|
}
|
|
1410
2682
|
|
|
1411
2683
|
/**
|
|
@@ -1415,7 +2687,7 @@ class Payment {
|
|
|
1415
2687
|
* @summary: API to fetch the customer credit summary
|
|
1416
2688
|
* @description: Use this API to fetch the customer credit summary.
|
|
1417
2689
|
*/
|
|
1418
|
-
customerOnboard({ body } = {}) {
|
|
2690
|
+
async customerOnboard({ body } = {}) {
|
|
1419
2691
|
const { error } = PaymentValidator.customerOnboard().validate(
|
|
1420
2692
|
{ body },
|
|
1421
2693
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1423,11 +2695,25 @@ class Payment {
|
|
|
1423
2695
|
if (error) {
|
|
1424
2696
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1425
2697
|
}
|
|
2698
|
+
|
|
2699
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2700
|
+
const { error: warrning } = PaymentValidator.customerOnboard().validate(
|
|
2701
|
+
{ body },
|
|
2702
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2703
|
+
);
|
|
2704
|
+
if (warrning) {
|
|
2705
|
+
Logger({
|
|
2706
|
+
level: "WARN",
|
|
2707
|
+
message: "Parameter Validation warrnings for customerOnboard",
|
|
2708
|
+
});
|
|
2709
|
+
Logger({ level: "WARN", message: warrning });
|
|
2710
|
+
}
|
|
2711
|
+
|
|
1426
2712
|
const query_params = {};
|
|
1427
2713
|
|
|
1428
2714
|
const xHeaders = {};
|
|
1429
2715
|
|
|
1430
|
-
|
|
2716
|
+
const response = await APIClient.execute(
|
|
1431
2717
|
this._conf,
|
|
1432
2718
|
"post",
|
|
1433
2719
|
constructUrl({
|
|
@@ -1438,6 +2724,23 @@ class Payment {
|
|
|
1438
2724
|
body,
|
|
1439
2725
|
xHeaders
|
|
1440
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;
|
|
1441
2744
|
}
|
|
1442
2745
|
}
|
|
1443
2746
|
|