@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
|
@@ -23,7 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.setTaxExemption = exports.updateExtendedFields = exports.queryDraftOrders = exports.deleteDraftOrder = exports.createOrderFromDraft = exports.commitDraftOrder = exports.getOrderDraftabilityStatus = exports.getDraftOrder = exports.setBillingInfo = exports.setRecipientInfo = exports.setBuyerInfo = exports.setShippingInfo = exports.deleteCustomAdditionalFees = exports.createCustomAdditionalFees = exports.setAdditionalFees = exports.deleteCustomDiscounts = exports.createCustomDiscounts = exports.setDiscounts = exports.updateLineItems = exports.addLineItemsToDraftOrder = exports.createEmptyDraftOrder = exports.createDraftOrder = exports.WebhookIdentityType = exports.SortOrder = exports.ChannelType = exports.AttributionSource = exports.ActivityType = exports.LineItemQuantityChangeType = exports.OrderStatus = exports.FulfillmentStatus = exports.PaymentStatus = exports.NonDraftableReason = exports.DiscountType = exports.FileType = exports.RuleType = exports.PickupMethod = exports.WeightUnit = exports.EditingStatus = exports.DiscountReason = exports.AppliedDiscountDiscountType = exports.SourceType = exports.PickupDetailsPickupMethod = exports.VatType = exports.TaxableAddressType = exports.AdjustmentType = exports.SubscriptionFrequency = exports.JurisdictionType = exports.PaymentOptionType = exports.ItemTypeItemType = exports.DescriptionLineType = void 0;
|
|
27
|
+
exports.setBusinessLocation = void 0;
|
|
27
28
|
const transform_error_1 = require("@wix/sdk-runtime/transform-error");
|
|
28
29
|
const query_builder_1 = require("@wix/sdk-runtime/query-builder");
|
|
29
30
|
const rename_all_nested_keys_1 = require("@wix/sdk-runtime/rename-all-nested-keys");
|
|
@@ -117,11 +118,11 @@ var PickupDetailsPickupMethod;
|
|
|
117
118
|
})(PickupDetailsPickupMethod || (exports.PickupDetailsPickupMethod = PickupDetailsPickupMethod = {}));
|
|
118
119
|
var SourceType;
|
|
119
120
|
(function (SourceType) {
|
|
120
|
-
/** Part of the original order */
|
|
121
|
+
/** Part of the original order. */
|
|
121
122
|
SourceType["ORIGINAL_ORDER"] = "ORIGINAL_ORDER";
|
|
122
|
-
/** Added by
|
|
123
|
+
/** Added automatically, as the result of recalculation caused by changes in draft order. */
|
|
123
124
|
SourceType["AUTOMATIC"] = "AUTOMATIC";
|
|
124
|
-
/** Added manually to
|
|
125
|
+
/** Added manually to draft order. */
|
|
125
126
|
SourceType["CUSTOM"] = "CUSTOM";
|
|
126
127
|
})(SourceType || (exports.SourceType = SourceType = {}));
|
|
127
128
|
var AppliedDiscountDiscountType;
|
|
@@ -138,9 +139,9 @@ var DiscountReason;
|
|
|
138
139
|
})(DiscountReason || (exports.DiscountReason = DiscountReason = {}));
|
|
139
140
|
var EditingStatus;
|
|
140
141
|
(function (EditingStatus) {
|
|
141
|
-
/**
|
|
142
|
+
/** Draft order can be modified and committed. */
|
|
142
143
|
EditingStatus["DRAFT"] = "DRAFT";
|
|
143
|
-
/**
|
|
144
|
+
/** Draft order is already committed. No further modifications allowed. */
|
|
144
145
|
EditingStatus["COMMITTED"] = "COMMITTED";
|
|
145
146
|
})(EditingStatus || (exports.EditingStatus = EditingStatus = {}));
|
|
146
147
|
var WeightUnit;
|
|
@@ -155,7 +156,9 @@ var WeightUnit;
|
|
|
155
156
|
var PickupMethod;
|
|
156
157
|
(function (PickupMethod) {
|
|
157
158
|
PickupMethod["UNKNOWN_METHOD"] = "UNKNOWN_METHOD";
|
|
159
|
+
/** Pickup is from the merchant's brick and mortar store. */
|
|
158
160
|
PickupMethod["STORE_PICKUP"] = "STORE_PICKUP";
|
|
161
|
+
/** Item is shipped to a specified pickup point. */
|
|
159
162
|
PickupMethod["PICKUP_POINT"] = "PICKUP_POINT";
|
|
160
163
|
})(PickupMethod || (exports.PickupMethod = PickupMethod = {}));
|
|
161
164
|
var RuleType;
|
|
@@ -194,24 +197,36 @@ var FileType;
|
|
|
194
197
|
var DiscountType;
|
|
195
198
|
(function (DiscountType) {
|
|
196
199
|
DiscountType["UNKNOWN_TYPE"] = "UNKNOWN_TYPE";
|
|
200
|
+
/** Discount applies to entire order. */
|
|
197
201
|
DiscountType["GLOBAL"] = "GLOBAL";
|
|
202
|
+
/** Discount applies to specific items. */
|
|
198
203
|
DiscountType["SPECIFIC_ITEMS"] = "SPECIFIC_ITEMS";
|
|
204
|
+
/** Discount applies to shipping. For example, free shipping. */
|
|
199
205
|
DiscountType["SHIPPING"] = "SHIPPING";
|
|
200
206
|
})(DiscountType || (exports.DiscountType = DiscountType = {}));
|
|
201
207
|
var NonDraftableReason;
|
|
202
208
|
(function (NonDraftableReason) {
|
|
203
209
|
NonDraftableReason["UNSPECIFIED"] = "UNSPECIFIED";
|
|
210
|
+
/** Modifications of refunded orders are not supported. */
|
|
204
211
|
NonDraftableReason["PARTIALLY_OR_FULLY_REFUNDED"] = "PARTIALLY_OR_FULLY_REFUNDED";
|
|
212
|
+
/**
|
|
213
|
+
* Original order must be created via one of the following channel types:
|
|
214
|
+
* + WEB
|
|
215
|
+
* + POS
|
|
216
|
+
* + BACKOFFICE_MERCHANT
|
|
217
|
+
* + WIX_APP_STORE
|
|
218
|
+
*/
|
|
205
219
|
NonDraftableReason["UNSUPPORTED_CHANNEL_TYPE"] = "UNSUPPORTED_CHANNEL_TYPE";
|
|
220
|
+
/** Order status is not APPROVED. */
|
|
206
221
|
NonDraftableReason["ORDER_STATUS_IS_NOT_SUPPORTED"] = "ORDER_STATUS_IS_NOT_SUPPORTED";
|
|
222
|
+
/** Site and order currencies are different. */
|
|
207
223
|
NonDraftableReason["ORDER_AND_SITE_CURRENCIES_ARE_INCONSISTENT"] = "ORDER_AND_SITE_CURRENCIES_ARE_INCONSISTENT";
|
|
224
|
+
/** Site and order weight units are different. */
|
|
208
225
|
NonDraftableReason["ORDER_AND_SITE_WEIGHT_UNITS_ARE_INCONSISTENT"] = "ORDER_AND_SITE_WEIGHT_UNITS_ARE_INCONSISTENT";
|
|
209
|
-
|
|
210
|
-
/** remove - this is not a reason, it's an error */
|
|
226
|
+
/** Order not found. */
|
|
211
227
|
NonDraftableReason["ORDER_NOT_FOUND"] = "ORDER_NOT_FOUND";
|
|
228
|
+
/** Modifications of orders with subscription items are not supported. */
|
|
212
229
|
NonDraftableReason["SUBSCRIPTION_LINE_ITEM_EXISTS"] = "SUBSCRIPTION_LINE_ITEM_EXISTS";
|
|
213
|
-
NonDraftableReason["UNSUPPORTED_CATALOG_ITEM"] = "UNSUPPORTED_CATALOG_ITEM";
|
|
214
|
-
NonDraftableReason["TAXABLE_EXISTING_ADDITIONAL_FEE"] = "TAXABLE_EXISTING_ADDITIONAL_FEE";
|
|
215
230
|
})(NonDraftableReason || (exports.NonDraftableReason = NonDraftableReason = {}));
|
|
216
231
|
var PaymentStatus;
|
|
217
232
|
(function (PaymentStatus) {
|
|
@@ -395,8 +410,8 @@ var WebhookIdentityType;
|
|
|
395
410
|
* Creates or gets a draft order.
|
|
396
411
|
*
|
|
397
412
|
* When passing the ID of an order that is already in draft, the existing draft order will be returned.
|
|
398
|
-
* To complete a draft and update the order, call
|
|
399
|
-
* @param orderId -
|
|
413
|
+
* To complete a draft and update the order, call Commit Draft Order([REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/draft-orders/commit-draft-order) | [SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/draft-orders/commit-draft-order)).
|
|
414
|
+
* @param orderId - Existing order ID to create draft from.
|
|
400
415
|
* @public
|
|
401
416
|
* @documentationMaturity preview
|
|
402
417
|
* @requiredField orderId
|
|
@@ -558,7 +573,7 @@ async function createEmptyDraftOrder() {
|
|
|
558
573
|
exports.createEmptyDraftOrder = createEmptyDraftOrder;
|
|
559
574
|
/**
|
|
560
575
|
* Adds line items to a draft order.
|
|
561
|
-
* @param draftOrderId -
|
|
576
|
+
* @param draftOrderId - Draft order ID.
|
|
562
577
|
* @public
|
|
563
578
|
* @documentationMaturity preview
|
|
564
579
|
* @requiredField draftOrderId
|
|
@@ -662,10 +677,13 @@ exports.addLineItemsToDraftOrder = addLineItemsToDraftOrder;
|
|
|
662
677
|
* > + Passing a quantity of `0` will remove the line item.
|
|
663
678
|
* > + Price cannot be updated for line items with `paymentOption: MEMBERSHIP`.
|
|
664
679
|
* > + Quantity cannot be decreased fulfilled line items. To get fulfillment information, pass the order ID to [List Fulfillments For Single Order](https://dev.wix.com/docs/rest/api-reference/wix-e-commerce/order-fulfillments/list-fulfillments-for-single-order).
|
|
665
|
-
* @param draftOrderId -
|
|
680
|
+
* @param draftOrderId - Draft order ID.
|
|
681
|
+
* @param lineItemChanges - Details of changes to apply per line item.
|
|
666
682
|
* @public
|
|
667
683
|
* @documentationMaturity preview
|
|
668
684
|
* @requiredField draftOrderId
|
|
685
|
+
* @requiredField lineItemChanges
|
|
686
|
+
* @requiredField lineItemChanges.lineItemId
|
|
669
687
|
* @permissionId ECOM.DRAFT_ORDERS_MODIFY_ITEMS
|
|
670
688
|
* @permissionScope Manage Stores - all permissions
|
|
671
689
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -676,12 +694,12 @@ exports.addLineItemsToDraftOrder = addLineItemsToDraftOrder;
|
|
|
676
694
|
* @applicableIdentity APP
|
|
677
695
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.UpdateLineItems
|
|
678
696
|
*/
|
|
679
|
-
async function updateLineItems(draftOrderId,
|
|
697
|
+
async function updateLineItems(draftOrderId, lineItemChanges) {
|
|
680
698
|
// @ts-ignore
|
|
681
699
|
const { httpClient, sideEffects } = arguments[2];
|
|
682
700
|
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
683
701
|
draftOrderId: draftOrderId,
|
|
684
|
-
lineItemChanges:
|
|
702
|
+
lineItemChanges: lineItemChanges,
|
|
685
703
|
});
|
|
686
704
|
const reqOpts = ambassadorWixEcomV1DraftOrder.updateLineItems(payload);
|
|
687
705
|
sideEffects?.onSiteCall?.();
|
|
@@ -737,24 +755,28 @@ async function updateLineItems(draftOrderId, options) {
|
|
|
737
755
|
spreadPathsToArguments: {},
|
|
738
756
|
explicitPathsToArguments: {
|
|
739
757
|
draftOrderId: '$[0]',
|
|
740
|
-
lineItemChanges: '$[1]
|
|
758
|
+
lineItemChanges: '$[1]',
|
|
741
759
|
},
|
|
742
760
|
singleArgumentUnchanged: false,
|
|
743
|
-
}, ['draftOrderId', '
|
|
761
|
+
}, ['draftOrderId', 'lineItemChanges']);
|
|
744
762
|
sideEffects?.onError?.(err);
|
|
745
763
|
throw transformedError;
|
|
746
764
|
}
|
|
747
765
|
}
|
|
748
766
|
exports.updateLineItems = updateLineItems;
|
|
749
767
|
/**
|
|
750
|
-
*
|
|
768
|
+
* Applies or unapplies discounts on a draft order.
|
|
751
769
|
*
|
|
752
|
-
*
|
|
753
|
-
*
|
|
754
|
-
* @param
|
|
770
|
+
* Unapplied discounts are still part of draft order, but do not affect balance.
|
|
771
|
+
* Existing discounts, not mentioned in request, will keep their current state.
|
|
772
|
+
* @param draftOrderId - Draft order ID.
|
|
773
|
+
* @param discounts - Discount IDs to apply/unapply.
|
|
774
|
+
* Existing discounts, not mentioned in request, will keep their current state.
|
|
755
775
|
* @public
|
|
756
776
|
* @documentationMaturity preview
|
|
757
777
|
* @requiredField discounts
|
|
778
|
+
* @requiredField discounts._id
|
|
779
|
+
* @requiredField discounts.applied
|
|
758
780
|
* @requiredField draftOrderId
|
|
759
781
|
* @permissionId ECOM.DRAFT_ORDERS_SET_DISCOUNTS
|
|
760
782
|
* @permissionScope Manage Stores - all permissions
|
|
@@ -834,14 +856,17 @@ async function setDiscounts(draftOrderId, discounts) {
|
|
|
834
856
|
}
|
|
835
857
|
exports.setDiscounts = setDiscounts;
|
|
836
858
|
/**
|
|
837
|
-
*
|
|
838
|
-
*
|
|
859
|
+
* Create custom discounts on a draft order.
|
|
860
|
+
*
|
|
861
|
+
* Newly added discounts are unapplied by default.
|
|
862
|
+
* To apply them, use Set Discounts ([REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/draft-orders/set-discounts) | [SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/draft-orders/set-discounts)).
|
|
863
|
+
* @param draftOrderId - Draft order ID.
|
|
839
864
|
* @public
|
|
840
865
|
* @documentationMaturity preview
|
|
841
866
|
* @requiredField draftOrderId
|
|
842
|
-
* @requiredField options.discounts.amount
|
|
843
867
|
* @requiredField options.discounts.amount.amount
|
|
844
868
|
* @requiredField options.discounts.discountType
|
|
869
|
+
* @requiredField options.discounts.priceAmount.amount
|
|
845
870
|
* @permissionId ECOM.DRAFT_ORDERS_ADD_DISCOUNTS
|
|
846
871
|
* @permissionScope Manage Stores - all permissions
|
|
847
872
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -924,8 +949,8 @@ async function createCustomDiscounts(draftOrderId, options) {
|
|
|
924
949
|
exports.createCustomDiscounts = createCustomDiscounts;
|
|
925
950
|
/**
|
|
926
951
|
* Remove custom discounts from the order.
|
|
927
|
-
* @param draftOrderId -
|
|
928
|
-
* @param discountIds -
|
|
952
|
+
* @param draftOrderId - Draft order ID.
|
|
953
|
+
* @param discountIds - Ids of discounts to remove.
|
|
929
954
|
* @public
|
|
930
955
|
* @documentationMaturity preview
|
|
931
956
|
* @requiredField discountIds
|
|
@@ -1008,13 +1033,18 @@ async function deleteCustomDiscounts(draftOrderId, discountIds) {
|
|
|
1008
1033
|
}
|
|
1009
1034
|
exports.deleteCustomDiscounts = deleteCustomDiscounts;
|
|
1010
1035
|
/**
|
|
1011
|
-
*
|
|
1012
|
-
*
|
|
1013
|
-
*
|
|
1014
|
-
*
|
|
1036
|
+
* Applies or unapplies additional fees on a draft order.
|
|
1037
|
+
*
|
|
1038
|
+
* Unapplied fees are still part of draft order, but do not affect balance.
|
|
1039
|
+
* Existing additional fees, not mentioned in request, will keep their current state.
|
|
1040
|
+
* @param draftOrderId - Draft order ID.
|
|
1041
|
+
* @param additionalFees - Additional fee IDs to apply/unapply.
|
|
1042
|
+
* Existing additional fees, not mentioned in this list, will keep their current state.
|
|
1015
1043
|
* @public
|
|
1016
1044
|
* @documentationMaturity preview
|
|
1017
1045
|
* @requiredField additionalFees
|
|
1046
|
+
* @requiredField additionalFees._id
|
|
1047
|
+
* @requiredField additionalFees.applied
|
|
1018
1048
|
* @requiredField draftOrderId
|
|
1019
1049
|
* @permissionId ECOM.DRAFT_ORDERS_SET_ADDITIONAL_FEES
|
|
1020
1050
|
* @permissionScope Manage Stores - all permissions
|
|
@@ -1097,10 +1127,11 @@ async function setAdditionalFees(draftOrderId, additionalFees) {
|
|
|
1097
1127
|
}
|
|
1098
1128
|
exports.setAdditionalFees = setAdditionalFees;
|
|
1099
1129
|
/**
|
|
1100
|
-
*
|
|
1101
|
-
*
|
|
1102
|
-
*
|
|
1103
|
-
*
|
|
1130
|
+
* Creates custom additional fees on a draft order.
|
|
1131
|
+
*
|
|
1132
|
+
* Newly added additional fees are unapplied by default.
|
|
1133
|
+
* To apply them, use Set Additional Fees ([REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/draft-orders/set-additional-fees) | [SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/draft-orders/set-additional-fees)).
|
|
1134
|
+
* @param draftOrderId - Draft order ID.
|
|
1104
1135
|
* @public
|
|
1105
1136
|
* @documentationMaturity preview
|
|
1106
1137
|
* @requiredField draftOrderId
|
|
@@ -1189,8 +1220,8 @@ async function createCustomAdditionalFees(draftOrderId, options) {
|
|
|
1189
1220
|
exports.createCustomAdditionalFees = createCustomAdditionalFees;
|
|
1190
1221
|
/**
|
|
1191
1222
|
* Remove custom additional fees from the order.
|
|
1192
|
-
* @param draftOrderId -
|
|
1193
|
-
* @param customAdditionalFees -
|
|
1223
|
+
* @param draftOrderId - Draft order ID.
|
|
1224
|
+
* @param customAdditionalFees - Ids of additional fees to remove.
|
|
1194
1225
|
* @public
|
|
1195
1226
|
* @documentationMaturity preview
|
|
1196
1227
|
* @requiredField customAdditionalFees
|
|
@@ -1276,9 +1307,11 @@ async function deleteCustomAdditionalFees(draftOrderId, customAdditionalFees) {
|
|
|
1276
1307
|
}
|
|
1277
1308
|
exports.deleteCustomAdditionalFees = deleteCustomAdditionalFees;
|
|
1278
1309
|
/**
|
|
1279
|
-
* Sets shipping
|
|
1310
|
+
* Sets shipping information on a draft order.
|
|
1311
|
+
* @param draftOrderId - Draft order ID.
|
|
1280
1312
|
* @public
|
|
1281
1313
|
* @documentationMaturity preview
|
|
1314
|
+
* @requiredField draftOrderId
|
|
1282
1315
|
* @permissionId ECOM.DRAFT_ORDERS_SET_SHIPPING_INFO
|
|
1283
1316
|
* @permissionScope Manage Stores - all permissions
|
|
1284
1317
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1289,10 +1322,13 @@ exports.deleteCustomAdditionalFees = deleteCustomAdditionalFees;
|
|
|
1289
1322
|
* @applicableIdentity APP
|
|
1290
1323
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetShippingInfo
|
|
1291
1324
|
*/
|
|
1292
|
-
async function setShippingInfo() {
|
|
1325
|
+
async function setShippingInfo(draftOrderId, options) {
|
|
1293
1326
|
// @ts-ignore
|
|
1294
|
-
const { httpClient, sideEffects } = arguments[
|
|
1295
|
-
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1327
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1328
|
+
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1329
|
+
draftOrderId: draftOrderId,
|
|
1330
|
+
shippingInfo: options?.shippingInfo,
|
|
1331
|
+
}), [
|
|
1296
1332
|
{
|
|
1297
1333
|
transformFn: address_1.transformSDKAddressToRESTAddress,
|
|
1298
1334
|
paths: [
|
|
@@ -1306,22 +1342,70 @@ async function setShippingInfo() {
|
|
|
1306
1342
|
try {
|
|
1307
1343
|
const result = await httpClient.request(reqOpts);
|
|
1308
1344
|
sideEffects?.onSuccess?.(result);
|
|
1345
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1346
|
+
{
|
|
1347
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1348
|
+
paths: [
|
|
1349
|
+
{
|
|
1350
|
+
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1351
|
+
},
|
|
1352
|
+
],
|
|
1353
|
+
},
|
|
1354
|
+
{
|
|
1355
|
+
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1356
|
+
paths: [
|
|
1357
|
+
{
|
|
1358
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1359
|
+
},
|
|
1360
|
+
{
|
|
1361
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1362
|
+
},
|
|
1363
|
+
{
|
|
1364
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1365
|
+
},
|
|
1366
|
+
{
|
|
1367
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1368
|
+
},
|
|
1369
|
+
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1370
|
+
{
|
|
1371
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1372
|
+
},
|
|
1373
|
+
{
|
|
1374
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1375
|
+
},
|
|
1376
|
+
{
|
|
1377
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1378
|
+
},
|
|
1379
|
+
{
|
|
1380
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1381
|
+
},
|
|
1382
|
+
{
|
|
1383
|
+
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1384
|
+
},
|
|
1385
|
+
],
|
|
1386
|
+
},
|
|
1387
|
+
]));
|
|
1309
1388
|
}
|
|
1310
1389
|
catch (err) {
|
|
1311
1390
|
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1312
1391
|
spreadPathsToArguments: {},
|
|
1313
|
-
explicitPathsToArguments: {
|
|
1392
|
+
explicitPathsToArguments: {
|
|
1393
|
+
draftOrderId: '$[0]',
|
|
1394
|
+
shippingInfo: '$[1].shippingInfo',
|
|
1395
|
+
},
|
|
1314
1396
|
singleArgumentUnchanged: false,
|
|
1315
|
-
}, []);
|
|
1397
|
+
}, ['draftOrderId', 'options']);
|
|
1316
1398
|
sideEffects?.onError?.(err);
|
|
1317
1399
|
throw transformedError;
|
|
1318
1400
|
}
|
|
1319
1401
|
}
|
|
1320
1402
|
exports.setShippingInfo = setShippingInfo;
|
|
1321
1403
|
/**
|
|
1322
|
-
* Sets buyer info
|
|
1404
|
+
* Sets buyer info on a draft order.
|
|
1405
|
+
* @param draftOrderId - Draft order ID.
|
|
1323
1406
|
* @public
|
|
1324
1407
|
* @documentationMaturity preview
|
|
1408
|
+
* @requiredField draftOrderId
|
|
1325
1409
|
* @permissionId ECOM.DRAFT_ORDER_SET_BUYER_INFO
|
|
1326
1410
|
* @permissionScope Manage Stores - all permissions
|
|
1327
1411
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1332,31 +1416,82 @@ exports.setShippingInfo = setShippingInfo;
|
|
|
1332
1416
|
* @applicableIdentity APP
|
|
1333
1417
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetBuyerInfo
|
|
1334
1418
|
*/
|
|
1335
|
-
async function setBuyerInfo() {
|
|
1419
|
+
async function setBuyerInfo(draftOrderId, options) {
|
|
1336
1420
|
// @ts-ignore
|
|
1337
|
-
const { httpClient, sideEffects } = arguments[
|
|
1338
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1421
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1422
|
+
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1423
|
+
draftOrderId: draftOrderId,
|
|
1424
|
+
buyerInfo: options?.buyerInfo,
|
|
1425
|
+
});
|
|
1339
1426
|
const reqOpts = ambassadorWixEcomV1DraftOrder.setBuyerInfo(payload);
|
|
1340
1427
|
sideEffects?.onSiteCall?.();
|
|
1341
1428
|
try {
|
|
1342
1429
|
const result = await httpClient.request(reqOpts);
|
|
1343
1430
|
sideEffects?.onSuccess?.(result);
|
|
1431
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1432
|
+
{
|
|
1433
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1434
|
+
paths: [
|
|
1435
|
+
{
|
|
1436
|
+
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1437
|
+
},
|
|
1438
|
+
],
|
|
1439
|
+
},
|
|
1440
|
+
{
|
|
1441
|
+
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1442
|
+
paths: [
|
|
1443
|
+
{
|
|
1444
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1445
|
+
},
|
|
1446
|
+
{
|
|
1447
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1448
|
+
},
|
|
1449
|
+
{
|
|
1450
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1451
|
+
},
|
|
1452
|
+
{
|
|
1453
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1454
|
+
},
|
|
1455
|
+
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1456
|
+
{
|
|
1457
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1458
|
+
},
|
|
1459
|
+
{
|
|
1460
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1461
|
+
},
|
|
1462
|
+
{
|
|
1463
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1464
|
+
},
|
|
1465
|
+
{
|
|
1466
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1467
|
+
},
|
|
1468
|
+
{
|
|
1469
|
+
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1470
|
+
},
|
|
1471
|
+
],
|
|
1472
|
+
},
|
|
1473
|
+
]));
|
|
1344
1474
|
}
|
|
1345
1475
|
catch (err) {
|
|
1346
1476
|
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1347
1477
|
spreadPathsToArguments: {},
|
|
1348
|
-
explicitPathsToArguments: {
|
|
1478
|
+
explicitPathsToArguments: {
|
|
1479
|
+
draftOrderId: '$[0]',
|
|
1480
|
+
buyerInfo: '$[1].buyerInfo',
|
|
1481
|
+
},
|
|
1349
1482
|
singleArgumentUnchanged: false,
|
|
1350
|
-
}, []);
|
|
1483
|
+
}, ['draftOrderId', 'options']);
|
|
1351
1484
|
sideEffects?.onError?.(err);
|
|
1352
1485
|
throw transformedError;
|
|
1353
1486
|
}
|
|
1354
1487
|
}
|
|
1355
1488
|
exports.setBuyerInfo = setBuyerInfo;
|
|
1356
1489
|
/**
|
|
1357
|
-
* Sets recipient info
|
|
1490
|
+
* Sets recipient info on a draft order.
|
|
1491
|
+
* @param draftOrderId - Draft order ID.
|
|
1358
1492
|
* @public
|
|
1359
1493
|
* @documentationMaturity preview
|
|
1494
|
+
* @requiredField draftOrderId
|
|
1360
1495
|
* @permissionId ECOM.DRAFT_ORDER_SET_RECIPIENT_INFO
|
|
1361
1496
|
* @permissionScope Manage Stores - all permissions
|
|
1362
1497
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1367,10 +1502,13 @@ exports.setBuyerInfo = setBuyerInfo;
|
|
|
1367
1502
|
* @applicableIdentity APP
|
|
1368
1503
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetRecipientInfo
|
|
1369
1504
|
*/
|
|
1370
|
-
async function setRecipientInfo() {
|
|
1505
|
+
async function setRecipientInfo(draftOrderId, options) {
|
|
1371
1506
|
// @ts-ignore
|
|
1372
|
-
const { httpClient, sideEffects } = arguments[
|
|
1373
|
-
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1507
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1508
|
+
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1509
|
+
draftOrderId: draftOrderId,
|
|
1510
|
+
recipientInfo: options?.recipientInfo,
|
|
1511
|
+
}), [
|
|
1374
1512
|
{
|
|
1375
1513
|
transformFn: address_1.transformSDKAddressToRESTAddress,
|
|
1376
1514
|
paths: [{ path: 'recipientInfo.address' }],
|
|
@@ -1381,22 +1519,70 @@ async function setRecipientInfo() {
|
|
|
1381
1519
|
try {
|
|
1382
1520
|
const result = await httpClient.request(reqOpts);
|
|
1383
1521
|
sideEffects?.onSuccess?.(result);
|
|
1522
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1523
|
+
{
|
|
1524
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1525
|
+
paths: [
|
|
1526
|
+
{
|
|
1527
|
+
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1528
|
+
},
|
|
1529
|
+
],
|
|
1530
|
+
},
|
|
1531
|
+
{
|
|
1532
|
+
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1533
|
+
paths: [
|
|
1534
|
+
{
|
|
1535
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1536
|
+
},
|
|
1537
|
+
{
|
|
1538
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1539
|
+
},
|
|
1540
|
+
{
|
|
1541
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1542
|
+
},
|
|
1543
|
+
{
|
|
1544
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1545
|
+
},
|
|
1546
|
+
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1547
|
+
{
|
|
1548
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1549
|
+
},
|
|
1550
|
+
{
|
|
1551
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1552
|
+
},
|
|
1553
|
+
{
|
|
1554
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1555
|
+
},
|
|
1556
|
+
{
|
|
1557
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1558
|
+
},
|
|
1559
|
+
{
|
|
1560
|
+
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1561
|
+
},
|
|
1562
|
+
],
|
|
1563
|
+
},
|
|
1564
|
+
]));
|
|
1384
1565
|
}
|
|
1385
1566
|
catch (err) {
|
|
1386
1567
|
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1387
1568
|
spreadPathsToArguments: {},
|
|
1388
|
-
explicitPathsToArguments: {
|
|
1569
|
+
explicitPathsToArguments: {
|
|
1570
|
+
draftOrderId: '$[0]',
|
|
1571
|
+
recipientInfo: '$[1].recipientInfo',
|
|
1572
|
+
},
|
|
1389
1573
|
singleArgumentUnchanged: false,
|
|
1390
|
-
}, []);
|
|
1574
|
+
}, ['draftOrderId', 'options']);
|
|
1391
1575
|
sideEffects?.onError?.(err);
|
|
1392
1576
|
throw transformedError;
|
|
1393
1577
|
}
|
|
1394
1578
|
}
|
|
1395
1579
|
exports.setRecipientInfo = setRecipientInfo;
|
|
1396
1580
|
/**
|
|
1397
|
-
* Sets billing info
|
|
1581
|
+
* Sets billing info on a draft order.
|
|
1582
|
+
* @param draftOrderId - Draft order ID.
|
|
1398
1583
|
* @public
|
|
1399
1584
|
* @documentationMaturity preview
|
|
1585
|
+
* @requiredField draftOrderId
|
|
1400
1586
|
* @permissionId ECOM.DRAFT_ORDER_SET_BILLING_INFO
|
|
1401
1587
|
* @permissionScope Manage Stores - all permissions
|
|
1402
1588
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1407,10 +1593,13 @@ exports.setRecipientInfo = setRecipientInfo;
|
|
|
1407
1593
|
* @applicableIdentity APP
|
|
1408
1594
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetBillingInfo
|
|
1409
1595
|
*/
|
|
1410
|
-
async function setBillingInfo() {
|
|
1596
|
+
async function setBillingInfo(draftOrderId, options) {
|
|
1411
1597
|
// @ts-ignore
|
|
1412
|
-
const { httpClient, sideEffects } = arguments[
|
|
1413
|
-
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1598
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1599
|
+
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1600
|
+
draftOrderId: draftOrderId,
|
|
1601
|
+
billingInfo: options?.billingInfo,
|
|
1602
|
+
}), [
|
|
1414
1603
|
{
|
|
1415
1604
|
transformFn: address_1.transformSDKAddressToRESTAddress,
|
|
1416
1605
|
paths: [{ path: 'billingInfo.address' }],
|
|
@@ -1421,25 +1610,72 @@ async function setBillingInfo() {
|
|
|
1421
1610
|
try {
|
|
1422
1611
|
const result = await httpClient.request(reqOpts);
|
|
1423
1612
|
sideEffects?.onSuccess?.(result);
|
|
1613
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1614
|
+
{
|
|
1615
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1616
|
+
paths: [
|
|
1617
|
+
{
|
|
1618
|
+
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
1619
|
+
},
|
|
1620
|
+
],
|
|
1621
|
+
},
|
|
1622
|
+
{
|
|
1623
|
+
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1624
|
+
paths: [
|
|
1625
|
+
{
|
|
1626
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1627
|
+
},
|
|
1628
|
+
{
|
|
1629
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1630
|
+
},
|
|
1631
|
+
{
|
|
1632
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1633
|
+
},
|
|
1634
|
+
{
|
|
1635
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1636
|
+
},
|
|
1637
|
+
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
1638
|
+
{
|
|
1639
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1640
|
+
},
|
|
1641
|
+
{
|
|
1642
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
1643
|
+
},
|
|
1644
|
+
{
|
|
1645
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1646
|
+
},
|
|
1647
|
+
{
|
|
1648
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
1649
|
+
},
|
|
1650
|
+
{
|
|
1651
|
+
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
1652
|
+
},
|
|
1653
|
+
],
|
|
1654
|
+
},
|
|
1655
|
+
]));
|
|
1424
1656
|
}
|
|
1425
1657
|
catch (err) {
|
|
1426
1658
|
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1427
1659
|
spreadPathsToArguments: {},
|
|
1428
|
-
explicitPathsToArguments: {
|
|
1660
|
+
explicitPathsToArguments: {
|
|
1661
|
+
draftOrderId: '$[0]',
|
|
1662
|
+
billingInfo: '$[1].billingInfo',
|
|
1663
|
+
},
|
|
1429
1664
|
singleArgumentUnchanged: false,
|
|
1430
|
-
}, []);
|
|
1665
|
+
}, ['draftOrderId', 'options']);
|
|
1431
1666
|
sideEffects?.onError?.(err);
|
|
1432
1667
|
throw transformedError;
|
|
1433
1668
|
}
|
|
1434
1669
|
}
|
|
1435
1670
|
exports.setBillingInfo = setBillingInfo;
|
|
1436
1671
|
/**
|
|
1437
|
-
*
|
|
1438
|
-
*
|
|
1672
|
+
* Gets a draft order.
|
|
1673
|
+
*
|
|
1674
|
+
* Draft order is recalculated and contains latest tax and totals (unless already committed).
|
|
1439
1675
|
* Automatic discounts and automatic additional fees will reflect the latest prices and eligibility.
|
|
1440
1676
|
* Calculation will be based on current draft order content - items, shipping info and eligible discounts and additional fees.
|
|
1441
|
-
* When
|
|
1442
|
-
* @param draftOrderId -
|
|
1677
|
+
* When retrieving an already committed draft, it's not recalculated and contains data calculated during commit.
|
|
1678
|
+
* @param draftOrderId - Draft order ID.
|
|
1443
1679
|
* @public
|
|
1444
1680
|
* @documentationMaturity preview
|
|
1445
1681
|
* @requiredField draftOrderId
|
|
@@ -1521,8 +1757,8 @@ async function getDraftOrder(draftOrderId) {
|
|
|
1521
1757
|
}
|
|
1522
1758
|
exports.getDraftOrder = getDraftOrder;
|
|
1523
1759
|
/**
|
|
1524
|
-
* Checks whether a draft can be created for this order
|
|
1525
|
-
* @param orderId - Order
|
|
1760
|
+
* Checks whether a draft can be created for this order.
|
|
1761
|
+
* @param orderId - Order Id.
|
|
1526
1762
|
* @public
|
|
1527
1763
|
* @documentationMaturity preview
|
|
1528
1764
|
* @requiredField orderId
|
|
@@ -1559,10 +1795,11 @@ async function getOrderDraftabilityStatus(orderId) {
|
|
|
1559
1795
|
}
|
|
1560
1796
|
exports.getOrderDraftabilityStatus = getOrderDraftabilityStatus;
|
|
1561
1797
|
/**
|
|
1562
|
-
* Commit latest changes to the baseline order and control
|
|
1798
|
+
* Commit latest changes to the baseline order and control which side-effects are executed.
|
|
1799
|
+
*
|
|
1563
1800
|
* Commit cannot be undone or reverted.
|
|
1564
|
-
*
|
|
1565
|
-
* @param draftOrderId -
|
|
1801
|
+
* Committed draft will become closed for further modifications, however it's kept for reference and can be retrieved.
|
|
1802
|
+
* @param draftOrderId - Draft order ID.
|
|
1566
1803
|
* @public
|
|
1567
1804
|
* @documentationMaturity preview
|
|
1568
1805
|
* @requiredField draftOrderId
|
|
@@ -1650,11 +1887,14 @@ async function commitDraftOrder(draftOrderId, options) {
|
|
|
1650
1887
|
}
|
|
1651
1888
|
exports.commitDraftOrder = commitDraftOrder;
|
|
1652
1889
|
/**
|
|
1653
|
-
*
|
|
1890
|
+
* Creates a new order while specifying which side-effects are executed.
|
|
1891
|
+
*
|
|
1654
1892
|
* Commit cannot be undone or reverted.
|
|
1655
|
-
*
|
|
1893
|
+
* Committed draft will become closed for further modifications, however it's kept for reference and can be retrieved.
|
|
1894
|
+
* @param draftOrderId - Draft order ID.
|
|
1656
1895
|
* @public
|
|
1657
1896
|
* @documentationMaturity preview
|
|
1897
|
+
* @requiredField draftOrderId
|
|
1658
1898
|
* @permissionId ECOM.DRAFT_ORDER_CREATE_ORDER_FROM_DRAFT
|
|
1659
1899
|
* @permissionId ECOM.DRAFT_ORDER_READ_ALL_EXTENDED_FIELDS
|
|
1660
1900
|
* @permissionScope Manage Stores - all permissions
|
|
@@ -1666,31 +1906,85 @@ exports.commitDraftOrder = commitDraftOrder;
|
|
|
1666
1906
|
* @applicableIdentity APP
|
|
1667
1907
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.CreateOrderFromDraft
|
|
1668
1908
|
*/
|
|
1669
|
-
async function createOrderFromDraft() {
|
|
1909
|
+
async function createOrderFromDraft(draftOrderId, options) {
|
|
1670
1910
|
// @ts-ignore
|
|
1671
|
-
const { httpClient, sideEffects } = arguments[
|
|
1672
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1911
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1912
|
+
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
1913
|
+
draftOrderId: draftOrderId,
|
|
1914
|
+
createSettings: options?.createSettings,
|
|
1915
|
+
reason: options?.reason,
|
|
1916
|
+
channelInfo: options?.channelInfo,
|
|
1917
|
+
});
|
|
1673
1918
|
const reqOpts = ambassadorWixEcomV1DraftOrder.createOrderFromDraft(payload);
|
|
1674
1919
|
sideEffects?.onSiteCall?.();
|
|
1675
1920
|
try {
|
|
1676
1921
|
const result = await httpClient.request(reqOpts);
|
|
1677
1922
|
sideEffects?.onSuccess?.(result);
|
|
1923
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
1924
|
+
{
|
|
1925
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
1926
|
+
paths: [
|
|
1927
|
+
{ path: 'committedDraftOrder.lineItems.lineItem.image' },
|
|
1928
|
+
{ path: 'createdOrder.lineItems.image' },
|
|
1929
|
+
],
|
|
1930
|
+
},
|
|
1931
|
+
{
|
|
1932
|
+
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
1933
|
+
paths: [
|
|
1934
|
+
{
|
|
1935
|
+
path: 'committedDraftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
1936
|
+
},
|
|
1937
|
+
{
|
|
1938
|
+
path: 'committedDraftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
1939
|
+
},
|
|
1940
|
+
{
|
|
1941
|
+
path: 'committedDraftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
1942
|
+
},
|
|
1943
|
+
{
|
|
1944
|
+
path: 'committedDraftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
1945
|
+
},
|
|
1946
|
+
{ path: 'committedDraftOrder.billingInfo.address' },
|
|
1947
|
+
{
|
|
1948
|
+
path: 'committedDraftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
1949
|
+
},
|
|
1950
|
+
{ path: 'committedDraftOrder.recipientInfo.recipientInfo.address' },
|
|
1951
|
+
{
|
|
1952
|
+
path: 'committedDraftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
1953
|
+
},
|
|
1954
|
+
{ path: 'committedDraftOrder.billingDetails.billingInfo.address' },
|
|
1955
|
+
{ path: 'createdOrder.billingInfo.address' },
|
|
1956
|
+
{
|
|
1957
|
+
path: 'createdOrder.shippingInfo.logistics.shippingDestination.address',
|
|
1958
|
+
},
|
|
1959
|
+
{
|
|
1960
|
+
path: 'createdOrder.shippingInfo.logistics.pickupDetails.address',
|
|
1961
|
+
},
|
|
1962
|
+
{ path: 'createdOrder.recipientInfo.address' },
|
|
1963
|
+
],
|
|
1964
|
+
},
|
|
1965
|
+
]));
|
|
1678
1966
|
}
|
|
1679
1967
|
catch (err) {
|
|
1680
1968
|
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1681
1969
|
spreadPathsToArguments: {},
|
|
1682
|
-
explicitPathsToArguments: {
|
|
1970
|
+
explicitPathsToArguments: {
|
|
1971
|
+
draftOrderId: '$[0]',
|
|
1972
|
+
createSettings: '$[1].createSettings',
|
|
1973
|
+
reason: '$[1].reason',
|
|
1974
|
+
channelInfo: '$[1].channelInfo',
|
|
1975
|
+
},
|
|
1683
1976
|
singleArgumentUnchanged: false,
|
|
1684
|
-
}, []);
|
|
1977
|
+
}, ['draftOrderId', 'options']);
|
|
1685
1978
|
sideEffects?.onError?.(err);
|
|
1686
1979
|
throw transformedError;
|
|
1687
1980
|
}
|
|
1688
1981
|
}
|
|
1689
1982
|
exports.createOrderFromDraft = createOrderFromDraft;
|
|
1690
1983
|
/**
|
|
1691
|
-
*
|
|
1692
|
-
*
|
|
1693
|
-
*
|
|
1984
|
+
* Deletes a draft order along with all its pending changes.
|
|
1985
|
+
*
|
|
1986
|
+
* Draft orders in status 'COMMITTED' cannot be deleted.
|
|
1987
|
+
* @param draftOrderId - Draft order ID.
|
|
1694
1988
|
* @public
|
|
1695
1989
|
* @documentationMaturity preview
|
|
1696
1990
|
* @requiredField draftOrderId
|
|
@@ -1827,9 +2121,103 @@ function queryDraftOrders() {
|
|
|
1827
2121
|
}
|
|
1828
2122
|
exports.queryDraftOrders = queryDraftOrders;
|
|
1829
2123
|
/**
|
|
1830
|
-
*
|
|
2124
|
+
* Updates extended fields on a draft order.
|
|
2125
|
+
* @param _id - ID of the entity to update.
|
|
2126
|
+
* @param namespace - Identifier for the app whose extended fields are being updated.
|
|
2127
|
+
* @public
|
|
2128
|
+
* @documentationMaturity preview
|
|
2129
|
+
* @requiredField _id
|
|
2130
|
+
* @requiredField namespace
|
|
2131
|
+
* @requiredField options
|
|
2132
|
+
* @requiredField options.namespaceData
|
|
2133
|
+
* @permissionId ECOM.DRAFT_ORDER_UPDATE_EXTENDED_FIELDS
|
|
2134
|
+
* @permissionId ECOM.DRAFT_ORDER_WRITE_ALL_EXTENDED_FIELDS
|
|
2135
|
+
* @permissionScope Manage Stores - all permissions
|
|
2136
|
+
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
2137
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
2138
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
2139
|
+
* @permissionScope Manage eCommerce - all permissions
|
|
2140
|
+
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
2141
|
+
* @permissionScope Manage Stores - all permissions
|
|
2142
|
+
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
2143
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
2144
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
2145
|
+
* @permissionScope Manage eCommerce - all permissions
|
|
2146
|
+
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
2147
|
+
* @permissionScope Manage Orders
|
|
2148
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
2149
|
+
* @applicableIdentity APP
|
|
2150
|
+
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.UpdateExtendedFields
|
|
2151
|
+
*/
|
|
2152
|
+
async function updateExtendedFields(_id, namespace, options) {
|
|
2153
|
+
// @ts-ignore
|
|
2154
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
2155
|
+
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
2156
|
+
id: _id,
|
|
2157
|
+
namespace: namespace,
|
|
2158
|
+
namespaceData: options?.namespaceData,
|
|
2159
|
+
});
|
|
2160
|
+
const reqOpts = ambassadorWixEcomV1DraftOrder.updateExtendedFields(payload);
|
|
2161
|
+
sideEffects?.onSiteCall?.();
|
|
2162
|
+
try {
|
|
2163
|
+
const result = await httpClient.request(reqOpts);
|
|
2164
|
+
sideEffects?.onSuccess?.(result);
|
|
2165
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
2166
|
+
{
|
|
2167
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
2168
|
+
paths: [{ path: 'draftOrder.lineItems.lineItem.image' }],
|
|
2169
|
+
},
|
|
2170
|
+
{
|
|
2171
|
+
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
2172
|
+
paths: [
|
|
2173
|
+
{
|
|
2174
|
+
path: 'draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
2175
|
+
},
|
|
2176
|
+
{
|
|
2177
|
+
path: 'draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
2178
|
+
},
|
|
2179
|
+
{
|
|
2180
|
+
path: 'draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
2181
|
+
},
|
|
2182
|
+
{
|
|
2183
|
+
path: 'draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
2184
|
+
},
|
|
2185
|
+
{ path: 'draftOrder.billingInfo.address' },
|
|
2186
|
+
{
|
|
2187
|
+
path: 'draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
2188
|
+
},
|
|
2189
|
+
{ path: 'draftOrder.recipientInfo.recipientInfo.address' },
|
|
2190
|
+
{
|
|
2191
|
+
path: 'draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
2192
|
+
},
|
|
2193
|
+
{ path: 'draftOrder.billingDetails.billingInfo.address' },
|
|
2194
|
+
],
|
|
2195
|
+
},
|
|
2196
|
+
]));
|
|
2197
|
+
}
|
|
2198
|
+
catch (err) {
|
|
2199
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
2200
|
+
spreadPathsToArguments: {},
|
|
2201
|
+
explicitPathsToArguments: {
|
|
2202
|
+
id: '$[0]',
|
|
2203
|
+
namespace: '$[1]',
|
|
2204
|
+
namespaceData: '$[2].namespaceData',
|
|
2205
|
+
},
|
|
2206
|
+
singleArgumentUnchanged: false,
|
|
2207
|
+
}, ['_id', 'namespace', 'options']);
|
|
2208
|
+
sideEffects?.onError?.(err);
|
|
2209
|
+
throw transformedError;
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
exports.updateExtendedFields = updateExtendedFields;
|
|
2213
|
+
/**
|
|
2214
|
+
* Sets tax exemption on a draft order.
|
|
2215
|
+
* @param draftOrderId - Draft order ID.
|
|
1831
2216
|
* @public
|
|
1832
2217
|
* @documentationMaturity preview
|
|
2218
|
+
* @requiredField draftOrderId
|
|
2219
|
+
* @requiredField options
|
|
2220
|
+
* @requiredField options.taxExempt
|
|
1833
2221
|
* @permissionId ECOM.DRAFT_ORDER_SET_TAX_EXEMPTION
|
|
1834
2222
|
* @permissionScope Manage Stores - all permissions
|
|
1835
2223
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1840,31 +2228,83 @@ exports.queryDraftOrders = queryDraftOrders;
|
|
|
1840
2228
|
* @applicableIdentity APP
|
|
1841
2229
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetTaxExemption
|
|
1842
2230
|
*/
|
|
1843
|
-
async function setTaxExemption() {
|
|
2231
|
+
async function setTaxExemption(draftOrderId, options) {
|
|
1844
2232
|
// @ts-ignore
|
|
1845
|
-
const { httpClient, sideEffects } = arguments[
|
|
1846
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
2233
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
2234
|
+
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
2235
|
+
draftOrderId: draftOrderId,
|
|
2236
|
+
taxExempt: options?.taxExempt,
|
|
2237
|
+
});
|
|
1847
2238
|
const reqOpts = ambassadorWixEcomV1DraftOrder.setTaxExemption(payload);
|
|
1848
2239
|
sideEffects?.onSiteCall?.();
|
|
1849
2240
|
try {
|
|
1850
2241
|
const result = await httpClient.request(reqOpts);
|
|
1851
2242
|
sideEffects?.onSuccess?.(result);
|
|
2243
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
2244
|
+
{
|
|
2245
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
2246
|
+
paths: [
|
|
2247
|
+
{
|
|
2248
|
+
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
2249
|
+
},
|
|
2250
|
+
],
|
|
2251
|
+
},
|
|
2252
|
+
{
|
|
2253
|
+
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
2254
|
+
paths: [
|
|
2255
|
+
{
|
|
2256
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
2257
|
+
},
|
|
2258
|
+
{
|
|
2259
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
2260
|
+
},
|
|
2261
|
+
{
|
|
2262
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
2263
|
+
},
|
|
2264
|
+
{
|
|
2265
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
2266
|
+
},
|
|
2267
|
+
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
2268
|
+
{
|
|
2269
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
2270
|
+
},
|
|
2271
|
+
{
|
|
2272
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
2273
|
+
},
|
|
2274
|
+
{
|
|
2275
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
2276
|
+
},
|
|
2277
|
+
{
|
|
2278
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
2279
|
+
},
|
|
2280
|
+
{
|
|
2281
|
+
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
2282
|
+
},
|
|
2283
|
+
],
|
|
2284
|
+
},
|
|
2285
|
+
]));
|
|
1852
2286
|
}
|
|
1853
2287
|
catch (err) {
|
|
1854
2288
|
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1855
2289
|
spreadPathsToArguments: {},
|
|
1856
|
-
explicitPathsToArguments: {
|
|
2290
|
+
explicitPathsToArguments: {
|
|
2291
|
+
draftOrderId: '$[0]',
|
|
2292
|
+
taxExempt: '$[1].taxExempt',
|
|
2293
|
+
},
|
|
1857
2294
|
singleArgumentUnchanged: false,
|
|
1858
|
-
}, []);
|
|
2295
|
+
}, ['draftOrderId', 'options']);
|
|
1859
2296
|
sideEffects?.onError?.(err);
|
|
1860
2297
|
throw transformedError;
|
|
1861
2298
|
}
|
|
1862
2299
|
}
|
|
1863
2300
|
exports.setTaxExemption = setTaxExemption;
|
|
1864
2301
|
/**
|
|
1865
|
-
* Sets business location
|
|
2302
|
+
* Sets business location on a draft order.
|
|
2303
|
+
* @param draftOrderId - Draft order ID.
|
|
1866
2304
|
* @public
|
|
1867
2305
|
* @documentationMaturity preview
|
|
2306
|
+
* @requiredField draftOrderId
|
|
2307
|
+
* @requiredField options.businessLocation._id
|
|
1868
2308
|
* @permissionId ECOM.DRAFT_ORDER_SET_BUSINESS_LOCATION
|
|
1869
2309
|
* @permissionScope Manage Stores - all permissions
|
|
1870
2310
|
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
@@ -1875,22 +2315,71 @@ exports.setTaxExemption = setTaxExemption;
|
|
|
1875
2315
|
* @applicableIdentity APP
|
|
1876
2316
|
* @fqn com.wix.ecom.orders.draft.v1.DraftOrders.SetBusinessLocation
|
|
1877
2317
|
*/
|
|
1878
|
-
async function setBusinessLocation() {
|
|
2318
|
+
async function setBusinessLocation(draftOrderId, options) {
|
|
1879
2319
|
// @ts-ignore
|
|
1880
|
-
const { httpClient, sideEffects } = arguments[
|
|
1881
|
-
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
2320
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
2321
|
+
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
2322
|
+
draftOrderId: draftOrderId,
|
|
2323
|
+
businessLocation: options?.businessLocation,
|
|
2324
|
+
});
|
|
1882
2325
|
const reqOpts = ambassadorWixEcomV1DraftOrder.setBusinessLocation(payload);
|
|
1883
2326
|
sideEffects?.onSiteCall?.();
|
|
1884
2327
|
try {
|
|
1885
2328
|
const result = await httpClient.request(reqOpts);
|
|
1886
2329
|
sideEffects?.onSuccess?.(result);
|
|
2330
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
2331
|
+
{
|
|
2332
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
2333
|
+
paths: [
|
|
2334
|
+
{
|
|
2335
|
+
path: 'calculatedDraftOrder.draftOrder.lineItems.lineItem.image',
|
|
2336
|
+
},
|
|
2337
|
+
],
|
|
2338
|
+
},
|
|
2339
|
+
{
|
|
2340
|
+
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
2341
|
+
paths: [
|
|
2342
|
+
{
|
|
2343
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.shippingDestination.address',
|
|
2344
|
+
},
|
|
2345
|
+
{
|
|
2346
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.changedDetails.shippingInfoBeforeChange.logistics.pickupDetails.address',
|
|
2347
|
+
},
|
|
2348
|
+
{
|
|
2349
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.shippingDestination.address',
|
|
2350
|
+
},
|
|
2351
|
+
{
|
|
2352
|
+
path: 'calculatedDraftOrder.draftOrder.shippingInfo.shippingInfo.logistics.pickupDetails.address',
|
|
2353
|
+
},
|
|
2354
|
+
{ path: 'calculatedDraftOrder.draftOrder.billingInfo.address' },
|
|
2355
|
+
{
|
|
2356
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.changedDetails.recipientInfoBeforeChange.address',
|
|
2357
|
+
},
|
|
2358
|
+
{
|
|
2359
|
+
path: 'calculatedDraftOrder.draftOrder.recipientInfo.recipientInfo.address',
|
|
2360
|
+
},
|
|
2361
|
+
{
|
|
2362
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.changedDetails.billingInfoBeforeChange.address',
|
|
2363
|
+
},
|
|
2364
|
+
{
|
|
2365
|
+
path: 'calculatedDraftOrder.draftOrder.billingDetails.billingInfo.address',
|
|
2366
|
+
},
|
|
2367
|
+
{
|
|
2368
|
+
path: 'calculatedDraftOrder.shippingOptions.logistics.pickupDetails.address',
|
|
2369
|
+
},
|
|
2370
|
+
],
|
|
2371
|
+
},
|
|
2372
|
+
]));
|
|
1887
2373
|
}
|
|
1888
2374
|
catch (err) {
|
|
1889
2375
|
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
1890
2376
|
spreadPathsToArguments: {},
|
|
1891
|
-
explicitPathsToArguments: {
|
|
2377
|
+
explicitPathsToArguments: {
|
|
2378
|
+
draftOrderId: '$[0]',
|
|
2379
|
+
businessLocation: '$[1].businessLocation',
|
|
2380
|
+
},
|
|
1892
2381
|
singleArgumentUnchanged: false,
|
|
1893
|
-
}, []);
|
|
2382
|
+
}, ['draftOrderId', 'options']);
|
|
1894
2383
|
sideEffects?.onError?.(err);
|
|
1895
2384
|
throw transformedError;
|
|
1896
2385
|
}
|