@gofynd/fdk-client-javascript 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/documentation/application/CART.md +251 -251
- package/documentation/application/CATALOG.md +414 -414
- package/documentation/application/CONTENT.md +15 -1
- package/documentation/application/ORDER.md +290 -290
- package/documentation/application/PAYMENT.md +255 -255
- package/documentation/application/POSCART.md +297 -297
- package/documentation/platform/CART.md +499 -499
- package/documentation/platform/CATALOG.md +3088 -2702
- package/documentation/platform/COMPANYPROFILE.md +201 -201
- package/documentation/platform/CONTENT.md +123 -1
- package/documentation/platform/ORDER.md +1233 -1158
- package/documentation/platform/PARTNER.md +7 -7
- package/documentation/platform/PAYMENT.md +83 -83
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +619 -108
- package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationModel.js +335 -335
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +730 -134
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +21 -21
- package/sdk/application/Catalog/CatalogApplicationModel.js +547 -547
- package/sdk/application/Common/CommonApplicationClient.js +48 -8
- package/sdk/application/Communication/CommunicationApplicationClient.js +75 -14
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +392 -66
- package/sdk/application/Content/ContentApplicationClient.js +444 -76
- package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +11 -1
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +74 -12
- package/sdk/application/Lead/LeadApplicationClient.js +164 -30
- package/sdk/application/Logistic/LogisticApplicationClient.js +98 -16
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +287 -54
- package/sdk/application/Order/OrderApplicationModel.d.ts +19 -19
- package/sdk/application/Order/OrderApplicationModel.js +357 -357
- package/sdk/application/Payment/PaymentApplicationClient.js +961 -186
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +3 -3
- package/sdk/application/Payment/PaymentApplicationModel.js +352 -352
- package/sdk/application/PosCart/PosCartApplicationClient.js +645 -114
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
- package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
- package/sdk/application/Rewards/RewardsApplicationClient.js +168 -28
- package/sdk/application/Share/ShareApplicationClient.js +157 -32
- package/sdk/application/Theme/ThemeApplicationClient.js +94 -16
- package/sdk/application/User/UserApplicationClient.js +806 -148
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +191 -34
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +103 -16
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
- package/sdk/platform/Billing/BillingPlatformClient.js +299 -54
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +409 -72
- package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
- package/sdk/platform/Cart/CartPlatformModel.js +617 -617
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +167 -114
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1562 -453
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +8 -8
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +39 -39
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +314 -196
- package/sdk/platform/Catalog/CatalogPlatformClient.js +2459 -718
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +103 -94
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2063 -1797
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +17 -15
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +95 -76
- package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
- package/sdk/platform/Common/CommonPlatformClient.js +51 -8
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1000 -168
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +335 -54
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +10 -10
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +278 -278
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +702 -118
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +457 -82
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +1724 -284
- 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 +270 -44
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +102 -16
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +150 -24
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
- package/sdk/platform/Inventory/InventoryPlatformClient.js +316 -52
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +311 -52
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +266 -44
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +78 -14
- package/sdk/platform/Order/OrderPlatformClient.d.ts +95 -43
- package/sdk/platform/Order/OrderPlatformClient.js +1062 -180
- package/sdk/platform/Order/OrderPlatformModel.d.ts +64 -60
- package/sdk/platform/Order/OrderPlatformModel.js +1481 -1425
- package/sdk/platform/Order/OrderPlatformValidator.js +5 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
- 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 +287 -56
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
- package/sdk/platform/Payment/PaymentPlatformClient.js +263 -48
- package/sdk/platform/Payment/PaymentPlatformModel.js +122 -122
- package/sdk/platform/PlatformApplicationClient.d.ts +2959 -2787
- package/sdk/platform/PlatformApplicationClient.js +3420 -3212
- package/sdk/platform/PlatformClient.d.ts +2959 -2787
- package/sdk/platform/PlatformClient.js +3420 -3212
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +308 -54
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/Share/SharePlatformApplicationClient.js +94 -16
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +571 -96
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
- package/sdk/platform/User/UserPlatformApplicationClient.js +296 -48
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
- package/sdk/platform/Webhook/WebhookPlatformClient.js +157 -30
- package/sdk/public/Configuration/ConfigurationPublicClient.js +51 -8
- package/sdk/public/Inventory/InventoryPublicClient.js +149 -26
- package/sdk/public/Webhook/WebhookPublicClient.js +51 -10
|
@@ -2,6 +2,9 @@ const Paginator = require("../../common/Paginator");
|
|
|
2
2
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
3
3
|
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
4
4
|
const PaymentValidator = require("./PaymentPlatformValidator");
|
|
5
|
+
const PaymentModel = require("./PaymentPlatformModel");
|
|
6
|
+
const { Logger } = require("./../../common/Logger");
|
|
7
|
+
|
|
5
8
|
class Payment {
|
|
6
9
|
constructor(config) {
|
|
7
10
|
this.config = config;
|
|
@@ -10,10 +13,11 @@ class Payment {
|
|
|
10
13
|
/**
|
|
11
14
|
* @param {Object} arg - Arg object.
|
|
12
15
|
* @param {string} [arg.uniqueExternalId] - Fetch payouts using unique external id
|
|
16
|
+
* @returns {Promise<PayoutsResponse>} - Success response
|
|
13
17
|
* @summary: Get All Payouts
|
|
14
18
|
* @description: Get All Payouts
|
|
15
19
|
*/
|
|
16
|
-
getAllPayouts({ uniqueExternalId } = {}) {
|
|
20
|
+
async getAllPayouts({ uniqueExternalId } = {}) {
|
|
17
21
|
const { error } = PaymentValidator.getAllPayouts().validate(
|
|
18
22
|
{
|
|
19
23
|
uniqueExternalId,
|
|
@@ -32,8 +36,11 @@ class Payment {
|
|
|
32
36
|
{ abortEarly: false, allowUnknown: false }
|
|
33
37
|
);
|
|
34
38
|
if (warrning) {
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
Logger({
|
|
40
|
+
level: "WARN",
|
|
41
|
+
message: "Parameter Validation warrnings for getAllPayouts",
|
|
42
|
+
});
|
|
43
|
+
Logger({ level: "WARN", message: warrning });
|
|
37
44
|
}
|
|
38
45
|
|
|
39
46
|
const query_params = {};
|
|
@@ -41,7 +48,7 @@ class Payment {
|
|
|
41
48
|
|
|
42
49
|
const xHeaders = {};
|
|
43
50
|
|
|
44
|
-
|
|
51
|
+
const response = await PlatformAPIClient.execute(
|
|
45
52
|
this.config,
|
|
46
53
|
"get",
|
|
47
54
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/payouts`,
|
|
@@ -49,15 +56,33 @@ class Payment {
|
|
|
49
56
|
undefined,
|
|
50
57
|
xHeaders
|
|
51
58
|
);
|
|
59
|
+
|
|
60
|
+
const {
|
|
61
|
+
error: res_error,
|
|
62
|
+
} = PaymentModel.PayoutsResponse().validate(response, {
|
|
63
|
+
abortEarly: false,
|
|
64
|
+
allowUnknown: false,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
if (res_error) {
|
|
68
|
+
Logger({
|
|
69
|
+
level: "WARN",
|
|
70
|
+
message: "Response Validation Warnnings for getAllPayouts",
|
|
71
|
+
});
|
|
72
|
+
Logger({ level: "WARN", message: res_error });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return response;
|
|
52
76
|
}
|
|
53
77
|
|
|
54
78
|
/**
|
|
55
79
|
* @param {Object} arg - Arg object.
|
|
56
80
|
* @param {PayoutRequest} arg.body
|
|
81
|
+
* @returns {Promise<PayoutResponse>} - Success response
|
|
57
82
|
* @summary: Save Payout
|
|
58
83
|
* @description: Save Payout
|
|
59
84
|
*/
|
|
60
|
-
savePayout({ body } = {}) {
|
|
85
|
+
async savePayout({ body } = {}) {
|
|
61
86
|
const { error } = PaymentValidator.savePayout().validate(
|
|
62
87
|
{
|
|
63
88
|
body,
|
|
@@ -76,15 +101,18 @@ class Payment {
|
|
|
76
101
|
{ abortEarly: false, allowUnknown: false }
|
|
77
102
|
);
|
|
78
103
|
if (warrning) {
|
|
79
|
-
|
|
80
|
-
|
|
104
|
+
Logger({
|
|
105
|
+
level: "WARN",
|
|
106
|
+
message: "Parameter Validation warrnings for savePayout",
|
|
107
|
+
});
|
|
108
|
+
Logger({ level: "WARN", message: warrning });
|
|
81
109
|
}
|
|
82
110
|
|
|
83
111
|
const query_params = {};
|
|
84
112
|
|
|
85
113
|
const xHeaders = {};
|
|
86
114
|
|
|
87
|
-
|
|
115
|
+
const response = await PlatformAPIClient.execute(
|
|
88
116
|
this.config,
|
|
89
117
|
"post",
|
|
90
118
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/payouts`,
|
|
@@ -92,16 +120,34 @@ class Payment {
|
|
|
92
120
|
body,
|
|
93
121
|
xHeaders
|
|
94
122
|
);
|
|
123
|
+
|
|
124
|
+
const {
|
|
125
|
+
error: res_error,
|
|
126
|
+
} = PaymentModel.PayoutResponse().validate(response, {
|
|
127
|
+
abortEarly: false,
|
|
128
|
+
allowUnknown: false,
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
if (res_error) {
|
|
132
|
+
Logger({
|
|
133
|
+
level: "WARN",
|
|
134
|
+
message: "Response Validation Warnnings for savePayout",
|
|
135
|
+
});
|
|
136
|
+
Logger({ level: "WARN", message: res_error });
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return response;
|
|
95
140
|
}
|
|
96
141
|
|
|
97
142
|
/**
|
|
98
143
|
* @param {Object} arg - Arg object.
|
|
99
144
|
* @param {string} arg.uniqueTransferNo - Unique transfer id
|
|
100
145
|
* @param {PayoutRequest} arg.body
|
|
146
|
+
* @returns {Promise<UpdatePayoutResponse>} - Success response
|
|
101
147
|
* @summary: Update Payout
|
|
102
148
|
* @description: Update Payout
|
|
103
149
|
*/
|
|
104
|
-
updatePayout({ uniqueTransferNo, body } = {}) {
|
|
150
|
+
async updatePayout({ uniqueTransferNo, body } = {}) {
|
|
105
151
|
const { error } = PaymentValidator.updatePayout().validate(
|
|
106
152
|
{
|
|
107
153
|
uniqueTransferNo,
|
|
@@ -122,15 +168,18 @@ class Payment {
|
|
|
122
168
|
{ abortEarly: false, allowUnknown: false }
|
|
123
169
|
);
|
|
124
170
|
if (warrning) {
|
|
125
|
-
|
|
126
|
-
|
|
171
|
+
Logger({
|
|
172
|
+
level: "WARN",
|
|
173
|
+
message: "Parameter Validation warrnings for updatePayout",
|
|
174
|
+
});
|
|
175
|
+
Logger({ level: "WARN", message: warrning });
|
|
127
176
|
}
|
|
128
177
|
|
|
129
178
|
const query_params = {};
|
|
130
179
|
|
|
131
180
|
const xHeaders = {};
|
|
132
181
|
|
|
133
|
-
|
|
182
|
+
const response = await PlatformAPIClient.execute(
|
|
134
183
|
this.config,
|
|
135
184
|
"put",
|
|
136
185
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/payouts/${uniqueTransferNo}`,
|
|
@@ -138,16 +187,34 @@ class Payment {
|
|
|
138
187
|
body,
|
|
139
188
|
xHeaders
|
|
140
189
|
);
|
|
190
|
+
|
|
191
|
+
const {
|
|
192
|
+
error: res_error,
|
|
193
|
+
} = PaymentModel.UpdatePayoutResponse().validate(response, {
|
|
194
|
+
abortEarly: false,
|
|
195
|
+
allowUnknown: false,
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
if (res_error) {
|
|
199
|
+
Logger({
|
|
200
|
+
level: "WARN",
|
|
201
|
+
message: "Response Validation Warnnings for updatePayout",
|
|
202
|
+
});
|
|
203
|
+
Logger({ level: "WARN", message: res_error });
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return response;
|
|
141
207
|
}
|
|
142
208
|
|
|
143
209
|
/**
|
|
144
210
|
* @param {Object} arg - Arg object.
|
|
145
211
|
* @param {string} arg.uniqueTransferNo - Unique transfer id
|
|
146
212
|
* @param {UpdatePayoutRequest} arg.body
|
|
213
|
+
* @returns {Promise<UpdatePayoutResponse>} - Success response
|
|
147
214
|
* @summary: Partial Update Payout
|
|
148
215
|
* @description: Partial Update Payout
|
|
149
216
|
*/
|
|
150
|
-
activateAndDectivatePayout({ uniqueTransferNo, body } = {}) {
|
|
217
|
+
async activateAndDectivatePayout({ uniqueTransferNo, body } = {}) {
|
|
151
218
|
const { error } = PaymentValidator.activateAndDectivatePayout().validate(
|
|
152
219
|
{
|
|
153
220
|
uniqueTransferNo,
|
|
@@ -170,17 +237,19 @@ class Payment {
|
|
|
170
237
|
{ abortEarly: false, allowUnknown: false }
|
|
171
238
|
);
|
|
172
239
|
if (warrning) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
240
|
+
Logger({
|
|
241
|
+
level: "WARN",
|
|
242
|
+
message:
|
|
243
|
+
"Parameter Validation warrnings for activateAndDectivatePayout",
|
|
244
|
+
});
|
|
245
|
+
Logger({ level: "WARN", message: warrning });
|
|
177
246
|
}
|
|
178
247
|
|
|
179
248
|
const query_params = {};
|
|
180
249
|
|
|
181
250
|
const xHeaders = {};
|
|
182
251
|
|
|
183
|
-
|
|
252
|
+
const response = await PlatformAPIClient.execute(
|
|
184
253
|
this.config,
|
|
185
254
|
"patch",
|
|
186
255
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/payouts/${uniqueTransferNo}`,
|
|
@@ -188,15 +257,33 @@ class Payment {
|
|
|
188
257
|
body,
|
|
189
258
|
xHeaders
|
|
190
259
|
);
|
|
260
|
+
|
|
261
|
+
const {
|
|
262
|
+
error: res_error,
|
|
263
|
+
} = PaymentModel.UpdatePayoutResponse().validate(response, {
|
|
264
|
+
abortEarly: false,
|
|
265
|
+
allowUnknown: false,
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
if (res_error) {
|
|
269
|
+
Logger({
|
|
270
|
+
level: "WARN",
|
|
271
|
+
message: "Response Validation Warnnings for activateAndDectivatePayout",
|
|
272
|
+
});
|
|
273
|
+
Logger({ level: "WARN", message: res_error });
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return response;
|
|
191
277
|
}
|
|
192
278
|
|
|
193
279
|
/**
|
|
194
280
|
* @param {Object} arg - Arg object.
|
|
195
281
|
* @param {string} arg.uniqueTransferNo - Unique transfer id
|
|
282
|
+
* @returns {Promise<DeletePayoutResponse>} - Success response
|
|
196
283
|
* @summary: Delete Payout
|
|
197
284
|
* @description: Delete Payout
|
|
198
285
|
*/
|
|
199
|
-
deletePayout({ uniqueTransferNo } = {}) {
|
|
286
|
+
async deletePayout({ uniqueTransferNo } = {}) {
|
|
200
287
|
const { error } = PaymentValidator.deletePayout().validate(
|
|
201
288
|
{
|
|
202
289
|
uniqueTransferNo,
|
|
@@ -215,15 +302,18 @@ class Payment {
|
|
|
215
302
|
{ abortEarly: false, allowUnknown: false }
|
|
216
303
|
);
|
|
217
304
|
if (warrning) {
|
|
218
|
-
|
|
219
|
-
|
|
305
|
+
Logger({
|
|
306
|
+
level: "WARN",
|
|
307
|
+
message: "Parameter Validation warrnings for deletePayout",
|
|
308
|
+
});
|
|
309
|
+
Logger({ level: "WARN", message: warrning });
|
|
220
310
|
}
|
|
221
311
|
|
|
222
312
|
const query_params = {};
|
|
223
313
|
|
|
224
314
|
const xHeaders = {};
|
|
225
315
|
|
|
226
|
-
|
|
316
|
+
const response = await PlatformAPIClient.execute(
|
|
227
317
|
this.config,
|
|
228
318
|
"delete",
|
|
229
319
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/payouts/${uniqueTransferNo}`,
|
|
@@ -231,15 +321,33 @@ class Payment {
|
|
|
231
321
|
undefined,
|
|
232
322
|
xHeaders
|
|
233
323
|
);
|
|
324
|
+
|
|
325
|
+
const {
|
|
326
|
+
error: res_error,
|
|
327
|
+
} = PaymentModel.DeletePayoutResponse().validate(response, {
|
|
328
|
+
abortEarly: false,
|
|
329
|
+
allowUnknown: false,
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
if (res_error) {
|
|
333
|
+
Logger({
|
|
334
|
+
level: "WARN",
|
|
335
|
+
message: "Response Validation Warnnings for deletePayout",
|
|
336
|
+
});
|
|
337
|
+
Logger({ level: "WARN", message: res_error });
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
return response;
|
|
234
341
|
}
|
|
235
342
|
|
|
236
343
|
/**
|
|
237
344
|
* @param {Object} arg - Arg object.
|
|
238
345
|
* @param {string} [arg.uniqueExternalId] - Unique external id
|
|
346
|
+
* @returns {Promise<SubscriptionPaymentMethodResponse>} - Success response
|
|
239
347
|
* @summary: List Subscription Payment Method
|
|
240
348
|
* @description: Get all Subscription Payment Method
|
|
241
349
|
*/
|
|
242
|
-
getSubscriptionPaymentMethod({ uniqueExternalId } = {}) {
|
|
350
|
+
async getSubscriptionPaymentMethod({ uniqueExternalId } = {}) {
|
|
243
351
|
const { error } = PaymentValidator.getSubscriptionPaymentMethod().validate(
|
|
244
352
|
{
|
|
245
353
|
uniqueExternalId,
|
|
@@ -260,10 +368,12 @@ class Payment {
|
|
|
260
368
|
{ abortEarly: false, allowUnknown: false }
|
|
261
369
|
);
|
|
262
370
|
if (warrning) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
371
|
+
Logger({
|
|
372
|
+
level: "WARN",
|
|
373
|
+
message:
|
|
374
|
+
"Parameter Validation warrnings for getSubscriptionPaymentMethod",
|
|
375
|
+
});
|
|
376
|
+
Logger({ level: "WARN", message: warrning });
|
|
267
377
|
}
|
|
268
378
|
|
|
269
379
|
const query_params = {};
|
|
@@ -271,7 +381,7 @@ class Payment {
|
|
|
271
381
|
|
|
272
382
|
const xHeaders = {};
|
|
273
383
|
|
|
274
|
-
|
|
384
|
+
const response = await PlatformAPIClient.execute(
|
|
275
385
|
this.config,
|
|
276
386
|
"get",
|
|
277
387
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/subscription/methods`,
|
|
@@ -279,16 +389,38 @@ class Payment {
|
|
|
279
389
|
undefined,
|
|
280
390
|
xHeaders
|
|
281
391
|
);
|
|
392
|
+
|
|
393
|
+
const {
|
|
394
|
+
error: res_error,
|
|
395
|
+
} = PaymentModel.SubscriptionPaymentMethodResponse().validate(response, {
|
|
396
|
+
abortEarly: false,
|
|
397
|
+
allowUnknown: false,
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
if (res_error) {
|
|
401
|
+
Logger({
|
|
402
|
+
level: "WARN",
|
|
403
|
+
message:
|
|
404
|
+
"Response Validation Warnnings for getSubscriptionPaymentMethod",
|
|
405
|
+
});
|
|
406
|
+
Logger({ level: "WARN", message: res_error });
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
return response;
|
|
282
410
|
}
|
|
283
411
|
|
|
284
412
|
/**
|
|
285
413
|
* @param {Object} arg - Arg object.
|
|
286
414
|
* @param {string} arg.uniqueExternalId -
|
|
287
415
|
* @param {string} arg.paymentMethodId -
|
|
416
|
+
* @returns {Promise<DeleteSubscriptionPaymentMethodResponse>} - Success response
|
|
288
417
|
* @summary: Delete Subscription Payment Method
|
|
289
418
|
* @description: Uses this api to Delete Subscription Payment Method
|
|
290
419
|
*/
|
|
291
|
-
deleteSubscriptionPaymentMethod({
|
|
420
|
+
async deleteSubscriptionPaymentMethod({
|
|
421
|
+
uniqueExternalId,
|
|
422
|
+
paymentMethodId,
|
|
423
|
+
} = {}) {
|
|
292
424
|
const {
|
|
293
425
|
error,
|
|
294
426
|
} = PaymentValidator.deleteSubscriptionPaymentMethod().validate(
|
|
@@ -313,10 +445,12 @@ class Payment {
|
|
|
313
445
|
{ abortEarly: false, allowUnknown: false }
|
|
314
446
|
);
|
|
315
447
|
if (warrning) {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
448
|
+
Logger({
|
|
449
|
+
level: "WARN",
|
|
450
|
+
message:
|
|
451
|
+
"Parameter Validation warrnings for deleteSubscriptionPaymentMethod",
|
|
452
|
+
});
|
|
453
|
+
Logger({ level: "WARN", message: warrning });
|
|
320
454
|
}
|
|
321
455
|
|
|
322
456
|
const query_params = {};
|
|
@@ -325,7 +459,7 @@ class Payment {
|
|
|
325
459
|
|
|
326
460
|
const xHeaders = {};
|
|
327
461
|
|
|
328
|
-
|
|
462
|
+
const response = await PlatformAPIClient.execute(
|
|
329
463
|
this.config,
|
|
330
464
|
"delete",
|
|
331
465
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/subscription/methods`,
|
|
@@ -333,14 +467,33 @@ class Payment {
|
|
|
333
467
|
undefined,
|
|
334
468
|
xHeaders
|
|
335
469
|
);
|
|
470
|
+
|
|
471
|
+
const {
|
|
472
|
+
error: res_error,
|
|
473
|
+
} = PaymentModel.DeleteSubscriptionPaymentMethodResponse().validate(
|
|
474
|
+
response,
|
|
475
|
+
{ abortEarly: false, allowUnknown: false }
|
|
476
|
+
);
|
|
477
|
+
|
|
478
|
+
if (res_error) {
|
|
479
|
+
Logger({
|
|
480
|
+
level: "WARN",
|
|
481
|
+
message:
|
|
482
|
+
"Response Validation Warnnings for deleteSubscriptionPaymentMethod",
|
|
483
|
+
});
|
|
484
|
+
Logger({ level: "WARN", message: res_error });
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
return response;
|
|
336
488
|
}
|
|
337
489
|
|
|
338
490
|
/**
|
|
339
491
|
* @param {Object} arg - Arg object.
|
|
492
|
+
* @returns {Promise<SubscriptionConfigResponse>} - Success response
|
|
340
493
|
* @summary: List Subscription Config
|
|
341
494
|
* @description: Get all Subscription Config details
|
|
342
495
|
*/
|
|
343
|
-
getSubscriptionConfig({} = {}) {
|
|
496
|
+
async getSubscriptionConfig({} = {}) {
|
|
344
497
|
const { error } = PaymentValidator.getSubscriptionConfig().validate(
|
|
345
498
|
{},
|
|
346
499
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -357,15 +510,18 @@ class Payment {
|
|
|
357
510
|
{ abortEarly: false, allowUnknown: false }
|
|
358
511
|
);
|
|
359
512
|
if (warrning) {
|
|
360
|
-
|
|
361
|
-
|
|
513
|
+
Logger({
|
|
514
|
+
level: "WARN",
|
|
515
|
+
message: "Parameter Validation warrnings for getSubscriptionConfig",
|
|
516
|
+
});
|
|
517
|
+
Logger({ level: "WARN", message: warrning });
|
|
362
518
|
}
|
|
363
519
|
|
|
364
520
|
const query_params = {};
|
|
365
521
|
|
|
366
522
|
const xHeaders = {};
|
|
367
523
|
|
|
368
|
-
|
|
524
|
+
const response = await PlatformAPIClient.execute(
|
|
369
525
|
this.config,
|
|
370
526
|
"get",
|
|
371
527
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/subscription/configs`,
|
|
@@ -373,15 +529,33 @@ class Payment {
|
|
|
373
529
|
undefined,
|
|
374
530
|
xHeaders
|
|
375
531
|
);
|
|
532
|
+
|
|
533
|
+
const {
|
|
534
|
+
error: res_error,
|
|
535
|
+
} = PaymentModel.SubscriptionConfigResponse().validate(response, {
|
|
536
|
+
abortEarly: false,
|
|
537
|
+
allowUnknown: false,
|
|
538
|
+
});
|
|
539
|
+
|
|
540
|
+
if (res_error) {
|
|
541
|
+
Logger({
|
|
542
|
+
level: "WARN",
|
|
543
|
+
message: "Response Validation Warnnings for getSubscriptionConfig",
|
|
544
|
+
});
|
|
545
|
+
Logger({ level: "WARN", message: res_error });
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
return response;
|
|
376
549
|
}
|
|
377
550
|
|
|
378
551
|
/**
|
|
379
552
|
* @param {Object} arg - Arg object.
|
|
380
553
|
* @param {SaveSubscriptionSetupIntentRequest} arg.body
|
|
554
|
+
* @returns {Promise<SaveSubscriptionSetupIntentResponse>} - Success response
|
|
381
555
|
* @summary: Save Subscription Setup Intent
|
|
382
556
|
* @description: Uses this api to Save Subscription Setup Intent
|
|
383
557
|
*/
|
|
384
|
-
saveSubscriptionSetupIntent({ body } = {}) {
|
|
558
|
+
async saveSubscriptionSetupIntent({ body } = {}) {
|
|
385
559
|
const { error } = PaymentValidator.saveSubscriptionSetupIntent().validate(
|
|
386
560
|
{
|
|
387
561
|
body,
|
|
@@ -402,17 +576,19 @@ class Payment {
|
|
|
402
576
|
{ abortEarly: false, allowUnknown: false }
|
|
403
577
|
);
|
|
404
578
|
if (warrning) {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
579
|
+
Logger({
|
|
580
|
+
level: "WARN",
|
|
581
|
+
message:
|
|
582
|
+
"Parameter Validation warrnings for saveSubscriptionSetupIntent",
|
|
583
|
+
});
|
|
584
|
+
Logger({ level: "WARN", message: warrning });
|
|
409
585
|
}
|
|
410
586
|
|
|
411
587
|
const query_params = {};
|
|
412
588
|
|
|
413
589
|
const xHeaders = {};
|
|
414
590
|
|
|
415
|
-
|
|
591
|
+
const response = await PlatformAPIClient.execute(
|
|
416
592
|
this.config,
|
|
417
593
|
"post",
|
|
418
594
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/subscription/setup/intent`,
|
|
@@ -420,15 +596,34 @@ class Payment {
|
|
|
420
596
|
body,
|
|
421
597
|
xHeaders
|
|
422
598
|
);
|
|
599
|
+
|
|
600
|
+
const {
|
|
601
|
+
error: res_error,
|
|
602
|
+
} = PaymentModel.SaveSubscriptionSetupIntentResponse().validate(response, {
|
|
603
|
+
abortEarly: false,
|
|
604
|
+
allowUnknown: false,
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
if (res_error) {
|
|
608
|
+
Logger({
|
|
609
|
+
level: "WARN",
|
|
610
|
+
message:
|
|
611
|
+
"Response Validation Warnnings for saveSubscriptionSetupIntent",
|
|
612
|
+
});
|
|
613
|
+
Logger({ level: "WARN", message: res_error });
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
return response;
|
|
423
617
|
}
|
|
424
618
|
|
|
425
619
|
/**
|
|
426
620
|
* @param {Object} arg - Arg object.
|
|
427
621
|
* @param {string} [arg.ifscCode] -
|
|
622
|
+
* @returns {Promise<IfscCodeResponse>} - Success response
|
|
428
623
|
* @summary: Ifsc Code Verification
|
|
429
624
|
* @description: Get True/False for correct IFSC Code for adding bank details for refund
|
|
430
625
|
*/
|
|
431
|
-
verifyIfscCode({ ifscCode } = {}) {
|
|
626
|
+
async verifyIfscCode({ ifscCode } = {}) {
|
|
432
627
|
const { error } = PaymentValidator.verifyIfscCode().validate(
|
|
433
628
|
{
|
|
434
629
|
ifscCode,
|
|
@@ -447,8 +642,11 @@ class Payment {
|
|
|
447
642
|
{ abortEarly: false, allowUnknown: false }
|
|
448
643
|
);
|
|
449
644
|
if (warrning) {
|
|
450
|
-
|
|
451
|
-
|
|
645
|
+
Logger({
|
|
646
|
+
level: "WARN",
|
|
647
|
+
message: "Parameter Validation warrnings for verifyIfscCode",
|
|
648
|
+
});
|
|
649
|
+
Logger({ level: "WARN", message: warrning });
|
|
452
650
|
}
|
|
453
651
|
|
|
454
652
|
const query_params = {};
|
|
@@ -456,7 +654,7 @@ class Payment {
|
|
|
456
654
|
|
|
457
655
|
const xHeaders = {};
|
|
458
656
|
|
|
459
|
-
|
|
657
|
+
const response = await PlatformAPIClient.execute(
|
|
460
658
|
this.config,
|
|
461
659
|
"get",
|
|
462
660
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/ifsc-code/verify`,
|
|
@@ -464,6 +662,23 @@ class Payment {
|
|
|
464
662
|
undefined,
|
|
465
663
|
xHeaders
|
|
466
664
|
);
|
|
665
|
+
|
|
666
|
+
const {
|
|
667
|
+
error: res_error,
|
|
668
|
+
} = PaymentModel.IfscCodeResponse().validate(response, {
|
|
669
|
+
abortEarly: false,
|
|
670
|
+
allowUnknown: false,
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
if (res_error) {
|
|
674
|
+
Logger({
|
|
675
|
+
level: "WARN",
|
|
676
|
+
message: "Response Validation Warnnings for verifyIfscCode",
|
|
677
|
+
});
|
|
678
|
+
Logger({ level: "WARN", message: res_error });
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
return response;
|
|
467
682
|
}
|
|
468
683
|
}
|
|
469
684
|
|