@wix/auto_sdk_ecom_checkout 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) 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-checkout-checkout.context.d.ts +37 -0
  11. package/build/cjs/src/ecom-v1-checkout-checkout.context.js +71 -0
  12. package/build/cjs/src/ecom-v1-checkout-checkout.context.js.map +1 -0
  13. package/build/cjs/src/ecom-v1-checkout-checkout.http.d.ts +120 -0
  14. package/build/cjs/src/ecom-v1-checkout-checkout.http.js +1299 -0
  15. package/build/cjs/src/ecom-v1-checkout-checkout.http.js.map +1 -0
  16. package/build/cjs/src/ecom-v1-checkout-checkout.meta.d.ts +58 -0
  17. package/build/cjs/src/ecom-v1-checkout-checkout.meta.js +332 -0
  18. package/build/cjs/src/ecom-v1-checkout-checkout.meta.js.map +1 -0
  19. package/build/cjs/src/ecom-v1-checkout-checkout.public.d.ts +186 -0
  20. package/build/cjs/src/ecom-v1-checkout-checkout.public.js +346 -0
  21. package/build/cjs/src/ecom-v1-checkout-checkout.public.js.map +1 -0
  22. package/build/cjs/src/ecom-v1-checkout-checkout.types.d.ts +3046 -0
  23. package/build/cjs/src/ecom-v1-checkout-checkout.types.js +301 -0
  24. package/build/cjs/src/ecom-v1-checkout-checkout.types.js.map +1 -0
  25. package/build/cjs/src/ecom-v1-checkout-checkout.universal.d.ts +3740 -0
  26. package/build/cjs/src/ecom-v1-checkout-checkout.universal.js +1513 -0
  27. package/build/cjs/src/ecom-v1-checkout-checkout.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-checkout-checkout.context.d.ts +37 -0
  39. package/build/es/src/ecom-v1-checkout-checkout.context.js +37 -0
  40. package/build/es/src/ecom-v1-checkout-checkout.context.js.map +1 -0
  41. package/build/es/src/ecom-v1-checkout-checkout.http.d.ts +120 -0
  42. package/build/es/src/ecom-v1-checkout-checkout.http.js +1280 -0
  43. package/build/es/src/ecom-v1-checkout-checkout.http.js.map +1 -0
  44. package/build/es/src/ecom-v1-checkout-checkout.meta.d.ts +58 -0
  45. package/build/es/src/ecom-v1-checkout-checkout.meta.js +290 -0
  46. package/build/es/src/ecom-v1-checkout-checkout.meta.js.map +1 -0
  47. package/build/es/src/ecom-v1-checkout-checkout.public.d.ts +186 -0
  48. package/build/es/src/ecom-v1-checkout-checkout.public.js +295 -0
  49. package/build/es/src/ecom-v1-checkout-checkout.public.js.map +1 -0
  50. package/build/es/src/ecom-v1-checkout-checkout.types.d.ts +3046 -0
  51. package/build/es/src/ecom-v1-checkout-checkout.types.js +298 -0
  52. package/build/es/src/ecom-v1-checkout-checkout.types.js.map +1 -0
  53. package/build/es/src/ecom-v1-checkout-checkout.universal.d.ts +3740 -0
  54. package/build/es/src/ecom-v1-checkout-checkout.universal.js +1471 -0
  55. package/build/es/src/ecom-v1-checkout-checkout.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-checkout-checkout.context.d.ts +37 -0
  66. package/build/internal/cjs/src/ecom-v1-checkout-checkout.context.js +71 -0
  67. package/build/internal/cjs/src/ecom-v1-checkout-checkout.context.js.map +1 -0
  68. package/build/internal/cjs/src/ecom-v1-checkout-checkout.http.d.ts +120 -0
  69. package/build/internal/cjs/src/ecom-v1-checkout-checkout.http.js +1299 -0
  70. package/build/internal/cjs/src/ecom-v1-checkout-checkout.http.js.map +1 -0
  71. package/build/internal/cjs/src/ecom-v1-checkout-checkout.meta.d.ts +58 -0
  72. package/build/internal/cjs/src/ecom-v1-checkout-checkout.meta.js +332 -0
  73. package/build/internal/cjs/src/ecom-v1-checkout-checkout.meta.js.map +1 -0
  74. package/build/internal/cjs/src/ecom-v1-checkout-checkout.public.d.ts +210 -0
  75. package/build/internal/cjs/src/ecom-v1-checkout-checkout.public.js +346 -0
  76. package/build/internal/cjs/src/ecom-v1-checkout-checkout.public.js.map +1 -0
  77. package/build/internal/cjs/src/ecom-v1-checkout-checkout.types.d.ts +3085 -0
  78. package/build/internal/cjs/src/ecom-v1-checkout-checkout.types.js +301 -0
  79. package/build/internal/cjs/src/ecom-v1-checkout-checkout.types.js.map +1 -0
  80. package/build/internal/cjs/src/ecom-v1-checkout-checkout.universal.d.ts +4005 -0
  81. package/build/internal/cjs/src/ecom-v1-checkout-checkout.universal.js +1513 -0
  82. package/build/internal/cjs/src/ecom-v1-checkout-checkout.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-checkout-checkout.context.d.ts +37 -0
  93. package/build/internal/es/src/ecom-v1-checkout-checkout.context.js +37 -0
  94. package/build/internal/es/src/ecom-v1-checkout-checkout.context.js.map +1 -0
  95. package/build/internal/es/src/ecom-v1-checkout-checkout.http.d.ts +120 -0
  96. package/build/internal/es/src/ecom-v1-checkout-checkout.http.js +1280 -0
  97. package/build/internal/es/src/ecom-v1-checkout-checkout.http.js.map +1 -0
  98. package/build/internal/es/src/ecom-v1-checkout-checkout.meta.d.ts +58 -0
  99. package/build/internal/es/src/ecom-v1-checkout-checkout.meta.js +290 -0
  100. package/build/internal/es/src/ecom-v1-checkout-checkout.meta.js.map +1 -0
  101. package/build/internal/es/src/ecom-v1-checkout-checkout.public.d.ts +210 -0
  102. package/build/internal/es/src/ecom-v1-checkout-checkout.public.js +295 -0
  103. package/build/internal/es/src/ecom-v1-checkout-checkout.public.js.map +1 -0
  104. package/build/internal/es/src/ecom-v1-checkout-checkout.types.d.ts +3085 -0
  105. package/build/internal/es/src/ecom-v1-checkout-checkout.types.js +298 -0
  106. package/build/internal/es/src/ecom-v1-checkout-checkout.types.js.map +1 -0
  107. package/build/internal/es/src/ecom-v1-checkout-checkout.universal.d.ts +4005 -0
  108. package/build/internal/es/src/ecom-v1-checkout-checkout.universal.js +1471 -0
  109. package/build/internal/es/src/ecom-v1-checkout-checkout.universal.js.map +1 -0
  110. package/meta/package.json +3 -0
  111. package/package.json +52 -0
