@labdigital/commercetools-mock 2.59.1 → 2.61.0
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.d.ts → index.d.mts} +154 -275
- package/dist/{index.js → index.mjs} +413 -401
- package/dist/index.mjs.map +1 -0
- package/package.json +30 -18
- package/src/config.ts +1 -1
- package/src/ctMock.test.ts +1 -1
- package/src/ctMock.ts +22 -21
- package/src/index.test.ts +1 -1
- package/src/index.ts +3 -3
- package/src/lib/haversine.test.ts +2 -2
- package/src/lib/masking.ts +1 -1
- package/src/lib/parser.ts +2 -2
- package/src/lib/password.ts +1 -1
- package/src/lib/predicateParser.test.ts +1 -1
- package/src/lib/predicateParser.ts +4 -4
- package/src/lib/product-review-statistics.test.ts +4 -8
- package/src/lib/productSearchFilter.test.ts +3 -3
- package/src/lib/productSearchFilter.ts +6 -6
- package/src/lib/projectionSearchFilter.test.ts +3 -3
- package/src/lib/projectionSearchFilter.ts +4 -4
- package/src/lib/review-statistics.ts +1 -1
- package/src/lib/searchQueryTypeChecker.test.ts +3 -3
- package/src/lib/searchQueryTypeChecker.ts +8 -4
- package/src/lib/tax.test.ts +119 -0
- package/src/lib/tax.ts +186 -0
- package/src/oauth/server.test.ts +7 -7
- package/src/oauth/server.ts +7 -7
- package/src/priceSelector.test.ts +1 -1
- package/src/priceSelector.ts +2 -2
- package/src/product-projection-search.ts +10 -12
- package/src/product-search-availability.test.ts +1 -1
- package/src/product-search.ts +6 -7
- package/src/projectAPI.test.ts +1 -1
- package/src/projectAPI.ts +7 -7
- package/src/repositories/abstract.ts +8 -10
- package/src/repositories/as-associate.test.ts +4 -4
- package/src/repositories/as-associate.ts +3 -3
- package/src/repositories/associate-role.ts +7 -9
- package/src/repositories/attribute-group.test.ts +3 -3
- package/src/repositories/attribute-group.ts +5 -5
- package/src/repositories/business-unit.test.ts +6 -6
- package/src/repositories/business-unit.ts +21 -23
- package/src/repositories/cart/actions.ts +79 -15
- package/src/repositories/cart/helpers.ts +5 -84
- package/src/repositories/cart/index.test.ts +53 -10
- package/src/repositories/cart/index.ts +17 -21
- package/src/repositories/cart-discount/actions.ts +5 -6
- package/src/repositories/cart-discount/index.ts +5 -5
- package/src/repositories/category/actions.ts +4 -4
- package/src/repositories/category/index.test.ts +3 -3
- package/src/repositories/category/index.ts +8 -8
- package/src/repositories/channel.test.ts +4 -4
- package/src/repositories/channel.ts +6 -6
- package/src/repositories/custom-object.ts +11 -8
- package/src/repositories/customer/actions.ts +9 -9
- package/src/repositories/customer/index.test.ts +3 -3
- package/src/repositories/customer/index.ts +12 -9
- package/src/repositories/customer-group.test.ts +4 -4
- package/src/repositories/customer-group.ts +6 -6
- package/src/repositories/discount-code/actions.ts +4 -4
- package/src/repositories/discount-code/index.ts +5 -5
- package/src/repositories/discount-group/actions.ts +3 -4
- package/src/repositories/discount-group/index.ts +4 -4
- package/src/repositories/errors.ts +1 -1
- package/src/repositories/extension.test.ts +3 -3
- package/src/repositories/extension.ts +6 -6
- package/src/repositories/helpers.ts +9 -12
- package/src/repositories/index.test.ts +3 -3
- package/src/repositories/index.ts +43 -43
- package/src/repositories/inventory-entry/actions.ts +15 -3
- package/src/repositories/inventory-entry/index.ts +5 -5
- package/src/repositories/my-customer.ts +5 -5
- package/src/repositories/my-order.ts +2 -2
- package/src/repositories/my-quote-request.ts +1 -1
- package/src/repositories/order/actions.ts +8 -9
- package/src/repositories/order/index.test.ts +191 -9
- package/src/repositories/order/index.ts +63 -21
- package/src/repositories/order-edit.ts +4 -4
- package/src/repositories/payment/actions.ts +6 -6
- package/src/repositories/payment/helpers.ts +3 -3
- package/src/repositories/payment/index.ts +7 -7
- package/src/repositories/product/actions.ts +7 -7
- package/src/repositories/product/helpers.ts +4 -4
- package/src/repositories/product/index.ts +13 -13
- package/src/repositories/product-discount.ts +9 -6
- package/src/repositories/product-projection.ts +7 -7
- package/src/repositories/product-selection.ts +9 -6
- package/src/repositories/product-tailoring.ts +6 -3
- package/src/repositories/product-type.ts +8 -5
- package/src/repositories/project.ts +5 -5
- package/src/repositories/quote/actions.ts +6 -6
- package/src/repositories/quote/index.ts +5 -5
- package/src/repositories/quote-request/actions.ts +6 -6
- package/src/repositories/quote-request/index.test.ts +3 -3
- package/src/repositories/quote-request/index.ts +5 -5
- package/src/repositories/quote-staged/actions.ts +6 -6
- package/src/repositories/quote-staged/index.ts +5 -5
- package/src/repositories/recurrence-policy/actions.ts +3 -3
- package/src/repositories/recurrence-policy/index.ts +4 -8
- package/src/repositories/recurring-order/actions.ts +3 -3
- package/src/repositories/recurring-order/index.ts +5 -5
- package/src/repositories/review.test.ts +5 -5
- package/src/repositories/review.ts +10 -9
- package/src/repositories/shipping-method/actions.ts +7 -9
- package/src/repositories/shipping-method/helpers.ts +1 -1
- package/src/repositories/shipping-method/index.ts +8 -8
- package/src/repositories/shopping-list/actions.ts +5 -5
- package/src/repositories/shopping-list/index.ts +7 -7
- package/src/repositories/standalone-price.ts +9 -6
- package/src/repositories/state.ts +9 -6
- package/src/repositories/store.ts +10 -7
- package/src/repositories/subscription.test.ts +3 -3
- package/src/repositories/subscription.ts +9 -6
- package/src/repositories/tax-category/actions.ts +4 -4
- package/src/repositories/tax-category/index.ts +6 -6
- package/src/repositories/type/actions.ts +4 -4
- package/src/repositories/type/index.ts +5 -5
- package/src/repositories/zone.test.ts +3 -3
- package/src/repositories/zone.ts +8 -5
- package/src/server.ts +4 -3
- package/src/services/abstract.ts +5 -5
- package/src/services/as-associate-cart.test.ts +1 -1
- package/src/services/as-associate-cart.ts +2 -2
- package/src/services/as-associate-order.test.ts +1 -1
- package/src/services/as-associate-order.ts +2 -2
- package/src/services/as-associate-quote-request.ts +2 -3
- package/src/services/as-associate.test.ts +1 -1
- package/src/services/as-associate.ts +4 -4
- package/src/services/associate-roles.test.ts +1 -1
- package/src/services/associate-roles.ts +2 -2
- package/src/services/attribute-group.test.ts +1 -1
- package/src/services/attribute-group.ts +2 -2
- package/src/services/business-units.test.ts +5 -5
- package/src/services/business-units.ts +2 -2
- package/src/services/cart-discount.ts +2 -2
- package/src/services/cart.test.ts +213 -2
- package/src/services/cart.ts +4 -5
- package/src/services/category.test.ts +1 -1
- package/src/services/category.ts +2 -2
- package/src/services/channel.test.ts +1 -1
- package/src/services/channel.ts +2 -2
- package/src/services/custom-object.test.ts +2 -2
- package/src/services/custom-object.ts +3 -3
- package/src/services/customer-group.test.ts +1 -1
- package/src/services/customer-group.ts +2 -2
- package/src/services/customer.test.ts +3 -3
- package/src/services/customer.ts +4 -5
- package/src/services/discount-code.test.ts +1 -1
- package/src/services/discount-code.ts +2 -2
- package/src/services/discount-group.test.ts +1 -1
- package/src/services/discount-group.ts +2 -2
- package/src/services/extension.test.ts +1 -1
- package/src/services/extension.ts +2 -2
- package/src/services/index.ts +44 -44
- package/src/services/inventory-entry.test.ts +16 -1
- package/src/services/inventory-entry.ts +2 -2
- package/src/services/my-business-unit.test.ts +1 -1
- package/src/services/my-business-unit.ts +2 -2
- package/src/services/my-cart.test.ts +1 -1
- package/src/services/my-cart.ts +2 -2
- package/src/services/my-customer.test.ts +2 -2
- package/src/services/my-customer.ts +6 -6
- package/src/services/my-order.ts +2 -2
- package/src/services/my-payment.test.ts +1 -1
- package/src/services/my-payment.ts +2 -2
- package/src/services/my-shopping-list.ts +2 -2
- package/src/services/order.test.ts +4 -11
- package/src/services/order.ts +4 -4
- package/src/services/payment.test.ts +1 -1
- package/src/services/payment.ts +2 -2
- package/src/services/product-discount.test.ts +1 -1
- package/src/services/product-discount.ts +2 -2
- package/src/services/product-projection.test.ts +2 -2
- package/src/services/product-projection.ts +4 -4
- package/src/services/product-selection.test.ts +1 -1
- package/src/services/product-selection.ts +2 -2
- package/src/services/product-type.test.ts +1 -1
- package/src/services/product-type.ts +2 -2
- package/src/services/product.test.ts +1 -1
- package/src/services/product.ts +3 -3
- package/src/services/project.test.ts +1 -1
- package/src/services/project.ts +4 -4
- package/src/services/quote-request.test.ts +2 -2
- package/src/services/quote-request.ts +2 -2
- package/src/services/quote-staged.ts +2 -2
- package/src/services/quote.ts +2 -2
- package/src/services/recurrence-policy.test.ts +1 -1
- package/src/services/recurrence-policy.ts +2 -2
- package/src/services/recurring-order.test.ts +1 -1
- package/src/services/recurring-order.ts +2 -2
- package/src/services/reviews.test.ts +1 -1
- package/src/services/reviews.ts +2 -2
- package/src/services/shipping-method.test.ts +2 -2
- package/src/services/shipping-method.ts +4 -4
- package/src/services/shopping-list.test.ts +1 -1
- package/src/services/shopping-list.ts +2 -2
- package/src/services/standalone-price.test.ts +1 -1
- package/src/services/standalone-price.ts +2 -2
- package/src/services/state.test.ts +1 -1
- package/src/services/state.ts +2 -2
- package/src/services/store.test.ts +1 -1
- package/src/services/store.ts +2 -2
- package/src/services/subscription.test.ts +1 -1
- package/src/services/subscription.ts +2 -2
- package/src/services/tax-category.test.ts +1 -1
- package/src/services/tax-category.ts +2 -2
- package/src/services/type.test.ts +1 -1
- package/src/services/type.ts +2 -2
- package/src/services/zone.test.ts +1 -1
- package/src/services/zone.ts +2 -2
- package/src/shipping.test.ts +1 -1
- package/src/shipping.ts +8 -8
- package/src/storage/abstract.ts +1 -1
- package/src/storage/in-memory.ts +15 -17
- package/src/storage/index.ts +2 -2
- package/src/testing/business-unit.ts +1 -2
- package/src/testing/customer.ts +1 -1
- package/src/testing/type.ts +1 -1
- package/src/types.ts +1 -1
- package/src/validate.ts +1 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DiscountCodeDraft } from "@commercetools/platform-sdk";
|
|
2
2
|
import supertest from "supertest";
|
|
3
3
|
import { describe, expect, test } from "vitest";
|
|
4
|
-
import { CommercetoolsMock } from "../index";
|
|
4
|
+
import { CommercetoolsMock } from "../index.ts";
|
|
5
5
|
|
|
6
6
|
const ctMock = new CommercetoolsMock();
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Router } from "express";
|
|
2
|
-
import type { DiscountCodeRepository } from "../repositories/discount-code/index";
|
|
3
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import type { DiscountCodeRepository } from "../repositories/discount-code/index.ts";
|
|
3
|
+
import AbstractService from "./abstract.ts";
|
|
4
4
|
|
|
5
5
|
export class DiscountCodeService extends AbstractService {
|
|
6
6
|
public repository: DiscountCodeRepository;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DiscountGroupDraft } from "@commercetools/platform-sdk";
|
|
2
2
|
import supertest from "supertest";
|
|
3
3
|
import { describe, expect, test } from "vitest";
|
|
4
|
-
import { CommercetoolsMock } from "../index";
|
|
4
|
+
import { CommercetoolsMock } from "../index.ts";
|
|
5
5
|
|
|
6
6
|
const ctMock = new CommercetoolsMock();
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Router } from "express";
|
|
2
|
-
import type { DiscountGroupRepository } from "../repositories/discount-group/index";
|
|
3
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import type { DiscountGroupRepository } from "../repositories/discount-group/index.ts";
|
|
3
|
+
import AbstractService from "./abstract.ts";
|
|
4
4
|
|
|
5
5
|
export class DiscountGroupService extends AbstractService {
|
|
6
6
|
public repository: DiscountGroupRepository;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtensionDraft } from "@commercetools/platform-sdk";
|
|
2
2
|
import supertest from "supertest";
|
|
3
3
|
import { describe, expect, test } from "vitest";
|
|
4
|
-
import { CommercetoolsMock } from "../index";
|
|
4
|
+
import { CommercetoolsMock } from "../index.ts";
|
|
5
5
|
|
|
6
6
|
const ctMock = new CommercetoolsMock();
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Router } from "express";
|
|
2
|
-
import type { ExtensionRepository } from "../repositories/extension";
|
|
3
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import type { ExtensionRepository } from "../repositories/extension.ts";
|
|
3
|
+
import AbstractService from "./abstract.ts";
|
|
4
4
|
|
|
5
5
|
export class ExtensionServices extends AbstractService {
|
|
6
6
|
public repository: ExtensionRepository;
|
package/src/services/index.ts
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import type { createRepositories } from "../repositories";
|
|
2
|
-
import { AsAssociateService } from "./as-associate";
|
|
3
|
-
import { AssociateRoleServices } from "./associate-roles";
|
|
4
|
-
import { AttributeGroupService } from "./attribute-group";
|
|
5
|
-
import { BusinessUnitServices } from "./business-units";
|
|
6
|
-
import { CartService } from "./cart";
|
|
7
|
-
import { CartDiscountService } from "./cart-discount";
|
|
8
|
-
import { CategoryServices } from "./category";
|
|
9
|
-
import { ChannelService } from "./channel";
|
|
10
|
-
import { CustomObjectService } from "./custom-object";
|
|
11
|
-
import { CustomerService } from "./customer";
|
|
12
|
-
import { CustomerGroupService } from "./customer-group";
|
|
13
|
-
import { DiscountCodeService } from "./discount-code";
|
|
14
|
-
import { DiscountGroupService } from "./discount-group";
|
|
15
|
-
import { ExtensionServices } from "./extension";
|
|
16
|
-
import { InventoryEntryService } from "./inventory-entry";
|
|
17
|
-
import { MyBusinessUnitService } from "./my-business-unit";
|
|
18
|
-
import { MyCartService } from "./my-cart";
|
|
19
|
-
import { MyCustomerService } from "./my-customer";
|
|
20
|
-
import { MyOrderService } from "./my-order";
|
|
21
|
-
import { MyPaymentService } from "./my-payment";
|
|
22
|
-
import { MyShoppingListService } from "./my-shopping-list";
|
|
23
|
-
import { OrderService } from "./order";
|
|
24
|
-
import { PaymentService } from "./payment";
|
|
25
|
-
import { ProductService } from "./product";
|
|
26
|
-
import { ProductDiscountService } from "./product-discount";
|
|
27
|
-
import { ProductProjectionService } from "./product-projection";
|
|
28
|
-
import { ProductSelectionService } from "./product-selection";
|
|
29
|
-
import { ProductTypeService } from "./product-type";
|
|
30
|
-
import { QuoteService } from "./quote";
|
|
31
|
-
import { QuoteRequestService } from "./quote-request";
|
|
32
|
-
import { StagedQuoteService } from "./quote-staged";
|
|
33
|
-
import { RecurrencePolicyService } from "./recurrence-policy";
|
|
34
|
-
import { RecurringOrderService } from "./recurring-order";
|
|
35
|
-
import { ReviewService } from "./reviews";
|
|
36
|
-
import { ShippingMethodService } from "./shipping-method";
|
|
37
|
-
import { ShoppingListService } from "./shopping-list";
|
|
38
|
-
import { StandAlonePriceService } from "./standalone-price";
|
|
39
|
-
import { StateService } from "./state";
|
|
40
|
-
import { StoreService } from "./store";
|
|
41
|
-
import { SubscriptionService } from "./subscription";
|
|
42
|
-
import { TaxCategoryService } from "./tax-category";
|
|
43
|
-
import { TypeService } from "./type";
|
|
44
|
-
import { ZoneService } from "./zone";
|
|
1
|
+
import type { createRepositories } from "../repositories/index.ts";
|
|
2
|
+
import { AsAssociateService } from "./as-associate.ts";
|
|
3
|
+
import { AssociateRoleServices } from "./associate-roles.ts";
|
|
4
|
+
import { AttributeGroupService } from "./attribute-group.ts";
|
|
5
|
+
import { BusinessUnitServices } from "./business-units.ts";
|
|
6
|
+
import { CartService } from "./cart.ts";
|
|
7
|
+
import { CartDiscountService } from "./cart-discount.ts";
|
|
8
|
+
import { CategoryServices } from "./category.ts";
|
|
9
|
+
import { ChannelService } from "./channel.ts";
|
|
10
|
+
import { CustomObjectService } from "./custom-object.ts";
|
|
11
|
+
import { CustomerService } from "./customer.ts";
|
|
12
|
+
import { CustomerGroupService } from "./customer-group.ts";
|
|
13
|
+
import { DiscountCodeService } from "./discount-code.ts";
|
|
14
|
+
import { DiscountGroupService } from "./discount-group.ts";
|
|
15
|
+
import { ExtensionServices } from "./extension.ts";
|
|
16
|
+
import { InventoryEntryService } from "./inventory-entry.ts";
|
|
17
|
+
import { MyBusinessUnitService } from "./my-business-unit.ts";
|
|
18
|
+
import { MyCartService } from "./my-cart.ts";
|
|
19
|
+
import { MyCustomerService } from "./my-customer.ts";
|
|
20
|
+
import { MyOrderService } from "./my-order.ts";
|
|
21
|
+
import { MyPaymentService } from "./my-payment.ts";
|
|
22
|
+
import { MyShoppingListService } from "./my-shopping-list.ts";
|
|
23
|
+
import { OrderService } from "./order.ts";
|
|
24
|
+
import { PaymentService } from "./payment.ts";
|
|
25
|
+
import { ProductService } from "./product.ts";
|
|
26
|
+
import { ProductDiscountService } from "./product-discount.ts";
|
|
27
|
+
import { ProductProjectionService } from "./product-projection.ts";
|
|
28
|
+
import { ProductSelectionService } from "./product-selection.ts";
|
|
29
|
+
import { ProductTypeService } from "./product-type.ts";
|
|
30
|
+
import { QuoteService } from "./quote.ts";
|
|
31
|
+
import { QuoteRequestService } from "./quote-request.ts";
|
|
32
|
+
import { StagedQuoteService } from "./quote-staged.ts";
|
|
33
|
+
import { RecurrencePolicyService } from "./recurrence-policy.ts";
|
|
34
|
+
import { RecurringOrderService } from "./recurring-order.ts";
|
|
35
|
+
import { ReviewService } from "./reviews.ts";
|
|
36
|
+
import { ShippingMethodService } from "./shipping-method.ts";
|
|
37
|
+
import { ShoppingListService } from "./shopping-list.ts";
|
|
38
|
+
import { StandAlonePriceService } from "./standalone-price.ts";
|
|
39
|
+
import { StateService } from "./state.ts";
|
|
40
|
+
import { StoreService } from "./store.ts";
|
|
41
|
+
import { SubscriptionService } from "./subscription.ts";
|
|
42
|
+
import { TaxCategoryService } from "./tax-category.ts";
|
|
43
|
+
import { TypeService } from "./type.ts";
|
|
44
|
+
import { ZoneService } from "./zone.ts";
|
|
45
45
|
|
|
46
46
|
export const createServices = (
|
|
47
47
|
router: any,
|
|
@@ -2,7 +2,7 @@ import assert from "node:assert";
|
|
|
2
2
|
import type { InventoryEntry, Type } from "@commercetools/platform-sdk";
|
|
3
3
|
import supertest from "supertest";
|
|
4
4
|
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
|
5
|
-
import { CommercetoolsMock } from "../index";
|
|
5
|
+
import { CommercetoolsMock } from "../index.ts";
|
|
6
6
|
|
|
7
7
|
describe("Inventory Entry Query", () => {
|
|
8
8
|
const ctMock = new CommercetoolsMock();
|
|
@@ -93,6 +93,21 @@ describe("Inventory Entry Update Actions", () => {
|
|
|
93
93
|
expect(response.body.quantityOnStock).toBe(300);
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
+
test("removeQuantity", async () => {
|
|
97
|
+
assert(inventoryEntry, "inventory entry not created");
|
|
98
|
+
|
|
99
|
+
const response = await supertest(ctMock.app)
|
|
100
|
+
.post(`/dummy/inventory/${inventoryEntry.id}`)
|
|
101
|
+
.send({
|
|
102
|
+
version: 1,
|
|
103
|
+
actions: [{ action: "removeQuantity", quantity: 15 }],
|
|
104
|
+
});
|
|
105
|
+
expect(response.status).toBe(200);
|
|
106
|
+
expect(response.body.version).toBe(2);
|
|
107
|
+
expect(response.body.availableQuantity).toBe(85);
|
|
108
|
+
expect(response.body.quantityOnStock).toBe(85);
|
|
109
|
+
});
|
|
110
|
+
|
|
96
111
|
test("set custom type", async () => {
|
|
97
112
|
assert(inventoryEntry, "inventory entry not created");
|
|
98
113
|
assert(customType, "custom type not created");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Router } from "express";
|
|
2
|
-
import type { InventoryEntryRepository } from "../repositories/inventory-entry";
|
|
3
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import type { InventoryEntryRepository } from "../repositories/inventory-entry/index.ts";
|
|
3
|
+
import AbstractService from "./abstract.ts";
|
|
4
4
|
|
|
5
5
|
export class InventoryEntryService extends AbstractService {
|
|
6
6
|
public repository: InventoryEntryRepository;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BusinessUnitDraft } from "@commercetools/platform-sdk";
|
|
2
2
|
import supertest from "supertest";
|
|
3
3
|
import { afterEach, describe, expect, test } from "vitest";
|
|
4
|
-
import { CommercetoolsMock } from "../index";
|
|
4
|
+
import { CommercetoolsMock } from "../index.ts";
|
|
5
5
|
|
|
6
6
|
const ctMock = new CommercetoolsMock();
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Router } from "express";
|
|
2
|
-
import type { BusinessUnitRepository } from "
|
|
3
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import type { BusinessUnitRepository } from "#src/repositories/business-unit.ts";
|
|
3
|
+
import AbstractService from "./abstract.ts";
|
|
4
4
|
|
|
5
5
|
export class MyBusinessUnitService extends AbstractService {
|
|
6
6
|
public repository: BusinessUnitRepository;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Cart, MyCartDraft } from "@commercetools/platform-sdk";
|
|
2
2
|
import supertest from "supertest";
|
|
3
3
|
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
|
4
|
-
import { CommercetoolsMock } from "../index";
|
|
4
|
+
import { CommercetoolsMock } from "../index.ts";
|
|
5
5
|
|
|
6
6
|
const ctMock = new CommercetoolsMock();
|
|
7
7
|
|
package/src/services/my-cart.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Request, Response } from "express";
|
|
2
2
|
import { Router } from "express";
|
|
3
|
-
import type { CartRepository } from "../repositories/cart";
|
|
4
|
-
import AbstractService from "./abstract";
|
|
3
|
+
import type { CartRepository } from "../repositories/cart/index.ts";
|
|
4
|
+
import AbstractService from "./abstract.ts";
|
|
5
5
|
|
|
6
6
|
export class MyCartService extends AbstractService {
|
|
7
7
|
public repository: CartRepository;
|
|
@@ -6,8 +6,8 @@ import type {
|
|
|
6
6
|
} from "@commercetools/platform-sdk";
|
|
7
7
|
import supertest from "supertest";
|
|
8
8
|
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
|
9
|
-
import { CommercetoolsMock, getBaseResourceProperties } from "../index";
|
|
10
|
-
import { hashPassword } from "../lib/password";
|
|
9
|
+
import { CommercetoolsMock, getBaseResourceProperties } from "../index.ts";
|
|
10
|
+
import { hashPassword } from "../lib/password.ts";
|
|
11
11
|
|
|
12
12
|
const ctMock = new CommercetoolsMock();
|
|
13
13
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Update } from "@commercetools/platform-sdk";
|
|
2
2
|
import type { Request, Response } from "express";
|
|
3
3
|
import { Router } from "express";
|
|
4
|
-
import { updateRequestSchema } from "
|
|
5
|
-
import { validateData } from "
|
|
6
|
-
import { hashPassword } from "../lib/password";
|
|
7
|
-
import { getRepositoryContext } from "../repositories/helpers";
|
|
8
|
-
import type { MyCustomerRepository } from "../repositories/my-customer";
|
|
9
|
-
import AbstractService from "./abstract";
|
|
4
|
+
import { updateRequestSchema } from "#src/schemas/update-request.ts";
|
|
5
|
+
import { validateData } from "#src/validate.ts";
|
|
6
|
+
import { hashPassword } from "../lib/password.ts";
|
|
7
|
+
import { getRepositoryContext } from "../repositories/helpers.ts";
|
|
8
|
+
import type { MyCustomerRepository } from "../repositories/my-customer.ts";
|
|
9
|
+
import AbstractService from "./abstract.ts";
|
|
10
10
|
|
|
11
11
|
export class MyCustomerService extends AbstractService {
|
|
12
12
|
public repository: MyCustomerRepository;
|
package/src/services/my-order.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Router } from "express";
|
|
2
|
-
import type { MyOrderRepository } from "../repositories/my-order";
|
|
3
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import type { MyOrderRepository } from "../repositories/my-order.ts";
|
|
3
|
+
import AbstractService from "./abstract.ts";
|
|
4
4
|
|
|
5
5
|
export class MyOrderService extends AbstractService {
|
|
6
6
|
public repository: MyOrderRepository;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MyPaymentDraft } from "@commercetools/platform-sdk";
|
|
2
2
|
import supertest from "supertest";
|
|
3
3
|
import { beforeEach, describe, expect, test } from "vitest";
|
|
4
|
-
import { CommercetoolsMock } from "../index";
|
|
4
|
+
import { CommercetoolsMock } from "../index.ts";
|
|
5
5
|
|
|
6
6
|
const ctMock = new CommercetoolsMock();
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Router } from "express";
|
|
2
|
-
import type { PaymentRepository } from "../repositories/payment";
|
|
3
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import type { PaymentRepository } from "../repositories/payment/index.ts";
|
|
3
|
+
import AbstractService from "./abstract.ts";
|
|
4
4
|
|
|
5
5
|
export class MyPaymentService extends AbstractService {
|
|
6
6
|
public repository: PaymentRepository;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Router } from "express";
|
|
2
|
-
import type { ShoppingListRepository } from "../repositories/shopping-list";
|
|
3
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import type { ShoppingListRepository } from "../repositories/shopping-list/index.ts";
|
|
3
|
+
import AbstractService from "./abstract.ts";
|
|
4
4
|
|
|
5
5
|
export class MyShoppingListService extends AbstractService {
|
|
6
6
|
public repository: ShoppingListRepository;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import assert from "node:assert";
|
|
2
|
-
import type {
|
|
3
|
-
CentPrecisionMoney,
|
|
4
|
-
Order,
|
|
5
|
-
Payment,
|
|
6
|
-
State,
|
|
7
|
-
} from "@commercetools/platform-sdk";
|
|
2
|
+
import type { Order, Payment, State } from "@commercetools/platform-sdk";
|
|
8
3
|
import supertest from "supertest";
|
|
9
4
|
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
|
10
|
-
import { generateRandomString } from "
|
|
11
|
-
import { CommercetoolsMock, getBaseResourceProperties } from "../index";
|
|
5
|
+
import { generateRandomString } from "#src/helpers.ts";
|
|
6
|
+
import { CommercetoolsMock, getBaseResourceProperties } from "../index.ts";
|
|
12
7
|
|
|
13
8
|
describe("Order Query", () => {
|
|
14
9
|
const ctMock = new CommercetoolsMock();
|
|
@@ -1035,9 +1030,8 @@ describe("Order Import", () => {
|
|
|
1035
1030
|
const ctMock = new CommercetoolsMock();
|
|
1036
1031
|
ctMock.project("dummy").add("product", {
|
|
1037
1032
|
id: "15fc56ba-a74e-4cf8-b4b0-bada5c101541",
|
|
1038
|
-
// @ts-ignore
|
|
1039
1033
|
masterData: {
|
|
1040
|
-
// @ts-
|
|
1034
|
+
// @ts-expect-error
|
|
1041
1035
|
current: {
|
|
1042
1036
|
name: { "nl-NL": "Dummy" },
|
|
1043
1037
|
slug: { "nl-NL": "Dummy" },
|
|
@@ -1092,7 +1086,6 @@ describe("Order Import", () => {
|
|
|
1092
1086
|
productType: {
|
|
1093
1087
|
typeId: "product-type",
|
|
1094
1088
|
id: "109caecb-abe6-4900-ab03-7af5af985ff3",
|
|
1095
|
-
// @ts-ignore
|
|
1096
1089
|
version: 1,
|
|
1097
1090
|
},
|
|
1098
1091
|
variant: {
|
package/src/services/order.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Request, Response, Router } from "express";
|
|
2
|
-
import { getRepositoryContext } from "../repositories/helpers";
|
|
3
|
-
import type { OrderRepository } from "../repositories/order/index";
|
|
4
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import { getRepositoryContext } from "../repositories/helpers.ts";
|
|
3
|
+
import type { OrderRepository } from "../repositories/order/index.ts";
|
|
4
|
+
import AbstractService from "./abstract.ts";
|
|
5
5
|
|
|
6
6
|
export class OrderService extends AbstractService {
|
|
7
7
|
public repository: OrderRepository;
|
|
@@ -38,7 +38,7 @@ export class OrderService extends AbstractService {
|
|
|
38
38
|
getRepositoryContext(request),
|
|
39
39
|
orderNumber,
|
|
40
40
|
|
|
41
|
-
// @ts-
|
|
41
|
+
// @ts-expect-error
|
|
42
42
|
request.query,
|
|
43
43
|
);
|
|
44
44
|
if (resource) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PaymentDraft } from "@commercetools/platform-sdk";
|
|
2
2
|
import supertest from "supertest";
|
|
3
3
|
import { beforeEach, describe, expect, test } from "vitest";
|
|
4
|
-
import { CommercetoolsMock } from "../index";
|
|
4
|
+
import { CommercetoolsMock } from "../index.ts";
|
|
5
5
|
|
|
6
6
|
const ctMock = new CommercetoolsMock();
|
|
7
7
|
|
package/src/services/payment.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Router } from "express";
|
|
2
|
-
import type { PaymentRepository } from "../repositories/payment";
|
|
3
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import type { PaymentRepository } from "../repositories/payment/index.ts";
|
|
3
|
+
import AbstractService from "./abstract.ts";
|
|
4
4
|
|
|
5
5
|
export class PaymentService extends AbstractService {
|
|
6
6
|
public repository: PaymentRepository;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ProductDiscountDraft } from "@commercetools/platform-sdk";
|
|
2
2
|
import supertest from "supertest";
|
|
3
3
|
import { describe, expect, test } from "vitest";
|
|
4
|
-
import { CommercetoolsMock } from "../index";
|
|
4
|
+
import { CommercetoolsMock } from "../index.ts";
|
|
5
5
|
|
|
6
6
|
const ctMock = new CommercetoolsMock();
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Router } from "express";
|
|
2
|
-
import type { ProductDiscountRepository } from "../repositories/product-discount";
|
|
3
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import type { ProductDiscountRepository } from "../repositories/product-discount.ts";
|
|
3
|
+
import AbstractService from "./abstract.ts";
|
|
4
4
|
|
|
5
5
|
export class ProductDiscountService extends AbstractService {
|
|
6
6
|
public repository: ProductDiscountRepository;
|
|
@@ -9,8 +9,8 @@ import type {
|
|
|
9
9
|
import supertest from "supertest";
|
|
10
10
|
import * as timekeeper from "timekeeper";
|
|
11
11
|
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
|
12
|
-
import { CommercetoolsMock } from "../index";
|
|
13
|
-
import type { Writable } from "../types";
|
|
12
|
+
import { CommercetoolsMock } from "../index.ts";
|
|
13
|
+
import type { Writable } from "../types.ts";
|
|
14
14
|
|
|
15
15
|
const ctMock = new CommercetoolsMock();
|
|
16
16
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Request, Response, Router } from "express";
|
|
2
|
-
import { queryParamsArray, queryParamsValue } from "../helpers";
|
|
3
|
-
import { getRepositoryContext } from "../repositories/helpers";
|
|
2
|
+
import { queryParamsArray, queryParamsValue } from "../helpers.ts";
|
|
3
|
+
import { getRepositoryContext } from "../repositories/helpers.ts";
|
|
4
4
|
import type {
|
|
5
5
|
ProductProjectionQueryParams,
|
|
6
6
|
ProductProjectionRepository,
|
|
7
|
-
} from "./../repositories/product-projection";
|
|
8
|
-
import AbstractService from "./abstract";
|
|
7
|
+
} from "./../repositories/product-projection.ts";
|
|
8
|
+
import AbstractService from "./abstract.ts";
|
|
9
9
|
|
|
10
10
|
export class ProductProjectionService extends AbstractService {
|
|
11
11
|
public repository: ProductProjectionRepository;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ProductSelectionDraft } from "@commercetools/platform-sdk";
|
|
2
2
|
import supertest from "supertest";
|
|
3
3
|
import { describe, expect, test } from "vitest";
|
|
4
|
-
import { CommercetoolsMock } from "../index";
|
|
4
|
+
import { CommercetoolsMock } from "../index.ts";
|
|
5
5
|
|
|
6
6
|
const ctMock = new CommercetoolsMock();
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Router } from "express";
|
|
2
|
-
import type { ProductSelectionRepository } from "../repositories/product-selection";
|
|
3
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import type { ProductSelectionRepository } from "../repositories/product-selection.ts";
|
|
3
|
+
import AbstractService from "./abstract.ts";
|
|
4
4
|
|
|
5
5
|
export class ProductSelectionService extends AbstractService {
|
|
6
6
|
public repository: ProductSelectionRepository;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ProductTypeDraft } from "@commercetools/platform-sdk";
|
|
2
2
|
import supertest from "supertest";
|
|
3
3
|
import { describe, expect, test } from "vitest";
|
|
4
|
-
import { CommercetoolsMock } from "../index";
|
|
4
|
+
import { CommercetoolsMock } from "../index.ts";
|
|
5
5
|
|
|
6
6
|
const ctMock = new CommercetoolsMock();
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Router } from "express";
|
|
2
|
-
import type { ProductTypeRepository } from "../repositories/product-type";
|
|
3
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import type { ProductTypeRepository } from "../repositories/product-type.ts";
|
|
3
|
+
import AbstractService from "./abstract.ts";
|
|
4
4
|
|
|
5
5
|
export class ProductTypeService extends AbstractService {
|
|
6
6
|
public repository: ProductTypeRepository;
|
package/src/services/product.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Request, Response, Router } from "express";
|
|
2
|
-
import { getRepositoryContext } from "
|
|
3
|
-
import type { ProductRepository } from "../repositories/product";
|
|
4
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import { getRepositoryContext } from "#src/repositories/helpers.ts";
|
|
3
|
+
import type { ProductRepository } from "../repositories/product/index.ts";
|
|
4
|
+
import AbstractService from "./abstract.ts";
|
|
5
5
|
|
|
6
6
|
export class ProductService extends AbstractService {
|
|
7
7
|
public repository: ProductRepository;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Project } from "@commercetools/platform-sdk";
|
|
2
2
|
import supertest from "supertest";
|
|
3
3
|
import { describe, expect, test } from "vitest";
|
|
4
|
-
import { CommercetoolsMock } from "../index";
|
|
4
|
+
import { CommercetoolsMock } from "../index.ts";
|
|
5
5
|
|
|
6
6
|
const ctMock = new CommercetoolsMock();
|
|
7
7
|
|
package/src/services/project.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Update } from "@commercetools/platform-sdk";
|
|
2
2
|
import type { Request, Response, Router } from "express";
|
|
3
|
-
import { updateRequestSchema } from "
|
|
4
|
-
import { validateData } from "
|
|
5
|
-
import { getRepositoryContext } from "../repositories/helpers";
|
|
6
|
-
import type { ProjectRepository } from "../repositories/project";
|
|
3
|
+
import { updateRequestSchema } from "#src/schemas/update-request.ts";
|
|
4
|
+
import { validateData } from "#src/validate.ts";
|
|
5
|
+
import { getRepositoryContext } from "../repositories/helpers.ts";
|
|
6
|
+
import type { ProjectRepository } from "../repositories/project.ts";
|
|
7
7
|
|
|
8
8
|
export class ProjectService {
|
|
9
9
|
public repository: ProjectRepository;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import supertest from "supertest";
|
|
2
2
|
import { afterEach, describe, expect, it } from "vitest";
|
|
3
|
-
import { customerDraftFactory } from "
|
|
4
|
-
import { CommercetoolsMock } from "../index";
|
|
3
|
+
import { customerDraftFactory } from "#src/testing/customer.ts";
|
|
4
|
+
import { CommercetoolsMock } from "../index.ts";
|
|
5
5
|
|
|
6
6
|
describe("Quote Request Create", () => {
|
|
7
7
|
const ctMock = new CommercetoolsMock();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Router } from "express";
|
|
2
|
-
import type { QuoteRequestRepository } from "
|
|
3
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import type { QuoteRequestRepository } from "#src/repositories/quote-request/index.ts";
|
|
3
|
+
import AbstractService from "./abstract.ts";
|
|
4
4
|
|
|
5
5
|
export class QuoteRequestService extends AbstractService {
|
|
6
6
|
public repository: QuoteRequestRepository;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Router } from "express";
|
|
2
|
-
import type { StagedQuoteRepository } from "
|
|
3
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import type { StagedQuoteRepository } from "#src/repositories/quote-staged/index.ts";
|
|
3
|
+
import AbstractService from "./abstract.ts";
|
|
4
4
|
|
|
5
5
|
export class StagedQuoteService extends AbstractService {
|
|
6
6
|
public repository: StagedQuoteRepository;
|
package/src/services/quote.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Router } from "express";
|
|
2
|
-
import type { QuoteRepository } from "
|
|
3
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import type { QuoteRepository } from "#src/repositories/quote/index.ts";
|
|
3
|
+
import AbstractService from "./abstract.ts";
|
|
4
4
|
|
|
5
5
|
export class QuoteService extends AbstractService {
|
|
6
6
|
public repository: QuoteRepository;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RecurrencePolicyDraft } from "@commercetools/platform-sdk";
|
|
2
2
|
import supertest from "supertest";
|
|
3
3
|
import { describe, expect, test } from "vitest";
|
|
4
|
-
import { CommercetoolsMock } from "../index";
|
|
4
|
+
import { CommercetoolsMock } from "../index.ts";
|
|
5
5
|
|
|
6
6
|
const ctMock = new CommercetoolsMock();
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Router } from "express";
|
|
2
|
-
import type { RecurrencePolicyRepository } from "../repositories/recurrence-policy/index";
|
|
3
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import type { RecurrencePolicyRepository } from "../repositories/recurrence-policy/index.ts";
|
|
3
|
+
import AbstractService from "./abstract.ts";
|
|
4
4
|
|
|
5
5
|
export class RecurrencePolicyService extends AbstractService {
|
|
6
6
|
public repository: RecurrencePolicyRepository;
|
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
} from "@commercetools/platform-sdk";
|
|
5
5
|
import supertest from "supertest";
|
|
6
6
|
import { describe, expect, test } from "vitest";
|
|
7
|
-
import { CommercetoolsMock } from "../index";
|
|
7
|
+
import { CommercetoolsMock } from "../index.ts";
|
|
8
8
|
|
|
9
9
|
const ctMock = new CommercetoolsMock();
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Router } from "express";
|
|
2
|
-
import type { RecurringOrderRepository } from "../repositories/recurring-order/index";
|
|
3
|
-
import AbstractService from "./abstract";
|
|
2
|
+
import type { RecurringOrderRepository } from "../repositories/recurring-order/index.ts";
|
|
3
|
+
import AbstractService from "./abstract.ts";
|
|
4
4
|
|
|
5
5
|
export class RecurringOrderService extends AbstractService {
|
|
6
6
|
public repository: RecurringOrderRepository;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Product, Review, State } from "@commercetools/platform-sdk";
|
|
2
2
|
import supertest from "supertest";
|
|
3
3
|
import { beforeEach, describe, expect, test } from "vitest";
|
|
4
|
-
import { CommercetoolsMock } from "
|
|
4
|
+
import { CommercetoolsMock } from "#src/index.ts";
|
|
5
5
|
|
|
6
6
|
describe("Review Update Actions", () => {
|
|
7
7
|
let ctMock: CommercetoolsMock;
|