@djust-b2b/djust-front-sdk 1.11.1 → 1.12.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 +6 -0
- 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/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/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -21,6 +21,12 @@ export declare const DjustSDK: {
|
|
|
21
21
|
storeId?: string;
|
|
22
22
|
storeViewId?: string;
|
|
23
23
|
}>) => void;
|
|
24
|
+
getOrderLogisticIncidents({ logisticOrderId, status, idType, page, size, sort, }: import("./services/incident/definitions").getOrderLogisticIncidentsParameters): Promise<import("./services/incident/definitions").getOrderLogisticIncidentsResponse>;
|
|
25
|
+
getOrderLogisticIncident({ logisticOrderId, incidentId, idType, }: import("./services/incident/definitions").getOrderLogisticIncidentParameters): Promise<import("./services/incident/definitions").getOrderLogisticIncidentResponse>;
|
|
26
|
+
getOrderLogisticLineIncidents({ logisticOrderId, lineId, status, idType, page, size, sort, }: import("./services/incident/definitions").getOrderLogisticLineIncidentsParameters): Promise<import("./services/incident/definitions").getOrderLogisticLineIncidentsResponse>;
|
|
27
|
+
createOrderLogisticIncident({ logisticOrderId, idType, customField, reasonCode, }: import("./services/incident/definitions").createOrderLogisticIncidentParameters): Promise<import("./services/incident/definitions").createOrderLogisticIncidentResponse>;
|
|
28
|
+
createOrderLogisticLineIncident({ logisticOrderId, idType, customFieldIdType, orderLines, reasonCode, }: import("./services/incident/definitions").createOrderLogisticLineIncidentParameters): Promise<import("./services/incident/definitions").createOrderLogisticLineIncidentResponse>;
|
|
29
|
+
getCustomerAccountIncidents({ customerAccountId, status, page, size, sort, }: import("./services/incident/definitions").getCustomerAccountIncidentsParameters): Promise<import("./services/incident/definitions").getCustomerAccountIncidentsResponse>;
|
|
24
30
|
getCommercialOrders({ locale, nbPreviewLines, }: import("./interfaces").GetCommercialOrdersParameters): Promise<import("./interfaces").GetCommercialOrdersResponse>;
|
|
25
31
|
createCommercialOrder({ nbPreviewLines, channel, customFields, locale, originId, paymentInfo, }: import("./interfaces").CreateCommercialOrderParameters): Promise<import("./interfaces").CreateCommercialOrderResponse>;
|
|
26
32
|
getCommercialOrder({ orderId, idType, locale, nbPreviewLines, }: import("./interfaces").GetCommercialOrderParameters): Promise<import("./interfaces").GetCommercialOrderResponse>;
|
package/lib/index.js
CHANGED
|
@@ -48,6 +48,7 @@ const QuoteServices = __importStar(require("./services/quote"));
|
|
|
48
48
|
const SupplierServices = __importStar(require("./services/supplier"));
|
|
49
49
|
const LogisticOrderServices = __importStar(require("./services/logistic-order"));
|
|
50
50
|
const CommercialOrderServices = __importStar(require("./services/commercial-order"));
|
|
51
|
+
const IncidentServices = __importStar(require("./services/incident"));
|
|
51
52
|
const fetch_instance_1 = require("./settings/fetch-instance");
|
|
52
53
|
exports.DjustSDK = {
|
|
53
54
|
...AuthServices,
|
|
@@ -61,6 +62,7 @@ exports.DjustSDK = {
|
|
|
61
62
|
...SupplierServices,
|
|
62
63
|
...LogisticOrderServices,
|
|
63
64
|
...CommercialOrderServices,
|
|
65
|
+
...IncidentServices,
|
|
64
66
|
initialize: fetch_instance_1.initialize,
|
|
65
67
|
updateConfiguration: fetch_instance_1.updateConfiguration,
|
|
66
68
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CustomFieldValueObject } from "./custom-field";
|
|
2
|
+
export type IncidentStatus = "OPEN" | "ON_GOING" | "CLOSED";
|
|
3
|
+
export type IncidentIdType = "DJUST_ID" | "EXTERNAL_ID";
|
|
4
|
+
export interface IncidentLogisticOrder {
|
|
5
|
+
id: string;
|
|
6
|
+
externalId: string;
|
|
7
|
+
customFieldValues: CustomFieldValueObject[];
|
|
8
|
+
}
|
|
9
|
+
export interface IncidentOrderLine {
|
|
10
|
+
id: string;
|
|
11
|
+
externalId: string;
|
|
12
|
+
customFieldValues: CustomFieldValueObject[];
|
|
13
|
+
quantity: number;
|
|
14
|
+
status: IncidentStatus;
|
|
15
|
+
}
|
|
16
|
+
export interface IncidentDto {
|
|
17
|
+
createdAt: string;
|
|
18
|
+
externalId: string;
|
|
19
|
+
id: string;
|
|
20
|
+
logisticOrder: IncidentLogisticOrder;
|
|
21
|
+
orderLines: IncidentOrderLine[];
|
|
22
|
+
reasons: string[];
|
|
23
|
+
status: IncidentStatus;
|
|
24
|
+
threadId: string;
|
|
25
|
+
}
|
|
26
|
+
export interface IncidentCreatedDto {
|
|
27
|
+
externalId: string;
|
|
28
|
+
incidentId: string;
|
|
29
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { IncidentDto, IncidentStatus, IncidentIdType, IncidentCreatedDto } from "../../interfaces/models/incident";
|
|
2
|
+
import { CustomFieldValueRequest } from "../../interfaces/models/custom-field";
|
|
3
|
+
/**
|
|
4
|
+
* Request parameters type definitions
|
|
5
|
+
*/
|
|
6
|
+
export interface getOrderLogisticIncidentsParameters {
|
|
7
|
+
logisticOrderId: string;
|
|
8
|
+
status: IncidentStatus[];
|
|
9
|
+
idType: IncidentIdType;
|
|
10
|
+
page: number;
|
|
11
|
+
size: number;
|
|
12
|
+
sort: String[];
|
|
13
|
+
}
|
|
14
|
+
export interface getOrderLogisticIncidentParameters {
|
|
15
|
+
logisticOrderId: string;
|
|
16
|
+
incidentId: string;
|
|
17
|
+
idType: IncidentIdType;
|
|
18
|
+
}
|
|
19
|
+
export interface getOrderLogisticLineIncidentsParameters {
|
|
20
|
+
logisticOrderId: string;
|
|
21
|
+
lineId: string;
|
|
22
|
+
status: IncidentStatus[];
|
|
23
|
+
idType: IncidentIdType;
|
|
24
|
+
page: number;
|
|
25
|
+
size: number;
|
|
26
|
+
sort: String[];
|
|
27
|
+
}
|
|
28
|
+
export interface createOrderLogisticIncidentParameters {
|
|
29
|
+
logisticOrderId: string;
|
|
30
|
+
idType: IncidentIdType;
|
|
31
|
+
customField: {
|
|
32
|
+
customFieldValues: CustomFieldValueRequest[];
|
|
33
|
+
idType: IncidentIdType;
|
|
34
|
+
};
|
|
35
|
+
reasonCode: string[];
|
|
36
|
+
}
|
|
37
|
+
export interface createOrderLogisticLineIncidentParameters {
|
|
38
|
+
logisticOrderId: string;
|
|
39
|
+
idType: IncidentIdType;
|
|
40
|
+
customFieldIdType: IncidentIdType;
|
|
41
|
+
orderLines: {
|
|
42
|
+
customFieldValues: CustomFieldValueRequest[];
|
|
43
|
+
lineId: string;
|
|
44
|
+
quantity: number;
|
|
45
|
+
}[];
|
|
46
|
+
reasonCode: string[];
|
|
47
|
+
}
|
|
48
|
+
export interface getCustomerAccountIncidentsParameters {
|
|
49
|
+
customerAccountId: string;
|
|
50
|
+
status: IncidentStatus[];
|
|
51
|
+
page: number;
|
|
52
|
+
size: number;
|
|
53
|
+
sort: String[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
*/
|
|
57
|
+
export interface getOrderLogisticIncidentsResponse extends Array<IncidentDto> {
|
|
58
|
+
}
|
|
59
|
+
export interface getOrderLogisticIncidentResponse extends IncidentDto {
|
|
60
|
+
}
|
|
61
|
+
export interface getOrderLogisticLineIncidentsResponse extends Array<IncidentDto> {
|
|
62
|
+
}
|
|
63
|
+
export interface createOrderLogisticIncidentResponse extends IncidentCreatedDto {
|
|
64
|
+
}
|
|
65
|
+
export interface createOrderLogisticLineIncidentResponse extends IncidentCreatedDto {
|
|
66
|
+
}
|
|
67
|
+
export interface getCustomerAccountIncidentsResponse extends Array<IncidentDto> {
|
|
68
|
+
}
|
|
@@ -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
|
+
}
|