@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
|
@@ -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,
|
|
@@ -24,12 +28,27 @@ class Payment {
|
|
|
24
28
|
return Promise.reject(new FDKClientValidationError(error));
|
|
25
29
|
}
|
|
26
30
|
|
|
31
|
+
// Showing warrnings if extra unknown parameters are found
|
|
32
|
+
const { error: warrning } = PaymentValidator.getAllPayouts().validate(
|
|
33
|
+
{
|
|
34
|
+
uniqueExternalId,
|
|
35
|
+
},
|
|
36
|
+
{ abortEarly: false, allowUnknown: false }
|
|
37
|
+
);
|
|
38
|
+
if (warrning) {
|
|
39
|
+
Logger({
|
|
40
|
+
level: "WARN",
|
|
41
|
+
message: "Parameter Validation warrnings for getAllPayouts",
|
|
42
|
+
});
|
|
43
|
+
Logger({ level: "WARN", message: warrning });
|
|
44
|
+
}
|
|
45
|
+
|
|
27
46
|
const query_params = {};
|
|
28
47
|
query_params["unique_external_id"] = uniqueExternalId;
|
|
29
48
|
|
|
30
49
|
const xHeaders = {};
|
|
31
50
|
|
|
32
|
-
|
|
51
|
+
const response = await PlatformAPIClient.execute(
|
|
33
52
|
this.config,
|
|
34
53
|
"get",
|
|
35
54
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/payouts`,
|
|
@@ -37,15 +56,33 @@ class Payment {
|
|
|
37
56
|
undefined,
|
|
38
57
|
xHeaders
|
|
39
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;
|
|
40
76
|
}
|
|
41
77
|
|
|
42
78
|
/**
|
|
43
79
|
* @param {Object} arg - Arg object.
|
|
44
80
|
* @param {PayoutRequest} arg.body
|
|
81
|
+
* @returns {Promise<PayoutResponse>} - Success response
|
|
45
82
|
* @summary: Save Payout
|
|
46
83
|
* @description: Save Payout
|
|
47
84
|
*/
|
|
48
|
-
savePayout({ body } = {}) {
|
|
85
|
+
async savePayout({ body } = {}) {
|
|
49
86
|
const { error } = PaymentValidator.savePayout().validate(
|
|
50
87
|
{
|
|
51
88
|
body,
|
|
@@ -56,11 +93,26 @@ class Payment {
|
|
|
56
93
|
return Promise.reject(new FDKClientValidationError(error));
|
|
57
94
|
}
|
|
58
95
|
|
|
96
|
+
// Showing warrnings if extra unknown parameters are found
|
|
97
|
+
const { error: warrning } = PaymentValidator.savePayout().validate(
|
|
98
|
+
{
|
|
99
|
+
body,
|
|
100
|
+
},
|
|
101
|
+
{ abortEarly: false, allowUnknown: false }
|
|
102
|
+
);
|
|
103
|
+
if (warrning) {
|
|
104
|
+
Logger({
|
|
105
|
+
level: "WARN",
|
|
106
|
+
message: "Parameter Validation warrnings for savePayout",
|
|
107
|
+
});
|
|
108
|
+
Logger({ level: "WARN", message: warrning });
|
|
109
|
+
}
|
|
110
|
+
|
|
59
111
|
const query_params = {};
|
|
60
112
|
|
|
61
113
|
const xHeaders = {};
|
|
62
114
|
|
|
63
|
-
|
|
115
|
+
const response = await PlatformAPIClient.execute(
|
|
64
116
|
this.config,
|
|
65
117
|
"post",
|
|
66
118
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/payouts`,
|
|
@@ -68,16 +120,34 @@ class Payment {
|
|
|
68
120
|
body,
|
|
69
121
|
xHeaders
|
|
70
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;
|
|
71
140
|
}
|
|
72
141
|
|
|
73
142
|
/**
|
|
74
143
|
* @param {Object} arg - Arg object.
|
|
75
144
|
* @param {string} arg.uniqueTransferNo - Unique transfer id
|
|
76
145
|
* @param {PayoutRequest} arg.body
|
|
146
|
+
* @returns {Promise<UpdatePayoutResponse>} - Success response
|
|
77
147
|
* @summary: Update Payout
|
|
78
148
|
* @description: Update Payout
|
|
79
149
|
*/
|
|
80
|
-
updatePayout({ uniqueTransferNo, body } = {}) {
|
|
150
|
+
async updatePayout({ uniqueTransferNo, body } = {}) {
|
|
81
151
|
const { error } = PaymentValidator.updatePayout().validate(
|
|
82
152
|
{
|
|
83
153
|
uniqueTransferNo,
|
|
@@ -89,11 +159,27 @@ class Payment {
|
|
|
89
159
|
return Promise.reject(new FDKClientValidationError(error));
|
|
90
160
|
}
|
|
91
161
|
|
|
162
|
+
// Showing warrnings if extra unknown parameters are found
|
|
163
|
+
const { error: warrning } = PaymentValidator.updatePayout().validate(
|
|
164
|
+
{
|
|
165
|
+
uniqueTransferNo,
|
|
166
|
+
body,
|
|
167
|
+
},
|
|
168
|
+
{ abortEarly: false, allowUnknown: false }
|
|
169
|
+
);
|
|
170
|
+
if (warrning) {
|
|
171
|
+
Logger({
|
|
172
|
+
level: "WARN",
|
|
173
|
+
message: "Parameter Validation warrnings for updatePayout",
|
|
174
|
+
});
|
|
175
|
+
Logger({ level: "WARN", message: warrning });
|
|
176
|
+
}
|
|
177
|
+
|
|
92
178
|
const query_params = {};
|
|
93
179
|
|
|
94
180
|
const xHeaders = {};
|
|
95
181
|
|
|
96
|
-
|
|
182
|
+
const response = await PlatformAPIClient.execute(
|
|
97
183
|
this.config,
|
|
98
184
|
"put",
|
|
99
185
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/payouts/${uniqueTransferNo}`,
|
|
@@ -101,16 +187,34 @@ class Payment {
|
|
|
101
187
|
body,
|
|
102
188
|
xHeaders
|
|
103
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;
|
|
104
207
|
}
|
|
105
208
|
|
|
106
209
|
/**
|
|
107
210
|
* @param {Object} arg - Arg object.
|
|
108
211
|
* @param {string} arg.uniqueTransferNo - Unique transfer id
|
|
109
212
|
* @param {UpdatePayoutRequest} arg.body
|
|
213
|
+
* @returns {Promise<UpdatePayoutResponse>} - Success response
|
|
110
214
|
* @summary: Partial Update Payout
|
|
111
215
|
* @description: Partial Update Payout
|
|
112
216
|
*/
|
|
113
|
-
activateAndDectivatePayout({ uniqueTransferNo, body } = {}) {
|
|
217
|
+
async activateAndDectivatePayout({ uniqueTransferNo, body } = {}) {
|
|
114
218
|
const { error } = PaymentValidator.activateAndDectivatePayout().validate(
|
|
115
219
|
{
|
|
116
220
|
uniqueTransferNo,
|
|
@@ -122,11 +226,30 @@ class Payment {
|
|
|
122
226
|
return Promise.reject(new FDKClientValidationError(error));
|
|
123
227
|
}
|
|
124
228
|
|
|
229
|
+
// Showing warrnings if extra unknown parameters are found
|
|
230
|
+
const {
|
|
231
|
+
error: warrning,
|
|
232
|
+
} = PaymentValidator.activateAndDectivatePayout().validate(
|
|
233
|
+
{
|
|
234
|
+
uniqueTransferNo,
|
|
235
|
+
body,
|
|
236
|
+
},
|
|
237
|
+
{ abortEarly: false, allowUnknown: false }
|
|
238
|
+
);
|
|
239
|
+
if (warrning) {
|
|
240
|
+
Logger({
|
|
241
|
+
level: "WARN",
|
|
242
|
+
message:
|
|
243
|
+
"Parameter Validation warrnings for activateAndDectivatePayout",
|
|
244
|
+
});
|
|
245
|
+
Logger({ level: "WARN", message: warrning });
|
|
246
|
+
}
|
|
247
|
+
|
|
125
248
|
const query_params = {};
|
|
126
249
|
|
|
127
250
|
const xHeaders = {};
|
|
128
251
|
|
|
129
|
-
|
|
252
|
+
const response = await PlatformAPIClient.execute(
|
|
130
253
|
this.config,
|
|
131
254
|
"patch",
|
|
132
255
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/payouts/${uniqueTransferNo}`,
|
|
@@ -134,15 +257,33 @@ class Payment {
|
|
|
134
257
|
body,
|
|
135
258
|
xHeaders
|
|
136
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;
|
|
137
277
|
}
|
|
138
278
|
|
|
139
279
|
/**
|
|
140
280
|
* @param {Object} arg - Arg object.
|
|
141
281
|
* @param {string} arg.uniqueTransferNo - Unique transfer id
|
|
282
|
+
* @returns {Promise<DeletePayoutResponse>} - Success response
|
|
142
283
|
* @summary: Delete Payout
|
|
143
284
|
* @description: Delete Payout
|
|
144
285
|
*/
|
|
145
|
-
deletePayout({ uniqueTransferNo } = {}) {
|
|
286
|
+
async deletePayout({ uniqueTransferNo } = {}) {
|
|
146
287
|
const { error } = PaymentValidator.deletePayout().validate(
|
|
147
288
|
{
|
|
148
289
|
uniqueTransferNo,
|
|
@@ -153,11 +294,26 @@ class Payment {
|
|
|
153
294
|
return Promise.reject(new FDKClientValidationError(error));
|
|
154
295
|
}
|
|
155
296
|
|
|
297
|
+
// Showing warrnings if extra unknown parameters are found
|
|
298
|
+
const { error: warrning } = PaymentValidator.deletePayout().validate(
|
|
299
|
+
{
|
|
300
|
+
uniqueTransferNo,
|
|
301
|
+
},
|
|
302
|
+
{ abortEarly: false, allowUnknown: false }
|
|
303
|
+
);
|
|
304
|
+
if (warrning) {
|
|
305
|
+
Logger({
|
|
306
|
+
level: "WARN",
|
|
307
|
+
message: "Parameter Validation warrnings for deletePayout",
|
|
308
|
+
});
|
|
309
|
+
Logger({ level: "WARN", message: warrning });
|
|
310
|
+
}
|
|
311
|
+
|
|
156
312
|
const query_params = {};
|
|
157
313
|
|
|
158
314
|
const xHeaders = {};
|
|
159
315
|
|
|
160
|
-
|
|
316
|
+
const response = await PlatformAPIClient.execute(
|
|
161
317
|
this.config,
|
|
162
318
|
"delete",
|
|
163
319
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/payouts/${uniqueTransferNo}`,
|
|
@@ -165,15 +321,33 @@ class Payment {
|
|
|
165
321
|
undefined,
|
|
166
322
|
xHeaders
|
|
167
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;
|
|
168
341
|
}
|
|
169
342
|
|
|
170
343
|
/**
|
|
171
344
|
* @param {Object} arg - Arg object.
|
|
172
345
|
* @param {string} [arg.uniqueExternalId] - Unique external id
|
|
346
|
+
* @returns {Promise<SubscriptionPaymentMethodResponse>} - Success response
|
|
173
347
|
* @summary: List Subscription Payment Method
|
|
174
348
|
* @description: Get all Subscription Payment Method
|
|
175
349
|
*/
|
|
176
|
-
getSubscriptionPaymentMethod({ uniqueExternalId } = {}) {
|
|
350
|
+
async getSubscriptionPaymentMethod({ uniqueExternalId } = {}) {
|
|
177
351
|
const { error } = PaymentValidator.getSubscriptionPaymentMethod().validate(
|
|
178
352
|
{
|
|
179
353
|
uniqueExternalId,
|
|
@@ -184,12 +358,30 @@ class Payment {
|
|
|
184
358
|
return Promise.reject(new FDKClientValidationError(error));
|
|
185
359
|
}
|
|
186
360
|
|
|
361
|
+
// Showing warrnings if extra unknown parameters are found
|
|
362
|
+
const {
|
|
363
|
+
error: warrning,
|
|
364
|
+
} = PaymentValidator.getSubscriptionPaymentMethod().validate(
|
|
365
|
+
{
|
|
366
|
+
uniqueExternalId,
|
|
367
|
+
},
|
|
368
|
+
{ abortEarly: false, allowUnknown: false }
|
|
369
|
+
);
|
|
370
|
+
if (warrning) {
|
|
371
|
+
Logger({
|
|
372
|
+
level: "WARN",
|
|
373
|
+
message:
|
|
374
|
+
"Parameter Validation warrnings for getSubscriptionPaymentMethod",
|
|
375
|
+
});
|
|
376
|
+
Logger({ level: "WARN", message: warrning });
|
|
377
|
+
}
|
|
378
|
+
|
|
187
379
|
const query_params = {};
|
|
188
380
|
query_params["unique_external_id"] = uniqueExternalId;
|
|
189
381
|
|
|
190
382
|
const xHeaders = {};
|
|
191
383
|
|
|
192
|
-
|
|
384
|
+
const response = await PlatformAPIClient.execute(
|
|
193
385
|
this.config,
|
|
194
386
|
"get",
|
|
195
387
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/subscription/methods`,
|
|
@@ -197,16 +389,38 @@ class Payment {
|
|
|
197
389
|
undefined,
|
|
198
390
|
xHeaders
|
|
199
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;
|
|
200
410
|
}
|
|
201
411
|
|
|
202
412
|
/**
|
|
203
413
|
* @param {Object} arg - Arg object.
|
|
204
414
|
* @param {string} arg.uniqueExternalId -
|
|
205
415
|
* @param {string} arg.paymentMethodId -
|
|
416
|
+
* @returns {Promise<DeleteSubscriptionPaymentMethodResponse>} - Success response
|
|
206
417
|
* @summary: Delete Subscription Payment Method
|
|
207
418
|
* @description: Uses this api to Delete Subscription Payment Method
|
|
208
419
|
*/
|
|
209
|
-
deleteSubscriptionPaymentMethod({
|
|
420
|
+
async deleteSubscriptionPaymentMethod({
|
|
421
|
+
uniqueExternalId,
|
|
422
|
+
paymentMethodId,
|
|
423
|
+
} = {}) {
|
|
210
424
|
const {
|
|
211
425
|
error,
|
|
212
426
|
} = PaymentValidator.deleteSubscriptionPaymentMethod().validate(
|
|
@@ -220,13 +434,32 @@ class Payment {
|
|
|
220
434
|
return Promise.reject(new FDKClientValidationError(error));
|
|
221
435
|
}
|
|
222
436
|
|
|
437
|
+
// Showing warrnings if extra unknown parameters are found
|
|
438
|
+
const {
|
|
439
|
+
error: warrning,
|
|
440
|
+
} = PaymentValidator.deleteSubscriptionPaymentMethod().validate(
|
|
441
|
+
{
|
|
442
|
+
uniqueExternalId,
|
|
443
|
+
paymentMethodId,
|
|
444
|
+
},
|
|
445
|
+
{ abortEarly: false, allowUnknown: false }
|
|
446
|
+
);
|
|
447
|
+
if (warrning) {
|
|
448
|
+
Logger({
|
|
449
|
+
level: "WARN",
|
|
450
|
+
message:
|
|
451
|
+
"Parameter Validation warrnings for deleteSubscriptionPaymentMethod",
|
|
452
|
+
});
|
|
453
|
+
Logger({ level: "WARN", message: warrning });
|
|
454
|
+
}
|
|
455
|
+
|
|
223
456
|
const query_params = {};
|
|
224
457
|
query_params["unique_external_id"] = uniqueExternalId;
|
|
225
458
|
query_params["payment_method_id"] = paymentMethodId;
|
|
226
459
|
|
|
227
460
|
const xHeaders = {};
|
|
228
461
|
|
|
229
|
-
|
|
462
|
+
const response = await PlatformAPIClient.execute(
|
|
230
463
|
this.config,
|
|
231
464
|
"delete",
|
|
232
465
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/subscription/methods`,
|
|
@@ -234,14 +467,33 @@ class Payment {
|
|
|
234
467
|
undefined,
|
|
235
468
|
xHeaders
|
|
236
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;
|
|
237
488
|
}
|
|
238
489
|
|
|
239
490
|
/**
|
|
240
491
|
* @param {Object} arg - Arg object.
|
|
492
|
+
* @returns {Promise<SubscriptionConfigResponse>} - Success response
|
|
241
493
|
* @summary: List Subscription Config
|
|
242
494
|
* @description: Get all Subscription Config details
|
|
243
495
|
*/
|
|
244
|
-
getSubscriptionConfig({} = {}) {
|
|
496
|
+
async getSubscriptionConfig({} = {}) {
|
|
245
497
|
const { error } = PaymentValidator.getSubscriptionConfig().validate(
|
|
246
498
|
{},
|
|
247
499
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -250,11 +502,26 @@ class Payment {
|
|
|
250
502
|
return Promise.reject(new FDKClientValidationError(error));
|
|
251
503
|
}
|
|
252
504
|
|
|
505
|
+
// Showing warrnings if extra unknown parameters are found
|
|
506
|
+
const {
|
|
507
|
+
error: warrning,
|
|
508
|
+
} = PaymentValidator.getSubscriptionConfig().validate(
|
|
509
|
+
{},
|
|
510
|
+
{ abortEarly: false, allowUnknown: false }
|
|
511
|
+
);
|
|
512
|
+
if (warrning) {
|
|
513
|
+
Logger({
|
|
514
|
+
level: "WARN",
|
|
515
|
+
message: "Parameter Validation warrnings for getSubscriptionConfig",
|
|
516
|
+
});
|
|
517
|
+
Logger({ level: "WARN", message: warrning });
|
|
518
|
+
}
|
|
519
|
+
|
|
253
520
|
const query_params = {};
|
|
254
521
|
|
|
255
522
|
const xHeaders = {};
|
|
256
523
|
|
|
257
|
-
|
|
524
|
+
const response = await PlatformAPIClient.execute(
|
|
258
525
|
this.config,
|
|
259
526
|
"get",
|
|
260
527
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/subscription/configs`,
|
|
@@ -262,15 +529,33 @@ class Payment {
|
|
|
262
529
|
undefined,
|
|
263
530
|
xHeaders
|
|
264
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;
|
|
265
549
|
}
|
|
266
550
|
|
|
267
551
|
/**
|
|
268
552
|
* @param {Object} arg - Arg object.
|
|
269
553
|
* @param {SaveSubscriptionSetupIntentRequest} arg.body
|
|
554
|
+
* @returns {Promise<SaveSubscriptionSetupIntentResponse>} - Success response
|
|
270
555
|
* @summary: Save Subscription Setup Intent
|
|
271
556
|
* @description: Uses this api to Save Subscription Setup Intent
|
|
272
557
|
*/
|
|
273
|
-
saveSubscriptionSetupIntent({ body } = {}) {
|
|
558
|
+
async saveSubscriptionSetupIntent({ body } = {}) {
|
|
274
559
|
const { error } = PaymentValidator.saveSubscriptionSetupIntent().validate(
|
|
275
560
|
{
|
|
276
561
|
body,
|
|
@@ -281,11 +566,29 @@ class Payment {
|
|
|
281
566
|
return Promise.reject(new FDKClientValidationError(error));
|
|
282
567
|
}
|
|
283
568
|
|
|
569
|
+
// Showing warrnings if extra unknown parameters are found
|
|
570
|
+
const {
|
|
571
|
+
error: warrning,
|
|
572
|
+
} = PaymentValidator.saveSubscriptionSetupIntent().validate(
|
|
573
|
+
{
|
|
574
|
+
body,
|
|
575
|
+
},
|
|
576
|
+
{ abortEarly: false, allowUnknown: false }
|
|
577
|
+
);
|
|
578
|
+
if (warrning) {
|
|
579
|
+
Logger({
|
|
580
|
+
level: "WARN",
|
|
581
|
+
message:
|
|
582
|
+
"Parameter Validation warrnings for saveSubscriptionSetupIntent",
|
|
583
|
+
});
|
|
584
|
+
Logger({ level: "WARN", message: warrning });
|
|
585
|
+
}
|
|
586
|
+
|
|
284
587
|
const query_params = {};
|
|
285
588
|
|
|
286
589
|
const xHeaders = {};
|
|
287
590
|
|
|
288
|
-
|
|
591
|
+
const response = await PlatformAPIClient.execute(
|
|
289
592
|
this.config,
|
|
290
593
|
"post",
|
|
291
594
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/subscription/setup/intent`,
|
|
@@ -293,15 +596,34 @@ class Payment {
|
|
|
293
596
|
body,
|
|
294
597
|
xHeaders
|
|
295
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;
|
|
296
617
|
}
|
|
297
618
|
|
|
298
619
|
/**
|
|
299
620
|
* @param {Object} arg - Arg object.
|
|
300
621
|
* @param {string} [arg.ifscCode] -
|
|
622
|
+
* @returns {Promise<IfscCodeResponse>} - Success response
|
|
301
623
|
* @summary: Ifsc Code Verification
|
|
302
624
|
* @description: Get True/False for correct IFSC Code for adding bank details for refund
|
|
303
625
|
*/
|
|
304
|
-
verifyIfscCode({ ifscCode } = {}) {
|
|
626
|
+
async verifyIfscCode({ ifscCode } = {}) {
|
|
305
627
|
const { error } = PaymentValidator.verifyIfscCode().validate(
|
|
306
628
|
{
|
|
307
629
|
ifscCode,
|
|
@@ -312,12 +634,27 @@ class Payment {
|
|
|
312
634
|
return Promise.reject(new FDKClientValidationError(error));
|
|
313
635
|
}
|
|
314
636
|
|
|
637
|
+
// Showing warrnings if extra unknown parameters are found
|
|
638
|
+
const { error: warrning } = PaymentValidator.verifyIfscCode().validate(
|
|
639
|
+
{
|
|
640
|
+
ifscCode,
|
|
641
|
+
},
|
|
642
|
+
{ abortEarly: false, allowUnknown: false }
|
|
643
|
+
);
|
|
644
|
+
if (warrning) {
|
|
645
|
+
Logger({
|
|
646
|
+
level: "WARN",
|
|
647
|
+
message: "Parameter Validation warrnings for verifyIfscCode",
|
|
648
|
+
});
|
|
649
|
+
Logger({ level: "WARN", message: warrning });
|
|
650
|
+
}
|
|
651
|
+
|
|
315
652
|
const query_params = {};
|
|
316
653
|
query_params["ifsc_code"] = ifscCode;
|
|
317
654
|
|
|
318
655
|
const xHeaders = {};
|
|
319
656
|
|
|
320
|
-
|
|
657
|
+
const response = await PlatformAPIClient.execute(
|
|
321
658
|
this.config,
|
|
322
659
|
"get",
|
|
323
660
|
`/service/platform/payment/v1.0/company/${this.config.companyId}/ifsc-code/verify`,
|
|
@@ -325,6 +662,23 @@ class Payment {
|
|
|
325
662
|
undefined,
|
|
326
663
|
xHeaders
|
|
327
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;
|
|
328
682
|
}
|
|
329
683
|
}
|
|
330
684
|
|