@gofynd/fdk-client-javascript 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/documentation/application/CART.md +251 -251
- package/documentation/application/CATALOG.md +393 -393
- package/documentation/application/CONTENT.md +15 -1
- package/documentation/application/ORDER.md +268 -268
- package/documentation/application/PAYMENT.md +249 -249
- package/documentation/application/POSCART.md +297 -297
- package/documentation/platform/CART.md +499 -499
- package/documentation/platform/CATALOG.md +3497 -3097
- package/documentation/platform/COMPANYPROFILE.md +207 -207
- package/documentation/platform/CONTENT.md +123 -1
- package/documentation/platform/ORDER.md +1518 -1324
- package/documentation/platform/PARTNER.md +7 -7
- package/documentation/platform/PAYMENT.md +96 -96
- package/index.js +7 -1
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +865 -52
- package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationModel.js +335 -335
- package/sdk/application/Cart/CartApplicationValidator.js +1 -0
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +1034 -60
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +19 -19
- package/sdk/application/Catalog/CatalogApplicationModel.js +532 -532
- package/sdk/application/Catalog/CatalogApplicationValidator.js +1 -0
- package/sdk/application/Common/CommonApplicationClient.js +66 -4
- package/sdk/application/Common/CommonApplicationValidator.js +1 -0
- package/sdk/application/Communication/CommunicationApplicationClient.js +108 -6
- package/sdk/application/Communication/CommunicationApplicationValidator.js +1 -0
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +558 -32
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +1 -0
- package/sdk/application/Content/ContentApplicationClient.js +621 -38
- package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +11 -1
- package/sdk/application/Content/ContentApplicationValidator.js +1 -0
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +101 -6
- package/sdk/application/FileStorage/FileStorageApplicationValidator.js +1 -0
- package/sdk/application/Lead/LeadApplicationClient.js +229 -14
- package/sdk/application/Lead/LeadApplicationValidator.js +1 -0
- package/sdk/application/Logistic/LogisticApplicationClient.js +134 -8
- package/sdk/application/Logistic/LogisticApplicationValidator.js +1 -0
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +403 -24
- package/sdk/application/Order/OrderApplicationModel.d.ts +20 -20
- package/sdk/application/Order/OrderApplicationModel.js +334 -334
- package/sdk/application/Order/OrderApplicationValidator.js +1 -0
- package/sdk/application/Payment/PaymentApplicationClient.js +1381 -78
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +2 -2
- package/sdk/application/Payment/PaymentApplicationModel.js +350 -350
- package/sdk/application/Payment/PaymentApplicationValidator.js +1 -0
- package/sdk/application/PosCart/PosCartApplicationClient.js +914 -54
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
- package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
- package/sdk/application/PosCart/PosCartApplicationValidator.js +1 -0
- package/sdk/application/Rewards/RewardsApplicationClient.js +235 -14
- package/sdk/application/Rewards/RewardsApplicationValidator.js +1 -0
- package/sdk/application/Share/ShareApplicationClient.js +226 -14
- package/sdk/application/Share/ShareApplicationValidator.js +1 -0
- package/sdk/application/Theme/ThemeApplicationClient.js +130 -8
- package/sdk/application/Theme/ThemeApplicationValidator.js +1 -0
- package/sdk/application/User/UserApplicationClient.js +1133 -70
- package/sdk/application/User/UserApplicationValidator.js +1 -0
- package/sdk/common/AxiosHelper.js +1 -1
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +287 -16
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +153 -8
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +141 -8
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
- package/sdk/platform/Billing/BillingPlatformClient.js +429 -24
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +617 -34
- package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
- package/sdk/platform/Cart/CartPlatformModel.js +617 -617
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +191 -138
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2202 -302
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +11 -11
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +45 -45
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +344 -226
- package/sdk/platform/Catalog/CatalogPlatformClient.js +3282 -488
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +110 -100
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2073 -1795
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +23 -21
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +103 -84
- package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
- package/sdk/platform/Common/CommonPlatformClient.js +73 -4
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1499 -80
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +41 -2
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +486 -26
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +9 -9
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +274 -274
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1022 -56
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +693 -36
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +2446 -140
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
- package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
- package/sdk/platform/Content/ContentPlatformModel.js +43 -1
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
- package/sdk/platform/Discount/DiscountPlatformClient.js +400 -22
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +148 -8
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +214 -12
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
- package/sdk/platform/Inventory/InventoryPlatformClient.js +449 -24
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +447 -26
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +384 -22
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +125 -6
- package/sdk/platform/Order/OrderPlatformClient.d.ts +108 -47
- package/sdk/platform/Order/OrderPlatformClient.js +1641 -100
- package/sdk/platform/Order/OrderPlatformModel.d.ts +69 -58
- package/sdk/platform/Order/OrderPlatformModel.js +1485 -1493
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +2 -1
- package/sdk/platform/Order/OrderPlatformValidator.js +15 -4
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +74 -4
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
- package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +418 -22
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
- package/sdk/platform/Payment/PaymentPlatformClient.js +374 -20
- package/sdk/platform/Payment/PaymentPlatformModel.js +139 -139
- package/sdk/platform/PlatformApplicationClient.d.ts +2973 -2827
- package/sdk/platform/PlatformApplicationClient.js +3461 -3263
- package/sdk/platform/PlatformClient.d.ts +2973 -2827
- package/sdk/platform/PlatformClient.js +3461 -3263
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +449 -26
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/Share/SharePlatformApplicationClient.js +139 -8
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +816 -48
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
- package/sdk/platform/User/UserPlatformApplicationClient.js +417 -24
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
- package/sdk/platform/Webhook/WebhookPlatformClient.js +229 -12
- package/sdk/public/Configuration/ConfigurationPublicClient.js +72 -4
- package/sdk/public/Configuration/ConfigurationPublicValidator.js +3 -1
- package/sdk/public/Inventory/InventoryPublicClient.js +210 -12
- package/sdk/public/Inventory/InventoryPublicValidator.js +3 -1
- package/sdk/public/Webhook/WebhookPublicClient.js +74 -4
- package/sdk/public/Webhook/WebhookPublicValidator.js +3 -1
|
@@ -49,11 +49,11 @@ class OAuthClient {
|
|
|
49
49
|
if (this.refreshToken && this.useAutoRenewTimer) {
|
|
50
50
|
this.retryOAuthToken(token.expires_in);
|
|
51
51
|
}
|
|
52
|
-
Logger({
|
|
52
|
+
Logger({ level: "INFO", message: "Token set." });
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
retryOAuthToken(expires_in) {
|
|
56
|
-
Logger({
|
|
56
|
+
Logger({ level: "INFO", message: "Retrying OAuth Token..." });
|
|
57
57
|
if (this.retryOAuthTokenTimer) {
|
|
58
58
|
clearTimeout(this.retryOAuthTokenTimer);
|
|
59
59
|
}
|
|
@@ -65,7 +65,7 @@ class OAuthClient {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
startAuthorization(options) {
|
|
68
|
-
Logger({
|
|
68
|
+
Logger({ level: "INFO", message: "Starting Authorization..." });
|
|
69
69
|
let query = {
|
|
70
70
|
client_id: this.config.apiKey,
|
|
71
71
|
scope: options.scope.join(","),
|
|
@@ -86,7 +86,7 @@ class OAuthClient {
|
|
|
86
86
|
signQuery: true,
|
|
87
87
|
};
|
|
88
88
|
signingOptions = sign(signingOptions);
|
|
89
|
-
Logger({
|
|
89
|
+
Logger({ level: "INFO", message: "Authorization successful.!" });
|
|
90
90
|
|
|
91
91
|
return `${this.config.domain}${signingOptions.path}`;
|
|
92
92
|
}
|
|
@@ -116,7 +116,7 @@ class OAuthClient {
|
|
|
116
116
|
|
|
117
117
|
async renewAccessToken(isOfflineToken = false) {
|
|
118
118
|
try {
|
|
119
|
-
Logger({
|
|
119
|
+
Logger({ level: "INFO", message: "Renewing Access token..." });
|
|
120
120
|
let res;
|
|
121
121
|
if (isOfflineToken) {
|
|
122
122
|
let requestCacheKey = `${this.config.apiKey}:${this.config.companyId}`;
|
|
@@ -138,7 +138,7 @@ class OAuthClient {
|
|
|
138
138
|
this.setToken(res);
|
|
139
139
|
this.token_expires_at =
|
|
140
140
|
new Date().getTime() + this.token_expires_in * 1000;
|
|
141
|
-
Logger({
|
|
141
|
+
Logger({ level: "INFO", message: "Done." });
|
|
142
142
|
return res;
|
|
143
143
|
} catch (error) {
|
|
144
144
|
if (error.isAxiosError) {
|
|
@@ -149,7 +149,7 @@ class OAuthClient {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
async getAccesstokenObj({ grant_type, refresh_token, code }) {
|
|
152
|
-
Logger({
|
|
152
|
+
Logger({ level: "INFO", message: "Processing Access token object..." });
|
|
153
153
|
let reqData = {
|
|
154
154
|
grant_type: grant_type,
|
|
155
155
|
};
|
|
@@ -173,7 +173,7 @@ class OAuthClient {
|
|
|
173
173
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
174
174
|
},
|
|
175
175
|
};
|
|
176
|
-
Logger({
|
|
176
|
+
Logger({ level: "INFO", message: "Done." });
|
|
177
177
|
return fdkAxios.request(rawRequest);
|
|
178
178
|
}
|
|
179
179
|
|
|
@@ -19,6 +19,7 @@ declare class Order {
|
|
|
19
19
|
* @param {number} [arg.pageSize] -
|
|
20
20
|
* @param {string} [arg.customerId] -
|
|
21
21
|
* @param {boolean} [arg.isPrioritySort] -
|
|
22
|
+
* @returns {Promise<ShipmentInternalPlatformViewResponse>} - Success response
|
|
22
23
|
* @summary:
|
|
23
24
|
* @description:
|
|
24
25
|
*/
|
|
@@ -37,23 +38,25 @@ declare class Order {
|
|
|
37
38
|
pageSize?: number;
|
|
38
39
|
customerId?: string;
|
|
39
40
|
isPrioritySort?: boolean;
|
|
40
|
-
}): Promise<
|
|
41
|
+
}): Promise<ShipmentInternalPlatformViewResponse>;
|
|
41
42
|
/**
|
|
42
43
|
* @param {Object} arg - Arg object.
|
|
43
44
|
* @param {string} arg.orderId -
|
|
45
|
+
* @returns {Promise<ShipmentDetailsResponse>} - Success response
|
|
44
46
|
* @summary:
|
|
45
47
|
* @description:
|
|
46
48
|
*/
|
|
47
49
|
getAppOrderShipmentDetails({ orderId }?: {
|
|
48
50
|
orderId: string;
|
|
49
|
-
}): Promise<
|
|
51
|
+
}): Promise<ShipmentDetailsResponse>;
|
|
50
52
|
/**
|
|
51
53
|
* @param {Object} arg - Arg object.
|
|
52
54
|
* @param {string} arg.shipmentId -
|
|
55
|
+
* @returns {Promise<PlatformShipmentTrack>} - Success response
|
|
53
56
|
* @summary: Track shipment
|
|
54
57
|
* @description: Track Shipment by shipment id, for application based on application Id
|
|
55
58
|
*/
|
|
56
59
|
trackPlatformShipment({ shipmentId }?: {
|
|
57
60
|
shipmentId: string;
|
|
58
|
-
}): Promise<
|
|
61
|
+
}): Promise<PlatformShipmentTrack>;
|
|
59
62
|
}
|
|
@@ -2,6 +2,8 @@ const Paginator = require("../../common/Paginator");
|
|
|
2
2
|
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
3
3
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
4
4
|
const OrderValidator = require("./OrderPlatformApplicationValidator");
|
|
5
|
+
const OrderModel = require("./OrderPlatformModel");
|
|
6
|
+
const { Logger } = require("./../../common/Logger");
|
|
5
7
|
|
|
6
8
|
class Order {
|
|
7
9
|
constructor(config, applicationId) {
|
|
@@ -25,10 +27,11 @@ class Order {
|
|
|
25
27
|
* @param {number} [arg.pageSize] -
|
|
26
28
|
* @param {string} [arg.customerId] -
|
|
27
29
|
* @param {boolean} [arg.isPrioritySort] -
|
|
30
|
+
* @returns {Promise<ShipmentInternalPlatformViewResponse>} - Success response
|
|
28
31
|
* @summary:
|
|
29
32
|
* @description:
|
|
30
33
|
*/
|
|
31
|
-
getApplicationShipments({
|
|
34
|
+
async getApplicationShipments({
|
|
32
35
|
lane,
|
|
33
36
|
searchType,
|
|
34
37
|
searchId,
|
|
@@ -67,6 +70,36 @@ class Order {
|
|
|
67
70
|
return Promise.reject(new FDKClientValidationError(error));
|
|
68
71
|
}
|
|
69
72
|
|
|
73
|
+
// Showing warrnings if extra unknown parameters are found
|
|
74
|
+
const {
|
|
75
|
+
error: warrning,
|
|
76
|
+
} = OrderValidator.getApplicationShipments().validate(
|
|
77
|
+
{
|
|
78
|
+
lane,
|
|
79
|
+
searchType,
|
|
80
|
+
searchId,
|
|
81
|
+
fromDate,
|
|
82
|
+
toDate,
|
|
83
|
+
dpIds,
|
|
84
|
+
orderingCompanyId,
|
|
85
|
+
stores,
|
|
86
|
+
salesChannel,
|
|
87
|
+
requestByExt,
|
|
88
|
+
pageNo,
|
|
89
|
+
pageSize,
|
|
90
|
+
customerId,
|
|
91
|
+
isPrioritySort,
|
|
92
|
+
},
|
|
93
|
+
{ abortEarly: false, allowUnknown: false }
|
|
94
|
+
);
|
|
95
|
+
if (warrning) {
|
|
96
|
+
Logger({
|
|
97
|
+
level: "WARN",
|
|
98
|
+
message: "Parameter Validation warrnings for getApplicationShipments",
|
|
99
|
+
});
|
|
100
|
+
Logger({ level: "WARN", message: warrning });
|
|
101
|
+
}
|
|
102
|
+
|
|
70
103
|
const query_params = {};
|
|
71
104
|
query_params["lane"] = lane;
|
|
72
105
|
query_params["search_type"] = searchType;
|
|
@@ -83,22 +116,40 @@ class Order {
|
|
|
83
116
|
query_params["customer_id"] = customerId;
|
|
84
117
|
query_params["is_priority_sort"] = isPrioritySort;
|
|
85
118
|
|
|
86
|
-
|
|
119
|
+
const response = await PlatformAPIClient.execute(
|
|
87
120
|
this.config,
|
|
88
121
|
"get",
|
|
89
122
|
`/service/platform/orders/v1.0/company/${this.config.companyId}/application/${this.applicationId}/shipments/`,
|
|
90
123
|
query_params,
|
|
91
124
|
undefined
|
|
92
125
|
);
|
|
126
|
+
|
|
127
|
+
const {
|
|
128
|
+
error: res_error,
|
|
129
|
+
} = OrderModel.ShipmentInternalPlatformViewResponse().validate(response, {
|
|
130
|
+
abortEarly: false,
|
|
131
|
+
allowUnknown: false,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
if (res_error) {
|
|
135
|
+
Logger({
|
|
136
|
+
level: "WARN",
|
|
137
|
+
message: "Response Validation Warnnings for getApplicationShipments",
|
|
138
|
+
});
|
|
139
|
+
Logger({ level: "WARN", message: res_error });
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return response;
|
|
93
143
|
}
|
|
94
144
|
|
|
95
145
|
/**
|
|
96
146
|
* @param {Object} arg - Arg object.
|
|
97
147
|
* @param {string} arg.orderId -
|
|
148
|
+
* @returns {Promise<ShipmentDetailsResponse>} - Success response
|
|
98
149
|
* @summary:
|
|
99
150
|
* @description:
|
|
100
151
|
*/
|
|
101
|
-
getAppOrderShipmentDetails({ orderId } = {}) {
|
|
152
|
+
async getAppOrderShipmentDetails({ orderId } = {}) {
|
|
102
153
|
const { error } = OrderValidator.getAppOrderShipmentDetails().validate(
|
|
103
154
|
{
|
|
104
155
|
orderId,
|
|
@@ -109,25 +160,61 @@ class Order {
|
|
|
109
160
|
return Promise.reject(new FDKClientValidationError(error));
|
|
110
161
|
}
|
|
111
162
|
|
|
163
|
+
// Showing warrnings if extra unknown parameters are found
|
|
164
|
+
const {
|
|
165
|
+
error: warrning,
|
|
166
|
+
} = OrderValidator.getAppOrderShipmentDetails().validate(
|
|
167
|
+
{
|
|
168
|
+
orderId,
|
|
169
|
+
},
|
|
170
|
+
{ abortEarly: false, allowUnknown: false }
|
|
171
|
+
);
|
|
172
|
+
if (warrning) {
|
|
173
|
+
Logger({
|
|
174
|
+
level: "WARN",
|
|
175
|
+
message:
|
|
176
|
+
"Parameter Validation warrnings for getAppOrderShipmentDetails",
|
|
177
|
+
});
|
|
178
|
+
Logger({ level: "WARN", message: warrning });
|
|
179
|
+
}
|
|
180
|
+
|
|
112
181
|
const query_params = {};
|
|
113
182
|
query_params["order_id"] = orderId;
|
|
114
183
|
|
|
115
|
-
|
|
184
|
+
const response = await PlatformAPIClient.execute(
|
|
116
185
|
this.config,
|
|
117
186
|
"get",
|
|
118
187
|
`/service/platform/orders/v1.0/company/${this.config.companyId}/application/${this.applicationId}/order-details`,
|
|
119
188
|
query_params,
|
|
120
189
|
undefined
|
|
121
190
|
);
|
|
191
|
+
|
|
192
|
+
const {
|
|
193
|
+
error: res_error,
|
|
194
|
+
} = OrderModel.ShipmentDetailsResponse().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 getAppOrderShipmentDetails",
|
|
203
|
+
});
|
|
204
|
+
Logger({ level: "WARN", message: res_error });
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return response;
|
|
122
208
|
}
|
|
123
209
|
|
|
124
210
|
/**
|
|
125
211
|
* @param {Object} arg - Arg object.
|
|
126
212
|
* @param {string} arg.shipmentId -
|
|
213
|
+
* @returns {Promise<PlatformShipmentTrack>} - Success response
|
|
127
214
|
* @summary: Track shipment
|
|
128
215
|
* @description: Track Shipment by shipment id, for application based on application Id
|
|
129
216
|
*/
|
|
130
|
-
trackPlatformShipment({ shipmentId } = {}) {
|
|
217
|
+
async trackPlatformShipment({ shipmentId } = {}) {
|
|
131
218
|
const { error } = OrderValidator.trackPlatformShipment().validate(
|
|
132
219
|
{
|
|
133
220
|
shipmentId,
|
|
@@ -138,15 +225,47 @@ class Order {
|
|
|
138
225
|
return Promise.reject(new FDKClientValidationError(error));
|
|
139
226
|
}
|
|
140
227
|
|
|
228
|
+
// Showing warrnings if extra unknown parameters are found
|
|
229
|
+
const { error: warrning } = OrderValidator.trackPlatformShipment().validate(
|
|
230
|
+
{
|
|
231
|
+
shipmentId,
|
|
232
|
+
},
|
|
233
|
+
{ abortEarly: false, allowUnknown: false }
|
|
234
|
+
);
|
|
235
|
+
if (warrning) {
|
|
236
|
+
Logger({
|
|
237
|
+
level: "WARN",
|
|
238
|
+
message: "Parameter Validation warrnings for trackPlatformShipment",
|
|
239
|
+
});
|
|
240
|
+
Logger({ level: "WARN", message: warrning });
|
|
241
|
+
}
|
|
242
|
+
|
|
141
243
|
const query_params = {};
|
|
142
244
|
|
|
143
|
-
|
|
245
|
+
const response = await PlatformAPIClient.execute(
|
|
144
246
|
this.config,
|
|
145
247
|
"get",
|
|
146
248
|
`/service/platform/orders/v1.0/company/${this.config.companyId}/application/${this.applicationId}/orders/shipments/${shipmentId}/track`,
|
|
147
249
|
query_params,
|
|
148
250
|
undefined
|
|
149
251
|
);
|
|
252
|
+
|
|
253
|
+
const {
|
|
254
|
+
error: res_error,
|
|
255
|
+
} = OrderModel.PlatformShipmentTrack().validate(response, {
|
|
256
|
+
abortEarly: false,
|
|
257
|
+
allowUnknown: false,
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
if (res_error) {
|
|
261
|
+
Logger({
|
|
262
|
+
level: "WARN",
|
|
263
|
+
message: "Response Validation Warnnings for trackPlatformShipment",
|
|
264
|
+
});
|
|
265
|
+
Logger({ level: "WARN", message: res_error });
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return response;
|
|
150
269
|
}
|
|
151
270
|
}
|
|
152
271
|
module.exports = Order;
|