@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
|
@@ -3,6 +3,8 @@ const constructUrl = require("../constructUrl");
|
|
|
3
3
|
const Paginator = require("../../common/Paginator");
|
|
4
4
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
5
5
|
const OrderValidator = require("./OrderApplicationValidator");
|
|
6
|
+
const OrderModel = require("./OrderApplicationModel");
|
|
7
|
+
const { Logger } = require("./../../common/Logger");
|
|
6
8
|
|
|
7
9
|
class Order {
|
|
8
10
|
constructor(_conf) {
|
|
@@ -64,7 +66,14 @@ class Order {
|
|
|
64
66
|
* @summary: Get all orders
|
|
65
67
|
* @description: Use this API to retrieve all the orders.
|
|
66
68
|
*/
|
|
67
|
-
getOrders({
|
|
69
|
+
async getOrders({
|
|
70
|
+
status,
|
|
71
|
+
pageNo,
|
|
72
|
+
pageSize,
|
|
73
|
+
fromDate,
|
|
74
|
+
toDate,
|
|
75
|
+
customMeta,
|
|
76
|
+
} = {}) {
|
|
68
77
|
const { error } = OrderValidator.getOrders().validate(
|
|
69
78
|
{ status, pageNo, pageSize, fromDate, toDate, customMeta },
|
|
70
79
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -79,8 +88,11 @@ class Order {
|
|
|
79
88
|
{ abortEarly: false, allowUnknown: false }
|
|
80
89
|
);
|
|
81
90
|
if (warrning) {
|
|
82
|
-
|
|
83
|
-
|
|
91
|
+
Logger({
|
|
92
|
+
level: "WARN",
|
|
93
|
+
message: "Parameter Validation warrnings for getOrders",
|
|
94
|
+
});
|
|
95
|
+
Logger({ level: "WARN", message: warrning });
|
|
84
96
|
}
|
|
85
97
|
|
|
86
98
|
const query_params = {};
|
|
@@ -93,7 +105,7 @@ class Order {
|
|
|
93
105
|
|
|
94
106
|
const xHeaders = {};
|
|
95
107
|
|
|
96
|
-
|
|
108
|
+
const response = await APIClient.execute(
|
|
97
109
|
this._conf,
|
|
98
110
|
"get",
|
|
99
111
|
constructUrl({
|
|
@@ -104,6 +116,21 @@ class Order {
|
|
|
104
116
|
undefined,
|
|
105
117
|
xHeaders
|
|
106
118
|
);
|
|
119
|
+
|
|
120
|
+
const { error: res_error } = OrderModel.OrderList().validate(response, {
|
|
121
|
+
abortEarly: false,
|
|
122
|
+
allowUnknown: false,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
if (res_error) {
|
|
126
|
+
Logger({
|
|
127
|
+
level: "WARN",
|
|
128
|
+
message: "Response Validation Warnnings for getOrders",
|
|
129
|
+
});
|
|
130
|
+
Logger({ level: "WARN", message: res_error });
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return response;
|
|
107
134
|
}
|
|
108
135
|
|
|
109
136
|
/**
|
|
@@ -114,7 +141,7 @@ class Order {
|
|
|
114
141
|
* @summary: Get details of an order
|
|
115
142
|
* @description: Use this API to retrieve order details such as tracking details, shipment, store information using Fynd Order ID.
|
|
116
143
|
*/
|
|
117
|
-
getOrderById({ orderId } = {}) {
|
|
144
|
+
async getOrderById({ orderId } = {}) {
|
|
118
145
|
const { error } = OrderValidator.getOrderById().validate(
|
|
119
146
|
{ orderId },
|
|
120
147
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -129,15 +156,18 @@ class Order {
|
|
|
129
156
|
{ abortEarly: false, allowUnknown: false }
|
|
130
157
|
);
|
|
131
158
|
if (warrning) {
|
|
132
|
-
|
|
133
|
-
|
|
159
|
+
Logger({
|
|
160
|
+
level: "WARN",
|
|
161
|
+
message: "Parameter Validation warrnings for getOrderById",
|
|
162
|
+
});
|
|
163
|
+
Logger({ level: "WARN", message: warrning });
|
|
134
164
|
}
|
|
135
165
|
|
|
136
166
|
const query_params = {};
|
|
137
167
|
|
|
138
168
|
const xHeaders = {};
|
|
139
169
|
|
|
140
|
-
|
|
170
|
+
const response = await APIClient.execute(
|
|
141
171
|
this._conf,
|
|
142
172
|
"get",
|
|
143
173
|
constructUrl({
|
|
@@ -148,6 +178,21 @@ class Order {
|
|
|
148
178
|
undefined,
|
|
149
179
|
xHeaders
|
|
150
180
|
);
|
|
181
|
+
|
|
182
|
+
const { error: res_error } = OrderModel.OrderById().validate(response, {
|
|
183
|
+
abortEarly: false,
|
|
184
|
+
allowUnknown: false,
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
if (res_error) {
|
|
188
|
+
Logger({
|
|
189
|
+
level: "WARN",
|
|
190
|
+
message: "Response Validation Warnnings for getOrderById",
|
|
191
|
+
});
|
|
192
|
+
Logger({ level: "WARN", message: res_error });
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return response;
|
|
151
196
|
}
|
|
152
197
|
|
|
153
198
|
/**
|
|
@@ -158,7 +203,7 @@ class Order {
|
|
|
158
203
|
* @summary: Get POS Order
|
|
159
204
|
* @description: Use this API to retrieve a POS order and all its details such as tracking details, shipment, store information using Fynd Order ID.
|
|
160
205
|
*/
|
|
161
|
-
getPosOrderById({ orderId } = {}) {
|
|
206
|
+
async getPosOrderById({ orderId } = {}) {
|
|
162
207
|
const { error } = OrderValidator.getPosOrderById().validate(
|
|
163
208
|
{ orderId },
|
|
164
209
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -173,15 +218,18 @@ class Order {
|
|
|
173
218
|
{ abortEarly: false, allowUnknown: false }
|
|
174
219
|
);
|
|
175
220
|
if (warrning) {
|
|
176
|
-
|
|
177
|
-
|
|
221
|
+
Logger({
|
|
222
|
+
level: "WARN",
|
|
223
|
+
message: "Parameter Validation warrnings for getPosOrderById",
|
|
224
|
+
});
|
|
225
|
+
Logger({ level: "WARN", message: warrning });
|
|
178
226
|
}
|
|
179
227
|
|
|
180
228
|
const query_params = {};
|
|
181
229
|
|
|
182
230
|
const xHeaders = {};
|
|
183
231
|
|
|
184
|
-
|
|
232
|
+
const response = await APIClient.execute(
|
|
185
233
|
this._conf,
|
|
186
234
|
"get",
|
|
187
235
|
constructUrl({
|
|
@@ -192,6 +240,21 @@ class Order {
|
|
|
192
240
|
undefined,
|
|
193
241
|
xHeaders
|
|
194
242
|
);
|
|
243
|
+
|
|
244
|
+
const { error: res_error } = OrderModel.OrderList().validate(response, {
|
|
245
|
+
abortEarly: false,
|
|
246
|
+
allowUnknown: false,
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
if (res_error) {
|
|
250
|
+
Logger({
|
|
251
|
+
level: "WARN",
|
|
252
|
+
message: "Response Validation Warnnings for getPosOrderById",
|
|
253
|
+
});
|
|
254
|
+
Logger({ level: "WARN", message: res_error });
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return response;
|
|
195
258
|
}
|
|
196
259
|
|
|
197
260
|
/**
|
|
@@ -203,7 +266,7 @@ class Order {
|
|
|
203
266
|
* @summary: Get details of a shipment
|
|
204
267
|
* @description: Use this API to retrieve shipment details such as price breakup, tracking details, store information, etc. using Shipment ID.
|
|
205
268
|
*/
|
|
206
|
-
getShipmentById({ shipmentId } = {}) {
|
|
269
|
+
async getShipmentById({ shipmentId } = {}) {
|
|
207
270
|
const { error } = OrderValidator.getShipmentById().validate(
|
|
208
271
|
{ shipmentId },
|
|
209
272
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -218,15 +281,18 @@ class Order {
|
|
|
218
281
|
{ abortEarly: false, allowUnknown: false }
|
|
219
282
|
);
|
|
220
283
|
if (warrning) {
|
|
221
|
-
|
|
222
|
-
|
|
284
|
+
Logger({
|
|
285
|
+
level: "WARN",
|
|
286
|
+
message: "Parameter Validation warrnings for getShipmentById",
|
|
287
|
+
});
|
|
288
|
+
Logger({ level: "WARN", message: warrning });
|
|
223
289
|
}
|
|
224
290
|
|
|
225
291
|
const query_params = {};
|
|
226
292
|
|
|
227
293
|
const xHeaders = {};
|
|
228
294
|
|
|
229
|
-
|
|
295
|
+
const response = await APIClient.execute(
|
|
230
296
|
this._conf,
|
|
231
297
|
"get",
|
|
232
298
|
constructUrl({
|
|
@@ -237,6 +303,21 @@ class Order {
|
|
|
237
303
|
undefined,
|
|
238
304
|
xHeaders
|
|
239
305
|
);
|
|
306
|
+
|
|
307
|
+
const { error: res_error } = OrderModel.ShipmentById().validate(response, {
|
|
308
|
+
abortEarly: false,
|
|
309
|
+
allowUnknown: false,
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
if (res_error) {
|
|
313
|
+
Logger({
|
|
314
|
+
level: "WARN",
|
|
315
|
+
message: "Response Validation Warnnings for getShipmentById",
|
|
316
|
+
});
|
|
317
|
+
Logger({ level: "WARN", message: res_error });
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return response;
|
|
240
321
|
}
|
|
241
322
|
|
|
242
323
|
/**
|
|
@@ -246,7 +327,7 @@ class Order {
|
|
|
246
327
|
* @summary: Get Invoice of a shipment
|
|
247
328
|
* @description: Use this API to retrieve shipment invoice.
|
|
248
329
|
*/
|
|
249
|
-
getInvoiceByShipmentId({ shipmentId } = {}) {
|
|
330
|
+
async getInvoiceByShipmentId({ shipmentId } = {}) {
|
|
250
331
|
const { error } = OrderValidator.getInvoiceByShipmentId().validate(
|
|
251
332
|
{ shipmentId },
|
|
252
333
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -263,15 +344,18 @@ class Order {
|
|
|
263
344
|
{ abortEarly: false, allowUnknown: false }
|
|
264
345
|
);
|
|
265
346
|
if (warrning) {
|
|
266
|
-
|
|
267
|
-
|
|
347
|
+
Logger({
|
|
348
|
+
level: "WARN",
|
|
349
|
+
message: "Parameter Validation warrnings for getInvoiceByShipmentId",
|
|
350
|
+
});
|
|
351
|
+
Logger({ level: "WARN", message: warrning });
|
|
268
352
|
}
|
|
269
353
|
|
|
270
354
|
const query_params = {};
|
|
271
355
|
|
|
272
356
|
const xHeaders = {};
|
|
273
357
|
|
|
274
|
-
|
|
358
|
+
const response = await APIClient.execute(
|
|
275
359
|
this._conf,
|
|
276
360
|
"get",
|
|
277
361
|
constructUrl({
|
|
@@ -282,6 +366,23 @@ class Order {
|
|
|
282
366
|
undefined,
|
|
283
367
|
xHeaders
|
|
284
368
|
);
|
|
369
|
+
|
|
370
|
+
const {
|
|
371
|
+
error: res_error,
|
|
372
|
+
} = OrderModel.ResponseGetInvoiceShipment().validate(response, {
|
|
373
|
+
abortEarly: false,
|
|
374
|
+
allowUnknown: false,
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
if (res_error) {
|
|
378
|
+
Logger({
|
|
379
|
+
level: "WARN",
|
|
380
|
+
message: "Response Validation Warnnings for getInvoiceByShipmentId",
|
|
381
|
+
});
|
|
382
|
+
Logger({ level: "WARN", message: res_error });
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
return response;
|
|
285
386
|
}
|
|
286
387
|
|
|
287
388
|
/**
|
|
@@ -293,7 +394,7 @@ class Order {
|
|
|
293
394
|
* @summary: Track shipment
|
|
294
395
|
* @description: Track Shipment by shipment id, for application based on application Id
|
|
295
396
|
*/
|
|
296
|
-
trackShipment({ shipmentId } = {}) {
|
|
397
|
+
async trackShipment({ shipmentId } = {}) {
|
|
297
398
|
const { error } = OrderValidator.trackShipment().validate(
|
|
298
399
|
{ shipmentId },
|
|
299
400
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -308,15 +409,18 @@ class Order {
|
|
|
308
409
|
{ abortEarly: false, allowUnknown: false }
|
|
309
410
|
);
|
|
310
411
|
if (warrning) {
|
|
311
|
-
|
|
312
|
-
|
|
412
|
+
Logger({
|
|
413
|
+
level: "WARN",
|
|
414
|
+
message: "Parameter Validation warrnings for trackShipment",
|
|
415
|
+
});
|
|
416
|
+
Logger({ level: "WARN", message: warrning });
|
|
313
417
|
}
|
|
314
418
|
|
|
315
419
|
const query_params = {};
|
|
316
420
|
|
|
317
421
|
const xHeaders = {};
|
|
318
422
|
|
|
319
|
-
|
|
423
|
+
const response = await APIClient.execute(
|
|
320
424
|
this._conf,
|
|
321
425
|
"get",
|
|
322
426
|
constructUrl({
|
|
@@ -327,6 +431,21 @@ class Order {
|
|
|
327
431
|
undefined,
|
|
328
432
|
xHeaders
|
|
329
433
|
);
|
|
434
|
+
|
|
435
|
+
const { error: res_error } = OrderModel.ShipmentTrack().validate(response, {
|
|
436
|
+
abortEarly: false,
|
|
437
|
+
allowUnknown: false,
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
if (res_error) {
|
|
441
|
+
Logger({
|
|
442
|
+
level: "WARN",
|
|
443
|
+
message: "Response Validation Warnnings for trackShipment",
|
|
444
|
+
});
|
|
445
|
+
Logger({ level: "WARN", message: res_error });
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
return response;
|
|
330
449
|
}
|
|
331
450
|
|
|
332
451
|
/**
|
|
@@ -340,7 +459,7 @@ class Order {
|
|
|
340
459
|
* @summary: Get Customer Details by Shipment Id
|
|
341
460
|
* @description: Use this API to retrieve customer details such as mobileno using Shipment ID.
|
|
342
461
|
*/
|
|
343
|
-
getCustomerDetailsByShipmentId({ orderId, shipmentId } = {}) {
|
|
462
|
+
async getCustomerDetailsByShipmentId({ orderId, shipmentId } = {}) {
|
|
344
463
|
const { error } = OrderValidator.getCustomerDetailsByShipmentId().validate(
|
|
345
464
|
{ orderId, shipmentId },
|
|
346
465
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -357,17 +476,19 @@ class Order {
|
|
|
357
476
|
{ abortEarly: false, allowUnknown: false }
|
|
358
477
|
);
|
|
359
478
|
if (warrning) {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
479
|
+
Logger({
|
|
480
|
+
level: "WARN",
|
|
481
|
+
message:
|
|
482
|
+
"Parameter Validation warrnings for getCustomerDetailsByShipmentId",
|
|
483
|
+
});
|
|
484
|
+
Logger({ level: "WARN", message: warrning });
|
|
364
485
|
}
|
|
365
486
|
|
|
366
487
|
const query_params = {};
|
|
367
488
|
|
|
368
489
|
const xHeaders = {};
|
|
369
490
|
|
|
370
|
-
|
|
491
|
+
const response = await APIClient.execute(
|
|
371
492
|
this._conf,
|
|
372
493
|
"get",
|
|
373
494
|
constructUrl({
|
|
@@ -378,6 +499,24 @@ class Order {
|
|
|
378
499
|
undefined,
|
|
379
500
|
xHeaders
|
|
380
501
|
);
|
|
502
|
+
|
|
503
|
+
const {
|
|
504
|
+
error: res_error,
|
|
505
|
+
} = OrderModel.CustomerDetailsResponse().validate(response, {
|
|
506
|
+
abortEarly: false,
|
|
507
|
+
allowUnknown: false,
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
if (res_error) {
|
|
511
|
+
Logger({
|
|
512
|
+
level: "WARN",
|
|
513
|
+
message:
|
|
514
|
+
"Response Validation Warnnings for getCustomerDetailsByShipmentId",
|
|
515
|
+
});
|
|
516
|
+
Logger({ level: "WARN", message: res_error });
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
return response;
|
|
381
520
|
}
|
|
382
521
|
|
|
383
522
|
/**
|
|
@@ -391,7 +530,7 @@ class Order {
|
|
|
391
530
|
* @summary: Send and Resend Otp code to Order-Shipment customer
|
|
392
531
|
* @description: Use this API to send OTP to the customer of the mapped Shipment.
|
|
393
532
|
*/
|
|
394
|
-
sendOtpToShipmentCustomer({ orderId, shipmentId } = {}) {
|
|
533
|
+
async sendOtpToShipmentCustomer({ orderId, shipmentId } = {}) {
|
|
395
534
|
const { error } = OrderValidator.sendOtpToShipmentCustomer().validate(
|
|
396
535
|
{ orderId, shipmentId },
|
|
397
536
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -408,17 +547,18 @@ class Order {
|
|
|
408
547
|
{ abortEarly: false, allowUnknown: false }
|
|
409
548
|
);
|
|
410
549
|
if (warrning) {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
550
|
+
Logger({
|
|
551
|
+
level: "WARN",
|
|
552
|
+
message: "Parameter Validation warrnings for sendOtpToShipmentCustomer",
|
|
553
|
+
});
|
|
554
|
+
Logger({ level: "WARN", message: warrning });
|
|
415
555
|
}
|
|
416
556
|
|
|
417
557
|
const query_params = {};
|
|
418
558
|
|
|
419
559
|
const xHeaders = {};
|
|
420
560
|
|
|
421
|
-
|
|
561
|
+
const response = await APIClient.execute(
|
|
422
562
|
this._conf,
|
|
423
563
|
"post",
|
|
424
564
|
constructUrl({
|
|
@@ -429,6 +569,23 @@ class Order {
|
|
|
429
569
|
undefined,
|
|
430
570
|
xHeaders
|
|
431
571
|
);
|
|
572
|
+
|
|
573
|
+
const {
|
|
574
|
+
error: res_error,
|
|
575
|
+
} = OrderModel.SendOtpToCustomerResponse().validate(response, {
|
|
576
|
+
abortEarly: false,
|
|
577
|
+
allowUnknown: false,
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
if (res_error) {
|
|
581
|
+
Logger({
|
|
582
|
+
level: "WARN",
|
|
583
|
+
message: "Response Validation Warnnings for sendOtpToShipmentCustomer",
|
|
584
|
+
});
|
|
585
|
+
Logger({ level: "WARN", message: res_error });
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
return response;
|
|
432
589
|
}
|
|
433
590
|
|
|
434
591
|
/**
|
|
@@ -443,7 +600,7 @@ class Order {
|
|
|
443
600
|
* @summary: Verify Otp code
|
|
444
601
|
* @description: Use this API to verify OTP and create a session token with custom payload.
|
|
445
602
|
*/
|
|
446
|
-
verifyOtpShipmentCustomer({ orderId, shipmentId, body } = {}) {
|
|
603
|
+
async verifyOtpShipmentCustomer({ orderId, shipmentId, body } = {}) {
|
|
447
604
|
const { error } = OrderValidator.verifyOtpShipmentCustomer().validate(
|
|
448
605
|
{ orderId, shipmentId, body },
|
|
449
606
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -460,17 +617,18 @@ class Order {
|
|
|
460
617
|
{ abortEarly: false, allowUnknown: false }
|
|
461
618
|
);
|
|
462
619
|
if (warrning) {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
620
|
+
Logger({
|
|
621
|
+
level: "WARN",
|
|
622
|
+
message: "Parameter Validation warrnings for verifyOtpShipmentCustomer",
|
|
623
|
+
});
|
|
624
|
+
Logger({ level: "WARN", message: warrning });
|
|
467
625
|
}
|
|
468
626
|
|
|
469
627
|
const query_params = {};
|
|
470
628
|
|
|
471
629
|
const xHeaders = {};
|
|
472
630
|
|
|
473
|
-
|
|
631
|
+
const response = await APIClient.execute(
|
|
474
632
|
this._conf,
|
|
475
633
|
"post",
|
|
476
634
|
constructUrl({
|
|
@@ -481,6 +639,23 @@ class Order {
|
|
|
481
639
|
body,
|
|
482
640
|
xHeaders
|
|
483
641
|
);
|
|
642
|
+
|
|
643
|
+
const {
|
|
644
|
+
error: res_error,
|
|
645
|
+
} = OrderModel.VerifyOtpResponse().validate(response, {
|
|
646
|
+
abortEarly: false,
|
|
647
|
+
allowUnknown: false,
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
if (res_error) {
|
|
651
|
+
Logger({
|
|
652
|
+
level: "WARN",
|
|
653
|
+
message: "Response Validation Warnnings for verifyOtpShipmentCustomer",
|
|
654
|
+
});
|
|
655
|
+
Logger({ level: "WARN", message: res_error });
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
return response;
|
|
484
659
|
}
|
|
485
660
|
|
|
486
661
|
/**
|
|
@@ -494,7 +669,7 @@ class Order {
|
|
|
494
669
|
* @summary: Get reasons behind full or partial cancellation of a shipment
|
|
495
670
|
* @description: Use this API to retrieve the issues that led to the cancellation of bags within a shipment.
|
|
496
671
|
*/
|
|
497
|
-
getShipmentBagReasons({ shipmentId, bagId } = {}) {
|
|
672
|
+
async getShipmentBagReasons({ shipmentId, bagId } = {}) {
|
|
498
673
|
const { error } = OrderValidator.getShipmentBagReasons().validate(
|
|
499
674
|
{ shipmentId, bagId },
|
|
500
675
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -509,15 +684,18 @@ class Order {
|
|
|
509
684
|
{ abortEarly: false, allowUnknown: false }
|
|
510
685
|
);
|
|
511
686
|
if (warrning) {
|
|
512
|
-
|
|
513
|
-
|
|
687
|
+
Logger({
|
|
688
|
+
level: "WARN",
|
|
689
|
+
message: "Parameter Validation warrnings for getShipmentBagReasons",
|
|
690
|
+
});
|
|
691
|
+
Logger({ level: "WARN", message: warrning });
|
|
514
692
|
}
|
|
515
693
|
|
|
516
694
|
const query_params = {};
|
|
517
695
|
|
|
518
696
|
const xHeaders = {};
|
|
519
697
|
|
|
520
|
-
|
|
698
|
+
const response = await APIClient.execute(
|
|
521
699
|
this._conf,
|
|
522
700
|
"get",
|
|
523
701
|
constructUrl({
|
|
@@ -528,6 +706,23 @@ class Order {
|
|
|
528
706
|
undefined,
|
|
529
707
|
xHeaders
|
|
530
708
|
);
|
|
709
|
+
|
|
710
|
+
const {
|
|
711
|
+
error: res_error,
|
|
712
|
+
} = OrderModel.ShipmentBagReasons().validate(response, {
|
|
713
|
+
abortEarly: false,
|
|
714
|
+
allowUnknown: false,
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
if (res_error) {
|
|
718
|
+
Logger({
|
|
719
|
+
level: "WARN",
|
|
720
|
+
message: "Response Validation Warnnings for getShipmentBagReasons",
|
|
721
|
+
});
|
|
722
|
+
Logger({ level: "WARN", message: res_error });
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
return response;
|
|
531
726
|
}
|
|
532
727
|
|
|
533
728
|
/**
|
|
@@ -539,7 +734,7 @@ class Order {
|
|
|
539
734
|
* @summary: Get reasons behind full or partial cancellation of a shipment
|
|
540
735
|
* @description: Use this API to retrieve the issues that led to the cancellation of bags within a shipment.
|
|
541
736
|
*/
|
|
542
|
-
getShipmentReasons({ shipmentId } = {}) {
|
|
737
|
+
async getShipmentReasons({ shipmentId } = {}) {
|
|
543
738
|
const { error } = OrderValidator.getShipmentReasons().validate(
|
|
544
739
|
{ shipmentId },
|
|
545
740
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -554,15 +749,18 @@ class Order {
|
|
|
554
749
|
{ abortEarly: false, allowUnknown: false }
|
|
555
750
|
);
|
|
556
751
|
if (warrning) {
|
|
557
|
-
|
|
558
|
-
|
|
752
|
+
Logger({
|
|
753
|
+
level: "WARN",
|
|
754
|
+
message: "Parameter Validation warrnings for getShipmentReasons",
|
|
755
|
+
});
|
|
756
|
+
Logger({ level: "WARN", message: warrning });
|
|
559
757
|
}
|
|
560
758
|
|
|
561
759
|
const query_params = {};
|
|
562
760
|
|
|
563
761
|
const xHeaders = {};
|
|
564
762
|
|
|
565
|
-
|
|
763
|
+
const response = await APIClient.execute(
|
|
566
764
|
this._conf,
|
|
567
765
|
"get",
|
|
568
766
|
constructUrl({
|
|
@@ -573,6 +771,21 @@ class Order {
|
|
|
573
771
|
undefined,
|
|
574
772
|
xHeaders
|
|
575
773
|
);
|
|
774
|
+
|
|
775
|
+
const { error: res_error } = OrderModel.ShipmentReasons().validate(
|
|
776
|
+
response,
|
|
777
|
+
{ abortEarly: false, allowUnknown: false }
|
|
778
|
+
);
|
|
779
|
+
|
|
780
|
+
if (res_error) {
|
|
781
|
+
Logger({
|
|
782
|
+
level: "WARN",
|
|
783
|
+
message: "Response Validation Warnnings for getShipmentReasons",
|
|
784
|
+
});
|
|
785
|
+
Logger({ level: "WARN", message: res_error });
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
return response;
|
|
576
789
|
}
|
|
577
790
|
|
|
578
791
|
/**
|
|
@@ -585,7 +798,7 @@ class Order {
|
|
|
585
798
|
* @summary: Update the shipment status
|
|
586
799
|
* @description: Use this API to update the status of a shipment using its shipment ID.
|
|
587
800
|
*/
|
|
588
|
-
updateShipmentStatus({ shipmentId, body } = {}) {
|
|
801
|
+
async updateShipmentStatus({ shipmentId, body } = {}) {
|
|
589
802
|
const { error } = OrderValidator.updateShipmentStatus().validate(
|
|
590
803
|
{ shipmentId, body },
|
|
591
804
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -600,15 +813,18 @@ class Order {
|
|
|
600
813
|
{ abortEarly: false, allowUnknown: false }
|
|
601
814
|
);
|
|
602
815
|
if (warrning) {
|
|
603
|
-
|
|
604
|
-
|
|
816
|
+
Logger({
|
|
817
|
+
level: "WARN",
|
|
818
|
+
message: "Parameter Validation warrnings for updateShipmentStatus",
|
|
819
|
+
});
|
|
820
|
+
Logger({ level: "WARN", message: warrning });
|
|
605
821
|
}
|
|
606
822
|
|
|
607
823
|
const query_params = {};
|
|
608
824
|
|
|
609
825
|
const xHeaders = {};
|
|
610
826
|
|
|
611
|
-
|
|
827
|
+
const response = await APIClient.execute(
|
|
612
828
|
this._conf,
|
|
613
829
|
"put",
|
|
614
830
|
constructUrl({
|
|
@@ -619,6 +835,23 @@ class Order {
|
|
|
619
835
|
body,
|
|
620
836
|
xHeaders
|
|
621
837
|
);
|
|
838
|
+
|
|
839
|
+
const {
|
|
840
|
+
error: res_error,
|
|
841
|
+
} = OrderModel.ShipmentApplicationStatusResponse().validate(response, {
|
|
842
|
+
abortEarly: false,
|
|
843
|
+
allowUnknown: false,
|
|
844
|
+
});
|
|
845
|
+
|
|
846
|
+
if (res_error) {
|
|
847
|
+
Logger({
|
|
848
|
+
level: "WARN",
|
|
849
|
+
message: "Response Validation Warnnings for updateShipmentStatus",
|
|
850
|
+
});
|
|
851
|
+
Logger({ level: "WARN", message: res_error });
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
return response;
|
|
622
855
|
}
|
|
623
856
|
}
|
|
624
857
|
|