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