@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
|
@@ -91,11 +91,11 @@ export var PickupDetailsPickupMethod;
|
|
|
91
91
|
})(PickupDetailsPickupMethod || (PickupDetailsPickupMethod = {}));
|
|
92
92
|
export var SourceType;
|
|
93
93
|
(function (SourceType) {
|
|
94
|
-
/** Part of the original order */
|
|
94
|
+
/** Part of the original order. */
|
|
95
95
|
SourceType["ORIGINAL_ORDER"] = "ORIGINAL_ORDER";
|
|
96
|
-
/** Added by
|
|
96
|
+
/** Added automatically, as the result of recalculation caused by changes in draft order. */
|
|
97
97
|
SourceType["AUTOMATIC"] = "AUTOMATIC";
|
|
98
|
-
/** Added manually to
|
|
98
|
+
/** Added manually to draft order. */
|
|
99
99
|
SourceType["CUSTOM"] = "CUSTOM";
|
|
100
100
|
})(SourceType || (SourceType = {}));
|
|
101
101
|
export var AppliedDiscountDiscountType;
|
|
@@ -112,9 +112,9 @@ export var DiscountReason;
|
|
|
112
112
|
})(DiscountReason || (DiscountReason = {}));
|
|
113
113
|
export var EditingStatus;
|
|
114
114
|
(function (EditingStatus) {
|
|
115
|
-
/**
|
|
115
|
+
/** Draft order can be modified and committed. */
|
|
116
116
|
EditingStatus["DRAFT"] = "DRAFT";
|
|
117
|
-
/**
|
|
117
|
+
/** Draft order is already committed. No further modifications allowed. */
|
|
118
118
|
EditingStatus["COMMITTED"] = "COMMITTED";
|
|
119
119
|
})(EditingStatus || (EditingStatus = {}));
|
|
120
120
|
export var WeightUnit;
|
|
@@ -129,7 +129,9 @@ export var WeightUnit;
|
|
|
129
129
|
export var PickupMethod;
|
|
130
130
|
(function (PickupMethod) {
|
|
131
131
|
PickupMethod["UNKNOWN_METHOD"] = "UNKNOWN_METHOD";
|
|
132
|
+
/** Pickup is from the merchant's brick and mortar store. */
|
|
132
133
|
PickupMethod["STORE_PICKUP"] = "STORE_PICKUP";
|
|
134
|
+
/** Item is shipped to a specified pickup point. */
|
|
133
135
|
PickupMethod["PICKUP_POINT"] = "PICKUP_POINT";
|
|
134
136
|
})(PickupMethod || (PickupMethod = {}));
|
|
135
137
|
export var RuleType;
|
|
@@ -168,24 +170,36 @@ export var FileType;
|
|
|
168
170
|
export var DiscountType;
|
|
169
171
|
(function (DiscountType) {
|
|
170
172
|
DiscountType["UNKNOWN_TYPE"] = "UNKNOWN_TYPE";
|
|
173
|
+
/** Discount applies to entire order. */
|
|
171
174
|
DiscountType["GLOBAL"] = "GLOBAL";
|
|
175
|
+
/** Discount applies to specific items. */
|
|
172
176
|
DiscountType["SPECIFIC_ITEMS"] = "SPECIFIC_ITEMS";
|
|
177
|
+
/** Discount applies to shipping. For example, free shipping. */
|
|
173
178
|
DiscountType["SHIPPING"] = "SHIPPING";
|
|
174
179
|
})(DiscountType || (DiscountType = {}));
|
|
175
180
|
export var NonDraftableReason;
|
|
176
181
|
(function (NonDraftableReason) {
|
|
177
182
|
NonDraftableReason["UNSPECIFIED"] = "UNSPECIFIED";
|
|
183
|
+
/** Modifications of refunded orders are not supported. */
|
|
178
184
|
NonDraftableReason["PARTIALLY_OR_FULLY_REFUNDED"] = "PARTIALLY_OR_FULLY_REFUNDED";
|
|
185
|
+
/**
|
|
186
|
+
* Original order must be created via one of the following channel types:
|
|
187
|
+
* + WEB
|
|
188
|
+
* + POS
|
|
189
|
+
* + BACKOFFICE_MERCHANT
|
|
190
|
+
* + WIX_APP_STORE
|
|
191
|
+
*/
|
|
179
192
|
NonDraftableReason["UNSUPPORTED_CHANNEL_TYPE"] = "UNSUPPORTED_CHANNEL_TYPE";
|
|
193
|
+
/** Order status is not APPROVED. */
|
|
180
194
|
NonDraftableReason["ORDER_STATUS_IS_NOT_SUPPORTED"] = "ORDER_STATUS_IS_NOT_SUPPORTED";
|
|
195
|
+
/** Site and order currencies are different. */
|
|
181
196
|
NonDraftableReason["ORDER_AND_SITE_CURRENCIES_ARE_INCONSISTENT"] = "ORDER_AND_SITE_CURRENCIES_ARE_INCONSISTENT";
|
|
197
|
+
/** Site and order weight units are different. */
|
|
182
198
|
NonDraftableReason["ORDER_AND_SITE_WEIGHT_UNITS_ARE_INCONSISTENT"] = "ORDER_AND_SITE_WEIGHT_UNITS_ARE_INCONSISTENT";
|
|
183
|
-
|
|
184
|
-
/** remove - this is not a reason, it's an error */
|
|
199
|
+
/** Order not found. */
|
|
185
200
|
NonDraftableReason["ORDER_NOT_FOUND"] = "ORDER_NOT_FOUND";
|
|
201
|
+
/** Modifications of orders with subscription items are not supported. */
|
|
186
202
|
NonDraftableReason["SUBSCRIPTION_LINE_ITEM_EXISTS"] = "SUBSCRIPTION_LINE_ITEM_EXISTS";
|
|
187
|
-
NonDraftableReason["UNSUPPORTED_CATALOG_ITEM"] = "UNSUPPORTED_CATALOG_ITEM";
|
|
188
|
-
NonDraftableReason["TAXABLE_EXISTING_ADDITIONAL_FEE"] = "TAXABLE_EXISTING_ADDITIONAL_FEE";
|
|
189
203
|
})(NonDraftableReason || (NonDraftableReason = {}));
|
|
190
204
|
export var PaymentStatus;
|
|
191
205
|
(function (PaymentStatus) {
|
|
@@ -369,8 +383,8 @@ export var WebhookIdentityType;
|
|
|
369
383
|
* Creates or gets a draft order.
|
|
370
384
|
*
|
|
371
385
|
* When passing the ID of an order that is already in draft, the existing draft order will be returned.
|
|
372
|
-
* To complete a draft and update the order, call
|
|
373
|
-
* @param orderId -
|
|
386
|
+
* 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)).
|
|
387
|
+
* @param orderId - Existing order ID to create draft from.
|
|
374
388
|
* @public
|
|
375
389
|
* @documentationMaturity preview
|
|
376
390
|
* @requiredField orderId
|
|
@@ -383,8 +397,6 @@ export var WebhookIdentityType;
|
|
|
383
397
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
384
398
|
* @permissionScope Manage eCommerce - all permissions
|
|
385
399
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
386
|
-
* @permissionScope Picasso private app mega scope
|
|
387
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
388
400
|
* @applicableIdentity APP
|
|
389
401
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateDraftOrder
|
|
390
402
|
*/
|
|
@@ -464,8 +476,6 @@ export async function createDraftOrder(orderId) {
|
|
|
464
476
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
465
477
|
* @permissionScope Manage eCommerce - all permissions
|
|
466
478
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
467
|
-
* @permissionScope Picasso private app mega scope
|
|
468
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
469
479
|
* @applicableIdentity APP
|
|
470
480
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateEmptyDraftOrder
|
|
471
481
|
*/
|
|
@@ -534,7 +544,7 @@ export async function createEmptyDraftOrder() {
|
|
|
534
544
|
}
|
|
535
545
|
/**
|
|
536
546
|
* Adds line items to a draft order.
|
|
537
|
-
* @param draftOrderId -
|
|
547
|
+
* @param draftOrderId - Draft order ID.
|
|
538
548
|
* @public
|
|
539
549
|
* @documentationMaturity preview
|
|
540
550
|
* @requiredField draftOrderId
|
|
@@ -546,8 +556,6 @@ export async function createEmptyDraftOrder() {
|
|
|
546
556
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
547
557
|
* @permissionScope Manage eCommerce - all permissions
|
|
548
558
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
549
|
-
* @permissionScope Picasso private app mega scope
|
|
550
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
551
559
|
* @applicableIdentity APP
|
|
552
560
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.AddLineItemsToDraftOrder
|
|
553
561
|
*/
|
|
@@ -639,10 +647,13 @@ export async function addLineItemsToDraftOrder(draftOrderId, options) {
|
|
|
639
647
|
* > + Passing a quantity of `0` will remove the line item.
|
|
640
648
|
* > + Price cannot be updated for line items with `paymentOption: MEMBERSHIP`.
|
|
641
649
|
* > + 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).
|
|
642
|
-
* @param draftOrderId -
|
|
650
|
+
* @param draftOrderId - Draft order ID.
|
|
651
|
+
* @param lineItemChanges - Details of changes to apply per line item.
|
|
643
652
|
* @public
|
|
644
653
|
* @documentationMaturity preview
|
|
645
654
|
* @requiredField draftOrderId
|
|
655
|
+
* @requiredField lineItemChanges
|
|
656
|
+
* @requiredField lineItemChanges.lineItemId
|
|
646
657
|
* @permissionId ECOM.DRAFT_ORDERS_MODIFY_ITEMS
|
|
647
658
|
* @permissionScope Manage Stores - all permissions
|
|
648
659
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -650,17 +661,15 @@ export async function addLineItemsToDraftOrder(draftOrderId, options) {
|
|
|
650
661
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
651
662
|
* @permissionScope Manage eCommerce - all permissions
|
|
652
663
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
653
|
-
* @permissionScope Picasso private app mega scope
|
|
654
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
655
664
|
* @applicableIdentity APP
|
|
656
665
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.UpdateLineItems
|
|
657
666
|
*/
|
|
658
|
-
export async function updateLineItems(draftOrderId,
|
|
667
|
+
export async function updateLineItems(draftOrderId, lineItemChanges) {
|
|
659
668
|
// @ts-ignore
|
|
660
669
|
const { httpClient, sideEffects } = arguments[2];
|
|
661
670
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
662
671
|
draftOrderId: draftOrderId,
|
|
663
|
-
lineItemChanges:
|
|
672
|
+
lineItemChanges: lineItemChanges,
|
|
664
673
|
});
|
|
665
674
|
const reqOpts = ambassadorWixEcomV1DraftOrder.updateLineItems(payload);
|
|
666
675
|
sideEffects?.onSiteCall?.();
|
|
@@ -716,23 +725,27 @@ export async function updateLineItems(draftOrderId, options) {
|
|
|
716
725
|
spreadPathsToArguments: {},
|
|
717
726
|
explicitPathsToArguments: {
|
|
718
727
|
draftOrderId: '$[0]',
|
|
719
|
-
lineItemChanges: '$[1]
|
|
728
|
+
lineItemChanges: '$[1]',
|
|
720
729
|
},
|
|
721
730
|
singleArgumentUnchanged: false,
|
|
722
|
-
}, ['draftOrderId', '
|
|
731
|
+
}, ['draftOrderId', 'lineItemChanges']);
|
|
723
732
|
sideEffects?.onError?.(err);
|
|
724
733
|
throw transformedError;
|
|
725
734
|
}
|
|
726
735
|
}
|
|
727
736
|
/**
|
|
728
|
-
*
|
|
737
|
+
* Applies or unapplies discounts on a draft order.
|
|
729
738
|
*
|
|
730
|
-
*
|
|
731
|
-
*
|
|
732
|
-
* @param
|
|
739
|
+
* Unapplied discounts are still part of draft order, but do not affect balance.
|
|
740
|
+
* Existing discounts, not mentioned in request, will keep their current state.
|
|
741
|
+
* @param draftOrderId - Draft order ID.
|
|
742
|
+
* @param discounts - Discount IDs to apply/unapply.
|
|
743
|
+
* Existing discounts, not mentioned in request, will keep their current state.
|
|
733
744
|
* @public
|
|
734
745
|
* @documentationMaturity preview
|
|
735
746
|
* @requiredField discounts
|
|
747
|
+
* @requiredField discounts._id
|
|
748
|
+
* @requiredField discounts.applied
|
|
736
749
|
* @requiredField draftOrderId
|
|
737
750
|
* @permissionId ECOM.DRAFT_ORDERS_SET_DISCOUNTS
|
|
738
751
|
* @permissionScope Manage Stores - all permissions
|
|
@@ -741,8 +754,6 @@ export async function updateLineItems(draftOrderId, options) {
|
|
|
741
754
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
742
755
|
* @permissionScope Manage eCommerce - all permissions
|
|
743
756
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
744
|
-
* @permissionScope Picasso private app mega scope
|
|
745
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
746
757
|
* @applicableIdentity APP
|
|
747
758
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetDiscounts
|
|
748
759
|
*/
|
|
@@ -813,14 +824,17 @@ export async function setDiscounts(draftOrderId, discounts) {
|
|
|
813
824
|
}
|
|
814
825
|
}
|
|
815
826
|
/**
|
|
816
|
-
*
|
|
817
|
-
*
|
|
827
|
+
* Create custom discounts on a draft order.
|
|
828
|
+
*
|
|
829
|
+
* Newly added discounts are unapplied by default.
|
|
830
|
+
* 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)).
|
|
831
|
+
* @param draftOrderId - Draft order ID.
|
|
818
832
|
* @public
|
|
819
833
|
* @documentationMaturity preview
|
|
820
834
|
* @requiredField draftOrderId
|
|
821
|
-
* @requiredField options.discounts.amount
|
|
822
835
|
* @requiredField options.discounts.amount.amount
|
|
823
836
|
* @requiredField options.discounts.discountType
|
|
837
|
+
* @requiredField options.discounts.priceAmount.amount
|
|
824
838
|
* @permissionId ECOM.DRAFT_ORDERS_ADD_DISCOUNTS
|
|
825
839
|
* @permissionScope Manage Stores - all permissions
|
|
826
840
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -828,8 +842,6 @@ export async function setDiscounts(draftOrderId, discounts) {
|
|
|
828
842
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
829
843
|
* @permissionScope Manage eCommerce - all permissions
|
|
830
844
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
831
|
-
* @permissionScope Picasso private app mega scope
|
|
832
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
833
845
|
* @applicableIdentity APP
|
|
834
846
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateCustomDiscounts
|
|
835
847
|
*/
|
|
@@ -904,8 +916,8 @@ export async function createCustomDiscounts(draftOrderId, options) {
|
|
|
904
916
|
}
|
|
905
917
|
/**
|
|
906
918
|
* Remove custom discounts from the order.
|
|
907
|
-
* @param draftOrderId -
|
|
908
|
-
* @param discountIds -
|
|
919
|
+
* @param draftOrderId - Draft order ID.
|
|
920
|
+
* @param discountIds - Ids of discounts to remove.
|
|
909
921
|
* @public
|
|
910
922
|
* @documentationMaturity preview
|
|
911
923
|
* @requiredField discountIds
|
|
@@ -917,8 +929,6 @@ export async function createCustomDiscounts(draftOrderId, options) {
|
|
|
917
929
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
918
930
|
* @permissionScope Manage eCommerce - all permissions
|
|
919
931
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
920
|
-
* @permissionScope Picasso private app mega scope
|
|
921
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
922
932
|
* @applicableIdentity APP
|
|
923
933
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.DeleteCustomDiscounts
|
|
924
934
|
*/
|
|
@@ -989,13 +999,18 @@ export async function deleteCustomDiscounts(draftOrderId, discountIds) {
|
|
|
989
999
|
}
|
|
990
1000
|
}
|
|
991
1001
|
/**
|
|
992
|
-
*
|
|
993
|
-
*
|
|
994
|
-
*
|
|
995
|
-
*
|
|
1002
|
+
* Applies or unapplies additional fees on a draft order.
|
|
1003
|
+
*
|
|
1004
|
+
* Unapplied fees are still part of draft order, but do not affect balance.
|
|
1005
|
+
* Existing additional fees, not mentioned in request, will keep their current state.
|
|
1006
|
+
* @param draftOrderId - Draft order ID.
|
|
1007
|
+
* @param additionalFees - Additional fee IDs to apply/unapply.
|
|
1008
|
+
* Existing additional fees, not mentioned in this list, will keep their current state.
|
|
996
1009
|
* @public
|
|
997
1010
|
* @documentationMaturity preview
|
|
998
1011
|
* @requiredField additionalFees
|
|
1012
|
+
* @requiredField additionalFees._id
|
|
1013
|
+
* @requiredField additionalFees.applied
|
|
999
1014
|
* @requiredField draftOrderId
|
|
1000
1015
|
* @permissionId ECOM.DRAFT_ORDERS_SET_ADDITIONAL_FEES
|
|
1001
1016
|
* @permissionScope Manage Stores - all permissions
|
|
@@ -1004,8 +1019,6 @@ export async function deleteCustomDiscounts(draftOrderId, discountIds) {
|
|
|
1004
1019
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1005
1020
|
* @permissionScope Manage eCommerce - all permissions
|
|
1006
1021
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1007
|
-
* @permissionScope Picasso private app mega scope
|
|
1008
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1009
1022
|
* @applicableIdentity APP
|
|
1010
1023
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetAdditionalFees
|
|
1011
1024
|
*/
|
|
@@ -1079,10 +1092,11 @@ export async function setAdditionalFees(draftOrderId, additionalFees) {
|
|
|
1079
1092
|
}
|
|
1080
1093
|
}
|
|
1081
1094
|
/**
|
|
1082
|
-
*
|
|
1083
|
-
*
|
|
1084
|
-
*
|
|
1085
|
-
*
|
|
1095
|
+
* Creates custom additional fees on a draft order.
|
|
1096
|
+
*
|
|
1097
|
+
* Newly added additional fees are unapplied by default.
|
|
1098
|
+
* 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)).
|
|
1099
|
+
* @param draftOrderId - Draft order ID.
|
|
1086
1100
|
* @public
|
|
1087
1101
|
* @documentationMaturity preview
|
|
1088
1102
|
* @requiredField draftOrderId
|
|
@@ -1096,8 +1110,6 @@ export async function setAdditionalFees(draftOrderId, additionalFees) {
|
|
|
1096
1110
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1097
1111
|
* @permissionScope Manage eCommerce - all permissions
|
|
1098
1112
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1099
|
-
* @permissionScope Picasso private app mega scope
|
|
1100
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1101
1113
|
* @applicableIdentity APP
|
|
1102
1114
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateCustomAdditionalFees
|
|
1103
1115
|
*/
|
|
@@ -1172,8 +1184,8 @@ export async function createCustomAdditionalFees(draftOrderId, options) {
|
|
|
1172
1184
|
}
|
|
1173
1185
|
/**
|
|
1174
1186
|
* Remove custom additional fees from the order.
|
|
1175
|
-
* @param draftOrderId -
|
|
1176
|
-
* @param customAdditionalFees -
|
|
1187
|
+
* @param draftOrderId - Draft order ID.
|
|
1188
|
+
* @param customAdditionalFees - Ids of additional fees to remove.
|
|
1177
1189
|
* @public
|
|
1178
1190
|
* @documentationMaturity preview
|
|
1179
1191
|
* @requiredField customAdditionalFees
|
|
@@ -1185,8 +1197,6 @@ export async function createCustomAdditionalFees(draftOrderId, options) {
|
|
|
1185
1197
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1186
1198
|
* @permissionScope Manage eCommerce - all permissions
|
|
1187
1199
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1188
|
-
* @permissionScope Picasso private app mega scope
|
|
1189
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1190
1200
|
* @applicableIdentity APP
|
|
1191
1201
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.DeleteCustomAdditionalFees
|
|
1192
1202
|
*/
|
|
@@ -1260,9 +1270,11 @@ export async function deleteCustomAdditionalFees(draftOrderId, customAdditionalF
|
|
|
1260
1270
|
}
|
|
1261
1271
|
}
|
|
1262
1272
|
/**
|
|
1263
|
-
* Sets shipping
|
|
1273
|
+
* Sets shipping information on a draft order.
|
|
1274
|
+
* @param draftOrderId - Draft order ID.
|
|
1264
1275
|
* @public
|
|
1265
1276
|
* @documentationMaturity preview
|
|
1277
|
+
* @requiredField draftOrderId
|
|
1266
1278
|
* @permissionId ECOM.DRAFT_ORDERS_SET_SHIPPING_INFO
|
|
1267
1279
|
* @permissionScope Manage Stores - all permissions
|
|
1268
1280
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1270,15 +1282,16 @@ export async function deleteCustomAdditionalFees(draftOrderId, customAdditionalF
|
|
|
1270
1282
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1271
1283
|
* @permissionScope Manage eCommerce - all permissions
|
|
1272
1284
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1273
|
-
* @permissionScope Picasso private app mega scope
|
|
1274
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1275
1285
|
* @applicableIdentity APP
|
|
1276
1286
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetShippingInfo
|
|
1277
1287
|
*/
|
|
1278
|
-
export async function setShippingInfo() {
|
|
1288
|
+
export async function setShippingInfo(draftOrderId, options) {
|
|
1279
1289
|
// @ts-ignore
|
|
1280
|
-
const { httpClient, sideEffects } = arguments[
|
|
1281
|
-
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
1290
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1291
|
+
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
1292
|
+
draftOrderId: draftOrderId,
|
|
1293
|
+
shippingInfo: options?.shippingInfo,
|
|
1294
|
+
}), [
|
|
1282
1295
|
{
|
|
1283
1296
|
transformFn: transformSDKAddressToRESTAddress,
|
|
1284
1297
|
paths: [
|
|
@@ -1292,21 +1305,69 @@ export async function setShippingInfo() {
|
|
|
1292
1305
|
try {
|
|
1293
1306
|
const result = await httpClient.request(reqOpts);
|
|
1294
1307
|
sideEffects?.onSuccess?.(result);
|
|
1308
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1309
|
+
{
|
|
1310
|
+
transformFn: transformRESTImageToSDKImage,
|
|
1311
|
+
paths: [
|
|
1312
|
+
{
|
|
1313
|
+
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1314
|
+
},
|
|
1315
|
+
],
|
|
1316
|
+
},
|
|
1317
|
+
{
|
|
1318
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
1319
|
+
paths: [
|
|
1320
|
+
{
|
|
1321
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1322
|
+
},
|
|
1323
|
+
{
|
|
1324
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1325
|
+
},
|
|
1326
|
+
{
|
|
1327
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1328
|
+
},
|
|
1329
|
+
{
|
|
1330
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1331
|
+
},
|
|
1332
|
+
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1333
|
+
{
|
|
1334
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1335
|
+
},
|
|
1336
|
+
{
|
|
1337
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1338
|
+
},
|
|
1339
|
+
{
|
|
1340
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1341
|
+
},
|
|
1342
|
+
{
|
|
1343
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1344
|
+
},
|
|
1345
|
+
{
|
|
1346
|
+
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1347
|
+
},
|
|
1348
|
+
],
|
|
1349
|
+
},
|
|
1350
|
+
]));
|
|
1295
1351
|
}
|
|
1296
1352
|
catch (err) {
|
|
1297
1353
|
const transformedError = sdkTransformError(err, {
|
|
1298
1354
|
spreadPathsToArguments: {},
|
|
1299
|
-
explicitPathsToArguments: {
|
|
1355
|
+
explicitPathsToArguments: {
|
|
1356
|
+
draftOrderId: '$[0]',
|
|
1357
|
+
shippingInfo: '$[1].shippingInfo',
|
|
1358
|
+
},
|
|
1300
1359
|
singleArgumentUnchanged: false,
|
|
1301
|
-
}, []);
|
|
1360
|
+
}, ['draftOrderId', 'options']);
|
|
1302
1361
|
sideEffects?.onError?.(err);
|
|
1303
1362
|
throw transformedError;
|
|
1304
1363
|
}
|
|
1305
1364
|
}
|
|
1306
1365
|
/**
|
|
1307
|
-
* Sets buyer info
|
|
1366
|
+
* Sets buyer info on a draft order.
|
|
1367
|
+
* @param draftOrderId - Draft order ID.
|
|
1308
1368
|
* @public
|
|
1309
1369
|
* @documentationMaturity preview
|
|
1370
|
+
* @requiredField draftOrderId
|
|
1310
1371
|
* @permissionId ECOM.DRAFT_ORDER_SET_BUYER_INFO
|
|
1311
1372
|
* @permissionScope Manage Stores - all permissions
|
|
1312
1373
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1314,35 +1375,84 @@ export async function setShippingInfo() {
|
|
|
1314
1375
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1315
1376
|
* @permissionScope Manage eCommerce - all permissions
|
|
1316
1377
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1317
|
-
* @permissionScope Picasso private app mega scope
|
|
1318
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1319
1378
|
* @applicableIdentity APP
|
|
1320
1379
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetBuyerInfo
|
|
1321
1380
|
*/
|
|
1322
|
-
export async function setBuyerInfo() {
|
|
1381
|
+
export async function setBuyerInfo(draftOrderId, options) {
|
|
1323
1382
|
// @ts-ignore
|
|
1324
|
-
const { httpClient, sideEffects } = arguments[
|
|
1325
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1383
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1384
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1385
|
+
draftOrderId: draftOrderId,
|
|
1386
|
+
buyerInfo: options?.buyerInfo,
|
|
1387
|
+
});
|
|
1326
1388
|
const reqOpts = ambassadorWixEcomV1DraftOrder.setBuyerInfo(payload);
|
|
1327
1389
|
sideEffects?.onSiteCall?.();
|
|
1328
1390
|
try {
|
|
1329
1391
|
const result = await httpClient.request(reqOpts);
|
|
1330
1392
|
sideEffects?.onSuccess?.(result);
|
|
1393
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1394
|
+
{
|
|
1395
|
+
transformFn: transformRESTImageToSDKImage,
|
|
1396
|
+
paths: [
|
|
1397
|
+
{
|
|
1398
|
+
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1399
|
+
},
|
|
1400
|
+
],
|
|
1401
|
+
},
|
|
1402
|
+
{
|
|
1403
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
1404
|
+
paths: [
|
|
1405
|
+
{
|
|
1406
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1407
|
+
},
|
|
1408
|
+
{
|
|
1409
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1410
|
+
},
|
|
1411
|
+
{
|
|
1412
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1413
|
+
},
|
|
1414
|
+
{
|
|
1415
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1416
|
+
},
|
|
1417
|
+
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1418
|
+
{
|
|
1419
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1420
|
+
},
|
|
1421
|
+
{
|
|
1422
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1423
|
+
},
|
|
1424
|
+
{
|
|
1425
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1426
|
+
},
|
|
1427
|
+
{
|
|
1428
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1429
|
+
},
|
|
1430
|
+
{
|
|
1431
|
+
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1432
|
+
},
|
|
1433
|
+
],
|
|
1434
|
+
},
|
|
1435
|
+
]));
|
|
1331
1436
|
}
|
|
1332
1437
|
catch (err) {
|
|
1333
1438
|
const transformedError = sdkTransformError(err, {
|
|
1334
1439
|
spreadPathsToArguments: {},
|
|
1335
|
-
explicitPathsToArguments: {
|
|
1440
|
+
explicitPathsToArguments: {
|
|
1441
|
+
draftOrderId: '$[0]',
|
|
1442
|
+
buyerInfo: '$[1].buyerInfo',
|
|
1443
|
+
},
|
|
1336
1444
|
singleArgumentUnchanged: false,
|
|
1337
|
-
}, []);
|
|
1445
|
+
}, ['draftOrderId', 'options']);
|
|
1338
1446
|
sideEffects?.onError?.(err);
|
|
1339
1447
|
throw transformedError;
|
|
1340
1448
|
}
|
|
1341
1449
|
}
|
|
1342
1450
|
/**
|
|
1343
|
-
* Sets recipient info
|
|
1451
|
+
* Sets recipient info on a draft order.
|
|
1452
|
+
* @param draftOrderId - Draft order ID.
|
|
1344
1453
|
* @public
|
|
1345
1454
|
* @documentationMaturity preview
|
|
1455
|
+
* @requiredField draftOrderId
|
|
1346
1456
|
* @permissionId ECOM.DRAFT_ORDER_SET_RECIPIENT_INFO
|
|
1347
1457
|
* @permissionScope Manage Stores - all permissions
|
|
1348
1458
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1350,15 +1460,16 @@ export async function setBuyerInfo() {
|
|
|
1350
1460
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1351
1461
|
* @permissionScope Manage eCommerce - all permissions
|
|
1352
1462
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1353
|
-
* @permissionScope Picasso private app mega scope
|
|
1354
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1355
1463
|
* @applicableIdentity APP
|
|
1356
1464
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetRecipientInfo
|
|
1357
1465
|
*/
|
|
1358
|
-
export async function setRecipientInfo() {
|
|
1466
|
+
export async function setRecipientInfo(draftOrderId, options) {
|
|
1359
1467
|
// @ts-ignore
|
|
1360
|
-
const { httpClient, sideEffects } = arguments[
|
|
1361
|
-
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
1468
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1469
|
+
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
1470
|
+
draftOrderId: draftOrderId,
|
|
1471
|
+
recipientInfo: options?.recipientInfo,
|
|
1472
|
+
}), [
|
|
1362
1473
|
{
|
|
1363
1474
|
transformFn: transformSDKAddressToRESTAddress,
|
|
1364
1475
|
paths: [{ path: 'recipientInfo.address' }],
|
|
@@ -1369,21 +1480,69 @@ export async function setRecipientInfo() {
|
|
|
1369
1480
|
try {
|
|
1370
1481
|
const result = await httpClient.request(reqOpts);
|
|
1371
1482
|
sideEffects?.onSuccess?.(result);
|
|
1483
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1484
|
+
{
|
|
1485
|
+
transformFn: transformRESTImageToSDKImage,
|
|
1486
|
+
paths: [
|
|
1487
|
+
{
|
|
1488
|
+
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1489
|
+
},
|
|
1490
|
+
],
|
|
1491
|
+
},
|
|
1492
|
+
{
|
|
1493
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
1494
|
+
paths: [
|
|
1495
|
+
{
|
|
1496
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1497
|
+
},
|
|
1498
|
+
{
|
|
1499
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1500
|
+
},
|
|
1501
|
+
{
|
|
1502
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1503
|
+
},
|
|
1504
|
+
{
|
|
1505
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1506
|
+
},
|
|
1507
|
+
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1508
|
+
{
|
|
1509
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1510
|
+
},
|
|
1511
|
+
{
|
|
1512
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1513
|
+
},
|
|
1514
|
+
{
|
|
1515
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1516
|
+
},
|
|
1517
|
+
{
|
|
1518
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1519
|
+
},
|
|
1520
|
+
{
|
|
1521
|
+
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1522
|
+
},
|
|
1523
|
+
],
|
|
1524
|
+
},
|
|
1525
|
+
]));
|
|
1372
1526
|
}
|
|
1373
1527
|
catch (err) {
|
|
1374
1528
|
const transformedError = sdkTransformError(err, {
|
|
1375
1529
|
spreadPathsToArguments: {},
|
|
1376
|
-
explicitPathsToArguments: {
|
|
1530
|
+
explicitPathsToArguments: {
|
|
1531
|
+
draftOrderId: '$[0]',
|
|
1532
|
+
recipientInfo: '$[1].recipientInfo',
|
|
1533
|
+
},
|
|
1377
1534
|
singleArgumentUnchanged: false,
|
|
1378
|
-
}, []);
|
|
1535
|
+
}, ['draftOrderId', 'options']);
|
|
1379
1536
|
sideEffects?.onError?.(err);
|
|
1380
1537
|
throw transformedError;
|
|
1381
1538
|
}
|
|
1382
1539
|
}
|
|
1383
1540
|
/**
|
|
1384
|
-
* Sets billing info
|
|
1541
|
+
* Sets billing info on a draft order.
|
|
1542
|
+
* @param draftOrderId - Draft order ID.
|
|
1385
1543
|
* @public
|
|
1386
1544
|
* @documentationMaturity preview
|
|
1545
|
+
* @requiredField draftOrderId
|
|
1387
1546
|
* @permissionId ECOM.DRAFT_ORDER_SET_BILLING_INFO
|
|
1388
1547
|
* @permissionScope Manage Stores - all permissions
|
|
1389
1548
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1391,15 +1550,16 @@ export async function setRecipientInfo() {
|
|
|
1391
1550
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1392
1551
|
* @permissionScope Manage eCommerce - all permissions
|
|
1393
1552
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1394
|
-
* @permissionScope Picasso private app mega scope
|
|
1395
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1396
1553
|
* @applicableIdentity APP
|
|
1397
1554
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetBillingInfo
|
|
1398
1555
|
*/
|
|
1399
|
-
export async function setBillingInfo() {
|
|
1556
|
+
export async function setBillingInfo(draftOrderId, options) {
|
|
1400
1557
|
// @ts-ignore
|
|
1401
|
-
const { httpClient, sideEffects } = arguments[
|
|
1402
|
-
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
1558
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1559
|
+
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
1560
|
+
draftOrderId: draftOrderId,
|
|
1561
|
+
billingInfo: options?.billingInfo,
|
|
1562
|
+
}), [
|
|
1403
1563
|
{
|
|
1404
1564
|
transformFn: transformSDKAddressToRESTAddress,
|
|
1405
1565
|
paths: [{ path: 'billingInfo.address' }],
|
|
@@ -1410,24 +1570,71 @@ export async function setBillingInfo() {
|
|
|
1410
1570
|
try {
|
|
1411
1571
|
const result = await httpClient.request(reqOpts);
|
|
1412
1572
|
sideEffects?.onSuccess?.(result);
|
|
1573
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1574
|
+
{
|
|
1575
|
+
transformFn: transformRESTImageToSDKImage,
|
|
1576
|
+
paths: [
|
|
1577
|
+
{
|
|
1578
|
+
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1579
|
+
},
|
|
1580
|
+
],
|
|
1581
|
+
},
|
|
1582
|
+
{
|
|
1583
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
1584
|
+
paths: [
|
|
1585
|
+
{
|
|
1586
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1587
|
+
},
|
|
1588
|
+
{
|
|
1589
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1590
|
+
},
|
|
1591
|
+
{
|
|
1592
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1593
|
+
},
|
|
1594
|
+
{
|
|
1595
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1596
|
+
},
|
|
1597
|
+
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1598
|
+
{
|
|
1599
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1600
|
+
},
|
|
1601
|
+
{
|
|
1602
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1603
|
+
},
|
|
1604
|
+
{
|
|
1605
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1606
|
+
},
|
|
1607
|
+
{
|
|
1608
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1609
|
+
},
|
|
1610
|
+
{
|
|
1611
|
+
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1612
|
+
},
|
|
1613
|
+
],
|
|
1614
|
+
},
|
|
1615
|
+
]));
|
|
1413
1616
|
}
|
|
1414
1617
|
catch (err) {
|
|
1415
1618
|
const transformedError = sdkTransformError(err, {
|
|
1416
1619
|
spreadPathsToArguments: {},
|
|
1417
|
-
explicitPathsToArguments: {
|
|
1620
|
+
explicitPathsToArguments: {
|
|
1621
|
+
draftOrderId: '$[0]',
|
|
1622
|
+
billingInfo: '$[1].billingInfo',
|
|
1623
|
+
},
|
|
1418
1624
|
singleArgumentUnchanged: false,
|
|
1419
|
-
}, []);
|
|
1625
|
+
}, ['draftOrderId', 'options']);
|
|
1420
1626
|
sideEffects?.onError?.(err);
|
|
1421
1627
|
throw transformedError;
|
|
1422
1628
|
}
|
|
1423
1629
|
}
|
|
1424
1630
|
/**
|
|
1425
|
-
*
|
|
1426
|
-
*
|
|
1631
|
+
* Gets a draft order.
|
|
1632
|
+
*
|
|
1633
|
+
* Draft order is recalculated and contains latest tax and totals (unless already committed).
|
|
1427
1634
|
* Automatic discounts and automatic additional fees will reflect the latest prices and eligibility.
|
|
1428
1635
|
* Calculation will be based on current draft order content - items, shipping info and eligible discounts and additional fees.
|
|
1429
|
-
* When
|
|
1430
|
-
* @param draftOrderId -
|
|
1636
|
+
* When retrieving an already committed draft, it's not recalculated and contains data calculated during commit.
|
|
1637
|
+
* @param draftOrderId - Draft order ID.
|
|
1431
1638
|
* @public
|
|
1432
1639
|
* @documentationMaturity preview
|
|
1433
1640
|
* @requiredField draftOrderId
|
|
@@ -1439,8 +1646,6 @@ export async function setBillingInfo() {
|
|
|
1439
1646
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1440
1647
|
* @permissionScope Manage eCommerce - all permissions
|
|
1441
1648
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1442
|
-
* @permissionScope Picasso private app mega scope
|
|
1443
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1444
1649
|
* @applicableIdentity APP
|
|
1445
1650
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.GetDraftOrder
|
|
1446
1651
|
*/
|
|
@@ -1510,8 +1715,8 @@ export async function getDraftOrder(draftOrderId) {
|
|
|
1510
1715
|
}
|
|
1511
1716
|
}
|
|
1512
1717
|
/**
|
|
1513
|
-
* Checks whether a draft can be created for this order
|
|
1514
|
-
* @param orderId - Order
|
|
1718
|
+
* Checks whether a draft can be created for this order.
|
|
1719
|
+
* @param orderId - Order Id.
|
|
1515
1720
|
* @public
|
|
1516
1721
|
* @documentationMaturity preview
|
|
1517
1722
|
* @requiredField orderId
|
|
@@ -1522,8 +1727,6 @@ export async function getDraftOrder(draftOrderId) {
|
|
|
1522
1727
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1523
1728
|
* @permissionScope Manage eCommerce - all permissions
|
|
1524
1729
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1525
|
-
* @permissionScope Picasso private app mega scope
|
|
1526
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1527
1730
|
* @applicableIdentity APP
|
|
1528
1731
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.GetOrderDraftabilityStatus
|
|
1529
1732
|
*/
|
|
@@ -1549,10 +1752,11 @@ export async function getOrderDraftabilityStatus(orderId) {
|
|
|
1549
1752
|
}
|
|
1550
1753
|
}
|
|
1551
1754
|
/**
|
|
1552
|
-
* Commit latest changes to the baseline order and control
|
|
1755
|
+
* Commit latest changes to the baseline order and control which side-effects are executed.
|
|
1756
|
+
*
|
|
1553
1757
|
* Commit cannot be undone or reverted.
|
|
1554
|
-
*
|
|
1555
|
-
* @param draftOrderId -
|
|
1758
|
+
* Committed draft will become closed for further modifications, however it's kept for reference and can be retrieved.
|
|
1759
|
+
* @param draftOrderId - Draft order ID.
|
|
1556
1760
|
* @public
|
|
1557
1761
|
* @documentationMaturity preview
|
|
1558
1762
|
* @requiredField draftOrderId
|
|
@@ -1564,8 +1768,6 @@ export async function getOrderDraftabilityStatus(orderId) {
|
|
|
1564
1768
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1565
1769
|
* @permissionScope Manage eCommerce - all permissions
|
|
1566
1770
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1567
|
-
* @permissionScope Picasso private app mega scope
|
|
1568
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1569
1771
|
* @applicableIdentity APP
|
|
1570
1772
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CommitDraftOrder
|
|
1571
1773
|
*/
|
|
@@ -1641,11 +1843,14 @@ export async function commitDraftOrder(draftOrderId, options) {
|
|
|
1641
1843
|
}
|
|
1642
1844
|
}
|
|
1643
1845
|
/**
|
|
1644
|
-
*
|
|
1846
|
+
* Creates a new order while specifying which side-effects are executed.
|
|
1847
|
+
*
|
|
1645
1848
|
* Commit cannot be undone or reverted.
|
|
1646
|
-
*
|
|
1849
|
+
* Committed draft will become closed for further modifications, however it's kept for reference and can be retrieved.
|
|
1850
|
+
* @param draftOrderId - Draft order ID.
|
|
1647
1851
|
* @public
|
|
1648
1852
|
* @documentationMaturity preview
|
|
1853
|
+
* @requiredField draftOrderId
|
|
1649
1854
|
* @permissionId ECOM.DRAFT_ORDER_CREATE_ORDER_FROM_DRAFT
|
|
1650
1855
|
* @permissionId ECOM.DRAFT_ORDER_READ_ALL_EXTENDED_FIELDS
|
|
1651
1856
|
* @permissionScope Manage Stores - all permissions
|
|
@@ -1654,35 +1859,87 @@ export async function commitDraftOrder(draftOrderId, options) {
|
|
|
1654
1859
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1655
1860
|
* @permissionScope Manage eCommerce - all permissions
|
|
1656
1861
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1657
|
-
* @permissionScope Picasso private app mega scope
|
|
1658
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1659
1862
|
* @applicableIdentity APP
|
|
1660
1863
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateOrderFromDraft
|
|
1661
1864
|
*/
|
|
1662
|
-
export async function createOrderFromDraft() {
|
|
1865
|
+
export async function createOrderFromDraft(draftOrderId, options) {
|
|
1663
1866
|
// @ts-ignore
|
|
1664
|
-
const { httpClient, sideEffects } = arguments[
|
|
1665
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1867
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1868
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1869
|
+
draftOrderId: draftOrderId,
|
|
1870
|
+
createSettings: options?.createSettings,
|
|
1871
|
+
reason: options?.reason,
|
|
1872
|
+
channelInfo: options?.channelInfo,
|
|
1873
|
+
});
|
|
1666
1874
|
const reqOpts = ambassadorWixEcomV1DraftOrder.createOrderFromDraft(payload);
|
|
1667
1875
|
sideEffects?.onSiteCall?.();
|
|
1668
1876
|
try {
|
|
1669
1877
|
const result = await httpClient.request(reqOpts);
|
|
1670
1878
|
sideEffects?.onSuccess?.(result);
|
|
1879
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1880
|
+
{
|
|
1881
|
+
transformFn: transformRESTImageToSDKImage,
|
|
1882
|
+
paths: [
|
|
1883
|
+
{ path: 'committedDraftOrder.lineItems.lineItem.image' },
|
|
1884
|
+
{ path: 'createdOrder.lineItems.image' },
|
|
1885
|
+
],
|
|
1886
|
+
},
|
|
1887
|
+
{
|
|
1888
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
1889
|
+
paths: [
|
|
1890
|
+
{
|
|
1891
|
+
path: 'committedDraftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1892
|
+
},
|
|
1893
|
+
{
|
|
1894
|
+
path: 'committedDraftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1895
|
+
},
|
|
1896
|
+
{
|
|
1897
|
+
path: 'committedDraftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1898
|
+
},
|
|
1899
|
+
{
|
|
1900
|
+
path: 'committedDraftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1901
|
+
},
|
|
1902
|
+
{ path: 'committedDraftOrder.billingInfo.address' },
|
|
1903
|
+
{
|
|
1904
|
+
path: 'committedDraftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1905
|
+
},
|
|
1906
|
+
{ path: 'committedDraftOrder.recipientInfo.recipientInfo.address' },
|
|
1907
|
+
{
|
|
1908
|
+
path: 'committedDraftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1909
|
+
},
|
|
1910
|
+
{ path: 'committedDraftOrder.billingDetails.billingInfo.address' },
|
|
1911
|
+
{ path: 'createdOrder.billingInfo.address' },
|
|
1912
|
+
{
|
|
1913
|
+
path: 'createdOrder.shippingInfo.logistics.shippingDestination.address',
|
|
1914
|
+
},
|
|
1915
|
+
{
|
|
1916
|
+
path: 'createdOrder.shippingInfo.logistics.pickupDetails.address',
|
|
1917
|
+
},
|
|
1918
|
+
{ path: 'createdOrder.recipientInfo.address' },
|
|
1919
|
+
],
|
|
1920
|
+
},
|
|
1921
|
+
]));
|
|
1671
1922
|
}
|
|
1672
1923
|
catch (err) {
|
|
1673
1924
|
const transformedError = sdkTransformError(err, {
|
|
1674
1925
|
spreadPathsToArguments: {},
|
|
1675
|
-
explicitPathsToArguments: {
|
|
1926
|
+
explicitPathsToArguments: {
|
|
1927
|
+
draftOrderId: '$[0]',
|
|
1928
|
+
createSettings: '$[1].createSettings',
|
|
1929
|
+
reason: '$[1].reason',
|
|
1930
|
+
channelInfo: '$[1].channelInfo',
|
|
1931
|
+
},
|
|
1676
1932
|
singleArgumentUnchanged: false,
|
|
1677
|
-
}, []);
|
|
1933
|
+
}, ['draftOrderId', 'options']);
|
|
1678
1934
|
sideEffects?.onError?.(err);
|
|
1679
1935
|
throw transformedError;
|
|
1680
1936
|
}
|
|
1681
1937
|
}
|
|
1682
1938
|
/**
|
|
1683
|
-
*
|
|
1684
|
-
*
|
|
1685
|
-
*
|
|
1939
|
+
* Deletes a draft order along with all its pending changes.
|
|
1940
|
+
*
|
|
1941
|
+
* Draft orders in status 'COMMITTED' cannot be deleted.
|
|
1942
|
+
* @param draftOrderId - Draft order ID.
|
|
1686
1943
|
* @public
|
|
1687
1944
|
* @documentationMaturity preview
|
|
1688
1945
|
* @requiredField draftOrderId
|
|
@@ -1694,8 +1951,6 @@ export async function createOrderFromDraft() {
|
|
|
1694
1951
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1695
1952
|
* @permissionScope Manage eCommerce - all permissions
|
|
1696
1953
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1697
|
-
* @permissionScope Picasso private app mega scope
|
|
1698
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1699
1954
|
* @applicableIdentity APP
|
|
1700
1955
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.DeleteDraftOrder
|
|
1701
1956
|
*/
|
|
@@ -1740,8 +1995,6 @@ export async function deleteDraftOrder(draftOrderId) {
|
|
|
1740
1995
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1741
1996
|
* @permissionScope Manage eCommerce - all permissions
|
|
1742
1997
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1743
|
-
* @permissionScope Picasso private app mega scope
|
|
1744
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1745
1998
|
* @permissionId ECOM.DRAFT_ORDERS_READ
|
|
1746
1999
|
* @applicableIdentity APP
|
|
1747
2000
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.QueryDraftOrders
|
|
@@ -1821,9 +2074,102 @@ export function queryDraftOrders() {
|
|
|
1821
2074
|
});
|
|
1822
2075
|
}
|
|
1823
2076
|
/**
|
|
1824
|
-
*
|
|
2077
|
+
* Updates extended fields on a draft order.
|
|
2078
|
+
* @param _id - ID of the entity to update.
|
|
2079
|
+
* @param namespace - Identifier for the app whose extended fields are being updated.
|
|
2080
|
+
* @public
|
|
2081
|
+
* @documentationMaturity preview
|
|
2082
|
+
* @requiredField _id
|
|
2083
|
+
* @requiredField namespace
|
|
2084
|
+
* @requiredField options
|
|
2085
|
+
* @requiredField options.namespaceData
|
|
2086
|
+
* @permissionId ECOM.DRAFT_ORDER_UPDATE_EXTENDED_FIELDS
|
|
2087
|
+
* @permissionId ECOM.DRAFT_ORDER_WRITE_ALL_EXTENDED_FIELDS
|
|
2088
|
+
* @permissionScope Manage Stores - all permissions
|
|
2089
|
+
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
2090
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
2091
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
2092
|
+
* @permissionScope Manage eCommerce - all permissions
|
|
2093
|
+
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
2094
|
+
* @permissionScope Manage Stores - all permissions
|
|
2095
|
+
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
2096
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
2097
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
2098
|
+
* @permissionScope Manage eCommerce - all permissions
|
|
2099
|
+
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
2100
|
+
* @permissionScope Manage Orders
|
|
2101
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
2102
|
+
* @applicableIdentity APP
|
|
2103
|
+
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.UpdateExtendedFields
|
|
2104
|
+
*/
|
|
2105
|
+
export async function updateExtendedFields(_id, namespace, options) {
|
|
2106
|
+
// @ts-ignore
|
|
2107
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
2108
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
2109
|
+
id: _id,
|
|
2110
|
+
namespace: namespace,
|
|
2111
|
+
namespaceData: options?.namespaceData,
|
|
2112
|
+
});
|
|
2113
|
+
const reqOpts = ambassadorWixEcomV1DraftOrder.updateExtendedFields(payload);
|
|
2114
|
+
sideEffects?.onSiteCall?.();
|
|
2115
|
+
try {
|
|
2116
|
+
const result = await httpClient.request(reqOpts);
|
|
2117
|
+
sideEffects?.onSuccess?.(result);
|
|
2118
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
2119
|
+
{
|
|
2120
|
+
transformFn: transformRESTImageToSDKImage,
|
|
2121
|
+
paths: [{ path: 'draftOrder.lineItems.lineItem.image' }],
|
|
2122
|
+
},
|
|
2123
|
+
{
|
|
2124
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
2125
|
+
paths: [
|
|
2126
|
+
{
|
|
2127
|
+
path: 'draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
2128
|
+
},
|
|
2129
|
+
{
|
|
2130
|
+
path: 'draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
2131
|
+
},
|
|
2132
|
+
{
|
|
2133
|
+
path: 'draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
2134
|
+
},
|
|
2135
|
+
{
|
|
2136
|
+
path: 'draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
2137
|
+
},
|
|
2138
|
+
{ path: 'draftOrder.billingInfo.address' },
|
|
2139
|
+
{
|
|
2140
|
+
path: 'draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
2141
|
+
},
|
|
2142
|
+
{ path: 'draftOrder.recipientInfo.recipientInfo.address' },
|
|
2143
|
+
{
|
|
2144
|
+
path: 'draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
2145
|
+
},
|
|
2146
|
+
{ path: 'draftOrder.billingDetails.billingInfo.address' },
|
|
2147
|
+
],
|
|
2148
|
+
},
|
|
2149
|
+
]));
|
|
2150
|
+
}
|
|
2151
|
+
catch (err) {
|
|
2152
|
+
const transformedError = sdkTransformError(err, {
|
|
2153
|
+
spreadPathsToArguments: {},
|
|
2154
|
+
explicitPathsToArguments: {
|
|
2155
|
+
id: '$[0]',
|
|
2156
|
+
namespace: '$[1]',
|
|
2157
|
+
namespaceData: '$[2].namespaceData',
|
|
2158
|
+
},
|
|
2159
|
+
singleArgumentUnchanged: false,
|
|
2160
|
+
}, ['_id', 'namespace', 'options']);
|
|
2161
|
+
sideEffects?.onError?.(err);
|
|
2162
|
+
throw transformedError;
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
/**
|
|
2166
|
+
* Sets tax exemption on a draft order.
|
|
2167
|
+
* @param draftOrderId - Draft order ID.
|
|
1825
2168
|
* @public
|
|
1826
2169
|
* @documentationMaturity preview
|
|
2170
|
+
* @requiredField draftOrderId
|
|
2171
|
+
* @requiredField options
|
|
2172
|
+
* @requiredField options.taxExempt
|
|
1827
2173
|
* @permissionId ECOM.DRAFT_ORDER_SET_TAX_EXEMPTION
|
|
1828
2174
|
* @permissionScope Manage Stores - all permissions
|
|
1829
2175
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1831,35 +2177,85 @@ export function queryDraftOrders() {
|
|
|
1831
2177
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1832
2178
|
* @permissionScope Manage eCommerce - all permissions
|
|
1833
2179
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1834
|
-
* @permissionScope Picasso private app mega scope
|
|
1835
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1836
2180
|
* @applicableIdentity APP
|
|
1837
2181
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetTaxExemption
|
|
1838
2182
|
*/
|
|
1839
|
-
export async function setTaxExemption() {
|
|
2183
|
+
export async function setTaxExemption(draftOrderId, options) {
|
|
1840
2184
|
// @ts-ignore
|
|
1841
|
-
const { httpClient, sideEffects } = arguments[
|
|
1842
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
2185
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
2186
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
2187
|
+
draftOrderId: draftOrderId,
|
|
2188
|
+
taxExempt: options?.taxExempt,
|
|
2189
|
+
});
|
|
1843
2190
|
const reqOpts = ambassadorWixEcomV1DraftOrder.setTaxExemption(payload);
|
|
1844
2191
|
sideEffects?.onSiteCall?.();
|
|
1845
2192
|
try {
|
|
1846
2193
|
const result = await httpClient.request(reqOpts);
|
|
1847
2194
|
sideEffects?.onSuccess?.(result);
|
|
2195
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
2196
|
+
{
|
|
2197
|
+
transformFn: transformRESTImageToSDKImage,
|
|
2198
|
+
paths: [
|
|
2199
|
+
{
|
|
2200
|
+
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
2201
|
+
},
|
|
2202
|
+
],
|
|
2203
|
+
},
|
|
2204
|
+
{
|
|
2205
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
2206
|
+
paths: [
|
|
2207
|
+
{
|
|
2208
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
2209
|
+
},
|
|
2210
|
+
{
|
|
2211
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
2212
|
+
},
|
|
2213
|
+
{
|
|
2214
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
2215
|
+
},
|
|
2216
|
+
{
|
|
2217
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
2218
|
+
},
|
|
2219
|
+
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
2220
|
+
{
|
|
2221
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
2222
|
+
},
|
|
2223
|
+
{
|
|
2224
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
2225
|
+
},
|
|
2226
|
+
{
|
|
2227
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
2228
|
+
},
|
|
2229
|
+
{
|
|
2230
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
2231
|
+
},
|
|
2232
|
+
{
|
|
2233
|
+
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
2234
|
+
},
|
|
2235
|
+
],
|
|
2236
|
+
},
|
|
2237
|
+
]));
|
|
1848
2238
|
}
|
|
1849
2239
|
catch (err) {
|
|
1850
2240
|
const transformedError = sdkTransformError(err, {
|
|
1851
2241
|
spreadPathsToArguments: {},
|
|
1852
|
-
explicitPathsToArguments: {
|
|
2242
|
+
explicitPathsToArguments: {
|
|
2243
|
+
draftOrderId: '$[0]',
|
|
2244
|
+
taxExempt: '$[1].taxExempt',
|
|
2245
|
+
},
|
|
1853
2246
|
singleArgumentUnchanged: false,
|
|
1854
|
-
}, []);
|
|
2247
|
+
}, ['draftOrderId', 'options']);
|
|
1855
2248
|
sideEffects?.onError?.(err);
|
|
1856
2249
|
throw transformedError;
|
|
1857
2250
|
}
|
|
1858
2251
|
}
|
|
1859
2252
|
/**
|
|
1860
|
-
* Sets business location
|
|
2253
|
+
* Sets business location on a draft order.
|
|
2254
|
+
* @param draftOrderId - Draft order ID.
|
|
1861
2255
|
* @public
|
|
1862
2256
|
* @documentationMaturity preview
|
|
2257
|
+
* @requiredField draftOrderId
|
|
2258
|
+
* @requiredField options.businessLocation._id
|
|
1863
2259
|
* @permissionId ECOM.DRAFT_ORDER_SET_BUSINESS_LOCATION
|
|
1864
2260
|
* @permissionScope Manage Stores - all permissions
|
|
1865
2261
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1867,27 +2263,74 @@ export async function setTaxExemption() {
|
|
|
1867
2263
|
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1868
2264
|
* @permissionScope Manage eCommerce - all permissions
|
|
1869
2265
|
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
1870
|
-
* @permissionScope Picasso private app mega scope
|
|
1871
|
-
* @permissionScopeId SCOPE.TEST.MEGA-PICASSO-MANAGE-SITE
|
|
1872
2266
|
* @applicableIdentity APP
|
|
1873
2267
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetBusinessLocation
|
|
1874
2268
|
*/
|
|
1875
|
-
export async function setBusinessLocation() {
|
|
2269
|
+
export async function setBusinessLocation(draftOrderId, options) {
|
|
1876
2270
|
// @ts-ignore
|
|
1877
|
-
const { httpClient, sideEffects } = arguments[
|
|
1878
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
2271
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
2272
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
2273
|
+
draftOrderId: draftOrderId,
|
|
2274
|
+
businessLocation: options?.businessLocation,
|
|
2275
|
+
});
|
|
1879
2276
|
const reqOpts = ambassadorWixEcomV1DraftOrder.setBusinessLocation(payload);
|
|
1880
2277
|
sideEffects?.onSiteCall?.();
|
|
1881
2278
|
try {
|
|
1882
2279
|
const result = await httpClient.request(reqOpts);
|
|
1883
2280
|
sideEffects?.onSuccess?.(result);
|
|
2281
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
2282
|
+
{
|
|
2283
|
+
transformFn: transformRESTImageToSDKImage,
|
|
2284
|
+
paths: [
|
|
2285
|
+
{
|
|
2286
|
+
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
2287
|
+
},
|
|
2288
|
+
],
|
|
2289
|
+
},
|
|
2290
|
+
{
|
|
2291
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
2292
|
+
paths: [
|
|
2293
|
+
{
|
|
2294
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
2295
|
+
},
|
|
2296
|
+
{
|
|
2297
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
2298
|
+
},
|
|
2299
|
+
{
|
|
2300
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
2301
|
+
},
|
|
2302
|
+
{
|
|
2303
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
2304
|
+
},
|
|
2305
|
+
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
2306
|
+
{
|
|
2307
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
2308
|
+
},
|
|
2309
|
+
{
|
|
2310
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
2311
|
+
},
|
|
2312
|
+
{
|
|
2313
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
2314
|
+
},
|
|
2315
|
+
{
|
|
2316
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
2317
|
+
},
|
|
2318
|
+
{
|
|
2319
|
+
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
2320
|
+
},
|
|
2321
|
+
],
|
|
2322
|
+
},
|
|
2323
|
+
]));
|
|
1884
2324
|
}
|
|
1885
2325
|
catch (err) {
|
|
1886
2326
|
const transformedError = sdkTransformError(err, {
|
|
1887
2327
|
spreadPathsToArguments: {},
|
|
1888
|
-
explicitPathsToArguments: {
|
|
2328
|
+
explicitPathsToArguments: {
|
|
2329
|
+
draftOrderId: '$[0]',
|
|
2330
|
+
businessLocation: '$[1].businessLocation',
|
|
2331
|
+
},
|
|
1889
2332
|
singleArgumentUnchanged: false,
|
|
1890
|
-
}, []);
|
|
2333
|
+
}, ['draftOrderId', 'options']);
|
|
1891
2334
|
sideEffects?.onError?.(err);
|
|
1892
2335
|
throw transformedError;
|
|
1893
2336
|
}
|