@gofynd/fdk-client-javascript 1.1.1 → 1.1.3
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/README.md +1 -2
- package/index.d.ts +4 -7
- package/index.js +5 -12
- package/package.json +1 -1
- package/sdk/application/ApplicationClient.d.ts +20 -20
- package/sdk/application/ApplicationClient.js +26 -26
- package/sdk/application/Cart/CartApplicationClient.d.ts +45 -4
- package/sdk/application/Cart/CartApplicationClient.js +169 -9
- package/sdk/application/Cart/CartApplicationModel.d.ts +15 -0
- package/sdk/application/Cart/CartApplicationModel.js +177 -1
- package/sdk/application/Cart/CartApplicationValidator.d.ts +2 -0
- package/sdk/application/Cart/CartApplicationValidator.js +20 -0
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +14 -4
- package/sdk/application/Catalog/CatalogApplicationClient.js +18 -6
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +1 -0
- package/sdk/application/Catalog/CatalogApplicationModel.js +13 -0
- package/sdk/application/Catalog/CatalogApplicationValidator.js +2 -0
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +14 -10
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +16 -10
- package/sdk/application/Configuration/ConfigurationApplicationModel.js +1 -0
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +4 -1
- package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +8 -2
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +8 -2
- package/sdk/application/FileStorage/FileStorageApplicationModel.js +2 -2
- package/sdk/application/Logistic/LogisticApplicationModel.js +3 -2
- package/sdk/application/Order/OrderApplicationClient.d.ts +17 -2
- package/sdk/application/Order/OrderApplicationClient.js +70 -2
- package/sdk/application/Order/OrderApplicationModel.d.ts +17 -0
- package/sdk/application/Order/OrderApplicationModel.js +129 -8
- package/sdk/application/Order/OrderApplicationValidator.d.ts +1 -0
- package/sdk/application/Order/OrderApplicationValidator.js +7 -0
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +35 -0
- package/sdk/application/Payment/PaymentApplicationClient.js +200 -0
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +4 -0
- package/sdk/application/Payment/PaymentApplicationModel.js +58 -7
- package/sdk/application/Payment/PaymentApplicationValidator.d.ts +3 -0
- package/sdk/application/Payment/PaymentApplicationValidator.js +19 -0
- package/sdk/application/PosCart/PosCartApplicationClient.d.ts +16 -3
- package/sdk/application/PosCart/PosCartApplicationClient.js +39 -6
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +10 -0
- package/sdk/application/PosCart/PosCartApplicationModel.js +113 -1
- package/sdk/application/PosCart/PosCartApplicationValidator.js +6 -0
- package/sdk/application/Rewards/RewardsApplicationClient.d.ts +8 -8
- package/sdk/application/Rewards/RewardsApplicationClient.js +8 -8
- package/sdk/application/index.d.ts +10 -10
- package/sdk/application/index.js +13 -13
- package/sdk/common/AxiosHelper.js +1 -1
- package/sdk/common/Constant.d.ts +5 -0
- package/sdk/common/Constant.js +5 -0
- package/sdk/platform/Billing/BillingPlatformModel.js +6 -1
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +479 -0
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +2574 -307
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +31 -0
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +263 -0
- package/sdk/platform/Cart/CartPlatformModel.d.ts +61 -0
- package/sdk/platform/Cart/CartPlatformModel.js +697 -2
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +8 -2
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +10 -0
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +1 -0
- package/sdk/platform/Catalog/CatalogPlatformClient.js +2 -2
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +1 -0
- package/sdk/platform/Catalog/CatalogPlatformModel.js +41 -29
- package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +1 -0
- package/sdk/platform/Communication/CommunicationPlatformModel.js +9 -0
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +2 -2
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +2 -2
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +5 -4
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +99 -78
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +99 -78
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +87 -71
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +87 -71
- package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +2 -0
- package/sdk/platform/Configuration/ConfigurationPlatformModel.js +26 -0
- package/sdk/platform/Content/ContentPlatformModel.js +4 -1
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +10 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +15 -9
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +1 -1
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +8 -2
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +8 -2
- package/sdk/platform/FileStorage/FileStoragePlatformModel.js +2 -2
- package/sdk/platform/Finance/FinancePlatformClient.d.ts +135 -0
- package/sdk/platform/Finance/FinancePlatformClient.js +853 -0
- package/sdk/platform/Finance/FinancePlatformModel.d.ts +51 -0
- package/sdk/platform/Finance/FinancePlatformModel.js +342 -0
- package/sdk/platform/Finance/FinancePlatformValidator.d.ts +16 -0
- package/sdk/platform/Finance/FinancePlatformValidator.js +84 -0
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +11 -1
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +66 -2
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -0
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +6 -0
- package/sdk/platform/Order/OrderPlatformClient.d.ts +161 -81
- package/sdk/platform/Order/OrderPlatformClient.js +546 -119
- package/sdk/platform/Order/OrderPlatformModel.d.ts +42 -6
- package/sdk/platform/Order/OrderPlatformModel.js +570 -158
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +6 -0
- package/sdk/platform/Order/OrderPlatformValidator.js +52 -10
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +22 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +127 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationValidator.d.ts +2 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +13 -0
- package/sdk/platform/Partner/PartnerPlatformClient.d.ts +145 -0
- package/sdk/platform/Partner/PartnerPlatformClient.js +799 -0
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +39 -0
- package/sdk/platform/Partner/PartnerPlatformModel.js +367 -0
- package/sdk/platform/Partner/PartnerPlatformValidator.d.ts +14 -0
- package/sdk/platform/Partner/PartnerPlatformValidator.js +87 -0
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +221 -0
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +1476 -190
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +20 -0
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +126 -0
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +44 -0
- package/sdk/platform/Payment/PaymentPlatformModel.js +410 -0
- package/sdk/platform/PlatformApplicationClient.d.ts +1149 -930
- package/sdk/platform/PlatformApplicationClient.js +1260 -1027
- package/sdk/platform/PlatformClient.d.ts +10360 -8660
- package/sdk/platform/PlatformClient.js +11126 -9093
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +14 -26
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +14 -74
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +0 -1
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +0 -7
- package/sdk/platform/index.d.ts +15 -14
- package/sdk/platform/index.js +20 -18
- package/sdk/public/PublicClient.d.ts +2 -2
- package/sdk/public/PublicClient.js +4 -4
- package/sdk/public/index.d.ts +1 -1
- package/sdk/public/index.js +2 -2
- package/partner.d.ts +0 -4
- package/partner.js +0 -7
- package/sdk/partner/OAuthClient.d.ts +0 -14
- package/sdk/partner/OAuthClient.js +0 -112
- package/sdk/partner/PartnerAPIClient.d.ts +0 -12
- package/sdk/partner/PartnerAPIClient.js +0 -42
- package/sdk/partner/PartnerClient.d.ts +0 -6
- package/sdk/partner/PartnerClient.js +0 -17
- package/sdk/partner/PartnerConfig.d.ts +0 -30
- package/sdk/partner/PartnerConfig.js +0 -39
- package/sdk/partner/index.d.ts +0 -3
- package/sdk/partner/index.js +0 -5
|
@@ -0,0 +1,853 @@
|
|
|
1
|
+
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
2
|
+
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
3
|
+
const Paginator = require("../../common/Paginator");
|
|
4
|
+
const FinanceValidator = require("./FinancePlatformValidator");
|
|
5
|
+
const FinanceModel = require("./FinancePlatformModel");
|
|
6
|
+
const { Logger } = require("./../../common/Logger");
|
|
7
|
+
const Joi = require("joi");
|
|
8
|
+
|
|
9
|
+
class Finance {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.config = config;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {Object} arg - Arg object.
|
|
16
|
+
* @param {CreditlineDataPlatformRequest} arg.body
|
|
17
|
+
* @returns {Promise<CreditlineDataPlatformResponse>} - Success response
|
|
18
|
+
* @summary:
|
|
19
|
+
* @description:
|
|
20
|
+
*/
|
|
21
|
+
async creditlineDataplatform({ body } = {}) {
|
|
22
|
+
const { error } = FinanceValidator.creditlineDataplatform().validate(
|
|
23
|
+
{
|
|
24
|
+
body,
|
|
25
|
+
},
|
|
26
|
+
{ abortEarly: false, allowUnknown: true }
|
|
27
|
+
);
|
|
28
|
+
if (error) {
|
|
29
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Showing warrnings if extra unknown parameters are found
|
|
33
|
+
const {
|
|
34
|
+
error: warrning,
|
|
35
|
+
} = FinanceValidator.creditlineDataplatform().validate(
|
|
36
|
+
{
|
|
37
|
+
body,
|
|
38
|
+
},
|
|
39
|
+
{ abortEarly: false, allowUnknown: false }
|
|
40
|
+
);
|
|
41
|
+
if (warrning) {
|
|
42
|
+
Logger({
|
|
43
|
+
level: "WARN",
|
|
44
|
+
message: "Parameter Validation warrnings for creditlineDataplatform",
|
|
45
|
+
});
|
|
46
|
+
Logger({ level: "WARN", message: warrning });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const query_params = {};
|
|
50
|
+
|
|
51
|
+
const xHeaders = {};
|
|
52
|
+
|
|
53
|
+
const response = await PlatformAPIClient.execute(
|
|
54
|
+
this.config,
|
|
55
|
+
"post",
|
|
56
|
+
`/service/platform/finance/v1.0/company/${this.config.companyId}/credit-line-data`,
|
|
57
|
+
query_params,
|
|
58
|
+
body,
|
|
59
|
+
xHeaders
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const {
|
|
63
|
+
error: res_error,
|
|
64
|
+
} = FinanceModel.CreditlineDataPlatformResponse().validate(response, {
|
|
65
|
+
abortEarly: false,
|
|
66
|
+
allowUnknown: false,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
if (res_error) {
|
|
70
|
+
Logger({
|
|
71
|
+
level: "WARN",
|
|
72
|
+
message: "Response Validation Warnnings for creditlineDataplatform",
|
|
73
|
+
});
|
|
74
|
+
Logger({ level: "WARN", message: res_error });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return response;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @param {Object} arg - Arg object.
|
|
82
|
+
* @param {DownloadCreditDebitNoteRequest} arg.body
|
|
83
|
+
* @returns {Promise<DownloadCreditDebitNoteResponse>} - Success response
|
|
84
|
+
* @summary:
|
|
85
|
+
* @description:
|
|
86
|
+
*/
|
|
87
|
+
async downloadCreditDebitNote({ body } = {}) {
|
|
88
|
+
const { error } = FinanceValidator.downloadCreditDebitNote().validate(
|
|
89
|
+
{
|
|
90
|
+
body,
|
|
91
|
+
},
|
|
92
|
+
{ abortEarly: false, allowUnknown: true }
|
|
93
|
+
);
|
|
94
|
+
if (error) {
|
|
95
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Showing warrnings if extra unknown parameters are found
|
|
99
|
+
const {
|
|
100
|
+
error: warrning,
|
|
101
|
+
} = FinanceValidator.downloadCreditDebitNote().validate(
|
|
102
|
+
{
|
|
103
|
+
body,
|
|
104
|
+
},
|
|
105
|
+
{ abortEarly: false, allowUnknown: false }
|
|
106
|
+
);
|
|
107
|
+
if (warrning) {
|
|
108
|
+
Logger({
|
|
109
|
+
level: "WARN",
|
|
110
|
+
message: "Parameter Validation warrnings for downloadCreditDebitNote",
|
|
111
|
+
});
|
|
112
|
+
Logger({ level: "WARN", message: warrning });
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const query_params = {};
|
|
116
|
+
|
|
117
|
+
const xHeaders = {};
|
|
118
|
+
|
|
119
|
+
const response = await PlatformAPIClient.execute(
|
|
120
|
+
this.config,
|
|
121
|
+
"post",
|
|
122
|
+
`/service/platform/finance/v1.0/company/${this.config.companyId}/download-credit-debit-note`,
|
|
123
|
+
query_params,
|
|
124
|
+
body,
|
|
125
|
+
xHeaders
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
const {
|
|
129
|
+
error: res_error,
|
|
130
|
+
} = FinanceModel.DownloadCreditDebitNoteResponse().validate(response, {
|
|
131
|
+
abortEarly: false,
|
|
132
|
+
allowUnknown: false,
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
if (res_error) {
|
|
136
|
+
Logger({
|
|
137
|
+
level: "WARN",
|
|
138
|
+
message: "Response Validation Warnnings for downloadCreditDebitNote",
|
|
139
|
+
});
|
|
140
|
+
Logger({ level: "WARN", message: res_error });
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return response;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @param {Object} arg - Arg object.
|
|
148
|
+
* @param {DownloadReport} arg.body
|
|
149
|
+
* @returns {Promise<DownloadReportList>} - Success response
|
|
150
|
+
* @summary:
|
|
151
|
+
* @description:
|
|
152
|
+
*/
|
|
153
|
+
async downloadReport({ body } = {}) {
|
|
154
|
+
const { error } = FinanceValidator.downloadReport().validate(
|
|
155
|
+
{
|
|
156
|
+
body,
|
|
157
|
+
},
|
|
158
|
+
{ abortEarly: false, allowUnknown: true }
|
|
159
|
+
);
|
|
160
|
+
if (error) {
|
|
161
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Showing warrnings if extra unknown parameters are found
|
|
165
|
+
const { error: warrning } = FinanceValidator.downloadReport().validate(
|
|
166
|
+
{
|
|
167
|
+
body,
|
|
168
|
+
},
|
|
169
|
+
{ abortEarly: false, allowUnknown: false }
|
|
170
|
+
);
|
|
171
|
+
if (warrning) {
|
|
172
|
+
Logger({
|
|
173
|
+
level: "WARN",
|
|
174
|
+
message: "Parameter Validation warrnings for downloadReport",
|
|
175
|
+
});
|
|
176
|
+
Logger({ level: "WARN", message: warrning });
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const query_params = {};
|
|
180
|
+
|
|
181
|
+
const xHeaders = {};
|
|
182
|
+
|
|
183
|
+
const response = await PlatformAPIClient.execute(
|
|
184
|
+
this.config,
|
|
185
|
+
"post",
|
|
186
|
+
`/service/platform/finance/v1.0/company/${this.config.companyId}/download-report`,
|
|
187
|
+
query_params,
|
|
188
|
+
body,
|
|
189
|
+
xHeaders
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
const {
|
|
193
|
+
error: res_error,
|
|
194
|
+
} = FinanceModel.DownloadReportList().validate(response, {
|
|
195
|
+
abortEarly: false,
|
|
196
|
+
allowUnknown: false,
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
if (res_error) {
|
|
200
|
+
Logger({
|
|
201
|
+
level: "WARN",
|
|
202
|
+
message: "Response Validation Warnnings for downloadReport",
|
|
203
|
+
});
|
|
204
|
+
Logger({ level: "WARN", message: res_error });
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return response;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @param {Object} arg - Arg object.
|
|
212
|
+
* @param {GenerateReportRequest} arg.body
|
|
213
|
+
* @returns {Promise<GenerateReportJson>} - Success response
|
|
214
|
+
* @summary:
|
|
215
|
+
* @description:
|
|
216
|
+
*/
|
|
217
|
+
async generateReport({ body } = {}) {
|
|
218
|
+
const { error } = FinanceValidator.generateReport().validate(
|
|
219
|
+
{
|
|
220
|
+
body,
|
|
221
|
+
},
|
|
222
|
+
{ abortEarly: false, allowUnknown: true }
|
|
223
|
+
);
|
|
224
|
+
if (error) {
|
|
225
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Showing warrnings if extra unknown parameters are found
|
|
229
|
+
const { error: warrning } = FinanceValidator.generateReport().validate(
|
|
230
|
+
{
|
|
231
|
+
body,
|
|
232
|
+
},
|
|
233
|
+
{ abortEarly: false, allowUnknown: false }
|
|
234
|
+
);
|
|
235
|
+
if (warrning) {
|
|
236
|
+
Logger({
|
|
237
|
+
level: "WARN",
|
|
238
|
+
message: "Parameter Validation warrnings for generateReport",
|
|
239
|
+
});
|
|
240
|
+
Logger({ level: "WARN", message: warrning });
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const query_params = {};
|
|
244
|
+
|
|
245
|
+
const xHeaders = {};
|
|
246
|
+
|
|
247
|
+
const response = await PlatformAPIClient.execute(
|
|
248
|
+
this.config,
|
|
249
|
+
"post",
|
|
250
|
+
`/service/platform/finance/v1.0/company/${this.config.companyId}/generate-report`,
|
|
251
|
+
query_params,
|
|
252
|
+
body,
|
|
253
|
+
xHeaders
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
const {
|
|
257
|
+
error: res_error,
|
|
258
|
+
} = FinanceModel.GenerateReportJson().validate(response, {
|
|
259
|
+
abortEarly: false,
|
|
260
|
+
allowUnknown: false,
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
if (res_error) {
|
|
264
|
+
Logger({
|
|
265
|
+
level: "WARN",
|
|
266
|
+
message: "Response Validation Warnnings for generateReport",
|
|
267
|
+
});
|
|
268
|
+
Logger({ level: "WARN", message: res_error });
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return response;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* @param {Object} arg - Arg object.
|
|
276
|
+
* @param {GetAffiliate} arg.body
|
|
277
|
+
* @returns {Promise<GetAffiliateResponse>} - Success response
|
|
278
|
+
* @summary:
|
|
279
|
+
* @description:
|
|
280
|
+
*/
|
|
281
|
+
async getAffiliate({ body } = {}) {
|
|
282
|
+
const { error } = FinanceValidator.getAffiliate().validate(
|
|
283
|
+
{
|
|
284
|
+
body,
|
|
285
|
+
},
|
|
286
|
+
{ abortEarly: false, allowUnknown: true }
|
|
287
|
+
);
|
|
288
|
+
if (error) {
|
|
289
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Showing warrnings if extra unknown parameters are found
|
|
293
|
+
const { error: warrning } = FinanceValidator.getAffiliate().validate(
|
|
294
|
+
{
|
|
295
|
+
body,
|
|
296
|
+
},
|
|
297
|
+
{ abortEarly: false, allowUnknown: false }
|
|
298
|
+
);
|
|
299
|
+
if (warrning) {
|
|
300
|
+
Logger({
|
|
301
|
+
level: "WARN",
|
|
302
|
+
message: "Parameter Validation warrnings for getAffiliate",
|
|
303
|
+
});
|
|
304
|
+
Logger({ level: "WARN", message: warrning });
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const query_params = {};
|
|
308
|
+
|
|
309
|
+
const xHeaders = {};
|
|
310
|
+
|
|
311
|
+
const response = await PlatformAPIClient.execute(
|
|
312
|
+
this.config,
|
|
313
|
+
"post",
|
|
314
|
+
`/service/platform/finance/v1.0/company/${this.config.companyId}/get-affiliate-list`,
|
|
315
|
+
query_params,
|
|
316
|
+
body,
|
|
317
|
+
xHeaders
|
|
318
|
+
);
|
|
319
|
+
|
|
320
|
+
const {
|
|
321
|
+
error: res_error,
|
|
322
|
+
} = FinanceModel.GetAffiliateResponse().validate(response, {
|
|
323
|
+
abortEarly: false,
|
|
324
|
+
allowUnknown: false,
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
if (res_error) {
|
|
328
|
+
Logger({
|
|
329
|
+
level: "WARN",
|
|
330
|
+
message: "Response Validation Warnnings for getAffiliate",
|
|
331
|
+
});
|
|
332
|
+
Logger({ level: "WARN", message: res_error });
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return response;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* @param {Object} arg - Arg object.
|
|
340
|
+
* @param {GetEngineRequest} arg.body
|
|
341
|
+
* @returns {Promise<GetEngineResponse>} - Success response
|
|
342
|
+
* @summary:
|
|
343
|
+
* @description:
|
|
344
|
+
*/
|
|
345
|
+
async getData({ body } = {}) {
|
|
346
|
+
const { error } = FinanceValidator.getData().validate(
|
|
347
|
+
{
|
|
348
|
+
body,
|
|
349
|
+
},
|
|
350
|
+
{ abortEarly: false, allowUnknown: true }
|
|
351
|
+
);
|
|
352
|
+
if (error) {
|
|
353
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// Showing warrnings if extra unknown parameters are found
|
|
357
|
+
const { error: warrning } = FinanceValidator.getData().validate(
|
|
358
|
+
{
|
|
359
|
+
body,
|
|
360
|
+
},
|
|
361
|
+
{ abortEarly: false, allowUnknown: false }
|
|
362
|
+
);
|
|
363
|
+
if (warrning) {
|
|
364
|
+
Logger({
|
|
365
|
+
level: "WARN",
|
|
366
|
+
message: "Parameter Validation warrnings for getData",
|
|
367
|
+
});
|
|
368
|
+
Logger({ level: "WARN", message: warrning });
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
const query_params = {};
|
|
372
|
+
|
|
373
|
+
const xHeaders = {};
|
|
374
|
+
|
|
375
|
+
const response = await PlatformAPIClient.execute(
|
|
376
|
+
this.config,
|
|
377
|
+
"post",
|
|
378
|
+
`/service/platform/finance/v1.0/company/${this.config.companyId}/get-data`,
|
|
379
|
+
query_params,
|
|
380
|
+
body,
|
|
381
|
+
xHeaders
|
|
382
|
+
);
|
|
383
|
+
|
|
384
|
+
const {
|
|
385
|
+
error: res_error,
|
|
386
|
+
} = FinanceModel.GetEngineResponse().validate(response, {
|
|
387
|
+
abortEarly: false,
|
|
388
|
+
allowUnknown: false,
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
if (res_error) {
|
|
392
|
+
Logger({
|
|
393
|
+
level: "WARN",
|
|
394
|
+
message: "Response Validation Warnnings for getData",
|
|
395
|
+
});
|
|
396
|
+
Logger({ level: "WARN", message: res_error });
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return response;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* @param {Object} arg - Arg object.
|
|
404
|
+
* @param {GetReasonRequest} arg.body
|
|
405
|
+
* @returns {Promise<GetReasonResponse>} - Success response
|
|
406
|
+
* @summary:
|
|
407
|
+
* @description:
|
|
408
|
+
*/
|
|
409
|
+
async getReason({ body } = {}) {
|
|
410
|
+
const { error } = FinanceValidator.getReason().validate(
|
|
411
|
+
{
|
|
412
|
+
body,
|
|
413
|
+
},
|
|
414
|
+
{ abortEarly: false, allowUnknown: true }
|
|
415
|
+
);
|
|
416
|
+
if (error) {
|
|
417
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// Showing warrnings if extra unknown parameters are found
|
|
421
|
+
const { error: warrning } = FinanceValidator.getReason().validate(
|
|
422
|
+
{
|
|
423
|
+
body,
|
|
424
|
+
},
|
|
425
|
+
{ abortEarly: false, allowUnknown: false }
|
|
426
|
+
);
|
|
427
|
+
if (warrning) {
|
|
428
|
+
Logger({
|
|
429
|
+
level: "WARN",
|
|
430
|
+
message: "Parameter Validation warrnings for getReason",
|
|
431
|
+
});
|
|
432
|
+
Logger({ level: "WARN", message: warrning });
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
const query_params = {};
|
|
436
|
+
|
|
437
|
+
const xHeaders = {};
|
|
438
|
+
|
|
439
|
+
const response = await PlatformAPIClient.execute(
|
|
440
|
+
this.config,
|
|
441
|
+
"post",
|
|
442
|
+
`/service/platform/finance/v1.0/company/${this.config.companyId}/get-reason`,
|
|
443
|
+
query_params,
|
|
444
|
+
body,
|
|
445
|
+
xHeaders
|
|
446
|
+
);
|
|
447
|
+
|
|
448
|
+
const {
|
|
449
|
+
error: res_error,
|
|
450
|
+
} = FinanceModel.GetReasonResponse().validate(response, {
|
|
451
|
+
abortEarly: false,
|
|
452
|
+
allowUnknown: false,
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
if (res_error) {
|
|
456
|
+
Logger({
|
|
457
|
+
level: "WARN",
|
|
458
|
+
message: "Response Validation Warnnings for getReason",
|
|
459
|
+
});
|
|
460
|
+
Logger({ level: "WARN", message: res_error });
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
return response;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* @param {Object} arg - Arg object.
|
|
468
|
+
* @param {GetReportListRequest} arg.body
|
|
469
|
+
* @returns {Promise<GetEngineResponse>} - Success response
|
|
470
|
+
* @summary:
|
|
471
|
+
* @description:
|
|
472
|
+
*/
|
|
473
|
+
async getReportList({ body } = {}) {
|
|
474
|
+
const { error } = FinanceValidator.getReportList().validate(
|
|
475
|
+
{
|
|
476
|
+
body,
|
|
477
|
+
},
|
|
478
|
+
{ abortEarly: false, allowUnknown: true }
|
|
479
|
+
);
|
|
480
|
+
if (error) {
|
|
481
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
// Showing warrnings if extra unknown parameters are found
|
|
485
|
+
const { error: warrning } = FinanceValidator.getReportList().validate(
|
|
486
|
+
{
|
|
487
|
+
body,
|
|
488
|
+
},
|
|
489
|
+
{ abortEarly: false, allowUnknown: false }
|
|
490
|
+
);
|
|
491
|
+
if (warrning) {
|
|
492
|
+
Logger({
|
|
493
|
+
level: "WARN",
|
|
494
|
+
message: "Parameter Validation warrnings for getReportList",
|
|
495
|
+
});
|
|
496
|
+
Logger({ level: "WARN", message: warrning });
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
const query_params = {};
|
|
500
|
+
|
|
501
|
+
const xHeaders = {};
|
|
502
|
+
|
|
503
|
+
const response = await PlatformAPIClient.execute(
|
|
504
|
+
this.config,
|
|
505
|
+
"post",
|
|
506
|
+
`/service/platform/finance/v1.0/company/${this.config.companyId}/get-report-list`,
|
|
507
|
+
query_params,
|
|
508
|
+
body,
|
|
509
|
+
xHeaders
|
|
510
|
+
);
|
|
511
|
+
|
|
512
|
+
const {
|
|
513
|
+
error: res_error,
|
|
514
|
+
} = FinanceModel.GetEngineResponse().validate(response, {
|
|
515
|
+
abortEarly: false,
|
|
516
|
+
allowUnknown: false,
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
if (res_error) {
|
|
520
|
+
Logger({
|
|
521
|
+
level: "WARN",
|
|
522
|
+
message: "Response Validation Warnnings for getReportList",
|
|
523
|
+
});
|
|
524
|
+
Logger({ level: "WARN", message: res_error });
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
return response;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* @param {Object} arg - Arg object.
|
|
532
|
+
* @param {InvoiceListingRequest} arg.body
|
|
533
|
+
* @returns {Promise<InvoiceListingResponse>} - Success response
|
|
534
|
+
* @summary:
|
|
535
|
+
* @description:
|
|
536
|
+
*/
|
|
537
|
+
async invoiceListing({ body } = {}) {
|
|
538
|
+
const { error } = FinanceValidator.invoiceListing().validate(
|
|
539
|
+
{
|
|
540
|
+
body,
|
|
541
|
+
},
|
|
542
|
+
{ abortEarly: false, allowUnknown: true }
|
|
543
|
+
);
|
|
544
|
+
if (error) {
|
|
545
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// Showing warrnings if extra unknown parameters are found
|
|
549
|
+
const { error: warrning } = FinanceValidator.invoiceListing().validate(
|
|
550
|
+
{
|
|
551
|
+
body,
|
|
552
|
+
},
|
|
553
|
+
{ abortEarly: false, allowUnknown: false }
|
|
554
|
+
);
|
|
555
|
+
if (warrning) {
|
|
556
|
+
Logger({
|
|
557
|
+
level: "WARN",
|
|
558
|
+
message: "Parameter Validation warrnings for invoiceListing",
|
|
559
|
+
});
|
|
560
|
+
Logger({ level: "WARN", message: warrning });
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
const query_params = {};
|
|
564
|
+
|
|
565
|
+
const xHeaders = {};
|
|
566
|
+
|
|
567
|
+
const response = await PlatformAPIClient.execute(
|
|
568
|
+
this.config,
|
|
569
|
+
"post",
|
|
570
|
+
`/service/platform/finance/v1.0/company/${this.config.companyId}/invoice/listing`,
|
|
571
|
+
query_params,
|
|
572
|
+
body,
|
|
573
|
+
xHeaders
|
|
574
|
+
);
|
|
575
|
+
|
|
576
|
+
const {
|
|
577
|
+
error: res_error,
|
|
578
|
+
} = FinanceModel.InvoiceListingResponse().validate(response, {
|
|
579
|
+
abortEarly: false,
|
|
580
|
+
allowUnknown: false,
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
if (res_error) {
|
|
584
|
+
Logger({
|
|
585
|
+
level: "WARN",
|
|
586
|
+
message: "Response Validation Warnnings for invoiceListing",
|
|
587
|
+
});
|
|
588
|
+
Logger({ level: "WARN", message: res_error });
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
return response;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* @param {Object} arg - Arg object.
|
|
596
|
+
* @param {InvoicePdfRequest} arg.body
|
|
597
|
+
* @returns {Promise<InvoicePdfResponse>} - Success response
|
|
598
|
+
* @summary:
|
|
599
|
+
* @description:
|
|
600
|
+
*/
|
|
601
|
+
async invoicePDF({ body } = {}) {
|
|
602
|
+
const { error } = FinanceValidator.invoicePDF().validate(
|
|
603
|
+
{
|
|
604
|
+
body,
|
|
605
|
+
},
|
|
606
|
+
{ abortEarly: false, allowUnknown: true }
|
|
607
|
+
);
|
|
608
|
+
if (error) {
|
|
609
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
// Showing warrnings if extra unknown parameters are found
|
|
613
|
+
const { error: warrning } = FinanceValidator.invoicePDF().validate(
|
|
614
|
+
{
|
|
615
|
+
body,
|
|
616
|
+
},
|
|
617
|
+
{ abortEarly: false, allowUnknown: false }
|
|
618
|
+
);
|
|
619
|
+
if (warrning) {
|
|
620
|
+
Logger({
|
|
621
|
+
level: "WARN",
|
|
622
|
+
message: "Parameter Validation warrnings for invoicePDF",
|
|
623
|
+
});
|
|
624
|
+
Logger({ level: "WARN", message: warrning });
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
const query_params = {};
|
|
628
|
+
|
|
629
|
+
const xHeaders = {};
|
|
630
|
+
|
|
631
|
+
const response = await PlatformAPIClient.execute(
|
|
632
|
+
this.config,
|
|
633
|
+
"post",
|
|
634
|
+
`/service/platform/finance/v1.0/company/${this.config.companyId}/invoice/pdf-view`,
|
|
635
|
+
query_params,
|
|
636
|
+
body,
|
|
637
|
+
xHeaders
|
|
638
|
+
);
|
|
639
|
+
|
|
640
|
+
const {
|
|
641
|
+
error: res_error,
|
|
642
|
+
} = FinanceModel.InvoicePdfResponse().validate(response, {
|
|
643
|
+
abortEarly: false,
|
|
644
|
+
allowUnknown: false,
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
if (res_error) {
|
|
648
|
+
Logger({
|
|
649
|
+
level: "WARN",
|
|
650
|
+
message: "Response Validation Warnnings for invoicePDF",
|
|
651
|
+
});
|
|
652
|
+
Logger({ level: "WARN", message: res_error });
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
return response;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* @param {Object} arg - Arg object.
|
|
660
|
+
* @param {InvoiceTypeRequest} arg.body
|
|
661
|
+
* @returns {Promise<InvoiceTypeResponse>} - Success response
|
|
662
|
+
* @summary:
|
|
663
|
+
* @description:
|
|
664
|
+
*/
|
|
665
|
+
async invoiceType({ body } = {}) {
|
|
666
|
+
const { error } = FinanceValidator.invoiceType().validate(
|
|
667
|
+
{
|
|
668
|
+
body,
|
|
669
|
+
},
|
|
670
|
+
{ abortEarly: false, allowUnknown: true }
|
|
671
|
+
);
|
|
672
|
+
if (error) {
|
|
673
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
// Showing warrnings if extra unknown parameters are found
|
|
677
|
+
const { error: warrning } = FinanceValidator.invoiceType().validate(
|
|
678
|
+
{
|
|
679
|
+
body,
|
|
680
|
+
},
|
|
681
|
+
{ abortEarly: false, allowUnknown: false }
|
|
682
|
+
);
|
|
683
|
+
if (warrning) {
|
|
684
|
+
Logger({
|
|
685
|
+
level: "WARN",
|
|
686
|
+
message: "Parameter Validation warrnings for invoiceType",
|
|
687
|
+
});
|
|
688
|
+
Logger({ level: "WARN", message: warrning });
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
const query_params = {};
|
|
692
|
+
|
|
693
|
+
const xHeaders = {};
|
|
694
|
+
|
|
695
|
+
const response = await PlatformAPIClient.execute(
|
|
696
|
+
this.config,
|
|
697
|
+
"post",
|
|
698
|
+
`/service/platform/finance/v1.0/company/${this.config.companyId}/invoice-type`,
|
|
699
|
+
query_params,
|
|
700
|
+
body,
|
|
701
|
+
xHeaders
|
|
702
|
+
);
|
|
703
|
+
|
|
704
|
+
const {
|
|
705
|
+
error: res_error,
|
|
706
|
+
} = FinanceModel.InvoiceTypeResponse().validate(response, {
|
|
707
|
+
abortEarly: false,
|
|
708
|
+
allowUnknown: false,
|
|
709
|
+
});
|
|
710
|
+
|
|
711
|
+
if (res_error) {
|
|
712
|
+
Logger({
|
|
713
|
+
level: "WARN",
|
|
714
|
+
message: "Response Validation Warnnings for invoiceType",
|
|
715
|
+
});
|
|
716
|
+
Logger({ level: "WARN", message: res_error });
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
return response;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* @param {Object} arg - Arg object.
|
|
724
|
+
* @param {IsCreditlinePlatformRequest} arg.body
|
|
725
|
+
* @returns {Promise<IsCreditlinePlatformResponse>} - Success response
|
|
726
|
+
* @summary:
|
|
727
|
+
* @description:
|
|
728
|
+
*/
|
|
729
|
+
async isCreditlinePlatform({ body } = {}) {
|
|
730
|
+
const { error } = FinanceValidator.isCreditlinePlatform().validate(
|
|
731
|
+
{
|
|
732
|
+
body,
|
|
733
|
+
},
|
|
734
|
+
{ abortEarly: false, allowUnknown: true }
|
|
735
|
+
);
|
|
736
|
+
if (error) {
|
|
737
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
// Showing warrnings if extra unknown parameters are found
|
|
741
|
+
const {
|
|
742
|
+
error: warrning,
|
|
743
|
+
} = FinanceValidator.isCreditlinePlatform().validate(
|
|
744
|
+
{
|
|
745
|
+
body,
|
|
746
|
+
},
|
|
747
|
+
{ abortEarly: false, allowUnknown: false }
|
|
748
|
+
);
|
|
749
|
+
if (warrning) {
|
|
750
|
+
Logger({
|
|
751
|
+
level: "WARN",
|
|
752
|
+
message: "Parameter Validation warrnings for isCreditlinePlatform",
|
|
753
|
+
});
|
|
754
|
+
Logger({ level: "WARN", message: warrning });
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
const query_params = {};
|
|
758
|
+
|
|
759
|
+
const xHeaders = {};
|
|
760
|
+
|
|
761
|
+
const response = await PlatformAPIClient.execute(
|
|
762
|
+
this.config,
|
|
763
|
+
"post",
|
|
764
|
+
`/service/platform/finance/v1.0/company/${this.config.companyId}/creditline-opted`,
|
|
765
|
+
query_params,
|
|
766
|
+
body,
|
|
767
|
+
xHeaders
|
|
768
|
+
);
|
|
769
|
+
|
|
770
|
+
const {
|
|
771
|
+
error: res_error,
|
|
772
|
+
} = FinanceModel.IsCreditlinePlatformResponse().validate(response, {
|
|
773
|
+
abortEarly: false,
|
|
774
|
+
allowUnknown: false,
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
if (res_error) {
|
|
778
|
+
Logger({
|
|
779
|
+
level: "WARN",
|
|
780
|
+
message: "Response Validation Warnnings for isCreditlinePlatform",
|
|
781
|
+
});
|
|
782
|
+
Logger({ level: "WARN", message: res_error });
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
return response;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* @param {Object} arg - Arg object.
|
|
790
|
+
* @param {PaymentProcessRequest} arg.body
|
|
791
|
+
* @returns {Promise<PaymentProcessResponse>} - Success response
|
|
792
|
+
* @summary:
|
|
793
|
+
* @description:
|
|
794
|
+
*/
|
|
795
|
+
async paymentProcess({ body } = {}) {
|
|
796
|
+
const { error } = FinanceValidator.paymentProcess().validate(
|
|
797
|
+
{
|
|
798
|
+
body,
|
|
799
|
+
},
|
|
800
|
+
{ abortEarly: false, allowUnknown: true }
|
|
801
|
+
);
|
|
802
|
+
if (error) {
|
|
803
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
// Showing warrnings if extra unknown parameters are found
|
|
807
|
+
const { error: warrning } = FinanceValidator.paymentProcess().validate(
|
|
808
|
+
{
|
|
809
|
+
body,
|
|
810
|
+
},
|
|
811
|
+
{ abortEarly: false, allowUnknown: false }
|
|
812
|
+
);
|
|
813
|
+
if (warrning) {
|
|
814
|
+
Logger({
|
|
815
|
+
level: "WARN",
|
|
816
|
+
message: "Parameter Validation warrnings for paymentProcess",
|
|
817
|
+
});
|
|
818
|
+
Logger({ level: "WARN", message: warrning });
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
const query_params = {};
|
|
822
|
+
|
|
823
|
+
const xHeaders = {};
|
|
824
|
+
|
|
825
|
+
const response = await PlatformAPIClient.execute(
|
|
826
|
+
this.config,
|
|
827
|
+
"post",
|
|
828
|
+
`/service/platform/finance/v1.0/company/${this.config.companyId}/payment-process`,
|
|
829
|
+
query_params,
|
|
830
|
+
body,
|
|
831
|
+
xHeaders
|
|
832
|
+
);
|
|
833
|
+
|
|
834
|
+
const {
|
|
835
|
+
error: res_error,
|
|
836
|
+
} = FinanceModel.PaymentProcessResponse().validate(response, {
|
|
837
|
+
abortEarly: false,
|
|
838
|
+
allowUnknown: false,
|
|
839
|
+
});
|
|
840
|
+
|
|
841
|
+
if (res_error) {
|
|
842
|
+
Logger({
|
|
843
|
+
level: "WARN",
|
|
844
|
+
message: "Response Validation Warnnings for paymentProcess",
|
|
845
|
+
});
|
|
846
|
+
Logger({ level: "WARN", message: res_error });
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
return response;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
module.exports = Finance;
|