@wix/auto_sdk_ecom_orders 1.0.34 → 1.0.35

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/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +18 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/index.typings.d.ts +1 -0
  5. package/build/cjs/index.typings.js +18 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/meta.d.ts +1 -0
  8. package/build/cjs/meta.js +18 -0
  9. package/build/cjs/meta.js.map +1 -0
  10. package/build/cjs/src/ecom-v1-order-orders.context.d.ts +34 -0
  11. package/build/cjs/src/ecom-v1-order-orders.context.js +117 -0
  12. package/build/cjs/src/ecom-v1-order-orders.context.js.map +1 -0
  13. package/build/cjs/src/ecom-v1-order-orders.http.d.ts +200 -0
  14. package/build/cjs/src/ecom-v1-order-orders.http.js +1610 -0
  15. package/build/cjs/src/ecom-v1-order-orders.http.js.map +1 -0
  16. package/build/cjs/src/ecom-v1-order-orders.meta.d.ts +78 -0
  17. package/build/cjs/src/ecom-v1-order-orders.meta.js +503 -0
  18. package/build/cjs/src/ecom-v1-order-orders.meta.js.map +1 -0
  19. package/build/cjs/src/ecom-v1-order-orders.public.d.ts +189 -0
  20. package/build/cjs/src/ecom-v1-order-orders.public.js +382 -0
  21. package/build/cjs/src/ecom-v1-order-orders.public.js.map +1 -0
  22. package/build/{ecom-v1-order-orders.universal-UflOyGzD.d.mts → cjs/src/ecom-v1-order-orders.types.d.ts} +637 -1109
  23. package/build/cjs/src/ecom-v1-order-orders.types.js +652 -0
  24. package/build/cjs/src/ecom-v1-order-orders.types.js.map +1 -0
  25. package/build/{internal/ecom-v1-order-orders.universal-DkzM7BQ-.d.ts → cjs/src/ecom-v1-order-orders.universal.d.ts} +985 -957
  26. package/build/cjs/src/ecom-v1-order-orders.universal.js +2294 -0
  27. package/build/cjs/src/ecom-v1-order-orders.universal.js.map +1 -0
  28. package/build/es/index.d.ts +1 -0
  29. package/build/es/index.js +2 -0
  30. package/build/es/index.js.map +1 -0
  31. package/build/es/index.typings.d.ts +1 -0
  32. package/build/es/index.typings.js +2 -0
  33. package/build/es/index.typings.js.map +1 -0
  34. package/build/es/meta.d.ts +1 -0
  35. package/build/es/meta.js +2 -0
  36. package/build/es/meta.js.map +1 -0
  37. package/build/es/package.json +3 -0
  38. package/build/es/src/ecom-v1-order-orders.context.d.ts +34 -0
  39. package/build/es/src/ecom-v1-order-orders.context.js +62 -0
  40. package/build/es/src/ecom-v1-order-orders.context.js.map +1 -0
  41. package/build/es/src/ecom-v1-order-orders.http.d.ts +200 -0
  42. package/build/es/src/ecom-v1-order-orders.http.js +1582 -0
  43. package/build/es/src/ecom-v1-order-orders.http.js.map +1 -0
  44. package/build/es/src/ecom-v1-order-orders.meta.d.ts +78 -0
  45. package/build/es/src/ecom-v1-order-orders.meta.js +452 -0
  46. package/build/es/src/ecom-v1-order-orders.meta.js.map +1 -0
  47. package/build/es/src/ecom-v1-order-orders.public.d.ts +189 -0
  48. package/build/es/src/ecom-v1-order-orders.public.js +302 -0
  49. package/build/es/src/ecom-v1-order-orders.public.js.map +1 -0
  50. package/build/{ecom-v1-order-orders.universal-UflOyGzD.d.ts → es/src/ecom-v1-order-orders.types.d.ts} +637 -1109
  51. package/build/es/src/ecom-v1-order-orders.types.js +648 -0
  52. package/build/es/src/ecom-v1-order-orders.types.js.map +1 -0
  53. package/build/{internal/ecom-v1-order-orders.universal-DkzM7BQ-.d.mts → es/src/ecom-v1-order-orders.universal.d.ts} +985 -957
  54. package/build/es/src/ecom-v1-order-orders.universal.js +2242 -0
  55. package/build/es/src/ecom-v1-order-orders.universal.js.map +1 -0
  56. package/build/internal/cjs/index.d.ts +1 -0
  57. package/build/internal/cjs/index.js +18 -0
  58. package/build/internal/cjs/index.js.map +1 -0
  59. package/build/internal/cjs/index.typings.d.ts +1 -0
  60. package/build/internal/cjs/index.typings.js +18 -0
  61. package/build/internal/cjs/index.typings.js.map +1 -0
  62. package/build/internal/cjs/meta.d.ts +1 -0
  63. package/build/internal/cjs/meta.js +18 -0
  64. package/build/internal/cjs/meta.js.map +1 -0
  65. package/build/internal/cjs/src/ecom-v1-order-orders.context.d.ts +62 -0
  66. package/build/internal/cjs/src/ecom-v1-order-orders.context.js +117 -0
  67. package/build/internal/cjs/src/ecom-v1-order-orders.context.js.map +1 -0
  68. package/build/internal/cjs/src/ecom-v1-order-orders.http.d.ts +200 -0
  69. package/build/internal/cjs/src/ecom-v1-order-orders.http.js +1610 -0
  70. package/build/internal/cjs/src/ecom-v1-order-orders.http.js.map +1 -0
  71. package/build/internal/cjs/src/ecom-v1-order-orders.meta.d.ts +78 -0
  72. package/build/internal/cjs/src/ecom-v1-order-orders.meta.js +503 -0
  73. package/build/internal/cjs/src/ecom-v1-order-orders.meta.js.map +1 -0
  74. package/build/internal/cjs/src/ecom-v1-order-orders.public.d.ts +340 -0
  75. package/build/internal/cjs/src/ecom-v1-order-orders.public.js +382 -0
  76. package/build/internal/cjs/src/ecom-v1-order-orders.public.js.map +1 -0
  77. package/build/internal/cjs/src/ecom-v1-order-orders.types.d.ts +6096 -0
  78. package/build/internal/cjs/src/ecom-v1-order-orders.types.js +652 -0
  79. package/build/internal/cjs/src/ecom-v1-order-orders.types.js.map +1 -0
  80. package/build/internal/cjs/src/ecom-v1-order-orders.universal.d.ts +7750 -0
  81. package/build/internal/cjs/src/ecom-v1-order-orders.universal.js +2294 -0
  82. package/build/internal/cjs/src/ecom-v1-order-orders.universal.js.map +1 -0
  83. package/build/internal/es/index.d.ts +1 -0
  84. package/build/internal/es/index.js +2 -0
  85. package/build/internal/es/index.js.map +1 -0
  86. package/build/internal/es/index.typings.d.ts +1 -0
  87. package/build/internal/es/index.typings.js +2 -0
  88. package/build/internal/es/index.typings.js.map +1 -0
  89. package/build/internal/es/meta.d.ts +1 -0
  90. package/build/internal/es/meta.js +2 -0
  91. package/build/internal/es/meta.js.map +1 -0
  92. package/build/internal/es/src/ecom-v1-order-orders.context.d.ts +62 -0
  93. package/build/internal/es/src/ecom-v1-order-orders.context.js +62 -0
  94. package/build/internal/es/src/ecom-v1-order-orders.context.js.map +1 -0
  95. package/build/internal/es/src/ecom-v1-order-orders.http.d.ts +200 -0
  96. package/build/internal/es/src/ecom-v1-order-orders.http.js +1582 -0
  97. package/build/internal/es/src/ecom-v1-order-orders.http.js.map +1 -0
  98. package/build/internal/es/src/ecom-v1-order-orders.meta.d.ts +78 -0
  99. package/build/internal/es/src/ecom-v1-order-orders.meta.js +452 -0
  100. package/build/internal/es/src/ecom-v1-order-orders.meta.js.map +1 -0
  101. package/build/internal/es/src/ecom-v1-order-orders.public.d.ts +340 -0
  102. package/build/internal/es/src/ecom-v1-order-orders.public.js +302 -0
  103. package/build/internal/es/src/ecom-v1-order-orders.public.js.map +1 -0
  104. package/build/internal/es/src/ecom-v1-order-orders.types.d.ts +6096 -0
  105. package/build/internal/es/src/ecom-v1-order-orders.types.js +648 -0
  106. package/build/internal/es/src/ecom-v1-order-orders.types.js.map +1 -0
  107. package/build/internal/es/src/ecom-v1-order-orders.universal.d.ts +7750 -0
  108. package/build/internal/es/src/ecom-v1-order-orders.universal.js +2242 -0
  109. package/build/internal/es/src/ecom-v1-order-orders.universal.js.map +1 -0
  110. package/package.json +11 -12
  111. package/build/index.d.mts +0 -212
  112. package/build/index.d.ts +0 -212
  113. package/build/index.js +0 -3504
  114. package/build/index.js.map +0 -1
  115. package/build/index.mjs +0 -3401
  116. package/build/index.mjs.map +0 -1
  117. package/build/internal/index.d.mts +0 -391
  118. package/build/internal/index.d.ts +0 -391
  119. package/build/internal/index.js +0 -3504
  120. package/build/internal/index.js.map +0 -1
  121. package/build/internal/index.mjs +0 -3401
  122. package/build/internal/index.mjs.map +0 -1
  123. package/build/internal/meta.d.mts +0 -3192
  124. package/build/internal/meta.d.ts +0 -3192
  125. package/build/internal/meta.js +0 -1941
  126. package/build/internal/meta.js.map +0 -1
  127. package/build/internal/meta.mjs +0 -1890
  128. package/build/internal/meta.mjs.map +0 -1
  129. package/build/meta.d.mts +0 -3192
  130. package/build/meta.d.ts +0 -3192
  131. package/build/meta.js +0 -1941
  132. package/build/meta.js.map +0 -1
  133. package/build/meta.mjs +0 -1890
  134. package/build/meta.mjs.map +0 -1
