@djust-b2b/djust-front-sdk 1.22.2 → 1.23.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/README.md +41 -10
- package/lib/{src/helpers → helpers}/parameters-validation.js +2 -2
- package/lib/{src/index.d.ts → index.d.ts} +18 -31
- package/lib/{src/index.js → index.js} +1 -2
- package/lib/{src/interfaces → interfaces}/models/common.d.ts +2 -2
- package/lib/{src/interfaces → interfaces}/models/customer-user.d.ts +1 -1
- package/lib/{src/interfaces → interfaces}/models/order.d.ts +90 -3
- package/lib/{src/services → services}/auth/definitions.requests.js +3 -0
- package/lib/{src/services → services}/cart/index.d.ts +2 -2
- package/lib/{src/services → services}/cart/index.js +2 -2
- package/lib/{src/services → services}/commercial-order/definitions.d.ts +33 -2
- package/lib/{src/services → services}/commercial-order/index.d.ts +167 -1
- package/lib/{src/services → services}/commercial-order/index.js +225 -4
- package/lib/{src/services → services}/customer-account/definitions.d.ts +14 -1
- package/lib/{src/services → services}/customer-account/index.d.ts +28 -2
- package/lib/{src/services → services}/customer-account/index.js +38 -0
- package/lib/{src/services → services}/customer-user/definitions.d.ts +1 -1
- package/lib/{src/services → services}/logistic-order/definitions.d.ts +94 -4
- package/lib/{src/services → services}/logistic-order/index.d.ts +423 -9
- package/lib/{src/services → services}/logistic-order/index.js +534 -8
- package/lib/{src/services → services}/navigation-category/definitions.d.ts +0 -3
- package/lib/{src/services → services}/product/definitions.d.ts +1 -2
- package/lib/{src/services → services}/product-variant/definitions.d.ts +1 -2
- package/lib/{src/settings → settings}/fetch-instance.d.ts +2 -3
- package/lib/{src/settings → settings}/fetch-instance.js +67 -30
- package/package.json +5 -6
- package/lib/instrument.d.ts +0 -2
- package/lib/instrument.js +0 -33
- /package/lib/{src/helpers → helpers}/parameters-validation.d.ts +0 -0
- /package/lib/{src/helpers → helpers}/utils.d.ts +0 -0
- /package/lib/{src/helpers → helpers}/utils.js +0 -0
- /package/lib/{src/interfaces → interfaces}/index.d.ts +0 -0
- /package/lib/{src/interfaces → interfaces}/index.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/address.d.ts +0 -0
- /package/lib/{src/interfaces → interfaces}/models/address.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/attribute.d.ts +0 -0
- /package/lib/{src/interfaces → interfaces}/models/attribute.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/auth.d.ts +0 -0
- /package/lib/{src/interfaces → interfaces}/models/auth.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/buying-list.d.ts +0 -0
- /package/lib/{src/interfaces → interfaces}/models/buying-list.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/cart.d.ts +0 -0
- /package/lib/{src/interfaces → interfaces}/models/cart.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/common.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/custom-field.d.ts +0 -0
- /package/lib/{src/interfaces → interfaces}/models/custom-field.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/customer-account.d.ts +0 -0
- /package/lib/{src/interfaces → interfaces}/models/customer-account.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/customer-organisation.d.ts +0 -0
- /package/lib/{src/interfaces → interfaces}/models/customer-organisation.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/customer-user.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/incident.d.ts +0 -0
- /package/lib/{src/interfaces → interfaces}/models/incident.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/navigation-category.d.ts +0 -0
- /package/lib/{src/interfaces → interfaces}/models/navigation-category.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/offer.d.ts +0 -0
- /package/lib/{src/interfaces → interfaces}/models/offer.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/order.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/payment.d.ts +0 -0
- /package/lib/{src/interfaces → interfaces}/models/payment.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/price.d.ts +0 -0
- /package/lib/{src/interfaces → interfaces}/models/price.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/product.d.ts +0 -0
- /package/lib/{src/interfaces → interfaces}/models/product.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/quote.d.ts +0 -0
- /package/lib/{src/interfaces → interfaces}/models/quote.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/searchProduct.d.ts +0 -0
- /package/lib/{src/interfaces → interfaces}/models/searchProduct.js +0 -0
- /package/lib/{src/interfaces → interfaces}/models/supplier.d.ts +0 -0
- /package/lib/{src/interfaces → interfaces}/models/supplier.js +0 -0
- /package/lib/{src/services → services}/auth/definitions.d.ts +0 -0
- /package/lib/{src/services → services}/auth/definitions.js +0 -0
- /package/lib/{src/services → services}/auth/definitions.requests.d.ts +0 -0
- /package/lib/{src/services → services}/auth/index.d.ts +0 -0
- /package/lib/{src/services → services}/auth/index.js +0 -0
- /package/lib/{src/services → services}/buying-list/definitions.d.ts +0 -0
- /package/lib/{src/services → services}/buying-list/definitions.js +0 -0
- /package/lib/{src/services → services}/buying-list/index.d.ts +0 -0
- /package/lib/{src/services → services}/buying-list/index.js +0 -0
- /package/lib/{src/services → services}/cart/definitions.d.ts +0 -0
- /package/lib/{src/services → services}/cart/definitions.js +0 -0
- /package/lib/{src/services → services}/commercial-order/definitions.js +0 -0
- /package/lib/{src/services → services}/custom-field/definitions.d.ts +0 -0
- /package/lib/{src/services → services}/custom-field/definitions.js +0 -0
- /package/lib/{src/services → services}/custom-field/index.d.ts +0 -0
- /package/lib/{src/services → services}/custom-field/index.js +0 -0
- /package/lib/{src/services → services}/customer-account/definitions.js +0 -0
- /package/lib/{src/services → services}/customer-user/definitions.js +0 -0
- /package/lib/{src/services → services}/customer-user/index.d.ts +0 -0
- /package/lib/{src/services → services}/customer-user/index.js +0 -0
- /package/lib/{src/services → services}/incident/definitions.d.ts +0 -0
- /package/lib/{src/services → services}/incident/definitions.js +0 -0
- /package/lib/{src/services → services}/incident/index.d.ts +0 -0
- /package/lib/{src/services → services}/incident/index.js +0 -0
- /package/lib/{src/services → services}/logistic-order/definitions.js +0 -0
- /package/lib/{src/services → services}/navigation-category/definitions.js +0 -0
- /package/lib/{src/services → services}/navigation-category/index.d.ts +0 -0
- /package/lib/{src/services → services}/navigation-category/index.js +0 -0
- /package/lib/{src/services → services}/product/definitions.js +0 -0
- /package/lib/{src/services → services}/product/index.d.ts +0 -0
- /package/lib/{src/services → services}/product/index.js +0 -0
- /package/lib/{src/services → services}/product-variant/definitions.js +0 -0
- /package/lib/{src/services → services}/product-variant/index.d.ts +0 -0
- /package/lib/{src/services → services}/product-variant/index.js +0 -0
- /package/lib/{src/services → services}/quote/definitions.d.ts +0 -0
- /package/lib/{src/services → services}/quote/definitions.js +0 -0
- /package/lib/{src/services → services}/quote/index.d.ts +0 -0
- /package/lib/{src/services → services}/quote/index.js +0 -0
- /package/lib/{src/services → services}/supplier/definitions.d.ts +0 -0
- /package/lib/{src/services → services}/supplier/definitions.js +0 -0
- /package/lib/{src/services → services}/supplier/index.d.ts +0 -0
- /package/lib/{src/services → services}/supplier/index.js +0 -0
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCommercialOrders = getCommercialOrders;
|
|
4
4
|
exports.createCommercialOrder = createCommercialOrder;
|
|
5
|
+
exports.createCommercialOrderV2 = createCommercialOrderV2;
|
|
5
6
|
exports.getCommercialOrder = getCommercialOrder;
|
|
7
|
+
exports.updateCommercialOrder = updateCommercialOrder;
|
|
6
8
|
exports.createCommercialOrderCardRegistration = createCommercialOrderCardRegistration;
|
|
7
9
|
exports.updateCommercialOrderBillingInformation = updateCommercialOrderBillingInformation;
|
|
8
10
|
exports.setCommercialOrderStatusAsCreated = setCommercialOrderStatusAsCreated;
|
|
@@ -12,6 +14,9 @@ exports.createCommercialOrderPreauthorization = createCommercialOrderPreauthoriz
|
|
|
12
14
|
exports.updateCommercialOrderShippingAddress = updateCommercialOrderShippingAddress;
|
|
13
15
|
exports.updateCommercialOrderShippingInformation = updateCommercialOrderShippingInformation;
|
|
14
16
|
exports.updateCommercialOrderShippingType = updateCommercialOrderShippingType;
|
|
17
|
+
exports.deleteCommercialOrder = deleteCommercialOrder;
|
|
18
|
+
exports.updateCommercialOrderLines = updateCommercialOrderLines;
|
|
19
|
+
exports.deleteCommercialOrderLines = deleteCommercialOrderLines;
|
|
15
20
|
const parameters_validation_1 = require("../../helpers/parameters-validation");
|
|
16
21
|
const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
17
22
|
/**
|
|
@@ -46,7 +51,7 @@ const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
|
46
51
|
*/
|
|
47
52
|
async function getCommercialOrders({ locale, nbPreviewLines, }) {
|
|
48
53
|
(0, parameters_validation_1.required)({ locale });
|
|
49
|
-
const { data } = await
|
|
54
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
50
55
|
method: "GET",
|
|
51
56
|
path: `/v1/shop/commercial-orders`,
|
|
52
57
|
params: {
|
|
@@ -108,6 +113,48 @@ async function createCommercialOrder({ nbPreviewLines, channel, customFields, lo
|
|
|
108
113
|
});
|
|
109
114
|
return data;
|
|
110
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* 🚚 Creates commercial orders V2.
|
|
118
|
+
*
|
|
119
|
+
* This function creates a commercial order (Version 2).
|
|
120
|
+
*
|
|
121
|
+
* 🛠 **Endpoint**: `POST /v2/shop/commercial-orders [ORDER-108]`
|
|
122
|
+
*
|
|
123
|
+
* | Parameter | Type | Required | Description |
|
|
124
|
+
* |----------------------|--------------------------------------|-----------------------------------------------------------------------|
|
|
125
|
+
* | `customFieldIdType` | `IdType` | ❌ | The custom field id type to use. |
|
|
126
|
+
* | `customFields` | `CustomFieldValueRequest[]` | ❌ | The custom fields to add to the created commercial order. |
|
|
127
|
+
*
|
|
128
|
+
* 📤 **Returns**:
|
|
129
|
+
* A `Promise` resolving to a single `CreateCommercialOrderV2Response` object representing the created commercial orders [ORDER-108].
|
|
130
|
+
*
|
|
131
|
+
* 🛠 **Example usage**:
|
|
132
|
+
* ```ts
|
|
133
|
+
* const orders = await createCommercialOrderV2({
|
|
134
|
+
* customFieldIdType: "DJUST_ID",
|
|
135
|
+
* customFields: [
|
|
136
|
+
* {
|
|
137
|
+
* "customFieldId": "string",
|
|
138
|
+
* "customFieldValue": "string"
|
|
139
|
+
* }
|
|
140
|
+
* ],
|
|
141
|
+
* });
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* @param {CreateCommercialOrderV2Parameters} params - The body of the request.
|
|
145
|
+
* @returns {Promise<CreateCommercialOrderV2Response>} A promise resolving to the response containing the created commercial orders.
|
|
146
|
+
*/
|
|
147
|
+
async function createCommercialOrderV2({ customFieldIdType, customFields, }) {
|
|
148
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
149
|
+
method: "POST",
|
|
150
|
+
path: `/v2/shop/commercial-orders`,
|
|
151
|
+
body: JSON.stringify({
|
|
152
|
+
customFieldIdType,
|
|
153
|
+
customFields,
|
|
154
|
+
}),
|
|
155
|
+
});
|
|
156
|
+
return data;
|
|
157
|
+
}
|
|
111
158
|
/**
|
|
112
159
|
* 🚚 Gets a specific commercial order.
|
|
113
160
|
*
|
|
@@ -141,7 +188,7 @@ async function createCommercialOrder({ nbPreviewLines, channel, customFields, lo
|
|
|
141
188
|
*/
|
|
142
189
|
async function getCommercialOrder({ orderId, idType, locale, nbPreviewLines, }) {
|
|
143
190
|
(0, parameters_validation_1.required)({ orderId, locale });
|
|
144
|
-
const { data } = await
|
|
191
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
145
192
|
method: "GET",
|
|
146
193
|
path: `/v1/shop/commercial-orders/${orderId}`,
|
|
147
194
|
params: {
|
|
@@ -152,6 +199,50 @@ async function getCommercialOrder({ orderId, idType, locale, nbPreviewLines, })
|
|
|
152
199
|
});
|
|
153
200
|
return data;
|
|
154
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* 🚚 Update commercial orders.
|
|
204
|
+
*
|
|
205
|
+
* This function update a commercial order.
|
|
206
|
+
*
|
|
207
|
+
* 🛠 **Endpoint**: `POST /v2/shop/commercial-orders/${commercialOrderId} [ORDER-222]`
|
|
208
|
+
*
|
|
209
|
+
* | Parameter | Type | Required | Description |
|
|
210
|
+
* |----------------------|--------------------------------------|----------------------------------------------------------------------|
|
|
211
|
+
* | `commercialOrderId` | `string` | ✅ | The commercial order Id. |
|
|
212
|
+
* | `customFieldIdType` | `IdType` | ❌ | The custom field id type to use. |
|
|
213
|
+
* | `customFields` | `CustomFieldValueRequest[]` | ❌ | The custom fields to add to the created commercial order. |
|
|
214
|
+
*
|
|
215
|
+
* 📤 **Returns**:
|
|
216
|
+
* A `Promise<void>` when the commercialOrder is successfully updated. No additional data is returned.
|
|
217
|
+
*
|
|
218
|
+
* 🛠 **Example usage**:
|
|
219
|
+
* ```ts
|
|
220
|
+
* const orders = await updateCommercialOrder({
|
|
221
|
+
* customFieldIdType: "EXTERNAL_ID",
|
|
222
|
+
* customFields: [
|
|
223
|
+
* {
|
|
224
|
+
* "customFieldId": "string",
|
|
225
|
+
* "customFieldValue": "string"
|
|
226
|
+
* }
|
|
227
|
+
* ],
|
|
228
|
+
* });
|
|
229
|
+
* ```
|
|
230
|
+
*
|
|
231
|
+
* @param {UpdateCommercialOrderParameters} params - The params of the request.
|
|
232
|
+
* @returns {Promise<void>}
|
|
233
|
+
*/
|
|
234
|
+
async function updateCommercialOrder({ commercialOrderId, customFieldIdType, customFields, }) {
|
|
235
|
+
(0, parameters_validation_1.required)({ commercialOrderId });
|
|
236
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
237
|
+
method: "PUT",
|
|
238
|
+
path: `/v2/shop/commercial-orders/${commercialOrderId}`,
|
|
239
|
+
body: JSON.stringify({
|
|
240
|
+
customFieldIdType,
|
|
241
|
+
customFields,
|
|
242
|
+
}),
|
|
243
|
+
});
|
|
244
|
+
return data;
|
|
245
|
+
}
|
|
155
246
|
/**
|
|
156
247
|
* 🚚 Creates a specific commercial order's card registration.
|
|
157
248
|
*
|
|
@@ -349,7 +440,7 @@ async function setCommercialOrderStatusAsOnHold({ orderId, }) {
|
|
|
349
440
|
*/
|
|
350
441
|
async function getCommercialOrderPaymentPageUrl({ orderId, paymentOption, paymentProvider, }) {
|
|
351
442
|
(0, parameters_validation_1.required)({ orderId, paymentOption });
|
|
352
|
-
const { data } = await
|
|
443
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
353
444
|
method: "GET",
|
|
354
445
|
path: `/v1/shop/commercial-orders/${orderId}/payment-page`,
|
|
355
446
|
params: {
|
|
@@ -399,7 +490,7 @@ async function getCommercialOrderPaymentPageUrl({ orderId, paymentOption, paymen
|
|
|
399
490
|
*/
|
|
400
491
|
async function createCommercialOrderPreauthorization({ orderId, paymentProvider, authorId, browserInfo, ipAddress, paymentCardInfo, }) {
|
|
401
492
|
(0, parameters_validation_1.required)({ orderId, paymentProvider, paymentCardInfo });
|
|
402
|
-
const { data } = await
|
|
493
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
403
494
|
method: "POST",
|
|
404
495
|
path: `/v1/shop/commercial-orders/${orderId}/preauthorization`,
|
|
405
496
|
body: JSON.stringify({
|
|
@@ -531,3 +622,133 @@ async function updateCommercialOrderShippingType({ orderId, shippingType, }) {
|
|
|
531
622
|
}),
|
|
532
623
|
});
|
|
533
624
|
}
|
|
625
|
+
/**
|
|
626
|
+
* ❌ Deletes a specific commercial order.
|
|
627
|
+
*
|
|
628
|
+
* This function deletes a commercial order identified by the `commercialOrderId`.
|
|
629
|
+
* The `commercialOrderId` parameter is required and validated before the request is executed.
|
|
630
|
+
*
|
|
631
|
+
* 🛠 **Endpoint**: `DELETE /v2/shop/commercial-orders/${commercialOrderId}` [ORDER-300]
|
|
632
|
+
*
|
|
633
|
+
* | Parameter | Type | Required | Description |
|
|
634
|
+
* |----------------------|--------- |----------|-----------------------------------------------|
|
|
635
|
+
* | `commercialOrderId` | `string` | ✅ | The ID of the commercial order to be deleted. |
|
|
636
|
+
*
|
|
637
|
+
* 📤 **Returns**:
|
|
638
|
+
* A `Promise` resolving with an empty response (`204 No Content`) when the commercial order is successfully deleted.
|
|
639
|
+
*
|
|
640
|
+
* 🛠 **Example usage**:
|
|
641
|
+
* ```ts
|
|
642
|
+
* await deleteCommercialOrder("commercialOrder123");
|
|
643
|
+
* ```
|
|
644
|
+
*
|
|
645
|
+
* @param {string} commercialOrderId - The ID of the commercial order to be deleted.
|
|
646
|
+
* @throws {Error} If `commercialOrderId` is missing.
|
|
647
|
+
* @returns {Promise<void>} A promise resolving when the commercial order is successfully deleted.
|
|
648
|
+
*/
|
|
649
|
+
async function deleteCommercialOrder(commercialOrderId) {
|
|
650
|
+
(0, parameters_validation_1.required)({ commercialOrderId });
|
|
651
|
+
await (0, fetch_instance_1.enhancedFetch)({
|
|
652
|
+
method: "DELETE",
|
|
653
|
+
path: `/v2/shop/commercial-orders/${commercialOrderId}`,
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* 🚚 Update specific commercial order lines.
|
|
658
|
+
*
|
|
659
|
+
* This function update commercial order lines identified by the `commercialOrderId`.
|
|
660
|
+
* This `commercialOrderId` parameter is required and validated before the request is executed.
|
|
661
|
+
*
|
|
662
|
+
* 🛠 **Endpoint**: `PUT /v2/shop/commercial-orders/${commercialOrderId}/lines` [ORDER-150]
|
|
663
|
+
*
|
|
664
|
+
* | Parameter | Type | Required | Description |
|
|
665
|
+
* |------------------------------------|--------------------------------------|-----------------|----------------------------------------------------------------|
|
|
666
|
+
* | `commercialOrderId` | `string` | ✅ | The ID of the commercial order whose lines are to be deleted |
|
|
667
|
+
* | `customFieldIdType` | `IdType` | ❌ | The custom field id type to use. |
|
|
668
|
+
* | `lineIdType` | `string` | ❌ | The line id type to use. |
|
|
669
|
+
* | `lineType` | `string` | ❌ | The line type to use. |
|
|
670
|
+
* | `updateOrderCommercialLines` | `OrderLogisticLineUpdate[]` | ❌ | Attributes to update. Can be empty object. |
|
|
671
|
+
* | `updateOrderLineIdType` | `IdType` | ❌ | The line id type to use. |
|
|
672
|
+
* | `updateOrderLineType` | `OrderLineType` | ❌ | The line type to use. |
|
|
673
|
+
*
|
|
674
|
+
* 📤 **Returns**:
|
|
675
|
+
* A `Promise` resolving when the commercial order lines are successfully updated.
|
|
676
|
+
*
|
|
677
|
+
* 🛠 **Example usage**:
|
|
678
|
+
* ```ts
|
|
679
|
+
* const response = await updateCommercialOrderLines("commercialOrder123", {
|
|
680
|
+
* customFieldType: "DJUST_ID",
|
|
681
|
+
* lineIdType: "string",
|
|
682
|
+
* lineType: "string",
|
|
683
|
+
* updateOrderCommercialLines: [
|
|
684
|
+
* {
|
|
685
|
+
* customFields: [
|
|
686
|
+
* {
|
|
687
|
+
* customFieldId: "string",
|
|
688
|
+
* value: "string"
|
|
689
|
+
* }
|
|
690
|
+
* ],
|
|
691
|
+
* id: "string",
|
|
692
|
+
* quantity: 0,
|
|
693
|
+
* updateAction: "ADD_QUANTITY"
|
|
694
|
+
* }
|
|
695
|
+
* ],
|
|
696
|
+
* updateOrderLineIdType: "EXTERNAL_ID",
|
|
697
|
+
* updateOrderLineType: "PRODUCT_VARIANT"
|
|
698
|
+
* });
|
|
699
|
+
* ```
|
|
700
|
+
*
|
|
701
|
+
* @param {UpdateCommercialOrderLinesParameters} params - The parameters for the request.
|
|
702
|
+
* @throws {Error} If `commercialOrderId` is missing.
|
|
703
|
+
* @returns {Promise<UpdateCommercialOrderLinesResponse>} A promise resolving when the commercial order lines are successfully updated.
|
|
704
|
+
*/
|
|
705
|
+
async function updateCommercialOrderLines({ commercialOrderId, customFieldIdType, lineIdType, lineType, updateOrderCommercialLines, updateOrderLineIdType, updateOrderLineType, }) {
|
|
706
|
+
(0, parameters_validation_1.required)({ commercialOrderId });
|
|
707
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
708
|
+
method: "DELETE",
|
|
709
|
+
path: `/v2/shop/commercial-orders/${commercialOrderId}/lines`,
|
|
710
|
+
body: JSON.stringify({
|
|
711
|
+
customFieldIdType,
|
|
712
|
+
lineIdType,
|
|
713
|
+
lineType,
|
|
714
|
+
updateOrderCommercialLines,
|
|
715
|
+
updateOrderLineIdType,
|
|
716
|
+
updateOrderLineType,
|
|
717
|
+
}),
|
|
718
|
+
});
|
|
719
|
+
return data;
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* ❌ Deletes specific commercial order lines.
|
|
723
|
+
*
|
|
724
|
+
* This function deletes commercial order lines identified by the `commercialOrderId`.
|
|
725
|
+
* The `commercialOrderId` parameter is mandatory and validated before the request is executed.
|
|
726
|
+
*
|
|
727
|
+
* 🛠 **Endpoint**: `DELETE /v2/shop/commercial-orders/${commercialOrderId}/lines` [ORDER-350]
|
|
728
|
+
*
|
|
729
|
+
* | Parameter | Type | Required | Description |
|
|
730
|
+
* |----------------------|------------------- |----------|---------------------------------------------------------------|
|
|
731
|
+
* | `commercialOrderId` | `string` | ✅ | The ID of the commercial order whose lines are to be deleted |
|
|
732
|
+
* | `body` | `OfferToDelete[]` | ❌ | The list of offers to delete. Can be empty. |
|
|
733
|
+
*
|
|
734
|
+
* 📤 **Returns**:
|
|
735
|
+
* A `Promise` resolving when the commercial order lines are successfully deleted.
|
|
736
|
+
*
|
|
737
|
+
* 🛠 **Example usage**:
|
|
738
|
+
* ```ts
|
|
739
|
+
* const response = await deleteCommercialOrderLines("commercialOrder123", [{ offerPriceId: "price456" }]);
|
|
740
|
+
* ```
|
|
741
|
+
*
|
|
742
|
+
* @param {DeleteCommercialOrderLinesParameters} params - The parameters for the request.
|
|
743
|
+
* @throws {Error} If `commercialOrderId` is missing.
|
|
744
|
+
* @returns {Promise<DeleteCommercialOrderLinesResponse>} A promise resolving when the commercial order lines are successfully deleted.
|
|
745
|
+
*/
|
|
746
|
+
async function deleteCommercialOrderLines({ commercialOrderId, body, }) {
|
|
747
|
+
(0, parameters_validation_1.required)({ commercialOrderId });
|
|
748
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
749
|
+
method: "DELETE",
|
|
750
|
+
path: `/v2/shop/commercial-orders/${commercialOrderId}/lines`,
|
|
751
|
+
body: JSON.stringify(body),
|
|
752
|
+
});
|
|
753
|
+
return data;
|
|
754
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CustomFieldValueRequest } from "../../interfaces/models/custom-field";
|
|
2
2
|
import { PageOrderLogisticDto } from "../../interfaces/models/order";
|
|
3
3
|
import { AddressDto, CreateAddressRequest, UpdateAddressRequest } from "../../interfaces/models/address";
|
|
4
|
-
import { PageableParameters } from "../../interfaces/models/common";
|
|
4
|
+
import { Order, PageableObject, PageableParameters } from "../../interfaces/models/common";
|
|
5
5
|
import { CreateObjectCustomerAccountRequest, CustomerAccountDto, LegalUserDto } from "../../interfaces/models/customer-account";
|
|
6
6
|
import { CustomerOrganisationDto, CustomerOrganisationStatus } from "../../interfaces/models/customer-organisation";
|
|
7
7
|
import { CivilityType, CreateCustomerUserRequest, PageCustomerUser, PageCustomerUserDto } from "../../interfaces/models/customer-user";
|
|
@@ -100,6 +100,19 @@ export interface UpdateCustomerAccountOrganisationUserParameters {
|
|
|
100
100
|
*/
|
|
101
101
|
export interface GetCustomerAccountResponse extends CustomerAccountDto {
|
|
102
102
|
}
|
|
103
|
+
export interface GetCustomerAccountResponseV2 {
|
|
104
|
+
content: CustomerAccountDto[];
|
|
105
|
+
empty: boolean;
|
|
106
|
+
first: boolean;
|
|
107
|
+
last: boolean;
|
|
108
|
+
number: number;
|
|
109
|
+
numberOfElements: number;
|
|
110
|
+
pageable: PageableObject;
|
|
111
|
+
size: number;
|
|
112
|
+
sort: Order[];
|
|
113
|
+
totalElements: number;
|
|
114
|
+
totalPages: number;
|
|
115
|
+
}
|
|
103
116
|
export interface CreateCustomerAccountResponse extends CustomerAccountDto {
|
|
104
117
|
}
|
|
105
118
|
export interface UpdateCustomerAccountResponse extends CustomerAccountDto {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DjustConfig } from "../../interfaces/models/common";
|
|
2
|
-
import { CreateCustomerAccountAddressParameters, CreateCustomerAccountAddressResponse, CreateCustomerAccountOrganisationParameters, CreateCustomerAccountOrganisationResponse, CreateCustomerAccountParameters, CreateCustomerAccountResponse, DeleteCustomerAccountAddressParameters, DeleteCustomerAccountOrganisationAddressParameters, GetCustomerAccountAddressesParameters, GetCustomerAccountAddressesResponse, GetCustomerAccountOrdersParameters, GetCustomerAccountOrdersResponse, GetCustomerAccountOrganisationAddressesParameters, GetCustomerAccountOrganisationAddressesResponse, GetCustomerAccountOrganisationOrdersParameters, GetCustomerAccountOrganisationOrdersResponse, GetCustomerAccountOrganisationResponse, GetCustomerAccountOrganisationUsersParameters, GetCustomerAccountOrganisationUsersResponse, GetCustomerAccountResponse, GetCustomerAccountUsersParameters, GetCustomerAccountUsersResponse, UpdateCustomerAccountAddressParameters, UpdateCustomerAccountAddressResponse, UpdateCustomerAccountOrganisationAddressParameters, UpdateCustomerAccountOrganisationAddressResponse, UpdateCustomerAccountOrganisationParameters, UpdateCustomerAccountOrganisationResponse, UpdateCustomerAccountOrganisationUserParameters, UpdateCustomerAccountOrganisationUserResponse, UpdateCustomerAccountParameters, UpdateCustomerAccountResponse } from "./definitions";
|
|
1
|
+
import { DjustConfig, PageableParameters } from "../../interfaces/models/common";
|
|
2
|
+
import { CreateCustomerAccountAddressParameters, CreateCustomerAccountAddressResponse, CreateCustomerAccountOrganisationParameters, CreateCustomerAccountOrganisationResponse, CreateCustomerAccountParameters, CreateCustomerAccountResponse, DeleteCustomerAccountAddressParameters, DeleteCustomerAccountOrganisationAddressParameters, GetCustomerAccountAddressesParameters, GetCustomerAccountAddressesResponse, GetCustomerAccountOrdersParameters, GetCustomerAccountOrdersResponse, GetCustomerAccountOrganisationAddressesParameters, GetCustomerAccountOrganisationAddressesResponse, GetCustomerAccountOrganisationOrdersParameters, GetCustomerAccountOrganisationOrdersResponse, GetCustomerAccountOrganisationResponse, GetCustomerAccountOrganisationUsersParameters, GetCustomerAccountOrganisationUsersResponse, GetCustomerAccountResponse, GetCustomerAccountUsersParameters, GetCustomerAccountUsersResponse, UpdateCustomerAccountAddressParameters, UpdateCustomerAccountAddressResponse, UpdateCustomerAccountOrganisationAddressParameters, UpdateCustomerAccountOrganisationAddressResponse, UpdateCustomerAccountOrganisationParameters, UpdateCustomerAccountOrganisationResponse, UpdateCustomerAccountOrganisationUserParameters, UpdateCustomerAccountOrganisationUserResponse, UpdateCustomerAccountParameters, UpdateCustomerAccountResponse, GetCustomerAccountResponseV2 } from "./definitions";
|
|
3
3
|
/**
|
|
4
4
|
* 📄 Get customer account details.
|
|
5
5
|
*
|
|
@@ -17,6 +17,32 @@ import { CreateCustomerAccountAddressParameters, CreateCustomerAccountAddressRes
|
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
19
|
export declare function getCustomerAccount(config?: DjustConfig): Promise<GetCustomerAccountResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* 📋 Get customer accounts.
|
|
22
|
+
*
|
|
23
|
+
*
|
|
24
|
+
* 🛠 **Endpoint**: `GET /v2/shop/customer-accounts`
|
|
25
|
+
*
|
|
26
|
+
* | **Parameter** | **Type** | **Required** | **Description** |
|
|
27
|
+
* |----------------------|------------|--------------|---------------------------------------------------------------------------|
|
|
28
|
+
* | `pageable` | `object` | ❌ | The pagination parameters to retrieve paginated results. |
|
|
29
|
+
*
|
|
30
|
+
* 📤 **Returns**:
|
|
31
|
+
* A `Promise<GetCustomerAccountResponseV2>`.
|
|
32
|
+
*
|
|
33
|
+
* 🛠 **Example Usage**:
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const orders = await getCustomerAccountV2({
|
|
36
|
+
* pageable: { page: 1, size: 10 },
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @param {GetCustomerAccountOrdersParameters} params - The parameters for fetching customer accounts:
|
|
41
|
+
* - `pageable` - Pagination parameters.
|
|
42
|
+
*
|
|
43
|
+
* @returns {Promise<GetCustomerAccountResponseV2>} - The response containing the customer accounts.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getCustomerAccountV2(pageable: PageableParameters): Promise<GetCustomerAccountResponseV2>;
|
|
20
46
|
/**
|
|
21
47
|
* 📄 Creates a new customer account.
|
|
22
48
|
*
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCustomerAccount = getCustomerAccount;
|
|
4
|
+
exports.getCustomerAccountV2 = getCustomerAccountV2;
|
|
4
5
|
exports.createCustomerAccount = createCustomerAccount;
|
|
5
6
|
exports.updateCustomerAccount = updateCustomerAccount;
|
|
6
7
|
exports.getCustomerAccountAddresses = getCustomerAccountAddresses;
|
|
@@ -44,6 +45,43 @@ async function getCustomerAccount(config) {
|
|
|
44
45
|
});
|
|
45
46
|
return data;
|
|
46
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* 📋 Get customer accounts.
|
|
50
|
+
*
|
|
51
|
+
*
|
|
52
|
+
* 🛠 **Endpoint**: `GET /v2/shop/customer-accounts`
|
|
53
|
+
*
|
|
54
|
+
* | **Parameter** | **Type** | **Required** | **Description** |
|
|
55
|
+
* |----------------------|------------|--------------|---------------------------------------------------------------------------|
|
|
56
|
+
* | `pageable` | `object` | ❌ | The pagination parameters to retrieve paginated results. |
|
|
57
|
+
*
|
|
58
|
+
* 📤 **Returns**:
|
|
59
|
+
* A `Promise<GetCustomerAccountResponseV2>`.
|
|
60
|
+
*
|
|
61
|
+
* 🛠 **Example Usage**:
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const orders = await getCustomerAccountV2({
|
|
64
|
+
* pageable: { page: 1, size: 10 },
|
|
65
|
+
* });
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @param {GetCustomerAccountOrdersParameters} params - The parameters for fetching customer accounts:
|
|
69
|
+
* - `pageable` - Pagination parameters.
|
|
70
|
+
*
|
|
71
|
+
* @returns {Promise<GetCustomerAccountResponseV2>} - The response containing the customer accounts.
|
|
72
|
+
*/
|
|
73
|
+
async function getCustomerAccountV2(pageable) {
|
|
74
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
75
|
+
method: "GET",
|
|
76
|
+
path: "/v2/shop/customer-accounts",
|
|
77
|
+
params: {
|
|
78
|
+
page: pageable === null || pageable === void 0 ? void 0 : pageable.page,
|
|
79
|
+
size: pageable === null || pageable === void 0 ? void 0 : pageable.size,
|
|
80
|
+
sort: pageable === null || pageable === void 0 ? void 0 : pageable.sort,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
return data;
|
|
84
|
+
}
|
|
47
85
|
/**
|
|
48
86
|
* 📄 Creates a new customer account.
|
|
49
87
|
*
|
|
@@ -55,7 +55,7 @@ export interface UpdateCustomerUserResponse {
|
|
|
55
55
|
}
|
|
56
56
|
export interface GetCustomerUserAddressesResponse extends Array<AddressDto> {
|
|
57
57
|
}
|
|
58
|
-
export interface GetAuthenticatedUserResponse extends
|
|
58
|
+
export interface GetAuthenticatedUserResponse extends UserInfoDto {
|
|
59
59
|
}
|
|
60
60
|
export interface GetCustomerUserOrganisationsResponse extends Array<CustomerOrganisationDto> {
|
|
61
61
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { WarningReportDto } from "../../interfaces/models/common";
|
|
2
|
-
import { CustomFieldValueRequest, PageCustomFieldSearch } from "../../interfaces/models/custom-field";
|
|
3
|
-
import { ApprovalDto, OrderDocumentDto, OrderIdType, OrderLogisticDto, OrderLogisticLineDto, OrderLogisticLineUpdate, OrderLogisticStatusType, OrderRatingResponse, PageOrderLogisticDto, PageOrderLogisticLineDto, ShippingTypeInformationDto, ThreadReasonDto, ThreadReasonType, ThreadReasonTypeDto } from "../../interfaces/models/order";
|
|
1
|
+
import { IdType, PageableParameters, WarningReportDto } from "../../interfaces/models/common";
|
|
2
|
+
import { CustomFieldValueObject, CustomFieldValueRequest, PageCustomFieldSearch } from "../../interfaces/models/custom-field";
|
|
3
|
+
import { ApprovalDto, OrderDocumentDto, OrderIdType, OrderLogisticDto, OrderLogisticLineDto, OrderLogisticLineUpdate, OrderLogisticStatusType, OrderRatingResponse, PageOrderLogisticDto, PageOrderLogisticLineDto, ShippingTypeInformationDto, OrderLogisticThreadResponse, ThreadReasonDto, ThreadReasonType, ThreadReasonTypeDto, logisticOrderIncidentThreadsCustomFieldValueRequest } from "../../interfaces/models/order";
|
|
4
4
|
import { PaymentOption } from "../../interfaces/models/payment";
|
|
5
5
|
/**
|
|
6
6
|
* Request parameters type definitions
|
|
@@ -16,6 +16,27 @@ export interface GetLogisticOrdersParameters {
|
|
|
16
16
|
size?: number;
|
|
17
17
|
sort?: string[];
|
|
18
18
|
}
|
|
19
|
+
export interface GetPaginatedLogisticOrdersParameters {
|
|
20
|
+
page?: number;
|
|
21
|
+
size?: number;
|
|
22
|
+
sort?: string;
|
|
23
|
+
nbPreviewLines?: number;
|
|
24
|
+
accountCustomFieldValueCriteria?: CustomFieldValueObject[];
|
|
25
|
+
approvalIds?: string[];
|
|
26
|
+
connectedUserOnly?: boolean;
|
|
27
|
+
creationDateFrom?: string;
|
|
28
|
+
creationDateTo?: string;
|
|
29
|
+
customerAccountIds?: string[];
|
|
30
|
+
incident?: boolean;
|
|
31
|
+
locale: string;
|
|
32
|
+
logisticStatus?: string[];
|
|
33
|
+
offerCustomFieldValueCriteria?: CustomFieldValueObject[];
|
|
34
|
+
orderLogisticCustomFieldValueCriteria?: CustomFieldValueObject[];
|
|
35
|
+
paymentOptions?: string[];
|
|
36
|
+
supplierIds?: string[];
|
|
37
|
+
updateDateFrom?: string;
|
|
38
|
+
updateDateTo?: string;
|
|
39
|
+
}
|
|
19
40
|
export interface GetLogisticOrderCustomFieldsParameters {
|
|
20
41
|
customFieldIds?: string[];
|
|
21
42
|
page?: number;
|
|
@@ -124,7 +145,15 @@ export interface UpdateLogisticOrderShippingTypeParameters {
|
|
|
124
145
|
}
|
|
125
146
|
export interface CreateLogisticOrderThreadParameters {
|
|
126
147
|
orderId: string;
|
|
127
|
-
lineId
|
|
148
|
+
lineId?: string;
|
|
149
|
+
message?: string;
|
|
150
|
+
reasonCode?: string;
|
|
151
|
+
}
|
|
152
|
+
export interface CreateLogisticOrderThreadParametersV2 {
|
|
153
|
+
logisticOrderId: string;
|
|
154
|
+
idType?: IdType;
|
|
155
|
+
customField?: logisticOrderIncidentThreadsCustomFieldValueRequest;
|
|
156
|
+
name: string;
|
|
128
157
|
message: string;
|
|
129
158
|
reasonCode: string;
|
|
130
159
|
}
|
|
@@ -180,6 +209,27 @@ export interface CreateLogisticOrderThreadResponse {
|
|
|
180
209
|
threadExternalId: string;
|
|
181
210
|
threadId: string;
|
|
182
211
|
}
|
|
212
|
+
export interface CreateLogisticOrderThreadResponseV2 extends CreateLogisticOrderThreadResponse {
|
|
213
|
+
}
|
|
214
|
+
export interface GetLogisticOrderThreadsParams {
|
|
215
|
+
logisticOrderId: string;
|
|
216
|
+
pageable: PageableParameters;
|
|
217
|
+
}
|
|
218
|
+
export interface GetLogisticOrderThreadParams {
|
|
219
|
+
logisticOrderId: string;
|
|
220
|
+
threadId: string;
|
|
221
|
+
}
|
|
222
|
+
export interface GetLogisticOrderThreadResponse extends OrderLogisticThreadResponse {
|
|
223
|
+
}
|
|
224
|
+
export interface GetLogisticOrderThreadsResponse {
|
|
225
|
+
content: OrderLogisticThreadResponse[];
|
|
226
|
+
page: number;
|
|
227
|
+
size: number;
|
|
228
|
+
totalElements: number;
|
|
229
|
+
totalPages: number;
|
|
230
|
+
}
|
|
231
|
+
export interface GetPaginatedLogisticOrdersResponse extends PageOrderLogisticDto {
|
|
232
|
+
}
|
|
183
233
|
export interface GetLogisticOrderReviewResponse extends OrderRatingResponse {
|
|
184
234
|
}
|
|
185
235
|
export interface AddLogisticOrderReviewResponse extends OrderRatingResponse {
|
|
@@ -188,3 +238,43 @@ export interface GetThreadReasonTypesResponse extends Array<ThreadReasonTypeDto>
|
|
|
188
238
|
}
|
|
189
239
|
export interface GetThreadSubReasonsResponse extends Array<ThreadReasonDto> {
|
|
190
240
|
}
|
|
241
|
+
export interface CreateLogisticOrderIncidentThreadsParams {
|
|
242
|
+
logisticOrderId: string;
|
|
243
|
+
incidentId: string;
|
|
244
|
+
customField?: logisticOrderIncidentThreadsCustomFieldValueRequest;
|
|
245
|
+
message?: string;
|
|
246
|
+
name?: string;
|
|
247
|
+
reasonCode: string;
|
|
248
|
+
}
|
|
249
|
+
export interface CreateLogisticOrderIncidentThreadsResponse extends CreateLogisticOrderThreadResponse {
|
|
250
|
+
}
|
|
251
|
+
export interface GetLogisticOrderIncidentThreadParams {
|
|
252
|
+
logisticOrderId: string;
|
|
253
|
+
incidentId: string;
|
|
254
|
+
threadId: string;
|
|
255
|
+
}
|
|
256
|
+
export interface CreateThreadMessageParams {
|
|
257
|
+
body?: string;
|
|
258
|
+
customField?: logisticOrderIncidentThreadsCustomFieldValueRequest;
|
|
259
|
+
}
|
|
260
|
+
export interface CreateLogisticOrderThreadMessagesParams extends GetLogisticOrderThreadParams, CreateThreadMessageParams {
|
|
261
|
+
}
|
|
262
|
+
export interface CreateLogisticOrderIncidentThreadMessagesParams extends GetLogisticOrderIncidentThreadParams, CreateThreadMessageParams {
|
|
263
|
+
}
|
|
264
|
+
export interface UpdateTreadMessageParams {
|
|
265
|
+
messageId: string;
|
|
266
|
+
customFieldValues: CustomFieldValueRequest[];
|
|
267
|
+
idType: IdType;
|
|
268
|
+
}
|
|
269
|
+
export interface UpdateLogisticOrderIncidentThreadMessageParams extends GetLogisticOrderIncidentThreadParams, UpdateTreadMessageParams {
|
|
270
|
+
}
|
|
271
|
+
export interface GetLogisticOrderIncidentThreadResponse extends OrderLogisticThreadResponse {
|
|
272
|
+
}
|
|
273
|
+
export interface CreateLogisticOrderThreadMessagesResponse {
|
|
274
|
+
externalId: string;
|
|
275
|
+
messageId: string;
|
|
276
|
+
}
|
|
277
|
+
export interface CreateLogisticOrderIncidentThreadMessagesResponse extends CreateLogisticOrderThreadMessagesResponse {
|
|
278
|
+
}
|
|
279
|
+
export interface UpdateLogisticOrderThreadMessageParams extends GetLogisticOrderThreadParams, UpdateTreadMessageParams {
|
|
280
|
+
}
|