@epcc-sdk/sdks-cart-checkout-order 0.0.1

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.
@@ -0,0 +1,1474 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ import { createClient, createConfig } from "@hey-api/client-fetch";
14
+ export var client = createClient(createConfig());
15
+ /**
16
+ * Get Shopper Carts
17
+ * You can retrieve the carts that are associated with an [account](/docs/api/carts/account-cart-associations) or a [customer](/docs/api/carts/customer-cart-associations).
18
+ *
19
+ * When a shopper retrieves their latest carts, the carts are sorted in descending order by the updated_date. For more information, see [Pagination](/guides/Getting-Started/pagination).
20
+ *
21
+ * :::note
22
+ *
23
+ * Requires an `implicit` token with only one of [Account Management Authentication Token](/docs/api/accounts/post-v-2-account-members-tokens) or [customer token](/docs/customer-management/customer-management-api/customer-tokens).
24
+ *
25
+ * :::
26
+ *
27
+ */
28
+ export var getCarts = function (options) {
29
+ var _a;
30
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
31
+ {
32
+ scheme: "bearer",
33
+ type: "http",
34
+ },
35
+ ], url: "/v2/carts" }));
36
+ };
37
+ /**
38
+ * Create a Cart
39
+ *
40
+ * Creates a cart. Call this endpoint each time a customer creates a cart.
41
+ *
42
+ * Each shopper can have multiple carts. Use the carts API to create a cart. The carts are distinct from one another. Shoppers can add different items to their carts. They can check out one of the carts without affecting the content or status of their other carts.
43
+ *
44
+ * After the shopper checks out the cart, the cart remains available to the shopper. The cart is persistent and stays with the shopper after it is used.
45
+ *
46
+ * You can also create a cart to specify custom discounts. You can enable custom discounts when the `discount_settings.custom_discounts_enabled` field is set to `true`. Default is set from cart discount settings for the store. See [Update Cart Settings](/docs/api/settings/put-v-2-settings-cart).
47
+ *
48
+ * ### Preview Cart
49
+ *
50
+ * You can set a future date for your shopping cart and view the promotions that will be available during that time period. This feature enables you to validate your promotion settings and observe how they will be applied in the cart.
51
+ *
52
+ * :::caution
53
+ * - Once the cart is in preview mode, you cannot revert it to a regular cart.
54
+ * - Carts with `snapshot_date` are same as preview carts.
55
+ * - You cannot checkout a cart that includes a `snapshot_date`.
56
+ * - To delete a promotion preview cart, use [Delete a cart](/docs/api/carts/delete-a-cart) endpoint.
57
+ * - The promotion preview cart has the same expiration time as a regular cart based on the store's [cart settings](/docs/api/settings/put-v-2-settings-cart).
58
+ * - Preview cart interactions skip inventory checks and events, allowing users to preview future carts without impacting related external systems.
59
+ * :::
60
+ *
61
+ * ### Custom Attributes
62
+ * You can create custom attributes for the cart object to include additional information, enabling promotions that target specific cart attributes.
63
+ * For example:
64
+ * ```
65
+ * "custom_attributes":{
66
+ * "membership": {
67
+ * "type": "string",
68
+ * "value": "VIP"
69
+ * }
70
+ * }
71
+ * ```
72
+ * See [adding cart custom attributes in promotions builder](/docs/commerce-manager/promotions-builder/creating-a-promotion-in-promotions-builder#adding-cart-custom-attributes)
73
+ *
74
+ * Cart custom attributes remain with the corresponding cart for the extent of its lifecycle. These custom attributes carry over to the resulting order objects on checkout and those on carts are deleted with their carts upon cart deletions.
75
+ * Custom attributes can be updated or removed using a PUT request. To delete specific custom attributes, simply exclude the unwanted attribute objects from the PUT request body.
76
+ *
77
+ * ### Contact Email
78
+ * You can attach an email to carts via the `contact.email` field. These values help identify guest shopper carts and, in the case of promotions with maximum usage settings for guest and registered shopper, track per-shopper promotion usages.
79
+ * See [Create Max Uses Per Shopper Promotion Codes](/docs/promotions-builder/promotions-builder-codes/create-max-use-limit-promotion-codes)
80
+ *
81
+ * For example:
82
+ * ```
83
+ * "contact": {
84
+ * "email": "tester@email.com"
85
+ * }
86
+ * ```
87
+ *
88
+ * Please note, this value is not supported for registered shopper carts (that is, carts with accounts or customers associated), as these carts already have email values associated via the shopper details. Accordingly, requests to add contact email information to registered shopper carts (and vice versa) result in error messages.
89
+ *
90
+ * ### Errors
91
+ *
92
+ * - `400 Bad Request` : This is returned when the submitted request does not adhere to the expected API contract for the endpoint.
93
+ *
94
+ * - For example, in the case of string fields, this error might indicate issues in the length or format of submitted strings. For more information about valid string fields, refer to Safe Characters section.
95
+ * - In the case of preview carts (those with `snapshot_date`), an error is returned for invalid actions, such as removing the preview date, setting a preview date in the past, or attempting to checkout a cart with a `snapshot_date`.
96
+ *
97
+ */
98
+ export var createACart = function (options) {
99
+ var _a;
100
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
101
+ {
102
+ scheme: "bearer",
103
+ type: "http",
104
+ },
105
+ ], url: "/v2/carts" }));
106
+ };
107
+ /**
108
+ * Delete a Cart
109
+ * You can delete a cart, including the items, name, description, and remove all associations.
110
+ *
111
+ * ### Errors
112
+ *
113
+ * The following error message is received when you attempt to delete a cart that is associated with a customer. Before deletion, ensure that the cart is disassociated.
114
+ *
115
+ * ```json
116
+ * message: {
117
+ * errors: [
118
+ * {
119
+ * status: 400,
120
+ * title: 'Last cart',
121
+ * detail: 'This is the last cart associated with a customer and it cannot be deleted, try disassociating instead'
122
+ * }
123
+ * ]
124
+ * }
125
+ * ````
126
+ *
127
+ */
128
+ export var deleteACart = function (options) {
129
+ var _a;
130
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
131
+ {
132
+ scheme: "bearer",
133
+ type: "http",
134
+ },
135
+ ], url: "/v2/carts/{cartID}" }));
136
+ };
137
+ /**
138
+ * Get a Cart
139
+ * Use this endpoint to retrieve a specific cart. If a cart ID does not exist, a new cart will be automatically created. If the cart is associated with shipping groups, calling this endpoint displays the associated shipping group IDs in the `relationships` section.
140
+ *
141
+ * You can easily get a new or existing cart by providing the unique cart reference in the request. If the cart is associated with shipping groups, calling this endpoint displays the associated shipping group IDs in the relationships section.
142
+ *
143
+ * :::note
144
+ *
145
+ * - The default cart name is Cart. However, you can update the cart name as required. Ensure that the string length of the name is greater than or equal to one. Follow the safe character guidelines for name and description naming. For more information about cart ID naming requirements, see the [Safe Characters](/guides/Getting-Started/safe-characters) section.
146
+ * - Outside of the JS-SDK, we don't handle creating cart references. You need to create your own.
147
+ *
148
+ * :::
149
+ *
150
+ * :::caution
151
+ *
152
+ * An empty cart is returned for any carts that don’t currently exist. For more information about the cart items object, see [Get Cart Items](/docs/api/carts/get-cart-items).
153
+ *
154
+ * :::
155
+ *
156
+ * ### Query parameters
157
+ *
158
+ *
159
+ * | Name | Required | Type | Description |
160
+ * |:----------|:---------|:---------|:-------------------------------------------|
161
+ * | `include` | Optional | `string` | Comma-delimited string of entities that can be included. The information included are `items`,`tax_items`, `custom_discounts`, or `promotions`. |
162
+ *
163
+ */
164
+ export var getACart = function (options) {
165
+ var _a;
166
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
167
+ {
168
+ scheme: "bearer",
169
+ type: "http",
170
+ },
171
+ ], url: "/v2/carts/{cartID}" }));
172
+ };
173
+ /**
174
+ * Update a Cart
175
+ * Updates cart properties for the specified cartID.
176
+ *
177
+ * You can also update a cart to specify custom discounts. You can enable custom discounts when the `discount_settings.custom_discounts_enabled` field is set to `true`. Default is set from cart discount settings for the store. See [Cart Settings](/docs/api/settings/put-v-2-settings-cart).
178
+ *
179
+ */
180
+ export var updateACart = function (options) {
181
+ var _a;
182
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).put(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
183
+ {
184
+ scheme: "bearer",
185
+ type: "http",
186
+ },
187
+ ], url: "/v2/carts/{cartID}" }));
188
+ };
189
+ /**
190
+ * Delete all Cart Items
191
+ * A shopper can clean up their cart, deleting custom items, promotions, and so on, while the empty cart remains available. The cart id, name, description, and any account or customer associations persist. The shopper can continue to add items to the cart.
192
+ *
193
+ */
194
+ export var deleteAllCartItems = function (options) {
195
+ var _a;
196
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
197
+ {
198
+ scheme: "bearer",
199
+ type: "http",
200
+ },
201
+ ], url: "/v2/carts/{cartID}/items" }));
202
+ };
203
+ /**
204
+ * Get Cart Items
205
+ *
206
+ * Use this endpoint to retrieve cart items. If the cart is associated with shipping groups, calling this endpoint displays the associated shipping group IDs.
207
+ *
208
+ * You can use this endpoint to retrieve the breakdown of cart items by promotion ID. For example, if you have Promotions Standard item discount with code *sale2024*, Rule Promotions item discount with code *sale2024*, and Rule Promotions cart discount with code *sale2024*, the `discounts.constituents` field in the response example will show the breakdown of the same promotion code used in both Promotions Standard and Rule Promotions.
209
+ *
210
+ * ```json
211
+ * "data": [
212
+ * {
213
+ * "id": "98de010d-dd10-4fa5-a070-0b9bcdc72974",
214
+ * "type": "cart_item",
215
+ * "product_id": "5a4662d2-9a2b-4f6e-a215-2970db914b0c",
216
+ * "name": "sku1",
217
+ * "description": "sku1",
218
+ * "sku": "sku1",
219
+ * "slug": "sku1",
220
+ * "image": {
221
+ * "mime_type": "",
222
+ * "file_name": "",
223
+ * "href": ""
224
+ * },
225
+ * "quantity": 1,
226
+ * "manage_stock": false,
227
+ * "unit_price": {
228
+ * "amount": 10000,
229
+ * "currency": "USD",
230
+ * "includes_tax": false
231
+ * },
232
+ * "value": {
233
+ * "amount": 10000,
234
+ * "currency": "USD",
235
+ * "includes_tax": false
236
+ * },
237
+ * "discounts": [
238
+ * {
239
+ * "amount": {
240
+ * "amount": -2000,
241
+ * "currency": "USD",
242
+ * "includes_tax": false
243
+ * },
244
+ * "code": "sale2024",
245
+ * "id": "e4d929d5-f471-4317-9a86-a84a6c572b44",
246
+ * "promotion_source": "rule-promotion",
247
+ * "is_cart_discount": true
248
+ * },
249
+ * {
250
+ * "amount": {
251
+ * "amount": -1000,
252
+ * "currency": "USD",
253
+ * "includes_tax": false
254
+ * },
255
+ * "code": "sale2024",
256
+ * "id": "de19a043-a6da-4bde-b896-d17e16b77e25",
257
+ * "promotion_source": "rule-promotion"
258
+ * },
259
+ * {
260
+ * "amount": {
261
+ * "amount": -1000,
262
+ * "currency": "USD",
263
+ * "includes_tax": false
264
+ * },
265
+ * "code": "sale2024",
266
+ * "id": "509295ee-2971-45b6-801e-95df09756989"
267
+ * },
268
+ * {
269
+ * "amount": {
270
+ * "amount": -1000,
271
+ * "currency": "USD",
272
+ * "includes_tax": false
273
+ * },
274
+ * "code": "sale2024",
275
+ * "id": "ca79e606-7ecd-41ac-9478-af4c8c28c546",
276
+ * "promotion_source": "rule-promotion",
277
+ * "is_cart_discount": true
278
+ * }
279
+ * ],
280
+ * "links": {
281
+ * "product": "https://useast.api.elasticpath.com/v2/products/5a4662d2-9a2b-4f6e-a215-2970db914b0c"
282
+ * },
283
+ * "meta": {
284
+ * "display_price": {
285
+ * "with_tax": {
286
+ * "unit": {
287
+ * "amount": 5000,
288
+ * "currency": "USD",
289
+ * "formatted": "$50.00"
290
+ * },
291
+ * "value": {
292
+ * "amount": 5000,
293
+ * "currency": "USD",
294
+ * "formatted": "$50.00"
295
+ * }
296
+ * },
297
+ * "without_tax": {
298
+ * "unit": {
299
+ * "amount": 5000,
300
+ * "currency": "USD",
301
+ * "formatted": "$50.00"
302
+ * },
303
+ * "value": {
304
+ * "amount": 5000,
305
+ * "currency": "USD",
306
+ * "formatted": "$50.00"
307
+ * }
308
+ * },
309
+ * "tax": {
310
+ * "unit": {
311
+ * "amount": 0,
312
+ * "currency": "USD",
313
+ * "formatted": "$0.00"
314
+ * },
315
+ * "value": {
316
+ * "amount": 0,
317
+ * "currency": "USD",
318
+ * "formatted": "$0.00"
319
+ * }
320
+ * },
321
+ * "discount": {
322
+ * "unit": {
323
+ * "amount": -5000,
324
+ * "currency": "USD",
325
+ * "formatted": "-$50.00"
326
+ * },
327
+ * "value": {
328
+ * "amount": -5000,
329
+ * "currency": "USD",
330
+ * "formatted": "-$50.00"
331
+ * }
332
+ * },
333
+ * "without_discount": {
334
+ * "unit": {
335
+ * "amount": 10000,
336
+ * "currency": "USD",
337
+ * "formatted": "$100.00"
338
+ * },
339
+ * "value": {
340
+ * "amount": 10000,
341
+ * "currency": "USD",
342
+ * "formatted": "$100.00"
343
+ * }
344
+ * },
345
+ * "discounts": {
346
+ * "sale2024": {
347
+ * "amount": -5000,
348
+ * "currency": "USD",
349
+ * "formatted": "-$50.00",
350
+ * "constituents": {
351
+ * "509295ee-2971-45b6-801e-95df09756989": {
352
+ * "amount": -1000,
353
+ * "currency": "USD",
354
+ * "formatted": "-$10.00"
355
+ * },
356
+ * "ca79e606-7ecd-41ac-9478-af4c8c28c546": {
357
+ * "amount": -1000,
358
+ * "currency": "USD",
359
+ * "formatted": "-$10.00"
360
+ * },
361
+ * "de19a043-a6da-4bde-b896-d17e16b77e25": {
362
+ * "amount": -1000,
363
+ * "currency": "USD",
364
+ * "formatted": "-$10.00"
365
+ * },
366
+ * "e4d929d5-f471-4317-9a86-a84a6c572b44": {
367
+ * "amount": -2000,
368
+ * "currency": "USD",
369
+ * "formatted": "-$20.00"
370
+ * }
371
+ * }
372
+ * }
373
+ * }
374
+ * },
375
+ * "timestamps": {
376
+ * "created_at": "2024-05-24T18:00:58Z",
377
+ * "updated_at": "2024-05-24T18:00:58Z"
378
+ * }
379
+ * },
380
+ * "catalog_id": "09b9359f-897f-407f-89a2-702e167fe781",
381
+ * "catalog_source": "pim"
382
+ * }
383
+ * ```
384
+ *
385
+ */
386
+ export var getCartItems = function (options) {
387
+ var _a;
388
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
389
+ {
390
+ scheme: "bearer",
391
+ type: "http",
392
+ },
393
+ ], url: "/v2/carts/{cartID}/items" }));
394
+ };
395
+ /**
396
+ * Add Items to Cart
397
+ *
398
+ * ### Add Product to Cart
399
+ *
400
+ * Adding a Product to Cart is the most common Cart action. If you want to add any custom products or promotions, you need to do that as a separate action.
401
+ *
402
+ * #### Dynamic Bundles
403
+ *
404
+ * A bundle is a purchasable product that is composed of a combination of two or more products that you want to sell together. You can create multiple components within a bundle. Each component can have one or more options. Each option is a product and a quantity. You can configure minimum and/or maximum values for the number of product options in a component that your shoppers can select. For example, you can enable a shopper to select 1 or more product options from a list of 10. These are called [dynamic bundles](/docs/api/pxm/products/products#dynamic-bundles).
405
+ *
406
+ * Your dynamic bundles are displayed in your published catalogs.
407
+ *
408
+ * 1. Use the configure a shopper endpoint to allow shoppers to make their selections from a bundle.
409
+ * 2. In the response of the configure a shopper, the `bundle_configuration` object contains the bundle selections a shopper has made.
410
+ * 3. In the add a product to cart request, use the `bundle_configuration` object to add the customers selections to a cart.
411
+ *
412
+ * ```json
413
+ * "bundle_configuration": {
414
+ * "selected_options": {
415
+ * "games": {
416
+ * "d7b79eb8-19d8-45ea-86ed-2324a604dd9c": 1
417
+ * },
418
+ * "toys": {
419
+ * "0192ccdd-6d33-4898-87d7-c4d87f2bf8ea": 1,
420
+ * "1aea6f97-f0d9-452c-b3c1-7fb5629ead82": 1
421
+ * }
422
+ * }
423
+ * }
424
+ * ```
425
+ *
426
+ * When a cart is checked out, the options a shopper selected are added to the order. See [order items](/docs/api/carts/get-order-items).
427
+ *
428
+ * #### Personalized Products
429
+ *
430
+ * You can allow shoppers to personalize their goods by adding custom text inputs to products directly. This feature is particularly useful for customizable items, such as personalized T-shirts or greeting cards. You can use this functionality by leveraging the `custom_inputs` attribute, and defining the details and validation rules for the custom text.
431
+ *
432
+ * First, you must configure a `custom_inputs` attribute when creating a new product or updating an existing product. Once you have defined your custom inputs on a product, you must configure the custom inputs in your orders.
433
+ *
434
+ * For example, you may sell T-shirts that can have personalized text on the front and back of the shirt.
435
+ *
436
+ * ```json
437
+ * {
438
+ * "data": {
439
+ * "type": "product",
440
+ * "attributes": {
441
+ * "custom_inputs": {
442
+ * "front": {
443
+ * "name": "T-Shirt Front",
444
+ * "validation_rules": [
445
+ * {
446
+ * "type": "string",
447
+ * "options": {
448
+ * "max_length": 50
449
+ * }
450
+ * }
451
+ * ],
452
+ * "required": false
453
+ * },
454
+ * "back": {
455
+ * "name": "T-Shirt Back",
456
+ * "validation_rules": [
457
+ * {
458
+ * "type": "string",
459
+ * "options": {
460
+ * "max_length": 50
461
+ * }
462
+ * }
463
+ * ],
464
+ * "required": false
465
+ * }
466
+ * }
467
+ * }
468
+ * }
469
+ * }
470
+ * ```
471
+ *
472
+ * If the same product has different `custom_inputs` attributes, then these are added as separate items in a cart.
473
+ *
474
+ * The `custom_inputs` attribute is stored in the cart item and the text for `custom_input` must not exceed 255 characters in length. When a cart is checked out, the `custom_inputs` attribute becomes part of the order.
475
+ *
476
+ * #### Limitations on Usage of `custom_inputs` with Specific Promotion Types
477
+ *
478
+ * When you add products to a cart with `custom_inputs`, there are certain limitations on usage of the `custom_inputs` with the following promotion types:
479
+ *
480
+ * - For [Free Gift Promotions](/docs/api/promotions/create-a-promotion), you can add `custom_inputs` to gift items.
481
+ * - For [Fixed Bundle Discount Promotions](/docs/api/promotions/create-a-promotion), the promotion applies as long as the cart contains the bundle SKUs even when there are different `custom_inputs`.
482
+ * - For [X for Y Discount Promotion and X for amount discount promotion](/docs/api/promotions/create-a-promotion), the promotion applies when there are two SKUs with the same `custom_inputs`. The promotion does not apply when there are different `custom_inputs` and the SKUs are in different line items.
483
+ *
484
+ * #### Stock locations
485
+ *
486
+ * When adding to a cart it is possible to specify which [stock location](/docs/api/pxm/inventory_mli/inventories-introduction?#multi-location-inventories) should be used for tracking inventory for that product by specifying its slug in `location`. This might represent the warehouse a product is shipped from or the store holding the stock in a Buy Online Pick Up In Store scenario.
487
+ *
488
+ * Each line item is restricted to a single stock location. If the same product is added with a different location then the most recently-specified location will be used for the total quantity of that line item.
489
+ *
490
+ * :::note
491
+ *
492
+ * - Any requests to add a product to cart returns the collection of cart items.
493
+ * - [Tax items](/docs/api/carts/tax-items) may optionally be added with the product. Only administrators with [client_credentials access tokens](/docs/api/authentication/create-an-access-token) are able to do this. If included, they replace any existing taxes on the product.
494
+ * - The cart currency is set when the first item is added to the cart.
495
+ * - The product being added to the cart requires a price in the same currency as the other items in the cart. The API returns a 400 error if a price is not defined in the correct currency.
496
+ * - A cart can contain a maximum of 100 unique items. Items include products, custom items, tax items, and promotions.
497
+ * - There are a number of actions that happen to your inventory when checking out and paying for an order. For more information, see the [Inventory](/docs/api/pxm/inventory/inventories-introduction) documentation.
498
+ *
499
+ * :::
500
+ *
501
+ * ### Including Resources
502
+ *
503
+ * When you make an `Add Product to Cart` request to the catalog-view service, you can obtain details of the component products. If you include the optional parameter `include=component_products` in the request, the response will include details for each component product.
504
+ *
505
+ * When a bundle with selected component products is added to a cart, the cart displays both the bundle pricing and component product IDs.
506
+ *
507
+ * The response example is returned with a new field called `component_products` under `bundle_configuration`, which is a list of component products that the user has selected for dynamic bundles.
508
+ *
509
+ * | Parameter | Required | Description |
510
+ * |:------------------------|:-------------|:-------------------|
511
+ * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. |
512
+ * | `main_image` | Optional | The main images associated with a product. |
513
+ * | `files` | Optional | Any files associated with a product. |
514
+ *
515
+ * ```json
516
+ * "bundle_configuration": {
517
+ * "selected_options": {
518
+ * "mixed-shirts": {
519
+ * "16a6cc14-6ebb-4156-9973-e6a0f92f5731": 3,
520
+ * "55037cc5-f382-4039-95c6-1e04ac0351d3": 2,
521
+ * "standard-shirts"
522
+ * "70f1c9d2-c580-4839-bd6c-a0a9b91d5159": 5
523
+ * }
524
+ * },
525
+ * "component_products": [
526
+ * {
527
+ * "id": "16a6cc14-6ebb-4156-9973-e6a0f92f5731",
528
+ * "type": "product",
529
+ * "attributes": {
530
+ * "name": "Red T-shirt",
531
+ * "description": "Standard red t-shirt.",
532
+ * "slug": "red-t-shirt-slug",
533
+ * "sku": "red-t-shirt-sku",
534
+ * "status": "live",
535
+ * "commodity_type": "physical"
536
+ * },
537
+ * "meta": {
538
+ * "display_price": {
539
+ * "without_tax": {
540
+ * "amount": 500,
541
+ * "currency": "USD",
542
+ * "formatted": "$5.00"
543
+ * }
544
+ * }
545
+ * }
546
+ * },
547
+ * {
548
+ * "id": "55037cc5-f382-4039-95c6-1e04ac0351d3",
549
+ * "type": "product",
550
+ * "attributes": {
551
+ * "name": "Blue T-shirt",
552
+ * "description": "Standard blue t-shirt.",
553
+ * "slug": "blue-t-shirt-slug",
554
+ * "sku": "blue-t-shirt-sku",
555
+ * "status": "live",
556
+ * "commodity_type": "physical"
557
+ * },
558
+ * "meta": {
559
+ * "display_price": {
560
+ * "without_tax": {
561
+ * "amount": 500,
562
+ * "currency": "USD",
563
+ * "formatted": "$5.00"
564
+ * }
565
+ * }
566
+ * }
567
+ * },
568
+ * {
569
+ * "id": "70f1c9d2-c580-4839-bd6c-a0a9b91d5159",
570
+ * "type": "product",
571
+ * "attributes": {
572
+ * "name": "White T-shirt",
573
+ * "description": "Standard white t-shirt.",
574
+ * "slug": "white-t-shirt-slug",
575
+ * "sku": "white-t-shirt-sku",
576
+ * "status": "live",
577
+ * "commodity_type": "physical"
578
+ * },
579
+ * "meta": {
580
+ * "display_price": {
581
+ * "without_tax": {
582
+ * "amount": 500,
583
+ * "currency": "USD",
584
+ * "formatted": "$5.00"
585
+ * }
586
+ * }
587
+ * }
588
+ * }
589
+ * ]
590
+ * }
591
+ * ```
592
+ *
593
+ * See [Including Resources](https://elasticpath.dev/guides/Getting-Started/includes).
594
+ *
595
+ * ### Add Subscription to Cart
596
+ *
597
+ * To add a subscription to your cart, you need to provide the ID of the subscription offering and the ID of the plan within that offering that you want to subscribe to.
598
+ *
599
+ * ```json
600
+ * {
601
+ * {
602
+ * "data": {
603
+ * "id": "5b9be99f-1c94-4ddd-9718-81adab0cc3e0",
604
+ * "type": "subscription_item",
605
+ * "quantity": 1,
606
+ * "subscription_configuration": {
607
+ * "plan": "40010dde-2f38-489b-8b3f-14a13cbfb431"
608
+ * }
609
+ * }
610
+ * }
611
+ * ```
612
+ *
613
+ * The price of the subscription item in the cart reflects the cost of the subscription's initial billing period. Once the cart has been checked out and the order paid for, the subscription will be automatically created in the subscriptions service.
614
+ *
615
+ * ### Add Custom Item to Cart
616
+ *
617
+ * You can add a custom item to the cart when you don't manage things like shipping, taxes and inventory in Commerce.
618
+ *
619
+ * For [Shipping Groups](/docs/ship-groups/shipping-groups/index), once you have created a [cart shipping group](/docs/ship-groups/shipping-groups/shipping-groups-api/create-cart-shipping-group), you need to link it to the cart items. This is important, because it is necessary to associate items with shipping groups in order to include shipping groups in the corresponding cart, order, and totals.
620
+ *
621
+ * :::note
622
+ *
623
+ * - Custom Cart Items are available when using [implicit access tokens](/docs/api/authentication/create-an-access-token). Ensure that you always check each order has the correct details for each item, most importantly, price.
624
+ *
625
+ * :::
626
+ *
627
+ * ### Add Promotion to Cart
628
+ *
629
+ * You can use the Promotions API to apply discounts to your cart as a special cart item type. Any requests to add a product to cart will return a collection of cart items.
630
+ *
631
+ * There are certain limitations on usage of the `custom_inputs` attribute with some promotion types. See [Limitations on Usage of `custom_inputs` with Specific Promotion Types](/docs/api/carts/manage-carts#limitations-on-usage-of-custom_inputs-with-specific-promotion-types).
632
+ *
633
+ * To remove promotion from the cart via the promotion code, see [Delete Promotion Code from Cart](/docs/api/carts/delete-a-promotion-via-promotion-code).
634
+ *
635
+ * ### Re-order
636
+ *
637
+ * From a shopper’s order history, they can add the items from a previous order into their carts. Shoppers can add items regardless of past order status, such as incomplete or not paid. For more information, see [Orders](/docs/api/carts/orders).
638
+ *
639
+ * :::note
640
+ * - Any requests to add an item to cart return a collection of [cart items](/docs/api/carts/cart-items).
641
+ * - A cart can contain a maximum of 100 unique items. Items include products, custom items, and promotions.
642
+ * - When a shopper creates a cart and re-orders items from an order with properties such as custom attributes, custom discounts, and payment intent ID, these properties will remain unchanged in the original cart.
643
+ * - Custom items do not exist in catalogs, and therefore cannot be reordered.
644
+ * :::
645
+ *
646
+ * ### Merging Carts
647
+ *
648
+ * A shopper can have multiple carts, and the system may automatically merge items from an anonymous cart into the shopper's registered cart when they sign in. For example, if a shopper has an existing cart with items `A`, `B` and `C`, and later adds items `D` and `E` while not signed in, the system can merge these carts when the shopper signs in. After the carts merge, the cart contains items `A`, `B`, `C`, `D` and `E`.
649
+ *
650
+ * If any items are duplicated from the anonymous cart to the registered cart, their quantities are incremented accordingly. For example, if a shopper's existing cart with items `A`, `B` and `C`, and they later add two more `A` items and one `B` item while not signed in, the system will merge the carts when the shopper signs in. The existing cart will now contain three `A` items, two `B` items, and one `C` item.
651
+ *
652
+ * :::note
653
+ *
654
+ * When the system merges items from one cart into another cart, properties such as custom attributes, custom discounts, and payment intent ID will remain unchanged in the original cart.
655
+ *
656
+ * :::
657
+ *
658
+ * ### Best Practices
659
+ *
660
+ * We recommend to include a unique `sku` code within the request body while adding custom items to carts. If the same `sku` is used for multiple products, they are merged into a single line item.
661
+ *
662
+ * For example, if a cart consists of the following items:
663
+ *
664
+ * - `product-1` with quantity 1 and sku code as `sku-1`
665
+ * - `product-2` with quantity 1 and sku code as `sku-1`
666
+ * - `product-3` with quantity 1 and sku code as `sku-2`.
667
+ *
668
+ * The following response is returned where it combines all products with the same sku codes into a single line item, while products with a unique sku codes are represented as separate items:
669
+ *
670
+ * ```json
671
+ * {
672
+ * "data": [
673
+ * {
674
+ * "id": "c58760f4-8889-4719-b34d-be1f1d11ae59",
675
+ * "type": "custom_item",
676
+ * "name": "product-1",
677
+ * "description": "My first custom item!",
678
+ * "sku": "sku-1",
679
+ * "slug": "",
680
+ * "image": {
681
+ * "mime_type": "",
682
+ * "file_name": "",
683
+ * "href": ""
684
+ * },
685
+ * "quantity": 2,
686
+ * "manage_stock": false,
687
+ * "unit_price": {
688
+ * "amount": 20000,
689
+ * "currency": "USD",
690
+ * "includes_tax": true
691
+ * },
692
+ * "value": {
693
+ * "amount": 40000,
694
+ * "currency": "USD",
695
+ * "includes_tax": true
696
+ * },
697
+ * "links": {},
698
+ * "meta": {
699
+ * "display_price": {
700
+ * "with_tax": {
701
+ * "unit": {
702
+ * "amount": 20000,
703
+ * "currency": "USD",
704
+ * "formatted": "$200.00"
705
+ * },
706
+ * "value": {
707
+ * "amount": 40000,
708
+ * "currency": "USD",
709
+ * "formatted": "$400.00"
710
+ * }
711
+ * },
712
+ * "without_tax": {
713
+ * "unit": {
714
+ * "amount": 20000,
715
+ * "currency": "USD",
716
+ * "formatted": "$200.00"
717
+ * },
718
+ * "value": {
719
+ * "amount": 40000,
720
+ * "currency": "USD",
721
+ * "formatted": "$400.00"
722
+ * }
723
+ * },
724
+ * "tax": {
725
+ * "unit": {
726
+ * "amount": 0,
727
+ * "currency": "USD",
728
+ * "formatted": "$0.00"
729
+ * },
730
+ * "value": {
731
+ * "amount": 0,
732
+ * "currency": "USD",
733
+ * "formatted": "$0.00"
734
+ * }
735
+ * },
736
+ * "discount": {
737
+ * "unit": {
738
+ * "amount": 0,
739
+ * "currency": "USD",
740
+ * "formatted": "$0.00"
741
+ * },
742
+ * "value": {
743
+ * "amount": 0,
744
+ * "currency": "USD",
745
+ * "formatted": "$0.00"
746
+ * }
747
+ * },
748
+ * "without_discount": {
749
+ * "unit": {
750
+ * "amount": 20000,
751
+ * "currency": "USD",
752
+ * "formatted": "$200.00"
753
+ * },
754
+ * "value": {
755
+ * "amount": 40000,
756
+ * "currency": "USD",
757
+ * "formatted": "$400.00"
758
+ * }
759
+ * }
760
+ * },
761
+ * "timestamps": {
762
+ * "created_at": "2023-05-02T16:28:11Z",
763
+ * "updated_at": "2023-05-02T16:28:18Z"
764
+ * }
765
+ * }
766
+ * }
767
+ * ```
768
+ *
769
+ */
770
+ export var manageCarts = function (options) {
771
+ var _a;
772
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
773
+ {
774
+ scheme: "bearer",
775
+ type: "http",
776
+ },
777
+ ], url: "/v2/carts/{cartID}/items" }));
778
+ };
779
+ /**
780
+ * Bulk Update Items in Cart
781
+ * The bulk update feature allows shoppers to update an array of items to their cart in one action, rather than updating each item one at a time. Shoppers can update quantity and shipping group details in bulk requests. This minimizes the time for shoppers while updating items to their cart. Shoppers can even update multiple items with the same or different shipping groups to their cart.
782
+ *
783
+ * When you update multiple items that qualify for free gifts in the cart, the corresponding free gifts for all eligible products are also automatically updated in the cart.
784
+ *
785
+ */
786
+ export var bulkUpdateItemsInCart = function (options) {
787
+ var _a;
788
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).put(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
789
+ {
790
+ scheme: "bearer",
791
+ type: "http",
792
+ },
793
+ ], url: "/v2/carts/{cartID}/items" }));
794
+ };
795
+ /**
796
+ * Delete a Cart Item
797
+ * Use this endpoint to delete a cart item.
798
+ */
799
+ export var deleteACartItem = function (options) {
800
+ var _a;
801
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
802
+ {
803
+ scheme: "bearer",
804
+ type: "http",
805
+ },
806
+ ], url: "/v2/carts/{cartID}/items/{cartitemID}" }));
807
+ };
808
+ /**
809
+ * Update a Cart Item
810
+ * You can easily update a cart item. A successful update returns the cart items.
811
+ */
812
+ export var updateACartItem = function (options) {
813
+ var _a;
814
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).put(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
815
+ {
816
+ scheme: "bearer",
817
+ type: "http",
818
+ },
819
+ ], url: "/v2/carts/{cartID}/items/{cartitemID}" }));
820
+ };
821
+ /**
822
+ * Delete Account Cart Association
823
+ * You can delete an association between an account and a cart.
824
+ */
825
+ export var deleteAccountCartAssociation = function (options) {
826
+ var _a;
827
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
828
+ {
829
+ scheme: "bearer",
830
+ type: "http",
831
+ },
832
+ ], url: "/v2/carts/{cartID}/relationships/accounts" }));
833
+ };
834
+ /**
835
+ * Create an Account Cart Association
836
+ * You can create associations between an account and one or more carts. After cart associations exist for an account, the account can access those carts across any device.
837
+ */
838
+ export var createAccountCartAssociation = function (options) {
839
+ var _a;
840
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
841
+ {
842
+ scheme: "bearer",
843
+ type: "http",
844
+ },
845
+ ], url: "/v2/carts/{cartID}/relationships/accounts" }));
846
+ };
847
+ /**
848
+ * Delete Customer Cart Association
849
+ * You can delete an association between a customer and a cart.
850
+ */
851
+ export var deleteCustomerCartAssociation = function (options) {
852
+ var _a;
853
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
854
+ {
855
+ scheme: "bearer",
856
+ type: "http",
857
+ },
858
+ ], url: "/v2/carts/{cartID}/relationships/customers" }));
859
+ };
860
+ /**
861
+ * Create a Customer Cart Association
862
+ * You can create associations between a customer and one or more carts. After cart associations exist for a customer, the customer can access those carts across any device.
863
+ */
864
+ export var createCustomerCartAssociation = function (options) {
865
+ var _a;
866
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
867
+ {
868
+ scheme: "bearer",
869
+ type: "http",
870
+ },
871
+ ], url: "/v2/carts/{cartID}/relationships/customers" }));
872
+ };
873
+ /**
874
+ * Delete a Promotion via Promotion Code
875
+ * You can remove promotion code from a cart if it was applied manually. This endpoint does not work if the promotion is applied automatically.
876
+ */
877
+ export var deleteAPromotionViaPromotionCode = function (options) {
878
+ var _a;
879
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
880
+ {
881
+ scheme: "bearer",
882
+ type: "http",
883
+ },
884
+ ], url: "/v2/carts/{cartID}/discounts/{promoCode}" }));
885
+ };
886
+ /**
887
+ * Add Tax Item to Cart
888
+ *
889
+ * Use this endpoint to add a tax item to a cart.
890
+ *
891
+ * :::note
892
+ *
893
+ * There is a soft limit of 5 unique tax items per cart item at any one time.
894
+ *
895
+ * :::
896
+ *
897
+ */
898
+ export var addTaxItemToCart = function (options) {
899
+ var _a;
900
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
901
+ {
902
+ scheme: "bearer",
903
+ type: "http",
904
+ },
905
+ ], url: "/v2/carts/{cartID}/items/{cartitemID}/taxes" }));
906
+ };
907
+ /**
908
+ * Bulk Delete Tax Items from Cart
909
+ * Use this endpoint to bulk delete tax items from cart.
910
+ */
911
+ export var bulkDeleteTaxItemsFromCart = function (options) {
912
+ var _a;
913
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
914
+ {
915
+ scheme: "bearer",
916
+ type: "http",
917
+ },
918
+ ], url: "/v2/carts/{cartID}/taxes" }));
919
+ };
920
+ /**
921
+ * Bulk Add Tax Items to Cart
922
+ * :::note
923
+ *
924
+ * A cart item can only have a maximum of five tax items.
925
+ *
926
+ * :::
927
+ *
928
+ * ### Errors
929
+ *
930
+ * `422 Unprocessable Entity`
931
+ *
932
+ * In this example, when `options.add_all_or_nothing` is set to `true` and if one of cart items is not found or has reached its maximum tax item limit, the following error response is returned:
933
+ *
934
+ * ```json
935
+ * {
936
+ * "status": 422,
937
+ * "title": "Add all or nothing.",
938
+ * "detail": "Add all or nothing set to (true). Could not bulk add tax items to cart."
939
+ * }
940
+ *
941
+ * ```
942
+ *
943
+ * In this example, if you add more than five tax items to the same cart item, the following error response is returned:
944
+ *
945
+ * ```json
946
+ * {
947
+ * "status": 422,
948
+ * "title": "Tax item not added to cart item.",
949
+ * "detail": "Cannot exceed tax item limit of (5) on cart item.",
950
+ * "meta": {
951
+ * "id": "f88e6370-cb35-40b2-a998-c759f31dec0a"
952
+ * }
953
+ * }
954
+ * ```
955
+ *
956
+ * `404`
957
+ *
958
+ * In this example, if there is a mismatch between `cart_item`/`custom_item` and the `relationships.item.data.type` specified in the bulk add tax item, the following error response is returned:
959
+ *
960
+ * ```json
961
+ * {
962
+ * "data": [],
963
+ * "errors": [
964
+ * {
965
+ * "status": 404,
966
+ * "title": "Tax item not added to cart item.",
967
+ * "detail": "Mismatch between bulk tax item type(cart_item) and cart item type(custom_item).",
968
+ * "meta": {
969
+ * "id": "56aab5d1-1dd4-45ed-88ed-4d0cc396b62d"
970
+ * }
971
+ * },
972
+ * {
973
+ * "status": 404,
974
+ * "title": "Tax item not added to cart item.",
975
+ * "detail": "Mismatch between bulk tax item type(cart_item) and cart item type(custom_item).",
976
+ * "meta": {
977
+ * "id": "56aab5d1-1dd4-45ed-88ed-4d0cc396b62d"
978
+ * }
979
+ * }
980
+ * ]
981
+ * }
982
+ * ```
983
+ *
984
+ */
985
+ export var bulkAddTaxItemsToCart = function (options) {
986
+ var _a;
987
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
988
+ {
989
+ scheme: "bearer",
990
+ type: "http",
991
+ },
992
+ ], url: "/v2/carts/{cartID}/taxes" }));
993
+ };
994
+ /**
995
+ * Delete a Tax Item
996
+ * Use this endpoint to delete a tax item.
997
+ */
998
+ export var deleteATaxItem = function (options) {
999
+ var _a;
1000
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
1001
+ {
1002
+ scheme: "bearer",
1003
+ type: "http",
1004
+ },
1005
+ ], url: "/v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}" }));
1006
+ };
1007
+ /**
1008
+ * Update a Tax Item
1009
+ * Use this endpoint to update a tax item.
1010
+ */
1011
+ export var updateATaxItem = function (options) {
1012
+ var _a;
1013
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).put(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
1014
+ {
1015
+ scheme: "bearer",
1016
+ type: "http",
1017
+ },
1018
+ ], url: "/v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}" }));
1019
+ };
1020
+ /**
1021
+ * Bulk Delete Custom Discounts From Cart
1022
+ * Use this endpoint to bulk delete custom discounts from cart.
1023
+ */
1024
+ export var bulkDeleteCustomDiscountsFromCart = function (options) {
1025
+ var _a;
1026
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
1027
+ {
1028
+ scheme: "bearer",
1029
+ type: "http",
1030
+ },
1031
+ ], url: "/v2/carts/{cartID}/custom-discounts" }));
1032
+ };
1033
+ /**
1034
+ * Bulk Add Custom Discounts to Cart
1035
+ * The default value for custom discounts on both the cart and cart items is set to 5 if this parameter is not configured in the store. To verify the custom discount limit value, call [Get all settings](/docs/api/settings/get-v-2-settings) endpoint.
1036
+ *
1037
+ * To increase the custom discount value, contact [Elastic Path Support team](https://support.elasticpath.com/hc/en-us).
1038
+ *
1039
+ */
1040
+ export var bulkAddCustomDiscountsToCart = function (options) {
1041
+ var _a;
1042
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
1043
+ {
1044
+ scheme: "bearer",
1045
+ type: "http",
1046
+ },
1047
+ ], url: "/v2/carts/{cartID}/custom-discounts" }));
1048
+ };
1049
+ /**
1050
+ * Delete Custom Discount From Cart
1051
+ * Use this endpoint to delete custom discount from cart.
1052
+ */
1053
+ export var deleteCustomDiscountFromCart = function (options) {
1054
+ var _a;
1055
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
1056
+ {
1057
+ scheme: "bearer",
1058
+ type: "http",
1059
+ },
1060
+ ], url: "/v2/carts/{cartID}/custom-discounts/{customdiscountID}" }));
1061
+ };
1062
+ /**
1063
+ * Update Custom Discount For Cart
1064
+ * Use this endpoint to update a custom discount in your cart.
1065
+ */
1066
+ export var updateCustomDiscountForCart = function (options) {
1067
+ var _a;
1068
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).put(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
1069
+ {
1070
+ scheme: "bearer",
1071
+ type: "http",
1072
+ },
1073
+ ], url: "/v2/carts/{cartID}/custom-discounts/{customdiscountID}" }));
1074
+ };
1075
+ /**
1076
+ * Add Custom Discount To Cart Item
1077
+ * Use this endpoint to add a custom discount to cart item.
1078
+ */
1079
+ export var addCustomDiscountToCartItem = function (options) {
1080
+ var _a;
1081
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
1082
+ {
1083
+ scheme: "bearer",
1084
+ type: "http",
1085
+ },
1086
+ ], url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts" }));
1087
+ };
1088
+ /**
1089
+ * Delete Custom Discount From Cart Item
1090
+ * Use this endpoint to delete custom discount from cart item.
1091
+ */
1092
+ export var deleteCustomDiscountFromCartItem = function (options) {
1093
+ var _a;
1094
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).delete(__assign(__assign({}, options), { security: [
1095
+ {
1096
+ scheme: "bearer",
1097
+ type: "http",
1098
+ },
1099
+ ], url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}" }));
1100
+ };
1101
+ /**
1102
+ * Update Custom Discount For Cart Item
1103
+ * Use this endpoint to update a custom discount in your cart item.
1104
+ */
1105
+ export var updateCustomDiscountForCartItem = function (options) {
1106
+ var _a;
1107
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).put(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
1108
+ {
1109
+ scheme: "bearer",
1110
+ type: "http",
1111
+ },
1112
+ ], url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}" }));
1113
+ };
1114
+ /**
1115
+ * Create Stripe Payment Intent for a Cart
1116
+ * The Cart Payment Intent feature enables the creation of a Stripe Payment Intent specifically tied to a shopping cart and its subsequent order. This allows Payment Intent users to track payment details from the cart stage and seamlessly maintain consistency in payment information throughout the order stage. Using these features, you can create Payment Intents for their carts, update Payment Intents with final cart details, and synchronize Payment Intents from Stripe to Commerce.
1117
+ *
1118
+ * :::note
1119
+ *
1120
+ * - Typically, in Commerce, inventory is allocated at the time of payment initiation after an order is created. However, in the case of Cart Payment Intent, information about the payment is received only upon synchronizing the order from Stripe to Commerce. This may happen after the payment is completed. Therefore, there might be a delay between the payment made and allocation, increasing the chance of paying for items that are not in stock.
1121
+ * - There are certain fields you can choose to set up when [creating a payment intent](https://stripe.com/docs/api/payment_intents/create). However, if you decide to update a payment intent, the available options may not be the same as those allowed while creating a payment intent. See [updating a payment intent](https://stripe.com/docs/api/payment_intents/update).
1122
+ *
1123
+ * :::
1124
+ *
1125
+ * The following steps outline the workflow associated with the Payment Intent:
1126
+ *
1127
+ * 1. [Add items to cart](/docs/api/carts/manage-carts#add-custom-item-to-cart).
1128
+ * 1. [Create a Payment Intent for the cart](/docs/api/carts/create-cart-payment-intent). The Payment Intent is created in Stripe, reflecting the cart and transaction details, including currency, amounts, payment type, and any optional Stripe details. The Payment Intent ID is generated and linked to the cart.
1129
+ * 1. [Update a Payment Intent](/docs/carts-orders/update-cart-payment-intent). This step is optional but becomes necessary when there are changes in the cart details at the time of payment. It ensures the Payment Intent accurately reflects the current cart details when processing the payments on the front end.
1130
+ * 1. [Checkout the cart](/docs/api/carts/checkout). An unpaid order is created, and the Payment Intent ID is linked to the order.
1131
+ * 1. [Confirm the order](/docs/carts-orders/confirm-an-order). This is important because after checkout, it is essential to confirm the Payment Intent and synchronize it with Commerce. This results in a corresponding transaction and change in order statuses in Commerce. Additionally, the Payment Intent ID is removed from the order once it is linked via the transaction.
1132
+ *
1133
+ * ### Best Practices
1134
+ *
1135
+ * We recommend you follow these practices to maintain consistency and accuracy when using Cart Payment Intent.
1136
+ *
1137
+ * - After checkout, we recommend clearing the shopping cart. You can achieve this using a [Delete a cart](/docs/api/carts/delete-a-cart) endpoint or [Update a cart](/docs/api/carts/update-a-cart) to remove the Payment Intent ID. This helps to avoid potential issues where subsequent checkouts for the same cart might unintentionally use the previous Stripe Payment Intent ID.
1138
+ * - If it is not reasonable to clear the cart immediately after checkout due to several subsequent, duplicate checkouts to the same cart, ensure that you only synchronize the Payment Intent when finalizing the order. Each order confirmation is unaware of the others, and syncing Payment Intent IDs for each confirmation can lead to duplicate transactions in Commerce. In other words, if you synchronize Payment Intents for earlier versions of a repeated checkout, you'll end up with multiple orders from the same cart, each having transactions linked to the same Payment Intent.
1139
+ * - To pay the entire amount at once, use the [Update Cart Payment Intent](/docs/carts-orders/update-cart-payment-intent) endpoint to update the Stripe Payment Intent with the final cart details when preparing to take the payment. Doing so, ensures that the Payment Intent accurately reflects the current cart details when processing payments on the front end. We do not recommend calling the [Update Cart Payment Intent](/docs/carts-orders/update-cart-payment-intent) for each individual change in the cart, as this can lead to more requests and may slow down the front-end performance.
1140
+ *
1141
+ */
1142
+ export var createCartPaymentIntent = function (options) {
1143
+ var _a;
1144
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
1145
+ {
1146
+ scheme: "bearer",
1147
+ type: "http",
1148
+ },
1149
+ ], url: "/v2/carts/{cartID}/payments" }));
1150
+ };
1151
+ /**
1152
+ * Checkout API
1153
+ * When a Cart is ready for checkout, you can convert the cart to an order. The cart remains and can be modified and checked out again if required.
1154
+ *
1155
+ * A cart can be checked out with a customer ID, customer object, or with an account by authenticating with the `Client Credentials Token`.
1156
+ *
1157
+ * After a successful checkout, a response that contains the order is returned. If the cart is linked to a shipping group, the shipping group is also associated with the order after checkout.
1158
+ *
1159
+ * You can checkout using one of the following methods:
1160
+ * - **Customer ID**: You can checkout a cart with an existing customer ID.
1161
+ * - **Guest Checkout** (Checkout with Customer Object): You can checkout a cart with an associated customer name and email.
1162
+ * - **Checkout with Account**: The shopper authenticates with the `Client Credentials` Token.
1163
+ * - **Checkout with Account Management Authentication Token**: The shopper authenticates with the `Implicit Token` and the `EP-Account-Management-Authentication-Token`.
1164
+ *
1165
+ * :::note
1166
+ *
1167
+ * - The cart currency is set when the first item is added to the cart.
1168
+ * - The product being added to the cart requires a price in the same currency as the other items in the cart. The API returns a 400 error if a price is not defined in the correct currency.
1169
+ * - To ensure that a free gift is automatically applied to an order, set the promotion to automatic. The checkout process will not be successful if free gift items are out of stock. See [Errors](#errors) section.
1170
+ *
1171
+ * :::
1172
+ *
1173
+ * :::caution
1174
+ *
1175
+ * - By default, carts are automatically deleted 7 days after the last update. You can change this setting by [updating cart settings](/docs/api/settings/put-v-2-settings-cart).
1176
+ * - Your inventory is modified during checkout and payment of an order. For more information about the changes in the inventory, see the [Inventory](/docs/api/pxm/inventory/inventories-introduction) section.
1177
+ *
1178
+ * :::
1179
+ *
1180
+ * You can pass `order_number` and `external_ref` in the checkout endpoint or when [updating an order](/docs/api/carts/update-an-order). The `order_number` is an optional, user-managed field that is used as an alternative to `order_id`. When processing transactions through Authorize.net, the `order_number` is sent instead of the `order_id`, and it will appear in the invoice number section. If no `order_number` is provided, the `order_id` is sent to Authorize.net on payment by default. There are no duplication restrictions on the `order_number` value.
1181
+ *
1182
+ * ### Next Steps
1183
+ *
1184
+ * After a cart has been converted to an Order using either of the previous methods, you most likely want to capture payment for order. See [Paying for an Order](/docs/api/carts/payments).
1185
+ *
1186
+ * ### Errors
1187
+ *
1188
+ * The following error response is returned during checkout when an eligible item is added to the cart, and the free gift is out of stock.
1189
+ *
1190
+ * ```json
1191
+ * {
1192
+ * "errors": [
1193
+ * {
1194
+ * "status": 400,
1195
+ * "title": "Insufficient stock",
1196
+ * "detail": "There is not enough stock to add gift2 to your cart",
1197
+ * "meta": {
1198
+ * "id": "f2b68648-9621-45a3-aed6-1b526b0f5beb",
1199
+ * "sku": "gift2"
1200
+ * }
1201
+ * }
1202
+ * ]
1203
+ * }
1204
+ * ```
1205
+ *
1206
+ */
1207
+ export var checkoutApi = function (options) {
1208
+ var _a;
1209
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
1210
+ {
1211
+ scheme: "bearer",
1212
+ type: "http",
1213
+ },
1214
+ ], url: "/v2/carts/{cartID}/checkout" }));
1215
+ };
1216
+ /**
1217
+ * Get all Orders
1218
+ * This endpoint returns all orders with custom flow fields. The pagination offset is set to fetch a maximum of 10,000 orders. If the store has 10,000 orders and you fetch the orders without using filters, an error is returned. Use a filter to view orders when the order is beyond the 10,000 mark.
1219
+ *
1220
+ * :::note
1221
+ *
1222
+ * - Pass the `X-Moltin-Customer-Token` header to limit orders to a specific customer. See [Customer Tokens](/docs/customer-management/customer-management-api/customer-tokens).
1223
+ * - Pass the `EP-Account-Management-Authentication-Token` header to limit orders to a specific account. See [Account Management Token](/docs/api/accounts/post-v-2-account-members-tokens).
1224
+ * - You can use pagination with this resource. For more information, see [pagination](/guides/Getting-Started/pagination).
1225
+ *
1226
+ * :::
1227
+ *
1228
+ * ### Filtering
1229
+ *
1230
+ * The following operators and attributes are available for filtering orders.
1231
+ *
1232
+ * | Attribute | Type | Operator | Example |
1233
+ * | :--- | :--- | :--- | :--- |
1234
+ * | `status` | `string` | `eq` | `eq(status,complete)` |
1235
+ * | `payment` | `string` | `eq` | `eq(payment,paid)` |
1236
+ * | `shipping` | `string` | `eq` | `eq(shipping,unfulfilled)` |
1237
+ * | `name` (`customer.name`) | `string` | `eq` / `like` | `like(name,Brad*)` |
1238
+ * | `email` (`customer.email`) | `string` | `eq` / `like` | `like(email,*@elasticpath.com)` |
1239
+ * | `customer_id` | `string` | `eq` / `like` | `eq(customer_id, e5a0d684-a4af-4919-a348-f66b0b4955e0)` |
1240
+ * | `account_id` | `string` | `eq` / `like` | `eq(account_id,3d7200c9-a9bc-4085-9822-63e80fd94a09)` |
1241
+ * | `account_member_id` | `string` | `eq` / `like` | `eq(account_member_id,2a8a3a92-2ccd-4b2b-a7af-52d3896eaecb)` |
1242
+ * | `contact.name` | `string` | `eq` / `like` | `eq(name,John Doe)` |
1243
+ * | `contact.email` | `string` | `eq` / `like` | `eq(email,John Doe)` |
1244
+ * | `shipping_postcode` | `string` | `eq` / `like` | `like(shipping_postcode,117*)` |
1245
+ * | `billing_postcode` | `string` | `eq` / `like` | `like(billing_postcode,117*)` |
1246
+ * | `with_tax` | `integer` | `gt`/`ge`/`lt`/`le` | `ge(with_tax,10000)` |
1247
+ * | `without_tax` | `integer` | `gt`/`ge`/`lt`/`le` | `ge(without_tax,10000)` |
1248
+ * | `currency` | `string` | `eq` | `eq(currency,USD)` |
1249
+ * | `product_id` | `string` | `eq` | `eq(product_id,6837058c-ae42-46db-b3c6-7f01e0c34b40)` |
1250
+ * | `product_sku` | `string` | `eq` | `eq(product_sku,deck-shoe-001)` |
1251
+ * | `created_at` | `date` | `eq` / `gt` / `ge`/ `le` / `lt` | `gt(created_at,YYYY-MM-DD)` |
1252
+ * | `updated_at` | `date` | `eq` / `gt` / `ge`/ `le`/ `lt` | `lt(updated_at,YYYY-MM-DD)` |
1253
+ * | `external_ref` | `string` | `eq` / `like` | `like(external_ref, 16be*)` |
1254
+ * | `order_number` | `string` | `eq` / `like` | `like(order_number, 123*)` |
1255
+ *
1256
+ */
1257
+ export var getCustomerOrders = function (options) {
1258
+ var _a;
1259
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
1260
+ {
1261
+ scheme: "bearer",
1262
+ type: "http",
1263
+ },
1264
+ ], url: "/v2/orders" }));
1265
+ };
1266
+ /**
1267
+ * Get an Order
1268
+ * Use this endpoint to retrieve a specific order.
1269
+ */
1270
+ export var getAnOrder = function (options) {
1271
+ var _a;
1272
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
1273
+ {
1274
+ scheme: "bearer",
1275
+ type: "http",
1276
+ },
1277
+ ], url: "/v2/orders/{orderID}" }));
1278
+ };
1279
+ /**
1280
+ * Update an Order
1281
+ * You can only update custom data, `shipping`, `shipping_address`, and status of orders. All other settings in the order object are immutable.
1282
+ *
1283
+ * This endpoint allows you to:
1284
+ *
1285
+ * - **Update an order number and external reference**: You can update an existing order that does not have an `order_number` and `external_ref`, modify the `order_number` and `external_ref` values, or remove them by passing an empty value in the `order_number` and `external_ref` fields.
1286
+ * - **Cancel an order**: You can cancel an order only if it has not been fulfilled.
1287
+ * - **Fulfill an order**: You can fulfill a paid order only.
1288
+ *
1289
+ * :::caution
1290
+ *
1291
+ * You can update `shipping`, `shipping_address`, and status of an order only if the order is not fulfilled. You can use the refund API to refund an order only if the payment status is `paid`. Canceling an order does not automatically refund a payment. You must refund the orders manually.
1292
+ *
1293
+ * :::
1294
+ *
1295
+ * :::note
1296
+ *
1297
+ * - This request is only accessible to client credentials token users with Seller Admin role.
1298
+ * - Non client credentials token users cannot access this endpoint. See [Permissions](/docs/authentication/Tokens/permissions).
1299
+ * - The `order_number` will appear as the invoice number in Authorize.net transactions.
1300
+ *
1301
+ * :::
1302
+ *
1303
+ */
1304
+ export var updateAnOrder = function (options) {
1305
+ var _a;
1306
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).put(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
1307
+ {
1308
+ scheme: "bearer",
1309
+ type: "http",
1310
+ },
1311
+ ], url: "/v2/orders/{orderID}" }));
1312
+ };
1313
+ /**
1314
+ * Get Order Items
1315
+ * Use this endpoint to retrieve order items.
1316
+ */
1317
+ export var getOrderItems = function (options) {
1318
+ var _a;
1319
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
1320
+ {
1321
+ scheme: "bearer",
1322
+ type: "http",
1323
+ },
1324
+ ], url: "/v2/orders/{orderID}/items" }));
1325
+ };
1326
+ /**
1327
+ * Anonymize Orders
1328
+ * You can anonymize an order when it is fulfilled, canceled, or fully refunded.
1329
+ *
1330
+ * When anonymization is successful, Personal Identifiable Information such as customer details, `shipping_address`, and `billing_address` are replaced with *.
1331
+ *
1332
+ */
1333
+ export var anonymizeOrders = function (options) {
1334
+ var _a;
1335
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
1336
+ {
1337
+ scheme: "bearer",
1338
+ type: "http",
1339
+ },
1340
+ ], url: "/v2/orders/anonymize" }));
1341
+ };
1342
+ /**
1343
+ * Payment Setup
1344
+ * Depending on the payment gateway, you may have access to different transaction types such as capturing funds immediately or authorizing them for later. For more information, see [Transactions](/docs/api/carts/transactions).
1345
+ *
1346
+ * The following types of payment methods are available depending on the payment gateway:
1347
+ *
1348
+ * - `purchase`: This is the simplest method. The gateway attempts to charge the customer immediately.
1349
+ * - `authorize`: This method authorizes a payment so that funds can be captured later, for example, when an item is dispatched or restocked.
1350
+ * - `purchase_setup`: This method prepares the system for a purchase by verifying payment details without actually charging the customer. For example, a customer adds items to their cart and proceeds to checkout. Before finalizing the purchase, the system runs `purchase_setup` to confirm all payment details, but no funds are transferred until the customer confirms the order.
1351
+ * - `authorize_setup`: This method prepares the system for an authorization-only transaction. This process holds the necessary funds but does not transfer them, ensuring that the customer has sufficient balance for the transaction. It sets up the conditions for a future capture of the authorized funds. For example, a customer places a pre-order for a product that will ship in two weeks. The merchant uses `authorize_setup` to prepare for the payment authorization. This holds the customer's funds to ensure they can cover the purchase but waits to capture the payment until the product ships. This ensures that payment is secured but not collected prematurely.
1352
+ *
1353
+ * :::note
1354
+ *
1355
+ * Split payments can be performed using any methods for any gateway.
1356
+ *
1357
+ * - You can partially pay funds using `purchase` method. The gateway attempts to charge the customer immediately, and the payment status for an order will show `partially_paid`
1358
+ * - You can partially pay for an order using `authorize` method where the order will be marked as `partially_authorized`. The transaction must be completed for the order status to be `partially_authorized`.
1359
+ * - A `purchase_setup` method allows verification of payment details for partial payments without transferring funds until the customer confirms the full order.
1360
+ * - An `authorize_setup` method can be used to hold a partial amount of the total funds, ensuring the customer has enough balance for a future capture.
1361
+ * Until a payment is made neither `purchase_setup` nor `authorize_setup` affects the payment statuses, and the order remains unpaid. For more information about order and payment statuses for split payments, see [Split payments](/docs/api/payments/payment-gateways-introduction#split-payments).
1362
+ *
1363
+ * :::
1364
+ *
1365
+ */
1366
+ export var paymentSetup = function (options) {
1367
+ var _a;
1368
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
1369
+ {
1370
+ scheme: "bearer",
1371
+ type: "http",
1372
+ },
1373
+ ], url: "/v2/orders/{orderID}/payments" }));
1374
+ };
1375
+ /**
1376
+ * Confirm Payment
1377
+ * Confirm Payment serves as a mechanism to synchronize transaction information from the third-party payment provider back to our system. This ensures that Composable Commerce accurately reflects the values from the payment provider.
1378
+ *
1379
+ * ### Handling 3D Secure Validations for Stripe Payments
1380
+ *
1381
+ * For Stripe Payments requiring 3D Secure validation, the transaction response will include the `client_parameters` object, which provides credentials to support validation of these payment requests on the payment provider's side. We recommend using the Stripe's client libraries to manage these 3D Secure validations. Once the validation succeeds, proceed with a confirmation request to sync the validated transaction into Composable Commerce and continue with the payment process.
1382
+ *
1383
+ */
1384
+ export var confirmPayment = function (options) {
1385
+ var _a;
1386
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
1387
+ {
1388
+ scheme: "bearer",
1389
+ type: "http",
1390
+ },
1391
+ ], url: "/v2/orders/{orderID}/transactions/{transactionID}/confirm" }));
1392
+ };
1393
+ /**
1394
+ * Capture a Transaction
1395
+ * Use this endpoint to capture a previously authorized payment. In this step, you can also pass in a custom reference, such as the payment reference from your chosen gateway.
1396
+ */
1397
+ export var captureATransaction = function (options) {
1398
+ var _a;
1399
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
1400
+ {
1401
+ scheme: "bearer",
1402
+ type: "http",
1403
+ },
1404
+ ], url: "/v2/orders/{orderID}/transactions/{transactionID}/capture" }));
1405
+ };
1406
+ /**
1407
+ * Refund a Transaction
1408
+ * There are two ways to refund; through your payment gateway and mark it refunded in Commerce Manager, or directly through Commerce Manager or API.
1409
+ *
1410
+ * * Mark as Refunded: You can manually mark a transaction as refunded. Before you can mark the order as refunded, you need to handle the actual refund on your side with your payment provider. Mark as Refunded is a full refund made to the transaction.
1411
+ * * Refund through Composable Commerce: You can process a full or partial refund to a supported payment provider directly from Commerce Manager or API by providing the refund amount. When you start the refund process, the request is directly sent to the payment gateway.
1412
+ *
1413
+ * :::caution
1414
+ *
1415
+ * If you use manual gateway for partial or full refund, you need to handle the actual refund on your side with your payment provider.
1416
+ *
1417
+ * :::
1418
+ *
1419
+ */
1420
+ export var refundATransaction = function (options) {
1421
+ var _a;
1422
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
1423
+ {
1424
+ scheme: "bearer",
1425
+ type: "http",
1426
+ },
1427
+ ], url: "/v2/orders/{orderID}/transactions/{transactionID}/refund" }));
1428
+ };
1429
+ /**
1430
+ * Get Order Transactions
1431
+ * Get order transactions
1432
+ */
1433
+ export var getOrderTransactions = function (options) {
1434
+ var _a;
1435
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
1436
+ {
1437
+ scheme: "bearer",
1438
+ type: "http",
1439
+ },
1440
+ ], url: "/v2/orders/{orderID}/transactions" }));
1441
+ };
1442
+ /**
1443
+ * Get a Transaction
1444
+ * Retrieves a transaction
1445
+ */
1446
+ export var getATransaction = function (options) {
1447
+ var _a;
1448
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).get(__assign(__assign({}, options), { security: [
1449
+ {
1450
+ scheme: "bearer",
1451
+ type: "http",
1452
+ },
1453
+ ], url: "/v2/orders/{orderID}/transactions/{transactionID}" }));
1454
+ };
1455
+ /**
1456
+ * Cancel a Transaction
1457
+ * Use this endpoint to cancel or void a pending or authorized transaction. The transaction can be canceled or voided when it is in `pending` and `completed` statuses.
1458
+ *
1459
+ * :::caution
1460
+ *
1461
+ * This endpoint works only for Stripe and PayPal and does not work for manual gateway.
1462
+ *
1463
+ * :::
1464
+ *
1465
+ */
1466
+ export var cancelATransaction = function (options) {
1467
+ var _a;
1468
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client).post(__assign(__assign({}, options), { headers: __assign({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers), security: [
1469
+ {
1470
+ scheme: "bearer",
1471
+ type: "http",
1472
+ },
1473
+ ], url: "/v2/orders/{orderID}/transactions/{transactionID}/cancel" }));
1474
+ };