@djust-b2b/djust-front-sdk 1.13.0 β†’ 1.14.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.
@@ -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
- * Get commercial orders
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
- * Create commercial order
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
- * Get commercial order
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
- * Update commercial order billing information
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
- * Set commercial order status as created
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
- * Set commercial order status as on hold
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
- * Get payment page url for an order
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
- * Update commercial order shipping address
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
- * Update commercial order shipping information
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
- * Update commercial order shipping type
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
- }