@wix/auto_sdk_ecom_draft-orders 1.0.21 → 1.0.23
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 +290 -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 +475 -169
- package/build/cjs/src/ecom-v1-draft-order-draft-orders.universal.js +581 -92
- 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 +290 -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 +475 -169
- package/build/es/src/ecom-v1-draft-order-draft-orders.universal.js +578 -91
- 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 +290 -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 +370 -339
- package/build/internal/cjs/src/ecom-v1-draft-order-draft-orders.universal.js +581 -92
- 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 +290 -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 +370 -339
- package/build/internal/es/src/ecom-v1-draft-order-draft-orders.universal.js +578 -91
- 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
|
|
@@ -530,7 +544,7 @@ export async function createEmptyDraftOrder() {
|
|
|
530
544
|
}
|
|
531
545
|
/**
|
|
532
546
|
* Adds line items to a draft order.
|
|
533
|
-
* @param draftOrderId -
|
|
547
|
+
* @param draftOrderId - Draft order ID.
|
|
534
548
|
* @public
|
|
535
549
|
* @documentationMaturity preview
|
|
536
550
|
* @requiredField draftOrderId
|
|
@@ -633,10 +647,13 @@ export async function addLineItemsToDraftOrder(draftOrderId, options) {
|
|
|
633
647
|
* > + Passing a quantity of `0` will remove the line item.
|
|
634
648
|
* > + Price cannot be updated for line items with `paymentOption: MEMBERSHIP`.
|
|
635
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).
|
|
636
|
-
* @param draftOrderId -
|
|
650
|
+
* @param draftOrderId - Draft order ID.
|
|
651
|
+
* @param lineItemChanges - Details of changes to apply per line item.
|
|
637
652
|
* @public
|
|
638
653
|
* @documentationMaturity preview
|
|
639
654
|
* @requiredField draftOrderId
|
|
655
|
+
* @requiredField lineItemChanges
|
|
656
|
+
* @requiredField lineItemChanges.lineItemId
|
|
640
657
|
* @permissionId ECOM.DRAFT_ORDERS_MODIFY_ITEMS
|
|
641
658
|
* @permissionScope Manage Stores - all permissions
|
|
642
659
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -647,12 +664,12 @@ export async function addLineItemsToDraftOrder(draftOrderId, options) {
|
|
|
647
664
|
* @applicableIdentity APP
|
|
648
665
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.UpdateLineItems
|
|
649
666
|
*/
|
|
650
|
-
export async function updateLineItems(draftOrderId,
|
|
667
|
+
export async function updateLineItems(draftOrderId, lineItemChanges) {
|
|
651
668
|
// @ts-ignore
|
|
652
669
|
const { httpClient, sideEffects } = arguments[2];
|
|
653
670
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
654
671
|
draftOrderId: draftOrderId,
|
|
655
|
-
lineItemChanges:
|
|
672
|
+
lineItemChanges: lineItemChanges,
|
|
656
673
|
});
|
|
657
674
|
const reqOpts = ambassadorWixEcomV1DraftOrder.updateLineItems(payload);
|
|
658
675
|
sideEffects?.onSiteCall?.();
|
|
@@ -708,23 +725,27 @@ export async function updateLineItems(draftOrderId, options) {
|
|
|
708
725
|
spreadPathsToArguments: {},
|
|
709
726
|
explicitPathsToArguments: {
|
|
710
727
|
draftOrderId: '$[0]',
|
|
711
|
-
lineItemChanges: '$[1]
|
|
728
|
+
lineItemChanges: '$[1]',
|
|
712
729
|
},
|
|
713
730
|
singleArgumentUnchanged: false,
|
|
714
|
-
}, ['draftOrderId', '
|
|
731
|
+
}, ['draftOrderId', 'lineItemChanges']);
|
|
715
732
|
sideEffects?.onError?.(err);
|
|
716
733
|
throw transformedError;
|
|
717
734
|
}
|
|
718
735
|
}
|
|
719
736
|
/**
|
|
720
|
-
*
|
|
737
|
+
* Applies or unapplies discounts on a draft order.
|
|
721
738
|
*
|
|
722
|
-
*
|
|
723
|
-
*
|
|
724
|
-
* @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.
|
|
725
744
|
* @public
|
|
726
745
|
* @documentationMaturity preview
|
|
727
746
|
* @requiredField discounts
|
|
747
|
+
* @requiredField discounts._id
|
|
748
|
+
* @requiredField discounts.applied
|
|
728
749
|
* @requiredField draftOrderId
|
|
729
750
|
* @permissionId ECOM.DRAFT_ORDERS_SET_DISCOUNTS
|
|
730
751
|
* @permissionScope Manage Stores - all permissions
|
|
@@ -803,14 +824,17 @@ export async function setDiscounts(draftOrderId, discounts) {
|
|
|
803
824
|
}
|
|
804
825
|
}
|
|
805
826
|
/**
|
|
806
|
-
*
|
|
807
|
-
*
|
|
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.
|
|
808
832
|
* @public
|
|
809
833
|
* @documentationMaturity preview
|
|
810
834
|
* @requiredField draftOrderId
|
|
811
|
-
* @requiredField options.discounts.amount
|
|
812
835
|
* @requiredField options.discounts.amount.amount
|
|
813
836
|
* @requiredField options.discounts.discountType
|
|
837
|
+
* @requiredField options.discounts.priceAmount.amount
|
|
814
838
|
* @permissionId ECOM.DRAFT_ORDERS_ADD_DISCOUNTS
|
|
815
839
|
* @permissionScope Manage Stores - all permissions
|
|
816
840
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -892,8 +916,8 @@ export async function createCustomDiscounts(draftOrderId, options) {
|
|
|
892
916
|
}
|
|
893
917
|
/**
|
|
894
918
|
* Remove custom discounts from the order.
|
|
895
|
-
* @param draftOrderId -
|
|
896
|
-
* @param discountIds -
|
|
919
|
+
* @param draftOrderId - Draft order ID.
|
|
920
|
+
* @param discountIds - Ids of discounts to remove.
|
|
897
921
|
* @public
|
|
898
922
|
* @documentationMaturity preview
|
|
899
923
|
* @requiredField discountIds
|
|
@@ -975,13 +999,18 @@ export async function deleteCustomDiscounts(draftOrderId, discountIds) {
|
|
|
975
999
|
}
|
|
976
1000
|
}
|
|
977
1001
|
/**
|
|
978
|
-
*
|
|
979
|
-
*
|
|
980
|
-
*
|
|
981
|
-
*
|
|
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.
|
|
982
1009
|
* @public
|
|
983
1010
|
* @documentationMaturity preview
|
|
984
1011
|
* @requiredField additionalFees
|
|
1012
|
+
* @requiredField additionalFees._id
|
|
1013
|
+
* @requiredField additionalFees.applied
|
|
985
1014
|
* @requiredField draftOrderId
|
|
986
1015
|
* @permissionId ECOM.DRAFT_ORDERS_SET_ADDITIONAL_FEES
|
|
987
1016
|
* @permissionScope Manage Stores - all permissions
|
|
@@ -1063,10 +1092,11 @@ export async function setAdditionalFees(draftOrderId, additionalFees) {
|
|
|
1063
1092
|
}
|
|
1064
1093
|
}
|
|
1065
1094
|
/**
|
|
1066
|
-
*
|
|
1067
|
-
*
|
|
1068
|
-
*
|
|
1069
|
-
*
|
|
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.
|
|
1070
1100
|
* @public
|
|
1071
1101
|
* @documentationMaturity preview
|
|
1072
1102
|
* @requiredField draftOrderId
|
|
@@ -1154,8 +1184,8 @@ export async function createCustomAdditionalFees(draftOrderId, options) {
|
|
|
1154
1184
|
}
|
|
1155
1185
|
/**
|
|
1156
1186
|
* Remove custom additional fees from the order.
|
|
1157
|
-
* @param draftOrderId -
|
|
1158
|
-
* @param customAdditionalFees -
|
|
1187
|
+
* @param draftOrderId - Draft order ID.
|
|
1188
|
+
* @param customAdditionalFees - Ids of additional fees to remove.
|
|
1159
1189
|
* @public
|
|
1160
1190
|
* @documentationMaturity preview
|
|
1161
1191
|
* @requiredField customAdditionalFees
|
|
@@ -1240,9 +1270,11 @@ export async function deleteCustomAdditionalFees(draftOrderId, customAdditionalF
|
|
|
1240
1270
|
}
|
|
1241
1271
|
}
|
|
1242
1272
|
/**
|
|
1243
|
-
* Sets shipping
|
|
1273
|
+
* Sets shipping information on a draft order.
|
|
1274
|
+
* @param draftOrderId - Draft order ID.
|
|
1244
1275
|
* @public
|
|
1245
1276
|
* @documentationMaturity preview
|
|
1277
|
+
* @requiredField draftOrderId
|
|
1246
1278
|
* @permissionId ECOM.DRAFT_ORDERS_SET_SHIPPING_INFO
|
|
1247
1279
|
* @permissionScope Manage Stores - all permissions
|
|
1248
1280
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1253,10 +1285,13 @@ export async function deleteCustomAdditionalFees(draftOrderId, customAdditionalF
|
|
|
1253
1285
|
* @applicableIdentity APP
|
|
1254
1286
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetShippingInfo
|
|
1255
1287
|
*/
|
|
1256
|
-
export async function setShippingInfo() {
|
|
1288
|
+
export async function setShippingInfo(draftOrderId, options) {
|
|
1257
1289
|
// @ts-ignore
|
|
1258
|
-
const { httpClient, sideEffects } = arguments[
|
|
1259
|
-
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
1290
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1291
|
+
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
1292
|
+
draftOrderId: draftOrderId,
|
|
1293
|
+
shippingInfo: options?.shippingInfo,
|
|
1294
|
+
}), [
|
|
1260
1295
|
{
|
|
1261
1296
|
transformFn: transformSDKAddressToRESTAddress,
|
|
1262
1297
|
paths: [
|
|
@@ -1270,21 +1305,69 @@ export async function setShippingInfo() {
|
|
|
1270
1305
|
try {
|
|
1271
1306
|
const result = await httpClient.request(reqOpts);
|
|
1272
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
|
+
]));
|
|
1273
1351
|
}
|
|
1274
1352
|
catch (err) {
|
|
1275
1353
|
const transformedError = sdkTransformError(err, {
|
|
1276
1354
|
spreadPathsToArguments: {},
|
|
1277
|
-
explicitPathsToArguments: {
|
|
1355
|
+
explicitPathsToArguments: {
|
|
1356
|
+
draftOrderId: '$[0]',
|
|
1357
|
+
shippingInfo: '$[1].shippingInfo',
|
|
1358
|
+
},
|
|
1278
1359
|
singleArgumentUnchanged: false,
|
|
1279
|
-
}, []);
|
|
1360
|
+
}, ['draftOrderId', 'options']);
|
|
1280
1361
|
sideEffects?.onError?.(err);
|
|
1281
1362
|
throw transformedError;
|
|
1282
1363
|
}
|
|
1283
1364
|
}
|
|
1284
1365
|
/**
|
|
1285
|
-
* Sets buyer info
|
|
1366
|
+
* Sets buyer info on a draft order.
|
|
1367
|
+
* @param draftOrderId - Draft order ID.
|
|
1286
1368
|
* @public
|
|
1287
1369
|
* @documentationMaturity preview
|
|
1370
|
+
* @requiredField draftOrderId
|
|
1288
1371
|
* @permissionId ECOM.DRAFT_ORDER_SET_BUYER_INFO
|
|
1289
1372
|
* @permissionScope Manage Stores - all permissions
|
|
1290
1373
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1295,30 +1378,81 @@ export async function setShippingInfo() {
|
|
|
1295
1378
|
* @applicableIdentity APP
|
|
1296
1379
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetBuyerInfo
|
|
1297
1380
|
*/
|
|
1298
|
-
export async function setBuyerInfo() {
|
|
1381
|
+
export async function setBuyerInfo(draftOrderId, options) {
|
|
1299
1382
|
// @ts-ignore
|
|
1300
|
-
const { httpClient, sideEffects } = arguments[
|
|
1301
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1383
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1384
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1385
|
+
draftOrderId: draftOrderId,
|
|
1386
|
+
buyerInfo: options?.buyerInfo,
|
|
1387
|
+
});
|
|
1302
1388
|
const reqOpts = ambassadorWixEcomV1DraftOrder.setBuyerInfo(payload);
|
|
1303
1389
|
sideEffects?.onSiteCall?.();
|
|
1304
1390
|
try {
|
|
1305
1391
|
const result = await httpClient.request(reqOpts);
|
|
1306
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
|
+
]));
|
|
1307
1436
|
}
|
|
1308
1437
|
catch (err) {
|
|
1309
1438
|
const transformedError = sdkTransformError(err, {
|
|
1310
1439
|
spreadPathsToArguments: {},
|
|
1311
|
-
explicitPathsToArguments: {
|
|
1440
|
+
explicitPathsToArguments: {
|
|
1441
|
+
draftOrderId: '$[0]',
|
|
1442
|
+
buyerInfo: '$[1].buyerInfo',
|
|
1443
|
+
},
|
|
1312
1444
|
singleArgumentUnchanged: false,
|
|
1313
|
-
}, []);
|
|
1445
|
+
}, ['draftOrderId', 'options']);
|
|
1314
1446
|
sideEffects?.onError?.(err);
|
|
1315
1447
|
throw transformedError;
|
|
1316
1448
|
}
|
|
1317
1449
|
}
|
|
1318
1450
|
/**
|
|
1319
|
-
* Sets recipient info
|
|
1451
|
+
* Sets recipient info on a draft order.
|
|
1452
|
+
* @param draftOrderId - Draft order ID.
|
|
1320
1453
|
* @public
|
|
1321
1454
|
* @documentationMaturity preview
|
|
1455
|
+
* @requiredField draftOrderId
|
|
1322
1456
|
* @permissionId ECOM.DRAFT_ORDER_SET_RECIPIENT_INFO
|
|
1323
1457
|
* @permissionScope Manage Stores - all permissions
|
|
1324
1458
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1329,10 +1463,13 @@ export async function setBuyerInfo() {
|
|
|
1329
1463
|
* @applicableIdentity APP
|
|
1330
1464
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetRecipientInfo
|
|
1331
1465
|
*/
|
|
1332
|
-
export async function setRecipientInfo() {
|
|
1466
|
+
export async function setRecipientInfo(draftOrderId, options) {
|
|
1333
1467
|
// @ts-ignore
|
|
1334
|
-
const { httpClient, sideEffects } = arguments[
|
|
1335
|
-
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
1468
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1469
|
+
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
1470
|
+
draftOrderId: draftOrderId,
|
|
1471
|
+
recipientInfo: options?.recipientInfo,
|
|
1472
|
+
}), [
|
|
1336
1473
|
{
|
|
1337
1474
|
transformFn: transformSDKAddressToRESTAddress,
|
|
1338
1475
|
paths: [{ path: 'recipientInfo.address' }],
|
|
@@ -1343,21 +1480,69 @@ export async function setRecipientInfo() {
|
|
|
1343
1480
|
try {
|
|
1344
1481
|
const result = await httpClient.request(reqOpts);
|
|
1345
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
|
+
]));
|
|
1346
1526
|
}
|
|
1347
1527
|
catch (err) {
|
|
1348
1528
|
const transformedError = sdkTransformError(err, {
|
|
1349
1529
|
spreadPathsToArguments: {},
|
|
1350
|
-
explicitPathsToArguments: {
|
|
1530
|
+
explicitPathsToArguments: {
|
|
1531
|
+
draftOrderId: '$[0]',
|
|
1532
|
+
recipientInfo: '$[1].recipientInfo',
|
|
1533
|
+
},
|
|
1351
1534
|
singleArgumentUnchanged: false,
|
|
1352
|
-
}, []);
|
|
1535
|
+
}, ['draftOrderId', 'options']);
|
|
1353
1536
|
sideEffects?.onError?.(err);
|
|
1354
1537
|
throw transformedError;
|
|
1355
1538
|
}
|
|
1356
1539
|
}
|
|
1357
1540
|
/**
|
|
1358
|
-
* Sets billing info
|
|
1541
|
+
* Sets billing info on a draft order.
|
|
1542
|
+
* @param draftOrderId - Draft order ID.
|
|
1359
1543
|
* @public
|
|
1360
1544
|
* @documentationMaturity preview
|
|
1545
|
+
* @requiredField draftOrderId
|
|
1361
1546
|
* @permissionId ECOM.DRAFT_ORDER_SET_BILLING_INFO
|
|
1362
1547
|
* @permissionScope Manage Stores - all permissions
|
|
1363
1548
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1368,10 +1553,13 @@ export async function setRecipientInfo() {
|
|
|
1368
1553
|
* @applicableIdentity APP
|
|
1369
1554
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetBillingInfo
|
|
1370
1555
|
*/
|
|
1371
|
-
export async function setBillingInfo() {
|
|
1556
|
+
export async function setBillingInfo(draftOrderId, options) {
|
|
1372
1557
|
// @ts-ignore
|
|
1373
|
-
const { httpClient, sideEffects } = arguments[
|
|
1374
|
-
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
1558
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1559
|
+
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
1560
|
+
draftOrderId: draftOrderId,
|
|
1561
|
+
billingInfo: options?.billingInfo,
|
|
1562
|
+
}), [
|
|
1375
1563
|
{
|
|
1376
1564
|
transformFn: transformSDKAddressToRESTAddress,
|
|
1377
1565
|
paths: [{ path: 'billingInfo.address' }],
|
|
@@ -1382,24 +1570,71 @@ export async function setBillingInfo() {
|
|
|
1382
1570
|
try {
|
|
1383
1571
|
const result = await httpClient.request(reqOpts);
|
|
1384
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
|
+
]));
|
|
1385
1616
|
}
|
|
1386
1617
|
catch (err) {
|
|
1387
1618
|
const transformedError = sdkTransformError(err, {
|
|
1388
1619
|
spreadPathsToArguments: {},
|
|
1389
|
-
explicitPathsToArguments: {
|
|
1620
|
+
explicitPathsToArguments: {
|
|
1621
|
+
draftOrderId: '$[0]',
|
|
1622
|
+
billingInfo: '$[1].billingInfo',
|
|
1623
|
+
},
|
|
1390
1624
|
singleArgumentUnchanged: false,
|
|
1391
|
-
}, []);
|
|
1625
|
+
}, ['draftOrderId', 'options']);
|
|
1392
1626
|
sideEffects?.onError?.(err);
|
|
1393
1627
|
throw transformedError;
|
|
1394
1628
|
}
|
|
1395
1629
|
}
|
|
1396
1630
|
/**
|
|
1397
|
-
*
|
|
1398
|
-
*
|
|
1631
|
+
* Gets a draft order.
|
|
1632
|
+
*
|
|
1633
|
+
* Draft order is recalculated and contains latest tax and totals (unless already committed).
|
|
1399
1634
|
* Automatic discounts and automatic additional fees will reflect the latest prices and eligibility.
|
|
1400
1635
|
* Calculation will be based on current draft order content - items, shipping info and eligible discounts and additional fees.
|
|
1401
|
-
* When
|
|
1402
|
-
* @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.
|
|
1403
1638
|
* @public
|
|
1404
1639
|
* @documentationMaturity preview
|
|
1405
1640
|
* @requiredField draftOrderId
|
|
@@ -1480,8 +1715,8 @@ export async function getDraftOrder(draftOrderId) {
|
|
|
1480
1715
|
}
|
|
1481
1716
|
}
|
|
1482
1717
|
/**
|
|
1483
|
-
* Checks whether a draft can be created for this order
|
|
1484
|
-
* @param orderId - Order
|
|
1718
|
+
* Checks whether a draft can be created for this order.
|
|
1719
|
+
* @param orderId - Order Id.
|
|
1485
1720
|
* @public
|
|
1486
1721
|
* @documentationMaturity preview
|
|
1487
1722
|
* @requiredField orderId
|
|
@@ -1517,10 +1752,11 @@ export async function getOrderDraftabilityStatus(orderId) {
|
|
|
1517
1752
|
}
|
|
1518
1753
|
}
|
|
1519
1754
|
/**
|
|
1520
|
-
* 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
|
+
*
|
|
1521
1757
|
* Commit cannot be undone or reverted.
|
|
1522
|
-
*
|
|
1523
|
-
* @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.
|
|
1524
1760
|
* @public
|
|
1525
1761
|
* @documentationMaturity preview
|
|
1526
1762
|
* @requiredField draftOrderId
|
|
@@ -1607,11 +1843,14 @@ export async function commitDraftOrder(draftOrderId, options) {
|
|
|
1607
1843
|
}
|
|
1608
1844
|
}
|
|
1609
1845
|
/**
|
|
1610
|
-
*
|
|
1846
|
+
* Creates a new order while specifying which side-effects are executed.
|
|
1847
|
+
*
|
|
1611
1848
|
* Commit cannot be undone or reverted.
|
|
1612
|
-
*
|
|
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.
|
|
1613
1851
|
* @public
|
|
1614
1852
|
* @documentationMaturity preview
|
|
1853
|
+
* @requiredField draftOrderId
|
|
1615
1854
|
* @permissionId ECOM.DRAFT_ORDER_CREATE_ORDER_FROM_DRAFT
|
|
1616
1855
|
* @permissionId ECOM.DRAFT_ORDER_READ_ALL_EXTENDED_FIELDS
|
|
1617
1856
|
* @permissionScope Manage Stores - all permissions
|
|
@@ -1623,30 +1862,84 @@ export async function commitDraftOrder(draftOrderId, options) {
|
|
|
1623
1862
|
* @applicableIdentity APP
|
|
1624
1863
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateOrderFromDraft
|
|
1625
1864
|
*/
|
|
1626
|
-
export async function createOrderFromDraft() {
|
|
1865
|
+
export async function createOrderFromDraft(draftOrderId, options) {
|
|
1627
1866
|
// @ts-ignore
|
|
1628
|
-
const { httpClient, sideEffects } = arguments[
|
|
1629
|
-
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
|
+
});
|
|
1630
1874
|
const reqOpts = ambassadorWixEcomV1DraftOrder.createOrderFromDraft(payload);
|
|
1631
1875
|
sideEffects?.onSiteCall?.();
|
|
1632
1876
|
try {
|
|
1633
1877
|
const result = await httpClient.request(reqOpts);
|
|
1634
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
|
+
]));
|
|
1635
1922
|
}
|
|
1636
1923
|
catch (err) {
|
|
1637
1924
|
const transformedError = sdkTransformError(err, {
|
|
1638
1925
|
spreadPathsToArguments: {},
|
|
1639
|
-
explicitPathsToArguments: {
|
|
1926
|
+
explicitPathsToArguments: {
|
|
1927
|
+
draftOrderId: '$[0]',
|
|
1928
|
+
createSettings: '$[1].createSettings',
|
|
1929
|
+
reason: '$[1].reason',
|
|
1930
|
+
channelInfo: '$[1].channelInfo',
|
|
1931
|
+
},
|
|
1640
1932
|
singleArgumentUnchanged: false,
|
|
1641
|
-
}, []);
|
|
1933
|
+
}, ['draftOrderId', 'options']);
|
|
1642
1934
|
sideEffects?.onError?.(err);
|
|
1643
1935
|
throw transformedError;
|
|
1644
1936
|
}
|
|
1645
1937
|
}
|
|
1646
1938
|
/**
|
|
1647
|
-
*
|
|
1648
|
-
*
|
|
1649
|
-
*
|
|
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.
|
|
1650
1943
|
* @public
|
|
1651
1944
|
* @documentationMaturity preview
|
|
1652
1945
|
* @requiredField draftOrderId
|
|
@@ -1781,9 +2074,102 @@ export function queryDraftOrders() {
|
|
|
1781
2074
|
});
|
|
1782
2075
|
}
|
|
1783
2076
|
/**
|
|
1784
|
-
*
|
|
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.
|
|
1785
2168
|
* @public
|
|
1786
2169
|
* @documentationMaturity preview
|
|
2170
|
+
* @requiredField draftOrderId
|
|
2171
|
+
* @requiredField options
|
|
2172
|
+
* @requiredField options.taxExempt
|
|
1787
2173
|
* @permissionId ECOM.DRAFT_ORDER_SET_TAX_EXEMPTION
|
|
1788
2174
|
* @permissionScope Manage Stores - all permissions
|
|
1789
2175
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1794,30 +2180,82 @@ export function queryDraftOrders() {
|
|
|
1794
2180
|
* @applicableIdentity APP
|
|
1795
2181
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetTaxExemption
|
|
1796
2182
|
*/
|
|
1797
|
-
export async function setTaxExemption() {
|
|
2183
|
+
export async function setTaxExemption(draftOrderId, options) {
|
|
1798
2184
|
// @ts-ignore
|
|
1799
|
-
const { httpClient, sideEffects } = arguments[
|
|
1800
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
2185
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
2186
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
2187
|
+
draftOrderId: draftOrderId,
|
|
2188
|
+
taxExempt: options?.taxExempt,
|
|
2189
|
+
});
|
|
1801
2190
|
const reqOpts = ambassadorWixEcomV1DraftOrder.setTaxExemption(payload);
|
|
1802
2191
|
sideEffects?.onSiteCall?.();
|
|
1803
2192
|
try {
|
|
1804
2193
|
const result = await httpClient.request(reqOpts);
|
|
1805
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
|
+
]));
|
|
1806
2238
|
}
|
|
1807
2239
|
catch (err) {
|
|
1808
2240
|
const transformedError = sdkTransformError(err, {
|
|
1809
2241
|
spreadPathsToArguments: {},
|
|
1810
|
-
explicitPathsToArguments: {
|
|
2242
|
+
explicitPathsToArguments: {
|
|
2243
|
+
draftOrderId: '$[0]',
|
|
2244
|
+
taxExempt: '$[1].taxExempt',
|
|
2245
|
+
},
|
|
1811
2246
|
singleArgumentUnchanged: false,
|
|
1812
|
-
}, []);
|
|
2247
|
+
}, ['draftOrderId', 'options']);
|
|
1813
2248
|
sideEffects?.onError?.(err);
|
|
1814
2249
|
throw transformedError;
|
|
1815
2250
|
}
|
|
1816
2251
|
}
|
|
1817
2252
|
/**
|
|
1818
|
-
* Sets business location
|
|
2253
|
+
* Sets business location on a draft order.
|
|
2254
|
+
* @param draftOrderId - Draft order ID.
|
|
1819
2255
|
* @public
|
|
1820
2256
|
* @documentationMaturity preview
|
|
2257
|
+
* @requiredField draftOrderId
|
|
2258
|
+
* @requiredField options.businessLocation._id
|
|
1821
2259
|
* @permissionId ECOM.DRAFT_ORDER_SET_BUSINESS_LOCATION
|
|
1822
2260
|
* @permissionScope Manage Stores - all permissions
|
|
1823
2261
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1828,22 +2266,71 @@ export async function setTaxExemption() {
|
|
|
1828
2266
|
* @applicableIdentity APP
|
|
1829
2267
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetBusinessLocation
|
|
1830
2268
|
*/
|
|
1831
|
-
export async function setBusinessLocation() {
|
|
2269
|
+
export async function setBusinessLocation(draftOrderId, options) {
|
|
1832
2270
|
// @ts-ignore
|
|
1833
|
-
const { httpClient, sideEffects } = arguments[
|
|
1834
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
2271
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
2272
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
2273
|
+
draftOrderId: draftOrderId,
|
|
2274
|
+
businessLocation: options?.businessLocation,
|
|
2275
|
+
});
|
|
1835
2276
|
const reqOpts = ambassadorWixEcomV1DraftOrder.setBusinessLocation(payload);
|
|
1836
2277
|
sideEffects?.onSiteCall?.();
|
|
1837
2278
|
try {
|
|
1838
2279
|
const result = await httpClient.request(reqOpts);
|
|
1839
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
|
+
]));
|
|
1840
2324
|
}
|
|
1841
2325
|
catch (err) {
|
|
1842
2326
|
const transformedError = sdkTransformError(err, {
|
|
1843
2327
|
spreadPathsToArguments: {},
|
|
1844
|
-
explicitPathsToArguments: {
|
|
2328
|
+
explicitPathsToArguments: {
|
|
2329
|
+
draftOrderId: '$[0]',
|
|
2330
|
+
businessLocation: '$[1].businessLocation',
|
|
2331
|
+
},
|
|
1845
2332
|
singleArgumentUnchanged: false,
|
|
1846
|
-
}, []);
|
|
2333
|
+
}, ['draftOrderId', 'options']);
|
|
1847
2334
|
sideEffects?.onError?.(err);
|
|
1848
2335
|
throw transformedError;
|
|
1849
2336
|
}
|