@wix/auto_sdk_ecom_draft-orders 1.0.34 → 1.0.36

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.
Files changed (134) hide show
  1. package/build/{es/src/ecom-v1-draft-order-draft-orders.types.d.ts → ecom-v1-draft-order-draft-orders.universal-BiN0i3mF.d.mts} +572 -369
  2. package/build/{cjs/src/ecom-v1-draft-order-draft-orders.types.d.ts → ecom-v1-draft-order-draft-orders.universal-BiN0i3mF.d.ts} +572 -369
  3. package/build/index.d.mts +291 -0
  4. package/build/index.d.ts +291 -0
  5. package/build/index.js +5403 -0
  6. package/build/index.js.map +1 -0
  7. package/build/index.mjs +5326 -0
  8. package/build/index.mjs.map +1 -0
  9. package/build/internal/{cjs/src/ecom-v1-draft-order-draft-orders.types.d.ts → ecom-v1-draft-order-draft-orders.universal-DkIb6bMI.d.mts} +747 -369
  10. package/build/internal/{es/src/ecom-v1-draft-order-draft-orders.types.d.ts → ecom-v1-draft-order-draft-orders.universal-DkIb6bMI.d.ts} +747 -369
  11. package/build/internal/index.d.mts +291 -0
  12. package/build/internal/index.d.ts +291 -0
  13. package/build/internal/index.js +5403 -0
  14. package/build/internal/index.js.map +1 -0
  15. package/build/internal/index.mjs +5326 -0
  16. package/build/internal/index.mjs.map +1 -0
  17. package/build/internal/meta.d.mts +3140 -0
  18. package/build/internal/meta.d.ts +3140 -0
  19. package/build/internal/meta.js +3455 -0
  20. package/build/internal/meta.js.map +1 -0
  21. package/build/internal/meta.mjs +3406 -0
  22. package/build/internal/meta.mjs.map +1 -0
  23. package/build/meta.d.mts +3140 -0
  24. package/build/meta.d.ts +3140 -0
  25. package/build/meta.js +3455 -0
  26. package/build/meta.js.map +1 -0
  27. package/build/meta.mjs +3406 -0
  28. package/build/meta.mjs.map +1 -0
  29. package/package.json +12 -11
  30. package/build/cjs/index.d.ts +0 -1
  31. package/build/cjs/index.js +0 -18
  32. package/build/cjs/index.js.map +0 -1
  33. package/build/cjs/index.typings.d.ts +0 -1
  34. package/build/cjs/index.typings.js +0 -18
  35. package/build/cjs/index.typings.js.map +0 -1
  36. package/build/cjs/meta.d.ts +0 -1
  37. package/build/cjs/meta.js +0 -18
  38. package/build/cjs/meta.js.map +0 -1
  39. package/build/cjs/src/ecom-v1-draft-order-draft-orders.context.d.ts +0 -43
  40. package/build/cjs/src/ecom-v1-draft-order-draft-orders.context.js +0 -75
  41. package/build/cjs/src/ecom-v1-draft-order-draft-orders.context.js.map +0 -1
  42. package/build/cjs/src/ecom-v1-draft-order-draft-orders.http.d.ts +0 -131
  43. package/build/cjs/src/ecom-v1-draft-order-draft-orders.http.js +0 -3097
  44. package/build/cjs/src/ecom-v1-draft-order-draft-orders.http.js.map +0 -1
  45. package/build/cjs/src/ecom-v1-draft-order-draft-orders.meta.d.ts +0 -63
  46. package/build/cjs/src/ecom-v1-draft-order-draft-orders.meta.js +0 -465
  47. package/build/cjs/src/ecom-v1-draft-order-draft-orders.meta.js.map +0 -1
  48. package/build/cjs/src/ecom-v1-draft-order-draft-orders.public.d.ts +0 -255
  49. package/build/cjs/src/ecom-v1-draft-order-draft-orders.public.js +0 -385
  50. package/build/cjs/src/ecom-v1-draft-order-draft-orders.public.js.map +0 -1
  51. package/build/cjs/src/ecom-v1-draft-order-draft-orders.types.js +0 -378
  52. package/build/cjs/src/ecom-v1-draft-order-draft-orders.types.js.map +0 -1
  53. package/build/cjs/src/ecom-v1-draft-order-draft-orders.universal.d.ts +0 -4726
  54. package/build/cjs/src/ecom-v1-draft-order-draft-orders.universal.js +0 -2453
  55. package/build/cjs/src/ecom-v1-draft-order-draft-orders.universal.js.map +0 -1
  56. package/build/es/index.d.ts +0 -1
  57. package/build/es/index.js +0 -2
  58. package/build/es/index.js.map +0 -1
  59. package/build/es/index.typings.d.ts +0 -1
  60. package/build/es/index.typings.js +0 -2
  61. package/build/es/index.typings.js.map +0 -1
  62. package/build/es/meta.d.ts +0 -1
  63. package/build/es/meta.js +0 -2
  64. package/build/es/meta.js.map +0 -1
  65. package/build/es/package.json +0 -3
  66. package/build/es/src/ecom-v1-draft-order-draft-orders.context.d.ts +0 -43
  67. package/build/es/src/ecom-v1-draft-order-draft-orders.context.js +0 -43
  68. package/build/es/src/ecom-v1-draft-order-draft-orders.context.js.map +0 -1
  69. package/build/es/src/ecom-v1-draft-order-draft-orders.http.d.ts +0 -131
  70. package/build/es/src/ecom-v1-draft-order-draft-orders.http.js +0 -3071
  71. package/build/es/src/ecom-v1-draft-order-draft-orders.http.js.map +0 -1
  72. package/build/es/src/ecom-v1-draft-order-draft-orders.meta.d.ts +0 -63
  73. package/build/es/src/ecom-v1-draft-order-draft-orders.meta.js +0 -416
  74. package/build/es/src/ecom-v1-draft-order-draft-orders.meta.js.map +0 -1
  75. package/build/es/src/ecom-v1-draft-order-draft-orders.public.d.ts +0 -255
  76. package/build/es/src/ecom-v1-draft-order-draft-orders.public.js +0 -330
  77. package/build/es/src/ecom-v1-draft-order-draft-orders.public.js.map +0 -1
  78. package/build/es/src/ecom-v1-draft-order-draft-orders.types.js +0 -375
  79. package/build/es/src/ecom-v1-draft-order-draft-orders.types.js.map +0 -1
  80. package/build/es/src/ecom-v1-draft-order-draft-orders.universal.d.ts +0 -4726
  81. package/build/es/src/ecom-v1-draft-order-draft-orders.universal.js +0 -2403
  82. package/build/es/src/ecom-v1-draft-order-draft-orders.universal.js.map +0 -1
  83. package/build/internal/cjs/index.d.ts +0 -1
  84. package/build/internal/cjs/index.js +0 -18
  85. package/build/internal/cjs/index.js.map +0 -1
  86. package/build/internal/cjs/index.typings.d.ts +0 -1
  87. package/build/internal/cjs/index.typings.js +0 -18
  88. package/build/internal/cjs/index.typings.js.map +0 -1
  89. package/build/internal/cjs/meta.d.ts +0 -1
  90. package/build/internal/cjs/meta.js +0 -18
  91. package/build/internal/cjs/meta.js.map +0 -1
  92. package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.context.d.ts +0 -43
  93. package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.context.js +0 -75
  94. package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.context.js.map +0 -1
  95. package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.http.d.ts +0 -131
  96. package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.http.js +0 -3097
  97. package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.http.js.map +0 -1
  98. package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.meta.d.ts +0 -63
  99. package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.meta.js +0 -465
  100. package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.meta.js.map +0 -1
  101. package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.public.d.ts +0 -255
  102. package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.public.js +0 -385
  103. package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.public.js.map +0 -1
  104. package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.types.js +0 -378
  105. package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.types.js.map +0 -1
  106. package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.universal.d.ts +0 -4901
  107. package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.universal.js +0 -2453
  108. package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.universal.js.map +0 -1
  109. package/build/internal/es/index.d.ts +0 -1
  110. package/build/internal/es/index.js +0 -2
  111. package/build/internal/es/index.js.map +0 -1
  112. package/build/internal/es/index.typings.d.ts +0 -1
  113. package/build/internal/es/index.typings.js +0 -2
  114. package/build/internal/es/index.typings.js.map +0 -1
  115. package/build/internal/es/meta.d.ts +0 -1
  116. package/build/internal/es/meta.js +0 -2
  117. package/build/internal/es/meta.js.map +0 -1
  118. package/build/internal/es/src/ecom-v1-draft-order-draft-orders.context.d.ts +0 -43
  119. package/build/internal/es/src/ecom-v1-draft-order-draft-orders.context.js +0 -43
  120. package/build/internal/es/src/ecom-v1-draft-order-draft-orders.context.js.map +0 -1
  121. package/build/internal/es/src/ecom-v1-draft-order-draft-orders.http.d.ts +0 -131
  122. package/build/internal/es/src/ecom-v1-draft-order-draft-orders.http.js +0 -3071
  123. package/build/internal/es/src/ecom-v1-draft-order-draft-orders.http.js.map +0 -1
  124. package/build/internal/es/src/ecom-v1-draft-order-draft-orders.meta.d.ts +0 -63
  125. package/build/internal/es/src/ecom-v1-draft-order-draft-orders.meta.js +0 -416
  126. package/build/internal/es/src/ecom-v1-draft-order-draft-orders.meta.js.map +0 -1
  127. package/build/internal/es/src/ecom-v1-draft-order-draft-orders.public.d.ts +0 -255
  128. package/build/internal/es/src/ecom-v1-draft-order-draft-orders.public.js +0 -330
  129. package/build/internal/es/src/ecom-v1-draft-order-draft-orders.public.js.map +0 -1
  130. package/build/internal/es/src/ecom-v1-draft-order-draft-orders.types.js +0 -375
  131. package/build/internal/es/src/ecom-v1-draft-order-draft-orders.types.js.map +0 -1
  132. package/build/internal/es/src/ecom-v1-draft-order-draft-orders.universal.d.ts +0 -4901
  133. package/build/internal/es/src/ecom-v1-draft-order-draft-orders.universal.js +0 -2403
  134. package/build/internal/es/src/ecom-v1-draft-order-draft-orders.universal.js.map +0 -1
