@wix/auto_sdk_ecom_draft-orders 1.0.20 → 1.0.22
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/cjs/src/ecom-v1-draft-order-draft-orders.context.d.ts +3 -2
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.context.js +3 -1
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.context.js.map +1 -1
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.http.d.ts +40 -25
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.http.js +153 -26
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.http.js.map +1 -1
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.meta.d.ts +3 -0
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.meta.js +20 -1
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.meta.js.map +1 -1
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.public.d.ts +82 -52
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.public.js +16 -10
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.public.js.map +1 -1
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.types.d.ts +288 -102
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.types.js +23 -9
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.types.js.map +1 -1
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.universal.d.ts +473 -213
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.universal.js +581 -136
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.universal.js.map +1 -1
- package/build/es/src/ecom-v1-draft-order-draft-orders.context.d.ts +3 -2
- package/build/es/src/ecom-v1-draft-order-draft-orders.context.js +2 -1
- package/build/es/src/ecom-v1-draft-order-draft-orders.context.js.map +1 -1
- package/build/es/src/ecom-v1-draft-order-draft-orders.http.d.ts +40 -25
- package/build/es/src/ecom-v1-draft-order-draft-orders.http.js +151 -25
- package/build/es/src/ecom-v1-draft-order-draft-orders.http.js.map +1 -1
- package/build/es/src/ecom-v1-draft-order-draft-orders.meta.d.ts +3 -0
- package/build/es/src/ecom-v1-draft-order-draft-orders.meta.js +18 -0
- package/build/es/src/ecom-v1-draft-order-draft-orders.meta.js.map +1 -1
- package/build/es/src/ecom-v1-draft-order-draft-orders.public.d.ts +82 -52
- package/build/es/src/ecom-v1-draft-order-draft-orders.public.js +14 -9
- package/build/es/src/ecom-v1-draft-order-draft-orders.public.js.map +1 -1
- package/build/es/src/ecom-v1-draft-order-draft-orders.types.d.ts +288 -102
- package/build/es/src/ecom-v1-draft-order-draft-orders.types.js +23 -9
- package/build/es/src/ecom-v1-draft-order-draft-orders.types.js.map +1 -1
- package/build/es/src/ecom-v1-draft-order-draft-orders.universal.d.ts +473 -213
- package/build/es/src/ecom-v1-draft-order-draft-orders.universal.js +578 -135
- package/build/es/src/ecom-v1-draft-order-draft-orders.universal.js.map +1 -1
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.context.d.ts +3 -2
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.context.js +3 -1
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.context.js.map +1 -1
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.http.d.ts +40 -25
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.http.js +153 -26
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.http.js.map +1 -1
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.meta.d.ts +3 -0
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.meta.js +20 -1
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.meta.js.map +1 -1
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.public.d.ts +82 -52
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.public.js +16 -10
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.public.js.map +1 -1
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.types.d.ts +288 -102
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.types.js +23 -9
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.types.js.map +1 -1
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.universal.d.ts +369 -379
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.universal.js +581 -136
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.universal.js.map +1 -1
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.context.d.ts +3 -2
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.context.js +2 -1
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.context.js.map +1 -1
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.http.d.ts +40 -25
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.http.js +151 -25
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.http.js.map +1 -1
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.meta.d.ts +3 -0
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.meta.js +18 -0
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.meta.js.map +1 -1
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.public.d.ts +82 -52
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.public.js +14 -9
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.public.js.map +1 -1
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.types.d.ts +288 -102
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.types.js +23 -9
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.types.js.map +1 -1
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.universal.d.ts +369 -379
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.universal.js +578 -135
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.universal.js.map +1 -1
- package/package.json +2 -2
|
@@ -23,7 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
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;
|
|
27
28
|
const transform_error_1 = require("@wix/sdk-runtime/transform-error");
|
|
28
29
|
const query_builder_1 = require("@wix/sdk-runtime/query-builder");
|
|
29
30
|
const rename_all_nested_keys_1 = require("@wix/sdk-runtime/rename-all-nested-keys");
|
|
@@ -117,11 +118,11 @@ var PickupDetailsPickupMethod;
|
|
|
117
118
|
})(PickupDetailsPickupMethod || (exports.PickupDetailsPickupMethod = PickupDetailsPickupMethod = {}));
|
|
118
119
|
var SourceType;
|
|
119
120
|
(function (SourceType) {
|
|
120
|
-
/** Part of the original order */
|
|
121
|
+
/** Part of the original order. */
|
|
121
122
|
SourceType["ORIGINAL_ORDER"] = "ORIGINAL_ORDER";
|
|
122
|
-
/** Added by
|
|
123
|
+
/** Added automatically, as the result of recalculation caused by changes in draft order. */
|
|
123
124
|
SourceType["AUTOMATIC"] = "AUTOMATIC";
|
|
124
|
-
/** Added manually to
|
|
125
|
+
/** Added manually to draft order. */
|
|
125
126
|
SourceType["CUSTOM"] = "CUSTOM";
|
|
126
127
|
})(SourceType || (exports.SourceType = SourceType = {}));
|
|
127
128
|
var AppliedDiscountDiscountType;
|
|
@@ -138,9 +139,9 @@ var DiscountReason;
|
|
|
138
139
|
})(DiscountReason || (exports.DiscountReason = DiscountReason = {}));
|
|
139
140
|
var EditingStatus;
|
|
140
141
|
(function (EditingStatus) {
|
|
141
|
-
/**
|
|
142
|
+
/** Draft order can be modified and committed. */
|
|
142
143
|
EditingStatus["DRAFT"] = "DRAFT";
|
|
143
|
-
/**
|
|
144
|
+
/** Draft order is already committed. No further modifications allowed. */
|
|
144
145
|
EditingStatus["COMMITTED"] = "COMMITTED";
|
|
145
146
|
})(EditingStatus || (exports.EditingStatus = EditingStatus = {}));
|
|
146
147
|
var WeightUnit;
|
|
@@ -155,7 +156,9 @@ var WeightUnit;
|
|
|
155
156
|
var PickupMethod;
|
|
156
157
|
(function (PickupMethod) {
|
|
157
158
|
PickupMethod["UNKNOWN_METHOD"] = "UNKNOWN_METHOD";
|
|
159
|
+
/** Pickup is from the merchant's brick and mortar store. */
|
|
158
160
|
PickupMethod["STORE_PICKUP"] = "STORE_PICKUP";
|
|
161
|
+
/** Item is shipped to a specified pickup point. */
|
|
159
162
|
PickupMethod["PICKUP_POINT"] = "PICKUP_POINT";
|
|
160
163
|
})(PickupMethod || (exports.PickupMethod = PickupMethod = {}));
|
|
161
164
|
var RuleType;
|
|
@@ -194,24 +197,36 @@ var FileType;
|
|
|
194
197
|
var DiscountType;
|
|
195
198
|
(function (DiscountType) {
|
|
196
199
|
DiscountType["UNKNOWN_TYPE"] = "UNKNOWN_TYPE";
|
|
200
|
+
/** Discount applies to entire order. */
|
|
197
201
|
DiscountType["GLOBAL"] = "GLOBAL";
|
|
202
|
+
/** Discount applies to specific items. */
|
|
198
203
|
DiscountType["SPECIFIC_ITEMS"] = "SPECIFIC_ITEMS";
|
|
204
|
+
/** Discount applies to shipping. For example, free shipping. */
|
|
199
205
|
DiscountType["SHIPPING"] = "SHIPPING";
|
|
200
206
|
})(DiscountType || (exports.DiscountType = DiscountType = {}));
|
|
201
207
|
var NonDraftableReason;
|
|
202
208
|
(function (NonDraftableReason) {
|
|
203
209
|
NonDraftableReason["UNSPECIFIED"] = "UNSPECIFIED";
|
|
210
|
+
/** Modifications of refunded orders are not supported. */
|
|
204
211
|
NonDraftableReason["PARTIALLY_OR_FULLY_REFUNDED"] = "PARTIALLY_OR_FULLY_REFUNDED";
|
|
212
|
+
/**
|
|
213
|
+
* Original order must be created via one of the following channel types:
|
|
214
|
+
* + WEB
|
|
215
|
+
* + POS
|
|
216
|
+
* + BACKOFFICE_MERCHANT
|
|
217
|
+
* + WIX_APP_STORE
|
|
218
|
+
*/
|
|
205
219
|
NonDraftableReason["UNSUPPORTED_CHANNEL_TYPE"] = "UNSUPPORTED_CHANNEL_TYPE";
|
|
220
|
+
/** Order status is not APPROVED. */
|
|
206
221
|
NonDraftableReason["ORDER_STATUS_IS_NOT_SUPPORTED"] = "ORDER_STATUS_IS_NOT_SUPPORTED";
|
|
222
|
+
/** Site and order currencies are different. */
|
|
207
223
|
NonDraftableReason["ORDER_AND_SITE_CURRENCIES_ARE_INCONSISTENT"] = "ORDER_AND_SITE_CURRENCIES_ARE_INCONSISTENT";
|
|
224
|
+
/** Site and order weight units are different. */
|
|
208
225
|
NonDraftableReason["ORDER_AND_SITE_WEIGHT_UNITS_ARE_INCONSISTENT"] = "ORDER_AND_SITE_WEIGHT_UNITS_ARE_INCONSISTENT";
|
|
209
|
-
|
|
210
|
-
/** remove - this is not a reason, it's an error */
|
|
226
|
+
/** Order not found. */
|
|
211
227
|
NonDraftableReason["ORDER_NOT_FOUND"] = "ORDER_NOT_FOUND";
|
|
228
|
+
/** Modifications of orders with subscription items are not supported. */
|
|
212
229
|
NonDraftableReason["SUBSCRIPTION_LINE_ITEM_EXISTS"] = "SUBSCRIPTION_LINE_ITEM_EXISTS";
|
|
213
|
-
NonDraftableReason["UNSUPPORTED_CATALOG_ITEM"] = "UNSUPPORTED_CATALOG_ITEM";
|
|
214
|
-
NonDraftableReason["TAXABLE_EXISTING_ADDITIONAL_FEE"] = "TAXABLE_EXISTING_ADDITIONAL_FEE";
|
|
215
230
|
})(NonDraftableReason || (exports.NonDraftableReason = NonDraftableReason = {}));
|
|
216
231
|
var PaymentStatus;
|
|
217
232
|
(function (PaymentStatus) {
|
|
@@ -395,8 +410,8 @@ var WebhookIdentityType;
|
|
|
395
410
|
* Creates or gets a draft order.
|
|
396
411
|
*
|
|
397
412
|
* When passing the ID of an order that is already in draft, the existing draft order will be returned.
|
|
398
|
-
* To complete a draft and update the order, call
|
|
399
|
-
* @param orderId -
|
|
413
|
+
* To complete a draft and update the order, call Commit Draft Order([REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/draft-orders/commit-draft-order) | [SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/draft-orders/commit-draft-order)).
|
|
414
|
+
* @param orderId - Existing order ID to create draft from.
|
|
400
415
|
* @public
|
|
401
416
|
* @documentationMaturity preview
|
|
402
417
|
* @requiredField orderId
|
|
@@ -409,8 +424,6 @@ var WebhookIdentityType;
|
|
|
409
424
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
410
425
|
* @permissionScope Manage eCommerce - all permissions
|
|
411
426
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
412
|
-
* @permissionScope Picasso private app mega scope
|
|
413
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
414
427
|
* @applicableIdentity APP
|
|
415
428
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateDraftOrder
|
|
416
429
|
*/
|
|
@@ -491,8 +504,6 @@ exports.createDraftOrder = createDraftOrder;
|
|
|
491
504
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
492
505
|
* @permissionScope Manage eCommerce - all permissions
|
|
493
506
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
494
|
-
* @permissionScope Picasso private app mega scope
|
|
495
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
496
507
|
* @applicableIdentity APP
|
|
497
508
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateEmptyDraftOrder
|
|
498
509
|
*/
|
|
@@ -562,7 +573,7 @@ async function createEmptyDraftOrder() {
|
|
|
562
573
|
exports.createEmptyDraftOrder = createEmptyDraftOrder;
|
|
563
574
|
/**
|
|
564
575
|
* Adds line items to a draft order.
|
|
565
|
-
* @param draftOrderId -
|
|
576
|
+
* @param draftOrderId - Draft order ID.
|
|
566
577
|
* @public
|
|
567
578
|
* @documentationMaturity preview
|
|
568
579
|
* @requiredField draftOrderId
|
|
@@ -574,8 +585,6 @@ exports.createEmptyDraftOrder = createEmptyDraftOrder;
|
|
|
574
585
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
575
586
|
* @permissionScope Manage eCommerce - all permissions
|
|
576
587
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
577
|
-
* @permissionScope Picasso private app mega scope
|
|
578
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
579
588
|
* @applicableIdentity APP
|
|
580
589
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.AddLineItemsToDraftOrder
|
|
581
590
|
*/
|
|
@@ -668,10 +677,13 @@ exports.addLineItemsToDraftOrder = addLineItemsToDraftOrder;
|
|
|
668
677
|
* > + Passing a quantity of `0` will remove the line item.
|
|
669
678
|
* > + Price cannot be updated for line items with `paymentOption: MEMBERSHIP`.
|
|
670
679
|
* > + Quantity cannot be decreased fulfilled line items. To get fulfillment information, pass the order ID to [List Fulfillments For Single Order](https://dev.wix.com/docs/rest/api-reference/wix-e-commerce/order-fulfillments/list-fulfillments-for-single-order).
|
|
671
|
-
* @param draftOrderId -
|
|
680
|
+
* @param draftOrderId - Draft order ID.
|
|
681
|
+
* @param lineItemChanges - Details of changes to apply per line item.
|
|
672
682
|
* @public
|
|
673
683
|
* @documentationMaturity preview
|
|
674
684
|
* @requiredField draftOrderId
|
|
685
|
+
* @requiredField lineItemChanges
|
|
686
|
+
* @requiredField lineItemChanges.lineItemId
|
|
675
687
|
* @permissionId ECOM.DRAFT_ORDERS_MODIFY_ITEMS
|
|
676
688
|
* @permissionScope Manage Stores - all permissions
|
|
677
689
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -679,17 +691,15 @@ exports.addLineItemsToDraftOrder = addLineItemsToDraftOrder;
|
|
|
679
691
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
680
692
|
* @permissionScope Manage eCommerce - all permissions
|
|
681
693
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
682
|
-
* @permissionScope Picasso private app mega scope
|
|
683
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
684
694
|
* @applicableIdentity APP
|
|
685
695
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.UpdateLineItems
|
|
686
696
|
*/
|
|
687
|
-
async function updateLineItems(draftOrderId,
|
|
697
|
+
async function updateLineItems(draftOrderId, lineItemChanges) {
|
|
688
698
|
// @ts-ignore
|
|
689
699
|
const { httpClient, sideEffects } = arguments[2];
|
|
690
700
|
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
691
701
|
draftOrderId: draftOrderId,
|
|
692
|
-
lineItemChanges:
|
|
702
|
+
lineItemChanges: lineItemChanges,
|
|
693
703
|
});
|
|
694
704
|
const reqOpts = ambassadorWixEcomV1DraftOrder.updateLineItems(payload);
|
|
695
705
|
sideEffects?.onSiteCall?.();
|
|
@@ -745,24 +755,28 @@ async function updateLineItems(draftOrderId, options) {
|
|
|
745
755
|
spreadPathsToArguments: {},
|
|
746
756
|
explicitPathsToArguments: {
|
|
747
757
|
draftOrderId: '$[0]',
|
|
748
|
-
lineItemChanges: '$[1]
|
|
758
|
+
lineItemChanges: '$[1]',
|
|
749
759
|
},
|
|
750
760
|
singleArgumentUnchanged: false,
|
|
751
|
-
}, ['draftOrderId', '
|
|
761
|
+
}, ['draftOrderId', 'lineItemChanges']);
|
|
752
762
|
sideEffects?.onError?.(err);
|
|
753
763
|
throw transformedError;
|
|
754
764
|
}
|
|
755
765
|
}
|
|
756
766
|
exports.updateLineItems = updateLineItems;
|
|
757
767
|
/**
|
|
758
|
-
*
|
|
768
|
+
* Applies or unapplies discounts on a draft order.
|
|
759
769
|
*
|
|
760
|
-
*
|
|
761
|
-
*
|
|
762
|
-
* @param
|
|
770
|
+
* Unapplied discounts are still part of draft order, but do not affect balance.
|
|
771
|
+
* Existing discounts, not mentioned in request, will keep their current state.
|
|
772
|
+
* @param draftOrderId - Draft order ID.
|
|
773
|
+
* @param discounts - Discount IDs to apply/unapply.
|
|
774
|
+
* Existing discounts, not mentioned in request, will keep their current state.
|
|
763
775
|
* @public
|
|
764
776
|
* @documentationMaturity preview
|
|
765
777
|
* @requiredField discounts
|
|
778
|
+
* @requiredField discounts._id
|
|
779
|
+
* @requiredField discounts.applied
|
|
766
780
|
* @requiredField draftOrderId
|
|
767
781
|
* @permissionId ECOM.DRAFT_ORDERS_SET_DISCOUNTS
|
|
768
782
|
* @permissionScope Manage Stores - all permissions
|
|
@@ -771,8 +785,6 @@ exports.updateLineItems = updateLineItems;
|
|
|
771
785
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
772
786
|
* @permissionScope Manage eCommerce - all permissions
|
|
773
787
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
774
|
-
* @permissionScope Picasso private app mega scope
|
|
775
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
776
788
|
* @applicableIdentity APP
|
|
777
789
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetDiscounts
|
|
778
790
|
*/
|
|
@@ -844,14 +856,17 @@ async function setDiscounts(draftOrderId, discounts) {
|
|
|
844
856
|
}
|
|
845
857
|
exports.setDiscounts = setDiscounts;
|
|
846
858
|
/**
|
|
847
|
-
*
|
|
848
|
-
*
|
|
859
|
+
* Create custom discounts on a draft order.
|
|
860
|
+
*
|
|
861
|
+
* Newly added discounts are unapplied by default.
|
|
862
|
+
* To apply them, use Set Discounts ([REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/draft-orders/set-discounts) | [SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/draft-orders/set-discounts)).
|
|
863
|
+
* @param draftOrderId - Draft order ID.
|
|
849
864
|
* @public
|
|
850
865
|
* @documentationMaturity preview
|
|
851
866
|
* @requiredField draftOrderId
|
|
852
|
-
* @requiredField options.discounts.amount
|
|
853
867
|
* @requiredField options.discounts.amount.amount
|
|
854
868
|
* @requiredField options.discounts.discountType
|
|
869
|
+
* @requiredField options.discounts.priceAmount.amount
|
|
855
870
|
* @permissionId ECOM.DRAFT_ORDERS_ADD_DISCOUNTS
|
|
856
871
|
* @permissionScope Manage Stores - all permissions
|
|
857
872
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -859,8 +874,6 @@ exports.setDiscounts = setDiscounts;
|
|
|
859
874
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
860
875
|
* @permissionScope Manage eCommerce - all permissions
|
|
861
876
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
862
|
-
* @permissionScope Picasso private app mega scope
|
|
863
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
864
877
|
* @applicableIdentity APP
|
|
865
878
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateCustomDiscounts
|
|
866
879
|
*/
|
|
@@ -936,8 +949,8 @@ async function createCustomDiscounts(draftOrderId, options) {
|
|
|
936
949
|
exports.createCustomDiscounts = createCustomDiscounts;
|
|
937
950
|
/**
|
|
938
951
|
* Remove custom discounts from the order.
|
|
939
|
-
* @param draftOrderId -
|
|
940
|
-
* @param discountIds -
|
|
952
|
+
* @param draftOrderId - Draft order ID.
|
|
953
|
+
* @param discountIds - Ids of discounts to remove.
|
|
941
954
|
* @public
|
|
942
955
|
* @documentationMaturity preview
|
|
943
956
|
* @requiredField discountIds
|
|
@@ -949,8 +962,6 @@ exports.createCustomDiscounts = createCustomDiscounts;
|
|
|
949
962
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
950
963
|
* @permissionScope Manage eCommerce - all permissions
|
|
951
964
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
952
|
-
* @permissionScope Picasso private app mega scope
|
|
953
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
954
965
|
* @applicableIdentity APP
|
|
955
966
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.DeleteCustomDiscounts
|
|
956
967
|
*/
|
|
@@ -1022,13 +1033,18 @@ async function deleteCustomDiscounts(draftOrderId, discountIds) {
|
|
|
1022
1033
|
}
|
|
1023
1034
|
exports.deleteCustomDiscounts = deleteCustomDiscounts;
|
|
1024
1035
|
/**
|
|
1025
|
-
*
|
|
1026
|
-
*
|
|
1027
|
-
*
|
|
1028
|
-
*
|
|
1036
|
+
* Applies or unapplies additional fees on a draft order.
|
|
1037
|
+
*
|
|
1038
|
+
* Unapplied fees are still part of draft order, but do not affect balance.
|
|
1039
|
+
* Existing additional fees, not mentioned in request, will keep their current state.
|
|
1040
|
+
* @param draftOrderId - Draft order ID.
|
|
1041
|
+
* @param additionalFees - Additional fee IDs to apply/unapply.
|
|
1042
|
+
* Existing additional fees, not mentioned in this list, will keep their current state.
|
|
1029
1043
|
* @public
|
|
1030
1044
|
* @documentationMaturity preview
|
|
1031
1045
|
* @requiredField additionalFees
|
|
1046
|
+
* @requiredField additionalFees._id
|
|
1047
|
+
* @requiredField additionalFees.applied
|
|
1032
1048
|
* @requiredField draftOrderId
|
|
1033
1049
|
* @permissionId ECOM.DRAFT_ORDERS_SET_ADDITIONAL_FEES
|
|
1034
1050
|
* @permissionScope Manage Stores - all permissions
|
|
@@ -1037,8 +1053,6 @@ exports.deleteCustomDiscounts = deleteCustomDiscounts;
|
|
|
1037
1053
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1038
1054
|
* @permissionScope Manage eCommerce - all permissions
|
|
1039
1055
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1040
|
-
* @permissionScope Picasso private app mega scope
|
|
1041
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1042
1056
|
* @applicableIdentity APP
|
|
1043
1057
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetAdditionalFees
|
|
1044
1058
|
*/
|
|
@@ -1113,10 +1127,11 @@ async function setAdditionalFees(draftOrderId, additionalFees) {
|
|
|
1113
1127
|
}
|
|
1114
1128
|
exports.setAdditionalFees = setAdditionalFees;
|
|
1115
1129
|
/**
|
|
1116
|
-
*
|
|
1117
|
-
*
|
|
1118
|
-
*
|
|
1119
|
-
*
|
|
1130
|
+
* Creates custom additional fees on a draft order.
|
|
1131
|
+
*
|
|
1132
|
+
* Newly added additional fees are unapplied by default.
|
|
1133
|
+
* To apply them, use Set Additional Fees ([REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/draft-orders/set-additional-fees) | [SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/draft-orders/set-additional-fees)).
|
|
1134
|
+
* @param draftOrderId - Draft order ID.
|
|
1120
1135
|
* @public
|
|
1121
1136
|
* @documentationMaturity preview
|
|
1122
1137
|
* @requiredField draftOrderId
|
|
@@ -1130,8 +1145,6 @@ exports.setAdditionalFees = setAdditionalFees;
|
|
|
1130
1145
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1131
1146
|
* @permissionScope Manage eCommerce - all permissions
|
|
1132
1147
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1133
|
-
* @permissionScope Picasso private app mega scope
|
|
1134
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1135
1148
|
* @applicableIdentity APP
|
|
1136
1149
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateCustomAdditionalFees
|
|
1137
1150
|
*/
|
|
@@ -1207,8 +1220,8 @@ async function createCustomAdditionalFees(draftOrderId, options) {
|
|
|
1207
1220
|
exports.createCustomAdditionalFees = createCustomAdditionalFees;
|
|
1208
1221
|
/**
|
|
1209
1222
|
* Remove custom additional fees from the order.
|
|
1210
|
-
* @param draftOrderId -
|
|
1211
|
-
* @param customAdditionalFees -
|
|
1223
|
+
* @param draftOrderId - Draft order ID.
|
|
1224
|
+
* @param customAdditionalFees - Ids of additional fees to remove.
|
|
1212
1225
|
* @public
|
|
1213
1226
|
* @documentationMaturity preview
|
|
1214
1227
|
* @requiredField customAdditionalFees
|
|
@@ -1220,8 +1233,6 @@ exports.createCustomAdditionalFees = createCustomAdditionalFees;
|
|
|
1220
1233
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1221
1234
|
* @permissionScope Manage eCommerce - all permissions
|
|
1222
1235
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1223
|
-
* @permissionScope Picasso private app mega scope
|
|
1224
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1225
1236
|
* @applicableIdentity APP
|
|
1226
1237
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.DeleteCustomAdditionalFees
|
|
1227
1238
|
*/
|
|
@@ -1296,9 +1307,11 @@ async function deleteCustomAdditionalFees(draftOrderId, customAdditionalFees) {
|
|
|
1296
1307
|
}
|
|
1297
1308
|
exports.deleteCustomAdditionalFees = deleteCustomAdditionalFees;
|
|
1298
1309
|
/**
|
|
1299
|
-
* Sets shipping
|
|
1310
|
+
* Sets shipping information on a draft order.
|
|
1311
|
+
* @param draftOrderId - Draft order ID.
|
|
1300
1312
|
* @public
|
|
1301
1313
|
* @documentationMaturity preview
|
|
1314
|
+
* @requiredField draftOrderId
|
|
1302
1315
|
* @permissionId ECOM.DRAFT_ORDERS_SET_SHIPPING_INFO
|
|
1303
1316
|
* @permissionScope Manage Stores - all permissions
|
|
1304
1317
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1306,15 +1319,16 @@ exports.deleteCustomAdditionalFees = deleteCustomAdditionalFees;
|
|
|
1306
1319
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1307
1320
|
* @permissionScope Manage eCommerce - all permissions
|
|
1308
1321
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1309
|
-
* @permissionScope Picasso private app mega scope
|
|
1310
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1311
1322
|
* @applicableIdentity APP
|
|
1312
1323
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetShippingInfo
|
|
1313
1324
|
*/
|
|
1314
|
-
async function setShippingInfo() {
|
|
1325
|
+
async function setShippingInfo(draftOrderId, options) {
|
|
1315
1326
|
// @ts-ignore
|
|
1316
|
-
const { httpClient, sideEffects } = arguments[
|
|
1317
|
-
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1327
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1328
|
+
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1329
|
+
draftOrderId: draftOrderId,
|
|
1330
|
+
shippingInfo: options?.shippingInfo,
|
|
1331
|
+
}), [
|
|
1318
1332
|
{
|
|
1319
1333
|
transformFn: address_1.transformSDKAddressToRESTAddress,
|
|
1320
1334
|
paths: [
|
|
@@ -1328,22 +1342,70 @@ async function setShippingInfo() {
|
|
|
1328
1342
|
try {
|
|
1329
1343
|
const result = await httpClient.request(reqOpts);
|
|
1330
1344
|
sideEffects?.onSuccess?.(result);
|
|
1345
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1346
|
+
{
|
|
1347
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1348
|
+
paths: [
|
|
1349
|
+
{
|
|
1350
|
+
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1351
|
+
},
|
|
1352
|
+
],
|
|
1353
|
+
},
|
|
1354
|
+
{
|
|
1355
|
+
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1356
|
+
paths: [
|
|
1357
|
+
{
|
|
1358
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1359
|
+
},
|
|
1360
|
+
{
|
|
1361
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1362
|
+
},
|
|
1363
|
+
{
|
|
1364
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1365
|
+
},
|
|
1366
|
+
{
|
|
1367
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1368
|
+
},
|
|
1369
|
+
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1370
|
+
{
|
|
1371
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1372
|
+
},
|
|
1373
|
+
{
|
|
1374
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1375
|
+
},
|
|
1376
|
+
{
|
|
1377
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1378
|
+
},
|
|
1379
|
+
{
|
|
1380
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1381
|
+
},
|
|
1382
|
+
{
|
|
1383
|
+
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1384
|
+
},
|
|
1385
|
+
],
|
|
1386
|
+
},
|
|
1387
|
+
]));
|
|
1331
1388
|
}
|
|
1332
1389
|
catch (err) {
|
|
1333
1390
|
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1334
1391
|
spreadPathsToArguments: {},
|
|
1335
|
-
explicitPathsToArguments: {
|
|
1392
|
+
explicitPathsToArguments: {
|
|
1393
|
+
draftOrderId: '$[0]',
|
|
1394
|
+
shippingInfo: '$[1].shippingInfo',
|
|
1395
|
+
},
|
|
1336
1396
|
singleArgumentUnchanged: false,
|
|
1337
|
-
}, []);
|
|
1397
|
+
}, ['draftOrderId', 'options']);
|
|
1338
1398
|
sideEffects?.onError?.(err);
|
|
1339
1399
|
throw transformedError;
|
|
1340
1400
|
}
|
|
1341
1401
|
}
|
|
1342
1402
|
exports.setShippingInfo = setShippingInfo;
|
|
1343
1403
|
/**
|
|
1344
|
-
* Sets buyer info
|
|
1404
|
+
* Sets buyer info on a draft order.
|
|
1405
|
+
* @param draftOrderId - Draft order ID.
|
|
1345
1406
|
* @public
|
|
1346
1407
|
* @documentationMaturity preview
|
|
1408
|
+
* @requiredField draftOrderId
|
|
1347
1409
|
* @permissionId ECOM.DRAFT_ORDER_SET_BUYER_INFO
|
|
1348
1410
|
* @permissionScope Manage Stores - all permissions
|
|
1349
1411
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1351,36 +1413,85 @@ exports.setShippingInfo = setShippingInfo;
|
|
|
1351
1413
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1352
1414
|
* @permissionScope Manage eCommerce - all permissions
|
|
1353
1415
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1354
|
-
* @permissionScope Picasso private app mega scope
|
|
1355
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1356
1416
|
* @applicableIdentity APP
|
|
1357
1417
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetBuyerInfo
|
|
1358
1418
|
*/
|
|
1359
|
-
async function setBuyerInfo() {
|
|
1419
|
+
async function setBuyerInfo(draftOrderId, options) {
|
|
1360
1420
|
// @ts-ignore
|
|
1361
|
-
const { httpClient, sideEffects } = arguments[
|
|
1362
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1421
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1422
|
+
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1423
|
+
draftOrderId: draftOrderId,
|
|
1424
|
+
buyerInfo: options?.buyerInfo,
|
|
1425
|
+
});
|
|
1363
1426
|
const reqOpts = ambassadorWixEcomV1DraftOrder.setBuyerInfo(payload);
|
|
1364
1427
|
sideEffects?.onSiteCall?.();
|
|
1365
1428
|
try {
|
|
1366
1429
|
const result = await httpClient.request(reqOpts);
|
|
1367
1430
|
sideEffects?.onSuccess?.(result);
|
|
1431
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1432
|
+
{
|
|
1433
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1434
|
+
paths: [
|
|
1435
|
+
{
|
|
1436
|
+
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1437
|
+
},
|
|
1438
|
+
],
|
|
1439
|
+
},
|
|
1440
|
+
{
|
|
1441
|
+
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1442
|
+
paths: [
|
|
1443
|
+
{
|
|
1444
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1445
|
+
},
|
|
1446
|
+
{
|
|
1447
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1448
|
+
},
|
|
1449
|
+
{
|
|
1450
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1451
|
+
},
|
|
1452
|
+
{
|
|
1453
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1454
|
+
},
|
|
1455
|
+
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1456
|
+
{
|
|
1457
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1458
|
+
},
|
|
1459
|
+
{
|
|
1460
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1461
|
+
},
|
|
1462
|
+
{
|
|
1463
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1464
|
+
},
|
|
1465
|
+
{
|
|
1466
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1467
|
+
},
|
|
1468
|
+
{
|
|
1469
|
+
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1470
|
+
},
|
|
1471
|
+
],
|
|
1472
|
+
},
|
|
1473
|
+
]));
|
|
1368
1474
|
}
|
|
1369
1475
|
catch (err) {
|
|
1370
1476
|
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1371
1477
|
spreadPathsToArguments: {},
|
|
1372
|
-
explicitPathsToArguments: {
|
|
1478
|
+
explicitPathsToArguments: {
|
|
1479
|
+
draftOrderId: '$[0]',
|
|
1480
|
+
buyerInfo: '$[1].buyerInfo',
|
|
1481
|
+
},
|
|
1373
1482
|
singleArgumentUnchanged: false,
|
|
1374
|
-
}, []);
|
|
1483
|
+
}, ['draftOrderId', 'options']);
|
|
1375
1484
|
sideEffects?.onError?.(err);
|
|
1376
1485
|
throw transformedError;
|
|
1377
1486
|
}
|
|
1378
1487
|
}
|
|
1379
1488
|
exports.setBuyerInfo = setBuyerInfo;
|
|
1380
1489
|
/**
|
|
1381
|
-
* Sets recipient info
|
|
1490
|
+
* Sets recipient info on a draft order.
|
|
1491
|
+
* @param draftOrderId - Draft order ID.
|
|
1382
1492
|
* @public
|
|
1383
1493
|
* @documentationMaturity preview
|
|
1494
|
+
* @requiredField draftOrderId
|
|
1384
1495
|
* @permissionId ECOM.DRAFT_ORDER_SET_RECIPIENT_INFO
|
|
1385
1496
|
* @permissionScope Manage Stores - all permissions
|
|
1386
1497
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1388,15 +1499,16 @@ exports.setBuyerInfo = setBuyerInfo;
|
|
|
1388
1499
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1389
1500
|
* @permissionScope Manage eCommerce - all permissions
|
|
1390
1501
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1391
|
-
* @permissionScope Picasso private app mega scope
|
|
1392
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1393
1502
|
* @applicableIdentity APP
|
|
1394
1503
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetRecipientInfo
|
|
1395
1504
|
*/
|
|
1396
|
-
async function setRecipientInfo() {
|
|
1505
|
+
async function setRecipientInfo(draftOrderId, options) {
|
|
1397
1506
|
// @ts-ignore
|
|
1398
|
-
const { httpClient, sideEffects } = arguments[
|
|
1399
|
-
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1507
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1508
|
+
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1509
|
+
draftOrderId: draftOrderId,
|
|
1510
|
+
recipientInfo: options?.recipientInfo,
|
|
1511
|
+
}), [
|
|
1400
1512
|
{
|
|
1401
1513
|
transformFn: address_1.transformSDKAddressToRESTAddress,
|
|
1402
1514
|
paths: [{ path: 'recipientInfo.address' }],
|
|
@@ -1407,22 +1519,70 @@ async function setRecipientInfo() {
|
|
|
1407
1519
|
try {
|
|
1408
1520
|
const result = await httpClient.request(reqOpts);
|
|
1409
1521
|
sideEffects?.onSuccess?.(result);
|
|
1522
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1523
|
+
{
|
|
1524
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1525
|
+
paths: [
|
|
1526
|
+
{
|
|
1527
|
+
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1528
|
+
},
|
|
1529
|
+
],
|
|
1530
|
+
},
|
|
1531
|
+
{
|
|
1532
|
+
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1533
|
+
paths: [
|
|
1534
|
+
{
|
|
1535
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1536
|
+
},
|
|
1537
|
+
{
|
|
1538
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1539
|
+
},
|
|
1540
|
+
{
|
|
1541
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1542
|
+
},
|
|
1543
|
+
{
|
|
1544
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1545
|
+
},
|
|
1546
|
+
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1547
|
+
{
|
|
1548
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1549
|
+
},
|
|
1550
|
+
{
|
|
1551
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1552
|
+
},
|
|
1553
|
+
{
|
|
1554
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1555
|
+
},
|
|
1556
|
+
{
|
|
1557
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1558
|
+
},
|
|
1559
|
+
{
|
|
1560
|
+
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1561
|
+
},
|
|
1562
|
+
],
|
|
1563
|
+
},
|
|
1564
|
+
]));
|
|
1410
1565
|
}
|
|
1411
1566
|
catch (err) {
|
|
1412
1567
|
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1413
1568
|
spreadPathsToArguments: {},
|
|
1414
|
-
explicitPathsToArguments: {
|
|
1569
|
+
explicitPathsToArguments: {
|
|
1570
|
+
draftOrderId: '$[0]',
|
|
1571
|
+
recipientInfo: '$[1].recipientInfo',
|
|
1572
|
+
},
|
|
1415
1573
|
singleArgumentUnchanged: false,
|
|
1416
|
-
}, []);
|
|
1574
|
+
}, ['draftOrderId', 'options']);
|
|
1417
1575
|
sideEffects?.onError?.(err);
|
|
1418
1576
|
throw transformedError;
|
|
1419
1577
|
}
|
|
1420
1578
|
}
|
|
1421
1579
|
exports.setRecipientInfo = setRecipientInfo;
|
|
1422
1580
|
/**
|
|
1423
|
-
* Sets billing info
|
|
1581
|
+
* Sets billing info on a draft order.
|
|
1582
|
+
* @param draftOrderId - Draft order ID.
|
|
1424
1583
|
* @public
|
|
1425
1584
|
* @documentationMaturity preview
|
|
1585
|
+
* @requiredField draftOrderId
|
|
1426
1586
|
* @permissionId ECOM.DRAFT_ORDER_SET_BILLING_INFO
|
|
1427
1587
|
* @permissionScope Manage Stores - all permissions
|
|
1428
1588
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1430,15 +1590,16 @@ exports.setRecipientInfo = setRecipientInfo;
|
|
|
1430
1590
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1431
1591
|
* @permissionScope Manage eCommerce - all permissions
|
|
1432
1592
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1433
|
-
* @permissionScope Picasso private app mega scope
|
|
1434
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1435
1593
|
* @applicableIdentity APP
|
|
1436
1594
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetBillingInfo
|
|
1437
1595
|
*/
|
|
1438
|
-
async function setBillingInfo() {
|
|
1596
|
+
async function setBillingInfo(draftOrderId, options) {
|
|
1439
1597
|
// @ts-ignore
|
|
1440
|
-
const { httpClient, sideEffects } = arguments[
|
|
1441
|
-
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1598
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1599
|
+
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1600
|
+
draftOrderId: draftOrderId,
|
|
1601
|
+
billingInfo: options?.billingInfo,
|
|
1602
|
+
}), [
|
|
1442
1603
|
{
|
|
1443
1604
|
transformFn: address_1.transformSDKAddressToRESTAddress,
|
|
1444
1605
|
paths: [{ path: 'billingInfo.address' }],
|
|
@@ -1449,25 +1610,72 @@ async function setBillingInfo() {
|
|
|
1449
1610
|
try {
|
|
1450
1611
|
const result = await httpClient.request(reqOpts);
|
|
1451
1612
|
sideEffects?.onSuccess?.(result);
|
|
1613
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1614
|
+
{
|
|
1615
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1616
|
+
paths: [
|
|
1617
|
+
{
|
|
1618
|
+
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1619
|
+
},
|
|
1620
|
+
],
|
|
1621
|
+
},
|
|
1622
|
+
{
|
|
1623
|
+
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1624
|
+
paths: [
|
|
1625
|
+
{
|
|
1626
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1627
|
+
},
|
|
1628
|
+
{
|
|
1629
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1630
|
+
},
|
|
1631
|
+
{
|
|
1632
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1633
|
+
},
|
|
1634
|
+
{
|
|
1635
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1636
|
+
},
|
|
1637
|
+
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1638
|
+
{
|
|
1639
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1640
|
+
},
|
|
1641
|
+
{
|
|
1642
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1643
|
+
},
|
|
1644
|
+
{
|
|
1645
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1646
|
+
},
|
|
1647
|
+
{
|
|
1648
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1649
|
+
},
|
|
1650
|
+
{
|
|
1651
|
+
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1652
|
+
},
|
|
1653
|
+
],
|
|
1654
|
+
},
|
|
1655
|
+
]));
|
|
1452
1656
|
}
|
|
1453
1657
|
catch (err) {
|
|
1454
1658
|
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1455
1659
|
spreadPathsToArguments: {},
|
|
1456
|
-
explicitPathsToArguments: {
|
|
1660
|
+
explicitPathsToArguments: {
|
|
1661
|
+
draftOrderId: '$[0]',
|
|
1662
|
+
billingInfo: '$[1].billingInfo',
|
|
1663
|
+
},
|
|
1457
1664
|
singleArgumentUnchanged: false,
|
|
1458
|
-
}, []);
|
|
1665
|
+
}, ['draftOrderId', 'options']);
|
|
1459
1666
|
sideEffects?.onError?.(err);
|
|
1460
1667
|
throw transformedError;
|
|
1461
1668
|
}
|
|
1462
1669
|
}
|
|
1463
1670
|
exports.setBillingInfo = setBillingInfo;
|
|
1464
1671
|
/**
|
|
1465
|
-
*
|
|
1466
|
-
*
|
|
1672
|
+
* Gets a draft order.
|
|
1673
|
+
*
|
|
1674
|
+
* Draft order is recalculated and contains latest tax and totals (unless already committed).
|
|
1467
1675
|
* Automatic discounts and automatic additional fees will reflect the latest prices and eligibility.
|
|
1468
1676
|
* Calculation will be based on current draft order content - items, shipping info and eligible discounts and additional fees.
|
|
1469
|
-
* When
|
|
1470
|
-
* @param draftOrderId -
|
|
1677
|
+
* When retrieving an already committed draft, it's not recalculated and contains data calculated during commit.
|
|
1678
|
+
* @param draftOrderId - Draft order ID.
|
|
1471
1679
|
* @public
|
|
1472
1680
|
* @documentationMaturity preview
|
|
1473
1681
|
* @requiredField draftOrderId
|
|
@@ -1479,8 +1687,6 @@ exports.setBillingInfo = setBillingInfo;
|
|
|
1479
1687
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1480
1688
|
* @permissionScope Manage eCommerce - all permissions
|
|
1481
1689
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1482
|
-
* @permissionScope Picasso private app mega scope
|
|
1483
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1484
1690
|
* @applicableIdentity APP
|
|
1485
1691
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.GetDraftOrder
|
|
1486
1692
|
*/
|
|
@@ -1551,8 +1757,8 @@ async function getDraftOrder(draftOrderId) {
|
|
|
1551
1757
|
}
|
|
1552
1758
|
exports.getDraftOrder = getDraftOrder;
|
|
1553
1759
|
/**
|
|
1554
|
-
* Checks whether a draft can be created for this order
|
|
1555
|
-
* @param orderId - Order
|
|
1760
|
+
* Checks whether a draft can be created for this order.
|
|
1761
|
+
* @param orderId - Order Id.
|
|
1556
1762
|
* @public
|
|
1557
1763
|
* @documentationMaturity preview
|
|
1558
1764
|
* @requiredField orderId
|
|
@@ -1563,8 +1769,6 @@ exports.getDraftOrder = getDraftOrder;
|
|
|
1563
1769
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1564
1770
|
* @permissionScope Manage eCommerce - all permissions
|
|
1565
1771
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1566
|
-
* @permissionScope Picasso private app mega scope
|
|
1567
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1568
1772
|
* @applicableIdentity APP
|
|
1569
1773
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.GetOrderDraftabilityStatus
|
|
1570
1774
|
*/
|
|
@@ -1591,10 +1795,11 @@ async function getOrderDraftabilityStatus(orderId) {
|
|
|
1591
1795
|
}
|
|
1592
1796
|
exports.getOrderDraftabilityStatus = getOrderDraftabilityStatus;
|
|
1593
1797
|
/**
|
|
1594
|
-
* Commit latest changes to the baseline order and control
|
|
1798
|
+
* Commit latest changes to the baseline order and control which side-effects are executed.
|
|
1799
|
+
*
|
|
1595
1800
|
* Commit cannot be undone or reverted.
|
|
1596
|
-
*
|
|
1597
|
-
* @param draftOrderId -
|
|
1801
|
+
* Committed draft will become closed for further modifications, however it's kept for reference and can be retrieved.
|
|
1802
|
+
* @param draftOrderId - Draft order ID.
|
|
1598
1803
|
* @public
|
|
1599
1804
|
* @documentationMaturity preview
|
|
1600
1805
|
* @requiredField draftOrderId
|
|
@@ -1606,8 +1811,6 @@ exports.getOrderDraftabilityStatus = getOrderDraftabilityStatus;
|
|
|
1606
1811
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1607
1812
|
* @permissionScope Manage eCommerce - all permissions
|
|
1608
1813
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1609
|
-
* @permissionScope Picasso private app mega scope
|
|
1610
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1611
1814
|
* @applicableIdentity APP
|
|
1612
1815
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CommitDraftOrder
|
|
1613
1816
|
*/
|
|
@@ -1684,11 +1887,14 @@ async function commitDraftOrder(draftOrderId, options) {
|
|
|
1684
1887
|
}
|
|
1685
1888
|
exports.commitDraftOrder = commitDraftOrder;
|
|
1686
1889
|
/**
|
|
1687
|
-
*
|
|
1890
|
+
* Creates a new order while specifying which side-effects are executed.
|
|
1891
|
+
*
|
|
1688
1892
|
* Commit cannot be undone or reverted.
|
|
1689
|
-
*
|
|
1893
|
+
* Committed draft will become closed for further modifications, however it's kept for reference and can be retrieved.
|
|
1894
|
+
* @param draftOrderId - Draft order ID.
|
|
1690
1895
|
* @public
|
|
1691
1896
|
* @documentationMaturity preview
|
|
1897
|
+
* @requiredField draftOrderId
|
|
1692
1898
|
* @permissionId ECOM.DRAFT_ORDER_CREATE_ORDER_FROM_DRAFT
|
|
1693
1899
|
* @permissionId ECOM.DRAFT_ORDER_READ_ALL_EXTENDED_FIELDS
|
|
1694
1900
|
* @permissionScope Manage Stores - all permissions
|
|
@@ -1697,36 +1903,88 @@ exports.commitDraftOrder = commitDraftOrder;
|
|
|
1697
1903
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1698
1904
|
* @permissionScope Manage eCommerce - all permissions
|
|
1699
1905
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1700
|
-
* @permissionScope Picasso private app mega scope
|
|
1701
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1702
1906
|
* @applicableIdentity APP
|
|
1703
1907
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateOrderFromDraft
|
|
1704
1908
|
*/
|
|
1705
|
-
async function createOrderFromDraft() {
|
|
1909
|
+
async function createOrderFromDraft(draftOrderId, options) {
|
|
1706
1910
|
// @ts-ignore
|
|
1707
|
-
const { httpClient, sideEffects } = arguments[
|
|
1708
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1911
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1912
|
+
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1913
|
+
draftOrderId: draftOrderId,
|
|
1914
|
+
createSettings: options?.createSettings,
|
|
1915
|
+
reason: options?.reason,
|
|
1916
|
+
channelInfo: options?.channelInfo,
|
|
1917
|
+
});
|
|
1709
1918
|
const reqOpts = ambassadorWixEcomV1DraftOrder.createOrderFromDraft(payload);
|
|
1710
1919
|
sideEffects?.onSiteCall?.();
|
|
1711
1920
|
try {
|
|
1712
1921
|
const result = await httpClient.request(reqOpts);
|
|
1713
1922
|
sideEffects?.onSuccess?.(result);
|
|
1923
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1924
|
+
{
|
|
1925
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1926
|
+
paths: [
|
|
1927
|
+
{ path: 'committedDraftOrder.lineItems.lineItem.image' },
|
|
1928
|
+
{ path: 'createdOrder.lineItems.image' },
|
|
1929
|
+
],
|
|
1930
|
+
},
|
|
1931
|
+
{
|
|
1932
|
+
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1933
|
+
paths: [
|
|
1934
|
+
{
|
|
1935
|
+
path: 'committedDraftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1936
|
+
},
|
|
1937
|
+
{
|
|
1938
|
+
path: 'committedDraftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1939
|
+
},
|
|
1940
|
+
{
|
|
1941
|
+
path: 'committedDraftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1942
|
+
},
|
|
1943
|
+
{
|
|
1944
|
+
path: 'committedDraftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1945
|
+
},
|
|
1946
|
+
{ path: 'committedDraftOrder.billingInfo.address' },
|
|
1947
|
+
{
|
|
1948
|
+
path: 'committedDraftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1949
|
+
},
|
|
1950
|
+
{ path: 'committedDraftOrder.recipientInfo.recipientInfo.address' },
|
|
1951
|
+
{
|
|
1952
|
+
path: 'committedDraftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1953
|
+
},
|
|
1954
|
+
{ path: 'committedDraftOrder.billingDetails.billingInfo.address' },
|
|
1955
|
+
{ path: 'createdOrder.billingInfo.address' },
|
|
1956
|
+
{
|
|
1957
|
+
path: 'createdOrder.shippingInfo.logistics.shippingDestination.address',
|
|
1958
|
+
},
|
|
1959
|
+
{
|
|
1960
|
+
path: 'createdOrder.shippingInfo.logistics.pickupDetails.address',
|
|
1961
|
+
},
|
|
1962
|
+
{ path: 'createdOrder.recipientInfo.address' },
|
|
1963
|
+
],
|
|
1964
|
+
},
|
|
1965
|
+
]));
|
|
1714
1966
|
}
|
|
1715
1967
|
catch (err) {
|
|
1716
1968
|
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1717
1969
|
spreadPathsToArguments: {},
|
|
1718
|
-
explicitPathsToArguments: {
|
|
1970
|
+
explicitPathsToArguments: {
|
|
1971
|
+
draftOrderId: '$[0]',
|
|
1972
|
+
createSettings: '$[1].createSettings',
|
|
1973
|
+
reason: '$[1].reason',
|
|
1974
|
+
channelInfo: '$[1].channelInfo',
|
|
1975
|
+
},
|
|
1719
1976
|
singleArgumentUnchanged: false,
|
|
1720
|
-
}, []);
|
|
1977
|
+
}, ['draftOrderId', 'options']);
|
|
1721
1978
|
sideEffects?.onError?.(err);
|
|
1722
1979
|
throw transformedError;
|
|
1723
1980
|
}
|
|
1724
1981
|
}
|
|
1725
1982
|
exports.createOrderFromDraft = createOrderFromDraft;
|
|
1726
1983
|
/**
|
|
1727
|
-
*
|
|
1728
|
-
*
|
|
1729
|
-
*
|
|
1984
|
+
* Deletes a draft order along with all its pending changes.
|
|
1985
|
+
*
|
|
1986
|
+
* Draft orders in status 'COMMITTED' cannot be deleted.
|
|
1987
|
+
* @param draftOrderId - Draft order ID.
|
|
1730
1988
|
* @public
|
|
1731
1989
|
* @documentationMaturity preview
|
|
1732
1990
|
* @requiredField draftOrderId
|
|
@@ -1738,8 +1996,6 @@ exports.createOrderFromDraft = createOrderFromDraft;
|
|
|
1738
1996
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1739
1997
|
* @permissionScope Manage eCommerce - all permissions
|
|
1740
1998
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1741
|
-
* @permissionScope Picasso private app mega scope
|
|
1742
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1743
1999
|
* @applicableIdentity APP
|
|
1744
2000
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.DeleteDraftOrder
|
|
1745
2001
|
*/
|
|
@@ -1785,8 +2041,6 @@ exports.deleteDraftOrder = deleteDraftOrder;
|
|
|
1785
2041
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1786
2042
|
* @permissionScope Manage eCommerce - all permissions
|
|
1787
2043
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1788
|
-
* @permissionScope Picasso private app mega scope
|
|
1789
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1790
2044
|
* @permissionId ECOM.DRAFT_ORDERS_READ
|
|
1791
2045
|
* @applicableIdentity APP
|
|
1792
2046
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.QueryDraftOrders
|
|
@@ -1867,9 +2121,103 @@ function queryDraftOrders() {
|
|
|
1867
2121
|
}
|
|
1868
2122
|
exports.queryDraftOrders = queryDraftOrders;
|
|
1869
2123
|
/**
|
|
1870
|
-
*
|
|
2124
|
+
* Updates extended fields on a draft order.
|
|
2125
|
+
* @param _id - ID of the entity to update.
|
|
2126
|
+
* @param namespace - Identifier for the app whose extended fields are being updated.
|
|
2127
|
+
* @public
|
|
2128
|
+
* @documentationMaturity preview
|
|
2129
|
+
* @requiredField _id
|
|
2130
|
+
* @requiredField namespace
|
|
2131
|
+
* @requiredField options
|
|
2132
|
+
* @requiredField options.namespaceData
|
|
2133
|
+
* @permissionId ECOM.DRAFT_ORDER_UPDATE_EXTENDED_FIELDS
|
|
2134
|
+
* @permissionId ECOM.DRAFT_ORDER_WRITE_ALL_EXTENDED_FIELDS
|
|
2135
|
+
* @permissionScope Manage Stores - all permissions
|
|
2136
|
+
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
2137
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
2138
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
2139
|
+
* @permissionScope Manage eCommerce - all permissions
|
|
2140
|
+
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
2141
|
+
* @permissionScope Manage Stores - all permissions
|
|
2142
|
+
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
2143
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
2144
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
2145
|
+
* @permissionScope Manage eCommerce - all permissions
|
|
2146
|
+
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
2147
|
+
* @permissionScope Manage Orders
|
|
2148
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
2149
|
+
* @applicableIdentity APP
|
|
2150
|
+
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.UpdateExtendedFields
|
|
2151
|
+
*/
|
|
2152
|
+
async function updateExtendedFields(_id, namespace, options) {
|
|
2153
|
+
// @ts-ignore
|
|
2154
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
2155
|
+
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
2156
|
+
id: _id,
|
|
2157
|
+
namespace: namespace,
|
|
2158
|
+
namespaceData: options?.namespaceData,
|
|
2159
|
+
});
|
|
2160
|
+
const reqOpts = ambassadorWixEcomV1DraftOrder.updateExtendedFields(payload);
|
|
2161
|
+
sideEffects?.onSiteCall?.();
|
|
2162
|
+
try {
|
|
2163
|
+
const result = await httpClient.request(reqOpts);
|
|
2164
|
+
sideEffects?.onSuccess?.(result);
|
|
2165
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
2166
|
+
{
|
|
2167
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
2168
|
+
paths: [{ path: 'draftOrder.lineItems.lineItem.image' }],
|
|
2169
|
+
},
|
|
2170
|
+
{
|
|
2171
|
+
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
2172
|
+
paths: [
|
|
2173
|
+
{
|
|
2174
|
+
path: 'draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
2175
|
+
},
|
|
2176
|
+
{
|
|
2177
|
+
path: 'draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
2178
|
+
},
|
|
2179
|
+
{
|
|
2180
|
+
path: 'draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
2181
|
+
},
|
|
2182
|
+
{
|
|
2183
|
+
path: 'draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
2184
|
+
},
|
|
2185
|
+
{ path: 'draftOrder.billingInfo.address' },
|
|
2186
|
+
{
|
|
2187
|
+
path: 'draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
2188
|
+
},
|
|
2189
|
+
{ path: 'draftOrder.recipientInfo.recipientInfo.address' },
|
|
2190
|
+
{
|
|
2191
|
+
path: 'draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
2192
|
+
},
|
|
2193
|
+
{ path: 'draftOrder.billingDetails.billingInfo.address' },
|
|
2194
|
+
],
|
|
2195
|
+
},
|
|
2196
|
+
]));
|
|
2197
|
+
}
|
|
2198
|
+
catch (err) {
|
|
2199
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
2200
|
+
spreadPathsToArguments: {},
|
|
2201
|
+
explicitPathsToArguments: {
|
|
2202
|
+
id: '$[0]',
|
|
2203
|
+
namespace: '$[1]',
|
|
2204
|
+
namespaceData: '$[2].namespaceData',
|
|
2205
|
+
},
|
|
2206
|
+
singleArgumentUnchanged: false,
|
|
2207
|
+
}, ['_id', 'namespace', 'options']);
|
|
2208
|
+
sideEffects?.onError?.(err);
|
|
2209
|
+
throw transformedError;
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
exports.updateExtendedFields = updateExtendedFields;
|
|
2213
|
+
/**
|
|
2214
|
+
* Sets tax exemption on a draft order.
|
|
2215
|
+
* @param draftOrderId - Draft order ID.
|
|
1871
2216
|
* @public
|
|
1872
2217
|
* @documentationMaturity preview
|
|
2218
|
+
* @requiredField draftOrderId
|
|
2219
|
+
* @requiredField options
|
|
2220
|
+
* @requiredField options.taxExempt
|
|
1873
2221
|
* @permissionId ECOM.DRAFT_ORDER_SET_TAX_EXEMPTION
|
|
1874
2222
|
* @permissionScope Manage Stores - all permissions
|
|
1875
2223
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1877,36 +2225,86 @@ exports.queryDraftOrders = queryDraftOrders;
|
|
|
1877
2225
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1878
2226
|
* @permissionScope Manage eCommerce - all permissions
|
|
1879
2227
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1880
|
-
* @permissionScope Picasso private app mega scope
|
|
1881
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1882
2228
|
* @applicableIdentity APP
|
|
1883
2229
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetTaxExemption
|
|
1884
2230
|
*/
|
|
1885
|
-
async function setTaxExemption() {
|
|
2231
|
+
async function setTaxExemption(draftOrderId, options) {
|
|
1886
2232
|
// @ts-ignore
|
|
1887
|
-
const { httpClient, sideEffects } = arguments[
|
|
1888
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
2233
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
2234
|
+
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
2235
|
+
draftOrderId: draftOrderId,
|
|
2236
|
+
taxExempt: options?.taxExempt,
|
|
2237
|
+
});
|
|
1889
2238
|
const reqOpts = ambassadorWixEcomV1DraftOrder.setTaxExemption(payload);
|
|
1890
2239
|
sideEffects?.onSiteCall?.();
|
|
1891
2240
|
try {
|
|
1892
2241
|
const result = await httpClient.request(reqOpts);
|
|
1893
2242
|
sideEffects?.onSuccess?.(result);
|
|
2243
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
2244
|
+
{
|
|
2245
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
2246
|
+
paths: [
|
|
2247
|
+
{
|
|
2248
|
+
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
2249
|
+
},
|
|
2250
|
+
],
|
|
2251
|
+
},
|
|
2252
|
+
{
|
|
2253
|
+
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
2254
|
+
paths: [
|
|
2255
|
+
{
|
|
2256
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
2257
|
+
},
|
|
2258
|
+
{
|
|
2259
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
2260
|
+
},
|
|
2261
|
+
{
|
|
2262
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
2263
|
+
},
|
|
2264
|
+
{
|
|
2265
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
2266
|
+
},
|
|
2267
|
+
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
2268
|
+
{
|
|
2269
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
2270
|
+
},
|
|
2271
|
+
{
|
|
2272
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
2273
|
+
},
|
|
2274
|
+
{
|
|
2275
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
2276
|
+
},
|
|
2277
|
+
{
|
|
2278
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
2279
|
+
},
|
|
2280
|
+
{
|
|
2281
|
+
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
2282
|
+
},
|
|
2283
|
+
],
|
|
2284
|
+
},
|
|
2285
|
+
]));
|
|
1894
2286
|
}
|
|
1895
2287
|
catch (err) {
|
|
1896
2288
|
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1897
2289
|
spreadPathsToArguments: {},
|
|
1898
|
-
explicitPathsToArguments: {
|
|
2290
|
+
explicitPathsToArguments: {
|
|
2291
|
+
draftOrderId: '$[0]',
|
|
2292
|
+
taxExempt: '$[1].taxExempt',
|
|
2293
|
+
},
|
|
1899
2294
|
singleArgumentUnchanged: false,
|
|
1900
|
-
}, []);
|
|
2295
|
+
}, ['draftOrderId', 'options']);
|
|
1901
2296
|
sideEffects?.onError?.(err);
|
|
1902
2297
|
throw transformedError;
|
|
1903
2298
|
}
|
|
1904
2299
|
}
|
|
1905
2300
|
exports.setTaxExemption = setTaxExemption;
|
|
1906
2301
|
/**
|
|
1907
|
-
* Sets business location
|
|
2302
|
+
* Sets business location on a draft order.
|
|
2303
|
+
* @param draftOrderId - Draft order ID.
|
|
1908
2304
|
* @public
|
|
1909
2305
|
* @documentationMaturity preview
|
|
2306
|
+
* @requiredField draftOrderId
|
|
2307
|
+
* @requiredField options.businessLocation._id
|
|
1910
2308
|
* @permissionId ECOM.DRAFT_ORDER_SET_BUSINESS_LOCATION
|
|
1911
2309
|
* @permissionScope Manage Stores - all permissions
|
|
1912
2310
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1914,27 +2312,74 @@ exports.setTaxExemption = setTaxExemption;
|
|
|
1914
2312
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1915
2313
|
* @permissionScope Manage eCommerce - all permissions
|
|
1916
2314
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1917
|
-
* @permissionScope Picasso private app mega scope
|
|
1918
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1919
2315
|
* @applicableIdentity APP
|
|
1920
2316
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetBusinessLocation
|
|
1921
2317
|
*/
|
|
1922
|
-
async function setBusinessLocation() {
|
|
2318
|
+
async function setBusinessLocation(draftOrderId, options) {
|
|
1923
2319
|
// @ts-ignore
|
|
1924
|
-
const { httpClient, sideEffects } = arguments[
|
|
1925
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
2320
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
2321
|
+
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
2322
|
+
draftOrderId: draftOrderId,
|
|
2323
|
+
businessLocation: options?.businessLocation,
|
|
2324
|
+
});
|
|
1926
2325
|
const reqOpts = ambassadorWixEcomV1DraftOrder.setBusinessLocation(payload);
|
|
1927
2326
|
sideEffects?.onSiteCall?.();
|
|
1928
2327
|
try {
|
|
1929
2328
|
const result = await httpClient.request(reqOpts);
|
|
1930
2329
|
sideEffects?.onSuccess?.(result);
|
|
2330
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
2331
|
+
{
|
|
2332
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
2333
|
+
paths: [
|
|
2334
|
+
{
|
|
2335
|
+
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
2336
|
+
},
|
|
2337
|
+
],
|
|
2338
|
+
},
|
|
2339
|
+
{
|
|
2340
|
+
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
2341
|
+
paths: [
|
|
2342
|
+
{
|
|
2343
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
2344
|
+
},
|
|
2345
|
+
{
|
|
2346
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
2347
|
+
},
|
|
2348
|
+
{
|
|
2349
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
2350
|
+
},
|
|
2351
|
+
{
|
|
2352
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
2353
|
+
},
|
|
2354
|
+
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
2355
|
+
{
|
|
2356
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
2357
|
+
},
|
|
2358
|
+
{
|
|
2359
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
2360
|
+
},
|
|
2361
|
+
{
|
|
2362
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
2363
|
+
},
|
|
2364
|
+
{
|
|
2365
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
2366
|
+
},
|
|
2367
|
+
{
|
|
2368
|
+
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
2369
|
+
},
|
|
2370
|
+
],
|
|
2371
|
+
},
|
|
2372
|
+
]));
|
|
1931
2373
|
}
|
|
1932
2374
|
catch (err) {
|
|
1933
2375
|
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1934
2376
|
spreadPathsToArguments: {},
|
|
1935
|
-
explicitPathsToArguments: {
|
|
2377
|
+
explicitPathsToArguments: {
|
|
2378
|
+
draftOrderId: '$[0]',
|
|
2379
|
+
businessLocation: '$[1].businessLocation',
|
|
2380
|
+
},
|
|
1936
2381
|
singleArgumentUnchanged: false,
|
|
1937
|
-
}, []);
|
|
2382
|
+
}, ['draftOrderId', 'options']);
|
|
1938
2383
|
sideEffects?.onError?.(err);
|
|
1939
2384
|
throw transformedError;
|
|
1940
2385
|
}
|