@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.
@@ -1,45 +1,391 @@
1
- import { CreateCommercialOrderParameters, CreateCommercialOrderResponse, GetCommercialOrderParameters, GetCommercialOrderPaymentPageUrlParameters, GetCommercialOrderResponse, GetCommercialOrdersParameters, GetCommercialOrdersResponse, SetCommercialOrderStatusAsCreatedParameters, SetCommercialOrderStatusAsOnHoldParameters, UpdateCommercialOrderBillingInformationParameters, UpdateCommercialOrderShippingAddressParameters, UpdateCommercialOrderShippingInformationParameters, UpdateCommercialOrderShippingTypeParameters, UpdateOrderLogisticCustomFieldParameters, UpdateOrderLogisticCustomFieldResponse } from "./definitions";
1
+ import { CreateCommercialOrderCardRegistrationParameters, CreateCommercialOrderCardRegistrationResponse, CreateCommercialOrderParameters, CreateCommercialOrderPreauthorizationParameters, CreateCommercialOrderPreauthorizationResponse, CreateCommercialOrderResponse, GetCommercialOrderParameters, GetCommercialOrderPaymentPageUrlParameters, GetCommercialOrderResponse, GetCommercialOrdersParameters, GetCommercialOrdersResponse, SetCommercialOrderStatusAsCreatedParameters, SetCommercialOrderStatusAsOnHoldParameters, UpdateCommercialOrderBillingInformationParameters, UpdateCommercialOrderShippingAddressParameters, UpdateCommercialOrderShippingInformationParameters, UpdateCommercialOrderShippingTypeParameters } from "./definitions";
2
2
  /**
3
- * Get commercial orders
3
+ * COMMERCIAL ORDER ENDPOINT
4
+ */
5
+ /**
6
+ * 🚚 Gets commercial orders.
7
+ *
8
+ * This function retrieves all commercial orders. The parameter locale is mandatory and validated
9
+ * before the request is executed.
10
+ *
11
+ * πŸ›  **Endpoint**: `GET /v1/shop/commercial-orders [ORDER-560]`
12
+ *
13
+ * | Parameter | Type | Required | Description |
14
+ * |-------------------|---------------------------------|------------|------------------------------------------|
15
+ * | `locale` | `string` | βœ… | The locale in which to return the commercial order. |
16
+ * | `nbPreviewLines` | `integer` | ❌ | The number of lines to display in the commercial order. |
17
+ *
18
+ * πŸ“€ **Returns**:
19
+ * A `Promise` resolving to a single `GetCommercialOrdersResponse` object representing the page of commercial orders.
20
+ *
21
+ * πŸ›  **Example usage**:
22
+ * ```ts
23
+ * const orders = await getCommercialOrders({
24
+ * locale: "fr",
25
+ * });
26
+ * ```
27
+ *
28
+ * @param {GetCommercialOrdersParameters} params - The parameters for the request.
29
+ * @throws {Error} If `locale` is missing.
30
+ * @returns {Promise<GetCommercialOrdersResponse>} A promise resolving to the response containing page object.
4
31
  */
5
32
  export declare function getCommercialOrders({ locale, nbPreviewLines, }: GetCommercialOrdersParameters): Promise<GetCommercialOrdersResponse>;
