@djust-b2b/djust-front-sdk 2.1.1 → 2.2.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 +1 -1
- package/lib/services/customer-account/index.js +1 -1
- 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
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Mocks centralisés pour les tests du module offer-prices
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.mockHttpErrors = exports.mockErrors = exports.mockResponses = exports.mockOrder = exports.mockPageableObject = exports.mockParameters = exports.mockOfferPrices = exports.mockPriceRanges = exports.mockProductPrices = void 0;
|
|
7
|
+
// Mock data pour les prix de produits
|
|
8
|
+
exports.mockProductPrices = {
|
|
9
|
+
standard: {
|
|
10
|
+
itemPrice: 10.5,
|
|
11
|
+
unitPrice: 2.1,
|
|
12
|
+
itemPriceTTC: 12.6,
|
|
13
|
+
unitPriceTTC: 2.52,
|
|
14
|
+
},
|
|
15
|
+
discounted: {
|
|
16
|
+
itemPrice: 8.4,
|
|
17
|
+
unitPrice: 1.68,
|
|
18
|
+
itemPriceTTC: 10.08,
|
|
19
|
+
unitPriceTTC: 2.02,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
// Mock data pour les gammes de prix
|
|
23
|
+
exports.mockPriceRanges = {
|
|
24
|
+
single: [
|
|
25
|
+
{
|
|
26
|
+
quantity: 1,
|
|
27
|
+
price: exports.mockProductPrices.standard,
|
|
28
|
+
discountPrice: exports.mockProductPrices.standard,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
multiple: [
|
|
32
|
+
{
|
|
33
|
+
quantity: 1,
|
|
34
|
+
price: exports.mockProductPrices.standard,
|
|
35
|
+
discountPrice: exports.mockProductPrices.standard,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
quantity: 10,
|
|
39
|
+
price: exports.mockProductPrices.standard,
|
|
40
|
+
discountPrice: exports.mockProductPrices.discounted,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
quantity: 50,
|
|
44
|
+
price: exports.mockProductPrices.standard,
|
|
45
|
+
discountPrice: {
|
|
46
|
+
itemPrice: 7.35,
|
|
47
|
+
unitPrice: 1.47,
|
|
48
|
+
itemPriceTTC: 8.82,
|
|
49
|
+
unitPriceTTC: 1.76,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
// Mock data pour les prix d'offres
|
|
55
|
+
exports.mockOfferPrices = [
|
|
56
|
+
{
|
|
57
|
+
id: "offer_price_1",
|
|
58
|
+
externalId: "ext_offer_price_1",
|
|
59
|
+
type: "PUBLIC",
|
|
60
|
+
itemPerPack: 5,
|
|
61
|
+
customerAccountExternalId: "",
|
|
62
|
+
customerTagExternalId: "",
|
|
63
|
+
priceRanges: exports.mockPriceRanges.single,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "offer_price_2",
|
|
67
|
+
externalId: "ext_offer_price_2",
|
|
68
|
+
type: "GROUP",
|
|
69
|
+
itemPerPack: 10,
|
|
70
|
+
customerAccountExternalId: "",
|
|
71
|
+
customerTagExternalId: "tag_123",
|
|
72
|
+
priceRanges: exports.mockPriceRanges.multiple,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "offer_price_3",
|
|
76
|
+
externalId: "ext_offer_price_3",
|
|
77
|
+
type: "ACCOUNT",
|
|
78
|
+
itemPerPack: 1,
|
|
79
|
+
customerAccountExternalId: "account_456",
|
|
80
|
+
customerTagExternalId: "",
|
|
81
|
+
priceRanges: exports.mockPriceRanges.single,
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
// Mock data pour les paramètres de test
|
|
85
|
+
exports.mockParameters = {
|
|
86
|
+
getPaginatedOfferPrices: {
|
|
87
|
+
valid: {
|
|
88
|
+
offerInventoryExternalId: "inventory_123",
|
|
89
|
+
},
|
|
90
|
+
withPagination: {
|
|
91
|
+
offerInventoryExternalId: "inventory_123",
|
|
92
|
+
page: 0,
|
|
93
|
+
size: 20,
|
|
94
|
+
},
|
|
95
|
+
withSorting: {
|
|
96
|
+
offerInventoryExternalId: "inventory_123",
|
|
97
|
+
page: 1,
|
|
98
|
+
size: 10,
|
|
99
|
+
sort: "createdAt,desc",
|
|
100
|
+
},
|
|
101
|
+
missingRequired: {
|
|
102
|
+
page: 0,
|
|
103
|
+
size: 20,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
// Mock data pour les objets de pagination
|
|
108
|
+
exports.mockPageableObject = {
|
|
109
|
+
offset: 0,
|
|
110
|
+
pageNumber: 0,
|
|
111
|
+
pageSize: 20,
|
|
112
|
+
paged: true,
|
|
113
|
+
sort: [],
|
|
114
|
+
unpaged: false,
|
|
115
|
+
};
|
|
116
|
+
exports.mockOrder = {
|
|
117
|
+
ascending: false,
|
|
118
|
+
descending: true,
|
|
119
|
+
direction: "DESC",
|
|
120
|
+
ignoreCase: false,
|
|
121
|
+
nullHandling: "NATIVE",
|
|
122
|
+
property: "createdAt",
|
|
123
|
+
};
|
|
124
|
+
// Mock Headers pour les tests
|
|
125
|
+
function createMockHeaders() {
|
|
126
|
+
const headers = new Headers();
|
|
127
|
+
headers.append("Content-Type", "application/json");
|
|
128
|
+
headers.append("dj-client", "test-client");
|
|
129
|
+
headers.append("dj-api-key", "test-api-key");
|
|
130
|
+
return headers;
|
|
131
|
+
}
|
|
132
|
+
// Mock data pour les réponses d'API
|
|
133
|
+
exports.mockResponses = {
|
|
134
|
+
getPaginatedOfferPrices: {
|
|
135
|
+
success: {
|
|
136
|
+
data: {
|
|
137
|
+
content: exports.mockOfferPrices,
|
|
138
|
+
empty: false,
|
|
139
|
+
first: true,
|
|
140
|
+
last: false,
|
|
141
|
+
number: 0,
|
|
142
|
+
numberOfElements: 3,
|
|
143
|
+
pageable: exports.mockPageableObject,
|
|
144
|
+
size: 20,
|
|
145
|
+
sort: [exports.mockOrder],
|
|
146
|
+
totalElements: 15,
|
|
147
|
+
},
|
|
148
|
+
headers: createMockHeaders(),
|
|
149
|
+
status: 200,
|
|
150
|
+
},
|
|
151
|
+
empty: {
|
|
152
|
+
data: {
|
|
153
|
+
content: [],
|
|
154
|
+
empty: true,
|
|
155
|
+
first: true,
|
|
156
|
+
last: true,
|
|
157
|
+
number: 0,
|
|
158
|
+
numberOfElements: 0,
|
|
159
|
+
pageable: exports.mockPageableObject,
|
|
160
|
+
size: 20,
|
|
161
|
+
sort: [],
|
|
162
|
+
totalElements: 0,
|
|
163
|
+
},
|
|
164
|
+
headers: createMockHeaders(),
|
|
165
|
+
status: 200,
|
|
166
|
+
},
|
|
167
|
+
singleItem: {
|
|
168
|
+
data: {
|
|
169
|
+
content: [exports.mockOfferPrices[0]],
|
|
170
|
+
empty: false,
|
|
171
|
+
first: true,
|
|
172
|
+
last: true,
|
|
173
|
+
number: 0,
|
|
174
|
+
numberOfElements: 1,
|
|
175
|
+
pageable: exports.mockPageableObject,
|
|
176
|
+
size: 20,
|
|
177
|
+
sort: [],
|
|
178
|
+
totalElements: 1,
|
|
179
|
+
},
|
|
180
|
+
headers: createMockHeaders(),
|
|
181
|
+
status: 200,
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
// Mock data pour les erreurs
|
|
186
|
+
exports.mockErrors = {
|
|
187
|
+
networkError: new Error("Network error"),
|
|
188
|
+
unauthorized: new Error("Unauthorized"),
|
|
189
|
+
badRequest: new Error("Bad request"),
|
|
190
|
+
notFound: new Error("Not found"),
|
|
191
|
+
serverError: new Error("Internal server error"),
|
|
192
|
+
missingParameter: new Error("Missing required parameter: offerInventoryExternalId"),
|
|
193
|
+
};
|
|
194
|
+
// Mock data pour les cas d'erreur HTTP
|
|
195
|
+
exports.mockHttpErrors = {
|
|
196
|
+
400: { status: 400, message: "Bad Request" },
|
|
197
|
+
401: { status: 401, message: "Unauthorized" },
|
|
198
|
+
404: { status: 404, message: "Not Found" },
|
|
199
|
+
500: { status: 500, message: "Internal Server Error" },
|
|
200
|
+
};
|
|
@@ -155,7 +155,7 @@ async function getPaymentMethods({ reference, countryCode, referenceType, locale
|
|
|
155
155
|
(0, parameters_validation_1.required)({ reference });
|
|
156
156
|
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
157
157
|
method: "GET",
|
|
158
|
-
path: `/v1/shop/payments/methods`,
|
|
158
|
+
path: `/v1/shop/payments/payments-methods`,
|
|
159
159
|
params: {
|
|
160
160
|
reference,
|
|
161
161
|
countryCode,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { SupplierDto, SupplierEvaluationDto, SupplierIdType } from "../../../interfaces/models/supplier";
|
|
2
|
+
import { PageableParameters } from "../../../interfaces/models/common";
|
|
3
|
+
export declare const mockSuppliers: SupplierDto[];
|
|
4
|
+
export declare const mockSupplierEvaluations: SupplierEvaluationDto[];
|
|
5
|
+
export declare const mockPageable: PageableParameters;
|
|
6
|
+
export declare const mockPageableWithSort: PageableParameters;
|
|
7
|
+
export declare const mockGetSuppliersParams: {
|
|
8
|
+
pageable: PageableParameters;
|
|
9
|
+
supplierStatus: string;
|
|
10
|
+
supplierIds: string[];
|
|
11
|
+
idType: SupplierIdType;
|
|
12
|
+
};
|
|
13
|
+
export declare const mockGetSupplierParams: {
|
|
14
|
+
supplierId: string;
|
|
15
|
+
idType: SupplierIdType;
|
|
16
|
+
};
|
|
17
|
+
export declare const mockGetSupplierEvaluationsParams: {
|
|
18
|
+
supplierId: string;
|
|
19
|
+
idType: SupplierIdType;
|
|
20
|
+
pageable: PageableParameters;
|
|
21
|
+
};
|
|
22
|
+
export declare const mockErrorResponse: {
|
|
23
|
+
message: string;
|
|
24
|
+
status: number;
|
|
25
|
+
};
|
|
26
|
+
export declare const mockNotFoundError: {
|
|
27
|
+
message: string;
|
|
28
|
+
status: number;
|
|
29
|
+
};
|
|
30
|
+
export declare const mockValidationError: {
|
|
31
|
+
message: string;
|
|
32
|
+
status: number;
|
|
33
|
+
};
|
|
34
|
+
export declare const mockEnhancedFetchSuccess: {
|
|
35
|
+
data: SupplierDto[];
|
|
36
|
+
headers: Headers;
|
|
37
|
+
status: number;
|
|
38
|
+
};
|
|
39
|
+
export declare const mockEnhancedFetchSupplierSuccess: {
|
|
40
|
+
data: SupplierDto;
|
|
41
|
+
headers: Headers;
|
|
42
|
+
status: number;
|
|
43
|
+
};
|
|
44
|
+
export declare const mockEnhancedFetchEvaluationsSuccess: {
|
|
45
|
+
data: SupplierEvaluationDto[];
|
|
46
|
+
headers: Headers;
|
|
47
|
+
status: number;
|
|
48
|
+
};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mockEnhancedFetchEvaluationsSuccess = exports.mockEnhancedFetchSupplierSuccess = exports.mockEnhancedFetchSuccess = exports.mockValidationError = exports.mockNotFoundError = exports.mockErrorResponse = exports.mockGetSupplierEvaluationsParams = exports.mockGetSupplierParams = exports.mockGetSuppliersParams = exports.mockPageableWithSort = exports.mockPageable = exports.mockSupplierEvaluations = exports.mockSuppliers = void 0;
|
|
4
|
+
// Mock data for suppliers
|
|
5
|
+
exports.mockSuppliers = [
|
|
6
|
+
{
|
|
7
|
+
id: "supplier-1",
|
|
8
|
+
externalId: "ext-supplier-1",
|
|
9
|
+
name: "Supplier One",
|
|
10
|
+
description: "First test supplier",
|
|
11
|
+
supplierStatus: "ACTIVE",
|
|
12
|
+
supplierRating: "4.5",
|
|
13
|
+
evaluationCount: 10,
|
|
14
|
+
totalOffers: 50,
|
|
15
|
+
totalOrders: 100,
|
|
16
|
+
totalSales: 50000,
|
|
17
|
+
returnPolicy: "30 days return policy",
|
|
18
|
+
logo: "https://example.com/logo1.png",
|
|
19
|
+
banner: "https://example.com/banner1.png",
|
|
20
|
+
additionalImageLink: ["https://example.com/image1.png"],
|
|
21
|
+
isDefault: true,
|
|
22
|
+
externalSource: "MIRAKL",
|
|
23
|
+
customFieldValues: [],
|
|
24
|
+
paymentDueDate: {
|
|
25
|
+
paymentDueDateDelay: 30,
|
|
26
|
+
paymentDueDateMode: "SIMPLE",
|
|
27
|
+
},
|
|
28
|
+
createdAt: "2023-01-01T00:00:00Z",
|
|
29
|
+
updatedAt: "2023-01-01T00:00:00Z",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "supplier-2",
|
|
33
|
+
externalId: "ext-supplier-2",
|
|
34
|
+
name: "Supplier Two",
|
|
35
|
+
description: "Second test supplier",
|
|
36
|
+
supplierStatus: "INACTIVE",
|
|
37
|
+
supplierRating: "3.8",
|
|
38
|
+
evaluationCount: 5,
|
|
39
|
+
totalOffers: 25,
|
|
40
|
+
totalOrders: 50,
|
|
41
|
+
totalSales: 25000,
|
|
42
|
+
returnPolicy: "14 days return policy",
|
|
43
|
+
logo: "https://example.com/logo2.png",
|
|
44
|
+
banner: "https://example.com/banner2.png",
|
|
45
|
+
additionalImageLink: ["https://example.com/image2.png"],
|
|
46
|
+
isDefault: false,
|
|
47
|
+
externalSource: "CLIENT",
|
|
48
|
+
customFieldValues: [],
|
|
49
|
+
paymentDueDate: {
|
|
50
|
+
paymentDueDateDelay: 15,
|
|
51
|
+
paymentDueDateMode: "SIMPLE",
|
|
52
|
+
},
|
|
53
|
+
createdAt: "2023-01-02T00:00:00Z",
|
|
54
|
+
updatedAt: "2023-01-02T00:00:00Z",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "supplier-3",
|
|
58
|
+
externalId: "ext-supplier-3",
|
|
59
|
+
name: "Supplier Three",
|
|
60
|
+
description: "Third test supplier",
|
|
61
|
+
supplierStatus: "SUSPENDED",
|
|
62
|
+
supplierRating: "2.1",
|
|
63
|
+
evaluationCount: 2,
|
|
64
|
+
totalOffers: 10,
|
|
65
|
+
totalOrders: 20,
|
|
66
|
+
totalSales: 10000,
|
|
67
|
+
returnPolicy: "No returns",
|
|
68
|
+
logo: "https://example.com/logo3.png",
|
|
69
|
+
banner: "https://example.com/banner3.png",
|
|
70
|
+
additionalImageLink: ["https://example.com/image3.png"],
|
|
71
|
+
isDefault: false,
|
|
72
|
+
externalSource: "EXTERN",
|
|
73
|
+
customFieldValues: [],
|
|
74
|
+
paymentDueDate: {
|
|
75
|
+
paymentDueDateDelay: 7,
|
|
76
|
+
paymentDueDateMode: "END_OF_MONTH",
|
|
77
|
+
},
|
|
78
|
+
createdAt: "2023-01-03T00:00:00Z",
|
|
79
|
+
updatedAt: "2023-01-03T00:00:00Z",
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
// Mock data for supplier evaluations
|
|
83
|
+
exports.mockSupplierEvaluations = [
|
|
84
|
+
{
|
|
85
|
+
comment: "Excellent service and fast delivery",
|
|
86
|
+
creationDate: "2023-01-15T10:00:00Z",
|
|
87
|
+
customerId: "customer-1",
|
|
88
|
+
firstname: "John",
|
|
89
|
+
lastname: "Doe",
|
|
90
|
+
grade: 5,
|
|
91
|
+
lastUpdatedDate: "2023-01-15T10:00:00Z",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
comment: "Good quality products",
|
|
95
|
+
creationDate: "2023-01-14T15:30:00Z",
|
|
96
|
+
customerId: "customer-2",
|
|
97
|
+
firstname: "Jane",
|
|
98
|
+
lastname: "Smith",
|
|
99
|
+
grade: 4,
|
|
100
|
+
lastUpdatedDate: "2023-01-14T15:30:00Z",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
comment: "Average experience",
|
|
104
|
+
creationDate: "2023-01-13T09:15:00Z",
|
|
105
|
+
customerId: "customer-3",
|
|
106
|
+
firstname: "Bob",
|
|
107
|
+
lastname: "Johnson",
|
|
108
|
+
grade: 3,
|
|
109
|
+
lastUpdatedDate: "2023-01-13T09:15:00Z",
|
|
110
|
+
},
|
|
111
|
+
];
|
|
112
|
+
// Mock pagination data
|
|
113
|
+
exports.mockPageable = {
|
|
114
|
+
page: 0,
|
|
115
|
+
size: 10,
|
|
116
|
+
sort: ["createdAt,desc"],
|
|
117
|
+
};
|
|
118
|
+
exports.mockPageableWithSort = {
|
|
119
|
+
page: 1,
|
|
120
|
+
size: 5,
|
|
121
|
+
sort: ["name,asc"],
|
|
122
|
+
};
|
|
123
|
+
// Mock request parameters
|
|
124
|
+
exports.mockGetSuppliersParams = {
|
|
125
|
+
pageable: exports.mockPageable,
|
|
126
|
+
supplierStatus: "ACTIVE",
|
|
127
|
+
supplierIds: ["supplier-1", "supplier-2"],
|
|
128
|
+
idType: "DJUST_ID",
|
|
129
|
+
};
|
|
130
|
+
exports.mockGetSupplierParams = {
|
|
131
|
+
supplierId: "supplier-1",
|
|
132
|
+
idType: "DJUST_ID",
|
|
133
|
+
};
|
|
134
|
+
exports.mockGetSupplierEvaluationsParams = {
|
|
135
|
+
supplierId: "supplier-1",
|
|
136
|
+
idType: "DJUST_ID",
|
|
137
|
+
pageable: exports.mockPageable,
|
|
138
|
+
};
|
|
139
|
+
// Mock error responses
|
|
140
|
+
exports.mockErrorResponse = {
|
|
141
|
+
message: "Internal server error",
|
|
142
|
+
status: 500,
|
|
143
|
+
};
|
|
144
|
+
exports.mockNotFoundError = {
|
|
145
|
+
message: "Supplier not found",
|
|
146
|
+
status: 404,
|
|
147
|
+
};
|
|
148
|
+
exports.mockValidationError = {
|
|
149
|
+
message: "Validation failed",
|
|
150
|
+
status: 400,
|
|
151
|
+
};
|
|
152
|
+
// Mock enhancedFetch responses
|
|
153
|
+
exports.mockEnhancedFetchSuccess = {
|
|
154
|
+
data: exports.mockSuppliers,
|
|
155
|
+
headers: new Headers(),
|
|
156
|
+
status: 200,
|
|
157
|
+
};
|
|
158
|
+
exports.mockEnhancedFetchSupplierSuccess = {
|
|
159
|
+
data: exports.mockSuppliers[0],
|
|
160
|
+
headers: new Headers(),
|
|
161
|
+
status: 200,
|
|
162
|
+
};
|
|
163
|
+
exports.mockEnhancedFetchEvaluationsSuccess = {
|
|
164
|
+
data: exports.mockSupplierEvaluations,
|
|
165
|
+
headers: new Headers(),
|
|
166
|
+
status: 200,
|
|
167
|
+
};
|
|
@@ -4,10 +4,10 @@ import { PageableParameters } from "../../interfaces/models/common";
|
|
|
4
4
|
* Request parameters type definitions
|
|
5
5
|
*/
|
|
6
6
|
export interface GetSuppliersParameters {
|
|
7
|
-
supplierIds: string[];
|
|
8
|
-
idType: SupplierIdType;
|
|
9
7
|
pageable: PageableParameters;
|
|
10
|
-
supplierStatus
|
|
8
|
+
supplierStatus?: string;
|
|
9
|
+
supplierIds?: string[];
|
|
10
|
+
idType?: SupplierIdType;
|
|
11
11
|
}
|
|
12
12
|
export interface GetSupplierParameters {
|
|
13
13
|
supplierId: string;
|