@wix/auto_sdk_ecom_draft-orders 1.0.34 → 1.0.36
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-draft-order-draft-orders.types.d.ts → ecom-v1-draft-order-draft-orders.universal-BiN0i3mF.d.mts} +572 -369
- package/build/{cjs/src/ecom-v1-draft-order-draft-orders.types.d.ts → ecom-v1-draft-order-draft-orders.universal-BiN0i3mF.d.ts} +572 -369
- package/build/index.d.mts +291 -0
- package/build/index.d.ts +291 -0
- package/build/index.js +5403 -0
- package/build/index.js.map +1 -0
- package/build/index.mjs +5326 -0
- package/build/index.mjs.map +1 -0
- package/build/internal/{cjs/src/ecom-v1-draft-order-draft-orders.types.d.ts → ecom-v1-draft-order-draft-orders.universal-DkIb6bMI.d.mts} +747 -369
- package/build/internal/{es/src/ecom-v1-draft-order-draft-orders.types.d.ts → ecom-v1-draft-order-draft-orders.universal-DkIb6bMI.d.ts} +747 -369
- package/build/internal/index.d.mts +291 -0
- package/build/internal/index.d.ts +291 -0
- package/build/internal/index.js +5403 -0
- package/build/internal/index.js.map +1 -0
- package/build/internal/index.mjs +5326 -0
- package/build/internal/index.mjs.map +1 -0
- package/build/internal/meta.d.mts +3140 -0
- package/build/internal/meta.d.ts +3140 -0
- package/build/internal/meta.js +3455 -0
- package/build/internal/meta.js.map +1 -0
- package/build/internal/meta.mjs +3406 -0
- package/build/internal/meta.mjs.map +1 -0
- package/build/meta.d.mts +3140 -0
- package/build/meta.d.ts +3140 -0
- package/build/meta.js +3455 -0
- package/build/meta.js.map +1 -0
- package/build/meta.mjs +3406 -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-draft-order-draft-orders.context.d.ts +0 -43
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.context.js +0 -75
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.context.js.map +0 -1
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.http.d.ts +0 -131
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.http.js +0 -3097
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.http.js.map +0 -1
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.meta.d.ts +0 -63
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.meta.js +0 -465
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.meta.js.map +0 -1
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.public.d.ts +0 -255
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.public.js +0 -385
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.public.js.map +0 -1
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.types.js +0 -378
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.types.js.map +0 -1
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.universal.d.ts +0 -4726
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.universal.js +0 -2453
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.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-draft-order-draft-orders.context.d.ts +0 -43
- package/build/es/src/ecom-v1-draft-order-draft-orders.context.js +0 -43
- package/build/es/src/ecom-v1-draft-order-draft-orders.context.js.map +0 -1
- package/build/es/src/ecom-v1-draft-order-draft-orders.http.d.ts +0 -131
- package/build/es/src/ecom-v1-draft-order-draft-orders.http.js +0 -3071
- package/build/es/src/ecom-v1-draft-order-draft-orders.http.js.map +0 -1
- package/build/es/src/ecom-v1-draft-order-draft-orders.meta.d.ts +0 -63
- package/build/es/src/ecom-v1-draft-order-draft-orders.meta.js +0 -416
- package/build/es/src/ecom-v1-draft-order-draft-orders.meta.js.map +0 -1
- package/build/es/src/ecom-v1-draft-order-draft-orders.public.d.ts +0 -255
- package/build/es/src/ecom-v1-draft-order-draft-orders.public.js +0 -330
- package/build/es/src/ecom-v1-draft-order-draft-orders.public.js.map +0 -1
- package/build/es/src/ecom-v1-draft-order-draft-orders.types.js +0 -375
- package/build/es/src/ecom-v1-draft-order-draft-orders.types.js.map +0 -1
- package/build/es/src/ecom-v1-draft-order-draft-orders.universal.d.ts +0 -4726
- package/build/es/src/ecom-v1-draft-order-draft-orders.universal.js +0 -2403
- package/build/es/src/ecom-v1-draft-order-draft-orders.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-draft-order-draft-orders.context.d.ts +0 -43
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.context.js +0 -75
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.context.js.map +0 -1
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.http.d.ts +0 -131
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.http.js +0 -3097
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.http.js.map +0 -1
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.meta.d.ts +0 -63
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.meta.js +0 -465
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.meta.js.map +0 -1
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.public.d.ts +0 -255
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.public.js +0 -385
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.public.js.map +0 -1
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.types.js +0 -378
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.types.js.map +0 -1
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.universal.d.ts +0 -4901
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.universal.js +0 -2453
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.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-draft-order-draft-orders.context.d.ts +0 -43
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.context.js +0 -43
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.context.js.map +0 -1
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.http.d.ts +0 -131
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.http.js +0 -3071
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.http.js.map +0 -1
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.meta.d.ts +0 -63
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.meta.js +0 -416
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.meta.js.map +0 -1
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.public.d.ts +0 -255
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.public.js +0 -330
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.public.js.map +0 -1
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.types.js +0 -375
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.types.js.map +0 -1
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.universal.d.ts +0 -4901
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.universal.js +0 -2403
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.universal.js.map +0 -1
|
@@ -1,2453 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.setTaxExemption = exports.updateExtendedFields = exports.queryDraftOrders = exports.deleteDraftOrder = exports.createOrderFromDraft = exports.commitDraftOrder = exports.getOrderDraftabilityStatus = exports.getDraftOrder = exports.setBillingInfo = exports.setRecipientInfo = exports.setBuyerInfo = exports.setShippingInfo = exports.deleteCustomAdditionalFees = exports.createCustomAdditionalFees = exports.setAdditionalFees = exports.deleteCustomDiscounts = exports.createCustomDiscounts = exports.setDiscounts = exports.updateLineItems = exports.addLineItemsToDraftOrder = exports.createEmptyDraftOrder = exports.createDraftOrder = exports.WebhookIdentityType = exports.SortOrder = exports.ChannelType = exports.AttributionSource = exports.ActivityType = exports.LineItemQuantityChangeType = exports.OrderStatus = exports.FulfillmentStatus = exports.PaymentStatus = exports.NonDraftableReason = exports.DiscountType = exports.FileType = exports.RuleType = exports.PickupMethod = exports.WeightUnit = exports.EditingStatus = exports.DiscountReason = exports.AppliedDiscountDiscountType = exports.SourceType = exports.PickupDetailsPickupMethod = exports.VatType = exports.TaxableAddressType = exports.AdjustmentType = exports.SubscriptionFrequency = exports.JurisdictionType = exports.PaymentOptionType = exports.ItemTypeItemType = exports.DescriptionLineType = void 0;
|
|
27
|
-
exports.setBusinessLocation = void 0;
|
|
28
|
-
const transform_error_1 = require("@wix/sdk-runtime/transform-error");
|
|
29
|
-
const query_builder_1 = require("@wix/sdk-runtime/query-builder");
|
|
30
|
-
const rename_all_nested_keys_1 = require("@wix/sdk-runtime/rename-all-nested-keys");
|
|
31
|
-
const ambassadorWixEcomV1DraftOrder = __importStar(require("./ecom-v1-draft-order-draft-orders.http.js"));
|
|
32
|
-
// @ts-ignore
|
|
33
|
-
const address_1 = require("@wix/sdk-runtime/transformations/address");
|
|
34
|
-
const address_2 = require("@wix/sdk-runtime/transformations/address");
|
|
35
|
-
const image_1 = require("@wix/sdk-runtime/transformations/image");
|
|
36
|
-
const image_2 = require("@wix/sdk-runtime/transformations/image");
|
|
37
|
-
const page_url_v2_1 = require("@wix/sdk-runtime/transformations/page-url-v2");
|
|
38
|
-
const transform_paths_1 = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
39
|
-
var DescriptionLineType;
|
|
40
|
-
(function (DescriptionLineType) {
|
|
41
|
-
/** Unrecognized type. */
|
|
42
|
-
DescriptionLineType["UNRECOGNISED"] = "UNRECOGNISED";
|
|
43
|
-
/** Plain text type. */
|
|
44
|
-
DescriptionLineType["PLAIN_TEXT"] = "PLAIN_TEXT";
|
|
45
|
-
/** Color type. */
|
|
46
|
-
DescriptionLineType["COLOR"] = "COLOR";
|
|
47
|
-
})(DescriptionLineType || (exports.DescriptionLineType = DescriptionLineType = {}));
|
|
48
|
-
var ItemTypeItemType;
|
|
49
|
-
(function (ItemTypeItemType) {
|
|
50
|
-
ItemTypeItemType["UNRECOGNISED"] = "UNRECOGNISED";
|
|
51
|
-
ItemTypeItemType["PHYSICAL"] = "PHYSICAL";
|
|
52
|
-
ItemTypeItemType["DIGITAL"] = "DIGITAL";
|
|
53
|
-
ItemTypeItemType["GIFT_CARD"] = "GIFT_CARD";
|
|
54
|
-
ItemTypeItemType["SERVICE"] = "SERVICE";
|
|
55
|
-
})(ItemTypeItemType || (exports.ItemTypeItemType = ItemTypeItemType = {}));
|
|
56
|
-
/** Type of selected payment option for catalog item */
|
|
57
|
-
var PaymentOptionType;
|
|
58
|
-
(function (PaymentOptionType) {
|
|
59
|
-
/** The entire payment for this item happens as part of the checkout. */
|
|
60
|
-
PaymentOptionType["FULL_PAYMENT_ONLINE"] = "FULL_PAYMENT_ONLINE";
|
|
61
|
-
/** The entire payment for this item happens after checkout. For example, when using cash, check, or other offline payment methods. */
|
|
62
|
-
PaymentOptionType["FULL_PAYMENT_OFFLINE"] = "FULL_PAYMENT_OFFLINE";
|
|
63
|
-
/** Payment for this item is done by charging a membership. When selected, `price` is `0`. */
|
|
64
|
-
PaymentOptionType["MEMBERSHIP"] = "MEMBERSHIP";
|
|
65
|
-
/** Partial payment to be paid upfront during checkout. The initial amount to be paid for each line item is specified in `depositAmount`. */
|
|
66
|
-
PaymentOptionType["DEPOSIT_ONLINE"] = "DEPOSIT_ONLINE";
|
|
67
|
-
/** 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`. */
|
|
68
|
-
PaymentOptionType["MEMBERSHIP_OFFLINE"] = "MEMBERSHIP_OFFLINE";
|
|
69
|
-
})(PaymentOptionType || (exports.PaymentOptionType = PaymentOptionType = {}));
|
|
70
|
-
/** JurisdictionType represents the type of the jurisdiction in which this tax detail applies (e.g. Country,State,County,City,Special). */
|
|
71
|
-
var JurisdictionType;
|
|
72
|
-
(function (JurisdictionType) {
|
|
73
|
-
JurisdictionType["UNDEFINED"] = "UNDEFINED";
|
|
74
|
-
JurisdictionType["COUNTRY"] = "COUNTRY";
|
|
75
|
-
JurisdictionType["STATE"] = "STATE";
|
|
76
|
-
JurisdictionType["COUNTY"] = "COUNTY";
|
|
77
|
-
JurisdictionType["CITY"] = "CITY";
|
|
78
|
-
JurisdictionType["SPECIAL"] = "SPECIAL";
|
|
79
|
-
})(JurisdictionType || (exports.JurisdictionType = JurisdictionType = {}));
|
|
80
|
-
/** Frequency unit of recurring payment */
|
|
81
|
-
var SubscriptionFrequency;
|
|
82
|
-
(function (SubscriptionFrequency) {
|
|
83
|
-
SubscriptionFrequency["UNDEFINED"] = "UNDEFINED";
|
|
84
|
-
SubscriptionFrequency["DAY"] = "DAY";
|
|
85
|
-
SubscriptionFrequency["WEEK"] = "WEEK";
|
|
86
|
-
SubscriptionFrequency["MONTH"] = "MONTH";
|
|
87
|
-
SubscriptionFrequency["YEAR"] = "YEAR";
|
|
88
|
-
})(SubscriptionFrequency || (exports.SubscriptionFrequency = SubscriptionFrequency = {}));
|
|
89
|
-
var AdjustmentType;
|
|
90
|
-
(function (AdjustmentType) {
|
|
91
|
-
AdjustmentType["UNKNOWN_ADJUSTMENT_TYPE"] = "UNKNOWN_ADJUSTMENT_TYPE";
|
|
92
|
-
/** Adjustment increases the total amount due to changes like covering extra billing days. Typically results in an additional fee. */
|
|
93
|
-
AdjustmentType["EXTRA_CHARGE"] = "EXTRA_CHARGE";
|
|
94
|
-
/** Adjustment reduces the total amount due to changes like covering fewer billing days. Typically results in a credit or discount. */
|
|
95
|
-
AdjustmentType["CREDIT"] = "CREDIT";
|
|
96
|
-
})(AdjustmentType || (exports.AdjustmentType = AdjustmentType = {}));
|
|
97
|
-
var TaxableAddressType;
|
|
98
|
-
(function (TaxableAddressType) {
|
|
99
|
-
TaxableAddressType["UNKNOWN_TAXABLE_ADDRESS"] = "UNKNOWN_TAXABLE_ADDRESS";
|
|
100
|
-
TaxableAddressType["BUSINESS"] = "BUSINESS";
|
|
101
|
-
TaxableAddressType["BILLING"] = "BILLING";
|
|
102
|
-
TaxableAddressType["SHIPPING"] = "SHIPPING";
|
|
103
|
-
})(TaxableAddressType || (exports.TaxableAddressType = TaxableAddressType = {}));
|
|
104
|
-
/** tax info types */
|
|
105
|
-
var VatType;
|
|
106
|
-
(function (VatType) {
|
|
107
|
-
VatType["UNSPECIFIED"] = "UNSPECIFIED";
|
|
108
|
-
/** CPF - for individual tax payers. */
|
|
109
|
-
VatType["CPF"] = "CPF";
|
|
110
|
-
/** CNPJ - for corporations */
|
|
111
|
-
VatType["CNPJ"] = "CNPJ";
|
|
112
|
-
})(VatType || (exports.VatType = VatType = {}));
|
|
113
|
-
var PickupDetailsPickupMethod;
|
|
114
|
-
(function (PickupDetailsPickupMethod) {
|
|
115
|
-
PickupDetailsPickupMethod["UNKNOWN_METHOD"] = "UNKNOWN_METHOD";
|
|
116
|
-
PickupDetailsPickupMethod["STORE_PICKUP"] = "STORE_PICKUP";
|
|
117
|
-
PickupDetailsPickupMethod["PICKUP_POINT"] = "PICKUP_POINT";
|
|
118
|
-
})(PickupDetailsPickupMethod || (exports.PickupDetailsPickupMethod = PickupDetailsPickupMethod = {}));
|
|
119
|
-
var SourceType;
|
|
120
|
-
(function (SourceType) {
|
|
121
|
-
/** Part of the original order. */
|
|
122
|
-
SourceType["ORIGINAL_ORDER"] = "ORIGINAL_ORDER";
|
|
123
|
-
/** Added automatically, as the result of recalculation caused by changes in draft order. */
|
|
124
|
-
SourceType["AUTOMATIC"] = "AUTOMATIC";
|
|
125
|
-
/** Added manually to draft order. */
|
|
126
|
-
SourceType["CUSTOM"] = "CUSTOM";
|
|
127
|
-
})(SourceType || (exports.SourceType = SourceType = {}));
|
|
128
|
-
var AppliedDiscountDiscountType;
|
|
129
|
-
(function (AppliedDiscountDiscountType) {
|
|
130
|
-
AppliedDiscountDiscountType["GLOBAL"] = "GLOBAL";
|
|
131
|
-
AppliedDiscountDiscountType["SPECIFIC_ITEMS"] = "SPECIFIC_ITEMS";
|
|
132
|
-
AppliedDiscountDiscountType["SHIPPING"] = "SHIPPING";
|
|
133
|
-
})(AppliedDiscountDiscountType || (exports.AppliedDiscountDiscountType = AppliedDiscountDiscountType = {}));
|
|
134
|
-
var DiscountReason;
|
|
135
|
-
(function (DiscountReason) {
|
|
136
|
-
DiscountReason["UNSPECIFIED"] = "UNSPECIFIED";
|
|
137
|
-
DiscountReason["EXCHANGED_ITEMS"] = "EXCHANGED_ITEMS";
|
|
138
|
-
DiscountReason["BILLING_ADJUSTMENT"] = "BILLING_ADJUSTMENT";
|
|
139
|
-
})(DiscountReason || (exports.DiscountReason = DiscountReason = {}));
|
|
140
|
-
var EditingStatus;
|
|
141
|
-
(function (EditingStatus) {
|
|
142
|
-
/** Draft order is being edited. */
|
|
143
|
-
EditingStatus["DRAFT"] = "DRAFT";
|
|
144
|
-
/**
|
|
145
|
-
* Draft order has been committed - No further modifications allowed.
|
|
146
|
-
*
|
|
147
|
-
* Draft orders with status 'COMMITTED' cannot be deleted.
|
|
148
|
-
*/
|
|
149
|
-
EditingStatus["COMMITTED"] = "COMMITTED";
|
|
150
|
-
})(EditingStatus || (exports.EditingStatus = EditingStatus = {}));
|
|
151
|
-
var WeightUnit;
|
|
152
|
-
(function (WeightUnit) {
|
|
153
|
-
/** Weight unit can't be classified due to an error. */
|
|
154
|
-
WeightUnit["UNSPECIFIED_WEIGHT_UNIT"] = "UNSPECIFIED_WEIGHT_UNIT";
|
|
155
|
-
/** Kilograms. */
|
|
156
|
-
WeightUnit["KG"] = "KG";
|
|
157
|
-
/** Pounds. */
|
|
158
|
-
WeightUnit["LB"] = "LB";
|
|
159
|
-
})(WeightUnit || (exports.WeightUnit = WeightUnit = {}));
|
|
160
|
-
var PickupMethod;
|
|
161
|
-
(function (PickupMethod) {
|
|
162
|
-
PickupMethod["UNKNOWN_METHOD"] = "UNKNOWN_METHOD";
|
|
163
|
-
/** Store pickup. */
|
|
164
|
-
PickupMethod["STORE_PICKUP"] = "STORE_PICKUP";
|
|
165
|
-
/** Pickup point. */
|
|
166
|
-
PickupMethod["PICKUP_POINT"] = "PICKUP_POINT";
|
|
167
|
-
})(PickupMethod || (exports.PickupMethod = PickupMethod = {}));
|
|
168
|
-
var RuleType;
|
|
169
|
-
(function (RuleType) {
|
|
170
|
-
RuleType["VALIDATION"] = "VALIDATION";
|
|
171
|
-
RuleType["OTHER"] = "OTHER";
|
|
172
|
-
RuleType["MAX"] = "MAX";
|
|
173
|
-
RuleType["MIN"] = "MIN";
|
|
174
|
-
RuleType["MAX_LENGTH"] = "MAX_LENGTH";
|
|
175
|
-
RuleType["MIN_LENGTH"] = "MIN_LENGTH";
|
|
176
|
-
RuleType["MAX_SIZE"] = "MAX_SIZE";
|
|
177
|
-
RuleType["MIN_SIZE"] = "MIN_SIZE";
|
|
178
|
-
RuleType["FORMAT"] = "FORMAT";
|
|
179
|
-
RuleType["DECIMAL_LTE"] = "DECIMAL_LTE";
|
|
180
|
-
RuleType["DECIMAL_GTE"] = "DECIMAL_GTE";
|
|
181
|
-
RuleType["DECIMAL_LT"] = "DECIMAL_LT";
|
|
182
|
-
RuleType["DECIMAL_GT"] = "DECIMAL_GT";
|
|
183
|
-
RuleType["DECIMAL_MAX_SCALE"] = "DECIMAL_MAX_SCALE";
|
|
184
|
-
RuleType["INVALID_ENUM_VALUE"] = "INVALID_ENUM_VALUE";
|
|
185
|
-
RuleType["REQUIRED_FIELD"] = "REQUIRED_FIELD";
|
|
186
|
-
RuleType["FIELD_NOT_ALLOWED"] = "FIELD_NOT_ALLOWED";
|
|
187
|
-
RuleType["ONE_OF_ALIGNMENT"] = "ONE_OF_ALIGNMENT";
|
|
188
|
-
RuleType["EXACT_LENGTH"] = "EXACT_LENGTH";
|
|
189
|
-
RuleType["EXACT_SIZE"] = "EXACT_SIZE";
|
|
190
|
-
RuleType["REQUIRED_ONE_OF_FIELD"] = "REQUIRED_ONE_OF_FIELD";
|
|
191
|
-
})(RuleType || (exports.RuleType = RuleType = {}));
|
|
192
|
-
var FileType;
|
|
193
|
-
(function (FileType) {
|
|
194
|
-
FileType["UNSPECIFIED"] = "UNSPECIFIED";
|
|
195
|
-
FileType["SECURE_PICTURE"] = "SECURE_PICTURE";
|
|
196
|
-
FileType["SECURE_VIDEO"] = "SECURE_VIDEO";
|
|
197
|
-
FileType["SECURE_DOCUMENT"] = "SECURE_DOCUMENT";
|
|
198
|
-
FileType["SECURE_MUSIC"] = "SECURE_MUSIC";
|
|
199
|
-
FileType["SECURE_ARCHIVE"] = "SECURE_ARCHIVE";
|
|
200
|
-
})(FileType || (exports.FileType = FileType = {}));
|
|
201
|
-
var DiscountType;
|
|
202
|
-
(function (DiscountType) {
|
|
203
|
-
DiscountType["UNKNOWN_TYPE"] = "UNKNOWN_TYPE";
|
|
204
|
-
/** Discount applies to the entire order. */
|
|
205
|
-
DiscountType["GLOBAL"] = "GLOBAL";
|
|
206
|
-
/** Discount applies to a specific item. */
|
|
207
|
-
DiscountType["SPECIFIC_ITEMS"] = "SPECIFIC_ITEMS";
|
|
208
|
-
/** Discount applies to shipping fee. */
|
|
209
|
-
DiscountType["SHIPPING"] = "SHIPPING";
|
|
210
|
-
})(DiscountType || (exports.DiscountType = DiscountType = {}));
|
|
211
|
-
var NonDraftableReason;
|
|
212
|
-
(function (NonDraftableReason) {
|
|
213
|
-
NonDraftableReason["UNSPECIFIED"] = "UNSPECIFIED";
|
|
214
|
-
/** Modifications of refunded orders are not supported. */
|
|
215
|
-
NonDraftableReason["PARTIALLY_OR_FULLY_REFUNDED"] = "PARTIALLY_OR_FULLY_REFUNDED";
|
|
216
|
-
/**
|
|
217
|
-
* Original order must be created via one of the following channel types:
|
|
218
|
-
* + WEB
|
|
219
|
-
* + POS
|
|
220
|
-
* + BACKOFFICE_MERCHANT
|
|
221
|
-
* + WIX_APP_STORE
|
|
222
|
-
*/
|
|
223
|
-
NonDraftableReason["UNSUPPORTED_CHANNEL_TYPE"] = "UNSUPPORTED_CHANNEL_TYPE";
|
|
224
|
-
/** Order status is not APPROVED. */
|
|
225
|
-
NonDraftableReason["ORDER_STATUS_IS_NOT_SUPPORTED"] = "ORDER_STATUS_IS_NOT_SUPPORTED";
|
|
226
|
-
/** Site and order currencies are different. */
|
|
227
|
-
NonDraftableReason["ORDER_AND_SITE_CURRENCIES_ARE_INCONSISTENT"] = "ORDER_AND_SITE_CURRENCIES_ARE_INCONSISTENT";
|
|
228
|
-
/** Site and order weight units are different. */
|
|
229
|
-
NonDraftableReason["ORDER_AND_SITE_WEIGHT_UNITS_ARE_INCONSISTENT"] = "ORDER_AND_SITE_WEIGHT_UNITS_ARE_INCONSISTENT";
|
|
230
|
-
/** Order not found. */
|
|
231
|
-
NonDraftableReason["ORDER_NOT_FOUND"] = "ORDER_NOT_FOUND";
|
|
232
|
-
/** Modifications of orders with subscription items are not supported. */
|
|
233
|
-
NonDraftableReason["SUBSCRIPTION_LINE_ITEM_EXISTS"] = "SUBSCRIPTION_LINE_ITEM_EXISTS";
|
|
234
|
-
})(NonDraftableReason || (exports.NonDraftableReason = NonDraftableReason = {}));
|
|
235
|
-
var PaymentStatus;
|
|
236
|
-
(function (PaymentStatus) {
|
|
237
|
-
PaymentStatus["UNSPECIFIED"] = "UNSPECIFIED";
|
|
238
|
-
/**
|
|
239
|
-
* `NOT_PAID` can apply to an order made online, but not yet paid. In such cases `order.status` will be `INITIALIZED`.
|
|
240
|
-
* This status also applies when an offline order needs to be manually marked as paid. In such cases `order.status` will be `APPROVED`.
|
|
241
|
-
*/
|
|
242
|
-
PaymentStatus["NOT_PAID"] = "NOT_PAID";
|
|
243
|
-
/** All required payments associated with this order are paid. */
|
|
244
|
-
PaymentStatus["PAID"] = "PAID";
|
|
245
|
-
/** Order partially refunded, but the refunded amount is less than the order's total price. See `order.balanceSummary` for more details. */
|
|
246
|
-
PaymentStatus["PARTIALLY_REFUNDED"] = "PARTIALLY_REFUNDED";
|
|
247
|
-
/** Order fully refunded. Refund amount equals total price. See `order.balanceSummary` for more details. */
|
|
248
|
-
PaymentStatus["FULLY_REFUNDED"] = "FULLY_REFUNDED";
|
|
249
|
-
/**
|
|
250
|
-
* All payments pending.
|
|
251
|
-
*
|
|
252
|
-
* This can happen with two-step payments, when a payment requires manual review, or when a payment is in progress and will be concluded shortly.
|
|
253
|
-
* Learn more about [pending orders](https://support.wix.com/en/article/pending-orders).
|
|
254
|
-
*/
|
|
255
|
-
PaymentStatus["PENDING"] = "PENDING";
|
|
256
|
-
/** At least one payment received and approved, but it covers less than the order's total price. See `order.balanceSummary` for more details. */
|
|
257
|
-
PaymentStatus["PARTIALLY_PAID"] = "PARTIALLY_PAID";
|
|
258
|
-
/**
|
|
259
|
-
* Payment received, but not yet confirmed by the payment provider.
|
|
260
|
-
*
|
|
261
|
-
* In most cases, when a payment provider is holding payment it's because setup hasn't been successfully completed by the merchant/site owner.
|
|
262
|
-
* To solve this, the merchant/site owner should log in to the payment provider's dashboard and make sure their account is set up correctly, or contact their support for further assistance.
|
|
263
|
-
* @documentationMaturity preview
|
|
264
|
-
*/
|
|
265
|
-
PaymentStatus["PENDING_MERCHANT"] = "PENDING_MERCHANT";
|
|
266
|
-
/**
|
|
267
|
-
* One or more payments canceled.
|
|
268
|
-
* @documentationMaturity preview
|
|
269
|
-
*/
|
|
270
|
-
PaymentStatus["CANCELED"] = "CANCELED";
|
|
271
|
-
/**
|
|
272
|
-
* One or more payments declined.
|
|
273
|
-
* @documentationMaturity preview
|
|
274
|
-
*/
|
|
275
|
-
PaymentStatus["DECLINED"] = "DECLINED";
|
|
276
|
-
})(PaymentStatus || (exports.PaymentStatus = PaymentStatus = {}));
|
|
277
|
-
var FulfillmentStatus;
|
|
278
|
-
(function (FulfillmentStatus) {
|
|
279
|
-
/** None of the order items are fulfilled or the order was manually marked as unfulfilled. */
|
|
280
|
-
FulfillmentStatus["NOT_FULFILLED"] = "NOT_FULFILLED";
|
|
281
|
-
/**
|
|
282
|
-
* All of the order items are fulfilled or the order was manually marked as fulfilled.
|
|
283
|
-
* Orders without shipping info are fulfilled automatically.
|
|
284
|
-
*/
|
|
285
|
-
FulfillmentStatus["FULFILLED"] = "FULFILLED";
|
|
286
|
-
/** Some, but not all, of the order items are fulfilled. */
|
|
287
|
-
FulfillmentStatus["PARTIALLY_FULFILLED"] = "PARTIALLY_FULFILLED";
|
|
288
|
-
})(FulfillmentStatus || (exports.FulfillmentStatus = FulfillmentStatus = {}));
|
|
289
|
-
var OrderStatus;
|
|
290
|
-
(function (OrderStatus) {
|
|
291
|
-
/** Order created, but not yet approved or canceled. */
|
|
292
|
-
OrderStatus["INITIALIZED"] = "INITIALIZED";
|
|
293
|
-
/**
|
|
294
|
-
* Order approved.
|
|
295
|
-
*
|
|
296
|
-
* This happens when either an online payment is received **or** when `order.priceSummary.total = 0` (a zero-total order).
|
|
297
|
-
* Offline orders (cash payment) are automatically approved.
|
|
298
|
-
*/
|
|
299
|
-
OrderStatus["APPROVED"] = "APPROVED";
|
|
300
|
-
/** Order canceled by the user. */
|
|
301
|
-
OrderStatus["CANCELED"] = "CANCELED";
|
|
302
|
-
/**
|
|
303
|
-
* Order pending.
|
|
304
|
-
* @documentationMaturity preview
|
|
305
|
-
*/
|
|
306
|
-
OrderStatus["PENDING"] = "PENDING";
|
|
307
|
-
/**
|
|
308
|
-
* Order rejected.
|
|
309
|
-
*
|
|
310
|
-
* This happens when pending payments fail.
|
|
311
|
-
* @documentationMaturity preview
|
|
312
|
-
*/
|
|
313
|
-
OrderStatus["REJECTED"] = "REJECTED";
|
|
314
|
-
})(OrderStatus || (exports.OrderStatus = OrderStatus = {}));
|
|
315
|
-
var LineItemQuantityChangeType;
|
|
316
|
-
(function (LineItemQuantityChangeType) {
|
|
317
|
-
/** Quantity increased. */
|
|
318
|
-
LineItemQuantityChangeType["QUANTITY_INCREASED"] = "QUANTITY_INCREASED";
|
|
319
|
-
/** Quantity decreased. */
|
|
320
|
-
LineItemQuantityChangeType["QUANTITY_DECREASED"] = "QUANTITY_DECREASED";
|
|
321
|
-
})(LineItemQuantityChangeType || (exports.LineItemQuantityChangeType = LineItemQuantityChangeType = {}));
|
|
322
|
-
var ActivityType;
|
|
323
|
-
(function (ActivityType) {
|
|
324
|
-
ActivityType["ORDER_REFUNDED"] = "ORDER_REFUNDED";
|
|
325
|
-
ActivityType["ORDER_PLACED"] = "ORDER_PLACED";
|
|
326
|
-
ActivityType["ORDER_PAID"] = "ORDER_PAID";
|
|
327
|
-
ActivityType["ORDER_FULFILLED"] = "ORDER_FULFILLED";
|
|
328
|
-
ActivityType["ORDER_NOT_FULFILLED"] = "ORDER_NOT_FULFILLED";
|
|
329
|
-
ActivityType["ORDER_CANCELED"] = "ORDER_CANCELED";
|
|
330
|
-
ActivityType["DOWNLOAD_LINK_SENT"] = "DOWNLOAD_LINK_SENT";
|
|
331
|
-
ActivityType["TRACKING_NUMBER_ADDED"] = "TRACKING_NUMBER_ADDED";
|
|
332
|
-
ActivityType["TRACKING_NUMBER_EDITED"] = "TRACKING_NUMBER_EDITED";
|
|
333
|
-
ActivityType["TRACKING_LINK_ADDED"] = "TRACKING_LINK_ADDED";
|
|
334
|
-
ActivityType["SHIPPING_CONFIRMATION_EMAIL_SENT"] = "SHIPPING_CONFIRMATION_EMAIL_SENT";
|
|
335
|
-
ActivityType["INVOICE_ADDED"] = "INVOICE_ADDED";
|
|
336
|
-
ActivityType["INVOICE_REMOVED"] = "INVOICE_REMOVED";
|
|
337
|
-
ActivityType["INVOICE_SENT"] = "INVOICE_SENT";
|
|
338
|
-
ActivityType["FULFILLER_EMAIL_SENT"] = "FULFILLER_EMAIL_SENT";
|
|
339
|
-
ActivityType["SHIPPING_ADDRESS_EDITED"] = "SHIPPING_ADDRESS_EDITED";
|
|
340
|
-
ActivityType["EMAIL_EDITED"] = "EMAIL_EDITED";
|
|
341
|
-
ActivityType["PICKUP_READY_EMAIL_SENT"] = "PICKUP_READY_EMAIL_SENT";
|
|
342
|
-
ActivityType["CUSTOM_ACTIVITY"] = "CUSTOM_ACTIVITY";
|
|
343
|
-
ActivityType["MERCHANT_COMMENT"] = "MERCHANT_COMMENT";
|
|
344
|
-
ActivityType["ORDER_CREATED_FROM_EXCHANGE"] = "ORDER_CREATED_FROM_EXCHANGE";
|
|
345
|
-
ActivityType["NEW_EXCHANGE_ORDER_CREATED"] = "NEW_EXCHANGE_ORDER_CREATED";
|
|
346
|
-
ActivityType["ORDER_PARTIALLY_PAID"] = "ORDER_PARTIALLY_PAID";
|
|
347
|
-
ActivityType["DRAFT_ORDER_CHANGES_APPLIED"] = "DRAFT_ORDER_CHANGES_APPLIED";
|
|
348
|
-
ActivityType["SAVED_PAYMENT_METHOD"] = "SAVED_PAYMENT_METHOD";
|
|
349
|
-
/** @documentationMaturity preview */
|
|
350
|
-
ActivityType["PAYMENT_PENDING"] = "PAYMENT_PENDING";
|
|
351
|
-
/** @documentationMaturity preview */
|
|
352
|
-
ActivityType["PAYMENT_CANCELED"] = "PAYMENT_CANCELED";
|
|
353
|
-
/** @documentationMaturity preview */
|
|
354
|
-
ActivityType["PAYMENT_DECLINED"] = "PAYMENT_DECLINED";
|
|
355
|
-
/** @documentationMaturity preview */
|
|
356
|
-
ActivityType["ORDER_PENDING"] = "ORDER_PENDING";
|
|
357
|
-
/** @documentationMaturity preview */
|
|
358
|
-
ActivityType["ORDER_REJECTED"] = "ORDER_REJECTED";
|
|
359
|
-
})(ActivityType || (exports.ActivityType = ActivityType = {}));
|
|
360
|
-
var AttributionSource;
|
|
361
|
-
(function (AttributionSource) {
|
|
362
|
-
AttributionSource["UNSPECIFIED"] = "UNSPECIFIED";
|
|
363
|
-
AttributionSource["FACEBOOK_ADS"] = "FACEBOOK_ADS";
|
|
364
|
-
})(AttributionSource || (exports.AttributionSource = AttributionSource = {}));
|
|
365
|
-
var ChannelType;
|
|
366
|
-
(function (ChannelType) {
|
|
367
|
-
/** Unspecified sales channel. This value is not supported. */
|
|
368
|
-
ChannelType["UNSPECIFIED"] = "UNSPECIFIED";
|
|
369
|
-
/** A web client. */
|
|
370
|
-
ChannelType["WEB"] = "WEB";
|
|
371
|
-
/** [Point of sale solutions](https://support.wix.com/en/wix-mobile-pos-2196395). */
|
|
372
|
-
ChannelType["POS"] = "POS";
|
|
373
|
-
/** [eBay shop](https://support.wix.com/en/article/wix-stores-connecting-and-setting-up-an-ebay-shop). */
|
|
374
|
-
ChannelType["EBAY"] = "EBAY";
|
|
375
|
-
/** [Amazon shop](https://support.wix.com/en/article/wix-stores-connecting-and-setting-up-an-amazon-shop). */
|
|
376
|
-
ChannelType["AMAZON"] = "AMAZON";
|
|
377
|
-
/** Other sales platform. */
|
|
378
|
-
ChannelType["OTHER_PLATFORM"] = "OTHER_PLATFORM";
|
|
379
|
-
/** [Wix Owner app](https://support.wix.com/article/wix-owner-app-an-overview). */
|
|
380
|
-
ChannelType["WIX_APP_STORE"] = "WIX_APP_STORE";
|
|
381
|
-
/** 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) */
|
|
382
|
-
ChannelType["WIX_INVOICES"] = "WIX_INVOICES";
|
|
383
|
-
/** Wix merchant backoffice. */
|
|
384
|
-
ChannelType["BACKOFFICE_MERCHANT"] = "BACKOFFICE_MERCHANT";
|
|
385
|
-
/** Wish sales channel. */
|
|
386
|
-
ChannelType["WISH"] = "WISH";
|
|
387
|
-
/** [ClassPass sales channel](https://support.wix.com/en/article/wix-bookings-letting-clients-book-your-services-with-classpass). */
|
|
388
|
-
ChannelType["CLASS_PASS"] = "CLASS_PASS";
|
|
389
|
-
/** Global-E sales channel. */
|
|
390
|
-
ChannelType["GLOBAL_E"] = "GLOBAL_E";
|
|
391
|
-
/** [Facebook shop](https://support.wix.com/en/article/wix-stores-changes-to-facebook-shops). */
|
|
392
|
-
ChannelType["FACEBOOK"] = "FACEBOOK";
|
|
393
|
-
/** [Etsy sales channel](https://support.wix.com/en/article/wix-stores-request-adding-etsy-as-a-sales-channel). */
|
|
394
|
-
ChannelType["ETSY"] = "ETSY";
|
|
395
|
-
/** [TikTok sales channel](https://support.wix.com/en/article/wix-stores-request-adding-tiktok-as-a-sales-channel). */
|
|
396
|
-
ChannelType["TIKTOK"] = "TIKTOK";
|
|
397
|
-
/** [Faire marketplace integration](https://support.wix.com/en/article/wix-stores-creating-a-faire-store-using-the-faire-integration-app). */
|
|
398
|
-
ChannelType["FAIRE_COM"] = "FAIRE_COM";
|
|
399
|
-
})(ChannelType || (exports.ChannelType = ChannelType = {}));
|
|
400
|
-
var SortOrder;
|
|
401
|
-
(function (SortOrder) {
|
|
402
|
-
SortOrder["ASC"] = "ASC";
|
|
403
|
-
SortOrder["DESC"] = "DESC";
|
|
404
|
-
})(SortOrder || (exports.SortOrder = SortOrder = {}));
|
|
405
|
-
var WebhookIdentityType;
|
|
406
|
-
(function (WebhookIdentityType) {
|
|
407
|
-
WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
|
|
408
|
-
WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
|
|
409
|
-
WebhookIdentityType["MEMBER"] = "MEMBER";
|
|
410
|
-
WebhookIdentityType["WIX_USER"] = "WIX_USER";
|
|
411
|
-
WebhookIdentityType["APP"] = "APP";
|
|
412
|
-
})(WebhookIdentityType || (exports.WebhookIdentityType = WebhookIdentityType = {}));
|
|
413
|
-
/**
|
|
414
|
-
* Creates or retrieves a draft order based on the specified order ID.
|
|
415
|
-
*
|
|
416
|
-
* When passing the ID of an order that is already in draft, the existing draft order is returned.
|
|
417
|
-
* To complete a draft and update the original order, call Commit Draft Order.
|
|
418
|
-
* @param orderId - ID of the order to create a draft for.
|
|
419
|
-
* @public
|
|
420
|
-
* @documentationMaturity preview
|
|
421
|
-
* @requiredField orderId
|
|
422
|
-
* @permissionId ECOM.DRAFT_ORDERS_CREATE
|
|
423
|
-
* @permissionId ECOM.DRAFT_ORDER_READ_ALL_EXTENDED_FIELDS
|
|
424
|
-
* @permissionId DRAFT_ORDER_WRITE_ALL_EXTENDED_FIELDS
|
|
425
|
-
* @permissionScope Manage Stores - all permissions
|
|
426
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
427
|
-
* @permissionScope Manage Stores
|
|
428
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
429
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
430
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
431
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
432
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
433
|
-
* @applicableIdentity APP
|
|
434
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateDraftOrder
|
|
435
|
-
*/
|
|
436
|
-
async function createDraftOrder(orderId) {
|
|
437
|
-
// @ts-ignore
|
|
438
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
439
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({ orderId: orderId });
|
|
440
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.createDraftOrder(payload);
|
|
441
|
-
sideEffects?.onSiteCall?.();
|
|
442
|
-
try {
|
|
443
|
-
const result = await httpClient.request(reqOpts);
|
|
444
|
-
sideEffects?.onSuccess?.(result);
|
|
445
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
446
|
-
{
|
|
447
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
448
|
-
paths: [
|
|
449
|
-
{
|
|
450
|
-
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
451
|
-
},
|
|
452
|
-
],
|
|
453
|
-
},
|
|
454
|
-
{
|
|
455
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
456
|
-
paths: [
|
|
457
|
-
{
|
|
458
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
462
|
-
},
|
|
463
|
-
{
|
|
464
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
465
|
-
},
|
|
466
|
-
{
|
|
467
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
468
|
-
},
|
|
469
|
-
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
470
|
-
{
|
|
471
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
472
|
-
},
|
|
473
|
-
{
|
|
474
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
475
|
-
},
|
|
476
|
-
{
|
|
477
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
478
|
-
},
|
|
479
|
-
{
|
|
480
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
481
|
-
},
|
|
482
|
-
{
|
|
483
|
-
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
484
|
-
},
|
|
485
|
-
],
|
|
486
|
-
},
|
|
487
|
-
]));
|
|
488
|
-
}
|
|
489
|
-
catch (err) {
|
|
490
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
491
|
-
spreadPathsToArguments: {},
|
|
492
|
-
explicitPathsToArguments: { orderId: '$[0]' },
|
|
493
|
-
singleArgumentUnchanged: false,
|
|
494
|
-
}, ['orderId']);
|
|
495
|
-
sideEffects?.onError?.(err);
|
|
496
|
-
throw transformedError;
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
exports.createDraftOrder = createDraftOrder;
|
|
500
|
-
/**
|
|
501
|
-
* Creates an empty draft order.
|
|
502
|
-
*
|
|
503
|
-
* After all relevant details are applied, call Create Order From Draft to convert the draft order to a regular order.
|
|
504
|
-
* @public
|
|
505
|
-
* @documentationMaturity preview
|
|
506
|
-
* @permissionId ECOM.DRAFT_ORDERS_CREATE
|
|
507
|
-
* @permissionId ECOM.DRAFT_ORDER_READ_ALL_EXTENDED_FIELDS
|
|
508
|
-
* @permissionId DRAFT_ORDER_WRITE_ALL_EXTENDED_FIELDS
|
|
509
|
-
* @permissionScope Manage Stores - all permissions
|
|
510
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
511
|
-
* @permissionScope Manage Stores
|
|
512
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
513
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
514
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
515
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
516
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
517
|
-
* @applicableIdentity APP
|
|
518
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateEmptyDraftOrder
|
|
519
|
-
*/
|
|
520
|
-
async function createEmptyDraftOrder() {
|
|
521
|
-
// @ts-ignore
|
|
522
|
-
const { httpClient, sideEffects } = arguments[0];
|
|
523
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({});
|
|
524
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.createEmptyDraftOrder(payload);
|
|
525
|
-
sideEffects?.onSiteCall?.();
|
|
526
|
-
try {
|
|
527
|
-
const result = await httpClient.request(reqOpts);
|
|
528
|
-
sideEffects?.onSuccess?.(result);
|
|
529
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
530
|
-
{
|
|
531
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
532
|
-
paths: [
|
|
533
|
-
{
|
|
534
|
-
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
535
|
-
},
|
|
536
|
-
],
|
|
537
|
-
},
|
|
538
|
-
{
|
|
539
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
540
|
-
paths: [
|
|
541
|
-
{
|
|
542
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
543
|
-
},
|
|
544
|
-
{
|
|
545
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
546
|
-
},
|
|
547
|
-
{
|
|
548
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
549
|
-
},
|
|
550
|
-
{
|
|
551
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
552
|
-
},
|
|
553
|
-
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
554
|
-
{
|
|
555
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
556
|
-
},
|
|
557
|
-
{
|
|
558
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
559
|
-
},
|
|
560
|
-
{
|
|
561
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
562
|
-
},
|
|
563
|
-
{
|
|
564
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
565
|
-
},
|
|
566
|
-
{
|
|
567
|
-
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
568
|
-
},
|
|
569
|
-
],
|
|
570
|
-
},
|
|
571
|
-
]));
|
|
572
|
-
}
|
|
573
|
-
catch (err) {
|
|
574
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
575
|
-
spreadPathsToArguments: {},
|
|
576
|
-
explicitPathsToArguments: {},
|
|
577
|
-
singleArgumentUnchanged: false,
|
|
578
|
-
}, []);
|
|
579
|
-
sideEffects?.onError?.(err);
|
|
580
|
-
throw transformedError;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
exports.createEmptyDraftOrder = createEmptyDraftOrder;
|
|
584
|
-
/**
|
|
585
|
-
* Adds catalog or custom line items to a draft order.
|
|
586
|
-
* @param draftOrderId - Draft order ID.
|
|
587
|
-
* @public
|
|
588
|
-
* @documentationMaturity preview
|
|
589
|
-
* @requiredField draftOrderId
|
|
590
|
-
* @requiredField options.catalogLineItems.catalogReference
|
|
591
|
-
* @permissionId ECOM.DRAFT_ORDERS_ADD_LINE_ITEMS
|
|
592
|
-
* @permissionScope Manage Stores - all permissions
|
|
593
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
594
|
-
* @permissionScope Manage Stores
|
|
595
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
596
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
597
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
598
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
599
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
600
|
-
* @applicableIdentity APP
|
|
601
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.AddLineItemsToDraftOrder
|
|
602
|
-
*/
|
|
603
|
-
async function addLineItemsToDraftOrder(draftOrderId, options) {
|
|
604
|
-
// @ts-ignore
|
|
605
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
606
|
-
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
607
|
-
draftOrderId: draftOrderId,
|
|
608
|
-
catalogLineItems: options?.catalogLineItems,
|
|
609
|
-
customLineItems: options?.customLineItems,
|
|
610
|
-
}), [
|
|
611
|
-
{
|
|
612
|
-
transformFn: page_url_v2_1.transformSDKPageURLV2ToRESTPageURLV2,
|
|
613
|
-
paths: [{ path: 'customLineItems.url' }],
|
|
614
|
-
},
|
|
615
|
-
{
|
|
616
|
-
transformFn: image_1.transformSDKImageToRESTImage,
|
|
617
|
-
paths: [{ path: 'customLineItems.media' }],
|
|
618
|
-
},
|
|
619
|
-
]);
|
|
620
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.addLineItemsToDraftOrder(payload);
|
|
621
|
-
sideEffects?.onSiteCall?.();
|
|
622
|
-
try {
|
|
623
|
-
const result = await httpClient.request(reqOpts);
|
|
624
|
-
sideEffects?.onSuccess?.(result);
|
|
625
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
626
|
-
{
|
|
627
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
628
|
-
paths: [
|
|
629
|
-
{
|
|
630
|
-
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
631
|
-
},
|
|
632
|
-
],
|
|
633
|
-
},
|
|
634
|
-
{
|
|
635
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
636
|
-
paths: [
|
|
637
|
-
{
|
|
638
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
639
|
-
},
|
|
640
|
-
{
|
|
641
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
642
|
-
},
|
|
643
|
-
{
|
|
644
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
645
|
-
},
|
|
646
|
-
{
|
|
647
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
648
|
-
},
|
|
649
|
-
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
650
|
-
{
|
|
651
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
652
|
-
},
|
|
653
|
-
{
|
|
654
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
655
|
-
},
|
|
656
|
-
{
|
|
657
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
658
|
-
},
|
|
659
|
-
{
|
|
660
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
661
|
-
},
|
|
662
|
-
{
|
|
663
|
-
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
664
|
-
},
|
|
665
|
-
],
|
|
666
|
-
},
|
|
667
|
-
]));
|
|
668
|
-
}
|
|
669
|
-
catch (err) {
|
|
670
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
671
|
-
spreadPathsToArguments: {},
|
|
672
|
-
explicitPathsToArguments: {
|
|
673
|
-
draftOrderId: '$[0]',
|
|
674
|
-
catalogLineItems: '$[1].catalogLineItems',
|
|
675
|
-
customLineItems: '$[1].customLineItems',
|
|
676
|
-
},
|
|
677
|
-
singleArgumentUnchanged: false,
|
|
678
|
-
}, ['draftOrderId', 'options']);
|
|
679
|
-
sideEffects?.onError?.(err);
|
|
680
|
-
throw transformedError;
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
exports.addLineItemsToDraftOrder = addLineItemsToDraftOrder;
|
|
684
|
-
/**
|
|
685
|
-
* Updates a draft order's line items.
|
|
686
|
-
*
|
|
687
|
-
* You can update a line item's quantity, price, and description.
|
|
688
|
-
* > **Notes:**
|
|
689
|
-
* > + Specifying a quantity of `0` will remove the line item.
|
|
690
|
-
* > + Price cannot be updated for line items with `paymentOption: MEMBERSHIP`.
|
|
691
|
-
* > + Quantity cannot be decreased for fulfilled line items. To retrieve fulfillment information, specify the order ID when calling List Fulfillments For Single Order ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/order-fulfillments/list-fulfillments-for-single-order) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/order-fulfillments/list-fulfillments-for-single-order)).
|
|
692
|
-
* @param draftOrderId - Draft order ID.
|
|
693
|
-
* @param lineItemChanges - Details of changes to apply per line item.
|
|
694
|
-
* @public
|
|
695
|
-
* @documentationMaturity preview
|
|
696
|
-
* @requiredField draftOrderId
|
|
697
|
-
* @requiredField lineItemChanges
|
|
698
|
-
* @requiredField lineItemChanges.lineItemId
|
|
699
|
-
* @permissionId ECOM.DRAFT_ORDERS_MODIFY_ITEMS
|
|
700
|
-
* @permissionScope Manage Stores - all permissions
|
|
701
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
702
|
-
* @permissionScope Manage Stores
|
|
703
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
704
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
705
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
706
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
707
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
708
|
-
* @applicableIdentity APP
|
|
709
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.UpdateLineItems
|
|
710
|
-
*/
|
|
711
|
-
async function updateLineItems(draftOrderId, lineItemChanges) {
|
|
712
|
-
// @ts-ignore
|
|
713
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
714
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
715
|
-
draftOrderId: draftOrderId,
|
|
716
|
-
lineItemChanges: lineItemChanges,
|
|
717
|
-
});
|
|
718
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.updateLineItems(payload);
|
|
719
|
-
sideEffects?.onSiteCall?.();
|
|
720
|
-
try {
|
|
721
|
-
const result = await httpClient.request(reqOpts);
|
|
722
|
-
sideEffects?.onSuccess?.(result);
|
|
723
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
724
|
-
{
|
|
725
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
726
|
-
paths: [
|
|
727
|
-
{
|
|
728
|
-
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
729
|
-
},
|
|
730
|
-
],
|
|
731
|
-
},
|
|
732
|
-
{
|
|
733
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
734
|
-
paths: [
|
|
735
|
-
{
|
|
736
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
737
|
-
},
|
|
738
|
-
{
|
|
739
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
740
|
-
},
|
|
741
|
-
{
|
|
742
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
743
|
-
},
|
|
744
|
-
{
|
|
745
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
746
|
-
},
|
|
747
|
-
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
748
|
-
{
|
|
749
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
750
|
-
},
|
|
751
|
-
{
|
|
752
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
753
|
-
},
|
|
754
|
-
{
|
|
755
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
756
|
-
},
|
|
757
|
-
{
|
|
758
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
759
|
-
},
|
|
760
|
-
{
|
|
761
|
-
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
762
|
-
},
|
|
763
|
-
],
|
|
764
|
-
},
|
|
765
|
-
]));
|
|
766
|
-
}
|
|
767
|
-
catch (err) {
|
|
768
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
769
|
-
spreadPathsToArguments: {},
|
|
770
|
-
explicitPathsToArguments: {
|
|
771
|
-
draftOrderId: '$[0]',
|
|
772
|
-
lineItemChanges: '$[1]',
|
|
773
|
-
},
|
|
774
|
-
singleArgumentUnchanged: false,
|
|
775
|
-
}, ['draftOrderId', 'lineItemChanges']);
|
|
776
|
-
sideEffects?.onError?.(err);
|
|
777
|
-
throw transformedError;
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
exports.updateLineItems = updateLineItems;
|
|
781
|
-
/**
|
|
782
|
-
* Applies or unapplies discounts on a draft order.
|
|
783
|
-
*
|
|
784
|
-
* Unapplied discounts are still part of the draft order, but do not affect balance.
|
|
785
|
-
* Existing discounts that are not passed in the request will keep their current state.
|
|
786
|
-
* @param draftOrderId - Draft order ID.
|
|
787
|
-
* @param discounts - Discounts to set on the draft order.
|
|
788
|
-
*
|
|
789
|
-
* Any existing discounts that are not passed will not change.
|
|
790
|
-
* @public
|
|
791
|
-
* @documentationMaturity preview
|
|
792
|
-
* @requiredField discounts
|
|
793
|
-
* @requiredField discounts._id
|
|
794
|
-
* @requiredField discounts.applied
|
|
795
|
-
* @requiredField draftOrderId
|
|
796
|
-
* @permissionId ECOM.DRAFT_ORDERS_SET_DISCOUNTS
|
|
797
|
-
* @permissionScope Manage Stores - all permissions
|
|
798
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
799
|
-
* @permissionScope Manage Stores
|
|
800
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
801
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
802
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
803
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
804
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
805
|
-
* @applicableIdentity APP
|
|
806
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetDiscounts
|
|
807
|
-
*/
|
|
808
|
-
async function setDiscounts(draftOrderId, discounts) {
|
|
809
|
-
// @ts-ignore
|
|
810
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
811
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
812
|
-
draftOrderId: draftOrderId,
|
|
813
|
-
discounts: discounts,
|
|
814
|
-
});
|
|
815
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.setDiscounts(payload);
|
|
816
|
-
sideEffects?.onSiteCall?.();
|
|
817
|
-
try {
|
|
818
|
-
const result = await httpClient.request(reqOpts);
|
|
819
|
-
sideEffects?.onSuccess?.(result);
|
|
820
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
821
|
-
{
|
|
822
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
823
|
-
paths: [
|
|
824
|
-
{
|
|
825
|
-
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
826
|
-
},
|
|
827
|
-
],
|
|
828
|
-
},
|
|
829
|
-
{
|
|
830
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
831
|
-
paths: [
|
|
832
|
-
{
|
|
833
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
834
|
-
},
|
|
835
|
-
{
|
|
836
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
837
|
-
},
|
|
838
|
-
{
|
|
839
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
840
|
-
},
|
|
841
|
-
{
|
|
842
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
843
|
-
},
|
|
844
|
-
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
845
|
-
{
|
|
846
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
847
|
-
},
|
|
848
|
-
{
|
|
849
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
850
|
-
},
|
|
851
|
-
{
|
|
852
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
853
|
-
},
|
|
854
|
-
{
|
|
855
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
856
|
-
},
|
|
857
|
-
{
|
|
858
|
-
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
859
|
-
},
|
|
860
|
-
],
|
|
861
|
-
},
|
|
862
|
-
]));
|
|
863
|
-
}
|
|
864
|
-
catch (err) {
|
|
865
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
866
|
-
spreadPathsToArguments: {},
|
|
867
|
-
explicitPathsToArguments: { draftOrderId: '$[0]', discounts: '$[1]' },
|
|
868
|
-
singleArgumentUnchanged: false,
|
|
869
|
-
}, ['draftOrderId', 'discounts']);
|
|
870
|
-
sideEffects?.onError?.(err);
|
|
871
|
-
throw transformedError;
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
exports.setDiscounts = setDiscounts;
|
|
875
|
-
/**
|
|
876
|
-
* Creates custom discounts.
|
|
877
|
-
*
|
|
878
|
-
* Newly created discounts are unapplied by default.
|
|
879
|
-
* To apply them, use Set Discounts.
|
|
880
|
-
* @param draftOrderId - Draft order ID.
|
|
881
|
-
* @public
|
|
882
|
-
* @documentationMaturity preview
|
|
883
|
-
* @requiredField draftOrderId
|
|
884
|
-
* @requiredField options.discounts.amount.amount
|
|
885
|
-
* @requiredField options.discounts.discountType
|
|
886
|
-
* @requiredField options.discounts.priceAmount.amount
|
|
887
|
-
* @permissionId ECOM.DRAFT_ORDERS_ADD_DISCOUNTS
|
|
888
|
-
* @permissionScope Manage Stores - all permissions
|
|
889
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
890
|
-
* @permissionScope Manage Stores
|
|
891
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
892
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
893
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
894
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
895
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
896
|
-
* @applicableIdentity APP
|
|
897
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateCustomDiscounts
|
|
898
|
-
*/
|
|
899
|
-
async function createCustomDiscounts(draftOrderId, options) {
|
|
900
|
-
// @ts-ignore
|
|
901
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
902
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
903
|
-
draftOrderId: draftOrderId,
|
|
904
|
-
discounts: options?.discounts,
|
|
905
|
-
});
|
|
906
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.createCustomDiscounts(payload);
|
|
907
|
-
sideEffects?.onSiteCall?.();
|
|
908
|
-
try {
|
|
909
|
-
const result = await httpClient.request(reqOpts);
|
|
910
|
-
sideEffects?.onSuccess?.(result);
|
|
911
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
912
|
-
{
|
|
913
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
914
|
-
paths: [
|
|
915
|
-
{
|
|
916
|
-
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
917
|
-
},
|
|
918
|
-
],
|
|
919
|
-
},
|
|
920
|
-
{
|
|
921
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
922
|
-
paths: [
|
|
923
|
-
{
|
|
924
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
925
|
-
},
|
|
926
|
-
{
|
|
927
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
928
|
-
},
|
|
929
|
-
{
|
|
930
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
931
|
-
},
|
|
932
|
-
{
|
|
933
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
934
|
-
},
|
|
935
|
-
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
936
|
-
{
|
|
937
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
938
|
-
},
|
|
939
|
-
{
|
|
940
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
941
|
-
},
|
|
942
|
-
{
|
|
943
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
944
|
-
},
|
|
945
|
-
{
|
|
946
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
947
|
-
},
|
|
948
|
-
{
|
|
949
|
-
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
950
|
-
},
|
|
951
|
-
],
|
|
952
|
-
},
|
|
953
|
-
]));
|
|
954
|
-
}
|
|
955
|
-
catch (err) {
|
|
956
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
957
|
-
spreadPathsToArguments: {},
|
|
958
|
-
explicitPathsToArguments: {
|
|
959
|
-
draftOrderId: '$[0]',
|
|
960
|
-
discounts: '$[1].discounts',
|
|
961
|
-
},
|
|
962
|
-
singleArgumentUnchanged: false,
|
|
963
|
-
}, ['draftOrderId', 'options']);
|
|
964
|
-
sideEffects?.onError?.(err);
|
|
965
|
-
throw transformedError;
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
exports.createCustomDiscounts = createCustomDiscounts;
|
|
969
|
-
/**
|
|
970
|
-
* Removes custom discounts from a draft order.
|
|
971
|
-
* @param draftOrderId - Draft order ID.
|
|
972
|
-
* @param discountIds - IDs of the discounts to remove from the draft order.
|
|
973
|
-
* @public
|
|
974
|
-
* @documentationMaturity preview
|
|
975
|
-
* @requiredField discountIds
|
|
976
|
-
* @requiredField draftOrderId
|
|
977
|
-
* @permissionId ECOM.DRAFT_ORDERS_DELETE_DISCOUNTS
|
|
978
|
-
* @permissionScope Manage Stores - all permissions
|
|
979
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
980
|
-
* @permissionScope Manage Stores
|
|
981
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
982
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
983
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
984
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
985
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
986
|
-
* @applicableIdentity APP
|
|
987
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.DeleteCustomDiscounts
|
|
988
|
-
*/
|
|
989
|
-
async function deleteCustomDiscounts(draftOrderId, discountIds) {
|
|
990
|
-
// @ts-ignore
|
|
991
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
992
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
993
|
-
draftOrderId: draftOrderId,
|
|
994
|
-
discountIds: discountIds,
|
|
995
|
-
});
|
|
996
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.deleteCustomDiscounts(payload);
|
|
997
|
-
sideEffects?.onSiteCall?.();
|
|
998
|
-
try {
|
|
999
|
-
const result = await httpClient.request(reqOpts);
|
|
1000
|
-
sideEffects?.onSuccess?.(result);
|
|
1001
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1002
|
-
{
|
|
1003
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1004
|
-
paths: [
|
|
1005
|
-
{
|
|
1006
|
-
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1007
|
-
},
|
|
1008
|
-
],
|
|
1009
|
-
},
|
|
1010
|
-
{
|
|
1011
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1012
|
-
paths: [
|
|
1013
|
-
{
|
|
1014
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1015
|
-
},
|
|
1016
|
-
{
|
|
1017
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1018
|
-
},
|
|
1019
|
-
{
|
|
1020
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1021
|
-
},
|
|
1022
|
-
{
|
|
1023
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1024
|
-
},
|
|
1025
|
-
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1026
|
-
{
|
|
1027
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1028
|
-
},
|
|
1029
|
-
{
|
|
1030
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1031
|
-
},
|
|
1032
|
-
{
|
|
1033
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1034
|
-
},
|
|
1035
|
-
{
|
|
1036
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1037
|
-
},
|
|
1038
|
-
{
|
|
1039
|
-
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1040
|
-
},
|
|
1041
|
-
],
|
|
1042
|
-
},
|
|
1043
|
-
]));
|
|
1044
|
-
}
|
|
1045
|
-
catch (err) {
|
|
1046
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1047
|
-
spreadPathsToArguments: {},
|
|
1048
|
-
explicitPathsToArguments: { draftOrderId: '$[0]', discountIds: '$[1]' },
|
|
1049
|
-
singleArgumentUnchanged: false,
|
|
1050
|
-
}, ['draftOrderId', 'discountIds']);
|
|
1051
|
-
sideEffects?.onError?.(err);
|
|
1052
|
-
throw transformedError;
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
exports.deleteCustomDiscounts = deleteCustomDiscounts;
|
|
1056
|
-
/**
|
|
1057
|
-
* Applies or unapplies additional fees on a draft order.
|
|
1058
|
-
*
|
|
1059
|
-
* Additional fees that are not applied are still part of the draft order, but do not affect balance.
|
|
1060
|
-
* Existing additional fees that are not passed in the request will keep their current state.
|
|
1061
|
-
* @param draftOrderId - Draft order ID.
|
|
1062
|
-
* @param additionalFees - Additional fees to set on the draft order.
|
|
1063
|
-
*
|
|
1064
|
-
* Any existing additional fees that are not passed will not change.
|
|
1065
|
-
* @public
|
|
1066
|
-
* @documentationMaturity preview
|
|
1067
|
-
* @requiredField additionalFees
|
|
1068
|
-
* @requiredField additionalFees._id
|
|
1069
|
-
* @requiredField additionalFees.applied
|
|
1070
|
-
* @requiredField draftOrderId
|
|
1071
|
-
* @permissionId ECOM.DRAFT_ORDERS_SET_ADDITIONAL_FEES
|
|
1072
|
-
* @permissionScope Manage Stores - all permissions
|
|
1073
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1074
|
-
* @permissionScope Manage Stores
|
|
1075
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1076
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1077
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1078
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1079
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1080
|
-
* @applicableIdentity APP
|
|
1081
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetAdditionalFees
|
|
1082
|
-
*/
|
|
1083
|
-
async function setAdditionalFees(draftOrderId, additionalFees) {
|
|
1084
|
-
// @ts-ignore
|
|
1085
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1086
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1087
|
-
draftOrderId: draftOrderId,
|
|
1088
|
-
additionalFees: additionalFees,
|
|
1089
|
-
});
|
|
1090
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.setAdditionalFees(payload);
|
|
1091
|
-
sideEffects?.onSiteCall?.();
|
|
1092
|
-
try {
|
|
1093
|
-
const result = await httpClient.request(reqOpts);
|
|
1094
|
-
sideEffects?.onSuccess?.(result);
|
|
1095
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1096
|
-
{
|
|
1097
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1098
|
-
paths: [
|
|
1099
|
-
{
|
|
1100
|
-
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1101
|
-
},
|
|
1102
|
-
],
|
|
1103
|
-
},
|
|
1104
|
-
{
|
|
1105
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1106
|
-
paths: [
|
|
1107
|
-
{
|
|
1108
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1109
|
-
},
|
|
1110
|
-
{
|
|
1111
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1112
|
-
},
|
|
1113
|
-
{
|
|
1114
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1115
|
-
},
|
|
1116
|
-
{
|
|
1117
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1118
|
-
},
|
|
1119
|
-
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1120
|
-
{
|
|
1121
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1122
|
-
},
|
|
1123
|
-
{
|
|
1124
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1125
|
-
},
|
|
1126
|
-
{
|
|
1127
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1128
|
-
},
|
|
1129
|
-
{
|
|
1130
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1131
|
-
},
|
|
1132
|
-
{
|
|
1133
|
-
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1134
|
-
},
|
|
1135
|
-
],
|
|
1136
|
-
},
|
|
1137
|
-
]));
|
|
1138
|
-
}
|
|
1139
|
-
catch (err) {
|
|
1140
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1141
|
-
spreadPathsToArguments: {},
|
|
1142
|
-
explicitPathsToArguments: {
|
|
1143
|
-
draftOrderId: '$[0]',
|
|
1144
|
-
additionalFees: '$[1]',
|
|
1145
|
-
},
|
|
1146
|
-
singleArgumentUnchanged: false,
|
|
1147
|
-
}, ['draftOrderId', 'additionalFees']);
|
|
1148
|
-
sideEffects?.onError?.(err);
|
|
1149
|
-
throw transformedError;
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
exports.setAdditionalFees = setAdditionalFees;
|
|
1153
|
-
/**
|
|
1154
|
-
* Creates custom additional fees on a draft order.
|
|
1155
|
-
*
|
|
1156
|
-
* Newly created additional fees are not applied by default.
|
|
1157
|
-
* To apply them, use Set Additional Fees.
|
|
1158
|
-
* @param draftOrderId - Draft order ID.
|
|
1159
|
-
* @public
|
|
1160
|
-
* @documentationMaturity preview
|
|
1161
|
-
* @requiredField draftOrderId
|
|
1162
|
-
* @requiredField options.customAdditionalFees.name
|
|
1163
|
-
* @requiredField options.customAdditionalFees.price
|
|
1164
|
-
* @requiredField options.customAdditionalFees.price.amount
|
|
1165
|
-
* @permissionId ECOM.DRAFT_ORDERS_CREATE_ADDITIONAL_FEES
|
|
1166
|
-
* @permissionScope Manage Stores - all permissions
|
|
1167
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1168
|
-
* @permissionScope Manage Stores
|
|
1169
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1170
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1171
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1172
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1173
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1174
|
-
* @applicableIdentity APP
|
|
1175
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateCustomAdditionalFees
|
|
1176
|
-
*/
|
|
1177
|
-
async function createCustomAdditionalFees(draftOrderId, options) {
|
|
1178
|
-
// @ts-ignore
|
|
1179
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1180
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1181
|
-
draftOrderId: draftOrderId,
|
|
1182
|
-
customAdditionalFees: options?.customAdditionalFees,
|
|
1183
|
-
});
|
|
1184
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.createCustomAdditionalFees(payload);
|
|
1185
|
-
sideEffects?.onSiteCall?.();
|
|
1186
|
-
try {
|
|
1187
|
-
const result = await httpClient.request(reqOpts);
|
|
1188
|
-
sideEffects?.onSuccess?.(result);
|
|
1189
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1190
|
-
{
|
|
1191
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1192
|
-
paths: [
|
|
1193
|
-
{
|
|
1194
|
-
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1195
|
-
},
|
|
1196
|
-
],
|
|
1197
|
-
},
|
|
1198
|
-
{
|
|
1199
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1200
|
-
paths: [
|
|
1201
|
-
{
|
|
1202
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1203
|
-
},
|
|
1204
|
-
{
|
|
1205
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1206
|
-
},
|
|
1207
|
-
{
|
|
1208
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1209
|
-
},
|
|
1210
|
-
{
|
|
1211
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1212
|
-
},
|
|
1213
|
-
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1214
|
-
{
|
|
1215
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1216
|
-
},
|
|
1217
|
-
{
|
|
1218
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1219
|
-
},
|
|
1220
|
-
{
|
|
1221
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1222
|
-
},
|
|
1223
|
-
{
|
|
1224
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1225
|
-
},
|
|
1226
|
-
{
|
|
1227
|
-
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1228
|
-
},
|
|
1229
|
-
],
|
|
1230
|
-
},
|
|
1231
|
-
]));
|
|
1232
|
-
}
|
|
1233
|
-
catch (err) {
|
|
1234
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1235
|
-
spreadPathsToArguments: {},
|
|
1236
|
-
explicitPathsToArguments: {
|
|
1237
|
-
draftOrderId: '$[0]',
|
|
1238
|
-
customAdditionalFees: '$[1].customAdditionalFees',
|
|
1239
|
-
},
|
|
1240
|
-
singleArgumentUnchanged: false,
|
|
1241
|
-
}, ['draftOrderId', 'options']);
|
|
1242
|
-
sideEffects?.onError?.(err);
|
|
1243
|
-
throw transformedError;
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
exports.createCustomAdditionalFees = createCustomAdditionalFees;
|
|
1247
|
-
/**
|
|
1248
|
-
* Removes custom additional fees from a draft order.
|
|
1249
|
-
* @param draftOrderId - Draft order ID.
|
|
1250
|
-
* @param customAdditionalFees - IDs of the additional fees to remove from the draft order.
|
|
1251
|
-
* @public
|
|
1252
|
-
* @documentationMaturity preview
|
|
1253
|
-
* @requiredField customAdditionalFees
|
|
1254
|
-
* @requiredField draftOrderId
|
|
1255
|
-
* @permissionId ECOM.DRAFT_ORDERS_DELETE_ADDITIONAL_FEES
|
|
1256
|
-
* @permissionScope Manage Stores - all permissions
|
|
1257
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1258
|
-
* @permissionScope Manage Stores
|
|
1259
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1260
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1261
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1262
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1263
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1264
|
-
* @applicableIdentity APP
|
|
1265
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.DeleteCustomAdditionalFees
|
|
1266
|
-
*/
|
|
1267
|
-
async function deleteCustomAdditionalFees(draftOrderId, customAdditionalFees) {
|
|
1268
|
-
// @ts-ignore
|
|
1269
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1270
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1271
|
-
draftOrderId: draftOrderId,
|
|
1272
|
-
customAdditionalFees: customAdditionalFees,
|
|
1273
|
-
});
|
|
1274
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.deleteCustomAdditionalFees(payload);
|
|
1275
|
-
sideEffects?.onSiteCall?.();
|
|
1276
|
-
try {
|
|
1277
|
-
const result = await httpClient.request(reqOpts);
|
|
1278
|
-
sideEffects?.onSuccess?.(result);
|
|
1279
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1280
|
-
{
|
|
1281
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1282
|
-
paths: [
|
|
1283
|
-
{
|
|
1284
|
-
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1285
|
-
},
|
|
1286
|
-
],
|
|
1287
|
-
},
|
|
1288
|
-
{
|
|
1289
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1290
|
-
paths: [
|
|
1291
|
-
{
|
|
1292
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1293
|
-
},
|
|
1294
|
-
{
|
|
1295
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1296
|
-
},
|
|
1297
|
-
{
|
|
1298
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1299
|
-
},
|
|
1300
|
-
{
|
|
1301
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1302
|
-
},
|
|
1303
|
-
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1304
|
-
{
|
|
1305
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1306
|
-
},
|
|
1307
|
-
{
|
|
1308
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1309
|
-
},
|
|
1310
|
-
{
|
|
1311
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1312
|
-
},
|
|
1313
|
-
{
|
|
1314
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1315
|
-
},
|
|
1316
|
-
{
|
|
1317
|
-
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1318
|
-
},
|
|
1319
|
-
],
|
|
1320
|
-
},
|
|
1321
|
-
]));
|
|
1322
|
-
}
|
|
1323
|
-
catch (err) {
|
|
1324
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1325
|
-
spreadPathsToArguments: {},
|
|
1326
|
-
explicitPathsToArguments: {
|
|
1327
|
-
draftOrderId: '$[0]',
|
|
1328
|
-
customAdditionalFees: '$[1]',
|
|
1329
|
-
},
|
|
1330
|
-
singleArgumentUnchanged: false,
|
|
1331
|
-
}, ['draftOrderId', 'customAdditionalFees']);
|
|
1332
|
-
sideEffects?.onError?.(err);
|
|
1333
|
-
throw transformedError;
|
|
1334
|
-
}
|
|
1335
|
-
}
|
|
1336
|
-
exports.deleteCustomAdditionalFees = deleteCustomAdditionalFees;
|
|
1337
|
-
/**
|
|
1338
|
-
* Sets shipping information on a draft order.
|
|
1339
|
-
* @param draftOrderId - Draft order ID.
|
|
1340
|
-
* @public
|
|
1341
|
-
* @documentationMaturity preview
|
|
1342
|
-
* @requiredField draftOrderId
|
|
1343
|
-
* @permissionId ECOM.DRAFT_ORDERS_SET_SHIPPING_INFO
|
|
1344
|
-
* @permissionScope Manage Stores - all permissions
|
|
1345
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1346
|
-
* @permissionScope Manage Stores
|
|
1347
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1348
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1349
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1350
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1351
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1352
|
-
* @applicableIdentity APP
|
|
1353
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetShippingInfo
|
|
1354
|
-
*/
|
|
1355
|
-
async function setShippingInfo(draftOrderId, options) {
|
|
1356
|
-
// @ts-ignore
|
|
1357
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1358
|
-
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1359
|
-
draftOrderId: draftOrderId,
|
|
1360
|
-
shippingInfo: options?.shippingInfo,
|
|
1361
|
-
}), [
|
|
1362
|
-
{
|
|
1363
|
-
transformFn: address_1.transformSDKAddressToRESTAddress,
|
|
1364
|
-
paths: [
|
|
1365
|
-
{ path: 'shippingInfo.logistics.shippingDestination.address' },
|
|
1366
|
-
{ path: 'shippingInfo.logistics.pickupDetails.address' },
|
|
1367
|
-
],
|
|
1368
|
-
},
|
|
1369
|
-
]);
|
|
1370
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.setShippingInfo(payload);
|
|
1371
|
-
sideEffects?.onSiteCall?.();
|
|
1372
|
-
try {
|
|
1373
|
-
const result = await httpClient.request(reqOpts);
|
|
1374
|
-
sideEffects?.onSuccess?.(result);
|
|
1375
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1376
|
-
{
|
|
1377
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1378
|
-
paths: [
|
|
1379
|
-
{
|
|
1380
|
-
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1381
|
-
},
|
|
1382
|
-
],
|
|
1383
|
-
},
|
|
1384
|
-
{
|
|
1385
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1386
|
-
paths: [
|
|
1387
|
-
{
|
|
1388
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1389
|
-
},
|
|
1390
|
-
{
|
|
1391
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1392
|
-
},
|
|
1393
|
-
{
|
|
1394
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1395
|
-
},
|
|
1396
|
-
{
|
|
1397
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1398
|
-
},
|
|
1399
|
-
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1400
|
-
{
|
|
1401
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1402
|
-
},
|
|
1403
|
-
{
|
|
1404
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1405
|
-
},
|
|
1406
|
-
{
|
|
1407
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1408
|
-
},
|
|
1409
|
-
{
|
|
1410
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1411
|
-
},
|
|
1412
|
-
{
|
|
1413
|
-
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1414
|
-
},
|
|
1415
|
-
],
|
|
1416
|
-
},
|
|
1417
|
-
]));
|
|
1418
|
-
}
|
|
1419
|
-
catch (err) {
|
|
1420
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1421
|
-
spreadPathsToArguments: {},
|
|
1422
|
-
explicitPathsToArguments: {
|
|
1423
|
-
draftOrderId: '$[0]',
|
|
1424
|
-
shippingInfo: '$[1].shippingInfo',
|
|
1425
|
-
},
|
|
1426
|
-
singleArgumentUnchanged: false,
|
|
1427
|
-
}, ['draftOrderId', 'options']);
|
|
1428
|
-
sideEffects?.onError?.(err);
|
|
1429
|
-
throw transformedError;
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
exports.setShippingInfo = setShippingInfo;
|
|
1433
|
-
/**
|
|
1434
|
-
* Sets buyer info on a draft order.
|
|
1435
|
-
* @param draftOrderId - Draft order ID.
|
|
1436
|
-
* @public
|
|
1437
|
-
* @documentationMaturity preview
|
|
1438
|
-
* @requiredField draftOrderId
|
|
1439
|
-
* @permissionId ECOM.DRAFT_ORDER_SET_BUYER_INFO
|
|
1440
|
-
* @permissionScope Manage Stores - all permissions
|
|
1441
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1442
|
-
* @permissionScope Manage Stores
|
|
1443
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1444
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1445
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1446
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1447
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1448
|
-
* @applicableIdentity APP
|
|
1449
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetBuyerInfo
|
|
1450
|
-
*/
|
|
1451
|
-
async function setBuyerInfo(draftOrderId, options) {
|
|
1452
|
-
// @ts-ignore
|
|
1453
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1454
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1455
|
-
draftOrderId: draftOrderId,
|
|
1456
|
-
buyerInfo: options?.buyerInfo,
|
|
1457
|
-
});
|
|
1458
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.setBuyerInfo(payload);
|
|
1459
|
-
sideEffects?.onSiteCall?.();
|
|
1460
|
-
try {
|
|
1461
|
-
const result = await httpClient.request(reqOpts);
|
|
1462
|
-
sideEffects?.onSuccess?.(result);
|
|
1463
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1464
|
-
{
|
|
1465
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1466
|
-
paths: [
|
|
1467
|
-
{
|
|
1468
|
-
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1469
|
-
},
|
|
1470
|
-
],
|
|
1471
|
-
},
|
|
1472
|
-
{
|
|
1473
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1474
|
-
paths: [
|
|
1475
|
-
{
|
|
1476
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1477
|
-
},
|
|
1478
|
-
{
|
|
1479
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1480
|
-
},
|
|
1481
|
-
{
|
|
1482
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1483
|
-
},
|
|
1484
|
-
{
|
|
1485
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1486
|
-
},
|
|
1487
|
-
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1488
|
-
{
|
|
1489
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1490
|
-
},
|
|
1491
|
-
{
|
|
1492
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1493
|
-
},
|
|
1494
|
-
{
|
|
1495
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1496
|
-
},
|
|
1497
|
-
{
|
|
1498
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1499
|
-
},
|
|
1500
|
-
{
|
|
1501
|
-
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1502
|
-
},
|
|
1503
|
-
],
|
|
1504
|
-
},
|
|
1505
|
-
]));
|
|
1506
|
-
}
|
|
1507
|
-
catch (err) {
|
|
1508
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1509
|
-
spreadPathsToArguments: {},
|
|
1510
|
-
explicitPathsToArguments: {
|
|
1511
|
-
draftOrderId: '$[0]',
|
|
1512
|
-
buyerInfo: '$[1].buyerInfo',
|
|
1513
|
-
},
|
|
1514
|
-
singleArgumentUnchanged: false,
|
|
1515
|
-
}, ['draftOrderId', 'options']);
|
|
1516
|
-
sideEffects?.onError?.(err);
|
|
1517
|
-
throw transformedError;
|
|
1518
|
-
}
|
|
1519
|
-
}
|
|
1520
|
-
exports.setBuyerInfo = setBuyerInfo;
|
|
1521
|
-
/**
|
|
1522
|
-
* Sets recipient info on a draft order.
|
|
1523
|
-
* @param draftOrderId - Draft order ID.
|
|
1524
|
-
* @public
|
|
1525
|
-
* @documentationMaturity preview
|
|
1526
|
-
* @requiredField draftOrderId
|
|
1527
|
-
* @permissionId ECOM.DRAFT_ORDER_SET_RECIPIENT_INFO
|
|
1528
|
-
* @permissionScope Manage Stores - all permissions
|
|
1529
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1530
|
-
* @permissionScope Manage Stores
|
|
1531
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1532
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1533
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1534
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1535
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1536
|
-
* @applicableIdentity APP
|
|
1537
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetRecipientInfo
|
|
1538
|
-
*/
|
|
1539
|
-
async function setRecipientInfo(draftOrderId, options) {
|
|
1540
|
-
// @ts-ignore
|
|
1541
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1542
|
-
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1543
|
-
draftOrderId: draftOrderId,
|
|
1544
|
-
recipientInfo: options?.recipientInfo,
|
|
1545
|
-
}), [
|
|
1546
|
-
{
|
|
1547
|
-
transformFn: address_1.transformSDKAddressToRESTAddress,
|
|
1548
|
-
paths: [{ path: 'recipientInfo.address' }],
|
|
1549
|
-
},
|
|
1550
|
-
]);
|
|
1551
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.setRecipientInfo(payload);
|
|
1552
|
-
sideEffects?.onSiteCall?.();
|
|
1553
|
-
try {
|
|
1554
|
-
const result = await httpClient.request(reqOpts);
|
|
1555
|
-
sideEffects?.onSuccess?.(result);
|
|
1556
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1557
|
-
{
|
|
1558
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1559
|
-
paths: [
|
|
1560
|
-
{
|
|
1561
|
-
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1562
|
-
},
|
|
1563
|
-
],
|
|
1564
|
-
},
|
|
1565
|
-
{
|
|
1566
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1567
|
-
paths: [
|
|
1568
|
-
{
|
|
1569
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1570
|
-
},
|
|
1571
|
-
{
|
|
1572
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1573
|
-
},
|
|
1574
|
-
{
|
|
1575
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1576
|
-
},
|
|
1577
|
-
{
|
|
1578
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1579
|
-
},
|
|
1580
|
-
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1581
|
-
{
|
|
1582
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1583
|
-
},
|
|
1584
|
-
{
|
|
1585
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1586
|
-
},
|
|
1587
|
-
{
|
|
1588
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1589
|
-
},
|
|
1590
|
-
{
|
|
1591
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1592
|
-
},
|
|
1593
|
-
{
|
|
1594
|
-
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1595
|
-
},
|
|
1596
|
-
],
|
|
1597
|
-
},
|
|
1598
|
-
]));
|
|
1599
|
-
}
|
|
1600
|
-
catch (err) {
|
|
1601
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1602
|
-
spreadPathsToArguments: {},
|
|
1603
|
-
explicitPathsToArguments: {
|
|
1604
|
-
draftOrderId: '$[0]',
|
|
1605
|
-
recipientInfo: '$[1].recipientInfo',
|
|
1606
|
-
},
|
|
1607
|
-
singleArgumentUnchanged: false,
|
|
1608
|
-
}, ['draftOrderId', 'options']);
|
|
1609
|
-
sideEffects?.onError?.(err);
|
|
1610
|
-
throw transformedError;
|
|
1611
|
-
}
|
|
1612
|
-
}
|
|
1613
|
-
exports.setRecipientInfo = setRecipientInfo;
|
|
1614
|
-
/**
|
|
1615
|
-
* Sets billing info on a draft order.
|
|
1616
|
-
* @param draftOrderId - Draft order ID.
|
|
1617
|
-
* @public
|
|
1618
|
-
* @documentationMaturity preview
|
|
1619
|
-
* @requiredField draftOrderId
|
|
1620
|
-
* @permissionId ECOM.DRAFT_ORDER_SET_BILLING_INFO
|
|
1621
|
-
* @permissionScope Manage Stores - all permissions
|
|
1622
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1623
|
-
* @permissionScope Manage Stores
|
|
1624
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1625
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1626
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1627
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1628
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1629
|
-
* @applicableIdentity APP
|
|
1630
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetBillingInfo
|
|
1631
|
-
*/
|
|
1632
|
-
async function setBillingInfo(draftOrderId, options) {
|
|
1633
|
-
// @ts-ignore
|
|
1634
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1635
|
-
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1636
|
-
draftOrderId: draftOrderId,
|
|
1637
|
-
billingInfo: options?.billingInfo,
|
|
1638
|
-
}), [
|
|
1639
|
-
{
|
|
1640
|
-
transformFn: address_1.transformSDKAddressToRESTAddress,
|
|
1641
|
-
paths: [{ path: 'billingInfo.address' }],
|
|
1642
|
-
},
|
|
1643
|
-
]);
|
|
1644
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.setBillingInfo(payload);
|
|
1645
|
-
sideEffects?.onSiteCall?.();
|
|
1646
|
-
try {
|
|
1647
|
-
const result = await httpClient.request(reqOpts);
|
|
1648
|
-
sideEffects?.onSuccess?.(result);
|
|
1649
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1650
|
-
{
|
|
1651
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1652
|
-
paths: [
|
|
1653
|
-
{
|
|
1654
|
-
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1655
|
-
},
|
|
1656
|
-
],
|
|
1657
|
-
},
|
|
1658
|
-
{
|
|
1659
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1660
|
-
paths: [
|
|
1661
|
-
{
|
|
1662
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1663
|
-
},
|
|
1664
|
-
{
|
|
1665
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1666
|
-
},
|
|
1667
|
-
{
|
|
1668
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1669
|
-
},
|
|
1670
|
-
{
|
|
1671
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1672
|
-
},
|
|
1673
|
-
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1674
|
-
{
|
|
1675
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1676
|
-
},
|
|
1677
|
-
{
|
|
1678
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1679
|
-
},
|
|
1680
|
-
{
|
|
1681
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1682
|
-
},
|
|
1683
|
-
{
|
|
1684
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1685
|
-
},
|
|
1686
|
-
{
|
|
1687
|
-
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1688
|
-
},
|
|
1689
|
-
],
|
|
1690
|
-
},
|
|
1691
|
-
]));
|
|
1692
|
-
}
|
|
1693
|
-
catch (err) {
|
|
1694
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1695
|
-
spreadPathsToArguments: {},
|
|
1696
|
-
explicitPathsToArguments: {
|
|
1697
|
-
draftOrderId: '$[0]',
|
|
1698
|
-
billingInfo: '$[1].billingInfo',
|
|
1699
|
-
},
|
|
1700
|
-
singleArgumentUnchanged: false,
|
|
1701
|
-
}, ['draftOrderId', 'options']);
|
|
1702
|
-
sideEffects?.onError?.(err);
|
|
1703
|
-
throw transformedError;
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
exports.setBillingInfo = setBillingInfo;
|
|
1707
|
-
/**
|
|
1708
|
-
* Retrieves a draft order.
|
|
1709
|
-
*
|
|
1710
|
-
* The retrieved draft order contains the latest calculations:
|
|
1711
|
-
* + Line items, shipping details, and buyer information.
|
|
1712
|
-
* + Tax details and price totals.
|
|
1713
|
-
* + Automatic discounts and automatic additional fees, along with updated eligibility.
|
|
1714
|
-
*
|
|
1715
|
-
* > **Note:** When retrieving a committed draft order, it **is not recalculated**.
|
|
1716
|
-
* @param draftOrderId - Draft order ID.
|
|
1717
|
-
* @public
|
|
1718
|
-
* @documentationMaturity preview
|
|
1719
|
-
* @requiredField draftOrderId
|
|
1720
|
-
* @permissionId ECOM.DRAFT_ORDERS_READ
|
|
1721
|
-
* @permissionId ECOM.DRAFT_ORDER_READ_ALL_EXTENDED_FIELDS
|
|
1722
|
-
* @permissionScope Manage Stores - all permissions
|
|
1723
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1724
|
-
* @permissionScope Manage Stores
|
|
1725
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1726
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1727
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1728
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1729
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1730
|
-
* @applicableIdentity APP
|
|
1731
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.GetDraftOrder
|
|
1732
|
-
*/
|
|
1733
|
-
async function getDraftOrder(draftOrderId) {
|
|
1734
|
-
// @ts-ignore
|
|
1735
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1736
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1737
|
-
draftOrderId: draftOrderId,
|
|
1738
|
-
});
|
|
1739
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.getDraftOrder(payload);
|
|
1740
|
-
sideEffects?.onSiteCall?.();
|
|
1741
|
-
try {
|
|
1742
|
-
const result = await httpClient.request(reqOpts);
|
|
1743
|
-
sideEffects?.onSuccess?.(result);
|
|
1744
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1745
|
-
{
|
|
1746
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1747
|
-
paths: [
|
|
1748
|
-
{
|
|
1749
|
-
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1750
|
-
},
|
|
1751
|
-
],
|
|
1752
|
-
},
|
|
1753
|
-
{
|
|
1754
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1755
|
-
paths: [
|
|
1756
|
-
{
|
|
1757
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1758
|
-
},
|
|
1759
|
-
{
|
|
1760
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1761
|
-
},
|
|
1762
|
-
{
|
|
1763
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1764
|
-
},
|
|
1765
|
-
{
|
|
1766
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1767
|
-
},
|
|
1768
|
-
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1769
|
-
{
|
|
1770
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1771
|
-
},
|
|
1772
|
-
{
|
|
1773
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1774
|
-
},
|
|
1775
|
-
{
|
|
1776
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1777
|
-
},
|
|
1778
|
-
{
|
|
1779
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1780
|
-
},
|
|
1781
|
-
{
|
|
1782
|
-
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1783
|
-
},
|
|
1784
|
-
],
|
|
1785
|
-
},
|
|
1786
|
-
]));
|
|
1787
|
-
}
|
|
1788
|
-
catch (err) {
|
|
1789
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1790
|
-
spreadPathsToArguments: {},
|
|
1791
|
-
explicitPathsToArguments: { draftOrderId: '$[0]' },
|
|
1792
|
-
singleArgumentUnchanged: false,
|
|
1793
|
-
}, ['draftOrderId']);
|
|
1794
|
-
sideEffects?.onError?.(err);
|
|
1795
|
-
throw transformedError;
|
|
1796
|
-
}
|
|
1797
|
-
}
|
|
1798
|
-
exports.getDraftOrder = getDraftOrder;
|
|
1799
|
-
/**
|
|
1800
|
-
* Checks whether a draft can be created for an order.
|
|
1801
|
-
*
|
|
1802
|
-
* If `orderDraftable` returns as `true`, the order can be used to create a draft order.
|
|
1803
|
-
*
|
|
1804
|
-
* If `orderDraftable` returns as `false`, refer to the `nonDraftableReasons` array in the response to understand why the order is not draftable.
|
|
1805
|
-
* @param orderId - Order ID.
|
|
1806
|
-
* @public
|
|
1807
|
-
* @documentationMaturity preview
|
|
1808
|
-
* @requiredField orderId
|
|
1809
|
-
* @permissionId ECOM.DRAFT_ORDERS_READ
|
|
1810
|
-
* @permissionScope Manage Stores - all permissions
|
|
1811
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1812
|
-
* @permissionScope Manage Stores
|
|
1813
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1814
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1815
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1816
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1817
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1818
|
-
* @applicableIdentity APP
|
|
1819
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.GetOrderDraftabilityStatus
|
|
1820
|
-
*/
|
|
1821
|
-
async function getOrderDraftabilityStatus(orderId) {
|
|
1822
|
-
// @ts-ignore
|
|
1823
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1824
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({ orderId: orderId });
|
|
1825
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.getOrderDraftabilityStatus(payload);
|
|
1826
|
-
sideEffects?.onSiteCall?.();
|
|
1827
|
-
try {
|
|
1828
|
-
const result = await httpClient.request(reqOpts);
|
|
1829
|
-
sideEffects?.onSuccess?.(result);
|
|
1830
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
1831
|
-
}
|
|
1832
|
-
catch (err) {
|
|
1833
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1834
|
-
spreadPathsToArguments: {},
|
|
1835
|
-
explicitPathsToArguments: { orderId: '$[0]' },
|
|
1836
|
-
singleArgumentUnchanged: false,
|
|
1837
|
-
}, ['orderId']);
|
|
1838
|
-
sideEffects?.onError?.(err);
|
|
1839
|
-
throw transformedError;
|
|
1840
|
-
}
|
|
1841
|
-
}
|
|
1842
|
-
exports.getOrderDraftabilityStatus = getOrderDraftabilityStatus;
|
|
1843
|
-
/**
|
|
1844
|
-
* Finalizes a draft order and applies its modifications to the associated order.
|
|
1845
|
-
* You can also control which side-effects are executed on commit.
|
|
1846
|
-
*
|
|
1847
|
-
* > **Notes:**
|
|
1848
|
-
* > + The draft order's status is set to `COMMITTED`.
|
|
1849
|
-
* > + Commiting a draft order cannot be undone or reverted.
|
|
1850
|
-
* > + A committed draft order does not allow for further modifications. However, it is kept for reference and can be retrieved.
|
|
1851
|
-
* @param draftOrderId - Draft order ID.
|
|
1852
|
-
* @public
|
|
1853
|
-
* @documentationMaturity preview
|
|
1854
|
-
* @requiredField draftOrderId
|
|
1855
|
-
* @permissionId ECOM.DRAFT_ORDERS_COMMIT
|
|
1856
|
-
* @permissionId ECOM.DRAFT_ORDER_READ_ALL_EXTENDED_FIELDS
|
|
1857
|
-
* @permissionScope Manage Stores - all permissions
|
|
1858
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1859
|
-
* @permissionScope Manage Stores
|
|
1860
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1861
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1862
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1863
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1864
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1865
|
-
* @applicableIdentity APP
|
|
1866
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CommitDraftOrder
|
|
1867
|
-
*/
|
|
1868
|
-
async function commitDraftOrder(draftOrderId, options) {
|
|
1869
|
-
// @ts-ignore
|
|
1870
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1871
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1872
|
-
draftOrderId: draftOrderId,
|
|
1873
|
-
commitSettings: options?.commitSettings,
|
|
1874
|
-
reason: options?.reason,
|
|
1875
|
-
});
|
|
1876
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.commitDraftOrder(payload);
|
|
1877
|
-
sideEffects?.onSiteCall?.();
|
|
1878
|
-
try {
|
|
1879
|
-
const result = await httpClient.request(reqOpts);
|
|
1880
|
-
sideEffects?.onSuccess?.(result);
|
|
1881
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1882
|
-
{
|
|
1883
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1884
|
-
paths: [
|
|
1885
|
-
{ path: 'committedDraftOrder.lineItems.lineItem.image' },
|
|
1886
|
-
{ path: 'orderAfterCommit.lineItems.image' },
|
|
1887
|
-
],
|
|
1888
|
-
},
|
|
1889
|
-
{
|
|
1890
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1891
|
-
paths: [
|
|
1892
|
-
{
|
|
1893
|
-
path: 'committedDraftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1894
|
-
},
|
|
1895
|
-
{
|
|
1896
|
-
path: 'committedDraftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1897
|
-
},
|
|
1898
|
-
{
|
|
1899
|
-
path: 'committedDraftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1900
|
-
},
|
|
1901
|
-
{
|
|
1902
|
-
path: 'committedDraftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1903
|
-
},
|
|
1904
|
-
{ path: 'committedDraftOrder.billingInfo.address' },
|
|
1905
|
-
{
|
|
1906
|
-
path: 'committedDraftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1907
|
-
},
|
|
1908
|
-
{ path: 'committedDraftOrder.recipientInfo.recipientInfo.address' },
|
|
1909
|
-
{
|
|
1910
|
-
path: 'committedDraftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1911
|
-
},
|
|
1912
|
-
{ path: 'committedDraftOrder.billingDetails.billingInfo.address' },
|
|
1913
|
-
{ path: 'orderAfterCommit.billingInfo.address' },
|
|
1914
|
-
{
|
|
1915
|
-
path: 'orderAfterCommit.shippingInfo.logistics.shippingDestination.address',
|
|
1916
|
-
},
|
|
1917
|
-
{
|
|
1918
|
-
path: 'orderAfterCommit.shippingInfo.logistics.pickupDetails.address',
|
|
1919
|
-
},
|
|
1920
|
-
{ path: 'orderAfterCommit.recipientInfo.address' },
|
|
1921
|
-
],
|
|
1922
|
-
},
|
|
1923
|
-
]));
|
|
1924
|
-
}
|
|
1925
|
-
catch (err) {
|
|
1926
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1927
|
-
spreadPathsToArguments: {},
|
|
1928
|
-
explicitPathsToArguments: {
|
|
1929
|
-
draftOrderId: '$[0]',
|
|
1930
|
-
commitSettings: '$[1].commitSettings',
|
|
1931
|
-
reason: '$[1].reason',
|
|
1932
|
-
},
|
|
1933
|
-
singleArgumentUnchanged: false,
|
|
1934
|
-
}, ['draftOrderId', 'options']);
|
|
1935
|
-
sideEffects?.onError?.(err);
|
|
1936
|
-
throw transformedError;
|
|
1937
|
-
}
|
|
1938
|
-
}
|
|
1939
|
-
exports.commitDraftOrder = commitDraftOrder;
|
|
1940
|
-
/**
|
|
1941
|
-
* Creates a new order from a draft, while specifying which side-effects are executed.
|
|
1942
|
-
*
|
|
1943
|
-
* > **Notes:**
|
|
1944
|
-
* > + The draft order's status is set to `COMMITTED`.
|
|
1945
|
-
* > + Commiting a draft order cannot be undone or reverted.
|
|
1946
|
-
* > + A committed draft order does not allow for further modifications. However, it is kept for reference and can be retrieved.
|
|
1947
|
-
* @param draftOrderId - Draft order ID.
|
|
1948
|
-
* @public
|
|
1949
|
-
* @documentationMaturity preview
|
|
1950
|
-
* @requiredField draftOrderId
|
|
1951
|
-
* @permissionId ECOM.DRAFT_ORDER_CREATE_ORDER_FROM_DRAFT
|
|
1952
|
-
* @permissionId ECOM.DRAFT_ORDER_READ_ALL_EXTENDED_FIELDS
|
|
1953
|
-
* @permissionScope Manage Stores - all permissions
|
|
1954
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
1955
|
-
* @permissionScope Manage Stores
|
|
1956
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
1957
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
1958
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1959
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
1960
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1961
|
-
* @applicableIdentity APP
|
|
1962
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateOrderFromDraft
|
|
1963
|
-
*/
|
|
1964
|
-
async function createOrderFromDraft(draftOrderId, options) {
|
|
1965
|
-
// @ts-ignore
|
|
1966
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1967
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1968
|
-
draftOrderId: draftOrderId,
|
|
1969
|
-
createSettings: options?.createSettings,
|
|
1970
|
-
reason: options?.reason,
|
|
1971
|
-
channelInfo: options?.channelInfo,
|
|
1972
|
-
});
|
|
1973
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.createOrderFromDraft(payload);
|
|
1974
|
-
sideEffects?.onSiteCall?.();
|
|
1975
|
-
try {
|
|
1976
|
-
const result = await httpClient.request(reqOpts);
|
|
1977
|
-
sideEffects?.onSuccess?.(result);
|
|
1978
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1979
|
-
{
|
|
1980
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1981
|
-
paths: [
|
|
1982
|
-
{ path: 'committedDraftOrder.lineItems.lineItem.image' },
|
|
1983
|
-
{ path: 'createdOrder.lineItems.image' },
|
|
1984
|
-
],
|
|
1985
|
-
},
|
|
1986
|
-
{
|
|
1987
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1988
|
-
paths: [
|
|
1989
|
-
{
|
|
1990
|
-
path: 'committedDraftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1991
|
-
},
|
|
1992
|
-
{
|
|
1993
|
-
path: 'committedDraftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1994
|
-
},
|
|
1995
|
-
{
|
|
1996
|
-
path: 'committedDraftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1997
|
-
},
|
|
1998
|
-
{
|
|
1999
|
-
path: 'committedDraftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
2000
|
-
},
|
|
2001
|
-
{ path: 'committedDraftOrder.billingInfo.address' },
|
|
2002
|
-
{
|
|
2003
|
-
path: 'committedDraftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
2004
|
-
},
|
|
2005
|
-
{ path: 'committedDraftOrder.recipientInfo.recipientInfo.address' },
|
|
2006
|
-
{
|
|
2007
|
-
path: 'committedDraftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
2008
|
-
},
|
|
2009
|
-
{ path: 'committedDraftOrder.billingDetails.billingInfo.address' },
|
|
2010
|
-
{ path: 'createdOrder.billingInfo.address' },
|
|
2011
|
-
{
|
|
2012
|
-
path: 'createdOrder.shippingInfo.logistics.shippingDestination.address',
|
|
2013
|
-
},
|
|
2014
|
-
{
|
|
2015
|
-
path: 'createdOrder.shippingInfo.logistics.pickupDetails.address',
|
|
2016
|
-
},
|
|
2017
|
-
{ path: 'createdOrder.recipientInfo.address' },
|
|
2018
|
-
],
|
|
2019
|
-
},
|
|
2020
|
-
]));
|
|
2021
|
-
}
|
|
2022
|
-
catch (err) {
|
|
2023
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
2024
|
-
spreadPathsToArguments: {},
|
|
2025
|
-
explicitPathsToArguments: {
|
|
2026
|
-
draftOrderId: '$[0]',
|
|
2027
|
-
createSettings: '$[1].createSettings',
|
|
2028
|
-
reason: '$[1].reason',
|
|
2029
|
-
channelInfo: '$[1].channelInfo',
|
|
2030
|
-
},
|
|
2031
|
-
singleArgumentUnchanged: false,
|
|
2032
|
-
}, ['draftOrderId', 'options']);
|
|
2033
|
-
sideEffects?.onError?.(err);
|
|
2034
|
-
throw transformedError;
|
|
2035
|
-
}
|
|
2036
|
-
}
|
|
2037
|
-
exports.createOrderFromDraft = createOrderFromDraft;
|
|
2038
|
-
/**
|
|
2039
|
-
* Deletes a draft order along with all its pending changes.
|
|
2040
|
-
*
|
|
2041
|
-
* Draft orders with status 'COMMITTED' cannot be deleted.
|
|
2042
|
-
* @param draftOrderId - Draft order ID.
|
|
2043
|
-
* @public
|
|
2044
|
-
* @documentationMaturity preview
|
|
2045
|
-
* @requiredField draftOrderId
|
|
2046
|
-
* @permissionId ECOM.DRAFT_ORDERS_DELETE
|
|
2047
|
-
* @permissionId ECOM.DRAFT_ORDERS_ADMIN_DELETE
|
|
2048
|
-
* @permissionScope Manage Stores - all permissions
|
|
2049
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
2050
|
-
* @permissionScope Manage Stores
|
|
2051
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
2052
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
2053
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
2054
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
2055
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
2056
|
-
* @applicableIdentity APP
|
|
2057
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.DeleteDraftOrder
|
|
2058
|
-
*/
|
|
2059
|
-
async function deleteDraftOrder(draftOrderId) {
|
|
2060
|
-
// @ts-ignore
|
|
2061
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
2062
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
2063
|
-
draftOrderId: draftOrderId,
|
|
2064
|
-
});
|
|
2065
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.deleteDraftOrder(payload);
|
|
2066
|
-
sideEffects?.onSiteCall?.();
|
|
2067
|
-
try {
|
|
2068
|
-
const result = await httpClient.request(reqOpts);
|
|
2069
|
-
sideEffects?.onSuccess?.(result);
|
|
2070
|
-
}
|
|
2071
|
-
catch (err) {
|
|
2072
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
2073
|
-
spreadPathsToArguments: {},
|
|
2074
|
-
explicitPathsToArguments: { draftOrderId: '$[0]' },
|
|
2075
|
-
singleArgumentUnchanged: false,
|
|
2076
|
-
}, ['draftOrderId']);
|
|
2077
|
-
sideEffects?.onError?.(err);
|
|
2078
|
-
throw transformedError;
|
|
2079
|
-
}
|
|
2080
|
-
}
|
|
2081
|
-
exports.deleteDraftOrder = deleteDraftOrder;
|
|
2082
|
-
/**
|
|
2083
|
-
* Retrieves a list of up to 100 draft orders, given the provided paging, filtering, and sorting.
|
|
2084
|
-
*
|
|
2085
|
-
* For field support, see [supported filters and sorting](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/draft-orders/supported-filters-and-sorting).
|
|
2086
|
-
* To learn how to query draft orders, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language).
|
|
2087
|
-
* @public
|
|
2088
|
-
* @documentationMaturity preview
|
|
2089
|
-
* @permissionScope Manage Stores - all permissions
|
|
2090
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
2091
|
-
* @permissionScope Manage Stores
|
|
2092
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
2093
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
2094
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
2095
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
2096
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
2097
|
-
* @permissionId ECOM.DRAFT_ORDERS_READ
|
|
2098
|
-
* @applicableIdentity APP
|
|
2099
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.QueryDraftOrders
|
|
2100
|
-
*/
|
|
2101
|
-
function queryDraftOrders() {
|
|
2102
|
-
// @ts-ignore
|
|
2103
|
-
const { httpClient, sideEffects } = arguments[0];
|
|
2104
|
-
return (0, query_builder_1.queryBuilder)({
|
|
2105
|
-
func: async (payload) => {
|
|
2106
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.queryDraftOrders(payload);
|
|
2107
|
-
sideEffects?.onSiteCall?.();
|
|
2108
|
-
try {
|
|
2109
|
-
const result = await httpClient.request(reqOpts);
|
|
2110
|
-
sideEffects?.onSuccess?.(result);
|
|
2111
|
-
return result;
|
|
2112
|
-
}
|
|
2113
|
-
catch (err) {
|
|
2114
|
-
sideEffects?.onError?.(err);
|
|
2115
|
-
throw err;
|
|
2116
|
-
}
|
|
2117
|
-
},
|
|
2118
|
-
requestTransformer: (query) => {
|
|
2119
|
-
const args = [query, {}];
|
|
2120
|
-
return (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
2121
|
-
...args?.[1],
|
|
2122
|
-
query: args?.[0],
|
|
2123
|
-
});
|
|
2124
|
-
},
|
|
2125
|
-
responseTransformer: ({ data }) => {
|
|
2126
|
-
const transformedData = (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(data, [
|
|
2127
|
-
{
|
|
2128
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
2129
|
-
paths: [{ path: 'draftOrders.lineItems.lineItem.image' }],
|
|
2130
|
-
},
|
|
2131
|
-
{
|
|
2132
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
2133
|
-
paths: [
|
|
2134
|
-
{
|
|
2135
|
-
path: 'draftOrders.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
2136
|
-
},
|
|
2137
|
-
{
|
|
2138
|
-
path: 'draftOrders.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
2139
|
-
},
|
|
2140
|
-
{
|
|
2141
|
-
path: 'draftOrders.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
2142
|
-
},
|
|
2143
|
-
{
|
|
2144
|
-
path: 'draftOrders.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
2145
|
-
},
|
|
2146
|
-
{ path: 'draftOrders.billingInfo.address' },
|
|
2147
|
-
{
|
|
2148
|
-
path: 'draftOrders.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
2149
|
-
},
|
|
2150
|
-
{ path: 'draftOrders.recipientInfo.recipientInfo.address' },
|
|
2151
|
-
{
|
|
2152
|
-
path: 'draftOrders.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
2153
|
-
},
|
|
2154
|
-
{ path: 'draftOrders.billingDetails.billingInfo.address' },
|
|
2155
|
-
],
|
|
2156
|
-
},
|
|
2157
|
-
]));
|
|
2158
|
-
return {
|
|
2159
|
-
items: transformedData?.draftOrders,
|
|
2160
|
-
pagingMetadata: transformedData?.pagingMetadata,
|
|
2161
|
-
};
|
|
2162
|
-
},
|
|
2163
|
-
errorTransformer: (err) => {
|
|
2164
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
2165
|
-
spreadPathsToArguments: {},
|
|
2166
|
-
explicitPathsToArguments: { query: '$[0]' },
|
|
2167
|
-
singleArgumentUnchanged: false,
|
|
2168
|
-
});
|
|
2169
|
-
throw transformedError;
|
|
2170
|
-
},
|
|
2171
|
-
pagingMethod: 'CURSOR',
|
|
2172
|
-
transformationPaths: {},
|
|
2173
|
-
});
|
|
2174
|
-
}
|
|
2175
|
-
exports.queryDraftOrders = queryDraftOrders;
|
|
2176
|
-
/**
|
|
2177
|
-
* Updates extended fields on a draft order.
|
|
2178
|
-
* @param _id - ID of the entity to update.
|
|
2179
|
-
* @param namespace - Identifier for the app whose extended fields are being updated.
|
|
2180
|
-
* @public
|
|
2181
|
-
* @documentationMaturity preview
|
|
2182
|
-
* @requiredField _id
|
|
2183
|
-
* @requiredField namespace
|
|
2184
|
-
* @requiredField options
|
|
2185
|
-
* @requiredField options.namespaceData
|
|
2186
|
-
* @permissionId ECOM.DRAFT_ORDER_UPDATE_EXTENDED_FIELDS
|
|
2187
|
-
* @permissionId ECOM.DRAFT_ORDER_WRITE_ALL_EXTENDED_FIELDS
|
|
2188
|
-
* @permissionScope Manage Stores - all permissions
|
|
2189
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
2190
|
-
* @permissionScope Manage Stores
|
|
2191
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
2192
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
2193
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
2194
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
2195
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
2196
|
-
* @permissionScope Manage Stores - all permissions
|
|
2197
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
2198
|
-
* @permissionScope Manage Stores
|
|
2199
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
2200
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
2201
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
2202
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
2203
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
2204
|
-
* @permissionScope Manage Orders
|
|
2205
|
-
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
2206
|
-
* @applicableIdentity APP
|
|
2207
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.UpdateExtendedFields
|
|
2208
|
-
*/
|
|
2209
|
-
async function updateExtendedFields(_id, namespace, options) {
|
|
2210
|
-
// @ts-ignore
|
|
2211
|
-
const { httpClient, sideEffects } = arguments[3];
|
|
2212
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
2213
|
-
id: _id,
|
|
2214
|
-
namespace: namespace,
|
|
2215
|
-
namespaceData: options?.namespaceData,
|
|
2216
|
-
});
|
|
2217
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.updateExtendedFields(payload);
|
|
2218
|
-
sideEffects?.onSiteCall?.();
|
|
2219
|
-
try {
|
|
2220
|
-
const result = await httpClient.request(reqOpts);
|
|
2221
|
-
sideEffects?.onSuccess?.(result);
|
|
2222
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
2223
|
-
{
|
|
2224
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
2225
|
-
paths: [{ path: 'draftOrder.lineItems.lineItem.image' }],
|
|
2226
|
-
},
|
|
2227
|
-
{
|
|
2228
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
2229
|
-
paths: [
|
|
2230
|
-
{
|
|
2231
|
-
path: 'draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
2232
|
-
},
|
|
2233
|
-
{
|
|
2234
|
-
path: 'draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
2235
|
-
},
|
|
2236
|
-
{
|
|
2237
|
-
path: 'draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
2238
|
-
},
|
|
2239
|
-
{
|
|
2240
|
-
path: 'draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
2241
|
-
},
|
|
2242
|
-
{ path: 'draftOrder.billingInfo.address' },
|
|
2243
|
-
{
|
|
2244
|
-
path: 'draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
2245
|
-
},
|
|
2246
|
-
{ path: 'draftOrder.recipientInfo.recipientInfo.address' },
|
|
2247
|
-
{
|
|
2248
|
-
path: 'draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
2249
|
-
},
|
|
2250
|
-
{ path: 'draftOrder.billingDetails.billingInfo.address' },
|
|
2251
|
-
],
|
|
2252
|
-
},
|
|
2253
|
-
]));
|
|
2254
|
-
}
|
|
2255
|
-
catch (err) {
|
|
2256
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
2257
|
-
spreadPathsToArguments: {},
|
|
2258
|
-
explicitPathsToArguments: {
|
|
2259
|
-
id: '$[0]',
|
|
2260
|
-
namespace: '$[1]',
|
|
2261
|
-
namespaceData: '$[2].namespaceData',
|
|
2262
|
-
},
|
|
2263
|
-
singleArgumentUnchanged: false,
|
|
2264
|
-
}, ['_id', 'namespace', 'options']);
|
|
2265
|
-
sideEffects?.onError?.(err);
|
|
2266
|
-
throw transformedError;
|
|
2267
|
-
}
|
|
2268
|
-
}
|
|
2269
|
-
exports.updateExtendedFields = updateExtendedFields;
|
|
2270
|
-
/**
|
|
2271
|
-
* Sets whether a draft order is tax-exempt.
|
|
2272
|
-
*
|
|
2273
|
-
* A tax exempted draft order ignores taxes during calculation. Tax information will return empty.
|
|
2274
|
-
* @param draftOrderId - Draft order ID.
|
|
2275
|
-
* @public
|
|
2276
|
-
* @documentationMaturity preview
|
|
2277
|
-
* @requiredField draftOrderId
|
|
2278
|
-
* @requiredField options
|
|
2279
|
-
* @requiredField options.taxExempt
|
|
2280
|
-
* @permissionId ECOM.DRAFT_ORDER_SET_TAX_EXEMPTION
|
|
2281
|
-
* @permissionScope Manage Stores - all permissions
|
|
2282
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
2283
|
-
* @permissionScope Manage Stores
|
|
2284
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
2285
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
2286
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
2287
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
2288
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
2289
|
-
* @applicableIdentity APP
|
|
2290
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetTaxExemption
|
|
2291
|
-
*/
|
|
2292
|
-
async function setTaxExemption(draftOrderId, options) {
|
|
2293
|
-
// @ts-ignore
|
|
2294
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
2295
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
2296
|
-
draftOrderId: draftOrderId,
|
|
2297
|
-
taxExempt: options?.taxExempt,
|
|
2298
|
-
});
|
|
2299
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.setTaxExemption(payload);
|
|
2300
|
-
sideEffects?.onSiteCall?.();
|
|
2301
|
-
try {
|
|
2302
|
-
const result = await httpClient.request(reqOpts);
|
|
2303
|
-
sideEffects?.onSuccess?.(result);
|
|
2304
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
2305
|
-
{
|
|
2306
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
2307
|
-
paths: [
|
|
2308
|
-
{
|
|
2309
|
-
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
2310
|
-
},
|
|
2311
|
-
],
|
|
2312
|
-
},
|
|
2313
|
-
{
|
|
2314
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
2315
|
-
paths: [
|
|
2316
|
-
{
|
|
2317
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
2318
|
-
},
|
|
2319
|
-
{
|
|
2320
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
2321
|
-
},
|
|
2322
|
-
{
|
|
2323
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
2324
|
-
},
|
|
2325
|
-
{
|
|
2326
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
2327
|
-
},
|
|
2328
|
-
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
2329
|
-
{
|
|
2330
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
2331
|
-
},
|
|
2332
|
-
{
|
|
2333
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
2334
|
-
},
|
|
2335
|
-
{
|
|
2336
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
2337
|
-
},
|
|
2338
|
-
{
|
|
2339
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
2340
|
-
},
|
|
2341
|
-
{
|
|
2342
|
-
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
2343
|
-
},
|
|
2344
|
-
],
|
|
2345
|
-
},
|
|
2346
|
-
]));
|
|
2347
|
-
}
|
|
2348
|
-
catch (err) {
|
|
2349
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
2350
|
-
spreadPathsToArguments: {},
|
|
2351
|
-
explicitPathsToArguments: {
|
|
2352
|
-
draftOrderId: '$[0]',
|
|
2353
|
-
taxExempt: '$[1].taxExempt',
|
|
2354
|
-
},
|
|
2355
|
-
singleArgumentUnchanged: false,
|
|
2356
|
-
}, ['draftOrderId', 'options']);
|
|
2357
|
-
sideEffects?.onError?.(err);
|
|
2358
|
-
throw transformedError;
|
|
2359
|
-
}
|
|
2360
|
-
}
|
|
2361
|
-
exports.setTaxExemption = setTaxExemption;
|
|
2362
|
-
/**
|
|
2363
|
-
* Sets business location on a draft order.
|
|
2364
|
-
*
|
|
2365
|
-
* When committed, the order will become associated to a specific business location. This affects who can see and manage this order, and how it is calculated in reports.
|
|
2366
|
-
* @param draftOrderId - Draft order ID.
|
|
2367
|
-
* @public
|
|
2368
|
-
* @documentationMaturity preview
|
|
2369
|
-
* @requiredField draftOrderId
|
|
2370
|
-
* @requiredField options.businessLocation._id
|
|
2371
|
-
* @permissionId ECOM.DRAFT_ORDER_SET_BUSINESS_LOCATION
|
|
2372
|
-
* @permissionScope Manage Stores - all permissions
|
|
2373
|
-
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
2374
|
-
* @permissionScope Manage Stores
|
|
2375
|
-
* @permissionScopeId SCOPE.STORES.MANAGE-STORES
|
|
2376
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
2377
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
2378
|
-
* @permissionScope Manage eCommerce - all permissions
|
|
2379
|
-
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
2380
|
-
* @applicableIdentity APP
|
|
2381
|
-
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetBusinessLocation
|
|
2382
|
-
*/
|
|
2383
|
-
async function setBusinessLocation(draftOrderId, options) {
|
|
2384
|
-
// @ts-ignore
|
|
2385
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
2386
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
2387
|
-
draftOrderId: draftOrderId,
|
|
2388
|
-
businessLocation: options?.businessLocation,
|
|
2389
|
-
});
|
|
2390
|
-
const reqOpts = ambassadorWixEcomV1DraftOrder.setBusinessLocation(payload);
|
|
2391
|
-
sideEffects?.onSiteCall?.();
|
|
2392
|
-
try {
|
|
2393
|
-
const result = await httpClient.request(reqOpts);
|
|
2394
|
-
sideEffects?.onSuccess?.(result);
|
|
2395
|
-
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
2396
|
-
{
|
|
2397
|
-
transformFn: image_2.transformRESTImageToSDKImage,
|
|
2398
|
-
paths: [
|
|
2399
|
-
{
|
|
2400
|
-
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
2401
|
-
},
|
|
2402
|
-
],
|
|
2403
|
-
},
|
|
2404
|
-
{
|
|
2405
|
-
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
2406
|
-
paths: [
|
|
2407
|
-
{
|
|
2408
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
2409
|
-
},
|
|
2410
|
-
{
|
|
2411
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
2412
|
-
},
|
|
2413
|
-
{
|
|
2414
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
2415
|
-
},
|
|
2416
|
-
{
|
|
2417
|
-
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
2418
|
-
},
|
|
2419
|
-
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
2420
|
-
{
|
|
2421
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
2422
|
-
},
|
|
2423
|
-
{
|
|
2424
|
-
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
2425
|
-
},
|
|
2426
|
-
{
|
|
2427
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
2428
|
-
},
|
|
2429
|
-
{
|
|
2430
|
-
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
2431
|
-
},
|
|
2432
|
-
{
|
|
2433
|
-
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
2434
|
-
},
|
|
2435
|
-
],
|
|
2436
|
-
},
|
|
2437
|
-
]));
|
|
2438
|
-
}
|
|
2439
|
-
catch (err) {
|
|
2440
|
-
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
2441
|
-
spreadPathsToArguments: {},
|
|
2442
|
-
explicitPathsToArguments: {
|
|
2443
|
-
draftOrderId: '$[0]',
|
|
2444
|
-
businessLocation: '$[1].businessLocation',
|
|
2445
|
-
},
|
|
2446
|
-
singleArgumentUnchanged: false,
|
|
2447
|
-
}, ['draftOrderId', 'options']);
|
|
2448
|
-
sideEffects?.onError?.(err);
|
|
2449
|
-
throw transformedError;
|
|
2450
|
-
}
|
|
2451
|
-
}
|
|
2452
|
-
exports.setBusinessLocation = setBusinessLocation;
|
|
2453
|
-
//# sourceMappingURL=ecom-v1-draft-order-draft-orders.universal.js.map
|