6
33
  /**
7
- * Create commercial order
34
+ * 🚚 Creates commercial orders.
35
+ *
36
+ * This function creates a commercial order. The parameters `locale`, `origin` and `originId` is mandatory and validated
37
+ * before the request is executed.
38
+ *
39
+ * πŸ›  **Endpoint**: `POST /v1/shop/commercial-orders [ORDER-100]`
40
+ *
41
+ * | Parameter | Type | Required | Description |
42
+ * |-------------------|---------------------------------|------------|------------------------------------------|
43
+ * | `nbPreviewLines` | `integer` | ❌ | The number of lines to display in the logistic order. |
44
+ * | `customFields` | `CustomFieldValueRequest[]` | ❌ | The custom fields to add to the created commercial order. |
45
+ * | `locale` | `string` | βœ… | The locale in which to return the logistic order. |
46
+ * | `origin` | `OrderOrigin` | βœ… | The type of object from which the commercial order is created (e.g., `CART`, `SUPPLIER_QUOTE`). |
47
+ * | `originId` | `string` | βœ… | The ID of the object from which the commercial order is created. |
48
+ * | `paymentInfo` | `string` | ❌ | The payment information for the order |
49
+ *
50
+ * πŸ“€ **Returns**:
51
+ * A `Promise` resolving to a single `CreateCommercialOrderResponse` object representing the created commercial orders.
52
+ *
53
+ * πŸ›  **Example usage**:
54
+ * ```ts
55
+ * const orders = await createCommercialOrder({
56
+ * locale: "fr",
57
+ * origin: "CART",
58
+ * originId: "cart1"
59
+ * });
60
+ * ```
61
+ *
62
+ * @param {CreateCommercialOrderParameters} params - The parameters for the request.
63
+ * @throws {Error} If `locale` or Γ²rigin`or Γ²riginId` is missing.
64
+ * @returns {Promise<CreateCommercialOrderResponse>} A promise resolving to the response containing the commercial orders.
8
65
  */
9
66
  export declare function createCommercialOrder({ nbPreviewLines, channel, customFields, locale, originId, paymentInfo, }: CreateCommercialOrderParameters): Promise<CreateCommercialOrderResponse>;
10
67
  /**
11
- * Get commercial order
68
+ * 🚚 Gets a specific commercial order.
69
+ *
70
+ * This function retrieves a specific commercial order, identified by
71
+ * the `orderId`. This parameter is mandatory and validated
72
+ * before the request is executed.
73
+ *
74
+ * πŸ›  **Endpoint**: `GET /v1/shop/commercial-orders/${orderId} [ORDER-500]`
75
+ *
76
+ * | Parameter | Type | Required | Description |
77
+ * |-------------------|---------------------------------|------------|------------------------------------------|
78
+ * | `orderId` | `string` | βœ… | The ID of the commercial order you want to retrieve. |
79
+ * | `locale` | `string` | βœ… | The locale in which to return the commercial order. |
80
+ * | `idType` | `OrderIdType` | ❌ | The type of order ID (e.g., `BUSINESS_ID`, `CART_ID`). |
81
+ * | `nbPreviewLines` | `integer` | ❌ | The number of lines to display in the commercial order. |
82
+ *
83
+ * πŸ“€ **Returns**:
84
+ * A `Promise` resolving to a single `GetCommercialOrderResponse` object representing the commercial order.
85
+ *
86
+ * πŸ›  **Example usage**:
87
+ * ```ts
88
+ * const order = await getCommercialOrder({
89
+ * orderId: "commercialOrder1",
90
+ * locale: "fr",
91
+ * });
92
+ * ```
93
+ *
94
+ * @param {GetCommercialOrderParameters} params - The parameters for the request.
95
+ * @throws {Error} If `orderId` or `locale` is missing.
96
+ * @returns {Promise<GetCommercialOrderResponse>} A promise resolving to the response containing the commercial order.
12
97
  */
13
98
  export declare function getCommercialOrder({ orderId, idType, locale, nbPreviewLines, }: GetCommercialOrderParameters): Promise<GetCommercialOrderResponse>;
