@gofynd/fdk-client-javascript 0.1.35
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/.github/workflows/on_create_release.yml +23 -0
- package/.github/workflows/on_merge_main.yml +38 -0
- package/.github/workflows/on_pull_request.yml +35 -0
- package/.prettierrc +5 -0
- package/LICENSE +21 -0
- package/README.md +118 -0
- package/application.d.ts +3 -0
- package/application.js +6 -0
- package/common.d.ts +4 -0
- package/common.js +9 -0
- package/documentation/application/CART.md +7290 -0
- package/documentation/application/CATALOG.md +9570 -0
- package/documentation/application/COMMON.md +448 -0
- package/documentation/application/COMMUNICATION.md +463 -0
- package/documentation/application/CONFIGURATION.md +2902 -0
- package/documentation/application/CONTENT.md +3350 -0
- package/documentation/application/FILESTORAGE.md +491 -0
- package/documentation/application/LEAD.md +1891 -0
- package/documentation/application/LOGISTIC.md +439 -0
- package/documentation/application/ORDER.md +3428 -0
- package/documentation/application/PAYMENT.md +5035 -0
- package/documentation/application/POSCART.md +7889 -0
- package/documentation/application/README.md +21 -0
- package/documentation/application/REWARDS.md +714 -0
- package/documentation/application/SHARE.md +729 -0
- package/documentation/application/THEME.md +5796 -0
- package/documentation/application/USER.md +4326 -0
- package/documentation/platform/ANALYTICS.md +1150 -0
- package/documentation/platform/AUDITTRAIL.md +572 -0
- package/documentation/platform/BILLING.md +2396 -0
- package/documentation/platform/CART.md +5539 -0
- package/documentation/platform/CATALOG.md +21624 -0
- package/documentation/platform/COMMON.md +448 -0
- package/documentation/platform/COMMUNICATION.md +5714 -0
- package/documentation/platform/COMPANYPROFILE.md +2141 -0
- package/documentation/platform/CONFIGURATION.md +7335 -0
- package/documentation/platform/CONTENT.md +8989 -0
- package/documentation/platform/DISCOUNT.md +773 -0
- package/documentation/platform/FILESTORAGE.md +994 -0
- package/documentation/platform/INVENTORY.md +1775 -0
- package/documentation/platform/LEAD.md +4736 -0
- package/documentation/platform/ORDER.md +3764 -0
- package/documentation/platform/PARTNER.md +216 -0
- package/documentation/platform/PAYMENT.md +3444 -0
- package/documentation/platform/README.md +27 -0
- package/documentation/platform/REWARDS.md +871 -0
- package/documentation/platform/SHARE.md +602 -0
- package/documentation/platform/THEME.md +35725 -0
- package/documentation/platform/USER.md +2305 -0
- package/documentation/platform/WEBHOOK.md +587 -0
- package/documentation/public/CONFIGURATION.md +448 -0
- package/documentation/public/INVENTORY.md +686 -0
- package/documentation/public/WEBHOOK.md +348 -0
- package/index.d.ts +10 -0
- package/index.js +18 -0
- package/jest.config.d.ts +4 -0
- package/jest.config.js +6 -0
- package/package.json +35 -0
- package/platform.d.ts +3 -0
- package/platform.js +6 -0
- package/public.d.ts +3 -0
- package/public.js +6 -0
- package/sdk/application/ApplicationAPIClient.d.ts +11 -0
- package/sdk/application/ApplicationAPIClient.js +44 -0
- package/sdk/application/ApplicationClient.d.ts +40 -0
- package/sdk/application/ApplicationClient.js +84 -0
- package/sdk/application/ApplicationConfig.d.ts +19 -0
- package/sdk/application/ApplicationConfig.js +55 -0
- package/sdk/application/ApplicationModels.d.ts +826 -0
- package/sdk/application/ApplicationModels.js +10474 -0
- package/sdk/application/client/CartApplicationClient.d.ts +432 -0
- package/sdk/application/client/CartApplicationClient.js +1066 -0
- package/sdk/application/client/CatalogApplicationClient.d.ts +694 -0
- package/sdk/application/client/CatalogApplicationClient.js +1629 -0
- package/sdk/application/client/CommonApplicationClient.d.ts +38 -0
- package/sdk/application/client/CommonApplicationClient.js +105 -0
- package/sdk/application/client/CommunicationApplicationClient.d.ts +39 -0
- package/sdk/application/client/CommunicationApplicationClient.js +131 -0
- package/sdk/application/client/ConfigurationApplicationClient.d.ts +210 -0
- package/sdk/application/client/ConfigurationApplicationClient.js +649 -0
- package/sdk/application/client/ContentApplicationClient.d.ts +256 -0
- package/sdk/application/client/ContentApplicationClient.js +785 -0
- package/sdk/application/client/FileStorageApplicationClient.d.ts +88 -0
- package/sdk/application/client/FileStorageApplicationClient.js +214 -0
- package/sdk/application/client/LeadApplicationClient.d.ts +90 -0
- package/sdk/application/client/LeadApplicationClient.js +264 -0
- package/sdk/application/client/LogisticApplicationClient.d.ts +42 -0
- package/sdk/application/client/LogisticApplicationClient.js +128 -0
- package/sdk/application/client/OrderApplicationClient.d.ts +190 -0
- package/sdk/application/client/OrderApplicationClient.js +479 -0
- package/sdk/application/client/PaymentApplicationClient.d.ts +454 -0
- package/sdk/application/client/PaymentApplicationClient.js +1378 -0
- package/sdk/application/client/PosCartApplicationClient.d.ts +449 -0
- package/sdk/application/client/PosCartApplicationClient.js +1123 -0
- package/sdk/application/client/RewardsApplicationClient.d.ts +93 -0
- package/sdk/application/client/RewardsApplicationClient.js +293 -0
- package/sdk/application/client/ShareApplicationClient.d.ts +87 -0
- package/sdk/application/client/ShareApplicationClient.js +268 -0
- package/sdk/application/client/ThemeApplicationClient.d.ts +52 -0
- package/sdk/application/client/ThemeApplicationClient.js +161 -0
- package/sdk/application/client/UserApplicationClient.d.ts +446 -0
- package/sdk/application/client/UserApplicationClient.js +1275 -0
- package/sdk/application/constructUrl.d.ts +5 -0
- package/sdk/application/constructUrl.js +13 -0
- package/sdk/application/index.d.ts +2 -0
- package/sdk/application/index.js +4 -0
- package/sdk/application/models/CartValidator.d.ts +29 -0
- package/sdk/application/models/CartValidator.js +223 -0
- package/sdk/application/models/CatalogValidator.d.ts +33 -0
- package/sdk/application/models/CatalogValidator.js +233 -0
- package/sdk/application/models/CommonValidator.d.ts +5 -0
- package/sdk/application/models/CommonValidator.js +18 -0
- package/sdk/application/models/CommunicationValidator.d.ts +6 -0
- package/sdk/application/models/CommunicationValidator.js +20 -0
- package/sdk/application/models/ConfigurationValidator.d.ts +19 -0
- package/sdk/application/models/ConfigurationValidator.js +88 -0
- package/sdk/application/models/ContentValidator.d.ts +22 -0
- package/sdk/application/models/ContentValidator.js +106 -0
- package/sdk/application/models/FileStorageValidator.d.ts +6 -0
- package/sdk/application/models/FileStorageValidator.js +24 -0
- package/sdk/application/models/LeadValidator.d.ts +10 -0
- package/sdk/application/models/LeadValidator.js +48 -0
- package/sdk/application/models/LogisticValidator.d.ts +6 -0
- package/sdk/application/models/LogisticValidator.js +22 -0
- package/sdk/application/models/OrderValidator.d.ts +15 -0
- package/sdk/application/models/OrderValidator.js +87 -0
- package/sdk/application/models/PaymentValidator.d.ts +40 -0
- package/sdk/application/models/PaymentValidator.js +235 -0
- package/sdk/application/models/PosCartValidator.d.ts +30 -0
- package/sdk/application/models/PosCartValidator.js +232 -0
- package/sdk/application/models/RewardsValidator.d.ts +10 -0
- package/sdk/application/models/RewardsValidator.js +43 -0
- package/sdk/application/models/ShareValidator.d.ts +10 -0
- package/sdk/application/models/ShareValidator.js +44 -0
- package/sdk/application/models/ThemeValidator.d.ts +7 -0
- package/sdk/application/models/ThemeValidator.js +27 -0
- package/sdk/application/models/UserValidator.d.ts +38 -0
- package/sdk/application/models/UserValidator.js +233 -0
- package/sdk/common/AxiosHelper.d.ts +1 -0
- package/sdk/common/AxiosHelper.js +141 -0
- package/sdk/common/Constant.d.ts +294 -0
- package/sdk/common/Constant.js +332 -0
- package/sdk/common/FDKError.d.ts +26 -0
- package/sdk/common/FDKError.js +51 -0
- package/sdk/common/Logger.d.ts +2 -0
- package/sdk/common/Logger.js +85 -0
- package/sdk/common/Paginator.d.ts +16 -0
- package/sdk/common/Paginator.js +26 -0
- package/sdk/common/RequestSigner.d.ts +1 -0
- package/sdk/common/RequestSigner.js +306 -0
- package/sdk/common/Utility.d.ts +9 -0
- package/sdk/common/Utility.js +86 -0
- package/sdk/common/utils.d.ts +14 -0
- package/sdk/common/utils.js +165 -0
- package/sdk/platform/OAuthClient.d.ts +26 -0
- package/sdk/platform/OAuthClient.js +221 -0
- package/sdk/platform/PlatformAPIClient.d.ts +12 -0
- package/sdk/platform/PlatformAPIClient.js +43 -0
- package/sdk/platform/PlatformApplicationClient.d.ts +24398 -0
- package/sdk/platform/PlatformApplicationClient.js +23185 -0
- package/sdk/platform/PlatformApplicationModels.d.ts +333 -0
- package/sdk/platform/PlatformApplicationModels.js +21262 -0
- package/sdk/platform/PlatformClient.d.ts +9535 -0
- package/sdk/platform/PlatformClient.js +12336 -0
- package/sdk/platform/PlatformConfig.d.ts +29 -0
- package/sdk/platform/PlatformConfig.js +36 -0
- package/sdk/platform/PlatformModels.d.ts +1396 -0
- package/sdk/platform/PlatformModels.js +19222 -0
- package/sdk/platform/client/AnalyticsPlatformClient.d.ts +84 -0
- package/sdk/platform/client/AnalyticsPlatformClient.js +215 -0
- package/sdk/platform/client/AuditTrailPlatformClient.d.ts +38 -0
- package/sdk/platform/client/AuditTrailPlatformClient.js +133 -0
- package/sdk/platform/client/BillingPlatformClient.d.ts +109 -0
- package/sdk/platform/client/BillingPlatformClient.js +381 -0
- package/sdk/platform/client/CatalogPlatformClient.d.ts +806 -0
- package/sdk/platform/client/CatalogPlatformClient.js +2462 -0
- package/sdk/platform/client/CommonPlatformClient.d.ts +30 -0
- package/sdk/platform/client/CommonPlatformClient.js +84 -0
- package/sdk/platform/client/CommunicationPlatformClient.d.ts +26 -0
- package/sdk/platform/client/CommunicationPlatformClient.js +72 -0
- package/sdk/platform/client/CompanyProfilePlatformClient.d.ts +182 -0
- package/sdk/platform/client/CompanyProfilePlatformClient.js +540 -0
- package/sdk/platform/client/ConfigurationPlatformClient.d.ts +277 -0
- package/sdk/platform/client/ConfigurationPlatformClient.js +806 -0
- package/sdk/platform/client/DiscountPlatformClient.d.ts +118 -0
- package/sdk/platform/client/DiscountPlatformClient.js +364 -0
- package/sdk/platform/client/FileStoragePlatformClient.d.ts +111 -0
- package/sdk/platform/client/FileStoragePlatformClient.js +268 -0
- package/sdk/platform/client/InventoryPlatformClient.d.ts +125 -0
- package/sdk/platform/client/InventoryPlatformClient.js +409 -0
- package/sdk/platform/client/LeadPlatformClient.d.ts +150 -0
- package/sdk/platform/client/LeadPlatformClient.js +439 -0
- package/sdk/platform/client/OrderPlatformClient.d.ts +190 -0
- package/sdk/platform/client/OrderPlatformClient.js +521 -0
- package/sdk/platform/client/PaymentPlatformClient.d.ts +98 -0
- package/sdk/platform/client/PaymentPlatformClient.js +331 -0
- package/sdk/platform/client/WebhookPlatformClient.d.ts +64 -0
- package/sdk/platform/client/WebhookPlatformClient.js +207 -0
- package/sdk/platform/index.d.ts +2 -0
- package/sdk/platform/index.js +4 -0
- package/sdk/platform/models/AnalyticsValidator.d.ts +7 -0
- package/sdk/platform/models/AnalyticsValidator.js +36 -0
- package/sdk/platform/models/AuditTrailValidator.d.ts +7 -0
- package/sdk/platform/models/AuditTrailValidator.js +26 -0
- package/sdk/platform/models/BillingValidator.d.ts +15 -0
- package/sdk/platform/models/BillingValidator.js +72 -0
- package/sdk/platform/models/CartValidator.d.ts +0 -0
- package/sdk/platform/models/CartValidator.js +0 -0
- package/sdk/platform/models/CatalogValidator.d.ts +74 -0
- package/sdk/platform/models/CatalogValidator.js +484 -0
- package/sdk/platform/models/CommonValidator.d.ts +5 -0
- package/sdk/platform/models/CommonValidator.js +18 -0
- package/sdk/platform/models/CommunicationValidator.d.ts +4 -0
- package/sdk/platform/models/CommunicationValidator.js +11 -0
- package/sdk/platform/models/CompanyProfileValidator.d.ts +17 -0
- package/sdk/platform/models/CompanyProfileValidator.js +93 -0
- package/sdk/platform/models/ConfigurationValidator.d.ts +21 -0
- package/sdk/platform/models/ConfigurationValidator.js +134 -0
- package/sdk/platform/models/ContentValidator.d.ts +0 -0
- package/sdk/platform/models/ContentValidator.js +0 -0
- package/sdk/platform/models/DiscountValidator.d.ts +13 -0
- package/sdk/platform/models/DiscountValidator.js +75 -0
- package/sdk/platform/models/FileStorageValidator.d.ts +9 -0
- package/sdk/platform/models/FileStorageValidator.js +44 -0
- package/sdk/platform/models/InventoryValidator.d.ts +15 -0
- package/sdk/platform/models/InventoryValidator.js +81 -0
- package/sdk/platform/models/LeadValidator.d.ts +14 -0
- package/sdk/platform/models/LeadValidator.js +78 -0
- package/sdk/platform/models/OrderValidator.d.ts +14 -0
- package/sdk/platform/models/OrderValidator.js +110 -0
- package/sdk/platform/models/PartnerValidator.d.ts +0 -0
- package/sdk/platform/models/PartnerValidator.js +0 -0
- package/sdk/platform/models/PaymentValidator.d.ts +13 -0
- package/sdk/platform/models/PaymentValidator.js +65 -0
- package/sdk/platform/models/RewardsValidator.d.ts +0 -0
- package/sdk/platform/models/RewardsValidator.js +0 -0
- package/sdk/platform/models/ShareValidator.d.ts +0 -0
- package/sdk/platform/models/ShareValidator.js +0 -0
- package/sdk/platform/models/ThemeValidator.d.ts +0 -0
- package/sdk/platform/models/ThemeValidator.js +0 -0
- package/sdk/platform/models/UserValidator.d.ts +0 -0
- package/sdk/platform/models/UserValidator.js +0 -0
- package/sdk/platform/models/WebhookValidator.d.ts +9 -0
- package/sdk/platform/models/WebhookValidator.js +42 -0
- package/sdk/public/PublicAPIClient.d.ts +11 -0
- package/sdk/public/PublicAPIClient.js +38 -0
- package/sdk/public/PublicClient.d.ts +12 -0
- package/sdk/public/PublicClient.js +24 -0
- package/sdk/public/PublicConfig.d.ts +10 -0
- package/sdk/public/PublicConfig.js +12 -0
- package/sdk/public/PublicModels.d.ts +50 -0
- package/sdk/public/PublicModels.js +712 -0
- package/sdk/public/client/ConfigurationPublicClient.d.ts +38 -0
- package/sdk/public/client/ConfigurationPublicClient.js +102 -0
- package/sdk/public/client/InventoryPublicClient.d.ts +81 -0
- package/sdk/public/client/InventoryPublicClient.js +239 -0
- package/sdk/public/client/WebhookPublicClient.d.ts +28 -0
- package/sdk/public/client/WebhookPublicClient.js +92 -0
- package/sdk/public/constructUrl.d.ts +5 -0
- package/sdk/public/constructUrl.js +13 -0
- package/sdk/public/index.d.ts +2 -0
- package/sdk/public/index.js +4 -0
- package/sdk/public/models/ConfigurationValidator.d.ts +5 -0
- package/sdk/public/models/ConfigurationValidator.js +18 -0
- package/sdk/public/models/InventoryValidator.d.ts +9 -0
- package/sdk/public/models/InventoryValidator.js +43 -0
- package/sdk/public/models/WebhookValidator.d.ts +5 -0
- package/sdk/public/models/WebhookValidator.js +14 -0
- package/tests/application/catalog.spec.js +47 -0
- package/tests/common/action-url.spec.js +35 -0
- package/tests/common/schema/action-url.json +163 -0
- package/tests/common/schema/url-action.json +667 -0
- package/tests/common/url-action.spec.js +48 -0
- package/tests/helpers/cookie.helper.js +31 -0
- package/tests/helpers/oauth.helper.js +43 -0
- package/tests/platform/catalog.spec.js +49 -0
- package/tests/public/location.spec.js +39 -0
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
const APIClient = require("../ApplicationAPIClient");
|
|
2
|
+
const Paginator = require("../../common/Paginator");
|
|
3
|
+
const constructUrl = require("../constructUrl");
|
|
4
|
+
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
5
|
+
const OrderValidator = require("../models/OrderValidator");
|
|
6
|
+
|
|
7
|
+
class Order {
|
|
8
|
+
constructor(_conf) {
|
|
9
|
+
this._conf = _conf;
|
|
10
|
+
this._relativeUrls = {
|
|
11
|
+
getOrders: "/service/application/order/v1.0/orders",
|
|
12
|
+
getOrderById: "/service/application/order/v1.0/orders/{order_id}",
|
|
13
|
+
getPosOrderById:
|
|
14
|
+
"/service/application/order/v1.0/orders/pos-order/{order_id}",
|
|
15
|
+
getShipmentById:
|
|
16
|
+
"/service/application/order/v1.0/orders/shipments/{shipment_id}",
|
|
17
|
+
getInvoiceByShipmentId:
|
|
18
|
+
"/service/application/order/v1.0/orders/shipments/{shipment_id}/invoice",
|
|
19
|
+
trackShipment:
|
|
20
|
+
"/service/application/order/v1.0/orders/shipments/{shipment_id}/track",
|
|
21
|
+
getCustomerDetailsByShipmentId:
|
|
22
|
+
"/service/application/order/v1.0/orders/{order_id}/shipments/{shipment_id}/customer-details",
|
|
23
|
+
sendOtpToShipmentCustomer:
|
|
24
|
+
"/service/application/order/v1.0/orders/{order_id}/shipments/{shipment_id}/otp/send/",
|
|
25
|
+
verifyOtpShipmentCustomer:
|
|
26
|
+
"/service/application/order/v1.0/orders/{order_id}/shipments/{shipment_id}/otp/verify/",
|
|
27
|
+
getShipmentBagReasons:
|
|
28
|
+
"/service/application/order/v1.0/orders/shipments/{shipment_id}/bags/{bag_id}/reasons",
|
|
29
|
+
getShipmentReasons:
|
|
30
|
+
"/service/application/order/v1.0/orders/shipments/{shipment_id}/reasons",
|
|
31
|
+
updateShipmentStatus:
|
|
32
|
+
"/service/application/order/v1.0/orders/shipments/{shipment_id}/status",
|
|
33
|
+
};
|
|
34
|
+
this._urls = Object.entries(this._relativeUrls).reduce(
|
|
35
|
+
(urls, [method, relativeUrl]) => {
|
|
36
|
+
urls[method] = `${_conf.domain}${relativeUrl}`;
|
|
37
|
+
return urls;
|
|
38
|
+
},
|
|
39
|
+
{}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
updateUrls(urls) {
|
|
44
|
+
this._urls = {
|
|
45
|
+
...this._urls,
|
|
46
|
+
...urls,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param {Object} arg - Arg object.
|
|
52
|
+
* @param {number} [arg.status] - A filter to retrieve orders by their
|
|
53
|
+
* current status such as *placed*, *delivered*, etc.
|
|
54
|
+
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
55
|
+
* given set of results. Default value is 1.
|
|
56
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each
|
|
57
|
+
* page. Default value is 10.
|
|
58
|
+
* @param {string} [arg.fromDate] - The date from which the orders should be
|
|
59
|
+
* retrieved.
|
|
60
|
+
* @param {string} [arg.toDate] - The date till which the orders should be retrieved.
|
|
61
|
+
* @param {string} [arg.customMeta] - A filter and retrieve data using
|
|
62
|
+
* special fields included for special use-cases
|
|
63
|
+
* @returns {Promise<OrderList>} - Success response
|
|
64
|
+
* @summary: Get all orders
|
|
65
|
+
* @description: Use this API to retrieve all the orders.
|
|
66
|
+
*/
|
|
67
|
+
getOrders({ status, pageNo, pageSize, fromDate, toDate, customMeta } = {}) {
|
|
68
|
+
const { error } = OrderValidator.getOrders().validate(
|
|
69
|
+
{ status, pageNo, pageSize, fromDate, toDate, customMeta },
|
|
70
|
+
{ abortEarly: false, allowUnknown: true }
|
|
71
|
+
);
|
|
72
|
+
if (error) {
|
|
73
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
74
|
+
}
|
|
75
|
+
const query_params = {};
|
|
76
|
+
query_params["status"] = status;
|
|
77
|
+
query_params["page_no"] = pageNo;
|
|
78
|
+
query_params["page_size"] = pageSize;
|
|
79
|
+
query_params["from_date"] = fromDate;
|
|
80
|
+
query_params["to_date"] = toDate;
|
|
81
|
+
query_params["custom_meta"] = customMeta;
|
|
82
|
+
|
|
83
|
+
const xHeaders = {};
|
|
84
|
+
|
|
85
|
+
return APIClient.execute(
|
|
86
|
+
this._conf,
|
|
87
|
+
"get",
|
|
88
|
+
constructUrl({
|
|
89
|
+
url: this._urls["getOrders"],
|
|
90
|
+
params: {},
|
|
91
|
+
}),
|
|
92
|
+
query_params,
|
|
93
|
+
undefined,
|
|
94
|
+
xHeaders
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @param {Object} arg - Arg object.
|
|
100
|
+
* @param {string} arg.orderId - A unique number used for identifying and
|
|
101
|
+
* tracking your orders.
|
|
102
|
+
* @returns {Promise<OrderById>} - Success response
|
|
103
|
+
* @summary: Get details of an order
|
|
104
|
+
* @description: Use this API to retrieve order details such as tracking details, shipment, store information using Fynd Order ID.
|
|
105
|
+
*/
|
|
106
|
+
getOrderById({ orderId } = {}) {
|
|
107
|
+
const { error } = OrderValidator.getOrderById().validate(
|
|
108
|
+
{ orderId },
|
|
109
|
+
{ abortEarly: false, allowUnknown: true }
|
|
110
|
+
);
|
|
111
|
+
if (error) {
|
|
112
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
113
|
+
}
|
|
114
|
+
const query_params = {};
|
|
115
|
+
|
|
116
|
+
const xHeaders = {};
|
|
117
|
+
|
|
118
|
+
return APIClient.execute(
|
|
119
|
+
this._conf,
|
|
120
|
+
"get",
|
|
121
|
+
constructUrl({
|
|
122
|
+
url: this._urls["getOrderById"],
|
|
123
|
+
params: { orderId },
|
|
124
|
+
}),
|
|
125
|
+
query_params,
|
|
126
|
+
undefined,
|
|
127
|
+
xHeaders
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @param {Object} arg - Arg object.
|
|
133
|
+
* @param {string} arg.orderId - A unique number used for identifying and
|
|
134
|
+
* tracking your orders.
|
|
135
|
+
* @returns {Promise<OrderList>} - Success response
|
|
136
|
+
* @summary: Get POS Order
|
|
137
|
+
* @description: Use this API to retrieve a POS order and all its details such as tracking details, shipment, store information using Fynd Order ID.
|
|
138
|
+
*/
|
|
139
|
+
getPosOrderById({ orderId } = {}) {
|
|
140
|
+
const { error } = OrderValidator.getPosOrderById().validate(
|
|
141
|
+
{ orderId },
|
|
142
|
+
{ abortEarly: false, allowUnknown: true }
|
|
143
|
+
);
|
|
144
|
+
if (error) {
|
|
145
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
146
|
+
}
|
|
147
|
+
const query_params = {};
|
|
148
|
+
|
|
149
|
+
const xHeaders = {};
|
|
150
|
+
|
|
151
|
+
return APIClient.execute(
|
|
152
|
+
this._conf,
|
|
153
|
+
"get",
|
|
154
|
+
constructUrl({
|
|
155
|
+
url: this._urls["getPosOrderById"],
|
|
156
|
+
params: { orderId },
|
|
157
|
+
}),
|
|
158
|
+
query_params,
|
|
159
|
+
undefined,
|
|
160
|
+
xHeaders
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @param {Object} arg - Arg object.
|
|
166
|
+
* @param {string} arg.shipmentId - ID of the shipment. An order may contain
|
|
167
|
+
* multiple items and may get divided into one or more shipment, each
|
|
168
|
+
* having its own ID.
|
|
169
|
+
* @returns {Promise<ShipmentById>} - Success response
|
|
170
|
+
* @summary: Get details of a shipment
|
|
171
|
+
* @description: Use this API to retrieve shipment details such as price breakup, tracking details, store information, etc. using Shipment ID.
|
|
172
|
+
*/
|
|
173
|
+
getShipmentById({ shipmentId } = {}) {
|
|
174
|
+
const { error } = OrderValidator.getShipmentById().validate(
|
|
175
|
+
{ shipmentId },
|
|
176
|
+
{ abortEarly: false, allowUnknown: true }
|
|
177
|
+
);
|
|
178
|
+
if (error) {
|
|
179
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
180
|
+
}
|
|
181
|
+
const query_params = {};
|
|
182
|
+
|
|
183
|
+
const xHeaders = {};
|
|
184
|
+
|
|
185
|
+
return APIClient.execute(
|
|
186
|
+
this._conf,
|
|
187
|
+
"get",
|
|
188
|
+
constructUrl({
|
|
189
|
+
url: this._urls["getShipmentById"],
|
|
190
|
+
params: { shipmentId },
|
|
191
|
+
}),
|
|
192
|
+
query_params,
|
|
193
|
+
undefined,
|
|
194
|
+
xHeaders
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @param {Object} arg - Arg object.
|
|
200
|
+
* @param {string} arg.shipmentId - ID of the shipment.
|
|
201
|
+
* @returns {Promise<ResponseGetInvoiceShipment>} - Success response
|
|
202
|
+
* @summary: Get Invoice of a shipment
|
|
203
|
+
* @description: Use this API to retrieve shipment invoice.
|
|
204
|
+
*/
|
|
205
|
+
getInvoiceByShipmentId({ shipmentId } = {}) {
|
|
206
|
+
const { error } = OrderValidator.getInvoiceByShipmentId().validate(
|
|
207
|
+
{ shipmentId },
|
|
208
|
+
{ abortEarly: false, allowUnknown: true }
|
|
209
|
+
);
|
|
210
|
+
if (error) {
|
|
211
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
212
|
+
}
|
|
213
|
+
const query_params = {};
|
|
214
|
+
|
|
215
|
+
const xHeaders = {};
|
|
216
|
+
|
|
217
|
+
return APIClient.execute(
|
|
218
|
+
this._conf,
|
|
219
|
+
"get",
|
|
220
|
+
constructUrl({
|
|
221
|
+
url: this._urls["getInvoiceByShipmentId"],
|
|
222
|
+
params: { shipmentId },
|
|
223
|
+
}),
|
|
224
|
+
query_params,
|
|
225
|
+
undefined,
|
|
226
|
+
xHeaders
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* @param {Object} arg - Arg object.
|
|
232
|
+
* @param {string} arg.shipmentId - ID of the shipment. An order may contain
|
|
233
|
+
* multiple items and may get divided into one or more shipment, each
|
|
234
|
+
* having its own ID.
|
|
235
|
+
* @returns {Promise<ShipmentTrack>} - Success response
|
|
236
|
+
* @summary: Track shipment
|
|
237
|
+
* @description: Track Shipment by shipment id, for application based on application Id
|
|
238
|
+
*/
|
|
239
|
+
trackShipment({ shipmentId } = {}) {
|
|
240
|
+
const { error } = OrderValidator.trackShipment().validate(
|
|
241
|
+
{ shipmentId },
|
|
242
|
+
{ abortEarly: false, allowUnknown: true }
|
|
243
|
+
);
|
|
244
|
+
if (error) {
|
|
245
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
246
|
+
}
|
|
247
|
+
const query_params = {};
|
|
248
|
+
|
|
249
|
+
const xHeaders = {};
|
|
250
|
+
|
|
251
|
+
return APIClient.execute(
|
|
252
|
+
this._conf,
|
|
253
|
+
"get",
|
|
254
|
+
constructUrl({
|
|
255
|
+
url: this._urls["trackShipment"],
|
|
256
|
+
params: { shipmentId },
|
|
257
|
+
}),
|
|
258
|
+
query_params,
|
|
259
|
+
undefined,
|
|
260
|
+
xHeaders
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* @param {Object} arg - Arg object.
|
|
266
|
+
* @param {string} arg.orderId - ID of the shipment. An order may contain
|
|
267
|
+
* multiple items and may get divided into one or more shipment, each
|
|
268
|
+
* having its own ID.
|
|
269
|
+
* @param {string} arg.shipmentId - A unique number used for identifying and
|
|
270
|
+
* tracking your orders.
|
|
271
|
+
* @returns {Promise<CustomerDetailsResponse>} - Success response
|
|
272
|
+
* @summary: Get Customer Details by Shipment Id
|
|
273
|
+
* @description: Use this API to retrieve customer details such as mobileno using Shipment ID.
|
|
274
|
+
*/
|
|
275
|
+
getCustomerDetailsByShipmentId({ orderId, shipmentId } = {}) {
|
|
276
|
+
const { error } = OrderValidator.getCustomerDetailsByShipmentId().validate(
|
|
277
|
+
{ orderId, shipmentId },
|
|
278
|
+
{ abortEarly: false, allowUnknown: true }
|
|
279
|
+
);
|
|
280
|
+
if (error) {
|
|
281
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
282
|
+
}
|
|
283
|
+
const query_params = {};
|
|
284
|
+
|
|
285
|
+
const xHeaders = {};
|
|
286
|
+
|
|
287
|
+
return APIClient.execute(
|
|
288
|
+
this._conf,
|
|
289
|
+
"get",
|
|
290
|
+
constructUrl({
|
|
291
|
+
url: this._urls["getCustomerDetailsByShipmentId"],
|
|
292
|
+
params: { orderId, shipmentId },
|
|
293
|
+
}),
|
|
294
|
+
query_params,
|
|
295
|
+
undefined,
|
|
296
|
+
xHeaders
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* @param {Object} arg - Arg object.
|
|
302
|
+
* @param {string} arg.orderId - A unique number used for identifying and
|
|
303
|
+
* tracking your orders.
|
|
304
|
+
* @param {string} arg.shipmentId - ID of the shipment. An order may contain
|
|
305
|
+
* multiple items and may get divided into one or more shipment, each
|
|
306
|
+
* having its own ID.
|
|
307
|
+
* @returns {Promise<SendOtpToCustomerResponse>} - Success response
|
|
308
|
+
* @summary: Send and Resend Otp code to Order-Shipment customer
|
|
309
|
+
* @description: Use this API to send OTP to the customer of the mapped Shipment.
|
|
310
|
+
*/
|
|
311
|
+
sendOtpToShipmentCustomer({ orderId, shipmentId } = {}) {
|
|
312
|
+
const { error } = OrderValidator.sendOtpToShipmentCustomer().validate(
|
|
313
|
+
{ orderId, shipmentId },
|
|
314
|
+
{ abortEarly: false, allowUnknown: true }
|
|
315
|
+
);
|
|
316
|
+
if (error) {
|
|
317
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
318
|
+
}
|
|
319
|
+
const query_params = {};
|
|
320
|
+
|
|
321
|
+
const xHeaders = {};
|
|
322
|
+
|
|
323
|
+
return APIClient.execute(
|
|
324
|
+
this._conf,
|
|
325
|
+
"post",
|
|
326
|
+
constructUrl({
|
|
327
|
+
url: this._urls["sendOtpToShipmentCustomer"],
|
|
328
|
+
params: { orderId, shipmentId },
|
|
329
|
+
}),
|
|
330
|
+
query_params,
|
|
331
|
+
undefined,
|
|
332
|
+
xHeaders
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* @param {Object} arg - Arg object.
|
|
338
|
+
* @param {string} arg.orderId - A unique number used for identifying and
|
|
339
|
+
* tracking your orders.
|
|
340
|
+
* @param {string} arg.shipmentId - ID of the shipment. An order may contain
|
|
341
|
+
* multiple items and may get divided into one or more shipment, each
|
|
342
|
+
* having its own ID.
|
|
343
|
+
* @param {VerifyOtp} arg.body
|
|
344
|
+
* @returns {Promise<VerifyOtpResponse>} - Success response
|
|
345
|
+
* @summary: Verify Otp code
|
|
346
|
+
* @description: Use this API to verify OTP and create a session token with custom payload.
|
|
347
|
+
*/
|
|
348
|
+
verifyOtpShipmentCustomer({ orderId, shipmentId, body } = {}) {
|
|
349
|
+
const { error } = OrderValidator.verifyOtpShipmentCustomer().validate(
|
|
350
|
+
{ orderId, shipmentId, body },
|
|
351
|
+
{ abortEarly: false, allowUnknown: true }
|
|
352
|
+
);
|
|
353
|
+
if (error) {
|
|
354
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
355
|
+
}
|
|
356
|
+
const query_params = {};
|
|
357
|
+
|
|
358
|
+
const xHeaders = {};
|
|
359
|
+
|
|
360
|
+
return APIClient.execute(
|
|
361
|
+
this._conf,
|
|
362
|
+
"post",
|
|
363
|
+
constructUrl({
|
|
364
|
+
url: this._urls["verifyOtpShipmentCustomer"],
|
|
365
|
+
params: { orderId, shipmentId },
|
|
366
|
+
}),
|
|
367
|
+
query_params,
|
|
368
|
+
body,
|
|
369
|
+
xHeaders
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* @param {Object} arg - Arg object.
|
|
375
|
+
* @param {string} arg.shipmentId - ID of the bag. An order may contain
|
|
376
|
+
* multiple items and may get divided into one or more shipment, each
|
|
377
|
+
* having its own ID.
|
|
378
|
+
* @param {string} arg.bagId - ID of the bag. An order may contain multiple
|
|
379
|
+
* items and may get divided into one or more shipment, each having its own ID.
|
|
380
|
+
* @returns {Promise<ShipmentBagReasons>} - Success response
|
|
381
|
+
* @summary: Get reasons behind full or partial cancellation of a shipment
|
|
382
|
+
* @description: Use this API to retrieve the issues that led to the cancellation of bags within a shipment.
|
|
383
|
+
*/
|
|
384
|
+
getShipmentBagReasons({ shipmentId, bagId } = {}) {
|
|
385
|
+
const { error } = OrderValidator.getShipmentBagReasons().validate(
|
|
386
|
+
{ shipmentId, bagId },
|
|
387
|
+
{ abortEarly: false, allowUnknown: true }
|
|
388
|
+
);
|
|
389
|
+
if (error) {
|
|
390
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
391
|
+
}
|
|
392
|
+
const query_params = {};
|
|
393
|
+
|
|
394
|
+
const xHeaders = {};
|
|
395
|
+
|
|
396
|
+
return APIClient.execute(
|
|
397
|
+
this._conf,
|
|
398
|
+
"get",
|
|
399
|
+
constructUrl({
|
|
400
|
+
url: this._urls["getShipmentBagReasons"],
|
|
401
|
+
params: { shipmentId, bagId },
|
|
402
|
+
}),
|
|
403
|
+
query_params,
|
|
404
|
+
undefined,
|
|
405
|
+
xHeaders
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* @param {Object} arg - Arg object.
|
|
411
|
+
* @param {string} arg.shipmentId - ID of the shipment. An order may contain
|
|
412
|
+
* multiple items and may get divided into one or more shipment, each
|
|
413
|
+
* having its own ID.
|
|
414
|
+
* @returns {Promise<ShipmentReasons>} - Success response
|
|
415
|
+
* @summary: Get reasons behind full or partial cancellation of a shipment
|
|
416
|
+
* @description: Use this API to retrieve the issues that led to the cancellation of bags within a shipment.
|
|
417
|
+
*/
|
|
418
|
+
getShipmentReasons({ shipmentId } = {}) {
|
|
419
|
+
const { error } = OrderValidator.getShipmentReasons().validate(
|
|
420
|
+
{ shipmentId },
|
|
421
|
+
{ abortEarly: false, allowUnknown: true }
|
|
422
|
+
);
|
|
423
|
+
if (error) {
|
|
424
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
425
|
+
}
|
|
426
|
+
const query_params = {};
|
|
427
|
+
|
|
428
|
+
const xHeaders = {};
|
|
429
|
+
|
|
430
|
+
return APIClient.execute(
|
|
431
|
+
this._conf,
|
|
432
|
+
"get",
|
|
433
|
+
constructUrl({
|
|
434
|
+
url: this._urls["getShipmentReasons"],
|
|
435
|
+
params: { shipmentId },
|
|
436
|
+
}),
|
|
437
|
+
query_params,
|
|
438
|
+
undefined,
|
|
439
|
+
xHeaders
|
|
440
|
+
);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* @param {Object} arg - Arg object.
|
|
445
|
+
* @param {string} arg.shipmentId - ID of the shipment. An order may contain
|
|
446
|
+
* multiple items and may get divided into one or more shipment, each
|
|
447
|
+
* having its own ID.
|
|
448
|
+
* @param {UpdateShipmentStatusRequest} arg.body
|
|
449
|
+
* @returns {Promise<ShipmentApplicationStatusResponse>} - Success response
|
|
450
|
+
* @summary: Update the shipment status
|
|
451
|
+
* @description: Use this API to update the status of a shipment using its shipment ID.
|
|
452
|
+
*/
|
|
453
|
+
updateShipmentStatus({ shipmentId, body } = {}) {
|
|
454
|
+
const { error } = OrderValidator.updateShipmentStatus().validate(
|
|
455
|
+
{ shipmentId, body },
|
|
456
|
+
{ abortEarly: false, allowUnknown: true }
|
|
457
|
+
);
|
|
458
|
+
if (error) {
|
|
459
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
460
|
+
}
|
|
461
|
+
const query_params = {};
|
|
462
|
+
|
|
463
|
+
const xHeaders = {};
|
|
464
|
+
|
|
465
|
+
return APIClient.execute(
|
|
466
|
+
this._conf,
|
|
467
|
+
"put",
|
|
468
|
+
constructUrl({
|
|
469
|
+
url: this._urls["updateShipmentStatus"],
|
|
470
|
+
params: { shipmentId },
|
|
471
|
+
}),
|
|
472
|
+
query_params,
|
|
473
|
+
body,
|
|
474
|
+
xHeaders
|
|
475
|
+
);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
module.exports = Order;
|