@djust-b2b/djust-front-sdk 1.13.0 β 1.15.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 +11 -10
- package/lib/interfaces/models/customer-user.d.ts +6 -0
- package/lib/interfaces/models/incident.d.ts +1 -0
- package/lib/interfaces/models/order.d.ts +96 -0
- package/lib/services/auth/index.d.ts +12 -13
- package/lib/services/auth/index.js +12 -13
- package/lib/services/commercial-order/definitions.d.ts +20 -3
- package/lib/services/commercial-order/index.d.ts +361 -15
- package/lib/services/commercial-order/index.js +397 -33
- package/lib/services/custom-field/definitions.d.ts +100 -0
- package/lib/services/custom-field/definitions.js +60 -0
- package/lib/services/custom-field/index.d.ts +121 -0
- package/lib/services/custom-field/index.js +145 -0
- package/lib/services/customer-account/index.d.ts +1781 -23
- package/lib/services/customer-account/index.js +1780 -45
- package/lib/services/customer-user/definitions.d.ts +3 -1
- package/lib/services/customer-user/index.d.ts +2 -2
- package/lib/services/incident/definitions.d.ts +9 -27
- package/lib/services/incident/index.d.ts +38 -119
- package/lib/services/incident/index.js +46 -153
- package/lib/services/logistic-order/definitions.d.ts +16 -1
- package/lib/services/logistic-order/index.d.ts +799 -28
- package/lib/services/logistic-order/index.js +823 -28
- package/lib/services/navigation-category/index.d.ts +122 -3
- package/lib/services/navigation-category/index.js +122 -3
- package/lib/services/product/definitions.d.ts +1 -1
- package/lib/services/product/index.d.ts +1762 -19
- package/lib/services/product/index.js +1777 -34
- package/package.json +1 -1
|
@@ -3,22 +3,50 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getCommercialOrders = getCommercialOrders;
|
|
4
4
|
exports.createCommercialOrder = createCommercialOrder;
|
|
5
5
|
exports.getCommercialOrder = getCommercialOrder;
|
|
6
|
+
exports.createCommercialOrderCardRegistration = createCommercialOrderCardRegistration;
|
|
6
7
|
exports.updateCommercialOrderBillingInformation = updateCommercialOrderBillingInformation;
|
|
7
8
|
exports.setCommercialOrderStatusAsCreated = setCommercialOrderStatusAsCreated;
|
|
8
9
|
exports.setCommercialOrderStatusAsOnHold = setCommercialOrderStatusAsOnHold;
|
|
9
10
|
exports.getCommercialOrderPaymentPageUrl = getCommercialOrderPaymentPageUrl;
|
|
11
|
+
exports.createCommercialOrderPreauthorization = createCommercialOrderPreauthorization;
|
|
10
12
|
exports.updateCommercialOrderShippingAddress = updateCommercialOrderShippingAddress;
|
|
11
13
|
exports.updateCommercialOrderShippingInformation = updateCommercialOrderShippingInformation;
|
|
12
14
|
exports.updateCommercialOrderShippingType = updateCommercialOrderShippingType;
|
|
13
|
-
exports.updateLogisticOrderCustomFieldsValue = updateLogisticOrderCustomFieldsValue;
|
|
14
15
|
const parameters_validation_1 = require("../../helpers/parameters-validation");
|
|
15
16
|
const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
+
* COMMERCIAL ORDER ENDPOINT
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* π Gets commercial orders.
|
|
22
|
+
*
|
|
23
|
+
* This function retrieves all commercial orders. The parameter locale is mandatory and validated
|
|
24
|
+
* before the request is executed.
|
|
25
|
+
*
|
|
26
|
+
* π **Endpoint**: `GET /v1/shop/commercial-orders [ORDER-560]`
|
|
27
|
+
*
|
|
28
|
+
* | Parameter | Type | Required | Description |
|
|
29
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
30
|
+
* | `locale` | `string` | β
| The locale in which to return the commercial order. |
|
|
31
|
+
* | `nbPreviewLines` | `integer` | β | The number of lines to display in the commercial order. |
|
|
32
|
+
*
|
|
33
|
+
* π€ **Returns**:
|
|
34
|
+
* A `Promise` resolving to a single `GetCommercialOrdersResponse` object representing the page of commercial orders.
|
|
35
|
+
*
|
|
36
|
+
* π **Example usage**:
|
|
37
|
+
* ```ts
|
|
38
|
+
* const orders = await getCommercialOrders({
|
|
39
|
+
* locale: "fr",
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @param {GetCommercialOrdersParameters} params - The parameters for the request.
|
|
44
|
+
* @throws {Error} If `locale` is missing.
|
|
45
|
+
* @returns {Promise<GetCommercialOrdersResponse>} A promise resolving to the response containing page object.
|
|
18
46
|
*/
|
|
19
47
|
async function getCommercialOrders({ locale, nbPreviewLines, }) {
|
|
20
48
|
(0, parameters_validation_1.required)({ locale });
|
|
21
|
-
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
49
|
+
const { data } = await await (0, fetch_instance_1.enhancedFetch)({
|
|
22
50
|
method: "GET",
|
|
23
51
|
path: `/v1/shop/commercial-orders`,
|
|
24
52
|
params: {
|
|
@@ -29,11 +57,41 @@ async function getCommercialOrders({ locale, nbPreviewLines, }) {
|
|
|
29
57
|
return data;
|
|
30
58
|
}
|
|
31
59
|
/**
|
|
32
|
-
*
|
|
60
|
+
* π Creates commercial orders.
|
|
61
|
+
*
|
|
62
|
+
* This function creates a commercial order. The parameters `locale`, `origin` and `originId` is mandatory and validated
|
|
63
|
+
* before the request is executed.
|
|
64
|
+
*
|
|
65
|
+
* π **Endpoint**: `POST /v1/shop/commercial-orders [ORDER-100]`
|
|
66
|
+
*
|
|
67
|
+
* | Parameter | Type | Required | Description |
|
|
68
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
69
|
+
* | `nbPreviewLines` | `integer` | β | The number of lines to display in the logistic order. |
|
|
70
|
+
* | `customFields` | `CustomFieldValueRequest[]` | β | The custom fields to add to the created commercial order. |
|
|
71
|
+
* | `locale` | `string` | β
| The locale in which to return the logistic order. |
|
|
72
|
+
* | `origin` | `OrderOrigin` | β
| The type of object from which the commercial order is created (e.g., `CART`, `SUPPLIER_QUOTE`). |
|
|
73
|
+
* | `originId` | `string` | β
| The ID of the object from which the commercial order is created. |
|
|
74
|
+
* | `paymentInfo` | `string` | β | The payment information for the order |
|
|
75
|
+
*
|
|
76
|
+
* π€ **Returns**:
|
|
77
|
+
* A `Promise` resolving to a single `CreateCommercialOrderResponse` object representing the created commercial orders.
|
|
78
|
+
*
|
|
79
|
+
* π **Example usage**:
|
|
80
|
+
* ```ts
|
|
81
|
+
* const orders = await createCommercialOrder({
|
|
82
|
+
* locale: "fr",
|
|
83
|
+
* origin: "CART",
|
|
84
|
+
* originId: "cart1"
|
|
85
|
+
* });
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @param {CreateCommercialOrderParameters} params - The parameters for the request.
|
|
89
|
+
* @throws {Error} If `locale` or Γ²rigin`or Γ²riginId` is missing.
|
|
90
|
+
* @returns {Promise<CreateCommercialOrderResponse>} A promise resolving to the response containing the commercial orders.
|
|
33
91
|
*/
|
|
34
92
|
async function createCommercialOrder({ nbPreviewLines, channel, customFields, locale, originId, paymentInfo, }) {
|
|
35
93
|
(0, parameters_validation_1.required)({ channel, locale, origin, originId });
|
|
36
|
-
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
94
|
+
const { data } = await await (0, fetch_instance_1.enhancedFetch)({
|
|
37
95
|
method: "POST",
|
|
38
96
|
path: `/v1/shop/commercial-orders`,
|
|
39
97
|
params: {
|
|
@@ -50,11 +108,39 @@ async function createCommercialOrder({ nbPreviewLines, channel, customFields, lo
|
|
|
50
108
|
return data;
|
|
51
109
|
}
|
|
52
110
|
/**
|
|
53
|
-
*
|
|
111
|
+
* π Gets a specific commercial order.
|
|
112
|
+
*
|
|
113
|
+
* This function retrieves a specific commercial order, identified by
|
|
114
|
+
* the `orderId`. This parameter is mandatory and validated
|
|
115
|
+
* before the request is executed.
|
|
116
|
+
*
|
|
117
|
+
* π **Endpoint**: `GET /v1/shop/commercial-orders/${orderId} [ORDER-500]`
|
|
118
|
+
*
|
|
119
|
+
* | Parameter | Type | Required | Description |
|
|
120
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
121
|
+
* | `orderId` | `string` | β
| The ID of the commercial order you want to retrieve. |
|
|
122
|
+
* | `locale` | `string` | β
| The locale in which to return the commercial order. |
|
|
123
|
+
* | `idType` | `OrderIdType` | β | The type of order ID (e.g., `BUSINESS_ID`, `CART_ID`). |
|
|
124
|
+
* | `nbPreviewLines` | `integer` | β | The number of lines to display in the commercial order. |
|
|
125
|
+
*
|
|
126
|
+
* π€ **Returns**:
|
|
127
|
+
* A `Promise` resolving to a single `GetCommercialOrderResponse` object representing the commercial order.
|
|
128
|
+
*
|
|
129
|
+
* π **Example usage**:
|
|
130
|
+
* ```ts
|
|
131
|
+
* const order = await getCommercialOrder({
|
|
132
|
+
* orderId: "commercialOrder1",
|
|
133
|
+
* locale: "fr",
|
|
134
|
+
* });
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* @param {GetCommercialOrderParameters} params - The parameters for the request.
|
|
138
|
+
* @throws {Error} If `orderId` or `locale` is missing.
|
|
139
|
+
* @returns {Promise<GetCommercialOrderResponse>} A promise resolving to the response containing the commercial order.
|
|
54
140
|
*/
|
|
55
141
|
async function getCommercialOrder({ orderId, idType, locale, nbPreviewLines, }) {
|
|
56
142
|
(0, parameters_validation_1.required)({ orderId, locale });
|
|
57
|
-
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
143
|
+
const { data } = await await (0, fetch_instance_1.enhancedFetch)({
|
|
58
144
|
method: "GET",
|
|
59
145
|
path: `/v1/shop/commercial-orders/${orderId}`,
|
|
60
146
|
params: {
|
|
@@ -66,11 +152,80 @@ async function getCommercialOrder({ orderId, idType, locale, nbPreviewLines, })
|
|
|
66
152
|
return data;
|
|
67
153
|
}
|
|
68
154
|
/**
|
|
69
|
-
*
|
|
155
|
+
* π Creates a specific commercial order's card registration.
|
|
156
|
+
*
|
|
157
|
+
* This function registered a card for a specific commercial order, identified by
|
|
158
|
+
* the `orderId`. Both parameters are mandatory and validated
|
|
159
|
+
* before the request is executed.
|
|
160
|
+
*
|
|
161
|
+
* π **Endpoint**: `POST /v1/shop/commercial-orders/${orderId}/card-registration [ORDER-104]`
|
|
162
|
+
*
|
|
163
|
+
* | Parameter | Type | Required | Description |
|
|
164
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
165
|
+
* | `orderId` | `string` | β
| The ID of the commercial order for which you want to register a card. |
|
|
166
|
+
* | `paymentProvider `| `paymentProvider` | β
| Specifies whether the card payments uses (`MANGOPAY`), (`THUNES`) or (`LEMONWAY`). |
|
|
167
|
+
* | `currency` | `Currency` | β
| The currency of the registered card. |
|
|
168
|
+
*
|
|
169
|
+
* π€ **Returns**:
|
|
170
|
+
* A `Promise` resolving to a single `CreateCommercialOrderCardRegistrationResponse` object representing the card registered.
|
|
171
|
+
*
|
|
172
|
+
* π **Example usage**:
|
|
173
|
+
* ```ts
|
|
174
|
+
* const card = await createCommercialOrderCardRegistration({
|
|
175
|
+
* orderId: "commercialOrder1",
|
|
176
|
+
* paymentProvider: "MANGOPAY",
|
|
177
|
+
* currency: "EUR",
|
|
178
|
+
* });
|
|
179
|
+
* ```
|
|
180
|
+
*
|
|
181
|
+
* @param {CreateCommercialOrderCardRegistrationParameters} params - The parameters for the request.
|
|
182
|
+
* @throws {Error} If `orderId` or `billingAddressId` is missing.
|
|
183
|
+
* @returns {Promise<CreateCommercialOrderCardRegistrationResponse>} A promise resolving to a response containing the card registered.
|
|
184
|
+
*/
|
|
185
|
+
async function createCommercialOrderCardRegistration({ orderId, paymentProvider, currency, }) {
|
|
186
|
+
(0, parameters_validation_1.required)({ orderId, paymentProvider, currency });
|
|
187
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
188
|
+
method: "POST",
|
|
189
|
+
path: `/v1/shop/commercial-orders/${orderId}/card-registration`,
|
|
190
|
+
body: JSON.stringify({
|
|
191
|
+
paymentProvider,
|
|
192
|
+
currency,
|
|
193
|
+
}),
|
|
194
|
+
});
|
|
195
|
+
return data;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* π Updates a specific commercial order's billing information.
|
|
199
|
+
*
|
|
200
|
+
* This function updates the billing information of a specific commercial order, identified by
|
|
201
|
+
* the `orderId` and the `billingAddressId`. Both parameters are mandatory and validated
|
|
202
|
+
* before the request is executed.
|
|
203
|
+
*
|
|
204
|
+
* π **Endpoint**: `PUT /v1/shop/commercial-orders/${orderId}/billing-information [ORDER-213]`
|
|
205
|
+
*
|
|
206
|
+
* | Parameter | Type | Required | Description |
|
|
207
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
208
|
+
* | `orderId` | `string` | β
| The ID of the commercial order of which you want to update the address. |
|
|
209
|
+
* | `billingAddressId`| `string` | β
| The ID of the billing address to add. |
|
|
210
|
+
*
|
|
211
|
+
* π€ **Returns**:
|
|
212
|
+
* A `Promise` resolving when the billing address of the commercial order is updated.
|
|
213
|
+
*
|
|
214
|
+
* π **Example usage**:
|
|
215
|
+
* ```ts
|
|
216
|
+
* await updateCommercialOrderBillingInformation({
|
|
217
|
+
* orderId: "commercialOrder1",
|
|
218
|
+
* billingAddressId: "billingAddress1",
|
|
219
|
+
* });
|
|
220
|
+
* ```
|
|
221
|
+
*
|
|
222
|
+
* @param {UpdateCommercialOrderBillingInformationParameters} params - The parameters for the request.
|
|
223
|
+
* @throws {Error} If `orderId` or `billingAddressId` is missing.
|
|
224
|
+
* @returns {Promise<void>} A promise resolving when shipping information of the commercial order is updated.
|
|
70
225
|
*/
|
|
71
226
|
async function updateCommercialOrderBillingInformation({ orderId, billingAddressId, }) {
|
|
72
227
|
(0, parameters_validation_1.required)({ orderId, billingAddressId });
|
|
73
|
-
(0, fetch_instance_1.enhancedFetch)({
|
|
228
|
+
await (0, fetch_instance_1.enhancedFetch)({
|
|
74
229
|
method: "PUT",
|
|
75
230
|
path: `/v1/shop/commercial-orders/${orderId}/billing-information`,
|
|
76
231
|
body: JSON.stringify({
|
|
@@ -79,32 +234,121 @@ async function updateCommercialOrderBillingInformation({ orderId, billingAddress
|
|
|
79
234
|
});
|
|
80
235
|
}
|
|
81
236
|
/**
|
|
82
|
-
*
|
|
237
|
+
* π Sets commercial order status as CREATED.
|
|
238
|
+
*
|
|
239
|
+
* This function changes a specific order status to CREATED, identified by
|
|
240
|
+
* the `orderId`. This parameter is mandatory and validated
|
|
241
|
+
* before the request is executed.
|
|
242
|
+
*
|
|
243
|
+
* π **Endpoint**: `PUT /v1/shop/commercial-orders/${orderId}/created [ORDER-212]`
|
|
244
|
+
*
|
|
245
|
+
* | Parameter | Type | Required | Description |
|
|
246
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
247
|
+
* | `orderId` | `string` | β
| The ID of the commercial order of which you want to set the status to CREATED. |
|
|
248
|
+
* | `paymentInfo` | `string` | β | The payment information for the order |
|
|
249
|
+
*
|
|
250
|
+
* π€ **Returns**:
|
|
251
|
+
* A `Promise` resolving when the commerical order is set to CREATED.
|
|
252
|
+
*
|
|
253
|
+
* π **Example usage**:
|
|
254
|
+
* ```ts
|
|
255
|
+
* await setCommercialOrderStatusAsCreated({
|
|
256
|
+
* orderId: "commercialOrder1",
|
|
257
|
+
* });
|
|
258
|
+
* ```
|
|
259
|
+
*
|
|
260
|
+
* ```json
|
|
261
|
+
* {
|
|
262
|
+
* "message": "Commercial order successfully set to created"
|
|
263
|
+
* }
|
|
264
|
+
* ```
|
|
265
|
+
*
|
|
266
|
+
* @param {SetCommercialOrderStatusAsCreatedParameters} params - The parameters for the request.
|
|
267
|
+
* @throws {Error} If `orderId` is missing.
|
|
268
|
+
* @returns {Promise<void>} A promise resolving when the commercial order is set to CREATED.
|
|
83
269
|
*/
|
|
84
270
|
async function setCommercialOrderStatusAsCreated({ orderId, paymentInfo, }) {
|
|
85
271
|
(0, parameters_validation_1.required)({ orderId });
|
|
86
|
-
(0, fetch_instance_1.enhancedFetch)({
|
|
272
|
+
await (0, fetch_instance_1.enhancedFetch)({
|
|
87
273
|
method: "PUT",
|
|
88
274
|
path: `/v1/shop/commercial-orders/${orderId}/created`,
|
|
89
275
|
body: JSON.stringify(paymentInfo),
|
|
90
276
|
});
|
|
91
277
|
}
|
|
92
278
|
/**
|
|
93
|
-
*
|
|
279
|
+
* π Sets commercial order status as ON HOLD.
|
|
280
|
+
*
|
|
281
|
+
* This function changes a specific order status to ON HOLD, identified by
|
|
282
|
+
* the `orderId`. This parameter is mandatory and validated
|
|
283
|
+
* before the request is executed.
|
|
284
|
+
*
|
|
285
|
+
* π **Endpoint**: `PUT /v1/shop/commercial-orders/${orderId}/hold [ORDER-207]`
|
|
286
|
+
*
|
|
287
|
+
* | Parameter | Type | Required | Description |
|
|
288
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
289
|
+
* | `orderId` | `string` | β
| The ID of the commercial order of which you want to set the status to ON HOLD. |
|
|
290
|
+
* | `paymentInfo` | `string` | β | The payment information for the order |
|
|
291
|
+
*
|
|
292
|
+
* π€ **Returns**:
|
|
293
|
+
* A `Promise` resolving when the commercial order is set to ON HOLD.
|
|
294
|
+
*
|
|
295
|
+
* π **Example usage**:
|
|
296
|
+
* ```ts
|
|
297
|
+
* await setCommercialOrderStatusAsOnHold({
|
|
298
|
+
* orderId: "commercialOrder1",
|
|
299
|
+
* });
|
|
300
|
+
* ```
|
|
301
|
+
*
|
|
302
|
+
* ```json
|
|
303
|
+
* {
|
|
304
|
+
* "message": "Commercial order successfully set to on-hold"
|
|
305
|
+
* }
|
|
306
|
+
* ```
|
|
307
|
+
*
|
|
308
|
+
* @param {SetCommercialOrderStatusAsOnHoldParameters} params - The parameters for the request.
|
|
309
|
+
* @throws {Error} If `orderId` is missing.
|
|
310
|
+
* @returns {Promise<void>} A promise resolving when the commercial order is set to ON HOLD.
|
|
94
311
|
*/
|
|
95
312
|
async function setCommercialOrderStatusAsOnHold({ orderId, }) {
|
|
96
313
|
(0, parameters_validation_1.required)({ orderId });
|
|
97
|
-
(0, fetch_instance_1.enhancedFetch)({
|
|
314
|
+
await (0, fetch_instance_1.enhancedFetch)({
|
|
98
315
|
method: "PUT",
|
|
99
316
|
path: `/v1/shop/commercial-orders/${orderId}/hold`,
|
|
100
317
|
});
|
|
101
318
|
}
|
|
102
319
|
/**
|
|
103
|
-
*
|
|
320
|
+
* π Gets payment page url for a specific order.
|
|
321
|
+
*
|
|
322
|
+
* This function retrieves the url of a payment page for a commercial order, identified by
|
|
323
|
+
* the `orderId`. This parameter is mandatory and validated
|
|
324
|
+
* before the request is executed.
|
|
325
|
+
*
|
|
326
|
+
* π **Endpoint**: `GET /v1/shop/commercial-orders/${orderId}/payment-page [ORDER-507]`
|
|
327
|
+
*
|
|
328
|
+
* | Parameter | Type | Required | Description |
|
|
329
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
330
|
+
* | `orderId` | `string` | β
| The ID of the commercial order associated with the payment page. |
|
|
331
|
+
* | `paymentOption` | `PaymentOption` | β
| Specifies whether the payment is done with (`BANK_WIRE`), (`BANK_WIRE_ON_DUE_DATE`), (`CREDIT_CARD`), (`DIRECT_PAYMENT`), (`BANK_WIRE_ON_ACCEPTANCE`). |
|
|
332
|
+
* | `paymentProvider` | `PaymentProvider` | β | Specifies whether the payment uses (`MANGOPAY`), (`THUNES`) or (`LEMONWAY`). |
|
|
333
|
+
*
|
|
334
|
+
* π€ **Returns**:
|
|
335
|
+
* A `Promise` resolving to a string containig the payment page url.
|
|
336
|
+
*
|
|
337
|
+
* π **Example usage**:
|
|
338
|
+
* ```ts
|
|
339
|
+
* await getCommercialOrderPaymentPageUrl({
|
|
340
|
+
* orderId: "commercialOrder1",
|
|
341
|
+
* paymentOption: "BANK_WIRE",
|
|
342
|
+
* });
|
|
343
|
+
* ```
|
|
344
|
+
*
|
|
345
|
+
* @param {GetCommercialOrderPaymentPageUrlParameters} params - The parameters for the request.
|
|
346
|
+
* @throws {Error} If `orderId` is missing.
|
|
347
|
+
* @returns {Promise<string>} A promise resolving to a string containig the payment page url.
|
|
104
348
|
*/
|
|
105
349
|
async function getCommercialOrderPaymentPageUrl({ orderId, paymentOption, paymentProvider, }) {
|
|
106
350
|
(0, parameters_validation_1.required)({ orderId, paymentOption });
|
|
107
|
-
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
351
|
+
const { data } = await await (0, fetch_instance_1.enhancedFetch)({
|
|
108
352
|
method: "GET",
|
|
109
353
|
path: `/v1/shop/commercial-orders/${orderId}/payment-page`,
|
|
110
354
|
params: {
|
|
@@ -115,11 +359,90 @@ async function getCommercialOrderPaymentPageUrl({ orderId, paymentOption, paymen
|
|
|
115
359
|
return data.url;
|
|
116
360
|
}
|
|
117
361
|
/**
|
|
118
|
-
*
|
|
362
|
+
* π Creates a specific commercial order's card registration.
|
|
363
|
+
*
|
|
364
|
+
* This function registered a card for a specific commercial order, identified by
|
|
365
|
+
* the `orderId`. Both parameters are mandatory and validated
|
|
366
|
+
* before the request is executed.
|
|
367
|
+
*
|
|
368
|
+
* π **Endpoint**: `POST /v1/shop/commercial-orders/${orderId}/preauthorization [ORDER-105]`
|
|
369
|
+
*
|
|
370
|
+
* | Parameter | Type | Required | Description |
|
|
371
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
372
|
+
* | `orderId` | `string` | β
| The ID of the commercial order for which you want to register a card. |
|
|
373
|
+
* | `paymentProvider` | `paymentProvider` | β
| Specifies whether the card payments uses (`MANGOPAY`), (`THUNES`) or (`LEMONWAY`). |
|
|
374
|
+
* | `authorId` | `string` | β | The ID of the author of the preauthorization. |
|
|
375
|
+
* | `browserInfo` | `browserInfo` | β | The information of the browser used to make the preauthorization. |
|
|
376
|
+
* | `ipAddress` | `string` | β | The IP Address of the machine used to make the preauthorization. |
|
|
377
|
+
* | `paymentCardInfo` | `paymentCardInfo` | β
| The information of the card used to make the preauthorization. |
|
|
378
|
+
*
|
|
379
|
+
* π€ **Returns**:
|
|
380
|
+
* A `Promise` resolving to a single `CreateCommercialOrderPreauthorizationResponse` object representing the preauthorization.
|
|
381
|
+
*
|
|
382
|
+
* π **Example usage**:
|
|
383
|
+
* ```ts
|
|
384
|
+
* const preauthorization = await createCommercialOrderPreauthorization({
|
|
385
|
+
* orderId: "commercialOrder1",
|
|
386
|
+
* paymentProvider: "MANGOPAY",
|
|
387
|
+
* paymentCardInfo: {
|
|
388
|
+
"amount": 0,
|
|
389
|
+
"cardId": "card1",
|
|
390
|
+
"currency": "EUR"
|
|
391
|
+
}
|
|
392
|
+
* });
|
|
393
|
+
* ```
|
|
394
|
+
*
|
|
395
|
+
* @param {CreateCommercialOrderPreauthorizationParameters} params - The parameters for the request.
|
|
396
|
+
* @throws {Error} If `orderId`, `paymentProvider` or `paymentCardInfo` is missing.
|
|
397
|
+
* @returns {Promise<CreateCommercialOrderPreauthorizationResponse>} A promise resolving to a response containing the preauthorization.
|
|
398
|
+
*/
|
|
399
|
+
async function createCommercialOrderPreauthorization({ orderId, paymentProvider, authorId, browserInfo, ipAddress, paymentCardInfo, }) {
|
|
400
|
+
(0, parameters_validation_1.required)({ orderId, paymentProvider, paymentCardInfo });
|
|
401
|
+
const { data } = await await (0, fetch_instance_1.enhancedFetch)({
|
|
402
|
+
method: "POST",
|
|
403
|
+
path: `/v1/shop/commercial-orders/${orderId}/preauthorization`,
|
|
404
|
+
body: JSON.stringify({
|
|
405
|
+
paymentProvider,
|
|
406
|
+
authorId,
|
|
407
|
+
browserInfo,
|
|
408
|
+
ipAddress,
|
|
409
|
+
paymentCardInfo,
|
|
410
|
+
}),
|
|
411
|
+
});
|
|
412
|
+
return data;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* π Updates a specific commercial order's shipping address.
|
|
416
|
+
*
|
|
417
|
+
* This function updates the shipping address of a specific commercial order, identified by
|
|
418
|
+
* the `orderId` and the `shippingAddressId`. Both parameters are mandatory and validated
|
|
419
|
+
* before the request is executed.
|
|
420
|
+
*
|
|
421
|
+
* π **Endpoint**: `PUT /v1/shop/commercial-orders/${orderId}/shipping-address [ORDER-202]`
|
|
422
|
+
*
|
|
423
|
+
* | Parameter | Type | Required | Description |
|
|
424
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
425
|
+
* | `orderId` | `string` | β
| The ID of the commercial order of which you want to update the address. |
|
|
426
|
+
* | `shippingAddressId`| `string` | β
| The ID of the shipping address to update. |
|
|
427
|
+
*
|
|
428
|
+
* π€ **Returns**:
|
|
429
|
+
* A `Promise` resolving when the shipping address of the commercial order is updated.
|
|
430
|
+
*
|
|
431
|
+
* π **Example usage**:
|
|
432
|
+
* ```ts
|
|
433
|
+
* await updateCommercialOrderShippingAddress({
|
|
434
|
+
* orderId: "commercialOrder1",
|
|
435
|
+
* shippingAddressId: "shippingAddress1",
|
|
436
|
+
* });
|
|
437
|
+
* ```
|
|
438
|
+
*
|
|
439
|
+
* @param {UpdateCommercialOrderShippingAddressParameters} params - The parameters for the request.
|
|
440
|
+
* @throws {Error} If `orderId` or `shippingAddressId` is missing.
|
|
441
|
+
* @returns {Promise<void>} A promise resolving when shipping address of the commercial order is updated.
|
|
119
442
|
*/
|
|
120
443
|
async function updateCommercialOrderShippingAddress({ orderId, shippingAddressId, }) {
|
|
121
444
|
(0, parameters_validation_1.required)({ orderId, shippingAddressId });
|
|
122
|
-
(0, fetch_instance_1.enhancedFetch)({
|
|
445
|
+
await (0, fetch_instance_1.enhancedFetch)({
|
|
123
446
|
method: "PUT",
|
|
124
447
|
path: `/v1/shop/commercial-orders/${orderId}/shipping-address`,
|
|
125
448
|
body: JSON.stringify({
|
|
@@ -128,11 +451,38 @@ async function updateCommercialOrderShippingAddress({ orderId, shippingAddressId
|
|
|
128
451
|
});
|
|
129
452
|
}
|
|
130
453
|
/**
|
|
131
|
-
*
|
|
454
|
+
* π Updates a specific commercial order's shipping information.
|
|
455
|
+
*
|
|
456
|
+
* This function updates the shipping information of a specific commercial order, identified by
|
|
457
|
+
* the `orderId` and the `shippingAddressId`. Both parameters are mandatory and validated
|
|
458
|
+
* before the request is executed.
|
|
459
|
+
*
|
|
460
|
+
* π **Endpoint**: `PUT /v1/shop/commercial-orders/${orderId}/shipping-information [ORDER-215]`
|
|
461
|
+
*
|
|
462
|
+
* | Parameter | Type | Required | Description |
|
|
463
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
464
|
+
* | `orderId` | `string` | β
| The ID of the commercial order of which you want to update the address. |
|
|
465
|
+
* | `shippingAddressId`| `string` | β
| The ID of the shipping address to update. |
|
|
466
|
+
* | `shippingType `| `string` | β
| The shipping type to set to the commercial order. |
|
|
467
|
+
*
|
|
468
|
+
* π€ **Returns**:
|
|
469
|
+
* A `Promise` resolving when the shipping address of the commercial order is updated.
|
|
470
|
+
*
|
|
471
|
+
* π **Example usage**:
|
|
472
|
+
* ```ts
|
|
473
|
+
* await updateCommercialOrderShippingInformation({
|
|
474
|
+
* orderId: "commercialOrder1",
|
|
475
|
+
* shippingAddressId: "shippingAddress1",
|
|
476
|
+
* });
|
|
477
|
+
* ```
|
|
478
|
+
*
|
|
479
|
+
* @param {UpdateCommercialOrderShippingInformationParameters} params - The parameters for the request.
|
|
480
|
+
* @throws {Error} If `orderId` or `shippingAddressId` is missing.
|
|
481
|
+
* @returns {Promise<void>} A promise resolving when shipping information of the commercial order is updated.
|
|
132
482
|
*/
|
|
133
483
|
async function updateCommercialOrderShippingInformation({ orderId, shippingAddressId, shippingType, }) {
|
|
134
484
|
(0, parameters_validation_1.required)({ orderId, shippingAddressId, shippingType });
|
|
135
|
-
(0, fetch_instance_1.enhancedFetch)({
|
|
485
|
+
await (0, fetch_instance_1.enhancedFetch)({
|
|
136
486
|
method: "PUT",
|
|
137
487
|
path: `/v1/shop/commercial-orders/${orderId}/shipping-information`,
|
|
138
488
|
body: JSON.stringify({
|
|
@@ -142,11 +492,37 @@ async function updateCommercialOrderShippingInformation({ orderId, shippingAddre
|
|
|
142
492
|
});
|
|
143
493
|
}
|
|
144
494
|
/**
|
|
145
|
-
*
|
|
495
|
+
* π Updates a specific commercial order's shipping type.
|
|
496
|
+
*
|
|
497
|
+
* This function updates the shipping type of a specific commercial order, identified by
|
|
498
|
+
* the `orderId`. This parameter is mandatory and validated
|
|
499
|
+
* before the request is executed.
|
|
500
|
+
*
|
|
501
|
+
* π **Endpoint**: `PUT /v1/shop/commercial-orders/${orderId}/shipping-information [ORDER-215]`
|
|
502
|
+
*
|
|
503
|
+
* | Parameter | Type | Required | Description |
|
|
504
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
505
|
+
* | `orderId` | `string` | β
| The ID of the commercial order of which you want to update the address. |
|
|
506
|
+
* | `shippingType `| `string` | β
| The shipping type to set to the commercial order. |
|
|
507
|
+
*
|
|
508
|
+
* π€ **Returns**:
|
|
509
|
+
* A `Promise` resolving when the shipping type of the commercial order is updated.
|
|
510
|
+
*
|
|
511
|
+
* π **Example usage**:
|
|
512
|
+
* ```ts
|
|
513
|
+
* await updateCommercialOrderShippingType({
|
|
514
|
+
* orderId: "commercialOrder1",
|
|
515
|
+
* shippingAddressId: "shippingAddress1",
|
|
516
|
+
* });
|
|
517
|
+
* ```
|
|
518
|
+
*
|
|
519
|
+
* @param {UpdateCommercialOrderShippingTypeParameters} params - The parameters for the request.
|
|
520
|
+
* @throws {Error} If `orderId` or `shippingType` is missing.
|
|
521
|
+
* @returns {Promise<void>} A promise resolving when shipping type of the commercial order is updated.
|
|
146
522
|
*/
|
|
147
523
|
async function updateCommercialOrderShippingType({ orderId, shippingType, }) {
|
|
148
524
|
(0, parameters_validation_1.required)({ orderId, shippingType });
|
|
149
|
-
(0, fetch_instance_1.enhancedFetch)({
|
|
525
|
+
await (0, fetch_instance_1.enhancedFetch)({
|
|
150
526
|
method: "PUT",
|
|
151
527
|
path: `/v1/shop/commercial-orders/${orderId}/shipping-type`,
|
|
152
528
|
body: JSON.stringify({
|
|
@@ -154,15 +530,3 @@ async function updateCommercialOrderShippingType({ orderId, shippingType, }) {
|
|
|
154
530
|
}),
|
|
155
531
|
});
|
|
156
532
|
}
|
|
157
|
-
/**
|
|
158
|
-
* Update order logistic custom fields value
|
|
159
|
-
*/
|
|
160
|
-
async function updateLogisticOrderCustomFieldsValue({ orderLogisticId, customFieldsValues, }) {
|
|
161
|
-
(0, parameters_validation_1.required)({ orderLogisticId });
|
|
162
|
-
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
163
|
-
method: "PATCH",
|
|
164
|
-
path: `/v1/shop/logistic-orders/${orderLogisticId}`,
|
|
165
|
-
body: JSON.stringify(customFieldsValues),
|
|
166
|
-
});
|
|
167
|
-
return data;
|
|
168
|
-
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Order, PageableObject } from "../../interfaces/models/common";
|
|
2
|
+
declare enum SealedTarget {
|
|
3
|
+
OFFER = 0,
|
|
4
|
+
ACCOUNT = 1,
|
|
5
|
+
NAVIGATION_CATEGORY = 2,
|
|
6
|
+
SUPPLIER = 3,
|
|
7
|
+
CUSTOMER_USER = 4,
|
|
8
|
+
CUSTOMER_ORGANISATION = 5,
|
|
9
|
+
ORDER_LOGISTIC = 6,
|
|
10
|
+
ORDER_COMMERCIAL = 7,
|
|
11
|
+
ORDER_LOGISTIC_LINE = 8,
|
|
12
|
+
QUOTE = 9,
|
|
13
|
+
QUOTE_LINE = 10,
|
|
14
|
+
ORDER_INCIDENT = 11,
|
|
15
|
+
THREAD_MESSAGE = 12
|
|
16
|
+
}
|
|
17
|
+
declare enum ExternalSource {
|
|
18
|
+
MIRAKL = 0,
|
|
19
|
+
CLIENT = 1,
|
|
20
|
+
NOT_DEFINED = 2,
|
|
21
|
+
EXTERN = 3,
|
|
22
|
+
SYSTEM = 4
|
|
23
|
+
}
|
|
24
|
+
declare enum CustomFieldRole {
|
|
25
|
+
PRODUCT_TAX_RATE = 0,
|
|
26
|
+
SHIPPING_TAX_RATE = 1,
|
|
27
|
+
SHIPPING_TAX_CODE = 2,
|
|
28
|
+
PRODUCT_TAX_CODE = 3,
|
|
29
|
+
ORDERS_MANAGED_INTERNALLY = 4,
|
|
30
|
+
OFFER_VALIDITY_START_DATE = 5,
|
|
31
|
+
OFFER_VALIDITY_END_DATE = 6,
|
|
32
|
+
AUTOMATIC_ORDER_VALIDATION = 7
|
|
33
|
+
}
|
|
34
|
+
declare enum CustomFieldStatus {
|
|
35
|
+
ACTIVE = 0,
|
|
36
|
+
INACTIVE = 1
|
|
37
|
+
}
|
|
38
|
+
declare enum CustomFieldType {
|
|
39
|
+
LONG_TEXT = 0,
|
|
40
|
+
TEXT = 1,
|
|
41
|
+
NUMBER = 2,
|
|
42
|
+
METRIC = 3,
|
|
43
|
+
DATE = 4,
|
|
44
|
+
LIST_TEXT = 5,
|
|
45
|
+
LIST_METRIC = 6,
|
|
46
|
+
LIST_NUMBER = 7,
|
|
47
|
+
BOOLEAN = 8,
|
|
48
|
+
MEDIA = 9
|
|
49
|
+
}
|
|
50
|
+
declare enum CustomFieldIdType {
|
|
51
|
+
BUSINESS_ID = 0,
|
|
52
|
+
EXTERNAL_ID = 1
|
|
53
|
+
}
|
|
54
|
+
interface CustomFieldDto {
|
|
55
|
+
externalId: string;
|
|
56
|
+
externalSource: ExternalSource;
|
|
57
|
+
faceted?: boolean;
|
|
58
|
+
id?: string;
|
|
59
|
+
indexable?: boolean;
|
|
60
|
+
mandatory: boolean;
|
|
61
|
+
name: string;
|
|
62
|
+
role?: CustomFieldRole;
|
|
63
|
+
sealedTarget: boolean;
|
|
64
|
+
searchable?: boolean;
|
|
65
|
+
sortable?: boolean;
|
|
66
|
+
status: CustomFieldStatus;
|
|
67
|
+
type?: CustomFieldType;
|
|
68
|
+
}
|
|
69
|
+
export interface GetCustomFieldParameters {
|
|
70
|
+
sealedTarget: SealedTarget;
|
|
71
|
+
status?: CustomFieldStatus;
|
|
72
|
+
type?: CustomFieldType;
|
|
73
|
+
searchCriteria?: string;
|
|
74
|
+
searchable?: boolean;
|
|
75
|
+
sortable?: boolean;
|
|
76
|
+
page?: number;
|
|
77
|
+
size?: number;
|
|
78
|
+
sort?: string[];
|
|
79
|
+
}
|
|
80
|
+
export interface GetCustomFieldResponse {
|
|
81
|
+
content: CustomFieldDto[];
|
|
82
|
+
empty?: boolean;
|
|
83
|
+
first?: boolean;
|
|
84
|
+
last?: boolean;
|
|
85
|
+
number?: number;
|
|
86
|
+
numberOfElements?: number;
|
|
87
|
+
pageable?: PageableObject;
|
|
88
|
+
size?: number;
|
|
89
|
+
sort?: Order[];
|
|
90
|
+
totalElemets?: number;
|
|
91
|
+
totalPages?: number;
|
|
92
|
+
}
|
|
93
|
+
export interface PostMediaCustomFieldParameters {
|
|
94
|
+
id: string;
|
|
95
|
+
customFieldIdType?: CustomFieldIdType;
|
|
96
|
+
sealedTarget?: SealedTarget;
|
|
97
|
+
fileName: string;
|
|
98
|
+
fileSize: number;
|
|
99
|
+
}
|
|
100
|
+
export {};
|