14
99
  /**
15
- * Update commercial order billing information
100
+ * 🚚 Creates a specific commercial order's card registration.
101
+ *
102
+ * This function registered a card for a specific commercial order, identified by
103
+ * the `orderId`. Both parameters are mandatory and validated
104
+ * before the request is executed.
105
+ *
106
+ * πŸ›  **Endpoint**: `POST /v1/shop/commercial-orders/${orderId}/card-registration [ORDER-104]`
107
+ *
108
+ * | Parameter | Type | Required | Description |
109
+ * |-------------------|---------------------------------|------------|------------------------------------------|
110
+ * | `orderId` | `string` | βœ… | The ID of the commercial order for which you want to register a card. |
111
+ * | `paymentProvider `| `paymentProvider` | βœ… | Specifies whether the card payments uses (`MANGOPAY`), (`THUNES`) or (`LEMONWAY`). |
112
+ * | `currency` | `Currency` | βœ… | The currency of the registered card. |
113
+ *
114
+ * πŸ“€ **Returns**:
115
+ * A `Promise` resolving to a single `CreateCommercialOrderCardRegistrationResponse` object representing the card registered.
116
+ *
117
+ * πŸ›  **Example usage**:
118
+ * ```ts
119
+ * const card = await createCommercialOrderCardRegistration({
120
+ * orderId: "commercialOrder1",
121
+ * paymentProvider: "MANGOPAY",
122
+ * currency: "EUR",
123
+ * });
124
+ * ```
125
+ *
126
+ * @param {CreateCommercialOrderCardRegistrationParameters} params - The parameters for the request.
127
+ * @throws {Error} If `orderId` or `billingAddressId` is missing.
128
+ * @returns {Promise<CreateCommercialOrderCardRegistrationResponse>} A promise resolving to a response containing the card registered.
129
+ */
130
+ export declare function createCommercialOrderCardRegistration({ orderId, paymentProvider, currency, }: CreateCommercialOrderCardRegistrationParameters): Promise<CreateCommercialOrderCardRegistrationResponse>;
131
+ /**
132
+ * 🚚 Updates a specific commercial order's billing information.
133
+ *
134
+ * This function updates the billing information of a specific commercial order, identified by
135
+ * the `orderId` and the `billingAddressId`. Both parameters are mandatory and validated
136
+ * before the request is executed.
137
+ *
138
+ * πŸ›  **Endpoint**: `PUT /v1/shop/commercial-orders/${orderId}/billing-information [ORDER-213]`
139
+ *
140
+ * | Parameter | Type | Required | Description |
141
+ * |-------------------|---------------------------------|------------|------------------------------------------|
142
+ * | `orderId` | `string` | βœ… | The ID of the commercial order of which you want to update the address. |
143
+ * | `billingAddressId`| `string` | βœ… | The ID of the billing address to add. |
144
+ *
145
+ * πŸ“€ **Returns**:
146
+ * A `Promise` resolving when the billing address of the commercial order is updated.
147
+ *
148
+ * πŸ›  **Example usage**:
149
+ * ```ts
150
+ * await updateCommercialOrderBillingInformation({
151
+ * orderId: "commercialOrder1",
152
+ * billingAddressId: "billingAddress1",
153
+ * });
154
+ * ```
155
+ *
156
+ * @param {UpdateCommercialOrderBillingInformationParameters} params - The parameters for the request.
157
+ * @throws {Error} If `orderId` or `billingAddressId` is missing.
158
+ * @returns {Promise<void>} A promise resolving when shipping information of the commercial order is updated.
16
159
  */
17
160
  export declare function updateCommercialOrderBillingInformation({ orderId, billingAddressId, }: UpdateCommercialOrderBillingInformationParameters): Promise<void>;
18
161
  /**
19
- * Set commercial order status as created
162
+ * 🚚 Sets commercial order status as CREATED.
163
+ *
164
+ * This function changes a specific order status to CREATED, identified by
165
+ * the `orderId`. This parameter is mandatory and validated
166
+ * before the request is executed.
167
+ *
168
+ * πŸ›  **Endpoint**: `PUT /v1/shop/commercial-orders/${orderId}/created [ORDER-212]`
169
+ *
170
+ * | Parameter | Type | Required | Description |
171
+ * |-------------------|---------------------------------|------------|------------------------------------------|
172
+ * | `orderId` | `string` | βœ… | The ID of the commercial order of which you want to set the status to CREATED. |
173
+ * | `paymentInfo` | `string` | ❌ | The payment information for the order |
174
+ *
175
+ * πŸ“€ **Returns**:
176
+ * A `Promise` resolving when the commerical order is set to CREATED.
177
+ *
178
+ * πŸ›  **Example usage**:
179
+ * ```ts
180
+ * await setCommercialOrderStatusAsCreated({
181
+ * orderId: "commercialOrder1",
182
+ * });
183
+ * ```
184
+ *
185
+ * ```json
186
+ * {
187
+ * "message": "Commercial order successfully set to created"
188
+ * }
189
+ * ```
190
+ *
191
+ * @param {SetCommercialOrderStatusAsCreatedParameters} params - The parameters for the request.
192
+ * @throws {Error} If `orderId` is missing.
193
+ * @returns {Promise<void>} A promise resolving when the commercial order is set to CREATED.
20
194
  */