@@ -0,0 +1,1299 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCheckoutPaymentSettings = exports.updateLineItemsQuantity = exports.markCheckoutAsCompleted = exports.createOrderAndCharge = exports.createOrder = exports.removeLineItems = exports.addToCheckout = exports.removeOverrideCheckoutUrl = exports.removeGiftCard = exports.removeCoupon = exports.updateCheckout = exports.getCheckoutUrl = exports.getWixCheckoutUrl = exports.getCheckoutByCartId = exports.getCheckout = exports.createCheckout = void 0;
4
+ const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
5
+ const float_1 = require("@wix/sdk-runtime/transformations/float");
6
+ const float_2 = require("@wix/sdk-runtime/transformations/float");
7
+ const timestamp_1 = require("@wix/sdk-runtime/transformations/timestamp");
8
+ const timestamp_2 = require("@wix/sdk-runtime/transformations/timestamp");
9
+ const field_mask_1 = require("@wix/sdk-runtime/transformations/field-mask");
10
+ const transform_paths_1 = require("@wix/sdk-runtime/transformations/transform-paths");
11
+ const rest_modules_2 = require("@wix/sdk-runtime/rest-modules");
12
+ function resolveComWixEcomCheckoutApiV1CheckoutServiceUrl(opts) {
13
+ const domainToMappings = {
14
+ 'www.wixapis.com': [
15
+ {
16
+ srcPath: '/ecom/v1/checkouts',
17
+ destPath: '/v1/checkouts',
18
+ },
19
+ ],
20
+ 'api._api_base_domain_': [
21
+ {
22
+ srcPath: '/checkout',
23
+ destPath: '',
24
+ },
25
+ ],
26
+ _: [
27
+ {
28
+ srcPath: '/ecom/v1/checkouts',
29
+ destPath: '/v1/checkouts',
30
+ },
31
+ ],
32
+ 'manage._base_domain_': [
33
+ {
34
+ srcPath: '/ecom/v1/checkouts',
35
+ destPath: '/v1/checkouts',
36
+ },
37
+ ],
38
+ 'www._base_domain_': [
39
+ {
40
+ srcPath: '/ecom/v1/checkouts',
41
+ destPath: '/v1/checkouts',
42
+ },
43
+ ],
44
+ 'bo._base_domain_': [
45
+ {
46
+ srcPath: '/ecom/v1/checkouts',
47
+ destPath: '/v1/checkouts',
48
+ },
49
+ ],
50
+ 'wixbo.ai': [
51
+ {
52
+ srcPath: '/ecom/v1/checkouts',
53
+ destPath: '/v1/checkouts',
54
+ },
55
+ ],
56
+ 'wix-bo.com': [
57
+ {
58
+ srcPath: '/ecom/v1/checkouts',
59
+ destPath: '/v1/checkouts',
60
+ },
61
+ ],
62
+ };
63
+ return (0, rest_modules_2.resolveUrl)(Object.assign(opts, { domainToMappings }));
64
+ }
65
+ const PACKAGE_NAME = '@wix/auto_sdk_ecom_checkout';
66
+ /**
67
+ * Creates a checkout.
68
+ *
69
+ *
70
+ * The `createCheckout()` function returns a Promise that resolves to the new checkout when it's created.
71
+ *
72
+ * > **Notes:**
73
+ * > + Checkout must include at least 1 item in the `options.lineItems` array.
74
+ * > + `options.channelType` is required.
75
+ * > + If `_id` for `options.lineItems` is added, make sure that each `_id` is unique.
76
+ * > + If `options.checkoutInfo.customFields` are added, then `options.checkoutInfo.customFields.value` is required.
77
+ */
78
+ function createCheckout(payload) {
79
+ function __createCheckout({ host }) {
80
+ const serializedData = (0, transform_paths_1.transformPaths)(payload, [
81
+ {
82
+ transformFn: timestamp_1.transformSDKTimestampToRESTTimestamp,
83
+ paths: [
84
+ { path: 'checkoutInfo.createdDate' },
85
+ { path: 'checkoutInfo.updatedDate' },
86
+ { path: 'checkoutInfo.lineItems.media.urlExpirationDate' },
87
+ {
88
+ path: 'checkoutInfo.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
89
+ },
90
+ { path: 'checkoutInfo.lineItems.serviceProperties.scheduledDate' },
91
+ {
92
+ path: 'checkoutInfo.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.from',
93
+ },
94
+ {
95
+ path: 'checkoutInfo.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.to',
96
+ },
97
+ {
98
+ path: 'checkoutInfo.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.from',
99
+ },
100
+ {
101
+ path: 'checkoutInfo.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.to',
102
+ },
103
+ {
104
+ path: 'checkoutInfo.membershipOptions.eligibleMemberships.expirationDate',
105
+ },
106
+ {
107
+ path: 'checkoutInfo.membershipOptions.invalidMemberships.membership.expirationDate',
108
+ },
109
+ { path: 'lineItems.media.urlExpirationDate' },
110
+ {
111
+ path: 'lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
112
+ },
113
+ { path: 'lineItems.serviceProperties.scheduledDate' },
114
+ {
115
+ path: 'customLineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
116
+ },
117
+ { path: 'customLineItems.serviceProperties.scheduledDate' },
118
+ ],
119
+ },
120
+ {
121
+ transformFn: float_1.transformSDKFloatToRESTFloat,
122
+ paths: [
123
+ { path: 'checkoutInfo.lineItems.media.focalPoint.x' },
124
+ { path: 'checkoutInfo.lineItems.media.focalPoint.y' },
125
+ { path: 'lineItems.media.focalPoint.x' },
126
+ { path: 'lineItems.media.focalPoint.y' },
127
+ { path: 'checkoutInfo.lineItems.physicalProperties.weight' },
128
+ {
129
+ path: 'checkoutInfo.lineItems.catalogOverrideFields.physicalProperties.weight',
130
+ },
131
+ { path: 'checkoutInfo.billingInfo.address.geocode.latitude' },
132
+ { path: 'checkoutInfo.billingInfo.address.geocode.longitude' },
133
+ {
134
+ path: 'checkoutInfo.shippingInfo.shippingDestination.address.geocode.latitude',
135
+ },
136
+ {
137
+ path: 'checkoutInfo.shippingInfo.shippingDestination.address.geocode.longitude',
138
+ },
139
+ {
140
+ path: 'checkoutInfo.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.latitude',
141
+ },
142
+ {
143
+ path: 'checkoutInfo.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.longitude',
144
+ },
145
+ {
146
+ path: 'checkoutInfo.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.latitude',
147
+ },
148
+ {
149
+ path: 'checkoutInfo.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.longitude',
150
+ },
151
+ { path: 'checkoutInfo.appliedDiscounts.merchantDiscount.percentage' },
152
+ { path: 'lineItems.physicalProperties.weight' },
153
+ { path: 'lineItems.catalogOverrideFields.physicalProperties.weight' },
154
+ { path: 'customLineItems.physicalProperties.weight' },
155
+ ],
156
+ },
157
+ ]);
158
+ const metadata = {
159
+ entityFqdn: 'wix.ecom.v1.checkout',
160
+ method: 'POST',
161
+ methodFqn: 'com.wix.ecom.checkout.api.v1.CheckoutService.CreateCheckout',
162
+ packageName: PACKAGE_NAME,
163
+ url: resolveComWixEcomCheckoutApiV1CheckoutServiceUrl({
164
+ protoPath: '/v1/checkouts',
165
+ data: serializedData,
166
+ host,
167
+ }),
168
+ data: serializedData,
169
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
170
+ {
171
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
172
+ paths: [
173
+ { path: 'checkout.createdDate' },
174
+ { path: 'checkout.updatedDate' },
175
+ { path: 'checkout.lineItems.media.urlExpirationDate' },
176
+ {
177
+ path: 'checkout.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
178
+ },
179
+ { path: 'checkout.lineItems.serviceProperties.scheduledDate' },
180
+ {
181
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.from',
182
+ },
183
+ {
184
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.to',
185
+ },
186
+ {
187
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.from',
188
+ },
189
+ {
190
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.to',
191
+ },
192
+ {
193
+ path: 'checkout.membershipOptions.eligibleMemberships.expirationDate',
194
+ },
195
+ {
196
+ path: 'checkout.membershipOptions.invalidMemberships.membership.expirationDate',
197
+ },
198
+ ],
199
+ },
200
+ {
201
+ transformFn: float_2.transformRESTFloatToSDKFloat,
202
+ paths: [
203
+ { path: 'checkout.lineItems.media.focalPoint.x' },
204
+ { path: 'checkout.lineItems.media.focalPoint.y' },
205
+ { path: 'checkout.lineItems.physicalProperties.weight' },
206
+ {
207
+ path: 'checkout.lineItems.catalogOverrideFields.physicalProperties.weight',
208
+ },
209
+ { path: 'checkout.billingInfo.address.geocode.latitude' },
210
+ { path: 'checkout.billingInfo.address.geocode.longitude' },
211
+ {
212
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.latitude',
213
+ },
214
+ {
215
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.longitude',
216
+ },
217
+ {
218
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.latitude',
219
+ },
220
+ {
221
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.longitude',
222
+ },
223
+ {
224
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.latitude',
225
+ },
226
+ {
227
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.longitude',
228
+ },
229
+ { path: 'checkout.appliedDiscounts.merchantDiscount.percentage' },
230
+ ],
231
+ },
232
+ ]),
233
+ };
234
+ return metadata;
235
+ }
236
+ return __createCheckout;
237
+ }
238
+ exports.createCheckout = createCheckout;
239
+ /**
240
+ * Retrieves a checkout.
241
+ *
242
+ *
243
+ * The `getCheckout()` function returns a Promise that resolves when the specified checkout is retrieved.
244
+ */
245
+ function getCheckout(payload) {
246
+ function __getCheckout({ host }) {
247
+ const metadata = {
248
+ entityFqdn: 'wix.ecom.v1.checkout',
249
+ method: 'GET',
250
+ methodFqn: 'com.wix.ecom.checkout.api.v1.CheckoutService.GetCheckout',
251
+ packageName: PACKAGE_NAME,
252
+ url: resolveComWixEcomCheckoutApiV1CheckoutServiceUrl({
253
+ protoPath: '/v1/checkouts/{id}',
254
+ data: payload,
255
+ host,
256
+ }),
257
+ params: (0, rest_modules_1.toURLSearchParams)(payload),
258
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
259
+ {
260
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
261
+ paths: [
262
+ { path: 'checkout.createdDate' },
263
+ { path: 'checkout.updatedDate' },
264
+ { path: 'checkout.lineItems.media.urlExpirationDate' },
265
+ {
266
+ path: 'checkout.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
267
+ },
268
+ { path: 'checkout.lineItems.serviceProperties.scheduledDate' },
269
+ {
270
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.from',
271
+ },
272
+ {
273
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.to',
274
+ },
275
+ {
276
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.from',
277
+ },
278
+ {
279
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.to',
280
+ },
281
+ {
282
+ path: 'checkout.membershipOptions.eligibleMemberships.expirationDate',
283
+ },
284
+ {
285
+ path: 'checkout.membershipOptions.invalidMemberships.membership.expirationDate',
286
+ },
287
+ ],
288
+ },
289
+ {
290
+ transformFn: float_2.transformRESTFloatToSDKFloat,
291
+ paths: [
292
+ { path: 'checkout.lineItems.media.focalPoint.x' },
293
+ { path: 'checkout.lineItems.media.focalPoint.y' },
294
+ { path: 'checkout.lineItems.physicalProperties.weight' },
295
+ {
296
+ path: 'checkout.lineItems.catalogOverrideFields.physicalProperties.weight',
297
+ },
298
+ { path: 'checkout.billingInfo.address.geocode.latitude' },
299
+ { path: 'checkout.billingInfo.address.geocode.longitude' },
300
+ {
301
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.latitude',
302
+ },
303
+ {
304
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.longitude',
305
+ },
306
+ {
307
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.latitude',
308
+ },
309
+ {
310
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.longitude',
311
+ },
312
+ {
313
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.latitude',
314
+ },
315
+ {
316
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.longitude',
317
+ },
318
+ { path: 'checkout.appliedDiscounts.merchantDiscount.percentage' },
319
+ ],
320
+ },
321
+ ]),
322
+ };
323
+ return metadata;
324
+ }
325
+ return __getCheckout;
326
+ }
327
+ exports.getCheckout = getCheckout;
328
+ /** Retrieves the checkout associated with a specified cart. */
329
+ function getCheckoutByCartId(payload) {
330
+ function __getCheckoutByCartId({ host }) {
331
+ const metadata = {
332
+ entityFqdn: 'wix.ecom.v1.checkout',
333
+ method: 'GET',
334
+ methodFqn: 'com.wix.ecom.checkout.api.v1.CheckoutService.GetCheckoutByCartId',
335
+ packageName: PACKAGE_NAME,
336
+ url: resolveComWixEcomCheckoutApiV1CheckoutServiceUrl({
337
+ protoPath: '/v1/checkouts/by-cart-id/{id}',
338
+ data: payload,
339
+ host,
340
+ }),
341
+ params: (0, rest_modules_1.toURLSearchParams)(payload),
342
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
343
+ {
344
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
345
+ paths: [
346
+ { path: 'checkout.createdDate' },
347
+ { path: 'checkout.updatedDate' },
348
+ { path: 'checkout.lineItems.media.urlExpirationDate' },
349
+ {
350
+ path: 'checkout.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
351
+ },
352
+ { path: 'checkout.lineItems.serviceProperties.scheduledDate' },
353
+ {
354
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.from',
355
+ },
356
+ {
357
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.to',
358
+ },
359
+ {
360
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.from',
361
+ },
362
+ {
363
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.to',
364
+ },
365
+ {
366
+ path: 'checkout.membershipOptions.eligibleMemberships.expirationDate',
367
+ },
368
+ {
369
+ path: 'checkout.membershipOptions.invalidMemberships.membership.expirationDate',
370
+ },
371
+ ],
372
+ },
373
+ {
374
+ transformFn: float_2.transformRESTFloatToSDKFloat,
375
+ paths: [
376
+ { path: 'checkout.lineItems.media.focalPoint.x' },
377
+ { path: 'checkout.lineItems.media.focalPoint.y' },
378
+ { path: 'checkout.lineItems.physicalProperties.weight' },
379
+ {
380
+ path: 'checkout.lineItems.catalogOverrideFields.physicalProperties.weight',
381
+ },
382
+ { path: 'checkout.billingInfo.address.geocode.latitude' },
383
+ { path: 'checkout.billingInfo.address.geocode.longitude' },
384
+ {
385
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.latitude',
386
+ },
387
+ {
388
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.longitude',
389
+ },
390
+ {
391
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.latitude',
392
+ },
393
+ {
394
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.longitude',
395
+ },
396
+ {
397
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.latitude',
398
+ },
399
+ {
400
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.longitude',
401
+ },
402
+ { path: 'checkout.appliedDiscounts.merchantDiscount.percentage' },
403
+ ],
404
+ },
405
+ ]),
406
+ };
407
+ return metadata;
408
+ }
409
+ return __getCheckoutByCartId;
410
+ }
411
+ exports.getCheckoutByCartId = getCheckoutByCartId;
412
+ /** Deprecated and will be removed soon, use GetCheckoutURL */
413
+ function getWixCheckoutUrl(payload) {
414
+ function __getWixCheckoutUrl({ host }) {
415
+ const metadata = {
416
+ entityFqdn: 'wix.ecom.v1.checkout',
417
+ method: 'GET',
418
+ methodFqn: 'com.wix.ecom.checkout.api.v1.CheckoutService.GetWixCheckoutURL',
419
+ packageName: PACKAGE_NAME,
420
+ url: resolveComWixEcomCheckoutApiV1CheckoutServiceUrl({
421
+ protoPath: '/v1/checkouts/{id}/wix-checkout-url',
422
+ data: payload,
423
+ host,
424
+ }),
425
+ params: (0, rest_modules_1.toURLSearchParams)(payload),
426
+ };
427
+ return metadata;
428
+ }
429
+ return __getWixCheckoutUrl;
430
+ }
431
+ exports.getWixCheckoutUrl = getWixCheckoutUrl;
432
+ /**
433
+ * Retrieves the checkout page URL of a specified checkout.
434
+ *
435
+ * By default, a `checkoutUrl` generates for a checkout and directs to a standard Wix checkout page.
436
+ * However, if `overrideCheckoutUrl` has a value, it will replace and set the value of `checkoutUrl`.
437
+ */
438
+ function getCheckoutUrl(payload) {
439
+ function __getCheckoutUrl({ host }) {
440
+ const metadata = {
441
+ entityFqdn: 'wix.ecom.v1.checkout',
442
+ method: 'GET',
443
+ methodFqn: 'com.wix.ecom.checkout.api.v1.CheckoutService.GetCheckoutURL',
444
+ packageName: PACKAGE_NAME,
445
+ url: resolveComWixEcomCheckoutApiV1CheckoutServiceUrl({
446
+ protoPath: '/v1/checkouts/{id}/checkout-url',
447
+ data: payload,
448
+ host,
449
+ }),
450
+ params: (0, rest_modules_1.toURLSearchParams)(payload),
451
+ };
452
+ return metadata;
453
+ }
454
+ return __getCheckoutUrl;
455
+ }
456
+ exports.getCheckoutUrl = getCheckoutUrl;
457
+ /**
458
+ * Updates a checkout.
459
+ *
460
+ *
461
+ * The `updateCheckout()` function returns a Promise that resolves to the updated checkout when the specified properties are updated.
462
+ *
463
+ * >**Notes:**
464
+ * > + If nothing is passed in the request, the call will fail.
465
+ * > + The `checkout.buyerInfo.email` may not be removed once it is set.
466
+ */
467
+ function updateCheckout(payload) {
468
+ function __updateCheckout({ host }) {
469
+ const serializedData = (0, transform_paths_1.transformPaths)(payload, [
470
+ {
471
+ transformFn: field_mask_1.transformSDKFieldMaskToRESTFieldMask,
472
+ paths: [{ path: 'fieldMask' }],
473
+ },
474
+ {
475
+ transformFn: timestamp_1.transformSDKTimestampToRESTTimestamp,
476
+ paths: [
477
+ { path: 'checkout.createdDate' },
478
+ { path: 'checkout.updatedDate' },
479
+ { path: 'checkout.lineItems.media.urlExpirationDate' },
480
+ {
481
+ path: 'checkout.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
482
+ },
483
+ { path: 'checkout.lineItems.serviceProperties.scheduledDate' },
484
+ {
485
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.from',
486
+ },
487
+ {
488
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.to',
489
+ },
490
+ {
491
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.from',
492
+ },
493
+ {
494
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.to',
495
+ },
496
+ {
497
+ path: 'checkout.membershipOptions.eligibleMemberships.expirationDate',
498
+ },
499
+ {
500
+ path: 'checkout.membershipOptions.invalidMemberships.membership.expirationDate',
501
+ },
502
+ { path: 'lineItems.media.urlExpirationDate' },
503
+ {
504
+ path: 'lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
505
+ },
506
+ { path: 'lineItems.serviceProperties.scheduledDate' },
507
+ {
508
+ path: 'customLineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
509
+ },
510
+ { path: 'customLineItems.serviceProperties.scheduledDate' },
511
+ ],
512
+ },
513
+ {
514
+ transformFn: float_1.transformSDKFloatToRESTFloat,
515
+ paths: [
516
+ { path: 'checkout.lineItems.media.focalPoint.x' },
517
+ { path: 'checkout.lineItems.media.focalPoint.y' },
518
+ { path: 'lineItems.media.focalPoint.x' },
519
+ { path: 'lineItems.media.focalPoint.y' },
520
+ { path: 'checkout.lineItems.physicalProperties.weight' },
521
+ {
522
+ path: 'checkout.lineItems.catalogOverrideFields.physicalProperties.weight',
523
+ },
524
+ { path: 'checkout.billingInfo.address.geocode.latitude' },
525
+ { path: 'checkout.billingInfo.address.geocode.longitude' },
526
+ {
527
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.latitude',
528
+ },
529
+ {
530
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.longitude',
531
+ },
532
+ {
533
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.latitude',
534
+ },
535
+ {
536
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.longitude',
537
+ },
538
+ {
539
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.latitude',
540
+ },
541
+ {
542
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.longitude',
543
+ },
544
+ { path: 'checkout.appliedDiscounts.merchantDiscount.percentage' },
545
+ { path: 'lineItems.physicalProperties.weight' },
546
+ { path: 'lineItems.catalogOverrideFields.physicalProperties.weight' },
547
+ { path: 'customLineItems.physicalProperties.weight' },
548
+ ],
549
+ },
550
+ ]);
551
+ const metadata = {
552
+ entityFqdn: 'wix.ecom.v1.checkout',
553
+ method: 'PATCH',
554
+ methodFqn: 'com.wix.ecom.checkout.api.v1.CheckoutService.UpdateCheckout',
555
+ packageName: PACKAGE_NAME,
556
+ url: resolveComWixEcomCheckoutApiV1CheckoutServiceUrl({
557
+ protoPath: '/v1/checkouts/{checkout.id}',
558
+ data: serializedData,
559
+ host,
560
+ }),
561
+ data: serializedData,
562
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
563
+ {
564
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
565
+ paths: [
566
+ { path: 'checkout.createdDate' },
567
+ { path: 'checkout.updatedDate' },
568
+ { path: 'checkout.lineItems.media.urlExpirationDate' },
569
+ {
570
+ path: 'checkout.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
571
+ },
572
+ { path: 'checkout.lineItems.serviceProperties.scheduledDate' },
573
+ {
574
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.from',
575
+ },
576
+ {
577
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.to',
578
+ },
579
+ {
580
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.from',
581
+ },
582
+ {
583
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.to',
584
+ },
585
+ {
586
+ path: 'checkout.membershipOptions.eligibleMemberships.expirationDate',
587
+ },
588
+ {
589
+ path: 'checkout.membershipOptions.invalidMemberships.membership.expirationDate',
590
+ },
591
+ ],
592
+ },
593
+ {
594
+ transformFn: float_2.transformRESTFloatToSDKFloat,
595
+ paths: [
596
+ { path: 'checkout.lineItems.media.focalPoint.x' },
597
+ { path: 'checkout.lineItems.media.focalPoint.y' },
598
+ { path: 'checkout.lineItems.physicalProperties.weight' },
599
+ {
600
+ path: 'checkout.lineItems.catalogOverrideFields.physicalProperties.weight',
601
+ },
602
+ { path: 'checkout.billingInfo.address.geocode.latitude' },
603
+ { path: 'checkout.billingInfo.address.geocode.longitude' },
604
+ {
605
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.latitude',
606
+ },
607
+ {
608
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.longitude',
609
+ },
610
+ {
611
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.latitude',
612
+ },
613
+ {
614
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.longitude',
615
+ },
616
+ {
617
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.latitude',
618
+ },
619
+ {
620
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.longitude',
621
+ },
622
+ { path: 'checkout.appliedDiscounts.merchantDiscount.percentage' },
623
+ ],
624
+ },
625
+ ]),
626
+ };
627
+ return metadata;
628
+ }
629
+ return __updateCheckout;
630
+ }
631
+ exports.updateCheckout = updateCheckout;
632
+ /**
633
+ * Removes the coupon from a specified checkout.
634
+ *
635
+ *
636
+ * The `removeCoupon()` function returns a Promise that resolves to the updated checkout when the coupon is removed from the specified checkout.
637
+ *
638
+ * >**Note:** A checkout can only hold 1 coupon.
639
+ */
640
+ function removeCoupon(payload) {
641
+ function __removeCoupon({ host }) {
642
+ const metadata = {
643
+ entityFqdn: 'wix.ecom.v1.checkout',
644
+ method: 'POST',
645
+ methodFqn: 'com.wix.ecom.checkout.api.v1.CheckoutService.RemoveCoupon',
646
+ packageName: PACKAGE_NAME,
647
+ url: resolveComWixEcomCheckoutApiV1CheckoutServiceUrl({
648
+ protoPath: '/v1/checkouts/{id}/remove-coupon',
649
+ data: payload,
650
+ host,
651
+ }),
652
+ data: payload,
653
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
654
+ {
655
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
656
+ paths: [
657
+ { path: 'checkout.createdDate' },
658
+ { path: 'checkout.updatedDate' },
659
+ { path: 'checkout.lineItems.media.urlExpirationDate' },
660
+ {
661
+ path: 'checkout.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
662
+ },
663
+ { path: 'checkout.lineItems.serviceProperties.scheduledDate' },
664
+ {
665
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.from',
666
+ },
667
+ {
668
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.to',
669
+ },
670
+ {
671
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.from',
672
+ },
673
+ {
674
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.to',
675
+ },
676
+ {
677
+ path: 'checkout.membershipOptions.eligibleMemberships.expirationDate',
678
+ },
679
+ {
680
+ path: 'checkout.membershipOptions.invalidMemberships.membership.expirationDate',
681
+ },
682
+ ],
683
+ },
684
+ {
685
+ transformFn: float_2.transformRESTFloatToSDKFloat,
686
+ paths: [
687
+ { path: 'checkout.lineItems.media.focalPoint.x' },
688
+ { path: 'checkout.lineItems.media.focalPoint.y' },
689
+ { path: 'checkout.lineItems.physicalProperties.weight' },
690
+ {
691
+ path: 'checkout.lineItems.catalogOverrideFields.physicalProperties.weight',
692
+ },
693
+ { path: 'checkout.billingInfo.address.geocode.latitude' },
694
+ { path: 'checkout.billingInfo.address.geocode.longitude' },
695
+ {
696
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.latitude',
697
+ },
698
+ {
699
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.longitude',
700
+ },
701
+ {
702
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.latitude',
703
+ },
704
+ {
705
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.longitude',
706
+ },
707
+ {
708
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.latitude',
709
+ },
710
+ {
711
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.longitude',
712
+ },
713
+ { path: 'checkout.appliedDiscounts.merchantDiscount.percentage' },
714
+ ],
715
+ },
716
+ ]),
717
+ };
718
+ return metadata;
719
+ }
720
+ return __removeCoupon;
721
+ }
722
+ exports.removeCoupon = removeCoupon;
723
+ /**
724
+ * Removes the gift card from a specified checkout.
725
+ *
726
+ *
727
+ * The `removeGiftCard()` function returns a Promise that resolves to the updated checkout when the gift card is removed from the specified checkout.
728
+ *
729
+ * >**Note:** A checkout can only hold 1 gift card.
730
+ */
731
+ function removeGiftCard(payload) {
732
+ function __removeGiftCard({ host }) {
733
+ const metadata = {
734
+ entityFqdn: 'wix.ecom.v1.checkout',
735
+ method: 'POST',
736
+ methodFqn: 'com.wix.ecom.checkout.api.v1.CheckoutService.RemoveGiftCard',
737
+ packageName: PACKAGE_NAME,
738
+ url: resolveComWixEcomCheckoutApiV1CheckoutServiceUrl({
739
+ protoPath: '/v1/checkouts/{id}/remove-gift-card',
740
+ data: payload,
741
+ host,
742
+ }),
743
+ data: payload,
744
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
745
+ {
746
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
747
+ paths: [
748
+ { path: 'checkout.createdDate' },
749
+ { path: 'checkout.updatedDate' },
750
+ { path: 'checkout.lineItems.media.urlExpirationDate' },
751
+ {
752
+ path: 'checkout.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
753
+ },
754
+ { path: 'checkout.lineItems.serviceProperties.scheduledDate' },
755
+ {
756
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.from',
757
+ },
758
+ {
759
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.to',
760
+ },
761
+ {
762
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.from',
763
+ },
764
+ {
765
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.to',
766
+ },
767
+ {
768
+ path: 'checkout.membershipOptions.eligibleMemberships.expirationDate',
769
+ },
770
+ {
771
+ path: 'checkout.membershipOptions.invalidMemberships.membership.expirationDate',
772
+ },
773
+ ],
774
+ },
775
+ {
776
+ transformFn: float_2.transformRESTFloatToSDKFloat,
777
+ paths: [
778
+ { path: 'checkout.lineItems.media.focalPoint.x' },
779
+ { path: 'checkout.lineItems.media.focalPoint.y' },
780
+ { path: 'checkout.lineItems.physicalProperties.weight' },
781
+ {
782
+ path: 'checkout.lineItems.catalogOverrideFields.physicalProperties.weight',
783
+ },
784
+ { path: 'checkout.billingInfo.address.geocode.latitude' },
785
+ { path: 'checkout.billingInfo.address.geocode.longitude' },
786
+ {
787
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.latitude',
788
+ },
789
+ {
790
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.longitude',
791
+ },
792
+ {
793
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.latitude',
794
+ },
795
+ {
796
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.longitude',
797
+ },
798
+ {
799
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.latitude',
800
+ },
801
+ {
802
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.longitude',
803
+ },
804
+ { path: 'checkout.appliedDiscounts.merchantDiscount.percentage' },
805
+ ],
806
+ },
807
+ ]),
808
+ };
809
+ return metadata;
810
+ }
811
+ return __removeGiftCard;
812
+ }
813
+ exports.removeGiftCard = removeGiftCard;
814
+ /**
815
+ * Removes the `overrideCheckoutUrl` from a specified checkout.
816
+ *
817
+ * When `overrideCheckoutUrl` is removed, the `checkoutUrl` will be set to the default, standard
818
+ * Wix checkout page URL.
819
+ */
820
+ function removeOverrideCheckoutUrl(payload) {
821
+ function __removeOverrideCheckoutUrl({ host }) {
822
+ const metadata = {
823
+ entityFqdn: 'wix.ecom.v1.checkout',
824
+ method: 'POST',
825
+ methodFqn: 'com.wix.ecom.checkout.api.v1.CheckoutService.RemoveOverrideCheckoutUrl',
826
+ packageName: PACKAGE_NAME,
827
+ url: resolveComWixEcomCheckoutApiV1CheckoutServiceUrl({
828
+ protoPath: '/v1/checkouts/{id}/remove-override-checkout-url',
829
+ data: payload,
830
+ host,
831
+ }),
832
+ data: payload,
833
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
834
+ {
835
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
836
+ paths: [
837
+ { path: 'checkout.createdDate' },
838
+ { path: 'checkout.updatedDate' },
839
+ { path: 'checkout.lineItems.media.urlExpirationDate' },
840
+ {
841
+ path: 'checkout.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
842
+ },
843
+ { path: 'checkout.lineItems.serviceProperties.scheduledDate' },
844
+ {
845
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.from',
846
+ },
847
+ {
848
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.to',
849
+ },
850
+ {
851
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.from',
852
+ },
853
+ {
854
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.to',
855
+ },
856
+ {
857
+ path: 'checkout.membershipOptions.eligibleMemberships.expirationDate',
858
+ },
859
+ {
860
+ path: 'checkout.membershipOptions.invalidMemberships.membership.expirationDate',
861
+ },
862
+ ],
863
+ },
864
+ {
865
+ transformFn: float_2.transformRESTFloatToSDKFloat,
866
+ paths: [
867
+ { path: 'checkout.lineItems.media.focalPoint.x' },
868
+ { path: 'checkout.lineItems.media.focalPoint.y' },
869
+ { path: 'checkout.lineItems.physicalProperties.weight' },
870
+ {
871
+ path: 'checkout.lineItems.catalogOverrideFields.physicalProperties.weight',
872
+ },
873
+ { path: 'checkout.billingInfo.address.geocode.latitude' },
874
+ { path: 'checkout.billingInfo.address.geocode.longitude' },
875
+ {
876
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.latitude',
877
+ },
878
+ {
879
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.longitude',
880
+ },
881
+ {
882
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.latitude',
883
+ },
884
+ {
885
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.longitude',
886
+ },
887
+ {
888
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.latitude',
889
+ },
890
+ {
891
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.longitude',
892
+ },
893
+ { path: 'checkout.appliedDiscounts.merchantDiscount.percentage' },
894
+ ],
895
+ },
896
+ ]),
897
+ };
898
+ return metadata;
899
+ }
900
+ return __removeOverrideCheckoutUrl;
901
+ }
902
+ exports.removeOverrideCheckoutUrl = removeOverrideCheckoutUrl;
903
+ /**
904
+ * Adds catalog line items and/or custom line items to a checkout.
905
+ *
906
+ *
907
+ * The `addToCheckout()` function returns a Promise that resolves to the updated checkout when the specified items have been added.
908
+ * > **Note:** When adding catalog items, `options.lineItems.catalogReference` is required.
909
+ */
910
+ function addToCheckout(payload) {
911
+ function __addToCheckout({ host }) {
912
+ const serializedData = (0, transform_paths_1.transformPaths)(payload, [
913
+ {
914
+ transformFn: timestamp_1.transformSDKTimestampToRESTTimestamp,
915
+ paths: [
916
+ { path: 'lineItems.media.urlExpirationDate' },
917
+ {
918
+ path: 'lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
919
+ },
920
+ { path: 'lineItems.serviceProperties.scheduledDate' },
921
+ {
922
+ path: 'customLineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
923
+ },
924
+ { path: 'customLineItems.serviceProperties.scheduledDate' },
925
+ ],
926
+ },
927
+ {
928
+ transformFn: float_1.transformSDKFloatToRESTFloat,
929
+ paths: [
930
+ { path: 'lineItems.media.focalPoint.x' },
931
+ { path: 'lineItems.media.focalPoint.y' },
932
+ { path: 'lineItems.physicalProperties.weight' },
933
+ { path: 'lineItems.catalogOverrideFields.physicalProperties.weight' },
934
+ { path: 'customLineItems.physicalProperties.weight' },
935
+ ],
936
+ },
937
+ ]);
938
+ const metadata = {
939
+ entityFqdn: 'wix.ecom.v1.checkout',
940
+ method: 'POST',
941
+ methodFqn: 'com.wix.ecom.checkout.api.v1.CheckoutService.AddToCheckout',
942
+ packageName: PACKAGE_NAME,
943
+ url: resolveComWixEcomCheckoutApiV1CheckoutServiceUrl({
944
+ protoPath: '/v1/checkouts/{id}/add-to-checkout',
945
+ data: serializedData,
946
+ host,
947
+ }),
948
+ data: serializedData,
949
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
950
+ {
951
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
952
+ paths: [
953
+ { path: 'checkout.createdDate' },
954
+ { path: 'checkout.updatedDate' },
955
+ { path: 'checkout.lineItems.media.urlExpirationDate' },
956
+ {
957
+ path: 'checkout.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
958
+ },
959
+ { path: 'checkout.lineItems.serviceProperties.scheduledDate' },
960
+ {
961
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.from',
962
+ },
963
+ {
964
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.to',
965
+ },
966
+ {
967
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.from',
968
+ },
969
+ {
970
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.to',
971
+ },
972
+ {
973
+ path: 'checkout.membershipOptions.eligibleMemberships.expirationDate',
974
+ },
975
+ {
976
+ path: 'checkout.membershipOptions.invalidMemberships.membership.expirationDate',
977
+ },
978
+ ],
979
+ },
980
+ {
981
+ transformFn: float_2.transformRESTFloatToSDKFloat,
982
+ paths: [
983
+ { path: 'checkout.lineItems.media.focalPoint.x' },
984
+ { path: 'checkout.lineItems.media.focalPoint.y' },
985
+ { path: 'checkout.lineItems.physicalProperties.weight' },
986
+ {
987
+ path: 'checkout.lineItems.catalogOverrideFields.physicalProperties.weight',
988
+ },
989
+ { path: 'checkout.billingInfo.address.geocode.latitude' },
990
+ { path: 'checkout.billingInfo.address.geocode.longitude' },
991
+ {
992
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.latitude',
993
+ },
994
+ {
995
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.longitude',
996
+ },
997
+ {
998
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.latitude',
999
+ },
1000
+ {
1001
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.longitude',
1002
+ },
1003
+ {
1004
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.latitude',
1005
+ },
1006
+ {
1007
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.longitude',
1008
+ },
1009
+ { path: 'checkout.appliedDiscounts.merchantDiscount.percentage' },
1010
+ ],
1011
+ },
1012
+ ]),
1013
+ };
1014
+ return metadata;
1015
+ }
1016
+ return __addToCheckout;
1017
+ }
1018
+ exports.addToCheckout = addToCheckout;
1019
+ /**
1020
+ * Removes line items from the specified checkout.
1021
+ *
1022
+ *
1023
+ * The `removeLineItems()` function returns a Promise that resolves to the updated checkout when the line items are removed from the specified checkout.
1024
+ */
1025
+ function removeLineItems(payload) {
1026
+ function __removeLineItems({ host }) {
1027
+ const metadata = {
1028
+ entityFqdn: 'wix.ecom.v1.checkout',
1029
+ method: 'POST',
1030
+ methodFqn: 'com.wix.ecom.checkout.api.v1.CheckoutService.RemoveLineItems',
1031
+ packageName: PACKAGE_NAME,
1032
+ url: resolveComWixEcomCheckoutApiV1CheckoutServiceUrl({
1033
+ protoPath: '/v1/checkouts/{id}/remove-line-items',
1034
+ data: payload,
1035
+ host,
1036
+ }),
1037
+ data: payload,
1038
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
1039
+ {
1040
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
1041
+ paths: [
1042
+ { path: 'checkout.createdDate' },
1043
+ { path: 'checkout.updatedDate' },
1044
+ { path: 'checkout.lineItems.media.urlExpirationDate' },
1045
+ {
1046
+ path: 'checkout.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
1047
+ },
1048
+ { path: 'checkout.lineItems.serviceProperties.scheduledDate' },
1049
+ {
1050
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.from',
1051
+ },
1052
+ {
1053
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.to',
1054
+ },
1055
+ {
1056
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.from',
1057
+ },
1058
+ {
1059
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.to',
1060
+ },
1061
+ {
1062
+ path: 'checkout.membershipOptions.eligibleMemberships.expirationDate',
1063
+ },
1064
+ {
1065
+ path: 'checkout.membershipOptions.invalidMemberships.membership.expirationDate',
1066
+ },
1067
+ ],
1068
+ },
1069
+ {
1070
+ transformFn: float_2.transformRESTFloatToSDKFloat,
1071
+ paths: [
1072
+ { path: 'checkout.lineItems.media.focalPoint.x' },
1073
+ { path: 'checkout.lineItems.media.focalPoint.y' },
1074
+ { path: 'checkout.lineItems.physicalProperties.weight' },
1075
+ {
1076
+ path: 'checkout.lineItems.catalogOverrideFields.physicalProperties.weight',
1077
+ },
1078
+ { path: 'checkout.billingInfo.address.geocode.latitude' },
1079
+ { path: 'checkout.billingInfo.address.geocode.longitude' },
1080
+ {
1081
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.latitude',
1082
+ },
1083
+ {
1084
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.longitude',
1085
+ },
1086
+ {
1087
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.latitude',
1088
+ },
1089
+ {
1090
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.longitude',
1091
+ },
1092
+ {
1093
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.latitude',
1094
+ },
1095
+ {
1096
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.longitude',
1097
+ },
1098
+ { path: 'checkout.appliedDiscounts.merchantDiscount.percentage' },
1099
+ ],
1100
+ },
1101
+ ]),
1102
+ };
1103
+ return metadata;
1104
+ }
1105
+ return __removeLineItems;
1106
+ }
1107
+ exports.removeLineItems = removeLineItems;
1108
+ /**
1109
+ * Creates an order from a specified checkout.
1110
+ *
1111
+ * The `createOrder()` function returns a Promise that resolves to the new order's ID and `paymentGatewayOrderID` when the order is created.
1112
+ * Pass the `paymentGatewayOrderId` as the `paymentId` param to the [`startPayment()`](https://www.wix.com/velo/reference/wix-pay-frontend/startpayment) function to allow a customer to pay for their order.
1113
+ *
1114
+ * > **Note:** The following requirements must be met for an order to be created from a checkout.
1115
+ * > + A checkout cannot have calculation errors. Pass the `checkout._id` to [Get Checkout](https://www.wix.com/velo/reference/wix-ecom-backend/checkout/getcheckout) and take a look at the `calculationErrors` field.
1116
+ * > + A checkout must have at least 1 line item.
1117
+ * > + All of the line Items have an `availability.status` of `"AVAILABLE"` or `"PARTIALLY_AVAILABLE"`.
1118
+ * > + If there is a payment to be made, meaning that `priceSummary.total` is greater than 0, the `billingInfo.address` field must be provided.
1119
+ * > + When a checkout has line items to be shipped, the `shippingInfo.shippingDestination.address` and `shippingInfo.selectedCarrierServiceOption` fields must be provided.
1120
+ * > + When a checkout has line items for pickup, the `shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails` field must be provided.
1121
+ */
1122
+ function createOrder(payload) {
1123
+ function __createOrder({ host }) {
1124
+ const metadata = {
1125
+ entityFqdn: 'wix.ecom.v1.checkout',
1126
+ method: 'POST',
1127
+ methodFqn: 'com.wix.ecom.checkout.api.v1.CheckoutService.CreateOrder',
1128
+ packageName: PACKAGE_NAME,
1129
+ url: resolveComWixEcomCheckoutApiV1CheckoutServiceUrl({
1130
+ protoPath: '/v1/checkouts/{id}/create-order',
1131
+ data: payload,
1132
+ host,
1133
+ }),
1134
+ data: payload,
1135
+ };
1136
+ return metadata;
1137
+ }
1138
+ return __createOrder;
1139
+ }
1140
+ exports.createOrder = createOrder;
1141
+ /** Deprecated (use createOrder instead) */
1142
+ function createOrderAndCharge(payload) {
1143
+ function __createOrderAndCharge({ host }) {
1144
+ const metadata = {
1145
+ entityFqdn: 'wix.ecom.v1.checkout',
1146
+ method: 'POST',
1147
+ methodFqn: 'com.wix.ecom.checkout.api.v1.CheckoutService.CreateOrderAndCharge',
1148
+ packageName: PACKAGE_NAME,
1149
+ url: resolveComWixEcomCheckoutApiV1CheckoutServiceUrl({
1150
+ protoPath: '/v1/checkouts/{id}/create-order-and-charge',
1151
+ data: payload,
1152
+ host,
1153
+ }),
1154
+ data: payload,
1155
+ };
1156
+ return metadata;
1157
+ }
1158
+ return __createOrderAndCharge;
1159
+ }
1160
+ exports.createOrderAndCharge = createOrderAndCharge;
1161
+ /**
1162
+ * Marks a checkout as completed - `checkout.complete` boolean is set to `true`.
1163
+ *
1164
+ *
1165
+ * The `markCheckoutAsCompleted()` function returns a Promise that resolves when the specified checkout is marked as completed.
1166
+ */
1167
+ function markCheckoutAsCompleted(payload) {
1168
+ function __markCheckoutAsCompleted({ host }) {
1169
+ const metadata = {
1170
+ entityFqdn: 'wix.ecom.v1.checkout',
1171
+ method: 'POST',
1172
+ methodFqn: 'com.wix.ecom.checkout.api.v1.CheckoutService.MarkCheckoutAsCompleted',
1173
+ packageName: PACKAGE_NAME,
1174
+ url: resolveComWixEcomCheckoutApiV1CheckoutServiceUrl({
1175
+ protoPath: '/v1/checkouts/{id}/mark-as-completed',
1176
+ data: payload,
1177
+ host,
1178
+ }),
1179
+ data: payload,
1180
+ };
1181
+ return metadata;
1182
+ }
1183
+ return __markCheckoutAsCompleted;
1184
+ }
1185
+ exports.markCheckoutAsCompleted = markCheckoutAsCompleted;
1186
+ /**
1187
+ * Updates the quantity of one or more line items in a checkout.
1188
+ *
1189
+ * This endpoint is only for updating the quantity of line items. To entirely remove a line item from
1190
+ * the checkout, use [`removeLineItems()`](#removelineitems).
1191
+ * To add a new line item to the checkout, use [`addToCheckout()`](#addtocheckout).
1192
+ *
1193
+ * This endpoint checks the amount of stock remaining for this line item. If the specified `quantity`
1194
+ * is greater than the remaining stock, then the `quantity` returned in the response is the total amount
1195
+ * of remaining stock.
1196
+ */
1197
+ function updateLineItemsQuantity(payload) {
1198
+ function __updateLineItemsQuantity({ host }) {
1199
+ const metadata = {
1200
+ entityFqdn: 'wix.ecom.v1.checkout',
1201
+ method: 'POST',
1202
+ methodFqn: 'com.wix.ecom.checkout.api.v1.CheckoutService.UpdateLineItemsQuantity',
1203
+ packageName: PACKAGE_NAME,
1204
+ url: resolveComWixEcomCheckoutApiV1CheckoutServiceUrl({
1205
+ protoPath: '/v1/checkouts/{id}/update-line-items-quantity',
1206
+ data: payload,
1207
+ host,
1208
+ }),
1209
+ data: payload,
1210
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
1211
+ {
1212
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
1213
+ paths: [
1214
+ { path: 'checkout.createdDate' },
1215
+ { path: 'checkout.updatedDate' },
1216
+ { path: 'checkout.lineItems.media.urlExpirationDate' },
1217
+ {
1218
+ path: 'checkout.lineItems.subscriptionOptionInfo.subscriptionSettings.startDate',
1219
+ },
1220
+ { path: 'checkout.lineItems.serviceProperties.scheduledDate' },
1221
+ {
1222
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.from',
1223
+ },
1224
+ {
1225
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.deliveryTimeSlot.to',
1226
+ },
1227
+ {
1228
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.from',
1229
+ },
1230
+ {
1231
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.deliveryTimeSlot.to',
1232
+ },
1233
+ {
1234
+ path: 'checkout.membershipOptions.eligibleMemberships.expirationDate',
1235
+ },
1236
+ {
1237
+ path: 'checkout.membershipOptions.invalidMemberships.membership.expirationDate',
1238
+ },
1239
+ ],
1240
+ },
1241
+ {
1242
+ transformFn: float_2.transformRESTFloatToSDKFloat,
1243
+ paths: [
1244
+ { path: 'checkout.lineItems.media.focalPoint.x' },
1245
+ { path: 'checkout.lineItems.media.focalPoint.y' },
1246
+ { path: 'checkout.lineItems.physicalProperties.weight' },
1247
+ {
1248
+ path: 'checkout.lineItems.catalogOverrideFields.physicalProperties.weight',
1249
+ },
1250
+ { path: 'checkout.billingInfo.address.geocode.latitude' },
1251
+ { path: 'checkout.billingInfo.address.geocode.longitude' },
1252
+ {
1253
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.latitude',
1254
+ },
1255
+ {
1256
+ path: 'checkout.shippingInfo.shippingDestination.address.geocode.longitude',
1257
+ },
1258
+ {
1259
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.latitude',
1260
+ },
1261
+ {
1262
+ path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address.geocode.longitude',
1263
+ },
1264
+ {
1265
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.latitude',
1266
+ },
1267
+ {
1268
+ path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address.geocode.longitude',
1269
+ },
1270
+ { path: 'checkout.appliedDiscounts.merchantDiscount.percentage' },
1271
+ ],
1272
+ },
1273
+ ]),
1274
+ };
1275
+ return metadata;
1276
+ }
1277
+ return __updateLineItemsQuantity;
1278
+ }
1279
+ exports.updateLineItemsQuantity = updateLineItemsQuantity;
1280
+ function getCheckoutPaymentSettings(payload) {
1281
+ function __getCheckoutPaymentSettings({ host }) {
1282
+ const metadata = {
1283
+ entityFqdn: 'wix.ecom.v1.checkout',
1284
+ method: 'GET',
1285
+ methodFqn: 'com.wix.ecom.checkout.api.v1.CheckoutService.GetCheckoutPaymentSettings',
1286
+ packageName: PACKAGE_NAME,
1287
+ url: resolveComWixEcomCheckoutApiV1CheckoutServiceUrl({
1288
+ protoPath: '/v1/checkouts/{id}/payment-settings',
1289
+ data: payload,
1290
+ host,
1291
+ }),
1292
+ params: (0, rest_modules_1.toURLSearchParams)(payload),
1293
+ };
1294
+ return metadata;
1295
+ }
1296
+ return __getCheckoutPaymentSettings;
1297
+ }
1298
+ exports.getCheckoutPaymentSettings = getCheckoutPaymentSettings;
1299
+ //# sourceMappingURL=ecom-v1-checkout-checkout.http.js.map