@wix/auto_sdk_ecom_checkout 1.0.35 → 1.0.37
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.
- package/build/{es/src/ecom-v1-checkout-checkout.types.d.ts → ecom-v1-checkout-checkout.universal-DEDRvPML.d.mts} +674 -365
- package/build/{cjs/src/ecom-v1-checkout-checkout.types.d.ts → ecom-v1-checkout-checkout.universal-DEDRvPML.d.ts} +674 -365
- package/build/index.d.mts +210 -0
- package/build/index.d.ts +210 -0
- package/build/index.js +2782 -0
- package/build/index.js.map +1 -0
- package/build/index.mjs +2708 -0
- package/build/index.mjs.map +1 -0
- package/build/internal/{cjs/src/ecom-v1-checkout-checkout.types.d.ts → ecom-v1-checkout-checkout.universal-CirtPjnM.d.mts} +803 -364
- package/build/internal/{es/src/ecom-v1-checkout-checkout.types.d.ts → ecom-v1-checkout-checkout.universal-CirtPjnM.d.ts} +803 -364
- package/build/internal/index.d.mts +240 -0
- package/build/internal/index.d.ts +240 -0
- package/build/internal/index.js +2782 -0
- package/build/internal/index.js.map +1 -0
- package/build/internal/index.mjs +2708 -0
- package/build/internal/index.mjs.map +1 -0
- package/build/internal/meta.d.mts +2606 -0
- package/build/internal/meta.d.ts +2606 -0
- package/build/internal/meta.js +1587 -0
- package/build/internal/meta.js.map +1 -0
- package/build/internal/meta.mjs +1544 -0
- package/build/internal/meta.mjs.map +1 -0
- package/build/meta.d.mts +2606 -0
- package/build/meta.d.ts +2606 -0
- package/build/meta.js +1587 -0
- package/build/meta.js.map +1 -0
- package/build/meta.mjs +1544 -0
- package/build/meta.mjs.map +1 -0
- package/package.json +12 -11
- package/build/cjs/index.d.ts +0 -1
- package/build/cjs/index.js +0 -18
- package/build/cjs/index.js.map +0 -1
- package/build/cjs/index.typings.d.ts +0 -1
- package/build/cjs/index.typings.js +0 -18
- package/build/cjs/index.typings.js.map +0 -1
- package/build/cjs/meta.d.ts +0 -1
- package/build/cjs/meta.js +0 -18
- package/build/cjs/meta.js.map +0 -1
- package/build/cjs/src/ecom-v1-checkout-checkout.context.d.ts +0 -35
- package/build/cjs/src/ecom-v1-checkout-checkout.context.js +0 -76
- package/build/cjs/src/ecom-v1-checkout-checkout.context.js.map +0 -1
- package/build/cjs/src/ecom-v1-checkout-checkout.http.d.ts +0 -122
- package/build/cjs/src/ecom-v1-checkout-checkout.http.js +0 -1338
- package/build/cjs/src/ecom-v1-checkout-checkout.http.js.map +0 -1
- package/build/cjs/src/ecom-v1-checkout-checkout.meta.d.ts +0 -59
- package/build/cjs/src/ecom-v1-checkout-checkout.meta.js +0 -351
- package/build/cjs/src/ecom-v1-checkout-checkout.meta.js.map +0 -1
- package/build/cjs/src/ecom-v1-checkout-checkout.public.d.ts +0 -194
- package/build/cjs/src/ecom-v1-checkout-checkout.public.js +0 -357
- package/build/cjs/src/ecom-v1-checkout-checkout.public.js.map +0 -1
- package/build/cjs/src/ecom-v1-checkout-checkout.types.js +0 -303
- package/build/cjs/src/ecom-v1-checkout-checkout.types.js.map +0 -1
- package/build/cjs/src/ecom-v1-checkout-checkout.universal.d.ts +0 -4429
- package/build/cjs/src/ecom-v1-checkout-checkout.universal.js +0 -1599
- package/build/cjs/src/ecom-v1-checkout-checkout.universal.js.map +0 -1
- package/build/es/index.d.ts +0 -1
- package/build/es/index.js +0 -2
- package/build/es/index.js.map +0 -1
- package/build/es/index.typings.d.ts +0 -1
- package/build/es/index.typings.js +0 -2
- package/build/es/index.typings.js.map +0 -1
- package/build/es/meta.d.ts +0 -1
- package/build/es/meta.js +0 -2
- package/build/es/meta.js.map +0 -1
- package/build/es/package.json +0 -3
- package/build/es/src/ecom-v1-checkout-checkout.context.d.ts +0 -35
- package/build/es/src/ecom-v1-checkout-checkout.context.js +0 -41
- package/build/es/src/ecom-v1-checkout-checkout.context.js.map +0 -1
- package/build/es/src/ecom-v1-checkout-checkout.http.d.ts +0 -122
- package/build/es/src/ecom-v1-checkout-checkout.http.js +0 -1318
- package/build/es/src/ecom-v1-checkout-checkout.http.js.map +0 -1
- package/build/es/src/ecom-v1-checkout-checkout.meta.d.ts +0 -59
- package/build/es/src/ecom-v1-checkout-checkout.meta.js +0 -308
- package/build/es/src/ecom-v1-checkout-checkout.meta.js.map +0 -1
- package/build/es/src/ecom-v1-checkout-checkout.public.d.ts +0 -194
- package/build/es/src/ecom-v1-checkout-checkout.public.js +0 -305
- package/build/es/src/ecom-v1-checkout-checkout.public.js.map +0 -1
- package/build/es/src/ecom-v1-checkout-checkout.types.js +0 -300
- package/build/es/src/ecom-v1-checkout-checkout.types.js.map +0 -1
- package/build/es/src/ecom-v1-checkout-checkout.universal.d.ts +0 -4429
- package/build/es/src/ecom-v1-checkout-checkout.universal.js +0 -1556
- package/build/es/src/ecom-v1-checkout-checkout.universal.js.map +0 -1
- package/build/internal/cjs/index.d.ts +0 -1
- package/build/internal/cjs/index.js +0 -18
- package/build/internal/cjs/index.js.map +0 -1
- package/build/internal/cjs/index.typings.d.ts +0 -1
- package/build/internal/cjs/index.typings.js +0 -18
- package/build/internal/cjs/index.typings.js.map +0 -1
- package/build/internal/cjs/meta.d.ts +0 -1
- package/build/internal/cjs/meta.js +0 -18
- package/build/internal/cjs/meta.js.map +0 -1
- package/build/internal/cjs/src/ecom-v1-checkout-checkout.context.d.ts +0 -41
- package/build/internal/cjs/src/ecom-v1-checkout-checkout.context.js +0 -76
- package/build/internal/cjs/src/ecom-v1-checkout-checkout.context.js.map +0 -1
- package/build/internal/cjs/src/ecom-v1-checkout-checkout.http.d.ts +0 -122
- package/build/internal/cjs/src/ecom-v1-checkout-checkout.http.js +0 -1338
- package/build/internal/cjs/src/ecom-v1-checkout-checkout.http.js.map +0 -1
- package/build/internal/cjs/src/ecom-v1-checkout-checkout.meta.d.ts +0 -59
- package/build/internal/cjs/src/ecom-v1-checkout-checkout.meta.js +0 -351
- package/build/internal/cjs/src/ecom-v1-checkout-checkout.meta.js.map +0 -1
- package/build/internal/cjs/src/ecom-v1-checkout-checkout.public.d.ts +0 -218
- package/build/internal/cjs/src/ecom-v1-checkout-checkout.public.js +0 -357
- package/build/internal/cjs/src/ecom-v1-checkout-checkout.public.js.map +0 -1
- package/build/internal/cjs/src/ecom-v1-checkout-checkout.types.js +0 -303
- package/build/internal/cjs/src/ecom-v1-checkout-checkout.types.js.map +0 -1
- package/build/internal/cjs/src/ecom-v1-checkout-checkout.universal.d.ts +0 -4615
- package/build/internal/cjs/src/ecom-v1-checkout-checkout.universal.js +0 -1599
- package/build/internal/cjs/src/ecom-v1-checkout-checkout.universal.js.map +0 -1
- package/build/internal/es/index.d.ts +0 -1
- package/build/internal/es/index.js +0 -2
- package/build/internal/es/index.js.map +0 -1
- package/build/internal/es/index.typings.d.ts +0 -1
- package/build/internal/es/index.typings.js +0 -2
- package/build/internal/es/index.typings.js.map +0 -1
- package/build/internal/es/meta.d.ts +0 -1
- package/build/internal/es/meta.js +0 -2
- package/build/internal/es/meta.js.map +0 -1
- package/build/internal/es/src/ecom-v1-checkout-checkout.context.d.ts +0 -41
- package/build/internal/es/src/ecom-v1-checkout-checkout.context.js +0 -41
- package/build/internal/es/src/ecom-v1-checkout-checkout.context.js.map +0 -1
- package/build/internal/es/src/ecom-v1-checkout-checkout.http.d.ts +0 -122
- package/build/internal/es/src/ecom-v1-checkout-checkout.http.js +0 -1318
- package/build/internal/es/src/ecom-v1-checkout-checkout.http.js.map +0 -1
- package/build/internal/es/src/ecom-v1-checkout-checkout.meta.d.ts +0 -59
- package/build/internal/es/src/ecom-v1-checkout-checkout.meta.js +0 -308
- package/build/internal/es/src/ecom-v1-checkout-checkout.meta.js.map +0 -1
- package/build/internal/es/src/ecom-v1-checkout-checkout.public.d.ts +0 -218
- package/build/internal/es/src/ecom-v1-checkout-checkout.public.js +0 -305
- package/build/internal/es/src/ecom-v1-checkout-checkout.public.js.map +0 -1
- package/build/internal/es/src/ecom-v1-checkout-checkout.types.js +0 -300
- package/build/internal/es/src/ecom-v1-checkout-checkout.types.js.map +0 -1
- package/build/internal/es/src/ecom-v1-checkout-checkout.universal.d.ts +0 -4615
- package/build/internal/es/src/ecom-v1-checkout-checkout.universal.js +0 -1556
- package/build/internal/es/src/ecom-v1-checkout-checkout.universal.js.map +0 -1
|
@@ -1,1556 +0,0 @@
|
|
|
1
|
-
import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';
|
|
2
|
-
import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys';
|
|
3
|
-
import * as ambassadorWixEcomV1Checkout from './ecom-v1-checkout-checkout.http.js';
|
|
4
|
-
import { transformSDKAddressToRESTAddress } from '@wix/sdk-runtime/transformations/address';
|
|
5
|
-
import { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';
|
|
6
|
-
import { transformSDKImageToRESTImage } from '@wix/sdk-runtime/transformations/image';
|
|
7
|
-
import { transformRESTImageToSDKImage } from '@wix/sdk-runtime/transformations/image';
|
|
8
|
-
import { transformSDKPageURLV2ToRESTPageURLV2 } from '@wix/sdk-runtime/transformations/page-url-v2';
|
|
9
|
-
import { transformRESTPageURLV2ToSDKPageURLV2 } from '@wix/sdk-runtime/transformations/page-url-v2';
|
|
10
|
-
import { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';
|
|
11
|
-
/** JurisdictionType represents the type of the jurisdiction in which this tax detail applies (e.g. Country,State,County,City,Special). */
|
|
12
|
-
export var JurisdictionType;
|
|
13
|
-
(function (JurisdictionType) {
|
|
14
|
-
JurisdictionType["UNDEFINED"] = "UNDEFINED";
|
|
15
|
-
JurisdictionType["COUNTRY"] = "COUNTRY";
|
|
16
|
-
JurisdictionType["STATE"] = "STATE";
|
|
17
|
-
JurisdictionType["COUNTY"] = "COUNTY";
|
|
18
|
-
JurisdictionType["CITY"] = "CITY";
|
|
19
|
-
JurisdictionType["SPECIAL"] = "SPECIAL";
|
|
20
|
-
})(JurisdictionType || (JurisdictionType = {}));
|
|
21
|
-
export var DescriptionLineType;
|
|
22
|
-
(function (DescriptionLineType) {
|
|
23
|
-
/** Unrecognized type. */
|
|
24
|
-
DescriptionLineType["UNRECOGNISED"] = "UNRECOGNISED";
|
|
25
|
-
/** Plain text type. */
|
|
26
|
-
DescriptionLineType["PLAIN_TEXT"] = "PLAIN_TEXT";
|
|
27
|
-
/** Color type. */
|
|
28
|
-
DescriptionLineType["COLOR"] = "COLOR";
|
|
29
|
-
})(DescriptionLineType || (DescriptionLineType = {}));
|
|
30
|
-
export var ItemAvailabilityStatus;
|
|
31
|
-
(function (ItemAvailabilityStatus) {
|
|
32
|
-
ItemAvailabilityStatus["AVAILABLE"] = "AVAILABLE";
|
|
33
|
-
/** Item does not exist. */
|
|
34
|
-
ItemAvailabilityStatus["NOT_FOUND"] = "NOT_FOUND";
|
|
35
|
-
/** Item is not in stock. */
|
|
36
|
-
ItemAvailabilityStatus["NOT_AVAILABLE"] = "NOT_AVAILABLE";
|
|
37
|
-
/** Available quantity is less than requested. */
|
|
38
|
-
ItemAvailabilityStatus["PARTIALLY_AVAILABLE"] = "PARTIALLY_AVAILABLE";
|
|
39
|
-
})(ItemAvailabilityStatus || (ItemAvailabilityStatus = {}));
|
|
40
|
-
export var ItemTypeItemType;
|
|
41
|
-
(function (ItemTypeItemType) {
|
|
42
|
-
ItemTypeItemType["UNRECOGNISED"] = "UNRECOGNISED";
|
|
43
|
-
ItemTypeItemType["PHYSICAL"] = "PHYSICAL";
|
|
44
|
-
ItemTypeItemType["DIGITAL"] = "DIGITAL";
|
|
45
|
-
ItemTypeItemType["GIFT_CARD"] = "GIFT_CARD";
|
|
46
|
-
ItemTypeItemType["SERVICE"] = "SERVICE";
|
|
47
|
-
})(ItemTypeItemType || (ItemTypeItemType = {}));
|
|
48
|
-
/** Frequency unit of recurring payment */
|
|
49
|
-
export var SubscriptionFrequency;
|
|
50
|
-
(function (SubscriptionFrequency) {
|
|
51
|
-
SubscriptionFrequency["UNDEFINED"] = "UNDEFINED";
|
|
52
|
-
SubscriptionFrequency["DAY"] = "DAY";
|
|
53
|
-
SubscriptionFrequency["WEEK"] = "WEEK";
|
|
54
|
-
SubscriptionFrequency["MONTH"] = "MONTH";
|
|
55
|
-
SubscriptionFrequency["YEAR"] = "YEAR";
|
|
56
|
-
})(SubscriptionFrequency || (SubscriptionFrequency = {}));
|
|
57
|
-
export var FileType;
|
|
58
|
-
(function (FileType) {
|
|
59
|
-
FileType["UNSPECIFIED"] = "UNSPECIFIED";
|
|
60
|
-
FileType["SECURE_PICTURE"] = "SECURE_PICTURE";
|
|
61
|
-
FileType["SECURE_VIDEO"] = "SECURE_VIDEO";
|
|
62
|
-
FileType["SECURE_DOCUMENT"] = "SECURE_DOCUMENT";
|
|
63
|
-
FileType["SECURE_MUSIC"] = "SECURE_MUSIC";
|
|
64
|
-
FileType["SECURE_ARCHIVE"] = "SECURE_ARCHIVE";
|
|
65
|
-
})(FileType || (FileType = {}));
|
|
66
|
-
/** Type of selected payment option for catalog item */
|
|
67
|
-
export var PaymentOptionType;
|
|
68
|
-
(function (PaymentOptionType) {
|
|
69
|
-
/** The entire payment for this item happens as part of the checkout. */
|
|
70
|
-
PaymentOptionType["FULL_PAYMENT_ONLINE"] = "FULL_PAYMENT_ONLINE";
|
|
71
|
-
/** The entire payment for this item happens after checkout. For example, when using cash, check, or other offline payment methods. */
|
|
72
|
-
PaymentOptionType["FULL_PAYMENT_OFFLINE"] = "FULL_PAYMENT_OFFLINE";
|
|
73
|
-
/** Payment for this item is done by charging a membership. When selected, `price` is `0`. */
|
|
74
|
-
PaymentOptionType["MEMBERSHIP"] = "MEMBERSHIP";
|
|
75
|
-
/** Partial payment to be paid upfront during checkout. The initial amount to be paid for each line item is specified in `depositAmount`. */
|
|
76
|
-
PaymentOptionType["DEPOSIT_ONLINE"] = "DEPOSIT_ONLINE";
|
|
77
|
-
/** Payment for this item can only be done by charging a membership and must be manually redeemed in the dashboard by the site admin. When selected, `price` is `0`. */
|
|
78
|
-
PaymentOptionType["MEMBERSHIP_OFFLINE"] = "MEMBERSHIP_OFFLINE";
|
|
79
|
-
})(PaymentOptionType || (PaymentOptionType = {}));
|
|
80
|
-
export var TaxableAddressType;
|
|
81
|
-
(function (TaxableAddressType) {
|
|
82
|
-
TaxableAddressType["UNKNOWN_TAXABLE_ADDRESS"] = "UNKNOWN_TAXABLE_ADDRESS";
|
|
83
|
-
TaxableAddressType["BUSINESS"] = "BUSINESS";
|
|
84
|
-
TaxableAddressType["BILLING"] = "BILLING";
|
|
85
|
-
TaxableAddressType["SHIPPING"] = "SHIPPING";
|
|
86
|
-
})(TaxableAddressType || (TaxableAddressType = {}));
|
|
87
|
-
/** tax info types */
|
|
88
|
-
export var CommonVatType;
|
|
89
|
-
(function (CommonVatType) {
|
|
90
|
-
CommonVatType["UNSPECIFIED"] = "UNSPECIFIED";
|
|
91
|
-
/** CPF - for individual tax payers. */
|
|
92
|
-
CommonVatType["CPF"] = "CPF";
|
|
93
|
-
/** CNPJ - for corporations */
|
|
94
|
-
CommonVatType["CNPJ"] = "CNPJ";
|
|
95
|
-
})(CommonVatType || (CommonVatType = {}));
|
|
96
|
-
export var PickupMethod;
|
|
97
|
-
(function (PickupMethod) {
|
|
98
|
-
PickupMethod["UNKNOWN_METHOD"] = "UNKNOWN_METHOD";
|
|
99
|
-
PickupMethod["STORE_PICKUP"] = "STORE_PICKUP";
|
|
100
|
-
PickupMethod["PICKUP_POINT"] = "PICKUP_POINT";
|
|
101
|
-
})(PickupMethod || (PickupMethod = {}));
|
|
102
|
-
export var ChargeType;
|
|
103
|
-
(function (ChargeType) {
|
|
104
|
-
ChargeType["HANDLING_FEE"] = "HANDLING_FEE";
|
|
105
|
-
ChargeType["INSURANCE"] = "INSURANCE";
|
|
106
|
-
})(ChargeType || (ChargeType = {}));
|
|
107
|
-
export var RuleType;
|
|
108
|
-
(function (RuleType) {
|
|
109
|
-
RuleType["VALIDATION"] = "VALIDATION";
|
|
110
|
-
RuleType["OTHER"] = "OTHER";
|
|
111
|
-
RuleType["MAX"] = "MAX";
|
|
112
|
-
RuleType["MIN"] = "MIN";
|
|
113
|
-
RuleType["MAX_LENGTH"] = "MAX_LENGTH";
|
|
114
|
-
RuleType["MIN_LENGTH"] = "MIN_LENGTH";
|
|
115
|
-
RuleType["MAX_SIZE"] = "MAX_SIZE";
|
|
116
|
-
RuleType["MIN_SIZE"] = "MIN_SIZE";
|
|
117
|
-
RuleType["FORMAT"] = "FORMAT";
|
|
118
|
-
RuleType["DECIMAL_LTE"] = "DECIMAL_LTE";
|
|
119
|
-
RuleType["DECIMAL_GTE"] = "DECIMAL_GTE";
|
|
120
|
-
RuleType["DECIMAL_LT"] = "DECIMAL_LT";
|
|
121
|
-
RuleType["DECIMAL_GT"] = "DECIMAL_GT";
|
|
122
|
-
RuleType["DECIMAL_MAX_SCALE"] = "DECIMAL_MAX_SCALE";
|
|
123
|
-
RuleType["INVALID_ENUM_VALUE"] = "INVALID_ENUM_VALUE";
|
|
124
|
-
RuleType["REQUIRED_FIELD"] = "REQUIRED_FIELD";
|
|
125
|
-
RuleType["FIELD_NOT_ALLOWED"] = "FIELD_NOT_ALLOWED";
|
|
126
|
-
RuleType["ONE_OF_ALIGNMENT"] = "ONE_OF_ALIGNMENT";
|
|
127
|
-
RuleType["EXACT_LENGTH"] = "EXACT_LENGTH";
|
|
128
|
-
RuleType["EXACT_SIZE"] = "EXACT_SIZE";
|
|
129
|
-
RuleType["REQUIRED_ONE_OF_FIELD"] = "REQUIRED_ONE_OF_FIELD";
|
|
130
|
-
})(RuleType || (RuleType = {}));
|
|
131
|
-
export var DiscountType;
|
|
132
|
-
(function (DiscountType) {
|
|
133
|
-
DiscountType["GLOBAL"] = "GLOBAL";
|
|
134
|
-
DiscountType["SPECIFIC_ITEMS"] = "SPECIFIC_ITEMS";
|
|
135
|
-
DiscountType["SHIPPING"] = "SHIPPING";
|
|
136
|
-
})(DiscountType || (DiscountType = {}));
|
|
137
|
-
export var WeightUnit;
|
|
138
|
-
(function (WeightUnit) {
|
|
139
|
-
/** Weight unit can't be classified due to an error. */
|
|
140
|
-
WeightUnit["UNSPECIFIED_WEIGHT_UNIT"] = "UNSPECIFIED_WEIGHT_UNIT";
|
|
141
|
-
/** Kilograms. */
|
|
142
|
-
WeightUnit["KG"] = "KG";
|
|
143
|
-
/** Pounds. */
|
|
144
|
-
WeightUnit["LB"] = "LB";
|
|
145
|
-
})(WeightUnit || (WeightUnit = {}));
|
|
146
|
-
export var RateType;
|
|
147
|
-
(function (RateType) {
|
|
148
|
-
/** no tax being collected for this request due to location of purchase */
|
|
149
|
-
RateType["NO_TAX_COLLECTED"] = "NO_TAX_COLLECTED";
|
|
150
|
-
/** manual rate used for calculation */
|
|
151
|
-
RateType["MANUAL_RATE"] = "MANUAL_RATE";
|
|
152
|
-
/** autotax rate used for calculation */
|
|
153
|
-
RateType["AUTO_RATE"] = "AUTO_RATE";
|
|
154
|
-
/** fallback rate used for calculation */
|
|
155
|
-
RateType["FALLBACK_RATE"] = "FALLBACK_RATE";
|
|
156
|
-
})(RateType || (RateType = {}));
|
|
157
|
-
export var ManualCalculationReason;
|
|
158
|
-
(function (ManualCalculationReason) {
|
|
159
|
-
/** user set calculator in Business Manager to be Manual */
|
|
160
|
-
ManualCalculationReason["GLOBAL_SETTING_TO_MANUAL"] = "GLOBAL_SETTING_TO_MANUAL";
|
|
161
|
-
/** specific region is on manual even though Global setting is Auto-tax */
|
|
162
|
-
ManualCalculationReason["REGION_SETTING_TO_MANUAL"] = "REGION_SETTING_TO_MANUAL";
|
|
163
|
-
})(ManualCalculationReason || (ManualCalculationReason = {}));
|
|
164
|
-
export var FallbackReason;
|
|
165
|
-
(function (FallbackReason) {
|
|
166
|
-
/** auto-tax failed to be calculated */
|
|
167
|
-
FallbackReason["AUTO_TAX_FAILED"] = "AUTO_TAX_FAILED";
|
|
168
|
-
/** auto-tax was temporarily deactivated on a system-level */
|
|
169
|
-
FallbackReason["AUTO_TAX_DEACTIVATED"] = "AUTO_TAX_DEACTIVATED";
|
|
170
|
-
})(FallbackReason || (FallbackReason = {}));
|
|
171
|
-
export var ChannelType;
|
|
172
|
-
(function (ChannelType) {
|
|
173
|
-
/** Unspecified sales channel. This value is not supported. */
|
|
174
|
-
ChannelType["UNSPECIFIED"] = "UNSPECIFIED";
|
|
175
|
-
/** A web client. */
|
|
176
|
-
ChannelType["WEB"] = "WEB";
|
|
177
|
-
/** [Point of sale solutions](https://support.wix.com/en/wix-mobile-pos-2196395). */
|
|
178
|
-
ChannelType["POS"] = "POS";
|
|
179
|
-
/** [eBay shop](https://support.wix.com/en/article/wix-stores-connecting-and-setting-up-an-ebay-shop). */
|
|
180
|
-
ChannelType["EBAY"] = "EBAY";
|
|
181
|
-
/** [Amazon shop](https://support.wix.com/en/article/wix-stores-connecting-and-setting-up-an-amazon-shop). */
|
|
182
|
-
ChannelType["AMAZON"] = "AMAZON";
|
|
183
|
-
/** Other sales platform. */
|
|
184
|
-
ChannelType["OTHER_PLATFORM"] = "OTHER_PLATFORM";
|
|
185
|
-
/** [Wix Owner app](https://support.wix.com/article/wix-owner-app-an-overview). */
|
|
186
|
-
ChannelType["WIX_APP_STORE"] = "WIX_APP_STORE";
|
|
187
|
-
/** Wix Invoices app in [your dashboard](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Finvoices/settings/general-settings) */
|
|
188
|
-
ChannelType["WIX_INVOICES"] = "WIX_INVOICES";
|
|
189
|
-
/** Wix merchant backoffice. */
|
|
190
|
-
ChannelType["BACKOFFICE_MERCHANT"] = "BACKOFFICE_MERCHANT";
|
|
191
|
-
/** Wish sales channel. */
|
|
192
|
-
ChannelType["WISH"] = "WISH";
|
|
193
|
-
/** [ClassPass sales channel](https://support.wix.com/en/article/wix-bookings-letting-clients-book-your-services-with-classpass). */
|
|
194
|
-
ChannelType["CLASS_PASS"] = "CLASS_PASS";
|
|
195
|
-
/** Global-E sales channel. */
|
|
196
|
-
ChannelType["GLOBAL_E"] = "GLOBAL_E";
|
|
197
|
-
/** [Facebook shop](https://support.wix.com/en/article/wix-stores-changes-to-facebook-shops). */
|
|
198
|
-
ChannelType["FACEBOOK"] = "FACEBOOK";
|
|
199
|
-
/** [Etsy sales channel](https://support.wix.com/en/article/wix-stores-request-adding-etsy-as-a-sales-channel). */
|
|
200
|
-
ChannelType["ETSY"] = "ETSY";
|
|
201
|
-
/** [TikTok sales channel](https://support.wix.com/en/article/wix-stores-request-adding-tiktok-as-a-sales-channel). */
|
|
202
|
-
ChannelType["TIKTOK"] = "TIKTOK";
|
|
203
|
-
/** [Faire marketplace integration](https://support.wix.com/en/article/wix-stores-creating-a-faire-store-using-the-faire-integration-app). */
|
|
204
|
-
ChannelType["FAIRE_COM"] = "FAIRE_COM";
|
|
205
|
-
})(ChannelType || (ChannelType = {}));
|
|
206
|
-
export var AdditionalFeeSource;
|
|
207
|
-
(function (AdditionalFeeSource) {
|
|
208
|
-
AdditionalFeeSource["UNKNOWN_ADDITIONAL_FEE_SOURCE"] = "UNKNOWN_ADDITIONAL_FEE_SOURCE";
|
|
209
|
-
/** The additional fee was added by an additional fee service plugin */
|
|
210
|
-
AdditionalFeeSource["SERVICE_PLUGIN"] = "SERVICE_PLUGIN";
|
|
211
|
-
/** The additional fee was added on the item either via the catalog or on custom line item */
|
|
212
|
-
AdditionalFeeSource["ITEM"] = "ITEM";
|
|
213
|
-
/** The additional fee was added manually on the request */
|
|
214
|
-
AdditionalFeeSource["MANUAL"] = "MANUAL";
|
|
215
|
-
/** The additional fee was added by the shipping provider */
|
|
216
|
-
AdditionalFeeSource["SHIPPING"] = "SHIPPING";
|
|
217
|
-
})(AdditionalFeeSource || (AdditionalFeeSource = {}));
|
|
218
|
-
export var Severity;
|
|
219
|
-
(function (Severity) {
|
|
220
|
-
/** The user is allowed to move forward in the flow. */
|
|
221
|
-
Severity["WARNING"] = "WARNING";
|
|
222
|
-
/**
|
|
223
|
-
* The user is blocked from moving forward in the flow.
|
|
224
|
-
* For example, if callerContext is CART - moving to checkout is blocked. if callerContext is CHECKOUT, placing an order is blocked.
|
|
225
|
-
*/
|
|
226
|
-
Severity["ERROR"] = "ERROR";
|
|
227
|
-
})(Severity || (Severity = {}));
|
|
228
|
-
/** Available locations on the webpage */
|
|
229
|
-
export var NameInOther;
|
|
230
|
-
(function (NameInOther) {
|
|
231
|
-
/** Default location, in case no specific location is specified. */
|
|
232
|
-
NameInOther["OTHER_DEFAULT"] = "OTHER_DEFAULT";
|
|
233
|
-
})(NameInOther || (NameInOther = {}));
|
|
234
|
-
/** Available locations on the line item */
|
|
235
|
-
export var NameInLineItem;
|
|
236
|
-
(function (NameInLineItem) {
|
|
237
|
-
/** Default location, in case no specific location is specified. */
|
|
238
|
-
NameInLineItem["LINE_ITEM_DEFAULT"] = "LINE_ITEM_DEFAULT";
|
|
239
|
-
})(NameInLineItem || (NameInLineItem = {}));
|
|
240
|
-
export var SuggestedFix;
|
|
241
|
-
(function (SuggestedFix) {
|
|
242
|
-
/** No suggested fix is specified. The user should refer to the violation description to resolve the issue. */
|
|
243
|
-
SuggestedFix["UNKNOWN_SUGGESTED_FIX"] = "UNKNOWN_SUGGESTED_FIX";
|
|
244
|
-
/** The line item should be removed from the cart or checkout to resolve the violation. */
|
|
245
|
-
SuggestedFix["REMOVE_LINE_ITEM"] = "REMOVE_LINE_ITEM";
|
|
246
|
-
})(SuggestedFix || (SuggestedFix = {}));
|
|
247
|
-
export var GetCheckoutPaymentSettingsResponsePaymentOption;
|
|
248
|
-
(function (GetCheckoutPaymentSettingsResponsePaymentOption) {
|
|
249
|
-
GetCheckoutPaymentSettingsResponsePaymentOption["UNKNOWN_PAYMENT_OPTION"] = "UNKNOWN_PAYMENT_OPTION";
|
|
250
|
-
GetCheckoutPaymentSettingsResponsePaymentOption["MANUAL"] = "MANUAL";
|
|
251
|
-
})(GetCheckoutPaymentSettingsResponsePaymentOption || (GetCheckoutPaymentSettingsResponsePaymentOption = {}));
|
|
252
|
-
export var IdentityType;
|
|
253
|
-
(function (IdentityType) {
|
|
254
|
-
IdentityType["UNSPECIFIED_IDENTITY_TYPE"] = "UNSPECIFIED_IDENTITY_TYPE";
|
|
255
|
-
/** Site member */
|
|
256
|
-
IdentityType["MEMBER"] = "MEMBER";
|
|
257
|
-
/** Contact */
|
|
258
|
-
IdentityType["CONTACT"] = "CONTACT";
|
|
259
|
-
})(IdentityType || (IdentityType = {}));
|
|
260
|
-
export var LineItemType;
|
|
261
|
-
(function (LineItemType) {
|
|
262
|
-
/** Line item type can't be classified, due to an error */
|
|
263
|
-
LineItemType["UNSPECIFIED_LINE_ITEM_TYPE"] = "UNSPECIFIED_LINE_ITEM_TYPE";
|
|
264
|
-
/** Physical item type */
|
|
265
|
-
LineItemType["PHYSICAL"] = "PHYSICAL";
|
|
266
|
-
/** Digital item type */
|
|
267
|
-
LineItemType["DIGITAL"] = "DIGITAL";
|
|
268
|
-
/** Custom item price */
|
|
269
|
-
LineItemType["CUSTOM_AMOUNT_ITEM"] = "CUSTOM_AMOUNT_ITEM";
|
|
270
|
-
})(LineItemType || (LineItemType = {}));
|
|
271
|
-
export var MediaItemType;
|
|
272
|
-
(function (MediaItemType) {
|
|
273
|
-
/** Media item type can't be classified, due to an error */
|
|
274
|
-
MediaItemType["UNSPECIFIED_MEDIA_TYPE_ITEM"] = "UNSPECIFIED_MEDIA_TYPE_ITEM";
|
|
275
|
-
/** Image item type */
|
|
276
|
-
MediaItemType["IMAGE"] = "IMAGE";
|
|
277
|
-
})(MediaItemType || (MediaItemType = {}));
|
|
278
|
-
/** Brazilian tax info types */
|
|
279
|
-
export var VatType;
|
|
280
|
-
(function (VatType) {
|
|
281
|
-
/** When the tax info type can't be classified, due to an error */
|
|
282
|
-
VatType["UNSPECIFIED_TAX_TYPE"] = "UNSPECIFIED_TAX_TYPE";
|
|
283
|
-
/** CPF - for individual tax payers */
|
|
284
|
-
VatType["CPF"] = "CPF";
|
|
285
|
-
/** CNPJ - for corporations */
|
|
286
|
-
VatType["CNPJ"] = "CNPJ";
|
|
287
|
-
})(VatType || (VatType = {}));
|
|
288
|
-
export var DiscountDiscountType;
|
|
289
|
-
(function (DiscountDiscountType) {
|
|
290
|
-
DiscountDiscountType["UNDEFINED"] = "UNDEFINED";
|
|
291
|
-
/** No discount */
|
|
292
|
-
DiscountDiscountType["AMOUNT"] = "AMOUNT";
|
|
293
|
-
DiscountDiscountType["PERCENT"] = "PERCENT";
|
|
294
|
-
})(DiscountDiscountType || (DiscountDiscountType = {}));
|
|
295
|
-
export var ChannelInfoChannelType;
|
|
296
|
-
(function (ChannelInfoChannelType) {
|
|
297
|
-
ChannelInfoChannelType["UNSPECIFIED"] = "UNSPECIFIED";
|
|
298
|
-
ChannelInfoChannelType["WEB"] = "WEB";
|
|
299
|
-
ChannelInfoChannelType["OTHER_PLATFORM"] = "OTHER_PLATFORM";
|
|
300
|
-
ChannelInfoChannelType["WIX_APP_STORE"] = "WIX_APP_STORE";
|
|
301
|
-
})(ChannelInfoChannelType || (ChannelInfoChannelType = {}));
|
|
302
|
-
export var WebhookIdentityType;
|
|
303
|
-
(function (WebhookIdentityType) {
|
|
304
|
-
WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
|
|
305
|
-
WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
|
|
306
|
-
WebhookIdentityType["MEMBER"] = "MEMBER";
|
|
307
|
-
WebhookIdentityType["WIX_USER"] = "WIX_USER";
|
|
308
|
-
WebhookIdentityType["APP"] = "APP";
|
|
309
|
-
})(WebhookIdentityType || (WebhookIdentityType = {}));
|
|
310
|
-
/**
|
|
311
|
-
* Creates a checkout.
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
* The `createCheckout()` function returns a Promise that resolves to the new checkout when it's created.
|
|
315
|
-
*
|
|
316
|
-
* > **Notes:**
|
|
317
|
-
* > + Checkout must include at least 1 item in the `options.lineItems` array.
|
|
318
|
-
* > + `options.channelType` is required.
|
|
319
|
-
* > + If `_id` for `options.lineItems` is added, make sure that each `_id` is unique.
|
|
320
|
-
* > + If `options.checkoutInfo.customFields` are added, then `options.checkoutInfo.customFields.value` is required.
|
|
321
|
-
* @public
|
|
322
|
-
* @requiredField options.channelType
|
|
323
|
-
* @requiredField options.checkoutInfo.customFields.value
|
|
324
|
-
* @requiredField options.checkoutInfo.membershipOptions.selectedMemberships.memberships._id
|
|
325
|
-
* @requiredField options.checkoutInfo.membershipOptions.selectedMemberships.memberships.appId
|
|
326
|
-
* @requiredField options.checkoutInfo.membershipOptions.selectedMemberships.memberships.lineItemIds
|
|
327
|
-
* @requiredField options.customLineItems.descriptionLines.name
|
|
328
|
-
* @requiredField options.customLineItems.descriptionLines.value
|
|
329
|
-
* @requiredField options.customLineItems.itemType
|
|
330
|
-
* @requiredField options.customLineItems.price
|
|
331
|
-
* @requiredField options.customLineItems.productName
|
|
332
|
-
* @requiredField options.customLineItems.quantity
|
|
333
|
-
* @requiredField options.lineItems.catalogReference
|
|
334
|
-
* @requiredField options.lineItems.catalogReference.appId
|
|
335
|
-
* @requiredField options.lineItems.catalogReference.catalogItemId
|
|
336
|
-
* @requiredField options.lineItems.quantity
|
|
337
|
-
* @param options - Checkout creation options.
|
|
338
|
-
* @permissionId ECOM.MODIFY_CHECKOUTS
|
|
339
|
-
* @permissionId ECOM.ADMIN_MODIFY_CHECKOUTS
|
|
340
|
-
* @permissionScope Manage Stores - all permissions
|
|
341
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
342
|
-
* @permissionScope Manage Stores
|
|
343
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
344
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
345
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
346
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
347
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
348
|
-
* @permissionScope Manage Orders
|
|
349
|
-
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
350
|
-
* @permissionScope Manage Stores - all permissions
|
|
351
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
352
|
-
* @permissionScope Manage eCommerce - Admin Permissions
|
|
353
|
-
* @permissionScopeId SCOPE.ECOM.MANAGE-ADMIN
|
|
354
|
-
* @permissionScope Manage Stores
|
|
355
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
356
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
357
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
358
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
359
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
360
|
-
* @applicableIdentity APP
|
|
361
|
-
* @applicableIdentity VISITOR
|
|
362
|
-
* @returns Fulfilled - the newly created checkout.
|
|
363
|
-
* @fqn com.wix.ecom.checkout.api.v1.CheckoutService.CreateCheckout
|
|
364
|
-
*/
|
|
365
|
-
export async function createCheckout(options) {
|
|
366
|
-
// @ts-ignore
|
|
367
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
368
|
-
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
369
|
-
checkoutInfo: options?.checkoutInfo,
|
|
370
|
-
couponCode: options?.couponCode,
|
|
371
|
-
lineItems: options?.lineItems,
|
|
372
|
-
customLineItems: options?.customLineItems,
|
|
373
|
-
channelType: options?.channelType,
|
|
374
|
-
giftCardCode: options?.giftCardCode,
|
|
375
|
-
overrideCheckoutUrl: options?.overrideCheckoutUrl,
|
|
376
|
-
}), [
|
|
377
|
-
{
|
|
378
|
-
transformFn: transformSDKPageURLV2ToRESTPageURLV2,
|
|
379
|
-
paths: [
|
|
380
|
-
{ path: 'checkoutInfo.lineItems.url' },
|
|
381
|
-
{ path: 'lineItems.url' },
|
|
382
|
-
{ path: 'customLineItems.url' },
|
|
383
|
-
],
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
transformFn: transformSDKImageToRESTImage,
|
|
387
|
-
paths: [
|
|
388
|
-
{ path: 'checkoutInfo.lineItems.media' },
|
|
389
|
-
{ path: 'checkoutInfo.lineItems.catalogOverrideFields.image' },
|
|
390
|
-
{ path: 'lineItems.media' },
|
|
391
|
-
{ path: 'lineItems.catalogOverrideFields.image' },
|
|
392
|
-
{ path: 'customLineItems.media' },
|
|
393
|
-
],
|
|
394
|
-
},
|
|
395
|
-
{
|
|
396
|
-
transformFn: transformSDKAddressToRESTAddress,
|
|
397
|
-
paths: [
|
|
398
|
-
{ path: 'checkoutInfo.billingInfo.address' },
|
|
399
|
-
{ path: 'checkoutInfo.shippingInfo.shippingDestination.address' },
|
|
400
|
-
{
|
|
401
|
-
path: 'checkoutInfo.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
|
|
402
|
-
},
|
|
403
|
-
{
|
|
404
|
-
path: 'checkoutInfo.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
|
|
405
|
-
},
|
|
406
|
-
],
|
|
407
|
-
},
|
|
408
|
-
]);
|
|
409
|
-
const reqOpts = ambassadorWixEcomV1Checkout.createCheckout(payload);
|
|
410
|
-
sideEffects?.onSiteCall?.();
|
|
411
|
-
try {
|
|
412
|
-
const result = await httpClient.request(reqOpts);
|
|
413
|
-
sideEffects?.onSuccess?.(result);
|
|
414
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
415
|
-
{
|
|
416
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
417
|
-
paths: [{ path: 'checkout.lineItems.url' }],
|
|
418
|
-
},
|
|
419
|
-
{
|
|
420
|
-
transformFn: transformRESTImageToSDKImage,
|
|
421
|
-
paths: [
|
|
422
|
-
{ path: 'checkout.lineItems.media' },
|
|
423
|
-
{ path: 'checkout.lineItems.catalogOverrideFields.image' },
|
|
424
|
-
],
|
|
425
|
-
},
|
|
426
|
-
{
|
|
427
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
428
|
-
paths: [
|
|
429
|
-
{ path: 'checkout.billingInfo.address' },
|
|
430
|
-
{ path: 'checkout.shippingInfo.shippingDestination.address' },
|
|
431
|
-
{
|
|
432
|
-
path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
|
|
433
|
-
},
|
|
434
|
-
{
|
|
435
|
-
path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
|
|
436
|
-
},
|
|
437
|
-
],
|
|
438
|
-
},
|
|
439
|
-
]))?.checkout;
|
|
440
|
-
}
|
|
441
|
-
catch (err) {
|
|
442
|
-
const transformedError = sdkTransformError(err, {
|
|
443
|
-
spreadPathsToArguments: {},
|
|
444
|
-
explicitPathsToArguments: {
|
|
445
|
-
checkoutInfo: '$[0].checkoutInfo',
|
|
446
|
-
couponCode: '$[0].couponCode',
|
|
447
|
-
lineItems: '$[0].lineItems',
|
|
448
|
-
customLineItems: '$[0].customLineItems',
|
|
449
|
-
channelType: '$[0].channelType',
|
|
450
|
-
giftCardCode: '$[0].giftCardCode',
|
|
451
|
-
overrideCheckoutUrl: '$[0].overrideCheckoutUrl',
|
|
452
|
-
},
|
|
453
|
-
singleArgumentUnchanged: false,
|
|
454
|
-
}, ['options']);
|
|
455
|
-
sideEffects?.onError?.(err);
|
|
456
|
-
throw transformedError;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
/**
|
|
460
|
-
* Retrieves a checkout.
|
|
461
|
-
*
|
|
462
|
-
*
|
|
463
|
-
* The `getCheckout()` function returns a Promise that resolves when the specified checkout is retrieved.
|
|
464
|
-
* @param _id - Checkout ID.
|
|
465
|
-
* @public
|
|
466
|
-
* @requiredField _id
|
|
467
|
-
* @permissionId ECOM.READ_CHECKOUTS
|
|
468
|
-
* @permissionScope Manage Stores - all permissions
|
|
469
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
470
|
-
* @permissionScope Manage Stores
|
|
471
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
472
|
-
* @permissionScope Read eCommerce - all read permissions
|
|
473
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
|
|
474
|
-
* @permissionScope Read Orders
|
|
475
|
-
* @permissionScopeId SCOPE.DC-STORES.READ-ORDERS
|
|
476
|
-
* @permissionScope Read Stores - all read permissions
|
|
477
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
|
|
478
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
479
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
480
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
481
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
482
|
-
* @permissionScope Manage Orders
|
|
483
|
-
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
484
|
-
* @applicableIdentity APP
|
|
485
|
-
* @applicableIdentity VISITOR
|
|
486
|
-
* @returns Fulfilled - the requested checkout.
|
|
487
|
-
* @fqn com.wix.ecom.checkout.api.v1.CheckoutService.GetCheckout
|
|
488
|
-
*/
|
|
489
|
-
export async function getCheckout(_id) {
|
|
490
|
-
// @ts-ignore
|
|
491
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
492
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
493
|
-
const reqOpts = ambassadorWixEcomV1Checkout.getCheckout(payload);
|
|
494
|
-
sideEffects?.onSiteCall?.();
|
|
495
|
-
try {
|
|
496
|
-
const result = await httpClient.request(reqOpts);
|
|
497
|
-
sideEffects?.onSuccess?.(result);
|
|
498
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
499
|
-
{
|
|
500
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
501
|
-
paths: [{ path: 'checkout.lineItems.url' }],
|
|
502
|
-
},
|
|
503
|
-
{
|
|
504
|
-
transformFn: transformRESTImageToSDKImage,
|
|
505
|
-
paths: [
|
|
506
|
-
{ path: 'checkout.lineItems.media' },
|
|
507
|
-
{ path: 'checkout.lineItems.catalogOverrideFields.image' },
|
|
508
|
-
],
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
512
|
-
paths: [
|
|
513
|
-
{ path: 'checkout.billingInfo.address' },
|
|
514
|
-
{ path: 'checkout.shippingInfo.shippingDestination.address' },
|
|
515
|
-
{
|
|
516
|
-
path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
|
|
517
|
-
},
|
|
518
|
-
{
|
|
519
|
-
path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
|
|
520
|
-
},
|
|
521
|
-
],
|
|
522
|
-
},
|
|
523
|
-
]))?.checkout;
|
|
524
|
-
}
|
|
525
|
-
catch (err) {
|
|
526
|
-
const transformedError = sdkTransformError(err, {
|
|
527
|
-
spreadPathsToArguments: {},
|
|
528
|
-
explicitPathsToArguments: { id: '$[0]' },
|
|
529
|
-
singleArgumentUnchanged: false,
|
|
530
|
-
}, ['_id']);
|
|
531
|
-
sideEffects?.onError?.(err);
|
|
532
|
-
throw transformedError;
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* Retrieves the checkout associated with a specified cart.
|
|
537
|
-
* @param _id - Cart ID.
|
|
538
|
-
* @public
|
|
539
|
-
* @requiredField _id
|
|
540
|
-
* @permissionId ECOM.READ_CHECKOUTS
|
|
541
|
-
* @permissionScope Manage Stores - all permissions
|
|
542
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
543
|
-
* @permissionScope Manage Stores
|
|
544
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
545
|
-
* @permissionScope Read eCommerce - all read permissions
|
|
546
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
|
|
547
|
-
* @permissionScope Read Orders
|
|
548
|
-
* @permissionScopeId SCOPE.DC-STORES.READ-ORDERS
|
|
549
|
-
* @permissionScope Read Stores - all read permissions
|
|
550
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
|
|
551
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
552
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
553
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
554
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
555
|
-
* @permissionScope Manage Orders
|
|
556
|
-
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
557
|
-
* @applicableIdentity APP
|
|
558
|
-
* @applicableIdentity VISITOR
|
|
559
|
-
* @fqn com.wix.ecom.checkout.api.v1.CheckoutService.GetCheckoutByCartId
|
|
560
|
-
*/
|
|
561
|
-
export async function getCheckoutByCartId(_id) {
|
|
562
|
-
// @ts-ignore
|
|
563
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
564
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
565
|
-
const reqOpts = ambassadorWixEcomV1Checkout.getCheckoutByCartId(payload);
|
|
566
|
-
sideEffects?.onSiteCall?.();
|
|
567
|
-
try {
|
|
568
|
-
const result = await httpClient.request(reqOpts);
|
|
569
|
-
sideEffects?.onSuccess?.(result);
|
|
570
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
571
|
-
{
|
|
572
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
573
|
-
paths: [{ path: 'checkout.lineItems.url' }],
|
|
574
|
-
},
|
|
575
|
-
{
|
|
576
|
-
transformFn: transformRESTImageToSDKImage,
|
|
577
|
-
paths: [
|
|
578
|
-
{ path: 'checkout.lineItems.media' },
|
|
579
|
-
{ path: 'checkout.lineItems.catalogOverrideFields.image' },
|
|
580
|
-
],
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
584
|
-
paths: [
|
|
585
|
-
{ path: 'checkout.billingInfo.address' },
|
|
586
|
-
{ path: 'checkout.shippingInfo.shippingDestination.address' },
|
|
587
|
-
{
|
|
588
|
-
path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
|
|
589
|
-
},
|
|
590
|
-
{
|
|
591
|
-
path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
|
|
592
|
-
},
|
|
593
|
-
],
|
|
594
|
-
},
|
|
595
|
-
]));
|
|
596
|
-
}
|
|
597
|
-
catch (err) {
|
|
598
|
-
const transformedError = sdkTransformError(err, {
|
|
599
|
-
spreadPathsToArguments: {},
|
|
600
|
-
explicitPathsToArguments: { id: '$[0]' },
|
|
601
|
-
singleArgumentUnchanged: false,
|
|
602
|
-
}, ['_id']);
|
|
603
|
-
sideEffects?.onError?.(err);
|
|
604
|
-
throw transformedError;
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
/**
|
|
608
|
-
* Deprecated and will be removed soon, use GetCheckoutURL
|
|
609
|
-
* @param _id - Checkout ID.
|
|
610
|
-
* @internal
|
|
611
|
-
* @documentationMaturity preview
|
|
612
|
-
* @requiredField _id
|
|
613
|
-
* @permissionId ECOM.READ_CHECKOUTS
|
|
614
|
-
* @permissionScope Manage Stores - all permissions
|
|
615
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
616
|
-
* @permissionScope Manage Stores
|
|
617
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
618
|
-
* @permissionScope Read eCommerce - all read permissions
|
|
619
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
|
|
620
|
-
* @permissionScope Read Orders
|
|
621
|
-
* @permissionScopeId SCOPE.DC-STORES.READ-ORDERS
|
|
622
|
-
* @permissionScope Read Stores - all read permissions
|
|
623
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
|
|
624
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
625
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
626
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
627
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
628
|
-
* @permissionScope Manage Orders
|
|
629
|
-
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
630
|
-
* @applicableIdentity APP
|
|
631
|
-
* @applicableIdentity VISITOR
|
|
632
|
-
* @fqn com.wix.ecom.checkout.api.v1.CheckoutService.GetWixCheckoutURL
|
|
633
|
-
*/
|
|
634
|
-
export async function getWixCheckoutUrl(_id) {
|
|
635
|
-
// @ts-ignore
|
|
636
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
637
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
638
|
-
const reqOpts = ambassadorWixEcomV1Checkout.getWixCheckoutUrl(payload);
|
|
639
|
-
sideEffects?.onSiteCall?.();
|
|
640
|
-
try {
|
|
641
|
-
const result = await httpClient.request(reqOpts);
|
|
642
|
-
sideEffects?.onSuccess?.(result);
|
|
643
|
-
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
644
|
-
}
|
|
645
|
-
catch (err) {
|
|
646
|
-
const transformedError = sdkTransformError(err, {
|
|
647
|
-
spreadPathsToArguments: {},
|
|
648
|
-
explicitPathsToArguments: { id: '$[0]' },
|
|
649
|
-
singleArgumentUnchanged: false,
|
|
650
|
-
}, ['_id']);
|
|
651
|
-
sideEffects?.onError?.(err);
|
|
652
|
-
throw transformedError;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
/**
|
|
656
|
-
* Retrieves the checkout page URL of a specified checkout.
|
|
657
|
-
*
|
|
658
|
-
* By default, a `checkoutUrl` generates for a checkout and directs to a standard Wix checkout page.
|
|
659
|
-
* However, if `overrideCheckoutUrl` has a value, it will replace and set the value of `checkoutUrl`.
|
|
660
|
-
* @param _id - Checkout ID.
|
|
661
|
-
* @public
|
|
662
|
-
* @requiredField _id
|
|
663
|
-
* @permissionId ECOM.READ_CHECKOUTS
|
|
664
|
-
* @permissionScope Manage Stores - all permissions
|
|
665
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
666
|
-
* @permissionScope Manage Stores
|
|
667
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
668
|
-
* @permissionScope Read eCommerce - all read permissions
|
|
669
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
|
|
670
|
-
* @permissionScope Read Orders
|
|
671
|
-
* @permissionScopeId SCOPE.DC-STORES.READ-ORDERS
|
|
672
|
-
* @permissionScope Read Stores - all read permissions
|
|
673
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
|
|
674
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
675
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
676
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
677
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
678
|
-
* @permissionScope Manage Orders
|
|
679
|
-
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
680
|
-
* @applicableIdentity APP
|
|
681
|
-
* @applicableIdentity VISITOR
|
|
682
|
-
* @fqn com.wix.ecom.checkout.api.v1.CheckoutService.GetCheckoutURL
|
|
683
|
-
*/
|
|
684
|
-
export async function getCheckoutUrl(_id) {
|
|
685
|
-
// @ts-ignore
|
|
686
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
687
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
688
|
-
const reqOpts = ambassadorWixEcomV1Checkout.getCheckoutUrl(payload);
|
|
689
|
-
sideEffects?.onSiteCall?.();
|
|
690
|
-
try {
|
|
691
|
-
const result = await httpClient.request(reqOpts);
|
|
692
|
-
sideEffects?.onSuccess?.(result);
|
|
693
|
-
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
694
|
-
}
|
|
695
|
-
catch (err) {
|
|
696
|
-
const transformedError = sdkTransformError(err, {
|
|
697
|
-
spreadPathsToArguments: {},
|
|
698
|
-
explicitPathsToArguments: { id: '$[0]' },
|
|
699
|
-
singleArgumentUnchanged: false,
|
|
700
|
-
}, ['_id']);
|
|
701
|
-
sideEffects?.onError?.(err);
|
|
702
|
-
throw transformedError;
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
/**
|
|
706
|
-
* Updates a checkout.
|
|
707
|
-
*
|
|
708
|
-
*
|
|
709
|
-
* The `updateCheckout()` function returns a Promise that resolves to the updated checkout when the specified properties are updated.
|
|
710
|
-
*
|
|
711
|
-
* >**Notes:**
|
|
712
|
-
* > + If nothing is passed in the request, the call will fail.
|
|
713
|
-
* > + The `checkout.buyerInfo.email` may not be removed once it is set.
|
|
714
|
-
* @param _id - Checkout ID.
|
|
715
|
-
* @public
|
|
716
|
-
* @requiredField _id
|
|
717
|
-
* @requiredField checkout
|
|
718
|
-
* @requiredField checkout.customFields.value
|
|
719
|
-
* @requiredField checkout.membershipOptions.selectedMemberships.memberships._id
|
|
720
|
-
* @requiredField checkout.membershipOptions.selectedMemberships.memberships.appId
|
|
721
|
-
* @requiredField checkout.membershipOptions.selectedMemberships.memberships.lineItemIds
|
|
722
|
-
* @requiredField options.customLineItems.descriptionLines.name
|
|
723
|
-
* @requiredField options.customLineItems.descriptionLines.value
|
|
724
|
-
* @requiredField options.customLineItems.itemType
|
|
725
|
-
* @requiredField options.customLineItems.productName
|
|
726
|
-
* @requiredField options.customLineItems.quantity
|
|
727
|
-
* @requiredField options.lineItems.catalogReference
|
|
728
|
-
* @requiredField options.lineItems.catalogReference.appId
|
|
729
|
-
* @requiredField options.lineItems.catalogReference.catalogItemId
|
|
730
|
-
* @requiredField options.lineItems.quantity
|
|
731
|
-
* @param options - Checkout update options.
|
|
732
|
-
* @permissionId ECOM.MODIFY_CHECKOUTS
|
|
733
|
-
* @permissionId ECOM.ADMIN_MODIFY_CHECKOUTS
|
|
734
|
-
* @permissionScope Manage Stores - all permissions
|
|
735
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
736
|
-
* @permissionScope Manage Stores
|
|
737
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
738
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
739
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
740
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
741
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
742
|
-
* @permissionScope Manage Orders
|
|
743
|
-
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
744
|
-
* @permissionScope Manage Stores - all permissions
|
|
745
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
746
|
-
* @permissionScope Manage eCommerce - Admin Permissions
|
|
747
|
-
* @permissionScopeId SCOPE.ECOM.MANAGE-ADMIN
|
|
748
|
-
* @permissionScope Manage Stores
|
|
749
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
750
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
751
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
752
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
753
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
754
|
-
* @applicableIdentity APP
|
|
755
|
-
* @applicableIdentity VISITOR
|
|
756
|
-
* @returns Updated checkout.
|
|
757
|
-
* @fqn com.wix.ecom.checkout.api.v1.CheckoutService.UpdateCheckout
|
|
758
|
-
*/
|
|
759
|
-
export async function updateCheckout(_id, checkout, options) {
|
|
760
|
-
// @ts-ignore
|
|
761
|
-
const { httpClient, sideEffects } = arguments[3];
|
|
762
|
-
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
763
|
-
checkout: { ...checkout, id: _id },
|
|
764
|
-
couponCode: options?.couponCode,
|
|
765
|
-
giftCardCode: options?.giftCardCode,
|
|
766
|
-
overrideCheckoutUrl: options?.overrideCheckoutUrl,
|
|
767
|
-
lineItems: options?.lineItems,
|
|
768
|
-
customLineItems: options?.customLineItems,
|
|
769
|
-
}), [
|
|
770
|
-
{
|
|
771
|
-
transformFn: transformSDKPageURLV2ToRESTPageURLV2,
|
|
772
|
-
paths: [
|
|
773
|
-
{ path: 'checkout.lineItems.url' },
|
|
774
|
-
{ path: 'lineItems.url' },
|
|
775
|
-
{ path: 'customLineItems.url' },
|
|
776
|
-
],
|
|
777
|
-
},
|
|
778
|
-
{
|
|
779
|
-
transformFn: transformSDKImageToRESTImage,
|
|
780
|
-
paths: [
|
|
781
|
-
{ path: 'checkout.lineItems.media' },
|
|
782
|
-
{ path: 'checkout.lineItems.catalogOverrideFields.image' },
|
|
783
|
-
{ path: 'lineItems.media' },
|
|
784
|
-
{ path: 'lineItems.catalogOverrideFields.image' },
|
|
785
|
-
{ path: 'customLineItems.media' },
|
|
786
|
-
],
|
|
787
|
-
},
|
|
788
|
-
{
|
|
789
|
-
transformFn: transformSDKAddressToRESTAddress,
|
|
790
|
-
paths: [
|
|
791
|
-
{ path: 'checkout.billingInfo.address' },
|
|
792
|
-
{ path: 'checkout.shippingInfo.shippingDestination.address' },
|
|
793
|
-
{
|
|
794
|
-
path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
|
|
795
|
-
},
|
|
796
|
-
{
|
|
797
|
-
path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
|
|
798
|
-
},
|
|
799
|
-
],
|
|
800
|
-
},
|
|
801
|
-
]);
|
|
802
|
-
const reqOpts = ambassadorWixEcomV1Checkout.updateCheckout(payload);
|
|
803
|
-
sideEffects?.onSiteCall?.();
|
|
804
|
-
try {
|
|
805
|
-
const result = await httpClient.request(reqOpts);
|
|
806
|
-
sideEffects?.onSuccess?.(result);
|
|
807
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
808
|
-
{
|
|
809
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
810
|
-
paths: [{ path: 'checkout.lineItems.url' }],
|
|
811
|
-
},
|
|
812
|
-
{
|
|
813
|
-
transformFn: transformRESTImageToSDKImage,
|
|
814
|
-
paths: [
|
|
815
|
-
{ path: 'checkout.lineItems.media' },
|
|
816
|
-
{ path: 'checkout.lineItems.catalogOverrideFields.image' },
|
|
817
|
-
],
|
|
818
|
-
},
|
|
819
|
-
{
|
|
820
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
821
|
-
paths: [
|
|
822
|
-
{ path: 'checkout.billingInfo.address' },
|
|
823
|
-
{ path: 'checkout.shippingInfo.shippingDestination.address' },
|
|
824
|
-
{
|
|
825
|
-
path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
|
|
826
|
-
},
|
|
827
|
-
{
|
|
828
|
-
path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
|
|
829
|
-
},
|
|
830
|
-
],
|
|
831
|
-
},
|
|
832
|
-
]))?.checkout;
|
|
833
|
-
}
|
|
834
|
-
catch (err) {
|
|
835
|
-
const transformedError = sdkTransformError(err, {
|
|
836
|
-
spreadPathsToArguments: { checkout: '$[1]' },
|
|
837
|
-
explicitPathsToArguments: {
|
|
838
|
-
'checkout.id': '$[0]',
|
|
839
|
-
couponCode: '$[2].couponCode',
|
|
840
|
-
giftCardCode: '$[2].giftCardCode',
|
|
841
|
-
overrideCheckoutUrl: '$[2].overrideCheckoutUrl',
|
|
842
|
-
lineItems: '$[2].lineItems',
|
|
843
|
-
customLineItems: '$[2].customLineItems',
|
|
844
|
-
},
|
|
845
|
-
singleArgumentUnchanged: false,
|
|
846
|
-
}, ['_id', 'checkout', 'options']);
|
|
847
|
-
sideEffects?.onError?.(err);
|
|
848
|
-
throw transformedError;
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
/**
|
|
852
|
-
* Removes the coupon from a specified checkout.
|
|
853
|
-
*
|
|
854
|
-
*
|
|
855
|
-
* The `removeCoupon()` function returns a Promise that resolves to the updated checkout when the coupon is removed from the specified checkout.
|
|
856
|
-
*
|
|
857
|
-
* >**Note:** A checkout can only hold 1 coupon.
|
|
858
|
-
* @param _id - ID of the checkout to remove the coupon from.
|
|
859
|
-
* @public
|
|
860
|
-
* @requiredField _id
|
|
861
|
-
* @permissionId ECOM.MODIFY_CHECKOUTS
|
|
862
|
-
* @permissionScope Manage Stores - all permissions
|
|
863
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
864
|
-
* @permissionScope Manage Stores
|
|
865
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
866
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
867
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
868
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
869
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
870
|
-
* @permissionScope Manage Orders
|
|
871
|
-
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
872
|
-
* @applicableIdentity APP
|
|
873
|
-
* @applicableIdentity VISITOR
|
|
874
|
-
* @fqn com.wix.ecom.checkout.api.v1.CheckoutService.RemoveCoupon
|
|
875
|
-
*/
|
|
876
|
-
export async function removeCoupon(_id) {
|
|
877
|
-
// @ts-ignore
|
|
878
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
879
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
880
|
-
const reqOpts = ambassadorWixEcomV1Checkout.removeCoupon(payload);
|
|
881
|
-
sideEffects?.onSiteCall?.();
|
|
882
|
-
try {
|
|
883
|
-
const result = await httpClient.request(reqOpts);
|
|
884
|
-
sideEffects?.onSuccess?.(result);
|
|
885
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
886
|
-
{
|
|
887
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
888
|
-
paths: [{ path: 'checkout.lineItems.url' }],
|
|
889
|
-
},
|
|
890
|
-
{
|
|
891
|
-
transformFn: transformRESTImageToSDKImage,
|
|
892
|
-
paths: [
|
|
893
|
-
{ path: 'checkout.lineItems.media' },
|
|
894
|
-
{ path: 'checkout.lineItems.catalogOverrideFields.image' },
|
|
895
|
-
],
|
|
896
|
-
},
|
|
897
|
-
{
|
|
898
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
899
|
-
paths: [
|
|
900
|
-
{ path: 'checkout.billingInfo.address' },
|
|
901
|
-
{ path: 'checkout.shippingInfo.shippingDestination.address' },
|
|
902
|
-
{
|
|
903
|
-
path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
|
|
904
|
-
},
|
|
905
|
-
{
|
|
906
|
-
path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
|
|
907
|
-
},
|
|
908
|
-
],
|
|
909
|
-
},
|
|
910
|
-
]));
|
|
911
|
-
}
|
|
912
|
-
catch (err) {
|
|
913
|
-
const transformedError = sdkTransformError(err, {
|
|
914
|
-
spreadPathsToArguments: {},
|
|
915
|
-
explicitPathsToArguments: { id: '$[0]' },
|
|
916
|
-
singleArgumentUnchanged: false,
|
|
917
|
-
}, ['_id']);
|
|
918
|
-
sideEffects?.onError?.(err);
|
|
919
|
-
throw transformedError;
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
/**
|
|
923
|
-
* Removes the gift card from a specified checkout.
|
|
924
|
-
*
|
|
925
|
-
*
|
|
926
|
-
* The `removeGiftCard()` function returns a Promise that resolves to the updated checkout when the gift card is removed from the specified checkout.
|
|
927
|
-
*
|
|
928
|
-
* >**Note:** A checkout can only hold 1 gift card.
|
|
929
|
-
* @param _id - ID of the checkout to remove the gift card from.
|
|
930
|
-
* @public
|
|
931
|
-
* @requiredField _id
|
|
932
|
-
* @permissionId ECOM.MODIFY_CHECKOUTS
|
|
933
|
-
* @permissionScope Manage Stores - all permissions
|
|
934
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
935
|
-
* @permissionScope Manage Stores
|
|
936
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
937
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
938
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
939
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
940
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
941
|
-
* @permissionScope Manage Orders
|
|
942
|
-
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
943
|
-
* @applicableIdentity APP
|
|
944
|
-
* @applicableIdentity VISITOR
|
|
945
|
-
* @fqn com.wix.ecom.checkout.api.v1.CheckoutService.RemoveGiftCard
|
|
946
|
-
*/
|
|
947
|
-
export async function removeGiftCard(_id) {
|
|
948
|
-
// @ts-ignore
|
|
949
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
950
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
951
|
-
const reqOpts = ambassadorWixEcomV1Checkout.removeGiftCard(payload);
|
|
952
|
-
sideEffects?.onSiteCall?.();
|
|
953
|
-
try {
|
|
954
|
-
const result = await httpClient.request(reqOpts);
|
|
955
|
-
sideEffects?.onSuccess?.(result);
|
|
956
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
957
|
-
{
|
|
958
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
959
|
-
paths: [{ path: 'checkout.lineItems.url' }],
|
|
960
|
-
},
|
|
961
|
-
{
|
|
962
|
-
transformFn: transformRESTImageToSDKImage,
|
|
963
|
-
paths: [
|
|
964
|
-
{ path: 'checkout.lineItems.media' },
|
|
965
|
-
{ path: 'checkout.lineItems.catalogOverrideFields.image' },
|
|
966
|
-
],
|
|
967
|
-
},
|
|
968
|
-
{
|
|
969
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
970
|
-
paths: [
|
|
971
|
-
{ path: 'checkout.billingInfo.address' },
|
|
972
|
-
{ path: 'checkout.shippingInfo.shippingDestination.address' },
|
|
973
|
-
{
|
|
974
|
-
path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
|
|
975
|
-
},
|
|
976
|
-
{
|
|
977
|
-
path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
|
|
978
|
-
},
|
|
979
|
-
],
|
|
980
|
-
},
|
|
981
|
-
]));
|
|
982
|
-
}
|
|
983
|
-
catch (err) {
|
|
984
|
-
const transformedError = sdkTransformError(err, {
|
|
985
|
-
spreadPathsToArguments: {},
|
|
986
|
-
explicitPathsToArguments: { id: '$[0]' },
|
|
987
|
-
singleArgumentUnchanged: false,
|
|
988
|
-
}, ['_id']);
|
|
989
|
-
sideEffects?.onError?.(err);
|
|
990
|
-
throw transformedError;
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
/**
|
|
994
|
-
* Removes the `overrideCheckoutUrl` from a specified checkout.
|
|
995
|
-
*
|
|
996
|
-
* When `overrideCheckoutUrl` is removed, the `checkoutUrl` will be set to the default, standard
|
|
997
|
-
* Wix checkout page URL.
|
|
998
|
-
* @param _id - ID of the checkout to remove the override checkout url from.
|
|
999
|
-
* @public
|
|
1000
|
-
* @requiredField _id
|
|
1001
|
-
* @permissionId ECOM.MODIFY_CHECKOUTS
|
|
1002
|
-
* @permissionScope Manage Stores - all permissions
|
|
1003
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1004
|
-
* @permissionScope Manage Stores
|
|
1005
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1006
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1007
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1008
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1009
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1010
|
-
* @permissionScope Manage Orders
|
|
1011
|
-
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
1012
|
-
* @applicableIdentity APP
|
|
1013
|
-
* @applicableIdentity VISITOR
|
|
1014
|
-
* @fqn com.wix.ecom.checkout.api.v1.CheckoutService.RemoveOverrideCheckoutUrl
|
|
1015
|
-
*/
|
|
1016
|
-
export async function removeOverrideCheckoutUrl(_id) {
|
|
1017
|
-
// @ts-ignore
|
|
1018
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1019
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
1020
|
-
const reqOpts = ambassadorWixEcomV1Checkout.removeOverrideCheckoutUrl(payload);
|
|
1021
|
-
sideEffects?.onSiteCall?.();
|
|
1022
|
-
try {
|
|
1023
|
-
const result = await httpClient.request(reqOpts);
|
|
1024
|
-
sideEffects?.onSuccess?.(result);
|
|
1025
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1026
|
-
{
|
|
1027
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
1028
|
-
paths: [{ path: 'checkout.lineItems.url' }],
|
|
1029
|
-
},
|
|
1030
|
-
{
|
|
1031
|
-
transformFn: transformRESTImageToSDKImage,
|
|
1032
|
-
paths: [
|
|
1033
|
-
{ path: 'checkout.lineItems.media' },
|
|
1034
|
-
{ path: 'checkout.lineItems.catalogOverrideFields.image' },
|
|
1035
|
-
],
|
|
1036
|
-
},
|
|
1037
|
-
{
|
|
1038
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
1039
|
-
paths: [
|
|
1040
|
-
{ path: 'checkout.billingInfo.address' },
|
|
1041
|
-
{ path: 'checkout.shippingInfo.shippingDestination.address' },
|
|
1042
|
-
{
|
|
1043
|
-
path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
|
|
1044
|
-
},
|
|
1045
|
-
{
|
|
1046
|
-
path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
|
|
1047
|
-
},
|
|
1048
|
-
],
|
|
1049
|
-
},
|
|
1050
|
-
]));
|
|
1051
|
-
}
|
|
1052
|
-
catch (err) {
|
|
1053
|
-
const transformedError = sdkTransformError(err, {
|
|
1054
|
-
spreadPathsToArguments: {},
|
|
1055
|
-
explicitPathsToArguments: { id: '$[0]' },
|
|
1056
|
-
singleArgumentUnchanged: false,
|
|
1057
|
-
}, ['_id']);
|
|
1058
|
-
sideEffects?.onError?.(err);
|
|
1059
|
-
throw transformedError;
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
/**
|
|
1063
|
-
* Adds catalog line items and/or custom line items to a checkout.
|
|
1064
|
-
*
|
|
1065
|
-
*
|
|
1066
|
-
* The `addToCheckout()` function returns a Promise that resolves to the updated checkout when the specified items have been added.
|
|
1067
|
-
* > **Note:** When adding catalog items, `options.lineItems.catalogReference` is required.
|
|
1068
|
-
* @param _id - Checkout ID.
|
|
1069
|
-
* @public
|
|
1070
|
-
* @requiredField _id
|
|
1071
|
-
* @requiredField options.customLineItems.descriptionLines.name
|
|
1072
|
-
* @requiredField options.customLineItems.descriptionLines.value
|
|
1073
|
-
* @requiredField options.customLineItems.itemType
|
|
1074
|
-
* @requiredField options.customLineItems.productName
|
|
1075
|
-
* @requiredField options.customLineItems.quantity
|
|
1076
|
-
* @requiredField options.lineItems.catalogReference
|
|
1077
|
-
* @requiredField options.lineItems.catalogReference.appId
|
|
1078
|
-
* @requiredField options.lineItems.catalogReference.catalogItemId
|
|
1079
|
-
* @requiredField options.lineItems.quantity
|
|
1080
|
-
* @param options - Items to be added to checkout.
|
|
1081
|
-
* @permissionId ECOM.MODIFY_CHECKOUTS
|
|
1082
|
-
* @permissionId ECOM.ADMIN_MODIFY_CHECKOUTS
|
|
1083
|
-
* @permissionScope Manage Stores - all permissions
|
|
1084
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1085
|
-
* @permissionScope Manage Stores
|
|
1086
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1087
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1088
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1089
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1090
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1091
|
-
* @permissionScope Manage Orders
|
|
1092
|
-
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
1093
|
-
* @permissionScope Manage Stores - all permissions
|
|
1094
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1095
|
-
* @permissionScope Manage eCommerce - Admin Permissions
|
|
1096
|
-
* @permissionScopeId SCOPE.ECOM.MANAGE-ADMIN
|
|
1097
|
-
* @permissionScope Manage Stores
|
|
1098
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1099
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1100
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1101
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1102
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1103
|
-
* @applicableIdentity APP
|
|
1104
|
-
* @applicableIdentity VISITOR
|
|
1105
|
-
* @fqn com.wix.ecom.checkout.api.v1.CheckoutService.AddToCheckout
|
|
1106
|
-
*/
|
|
1107
|
-
export async function addToCheckout(_id, options) {
|
|
1108
|
-
// @ts-ignore
|
|
1109
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1110
|
-
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
1111
|
-
id: _id,
|
|
1112
|
-
lineItems: options?.lineItems,
|
|
1113
|
-
customLineItems: options?.customLineItems,
|
|
1114
|
-
}), [
|
|
1115
|
-
{
|
|
1116
|
-
transformFn: transformSDKPageURLV2ToRESTPageURLV2,
|
|
1117
|
-
paths: [{ path: 'lineItems.url' }, { path: 'customLineItems.url' }],
|
|
1118
|
-
},
|
|
1119
|
-
{
|
|
1120
|
-
transformFn: transformSDKImageToRESTImage,
|
|
1121
|
-
paths: [
|
|
1122
|
-
{ path: 'lineItems.media' },
|
|
1123
|
-
{ path: 'lineItems.catalogOverrideFields.image' },
|
|
1124
|
-
{ path: 'customLineItems.media' },
|
|
1125
|
-
],
|
|
1126
|
-
},
|
|
1127
|
-
]);
|
|
1128
|
-
const reqOpts = ambassadorWixEcomV1Checkout.addToCheckout(payload);
|
|
1129
|
-
sideEffects?.onSiteCall?.();
|
|
1130
|
-
try {
|
|
1131
|
-
const result = await httpClient.request(reqOpts);
|
|
1132
|
-
sideEffects?.onSuccess?.(result);
|
|
1133
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1134
|
-
{
|
|
1135
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
1136
|
-
paths: [{ path: 'checkout.lineItems.url' }],
|
|
1137
|
-
},
|
|
1138
|
-
{
|
|
1139
|
-
transformFn: transformRESTImageToSDKImage,
|
|
1140
|
-
paths: [
|
|
1141
|
-
{ path: 'checkout.lineItems.media' },
|
|
1142
|
-
{ path: 'checkout.lineItems.catalogOverrideFields.image' },
|
|
1143
|
-
],
|
|
1144
|
-
},
|
|
1145
|
-
{
|
|
1146
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
1147
|
-
paths: [
|
|
1148
|
-
{ path: 'checkout.billingInfo.address' },
|
|
1149
|
-
{ path: 'checkout.shippingInfo.shippingDestination.address' },
|
|
1150
|
-
{
|
|
1151
|
-
path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
|
|
1152
|
-
},
|
|
1153
|
-
{
|
|
1154
|
-
path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
|
|
1155
|
-
},
|
|
1156
|
-
],
|
|
1157
|
-
},
|
|
1158
|
-
]));
|
|
1159
|
-
}
|
|
1160
|
-
catch (err) {
|
|
1161
|
-
const transformedError = sdkTransformError(err, {
|
|
1162
|
-
spreadPathsToArguments: {},
|
|
1163
|
-
explicitPathsToArguments: {
|
|
1164
|
-
id: '$[0]',
|
|
1165
|
-
lineItems: '$[1].lineItems',
|
|
1166
|
-
customLineItems: '$[1].customLineItems',
|
|
1167
|
-
},
|
|
1168
|
-
singleArgumentUnchanged: false,
|
|
1169
|
-
}, ['_id', 'options']);
|
|
1170
|
-
sideEffects?.onError?.(err);
|
|
1171
|
-
throw transformedError;
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
/**
|
|
1175
|
-
* Removes line items from the specified checkout.
|
|
1176
|
-
*
|
|
1177
|
-
*
|
|
1178
|
-
* The `removeLineItems()` function returns a Promise that resolves to the updated checkout when the line items are removed from the specified checkout.
|
|
1179
|
-
* @param _id - ID of the checkout to remove line items from.
|
|
1180
|
-
* @public
|
|
1181
|
-
* @requiredField _id
|
|
1182
|
-
* @requiredField lineItemIds
|
|
1183
|
-
* @param lineItemIds - IDs of the line items to be removed.
|
|
1184
|
-
* To find the IDs of the checkout line items you'd like to remove, pass the `checkout._id` to [getCheckout()](https://www.wix.com/velo/reference/wix-ecom-backend/checkout/getcheckout) and look for the IDs under `lineItems` and/or `customLineItems`.
|
|
1185
|
-
* @permissionId ECOM.MODIFY_CHECKOUTS
|
|
1186
|
-
* @permissionScope Manage Stores - all permissions
|
|
1187
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1188
|
-
* @permissionScope Manage Stores
|
|
1189
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1190
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1191
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1192
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1193
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1194
|
-
* @permissionScope Manage Orders
|
|
1195
|
-
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
1196
|
-
* @applicableIdentity APP
|
|
1197
|
-
* @applicableIdentity VISITOR
|
|
1198
|
-
* @fqn com.wix.ecom.checkout.api.v1.CheckoutService.RemoveLineItems
|
|
1199
|
-
*/
|
|
1200
|
-
export async function removeLineItems(_id, lineItemIds) {
|
|
1201
|
-
// @ts-ignore
|
|
1202
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1203
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1204
|
-
id: _id,
|
|
1205
|
-
lineItemIds: lineItemIds,
|
|
1206
|
-
});
|
|
1207
|
-
const reqOpts = ambassadorWixEcomV1Checkout.removeLineItems(payload);
|
|
1208
|
-
sideEffects?.onSiteCall?.();
|
|
1209
|
-
try {
|
|
1210
|
-
const result = await httpClient.request(reqOpts);
|
|
1211
|
-
sideEffects?.onSuccess?.(result);
|
|
1212
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1213
|
-
{
|
|
1214
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
1215
|
-
paths: [{ path: 'checkout.lineItems.url' }],
|
|
1216
|
-
},
|
|
1217
|
-
{
|
|
1218
|
-
transformFn: transformRESTImageToSDKImage,
|
|
1219
|
-
paths: [
|
|
1220
|
-
{ path: 'checkout.lineItems.media' },
|
|
1221
|
-
{ path: 'checkout.lineItems.catalogOverrideFields.image' },
|
|
1222
|
-
],
|
|
1223
|
-
},
|
|
1224
|
-
{
|
|
1225
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
1226
|
-
paths: [
|
|
1227
|
-
{ path: 'checkout.billingInfo.address' },
|
|
1228
|
-
{ path: 'checkout.shippingInfo.shippingDestination.address' },
|
|
1229
|
-
{
|
|
1230
|
-
path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
|
|
1231
|
-
},
|
|
1232
|
-
{
|
|
1233
|
-
path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
|
|
1234
|
-
},
|
|
1235
|
-
],
|
|
1236
|
-
},
|
|
1237
|
-
]));
|
|
1238
|
-
}
|
|
1239
|
-
catch (err) {
|
|
1240
|
-
const transformedError = sdkTransformError(err, {
|
|
1241
|
-
spreadPathsToArguments: {},
|
|
1242
|
-
explicitPathsToArguments: { id: '$[0]', lineItemIds: '$[1]' },
|
|
1243
|
-
singleArgumentUnchanged: false,
|
|
1244
|
-
}, ['_id', 'lineItemIds']);
|
|
1245
|
-
sideEffects?.onError?.(err);
|
|
1246
|
-
throw transformedError;
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
/**
|
|
1250
|
-
* Creates an order from a specified checkout.
|
|
1251
|
-
*
|
|
1252
|
-
* The `createOrder()` function returns a Promise that resolves to the new order's ID and `paymentGatewayOrderID` when the order is created.
|
|
1253
|
-
* 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.
|
|
1254
|
-
*
|
|
1255
|
-
* > **Note:** The following requirements must be met for an order to be created from a checkout.
|
|
1256
|
-
* > + 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.
|
|
1257
|
-
* > + A checkout must have at least 1 line item.
|
|
1258
|
-
* > + All of the line Items have an `availability.status` of `"AVAILABLE"` or `"PARTIALLY_AVAILABLE"`.
|
|
1259
|
-
* > + If there is a payment to be made, meaning that `priceSummary.total` is greater than 0, the `billingInfo.address` field must be provided.
|
|
1260
|
-
* > + When a checkout has line items to be shipped, the `shippingInfo.shippingDestination.address` and `shippingInfo.selectedCarrierServiceOption` fields must be provided.
|
|
1261
|
-
* > + When a checkout has line items for pickup, the `shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails` field must be provided.
|
|
1262
|
-
* @param _id - Checkout ID.
|
|
1263
|
-
* @public
|
|
1264
|
-
* @requiredField _id
|
|
1265
|
-
* @param options - Further order creation options.
|
|
1266
|
-
* @permissionId ECOM.CREATE_ORDER_FROM_CHECKOUT
|
|
1267
|
-
* @permissionScope Manage Stores - all permissions
|
|
1268
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1269
|
-
* @permissionScope Manage Stores
|
|
1270
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1271
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1272
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1273
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1274
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1275
|
-
* @permissionScope Manage Orders
|
|
1276
|
-
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
1277
|
-
* @applicableIdentity APP
|
|
1278
|
-
* @applicableIdentity VISITOR
|
|
1279
|
-
* @fqn com.wix.ecom.checkout.api.v1.CheckoutService.CreateOrder
|
|
1280
|
-
*/
|
|
1281
|
-
export async function createOrder(_id, options) {
|
|
1282
|
-
// @ts-ignore
|
|
1283
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1284
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1285
|
-
id: _id,
|
|
1286
|
-
savePaymentMethod: options?.savePaymentMethod,
|
|
1287
|
-
delayCapture: options?.delayCapture,
|
|
1288
|
-
});
|
|
1289
|
-
const reqOpts = ambassadorWixEcomV1Checkout.createOrder(payload);
|
|
1290
|
-
sideEffects?.onSiteCall?.();
|
|
1291
|
-
try {
|
|
1292
|
-
const result = await httpClient.request(reqOpts);
|
|
1293
|
-
sideEffects?.onSuccess?.(result);
|
|
1294
|
-
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1295
|
-
}
|
|
1296
|
-
catch (err) {
|
|
1297
|
-
const transformedError = sdkTransformError(err, {
|
|
1298
|
-
spreadPathsToArguments: {},
|
|
1299
|
-
explicitPathsToArguments: {
|
|
1300
|
-
id: '$[0]',
|
|
1301
|
-
savePaymentMethod: '$[1].savePaymentMethod',
|
|
1302
|
-
delayCapture: '$[1].delayCapture',
|
|
1303
|
-
},
|
|
1304
|
-
singleArgumentUnchanged: false,
|
|
1305
|
-
}, ['_id', 'options']);
|
|
1306
|
-
sideEffects?.onError?.(err);
|
|
1307
|
-
throw transformedError;
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
/**
|
|
1311
|
-
* Deprecated (use createOrder instead)
|
|
1312
|
-
* @param _id - Checkout ID.
|
|
1313
|
-
* @internal
|
|
1314
|
-
* @documentationMaturity preview
|
|
1315
|
-
* @requiredField _id
|
|
1316
|
-
* @permissionId ECOM.CREATE_ORDER_FROM_CHECKOUT
|
|
1317
|
-
* @permissionScope Manage Stores - all permissions
|
|
1318
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1319
|
-
* @permissionScope Manage Stores
|
|
1320
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1321
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1322
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1323
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1324
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1325
|
-
* @permissionScope Manage Orders
|
|
1326
|
-
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
1327
|
-
* @applicableIdentity APP
|
|
1328
|
-
* @applicableIdentity VISITOR
|
|
1329
|
-
* @fqn com.wix.ecom.checkout.api.v1.CheckoutService.CreateOrderAndCharge
|
|
1330
|
-
*/
|
|
1331
|
-
export async function createOrderAndCharge(_id, options) {
|
|
1332
|
-
// @ts-ignore
|
|
1333
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1334
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1335
|
-
id: _id,
|
|
1336
|
-
paymentToken: options?.paymentToken,
|
|
1337
|
-
savePaymentMethod: options?.savePaymentMethod,
|
|
1338
|
-
delayCapture: options?.delayCapture,
|
|
1339
|
-
});
|
|
1340
|
-
const reqOpts = ambassadorWixEcomV1Checkout.createOrderAndCharge(payload);
|
|
1341
|
-
sideEffects?.onSiteCall?.();
|
|
1342
|
-
try {
|
|
1343
|
-
const result = await httpClient.request(reqOpts);
|
|
1344
|
-
sideEffects?.onSuccess?.(result);
|
|
1345
|
-
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1346
|
-
}
|
|
1347
|
-
catch (err) {
|
|
1348
|
-
const transformedError = sdkTransformError(err, {
|
|
1349
|
-
spreadPathsToArguments: {},
|
|
1350
|
-
explicitPathsToArguments: {
|
|
1351
|
-
id: '$[0]',
|
|
1352
|
-
paymentToken: '$[1].paymentToken',
|
|
1353
|
-
savePaymentMethod: '$[1].savePaymentMethod',
|
|
1354
|
-
delayCapture: '$[1].delayCapture',
|
|
1355
|
-
},
|
|
1356
|
-
singleArgumentUnchanged: false,
|
|
1357
|
-
}, ['_id', 'options']);
|
|
1358
|
-
sideEffects?.onError?.(err);
|
|
1359
|
-
throw transformedError;
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
/**
|
|
1363
|
-
* Marks a checkout as completed and redirects to a specified URL.
|
|
1364
|
-
* @param token - Server-signed JWT token with required information to complete checkout
|
|
1365
|
-
* @public
|
|
1366
|
-
* @documentationMaturity preview
|
|
1367
|
-
* @requiredField token
|
|
1368
|
-
* @permissionId ECOM.MODIFY_CHECKOUTS
|
|
1369
|
-
* @permissionScope Manage Stores - all permissions
|
|
1370
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1371
|
-
* @permissionScope Manage Stores
|
|
1372
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1373
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1374
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1375
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1376
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1377
|
-
* @permissionScope Manage Orders
|
|
1378
|
-
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
1379
|
-
* @applicableIdentity APP
|
|
1380
|
-
* @applicableIdentity VISITOR
|
|
1381
|
-
* @fqn com.wix.ecom.checkout.api.v1.CheckoutService.MarkCheckoutAsCompletedAndRedirectToUrl
|
|
1382
|
-
*/
|
|
1383
|
-
export async function markCheckoutAsCompletedAndRedirectToUrl(token) {
|
|
1384
|
-
// @ts-ignore
|
|
1385
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1386
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({ token: token });
|
|
1387
|
-
const reqOpts = ambassadorWixEcomV1Checkout.markCheckoutAsCompletedAndRedirectToUrl(payload);
|
|
1388
|
-
sideEffects?.onSiteCall?.();
|
|
1389
|
-
try {
|
|
1390
|
-
const result = await httpClient.request(reqOpts);
|
|
1391
|
-
sideEffects?.onSuccess?.(result);
|
|
1392
|
-
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1393
|
-
}
|
|
1394
|
-
catch (err) {
|
|
1395
|
-
const transformedError = sdkTransformError(err, {
|
|
1396
|
-
spreadPathsToArguments: {},
|
|
1397
|
-
explicitPathsToArguments: { token: '$[0]' },
|
|
1398
|
-
singleArgumentUnchanged: false,
|
|
1399
|
-
}, ['token']);
|
|
1400
|
-
sideEffects?.onError?.(err);
|
|
1401
|
-
throw transformedError;
|
|
1402
|
-
}
|
|
1403
|
-
}
|
|
1404
|
-
/**
|
|
1405
|
-
* Marks a checkout as completed - `checkout.complete` boolean is set to `true`.
|
|
1406
|
-
*
|
|
1407
|
-
*
|
|
1408
|
-
* The `markCheckoutAsCompleted()` function returns a Promise that resolves when the specified checkout is marked as completed.
|
|
1409
|
-
* @param _id - Checkout ID.
|
|
1410
|
-
* @public
|
|
1411
|
-
* @requiredField _id
|
|
1412
|
-
* @permissionId ECOM.MODIFY_CHECKOUTS
|
|
1413
|
-
* @permissionScope Manage Stores - all permissions
|
|
1414
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1415
|
-
* @permissionScope Manage Stores
|
|
1416
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1417
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1418
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1419
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1420
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1421
|
-
* @permissionScope Manage Orders
|
|
1422
|
-
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
1423
|
-
* @applicableIdentity APP
|
|
1424
|
-
* @applicableIdentity VISITOR
|
|
1425
|
-
* @fqn com.wix.ecom.checkout.api.v1.CheckoutService.MarkCheckoutAsCompleted
|
|
1426
|
-
*/
|
|
1427
|
-
export async function markCheckoutAsCompleted(_id) {
|
|
1428
|
-
// @ts-ignore
|
|
1429
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1430
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
1431
|
-
const reqOpts = ambassadorWixEcomV1Checkout.markCheckoutAsCompleted(payload);
|
|
1432
|
-
sideEffects?.onSiteCall?.();
|
|
1433
|
-
try {
|
|
1434
|
-
const result = await httpClient.request(reqOpts);
|
|
1435
|
-
sideEffects?.onSuccess?.(result);
|
|
1436
|
-
}
|
|
1437
|
-
catch (err) {
|
|
1438
|
-
const transformedError = sdkTransformError(err, {
|
|
1439
|
-
spreadPathsToArguments: {},
|
|
1440
|
-
explicitPathsToArguments: { id: '$[0]' },
|
|
1441
|
-
singleArgumentUnchanged: false,
|
|
1442
|
-
}, ['_id']);
|
|
1443
|
-
sideEffects?.onError?.(err);
|
|
1444
|
-
throw transformedError;
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
/**
|
|
1448
|
-
* Updates the quantity of one or more line items in a checkout.
|
|
1449
|
-
*
|
|
1450
|
-
* This endpoint is only for updating the quantity of line items. To entirely remove a line item from
|
|
1451
|
-
* the checkout, use [`removeLineItems()`](#removelineitems).
|
|
1452
|
-
* To add a new line item to the checkout, use [`addToCheckout()`](#addtocheckout).
|
|
1453
|
-
*
|
|
1454
|
-
* This endpoint checks the amount of stock remaining for this line item. If the specified `quantity`
|
|
1455
|
-
* is greater than the remaining stock, then the `quantity` returned in the response is the total amount
|
|
1456
|
-
* of remaining stock.
|
|
1457
|
-
* @param _id - Checkout ID.
|
|
1458
|
-
* @param lineItems - Line item info to update.
|
|
1459
|
-
* @public
|
|
1460
|
-
* @requiredField _id
|
|
1461
|
-
* @requiredField lineItems
|
|
1462
|
-
* @requiredField lineItems._id
|
|
1463
|
-
* @requiredField lineItems.quantity
|
|
1464
|
-
* @permissionId ECOM.MODIFY_CHECKOUTS
|
|
1465
|
-
* @permissionScope Manage Stores - all permissions
|
|
1466
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1467
|
-
* @permissionScope Manage Stores
|
|
1468
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1469
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1470
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1471
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1472
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1473
|
-
* @permissionScope Manage Orders
|
|
1474
|
-
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
1475
|
-
* @applicableIdentity APP
|
|
1476
|
-
* @applicableIdentity VISITOR
|
|
1477
|
-
* @fqn com.wix.ecom.checkout.api.v1.CheckoutService.UpdateLineItemsQuantity
|
|
1478
|
-
*/
|
|
1479
|
-
export async function updateLineItemsQuantity(_id, lineItems) {
|
|
1480
|
-
// @ts-ignore
|
|
1481
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1482
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1483
|
-
id: _id,
|
|
1484
|
-
lineItems: lineItems,
|
|
1485
|
-
});
|
|
1486
|
-
const reqOpts = ambassadorWixEcomV1Checkout.updateLineItemsQuantity(payload);
|
|
1487
|
-
sideEffects?.onSiteCall?.();
|
|
1488
|
-
try {
|
|
1489
|
-
const result = await httpClient.request(reqOpts);
|
|
1490
|
-
sideEffects?.onSuccess?.(result);
|
|
1491
|
-
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1492
|
-
{
|
|
1493
|
-
transformFn: transformRESTPageURLV2ToSDKPageURLV2,
|
|
1494
|
-
paths: [{ path: 'checkout.lineItems.url' }],
|
|
1495
|
-
},
|
|
1496
|
-
{
|
|
1497
|
-
transformFn: transformRESTImageToSDKImage,
|
|
1498
|
-
paths: [
|
|
1499
|
-
{ path: 'checkout.lineItems.media' },
|
|
1500
|
-
{ path: 'checkout.lineItems.catalogOverrideFields.image' },
|
|
1501
|
-
],
|
|
1502
|
-
},
|
|
1503
|
-
{
|
|
1504
|
-
transformFn: transformRESTAddressToSDKAddress,
|
|
1505
|
-
paths: [
|
|
1506
|
-
{ path: 'checkout.billingInfo.address' },
|
|
1507
|
-
{ path: 'checkout.shippingInfo.shippingDestination.address' },
|
|
1508
|
-
{
|
|
1509
|
-
path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
|
|
1510
|
-
},
|
|
1511
|
-
{
|
|
1512
|
-
path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
|
|
1513
|
-
},
|
|
1514
|
-
],
|
|
1515
|
-
},
|
|
1516
|
-
]));
|
|
1517
|
-
}
|
|
1518
|
-
catch (err) {
|
|
1519
|
-
const transformedError = sdkTransformError(err, {
|
|
1520
|
-
spreadPathsToArguments: {},
|
|
1521
|
-
explicitPathsToArguments: { id: '$[0]', lineItems: '$[1]' },
|
|
1522
|
-
singleArgumentUnchanged: false,
|
|
1523
|
-
}, ['_id', 'lineItems']);
|
|
1524
|
-
sideEffects?.onError?.(err);
|
|
1525
|
-
throw transformedError;
|
|
1526
|
-
}
|
|
1527
|
-
}
|
|
1528
|
-
/** @param _id - Checkout ID.
|
|
1529
|
-
* @internal
|
|
1530
|
-
* @documentationMaturity preview
|
|
1531
|
-
* @requiredField _id
|
|
1532
|
-
* @permissionId ECOM.READ_PAYMENT_SETTINGS
|
|
1533
|
-
* @fqn com.wix.ecom.checkout.api.v1.CheckoutService.GetCheckoutPaymentSettings
|
|
1534
|
-
*/
|
|
1535
|
-
export async function getCheckoutPaymentSettings(_id) {
|
|
1536
|
-
// @ts-ignore
|
|
1537
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1538
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
1539
|
-
const reqOpts = ambassadorWixEcomV1Checkout.getCheckoutPaymentSettings(payload);
|
|
1540
|
-
sideEffects?.onSiteCall?.();
|
|
1541
|
-
try {
|
|
1542
|
-
const result = await httpClient.request(reqOpts);
|
|
1543
|
-
sideEffects?.onSuccess?.(result);
|
|
1544
|
-
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1545
|
-
}
|
|
1546
|
-
catch (err) {
|
|
1547
|
-
const transformedError = sdkTransformError(err, {
|
|
1548
|
-
spreadPathsToArguments: {},
|
|
1549
|
-
explicitPathsToArguments: { id: '$[0]' },
|
|
1550
|
-
singleArgumentUnchanged: false,
|
|
1551
|
-
}, ['_id']);
|
|
1552
|
-
sideEffects?.onError?.(err);
|
|
1553
|
-
throw transformedError;
|
|
1554
|
-
}
|
|
1555
|
-
}
|
|
1556
|
-
//# sourceMappingURL=ecom-v1-checkout-checkout.universal.js.map
|