21
195
  export declare function setCommercialOrderStatusAsCreated({ orderId, paymentInfo, }: SetCommercialOrderStatusAsCreatedParameters): Promise<void>;
22
196
  /**
23
- * Set commercial order status as on hold
197
+ * 🚚 Sets commercial order status as ON HOLD.
198
+ *
199
+ * This function changes a specific order status to ON HOLD, identified by
200
+ * the `orderId`. This parameter is mandatory and validated
201
+ * before the request is executed.
202
+ *
203
+ * πŸ›  **Endpoint**: `PUT /v1/shop/commercial-orders/${orderId}/hold [ORDER-207]`
204
+ *
205
+ * | Parameter | Type | Required | Description |
206
+ * |-------------------|---------------------------------|------------|------------------------------------------|
207
+ * | `orderId` | `string` | βœ… | The ID of the commercial order of which you want to set the status to ON HOLD. |
208
+ * | `paymentInfo` | `string` | ❌ | The payment information for the order |
209
+ *
210
+ * πŸ“€ **Returns**:
211
+ * A `Promise` resolving when the commercial order is set to ON HOLD.
212
+ *
213
+ * πŸ›  **Example usage**:
214
+ * ```ts
215
+ * await setCommercialOrderStatusAsOnHold({
216
+ * orderId: "commercialOrder1",
217
+ * });
218
+ * ```
219
+ *
220
+ * ```json
221
+ * {
222
+ * "message": "Commercial order successfully set to on-hold"
223
+ * }
224
+ * ```
225
+ *
226
+ * @param {SetCommercialOrderStatusAsOnHoldParameters} params - The parameters for the request.
227
+ * @throws {Error} If `orderId` is missing.
228
+ * @returns {Promise<void>} A promise resolving when the commercial order is set to ON HOLD.
24
229
  */
25
230
  export declare function setCommercialOrderStatusAsOnHold({ orderId, }: SetCommercialOrderStatusAsOnHoldParameters): Promise<void>;
26
231
  /**
27
- * Get payment page url for an order
232
+ * 🚚 Gets payment page url for a specific order.
233
+ *
234
+ * This function retrieves the url of a payment page for a commercial order, identified by
235
+ * the `orderId`. This parameter is mandatory and validated
236
+ * before the request is executed.
237
+ *
238
+ * πŸ›  **Endpoint**: `GET /v1/shop/commercial-orders/${orderId}/payment-page [ORDER-507]`
239
+ *
240
+ * | Parameter | Type | Required | Description |
241
+ * |-------------------|---------------------------------|------------|------------------------------------------|
242
+ * | `orderId` | `string` | βœ… | The ID of the commercial order associated with the payment page. |
243
+ * | `paymentOption` | `PaymentOption` | βœ… | Specifies whether the payment is done with (`BANK_WIRE`), (`BANK_WIRE_ON_DUE_DATE`), (`CREDIT_CARD`), (`DIRECT_PAYMENT`), (`BANK_WIRE_ON_ACCEPTANCE`). |
244
+ * | `paymentProvider` | `PaymentProvider` | ❌ | Specifies whether the payment uses (`MANGOPAY`), (`THUNES`) or (`LEMONWAY`). |
245
+ *
246
+ * πŸ“€ **Returns**:
247
+ * A `Promise` resolving to a string containig the payment page url.
248
+ *
249
+ * πŸ›  **Example usage**:
250
+ * ```ts
251
+ * await getCommercialOrderPaymentPageUrl({
252
+ * orderId: "commercialOrder1",
253
+ * paymentOption: "BANK_WIRE",
254
+ * });
255
+ * ```
256
+ *
257
+ * @param {GetCommercialOrderPaymentPageUrlParameters} params - The parameters for the request.
258
+ * @throws {Error} If `orderId` is missing.
259
+ * @returns {Promise<string>} A promise resolving to a string containig the payment page url.
28
260
  */
