@djust-b2b/djust-front-sdk 1.11.1 → 1.13.0
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/lib/index.d.ts +12 -4
- package/lib/index.js +2 -0
- package/lib/interfaces/models/incident.d.ts +29 -0
- package/lib/interfaces/models/incident.js +2 -0
- package/lib/interfaces/models/offer.d.ts +1 -1
- package/lib/interfaces/models/quote.d.ts +13 -1
- package/lib/services/auth/index.d.ts +119 -4
- package/lib/services/auth/index.js +119 -4
- package/lib/services/customer-user/definitions.d.ts +0 -3
- package/lib/services/customer-user/index.d.ts +263 -14
- package/lib/services/customer-user/index.js +264 -20
- package/lib/services/incident/definitions.d.ts +68 -0
- package/lib/services/incident/definitions.js +2 -0
- package/lib/services/incident/index.d.ts +222 -0
- package/lib/services/incident/index.js +311 -0
- package/lib/services/quote/definitions.d.ts +25 -1
- package/lib/services/quote/index.d.ts +349 -10
- package/lib/services/quote/index.js +382 -11
- package/lib/services/supplier/definitions.d.ts +3 -0
- package/lib/services/supplier/index.d.ts +92 -4
- package/lib/services/supplier/index.js +96 -5
- package/package.json +1 -1
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { getOrderLogisticIncidentsParameters, getOrderLogisticIncidentParameters, getOrderLogisticLineIncidentsParameters, createOrderLogisticIncidentParameters, createOrderLogisticLineIncidentParameters, getCustomerAccountIncidentsParameters, getOrderLogisticIncidentsResponse, getOrderLogisticIncidentResponse, getOrderLogisticLineIncidentsResponse, createOrderLogisticIncidentResponse, createOrderLogisticLineIncidentResponse, getCustomerAccountIncidentsResponse } from "./definitions";
|
|
2
|
+
/**
|
|
3
|
+
* 🚚 Fetches logistic order incidents.
|
|
4
|
+
*
|
|
5
|
+
* This function retrieves a paginated list of incidents for a specific logistic order,
|
|
6
|
+
* filtered by status and other parameters. The `logisticOrderId` parameter is mandatory
|
|
7
|
+
* and validated before the request is executed.
|
|
8
|
+
*
|
|
9
|
+
* 🛠 **Endpoint**: `GET /v1/shop/logistic-orders/{logisticOrderId}/incidents [ORDER-557]`
|
|
10
|
+
*
|
|
11
|
+
* | Parameter | Type | Required | Description |
|
|
12
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
13
|
+
* | `logisticOrderId` | `string` | ✅ | The ID of the logistic order to fetch incidents for. |
|
|
14
|
+
* | `status` | `IncidentStatus[]` | ❌ | Array of statuses to filter incidents (e.g., `["OPEN"]`). |
|
|
15
|
+
* | `idType` | `IncidentIdType` | ❌ | Specifies whether the ID is internal (`DJUST_ID`) or external (`EXTERNAL_ID`). |
|
|
16
|
+
* | `page` | `number` | ❌ | The page number for pagination. |
|
|
17
|
+
* | `size` | `number` | ❌ | The number of results per page. |
|
|
18
|
+
* | `sort` | `String[]` | ❌ | Sorting criteria (e.g., `["createdAt,desc"]`). |
|
|
19
|
+
*
|
|
20
|
+
* 📤 **Returns**:
|
|
21
|
+
* A `Promise` resolving to an array of `IncidentDto` objects representing the incidents.
|
|
22
|
+
*
|
|
23
|
+
* 🛠 **Example usage**:
|
|
24
|
+
* ```ts
|
|
25
|
+
* const incidents = await getOrderLogisticIncidents({
|
|
26
|
+
* logisticOrderId: "12345",
|
|
27
|
+
* status: ["OPEN", "CLOSED"],
|
|
28
|
+
* idType: "EXTERNAL_ID",
|
|
29
|
+
* page: 1,
|
|
30
|
+
* size: 10,
|
|
31
|
+
* sort: ["createdAt,desc"],
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @param {getOrderLogisticIncidentsParameters} params - The parameters for the request.
|
|
36
|
+
* @throws {Error} If `logisticOrderId` is missing.
|
|
37
|
+
* @returns {Promise<getOrderLogisticIncidentsResponse>} A promise resolving to the response containing the incidents.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getOrderLogisticIncidents({ logisticOrderId, status, idType, page, size, sort, }: getOrderLogisticIncidentsParameters): Promise<getOrderLogisticIncidentsResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* 🚚 Fetches a specific logistic order incident.
|
|
42
|
+
*
|
|
43
|
+
* This function retrieves a specific incident for a logistic order, identified by both
|
|
44
|
+
* the `logisticOrderId` and `incidentId`. Both parameters are mandatory and validated
|
|
45
|
+
* before the request is executed.
|
|
46
|
+
*
|
|
47
|
+
* 🛠 **Endpoint**: `GET /v1/shop/logistic-orders/{logisticOrderId}/incidents/{incidentId} [ORDER-503]`
|
|
48
|
+
*
|
|
49
|
+
* | Parameter | Type | Required | Description |
|
|
50
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
51
|
+
* | `logisticOrderId` | `string` | ✅ | The ID of the logistic order to fetch the incident for. |
|
|
52
|
+
* | `incidentId` | `string` | ✅ | The ID of the specific incident to fetch. |
|
|
53
|
+
* | `idType` | `IncidentIdType` | ❌ | Specifies whether the ID is internal (`DJUST_ID`) or external (`EXTERNAL_ID`). |
|
|
54
|
+
*
|
|
55
|
+
* 📤 **Returns**:
|
|
56
|
+
* A `Promise` resolving to a single `getOrderLogisticIncidentResponse` object representing the incident.
|
|
57
|
+
*
|
|
58
|
+
* 🛠 **Example usage**:
|
|
59
|
+
* ```ts
|
|
60
|
+
* const incident = await getOrderLogisticIncident({
|
|
61
|
+
* logisticOrderId: "12345",
|
|
62
|
+
* incidentId: "incident_1",
|
|
63
|
+
* idType: "EXTERNAL_ID",
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @param {getOrderLogisticIncidentParameters} params - The parameters for the request.
|
|
68
|
+
* @throws {Error} If `logisticOrderId` or `incidentId` is missing.
|
|
69
|
+
* @returns {Promise<getOrderLogisticIncidentResponse>} A promise resolving to the response containing the incident.
|
|
70
|
+
*/
|
|
71
|
+
export declare function getOrderLogisticIncident({ logisticOrderId, incidentId, idType, }: getOrderLogisticIncidentParameters): Promise<getOrderLogisticIncidentResponse>;
|
|
72
|
+
/**
|
|
73
|
+
* 🚚 Fetches incidents for a specific line of a logistic order.
|
|
74
|
+
*
|
|
75
|
+
* This function retrieves a list of incidents for a specific line in a logistic order,
|
|
76
|
+
* filtered by status and other parameters. The `logisticOrderId` and `lineId` parameters
|
|
77
|
+
* are mandatory and validated before the request is executed.
|
|
78
|
+
*
|
|
79
|
+
* 🛠 **Endpoint**: `GET /v1/shop/logistic-orders/{logisticOrderId}/incidents/lines/{lineId} [ORDER-559]`
|
|
80
|
+
*
|
|
81
|
+
* | Parameter | Type | Required | Description |
|
|
82
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
83
|
+
* | `logisticOrderId` | `string` | ✅ | The ID of the logistic order to fetch incidents for. |
|
|
84
|
+
* | `lineId` | `string` | ✅ | The ID of the line in the logistic order to fetch incidents for. |
|
|
85
|
+
* | `status` | `IncidentStatus[]` | ❌ | Array of statuses to filter incidents (e.g., `["OPEN"]`). |
|
|
86
|
+
* | `idType` | `IncidentIdType` | ❌ | Specifies whether the ID is internal (`DJUST_ID`) or external (`EXTERNAL_ID`). |
|
|
87
|
+
* | `page` | `number` | ❌ | The page number for pagination. |
|
|
88
|
+
* | `size` | `number` | ❌ | The number of results per page. |
|
|
89
|
+
* | `sort` | `String[]` | ❌ | Sorting criteria (e.g., `["createdAt,desc"]`). |
|
|
90
|
+
*
|
|
91
|
+
* 📤 **Returns**:
|
|
92
|
+
* A `Promise` resolving to an array of `getOrderLogisticLineIncidentsResponse` objects representing the incidents.
|
|
93
|
+
*
|
|
94
|
+
* 🛠 **Example usage**:
|
|
95
|
+
* ```ts
|
|
96
|
+
* const incidents = await getOrderLogisticLineIncidents({
|
|
97
|
+
* logisticOrderId: "12345",
|
|
98
|
+
* lineId: "line_1",
|
|
99
|
+
* status: ["OPEN"],
|
|
100
|
+
* idType: "EXTERNAL_ID",
|
|
101
|
+
* page: 1,
|
|
102
|
+
* size: 10,
|
|
103
|
+
* sort: ["createdAt,desc"],
|
|
104
|
+
* });
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @param {getOrderLogisticLineIncidentsParameters} params - The parameters for the request.
|
|
108
|
+
* @throws {Error} If `logisticOrderId` or `lineId` is missing.
|
|
109
|
+
* @returns {Promise<getOrderLogisticLineIncidentsResponse>} A promise resolving to the response containing the incidents.
|
|
110
|
+
*/
|
|
111
|
+
export declare function getOrderLogisticLineIncidents({ logisticOrderId, lineId, status, idType, page, size, sort, }: getOrderLogisticLineIncidentsParameters): Promise<getOrderLogisticLineIncidentsResponse>;
|
|
112
|
+
/**
|
|
113
|
+
* 🚚 Creates a new incident for a specific logistic order.
|
|
114
|
+
*
|
|
115
|
+
* This function allows the creation of an incident for a given logistic order,
|
|
116
|
+
* requiring essential parameters like the `logisticOrderId` and `reasonCode`.
|
|
117
|
+
* The `customField` and `idType` are used to provide additional information for the incident creation.
|
|
118
|
+
*
|
|
119
|
+
* 🛠 **Endpoint**: `POST /v1/shop/logistic-orders/{logisticOrderId}/incidents [ORDER-101]`
|
|
120
|
+
*
|
|
121
|
+
* | Parameter | Type | Required | Description |
|
|
122
|
+
* |------------------|-------------------------------------|------------|----------------------------------------------------------|
|
|
123
|
+
* | `logisticOrderId`| `string` | ✅ | The ID of the logistic order for which the incident is created. |
|
|
124
|
+
* | `idType` | `IncidentIdType` | ❌ | The type of incident ID (e.g., `DJUST_ID`, `EXTERNAL_ID`). |
|
|
125
|
+
* | `customField` | `{ customFieldValues: CustomFieldValueRequest[], idType: IncidentIdType }` | ❌ | The custom field data for the incident, including custom field values and ID type. |
|
|
126
|
+
* | `reasonCode` | `string[]` | ✅ | The reason codes for the incident (e.g., `["PRODUCT_DEFECT"]`). |
|
|
127
|
+
*
|
|
128
|
+
* 📤 **Returns**:
|
|
129
|
+
* A `Promise` resolving to a `createOrderLogisticIncidentResponse` object,
|
|
130
|
+
* containing the `incidentId` and `externalId` of the created incident.
|
|
131
|
+
*
|
|
132
|
+
* 🛠 **Example usage**:
|
|
133
|
+
* ```ts
|
|
134
|
+
* const incident = await createOrderLogisticIncident({
|
|
135
|
+
* logisticOrderId: "12345",
|
|
136
|
+
* idType: "EXTERNAL_ID",
|
|
137
|
+
* customField: { customFieldValues: [], idType: "EXTERNAL_ID" },
|
|
138
|
+
* reasonCode: ["PRODUCT_DEFECT"]
|
|
139
|
+
* });
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* @param {createOrderLogisticIncidentParameters} params - The parameters for creating the incident.
|
|
143
|
+
* @throws {Error} If `logisticOrderId` or `reasonCode` is missing.
|
|
144
|
+
* @returns {Promise<createOrderLogisticIncidentResponse>} A promise resolving to the response containing the created incident's details.
|
|
145
|
+
*/
|
|
146
|
+
export declare function createOrderLogisticIncident({ logisticOrderId, idType, customField, reasonCode, }: createOrderLogisticIncidentParameters): Promise<createOrderLogisticIncidentResponse>;
|
|
147
|
+
/**
|
|
148
|
+
* 🚚 Creates a new incident for a specific line within a logistic order.
|
|
149
|
+
*
|
|
150
|
+
* This function allows the creation of an incident for one or more lines within a logistic order.
|
|
151
|
+
* The `logisticOrderId`, `reasonCode`, and `orderLines` are required parameters.
|
|
152
|
+
* The `customFieldIdType` and `idType` are used for specifying additional information about the incident.
|
|
153
|
+
*
|
|
154
|
+
* 🛠 **Endpoint**: `POST /v1/shop/logistic-orders/{logisticOrderId}/lines/incidents [ORDER-102]`
|
|
155
|
+
*
|
|
156
|
+
* | Parameter | Type | Required | Description |
|
|
157
|
+
* |--------------------|-------------------------------------|------------|----------------------------------------------------------|
|
|
158
|
+
* | `logisticOrderId` | `string` | ✅ | The ID of the logistic order for which the line incident is created. |
|
|
159
|
+
* | `idType` | `IncidentIdType` | ❌ | The type of incident ID (e.g., `DJUST_ID`, `EXTERNAL_ID`). |
|
|
160
|
+
* | `customFieldIdType`| `IncidentIdType` | ❌ | The ID type for custom field values (e.g., `EXTERNAL_ID`). |
|
|
161
|
+
* | `orderLines` | `{ customFieldValues: CustomFieldValueRequest[], lineId: string, quantity: number }[]` | ✅ | An array of objects describing the order lines, including custom field values, line ID, and quantity. |
|
|
162
|
+
* | `reasonCode` | `string[]` | ✅ | The reason codes for the incident (e.g., `["PRODUCT_DEFECT"]`). |
|
|
163
|
+
*
|
|
164
|
+
* 📤 **Returns**:
|
|
165
|
+
* A `Promise` resolving to a `createOrderLogisticLineIncidentResponse` object,
|
|
166
|
+
* containing the `incidentId` and `externalId` of the created incident.
|
|
167
|
+
*
|
|
168
|
+
* 🛠 **Example usage**:
|
|
169
|
+
* ```ts
|
|
170
|
+
* const incident = await createOrderLogisticLineIncident({
|
|
171
|
+
* logisticOrderId: "12345",
|
|
172
|
+
* idType: "EXTERNAL_ID",
|
|
173
|
+
* customFieldIdType: "DJUST_ID",
|
|
174
|
+
* orderLines: [
|
|
175
|
+
* { customFieldValues: [], lineId: "line_1", quantity: 2 }
|
|
176
|
+
* ],
|
|
177
|
+
* reasonCode: ["PRODUCT_DEFECT"]
|
|
178
|
+
* });
|
|
179
|
+
* ```
|
|
180
|
+
*
|
|
181
|
+
* @param {createOrderLogisticLineIncidentParameters} params - The parameters for creating the incident.
|
|
182
|
+
* @throws {Error} If `logisticOrderId`, `reasonCode`, or `orderLines` is missing.
|
|
183
|
+
* @returns {Promise<createOrderLogisticLineIncidentResponse>} A promise resolving to the response containing the created incident's details.
|
|
184
|
+
*/
|
|
185
|
+
export declare function createOrderLogisticLineIncident({ logisticOrderId, idType, customFieldIdType, orderLines, reasonCode, }: createOrderLogisticLineIncidentParameters): Promise<createOrderLogisticLineIncidentResponse>;
|
|
186
|
+
/**
|
|
187
|
+
* 🧑💼 Fetches incidents for a specific customer account.
|
|
188
|
+
*
|
|
189
|
+
* This function retrieves incidents associated with a particular customer account,
|
|
190
|
+
* using parameters such as `status`, `page`, `size`, and `sort` to filter and paginate the results.
|
|
191
|
+
* The `customerAccountId` is a mandatory parameter and is validated before making the request.
|
|
192
|
+
*
|
|
193
|
+
* 🛠 **Endpoint**: `GET /v1/shop/customer-accounts/{customerAccountId}/incidents [ACCOUNT-551]`
|
|
194
|
+
*
|
|
195
|
+
* | Parameter | Type | Required | Description |
|
|
196
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
197
|
+
* | `customerAccountId`| `string` | ✅ | The ID of the customer account for which incidents are to be fetched. |
|
|
198
|
+
* | `status` | `IncidentStatus[]` | ❌ | Array of statuses to filter incidents by (e.g., `["OPEN"]`). |
|
|
199
|
+
* | `page` | `number` | ❌ | The page number for pagination. |
|
|
200
|
+
* | `size` | `number` | ❌ | The number of results per page. |
|
|
201
|
+
* | `sort` | `string[]` | ❌ | Sorting criteria (e.g., `["createdAt,desc"]`). |
|
|
202
|
+
*
|
|
203
|
+
* 📤 **Returns**:
|
|
204
|
+
* A `Promise` resolving to an array of `getCustomerAccountIncidentsResponse` objects,
|
|
205
|
+
* representing the incidents for the given customer account.
|
|
206
|
+
*
|
|
207
|
+
* 🛠 **Example usage**:
|
|
208
|
+
* ```ts
|
|
209
|
+
* const incidents = await getCustomerAccountIncidents({
|
|
210
|
+
* customerAccountId: "98765",
|
|
211
|
+
* status: ["OPEN"],
|
|
212
|
+
* page: 1,
|
|
213
|
+
* size: 10,
|
|
214
|
+
* sort: ["createdAt,desc"],
|
|
215
|
+
* });
|
|
216
|
+
* ```
|
|
217
|
+
*
|
|
218
|
+
* @param {getCustomerAccountIncidentsParameters} params - The parameters for the request.
|
|
219
|
+
* @throws {Error} If `customerAccountId` is missing.
|
|
220
|
+
* @returns {Promise<getCustomerAccountIncidentsResponse>} A promise resolving to the incidents response.
|
|
221
|
+
*/
|
|
222
|
+
export declare function getCustomerAccountIncidents({ customerAccountId, status, page, size, sort, }: getCustomerAccountIncidentsParameters): Promise<getCustomerAccountIncidentsResponse>;
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOrderLogisticIncidents = getOrderLogisticIncidents;
|
|
4
|
+
exports.getOrderLogisticIncident = getOrderLogisticIncident;
|
|
5
|
+
exports.getOrderLogisticLineIncidents = getOrderLogisticLineIncidents;
|
|
6
|
+
exports.createOrderLogisticIncident = createOrderLogisticIncident;
|
|
7
|
+
exports.createOrderLogisticLineIncident = createOrderLogisticLineIncident;
|
|
8
|
+
exports.getCustomerAccountIncidents = getCustomerAccountIncidents;
|
|
9
|
+
const parameters_validation_1 = require("../../helpers/parameters-validation");
|
|
10
|
+
const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
11
|
+
/**
|
|
12
|
+
* 🚚 Fetches logistic order incidents.
|
|
13
|
+
*
|
|
14
|
+
* This function retrieves a paginated list of incidents for a specific logistic order,
|
|
15
|
+
* filtered by status and other parameters. The `logisticOrderId` parameter is mandatory
|
|
16
|
+
* and validated before the request is executed.
|
|
17
|
+
*
|
|
18
|
+
* 🛠 **Endpoint**: `GET /v1/shop/logistic-orders/{logisticOrderId}/incidents [ORDER-557]`
|
|
19
|
+
*
|
|
20
|
+
* | Parameter | Type | Required | Description |
|
|
21
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
22
|
+
* | `logisticOrderId` | `string` | ✅ | The ID of the logistic order to fetch incidents for. |
|
|
23
|
+
* | `status` | `IncidentStatus[]` | ❌ | Array of statuses to filter incidents (e.g., `["OPEN"]`). |
|
|
24
|
+
* | `idType` | `IncidentIdType` | ❌ | Specifies whether the ID is internal (`DJUST_ID`) or external (`EXTERNAL_ID`). |
|
|
25
|
+
* | `page` | `number` | ❌ | The page number for pagination. |
|
|
26
|
+
* | `size` | `number` | ❌ | The number of results per page. |
|
|
27
|
+
* | `sort` | `String[]` | ❌ | Sorting criteria (e.g., `["createdAt,desc"]`). |
|
|
28
|
+
*
|
|
29
|
+
* 📤 **Returns**:
|
|
30
|
+
* A `Promise` resolving to an array of `IncidentDto` objects representing the incidents.
|
|
31
|
+
*
|
|
32
|
+
* 🛠 **Example usage**:
|
|
33
|
+
* ```ts
|
|
34
|
+
* const incidents = await getOrderLogisticIncidents({
|
|
35
|
+
* logisticOrderId: "12345",
|
|
36
|
+
* status: ["OPEN", "CLOSED"],
|
|
37
|
+
* idType: "EXTERNAL_ID",
|
|
38
|
+
* page: 1,
|
|
39
|
+
* size: 10,
|
|
40
|
+
* sort: ["createdAt,desc"],
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @param {getOrderLogisticIncidentsParameters} params - The parameters for the request.
|
|
45
|
+
* @throws {Error} If `logisticOrderId` is missing.
|
|
46
|
+
* @returns {Promise<getOrderLogisticIncidentsResponse>} A promise resolving to the response containing the incidents.
|
|
47
|
+
*/
|
|
48
|
+
async function getOrderLogisticIncidents({ logisticOrderId, status, idType, page, size, sort, }) {
|
|
49
|
+
(0, parameters_validation_1.required)({ logisticOrderId });
|
|
50
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
51
|
+
method: "GET",
|
|
52
|
+
path: `/v1/shop/logistic-orders/${logisticOrderId}/incidents`,
|
|
53
|
+
params: {
|
|
54
|
+
status,
|
|
55
|
+
idType,
|
|
56
|
+
page,
|
|
57
|
+
size,
|
|
58
|
+
sort,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* 🚚 Fetches a specific logistic order incident.
|
|
65
|
+
*
|
|
66
|
+
* This function retrieves a specific incident for a logistic order, identified by both
|
|
67
|
+
* the `logisticOrderId` and `incidentId`. Both parameters are mandatory and validated
|
|
68
|
+
* before the request is executed.
|
|
69
|
+
*
|
|
70
|
+
* 🛠 **Endpoint**: `GET /v1/shop/logistic-orders/{logisticOrderId}/incidents/{incidentId} [ORDER-503]`
|
|
71
|
+
*
|
|
72
|
+
* | Parameter | Type | Required | Description |
|
|
73
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
74
|
+
* | `logisticOrderId` | `string` | ✅ | The ID of the logistic order to fetch the incident for. |
|
|
75
|
+
* | `incidentId` | `string` | ✅ | The ID of the specific incident to fetch. |
|
|
76
|
+
* | `idType` | `IncidentIdType` | ❌ | Specifies whether the ID is internal (`DJUST_ID`) or external (`EXTERNAL_ID`). |
|
|
77
|
+
*
|
|
78
|
+
* 📤 **Returns**:
|
|
79
|
+
* A `Promise` resolving to a single `getOrderLogisticIncidentResponse` object representing the incident.
|
|
80
|
+
*
|
|
81
|
+
* 🛠 **Example usage**:
|
|
82
|
+
* ```ts
|
|
83
|
+
* const incident = await getOrderLogisticIncident({
|
|
84
|
+
* logisticOrderId: "12345",
|
|
85
|
+
* incidentId: "incident_1",
|
|
86
|
+
* idType: "EXTERNAL_ID",
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @param {getOrderLogisticIncidentParameters} params - The parameters for the request.
|
|
91
|
+
* @throws {Error} If `logisticOrderId` or `incidentId` is missing.
|
|
92
|
+
* @returns {Promise<getOrderLogisticIncidentResponse>} A promise resolving to the response containing the incident.
|
|
93
|
+
*/
|
|
94
|
+
async function getOrderLogisticIncident({ logisticOrderId, incidentId, idType, }) {
|
|
95
|
+
(0, parameters_validation_1.required)({ logisticOrderId, incidentId });
|
|
96
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
97
|
+
method: "GET",
|
|
98
|
+
path: `/v1/shop/logistic-orders/${logisticOrderId}/incidents/${incidentId}`,
|
|
99
|
+
params: {
|
|
100
|
+
idType,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
return data;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* 🚚 Fetches incidents for a specific line of a logistic order.
|
|
107
|
+
*
|
|
108
|
+
* This function retrieves a list of incidents for a specific line in a logistic order,
|
|
109
|
+
* filtered by status and other parameters. The `logisticOrderId` and `lineId` parameters
|
|
110
|
+
* are mandatory and validated before the request is executed.
|
|
111
|
+
*
|
|
112
|
+
* 🛠 **Endpoint**: `GET /v1/shop/logistic-orders/{logisticOrderId}/incidents/lines/{lineId} [ORDER-559]`
|
|
113
|
+
*
|
|
114
|
+
* | Parameter | Type | Required | Description |
|
|
115
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
116
|
+
* | `logisticOrderId` | `string` | ✅ | The ID of the logistic order to fetch incidents for. |
|
|
117
|
+
* | `lineId` | `string` | ✅ | The ID of the line in the logistic order to fetch incidents for. |
|
|
118
|
+
* | `status` | `IncidentStatus[]` | ❌ | Array of statuses to filter incidents (e.g., `["OPEN"]`). |
|
|
119
|
+
* | `idType` | `IncidentIdType` | ❌ | Specifies whether the ID is internal (`DJUST_ID`) or external (`EXTERNAL_ID`). |
|
|
120
|
+
* | `page` | `number` | ❌ | The page number for pagination. |
|
|
121
|
+
* | `size` | `number` | ❌ | The number of results per page. |
|
|
122
|
+
* | `sort` | `String[]` | ❌ | Sorting criteria (e.g., `["createdAt,desc"]`). |
|
|
123
|
+
*
|
|
124
|
+
* 📤 **Returns**:
|
|
125
|
+
* A `Promise` resolving to an array of `getOrderLogisticLineIncidentsResponse` objects representing the incidents.
|
|
126
|
+
*
|
|
127
|
+
* 🛠 **Example usage**:
|
|
128
|
+
* ```ts
|
|
129
|
+
* const incidents = await getOrderLogisticLineIncidents({
|
|
130
|
+
* logisticOrderId: "12345",
|
|
131
|
+
* lineId: "line_1",
|
|
132
|
+
* status: ["OPEN"],
|
|
133
|
+
* idType: "EXTERNAL_ID",
|
|
134
|
+
* page: 1,
|
|
135
|
+
* size: 10,
|
|
136
|
+
* sort: ["createdAt,desc"],
|
|
137
|
+
* });
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* @param {getOrderLogisticLineIncidentsParameters} params - The parameters for the request.
|
|
141
|
+
* @throws {Error} If `logisticOrderId` or `lineId` is missing.
|
|
142
|
+
* @returns {Promise<getOrderLogisticLineIncidentsResponse>} A promise resolving to the response containing the incidents.
|
|
143
|
+
*/
|
|
144
|
+
async function getOrderLogisticLineIncidents({ logisticOrderId, lineId, status, idType, page, size, sort, }) {
|
|
145
|
+
(0, parameters_validation_1.required)({ logisticOrderId, lineId });
|
|
146
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
147
|
+
method: "GET",
|
|
148
|
+
path: `/v1/shop/logistic-orders/${logisticOrderId}/incidents/lines/${lineId}`,
|
|
149
|
+
params: {
|
|
150
|
+
status,
|
|
151
|
+
idType,
|
|
152
|
+
page,
|
|
153
|
+
size,
|
|
154
|
+
sort,
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
return data;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* 🚚 Creates a new incident for a specific logistic order.
|
|
161
|
+
*
|
|
162
|
+
* This function allows the creation of an incident for a given logistic order,
|
|
163
|
+
* requiring essential parameters like the `logisticOrderId` and `reasonCode`.
|
|
164
|
+
* The `customField` and `idType` are used to provide additional information for the incident creation.
|
|
165
|
+
*
|
|
166
|
+
* 🛠 **Endpoint**: `POST /v1/shop/logistic-orders/{logisticOrderId}/incidents [ORDER-101]`
|
|
167
|
+
*
|
|
168
|
+
* | Parameter | Type | Required | Description |
|
|
169
|
+
* |------------------|-------------------------------------|------------|----------------------------------------------------------|
|
|
170
|
+
* | `logisticOrderId`| `string` | ✅ | The ID of the logistic order for which the incident is created. |
|
|
171
|
+
* | `idType` | `IncidentIdType` | ❌ | The type of incident ID (e.g., `DJUST_ID`, `EXTERNAL_ID`). |
|
|
172
|
+
* | `customField` | `{ customFieldValues: CustomFieldValueRequest[], idType: IncidentIdType }` | ❌ | The custom field data for the incident, including custom field values and ID type. |
|
|
173
|
+
* | `reasonCode` | `string[]` | ✅ | The reason codes for the incident (e.g., `["PRODUCT_DEFECT"]`). |
|
|
174
|
+
*
|
|
175
|
+
* 📤 **Returns**:
|
|
176
|
+
* A `Promise` resolving to a `createOrderLogisticIncidentResponse` object,
|
|
177
|
+
* containing the `incidentId` and `externalId` of the created incident.
|
|
178
|
+
*
|
|
179
|
+
* 🛠 **Example usage**:
|
|
180
|
+
* ```ts
|
|
181
|
+
* const incident = await createOrderLogisticIncident({
|
|
182
|
+
* logisticOrderId: "12345",
|
|
183
|
+
* idType: "EXTERNAL_ID",
|
|
184
|
+
* customField: { customFieldValues: [], idType: "EXTERNAL_ID" },
|
|
185
|
+
* reasonCode: ["PRODUCT_DEFECT"]
|
|
186
|
+
* });
|
|
187
|
+
* ```
|
|
188
|
+
*
|
|
189
|
+
* @param {createOrderLogisticIncidentParameters} params - The parameters for creating the incident.
|
|
190
|
+
* @throws {Error} If `logisticOrderId` or `reasonCode` is missing.
|
|
191
|
+
* @returns {Promise<createOrderLogisticIncidentResponse>} A promise resolving to the response containing the created incident's details.
|
|
192
|
+
*/
|
|
193
|
+
async function createOrderLogisticIncident({ logisticOrderId, idType, customField, reasonCode, }) {
|
|
194
|
+
(0, parameters_validation_1.required)({ logisticOrderId, reasonCode });
|
|
195
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
196
|
+
method: "POST",
|
|
197
|
+
path: `/v1/shop/logistic-orders/${logisticOrderId}/incidents`,
|
|
198
|
+
params: {
|
|
199
|
+
idType,
|
|
200
|
+
},
|
|
201
|
+
body: JSON.stringify({
|
|
202
|
+
customField,
|
|
203
|
+
reasonCode,
|
|
204
|
+
}),
|
|
205
|
+
});
|
|
206
|
+
return data;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* 🚚 Creates a new incident for a specific line within a logistic order.
|
|
210
|
+
*
|
|
211
|
+
* This function allows the creation of an incident for one or more lines within a logistic order.
|
|
212
|
+
* The `logisticOrderId`, `reasonCode`, and `orderLines` are required parameters.
|
|
213
|
+
* The `customFieldIdType` and `idType` are used for specifying additional information about the incident.
|
|
214
|
+
*
|
|
215
|
+
* 🛠 **Endpoint**: `POST /v1/shop/logistic-orders/{logisticOrderId}/lines/incidents [ORDER-102]`
|
|
216
|
+
*
|
|
217
|
+
* | Parameter | Type | Required | Description |
|
|
218
|
+
* |--------------------|-------------------------------------|------------|----------------------------------------------------------|
|
|
219
|
+
* | `logisticOrderId` | `string` | ✅ | The ID of the logistic order for which the line incident is created. |
|
|
220
|
+
* | `idType` | `IncidentIdType` | ❌ | The type of incident ID (e.g., `DJUST_ID`, `EXTERNAL_ID`). |
|
|
221
|
+
* | `customFieldIdType`| `IncidentIdType` | ❌ | The ID type for custom field values (e.g., `EXTERNAL_ID`). |
|
|
222
|
+
* | `orderLines` | `{ customFieldValues: CustomFieldValueRequest[], lineId: string, quantity: number }[]` | ✅ | An array of objects describing the order lines, including custom field values, line ID, and quantity. |
|
|
223
|
+
* | `reasonCode` | `string[]` | ✅ | The reason codes for the incident (e.g., `["PRODUCT_DEFECT"]`). |
|
|
224
|
+
*
|
|
225
|
+
* 📤 **Returns**:
|
|
226
|
+
* A `Promise` resolving to a `createOrderLogisticLineIncidentResponse` object,
|
|
227
|
+
* containing the `incidentId` and `externalId` of the created incident.
|
|
228
|
+
*
|
|
229
|
+
* 🛠 **Example usage**:
|
|
230
|
+
* ```ts
|
|
231
|
+
* const incident = await createOrderLogisticLineIncident({
|
|
232
|
+
* logisticOrderId: "12345",
|
|
233
|
+
* idType: "EXTERNAL_ID",
|
|
234
|
+
* customFieldIdType: "DJUST_ID",
|
|
235
|
+
* orderLines: [
|
|
236
|
+
* { customFieldValues: [], lineId: "line_1", quantity: 2 }
|
|
237
|
+
* ],
|
|
238
|
+
* reasonCode: ["PRODUCT_DEFECT"]
|
|
239
|
+
* });
|
|
240
|
+
* ```
|
|
241
|
+
*
|
|
242
|
+
* @param {createOrderLogisticLineIncidentParameters} params - The parameters for creating the incident.
|
|
243
|
+
* @throws {Error} If `logisticOrderId`, `reasonCode`, or `orderLines` is missing.
|
|
244
|
+
* @returns {Promise<createOrderLogisticLineIncidentResponse>} A promise resolving to the response containing the created incident's details.
|
|
245
|
+
*/
|
|
246
|
+
async function createOrderLogisticLineIncident({ logisticOrderId, idType, customFieldIdType, orderLines, reasonCode, }) {
|
|
247
|
+
(0, parameters_validation_1.required)({ logisticOrderId, reasonCode, orderLines });
|
|
248
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
249
|
+
method: "POST",
|
|
250
|
+
path: `/v1/shop/logistic-orders/${logisticOrderId}/lines/incidents`,
|
|
251
|
+
params: {
|
|
252
|
+
idType,
|
|
253
|
+
},
|
|
254
|
+
body: JSON.stringify({
|
|
255
|
+
customFieldIdType,
|
|
256
|
+
orderLines,
|
|
257
|
+
reasonCode,
|
|
258
|
+
}),
|
|
259
|
+
});
|
|
260
|
+
return data;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* 🧑💼 Fetches incidents for a specific customer account.
|
|
264
|
+
*
|
|
265
|
+
* This function retrieves incidents associated with a particular customer account,
|
|
266
|
+
* using parameters such as `status`, `page`, `size`, and `sort` to filter and paginate the results.
|
|
267
|
+
* The `customerAccountId` is a mandatory parameter and is validated before making the request.
|
|
268
|
+
*
|
|
269
|
+
* 🛠 **Endpoint**: `GET /v1/shop/customer-accounts/{customerAccountId}/incidents [ACCOUNT-551]`
|
|
270
|
+
*
|
|
271
|
+
* | Parameter | Type | Required | Description |
|
|
272
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
273
|
+
* | `customerAccountId`| `string` | ✅ | The ID of the customer account for which incidents are to be fetched. |
|
|
274
|
+
* | `status` | `IncidentStatus[]` | ❌ | Array of statuses to filter incidents by (e.g., `["OPEN"]`). |
|
|
275
|
+
* | `page` | `number` | ❌ | The page number for pagination. |
|
|
276
|
+
* | `size` | `number` | ❌ | The number of results per page. |
|
|
277
|
+
* | `sort` | `string[]` | ❌ | Sorting criteria (e.g., `["createdAt,desc"]`). |
|
|
278
|
+
*
|
|
279
|
+
* 📤 **Returns**:
|
|
280
|
+
* A `Promise` resolving to an array of `getCustomerAccountIncidentsResponse` objects,
|
|
281
|
+
* representing the incidents for the given customer account.
|
|
282
|
+
*
|
|
283
|
+
* 🛠 **Example usage**:
|
|
284
|
+
* ```ts
|
|
285
|
+
* const incidents = await getCustomerAccountIncidents({
|
|
286
|
+
* customerAccountId: "98765",
|
|
287
|
+
* status: ["OPEN"],
|
|
288
|
+
* page: 1,
|
|
289
|
+
* size: 10,
|
|
290
|
+
* sort: ["createdAt,desc"],
|
|
291
|
+
* });
|
|
292
|
+
* ```
|
|
293
|
+
*
|
|
294
|
+
* @param {getCustomerAccountIncidentsParameters} params - The parameters for the request.
|
|
295
|
+
* @throws {Error} If `customerAccountId` is missing.
|
|
296
|
+
* @returns {Promise<getCustomerAccountIncidentsResponse>} A promise resolving to the incidents response.
|
|
297
|
+
*/
|
|
298
|
+
async function getCustomerAccountIncidents({ customerAccountId, status, page, size, sort, }) {
|
|
299
|
+
(0, parameters_validation_1.required)({ customerAccountId });
|
|
300
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
301
|
+
method: "GET",
|
|
302
|
+
path: `/v1/shop/customer-accounts/${customerAccountId}/incidents`,
|
|
303
|
+
params: {
|
|
304
|
+
status,
|
|
305
|
+
page,
|
|
306
|
+
size,
|
|
307
|
+
sort,
|
|
308
|
+
},
|
|
309
|
+
});
|
|
310
|
+
return data;
|
|
311
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { MasterQuote, PageMasterQuote, SupplierQuoteDto } from "../../interfaces/models/quote";
|
|
1
|
+
import { MasterQuote, PageMasterQuote, SupplierQuoteDto, SupplierQuoteIdType } from "../../interfaces/models/quote";
|
|
2
|
+
import { OrderCommercialDto } from "../../interfaces/models/order";
|
|
2
3
|
import { PageableParameters } from "../../interfaces/models/common";
|
|
4
|
+
import { CustomFieldValueRequest } from "../../interfaces/models/custom-field";
|
|
3
5
|
/**
|
|
4
6
|
* Request parameters type definitions
|
|
5
7
|
*/
|
|
@@ -46,6 +48,9 @@ export interface CreateSupplierQuotesParameters {
|
|
|
46
48
|
export interface GetSupplierQuoteParameters {
|
|
47
49
|
supplierQuoteId: string;
|
|
48
50
|
}
|
|
51
|
+
export interface AcceptSupplierQuoteParameters {
|
|
52
|
+
supplierQuoteId: string;
|
|
53
|
+
}
|
|
49
54
|
export interface DeclineSupplierQuoteParameters {
|
|
50
55
|
supplierQuoteId: string;
|
|
51
56
|
}
|
|
@@ -54,6 +59,19 @@ export interface PostMessageToSupplierQuoteParameters {
|
|
|
54
59
|
message: string;
|
|
55
60
|
username: string;
|
|
56
61
|
}
|
|
62
|
+
export interface UpdateSupplierQuoteCustomFieldsParameters {
|
|
63
|
+
supplierQuoteId: string;
|
|
64
|
+
customFieldValues: CustomFieldValueRequest[];
|
|
65
|
+
idType: SupplierQuoteIdType;
|
|
66
|
+
}
|
|
67
|
+
export interface InitializeOrderFromSupplierQuoteParameters {
|
|
68
|
+
supplierQuoteId: string;
|
|
69
|
+
nbPreviewLines: number;
|
|
70
|
+
quoteLineIdsAndQuantities: {
|
|
71
|
+
quantity: number;
|
|
72
|
+
quoteLineId: string;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
57
75
|
/**
|
|
58
76
|
* Response type definitions
|
|
59
77
|
*/
|
|
@@ -71,5 +89,11 @@ export interface GetSupplierQuoteResponse extends SupplierQuoteDto {
|
|
|
71
89
|
}
|
|
72
90
|
export interface DeclineSupplierQuoteResponse extends SupplierQuoteDto {
|
|
73
91
|
}
|
|
92
|
+
export interface AcceptSupplierQuoteResponse extends SupplierQuoteDto {
|
|
93
|
+
}
|
|
74
94
|
export interface PostMessageToSupplierQuoteResponse extends SupplierQuoteDto {
|
|
75
95
|
}
|
|
96
|
+
export interface UpdateSupplierQuoteCustomFieldsResponse extends SupplierQuoteDto {
|
|
97
|
+
}
|
|
98
|
+
export interface InitializeOrderFromSupplierQuoteResponse extends OrderCommercialDto {
|
|
99
|
+
}
|