@@ -1,2403 +0,0 @@
1
- import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';
2
- import { queryBuilder } from '@wix/sdk-runtime/query-builder';
3
- import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys';
4
- import * as ambassadorWixEcomV1DraftOrder from './ecom-v1-draft-order-draft-orders.http.js';
5
- // @ts-ignore
6
- import { transformSDKAddressToRESTAddress } from '@wix/sdk-runtime/transformations/address';
7
- import { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';
8
- import { transformSDKImageToRESTImage } from '@wix/sdk-runtime/transformations/image';
9
- import { transformRESTImageToSDKImage } from '@wix/sdk-runtime/transformations/image';
10
- import { transformSDKPageURLV2ToRESTPageURLV2 } from '@wix/sdk-runtime/transformations/page-url-v2';
11
- import { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';
12
- export var DescriptionLineType;
13
- (function (DescriptionLineType) {
14
- /** Unrecognized type. */
15
- DescriptionLineType["UNRECOGNISED"] = "UNRECOGNISED";
16
- /** Plain text type. */
17
- DescriptionLineType["PLAIN_TEXT"] = "PLAIN_TEXT";
18
- /** Color type. */
19
- DescriptionLineType["COLOR"] = "COLOR";
20
- })(DescriptionLineType || (DescriptionLineType = {}));
21
- export var ItemTypeItemType;
22
- (function (ItemTypeItemType) {
23
- ItemTypeItemType["UNRECOGNISED"] = "UNRECOGNISED";
24
- ItemTypeItemType["PHYSICAL"] = "PHYSICAL";
25
- ItemTypeItemType["DIGITAL"] = "DIGITAL";
26
- ItemTypeItemType["GIFT_CARD"] = "GIFT_CARD";
27
- ItemTypeItemType["SERVICE"] = "SERVICE";
28
- })(ItemTypeItemType || (ItemTypeItemType = {}));
29
- /** Type of selected payment option for catalog item */
30
- export var PaymentOptionType;
31
- (function (PaymentOptionType) {
32
- /** The entire payment for this item happens as part of the checkout. */
33
- PaymentOptionType["FULL_PAYMENT_ONLINE"] = "FULL_PAYMENT_ONLINE";
34
- /** The entire payment for this item happens after checkout. For example, when using cash, check, or other offline payment methods. */
35
- PaymentOptionType["FULL_PAYMENT_OFFLINE"] = "FULL_PAYMENT_OFFLINE";
36
- /** Payment for this item is done by charging a membership. When selected, `price` is `0`. */
37
- PaymentOptionType["MEMBERSHIP"] = "MEMBERSHIP";
38
- /** Partial payment to be paid upfront during checkout. The initial amount to be paid for each line item is specified in `depositAmount`. */
39
- PaymentOptionType["DEPOSIT_ONLINE"] = "DEPOSIT_ONLINE";
40
- /** Payment for this item can only be done by charging a membership and must be manually redeemed in the dashboard by the site admin. When selected, `price` is `0`. */
41
- PaymentOptionType["MEMBERSHIP_OFFLINE"] = "MEMBERSHIP_OFFLINE";
42
- })(PaymentOptionType || (PaymentOptionType = {}));
43
- /** JurisdictionType represents the type of the jurisdiction in which this tax detail applies (e.g. Country,State,County,City,Special). */
44
- export var JurisdictionType;
45
- (function (JurisdictionType) {
46
- JurisdictionType["UNDEFINED"] = "UNDEFINED";
47
- JurisdictionType["COUNTRY"] = "COUNTRY";
48
- JurisdictionType["STATE"] = "STATE";
49
- JurisdictionType["COUNTY"] = "COUNTY";
50
- JurisdictionType["CITY"] = "CITY";
51
- JurisdictionType["SPECIAL"] = "SPECIAL";
52
- })(JurisdictionType || (JurisdictionType = {}));
53
- /** Frequency unit of recurring payment */
54
- export var SubscriptionFrequency;
55
- (function (SubscriptionFrequency) {
56
- SubscriptionFrequency["UNDEFINED"] = "UNDEFINED";
57
- SubscriptionFrequency["DAY"] = "DAY";
58
- SubscriptionFrequency["WEEK"] = "WEEK";
59
- SubscriptionFrequency["MONTH"] = "MONTH";
60
- SubscriptionFrequency["YEAR"] = "YEAR";
61
- })(SubscriptionFrequency || (SubscriptionFrequency = {}));
62
- export var AdjustmentType;
63
- (function (AdjustmentType) {
64
- AdjustmentType["UNKNOWN_ADJUSTMENT_TYPE"] = "UNKNOWN_ADJUSTMENT_TYPE";
65
- /** Adjustment increases the total amount due to changes like covering extra billing days. Typically results in an additional fee. */
66
- AdjustmentType["EXTRA_CHARGE"] = "EXTRA_CHARGE";
67
- /** Adjustment reduces the total amount due to changes like covering fewer billing days. Typically results in a credit or discount. */
68
- AdjustmentType["CREDIT"] = "CREDIT";
69
- })(AdjustmentType || (AdjustmentType = {}));
70
- export var TaxableAddressType;
71
- (function (TaxableAddressType) {
72
- TaxableAddressType["UNKNOWN_TAXABLE_ADDRESS"] = "UNKNOWN_TAXABLE_ADDRESS";
73
- TaxableAddressType["BUSINESS"] = "BUSINESS";
74
- TaxableAddressType["BILLING"] = "BILLING";
75
- TaxableAddressType["SHIPPING"] = "SHIPPING";
76
- })(TaxableAddressType || (TaxableAddressType = {}));
77
- /** tax info types */
78
- export var VatType;
79
- (function (VatType) {
80
- VatType["UNSPECIFIED"] = "UNSPECIFIED";
81
- /** CPF - for individual tax payers. */
82
- VatType["CPF"] = "CPF";
83
- /** CNPJ - for corporations */
84
- VatType["CNPJ"] = "CNPJ";
85
- })(VatType || (VatType = {}));
86
- export var PickupDetailsPickupMethod;
87
- (function (PickupDetailsPickupMethod) {
88
- PickupDetailsPickupMethod["UNKNOWN_METHOD"] = "UNKNOWN_METHOD";
89
- PickupDetailsPickupMethod["STORE_PICKUP"] = "STORE_PICKUP";
90
- PickupDetailsPickupMethod["PICKUP_POINT"] = "PICKUP_POINT";
91
- })(PickupDetailsPickupMethod || (PickupDetailsPickupMethod = {}));
92
- export var SourceType;
93
- (function (SourceType) {
94
- /** Part of the original order. */
95
- SourceType["ORIGINAL_ORDER"] = "ORIGINAL_ORDER";
96
- /** Added automatically, as the result of recalculation caused by changes in draft order. */
97
- SourceType["AUTOMATIC"] = "AUTOMATIC";
98
- /** Added manually to draft order. */
99
- SourceType["CUSTOM"] = "CUSTOM";
100
- })(SourceType || (SourceType = {}));
101
- export var AppliedDiscountDiscountType;
102
- (function (AppliedDiscountDiscountType) {
103
- AppliedDiscountDiscountType["GLOBAL"] = "GLOBAL";
104
- AppliedDiscountDiscountType["SPECIFIC_ITEMS"] = "SPECIFIC_ITEMS";
105
- AppliedDiscountDiscountType["SHIPPING"] = "SHIPPING";
106
- })(AppliedDiscountDiscountType || (AppliedDiscountDiscountType = {}));
107
- export var DiscountReason;
108
- (function (DiscountReason) {
109
- DiscountReason["UNSPECIFIED"] = "UNSPECIFIED";
110
- DiscountReason["EXCHANGED_ITEMS"] = "EXCHANGED_ITEMS";
111
- DiscountReason["BILLING_ADJUSTMENT"] = "BILLING_ADJUSTMENT";
112
- })(DiscountReason || (DiscountReason = {}));
113
- export var EditingStatus;
114
- (function (EditingStatus) {
115
- /** Draft order is being edited. */
116
- EditingStatus["DRAFT"] = "DRAFT";
117
- /**
118
- * Draft order has been committed - No further modifications allowed.
119
- *
120
- * Draft orders with status 'COMMITTED' cannot be deleted.
121
- */
122
- EditingStatus["COMMITTED"] = "COMMITTED";
123
- })(EditingStatus || (EditingStatus = {}));
124
- export var WeightUnit;
125
- (function (WeightUnit) {
126
- /** Weight unit can't be classified due to an error. */
127
- WeightUnit["UNSPECIFIED_WEIGHT_UNIT"] = "UNSPECIFIED_WEIGHT_UNIT";
128
- /** Kilograms. */
129
- WeightUnit["KG"] = "KG";
130
- /** Pounds. */
131
- WeightUnit["LB"] = "LB";
132
- })(WeightUnit || (WeightUnit = {}));
133
- export var PickupMethod;
134
- (function (PickupMethod) {
135
- PickupMethod["UNKNOWN_METHOD"] = "UNKNOWN_METHOD";
136
- /** Store pickup. */
137
- PickupMethod["STORE_PICKUP"] = "STORE_PICKUP";
138
- /** Pickup point. */
139
- PickupMethod["PICKUP_POINT"] = "PICKUP_POINT";
140
- })(PickupMethod || (PickupMethod = {}));
141
- export var RuleType;
142
- (function (RuleType) {
143
- RuleType["VALIDATION"] = "VALIDATION";
144
- RuleType["OTHER"] = "OTHER";
145
- RuleType["MAX"] = "MAX";
146
- RuleType["MIN"] = "MIN";
147
- RuleType["MAX_LENGTH"] = "MAX_LENGTH";
148
- RuleType["MIN_LENGTH"] = "MIN_LENGTH";
149
- RuleType["MAX_SIZE"] = "MAX_SIZE";
150
- RuleType["MIN_SIZE"] = "MIN_SIZE";
151
- RuleType["FORMAT"] = "FORMAT";
152
- RuleType["DECIMAL_LTE"] = "DECIMAL_LTE";
153
- RuleType["DECIMAL_GTE"] = "DECIMAL_GTE";
154
- RuleType["DECIMAL_LT"] = "DECIMAL_LT";
155
- RuleType["DECIMAL_GT"] = "DECIMAL_GT";
156
- RuleType["DECIMAL_MAX_SCALE"] = "DECIMAL_MAX_SCALE";
157
- RuleType["INVALID_ENUM_VALUE"] = "INVALID_ENUM_VALUE";
158
- RuleType["REQUIRED_FIELD"] = "REQUIRED_FIELD";
159
- RuleType["FIELD_NOT_ALLOWED"] = "FIELD_NOT_ALLOWED";
160
- RuleType["ONE_OF_ALIGNMENT"] = "ONE_OF_ALIGNMENT";
161
- RuleType["EXACT_LENGTH"] = "EXACT_LENGTH";
162
- RuleType["EXACT_SIZE"] = "EXACT_SIZE";
163
- RuleType["REQUIRED_ONE_OF_FIELD"] = "REQUIRED_ONE_OF_FIELD";
164
- })(RuleType || (RuleType = {}));
165
- export var FileType;
166
- (function (FileType) {
167
- FileType["UNSPECIFIED"] = "UNSPECIFIED";
168
- FileType["SECURE_PICTURE"] = "SECURE_PICTURE";
169
- FileType["SECURE_VIDEO"] = "SECURE_VIDEO";
170
- FileType["SECURE_DOCUMENT"] = "SECURE_DOCUMENT";
171
- FileType["SECURE_MUSIC"] = "SECURE_MUSIC";
172
- FileType["SECURE_ARCHIVE"] = "SECURE_ARCHIVE";
173
- })(FileType || (FileType = {}));
174
- export var DiscountType;
175
- (function (DiscountType) {
176
- DiscountType["UNKNOWN_TYPE"] = "UNKNOWN_TYPE";
177
- /** Discount applies to the entire order. */
178
- DiscountType["GLOBAL"] = "GLOBAL";
179
- /** Discount applies to a specific item. */
180
- DiscountType["SPECIFIC_ITEMS"] = "SPECIFIC_ITEMS";
181
- /** Discount applies to shipping fee. */
182
- DiscountType["SHIPPING"] = "SHIPPING";
183
- })(DiscountType || (DiscountType = {}));
184
- export var NonDraftableReason;
185
- (function (NonDraftableReason) {
186
- NonDraftableReason["UNSPECIFIED"] = "UNSPECIFIED";
187
- /** Modifications of refunded orders are not supported. */
188
- NonDraftableReason["PARTIALLY_OR_FULLY_REFUNDED"] = "PARTIALLY_OR_FULLY_REFUNDED";
189
- /**
190
- * Original order must be created via one of the following channel types:
191
- * + WEB
192
- * + POS
193
- * + BACKOFFICE_MERCHANT
194
- * + WIX_APP_STORE
195
- */
196
- NonDraftableReason["UNSUPPORTED_CHANNEL_TYPE"] = "UNSUPPORTED_CHANNEL_TYPE";
197
- /** Order status is not APPROVED. */
198
- NonDraftableReason["ORDER_STATUS_IS_NOT_SUPPORTED"] = "ORDER_STATUS_IS_NOT_SUPPORTED";
199
- /** Site and order currencies are different. */
200
- NonDraftableReason["ORDER_AND_SITE_CURRENCIES_ARE_INCONSISTENT"] = "ORDER_AND_SITE_CURRENCIES_ARE_INCONSISTENT";
201
- /** Site and order weight units are different. */
202
- NonDraftableReason["ORDER_AND_SITE_WEIGHT_UNITS_ARE_INCONSISTENT"] = "ORDER_AND_SITE_WEIGHT_UNITS_ARE_INCONSISTENT";
203
- /** Order not found. */
204
- NonDraftableReason["ORDER_NOT_FOUND"] = "ORDER_NOT_FOUND";
205
- /** Modifications of orders with subscription items are not supported. */
206
- NonDraftableReason["SUBSCRIPTION_LINE_ITEM_EXISTS"] = "SUBSCRIPTION_LINE_ITEM_EXISTS";
207
- })(NonDraftableReason || (NonDraftableReason = {}));
208
- export var PaymentStatus;
209
- (function (PaymentStatus) {
210
- PaymentStatus["UNSPECIFIED"] = "UNSPECIFIED";
211
- /**
212
- * `NOT_PAID` can apply to an order made online, but not yet paid. In such cases `order.status` will be `INITIALIZED`.
213
- * This status also applies when an offline order needs to be manually marked as paid. In such cases `order.status` will be `APPROVED`.
214
- */
215
- PaymentStatus["NOT_PAID"] = "NOT_PAID";
216
- /** All required payments associated with this order are paid. */
217
- PaymentStatus["PAID"] = "PAID";
218
- /** Order partially refunded, but the refunded amount is less than the order's total price. See `order.balanceSummary` for more details. */
219
- PaymentStatus["PARTIALLY_REFUNDED"] = "PARTIALLY_REFUNDED";
220
- /** Order fully refunded. Refund amount equals total price. See `order.balanceSummary` for more details. */
221
- PaymentStatus["FULLY_REFUNDED"] = "FULLY_REFUNDED";
222
- /**
223
- * All payments pending.
224
- *
225
- * This can happen with two-step payments, when a payment requires manual review, or when a payment is in progress and will be concluded shortly.
226
- * Learn more about [pending orders](https://support.wix.com/en/article/pending-orders).
227
- */
228
- PaymentStatus["PENDING"] = "PENDING";
229
- /** At least one payment received and approved, but it covers less than the order's total price. See `order.balanceSummary` for more details. */
230
- PaymentStatus["PARTIALLY_PAID"] = "PARTIALLY_PAID";
231
- /**
232
- * Payment received, but not yet confirmed by the payment provider.
233
- *
234
- * In most cases, when a payment provider is holding payment it's because setup hasn't been successfully completed by the merchant/site owner.
235
- * To solve this, the merchant/site owner should log in to the payment provider's dashboard and make sure their account is set up correctly, or contact their support for further assistance.
236
- * @documentationMaturity preview
237
- */
238
- PaymentStatus["PENDING_MERCHANT"] = "PENDING_MERCHANT";
239
- /**
240
- * One or more payments canceled.
241
- * @documentationMaturity preview
242
- */
243
- PaymentStatus["CANCELED"] = "CANCELED";
244
- /**
245
- * One or more payments declined.
246
- * @documentationMaturity preview
247
- */
248
- PaymentStatus["DECLINED"] = "DECLINED";
249
- })(PaymentStatus || (PaymentStatus = {}));
250
- export var FulfillmentStatus;
251
- (function (FulfillmentStatus) {
252
- /** None of the order items are fulfilled or the order was manually marked as unfulfilled. */
253
- FulfillmentStatus["NOT_FULFILLED"] = "NOT_FULFILLED";
254
- /**
255
- * All of the order items are fulfilled or the order was manually marked as fulfilled.
256
- * Orders without shipping info are fulfilled automatically.
257
- */
258
- FulfillmentStatus["FULFILLED"] = "FULFILLED";
259
- /** Some, but not all, of the order items are fulfilled. */
260
- FulfillmentStatus["PARTIALLY_FULFILLED"] = "PARTIALLY_FULFILLED";
261
- })(FulfillmentStatus || (FulfillmentStatus = {}));
262
- export var OrderStatus;
263
- (function (OrderStatus) {
264
- /** Order created, but not yet approved or canceled. */
265
- OrderStatus["INITIALIZED"] = "INITIALIZED";
266
- /**
267
- * Order approved.
268
- *
269
- * This happens when either an online payment is received **or** when `order.priceSummary.total = 0` (a zero-total order).
270
- * Offline orders (cash payment) are automatically approved.
271
- */
272
- OrderStatus["APPROVED"] = "APPROVED";
273
- /** Order canceled by the user. */
274
- OrderStatus["CANCELED"] = "CANCELED";
275
- /**
276
- * Order pending.
277
- * @documentationMaturity preview
278
- */
279
- OrderStatus["PENDING"] = "PENDING";
280
- /**
281
- * Order rejected.
282
- *
283
- * This happens when pending payments fail.
284
- * @documentationMaturity preview
285
- */
286
- OrderStatus["REJECTED"] = "REJECTED";
287
- })(OrderStatus || (OrderStatus = {}));
288
- export var LineItemQuantityChangeType;
289
- (function (LineItemQuantityChangeType) {
290
- /** Quantity increased. */
291
- LineItemQuantityChangeType["QUANTITY_INCREASED"] = "QUANTITY_INCREASED";
292
- /** Quantity decreased. */
293
- LineItemQuantityChangeType["QUANTITY_DECREASED"] = "QUANTITY_DECREASED";
294
- })(LineItemQuantityChangeType || (LineItemQuantityChangeType = {}));
295
- export var ActivityType;
296
- (function (ActivityType) {
297
- ActivityType["ORDER_REFUNDED"] = "ORDER_REFUNDED";
298
- ActivityType["ORDER_PLACED"] = "ORDER_PLACED";
299
- ActivityType["ORDER_PAID"] = "ORDER_PAID";
300
- ActivityType["ORDER_FULFILLED"] = "ORDER_FULFILLED";
301
- ActivityType["ORDER_NOT_FULFILLED"] = "ORDER_NOT_FULFILLED";
302
- ActivityType["ORDER_CANCELED"] = "ORDER_CANCELED";
303
- ActivityType["DOWNLOAD_LINK_SENT"] = "DOWNLOAD_LINK_SENT";
304
- ActivityType["TRACKING_NUMBER_ADDED"] = "TRACKING_NUMBER_ADDED";
305
- ActivityType["TRACKING_NUMBER_EDITED"] = "TRACKING_NUMBER_EDITED";
306
- ActivityType["TRACKING_LINK_ADDED"] = "TRACKING_LINK_ADDED";
307
- ActivityType["SHIPPING_CONFIRMATION_EMAIL_SENT"] = "SHIPPING_CONFIRMATION_EMAIL_SENT";
308
- ActivityType["INVOICE_ADDED"] = "INVOICE_ADDED";
309
- ActivityType["INVOICE_REMOVED"] = "INVOICE_REMOVED";
310
- ActivityType["INVOICE_SENT"] = "INVOICE_SENT";
311
- ActivityType["FULFILLER_EMAIL_SENT"] = "FULFILLER_EMAIL_SENT";
312
- ActivityType["SHIPPING_ADDRESS_EDITED"] = "SHIPPING_ADDRESS_EDITED";
313
- ActivityType["EMAIL_EDITED"] = "EMAIL_EDITED";
314
- ActivityType["PICKUP_READY_EMAIL_SENT"] = "PICKUP_READY_EMAIL_SENT";
315
- ActivityType["CUSTOM_ACTIVITY"] = "CUSTOM_ACTIVITY";
316
- ActivityType["MERCHANT_COMMENT"] = "MERCHANT_COMMENT";
317
- ActivityType["ORDER_CREATED_FROM_EXCHANGE"] = "ORDER_CREATED_FROM_EXCHANGE";
318
- ActivityType["NEW_EXCHANGE_ORDER_CREATED"] = "NEW_EXCHANGE_ORDER_CREATED";
319
- ActivityType["ORDER_PARTIALLY_PAID"] = "ORDER_PARTIALLY_PAID";
320
- ActivityType["DRAFT_ORDER_CHANGES_APPLIED"] = "DRAFT_ORDER_CHANGES_APPLIED";
321
- ActivityType["SAVED_PAYMENT_METHOD"] = "SAVED_PAYMENT_METHOD";
322
- /** @documentationMaturity preview */
323
- ActivityType["PAYMENT_PENDING"] = "PAYMENT_PENDING";
324
- /** @documentationMaturity preview */
325
- ActivityType["PAYMENT_CANCELED"] = "PAYMENT_CANCELED";
326
- /** @documentationMaturity preview */
327
- ActivityType["PAYMENT_DECLINED"] = "PAYMENT_DECLINED";
328
- /** @documentationMaturity preview */
329
- ActivityType["ORDER_PENDING"] = "ORDER_PENDING";
330
- /** @documentationMaturity preview */
331
- ActivityType["ORDER_REJECTED"] = "ORDER_REJECTED";
332
- })(ActivityType || (ActivityType = {}));
333
- export var AttributionSource;
334
- (function (AttributionSource) {
335
- AttributionSource["UNSPECIFIED"] = "UNSPECIFIED";
336
- AttributionSource["FACEBOOK_ADS"] = "FACEBOOK_ADS";
337
- })(AttributionSource || (AttributionSource = {}));
338
- export var ChannelType;
339
- (function (ChannelType) {
340
- /** Unspecified sales channel. This value is not supported. */
341
- ChannelType["UNSPECIFIED"] = "UNSPECIFIED";
342
- /** A web client. */
343
- ChannelType["WEB"] = "WEB";
344
- /** [Point of sale solutions](https://support.wix.com/en/wix-mobile-pos-2196395). */
345
- ChannelType["POS"] = "POS";
346
- /** [eBay shop](https://support.wix.com/en/article/wix-stores-connecting-and-setting-up-an-ebay-shop). */
347
- ChannelType["EBAY"] = "EBAY";
348
- /** [Amazon shop](https://support.wix.com/en/article/wix-stores-connecting-and-setting-up-an-amazon-shop). */
349
- ChannelType["AMAZON"] = "AMAZON";
350
- /** Other sales platform. */
351
- ChannelType["OTHER_PLATFORM"] = "OTHER_PLATFORM";
352
- /** [Wix Owner app](https://support.wix.com/article/wix-owner-app-an-overview). */
353
- ChannelType["WIX_APP_STORE"] = "WIX_APP_STORE";
354
- /** Wix Invoices app in [your dashboard](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Finvoices/settings/general-settings) */
355
- ChannelType["WIX_INVOICES"] = "WIX_INVOICES";
356
- /** Wix merchant backoffice. */
357
- ChannelType["BACKOFFICE_MERCHANT"] = "BACKOFFICE_MERCHANT";
358
- /** Wish sales channel. */
359
- ChannelType["WISH"] = "WISH";
360
- /** [ClassPass sales channel](https://support.wix.com/en/article/wix-bookings-letting-clients-book-your-services-with-classpass). */
361
- ChannelType["CLASS_PASS"] = "CLASS_PASS";
362
- /** Global-E sales channel. */
363
- ChannelType["GLOBAL_E"] = "GLOBAL_E";
364
- /** [Facebook shop](https://support.wix.com/en/article/wix-stores-changes-to-facebook-shops). */
365
- ChannelType["FACEBOOK"] = "FACEBOOK";
366
- /** [Etsy sales channel](https://support.wix.com/en/article/wix-stores-request-adding-etsy-as-a-sales-channel). */
367
- ChannelType["ETSY"] = "ETSY";
368
- /** [TikTok sales channel](https://support.wix.com/en/article/wix-stores-request-adding-tiktok-as-a-sales-channel). */
369
- ChannelType["TIKTOK"] = "TIKTOK";
370
- /** [Faire marketplace integration](https://support.wix.com/en/article/wix-stores-creating-a-faire-store-using-the-faire-integration-app). */
371
- ChannelType["FAIRE_COM"] = "FAIRE_COM";
372
- })(ChannelType || (ChannelType = {}));
373
- export var SortOrder;
374
- (function (SortOrder) {
375
- SortOrder["ASC"] = "ASC";
376
- SortOrder["DESC"] = "DESC";
377
- })(SortOrder || (SortOrder = {}));
378
- export var WebhookIdentityType;
379
- (function (WebhookIdentityType) {
380
- WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
381
- WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
382
- WebhookIdentityType["MEMBER"] = "MEMBER";
383
- WebhookIdentityType["WIX_USER"] = "WIX_USER";
384
- WebhookIdentityType["APP"] = "APP";
385
- })(WebhookIdentityType || (WebhookIdentityType = {}));
386
- /**
387
- * Creates or retrieves a draft order based on the specified order ID.
388
- *
389
- * When passing the ID of an order that is already in draft, the existing draft order is returned.
390
- * To complete a draft and update the original order, call Commit Draft Order.
391
- * @param orderId - ID of the order to create a draft for.
392
- * @public
393
- * @documentationMaturity preview
394
- * @requiredField orderId
395
- * @permissionId ECOM.DRAFT_ORDERS_CREATE
396
- * @permissionId ECOM.DRAFT_ORDER_READ_ALL_EXTENDED_FIELDS
397
- * @permissionId DRAFT_ORDER_WRITE_ALL_EXTENDED_FIELDS
398
- * @permissionScope Manage Stores - all permissions
399
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
400
- * @permissionScope Manage Stores
401
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
402
- * @permissionScope Manage Restaurants - all permissions
403
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
404
- * @permissionScope Manage eCommerce - all permissions
405
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
406
- * @applicableIdentity APP
407
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateDraftOrder
408
- */
409
- export async function createDraftOrder(orderId) {
410
- // @ts-ignore
411
- const { httpClient, sideEffects } = arguments[1];
412
- const payload = renameKeysFromSDKRequestToRESTRequest({ orderId: orderId });
413
- const reqOpts = ambassadorWixEcomV1DraftOrder.createDraftOrder(payload);
414
- sideEffects?.onSiteCall?.();
415
- try {
416
- const result = await httpClient.request(reqOpts);
417
- sideEffects?.onSuccess?.(result);
418
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
419
- {
420
- transformFn: transformRESTImageToSDKImage,
421
- paths: [
422
- {
423
- path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
424
- },
425
- ],
426
- },
427
- {
428
- transformFn: transformRESTAddressToSDKAddress,
429
- paths: [
430
- {
431
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
432
- },
433
- {
434
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
435
- },
436
- {
437
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
438
- },
439
- {
440
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
441
- },
442
- { path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
443
- {
444
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
445
- },
446
- {
447
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
448
- },
449
- {
450
- path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
451
- },
452
- {
453
- path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
454
- },
455
- {
456
- path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
457
- },
458
- ],
459
- },
460
- ]));
461
- }
462
- catch (err) {
463
- const transformedError = sdkTransformError(err, {
464
- spreadPathsToArguments: {},
465
- explicitPathsToArguments: { orderId: '$[0]' },
466
- singleArgumentUnchanged: false,
467
- }, ['orderId']);
468
- sideEffects?.onError?.(err);
469
- throw transformedError;
470
- }
471
- }
472
- /**
473
- * Creates an empty draft order.
474
- *
475
- * After all relevant details are applied, call Create Order From Draft to convert the draft order to a regular order.
476
- * @public
477
- * @documentationMaturity preview
478
- * @permissionId ECOM.DRAFT_ORDERS_CREATE
479
- * @permissionId ECOM.DRAFT_ORDER_READ_ALL_EXTENDED_FIELDS
480
- * @permissionId DRAFT_ORDER_WRITE_ALL_EXTENDED_FIELDS
481
- * @permissionScope Manage Stores - all permissions
482
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
483
- * @permissionScope Manage Stores
484
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
485
- * @permissionScope Manage Restaurants - all permissions
486
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
487
- * @permissionScope Manage eCommerce - all permissions
488
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
489
- * @applicableIdentity APP
490
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateEmptyDraftOrder
491
- */
492
- export async function createEmptyDraftOrder() {
493
- // @ts-ignore
494
- const { httpClient, sideEffects } = arguments[0];
495
- const payload = renameKeysFromSDKRequestToRESTRequest({});
496
- const reqOpts = ambassadorWixEcomV1DraftOrder.createEmptyDraftOrder(payload);
497
- sideEffects?.onSiteCall?.();
498
- try {
499
- const result = await httpClient.request(reqOpts);
500
- sideEffects?.onSuccess?.(result);
501
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
502
- {
503
- transformFn: transformRESTImageToSDKImage,
504
- paths: [
505
- {
506
- path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
507
- },
508
- ],
509
- },
510
- {
511
- transformFn: transformRESTAddressToSDKAddress,
512
- paths: [
513
- {
514
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
515
- },
516
- {
517
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
518
- },
519
- {
520
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
521
- },
522
- {
523
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
524
- },
525
- { path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
526
- {
527
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
528
- },
529
- {
530
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
531
- },
532
- {
533
- path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
534
- },
535
- {
536
- path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
537
- },
538
- {
539
- path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
540
- },
541
- ],
542
- },
543
- ]));
544
- }
545
- catch (err) {
546
- const transformedError = sdkTransformError(err, {
547
- spreadPathsToArguments: {},
548
- explicitPathsToArguments: {},
549
- singleArgumentUnchanged: false,
550
- }, []);
551
- sideEffects?.onError?.(err);
552
- throw transformedError;
553
- }
554
- }
555
- /**
556
- * Adds catalog or custom line items to a draft order.
557
- * @param draftOrderId - Draft order ID.
558
- * @public
559
- * @documentationMaturity preview
560
- * @requiredField draftOrderId
561
- * @requiredField options.catalogLineItems.catalogReference
562
- * @permissionId ECOM.DRAFT_ORDERS_ADD_LINE_ITEMS
563
- * @permissionScope Manage Stores - all permissions
564
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
565
- * @permissionScope Manage Stores
566
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
567
- * @permissionScope Manage Restaurants - all permissions
568
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
569
- * @permissionScope Manage eCommerce - all permissions
570
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
571
- * @applicableIdentity APP
572
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.AddLineItemsToDraftOrder
573
- */
574
- export async function addLineItemsToDraftOrder(draftOrderId, options) {
575
- // @ts-ignore
576
- const { httpClient, sideEffects } = arguments[2];
577
- const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
578
- draftOrderId: draftOrderId,
579
- catalogLineItems: options?.catalogLineItems,
580
- customLineItems: options?.customLineItems,
581
- }), [
582
- {
583
- transformFn: transformSDKPageURLV2ToRESTPageURLV2,
584
- paths: [{ path: 'customLineItems.url' }],
585
- },
586
- {
587
- transformFn: transformSDKImageToRESTImage,
588
- paths: [{ path: 'customLineItems.media' }],
589
- },
590
- ]);
591
- const reqOpts = ambassadorWixEcomV1DraftOrder.addLineItemsToDraftOrder(payload);
592
- sideEffects?.onSiteCall?.();
593
- try {
594
- const result = await httpClient.request(reqOpts);
595
- sideEffects?.onSuccess?.(result);
596
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
597
- {
598
- transformFn: transformRESTImageToSDKImage,
599
- paths: [
600
- {
601
- path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
602
- },
603
- ],
604
- },
605
- {
606
- transformFn: transformRESTAddressToSDKAddress,
607
- paths: [
608
- {
609
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
610
- },
611
- {
612
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
613
- },
614
- {
615
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
616
- },
617
- {
618
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
619
- },
620
- { path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
621
- {
622
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
623
- },
624
- {
625
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
626
- },
627
- {
628
- path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
629
- },
630
- {
631
- path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
632
- },
633
- {
634
- path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
635
- },
636
- ],
637
- },
638
- ]));
639
- }
640
- catch (err) {
641
- const transformedError = sdkTransformError(err, {
642
- spreadPathsToArguments: {},
643
- explicitPathsToArguments: {
644
- draftOrderId: '$[0]',
645
- catalogLineItems: '$[1].catalogLineItems',
646
- customLineItems: '$[1].customLineItems',
647
- },
648
- singleArgumentUnchanged: false,
649
- }, ['draftOrderId', 'options']);
650
- sideEffects?.onError?.(err);
651
- throw transformedError;
652
- }
653
- }
654
- /**
655
- * Updates a draft order's line items.
656
- *
657
- * You can update a line item's quantity, price, and description.
658
- * > **Notes:**
659
- * > + Specifying a quantity of `0` will remove the line item.
660
- * > + Price cannot be updated for line items with `paymentOption: MEMBERSHIP`.
661
- * > + Quantity cannot be decreased for fulfilled line items. To retrieve fulfillment information, specify the order ID when calling List Fulfillments For Single Order ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/order-fulfillments/list-fulfillments-for-single-order) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/order-fulfillments/list-fulfillments-for-single-order)).
662
- * @param draftOrderId - Draft order ID.
663
- * @param lineItemChanges - Details of changes to apply per line item.
664
- * @public
665
- * @documentationMaturity preview
666
- * @requiredField draftOrderId
667
- * @requiredField lineItemChanges
668
- * @requiredField lineItemChanges.lineItemId
669
- * @permissionId ECOM.DRAFT_ORDERS_MODIFY_ITEMS
670
- * @permissionScope Manage Stores - all permissions
671
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
672
- * @permissionScope Manage Stores
673
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
674
- * @permissionScope Manage Restaurants - all permissions
675
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
676
- * @permissionScope Manage eCommerce - all permissions
677
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
678
- * @applicableIdentity APP
679
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.UpdateLineItems
680
- */
681
- export async function updateLineItems(draftOrderId, lineItemChanges) {
682
- // @ts-ignore
683
- const { httpClient, sideEffects } = arguments[2];
684
- const payload = renameKeysFromSDKRequestToRESTRequest({
685
- draftOrderId: draftOrderId,
686
- lineItemChanges: lineItemChanges,
687
- });
688
- const reqOpts = ambassadorWixEcomV1DraftOrder.updateLineItems(payload);
689
- sideEffects?.onSiteCall?.();
690
- try {
691
- const result = await httpClient.request(reqOpts);
692
- sideEffects?.onSuccess?.(result);
693
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
694
- {
695
- transformFn: transformRESTImageToSDKImage,
696
- paths: [
697
- {
698
- path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
699
- },
700
- ],
701
- },
702
- {
703
- transformFn: transformRESTAddressToSDKAddress,
704
- paths: [
705
- {
706
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
707
- },
708
- {
709
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
710
- },
711
- {
712
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
713
- },
714
- {
715
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
716
- },
717
- { path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
718
- {
719
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
720
- },
721
- {
722
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
723
- },
724
- {
725
- path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
726
- },
727
- {
728
- path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
729
- },
730
- {
731
- path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
732
- },
733
- ],
734
- },
735
- ]));
736
- }
737
- catch (err) {
738
- const transformedError = sdkTransformError(err, {
739
- spreadPathsToArguments: {},
740
- explicitPathsToArguments: {
741
- draftOrderId: '$[0]',
742
- lineItemChanges: '$[1]',
743
- },
744
- singleArgumentUnchanged: false,
745
- }, ['draftOrderId', 'lineItemChanges']);
746
- sideEffects?.onError?.(err);
747
- throw transformedError;
748
- }
749
- }
750
- /**
751
- * Applies or unapplies discounts on a draft order.
752
- *
753
- * Unapplied discounts are still part of the draft order, but do not affect balance.
754
- * Existing discounts that are not passed in the request will keep their current state.
755
- * @param draftOrderId - Draft order ID.
756
- * @param discounts - Discounts to set on the draft order.
757
- *
758
- * Any existing discounts that are not passed will not change.
759
- * @public
760
- * @documentationMaturity preview
761
- * @requiredField discounts
762
- * @requiredField discounts._id
763
- * @requiredField discounts.applied
764
- * @requiredField draftOrderId
765
- * @permissionId ECOM.DRAFT_ORDERS_SET_DISCOUNTS
766
- * @permissionScope Manage Stores - all permissions
767
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
768
- * @permissionScope Manage Stores
769
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
770
- * @permissionScope Manage Restaurants - all permissions
771
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
772
- * @permissionScope Manage eCommerce - all permissions
773
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
774
- * @applicableIdentity APP
775
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetDiscounts
776
- */
777
- export async function setDiscounts(draftOrderId, discounts) {
778
- // @ts-ignore
779
- const { httpClient, sideEffects } = arguments[2];
780
- const payload = renameKeysFromSDKRequestToRESTRequest({
781
- draftOrderId: draftOrderId,
782
- discounts: discounts,
783
- });
784
- const reqOpts = ambassadorWixEcomV1DraftOrder.setDiscounts(payload);
785
- sideEffects?.onSiteCall?.();
786
- try {
787
- const result = await httpClient.request(reqOpts);
788
- sideEffects?.onSuccess?.(result);
789
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
790
- {
791
- transformFn: transformRESTImageToSDKImage,
792
- paths: [
793
- {
794
- path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
795
- },
796
- ],
797
- },
798
- {
799
- transformFn: transformRESTAddressToSDKAddress,
800
- paths: [
801
- {
802
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
803
- },
804
- {
805
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
806
- },
807
- {
808
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
809
- },
810
- {
811
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
812
- },
813
- { path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
814
- {
815
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
816
- },
817
- {
818
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
819
- },
820
- {
821
- path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
822
- },
823
- {
824
- path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
825
- },
826
- {
827
- path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
828
- },
829
- ],
830
- },
831
- ]));
832
- }
833
- catch (err) {
834
- const transformedError = sdkTransformError(err, {
835
- spreadPathsToArguments: {},
836
- explicitPathsToArguments: { draftOrderId: '$[0]', discounts: '$[1]' },
837
- singleArgumentUnchanged: false,
838
- }, ['draftOrderId', 'discounts']);
839
- sideEffects?.onError?.(err);
840
- throw transformedError;
841
- }
842
- }
843
- /**
844
- * Creates custom discounts.
845
- *
846
- * Newly created discounts are unapplied by default.
847
- * To apply them, use Set Discounts.
848
- * @param draftOrderId - Draft order ID.
849
- * @public
850
- * @documentationMaturity preview
851
- * @requiredField draftOrderId
852
- * @requiredField options.discounts.amount.amount
853
- * @requiredField options.discounts.discountType
854
- * @requiredField options.discounts.priceAmount.amount
855
- * @permissionId ECOM.DRAFT_ORDERS_ADD_DISCOUNTS
856
- * @permissionScope Manage Stores - all permissions
857
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
858
- * @permissionScope Manage Stores
859
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
860
- * @permissionScope Manage Restaurants - all permissions
861
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
862
- * @permissionScope Manage eCommerce - all permissions
863
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
864
- * @applicableIdentity APP
865
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateCustomDiscounts
866
- */
867
- export async function createCustomDiscounts(draftOrderId, options) {
868
- // @ts-ignore
869
- const { httpClient, sideEffects } = arguments[2];
870
- const payload = renameKeysFromSDKRequestToRESTRequest({
871
- draftOrderId: draftOrderId,
872
- discounts: options?.discounts,
873
- });
874
- const reqOpts = ambassadorWixEcomV1DraftOrder.createCustomDiscounts(payload);
875
- sideEffects?.onSiteCall?.();
876
- try {
877
- const result = await httpClient.request(reqOpts);
878
- sideEffects?.onSuccess?.(result);
879
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
880
- {
881
- transformFn: transformRESTImageToSDKImage,
882
- paths: [
883
- {
884
- path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
885
- },
886
- ],
887
- },
888
- {
889
- transformFn: transformRESTAddressToSDKAddress,
890
- paths: [
891
- {
892
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
893
- },
894
- {
895
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
896
- },
897
- {
898
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
899
- },
900
- {
901
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
902
- },
903
- { path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
904
- {
905
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
906
- },
907
- {
908
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
909
- },
910
- {
911
- path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
912
- },
913
- {
914
- path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
915
- },
916
- {
917
- path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
918
- },
919
- ],
920
- },
921
- ]));
922
- }
923
- catch (err) {
924
- const transformedError = sdkTransformError(err, {
925
- spreadPathsToArguments: {},
926
- explicitPathsToArguments: {
927
- draftOrderId: '$[0]',
928
- discounts: '$[1].discounts',
929
- },
930
- singleArgumentUnchanged: false,
931
- }, ['draftOrderId', 'options']);
932
- sideEffects?.onError?.(err);
933
- throw transformedError;
934
- }
935
- }
936
- /**
937
- * Removes custom discounts from a draft order.
938
- * @param draftOrderId - Draft order ID.
939
- * @param discountIds - IDs of the discounts to remove from the draft order.
940
- * @public
941
- * @documentationMaturity preview
942
- * @requiredField discountIds
943
- * @requiredField draftOrderId
944
- * @permissionId ECOM.DRAFT_ORDERS_DELETE_DISCOUNTS
945
- * @permissionScope Manage Stores - all permissions
946
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
947
- * @permissionScope Manage Stores
948
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
949
- * @permissionScope Manage Restaurants - all permissions
950
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
951
- * @permissionScope Manage eCommerce - all permissions
952
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
953
- * @applicableIdentity APP
954
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.DeleteCustomDiscounts
955
- */
956
- export async function deleteCustomDiscounts(draftOrderId, discountIds) {
957
- // @ts-ignore
958
- const { httpClient, sideEffects } = arguments[2];
959
- const payload = renameKeysFromSDKRequestToRESTRequest({
960
- draftOrderId: draftOrderId,
961
- discountIds: discountIds,
962
- });
963
- const reqOpts = ambassadorWixEcomV1DraftOrder.deleteCustomDiscounts(payload);
964
- sideEffects?.onSiteCall?.();
965
- try {
966
- const result = await httpClient.request(reqOpts);
967
- sideEffects?.onSuccess?.(result);
968
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
969
- {
970
- transformFn: transformRESTImageToSDKImage,
971
- paths: [
972
- {
973
- path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
974
- },
975
- ],
976
- },
977
- {
978
- transformFn: transformRESTAddressToSDKAddress,
979
- paths: [
980
- {
981
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
982
- },
983
- {
984
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
985
- },
986
- {
987
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
988
- },
989
- {
990
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
991
- },
992
- { path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
993
- {
994
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
995
- },
996
- {
997
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
998
- },
999
- {
1000
- path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
1001
- },
1002
- {
1003
- path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
1004
- },
1005
- {
1006
- path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
1007
- },
1008
- ],
1009
- },
1010
- ]));
1011
- }
1012
- catch (err) {
1013
- const transformedError = sdkTransformError(err, {
1014
- spreadPathsToArguments: {},
1015
- explicitPathsToArguments: { draftOrderId: '$[0]', discountIds: '$[1]' },
1016
- singleArgumentUnchanged: false,
1017
- }, ['draftOrderId', 'discountIds']);
1018
- sideEffects?.onError?.(err);
1019
- throw transformedError;
1020
- }
1021
- }
1022
- /**
1023
- * Applies or unapplies additional fees on a draft order.
1024
- *
1025
- * Additional fees that are not applied are still part of the draft order, but do not affect balance.
1026
- * Existing additional fees that are not passed in the request will keep their current state.
1027
- * @param draftOrderId - Draft order ID.
1028
- * @param additionalFees - Additional fees to set on the draft order.
1029
- *
1030
- * Any existing additional fees that are not passed will not change.
1031
- * @public
1032
- * @documentationMaturity preview
1033
- * @requiredField additionalFees
1034
- * @requiredField additionalFees._id
1035
- * @requiredField additionalFees.applied
1036
- * @requiredField draftOrderId
1037
- * @permissionId ECOM.DRAFT_ORDERS_SET_ADDITIONAL_FEES
1038
- * @permissionScope Manage Stores - all permissions
1039
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1040
- * @permissionScope Manage Stores
1041
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1042
- * @permissionScope Manage Restaurants - all permissions
1043
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1044
- * @permissionScope Manage eCommerce - all permissions
1045
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1046
- * @applicableIdentity APP
1047
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetAdditionalFees
1048
- */
1049
- export async function setAdditionalFees(draftOrderId, additionalFees) {
1050
- // @ts-ignore
1051
- const { httpClient, sideEffects } = arguments[2];
1052
- const payload = renameKeysFromSDKRequestToRESTRequest({
1053
- draftOrderId: draftOrderId,
1054
- additionalFees: additionalFees,
1055
- });
1056
- const reqOpts = ambassadorWixEcomV1DraftOrder.setAdditionalFees(payload);
1057
- sideEffects?.onSiteCall?.();
1058
- try {
1059
- const result = await httpClient.request(reqOpts);
1060
- sideEffects?.onSuccess?.(result);
1061
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1062
- {
1063
- transformFn: transformRESTImageToSDKImage,
1064
- paths: [
1065
- {
1066
- path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
1067
- },
1068
- ],
1069
- },
1070
- {
1071
- transformFn: transformRESTAddressToSDKAddress,
1072
- paths: [
1073
- {
1074
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
1075
- },
1076
- {
1077
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
1078
- },
1079
- {
1080
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
1081
- },
1082
- {
1083
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
1084
- },
1085
- { path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
1086
- {
1087
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
1088
- },
1089
- {
1090
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
1091
- },
1092
- {
1093
- path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
1094
- },
1095
- {
1096
- path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
1097
- },
1098
- {
1099
- path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
1100
- },
1101
- ],
1102
- },
1103
- ]));
1104
- }
1105
- catch (err) {
1106
- const transformedError = sdkTransformError(err, {
1107
- spreadPathsToArguments: {},
1108
- explicitPathsToArguments: {
1109
- draftOrderId: '$[0]',
1110
- additionalFees: '$[1]',
1111
- },
1112
- singleArgumentUnchanged: false,
1113
- }, ['draftOrderId', 'additionalFees']);
1114
- sideEffects?.onError?.(err);
1115
- throw transformedError;
1116
- }
1117
- }
1118
- /**
1119
- * Creates custom additional fees on a draft order.
1120
- *
1121
- * Newly created additional fees are not applied by default.
1122
- * To apply them, use Set Additional Fees.
1123
- * @param draftOrderId - Draft order ID.
1124
- * @public
1125
- * @documentationMaturity preview
1126
- * @requiredField draftOrderId
1127
- * @requiredField options.customAdditionalFees.name
1128
- * @requiredField options.customAdditionalFees.price
1129
- * @requiredField options.customAdditionalFees.price.amount
1130
- * @permissionId ECOM.DRAFT_ORDERS_CREATE_ADDITIONAL_FEES
1131
- * @permissionScope Manage Stores - all permissions
1132
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1133
- * @permissionScope Manage Stores
1134
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1135
- * @permissionScope Manage Restaurants - all permissions
1136
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1137
- * @permissionScope Manage eCommerce - all permissions
1138
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1139
- * @applicableIdentity APP
1140
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateCustomAdditionalFees
1141
- */
1142
- export async function createCustomAdditionalFees(draftOrderId, options) {
1143
- // @ts-ignore
1144
- const { httpClient, sideEffects } = arguments[2];
1145
- const payload = renameKeysFromSDKRequestToRESTRequest({
1146
- draftOrderId: draftOrderId,
1147
- customAdditionalFees: options?.customAdditionalFees,
1148
- });
1149
- const reqOpts = ambassadorWixEcomV1DraftOrder.createCustomAdditionalFees(payload);
1150
- sideEffects?.onSiteCall?.();
1151
- try {
1152
- const result = await httpClient.request(reqOpts);
1153
- sideEffects?.onSuccess?.(result);
1154
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1155
- {
1156
- transformFn: transformRESTImageToSDKImage,
1157
- paths: [
1158
- {
1159
- path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
1160
- },
1161
- ],
1162
- },
1163
- {
1164
- transformFn: transformRESTAddressToSDKAddress,
1165
- paths: [
1166
- {
1167
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
1168
- },
1169
- {
1170
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
1171
- },
1172
- {
1173
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
1174
- },
1175
- {
1176
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
1177
- },
1178
- { path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
1179
- {
1180
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
1181
- },
1182
- {
1183
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
1184
- },
1185
- {
1186
- path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
1187
- },
1188
- {
1189
- path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
1190
- },
1191
- {
1192
- path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
1193
- },
1194
- ],
1195
- },
1196
- ]));
1197
- }
1198
- catch (err) {
1199
- const transformedError = sdkTransformError(err, {
1200
- spreadPathsToArguments: {},
1201
- explicitPathsToArguments: {
1202
- draftOrderId: '$[0]',
1203
- customAdditionalFees: '$[1].customAdditionalFees',
1204
- },
1205
- singleArgumentUnchanged: false,
1206
- }, ['draftOrderId', 'options']);
1207
- sideEffects?.onError?.(err);
1208
- throw transformedError;
1209
- }
1210
- }
1211
- /**
1212
- * Removes custom additional fees from a draft order.
1213
- * @param draftOrderId - Draft order ID.
1214
- * @param customAdditionalFees - IDs of the additional fees to remove from the draft order.
1215
- * @public
1216
- * @documentationMaturity preview
1217
- * @requiredField customAdditionalFees
1218
- * @requiredField draftOrderId
1219
- * @permissionId ECOM.DRAFT_ORDERS_DELETE_ADDITIONAL_FEES
1220
- * @permissionScope Manage Stores - all permissions
1221
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1222
- * @permissionScope Manage Stores
1223
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1224
- * @permissionScope Manage Restaurants - all permissions
1225
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1226
- * @permissionScope Manage eCommerce - all permissions
1227
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1228
- * @applicableIdentity APP
1229
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.DeleteCustomAdditionalFees
1230
- */
1231
- export async function deleteCustomAdditionalFees(draftOrderId, customAdditionalFees) {
1232
- // @ts-ignore
1233
- const { httpClient, sideEffects } = arguments[2];
1234
- const payload = renameKeysFromSDKRequestToRESTRequest({
1235
- draftOrderId: draftOrderId,
1236
- customAdditionalFees: customAdditionalFees,
1237
- });
1238
- const reqOpts = ambassadorWixEcomV1DraftOrder.deleteCustomAdditionalFees(payload);
1239
- sideEffects?.onSiteCall?.();
1240
- try {
1241
- const result = await httpClient.request(reqOpts);
1242
- sideEffects?.onSuccess?.(result);
1243
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1244
- {
1245
- transformFn: transformRESTImageToSDKImage,
1246
- paths: [
1247
- {
1248
- path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
1249
- },
1250
- ],
1251
- },
1252
- {
1253
- transformFn: transformRESTAddressToSDKAddress,
1254
- paths: [
1255
- {
1256
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
1257
- },
1258
- {
1259
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
1260
- },
1261
- {
1262
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
1263
- },
1264
- {
1265
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
1266
- },
1267
- { path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
1268
- {
1269
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
1270
- },
1271
- {
1272
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
1273
- },
1274
- {
1275
- path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
1276
- },
1277
- {
1278
- path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
1279
- },
1280
- {
1281
- path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
1282
- },
1283
- ],
1284
- },
1285
- ]));
1286
- }
1287
- catch (err) {
1288
- const transformedError = sdkTransformError(err, {
1289
- spreadPathsToArguments: {},
1290
- explicitPathsToArguments: {
1291
- draftOrderId: '$[0]',
1292
- customAdditionalFees: '$[1]',
1293
- },
1294
- singleArgumentUnchanged: false,
1295
- }, ['draftOrderId', 'customAdditionalFees']);
1296
- sideEffects?.onError?.(err);
1297
- throw transformedError;
1298
- }
1299
- }
1300
- /**
1301
- * Sets shipping information on a draft order.
1302
- * @param draftOrderId - Draft order ID.
1303
- * @public
1304
- * @documentationMaturity preview
1305
- * @requiredField draftOrderId
1306
- * @permissionId ECOM.DRAFT_ORDERS_SET_SHIPPING_INFO
1307
- * @permissionScope Manage Stores - all permissions
1308
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1309
- * @permissionScope Manage Stores
1310
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1311
- * @permissionScope Manage Restaurants - all permissions
1312
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1313
- * @permissionScope Manage eCommerce - all permissions
1314
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1315
- * @applicableIdentity APP
1316
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetShippingInfo
1317
- */
1318
- export async function setShippingInfo(draftOrderId, options) {
1319
- // @ts-ignore
1320
- const { httpClient, sideEffects } = arguments[2];
1321
- const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
1322
- draftOrderId: draftOrderId,
1323
- shippingInfo: options?.shippingInfo,
1324
- }), [
1325
- {
1326
- transformFn: transformSDKAddressToRESTAddress,
1327
- paths: [
1328
- { path: 'shippingInfo.logistics.shippingDestination.address' },
1329
- { path: 'shippingInfo.logistics.pickupDetails.address' },
1330
- ],
1331
- },
1332
- ]);
1333
- const reqOpts = ambassadorWixEcomV1DraftOrder.setShippingInfo(payload);
1334
- sideEffects?.onSiteCall?.();
1335
- try {
1336
- const result = await httpClient.request(reqOpts);
1337
- sideEffects?.onSuccess?.(result);
1338
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1339
- {
1340
- transformFn: transformRESTImageToSDKImage,
1341
- paths: [
1342
- {
1343
- path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
1344
- },
1345
- ],
1346
- },
1347
- {
1348
- transformFn: transformRESTAddressToSDKAddress,
1349
- paths: [
1350
- {
1351
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
1352
- },
1353
- {
1354
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
1355
- },
1356
- {
1357
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
1358
- },
1359
- {
1360
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
1361
- },
1362
- { path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
1363
- {
1364
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
1365
- },
1366
- {
1367
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
1368
- },
1369
- {
1370
- path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
1371
- },
1372
- {
1373
- path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
1374
- },
1375
- {
1376
- path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
1377
- },
1378
- ],
1379
- },
1380
- ]));
1381
- }
1382
- catch (err) {
1383
- const transformedError = sdkTransformError(err, {
1384
- spreadPathsToArguments: {},
1385
- explicitPathsToArguments: {
1386
- draftOrderId: '$[0]',
1387
- shippingInfo: '$[1].shippingInfo',
1388
- },
1389
- singleArgumentUnchanged: false,
1390
- }, ['draftOrderId', 'options']);
1391
- sideEffects?.onError?.(err);
1392
- throw transformedError;
1393
- }
1394
- }
1395
- /**
1396
- * Sets buyer info on a draft order.
1397
- * @param draftOrderId - Draft order ID.
1398
- * @public
1399
- * @documentationMaturity preview
1400
- * @requiredField draftOrderId
1401
- * @permissionId ECOM.DRAFT_ORDER_SET_BUYER_INFO
1402
- * @permissionScope Manage Stores - all permissions
1403
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1404
- * @permissionScope Manage Stores
1405
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1406
- * @permissionScope Manage Restaurants - all permissions
1407
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1408
- * @permissionScope Manage eCommerce - all permissions
1409
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1410
- * @applicableIdentity APP
1411
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetBuyerInfo
1412
- */
1413
- export async function setBuyerInfo(draftOrderId, options) {
1414
- // @ts-ignore
1415
- const { httpClient, sideEffects } = arguments[2];
1416
- const payload = renameKeysFromSDKRequestToRESTRequest({
1417
- draftOrderId: draftOrderId,
1418
- buyerInfo: options?.buyerInfo,
1419
- });
1420
- const reqOpts = ambassadorWixEcomV1DraftOrder.setBuyerInfo(payload);
1421
- sideEffects?.onSiteCall?.();
1422
- try {
1423
- const result = await httpClient.request(reqOpts);
1424
- sideEffects?.onSuccess?.(result);
1425
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1426
- {
1427
- transformFn: transformRESTImageToSDKImage,
1428
- paths: [
1429
- {
1430
- path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
1431
- },
1432
- ],
1433
- },
1434
- {
1435
- transformFn: transformRESTAddressToSDKAddress,
1436
- paths: [
1437
- {
1438
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
1439
- },
1440
- {
1441
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
1442
- },
1443
- {
1444
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
1445
- },
1446
- {
1447
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
1448
- },
1449
- { path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
1450
- {
1451
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
1452
- },
1453
- {
1454
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
1455
- },
1456
- {
1457
- path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
1458
- },
1459
- {
1460
- path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
1461
- },
1462
- {
1463
- path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
1464
- },
1465
- ],
1466
- },
1467
- ]));
1468
- }
1469
- catch (err) {
1470
- const transformedError = sdkTransformError(err, {
1471
- spreadPathsToArguments: {},
1472
- explicitPathsToArguments: {
1473
- draftOrderId: '$[0]',
1474
- buyerInfo: '$[1].buyerInfo',
1475
- },
1476
- singleArgumentUnchanged: false,
1477
- }, ['draftOrderId', 'options']);
1478
- sideEffects?.onError?.(err);
1479
- throw transformedError;
1480
- }
1481
- }
1482
- /**
1483
- * Sets recipient info on a draft order.
1484
- * @param draftOrderId - Draft order ID.
1485
- * @public
1486
- * @documentationMaturity preview
1487
- * @requiredField draftOrderId
1488
- * @permissionId ECOM.DRAFT_ORDER_SET_RECIPIENT_INFO
1489
- * @permissionScope Manage Stores - all permissions
1490
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1491
- * @permissionScope Manage Stores
1492
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1493
- * @permissionScope Manage Restaurants - all permissions
1494
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1495
- * @permissionScope Manage eCommerce - all permissions
1496
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1497
- * @applicableIdentity APP
1498
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetRecipientInfo
1499
- */
1500
- export async function setRecipientInfo(draftOrderId, options) {
1501
- // @ts-ignore
1502
- const { httpClient, sideEffects } = arguments[2];
1503
- const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
1504
- draftOrderId: draftOrderId,
1505
- recipientInfo: options?.recipientInfo,
1506
- }), [
1507
- {
1508
- transformFn: transformSDKAddressToRESTAddress,
1509
- paths: [{ path: 'recipientInfo.address' }],
1510
- },
1511
- ]);
1512
- const reqOpts = ambassadorWixEcomV1DraftOrder.setRecipientInfo(payload);
1513
- sideEffects?.onSiteCall?.();
1514
- try {
1515
- const result = await httpClient.request(reqOpts);
1516
- sideEffects?.onSuccess?.(result);
1517
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1518
- {
1519
- transformFn: transformRESTImageToSDKImage,
1520
- paths: [
1521
- {
1522
- path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
1523
- },
1524
- ],
1525
- },
1526
- {
1527
- transformFn: transformRESTAddressToSDKAddress,
1528
- paths: [
1529
- {
1530
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
1531
- },
1532
- {
1533
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
1534
- },
1535
- {
1536
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
1537
- },
1538
- {
1539
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
1540
- },
1541
- { path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
1542
- {
1543
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
1544
- },
1545
- {
1546
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
1547
- },
1548
- {
1549
- path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
1550
- },
1551
- {
1552
- path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
1553
- },
1554
- {
1555
- path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
1556
- },
1557
- ],
1558
- },
1559
- ]));
1560
- }
1561
- catch (err) {
1562
- const transformedError = sdkTransformError(err, {
1563
- spreadPathsToArguments: {},
1564
- explicitPathsToArguments: {
1565
- draftOrderId: '$[0]',
1566
- recipientInfo: '$[1].recipientInfo',
1567
- },
1568
- singleArgumentUnchanged: false,
1569
- }, ['draftOrderId', 'options']);
1570
- sideEffects?.onError?.(err);
1571
- throw transformedError;
1572
- }
1573
- }
1574
- /**
1575
- * Sets billing info on a draft order.
1576
- * @param draftOrderId - Draft order ID.
1577
- * @public
1578
- * @documentationMaturity preview
1579
- * @requiredField draftOrderId
1580
- * @permissionId ECOM.DRAFT_ORDER_SET_BILLING_INFO
1581
- * @permissionScope Manage Stores - all permissions
1582
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1583
- * @permissionScope Manage Stores
1584
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1585
- * @permissionScope Manage Restaurants - all permissions
1586
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1587
- * @permissionScope Manage eCommerce - all permissions
1588
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1589
- * @applicableIdentity APP
1590
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetBillingInfo
1591
- */
1592
- export async function setBillingInfo(draftOrderId, options) {
1593
- // @ts-ignore
1594
- const { httpClient, sideEffects } = arguments[2];
1595
- const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
1596
- draftOrderId: draftOrderId,
1597
- billingInfo: options?.billingInfo,
1598
- }), [
1599
- {
1600
- transformFn: transformSDKAddressToRESTAddress,
1601
- paths: [{ path: 'billingInfo.address' }],
1602
- },
1603
- ]);
1604
- const reqOpts = ambassadorWixEcomV1DraftOrder.setBillingInfo(payload);
1605
- sideEffects?.onSiteCall?.();
1606
- try {
1607
- const result = await httpClient.request(reqOpts);
1608
- sideEffects?.onSuccess?.(result);
1609
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1610
- {
1611
- transformFn: transformRESTImageToSDKImage,
1612
- paths: [
1613
- {
1614
- path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
1615
- },
1616
- ],
1617
- },
1618
- {
1619
- transformFn: transformRESTAddressToSDKAddress,
1620
- paths: [
1621
- {
1622
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
1623
- },
1624
- {
1625
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
1626
- },
1627
- {
1628
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
1629
- },
1630
- {
1631
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
1632
- },
1633
- { path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
1634
- {
1635
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
1636
- },
1637
- {
1638
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
1639
- },
1640
- {
1641
- path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
1642
- },
1643
- {
1644
- path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
1645
- },
1646
- {
1647
- path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
1648
- },
1649
- ],
1650
- },
1651
- ]));
1652
- }
1653
- catch (err) {
1654
- const transformedError = sdkTransformError(err, {
1655
- spreadPathsToArguments: {},
1656
- explicitPathsToArguments: {
1657
- draftOrderId: '$[0]',
1658
- billingInfo: '$[1].billingInfo',
1659
- },
1660
- singleArgumentUnchanged: false,
1661
- }, ['draftOrderId', 'options']);
1662
- sideEffects?.onError?.(err);
1663
- throw transformedError;
1664
- }
1665
- }
1666
- /**
1667
- * Retrieves a draft order.
1668
- *
1669
- * The retrieved draft order contains the latest calculations:
1670
- * + Line items, shipping details, and buyer information.
1671
- * + Tax details and price totals.
1672
- * + Automatic discounts and automatic additional fees, along with updated eligibility.
1673
- *
1674
- * > **Note:** When retrieving a committed draft order, it **is not recalculated**.
1675
- * @param draftOrderId - Draft order ID.
1676
- * @public
1677
- * @documentationMaturity preview
1678
- * @requiredField draftOrderId
1679
- * @permissionId ECOM.DRAFT_ORDERS_READ
1680
- * @permissionId ECOM.DRAFT_ORDER_READ_ALL_EXTENDED_FIELDS
1681
- * @permissionScope Manage Stores - all permissions
1682
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1683
- * @permissionScope Manage Stores
1684
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1685
- * @permissionScope Manage Restaurants - all permissions
1686
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1687
- * @permissionScope Manage eCommerce - all permissions
1688
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1689
- * @applicableIdentity APP
1690
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.GetDraftOrder
1691
- */
1692
- export async function getDraftOrder(draftOrderId) {
1693
- // @ts-ignore
1694
- const { httpClient, sideEffects } = arguments[1];
1695
- const payload = renameKeysFromSDKRequestToRESTRequest({
1696
- draftOrderId: draftOrderId,
1697
- });
1698
- const reqOpts = ambassadorWixEcomV1DraftOrder.getDraftOrder(payload);
1699
- sideEffects?.onSiteCall?.();
1700
- try {
1701
- const result = await httpClient.request(reqOpts);
1702
- sideEffects?.onSuccess?.(result);
1703
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1704
- {
1705
- transformFn: transformRESTImageToSDKImage,
1706
- paths: [
1707
- {
1708
- path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
1709
- },
1710
- ],
1711
- },
1712
- {
1713
- transformFn: transformRESTAddressToSDKAddress,
1714
- paths: [
1715
- {
1716
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
1717
- },
1718
- {
1719
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
1720
- },
1721
- {
1722
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
1723
- },
1724
- {
1725
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
1726
- },
1727
- { path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
1728
- {
1729
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
1730
- },
1731
- {
1732
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
1733
- },
1734
- {
1735
- path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
1736
- },
1737
- {
1738
- path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
1739
- },
1740
- {
1741
- path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
1742
- },
1743
- ],
1744
- },
1745
- ]));
1746
- }
1747
- catch (err) {
1748
- const transformedError = sdkTransformError(err, {
1749
- spreadPathsToArguments: {},
1750
- explicitPathsToArguments: { draftOrderId: '$[0]' },
1751
- singleArgumentUnchanged: false,
1752
- }, ['draftOrderId']);
1753
- sideEffects?.onError?.(err);
1754
- throw transformedError;
1755
- }
1756
- }
1757
- /**
1758
- * Checks whether a draft can be created for an order.
1759
- *
1760
- * If `orderDraftable` returns as `true`, the order can be used to create a draft order.
1761
- *
1762
- * If `orderDraftable` returns as `false`, refer to the `nonDraftableReasons` array in the response to understand why the order is not draftable.
1763
- * @param orderId - Order ID.
1764
- * @public
1765
- * @documentationMaturity preview
1766
- * @requiredField orderId
1767
- * @permissionId ECOM.DRAFT_ORDERS_READ
1768
- * @permissionScope Manage Stores - all permissions
1769
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1770
- * @permissionScope Manage Stores
1771
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1772
- * @permissionScope Manage Restaurants - all permissions
1773
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1774
- * @permissionScope Manage eCommerce - all permissions
1775
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1776
- * @applicableIdentity APP
1777
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.GetOrderDraftabilityStatus
1778
- */
1779
- export async function getOrderDraftabilityStatus(orderId) {
1780
- // @ts-ignore
1781
- const { httpClient, sideEffects } = arguments[1];
1782
- const payload = renameKeysFromSDKRequestToRESTRequest({ orderId: orderId });
1783
- const reqOpts = ambassadorWixEcomV1DraftOrder.getOrderDraftabilityStatus(payload);
1784
- sideEffects?.onSiteCall?.();
1785
- try {
1786
- const result = await httpClient.request(reqOpts);
1787
- sideEffects?.onSuccess?.(result);
1788
- return renameKeysFromRESTResponseToSDKResponse(result.data);
1789
- }
1790
- catch (err) {
1791
- const transformedError = sdkTransformError(err, {
1792
- spreadPathsToArguments: {},
1793
- explicitPathsToArguments: { orderId: '$[0]' },
1794
- singleArgumentUnchanged: false,
1795
- }, ['orderId']);
1796
- sideEffects?.onError?.(err);
1797
- throw transformedError;
1798
- }
1799
- }
1800
- /**
1801
- * Finalizes a draft order and applies its modifications to the associated order.
1802
- * You can also control which side-effects are executed on commit.
1803
- *
1804
- * > **Notes:**
1805
- * > + The draft order's status is set to `COMMITTED`.
1806
- * > + Commiting a draft order cannot be undone or reverted.
1807
- * > + A committed draft order does not allow for further modifications. However, it is kept for reference and can be retrieved.
1808
- * @param draftOrderId - Draft order ID.
1809
- * @public
1810
- * @documentationMaturity preview
1811
- * @requiredField draftOrderId
1812
- * @permissionId ECOM.DRAFT_ORDERS_COMMIT
1813
- * @permissionId ECOM.DRAFT_ORDER_READ_ALL_EXTENDED_FIELDS
1814
- * @permissionScope Manage Stores - all permissions
1815
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1816
- * @permissionScope Manage Stores
1817
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1818
- * @permissionScope Manage Restaurants - all permissions
1819
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1820
- * @permissionScope Manage eCommerce - all permissions
1821
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1822
- * @applicableIdentity APP
1823
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CommitDraftOrder
1824
- */
1825
- export async function commitDraftOrder(draftOrderId, options) {
1826
- // @ts-ignore
1827
- const { httpClient, sideEffects } = arguments[2];
1828
- const payload = renameKeysFromSDKRequestToRESTRequest({
1829
- draftOrderId: draftOrderId,
1830
- commitSettings: options?.commitSettings,
1831
- reason: options?.reason,
1832
- });
1833
- const reqOpts = ambassadorWixEcomV1DraftOrder.commitDraftOrder(payload);
1834
- sideEffects?.onSiteCall?.();
1835
- try {
1836
- const result = await httpClient.request(reqOpts);
1837
- sideEffects?.onSuccess?.(result);
1838
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1839
- {
1840
- transformFn: transformRESTImageToSDKImage,
1841
- paths: [
1842
- { path: 'committedDraftOrder.lineItems.lineItem.image' },
1843
- { path: 'orderAfterCommit.lineItems.image' },
1844
- ],
1845
- },
1846
- {
1847
- transformFn: transformRESTAddressToSDKAddress,
1848
- paths: [
1849
- {
1850
- path: 'committedDraftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
1851
- },
1852
- {
1853
- path: 'committedDraftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
1854
- },
1855
- {
1856
- path: 'committedDraftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
1857
- },
1858
- {
1859
- path: 'committedDraftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
1860
- },
1861
- { path: 'committedDraftOrder.billingInfo.address' },
1862
- {
1863
- path: 'committedDraftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
1864
- },
1865
- { path: 'committedDraftOrder.recipientInfo.recipientInfo.address' },
1866
- {
1867
- path: 'committedDraftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
1868
- },
1869
- { path: 'committedDraftOrder.billingDetails.billingInfo.address' },
1870
- { path: 'orderAfterCommit.billingInfo.address' },
1871
- {
1872
- path: 'orderAfterCommit.shippingInfo.logistics.shippingDestination.address',
1873
- },
1874
- {
1875
- path: 'orderAfterCommit.shippingInfo.logistics.pickupDetails.address',
1876
- },
1877
- { path: 'orderAfterCommit.recipientInfo.address' },
1878
- ],
1879
- },
1880
- ]));
1881
- }
1882
- catch (err) {
1883
- const transformedError = sdkTransformError(err, {
1884
- spreadPathsToArguments: {},
1885
- explicitPathsToArguments: {
1886
- draftOrderId: '$[0]',
1887
- commitSettings: '$[1].commitSettings',
1888
- reason: '$[1].reason',
1889
- },
1890
- singleArgumentUnchanged: false,
1891
- }, ['draftOrderId', 'options']);
1892
- sideEffects?.onError?.(err);
1893
- throw transformedError;
1894
- }
1895
- }
1896
- /**
1897
- * Creates a new order from a draft, while specifying which side-effects are executed.
1898
- *
1899
- * > **Notes:**
1900
- * > + The draft order's status is set to `COMMITTED`.
1901
- * > + Commiting a draft order cannot be undone or reverted.
1902
- * > + A committed draft order does not allow for further modifications. However, it is kept for reference and can be retrieved.
1903
- * @param draftOrderId - Draft order ID.
1904
- * @public
1905
- * @documentationMaturity preview
1906
- * @requiredField draftOrderId
1907
- * @permissionId ECOM.DRAFT_ORDER_CREATE_ORDER_FROM_DRAFT
1908
- * @permissionId ECOM.DRAFT_ORDER_READ_ALL_EXTENDED_FIELDS
1909
- * @permissionScope Manage Stores - all permissions
1910
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1911
- * @permissionScope Manage Stores
1912
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1913
- * @permissionScope Manage Restaurants - all permissions
1914
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1915
- * @permissionScope Manage eCommerce - all permissions
1916
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1917
- * @applicableIdentity APP
1918
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateOrderFromDraft
1919
- */
1920
- export async function createOrderFromDraft(draftOrderId, options) {
1921
- // @ts-ignore
1922
- const { httpClient, sideEffects } = arguments[2];
1923
- const payload = renameKeysFromSDKRequestToRESTRequest({
1924
- draftOrderId: draftOrderId,
1925
- createSettings: options?.createSettings,
1926
- reason: options?.reason,
1927
- channelInfo: options?.channelInfo,
1928
- });
1929
- const reqOpts = ambassadorWixEcomV1DraftOrder.createOrderFromDraft(payload);
1930
- sideEffects?.onSiteCall?.();
1931
- try {
1932
- const result = await httpClient.request(reqOpts);
1933
- sideEffects?.onSuccess?.(result);
1934
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1935
- {
1936
- transformFn: transformRESTImageToSDKImage,
1937
- paths: [
1938
- { path: 'committedDraftOrder.lineItems.lineItem.image' },
1939
- { path: 'createdOrder.lineItems.image' },
1940
- ],
1941
- },
1942
- {
1943
- transformFn: transformRESTAddressToSDKAddress,
1944
- paths: [
1945
- {
1946
- path: 'committedDraftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
1947
- },
1948
- {
1949
- path: 'committedDraftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
1950
- },
1951
- {
1952
- path: 'committedDraftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
1953
- },
1954
- {
1955
- path: 'committedDraftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
1956
- },
1957
- { path: 'committedDraftOrder.billingInfo.address' },
1958
- {
1959
- path: 'committedDraftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
1960
- },
1961
- { path: 'committedDraftOrder.recipientInfo.recipientInfo.address' },
1962
- {
1963
- path: 'committedDraftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
1964
- },
1965
- { path: 'committedDraftOrder.billingDetails.billingInfo.address' },
1966
- { path: 'createdOrder.billingInfo.address' },
1967
- {
1968
- path: 'createdOrder.shippingInfo.logistics.shippingDestination.address',
1969
- },
1970
- {
1971
- path: 'createdOrder.shippingInfo.logistics.pickupDetails.address',
1972
- },
1973
- { path: 'createdOrder.recipientInfo.address' },
1974
- ],
1975
- },
1976
- ]));
1977
- }
1978
- catch (err) {
1979
- const transformedError = sdkTransformError(err, {
1980
- spreadPathsToArguments: {},
1981
- explicitPathsToArguments: {
1982
- draftOrderId: '$[0]',
1983
- createSettings: '$[1].createSettings',
1984
- reason: '$[1].reason',
1985
- channelInfo: '$[1].channelInfo',
1986
- },
1987
- singleArgumentUnchanged: false,
1988
- }, ['draftOrderId', 'options']);
1989
- sideEffects?.onError?.(err);
1990
- throw transformedError;
1991
- }
1992
- }
1993
- /**
1994
- * Deletes a draft order along with all its pending changes.
1995
- *
1996
- * Draft orders with status 'COMMITTED' cannot be deleted.
1997
- * @param draftOrderId - Draft order ID.
1998
- * @public
1999
- * @documentationMaturity preview
2000
- * @requiredField draftOrderId
2001
- * @permissionId ECOM.DRAFT_ORDERS_DELETE
2002
- * @permissionId ECOM.DRAFT_ORDERS_ADMIN_DELETE
2003
- * @permissionScope Manage Stores - all permissions
2004
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
2005
- * @permissionScope Manage Stores
2006
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
2007
- * @permissionScope Manage Restaurants - all permissions
2008
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
2009
- * @permissionScope Manage eCommerce - all permissions
2010
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
2011
- * @applicableIdentity APP
2012
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.DeleteDraftOrder
2013
- */
2014
- export async function deleteDraftOrder(draftOrderId) {
2015
- // @ts-ignore
2016
- const { httpClient, sideEffects } = arguments[1];
2017
- const payload = renameKeysFromSDKRequestToRESTRequest({
2018
- draftOrderId: draftOrderId,
2019
- });
2020
- const reqOpts = ambassadorWixEcomV1DraftOrder.deleteDraftOrder(payload);
2021
- sideEffects?.onSiteCall?.();
2022
- try {
2023
- const result = await httpClient.request(reqOpts);
2024
- sideEffects?.onSuccess?.(result);
2025
- }
2026
- catch (err) {
2027
- const transformedError = sdkTransformError(err, {
2028
- spreadPathsToArguments: {},
2029
- explicitPathsToArguments: { draftOrderId: '$[0]' },
2030
- singleArgumentUnchanged: false,
2031
- }, ['draftOrderId']);
2032
- sideEffects?.onError?.(err);
2033
- throw transformedError;
2034
- }
2035
- }
2036
- /**
2037
- * Retrieves a list of up to 100 draft orders, given the provided paging, filtering, and sorting.
2038
- *
2039
- * For field support, see [supported filters and sorting](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/draft-orders/supported-filters-and-sorting).
2040
- * To learn how to query draft orders, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language).
2041
- * @public
2042
- * @documentationMaturity preview
2043
- * @permissionScope Manage Stores - all permissions
2044
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
2045
- * @permissionScope Manage Stores
2046
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
2047
- * @permissionScope Manage Restaurants - all permissions
2048
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
2049
- * @permissionScope Manage eCommerce - all permissions
2050
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
2051
- * @permissionId ECOM.DRAFT_ORDERS_READ
2052
- * @applicableIdentity APP
2053
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.QueryDraftOrders
2054
- */
2055
- export function queryDraftOrders() {
2056
- // @ts-ignore
2057
- const { httpClient, sideEffects } = arguments[0];
2058
- return queryBuilder({
2059
- func: async (payload) => {
2060
- const reqOpts = ambassadorWixEcomV1DraftOrder.queryDraftOrders(payload);
2061
- sideEffects?.onSiteCall?.();
2062
- try {
2063
- const result = await httpClient.request(reqOpts);
2064
- sideEffects?.onSuccess?.(result);
2065
- return result;
2066
- }
2067
- catch (err) {
2068
- sideEffects?.onError?.(err);
2069
- throw err;
2070
- }
2071
- },
2072
- requestTransformer: (query) => {
2073
- const args = [query, {}];
2074
- return renameKeysFromSDKRequestToRESTRequest({
2075
- ...args?.[1],
2076
- query: args?.[0],
2077
- });
2078
- },
2079
- responseTransformer: ({ data }) => {
2080
- const transformedData = renameKeysFromRESTResponseToSDKResponse(transformPaths(data, [
2081
- {
2082
- transformFn: transformRESTImageToSDKImage,
2083
- paths: [{ path: 'draftOrders.lineItems.lineItem.image' }],
2084
- },
2085
- {
2086
- transformFn: transformRESTAddressToSDKAddress,
2087
- paths: [
2088
- {
2089
- path: 'draftOrders.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
2090
- },
2091
- {
2092
- path: 'draftOrders.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
2093
- },
2094
- {
2095
- path: 'draftOrders.shippingInfo.shippingInfo.logistics.shippingDestination.address',
2096
- },
2097
- {
2098
- path: 'draftOrders.shippingInfo.shippingInfo.logistics.pickupDetails.address',
2099
- },
2100
- { path: 'draftOrders.billingInfo.address' },
2101
- {
2102
- path: 'draftOrders.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
2103
- },
2104
- { path: 'draftOrders.recipientInfo.recipientInfo.address' },
2105
- {
2106
- path: 'draftOrders.billingDetails.changedDetails.billingInfoBeforeChange.address',
2107
- },
2108
- { path: 'draftOrders.billingDetails.billingInfo.address' },
2109
- ],
2110
- },
2111
- ]));
2112
- return {
2113
- items: transformedData?.draftOrders,
2114
- pagingMetadata: transformedData?.pagingMetadata,
2115
- };
2116
- },
2117
- errorTransformer: (err) => {
2118
- const transformedError = sdkTransformError(err, {
2119
- spreadPathsToArguments: {},
2120
- explicitPathsToArguments: { query: '$[0]' },
2121
- singleArgumentUnchanged: false,
2122
- });
2123
- throw transformedError;
2124
- },
2125
- pagingMethod: 'CURSOR',
2126
- transformationPaths: {},
2127
- });
2128
- }
2129
- /**
2130
- * Updates extended fields on a draft order.
2131
- * @param _id - ID of the entity to update.
2132
- * @param namespace - Identifier for the app whose extended fields are being updated.
2133
- * @public
2134
- * @documentationMaturity preview
2135
- * @requiredField _id
2136
- * @requiredField namespace
2137
- * @requiredField options
2138
- * @requiredField options.namespaceData
2139
- * @permissionId ECOM.DRAFT_ORDER_UPDATE_EXTENDED_FIELDS
2140
- * @permissionId ECOM.DRAFT_ORDER_WRITE_ALL_EXTENDED_FIELDS
2141
- * @permissionScope Manage Stores - all permissions
2142
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
2143
- * @permissionScope Manage Stores
2144
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
2145
- * @permissionScope Manage Restaurants - all permissions
2146
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
2147
- * @permissionScope Manage eCommerce - all permissions
2148
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
2149
- * @permissionScope Manage Stores - all permissions
2150
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
2151
- * @permissionScope Manage Stores
2152
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
2153
- * @permissionScope Manage Restaurants - all permissions
2154
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
2155
- * @permissionScope Manage eCommerce - all permissions
2156
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
2157
- * @permissionScope Manage Orders
2158
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
2159
- * @applicableIdentity APP
2160
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.UpdateExtendedFields
2161
- */
2162
- export async function updateExtendedFields(_id, namespace, options) {
2163
- // @ts-ignore
2164
- const { httpClient, sideEffects } = arguments[3];
2165
- const payload = renameKeysFromSDKRequestToRESTRequest({
2166
- id: _id,
2167
- namespace: namespace,
2168
- namespaceData: options?.namespaceData,
2169
- });
2170
- const reqOpts = ambassadorWixEcomV1DraftOrder.updateExtendedFields(payload);
2171
- sideEffects?.onSiteCall?.();
2172
- try {
2173
- const result = await httpClient.request(reqOpts);
2174
- sideEffects?.onSuccess?.(result);
2175
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
2176
- {
2177
- transformFn: transformRESTImageToSDKImage,
2178
- paths: [{ path: 'draftOrder.lineItems.lineItem.image' }],
2179
- },
2180
- {
2181
- transformFn: transformRESTAddressToSDKAddress,
2182
- paths: [
2183
- {
2184
- path: 'draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
2185
- },
2186
- {
2187
- path: 'draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
2188
- },
2189
- {
2190
- path: 'draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
2191
- },
2192
- {
2193
- path: 'draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
2194
- },
2195
- { path: 'draftOrder.billingInfo.address' },
2196
- {
2197
- path: 'draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
2198
- },
2199
- { path: 'draftOrder.recipientInfo.recipientInfo.address' },
2200
- {
2201
- path: 'draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
2202
- },
2203
- { path: 'draftOrder.billingDetails.billingInfo.address' },
2204
- ],
2205
- },
2206
- ]));
2207
- }
2208
- catch (err) {
2209
- const transformedError = sdkTransformError(err, {
2210
- spreadPathsToArguments: {},
2211
- explicitPathsToArguments: {
2212
- id: '$[0]',
2213
- namespace: '$[1]',
2214
- namespaceData: '$[2].namespaceData',
2215
- },
2216
- singleArgumentUnchanged: false,
2217
- }, ['_id', 'namespace', 'options']);
2218
- sideEffects?.onError?.(err);
2219
- throw transformedError;
2220
- }
2221
- }
2222
- /**
2223
- * Sets whether a draft order is tax-exempt.
2224
- *
2225
- * A tax exempted draft order ignores taxes during calculation. Tax information will return empty.
2226
- * @param draftOrderId - Draft order ID.
2227
- * @public
2228
- * @documentationMaturity preview
2229
- * @requiredField draftOrderId
2230
- * @requiredField options
2231
- * @requiredField options.taxExempt
2232
- * @permissionId ECOM.DRAFT_ORDER_SET_TAX_EXEMPTION
2233
- * @permissionScope Manage Stores - all permissions
2234
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
2235
- * @permissionScope Manage Stores
2236
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
2237
- * @permissionScope Manage Restaurants - all permissions
2238
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
2239
- * @permissionScope Manage eCommerce - all permissions
2240
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
2241
- * @applicableIdentity APP
2242
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetTaxExemption
2243
- */
2244
- export async function setTaxExemption(draftOrderId, options) {
2245
- // @ts-ignore
2246
- const { httpClient, sideEffects } = arguments[2];
2247
- const payload = renameKeysFromSDKRequestToRESTRequest({
2248
- draftOrderId: draftOrderId,
2249
- taxExempt: options?.taxExempt,
2250
- });
2251
- const reqOpts = ambassadorWixEcomV1DraftOrder.setTaxExemption(payload);
2252
- sideEffects?.onSiteCall?.();
2253
- try {
2254
- const result = await httpClient.request(reqOpts);
2255
- sideEffects?.onSuccess?.(result);
2256
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
2257
- {
2258
- transformFn: transformRESTImageToSDKImage,
2259
- paths: [
2260
- {
2261
- path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
2262
- },
2263
- ],
2264
- },
2265
- {
2266
- transformFn: transformRESTAddressToSDKAddress,
2267
- paths: [
2268
- {
2269
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
2270
- },
2271
- {
2272
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
2273
- },
2274
- {
2275
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
2276
- },
2277
- {
2278
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
2279
- },
2280
- { path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
2281
- {
2282
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
2283
- },
2284
- {
2285
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
2286
- },
2287
- {
2288
- path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
2289
- },
2290
- {
2291
- path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
2292
- },
2293
- {
2294
- path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
2295
- },
2296
- ],
2297
- },
2298
- ]));
2299
- }
2300
- catch (err) {
2301
- const transformedError = sdkTransformError(err, {
2302
- spreadPathsToArguments: {},
2303
- explicitPathsToArguments: {
2304
- draftOrderId: '$[0]',
2305
- taxExempt: '$[1].taxExempt',
2306
- },
2307
- singleArgumentUnchanged: false,
2308
- }, ['draftOrderId', 'options']);
2309
- sideEffects?.onError?.(err);
2310
- throw transformedError;
2311
- }
2312
- }
2313
- /**
2314
- * Sets business location on a draft order.
2315
- *
2316
- * When committed, the order will become associated to a specific business location. This affects who can see and manage this order, and how it is calculated in reports.
2317
- * @param draftOrderId - Draft order ID.
2318
- * @public
2319
- * @documentationMaturity preview
2320
- * @requiredField draftOrderId
2321
- * @requiredField options.businessLocation._id
2322
- * @permissionId ECOM.DRAFT_ORDER_SET_BUSINESS_LOCATION
2323
- * @permissionScope Manage Stores - all permissions
2324
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
2325
- * @permissionScope Manage Stores
2326
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
2327
- * @permissionScope Manage Restaurants - all permissions
2328
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
2329
- * @permissionScope Manage eCommerce - all permissions
2330
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
2331
- * @applicableIdentity APP
2332
- * @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetBusinessLocation
2333
- */
2334
- export async function setBusinessLocation(draftOrderId, options) {
2335
- // @ts-ignore
2336
- const { httpClient, sideEffects } = arguments[2];
2337
- const payload = renameKeysFromSDKRequestToRESTRequest({
2338
- draftOrderId: draftOrderId,
2339
- businessLocation: options?.businessLocation,
2340
- });
2341
- const reqOpts = ambassadorWixEcomV1DraftOrder.setBusinessLocation(payload);
2342
- sideEffects?.onSiteCall?.();
2343
- try {
2344
- const result = await httpClient.request(reqOpts);
2345
- sideEffects?.onSuccess?.(result);
2346
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
2347
- {
2348
- transformFn: transformRESTImageToSDKImage,
2349
- paths: [
2350
- {
2351
- path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
2352
- },
2353
- ],
2354
- },
2355
- {
2356
- transformFn: transformRESTAddressToSDKAddress,
2357
- paths: [
2358
- {
2359
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
2360
- },
2361
- {
2362
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
2363
- },
2364
- {
2365
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
2366
- },
2367
- {
2368
- path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
2369
- },
2370
- { path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
2371
- {
2372
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
2373
- },
2374
- {
2375
- path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
2376
- },
2377
- {
2378
- path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
2379
- },
2380
- {
2381
- path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
2382
- },
2383
- {
2384
- path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
2385
- },
2386
- ],
2387
- },
2388
- ]));
2389
- }
2390
- catch (err) {
2391
- const transformedError = sdkTransformError(err, {
2392
- spreadPathsToArguments: {},
2393
- explicitPathsToArguments: {
2394
- draftOrderId: '$[0]',
2395
- businessLocation: '$[1].businessLocation',
2396
- },
2397
- singleArgumentUnchanged: false,
2398
- }, ['draftOrderId', 'options']);
2399
- sideEffects?.onError?.(err);
2400
- throw transformedError;
2401
- }
2402
- }
2403
- //# sourceMappingURL=ecom-v1-draft-order-draft-orders.universal.js.map