29
261
  export declare function getCommercialOrderPaymentPageUrl({ orderId, paymentOption, paymentProvider, }: GetCommercialOrderPaymentPageUrlParameters): Promise<string>;
30
262
  /**
31
- * Update commercial order shipping address
263
+ * 🚚 Creates a specific commercial order's card registration.
264
+ *
265
+ * This function registered a card for a specific commercial order, identified by
266
+ * the `orderId`. Both parameters are mandatory and validated
267
+ * before the request is executed.
268
+ *
269
+ * πŸ›  **Endpoint**: `POST /v1/shop/commercial-orders/${orderId}/preauthorization [ORDER-105]`
270
+ *
271
+ * | Parameter | Type | Required | Description |
272
+ * |-------------------|---------------------------------|------------|------------------------------------------|
273
+ * | `orderId` | `string` | βœ… | The ID of the commercial order for which you want to register a card. |
274
+ * | `paymentProvider` | `paymentProvider` | βœ… | Specifies whether the card payments uses (`MANGOPAY`), (`THUNES`) or (`LEMONWAY`). |
275
+ * | `authorId` | `string` | ❌ | The ID of the author of the preauthorization. |
276
+ * | `browserInfo` | `browserInfo` | ❌ | The information of the browser used to make the preauthorization. |
277
+ * | `ipAddress` | `string` | ❌ | The IP Address of the machine used to make the preauthorization. |
278
+ * | `paymentCardInfo` | `paymentCardInfo` | βœ… | The information of the card used to make the preauthorization. |
279
+ *
280
+ * πŸ“€ **Returns**:
281
+ * A `Promise` resolving to a single `CreateCommercialOrderPreauthorizationResponse` object representing the preauthorization.
282
+ *
283
+ * πŸ›  **Example usage**:
284
+ * ```ts
285
+ * const preauthorization = await createCommercialOrderPreauthorization({
286
+ * orderId: "commercialOrder1",
287
+ * paymentProvider: "MANGOPAY",
288
+ * paymentCardInfo: {
289
+ "amount": 0,
290
+ "cardId": "card1",
291
+ "currency": "EUR"
292
+ }
293
+ * });
294
+ * ```
295
+ *
296
+ * @param {CreateCommercialOrderPreauthorizationParameters} params - The parameters for the request.
297
+ * @throws {Error} If `orderId`, `paymentProvider` or `paymentCardInfo` is missing.
298
+ * @returns {Promise<CreateCommercialOrderPreauthorizationResponse>} A promise resolving to a response containing the preauthorization.
299
+ */
300
+ export declare function createCommercialOrderPreauthorization({ orderId, paymentProvider, authorId, browserInfo, ipAddress, paymentCardInfo, }: CreateCommercialOrderPreauthorizationParameters): Promise<CreateCommercialOrderPreauthorizationResponse>;
301
+ /**
302
+ * 🚚 Updates a specific commercial order's shipping address.
303
+ *
304
+ * This function updates the shipping address of a specific commercial order, identified by
305
+ * the `orderId` and the `shippingAddressId`. Both parameters are mandatory and validated
306
+ * before the request is executed.
307
+ *
308
+ * πŸ›  **Endpoint**: `PUT /v1/shop/commercial-orders/${orderId}/shipping-address [ORDER-202]`
309
+ *
310
+ * | Parameter | Type | Required | Description |
311
+ * |-------------------|---------------------------------|------------|------------------------------------------|
312
+ * | `orderId` | `string` | βœ… | The ID of the commercial order of which you want to update the address. |
313
+ * | `shippingAddressId`| `string` | βœ… | The ID of the shipping address to update. |
314
+ *
315
+ * πŸ“€ **Returns**:
316
+ * A `Promise` resolving when the shipping address of the commercial order is updated.
317
+ *
318
+ * πŸ›  **Example usage**:
319
+ * ```ts
320
+ * await updateCommercialOrderShippingAddress({
321
+ * orderId: "commercialOrder1",
322
+ * shippingAddressId: "shippingAddress1",
323
+ * });
324
+ * ```
325
+ *
326
+ * @param {UpdateCommercialOrderShippingAddressParameters} params - The parameters for the request.
327
+ * @throws {Error} If `orderId` or `shippingAddressId` is missing.
328
+ * @returns {Promise<void>} A promise resolving when shipping address of the commercial order is updated.
32
329
  */
