@wix/auto_sdk_ecom_checkout 1.0.16 → 1.0.18

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