@djust-b2b/djust-front-sdk 2.1.1 β 2.3.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 +4 -8
- package/lib/index.js +2 -2
- package/lib/interfaces/index.d.ts +0 -1
- package/lib/interfaces/index.js +0 -1
- package/lib/services/auth/__mocks__/auth.mocks.d.ts +248 -0
- package/lib/services/auth/__mocks__/auth.mocks.js +220 -0
- package/lib/services/auth/index.d.ts +2 -2
- package/lib/services/auth/index.js +2 -2
- package/lib/services/custom-field/index.d.ts +2 -1
- package/lib/services/custom-field/index.js +2 -1
- package/lib/services/customer-account/index.d.ts +47 -70
- package/lib/services/customer-account/index.js +47 -70
- package/lib/services/incident/definitions.d.ts +1 -0
- package/lib/services/incident/index.d.ts +41 -1
- package/lib/services/incident/index.js +60 -1
- package/lib/services/offer-prices/__mocks__/offer-prices.mocks.d.ts +108 -0
- package/lib/services/offer-prices/__mocks__/offer-prices.mocks.js +200 -0
- package/lib/services/payment/index.js +1 -1
- package/lib/services/supplier/__mocks__/supplier-mocks.d.ts +48 -0
- package/lib/services/supplier/__mocks__/supplier-mocks.js +167 -0
- package/lib/services/supplier/definitions.d.ts +3 -3
- package/lib/services/supplier/index.js +0 -2
- package/package.json +4 -3
- package/lib/interfaces/models/buying-list.d.ts +0 -16
- package/lib/interfaces/models/buying-list.js +0 -2
- package/lib/services/buying-list/definitions.d.ts +0 -43
- package/lib/services/buying-list/definitions.js +0 -2
- package/lib/services/buying-list/index.d.ts +0 -33
- package/lib/services/buying-list/index.js +0 -104
|
@@ -48,7 +48,7 @@ export declare function getCustomerAccountV2(pageable: PageableParameters): Prom
|
|
|
48
48
|
*
|
|
49
49
|
* This function allows the creation of a new customer account with relevant details including addresses, user information, and custom fields.
|
|
50
50
|
*
|
|
51
|
-
* π **Endpoint**: `POST /v1/shop/customer-accounts`
|
|
51
|
+
* π **Endpoint**: `POST /v1/shop/customer-accounts` [ACCOUNT-100]
|
|
52
52
|
*
|
|
53
53
|
* | Parameter | Type | Required | Description |
|
|
54
54
|
* |-----------------------------------|--------------------------------|----------|-------------|
|
|
@@ -58,82 +58,59 @@ export declare function getCustomerAccountV2(pageable: PageableParameters): Prom
|
|
|
58
58
|
* | `customFieldValues` | `object[]` | β
| List of custom fields with their `customFieldId` and `customFieldValue`. |
|
|
59
59
|
* | `customerTagList` | `string[]` | β
| List of customer tags. |
|
|
60
60
|
* | `fromFO` | `boolean` | β
| Flag indicating if the account is created from the front-office (FO). |
|
|
61
|
-
* | `legalUser` | `object
|
|
62
|
-
|
|
61
|
+
* | `legalUser` | `object` | β
| Information about the legal user including `birthday`, `countryOfResidence`, `email`, `firstName`, `lastName`, and `nationality`. |
|
|
62
|
+
*
|
|
63
63
|
* π€ **Returns**:
|
|
64
64
|
* A `Promise<CreateCustomerAccountResponse>` containing the details of the created customer account.
|
|
65
65
|
*
|
|
66
66
|
* π **Example usage**:
|
|
67
67
|
* ```ts
|
|
68
68
|
* const response = await createCustomerAccount({
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* accountManager: "string",
|
|
109
|
-
* businessRegistrationNumber: "string",
|
|
110
|
-
* companyRegistrationName: "string",
|
|
111
|
-
* externalId: "string",
|
|
112
|
-
* name: "string",
|
|
113
|
-
* vatNumber: "string",
|
|
114
|
-
* website: "string"
|
|
115
|
-
* },
|
|
116
|
-
* customFieldValues: [
|
|
117
|
-
* {
|
|
118
|
-
* customFieldId: "string",
|
|
119
|
-
* customFieldValue: "value"
|
|
120
|
-
* }
|
|
121
|
-
* ],
|
|
122
|
-
* customerTagList: ["tag1", "tag2"],
|
|
123
|
-
* fromFO: true,
|
|
124
|
-
* legalUser: [
|
|
125
|
-
* {
|
|
126
|
-
* birthday: "2024-12-11T09:46:27.656Z",
|
|
127
|
-
* countryOfResidence: "FR",
|
|
128
|
-
* email: "user@example.com",
|
|
129
|
-
* firstName: "John",
|
|
130
|
-
* id: "userId",
|
|
131
|
-
* lastName: "Doe",
|
|
132
|
-
* nationality: "FR"
|
|
133
|
-
* }
|
|
134
|
-
* ],
|
|
69
|
+
* createAddressRequests: [
|
|
70
|
+
* {
|
|
71
|
+
* address: "123 Main Street",
|
|
72
|
+
* city: "Paris",
|
|
73
|
+
* country: "FR",
|
|
74
|
+
* billing: true,
|
|
75
|
+
* shipping: true,
|
|
76
|
+
* fullName: "John Doe",
|
|
77
|
+
* zipcode: "75001"
|
|
78
|
+
* }
|
|
79
|
+
* ],
|
|
80
|
+
* createCustomerUserRequest: {
|
|
81
|
+
* email: "john.doe@example.com",
|
|
82
|
+
* firstName: "John",
|
|
83
|
+
* lastName: "Doe",
|
|
84
|
+
* password: "securePassword123",
|
|
85
|
+
* phone: "+33123456789"
|
|
86
|
+
* },
|
|
87
|
+
* createObjectCustomerAccountRequest: {
|
|
88
|
+
* name: "Acme Corporation",
|
|
89
|
+
* externalId: "acme-corp-001",
|
|
90
|
+
* vatNumber: "FR12345678901"
|
|
91
|
+
* },
|
|
92
|
+
* customFieldValues: [
|
|
93
|
+
* {
|
|
94
|
+
* customFieldId: "industry",
|
|
95
|
+
* customFieldValue: "technology"
|
|
96
|
+
* }
|
|
97
|
+
* ],
|
|
98
|
+
* customerTagList: ["premium", "enterprise"],
|
|
99
|
+
* fromFO: true,
|
|
100
|
+
* legalUser: {
|
|
101
|
+
* birthday: "1990-01-01T00:00:00.000Z",
|
|
102
|
+
* countryOfResidence: "FR",
|
|
103
|
+
* email: "john.doe@example.com",
|
|
104
|
+
* firstName: "John",
|
|
105
|
+
* lastName: "Doe",
|
|
106
|
+
* nationality: "FR"
|
|
107
|
+
* }
|
|
135
108
|
* });
|
|
136
109
|
* ```
|
|
110
|
+
*
|
|
111
|
+
* @param {CreateCustomerAccountParameters} params - The parameters for creating a customer account
|
|
112
|
+
* @throws {Error} If required parameters are missing
|
|
113
|
+
* @returns {Promise<CreateCustomerAccountResponse>} A promise resolving to the response containing the created customer account
|
|
137
114
|
*/
|
|
138
115
|
export declare function createCustomerAccount({ createAddressRequests, createCustomerUserRequest, createObjectCustomerAccountRequest, customFieldValues, customerTagList, fromFO, legalUser, ...config }: CreateCustomerAccountParameters & DjustConfig): Promise<CreateCustomerAccountResponse>;
|
|
139
116
|
/**
|
|
@@ -291,7 +268,7 @@ export declare function updateCustomerAccountAddress({ addressId, additionalAddr
|
|
|
291
268
|
*
|
|
292
269
|
* This function retrieves custom fields for a customer account.
|
|
293
270
|
*
|
|
294
|
-
* π **Endpoint**: `GET /v1/shop/customer-accounts/custom-fields`
|
|
271
|
+
* π **Endpoint**: `GET /v1/shop/customer-accounts/custom-fields` [ACCOUNT-554]
|
|
295
272
|
*
|
|
296
273
|
* | **Parameter** | **Type** | **Required** | **Description** |
|
|
297
274
|
* |----------------------|------------|--------------|---------------------------------------------------------------------------|
|
|
@@ -88,7 +88,7 @@ async function getCustomerAccountV2(pageable) {
|
|
|
88
88
|
*
|
|
89
89
|
* This function allows the creation of a new customer account with relevant details including addresses, user information, and custom fields.
|
|
90
90
|
*
|
|
91
|
-
* π **Endpoint**: `POST /v1/shop/customer-accounts`
|
|
91
|
+
* π **Endpoint**: `POST /v1/shop/customer-accounts` [ACCOUNT-100]
|
|
92
92
|
*
|
|
93
93
|
* | Parameter | Type | Required | Description |
|
|
94
94
|
* |-----------------------------------|--------------------------------|----------|-------------|
|
|
@@ -98,82 +98,59 @@ async function getCustomerAccountV2(pageable) {
|
|
|
98
98
|
* | `customFieldValues` | `object[]` | β
| List of custom fields with their `customFieldId` and `customFieldValue`. |
|
|
99
99
|
* | `customerTagList` | `string[]` | β
| List of customer tags. |
|
|
100
100
|
* | `fromFO` | `boolean` | β
| Flag indicating if the account is created from the front-office (FO). |
|
|
101
|
-
* | `legalUser` | `object
|
|
102
|
-
|
|
101
|
+
* | `legalUser` | `object` | β
| Information about the legal user including `birthday`, `countryOfResidence`, `email`, `firstName`, `lastName`, and `nationality`. |
|
|
102
|
+
*
|
|
103
103
|
* π€ **Returns**:
|
|
104
104
|
* A `Promise<CreateCustomerAccountResponse>` containing the details of the created customer account.
|
|
105
105
|
*
|
|
106
106
|
* π **Example usage**:
|
|
107
107
|
* ```ts
|
|
108
108
|
* const response = await createCustomerAccount({
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* accountManager: "string",
|
|
149
|
-
* businessRegistrationNumber: "string",
|
|
150
|
-
* companyRegistrationName: "string",
|
|
151
|
-
* externalId: "string",
|
|
152
|
-
* name: "string",
|
|
153
|
-
* vatNumber: "string",
|
|
154
|
-
* website: "string"
|
|
155
|
-
* },
|
|
156
|
-
* customFieldValues: [
|
|
157
|
-
* {
|
|
158
|
-
* customFieldId: "string",
|
|
159
|
-
* customFieldValue: "value"
|
|
160
|
-
* }
|
|
161
|
-
* ],
|
|
162
|
-
* customerTagList: ["tag1", "tag2"],
|
|
163
|
-
* fromFO: true,
|
|
164
|
-
* legalUser: [
|
|
165
|
-
* {
|
|
166
|
-
* birthday: "2024-12-11T09:46:27.656Z",
|
|
167
|
-
* countryOfResidence: "FR",
|
|
168
|
-
* email: "user@example.com",
|
|
169
|
-
* firstName: "John",
|
|
170
|
-
* id: "userId",
|
|
171
|
-
* lastName: "Doe",
|
|
172
|
-
* nationality: "FR"
|
|
173
|
-
* }
|
|
174
|
-
* ],
|
|
109
|
+
* createAddressRequests: [
|
|
110
|
+
* {
|
|
111
|
+
* address: "123 Main Street",
|
|
112
|
+
* city: "Paris",
|
|
113
|
+
* country: "FR",
|
|
114
|
+
* billing: true,
|
|
115
|
+
* shipping: true,
|
|
116
|
+
* fullName: "John Doe",
|
|
117
|
+
* zipcode: "75001"
|
|
118
|
+
* }
|
|
119
|
+
* ],
|
|
120
|
+
* createCustomerUserRequest: {
|
|
121
|
+
* email: "john.doe@example.com",
|
|
122
|
+
* firstName: "John",
|
|
123
|
+
* lastName: "Doe",
|
|
124
|
+
* password: "securePassword123",
|
|
125
|
+
* phone: "+33123456789"
|
|
126
|
+
* },
|
|
127
|
+
* createObjectCustomerAccountRequest: {
|
|
128
|
+
* name: "Acme Corporation",
|
|
129
|
+
* externalId: "acme-corp-001",
|
|
130
|
+
* vatNumber: "FR12345678901"
|
|
131
|
+
* },
|
|
132
|
+
* customFieldValues: [
|
|
133
|
+
* {
|
|
134
|
+
* customFieldId: "industry",
|
|
135
|
+
* customFieldValue: "technology"
|
|
136
|
+
* }
|
|
137
|
+
* ],
|
|
138
|
+
* customerTagList: ["premium", "enterprise"],
|
|
139
|
+
* fromFO: true,
|
|
140
|
+
* legalUser: {
|
|
141
|
+
* birthday: "1990-01-01T00:00:00.000Z",
|
|
142
|
+
* countryOfResidence: "FR",
|
|
143
|
+
* email: "john.doe@example.com",
|
|
144
|
+
* firstName: "John",
|
|
145
|
+
* lastName: "Doe",
|
|
146
|
+
* nationality: "FR"
|
|
147
|
+
* }
|
|
175
148
|
* });
|
|
176
149
|
* ```
|
|
150
|
+
*
|
|
151
|
+
* @param {CreateCustomerAccountParameters} params - The parameters for creating a customer account
|
|
152
|
+
* @throws {Error} If required parameters are missing
|
|
153
|
+
* @returns {Promise<CreateCustomerAccountResponse>} A promise resolving to the response containing the created customer account
|
|
177
154
|
*/
|
|
178
155
|
async function createCustomerAccount({ createAddressRequests, createCustomerUserRequest, createObjectCustomerAccountRequest, customFieldValues, customerTagList, fromFO, legalUser, ...config }) {
|
|
179
156
|
(0, parameters_validation_1.required)({
|
|
@@ -419,7 +396,7 @@ async function updateCustomerAccountAddress({ addressId, additionalAddress, addr
|
|
|
419
396
|
*
|
|
420
397
|
* This function retrieves custom fields for a customer account.
|
|
421
398
|
*
|
|
422
|
-
* π **Endpoint**: `GET /v1/shop/customer-accounts/custom-fields`
|
|
399
|
+
* π **Endpoint**: `GET /v1/shop/customer-accounts/custom-fields` [ACCOUNT-554]
|
|
423
400
|
*
|
|
424
401
|
* | **Parameter** | **Type** | **Required** | **Description** |
|
|
425
402
|
* |----------------------|------------|--------------|---------------------------------------------------------------------------|
|
|
@@ -4,7 +4,7 @@ import { getIncidentsParameters, getIncidentParameters, createOrderLogisticIncid
|
|
|
4
4
|
*
|
|
5
5
|
* This function allows you to fetch incidents with detailed filtering options, such as customer account IDs, status, and sorting preferences.
|
|
6
6
|
*
|
|
7
|
-
* π **Endpoint**: `GET /v1/shop/incidents
|
|
7
|
+
* π **Endpoint**: `GET /v1/shop/incidents`
|
|
8
8
|
*
|
|
9
9
|
* | Parameter | Type | Required | Description |
|
|
10
10
|
* |-----------------------|--------------------|----------|-----------------------------------------------------------------------------|
|
|
@@ -221,3 +221,43 @@ export declare function createOrderLogisticIncidentThread({ logisticOrderId, inc
|
|
|
221
221
|
* @returns {Promise<createIncidentResponse>} A promise that resolves to the created incident details.
|
|
222
222
|
*/
|
|
223
223
|
export declare function createIncident({ customField, externalId, logisticOrderId, reasonCodes, idType, }: createIncidentParameters): Promise<createIncidentResponse>;
|
|
224
|
+
/**
|
|
225
|
+
* π Retrieves a list of incidents based on various filter criteria.
|
|
226
|
+
*
|
|
227
|
+
* This function allows you to fetch incidents with detailed filtering options, such as customer account IDs, supplier IDs, status, and sorting preferences.
|
|
228
|
+
*
|
|
229
|
+
* π **Endpoint**: `GET /v2/shop/incidents` [ORDER-559]
|
|
230
|
+
*
|
|
231
|
+
* | Parameter | Type | Required | Description |
|
|
232
|
+
* |-----------------------|--------------------|----------|-----------------------------------------------------------------------------|
|
|
233
|
+
* | `customerAccountIds` | `string[]` | β | List of customer account IDs to filter incidents by. |
|
|
234
|
+
* | `linkedType` | `string` | β
| Type of entity linked to the incident (e.g., ORDER or ORDER_LINES). |
|
|
235
|
+
* | `ids` | `string[]` | β | Specific incident IDs to retrieve. |
|
|
236
|
+
* | `status` | `IncidentStatus[]`| β | List of statuses to filter incidents by (e.g., OPEN, ON_GOING, CLOSED). |
|
|
237
|
+
* | `idType` | `IncidentIdType` | β | Type of ID used for filtering (e.g., DJUST_ID, EXTERNAL_ID). |
|
|
238
|
+
* | `page` | `number` | β | Page number for paginated results (starting at 0). |
|
|
239
|
+
* | `size` | `number` | β | Number of incidents per page. |
|
|
240
|
+
* | `sort` | `string[]` | β | Sorting criteria in the format `field,(asc|desc)` (e.g., `status,desc`). |
|
|
241
|
+
* | `supplierIds` | `string[]` | β | List of supplier IDs to filter incidents by. |
|
|
242
|
+
*
|
|
243
|
+
* π€ **Returns**:
|
|
244
|
+
* A `Promise<getIncidentsResponse>` containing a paginated list of incidents matching the filter criteria.
|
|
245
|
+
*
|
|
246
|
+
* π **Example usage**:
|
|
247
|
+
* ```ts
|
|
248
|
+
* const incidents = await getIncidentsV2({
|
|
249
|
+
* customerAccountIds: ["acc123", "acc456"],
|
|
250
|
+
* linkedType: "ORDER",
|
|
251
|
+
* status: ["OPEN", "ON_GOING"],
|
|
252
|
+
* supplierIds: ["supplier1", "supplier2"],
|
|
253
|
+
* page: 0,
|
|
254
|
+
* size: 10,
|
|
255
|
+
* sort: ["createdAt,desc"],
|
|
256
|
+
* });
|
|
257
|
+
* ```
|
|
258
|
+
*
|
|
259
|
+
* @param {getIncidentsParameters} params - The parameters for filtering and retrieving incidents.
|
|
260
|
+
* @throws {Error} If the required `linkedType` is missing.
|
|
261
|
+
* @returns {Promise<getIncidentsResponse>} A promise that resolves to a response object containing the incidents.
|
|
262
|
+
*/
|
|
263
|
+
export declare function getIncidentsV2({ customerAccountIds, linkedType, ids, status, idType, page, size, sort, supplierIds, }: getIncidentsParameters): Promise<getIncidentsResponse>;
|
|
@@ -6,6 +6,7 @@ exports.createOrderLogisticIncident = createOrderLogisticIncident;
|
|
|
6
6
|
exports.createOrderLogisticLineIncident = createOrderLogisticLineIncident;
|
|
7
7
|
exports.createOrderLogisticIncidentThread = createOrderLogisticIncidentThread;
|
|
8
8
|
exports.createIncident = createIncident;
|
|
9
|
+
exports.getIncidentsV2 = getIncidentsV2;
|
|
9
10
|
const parameters_validation_1 = require("../../helpers/parameters-validation");
|
|
10
11
|
const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
11
12
|
/**
|
|
@@ -13,7 +14,7 @@ const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
|
13
14
|
*
|
|
14
15
|
* This function allows you to fetch incidents with detailed filtering options, such as customer account IDs, status, and sorting preferences.
|
|
15
16
|
*
|
|
16
|
-
* π **Endpoint**: `GET /v1/shop/incidents
|
|
17
|
+
* π **Endpoint**: `GET /v1/shop/incidents`
|
|
17
18
|
*
|
|
18
19
|
* | Parameter | Type | Required | Description |
|
|
19
20
|
* |-----------------------|--------------------|----------|-----------------------------------------------------------------------------|
|
|
@@ -318,3 +319,61 @@ async function createIncident({ customField, externalId, logisticOrderId, reason
|
|
|
318
319
|
});
|
|
319
320
|
return data;
|
|
320
321
|
}
|
|
322
|
+
/**
|
|
323
|
+
* π Retrieves a list of incidents based on various filter criteria.
|
|
324
|
+
*
|
|
325
|
+
* This function allows you to fetch incidents with detailed filtering options, such as customer account IDs, supplier IDs, status, and sorting preferences.
|
|
326
|
+
*
|
|
327
|
+
* π **Endpoint**: `GET /v2/shop/incidents` [ORDER-559]
|
|
328
|
+
*
|
|
329
|
+
* | Parameter | Type | Required | Description |
|
|
330
|
+
* |-----------------------|--------------------|----------|-----------------------------------------------------------------------------|
|
|
331
|
+
* | `customerAccountIds` | `string[]` | β | List of customer account IDs to filter incidents by. |
|
|
332
|
+
* | `linkedType` | `string` | β
| Type of entity linked to the incident (e.g., ORDER or ORDER_LINES). |
|
|
333
|
+
* | `ids` | `string[]` | β | Specific incident IDs to retrieve. |
|
|
334
|
+
* | `status` | `IncidentStatus[]`| β | List of statuses to filter incidents by (e.g., OPEN, ON_GOING, CLOSED). |
|
|
335
|
+
* | `idType` | `IncidentIdType` | β | Type of ID used for filtering (e.g., DJUST_ID, EXTERNAL_ID). |
|
|
336
|
+
* | `page` | `number` | β | Page number for paginated results (starting at 0). |
|
|
337
|
+
* | `size` | `number` | β | Number of incidents per page. |
|
|
338
|
+
* | `sort` | `string[]` | β | Sorting criteria in the format `field,(asc|desc)` (e.g., `status,desc`). |
|
|
339
|
+
* | `supplierIds` | `string[]` | β | List of supplier IDs to filter incidents by. |
|
|
340
|
+
*
|
|
341
|
+
* π€ **Returns**:
|
|
342
|
+
* A `Promise<getIncidentsResponse>` containing a paginated list of incidents matching the filter criteria.
|
|
343
|
+
*
|
|
344
|
+
* π **Example usage**:
|
|
345
|
+
* ```ts
|
|
346
|
+
* const incidents = await getIncidentsV2({
|
|
347
|
+
* customerAccountIds: ["acc123", "acc456"],
|
|
348
|
+
* linkedType: "ORDER",
|
|
349
|
+
* status: ["OPEN", "ON_GOING"],
|
|
350
|
+
* supplierIds: ["supplier1", "supplier2"],
|
|
351
|
+
* page: 0,
|
|
352
|
+
* size: 10,
|
|
353
|
+
* sort: ["createdAt,desc"],
|
|
354
|
+
* });
|
|
355
|
+
* ```
|
|
356
|
+
*
|
|
357
|
+
* @param {getIncidentsParameters} params - The parameters for filtering and retrieving incidents.
|
|
358
|
+
* @throws {Error} If the required `linkedType` is missing.
|
|
359
|
+
* @returns {Promise<getIncidentsResponse>} A promise that resolves to a response object containing the incidents.
|
|
360
|
+
*/
|
|
361
|
+
async function getIncidentsV2({ customerAccountIds, linkedType, ids, status, idType, page, size, sort, supplierIds, }) {
|
|
362
|
+
(0, parameters_validation_1.required)({ linkedType });
|
|
363
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
364
|
+
method: "GET",
|
|
365
|
+
path: `/v2/shop/incidents`,
|
|
366
|
+
params: {
|
|
367
|
+
customerAccountIds,
|
|
368
|
+
linkedType,
|
|
369
|
+
ids,
|
|
370
|
+
status,
|
|
371
|
+
idType,
|
|
372
|
+
page,
|
|
373
|
+
size,
|
|
374
|
+
sort,
|
|
375
|
+
supplierIds,
|
|
376
|
+
},
|
|
377
|
+
});
|
|
378
|
+
return data;
|
|
379
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mocks centralisΓ©s pour les tests du module offer-prices
|
|
3
|
+
*/
|
|
4
|
+
import { GetPaginatedOfferPricesParameters, GetOfferPricesResponse } from "../definitions";
|
|
5
|
+
import { OfferPrice } from "../../../interfaces/models/offer";
|
|
6
|
+
import { Order, PageableObject } from "../../../interfaces/models/common";
|
|
7
|
+
export declare const mockProductPrices: {
|
|
8
|
+
standard: {
|
|
9
|
+
itemPrice: number;
|
|
10
|
+
unitPrice: number;
|
|
11
|
+
itemPriceTTC: number;
|
|
12
|
+
unitPriceTTC: number;
|
|
13
|
+
};
|
|
14
|
+
discounted: {
|
|
15
|
+
itemPrice: number;
|
|
16
|
+
unitPrice: number;
|
|
17
|
+
itemPriceTTC: number;
|
|
18
|
+
unitPriceTTC: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare const mockPriceRanges: {
|
|
22
|
+
single: {
|
|
23
|
+
quantity: number;
|
|
24
|
+
price: {
|
|
25
|
+
itemPrice: number;
|
|
26
|
+
unitPrice: number;
|
|
27
|
+
itemPriceTTC: number;
|
|
28
|
+
unitPriceTTC: number;
|
|
29
|
+
};
|
|
30
|
+
discountPrice: {
|
|
31
|
+
itemPrice: number;
|
|
32
|
+
unitPrice: number;
|
|
33
|
+
itemPriceTTC: number;
|
|
34
|
+
unitPriceTTC: number;
|
|
35
|
+
};
|
|
36
|
+
}[];
|
|
37
|
+
multiple: {
|
|
38
|
+
quantity: number;
|
|
39
|
+
price: {
|
|
40
|
+
itemPrice: number;
|
|
41
|
+
unitPrice: number;
|
|
42
|
+
itemPriceTTC: number;
|
|
43
|
+
unitPriceTTC: number;
|
|
44
|
+
};
|
|
45
|
+
discountPrice: {
|
|
46
|
+
itemPrice: number;
|
|
47
|
+
unitPrice: number;
|
|
48
|
+
itemPriceTTC: number;
|
|
49
|
+
unitPriceTTC: number;
|
|
50
|
+
};
|
|
51
|
+
}[];
|
|
52
|
+
};
|
|
53
|
+
export declare const mockOfferPrices: OfferPrice[];
|
|
54
|
+
export declare const mockParameters: {
|
|
55
|
+
getPaginatedOfferPrices: {
|
|
56
|
+
valid: GetPaginatedOfferPricesParameters;
|
|
57
|
+
withPagination: GetPaginatedOfferPricesParameters;
|
|
58
|
+
withSorting: GetPaginatedOfferPricesParameters;
|
|
59
|
+
missingRequired: Partial<GetPaginatedOfferPricesParameters>;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
export declare const mockPageableObject: PageableObject;
|
|
63
|
+
export declare const mockOrder: Order;
|
|
64
|
+
export declare const mockResponses: {
|
|
65
|
+
getPaginatedOfferPrices: {
|
|
66
|
+
success: {
|
|
67
|
+
data: GetOfferPricesResponse;
|
|
68
|
+
headers: Headers;
|
|
69
|
+
status: number;
|
|
70
|
+
};
|
|
71
|
+
empty: {
|
|
72
|
+
data: GetOfferPricesResponse;
|
|
73
|
+
headers: Headers;
|
|
74
|
+
status: number;
|
|
75
|
+
};
|
|
76
|
+
singleItem: {
|
|
77
|
+
data: GetOfferPricesResponse;
|
|
78
|
+
headers: Headers;
|
|
79
|
+
status: number;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export declare const mockErrors: {
|
|
84
|
+
networkError: Error;
|
|
85
|
+
unauthorized: Error;
|
|
86
|
+
badRequest: Error;
|
|
87
|
+
notFound: Error;
|
|
88
|
+
serverError: Error;
|
|
89
|
+
missingParameter: Error;
|
|
90
|
+
};
|
|
91
|
+
export declare const mockHttpErrors: {
|
|
92
|
+
400: {
|
|
93
|
+
status: number;
|
|
94
|
+
message: string;
|
|
95
|
+
};
|
|
96
|
+
401: {
|
|
97
|
+
status: number;
|
|
98
|
+
message: string;
|
|
99
|
+
};
|
|
100
|
+
404: {
|
|
101
|
+
status: number;
|
|
102
|
+
message: string;
|
|
103
|
+
};
|
|
104
|
+
500: {
|
|
105
|
+
status: number;
|
|
106
|
+
message: string;
|
|
107
|
+
};
|
|
108
|
+
};
|