@labdigital/commercetools-mock 2.27.0 → 2.28.1
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/dist/index.cjs +72 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +72 -16
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/oauth/server.test.ts +1 -0
- package/src/repositories/business-unit.ts +40 -8
- package/src/repositories/cart/actions.ts +8 -4
- package/src/repositories/customer/index.ts +1 -0
- package/src/repositories/helpers.ts +1 -2
- package/src/repositories/index.ts +2 -0
- package/src/repositories/order/actions.ts +22 -0
- package/src/repositories/product-tailoring.ts +34 -0
- package/src/repositories/shipping-method/actions.ts +10 -1
- package/src/repositories/shipping-method/index.ts +1 -0
- package/src/services/customer.test.ts +2 -0
- package/src/services/my-customer.test.ts +11 -3
- package/src/services/order.test.ts +161 -0
- package/src/services/shipping-method.test.ts +1 -0
- package/src/storage/in-memory.ts +2 -0
- package/src/types.ts +2 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import { SetupServerApi, SetupServer } from 'msw/node';
|
|
3
3
|
import * as ctp from '@commercetools/platform-sdk';
|
|
4
|
-
import { QueryParam, BaseResource, Project, UpdateAction, ResourceIdentifier, AssociateRoleDraft, AssociateRole, AttributeGroupDraft, AttributeGroup, BusinessUnitDraft, BusinessUnit, CartDraft, Cart, LineItemDraft, LineItem, CartDiscountDraft, CartDiscount, CategoryDraft, Category, ChannelDraft, Channel, CustomObjectDraft, CustomObject, CustomerDraft, Customer, CustomerCreatePasswordResetToken, CustomerToken, CustomerResetPassword, MyCustomerResetPassword, CustomerGroupDraft, CustomerGroup, DiscountCodeDraft, DiscountCode, ExtensionDraft, Extension, InventoryEntryDraft, InventoryEntry, MyCustomerChangePassword, MyCustomerEmailVerify, OrderFromCartDraft, Order, CartReference, OrderImportDraft, MyOrderFromCartDraft, OrderEditDraft, OrderEdit, PaymentDraft, Payment, ProductDraft, Product, ProductDiscountDraft, ProductDiscount, ProductProjectionPagedSearchResponse, ProductProjection, FacetResults, TermFacetResult, FilteredFacetResult, RangeFacetResult, ProductSelectionDraft, ProductSelection, ProductTypeDraft, ProductType, QuoteDraft, Quote, QuoteRequestDraft, QuoteRequest, ReviewDraft, Review, ShippingMethodDraft, ShippingMethod, ZoneReference, ShoppingListDraft, ShoppingList, ShoppingListLineItem, StagedQuoteDraft, StagedQuote, StandalonePriceDraft, StandalonePrice, ChannelResourceIdentifier, ChannelReference, StateDraft, State, StoreDraft, Store, SubscriptionDraft, Subscription, TaxCategoryDraft, TaxCategory, TypeDraft, Type, ZoneDraft, Zone } from '@commercetools/platform-sdk';
|
|
4
|
+
import { QueryParam, BaseResource, Project, UpdateAction, ResourceIdentifier, ProductTailoring, AssociateRoleDraft, AssociateRole, AttributeGroupDraft, AttributeGroup, BusinessUnitDraft, BusinessUnit, CartDraft, Cart, LineItemDraft, LineItem, CartDiscountDraft, CartDiscount, CategoryDraft, Category, ChannelDraft, Channel, CustomObjectDraft, CustomObject, CustomerDraft, Customer, CustomerCreatePasswordResetToken, CustomerToken, CustomerResetPassword, MyCustomerResetPassword, CustomerGroupDraft, CustomerGroup, DiscountCodeDraft, DiscountCode, ExtensionDraft, Extension, InventoryEntryDraft, InventoryEntry, MyCustomerChangePassword, MyCustomerEmailVerify, OrderFromCartDraft, Order, CartReference, OrderImportDraft, MyOrderFromCartDraft, OrderEditDraft, OrderEdit, PaymentDraft, Payment, ProductDraft, Product, ProductDiscountDraft, ProductDiscount, ProductProjectionPagedSearchResponse, ProductProjection, FacetResults, TermFacetResult, FilteredFacetResult, RangeFacetResult, ProductSelectionDraft, ProductSelection, ProductTypeDraft, ProductType, QuoteDraft, Quote, QuoteRequestDraft, QuoteRequest, ReviewDraft, Review, ShippingMethodDraft, ShippingMethod, ZoneReference, ShoppingListDraft, ShoppingList, ShoppingListLineItem, StagedQuoteDraft, StagedQuote, StandalonePriceDraft, StandalonePrice, ChannelResourceIdentifier, ChannelReference, StateDraft, State, StoreDraft, Store, SubscriptionDraft, Subscription, TaxCategoryDraft, TaxCategory, TypeDraft, Type, ZoneDraft, Zone } from '@commercetools/platform-sdk';
|
|
5
5
|
|
|
6
6
|
type Token = {
|
|
7
7
|
access_token: string;
|
|
@@ -101,6 +101,7 @@ type ResourceMap = {
|
|
|
101
101
|
"product-price": ctp.StandalonePrice;
|
|
102
102
|
"product-projection": ctp.ProductProjection;
|
|
103
103
|
"product-selection": ctp.ProductSelection;
|
|
104
|
+
"product-tailoring": ctp.ProductTailoring;
|
|
104
105
|
"product-type": ctp.ProductType;
|
|
105
106
|
"product": ctp.Product;
|
|
106
107
|
"quote-request": ctp.QuoteRequest;
|
|
@@ -140,6 +141,7 @@ type PagedQueryResponseMap = {
|
|
|
140
141
|
"product-price": ctp.StandalonePricePagedQueryResponse;
|
|
141
142
|
"product-projection": ctp.ProductProjectionPagedQueryResponse;
|
|
142
143
|
"product-selection": ctp.ProductSelectionPagedQueryResponse;
|
|
144
|
+
"product-tailoring": ctp.ProductTailoringPagedQueryResponse;
|
|
143
145
|
"product-type": ctp.ProductTypePagedQueryResponse;
|
|
144
146
|
"product": ctp.ProductPagedQueryResponse;
|
|
145
147
|
"quote-request": ctp.QuoteRequestPagedQueryResponse;
|
|
@@ -184,6 +186,11 @@ declare abstract class AbstractStorage {
|
|
|
184
186
|
abstract expand<T>(projectKey: string, obj: T, clause: undefined | string | string[]): T;
|
|
185
187
|
}
|
|
186
188
|
|
|
189
|
+
declare class ProductTailoringRepository extends AbstractResourceRepository<"product-tailoring"> {
|
|
190
|
+
constructor(storage: AbstractStorage);
|
|
191
|
+
create(context: RepositoryContext, draft: any): ProductTailoring;
|
|
192
|
+
}
|
|
193
|
+
|
|
187
194
|
declare class AssociateRoleRepository extends AbstractResourceRepository<"associate-role"> {
|
|
188
195
|
constructor(storage: AbstractStorage);
|
|
189
196
|
create(context: RepositoryContext, draft: AssociateRoleDraft): AssociateRole;
|
|
@@ -440,6 +447,7 @@ declare class ShippingMethodRepository extends AbstractResourceRepository<"shipp
|
|
|
440
447
|
description?: string | undefined;
|
|
441
448
|
localizedDescription?: ctp.LocalizedString | undefined;
|
|
442
449
|
taxCategory: ctp.TaxCategoryReference;
|
|
450
|
+
active: boolean;
|
|
443
451
|
isDefault: boolean;
|
|
444
452
|
predicate?: string | undefined;
|
|
445
453
|
custom?: ctp.CustomFields | undefined;
|
|
@@ -527,6 +535,7 @@ declare const createRepositories: (storage: AbstractStorage) => {
|
|
|
527
535
|
"product-discount": ProductDiscountRepository;
|
|
528
536
|
"product-projection": ProductProjectionRepository;
|
|
529
537
|
"product-selection": ProductSelectionRepository;
|
|
538
|
+
"product-tailoring": ProductTailoringRepository;
|
|
530
539
|
project: ProjectRepository;
|
|
531
540
|
review: ReviewRepository;
|
|
532
541
|
quote: QuoteRepository;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import { SetupServerApi, SetupServer } from 'msw/node';
|
|
3
3
|
import * as ctp from '@commercetools/platform-sdk';
|
|
4
|
-
import { QueryParam, BaseResource, Project, UpdateAction, ResourceIdentifier, AssociateRoleDraft, AssociateRole, AttributeGroupDraft, AttributeGroup, BusinessUnitDraft, BusinessUnit, CartDraft, Cart, LineItemDraft, LineItem, CartDiscountDraft, CartDiscount, CategoryDraft, Category, ChannelDraft, Channel, CustomObjectDraft, CustomObject, CustomerDraft, Customer, CustomerCreatePasswordResetToken, CustomerToken, CustomerResetPassword, MyCustomerResetPassword, CustomerGroupDraft, CustomerGroup, DiscountCodeDraft, DiscountCode, ExtensionDraft, Extension, InventoryEntryDraft, InventoryEntry, MyCustomerChangePassword, MyCustomerEmailVerify, OrderFromCartDraft, Order, CartReference, OrderImportDraft, MyOrderFromCartDraft, OrderEditDraft, OrderEdit, PaymentDraft, Payment, ProductDraft, Product, ProductDiscountDraft, ProductDiscount, ProductProjectionPagedSearchResponse, ProductProjection, FacetResults, TermFacetResult, FilteredFacetResult, RangeFacetResult, ProductSelectionDraft, ProductSelection, ProductTypeDraft, ProductType, QuoteDraft, Quote, QuoteRequestDraft, QuoteRequest, ReviewDraft, Review, ShippingMethodDraft, ShippingMethod, ZoneReference, ShoppingListDraft, ShoppingList, ShoppingListLineItem, StagedQuoteDraft, StagedQuote, StandalonePriceDraft, StandalonePrice, ChannelResourceIdentifier, ChannelReference, StateDraft, State, StoreDraft, Store, SubscriptionDraft, Subscription, TaxCategoryDraft, TaxCategory, TypeDraft, Type, ZoneDraft, Zone } from '@commercetools/platform-sdk';
|
|
4
|
+
import { QueryParam, BaseResource, Project, UpdateAction, ResourceIdentifier, ProductTailoring, AssociateRoleDraft, AssociateRole, AttributeGroupDraft, AttributeGroup, BusinessUnitDraft, BusinessUnit, CartDraft, Cart, LineItemDraft, LineItem, CartDiscountDraft, CartDiscount, CategoryDraft, Category, ChannelDraft, Channel, CustomObjectDraft, CustomObject, CustomerDraft, Customer, CustomerCreatePasswordResetToken, CustomerToken, CustomerResetPassword, MyCustomerResetPassword, CustomerGroupDraft, CustomerGroup, DiscountCodeDraft, DiscountCode, ExtensionDraft, Extension, InventoryEntryDraft, InventoryEntry, MyCustomerChangePassword, MyCustomerEmailVerify, OrderFromCartDraft, Order, CartReference, OrderImportDraft, MyOrderFromCartDraft, OrderEditDraft, OrderEdit, PaymentDraft, Payment, ProductDraft, Product, ProductDiscountDraft, ProductDiscount, ProductProjectionPagedSearchResponse, ProductProjection, FacetResults, TermFacetResult, FilteredFacetResult, RangeFacetResult, ProductSelectionDraft, ProductSelection, ProductTypeDraft, ProductType, QuoteDraft, Quote, QuoteRequestDraft, QuoteRequest, ReviewDraft, Review, ShippingMethodDraft, ShippingMethod, ZoneReference, ShoppingListDraft, ShoppingList, ShoppingListLineItem, StagedQuoteDraft, StagedQuote, StandalonePriceDraft, StandalonePrice, ChannelResourceIdentifier, ChannelReference, StateDraft, State, StoreDraft, Store, SubscriptionDraft, Subscription, TaxCategoryDraft, TaxCategory, TypeDraft, Type, ZoneDraft, Zone } from '@commercetools/platform-sdk';
|
|
5
5
|
|
|
6
6
|
type Token = {
|
|
7
7
|
access_token: string;
|
|
@@ -101,6 +101,7 @@ type ResourceMap = {
|
|
|
101
101
|
"product-price": ctp.StandalonePrice;
|
|
102
102
|
"product-projection": ctp.ProductProjection;
|
|
103
103
|
"product-selection": ctp.ProductSelection;
|
|
104
|
+
"product-tailoring": ctp.ProductTailoring;
|
|
104
105
|
"product-type": ctp.ProductType;
|
|
105
106
|
"product": ctp.Product;
|
|
106
107
|
"quote-request": ctp.QuoteRequest;
|
|
@@ -140,6 +141,7 @@ type PagedQueryResponseMap = {
|
|
|
140
141
|
"product-price": ctp.StandalonePricePagedQueryResponse;
|
|
141
142
|
"product-projection": ctp.ProductProjectionPagedQueryResponse;
|
|
142
143
|
"product-selection": ctp.ProductSelectionPagedQueryResponse;
|
|
144
|
+
"product-tailoring": ctp.ProductTailoringPagedQueryResponse;
|
|
143
145
|
"product-type": ctp.ProductTypePagedQueryResponse;
|
|
144
146
|
"product": ctp.ProductPagedQueryResponse;
|
|
145
147
|
"quote-request": ctp.QuoteRequestPagedQueryResponse;
|
|
@@ -184,6 +186,11 @@ declare abstract class AbstractStorage {
|
|
|
184
186
|
abstract expand<T>(projectKey: string, obj: T, clause: undefined | string | string[]): T;
|
|
185
187
|
}
|
|
186
188
|
|
|
189
|
+
declare class ProductTailoringRepository extends AbstractResourceRepository<"product-tailoring"> {
|
|
190
|
+
constructor(storage: AbstractStorage);
|
|
191
|
+
create(context: RepositoryContext, draft: any): ProductTailoring;
|
|
192
|
+
}
|
|
193
|
+
|
|
187
194
|
declare class AssociateRoleRepository extends AbstractResourceRepository<"associate-role"> {
|
|
188
195
|
constructor(storage: AbstractStorage);
|
|
189
196
|
create(context: RepositoryContext, draft: AssociateRoleDraft): AssociateRole;
|
|
@@ -440,6 +447,7 @@ declare class ShippingMethodRepository extends AbstractResourceRepository<"shipp
|
|
|
440
447
|
description?: string | undefined;
|
|
441
448
|
localizedDescription?: ctp.LocalizedString | undefined;
|
|
442
449
|
taxCategory: ctp.TaxCategoryReference;
|
|
450
|
+
active: boolean;
|
|
443
451
|
isDefault: boolean;
|
|
444
452
|
predicate?: string | undefined;
|
|
445
453
|
custom?: ctp.CustomFields | undefined;
|
|
@@ -527,6 +535,7 @@ declare const createRepositories: (storage: AbstractStorage) => {
|
|
|
527
535
|
"product-discount": ProductDiscountRepository;
|
|
528
536
|
"product-projection": ProductProjectionRepository;
|
|
529
537
|
"product-selection": ProductSelectionRepository;
|
|
538
|
+
"product-tailoring": ProductTailoringRepository;
|
|
530
539
|
project: ProjectRepository;
|
|
531
540
|
review: ReviewRepository;
|
|
532
541
|
quote: QuoteRepository;
|
package/dist/index.js
CHANGED
|
@@ -1503,6 +1503,7 @@ var InMemoryStorage = class extends AbstractStorage {
|
|
|
1503
1503
|
"product-selection": /* @__PURE__ */ new Map(),
|
|
1504
1504
|
"product-type": /* @__PURE__ */ new Map(),
|
|
1505
1505
|
"product-projection": /* @__PURE__ */ new Map(),
|
|
1506
|
+
"product-tailoring": /* @__PURE__ */ new Map(),
|
|
1506
1507
|
"review": /* @__PURE__ */ new Map(),
|
|
1507
1508
|
"shipping-method": /* @__PURE__ */ new Map(),
|
|
1508
1509
|
"staged-quote": /* @__PURE__ */ new Map(),
|
|
@@ -1887,6 +1888,22 @@ var AbstractUpdateHandler = class {
|
|
|
1887
1888
|
}
|
|
1888
1889
|
};
|
|
1889
1890
|
|
|
1891
|
+
// src/repositories/product-tailoring.ts
|
|
1892
|
+
var ProductTailoringRepository = class extends AbstractResourceRepository {
|
|
1893
|
+
constructor(storage) {
|
|
1894
|
+
super("product-tailoring", storage);
|
|
1895
|
+
this.actions = new ProductTailoringUpdateHandler(this._storage);
|
|
1896
|
+
}
|
|
1897
|
+
create(context, draft) {
|
|
1898
|
+
throw new Error("Create method for product-tailoring not implemented.");
|
|
1899
|
+
}
|
|
1900
|
+
};
|
|
1901
|
+
var ProductTailoringUpdateHandler = class extends AbstractUpdateHandler {
|
|
1902
|
+
setSlug() {
|
|
1903
|
+
throw new Error("SetSlug method for product-tailoring not implemented.");
|
|
1904
|
+
}
|
|
1905
|
+
};
|
|
1906
|
+
|
|
1890
1907
|
// src/repositories/helpers.ts
|
|
1891
1908
|
import { v4 as uuidv44 } from "uuid";
|
|
1892
1909
|
var createAddress = (base, projectKey, storage) => {
|
|
@@ -2210,6 +2227,18 @@ var BusinessUnitRepository = class extends AbstractResourceRepository {
|
|
|
2210
2227
|
this.actions = new BusinessUnitUpdateHandler(this._storage);
|
|
2211
2228
|
}
|
|
2212
2229
|
create(context, draft) {
|
|
2230
|
+
const addresses = draft.addresses?.map((address) => ({
|
|
2231
|
+
...address,
|
|
2232
|
+
id: generateRandomString(5)
|
|
2233
|
+
})) ?? [];
|
|
2234
|
+
const defaultBillingAddressId = addresses.length > 0 && draft.defaultBillingAddress !== void 0 ? addresses[draft.defaultBillingAddress].id : void 0;
|
|
2235
|
+
const defaultShippingAddressId = addresses.length > 0 && draft.defaultShippingAddress !== void 0 ? addresses[draft.defaultShippingAddress].id : void 0;
|
|
2236
|
+
const shippingAddressIds = draft.shippingAddresses?.map(
|
|
2237
|
+
(i) => addresses[i].id
|
|
2238
|
+
);
|
|
2239
|
+
const billingAddressIds = draft.billingAddresses?.map(
|
|
2240
|
+
(i) => addresses[i].id
|
|
2241
|
+
);
|
|
2213
2242
|
const resource = {
|
|
2214
2243
|
...getBaseResourceProperties(),
|
|
2215
2244
|
key: draft.key,
|
|
@@ -2220,18 +2249,18 @@ var BusinessUnitRepository = class extends AbstractResourceRepository {
|
|
|
2220
2249
|
storeMode: draft.storeMode,
|
|
2221
2250
|
name: draft.name,
|
|
2222
2251
|
contactEmail: draft.contactEmail,
|
|
2223
|
-
addresses
|
|
2224
|
-
(a) => createAddress(a, context.projectKey, this._storage)
|
|
2225
|
-
),
|
|
2252
|
+
addresses,
|
|
2226
2253
|
custom: createCustomFields(
|
|
2227
2254
|
draft.custom,
|
|
2228
2255
|
context.projectKey,
|
|
2229
2256
|
this._storage
|
|
2230
2257
|
),
|
|
2231
|
-
shippingAddressIds
|
|
2232
|
-
|
|
2233
|
-
|
|
2258
|
+
shippingAddressIds,
|
|
2259
|
+
billingAddressIds,
|
|
2260
|
+
defaultShippingAddressId,
|
|
2261
|
+
defaultBillingAddressId,
|
|
2234
2262
|
associateMode: draft.associateMode,
|
|
2263
|
+
approvalRuleMode: draft.approvalRuleMode,
|
|
2235
2264
|
associates: draft.associates?.map(
|
|
2236
2265
|
(a) => createAssociate(a, context.projectKey, this._storage)
|
|
2237
2266
|
)
|
|
@@ -2305,6 +2334,9 @@ var BusinessUnitUpdateHandler = class extends AbstractUpdateHandler {
|
|
|
2305
2334
|
resource.addresses.push(newAddress);
|
|
2306
2335
|
}
|
|
2307
2336
|
}
|
|
2337
|
+
changeApprovalRuleMode(context, resource, { approvalRuleMode }) {
|
|
2338
|
+
resource.approvalRuleMode = approvalRuleMode;
|
|
2339
|
+
}
|
|
2308
2340
|
changeAssociateMode(context, resource, { associateMode }) {
|
|
2309
2341
|
resource.associateMode = associateMode;
|
|
2310
2342
|
}
|
|
@@ -2604,10 +2636,12 @@ var CartUpdateHandler = class extends AbstractUpdateHandler {
|
|
|
2604
2636
|
}
|
|
2605
2637
|
}
|
|
2606
2638
|
setDirectDiscounts(context, resource, { discounts }) {
|
|
2607
|
-
resource.directDiscounts = discounts.map(
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2639
|
+
resource.directDiscounts = discounts.map(
|
|
2640
|
+
(discount) => ({
|
|
2641
|
+
...discount,
|
|
2642
|
+
id: uuidv45()
|
|
2643
|
+
})
|
|
2644
|
+
);
|
|
2611
2645
|
}
|
|
2612
2646
|
setLineItemShippingDetails(context, resource, {
|
|
2613
2647
|
action,
|
|
@@ -3417,7 +3451,8 @@ var CustomerRepository = class extends AbstractResourceRepository {
|
|
|
3417
3451
|
draft.custom,
|
|
3418
3452
|
context.projectKey,
|
|
3419
3453
|
this._storage
|
|
3420
|
-
)
|
|
3454
|
+
),
|
|
3455
|
+
stores: []
|
|
3421
3456
|
};
|
|
3422
3457
|
return this.saveNew(context, resource);
|
|
3423
3458
|
}
|
|
@@ -3855,12 +3890,13 @@ var MyCustomerRepository = class extends CustomerRepository {
|
|
|
3855
3890
|
};
|
|
3856
3891
|
|
|
3857
3892
|
// src/repositories/my-order.ts
|
|
3858
|
-
import
|
|
3893
|
+
import assert4 from "assert";
|
|
3859
3894
|
|
|
3860
3895
|
// src/repositories/order/index.ts
|
|
3861
|
-
import
|
|
3896
|
+
import assert3 from "assert";
|
|
3862
3897
|
|
|
3863
3898
|
// src/repositories/order/actions.ts
|
|
3899
|
+
import assert2 from "assert";
|
|
3864
3900
|
var OrderUpdateHandler = class extends AbstractUpdateHandler {
|
|
3865
3901
|
addPayment(context, resource, { payment }) {
|
|
3866
3902
|
const resolvedPayment = this._storage.getByResourceIdentifier(
|
|
@@ -3956,6 +3992,21 @@ var OrderUpdateHandler = class extends AbstractUpdateHandler {
|
|
|
3956
3992
|
};
|
|
3957
3993
|
}
|
|
3958
3994
|
}
|
|
3995
|
+
setDeliveryCustomField(context, resource, { deliveryId, name, value }) {
|
|
3996
|
+
assert2(resource.shippingInfo, "shippingInfo is not defined");
|
|
3997
|
+
if (Array.isArray(resource.shippingInfo.deliveries)) {
|
|
3998
|
+
resource.shippingInfo.deliveries.map((delivery) => {
|
|
3999
|
+
if (delivery.id !== deliveryId)
|
|
4000
|
+
throw "No matching delivery id found";
|
|
4001
|
+
if (delivery.custom) {
|
|
4002
|
+
const update = delivery.custom.fields;
|
|
4003
|
+
update[name] = value;
|
|
4004
|
+
Object.assign(delivery.custom.fields, update);
|
|
4005
|
+
}
|
|
4006
|
+
return delivery;
|
|
4007
|
+
});
|
|
4008
|
+
}
|
|
4009
|
+
}
|
|
3959
4010
|
setLocale(context, resource, { locale }) {
|
|
3960
4011
|
resource.locale = locale;
|
|
3961
4012
|
}
|
|
@@ -4037,7 +4088,7 @@ var OrderRepository = class extends AbstractResourceRepository {
|
|
|
4037
4088
|
this.actions = new OrderUpdateHandler(storage);
|
|
4038
4089
|
}
|
|
4039
4090
|
create(context, draft) {
|
|
4040
|
-
|
|
4091
|
+
assert3(draft.cart, "draft.cart is missing");
|
|
4041
4092
|
return this.createFromCart(
|
|
4042
4093
|
context,
|
|
4043
4094
|
{
|
|
@@ -4078,7 +4129,7 @@ var OrderRepository = class extends AbstractResourceRepository {
|
|
|
4078
4129
|
return this.saveNew(context, resource);
|
|
4079
4130
|
}
|
|
4080
4131
|
import(context, draft) {
|
|
4081
|
-
|
|
4132
|
+
assert3(this, "OrderRepository not valid");
|
|
4082
4133
|
const resource = {
|
|
4083
4134
|
...getBaseResourceProperties(),
|
|
4084
4135
|
billingAddress: createAddress(
|
|
@@ -4221,7 +4272,7 @@ var OrderRepository = class extends AbstractResourceRepository {
|
|
|
4221
4272
|
// src/repositories/my-order.ts
|
|
4222
4273
|
var MyOrderRepository = class extends OrderRepository {
|
|
4223
4274
|
create(context, draft) {
|
|
4224
|
-
|
|
4275
|
+
assert4(draft.id, "draft.id is missing");
|
|
4225
4276
|
const cartIdentifier = {
|
|
4226
4277
|
id: draft.id,
|
|
4227
4278
|
typeId: "cart"
|
|
@@ -6212,6 +6263,9 @@ var ShippingMethodUpdateHandler = class extends AbstractUpdateHandler {
|
|
|
6212
6263
|
shippingRates: []
|
|
6213
6264
|
});
|
|
6214
6265
|
}
|
|
6266
|
+
changeActive(_context, resource, { active }) {
|
|
6267
|
+
resource.active = active;
|
|
6268
|
+
}
|
|
6215
6269
|
changeIsDefault(_context, resource, { isDefault }) {
|
|
6216
6270
|
resource.isDefault = isDefault;
|
|
6217
6271
|
}
|
|
@@ -6281,6 +6335,7 @@ var ShippingMethodRepository = class extends AbstractResourceRepository {
|
|
|
6281
6335
|
const resource = {
|
|
6282
6336
|
...getBaseResourceProperties(),
|
|
6283
6337
|
...draft,
|
|
6338
|
+
active: draft.active ?? true,
|
|
6284
6339
|
taxCategory: getReferenceFromResourceIdentifier(
|
|
6285
6340
|
draft.taxCategory,
|
|
6286
6341
|
context.projectKey,
|
|
@@ -7097,6 +7152,7 @@ var createRepositories = (storage) => ({
|
|
|
7097
7152
|
"product-discount": new ProductDiscountRepository(storage),
|
|
7098
7153
|
"product-projection": new ProductProjectionRepository(storage),
|
|
7099
7154
|
"product-selection": new ProductSelectionRepository(storage),
|
|
7155
|
+
"product-tailoring": new ProductTailoringRepository(storage),
|
|
7100
7156
|
"project": new ProjectRepository(storage),
|
|
7101
7157
|
"review": new ReviewRepository(storage),
|
|
7102
7158
|
"quote": new QuoteRepository(storage),
|