@gofynd/fdk-client-javascript 1.3.6-beta.1 → 1.3.6
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 -1
- package/package.json +2 -2
- package/sdk/application/ApplicationConfig.d.ts +11 -3
- package/sdk/application/ApplicationConfig.js +21 -3
- package/sdk/application/Cart/CartApplicationClient.js +228 -113
- package/sdk/application/Catalog/CatalogApplicationClient.js +244 -121
- package/sdk/application/Common/CommonApplicationClient.js +20 -9
- package/sdk/application/Communication/CommunicationApplicationClient.js +28 -13
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +132 -65
- package/sdk/application/Content/ContentApplicationClient.js +156 -77
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +28 -13
- package/sdk/application/Lead/LeadApplicationClient.js +60 -29
- package/sdk/application/Logistic/LogisticApplicationClient.js +44 -21
- package/sdk/application/Order/OrderApplicationClient.js +100 -49
- package/sdk/application/Payment/PaymentApplicationClient.js +340 -169
- package/sdk/application/PosCart/PosCartApplicationClient.js +220 -109
- package/sdk/application/Rewards/RewardsApplicationClient.js +60 -29
- package/sdk/application/Share/ShareApplicationClient.js +60 -29
- package/sdk/application/Theme/ThemeApplicationClient.js +36 -17
- package/sdk/application/User/UserApplicationClient.js +324 -161
- package/sdk/common/AxiosHelper.js +3 -3
- package/sdk/common/FDKError.d.ts +4 -0
- package/sdk/common/FDKError.js +9 -0
- package/sdk/partner/FileStorage/FileStoragePartnerClient.d.ts +16 -40
- package/sdk/partner/FileStorage/FileStoragePartnerClient.js +160 -38
- package/sdk/partner/PartnerConfig.d.ts +10 -0
- package/sdk/partner/PartnerConfig.js +10 -1
- package/sdk/partner/Theme/ThemePartnerClient.d.ts +96 -199
- package/sdk/partner/Theme/ThemePartnerClient.js +935 -170
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +36 -17
- package/sdk/platform/Billing/BillingPlatformClient.js +140 -69
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +456 -228
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +512 -256
- package/sdk/platform/Catalog/CatalogPlatformClient.js +620 -309
- package/sdk/platform/Common/CommonPlatformClient.js +20 -9
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +472 -236
- package/sdk/platform/Communication/CommunicationPlatformClient.js +12 -5
- package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +14 -1
- package/sdk/platform/Communication/CommunicationPlatformModel.js +16 -0
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +116 -57
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +256 -128
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +148 -73
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +552 -276
- package/sdk/platform/Discount/DiscountPlatformClient.js +92 -45
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +88 -44
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +52 -25
- package/sdk/platform/Finance/FinancePlatformClient.js +196 -97
- package/sdk/platform/Inventory/InventoryPlatformClient.js +100 -49
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +104 -52
- package/sdk/platform/Lead/LeadPlatformClient.js +92 -45
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +26 -0
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +239 -5
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +57 -1
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +55 -0
- package/sdk/platform/Order/OrderPlatformClient.js +356 -177
- package/sdk/platform/Order/OrderPlatformModel.d.ts +44 -5
- package/sdk/platform/Order/OrderPlatformModel.js +52 -4
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +16 -8
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +336 -168
- package/sdk/platform/Payment/PaymentPlatformClient.js +84 -41
- package/sdk/platform/PlatformConfig.d.ts +10 -0
- package/sdk/platform/PlatformConfig.js +10 -1
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +96 -48
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +112 -56
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +148 -73
- package/sdk/platform/Share/SharePlatformApplicationClient.js +40 -20
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +224 -112
- package/sdk/platform/Theme/ThemePlatformClient.js +28 -13
- package/sdk/platform/User/UserPlatformApplicationClient.js +144 -72
- package/sdk/platform/Webhook/WebhookPlatformClient.js +132 -65
- package/sdk/public/Configuration/ConfigurationPublicClient.js +20 -9
- package/sdk/public/Inventory/InventoryPublicClient.js +52 -25
- package/sdk/public/Partner/PartnerPublicClient.js +12 -5
- package/sdk/public/PublicConfig.d.ts +11 -1
- package/sdk/public/PublicConfig.js +10 -1
- package/sdk/public/Webhook/WebhookPublicClient.js +20 -9
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
2
|
-
const {
|
|
2
|
+
const {
|
|
3
|
+
FDKClientValidationError,
|
|
4
|
+
FDKResponseValidationError,
|
|
5
|
+
} = require("../../common/FDKError");
|
|
3
6
|
const Paginator = require("../../common/Paginator");
|
|
4
7
|
const LeadPlatformValidator = require("./LeadPlatformValidator");
|
|
5
8
|
const LeadPlatformModel = require("./LeadPlatformModel");
|
|
@@ -81,10 +84,14 @@ class Lead {
|
|
|
81
84
|
});
|
|
82
85
|
|
|
83
86
|
if (res_error) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
88
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
89
|
+
} else {
|
|
90
|
+
Logger({
|
|
91
|
+
level: "WARN",
|
|
92
|
+
message: `Response Validation Warnings for platform > Lead > createPlatformTicketHistory \n ${res_error}`,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
88
95
|
}
|
|
89
96
|
|
|
90
97
|
return response;
|
|
@@ -154,10 +161,14 @@ class Lead {
|
|
|
154
161
|
});
|
|
155
162
|
|
|
156
163
|
if (res_error) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
164
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
165
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
166
|
+
} else {
|
|
167
|
+
Logger({
|
|
168
|
+
level: "WARN",
|
|
169
|
+
message: `Response Validation Warnings for platform > Lead > createTicket \n ${res_error}`,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
161
172
|
}
|
|
162
173
|
|
|
163
174
|
return response;
|
|
@@ -231,10 +242,14 @@ class Lead {
|
|
|
231
242
|
});
|
|
232
243
|
|
|
233
244
|
if (res_error) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
245
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
246
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
247
|
+
} else {
|
|
248
|
+
Logger({
|
|
249
|
+
level: "WARN",
|
|
250
|
+
message: `Response Validation Warnings for platform > Lead > editPlatformTicket \n ${res_error}`,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
238
253
|
}
|
|
239
254
|
|
|
240
255
|
return response;
|
|
@@ -304,10 +319,14 @@ class Lead {
|
|
|
304
319
|
});
|
|
305
320
|
|
|
306
321
|
if (res_error) {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
322
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
323
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
324
|
+
} else {
|
|
325
|
+
Logger({
|
|
326
|
+
level: "WARN",
|
|
327
|
+
message: `Response Validation Warnings for platform > Lead > getFeedbacks \n ${res_error}`,
|
|
328
|
+
});
|
|
329
|
+
}
|
|
311
330
|
}
|
|
312
331
|
|
|
313
332
|
return response;
|
|
@@ -375,10 +394,14 @@ class Lead {
|
|
|
375
394
|
});
|
|
376
395
|
|
|
377
396
|
if (res_error) {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
397
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
398
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
399
|
+
} else {
|
|
400
|
+
Logger({
|
|
401
|
+
level: "WARN",
|
|
402
|
+
message: `Response Validation Warnings for platform > Lead > getGeneralConfig \n ${res_error}`,
|
|
403
|
+
});
|
|
404
|
+
}
|
|
382
405
|
}
|
|
383
406
|
|
|
384
407
|
return response;
|
|
@@ -450,10 +473,14 @@ class Lead {
|
|
|
450
473
|
});
|
|
451
474
|
|
|
452
475
|
if (res_error) {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
476
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
477
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
478
|
+
} else {
|
|
479
|
+
Logger({
|
|
480
|
+
level: "WARN",
|
|
481
|
+
message: `Response Validation Warnings for platform > Lead > getPlatformTicket \n ${res_error}`,
|
|
482
|
+
});
|
|
483
|
+
}
|
|
457
484
|
}
|
|
458
485
|
|
|
459
486
|
return response;
|
|
@@ -525,10 +552,14 @@ class Lead {
|
|
|
525
552
|
});
|
|
526
553
|
|
|
527
554
|
if (res_error) {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
555
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
556
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
557
|
+
} else {
|
|
558
|
+
Logger({
|
|
559
|
+
level: "WARN",
|
|
560
|
+
message: `Response Validation Warnings for platform > Lead > getPlatformTicketHistory \n ${res_error}`,
|
|
561
|
+
});
|
|
562
|
+
}
|
|
532
563
|
}
|
|
533
564
|
|
|
534
565
|
return response;
|
|
@@ -632,10 +663,14 @@ class Lead {
|
|
|
632
663
|
});
|
|
633
664
|
|
|
634
665
|
if (res_error) {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
666
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
667
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
668
|
+
} else {
|
|
669
|
+
Logger({
|
|
670
|
+
level: "WARN",
|
|
671
|
+
message: `Response Validation Warnings for platform > Lead > getPlatformTickets \n ${res_error}`,
|
|
672
|
+
});
|
|
673
|
+
}
|
|
639
674
|
}
|
|
640
675
|
|
|
641
676
|
return response;
|
|
@@ -761,10 +796,14 @@ class Lead {
|
|
|
761
796
|
);
|
|
762
797
|
|
|
763
798
|
if (res_error) {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
799
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
800
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
801
|
+
} else {
|
|
802
|
+
Logger({
|
|
803
|
+
level: "WARN",
|
|
804
|
+
message: `Response Validation Warnings for platform > Lead > getPlatformVideoParticipants \n ${res_error}`,
|
|
805
|
+
});
|
|
806
|
+
}
|
|
768
807
|
}
|
|
769
808
|
|
|
770
809
|
return response;
|
|
@@ -839,10 +878,14 @@ class Lead {
|
|
|
839
878
|
);
|
|
840
879
|
|
|
841
880
|
if (res_error) {
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
881
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
882
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
883
|
+
} else {
|
|
884
|
+
Logger({
|
|
885
|
+
level: "WARN",
|
|
886
|
+
message: `Response Validation Warnings for platform > Lead > getTokenForPlatformVideoRoom \n ${res_error}`,
|
|
887
|
+
});
|
|
888
|
+
}
|
|
846
889
|
}
|
|
847
890
|
|
|
848
891
|
return response;
|
|
@@ -914,10 +957,14 @@ class Lead {
|
|
|
914
957
|
});
|
|
915
958
|
|
|
916
959
|
if (res_error) {
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
960
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
961
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
962
|
+
} else {
|
|
963
|
+
Logger({
|
|
964
|
+
level: "WARN",
|
|
965
|
+
message: `Response Validation Warnings for platform > Lead > submitFeedback \n ${res_error}`,
|
|
966
|
+
});
|
|
967
|
+
}
|
|
921
968
|
}
|
|
922
969
|
|
|
923
970
|
return response;
|
|
@@ -3,6 +3,20 @@ declare class Order {
|
|
|
3
3
|
constructor(config: any, applicationId: any);
|
|
4
4
|
config: any;
|
|
5
5
|
applicationId: any;
|
|
6
|
+
/**
|
|
7
|
+
* @param {OrderPlatformApplicationValidator.GetApplicationShipmentsParam} arg
|
|
8
|
+
* - Arg object
|
|
9
|
+
*
|
|
10
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
11
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
12
|
+
* @returns {Promise<OrderPlatformModel.ShipmentInternalPlatformViewResponse>}
|
|
13
|
+
* - Success response
|
|
14
|
+
*
|
|
15
|
+
* @name getApplicationShipments
|
|
16
|
+
* @summary:
|
|
17
|
+
* @description: - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/order/getApplicationShipments/).
|
|
18
|
+
*/
|
|
19
|
+
getApplicationShipments({ lane, searchType, searchId, fromDate, toDate, dpIds, orderingCompanyId, stores, salesChannel, requestByExt, pageNo, pageSize, customerId, isPrioritySort, excludeLockedShipments, requestHeaders, }?: OrderPlatformApplicationValidator.GetApplicationShipmentsParam, { responseHeaders }?: object): Promise<OrderPlatformModel.ShipmentInternalPlatformViewResponse>;
|
|
6
20
|
/**
|
|
7
21
|
* @param {OrderPlatformApplicationValidator.GetPlatformShipmentReasonsParam} arg
|
|
8
22
|
* - Arg object
|
|
@@ -15,6 +29,18 @@ declare class Order {
|
|
|
15
29
|
* @description: Using action, get reasons behind full or partial cancellation of a shipment - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/order/getPlatformShipmentReasons/).
|
|
16
30
|
*/
|
|
17
31
|
getPlatformShipmentReasons({ action, requestHeaders }?: OrderPlatformApplicationValidator.GetPlatformShipmentReasonsParam, { responseHeaders }?: object): Promise<OrderPlatformModel.ShipmentReasonsResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* @param {OrderPlatformApplicationValidator.GetShipmentBagReasonsParam} arg
|
|
34
|
+
* - Arg object
|
|
35
|
+
*
|
|
36
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
37
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
38
|
+
* @returns {Promise<OrderPlatformModel.ShipmentBagReasons>} - Success response
|
|
39
|
+
* @name getShipmentBagReasons
|
|
40
|
+
* @summary: Get reasons behind full or partial cancellation of a shipment
|
|
41
|
+
* @description: Use this API to retrieve the issues that led to the cancellation of bags within a shipment. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/order/getShipmentBagReasons/).
|
|
42
|
+
*/
|
|
43
|
+
getShipmentBagReasons({ shipmentId, lineNumber, requestHeaders }?: OrderPlatformApplicationValidator.GetShipmentBagReasonsParam, { responseHeaders }?: object): Promise<OrderPlatformModel.ShipmentBagReasons>;
|
|
18
44
|
/**
|
|
19
45
|
* @param {OrderPlatformApplicationValidator.TrackShipmentPlatformParam} arg
|
|
20
46
|
* - Arg object
|
|
@@ -12,6 +12,149 @@ class Order {
|
|
|
12
12
|
this.applicationId = applicationId;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* @param {OrderPlatformApplicationValidator.GetApplicationShipmentsParam} arg
|
|
17
|
+
* - Arg object
|
|
18
|
+
*
|
|
19
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
20
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
21
|
+
* @returns {Promise<OrderPlatformModel.ShipmentInternalPlatformViewResponse>}
|
|
22
|
+
* - Success response
|
|
23
|
+
*
|
|
24
|
+
* @name getApplicationShipments
|
|
25
|
+
* @summary:
|
|
26
|
+
* @description: - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/order/getApplicationShipments/).
|
|
27
|
+
*/
|
|
28
|
+
async getApplicationShipments(
|
|
29
|
+
{
|
|
30
|
+
lane,
|
|
31
|
+
searchType,
|
|
32
|
+
searchId,
|
|
33
|
+
fromDate,
|
|
34
|
+
toDate,
|
|
35
|
+
dpIds,
|
|
36
|
+
orderingCompanyId,
|
|
37
|
+
stores,
|
|
38
|
+
salesChannel,
|
|
39
|
+
requestByExt,
|
|
40
|
+
pageNo,
|
|
41
|
+
pageSize,
|
|
42
|
+
customerId,
|
|
43
|
+
isPrioritySort,
|
|
44
|
+
excludeLockedShipments,
|
|
45
|
+
requestHeaders,
|
|
46
|
+
} = { requestHeaders: {} },
|
|
47
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
48
|
+
) {
|
|
49
|
+
const {
|
|
50
|
+
error,
|
|
51
|
+
} = OrderPlatformApplicationValidator.getApplicationShipments().validate(
|
|
52
|
+
{
|
|
53
|
+
lane,
|
|
54
|
+
searchType,
|
|
55
|
+
searchId,
|
|
56
|
+
fromDate,
|
|
57
|
+
toDate,
|
|
58
|
+
dpIds,
|
|
59
|
+
orderingCompanyId,
|
|
60
|
+
stores,
|
|
61
|
+
salesChannel,
|
|
62
|
+
requestByExt,
|
|
63
|
+
pageNo,
|
|
64
|
+
pageSize,
|
|
65
|
+
customerId,
|
|
66
|
+
isPrioritySort,
|
|
67
|
+
excludeLockedShipments,
|
|
68
|
+
},
|
|
69
|
+
{ abortEarly: false, allowUnknown: true }
|
|
70
|
+
);
|
|
71
|
+
if (error) {
|
|
72
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Showing warrnings if extra unknown parameters are found
|
|
76
|
+
const {
|
|
77
|
+
error: warrning,
|
|
78
|
+
} = OrderPlatformApplicationValidator.getApplicationShipments().validate(
|
|
79
|
+
{
|
|
80
|
+
lane,
|
|
81
|
+
searchType,
|
|
82
|
+
searchId,
|
|
83
|
+
fromDate,
|
|
84
|
+
toDate,
|
|
85
|
+
dpIds,
|
|
86
|
+
orderingCompanyId,
|
|
87
|
+
stores,
|
|
88
|
+
salesChannel,
|
|
89
|
+
requestByExt,
|
|
90
|
+
pageNo,
|
|
91
|
+
pageSize,
|
|
92
|
+
customerId,
|
|
93
|
+
isPrioritySort,
|
|
94
|
+
excludeLockedShipments,
|
|
95
|
+
},
|
|
96
|
+
{ abortEarly: false, allowUnknown: false }
|
|
97
|
+
);
|
|
98
|
+
if (warrning) {
|
|
99
|
+
Logger({
|
|
100
|
+
level: "WARN",
|
|
101
|
+
message: `Parameter Validation warrnings for platform > Order > getApplicationShipments \n ${warrning}`,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const query_params = {};
|
|
106
|
+
query_params["lane"] = lane;
|
|
107
|
+
query_params["search_type"] = searchType;
|
|
108
|
+
query_params["search_id"] = searchId;
|
|
109
|
+
query_params["from_date"] = fromDate;
|
|
110
|
+
query_params["to_date"] = toDate;
|
|
111
|
+
query_params["dp_ids"] = dpIds;
|
|
112
|
+
query_params["ordering_company_id"] = orderingCompanyId;
|
|
113
|
+
query_params["stores"] = stores;
|
|
114
|
+
query_params["sales_channel"] = salesChannel;
|
|
115
|
+
query_params["request_by_ext"] = requestByExt;
|
|
116
|
+
query_params["page_no"] = pageNo;
|
|
117
|
+
query_params["page_size"] = pageSize;
|
|
118
|
+
query_params["customer_id"] = customerId;
|
|
119
|
+
query_params["is_priority_sort"] = isPrioritySort;
|
|
120
|
+
query_params["exclude_locked_shipments"] = excludeLockedShipments;
|
|
121
|
+
|
|
122
|
+
const response = await PlatformAPIClient.execute(
|
|
123
|
+
this.config,
|
|
124
|
+
"get",
|
|
125
|
+
`/service/platform/order/v1.0/company/${this.config.companyId}/application/${this.applicationId}/shipments/`,
|
|
126
|
+
query_params,
|
|
127
|
+
undefined,
|
|
128
|
+
requestHeaders,
|
|
129
|
+
{ responseHeaders }
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
let responseData = response;
|
|
133
|
+
if (responseHeaders) {
|
|
134
|
+
responseData = response[0];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const {
|
|
138
|
+
error: res_error,
|
|
139
|
+
} = OrderPlatformModel.ShipmentInternalPlatformViewResponse().validate(
|
|
140
|
+
responseData,
|
|
141
|
+
{ abortEarly: false, allowUnknown: false }
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
if (res_error) {
|
|
145
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
146
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
147
|
+
} else {
|
|
148
|
+
Logger({
|
|
149
|
+
level: "WARN",
|
|
150
|
+
message: `Response Validation Warnings for platform > Order > getApplicationShipments \n ${res_error}`,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return response;
|
|
156
|
+
}
|
|
157
|
+
|
|
15
158
|
/**
|
|
16
159
|
* @param {OrderPlatformApplicationValidator.GetPlatformShipmentReasonsParam} arg
|
|
17
160
|
* - Arg object
|
|
@@ -80,12 +223,99 @@ class Order {
|
|
|
80
223
|
});
|
|
81
224
|
|
|
82
225
|
if (res_error) {
|
|
226
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
227
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
228
|
+
} else {
|
|
229
|
+
Logger({
|
|
230
|
+
level: "WARN",
|
|
231
|
+
message: `Response Validation Warnings for platform > Order > getPlatformShipmentReasons \n ${res_error}`,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return response;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* @param {OrderPlatformApplicationValidator.GetShipmentBagReasonsParam} arg
|
|
241
|
+
* - Arg object
|
|
242
|
+
*
|
|
243
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
244
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
245
|
+
* @returns {Promise<OrderPlatformModel.ShipmentBagReasons>} - Success response
|
|
246
|
+
* @name getShipmentBagReasons
|
|
247
|
+
* @summary: Get reasons behind full or partial cancellation of a shipment
|
|
248
|
+
* @description: Use this API to retrieve the issues that led to the cancellation of bags within a shipment. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/order/getShipmentBagReasons/).
|
|
249
|
+
*/
|
|
250
|
+
async getShipmentBagReasons(
|
|
251
|
+
{ shipmentId, lineNumber, requestHeaders } = { requestHeaders: {} },
|
|
252
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
253
|
+
) {
|
|
254
|
+
const {
|
|
255
|
+
error,
|
|
256
|
+
} = OrderPlatformApplicationValidator.getShipmentBagReasons().validate(
|
|
257
|
+
{
|
|
258
|
+
shipmentId,
|
|
259
|
+
lineNumber,
|
|
260
|
+
},
|
|
261
|
+
{ abortEarly: false, allowUnknown: true }
|
|
262
|
+
);
|
|
263
|
+
if (error) {
|
|
264
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Showing warrnings if extra unknown parameters are found
|
|
268
|
+
const {
|
|
269
|
+
error: warrning,
|
|
270
|
+
} = OrderPlatformApplicationValidator.getShipmentBagReasons().validate(
|
|
271
|
+
{
|
|
272
|
+
shipmentId,
|
|
273
|
+
lineNumber,
|
|
274
|
+
},
|
|
275
|
+
{ abortEarly: false, allowUnknown: false }
|
|
276
|
+
);
|
|
277
|
+
if (warrning) {
|
|
83
278
|
Logger({
|
|
84
279
|
level: "WARN",
|
|
85
|
-
message: `
|
|
280
|
+
message: `Parameter Validation warrnings for platform > Order > getShipmentBagReasons \n ${warrning}`,
|
|
86
281
|
});
|
|
87
282
|
}
|
|
88
283
|
|
|
284
|
+
const query_params = {};
|
|
285
|
+
|
|
286
|
+
const response = await PlatformAPIClient.execute(
|
|
287
|
+
this.config,
|
|
288
|
+
"get",
|
|
289
|
+
`/service/platform/order/v1.0/company/${this.config.companyId}/application/<application_id>/orders/shipments/<shipment_id>/line_number/<line_number>/reasons`,
|
|
290
|
+
query_params,
|
|
291
|
+
undefined,
|
|
292
|
+
requestHeaders,
|
|
293
|
+
{ responseHeaders }
|
|
294
|
+
);
|
|
295
|
+
|
|
296
|
+
let responseData = response;
|
|
297
|
+
if (responseHeaders) {
|
|
298
|
+
responseData = response[0];
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
const {
|
|
302
|
+
error: res_error,
|
|
303
|
+
} = OrderPlatformModel.ShipmentBagReasons().validate(responseData, {
|
|
304
|
+
abortEarly: false,
|
|
305
|
+
allowUnknown: false,
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
if (res_error) {
|
|
309
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
310
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
311
|
+
} else {
|
|
312
|
+
Logger({
|
|
313
|
+
level: "WARN",
|
|
314
|
+
message: `Response Validation Warnings for platform > Order > getShipmentBagReasons \n ${res_error}`,
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
89
319
|
return response;
|
|
90
320
|
}
|
|
91
321
|
|
|
@@ -157,10 +387,14 @@ class Order {
|
|
|
157
387
|
});
|
|
158
388
|
|
|
159
389
|
if (res_error) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
390
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
391
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
392
|
+
} else {
|
|
393
|
+
Logger({
|
|
394
|
+
level: "WARN",
|
|
395
|
+
message: `Response Validation Warnings for platform > Order > trackShipmentPlatform \n ${res_error}`,
|
|
396
|
+
});
|
|
397
|
+
}
|
|
164
398
|
}
|
|
165
399
|
|
|
166
400
|
return response;
|
|
@@ -1,24 +1,80 @@
|
|
|
1
1
|
export = OrderPlatformApplicationValidator;
|
|
2
|
+
/**
|
|
3
|
+
* @typedef GetApplicationShipmentsParam
|
|
4
|
+
* @property {string} [lane]
|
|
5
|
+
* @property {string} [searchType]
|
|
6
|
+
* @property {string} [searchId]
|
|
7
|
+
* @property {string} [fromDate]
|
|
8
|
+
* @property {string} [toDate]
|
|
9
|
+
* @property {string} [dpIds]
|
|
10
|
+
* @property {string} [orderingCompanyId]
|
|
11
|
+
* @property {string} [stores]
|
|
12
|
+
* @property {string} [salesChannel]
|
|
13
|
+
* @property {string} [requestByExt]
|
|
14
|
+
* @property {number} [pageNo]
|
|
15
|
+
* @property {number} [pageSize]
|
|
16
|
+
* @property {string} [customerId]
|
|
17
|
+
* @property {boolean} [isPrioritySort]
|
|
18
|
+
* @property {boolean} [excludeLockedShipments]
|
|
19
|
+
*/
|
|
2
20
|
/**
|
|
3
21
|
* @typedef GetPlatformShipmentReasonsParam
|
|
4
22
|
* @property {string} action
|
|
5
23
|
*/
|
|
24
|
+
/**
|
|
25
|
+
* @typedef GetShipmentBagReasonsParam
|
|
26
|
+
* @property {string} shipmentId - ID of the bag. An order may contain multiple
|
|
27
|
+
* items and may get divided into one or more shipment, each having its own ID.
|
|
28
|
+
* @property {number} lineNumber - Line number of bag.
|
|
29
|
+
*/
|
|
6
30
|
/**
|
|
7
31
|
* @typedef TrackShipmentPlatformParam
|
|
8
32
|
* @property {string} shipmentId - Shipment Id
|
|
9
33
|
*/
|
|
10
34
|
declare class OrderPlatformApplicationValidator {
|
|
35
|
+
/** @returns {GetApplicationShipmentsParam} */
|
|
36
|
+
static getApplicationShipments(): GetApplicationShipmentsParam;
|
|
11
37
|
/** @returns {GetPlatformShipmentReasonsParam} */
|
|
12
38
|
static getPlatformShipmentReasons(): GetPlatformShipmentReasonsParam;
|
|
39
|
+
/** @returns {GetShipmentBagReasonsParam} */
|
|
40
|
+
static getShipmentBagReasons(): GetShipmentBagReasonsParam;
|
|
13
41
|
/** @returns {TrackShipmentPlatformParam} */
|
|
14
42
|
static trackShipmentPlatform(): TrackShipmentPlatformParam;
|
|
15
43
|
}
|
|
16
44
|
declare namespace OrderPlatformApplicationValidator {
|
|
17
|
-
export { GetPlatformShipmentReasonsParam, TrackShipmentPlatformParam };
|
|
45
|
+
export { GetApplicationShipmentsParam, GetPlatformShipmentReasonsParam, GetShipmentBagReasonsParam, TrackShipmentPlatformParam };
|
|
18
46
|
}
|
|
47
|
+
type GetApplicationShipmentsParam = {
|
|
48
|
+
lane?: string;
|
|
49
|
+
searchType?: string;
|
|
50
|
+
searchId?: string;
|
|
51
|
+
fromDate?: string;
|
|
52
|
+
toDate?: string;
|
|
53
|
+
dpIds?: string;
|
|
54
|
+
orderingCompanyId?: string;
|
|
55
|
+
stores?: string;
|
|
56
|
+
salesChannel?: string;
|
|
57
|
+
requestByExt?: string;
|
|
58
|
+
pageNo?: number;
|
|
59
|
+
pageSize?: number;
|
|
60
|
+
customerId?: string;
|
|
61
|
+
isPrioritySort?: boolean;
|
|
62
|
+
excludeLockedShipments?: boolean;
|
|
63
|
+
};
|
|
19
64
|
type GetPlatformShipmentReasonsParam = {
|
|
20
65
|
action: string;
|
|
21
66
|
};
|
|
67
|
+
type GetShipmentBagReasonsParam = {
|
|
68
|
+
/**
|
|
69
|
+
* - ID of the bag. An order may contain multiple
|
|
70
|
+
* items and may get divided into one or more shipment, each having its own ID.
|
|
71
|
+
*/
|
|
72
|
+
shipmentId: string;
|
|
73
|
+
/**
|
|
74
|
+
* - Line number of bag.
|
|
75
|
+
*/
|
|
76
|
+
lineNumber: number;
|
|
77
|
+
};
|
|
22
78
|
type TrackShipmentPlatformParam = {
|
|
23
79
|
/**
|
|
24
80
|
* - Shipment Id
|
|
@@ -2,17 +2,64 @@ const Joi = require("joi");
|
|
|
2
2
|
|
|
3
3
|
const OrderPlatformModel = require("./OrderPlatformModel");
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @typedef GetApplicationShipmentsParam
|
|
7
|
+
* @property {string} [lane]
|
|
8
|
+
* @property {string} [searchType]
|
|
9
|
+
* @property {string} [searchId]
|
|
10
|
+
* @property {string} [fromDate]
|
|
11
|
+
* @property {string} [toDate]
|
|
12
|
+
* @property {string} [dpIds]
|
|
13
|
+
* @property {string} [orderingCompanyId]
|
|
14
|
+
* @property {string} [stores]
|
|
15
|
+
* @property {string} [salesChannel]
|
|
16
|
+
* @property {string} [requestByExt]
|
|
17
|
+
* @property {number} [pageNo]
|
|
18
|
+
* @property {number} [pageSize]
|
|
19
|
+
* @property {string} [customerId]
|
|
20
|
+
* @property {boolean} [isPrioritySort]
|
|
21
|
+
* @property {boolean} [excludeLockedShipments]
|
|
22
|
+
*/
|
|
23
|
+
|
|
5
24
|
/**
|
|
6
25
|
* @typedef GetPlatformShipmentReasonsParam
|
|
7
26
|
* @property {string} action
|
|
8
27
|
*/
|
|
9
28
|
|
|
29
|
+
/**
|
|
30
|
+
* @typedef GetShipmentBagReasonsParam
|
|
31
|
+
* @property {string} shipmentId - ID of the bag. An order may contain multiple
|
|
32
|
+
* items and may get divided into one or more shipment, each having its own ID.
|
|
33
|
+
* @property {number} lineNumber - Line number of bag.
|
|
34
|
+
*/
|
|
35
|
+
|
|
10
36
|
/**
|
|
11
37
|
* @typedef TrackShipmentPlatformParam
|
|
12
38
|
* @property {string} shipmentId - Shipment Id
|
|
13
39
|
*/
|
|
14
40
|
|
|
15
41
|
class OrderPlatformApplicationValidator {
|
|
42
|
+
/** @returns {GetApplicationShipmentsParam} */
|
|
43
|
+
static getApplicationShipments() {
|
|
44
|
+
return Joi.object({
|
|
45
|
+
lane: Joi.string().allow(""),
|
|
46
|
+
searchType: Joi.string().allow(""),
|
|
47
|
+
searchId: Joi.string().allow(""),
|
|
48
|
+
fromDate: Joi.string().allow(""),
|
|
49
|
+
toDate: Joi.string().allow(""),
|
|
50
|
+
dpIds: Joi.string().allow(""),
|
|
51
|
+
orderingCompanyId: Joi.string().allow(""),
|
|
52
|
+
stores: Joi.string().allow(""),
|
|
53
|
+
salesChannel: Joi.string().allow(""),
|
|
54
|
+
requestByExt: Joi.string().allow(""),
|
|
55
|
+
pageNo: Joi.number(),
|
|
56
|
+
pageSize: Joi.number(),
|
|
57
|
+
customerId: Joi.string().allow(""),
|
|
58
|
+
isPrioritySort: Joi.boolean(),
|
|
59
|
+
excludeLockedShipments: Joi.boolean(),
|
|
60
|
+
}).required();
|
|
61
|
+
}
|
|
62
|
+
|
|
16
63
|
/** @returns {GetPlatformShipmentReasonsParam} */
|
|
17
64
|
static getPlatformShipmentReasons() {
|
|
18
65
|
return Joi.object({
|
|
@@ -20,6 +67,14 @@ class OrderPlatformApplicationValidator {
|
|
|
20
67
|
}).required();
|
|
21
68
|
}
|
|
22
69
|
|
|
70
|
+
/** @returns {GetShipmentBagReasonsParam} */
|
|
71
|
+
static getShipmentBagReasons() {
|
|
72
|
+
return Joi.object({
|
|
73
|
+
shipmentId: Joi.string().allow("").required(),
|
|
74
|
+
lineNumber: Joi.number().required(),
|
|
75
|
+
}).required();
|
|
76
|
+
}
|
|
77
|
+
|
|
23
78
|
/** @returns {TrackShipmentPlatformParam} */
|
|
24
79
|
static trackShipmentPlatform() {
|
|
25
80
|
return Joi.object({
|