@@ -0,0 +1,2242 @@
1
+ import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';
2
+ import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys';
3
+ import * as ambassadorWixEcomV1Order from './ecom-v1-order-orders.http.js';
4
+ // @ts-ignore
5
+ import { transformSDKAddressToRESTAddress } from '@wix/sdk-runtime/transformations/address';
6
+ import { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';
7
+ import { transformSDKImageToRESTImage } from '@wix/sdk-runtime/transformations/image';
8
+ import { transformRESTImageToSDKImage } from '@wix/sdk-runtime/transformations/image';
9
+ import { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';
10
+ export var DescriptionLineType;
11
+ (function (DescriptionLineType) {
12
+ /** Unrecognized type. */
13
+ DescriptionLineType["UNRECOGNISED"] = "UNRECOGNISED";
14
+ /** Plain text type. */
15
+ DescriptionLineType["PLAIN_TEXT"] = "PLAIN_TEXT";
16
+ /** Color type. */
17
+ DescriptionLineType["COLOR"] = "COLOR";
18
+ })(DescriptionLineType || (DescriptionLineType = {}));
19
+ export var ItemTypeItemType;
20
+ (function (ItemTypeItemType) {
21
+ ItemTypeItemType["UNRECOGNISED"] = "UNRECOGNISED";
22
+ ItemTypeItemType["PHYSICAL"] = "PHYSICAL";
23
+ ItemTypeItemType["DIGITAL"] = "DIGITAL";
24
+ ItemTypeItemType["GIFT_CARD"] = "GIFT_CARD";
25
+ ItemTypeItemType["SERVICE"] = "SERVICE";
26
+ })(ItemTypeItemType || (ItemTypeItemType = {}));
27
+ /** Type of selected payment option for catalog item */
28
+ export var PaymentOptionType;
29
+ (function (PaymentOptionType) {
30
+ /** The entire payment for this item happens as part of the checkout. */
31
+ PaymentOptionType["FULL_PAYMENT_ONLINE"] = "FULL_PAYMENT_ONLINE";
32
+ /** The entire payment for this item happens after checkout. For example, when using cash, check, or other offline payment methods. */
33
+ PaymentOptionType["FULL_PAYMENT_OFFLINE"] = "FULL_PAYMENT_OFFLINE";
34
+ /** Payment for this item is done by charging a membership. When selected, `price` is `0`. */
35
+ PaymentOptionType["MEMBERSHIP"] = "MEMBERSHIP";
36
+ /** Partial payment to be paid upfront during checkout. The initial amount to be paid for each line item is specified in `depositAmount`. */
37
+ PaymentOptionType["DEPOSIT_ONLINE"] = "DEPOSIT_ONLINE";
38
+ /** 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`. */
39
+ PaymentOptionType["MEMBERSHIP_OFFLINE"] = "MEMBERSHIP_OFFLINE";
40
+ })(PaymentOptionType || (PaymentOptionType = {}));
41
+ /** JurisdictionType represents the type of the jurisdiction in which this tax detail applies (e.g. Country,State,County,City,Special). */
42
+ export var JurisdictionType;
43
+ (function (JurisdictionType) {
44
+ JurisdictionType["UNDEFINED"] = "UNDEFINED";
45
+ JurisdictionType["COUNTRY"] = "COUNTRY";
46
+ JurisdictionType["STATE"] = "STATE";
47
+ JurisdictionType["COUNTY"] = "COUNTY";
48
+ JurisdictionType["CITY"] = "CITY";
49
+ JurisdictionType["SPECIAL"] = "SPECIAL";
50
+ })(JurisdictionType || (JurisdictionType = {}));
51
+ /** Frequency unit of recurring payment */
52
+ export var SubscriptionFrequency;
53
+ (function (SubscriptionFrequency) {
54
+ SubscriptionFrequency["UNDEFINED"] = "UNDEFINED";
55
+ SubscriptionFrequency["DAY"] = "DAY";
56
+ SubscriptionFrequency["WEEK"] = "WEEK";
57
+ SubscriptionFrequency["MONTH"] = "MONTH";
58
+ SubscriptionFrequency["YEAR"] = "YEAR";
59
+ })(SubscriptionFrequency || (SubscriptionFrequency = {}));
60
+ export var AdjustmentType;
61
+ (function (AdjustmentType) {
62
+ AdjustmentType["UNKNOWN_ADJUSTMENT_TYPE"] = "UNKNOWN_ADJUSTMENT_TYPE";
63
+ /** Adjustment increases the total amount due to changes like covering extra billing days. Typically results in an additional fee. */
64
+ AdjustmentType["EXTRA_CHARGE"] = "EXTRA_CHARGE";
65
+ /** Adjustment reduces the total amount due to changes like covering fewer billing days. Typically results in a credit or discount. */
66
+ AdjustmentType["CREDIT"] = "CREDIT";
67
+ })(AdjustmentType || (AdjustmentType = {}));
68
+ export var TaxableAddressType;
69
+ (function (TaxableAddressType) {
70
+ TaxableAddressType["UNKNOWN_TAXABLE_ADDRESS"] = "UNKNOWN_TAXABLE_ADDRESS";
71
+ TaxableAddressType["BUSINESS"] = "BUSINESS";
72
+ TaxableAddressType["BILLING"] = "BILLING";
73
+ TaxableAddressType["SHIPPING"] = "SHIPPING";
74
+ })(TaxableAddressType || (TaxableAddressType = {}));
75
+ export var PaymentStatus;
76
+ (function (PaymentStatus) {
77
+ PaymentStatus["UNSPECIFIED"] = "UNSPECIFIED";
78
+ /**
79
+ * `NOT_PAID` can apply to an order made online, but not yet paid. In such cases `order.status` will be `INITIALIZED`.
80
+ * This status also applies when an offline order needs to be manually marked as paid. In such cases `order.status` will be `APPROVED`.
81
+ */
82
+ PaymentStatus["NOT_PAID"] = "NOT_PAID";
83
+ /** All required payments associated with this order are paid. */
84
+ PaymentStatus["PAID"] = "PAID";
85
+ /** Order partially refunded, but the refunded amount is less than the order's total price. See `order.balanceSummary` for more details. */
86
+ PaymentStatus["PARTIALLY_REFUNDED"] = "PARTIALLY_REFUNDED";
87
+ /** Order fully refunded. Refund amount equals total price. See `order.balanceSummary` for more details. */
88
+ PaymentStatus["FULLY_REFUNDED"] = "FULLY_REFUNDED";
89
+ /**
90
+ * All payments pending.
91
+ *
92
+ * 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.
93
+ * Learn more about [pending orders](https://support.wix.com/en/article/pending-orders).
94
+ */
95
+ PaymentStatus["PENDING"] = "PENDING";
96
+ /** At least one payment received and approved, but it covers less than the order's total price. See `order.balanceSummary` for more details. */
97
+ PaymentStatus["PARTIALLY_PAID"] = "PARTIALLY_PAID";
98
+ /**
99
+ * Payment received, but not yet confirmed by the payment provider.
100
+ *
101
+ * In most cases, when a payment provider is holding payment it's because setup hasn't been successfully completed by the merchant/site owner.
102
+ * 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.
103
+ * @documentationMaturity preview
104
+ */
105
+ PaymentStatus["PENDING_MERCHANT"] = "PENDING_MERCHANT";
106
+ /**
107
+ * One or more payments canceled.
108
+ * @documentationMaturity preview
109
+ */
110
+ PaymentStatus["CANCELED"] = "CANCELED";
111
+ /**
112
+ * One or more payments declined.
113
+ * @documentationMaturity preview
114
+ */
115
+ PaymentStatus["DECLINED"] = "DECLINED";
116
+ })(PaymentStatus || (PaymentStatus = {}));
117
+ export var FulfillmentStatus;
118
+ (function (FulfillmentStatus) {
119
+ /** None of the order items are fulfilled or the order was manually marked as unfulfilled. */
120
+ FulfillmentStatus["NOT_FULFILLED"] = "NOT_FULFILLED";
121
+ /**
122
+ * All of the order items are fulfilled or the order was manually marked as fulfilled.
123
+ * Orders without shipping info are fulfilled automatically.
124
+ */
125
+ FulfillmentStatus["FULFILLED"] = "FULFILLED";
126
+ /** Some, but not all, of the order items are fulfilled. */
127
+ FulfillmentStatus["PARTIALLY_FULFILLED"] = "PARTIALLY_FULFILLED";
128
+ })(FulfillmentStatus || (FulfillmentStatus = {}));
129
+ export var WeightUnit;
130
+ (function (WeightUnit) {
131
+ /** Weight unit can't be classified due to an error. */
132
+ WeightUnit["UNSPECIFIED_WEIGHT_UNIT"] = "UNSPECIFIED_WEIGHT_UNIT";
133
+ /** Kilograms. */
134
+ WeightUnit["KG"] = "KG";
135
+ /** Pounds. */
136
+ WeightUnit["LB"] = "LB";
137
+ })(WeightUnit || (WeightUnit = {}));
138
+ /** tax info types */
139
+ export var VatType;
140
+ (function (VatType) {
141
+ VatType["UNSPECIFIED"] = "UNSPECIFIED";
142
+ /** CPF - for individual tax payers. */
143
+ VatType["CPF"] = "CPF";
144
+ /** CNPJ - for corporations */
145
+ VatType["CNPJ"] = "CNPJ";
146
+ })(VatType || (VatType = {}));
147
+ export var PickupMethod;
148
+ (function (PickupMethod) {
149
+ PickupMethod["UNKNOWN_METHOD"] = "UNKNOWN_METHOD";
150
+ PickupMethod["STORE_PICKUP"] = "STORE_PICKUP";
151
+ PickupMethod["PICKUP_POINT"] = "PICKUP_POINT";
152
+ })(PickupMethod || (PickupMethod = {}));
153
+ export var OrderStatus;
154
+ (function (OrderStatus) {
155
+ /** Order created, but not yet approved or canceled. */
156
+ OrderStatus["INITIALIZED"] = "INITIALIZED";
157
+ /**
158
+ * Order approved.
159
+ *
160
+ * This happens when either an online payment is received **or** when `order.priceSummary.total = 0` (a zero-total order).
161
+ * Offline orders (cash payment) are automatically approved.
162
+ */
163
+ OrderStatus["APPROVED"] = "APPROVED";
164
+ /** Order canceled by the user. */
165
+ OrderStatus["CANCELED"] = "CANCELED";
166
+ /**
167
+ * Order pending.
168
+ * @documentationMaturity preview
169
+ */
170
+ OrderStatus["PENDING"] = "PENDING";
171
+ /**
172
+ * Order rejected.
173
+ *
174
+ * This happens when pending payments fail.
175
+ * @documentationMaturity preview
176
+ */
177
+ OrderStatus["REJECTED"] = "REJECTED";
178
+ })(OrderStatus || (OrderStatus = {}));
179
+ export var DiscountType;
180
+ (function (DiscountType) {
181
+ DiscountType["GLOBAL"] = "GLOBAL";
182
+ DiscountType["SPECIFIC_ITEMS"] = "SPECIFIC_ITEMS";
183
+ DiscountType["SHIPPING"] = "SHIPPING";
184
+ })(DiscountType || (DiscountType = {}));
185
+ export var DiscountReason;
186
+ (function (DiscountReason) {
187
+ DiscountReason["UNSPECIFIED"] = "UNSPECIFIED";
188
+ DiscountReason["EXCHANGED_ITEMS"] = "EXCHANGED_ITEMS";
189
+ DiscountReason["BILLING_ADJUSTMENT"] = "BILLING_ADJUSTMENT";
190
+ })(DiscountReason || (DiscountReason = {}));
191
+ export var LineItemQuantityChangeType;
192
+ (function (LineItemQuantityChangeType) {
193
+ /** Quantity increased. */
194
+ LineItemQuantityChangeType["QUANTITY_INCREASED"] = "QUANTITY_INCREASED";
195
+ /** Quantity decreased. */
196
+ LineItemQuantityChangeType["QUANTITY_DECREASED"] = "QUANTITY_DECREASED";
197
+ })(LineItemQuantityChangeType || (LineItemQuantityChangeType = {}));
198
+ export var ActivityType;
199
+ (function (ActivityType) {
200
+ ActivityType["ORDER_REFUNDED"] = "ORDER_REFUNDED";
201
+ ActivityType["ORDER_PLACED"] = "ORDER_PLACED";
202
+ ActivityType["ORDER_PAID"] = "ORDER_PAID";
203
+ ActivityType["ORDER_FULFILLED"] = "ORDER_FULFILLED";
204
+ ActivityType["ORDER_NOT_FULFILLED"] = "ORDER_NOT_FULFILLED";
205
+ ActivityType["ORDER_CANCELED"] = "ORDER_CANCELED";
206
+ ActivityType["DOWNLOAD_LINK_SENT"] = "DOWNLOAD_LINK_SENT";
207
+ ActivityType["TRACKING_NUMBER_ADDED"] = "TRACKING_NUMBER_ADDED";
208
+ ActivityType["TRACKING_NUMBER_EDITED"] = "TRACKING_NUMBER_EDITED";
209
+ ActivityType["TRACKING_LINK_ADDED"] = "TRACKING_LINK_ADDED";
210
+ ActivityType["SHIPPING_CONFIRMATION_EMAIL_SENT"] = "SHIPPING_CONFIRMATION_EMAIL_SENT";
211
+ ActivityType["INVOICE_ADDED"] = "INVOICE_ADDED";
212
+ ActivityType["INVOICE_REMOVED"] = "INVOICE_REMOVED";
213
+ ActivityType["INVOICE_SENT"] = "INVOICE_SENT";
214
+ ActivityType["FULFILLER_EMAIL_SENT"] = "FULFILLER_EMAIL_SENT";
215
+ ActivityType["SHIPPING_ADDRESS_EDITED"] = "SHIPPING_ADDRESS_EDITED";
216
+ ActivityType["EMAIL_EDITED"] = "EMAIL_EDITED";
217
+ ActivityType["PICKUP_READY_EMAIL_SENT"] = "PICKUP_READY_EMAIL_SENT";
218
+ ActivityType["CUSTOM_ACTIVITY"] = "CUSTOM_ACTIVITY";
219
+ ActivityType["MERCHANT_COMMENT"] = "MERCHANT_COMMENT";
220
+ ActivityType["ORDER_CREATED_FROM_EXCHANGE"] = "ORDER_CREATED_FROM_EXCHANGE";
221
+ ActivityType["NEW_EXCHANGE_ORDER_CREATED"] = "NEW_EXCHANGE_ORDER_CREATED";
222
+ ActivityType["ORDER_PARTIALLY_PAID"] = "ORDER_PARTIALLY_PAID";
223
+ ActivityType["DRAFT_ORDER_CHANGES_APPLIED"] = "DRAFT_ORDER_CHANGES_APPLIED";
224
+ ActivityType["SAVED_PAYMENT_METHOD"] = "SAVED_PAYMENT_METHOD";
225
+ /** @documentationMaturity preview */
226
+ ActivityType["PAYMENT_PENDING"] = "PAYMENT_PENDING";
227
+ /** @documentationMaturity preview */
228
+ ActivityType["PAYMENT_CANCELED"] = "PAYMENT_CANCELED";
229
+ /** @documentationMaturity preview */
230
+ ActivityType["PAYMENT_DECLINED"] = "PAYMENT_DECLINED";
231
+ /** @documentationMaturity preview */
232
+ ActivityType["ORDER_PENDING"] = "ORDER_PENDING";
233
+ /** @documentationMaturity preview */
234
+ ActivityType["ORDER_REJECTED"] = "ORDER_REJECTED";
235
+ })(ActivityType || (ActivityType = {}));
236
+ export var AttributionSource;
237
+ (function (AttributionSource) {
238
+ AttributionSource["UNSPECIFIED"] = "UNSPECIFIED";
239
+ AttributionSource["FACEBOOK_ADS"] = "FACEBOOK_ADS";
240
+ })(AttributionSource || (AttributionSource = {}));
241
+ export var ChannelType;
242
+ (function (ChannelType) {
243
+ /** Unspecified sales channel. This value is not supported. */
244
+ ChannelType["UNSPECIFIED"] = "UNSPECIFIED";
245
+ /** A web client. */
246
+ ChannelType["WEB"] = "WEB";
247
+ /** [Point of sale solutions](https://support.wix.com/en/wix-mobile-pos-2196395). */
248
+ ChannelType["POS"] = "POS";
249
+ /** [eBay shop](https://support.wix.com/en/article/wix-stores-connecting-and-setting-up-an-ebay-shop). */
250
+ ChannelType["EBAY"] = "EBAY";
251
+ /** [Amazon shop](https://support.wix.com/en/article/wix-stores-connecting-and-setting-up-an-amazon-shop). */
252
+ ChannelType["AMAZON"] = "AMAZON";
253
+ /** Other sales platform. */
254
+ ChannelType["OTHER_PLATFORM"] = "OTHER_PLATFORM";
255
+ /** [Wix Owner app](https://support.wix.com/article/wix-owner-app-an-overview). */
256
+ ChannelType["WIX_APP_STORE"] = "WIX_APP_STORE";
257
+ /** 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) */
258
+ ChannelType["WIX_INVOICES"] = "WIX_INVOICES";
259
+ /** Wix merchant backoffice. */
260
+ ChannelType["BACKOFFICE_MERCHANT"] = "BACKOFFICE_MERCHANT";
261
+ /** Wish sales channel. */
262
+ ChannelType["WISH"] = "WISH";
263
+ /** [ClassPass sales channel](https://support.wix.com/en/article/wix-bookings-letting-clients-book-your-services-with-classpass). */
264
+ ChannelType["CLASS_PASS"] = "CLASS_PASS";
265
+ /** Global-E sales channel. */
266
+ ChannelType["GLOBAL_E"] = "GLOBAL_E";
267
+ /** [Facebook shop](https://support.wix.com/en/article/wix-stores-changes-to-facebook-shops). */
268
+ ChannelType["FACEBOOK"] = "FACEBOOK";
269
+ /** [Etsy sales channel](https://support.wix.com/en/article/wix-stores-request-adding-etsy-as-a-sales-channel). */
270
+ ChannelType["ETSY"] = "ETSY";
271
+ /** [TikTok sales channel](https://support.wix.com/en/article/wix-stores-request-adding-tiktok-as-a-sales-channel). */
272
+ ChannelType["TIKTOK"] = "TIKTOK";
273
+ /** [Faire marketplace integration](https://support.wix.com/en/article/wix-stores-creating-a-faire-store-using-the-faire-integration-app). */
274
+ ChannelType["FAIRE_COM"] = "FAIRE_COM";
275
+ })(ChannelType || (ChannelType = {}));
276
+ export var ScheduledAction;
277
+ (function (ScheduledAction) {
278
+ ScheduledAction["UNSPECIFIED"] = "UNSPECIFIED";
279
+ /** Whether payment will be auto-voided when duration passes */
280
+ ScheduledAction["VOID"] = "VOID";
281
+ /** Whether payment will be auto-captured when duration passes */
282
+ ScheduledAction["CAPTURE"] = "CAPTURE";
283
+ })(ScheduledAction || (ScheduledAction = {}));
284
+ export var DurationUnit;
285
+ (function (DurationUnit) {
286
+ DurationUnit["UNKNOWN_DURATION_UNIT"] = "UNKNOWN_DURATION_UNIT";
287
+ DurationUnit["MINUTES"] = "MINUTES";
288
+ DurationUnit["HOURS"] = "HOURS";
289
+ DurationUnit["DAYS"] = "DAYS";
290
+ })(DurationUnit || (DurationUnit = {}));
291
+ export var PaymentCollectabilityStatus;
292
+ (function (PaymentCollectabilityStatus) {
293
+ PaymentCollectabilityStatus["UNKNOWN"] = "UNKNOWN";
294
+ PaymentCollectabilityStatus["COLLECTABLE"] = "COLLECTABLE";
295
+ PaymentCollectabilityStatus["NONCOLLECTABLE_ORDER_IS_CANCELLED"] = "NONCOLLECTABLE_ORDER_IS_CANCELLED";
296
+ PaymentCollectabilityStatus["NONCOLLECTABLE_ORDER_IS_PAID"] = "NONCOLLECTABLE_ORDER_IS_PAID";
297
+ PaymentCollectabilityStatus["NONCOLLECTABLE_MISSING_PAYMENT_METHOD"] = "NONCOLLECTABLE_MISSING_PAYMENT_METHOD";
298
+ PaymentCollectabilityStatus["NONCOLLECTABLE_ORDER_IS_PENDING"] = "NONCOLLECTABLE_ORDER_IS_PENDING";
299
+ PaymentCollectabilityStatus["NONCOLLECTABLE_ORDER_IS_REJECTED"] = "NONCOLLECTABLE_ORDER_IS_REJECTED";
300
+ PaymentCollectabilityStatus["NONCOLLECTABLE_ORDER_HAS_SUBSCRIPTIONS"] = "NONCOLLECTABLE_ORDER_HAS_SUBSCRIPTIONS";
301
+ })(PaymentCollectabilityStatus || (PaymentCollectabilityStatus = {}));
302
+ export var RefundableStatus;
303
+ (function (RefundableStatus) {
304
+ RefundableStatus["NOT_REFUNDABLE"] = "NOT_REFUNDABLE";
305
+ RefundableStatus["MANUAL"] = "MANUAL";
306
+ RefundableStatus["REFUNDABLE"] = "REFUNDABLE";
307
+ })(RefundableStatus || (RefundableStatus = {}));
308
+ export var NonRefundableReason;
309
+ (function (NonRefundableReason) {
310
+ NonRefundableReason["NONE"] = "NONE";
311
+ NonRefundableReason["ALREADY_REFUNDED"] = "ALREADY_REFUNDED";
312
+ NonRefundableReason["PROVIDER_IS_DOWN"] = "PROVIDER_IS_DOWN";
313
+ NonRefundableReason["INTERNAL_ERROR"] = "INTERNAL_ERROR";
314
+ NonRefundableReason["NOT_PAID"] = "NOT_PAID";
315
+ NonRefundableReason["ACCESS_DENIED"] = "ACCESS_DENIED";
316
+ NonRefundableReason["ZERO_PRICE"] = "ZERO_PRICE";
317
+ NonRefundableReason["DISABLED_BY_PROVIDER"] = "DISABLED_BY_PROVIDER";
318
+ NonRefundableReason["PENDING_REFUND"] = "PENDING_REFUND";
319
+ NonRefundableReason["FORBIDDEN"] = "FORBIDDEN";
320
+ NonRefundableReason["TRANSACTION_NOT_FOUND"] = "TRANSACTION_NOT_FOUND";
321
+ NonRefundableReason["ORDER_IS_PENDING"] = "ORDER_IS_PENDING";
322
+ NonRefundableReason["ORDER_IS_REJECTED"] = "ORDER_IS_REJECTED";
323
+ })(NonRefundableReason || (NonRefundableReason = {}));
324
+ export var ManuallyRefundableReason;
325
+ (function (ManuallyRefundableReason) {
326
+ ManuallyRefundableReason["EXPIRED"] = "EXPIRED";
327
+ ManuallyRefundableReason["NOT_SUPPORTED"] = "NOT_SUPPORTED";
328
+ ManuallyRefundableReason["OFFLINE"] = "OFFLINE";
329
+ ManuallyRefundableReason["REQUIRES_CARD_READER"] = "REQUIRES_CARD_READER";
330
+ })(ManuallyRefundableReason || (ManuallyRefundableReason = {}));
331
+ export var RestockType;
332
+ (function (RestockType) {
333
+ RestockType["NO_ITEMS"] = "NO_ITEMS";
334
+ RestockType["ALL_ITEMS"] = "ALL_ITEMS";
335
+ RestockType["SOME_ITEMS"] = "SOME_ITEMS";
336
+ })(RestockType || (RestockType = {}));
337
+ export var TransactionStatus;
338
+ (function (TransactionStatus) {
339
+ TransactionStatus["UNDEFINED"] = "UNDEFINED";
340
+ TransactionStatus["APPROVED"] = "APPROVED";
341
+ TransactionStatus["PENDING"] = "PENDING";
342
+ TransactionStatus["PENDING_MERCHANT"] = "PENDING_MERCHANT";
343
+ TransactionStatus["CANCELED"] = "CANCELED";
344
+ TransactionStatus["DECLINED"] = "DECLINED";
345
+ TransactionStatus["REFUNDED"] = "REFUNDED";
346
+ TransactionStatus["PARTIALLY_REFUNDED"] = "PARTIALLY_REFUNDED";
347
+ TransactionStatus["AUTHORIZED"] = "AUTHORIZED";
348
+ TransactionStatus["VOIDED"] = "VOIDED";
349
+ })(TransactionStatus || (TransactionStatus = {}));
350
+ export var AuthorizationCaptureStatus;
351
+ (function (AuthorizationCaptureStatus) {
352
+ AuthorizationCaptureStatus["UNKNOWN_STATUS"] = "UNKNOWN_STATUS";
353
+ /** Capture operation still in progress. */
354
+ AuthorizationCaptureStatus["PENDING"] = "PENDING";
355
+ /** Capture operation succeeded. */
356
+ AuthorizationCaptureStatus["SUCCEEDED"] = "SUCCEEDED";
357
+ /** Capture operation failed. */
358
+ AuthorizationCaptureStatus["FAILED"] = "FAILED";
359
+ })(AuthorizationCaptureStatus || (AuthorizationCaptureStatus = {}));
360
+ export var AuthorizationVoidStatus;
361
+ (function (AuthorizationVoidStatus) {
362
+ AuthorizationVoidStatus["UNKNOWN_STATUS"] = "UNKNOWN_STATUS";
363
+ /** Void operation still in progress. */
364
+ AuthorizationVoidStatus["PENDING"] = "PENDING";
365
+ /** Void operation succeeded. */
366
+ AuthorizationVoidStatus["SUCCEEDED"] = "SUCCEEDED";
367
+ /** Void operation failed. */
368
+ AuthorizationVoidStatus["FAILED"] = "FAILED";
369
+ })(AuthorizationVoidStatus || (AuthorizationVoidStatus = {}));
370
+ /** Reason the authorization was voided. */
371
+ export var Reason;
372
+ (function (Reason) {
373
+ Reason["UNKNOWN_REASON"] = "UNKNOWN_REASON";
374
+ /** Authorization was voided by user. */
375
+ Reason["MANUAL"] = "MANUAL";
376
+ /** Authorization passed execution date. */
377
+ Reason["SCHEDULED"] = "SCHEDULED";
378
+ })(Reason || (Reason = {}));
379
+ export var ActionType;
380
+ (function (ActionType) {
381
+ ActionType["UNKNOWN_ACTION_TYPE"] = "UNKNOWN_ACTION_TYPE";
382
+ ActionType["VOID"] = "VOID";
383
+ ActionType["CAPTURE"] = "CAPTURE";
384
+ })(ActionType || (ActionType = {}));
385
+ export var MembershipPaymentStatus;
386
+ (function (MembershipPaymentStatus) {
387
+ /** Payment was charged. */
388
+ MembershipPaymentStatus["CHARGED"] = "CHARGED";
389
+ /** The attempt to charge the payment failed, for example, due to lack of credits. */
390
+ MembershipPaymentStatus["CHARGE_FAILED"] = "CHARGE_FAILED";
391
+ })(MembershipPaymentStatus || (MembershipPaymentStatus = {}));
392
+ /** Refund transaction status. */
393
+ export var RefundStatus;
394
+ (function (RefundStatus) {
395
+ /** Refund was initiated on payment provider side. PENDING status was assigned by provider. */
396
+ RefundStatus["PENDING"] = "PENDING";
397
+ /** Refund transaction succeeded. */
398
+ RefundStatus["SUCCEEDED"] = "SUCCEEDED";
399
+ /** Refund transaction failed. */
400
+ RefundStatus["FAILED"] = "FAILED";
401
+ /** Refund request acknowledged, and will be executed soon. */
402
+ RefundStatus["SCHEDULED"] = "SCHEDULED";
403
+ /** Refund was initiated on payment provider side. */
404
+ RefundStatus["STARTED"] = "STARTED";
405
+ })(RefundStatus || (RefundStatus = {}));
406
+ export var WebhookIdentityType;
407
+ (function (WebhookIdentityType) {
408
+ WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
409
+ WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
410
+ WebhookIdentityType["MEMBER"] = "MEMBER";
411
+ WebhookIdentityType["WIX_USER"] = "WIX_USER";
412
+ WebhookIdentityType["APP"] = "APP";
413
+ })(WebhookIdentityType || (WebhookIdentityType = {}));
414
+ export var TextDetection;
415
+ (function (TextDetection) {
416
+ /** No detection was made */
417
+ TextDetection["UNKNOWN_TEXT_DETECTION"] = "UNKNOWN_TEXT_DETECTION";
418
+ /** The image contains text */
419
+ TextDetection["CONTAINS_TEXT"] = "CONTAINS_TEXT";
420
+ /** The image does not contain text */
421
+ TextDetection["NO_TEXT"] = "NO_TEXT";
422
+ })(TextDetection || (TextDetection = {}));
423
+ export var AnimationDetection;
424
+ (function (AnimationDetection) {
425
+ /** No detection was made */
426
+ AnimationDetection["UNKNOWN_ANIMATION_DETECTION"] = "UNKNOWN_ANIMATION_DETECTION";
427
+ /** The image contains animation */
428
+ AnimationDetection["CONTAINS_ANIMATION"] = "CONTAINS_ANIMATION";
429
+ /** The image does not contain animation */
430
+ AnimationDetection["NO_ANIMATION"] = "NO_ANIMATION";
431
+ })(AnimationDetection || (AnimationDetection = {}));
432
+ export var PreviewEmailType;
433
+ (function (PreviewEmailType) {
434
+ PreviewEmailType["ORDER_PLACED"] = "ORDER_PLACED";
435
+ PreviewEmailType["DOWNLOAD_LINKS"] = "DOWNLOAD_LINKS";
436
+ PreviewEmailType["ORDER_SHIPPED"] = "ORDER_SHIPPED";
437
+ PreviewEmailType["ORDER_READY_FOR_PICKUP"] = "ORDER_READY_FOR_PICKUP";
438
+ })(PreviewEmailType || (PreviewEmailType = {}));
439
+ /**
440
+ * Represents the actual state of the application on site. Do not confuse with the State in the old MetaSiteDTO,
441
+ * which has less values and doesn't have 1-to-1 correspondence with this one (this one is exact and correct!)
442
+ */
443
+ export var State;
444
+ (function (State) {
445
+ State["UNKNOWN"] = "UNKNOWN";
446
+ /** App is installed on a site. */
447
+ State["ENABLED"] = "ENABLED";
448
+ /** App is removed from a site (but we preserve it just in case). */
449
+ State["DISABLED"] = "DISABLED";
450
+ /** App is in "demo" mode, meaning that it's in read-only mode (it's in a template OR not installed yet). */
451
+ State["TEMPLATE"] = "TEMPLATE";
452
+ /** App is not installed, there is a user intention for it only (user will see the pimpl in the editor). */
453
+ State["PENDING"] = "PENDING";
454
+ })(State || (State = {}));
455
+ export var Namespace;
456
+ (function (Namespace) {
457
+ Namespace["UNKNOWN_NAMESPACE"] = "UNKNOWN_NAMESPACE";
458
+ /** Default namespace for UGC sites. MetaSites with this namespace will be shown in a user's site list by default. */
459
+ Namespace["WIX"] = "WIX";
460
+ /** ShoutOut stand alone product. These are siteless (no actual Wix site, no HtmlWeb). MetaSites with this namespace will *not* be shown in a user's site list by default. */
461
+ Namespace["SHOUT_OUT"] = "SHOUT_OUT";
462
+ /** MetaSites created by the Albums product, they appear as part of the Albums app. MetaSites with this namespace will *not* be shown in a user's site list by default. */
463
+ Namespace["ALBUMS"] = "ALBUMS";
464
+ /** Part of the WixStores migration flow, a user tries to migrate and gets this site to view and if the user likes it then stores removes this namespace and deletes the old site with the old stores. MetaSites with this namespace will *not* be shown in a user's site list by default. */
465
+ Namespace["WIX_STORES_TEST_DRIVE"] = "WIX_STORES_TEST_DRIVE";
466
+ /** Hotels standalone (siteless). MetaSites with this namespace will *not* be shown in a user's site list by default. */
467
+ Namespace["HOTELS"] = "HOTELS";
468
+ /** Clubs siteless MetaSites, a club without a wix website. MetaSites with this namespace will *not* be shown in a user's site list by default. */
469
+ Namespace["CLUBS"] = "CLUBS";
470
+ /** A partially created ADI website. MetaSites with this namespace will *not* be shown in a user's site list by default. */
471
+ Namespace["ONBOARDING_DRAFT"] = "ONBOARDING_DRAFT";
472
+ /** AppBuilder for AppStudio / shmite (c). MetaSites with this namespace will *not* be shown in a user's site list by default. */
473
+ Namespace["DEV_SITE"] = "DEV_SITE";
474
+ /** LogoMaker websites offered to the user after logo purchase. MetaSites with this namespace will *not* be shown in a user's site list by default. */
475
+ Namespace["LOGOS"] = "LOGOS";
476
+ /** VideoMaker websites offered to the user after video purchase. MetaSites with this namespace will *not* be shown in a user's site list by default. */
477
+ Namespace["VIDEO_MAKER"] = "VIDEO_MAKER";
478
+ /** MetaSites with this namespace will *not* be shown in a user's site list by default. */
479
+ Namespace["PARTNER_DASHBOARD"] = "PARTNER_DASHBOARD";
480
+ /** MetaSites with this namespace will *not* be shown in a user's site list by default. */
481
+ Namespace["DEV_CENTER_COMPANY"] = "DEV_CENTER_COMPANY";
482
+ /**
483
+ * A draft created by HTML editor on open. Upon "first save" it will be moved to be of WIX domain.
484
+ *
485
+ * Meta site with this namespace will *not* be shown in a user's site list by default.
486
+ */
487
+ Namespace["HTML_DRAFT"] = "HTML_DRAFT";
488
+ /**
489
+ * the user-journey for Fitness users who want to start from managing their business instead of designing their website.
490
+ * Will be accessible from Site List and will not have a website app.
491
+ * Once the user attaches a site, the site will become a regular wixsite.
492
+ */
493
+ Namespace["SITELESS_BUSINESS"] = "SITELESS_BUSINESS";
494
+ /** Belongs to "strategic products" company. Supports new product in the creator's economy space. */
495
+ Namespace["CREATOR_ECONOMY"] = "CREATOR_ECONOMY";
496
+ /** It is to be used in the Business First efforts. */
497
+ Namespace["DASHBOARD_FIRST"] = "DASHBOARD_FIRST";
498
+ /** Bookings business flow with no site. */
499
+ Namespace["ANYWHERE"] = "ANYWHERE";
500
+ /** Namespace for Headless Backoffice with no editor */
501
+ Namespace["HEADLESS"] = "HEADLESS";
502
+ /**
503
+ * Namespace for master site that will exist in parent account that will be referenced by subaccounts
504
+ * The site will be used for account level CSM feature for enterprise
505
+ */
506
+ Namespace["ACCOUNT_MASTER_CMS"] = "ACCOUNT_MASTER_CMS";
507
+ /** Rise.ai Siteless account management for Gift Cards and Store Credit. */
508
+ Namespace["RISE"] = "RISE";
509
+ /**
510
+ * As part of the branded app new funnel, users now can create a meta site that will be branded app first.
511
+ * There's a blank site behind the scene but it's blank).
512
+ * The Mobile company will be the owner of this namespace.
513
+ */
514
+ Namespace["BRANDED_FIRST"] = "BRANDED_FIRST";
515
+ /** Nownia.com Siteless account management for Ai Scheduling Assistant. */
516
+ Namespace["NOWNIA"] = "NOWNIA";
517
+ /**
518
+ * UGC Templates are templates that are created by users for personal use and to sale to other users.
519
+ * The Partners company owns this namespace.
520
+ */
521
+ Namespace["UGC_TEMPLATE"] = "UGC_TEMPLATE";
522
+ /** Codux Headless Sites */
523
+ Namespace["CODUX"] = "CODUX";
524
+ /** Bobb - AI Design Creator. */
525
+ Namespace["MEDIA_DESIGN_CREATOR"] = "MEDIA_DESIGN_CREATOR";
526
+ /**
527
+ * Shared Blog Site is a unique single site across Enterprise account,
528
+ * This site will hold all Blog posts related to the Marketing product.
529
+ */
530
+ Namespace["SHARED_BLOG_ENTERPRISE"] = "SHARED_BLOG_ENTERPRISE";
531
+ /** Standalone forms (siteless). MetaSites with this namespace will *not* be shown in a user's site list by default. */
532
+ Namespace["STANDALONE_FORMS"] = "STANDALONE_FORMS";
533
+ /** Standalone events (siteless). MetaSites with this namespace will *not* be shown in a user's site list by default. */
534
+ Namespace["STANDALONE_EVENTS"] = "STANDALONE_EVENTS";
535
+ /** MIMIR - Siteless account for MIMIR Ai Job runner. */
536
+ Namespace["MIMIR"] = "MIMIR";
537
+ })(Namespace || (Namespace = {}));
538
+ export var SortOrder;
539
+ (function (SortOrder) {
540
+ SortOrder["ASC"] = "ASC";
541
+ SortOrder["DESC"] = "DESC";
542
+ })(SortOrder || (SortOrder = {}));
543
+ export var VersioningMode;
544
+ (function (VersioningMode) {
545
+ /** use default versioning mode agreed with search team */
546
+ VersioningMode["DEFAULT"] = "DEFAULT";
547
+ /** execute only if version is greater than existing */
548
+ VersioningMode["GREATER_THAN"] = "GREATER_THAN";
549
+ /** execute only if version is greater or equal to existing */
550
+ VersioningMode["GREATER_OR_EQUAL"] = "GREATER_OR_EQUAL";
551
+ })(VersioningMode || (VersioningMode = {}));
552
+ export var OrderApprovalStrategy;
553
+ (function (OrderApprovalStrategy) {
554
+ /** Order is automatically approved when `order.priceSummary.total = 0`, **or** after receiving payment. */
555
+ OrderApprovalStrategy["DEFAULT"] = "DEFAULT";
556
+ /** Order is automatically approved **only** after receiving payment. */
557
+ OrderApprovalStrategy["PAYMENT_RECEIVED"] = "PAYMENT_RECEIVED";
558
+ /** Order is automatically approved when payment method is saved for it. */
559
+ OrderApprovalStrategy["PAYMENT_METHOD_SAVED"] = "PAYMENT_METHOD_SAVED";
560
+ })(OrderApprovalStrategy || (OrderApprovalStrategy = {}));
561
+ /** Type of selected payment option for catalog item */
562
+ export var DeltaPaymentOptionType;
563
+ (function (DeltaPaymentOptionType) {
564
+ /** Irrelevant */
565
+ DeltaPaymentOptionType["UNKNOWN_PAYMENT_OPTION"] = "UNKNOWN_PAYMENT_OPTION";
566
+ /** The entire payment for the given item will happen after checkout. */
567
+ DeltaPaymentOptionType["FULL_PAYMENT_OFFLINE"] = "FULL_PAYMENT_OFFLINE";
568
+ /**
569
+ * Payment for this item can only be done using a membership and must be manually redeemed in the dashboard by the site owner.
570
+ * Note: when this option is used, the price will be 0.
571
+ */
572
+ DeltaPaymentOptionType["MEMBERSHIP_OFFLINE"] = "MEMBERSHIP_OFFLINE";
573
+ })(DeltaPaymentOptionType || (DeltaPaymentOptionType = {}));
574
+ export var InventoryAction;
575
+ (function (InventoryAction) {
576
+ /** Restock inventory */
577
+ InventoryAction["RESTOCK"] = "RESTOCK";
578
+ /** Decrease inventory. Without failing on negative inventory. */
579
+ InventoryAction["DECREASE"] = "DECREASE";
580
+ })(InventoryAction || (InventoryAction = {}));
581
+ export var Placement;
582
+ (function (Placement) {
583
+ Placement["Unknown"] = "Unknown";
584
+ Placement["Replace"] = "Replace";
585
+ Placement["Before"] = "Before";
586
+ Placement["After"] = "After";
587
+ })(Placement || (Placement = {}));
588
+ export var SubdivisionType;
589
+ (function (SubdivisionType) {
590
+ SubdivisionType["UNKNOWN_SUBDIVISION_TYPE"] = "UNKNOWN_SUBDIVISION_TYPE";
591
+ /** State */
592
+ SubdivisionType["ADMINISTRATIVE_AREA_LEVEL_1"] = "ADMINISTRATIVE_AREA_LEVEL_1";
593
+ /** County */
594
+ SubdivisionType["ADMINISTRATIVE_AREA_LEVEL_2"] = "ADMINISTRATIVE_AREA_LEVEL_2";
595
+ /** City/town */
596
+ SubdivisionType["ADMINISTRATIVE_AREA_LEVEL_3"] = "ADMINISTRATIVE_AREA_LEVEL_3";
597
+ /** Neighborhood/quarter */
598
+ SubdivisionType["ADMINISTRATIVE_AREA_LEVEL_4"] = "ADMINISTRATIVE_AREA_LEVEL_4";
599
+ /** Street/block */
600
+ SubdivisionType["ADMINISTRATIVE_AREA_LEVEL_5"] = "ADMINISTRATIVE_AREA_LEVEL_5";
601
+ /** ADMINISTRATIVE_AREA_LEVEL_0. Indicates the national political entity, and is typically the highest order type returned by the Geocoder. */
602
+ SubdivisionType["COUNTRY"] = "COUNTRY";
603
+ })(SubdivisionType || (SubdivisionType = {}));
604
+ export var SourceType;
605
+ (function (SourceType) {
606
+ SourceType["UNKNOWN_SOURCE_TYPE"] = "UNKNOWN_SOURCE_TYPE";
607
+ SourceType["WIX_APP"] = "WIX_APP";
608
+ SourceType["EXTERNAL"] = "EXTERNAL";
609
+ SourceType["ADMIN"] = "ADMIN";
610
+ SourceType["OTHER"] = "OTHER";
611
+ })(SourceType || (SourceType = {}));
612
+ export var CustomFieldGroup;
613
+ (function (CustomFieldGroup) {
614
+ CustomFieldGroup["UNKNOWN_CUSTOM_FIELD_GROUP"] = "UNKNOWN_CUSTOM_FIELD_GROUP";
615
+ CustomFieldGroup["BUSINESS_DETAILS"] = "BUSINESS_DETAILS";
616
+ CustomFieldGroup["CUSTOMER_DETAILS"] = "CUSTOMER_DETAILS";
617
+ CustomFieldGroup["DOCUMENT"] = "DOCUMENT";
618
+ CustomFieldGroup["FOOTER"] = "FOOTER";
619
+ CustomFieldGroup["OTHER"] = "OTHER";
620
+ })(CustomFieldGroup || (CustomFieldGroup = {}));
621
+ export var ValueType;
622
+ (function (ValueType) {
623
+ ValueType["UNKNOWN_VALUE_TYPE"] = "UNKNOWN_VALUE_TYPE";
624
+ ValueType["STRING"] = "STRING";
625
+ ValueType["DATE"] = "DATE";
626
+ ValueType["BOOLEAN"] = "BOOLEAN";
627
+ ValueType["NUMBER"] = "NUMBER";
628
+ })(ValueType || (ValueType = {}));
629
+ export var DepositType;
630
+ (function (DepositType) {
631
+ DepositType["UNKNOWN"] = "UNKNOWN";
632
+ DepositType["FLAT"] = "FLAT";
633
+ DepositType["PERCENTAGE"] = "PERCENTAGE";
634
+ })(DepositType || (DepositType = {}));
635
+ /**
636
+ * InvoiceStatus allowed transitions based on current status:
637
+ * Draft -> Deleted, Paid, Partially Paid, Sent
638
+ * Sent -> Draft, Deleted, Void, Paid, Partially Paid, Processing, (Overdue)
639
+ * Processing -> PartiallyPaid, Paid, Sent
640
+ * Paid -> Void
641
+ * PartiallyPaid -> Void, (PartialAndOverdue)
642
+ * Void -> Deleted
643
+ * Deleted
644
+ */
645
+ export var InvoiceStatus;
646
+ (function (InvoiceStatus) {
647
+ InvoiceStatus["Draft"] = "Draft";
648
+ InvoiceStatus["Sent"] = "Sent";
649
+ InvoiceStatus["Processing"] = "Processing";
650
+ InvoiceStatus["Paid"] = "Paid";
651
+ InvoiceStatus["Overdue"] = "Overdue";
652
+ InvoiceStatus["Void"] = "Void";
653
+ InvoiceStatus["Deleted"] = "Deleted";
654
+ InvoiceStatus["PartiallyPaid"] = "PartiallyPaid";
655
+ InvoiceStatus["PartialAndOverdue"] = "PartialAndOverdue";
656
+ })(InvoiceStatus || (InvoiceStatus = {}));
657
+ /**
658
+ * Prepares payment collection for given ecom order. This is the first of 2-step process of payment collection.
659
+ * Here we ensure that payment collection is possible for given order and store and prepare payment gateway order for future charge.
660
+ * 2nd step is an actual charge of prepared payment gateway order. This could be done either
661
+ * via Wix-Cashier's API (https://bo.wix.com/wix-docs/rest/wix-cashier/pay/charge/charge-for-order)
662
+ * or using Cashier Payments Widget (https://github.com/wix-private/cashier-client/tree/master/packages/cashier-payments-widget)
663
+ * @param ecomOrderId - Ecom order ID.
664
+ * @param amount - Amount to collect
665
+ * @public
666
+ * @documentationMaturity preview
667
+ * @requiredField amount
668
+ * @requiredField ecomOrderId
669
+ * @permissionId ECOM.COLLECT_PAYMENTS
670
+ * @permissionScope Manage Restaurants - all permissions
671
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
672
+ * @permissionScope Picasso private app mega scope
673
+ * @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
674
+ * @applicableIdentity APP
675
+ * @fqn com.wix.ecom.orders.payments_collector.v1.PaymentsCollector.PreparePaymentCollection
676
+ */
677
+ export async function preparePaymentCollection(ecomOrderId, amount, options) {
678
+ // @ts-ignore
679
+ const { httpClient, sideEffects } = arguments[3];
680
+ const payload = renameKeysFromSDKRequestToRESTRequest({
681
+ ecomOrderId: ecomOrderId,
682
+ amount: amount,
683
+ paymentGatewayOrderId: options?.paymentGatewayOrderId,
684
+ delayedCapture: options?.delayedCapture,
685
+ delayedCaptureSettings: options?.delayedCaptureSettings,
686
+ });
687
+ const reqOpts = ambassadorWixEcomV1Order.preparePaymentCollection(payload);
688
+ sideEffects?.onSiteCall?.();
689
+ try {
690
+ const result = await httpClient.request(reqOpts);
691
+ sideEffects?.onSuccess?.(result);
692
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
693
+ }
694
+ catch (err) {
695
+ const transformedError = sdkTransformError(err, {
696
+ spreadPathsToArguments: {},
697
+ explicitPathsToArguments: {
698
+ ecomOrderId: '$[0]',
699
+ amount: '$[1]',
700
+ paymentGatewayOrderId: '$[2].paymentGatewayOrderId',
701
+ delayedCapture: '$[2].delayedCapture',
702
+ delayedCaptureSettings: '$[2].delayedCaptureSettings',
703
+ },
704
+ singleArgumentUnchanged: false,
705
+ }, ['ecomOrderId', 'amount', 'options']);
706
+ sideEffects?.onError?.(err);
707
+ throw transformedError;
708
+ }
709
+ }
710
+ /**
711
+ * Provides payment collectability status for given order. If payment collection is possible
712
+ * response will contain collectable amount for given ecom order. If not - response will contain
713
+ * reason why payment collection is not possible.
714
+ * @param ecomOrderId - Ecom order ID.
715
+ * @public
716
+ * @documentationMaturity preview
717
+ * @requiredField ecomOrderId
718
+ * @permissionId ECOM.COLLECT_PAYMENTS
719
+ * @permissionScope Manage Restaurants - all permissions
720
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
721
+ * @permissionScope Picasso private app mega scope
722
+ * @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
723
+ * @applicableIdentity APP
724
+ * @fqn com.wix.ecom.orders.payments_collector.v1.PaymentsCollector.GetPaymentCollectabilityStatus
725
+ */
726
+ export async function getPaymentCollectabilityStatus(ecomOrderId) {
727
+ // @ts-ignore
728
+ const { httpClient, sideEffects } = arguments[1];
729
+ const payload = renameKeysFromSDKRequestToRESTRequest({
730
+ ecomOrderId: ecomOrderId,
731
+ });
732
+ const reqOpts = ambassadorWixEcomV1Order.getPaymentCollectabilityStatus(payload);
733
+ sideEffects?.onSiteCall?.();
734
+ try {
735
+ const result = await httpClient.request(reqOpts);
736
+ sideEffects?.onSuccess?.(result);
737
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
738
+ }
739
+ catch (err) {
740
+ const transformedError = sdkTransformError(err, {
741
+ spreadPathsToArguments: {},
742
+ explicitPathsToArguments: { ecomOrderId: '$[0]' },
743
+ singleArgumentUnchanged: false,
744
+ }, ['ecomOrderId']);
745
+ sideEffects?.onError?.(err);
746
+ throw transformedError;
747
+ }
748
+ }
749
+ /**
750
+ * Records and approves new manual payment with provided custom amount on given order.
751
+ * Existing pending payments are ignored.
752
+ * Custom amount is expected to be less or equal remaining amount to be paid on order (affected by approved payments, refunds and gift card payments)
753
+ * @param orderId - Order ID.
754
+ * @param amount - Amount to be recorded as approved manual payment for given order
755
+ * @internal
756
+ * @documentationMaturity preview
757
+ * @requiredField amount
758
+ * @requiredField orderId
759
+ * @permissionId ECOM.COLLECT_PAYMENTS
760
+ * @permissionScope Manage Restaurants - all permissions
761
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
762
+ * @permissionScope Picasso private app mega scope
763
+ * @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
764
+ * @applicableIdentity APP
765
+ * @fqn com.wix.ecom.orders.payments_collector.v1.PaymentsCollector.RecordManuallyCollectedPayment
766
+ */
767
+ export async function recordManuallyCollectedPayment(orderId, amount) {
768
+ // @ts-ignore
769
+ const { httpClient, sideEffects } = arguments[2];
770
+ const payload = renameKeysFromSDKRequestToRESTRequest({
771
+ orderId: orderId,
772
+ amount: amount,
773
+ });
774
+ const reqOpts = ambassadorWixEcomV1Order.recordManuallyCollectedPayment(payload);
775
+ sideEffects?.onSiteCall?.();
776
+ try {
777
+ const result = await httpClient.request(reqOpts);
778
+ sideEffects?.onSuccess?.(result);
779
+ }
780
+ catch (err) {
781
+ const transformedError = sdkTransformError(err, {
782
+ spreadPathsToArguments: {},
783
+ explicitPathsToArguments: { orderId: '$[0]', amount: '$[1]' },
784
+ singleArgumentUnchanged: false,
785
+ }, ['orderId', 'amount']);
786
+ sideEffects?.onError?.(err);
787
+ throw transformedError;
788
+ }
789
+ }
790
+ /**
791
+ * Marks the order as paid. `order.paymentStatus` field *eventually* changes to `PAID`.
792
+ * In case the order already has an offline payment transaction associated with it
793
+ * (usually when manual payment method is chosen at checkout) - This transaction will become approved.
794
+ * In case the order has no payment transactions associated with it
795
+ * (usually when the item is set to be paid offline after checkout or when an order is created from the backoffice) - A payment transaction
796
+ * will be created and approved.
797
+ * @param ecomOrderId - Ecom order ID.
798
+ * @internal
799
+ * @documentationMaturity preview
800
+ * @requiredField ecomOrderId
801
+ * @permissionId ECOM.MODIFY_ORDERS
802
+ * @permissionScope Manage Stores - all permissions
803
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
804
+ * @permissionScope Manage Restaurants - all permissions
805
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
806
+ * @permissionScope Manage eCommerce - all permissions
807
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
808
+ * @permissionScope Picasso private app mega scope
809
+ * @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
810
+ * @permissionScope Manage Orders
811
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
812
+ * @applicableIdentity APP
813
+ * @fqn com.wix.ecom.orders.payments_collector.v1.PaymentsCollector.MarkOrderAsPaid
814
+ */
815
+ export async function paymentCollectionMarkOrderAsPaid(ecomOrderId) {
816
+ // @ts-ignore
817
+ const { httpClient, sideEffects } = arguments[1];
818
+ const payload = renameKeysFromSDKRequestToRESTRequest({
819
+ ecomOrderId: ecomOrderId,
820
+ });
821
+ const reqOpts = ambassadorWixEcomV1Order.paymentCollectionMarkOrderAsPaid(payload);
822
+ sideEffects?.onSiteCall?.();
823
+ try {
824
+ const result = await httpClient.request(reqOpts);
825
+ sideEffects?.onSuccess?.(result);
826
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
827
+ {
828
+ transformFn: transformRESTImageToSDKImage,
829
+ paths: [{ path: 'order.lineItems.image' }],
830
+ },
831
+ {
832
+ transformFn: transformRESTAddressToSDKAddress,
833
+ paths: [
834
+ { path: 'order.billingInfo.address' },
835
+ {
836
+ path: 'order.shippingInfo.logistics.shippingDestination.address',
837
+ },
838
+ { path: 'order.shippingInfo.logistics.pickupDetails.address' },
839
+ { path: 'order.recipientInfo.address' },
840
+ ],
841
+ },
842
+ ]));
843
+ }
844
+ catch (err) {
845
+ const transformedError = sdkTransformError(err, {
846
+ spreadPathsToArguments: {},
847
+ explicitPathsToArguments: { ecomOrderId: '$[0]' },
848
+ singleArgumentUnchanged: false,
849
+ }, ['ecomOrderId']);
850
+ sideEffects?.onError?.(err);
851
+ throw transformedError;
852
+ }
853
+ }
854
+ /**
855
+ * Marks multiple orders as paid. `order.paymentStatus` field *eventually* changes to `PAID`.
856
+ * @param ecomOrderIds - IDs of orders to mark as paid.
857
+ * @internal
858
+ * @documentationMaturity preview
859
+ * @requiredField ecomOrderIds
860
+ * @permissionId ECOM.MODIFY_ORDERS
861
+ * @permissionScope Manage Stores - all permissions
862
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
863
+ * @permissionScope Manage Restaurants - all permissions
864
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
865
+ * @permissionScope Manage eCommerce - all permissions
866
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
867
+ * @permissionScope Picasso private app mega scope
868
+ * @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
869
+ * @permissionScope Manage Orders
870
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
871
+ * @applicableIdentity APP
872
+ * @fqn com.wix.ecom.orders.payments_collector.v1.PaymentsCollector.BulkMarkOrdersAsPaid
873
+ */
874
+ export async function paymentCollectionBulkMarkOrdersAsPaid(ecomOrderIds) {
875
+ // @ts-ignore
876
+ const { httpClient, sideEffects } = arguments[1];
877
+ const payload = renameKeysFromSDKRequestToRESTRequest({
878
+ ecomOrderIds: ecomOrderIds,
879
+ });
880
+ const reqOpts = ambassadorWixEcomV1Order.paymentCollectionBulkMarkOrdersAsPaid(payload);
881
+ sideEffects?.onSiteCall?.();
882
+ try {
883
+ const result = await httpClient.request(reqOpts);
884
+ sideEffects?.onSuccess?.(result);
885
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
886
+ {
887
+ transformFn: transformRESTImageToSDKImage,
888
+ paths: [{ path: 'results.item.lineItems.image' }],
889
+ },
890
+ {
891
+ transformFn: transformRESTAddressToSDKAddress,
892
+ paths: [
893
+ { path: 'results.item.billingInfo.address' },
894
+ {
895
+ path: 'results.item.shippingInfo.logistics.shippingDestination.address',
896
+ },
897
+ {
898
+ path: 'results.item.shippingInfo.logistics.pickupDetails.address',
899
+ },
900
+ { path: 'results.item.recipientInfo.address' },
901
+ ],
902
+ },
903
+ ]));
904
+ }
905
+ catch (err) {
906
+ const transformedError = sdkTransformError(err, {
907
+ spreadPathsToArguments: {},
908
+ explicitPathsToArguments: { ecomOrderIds: '$[0]' },
909
+ singleArgumentUnchanged: false,
910
+ }, ['ecomOrderIds']);
911
+ sideEffects?.onError?.(err);
912
+ throw transformedError;
913
+ }
914
+ }
915
+ /**
916
+ * Checks whether this order can be refunded.
917
+ * @param ecomOrderId - Order ID.
918
+ * @internal
919
+ * @documentationMaturity preview
920
+ * @requiredField ecomOrderId
921
+ * @permissionId ECOM.READ_TRANSACTIONS
922
+ * @permissionScope Manage Stores - all permissions
923
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
924
+ * @permissionScope Read eCommerce - all read permissions
925
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
926
+ * @permissionScope Read Orders
927
+ * @permissionScopeId SCOPE.DC-STORES.READ-ORDERS
928
+ * @permissionScope Read Stores - all read permissions
929
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
930
+ * @permissionScope Manage Restaurants - all permissions
931
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
932
+ * @permissionScope Manage eCommerce - all permissions
933
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
934
+ * @permissionScope Picasso private app mega scope
935
+ * @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
936
+ * @permissionScope Manage Orders
937
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
938
+ * @applicableIdentity APP
939
+ * @fqn com.wix.ecom.orders.payments_collector.v1.PaymentsCollector.GetRefundabilityStatus
940
+ */
941
+ export async function getRefundabilityStatus(ecomOrderId) {
942
+ // @ts-ignore
943
+ const { httpClient, sideEffects } = arguments[1];
944
+ const payload = renameKeysFromSDKRequestToRESTRequest({
945
+ ecomOrderId: ecomOrderId,
946
+ });
947
+ const reqOpts = ambassadorWixEcomV1Order.getRefundabilityStatus(payload);
948
+ sideEffects?.onSiteCall?.();
949
+ try {
950
+ const result = await httpClient.request(reqOpts);
951
+ sideEffects?.onSuccess?.(result);
952
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
953
+ }
954
+ catch (err) {
955
+ const transformedError = sdkTransformError(err, {
956
+ spreadPathsToArguments: {},
957
+ explicitPathsToArguments: { ecomOrderId: '$[0]' },
958
+ singleArgumentUnchanged: false,
959
+ }, ['ecomOrderId']);
960
+ sideEffects?.onError?.(err);
961
+ throw transformedError;
962
+ }
963
+ }
964
+ /**
965
+ * Call this endpoint to create an order in the payment gateway system. The amount of the order would be either:
966
+ * 1. An explicit amount provided in the request, or;
967
+ * 2. If an explicit amount is not provided - the remaining amount to complete the payment of that eCom order.
968
+ * As a result, an ID of the created payment gateway order would be returned.
969
+ * You can then use Wix Payments APIs to approve that order or collect payment, which will eventually change the eCom order state (e.g mark it as paid).
970
+ * @param ecomOrderId - Ecom order ID.
971
+ * @internal
972
+ * @documentationMaturity preview
973
+ * @requiredField ecomOrderId
974
+ * @permissionId ECOM.MODIFY_ORDERS
975
+ * @permissionScope Manage Stores - all permissions
976
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
977
+ * @permissionScope Manage Restaurants - all permissions
978
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
979
+ * @permissionScope Manage eCommerce - all permissions
980
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
981
+ * @permissionScope Picasso private app mega scope
982
+ * @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
983
+ * @permissionScope Manage Orders
984
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
985
+ * @applicableIdentity APP
986
+ * @fqn com.wix.ecom.orders.payments_collector.v1.PaymentsCollector.CreatePaymentGatewayOrder
987
+ */
988
+ export async function paymentCollectionCreatePaymentGatewayOrder(ecomOrderId, options) {
989
+ // @ts-ignore
990
+ const { httpClient, sideEffects } = arguments[2];
991
+ const payload = renameKeysFromSDKRequestToRESTRequest({
992
+ ecomOrderId: ecomOrderId,
993
+ chargedBy: options?.chargedBy,
994
+ });
995
+ const reqOpts = ambassadorWixEcomV1Order.paymentCollectionCreatePaymentGatewayOrder(payload);
996
+ sideEffects?.onSiteCall?.();
997
+ try {
998
+ const result = await httpClient.request(reqOpts);
999
+ sideEffects?.onSuccess?.(result);
1000
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
1001
+ }
1002
+ catch (err) {
1003
+ const transformedError = sdkTransformError(err, {
1004
+ spreadPathsToArguments: {},
1005
+ explicitPathsToArguments: {
1006
+ ecomOrderId: '$[0]',
1007
+ chargedBy: '$[1].chargedBy',
1008
+ },
1009
+ singleArgumentUnchanged: false,
1010
+ }, ['ecomOrderId', 'options']);
1011
+ sideEffects?.onError?.(err);
1012
+ throw transformedError;
1013
+ }
1014
+ }
1015
+ /** @param ecomOrderId - Order ID.
1016
+ * @param memberId - The member id. Do not attempt to get it from the request context, since in some cases the caller is not a member
1017
+ * but a user which is using the membership on behalf of the a member
1018
+ * @internal
1019
+ * @documentationMaturity preview
1020
+ * @requiredField ecomOrderId
1021
+ * @requiredField memberId
1022
+ * @requiredField options.membershipCharges.appId
1023
+ * @requiredField options.membershipCharges.catalogReference
1024
+ * @requiredField options.membershipCharges.catalogReference.appId
1025
+ * @requiredField options.membershipCharges.catalogReference.catalogItemId
1026
+ * @requiredField options.membershipCharges.membershipId
1027
+ * @requiredField options.membershipCharges.membershipName
1028
+ * @requiredField options.membershipCharges.membershipName.original
1029
+ * @requiredField options.membershipCharges.rootCatalogItemId
1030
+ * @permissionId ECOM.MODIFY_TRANSACTIONS
1031
+ * @permissionScope Manage Stores - all permissions
1032
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1033
+ * @permissionScope Manage Restaurants - all permissions
1034
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1035
+ * @permissionScope Manage eCommerce - all permissions
1036
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1037
+ * @permissionScope Picasso private app mega scope
1038
+ * @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
1039
+ * @permissionScope Manage Orders
1040
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1041
+ * @applicableIdentity APP
1042
+ * @fqn com.wix.ecom.orders.payments_collector.v1.PaymentsCollector.ChargeMemberships
1043
+ */
1044
+ export async function chargeMemberships(ecomOrderId, memberId, options) {
1045
+ // @ts-ignore
1046
+ const { httpClient, sideEffects } = arguments[3];
1047
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1048
+ ecomOrderId: ecomOrderId,
1049
+ memberId: memberId,
1050
+ membershipCharges: options?.membershipCharges,
1051
+ });
1052
+ const reqOpts = ambassadorWixEcomV1Order.chargeMemberships(payload);
1053
+ sideEffects?.onSiteCall?.();
1054
+ try {
1055
+ const result = await httpClient.request(reqOpts);
1056
+ sideEffects?.onSuccess?.(result);
1057
+ }
1058
+ catch (err) {
1059
+ const transformedError = sdkTransformError(err, {
1060
+ spreadPathsToArguments: {},
1061
+ explicitPathsToArguments: {
1062
+ ecomOrderId: '$[0]',
1063
+ memberId: '$[1]',
1064
+ membershipCharges: '$[2].membershipCharges',
1065
+ },
1066
+ singleArgumentUnchanged: false,
1067
+ }, ['ecomOrderId', 'memberId', 'options']);
1068
+ sideEffects?.onError?.(err);
1069
+ throw transformedError;
1070
+ }
1071
+ }
1072
+ /**
1073
+ * Calls corresponding payment providers and creates refund transactions for requested payments.
1074
+ * Updates order transactions based on refund results.
1075
+ * For requested payments with `TriggerRefundRequest.payments.external_refund = true` will not call payment providers and
1076
+ * will only update order transactions.
1077
+ * @param ecomOrderId - The order this refund related to
1078
+ * @param payments - Refund operations information
1079
+ * @internal
1080
+ * @documentationMaturity preview
1081
+ * @requiredField ecomOrderId
1082
+ * @requiredField payments
1083
+ * @requiredField payments.paymentId
1084
+ * @permissionId ECOM.MODIFY_TRANSACTIONS
1085
+ * @permissionScope Manage Stores - all permissions
1086
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1087
+ * @permissionScope Manage Restaurants - all permissions
1088
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1089
+ * @permissionScope Manage eCommerce - all permissions
1090
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1091
+ * @permissionScope Picasso private app mega scope
1092
+ * @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
1093
+ * @permissionScope Manage Orders
1094
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1095
+ * @applicableIdentity APP
1096
+ * @fqn com.wix.ecom.orders.payments_collector.v1.PaymentsCollector.TriggerRefund
1097
+ */
1098
+ export async function triggerRefund(ecomOrderId, payments, options) {
1099
+ // @ts-ignore
1100
+ const { httpClient, sideEffects } = arguments[3];
1101
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1102
+ ecomOrderId: ecomOrderId,
1103
+ payments: payments,
1104
+ details: options?.details,
1105
+ sideEffects: options?.sideEffects,
1106
+ });
1107
+ const reqOpts = ambassadorWixEcomV1Order.triggerRefund(payload);
1108
+ sideEffects?.onSiteCall?.();
1109
+ try {
1110
+ const result = await httpClient.request(reqOpts);
1111
+ sideEffects?.onSuccess?.(result);
1112
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
1113
+ }
1114
+ catch (err) {
1115
+ const transformedError = sdkTransformError(err, {
1116
+ spreadPathsToArguments: {},
1117
+ explicitPathsToArguments: {
1118
+ ecomOrderId: '$[0]',
1119
+ payments: '$[1]',
1120
+ details: '$[2].details',
1121
+ sideEffects: '$[2].sideEffects',
1122
+ },
1123
+ singleArgumentUnchanged: false,
1124
+ }, ['ecomOrderId', 'payments', 'options']);
1125
+ sideEffects?.onError?.(err);
1126
+ throw transformedError;
1127
+ }
1128
+ }
1129
+ /**
1130
+ * Void authorized payments
1131
+ * Transaction statuses for related payments will be updated in async way
1132
+ * @param ecomOrderId - Wix eCommerce order ID
1133
+ * @param paymentIds - Payment IDs
1134
+ * @public
1135
+ * @documentationMaturity preview
1136
+ * @requiredField ecomOrderId
1137
+ * @requiredField paymentIds
1138
+ * @permissionId ECOM.ORDER_VOID_AUTHORIZED_PAYMENT
1139
+ * @permissionScope Manage Stores - all permissions
1140
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1141
+ * @permissionScope Manage Restaurants - all permissions
1142
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1143
+ * @permissionScope Manage eCommerce - all permissions
1144
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1145
+ * @permissionScope Picasso private app mega scope
1146
+ * @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
1147
+ * @permissionScope Manage Orders
1148
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1149
+ * @applicableIdentity APP
1150
+ * @fqn com.wix.ecom.orders.payments_collector.v1.PaymentsCollector.VoidAuthorizedPayments
1151
+ */
1152
+ export async function voidAuthorizedPayments(ecomOrderId, paymentIds) {
1153
+ // @ts-ignore
1154
+ const { httpClient, sideEffects } = arguments[2];
1155
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1156
+ ecomOrderId: ecomOrderId,
1157
+ paymentIds: paymentIds,
1158
+ });
1159
+ const reqOpts = ambassadorWixEcomV1Order.voidAuthorizedPayments(payload);
1160
+ sideEffects?.onSiteCall?.();
1161
+ try {
1162
+ const result = await httpClient.request(reqOpts);
1163
+ sideEffects?.onSuccess?.(result);
1164
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
1165
+ }
1166
+ catch (err) {
1167
+ const transformedError = sdkTransformError(err, {
1168
+ spreadPathsToArguments: {},
1169
+ explicitPathsToArguments: { ecomOrderId: '$[0]', paymentIds: '$[1]' },
1170
+ singleArgumentUnchanged: false,
1171
+ }, ['ecomOrderId', 'paymentIds']);
1172
+ sideEffects?.onError?.(err);
1173
+ throw transformedError;
1174
+ }
1175
+ }
1176
+ /**
1177
+ * Capture authorized payments
1178
+ * Transaction statuses for related payments will be updated in async way
1179
+ * @param ecomOrderId - Wix eCommerce order ID
1180
+ * @param payments - Capture payments information
1181
+ * @public
1182
+ * @documentationMaturity preview
1183
+ * @requiredField ecomOrderId
1184
+ * @requiredField payments
1185
+ * @requiredField payments.paymentId
1186
+ * @permissionId ECOM.ORDER_CAPTURE_AUTHORIZED_PAYMENT
1187
+ * @permissionScope Manage Stores - all permissions
1188
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1189
+ * @permissionScope Manage Restaurants - all permissions
1190
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1191
+ * @permissionScope Manage eCommerce - all permissions
1192
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1193
+ * @permissionScope Picasso private app mega scope
1194
+ * @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
1195
+ * @permissionScope Manage Orders
1196
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1197
+ * @applicableIdentity APP
1198
+ * @fqn com.wix.ecom.orders.payments_collector.v1.PaymentsCollector.CaptureAuthorizedPayments
1199
+ */
1200
+ export async function captureAuthorizedPayments(ecomOrderId, payments) {
1201
+ // @ts-ignore
1202
+ const { httpClient, sideEffects } = arguments[2];
1203
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1204
+ ecomOrderId: ecomOrderId,
1205
+ payments: payments,
1206
+ });
1207
+ const reqOpts = ambassadorWixEcomV1Order.captureAuthorizedPayments(payload);
1208
+ sideEffects?.onSiteCall?.();
1209
+ try {
1210
+ const result = await httpClient.request(reqOpts);
1211
+ sideEffects?.onSuccess?.(result);
1212
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
1213
+ }
1214
+ catch (err) {
1215
+ const transformedError = sdkTransformError(err, {
1216
+ spreadPathsToArguments: {},
1217
+ explicitPathsToArguments: { ecomOrderId: '$[0]', payments: '$[1]' },
1218
+ singleArgumentUnchanged: false,
1219
+ }, ['ecomOrderId', 'payments']);
1220
+ sideEffects?.onError?.(err);
1221
+ throw transformedError;
1222
+ }
1223
+ }
1224
+ /**
1225
+ * Retrieves an order.
1226
+ *
1227
+ *
1228
+ * The `getOrder()` function returns a Promise that resolves when the specified order is retrieved.
1229
+ *
1230
+ * To retrieve an order's payment and refund details, including amounts, payment methods, and payment statuses, pass the order ID to [`listTransactionsForSingleOrder( )`](https://www.wix.com/velo/reference/wix-ecom-backend/ordertransactions/listtransactionsforsingleorder).
1231
+ * @param _id - ID of the order to retrieve.
1232
+ * @public
1233
+ * @requiredField _id
1234
+ * @permissionId ECOM.READ_ORDERS
1235
+ * @permissionId ECOM.ORDER_READ_ALL_EXTENDED_FIELDS
1236
+ * @permissionScope Manage Stores - all permissions
1237
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1238
+ * @permissionScope Read eCommerce - all read permissions
1239
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
1240
+ * @permissionScope Read Orders
1241
+ * @permissionScopeId SCOPE.DC-STORES.READ-ORDERS
1242
+ * @permissionScope Read Stores - all read permissions
1243
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
1244
+ * @permissionScope Manage Restaurants - all permissions
1245
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1246
+ * @permissionScope Manage eCommerce - all permissions
1247
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1248
+ * @permissionScope Manage Orders
1249
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1250
+ * @applicableIdentity APP
1251
+ * @returns Fulfilled - The requested order.
1252
+ * @fqn com.wix.ecom.orders.v1.Orders.GetOrder
1253
+ */
1254
+ export async function getOrder(_id) {
1255
+ // @ts-ignore
1256
+ const { httpClient, sideEffects } = arguments[1];
1257
+ const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
1258
+ const reqOpts = ambassadorWixEcomV1Order.getOrder(payload);
1259
+ sideEffects?.onSiteCall?.();
1260
+ try {
1261
+ const result = await httpClient.request(reqOpts);
1262
+ sideEffects?.onSuccess?.(result);
1263
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1264
+ {
1265
+ transformFn: transformRESTImageToSDKImage,
1266
+ paths: [{ path: 'order.lineItems.image' }],
1267
+ },
1268
+ {
1269
+ transformFn: transformRESTAddressToSDKAddress,
1270
+ paths: [
1271
+ { path: 'order.billingInfo.address' },
1272
+ {
1273
+ path: 'order.shippingInfo.logistics.shippingDestination.address',
1274
+ },
1275
+ { path: 'order.shippingInfo.logistics.pickupDetails.address' },
1276
+ { path: 'order.recipientInfo.address' },
1277
+ ],
1278
+ },
1279
+ ]))?.order;
1280
+ }
1281
+ catch (err) {
1282
+ const transformedError = sdkTransformError(err, {
1283
+ spreadPathsToArguments: {},
1284
+ explicitPathsToArguments: { id: '$[0]' },
1285
+ singleArgumentUnchanged: false,
1286
+ }, ['_id']);
1287
+ sideEffects?.onError?.(err);
1288
+ throw transformedError;
1289
+ }
1290
+ }
1291
+ /**
1292
+ * Retrieves a list of orders, given the provided paging, filtering, and sorting.
1293
+ *
1294
+ *
1295
+ * Search Orders runs with these defaults, which you can override:
1296
+ *
1297
+ * - `createdDate` is sorted in `DESC` order
1298
+ * - `cursorPaging.limit` is `100`
1299
+ * - `filter: {"status": {"$ne": "INITIALIZED"}}` - other order statuses can be queried, but orders with `status: "INITIALIZED"` are never returned
1300
+ *
1301
+ * For field support for filters and sorting, see [Orders: Supported Filters and Sorting](https://dev.wix.com/docs/rest/api-reference/wix-e-commerce/orders/supported-filters-and-sorting).
1302
+ *
1303
+ * To learn about working with _Search_ endpoints, see
1304
+ * [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language), and
1305
+ * [Sorting and Paging](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging).
1306
+ * @public
1307
+ * @permissionId ECOM.READ_ORDERS
1308
+ * @permissionScope Manage Stores - all permissions
1309
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1310
+ * @permissionScope Read eCommerce - all read permissions
1311
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
1312
+ * @permissionScope Read Orders
1313
+ * @permissionScopeId SCOPE.DC-STORES.READ-ORDERS
1314
+ * @permissionScope Read Stores - all read permissions
1315
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
1316
+ * @permissionScope Manage Restaurants - all permissions
1317
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1318
+ * @permissionScope Manage eCommerce - all permissions
1319
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1320
+ * @permissionScope Manage Orders
1321
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1322
+ * @applicableIdentity APP
1323
+ * @fqn com.wix.ecom.orders.v1.Orders.SearchOrders
1324
+ */
1325
+ export async function searchOrders(options) {
1326
+ // @ts-ignore
1327
+ const { httpClient, sideEffects } = arguments[1];
1328
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1329
+ search: options?.search,
1330
+ });
1331
+ const reqOpts = ambassadorWixEcomV1Order.searchOrders(payload);
1332
+ sideEffects?.onSiteCall?.();
1333
+ try {
1334
+ const result = await httpClient.request(reqOpts);
1335
+ sideEffects?.onSuccess?.(result);
1336
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1337
+ {
1338
+ transformFn: transformRESTImageToSDKImage,
1339
+ paths: [{ path: 'orders.lineItems.image' }],
1340
+ },
1341
+ {
1342
+ transformFn: transformRESTAddressToSDKAddress,
1343
+ paths: [
1344
+ { path: 'orders.billingInfo.address' },
1345
+ {
1346
+ path: 'orders.shippingInfo.logistics.shippingDestination.address',
1347
+ },
1348
+ { path: 'orders.shippingInfo.logistics.pickupDetails.address' },
1349
+ { path: 'orders.recipientInfo.address' },
1350
+ ],
1351
+ },
1352
+ ]));
1353
+ }
1354
+ catch (err) {
1355
+ const transformedError = sdkTransformError(err, {
1356
+ spreadPathsToArguments: {},
1357
+ explicitPathsToArguments: { search: '$[0].search' },
1358
+ singleArgumentUnchanged: false,
1359
+ }, ['options']);
1360
+ sideEffects?.onError?.(err);
1361
+ throw transformedError;
1362
+ }
1363
+ }
1364
+ /**
1365
+ * Creates an order.
1366
+ *
1367
+ *
1368
+ * The `createOrder()` function returns a Promise that resolves when the order is created.
1369
+ *
1370
+ * > **Notes:**
1371
+ * > + If an item is digital - `lineItems[i].itemType.preset: DIGITAL` - then `lineItems[i].digitalFile` must be provided.
1372
+ * > + If `lineItems[i].id` is passed, it must be either a valid GUID, or empty.
1373
+ * @param order - Order info.
1374
+ * @public
1375
+ * @requiredField order
1376
+ * @requiredField order.billingInfo.contactDetails
1377
+ * @requiredField order.channelInfo
1378
+ * @requiredField order.currencyConversionDetails.conversionRate
1379
+ * @requiredField order.currencyConversionDetails.originalCurrency
1380
+ * @requiredField order.lineItems
1381
+ * @requiredField order.lineItems.catalogReference.appId
1382
+ * @requiredField order.lineItems.catalogReference.catalogItemId
1383
+ * @requiredField order.lineItems.itemType
1384
+ * @requiredField order.lineItems.price
1385
+ * @requiredField order.lineItems.productName
1386
+ * @requiredField order.lineItems.productName.original
1387
+ * @requiredField order.lineItems.quantity
1388
+ * @requiredField order.priceSummary
1389
+ * @permissionId ECOM.CREATE_ORDERS
1390
+ * @permissionId ECOM.ORDER_WRITE_ALL_EXTENDED_FIELDS
1391
+ * @permissionScope Manage Stores - all permissions
1392
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1393
+ * @permissionScope Manage Restaurants - all permissions
1394
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1395
+ * @permissionScope Manage eCommerce - all permissions
1396
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1397
+ * @permissionScope Manage Orders
1398
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1399
+ * @applicableIdentity APP
1400
+ * @returns Newly created order.
1401
+ * @fqn com.wix.ecom.orders.v1.Orders.CreateOrder
1402
+ */
1403
+ export async function createOrder(order, options) {
1404
+ // @ts-ignore
1405
+ const { httpClient, sideEffects } = arguments[2];
1406
+ const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
1407
+ order: order,
1408
+ settings: options?.settings,
1409
+ }), [
1410
+ {
1411
+ transformFn: transformSDKImageToRESTImage,
1412
+ paths: [{ path: 'order.lineItems.image' }],
1413
+ },
1414
+ {
1415
+ transformFn: transformSDKAddressToRESTAddress,
1416
+ paths: [
1417
+ { path: 'order.billingInfo.address' },
1418
+ { path: 'order.shippingInfo.logistics.shippingDestination.address' },
1419
+ { path: 'order.shippingInfo.logistics.pickupDetails.address' },
1420
+ { path: 'order.recipientInfo.address' },
1421
+ ],
1422
+ },
1423
+ ]);
1424
+ const reqOpts = ambassadorWixEcomV1Order.createOrder(payload);
1425
+ sideEffects?.onSiteCall?.();
1426
+ try {
1427
+ const result = await httpClient.request(reqOpts);
1428
+ sideEffects?.onSuccess?.(result);
1429
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1430
+ {
1431
+ transformFn: transformRESTImageToSDKImage,
1432
+ paths: [{ path: 'order.lineItems.image' }],
1433
+ },
1434
+ {
1435
+ transformFn: transformRESTAddressToSDKAddress,
1436
+ paths: [
1437
+ { path: 'order.billingInfo.address' },
1438
+ {
1439
+ path: 'order.shippingInfo.logistics.shippingDestination.address',
1440
+ },
1441
+ { path: 'order.shippingInfo.logistics.pickupDetails.address' },
1442
+ { path: 'order.recipientInfo.address' },
1443
+ ],
1444
+ },
1445
+ ]))?.order;
1446
+ }
1447
+ catch (err) {
1448
+ const transformedError = sdkTransformError(err, {
1449
+ spreadPathsToArguments: {},
1450
+ explicitPathsToArguments: { order: '$[0]', settings: '$[1].settings' },
1451
+ singleArgumentUnchanged: false,
1452
+ }, ['order', 'options']);
1453
+ sideEffects?.onError?.(err);
1454
+ throw transformedError;
1455
+ }
1456
+ }
1457
+ /**
1458
+ * Updates an order.
1459
+ *
1460
+ *
1461
+ * The `updateOrder()` function returns a Promise that resolves when the specified order's information is updated.
1462
+ *
1463
+ * Currently, the following fields can be updated:
1464
+ * + `order.buyerInfo.email`
1465
+ * + `order.buyerLanguage`
1466
+ * + `order.weightUnit`
1467
+ * + `order.billingInfo.address`
1468
+ * + `order.billingInfo.contactDetails`
1469
+ * + `order.archived`
1470
+ * + `order.attributionSource`
1471
+ * + `order.seenByAHuman`
1472
+ * + `order.recipientInfo.address`
1473
+ * + `order.recipientInfo.contactDetails`
1474
+ * + `order.shippingInfo.logistics.shippingDestination.address`
1475
+ * + `order.shippingInfo.logistics.shippingDestination.contactDetails`
1476
+ *
1477
+ * To update a field's value, include the new value in the `order` object in the method parameters.
1478
+ * To remove a field's value, pass `null`.
1479
+ *
1480
+ * > **Note:** Removing `buyerInfo` or `contactDetails` fields results in an error.
1481
+ *
1482
+ * To update an order's payment status, use [`updatePaymentStatus( )`](https://www.wix.com/velo/reference/wix-ecom-backend/ordertransactions/updatepaymentstatus).
1483
+ * @param _id - Order ID.
1484
+ * @public
1485
+ * @requiredField _id
1486
+ * @requiredField order
1487
+ * @permissionId ECOM.MODIFY_ORDERS
1488
+ * @permissionId ECOM.ORDER_WRITE_ALL_EXTENDED_FIELDS
1489
+ * @permissionScope Manage Stores - all permissions
1490
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1491
+ * @permissionScope Manage Restaurants - all permissions
1492
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1493
+ * @permissionScope Manage eCommerce - all permissions
1494
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1495
+ * @permissionScope Manage Orders
1496
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1497
+ * @applicableIdentity APP
1498
+ * @returns Newly created order.
1499
+ * @fqn com.wix.ecom.orders.v1.Orders.UpdateOrder
1500
+ */
1501
+ export async function updateOrder(_id, order) {
1502
+ // @ts-ignore
1503
+ const { httpClient, sideEffects } = arguments[2];
1504
+ const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({ order: { ...order, id: _id } }), [
1505
+ {
1506
+ transformFn: transformSDKImageToRESTImage,
1507
+ paths: [{ path: 'order.lineItems.image' }],
1508
+ },
1509
+ {
1510
+ transformFn: transformSDKAddressToRESTAddress,
1511
+ paths: [
1512
+ { path: 'order.billingInfo.address' },
1513
+ { path: 'order.shippingInfo.logistics.shippingDestination.address' },
1514
+ { path: 'order.shippingInfo.logistics.pickupDetails.address' },
1515
+ { path: 'order.recipientInfo.address' },
1516
+ ],
1517
+ },
1518
+ ]);
1519
+ const reqOpts = ambassadorWixEcomV1Order.updateOrder(payload);
1520
+ sideEffects?.onSiteCall?.();
1521
+ try {
1522
+ const result = await httpClient.request(reqOpts);
1523
+ sideEffects?.onSuccess?.(result);
1524
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1525
+ {
1526
+ transformFn: transformRESTImageToSDKImage,
1527
+ paths: [{ path: 'order.lineItems.image' }],
1528
+ },
1529
+ {
1530
+ transformFn: transformRESTAddressToSDKAddress,
1531
+ paths: [
1532
+ { path: 'order.billingInfo.address' },
1533
+ {
1534
+ path: 'order.shippingInfo.logistics.shippingDestination.address',
1535
+ },
1536
+ { path: 'order.shippingInfo.logistics.pickupDetails.address' },
1537
+ { path: 'order.recipientInfo.address' },
1538
+ ],
1539
+ },
1540
+ ]))?.order;
1541
+ }
1542
+ catch (err) {
1543
+ const transformedError = sdkTransformError(err, {
1544
+ spreadPathsToArguments: { order: '$[1]' },
1545
+ explicitPathsToArguments: { 'order.id': '$[0]' },
1546
+ singleArgumentUnchanged: false,
1547
+ }, ['_id', 'order']);
1548
+ sideEffects?.onError?.(err);
1549
+ throw transformedError;
1550
+ }
1551
+ }
1552
+ /**
1553
+ * Updates up to 100 orders.
1554
+ *
1555
+ *
1556
+ * The `bulkUpdateOrders()` function returns a Promise that resolves when the specified orders' information is updated.
1557
+ *
1558
+ * Currently, the following fields can be updated:
1559
+ * + `order.buyerInfo.email`
1560
+ * + `order.buyerLanguage`
1561
+ * + `order.weightUnit`
1562
+ * + `order.billingInfo.address`
1563
+ * + `order.billingInfo.contactDetails`
1564
+ * + `order.archived`
1565
+ * + `order.attributionSource`
1566
+ * + `order.seenByAHuman`
1567
+ * + `order.recipientInfo.address`
1568
+ * + `order.recipientInfo.contactDetails`
1569
+ * + `order.shippingInfo.logistics.shippingDestination.address`
1570
+ * + `order.shippingInfo.logistics.shippingDestination.contactDetails`
1571
+ *
1572
+ * To update a field's value, include the new value in the `orders.order` object in the method parameters.
1573
+ * To remove a field's value, pass `null`.
1574
+ *
1575
+ * > **Note:** Removing `buyerInfo` or `contactDetails` fields results in an error.
1576
+ *
1577
+ * To update an order's payment status, use [`updatePaymentStatus( )`](https://www.wix.com/velo/reference/wix-ecom-backend/ordertransactions/updatepaymentstatus).
1578
+ * @param orders - Orders to update.
1579
+ * @public
1580
+ * @requiredField orders
1581
+ * @requiredField orders.order
1582
+ * @requiredField orders.order._id
1583
+ * @permissionId ECOM.MODIFY_ORDERS
1584
+ * @permissionScope Manage Stores - all permissions
1585
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1586
+ * @permissionScope Manage Restaurants - all permissions
1587
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1588
+ * @permissionScope Manage eCommerce - all permissions
1589
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1590
+ * @permissionScope Manage Orders
1591
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1592
+ * @applicableIdentity APP
1593
+ * @fqn com.wix.ecom.orders.v1.Orders.BulkUpdateOrders
1594
+ */
1595
+ export async function bulkUpdateOrders(orders, options) {
1596
+ // @ts-ignore
1597
+ const { httpClient, sideEffects } = arguments[2];
1598
+ const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
1599
+ orders: orders,
1600
+ returnEntity: options?.returnEntity,
1601
+ }), [
1602
+ {
1603
+ transformFn: transformSDKImageToRESTImage,
1604
+ paths: [{ path: 'orders.order.lineItems.image' }],
1605
+ },
1606
+ {
1607
+ transformFn: transformSDKAddressToRESTAddress,
1608
+ paths: [
1609
+ { path: 'orders.order.billingInfo.address' },
1610
+ {
1611
+ path: 'orders.order.shippingInfo.logistics.shippingDestination.address',
1612
+ },
1613
+ { path: 'orders.order.shippingInfo.logistics.pickupDetails.address' },
1614
+ { path: 'orders.order.recipientInfo.address' },
1615
+ ],
1616
+ },
1617
+ ]);
1618
+ const reqOpts = ambassadorWixEcomV1Order.bulkUpdateOrders(payload);
1619
+ sideEffects?.onSiteCall?.();
1620
+ try {
1621
+ const result = await httpClient.request(reqOpts);
1622
+ sideEffects?.onSuccess?.(result);
1623
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1624
+ {
1625
+ transformFn: transformRESTImageToSDKImage,
1626
+ paths: [{ path: 'results.item.lineItems.image' }],
1627
+ },
1628
+ {
1629
+ transformFn: transformRESTAddressToSDKAddress,
1630
+ paths: [
1631
+ { path: 'results.item.billingInfo.address' },
1632
+ {
1633
+ path: 'results.item.shippingInfo.logistics.shippingDestination.address',
1634
+ },
1635
+ {
1636
+ path: 'results.item.shippingInfo.logistics.pickupDetails.address',
1637
+ },
1638
+ { path: 'results.item.recipientInfo.address' },
1639
+ ],
1640
+ },
1641
+ ]));
1642
+ }
1643
+ catch (err) {
1644
+ const transformedError = sdkTransformError(err, {
1645
+ spreadPathsToArguments: {},
1646
+ explicitPathsToArguments: {
1647
+ orders: '$[0]',
1648
+ returnEntity: '$[1].returnEntity',
1649
+ },
1650
+ singleArgumentUnchanged: false,
1651
+ }, ['orders', 'options']);
1652
+ sideEffects?.onError?.(err);
1653
+ throw transformedError;
1654
+ }
1655
+ }
1656
+ /** @param _id - Order id to be updated
1657
+ * @internal
1658
+ * @documentationMaturity preview
1659
+ * @requiredField _id
1660
+ * @requiredField options.changes
1661
+ * @requiredField options.changes.priceSummary.subtotal
1662
+ * @requiredField options.changes.priceSummary.total
1663
+ * @permissionId ECOM.ORDERS_DELTAS_COMMIT
1664
+ * @permissionId ECOM.ORDER_WRITE_ALL_EXTENDED_FIELDS
1665
+ * @fqn com.wix.ecom.orders.v1.Orders.CommitDeltas
1666
+ */
1667
+ export async function commitDeltas(_id, options) {
1668
+ // @ts-ignore
1669
+ const { httpClient, sideEffects } = arguments[2];
1670
+ const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
1671
+ id: _id,
1672
+ draftOrderId: options?.draftOrderId,
1673
+ changes: options?.changes,
1674
+ commitSettings: options?.commitSettings,
1675
+ reason: options?.reason,
1676
+ }), [
1677
+ {
1678
+ transformFn: transformSDKAddressToRESTAddress,
1679
+ paths: [
1680
+ {
1681
+ path: 'changes.changedShippingInfo.logistics.shippingDestination.address',
1682
+ },
1683
+ {
1684
+ path: 'changes.changedShippingInfo.logistics.pickupDetails.address',
1685
+ },
1686
+ { path: 'changes.changedBillingInfo.address' },
1687
+ { path: 'changes.changedRecipientInfo.address' },
1688
+ ],
1689
+ },
1690
+ {
1691
+ transformFn: transformSDKImageToRESTImage,
1692
+ paths: [{ path: 'changes.lineItems.lineItem.image' }],
1693
+ },
1694
+ ]);
1695
+ const reqOpts = ambassadorWixEcomV1Order.commitDeltas(payload);
1696
+ sideEffects?.onSiteCall?.();
1697
+ try {
1698
+ const result = await httpClient.request(reqOpts);
1699
+ sideEffects?.onSuccess?.(result);
1700
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1701
+ {
1702
+ transformFn: transformRESTImageToSDKImage,
1703
+ paths: [{ path: 'order.lineItems.image' }],
1704
+ },
1705
+ {
1706
+ transformFn: transformRESTAddressToSDKAddress,
1707
+ paths: [
1708
+ { path: 'order.billingInfo.address' },
1709
+ {
1710
+ path: 'order.shippingInfo.logistics.shippingDestination.address',
1711
+ },
1712
+ { path: 'order.shippingInfo.logistics.pickupDetails.address' },
1713
+ { path: 'order.recipientInfo.address' },
1714
+ ],
1715
+ },
1716
+ ]));
1717
+ }
1718
+ catch (err) {
1719
+ const transformedError = sdkTransformError(err, {
1720
+ spreadPathsToArguments: {},
1721
+ explicitPathsToArguments: {
1722
+ id: '$[0]',
1723
+ draftOrderId: '$[1].draftOrderId',
1724
+ changes: '$[1].changes',
1725
+ commitSettings: '$[1].commitSettings',
1726
+ reason: '$[1].reason',
1727
+ },
1728
+ singleArgumentUnchanged: false,
1729
+ }, ['_id', 'options']);
1730
+ sideEffects?.onError?.(err);
1731
+ throw transformedError;
1732
+ }
1733
+ }
1734
+ /** @internal
1735
+ * @documentationMaturity preview
1736
+ * @requiredField identifiers
1737
+ * @requiredField identifiers._id
1738
+ * @requiredField identifiers.lineItemId
1739
+ * @requiredField lineItem
1740
+ * @permissionId ECOM.MODIFY_ORDERS
1741
+ * @permissionScope Manage Stores - all permissions
1742
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1743
+ * @permissionScope Manage Restaurants - all permissions
1744
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1745
+ * @permissionScope Manage eCommerce - all permissions
1746
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1747
+ * @permissionScope Manage Orders
1748
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1749
+ * @applicableIdentity APP
1750
+ * @fqn com.wix.ecom.orders.v1.Orders.UpdateOrderLineItem
1751
+ * @deprecated
1752
+ * @targetRemovalDate 2024-02-15
1753
+ */
1754
+ export async function updateOrderLineItem(identifiers, lineItem) {
1755
+ // @ts-ignore
1756
+ const { httpClient, sideEffects } = arguments[2];
1757
+ const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
1758
+ id: identifiers?._id,
1759
+ lineItem: { ...lineItem, id: identifiers?.lineItemId },
1760
+ }), [
1761
+ {
1762
+ transformFn: transformSDKImageToRESTImage,
1763
+ paths: [{ path: 'lineItem.image' }],
1764
+ },
1765
+ ]);
1766
+ const reqOpts = ambassadorWixEcomV1Order.updateOrderLineItem(payload);
1767
+ sideEffects?.onSiteCall?.();
1768
+ try {
1769
+ const result = await httpClient.request(reqOpts);
1770
+ sideEffects?.onSuccess?.(result);
1771
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1772
+ {
1773
+ transformFn: transformRESTImageToSDKImage,
1774
+ paths: [{ path: 'order.lineItems.image' }],
1775
+ },
1776
+ {
1777
+ transformFn: transformRESTAddressToSDKAddress,
1778
+ paths: [
1779
+ { path: 'order.billingInfo.address' },
1780
+ {
1781
+ path: 'order.shippingInfo.logistics.shippingDestination.address',
1782
+ },
1783
+ { path: 'order.shippingInfo.logistics.pickupDetails.address' },
1784
+ { path: 'order.recipientInfo.address' },
1785
+ ],
1786
+ },
1787
+ ]));
1788
+ }
1789
+ catch (err) {
1790
+ const transformedError = sdkTransformError(err, {
1791
+ spreadPathsToArguments: { lineItem: '$[1]' },
1792
+ explicitPathsToArguments: {
1793
+ id: '$[0]._id',
1794
+ 'lineItem.id': '$[0].lineItemId',
1795
+ },
1796
+ singleArgumentUnchanged: false,
1797
+ }, ['identifiers', 'lineItem']);
1798
+ sideEffects?.onError?.(err);
1799
+ throw transformedError;
1800
+ }
1801
+ }
1802
+ /**
1803
+ * Adds a merchant comment to an order.
1804
+ * > **Note:** Activities with type CustomActivity not supported
1805
+ * @param _id - Order ID.
1806
+ * @param activity - Activity info.
1807
+ * @internal
1808
+ * @documentationMaturity preview
1809
+ * @requiredField _id
1810
+ * @requiredField activity
1811
+ * @permissionId ECOM.MODIFY_ORDERS
1812
+ * @permissionScope Manage Stores - all permissions
1813
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1814
+ * @permissionScope Manage Restaurants - all permissions
1815
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1816
+ * @permissionScope Manage eCommerce - all permissions
1817
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1818
+ * @permissionScope Manage Orders
1819
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1820
+ * @applicableIdentity APP
1821
+ * @fqn com.wix.ecom.orders.v1.Orders.AddActivity
1822
+ * @deprecated
1823
+ * @replacedBy com.wix.ecom.orders.v1.OrdersService.AddActivities
1824
+ * @targetRemovalDate 2024-11-01
1825
+ */
1826
+ export async function addActivity(_id, activity) {
1827
+ // @ts-ignore
1828
+ const { httpClient, sideEffects } = arguments[2];
1829
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1830
+ id: _id,
1831
+ activity: activity,
1832
+ });
1833
+ const reqOpts = ambassadorWixEcomV1Order.addActivity(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: [{ path: 'order.lineItems.image' }],
1842
+ },
1843
+ {
1844
+ transformFn: transformRESTAddressToSDKAddress,
1845
+ paths: [
1846
+ { path: 'order.billingInfo.address' },
1847
+ {
1848
+ path: 'order.shippingInfo.logistics.shippingDestination.address',
1849
+ },
1850
+ { path: 'order.shippingInfo.logistics.pickupDetails.address' },
1851
+ { path: 'order.recipientInfo.address' },
1852
+ ],
1853
+ },
1854
+ ]));
1855
+ }
1856
+ catch (err) {
1857
+ const transformedError = sdkTransformError(err, {
1858
+ spreadPathsToArguments: {},
1859
+ explicitPathsToArguments: { id: '$[0]', activity: '$[1]' },
1860
+ singleArgumentUnchanged: false,
1861
+ }, ['_id', 'activity']);
1862
+ sideEffects?.onError?.(err);
1863
+ throw transformedError;
1864
+ }
1865
+ }
1866
+ /**
1867
+ * Updates an order's activity.
1868
+ * @param activity - Activity info.
1869
+ * @internal
1870
+ * @documentationMaturity preview
1871
+ * @requiredField activity
1872
+ * @requiredField identifiers
1873
+ * @requiredField identifiers._id
1874
+ * @requiredField identifiers.activityId
1875
+ * @permissionId ECOM.MODIFY_ORDERS
1876
+ * @permissionScope Manage Stores - all permissions
1877
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1878
+ * @permissionScope Manage Restaurants - all permissions
1879
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1880
+ * @permissionScope Manage eCommerce - all permissions
1881
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1882
+ * @permissionScope Manage Orders
1883
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1884
+ * @applicableIdentity APP
1885
+ * @fqn com.wix.ecom.orders.v1.Orders.UpdateActivity
1886
+ */
1887
+ export async function updateActivity(identifiers, activity) {
1888
+ // @ts-ignore
1889
+ const { httpClient, sideEffects } = arguments[2];
1890
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1891
+ id: identifiers?._id,
1892
+ activityId: identifiers?.activityId,
1893
+ activity: activity,
1894
+ });
1895
+ const reqOpts = ambassadorWixEcomV1Order.updateActivity(payload);
1896
+ sideEffects?.onSiteCall?.();
1897
+ try {
1898
+ const result = await httpClient.request(reqOpts);
1899
+ sideEffects?.onSuccess?.(result);
1900
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1901
+ {
1902
+ transformFn: transformRESTImageToSDKImage,
1903
+ paths: [{ path: 'order.lineItems.image' }],
1904
+ },
1905
+ {
1906
+ transformFn: transformRESTAddressToSDKAddress,
1907
+ paths: [
1908
+ { path: 'order.billingInfo.address' },
1909
+ {
1910
+ path: 'order.shippingInfo.logistics.shippingDestination.address',
1911
+ },
1912
+ { path: 'order.shippingInfo.logistics.pickupDetails.address' },
1913
+ { path: 'order.recipientInfo.address' },
1914
+ ],
1915
+ },
1916
+ ]));
1917
+ }
1918
+ catch (err) {
1919
+ const transformedError = sdkTransformError(err, {
1920
+ spreadPathsToArguments: {},
1921
+ explicitPathsToArguments: {
1922
+ id: '$[0]._id',
1923
+ activityId: '$[0].activityId',
1924
+ activity: '$[1]',
1925
+ },
1926
+ singleArgumentUnchanged: false,
1927
+ }, ['identifiers', 'activity']);
1928
+ sideEffects?.onError?.(err);
1929
+ throw transformedError;
1930
+ }
1931
+ }
1932
+ /**
1933
+ * Delete's an order's activity.
1934
+ *
1935
+ * Only custom activities and merchant comments can be deleted.
1936
+ * @internal
1937
+ * @documentationMaturity preview
1938
+ * @requiredField identifiers
1939
+ * @requiredField identifiers._id
1940
+ * @requiredField identifiers.activityId
1941
+ * @permissionId ECOM.MODIFY_ORDERS
1942
+ * @permissionScope Manage Stores - all permissions
1943
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1944
+ * @permissionScope Manage Restaurants - all permissions
1945
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1946
+ * @permissionScope Manage eCommerce - all permissions
1947
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1948
+ * @permissionScope Manage Orders
1949
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1950
+ * @applicableIdentity APP
1951
+ * @fqn com.wix.ecom.orders.v1.Orders.DeleteActivity
1952
+ */
1953
+ export async function deleteActivity(identifiers) {
1954
+ // @ts-ignore
1955
+ const { httpClient, sideEffects } = arguments[1];
1956
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1957
+ id: identifiers?._id,
1958
+ activityId: identifiers?.activityId,
1959
+ });
1960
+ const reqOpts = ambassadorWixEcomV1Order.deleteActivity(payload);
1961
+ sideEffects?.onSiteCall?.();
1962
+ try {
1963
+ const result = await httpClient.request(reqOpts);
1964
+ sideEffects?.onSuccess?.(result);
1965
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1966
+ {
1967
+ transformFn: transformRESTImageToSDKImage,
1968
+ paths: [{ path: 'order.lineItems.image' }],
1969
+ },
1970
+ {
1971
+ transformFn: transformRESTAddressToSDKAddress,
1972
+ paths: [
1973
+ { path: 'order.billingInfo.address' },
1974
+ {
1975
+ path: 'order.shippingInfo.logistics.shippingDestination.address',
1976
+ },
1977
+ { path: 'order.shippingInfo.logistics.pickupDetails.address' },
1978
+ { path: 'order.recipientInfo.address' },
1979
+ ],
1980
+ },
1981
+ ]));
1982
+ }
1983
+ catch (err) {
1984
+ const transformedError = sdkTransformError(err, {
1985
+ spreadPathsToArguments: {},
1986
+ explicitPathsToArguments: {
1987
+ id: '$[0]._id',
1988
+ activityId: '$[0].activityId',
1989
+ },
1990
+ singleArgumentUnchanged: false,
1991
+ }, ['identifiers']);
1992
+ sideEffects?.onError?.(err);
1993
+ throw transformedError;
1994
+ }
1995
+ }
1996
+ /**
1997
+ * Cancels an order.
1998
+ *
1999
+ *
2000
+ * The `cancelOrder()` function returns a Promise that resolves when the specified order is canceled and the `order.status` field changes to `CANCELED`.
2001
+ * @param _id - Order ID.
2002
+ * @public
2003
+ * @requiredField _id
2004
+ * @permissionId ECOM.MODIFY_ORDERS
2005
+ * @permissionScope Manage Stores - all permissions
2006
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.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
+ * @permissionScope Manage Orders
2012
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
2013
+ * @applicableIdentity APP
2014
+ * @fqn com.wix.ecom.orders.v1.Orders.CancelOrder
2015
+ */
2016
+ export async function cancelOrder(_id, options) {
2017
+ // @ts-ignore
2018
+ const { httpClient, sideEffects } = arguments[2];
2019
+ const payload = renameKeysFromSDKRequestToRESTRequest({
2020
+ id: _id,
2021
+ sendOrderCanceledEmail: options?.sendOrderCanceledEmail,
2022
+ customMessage: options?.customMessage,
2023
+ restockAllItems: options?.restockAllItems,
2024
+ });
2025
+ const reqOpts = ambassadorWixEcomV1Order.cancelOrder(payload);
2026
+ sideEffects?.onSiteCall?.();
2027
+ try {
2028
+ const result = await httpClient.request(reqOpts);
2029
+ sideEffects?.onSuccess?.(result);
2030
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
2031
+ {
2032
+ transformFn: transformRESTImageToSDKImage,
2033
+ paths: [{ path: 'order.lineItems.image' }],
2034
+ },
2035
+ {
2036
+ transformFn: transformRESTAddressToSDKAddress,
2037
+ paths: [
2038
+ { path: 'order.billingInfo.address' },
2039
+ {
2040
+ path: 'order.shippingInfo.logistics.shippingDestination.address',
2041
+ },
2042
+ { path: 'order.shippingInfo.logistics.pickupDetails.address' },
2043
+ { path: 'order.recipientInfo.address' },
2044
+ ],
2045
+ },
2046
+ ]));
2047
+ }
2048
+ catch (err) {
2049
+ const transformedError = sdkTransformError(err, {
2050
+ spreadPathsToArguments: {},
2051
+ explicitPathsToArguments: {
2052
+ id: '$[0]',
2053
+ sendOrderCanceledEmail: '$[1].sendOrderCanceledEmail',
2054
+ customMessage: '$[1].customMessage',
2055
+ restockAllItems: '$[1].restockAllItems',
2056
+ },
2057
+ singleArgumentUnchanged: false,
2058
+ }, ['_id', 'options']);
2059
+ sideEffects?.onError?.(err);
2060
+ throw transformedError;
2061
+ }
2062
+ }
2063
+ /**
2064
+ * Updates order status.
2065
+ *
2066
+ * >CANCELED and REJECTED are final statuses. Update from either of those will fail.
2067
+ * >Updates into INITIALIZED are not supported.
2068
+ *
2069
+ * Approving order:
2070
+ * APPROVED status can be set while order has one of [INITIALIZED, PENDING] statuses.
2071
+ *
2072
+ * Approving an order which was created with CreateOrderRequest.settings.order_approval_strategy = PAYMENT_METHOD_SAVED
2073
+ * will cause an error.
2074
+ *
2075
+ * Setting PENDING status:
2076
+ * Only orders in INITIALIZED status can be updated into PENDING.
2077
+ * @param orderId - Order ID.
2078
+ * @param status - New order status.
2079
+ * @internal
2080
+ * @documentationMaturity preview
2081
+ * @requiredField orderId
2082
+ * @requiredField status
2083
+ * @permissionId ECOM.ORDER_UPDATE_STATUS
2084
+ * @permissionScope Manage Stores - all permissions
2085
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
2086
+ * @permissionScope Manage Restaurants - all permissions
2087
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
2088
+ * @permissionScope Manage eCommerce - all permissions
2089
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
2090
+ * @permissionScope Manage Orders
2091
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
2092
+ * @applicableIdentity APP
2093
+ * @fqn com.wix.ecom.orders.v1.Orders.UpdateOrderStatus
2094
+ */
2095
+ export async function updateOrderStatus(orderId, status) {
2096
+ // @ts-ignore
2097
+ const { httpClient, sideEffects } = arguments[2];
2098
+ const payload = renameKeysFromSDKRequestToRESTRequest({
2099
+ orderId: orderId,
2100
+ status: status,
2101
+ });
2102
+ const reqOpts = ambassadorWixEcomV1Order.updateOrderStatus(payload);
2103
+ sideEffects?.onSiteCall?.();
2104
+ try {
2105
+ const result = await httpClient.request(reqOpts);
2106
+ sideEffects?.onSuccess?.(result);
2107
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
2108
+ {
2109
+ transformFn: transformRESTImageToSDKImage,
2110
+ paths: [{ path: 'order.lineItems.image' }],
2111
+ },
2112
+ {
2113
+ transformFn: transformRESTAddressToSDKAddress,
2114
+ paths: [
2115
+ { path: 'order.billingInfo.address' },
2116
+ {
2117
+ path: 'order.shippingInfo.logistics.shippingDestination.address',
2118
+ },
2119
+ { path: 'order.shippingInfo.logistics.pickupDetails.address' },
2120
+ { path: 'order.recipientInfo.address' },
2121
+ ],
2122
+ },
2123
+ ]));
2124
+ }
2125
+ catch (err) {
2126
+ const transformedError = sdkTransformError(err, {
2127
+ spreadPathsToArguments: {},
2128
+ explicitPathsToArguments: { orderId: '$[0]', status: '$[1]' },
2129
+ singleArgumentUnchanged: false,
2130
+ }, ['orderId', 'status']);
2131
+ sideEffects?.onError?.(err);
2132
+ throw transformedError;
2133
+ }
2134
+ }
2135
+ /** @internal
2136
+ * @documentationMaturity preview
2137
+ * @requiredField options.aggregation
2138
+ * @permissionId ECOM.READ_ORDERS
2139
+ * @permissionScope Manage Stores - all permissions
2140
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
2141
+ * @permissionScope Read eCommerce - all read permissions
2142
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
2143
+ * @permissionScope Read Orders
2144
+ * @permissionScopeId SCOPE.DC-STORES.READ-ORDERS
2145
+ * @permissionScope Read Stores - all read permissions
2146
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
2147
+ * @permissionScope Manage Restaurants - all permissions
2148
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
2149
+ * @permissionScope Manage eCommerce - all permissions
2150
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
2151
+ * @permissionScope Manage Orders
2152
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
2153
+ * @applicableIdentity APP
2154
+ * @fqn com.wix.ecom.orders.v1.Orders.AggregateOrders
2155
+ */
2156
+ export async function aggregateOrders(options) {
2157
+ // @ts-ignore
2158
+ const { httpClient, sideEffects } = arguments[1];
2159
+ const payload = renameKeysFromSDKRequestToRESTRequest({
2160
+ filter: options?.filter,
2161
+ aggregation: options?.aggregation,
2162
+ hierarchySeparatorOverride: options?.hierarchySeparatorOverride,
2163
+ });
2164
+ const reqOpts = ambassadorWixEcomV1Order.aggregateOrders(payload);
2165
+ sideEffects?.onSiteCall?.();
2166
+ try {
2167
+ const result = await httpClient.request(reqOpts);
2168
+ sideEffects?.onSuccess?.(result);
2169
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
2170
+ }
2171
+ catch (err) {
2172
+ const transformedError = sdkTransformError(err, {
2173
+ spreadPathsToArguments: {},
2174
+ explicitPathsToArguments: {
2175
+ filter: '$[0].filter',
2176
+ aggregation: '$[0].aggregation',
2177
+ hierarchySeparatorOverride: '$[0].hierarchySeparatorOverride',
2178
+ },
2179
+ singleArgumentUnchanged: false,
2180
+ }, ['options']);
2181
+ sideEffects?.onError?.(err);
2182
+ throw transformedError;
2183
+ }
2184
+ }
2185
+ /**
2186
+ * Synchronously update tags on multiple orders, by list of order IDs.
2187
+ *
2188
+ * > **Note:** If the same tag is passed to both the `assignTags` and `unassignTags` fields, it will be assigned.
2189
+ * @param orderIds - IDs of orders to update tags for.
2190
+ * @public
2191
+ * @requiredField orderIds
2192
+ * @permissionId ECOM.MODIFY_ORDERS
2193
+ * @permissionId ECOM.ORDER_MODIFY_PRIVATE_TAGS
2194
+ * @permissionScope Manage Stores - all permissions
2195
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
2196
+ * @permissionScope Manage Restaurants - all permissions
2197
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
2198
+ * @permissionScope Manage eCommerce - all permissions
2199
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
2200
+ * @permissionScope Manage Orders
2201
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
2202
+ * @permissionScope Manage Stores - all permissions
2203
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
2204
+ * @permissionScope Manage Restaurants - all permissions
2205
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
2206
+ * @permissionScope Manage eCommerce - all permissions
2207
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
2208
+ * @permissionScope Manage Orders
2209
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
2210
+ * @applicableIdentity APP
2211
+ * @fqn com.wix.ecom.orders.v1.Orders.BulkUpdateOrderTags
2212
+ */
2213
+ export async function bulkUpdateOrderTags(orderIds, options) {
2214
+ // @ts-ignore
2215
+ const { httpClient, sideEffects } = arguments[2];
2216
+ const payload = renameKeysFromSDKRequestToRESTRequest({
2217
+ orderIds: orderIds,
2218
+ assignTags: options?.assignTags,
2219
+ unassignTags: options?.unassignTags,
2220
+ });
2221
+ const reqOpts = ambassadorWixEcomV1Order.bulkUpdateOrderTags(payload);
2222
+ sideEffects?.onSiteCall?.();
2223
+ try {
2224
+ const result = await httpClient.request(reqOpts);
2225
+ sideEffects?.onSuccess?.(result);
2226
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
2227
+ }
2228
+ catch (err) {
2229
+ const transformedError = sdkTransformError(err, {
2230
+ spreadPathsToArguments: {},
2231
+ explicitPathsToArguments: {
2232
+ orderIds: '$[0]',
2233
+ assignTags: '$[1].assignTags',
2234
+ unassignTags: '$[1].unassignTags',
2235
+ },
2236
+ singleArgumentUnchanged: false,
2237
+ }, ['orderIds', 'options']);
2238
+ sideEffects?.onError?.(err);
2239
+ throw transformedError;
2240
+ }
2241
+ }
2242
+ //# sourceMappingURL=ecom-v1-order-orders.universal.js.map