33
330
  export declare function updateCommercialOrderShippingAddress({ orderId, shippingAddressId, }: UpdateCommercialOrderShippingAddressParameters): Promise<void>;
34
331
  /**
35
- * Update commercial order shipping information
332
+ * 🚚 Updates a specific commercial order's shipping information.
333
+ *
334
+ * This function updates the shipping information of a specific commercial order, identified by
335
+ * the `orderId` and the `shippingAddressId`. Both parameters are mandatory and validated
336
+ * before the request is executed.
337
+ *
338
+ * πŸ›  **Endpoint**: `PUT /v1/shop/commercial-orders/${orderId}/shipping-information [ORDER-215]`
339
+ *
340
+ * | Parameter | Type | Required | Description |
341
+ * |-------------------|---------------------------------|------------|------------------------------------------|
342
+ * | `orderId` | `string` | βœ… | The ID of the commercial order of which you want to update the address. |
343
+ * | `shippingAddressId`| `string` | βœ… | The ID of the shipping address to update. |
344
+ * | `shippingType `| `string` | βœ… | The shipping type to set to the commercial order. |
345
+ *
346
+ * πŸ“€ **Returns**:
347
+ * A `Promise` resolving when the shipping address of the commercial order is updated.
348
+ *
349
+ * πŸ›  **Example usage**:
350
+ * ```ts
351
+ * await updateCommercialOrderShippingInformation({
352
+ * orderId: "commercialOrder1",
353
+ * shippingAddressId: "shippingAddress1",
354
+ * });
355
+ * ```
356
+ *
357
+ * @param {UpdateCommercialOrderShippingInformationParameters} params - The parameters for the request.
358
+ * @throws {Error} If `orderId` or `shippingAddressId` is missing.
359
+ * @returns {Promise<void>} A promise resolving when shipping information of the commercial order is updated.
36
360
  */
37
361
  export declare function updateCommercialOrderShippingInformation({ orderId, shippingAddressId, shippingType, }: UpdateCommercialOrderShippingInformationParameters): Promise<void>;
38
362
  /**
39
- * Update commercial order shipping type
363
+ * 🚚 Updates a specific commercial order's shipping type.
364
+ *
365
+ * This function updates the shipping type of a specific commercial order, identified by
366
+ * the `orderId`. This parameter is mandatory and validated
367
+ * before the request is executed.
368
+ *
369
+ * πŸ›  **Endpoint**: `PUT /v1/shop/commercial-orders/${orderId}/shipping-information [ORDER-215]`
370
+ *
371
+ * | Parameter | Type | Required | Description |
372
+ * |-------------------|---------------------------------|------------|------------------------------------------|
373
+ * | `orderId` | `string` | βœ… | The ID of the commercial order of which you want to update the address. |
374
+ * | `shippingType `| `string` | βœ… | The shipping type to set to the commercial order. |
375
+ *
376
+ * πŸ“€ **Returns**:
377
+ * A `Promise` resolving when the shipping type of the commercial order is updated.
378
+ *
379
+ * πŸ›  **Example usage**:
380
+ * ```ts
381
+ * await updateCommercialOrderShippingType({
382
+ * orderId: "commercialOrder1",
383
+ * shippingAddressId: "shippingAddress1",
384
+ * });
385
+ * ```
386
+ *
387
+ * @param {UpdateCommercialOrderShippingTypeParameters} params - The parameters for the request.
388
+ * @throws {Error} If `orderId` or `shippingType` is missing.
389
+ * @returns {Promise<void>} A promise resolving when shipping type of the commercial order is updated.
40
390
  */
41
391
  export declare function updateCommercialOrderShippingType({ orderId, shippingType, }: UpdateCommercialOrderShippingTypeParameters): Promise<void>;
42
- /**
43
- * Update order logistic custom fields value
44
- */
45
- export declare function updateLogisticOrderCustomFieldsValue({ orderLogisticId, customFieldsValues, }: UpdateOrderLogisticCustomFieldParameters): Promise<UpdateOrderLogisticCustomFieldResponse>;