Browse Source

feat(core): Implement tax on shipping

Relates to #54
Michael Bromley 6 years ago
parent
commit
1b13aa3d87

+ 40 - 36
admin-ui/src/app/common/generated-types.ts

@@ -1414,12 +1414,12 @@ export type Mutation = {
   assignRoleToAdministrator: Administrator,
   assignRoleToAdministrator: Administrator,
   /** Create a new Asset */
   /** Create a new Asset */
   createAssets: Array<Asset>,
   createAssets: Array<Asset>,
-  login: LoginResult,
-  logout: Scalars['Boolean'],
   /** Create a new Channel */
   /** Create a new Channel */
   createChannel: Channel,
   createChannel: Channel,
   /** Update an existing Channel */
   /** Update an existing Channel */
   updateChannel: Channel,
   updateChannel: Channel,
+  login: LoginResult,
+  logout: Scalars['Boolean'],
   /** Create a new Collection */
   /** Create a new Collection */
   createCollection: Collection,
   createCollection: Collection,
   /** Update an existing Collection */
   /** Update an existing Collection */
@@ -1472,7 +1472,6 @@ export type Mutation = {
   createProductOptionGroup: ProductOptionGroup,
   createProductOptionGroup: ProductOptionGroup,
   /** Update an existing ProductOptionGroup */
   /** Update an existing ProductOptionGroup */
   updateProductOptionGroup: ProductOptionGroup,
   updateProductOptionGroup: ProductOptionGroup,
-  reindex: SearchReindexResponse,
   /** Create a new Product */
   /** Create a new Product */
   createProduct: Product,
   createProduct: Product,
   /** Update an existing Product */
   /** Update an existing Product */
@@ -1487,6 +1486,7 @@ export type Mutation = {
   generateVariantsForProduct: Product,
   generateVariantsForProduct: Product,
   /** Update existing ProductVariants */
   /** Update existing ProductVariants */
   updateProductVariants: Array<Maybe<ProductVariant>>,
   updateProductVariants: Array<Maybe<ProductVariant>>,
+  reindex: SearchReindexResponse,
   createPromotion: Promotion,
   createPromotion: Promotion,
   updatePromotion: Promotion,
   updatePromotion: Promotion,
   deletePromotion: DeletionResponse,
   deletePromotion: DeletionResponse,
@@ -1494,14 +1494,14 @@ export type Mutation = {
   createRole: Role,
   createRole: Role,
   /** Update an existing Role */
   /** Update an existing Role */
   updateRole: Role,
   updateRole: Role,
-  /** Create a new ShippingMethod */
-  createShippingMethod: ShippingMethod,
-  /** Update an existing ShippingMethod */
-  updateShippingMethod: ShippingMethod,
   /** Create a new TaxCategory */
   /** Create a new TaxCategory */
   createTaxCategory: TaxCategory,
   createTaxCategory: TaxCategory,
   /** Update an existing TaxCategory */
   /** Update an existing TaxCategory */
   updateTaxCategory: TaxCategory,
   updateTaxCategory: TaxCategory,
+  /** Create a new ShippingMethod */
+  createShippingMethod: ShippingMethod,
+  /** Update an existing ShippingMethod */
+  updateShippingMethod: ShippingMethod,
   /** Create a new TaxRate */
   /** Create a new TaxRate */
   createTaxRate: TaxRate,
   createTaxRate: TaxRate,
   /** Update an existing TaxRate */
   /** Update an existing TaxRate */
@@ -1545,13 +1545,6 @@ export type MutationCreateAssetsArgs = {
 };
 };
 
 
 
 
-export type MutationLoginArgs = {
-  username: Scalars['String'],
-  password: Scalars['String'],
-  rememberMe?: Maybe<Scalars['Boolean']>
-};
-
-
 export type MutationCreateChannelArgs = {
 export type MutationCreateChannelArgs = {
   input: CreateChannelInput
   input: CreateChannelInput
 };
 };
@@ -1562,6 +1555,13 @@ export type MutationUpdateChannelArgs = {
 };
 };
 
 
 
 
+export type MutationLoginArgs = {
+  username: Scalars['String'],
+  password: Scalars['String'],
+  rememberMe?: Maybe<Scalars['Boolean']>
+};
+
+
 export type MutationCreateCollectionArgs = {
 export type MutationCreateCollectionArgs = {
   input: CreateCollectionInput
   input: CreateCollectionInput
 };
 };
@@ -1768,23 +1768,23 @@ export type MutationUpdateRoleArgs = {
 };
 };
 
 
 
 
-export type MutationCreateShippingMethodArgs = {
-  input: CreateShippingMethodInput
+export type MutationCreateTaxCategoryArgs = {
+  input: CreateTaxCategoryInput
 };
 };
 
 
 
 
-export type MutationUpdateShippingMethodArgs = {
-  input: UpdateShippingMethodInput
+export type MutationUpdateTaxCategoryArgs = {
+  input: UpdateTaxCategoryInput
 };
 };
 
 
 
 
-export type MutationCreateTaxCategoryArgs = {
-  input: CreateTaxCategoryInput
+export type MutationCreateShippingMethodArgs = {
+  input: CreateShippingMethodInput
 };
 };
 
 
 
 
-export type MutationUpdateTaxCategoryArgs = {
-  input: UpdateTaxCategoryInput
+export type MutationUpdateShippingMethodArgs = {
+  input: UpdateShippingMethodInput
 };
 };
 
 
 
 
@@ -1874,6 +1874,7 @@ export type Order = Node & {
   subTotal: Scalars['Int'],
   subTotal: Scalars['Int'],
   currencyCode: CurrencyCode,
   currencyCode: CurrencyCode,
   shipping: Scalars['Int'],
   shipping: Scalars['Int'],
+  shippingWithTax: Scalars['Int'],
   shippingMethod?: Maybe<ShippingMethod>,
   shippingMethod?: Maybe<ShippingMethod>,
   totalBeforeTax: Scalars['Int'],
   totalBeforeTax: Scalars['Int'],
   total: Scalars['Int'],
   total: Scalars['Int'],
@@ -1902,6 +1903,7 @@ export type OrderFilterParameter = {
   subTotal?: Maybe<NumberOperators>,
   subTotal?: Maybe<NumberOperators>,
   currencyCode?: Maybe<StringOperators>,
   currencyCode?: Maybe<StringOperators>,
   shipping?: Maybe<NumberOperators>,
   shipping?: Maybe<NumberOperators>,
+  shippingWithTax?: Maybe<NumberOperators>,
   totalBeforeTax?: Maybe<NumberOperators>,
   totalBeforeTax?: Maybe<NumberOperators>,
   total?: Maybe<NumberOperators>,
   total?: Maybe<NumberOperators>,
 };
 };
@@ -1953,6 +1955,7 @@ export type OrderSortParameter = {
   subTotalBeforeTax?: Maybe<SortOrder>,
   subTotalBeforeTax?: Maybe<SortOrder>,
   subTotal?: Maybe<SortOrder>,
   subTotal?: Maybe<SortOrder>,
   shipping?: Maybe<SortOrder>,
   shipping?: Maybe<SortOrder>,
+  shippingWithTax?: Maybe<SortOrder>,
   totalBeforeTax?: Maybe<SortOrder>,
   totalBeforeTax?: Maybe<SortOrder>,
   total?: Maybe<SortOrder>,
   total?: Maybe<SortOrder>,
 };
 };
@@ -2294,10 +2297,10 @@ export type Query = {
   administrator?: Maybe<Administrator>,
   administrator?: Maybe<Administrator>,
   assets: AssetList,
   assets: AssetList,
   asset?: Maybe<Asset>,
   asset?: Maybe<Asset>,
-  me?: Maybe<CurrentUser>,
   channels: Array<Channel>,
   channels: Array<Channel>,
   channel?: Maybe<Channel>,
   channel?: Maybe<Channel>,
   activeChannel: Channel,
   activeChannel: Channel,
+  me?: Maybe<CurrentUser>,
   collections: CollectionList,
   collections: CollectionList,
   collection?: Maybe<Collection>,
   collection?: Maybe<Collection>,
   collectionFilters: Array<ConfigurableOperation>,
   collectionFilters: Array<ConfigurableOperation>,
@@ -2316,20 +2319,20 @@ export type Query = {
   paymentMethod?: Maybe<PaymentMethod>,
   paymentMethod?: Maybe<PaymentMethod>,
   productOptionGroups: Array<ProductOptionGroup>,
   productOptionGroups: Array<ProductOptionGroup>,
   productOptionGroup?: Maybe<ProductOptionGroup>,
   productOptionGroup?: Maybe<ProductOptionGroup>,
-  search: SearchResponse,
   products: ProductList,
   products: ProductList,
   product?: Maybe<Product>,
   product?: Maybe<Product>,
+  search: SearchResponse,
   promotion?: Maybe<Promotion>,
   promotion?: Maybe<Promotion>,
   promotions: PromotionList,
   promotions: PromotionList,
   adjustmentOperations: AdjustmentOperations,
   adjustmentOperations: AdjustmentOperations,
   roles: RoleList,
   roles: RoleList,
   role?: Maybe<Role>,
   role?: Maybe<Role>,
+  taxCategories: Array<TaxCategory>,
+  taxCategory?: Maybe<TaxCategory>,
   shippingMethods: ShippingMethodList,
   shippingMethods: ShippingMethodList,
   shippingMethod?: Maybe<ShippingMethod>,
   shippingMethod?: Maybe<ShippingMethod>,
   shippingEligibilityCheckers: Array<ConfigurableOperation>,
   shippingEligibilityCheckers: Array<ConfigurableOperation>,
   shippingCalculators: Array<ConfigurableOperation>,
   shippingCalculators: Array<ConfigurableOperation>,
-  taxCategories: Array<TaxCategory>,
-  taxCategory?: Maybe<TaxCategory>,
   taxRates: TaxRateList,
   taxRates: TaxRateList,
   taxRate?: Maybe<TaxRate>,
   taxRate?: Maybe<TaxRate>,
   zones: Array<Zone>,
   zones: Array<Zone>,
@@ -2447,11 +2450,6 @@ export type QueryProductOptionGroupArgs = {
 };
 };
 
 
 
 
-export type QuerySearchArgs = {
-  input: SearchInput
-};
-
-
 export type QueryProductsArgs = {
 export type QueryProductsArgs = {
   languageCode?: Maybe<LanguageCode>,
   languageCode?: Maybe<LanguageCode>,
   options?: Maybe<ProductListOptions>
   options?: Maybe<ProductListOptions>
@@ -2464,6 +2462,11 @@ export type QueryProductArgs = {
 };
 };
 
 
 
 
+export type QuerySearchArgs = {
+  input: SearchInput
+};
+
+
 export type QueryPromotionArgs = {
 export type QueryPromotionArgs = {
   id: Scalars['ID']
   id: Scalars['ID']
 };
 };
@@ -2484,17 +2487,17 @@ export type QueryRoleArgs = {
 };
 };
 
 
 
 
-export type QueryShippingMethodsArgs = {
-  options?: Maybe<ShippingMethodListOptions>
+export type QueryTaxCategoryArgs = {
+  id: Scalars['ID']
 };
 };
 
 
 
 
-export type QueryShippingMethodArgs = {
-  id: Scalars['ID']
+export type QueryShippingMethodsArgs = {
+  options?: Maybe<ShippingMethodListOptions>
 };
 };
 
 
 
 
-export type QueryTaxCategoryArgs = {
+export type QueryShippingMethodArgs = {
   id: Scalars['ID']
   id: Scalars['ID']
 };
 };
 
 
@@ -2658,6 +2661,7 @@ export type ShippingMethodListOptions = {
 export type ShippingMethodQuote = {
 export type ShippingMethodQuote = {
   id: Scalars['ID'],
   id: Scalars['ID'],
   price: Scalars['Int'],
   price: Scalars['Int'],
+  priceWithTax: Scalars['Int'],
   description: Scalars['String'],
   description: Scalars['String'],
 };
 };
 
 

+ 4 - 0
packages/common/src/generated-shop-types.ts

@@ -1277,6 +1277,7 @@ export type Order = Node & {
     subTotal: Scalars['Int'];
     subTotal: Scalars['Int'];
     currencyCode: CurrencyCode;
     currencyCode: CurrencyCode;
     shipping: Scalars['Int'];
     shipping: Scalars['Int'];
+    shippingWithTax: Scalars['Int'];
     shippingMethod?: Maybe<ShippingMethod>;
     shippingMethod?: Maybe<ShippingMethod>;
     totalBeforeTax: Scalars['Int'];
     totalBeforeTax: Scalars['Int'];
     total: Scalars['Int'];
     total: Scalars['Int'];
@@ -1305,6 +1306,7 @@ export type OrderFilterParameter = {
     subTotal?: Maybe<NumberOperators>;
     subTotal?: Maybe<NumberOperators>;
     currencyCode?: Maybe<StringOperators>;
     currencyCode?: Maybe<StringOperators>;
     shipping?: Maybe<NumberOperators>;
     shipping?: Maybe<NumberOperators>;
+    shippingWithTax?: Maybe<NumberOperators>;
     totalBeforeTax?: Maybe<NumberOperators>;
     totalBeforeTax?: Maybe<NumberOperators>;
     total?: Maybe<NumberOperators>;
     total?: Maybe<NumberOperators>;
 };
 };
@@ -1356,6 +1358,7 @@ export type OrderSortParameter = {
     subTotalBeforeTax?: Maybe<SortOrder>;
     subTotalBeforeTax?: Maybe<SortOrder>;
     subTotal?: Maybe<SortOrder>;
     subTotal?: Maybe<SortOrder>;
     shipping?: Maybe<SortOrder>;
     shipping?: Maybe<SortOrder>;
+    shippingWithTax?: Maybe<SortOrder>;
     totalBeforeTax?: Maybe<SortOrder>;
     totalBeforeTax?: Maybe<SortOrder>;
     total?: Maybe<SortOrder>;
     total?: Maybe<SortOrder>;
 };
 };
@@ -1773,6 +1776,7 @@ export type ShippingMethodList = PaginatedList & {
 export type ShippingMethodQuote = {
 export type ShippingMethodQuote = {
     id: Scalars['ID'];
     id: Scalars['ID'];
     price: Scalars['Int'];
     price: Scalars['Int'];
+    priceWithTax: Scalars['Int'];
     description: Scalars['String'];
     description: Scalars['String'];
 };
 };
 
 

+ 40 - 36
packages/common/src/generated-types.ts

@@ -1413,12 +1413,12 @@ export type Mutation = {
   assignRoleToAdministrator: Administrator,
   assignRoleToAdministrator: Administrator,
   /** Create a new Asset */
   /** Create a new Asset */
   createAssets: Array<Asset>,
   createAssets: Array<Asset>,
-  login: LoginResult,
-  logout: Scalars['Boolean'],
   /** Create a new Channel */
   /** Create a new Channel */
   createChannel: Channel,
   createChannel: Channel,
   /** Update an existing Channel */
   /** Update an existing Channel */
   updateChannel: Channel,
   updateChannel: Channel,
+  login: LoginResult,
+  logout: Scalars['Boolean'],
   /** Create a new Collection */
   /** Create a new Collection */
   createCollection: Collection,
   createCollection: Collection,
   /** Update an existing Collection */
   /** Update an existing Collection */
@@ -1471,7 +1471,6 @@ export type Mutation = {
   createProductOptionGroup: ProductOptionGroup,
   createProductOptionGroup: ProductOptionGroup,
   /** Update an existing ProductOptionGroup */
   /** Update an existing ProductOptionGroup */
   updateProductOptionGroup: ProductOptionGroup,
   updateProductOptionGroup: ProductOptionGroup,
-  reindex: SearchReindexResponse,
   /** Create a new Product */
   /** Create a new Product */
   createProduct: Product,
   createProduct: Product,
   /** Update an existing Product */
   /** Update an existing Product */
@@ -1486,6 +1485,7 @@ export type Mutation = {
   generateVariantsForProduct: Product,
   generateVariantsForProduct: Product,
   /** Update existing ProductVariants */
   /** Update existing ProductVariants */
   updateProductVariants: Array<Maybe<ProductVariant>>,
   updateProductVariants: Array<Maybe<ProductVariant>>,
+  reindex: SearchReindexResponse,
   createPromotion: Promotion,
   createPromotion: Promotion,
   updatePromotion: Promotion,
   updatePromotion: Promotion,
   deletePromotion: DeletionResponse,
   deletePromotion: DeletionResponse,
@@ -1493,14 +1493,14 @@ export type Mutation = {
   createRole: Role,
   createRole: Role,
   /** Update an existing Role */
   /** Update an existing Role */
   updateRole: Role,
   updateRole: Role,
-  /** Create a new ShippingMethod */
-  createShippingMethod: ShippingMethod,
-  /** Update an existing ShippingMethod */
-  updateShippingMethod: ShippingMethod,
   /** Create a new TaxCategory */
   /** Create a new TaxCategory */
   createTaxCategory: TaxCategory,
   createTaxCategory: TaxCategory,
   /** Update an existing TaxCategory */
   /** Update an existing TaxCategory */
   updateTaxCategory: TaxCategory,
   updateTaxCategory: TaxCategory,
+  /** Create a new ShippingMethod */
+  createShippingMethod: ShippingMethod,
+  /** Update an existing ShippingMethod */
+  updateShippingMethod: ShippingMethod,
   /** Create a new TaxRate */
   /** Create a new TaxRate */
   createTaxRate: TaxRate,
   createTaxRate: TaxRate,
   /** Update an existing TaxRate */
   /** Update an existing TaxRate */
@@ -1539,13 +1539,6 @@ export type MutationCreateAssetsArgs = {
 };
 };
 
 
 
 
-export type MutationLoginArgs = {
-  username: Scalars['String'],
-  password: Scalars['String'],
-  rememberMe?: Maybe<Scalars['Boolean']>
-};
-
-
 export type MutationCreateChannelArgs = {
 export type MutationCreateChannelArgs = {
   input: CreateChannelInput
   input: CreateChannelInput
 };
 };
@@ -1556,6 +1549,13 @@ export type MutationUpdateChannelArgs = {
 };
 };
 
 
 
 
+export type MutationLoginArgs = {
+  username: Scalars['String'],
+  password: Scalars['String'],
+  rememberMe?: Maybe<Scalars['Boolean']>
+};
+
+
 export type MutationCreateCollectionArgs = {
 export type MutationCreateCollectionArgs = {
   input: CreateCollectionInput
   input: CreateCollectionInput
 };
 };
@@ -1762,23 +1762,23 @@ export type MutationUpdateRoleArgs = {
 };
 };
 
 
 
 
-export type MutationCreateShippingMethodArgs = {
-  input: CreateShippingMethodInput
+export type MutationCreateTaxCategoryArgs = {
+  input: CreateTaxCategoryInput
 };
 };
 
 
 
 
-export type MutationUpdateShippingMethodArgs = {
-  input: UpdateShippingMethodInput
+export type MutationUpdateTaxCategoryArgs = {
+  input: UpdateTaxCategoryInput
 };
 };
 
 
 
 
-export type MutationCreateTaxCategoryArgs = {
-  input: CreateTaxCategoryInput
+export type MutationCreateShippingMethodArgs = {
+  input: CreateShippingMethodInput
 };
 };
 
 
 
 
-export type MutationUpdateTaxCategoryArgs = {
-  input: UpdateTaxCategoryInput
+export type MutationUpdateShippingMethodArgs = {
+  input: UpdateShippingMethodInput
 };
 };
 
 
 
 
@@ -1853,6 +1853,7 @@ export type Order = Node & {
   subTotal: Scalars['Int'],
   subTotal: Scalars['Int'],
   currencyCode: CurrencyCode,
   currencyCode: CurrencyCode,
   shipping: Scalars['Int'],
   shipping: Scalars['Int'],
+  shippingWithTax: Scalars['Int'],
   shippingMethod?: Maybe<ShippingMethod>,
   shippingMethod?: Maybe<ShippingMethod>,
   totalBeforeTax: Scalars['Int'],
   totalBeforeTax: Scalars['Int'],
   total: Scalars['Int'],
   total: Scalars['Int'],
@@ -1881,6 +1882,7 @@ export type OrderFilterParameter = {
   subTotal?: Maybe<NumberOperators>,
   subTotal?: Maybe<NumberOperators>,
   currencyCode?: Maybe<StringOperators>,
   currencyCode?: Maybe<StringOperators>,
   shipping?: Maybe<NumberOperators>,
   shipping?: Maybe<NumberOperators>,
+  shippingWithTax?: Maybe<NumberOperators>,
   totalBeforeTax?: Maybe<NumberOperators>,
   totalBeforeTax?: Maybe<NumberOperators>,
   total?: Maybe<NumberOperators>,
   total?: Maybe<NumberOperators>,
 };
 };
@@ -1932,6 +1934,7 @@ export type OrderSortParameter = {
   subTotalBeforeTax?: Maybe<SortOrder>,
   subTotalBeforeTax?: Maybe<SortOrder>,
   subTotal?: Maybe<SortOrder>,
   subTotal?: Maybe<SortOrder>,
   shipping?: Maybe<SortOrder>,
   shipping?: Maybe<SortOrder>,
+  shippingWithTax?: Maybe<SortOrder>,
   totalBeforeTax?: Maybe<SortOrder>,
   totalBeforeTax?: Maybe<SortOrder>,
   total?: Maybe<SortOrder>,
   total?: Maybe<SortOrder>,
 };
 };
@@ -2273,10 +2276,10 @@ export type Query = {
   administrator?: Maybe<Administrator>,
   administrator?: Maybe<Administrator>,
   assets: AssetList,
   assets: AssetList,
   asset?: Maybe<Asset>,
   asset?: Maybe<Asset>,
-  me?: Maybe<CurrentUser>,
   channels: Array<Channel>,
   channels: Array<Channel>,
   channel?: Maybe<Channel>,
   channel?: Maybe<Channel>,
   activeChannel: Channel,
   activeChannel: Channel,
+  me?: Maybe<CurrentUser>,
   collections: CollectionList,
   collections: CollectionList,
   collection?: Maybe<Collection>,
   collection?: Maybe<Collection>,
   collectionFilters: Array<ConfigurableOperation>,
   collectionFilters: Array<ConfigurableOperation>,
@@ -2295,20 +2298,20 @@ export type Query = {
   paymentMethod?: Maybe<PaymentMethod>,
   paymentMethod?: Maybe<PaymentMethod>,
   productOptionGroups: Array<ProductOptionGroup>,
   productOptionGroups: Array<ProductOptionGroup>,
   productOptionGroup?: Maybe<ProductOptionGroup>,
   productOptionGroup?: Maybe<ProductOptionGroup>,
-  search: SearchResponse,
   products: ProductList,
   products: ProductList,
   product?: Maybe<Product>,
   product?: Maybe<Product>,
+  search: SearchResponse,
   promotion?: Maybe<Promotion>,
   promotion?: Maybe<Promotion>,
   promotions: PromotionList,
   promotions: PromotionList,
   adjustmentOperations: AdjustmentOperations,
   adjustmentOperations: AdjustmentOperations,
   roles: RoleList,
   roles: RoleList,
   role?: Maybe<Role>,
   role?: Maybe<Role>,
+  taxCategories: Array<TaxCategory>,
+  taxCategory?: Maybe<TaxCategory>,
   shippingMethods: ShippingMethodList,
   shippingMethods: ShippingMethodList,
   shippingMethod?: Maybe<ShippingMethod>,
   shippingMethod?: Maybe<ShippingMethod>,
   shippingEligibilityCheckers: Array<ConfigurableOperation>,
   shippingEligibilityCheckers: Array<ConfigurableOperation>,
   shippingCalculators: Array<ConfigurableOperation>,
   shippingCalculators: Array<ConfigurableOperation>,
-  taxCategories: Array<TaxCategory>,
-  taxCategory?: Maybe<TaxCategory>,
   taxRates: TaxRateList,
   taxRates: TaxRateList,
   taxRate?: Maybe<TaxRate>,
   taxRate?: Maybe<TaxRate>,
   zones: Array<Zone>,
   zones: Array<Zone>,
@@ -2423,11 +2426,6 @@ export type QueryProductOptionGroupArgs = {
 };
 };
 
 
 
 
-export type QuerySearchArgs = {
-  input: SearchInput
-};
-
-
 export type QueryProductsArgs = {
 export type QueryProductsArgs = {
   languageCode?: Maybe<LanguageCode>,
   languageCode?: Maybe<LanguageCode>,
   options?: Maybe<ProductListOptions>
   options?: Maybe<ProductListOptions>
@@ -2440,6 +2438,11 @@ export type QueryProductArgs = {
 };
 };
 
 
 
 
+export type QuerySearchArgs = {
+  input: SearchInput
+};
+
+
 export type QueryPromotionArgs = {
 export type QueryPromotionArgs = {
   id: Scalars['ID']
   id: Scalars['ID']
 };
 };
@@ -2460,17 +2463,17 @@ export type QueryRoleArgs = {
 };
 };
 
 
 
 
-export type QueryShippingMethodsArgs = {
-  options?: Maybe<ShippingMethodListOptions>
+export type QueryTaxCategoryArgs = {
+  id: Scalars['ID']
 };
 };
 
 
 
 
-export type QueryShippingMethodArgs = {
-  id: Scalars['ID']
+export type QueryShippingMethodsArgs = {
+  options?: Maybe<ShippingMethodListOptions>
 };
 };
 
 
 
 
-export type QueryTaxCategoryArgs = {
+export type QueryShippingMethodArgs = {
   id: Scalars['ID']
   id: Scalars['ID']
 };
 };
 
 
@@ -2634,6 +2637,7 @@ export type ShippingMethodListOptions = {
 export type ShippingMethodQuote = {
 export type ShippingMethodQuote = {
   id: Scalars['ID'],
   id: Scalars['ID'],
   price: Scalars['Int'],
   price: Scalars['Int'],
+  priceWithTax: Scalars['Int'],
   description: Scalars['String'],
   description: Scalars['String'],
 };
 };
 
 

+ 37 - 33
packages/core/e2e/graphql/generated-e2e-admin-types.ts

@@ -1410,12 +1410,12 @@ export type Mutation = {
     assignRoleToAdministrator: Administrator;
     assignRoleToAdministrator: Administrator;
     /** Create a new Asset */
     /** Create a new Asset */
     createAssets: Array<Asset>;
     createAssets: Array<Asset>;
-    login: LoginResult;
-    logout: Scalars['Boolean'];
     /** Create a new Channel */
     /** Create a new Channel */
     createChannel: Channel;
     createChannel: Channel;
     /** Update an existing Channel */
     /** Update an existing Channel */
     updateChannel: Channel;
     updateChannel: Channel;
+    login: LoginResult;
+    logout: Scalars['Boolean'];
     /** Create a new Collection */
     /** Create a new Collection */
     createCollection: Collection;
     createCollection: Collection;
     /** Update an existing Collection */
     /** Update an existing Collection */
@@ -1468,7 +1468,6 @@ export type Mutation = {
     createProductOptionGroup: ProductOptionGroup;
     createProductOptionGroup: ProductOptionGroup;
     /** Update an existing ProductOptionGroup */
     /** Update an existing ProductOptionGroup */
     updateProductOptionGroup: ProductOptionGroup;
     updateProductOptionGroup: ProductOptionGroup;
-    reindex: SearchReindexResponse;
     /** Create a new Product */
     /** Create a new Product */
     createProduct: Product;
     createProduct: Product;
     /** Update an existing Product */
     /** Update an existing Product */
@@ -1483,6 +1482,7 @@ export type Mutation = {
     generateVariantsForProduct: Product;
     generateVariantsForProduct: Product;
     /** Update existing ProductVariants */
     /** Update existing ProductVariants */
     updateProductVariants: Array<Maybe<ProductVariant>>;
     updateProductVariants: Array<Maybe<ProductVariant>>;
+    reindex: SearchReindexResponse;
     createPromotion: Promotion;
     createPromotion: Promotion;
     updatePromotion: Promotion;
     updatePromotion: Promotion;
     deletePromotion: DeletionResponse;
     deletePromotion: DeletionResponse;
@@ -1490,14 +1490,14 @@ export type Mutation = {
     createRole: Role;
     createRole: Role;
     /** Update an existing Role */
     /** Update an existing Role */
     updateRole: Role;
     updateRole: Role;
-    /** Create a new ShippingMethod */
-    createShippingMethod: ShippingMethod;
-    /** Update an existing ShippingMethod */
-    updateShippingMethod: ShippingMethod;
     /** Create a new TaxCategory */
     /** Create a new TaxCategory */
     createTaxCategory: TaxCategory;
     createTaxCategory: TaxCategory;
     /** Update an existing TaxCategory */
     /** Update an existing TaxCategory */
     updateTaxCategory: TaxCategory;
     updateTaxCategory: TaxCategory;
+    /** Create a new ShippingMethod */
+    createShippingMethod: ShippingMethod;
+    /** Update an existing ShippingMethod */
+    updateShippingMethod: ShippingMethod;
     /** Create a new TaxRate */
     /** Create a new TaxRate */
     createTaxRate: TaxRate;
     createTaxRate: TaxRate;
     /** Update an existing TaxRate */
     /** Update an existing TaxRate */
@@ -1531,12 +1531,6 @@ export type MutationCreateAssetsArgs = {
     input: Array<CreateAssetInput>;
     input: Array<CreateAssetInput>;
 };
 };
 
 
-export type MutationLoginArgs = {
-    username: Scalars['String'];
-    password: Scalars['String'];
-    rememberMe?: Maybe<Scalars['Boolean']>;
-};
-
 export type MutationCreateChannelArgs = {
 export type MutationCreateChannelArgs = {
     input: CreateChannelInput;
     input: CreateChannelInput;
 };
 };
@@ -1545,6 +1539,12 @@ export type MutationUpdateChannelArgs = {
     input: UpdateChannelInput;
     input: UpdateChannelInput;
 };
 };
 
 
+export type MutationLoginArgs = {
+    username: Scalars['String'];
+    password: Scalars['String'];
+    rememberMe?: Maybe<Scalars['Boolean']>;
+};
+
 export type MutationCreateCollectionArgs = {
 export type MutationCreateCollectionArgs = {
     input: CreateCollectionInput;
     input: CreateCollectionInput;
 };
 };
@@ -1712,14 +1712,6 @@ export type MutationUpdateRoleArgs = {
     input: UpdateRoleInput;
     input: UpdateRoleInput;
 };
 };
 
 
-export type MutationCreateShippingMethodArgs = {
-    input: CreateShippingMethodInput;
-};
-
-export type MutationUpdateShippingMethodArgs = {
-    input: UpdateShippingMethodInput;
-};
-
 export type MutationCreateTaxCategoryArgs = {
 export type MutationCreateTaxCategoryArgs = {
     input: CreateTaxCategoryInput;
     input: CreateTaxCategoryInput;
 };
 };
@@ -1728,6 +1720,14 @@ export type MutationUpdateTaxCategoryArgs = {
     input: UpdateTaxCategoryInput;
     input: UpdateTaxCategoryInput;
 };
 };
 
 
+export type MutationCreateShippingMethodArgs = {
+    input: CreateShippingMethodInput;
+};
+
+export type MutationUpdateShippingMethodArgs = {
+    input: UpdateShippingMethodInput;
+};
+
 export type MutationCreateTaxRateArgs = {
 export type MutationCreateTaxRateArgs = {
     input: CreateTaxRateInput;
     input: CreateTaxRateInput;
 };
 };
@@ -1793,6 +1793,7 @@ export type Order = Node & {
     subTotal: Scalars['Int'];
     subTotal: Scalars['Int'];
     currencyCode: CurrencyCode;
     currencyCode: CurrencyCode;
     shipping: Scalars['Int'];
     shipping: Scalars['Int'];
+    shippingWithTax: Scalars['Int'];
     shippingMethod?: Maybe<ShippingMethod>;
     shippingMethod?: Maybe<ShippingMethod>;
     totalBeforeTax: Scalars['Int'];
     totalBeforeTax: Scalars['Int'];
     total: Scalars['Int'];
     total: Scalars['Int'];
@@ -1821,6 +1822,7 @@ export type OrderFilterParameter = {
     subTotal?: Maybe<NumberOperators>;
     subTotal?: Maybe<NumberOperators>;
     currencyCode?: Maybe<StringOperators>;
     currencyCode?: Maybe<StringOperators>;
     shipping?: Maybe<NumberOperators>;
     shipping?: Maybe<NumberOperators>;
+    shippingWithTax?: Maybe<NumberOperators>;
     totalBeforeTax?: Maybe<NumberOperators>;
     totalBeforeTax?: Maybe<NumberOperators>;
     total?: Maybe<NumberOperators>;
     total?: Maybe<NumberOperators>;
 };
 };
@@ -1872,6 +1874,7 @@ export type OrderSortParameter = {
     subTotalBeforeTax?: Maybe<SortOrder>;
     subTotalBeforeTax?: Maybe<SortOrder>;
     subTotal?: Maybe<SortOrder>;
     subTotal?: Maybe<SortOrder>;
     shipping?: Maybe<SortOrder>;
     shipping?: Maybe<SortOrder>;
+    shippingWithTax?: Maybe<SortOrder>;
     totalBeforeTax?: Maybe<SortOrder>;
     totalBeforeTax?: Maybe<SortOrder>;
     total?: Maybe<SortOrder>;
     total?: Maybe<SortOrder>;
 };
 };
@@ -2212,10 +2215,10 @@ export type Query = {
     administrator?: Maybe<Administrator>;
     administrator?: Maybe<Administrator>;
     assets: AssetList;
     assets: AssetList;
     asset?: Maybe<Asset>;
     asset?: Maybe<Asset>;
-    me?: Maybe<CurrentUser>;
     channels: Array<Channel>;
     channels: Array<Channel>;
     channel?: Maybe<Channel>;
     channel?: Maybe<Channel>;
     activeChannel: Channel;
     activeChannel: Channel;
+    me?: Maybe<CurrentUser>;
     collections: CollectionList;
     collections: CollectionList;
     collection?: Maybe<Collection>;
     collection?: Maybe<Collection>;
     collectionFilters: Array<ConfigurableOperation>;
     collectionFilters: Array<ConfigurableOperation>;
@@ -2234,20 +2237,20 @@ export type Query = {
     paymentMethod?: Maybe<PaymentMethod>;
     paymentMethod?: Maybe<PaymentMethod>;
     productOptionGroups: Array<ProductOptionGroup>;
     productOptionGroups: Array<ProductOptionGroup>;
     productOptionGroup?: Maybe<ProductOptionGroup>;
     productOptionGroup?: Maybe<ProductOptionGroup>;
-    search: SearchResponse;
     products: ProductList;
     products: ProductList;
     product?: Maybe<Product>;
     product?: Maybe<Product>;
+    search: SearchResponse;
     promotion?: Maybe<Promotion>;
     promotion?: Maybe<Promotion>;
     promotions: PromotionList;
     promotions: PromotionList;
     adjustmentOperations: AdjustmentOperations;
     adjustmentOperations: AdjustmentOperations;
     roles: RoleList;
     roles: RoleList;
     role?: Maybe<Role>;
     role?: Maybe<Role>;
+    taxCategories: Array<TaxCategory>;
+    taxCategory?: Maybe<TaxCategory>;
     shippingMethods: ShippingMethodList;
     shippingMethods: ShippingMethodList;
     shippingMethod?: Maybe<ShippingMethod>;
     shippingMethod?: Maybe<ShippingMethod>;
     shippingEligibilityCheckers: Array<ConfigurableOperation>;
     shippingEligibilityCheckers: Array<ConfigurableOperation>;
     shippingCalculators: Array<ConfigurableOperation>;
     shippingCalculators: Array<ConfigurableOperation>;
-    taxCategories: Array<TaxCategory>;
-    taxCategory?: Maybe<TaxCategory>;
     taxRates: TaxRateList;
     taxRates: TaxRateList;
     taxRate?: Maybe<TaxRate>;
     taxRate?: Maybe<TaxRate>;
     zones: Array<Zone>;
     zones: Array<Zone>;
@@ -2341,10 +2344,6 @@ export type QueryProductOptionGroupArgs = {
     languageCode?: Maybe<LanguageCode>;
     languageCode?: Maybe<LanguageCode>;
 };
 };
 
 
-export type QuerySearchArgs = {
-    input: SearchInput;
-};
-
 export type QueryProductsArgs = {
 export type QueryProductsArgs = {
     languageCode?: Maybe<LanguageCode>;
     languageCode?: Maybe<LanguageCode>;
     options?: Maybe<ProductListOptions>;
     options?: Maybe<ProductListOptions>;
@@ -2355,6 +2354,10 @@ export type QueryProductArgs = {
     languageCode?: Maybe<LanguageCode>;
     languageCode?: Maybe<LanguageCode>;
 };
 };
 
 
+export type QuerySearchArgs = {
+    input: SearchInput;
+};
+
 export type QueryPromotionArgs = {
 export type QueryPromotionArgs = {
     id: Scalars['ID'];
     id: Scalars['ID'];
 };
 };
@@ -2371,6 +2374,10 @@ export type QueryRoleArgs = {
     id: Scalars['ID'];
     id: Scalars['ID'];
 };
 };
 
 
+export type QueryTaxCategoryArgs = {
+    id: Scalars['ID'];
+};
+
 export type QueryShippingMethodsArgs = {
 export type QueryShippingMethodsArgs = {
     options?: Maybe<ShippingMethodListOptions>;
     options?: Maybe<ShippingMethodListOptions>;
 };
 };
@@ -2379,10 +2386,6 @@ export type QueryShippingMethodArgs = {
     id: Scalars['ID'];
     id: Scalars['ID'];
 };
 };
 
 
-export type QueryTaxCategoryArgs = {
-    id: Scalars['ID'];
-};
-
 export type QueryTaxRatesArgs = {
 export type QueryTaxRatesArgs = {
     options?: Maybe<TaxRateListOptions>;
     options?: Maybe<TaxRateListOptions>;
 };
 };
@@ -2542,6 +2545,7 @@ export type ShippingMethodListOptions = {
 export type ShippingMethodQuote = {
 export type ShippingMethodQuote = {
     id: Scalars['ID'];
     id: Scalars['ID'];
     price: Scalars['Int'];
     price: Scalars['Int'];
+    priceWithTax: Scalars['Int'];
     description: Scalars['String'];
     description: Scalars['String'];
 };
 };
 
 

+ 4 - 0
packages/core/e2e/graphql/generated-e2e-shop-types.ts

@@ -1277,6 +1277,7 @@ export type Order = Node & {
     subTotal: Scalars['Int'];
     subTotal: Scalars['Int'];
     currencyCode: CurrencyCode;
     currencyCode: CurrencyCode;
     shipping: Scalars['Int'];
     shipping: Scalars['Int'];
+    shippingWithTax: Scalars['Int'];
     shippingMethod?: Maybe<ShippingMethod>;
     shippingMethod?: Maybe<ShippingMethod>;
     totalBeforeTax: Scalars['Int'];
     totalBeforeTax: Scalars['Int'];
     total: Scalars['Int'];
     total: Scalars['Int'];
@@ -1305,6 +1306,7 @@ export type OrderFilterParameter = {
     subTotal?: Maybe<NumberOperators>;
     subTotal?: Maybe<NumberOperators>;
     currencyCode?: Maybe<StringOperators>;
     currencyCode?: Maybe<StringOperators>;
     shipping?: Maybe<NumberOperators>;
     shipping?: Maybe<NumberOperators>;
+    shippingWithTax?: Maybe<NumberOperators>;
     totalBeforeTax?: Maybe<NumberOperators>;
     totalBeforeTax?: Maybe<NumberOperators>;
     total?: Maybe<NumberOperators>;
     total?: Maybe<NumberOperators>;
 };
 };
@@ -1356,6 +1358,7 @@ export type OrderSortParameter = {
     subTotalBeforeTax?: Maybe<SortOrder>;
     subTotalBeforeTax?: Maybe<SortOrder>;
     subTotal?: Maybe<SortOrder>;
     subTotal?: Maybe<SortOrder>;
     shipping?: Maybe<SortOrder>;
     shipping?: Maybe<SortOrder>;
+    shippingWithTax?: Maybe<SortOrder>;
     totalBeforeTax?: Maybe<SortOrder>;
     totalBeforeTax?: Maybe<SortOrder>;
     total?: Maybe<SortOrder>;
     total?: Maybe<SortOrder>;
 };
 };
@@ -1773,6 +1776,7 @@ export type ShippingMethodList = PaginatedList & {
 export type ShippingMethodQuote = {
 export type ShippingMethodQuote = {
     id: Scalars['ID'];
     id: Scalars['ID'];
     price: Scalars['Int'];
     price: Scalars['Int'];
+    priceWithTax: Scalars['Int'];
     description: Scalars['String'];
     description: Scalars['String'];
 };
 };
 
 

+ 1 - 0
packages/core/mock-data/simple-graphql-client.ts

@@ -1,3 +1,4 @@
+/// <reference types="../typings" />
 import { SUPER_ADMIN_USER_IDENTIFIER, SUPER_ADMIN_USER_PASSWORD } from '@vendure/common/lib/shared-constants';
 import { SUPER_ADMIN_USER_IDENTIFIER, SUPER_ADMIN_USER_PASSWORD } from '@vendure/common/lib/shared-constants';
 import { DocumentNode } from 'graphql';
 import { DocumentNode } from 'graphql';
 import { GraphQLClient } from 'graphql-request';
 import { GraphQLClient } from 'graphql-request';

+ 2 - 0
packages/core/src/api/schema/type/order.type.graphql

@@ -15,6 +15,7 @@ type Order implements Node {
     subTotal: Int!
     subTotal: Int!
     currencyCode: CurrencyCode!
     currencyCode: CurrencyCode!
     shipping: Int!
     shipping: Int!
+    shippingWithTax: Int!
     shippingMethod: ShippingMethod
     shippingMethod: ShippingMethod
     totalBeforeTax: Int!
     totalBeforeTax: Int!
     total: Int!
     total: Int!
@@ -41,6 +42,7 @@ type OrderList implements PaginatedList {
 type ShippingMethodQuote {
 type ShippingMethodQuote {
     id: ID!
     id: ID!
     price: Int!
     price: Int!
+    priceWithTax: Int!
     description: String!
     description: String!
 }
 }
 
 

+ 1 - 2
packages/core/src/common/configurable-operation.ts

@@ -76,13 +76,12 @@ function coerceValueToType<T>(arg: ConfigArg): ConfigArgValues<T>[keyof T] {
             return arg.value as any;
             return arg.value as any;
         case ConfigArgType.INT:
         case ConfigArgType.INT:
         case ConfigArgType.MONEY:
         case ConfigArgType.MONEY:
+        case ConfigArgType.PERCENTAGE:
             return Number.parseInt(arg.value || '', 10) as any;
             return Number.parseInt(arg.value || '', 10) as any;
         case ConfigArgType.DATETIME:
         case ConfigArgType.DATETIME:
             return Date.parse(arg.value || '') as any;
             return Date.parse(arg.value || '') as any;
         case ConfigArgType.BOOLEAN:
         case ConfigArgType.BOOLEAN:
             return !!arg.value as any;
             return !!arg.value as any;
-        case ConfigArgType.PERCENTAGE:
-            return arg.value as any;
         case ConfigArgType.FACET_VALUE_IDS:
         case ConfigArgType.FACET_VALUE_IDS:
             try {
             try {
                 return JSON.parse(arg.value as any);
                 return JSON.parse(arg.value as any);

+ 2 - 1
packages/core/src/config/shipping-method/default-shipping-calculator.ts

@@ -7,8 +7,9 @@ export const defaultShippingCalculator = new ShippingCalculator({
     description: 'Default Flat-Rate Shipping Calculator',
     description: 'Default Flat-Rate Shipping Calculator',
     args: {
     args: {
         rate: ConfigArgType.MONEY,
         rate: ConfigArgType.MONEY,
+        taxRate: ConfigArgType.PERCENTAGE,
     },
     },
     calculate: (order, args) => {
     calculate: (order, args) => {
-        return args.rate;
+        return { price: args.rate, priceWithTax: args.rate * ((100 + args.taxRate) / 100) };
     },
     },
 });
 });

+ 1 - 0
packages/core/src/config/shipping-method/default-shipping-eligibility-checker.ts

@@ -1,4 +1,5 @@
 import { ConfigArgType } from '../../../../common/lib/generated-types';
 import { ConfigArgType } from '../../../../common/lib/generated-types';
+
 import { ShippingEligibilityChecker } from './shipping-eligibility-checker';
 import { ShippingEligibilityChecker } from './shipping-eligibility-checker';
 
 
 export const defaultShippingEligibilityChecker = new ShippingEligibilityChecker({
 export const defaultShippingEligibilityChecker = new ShippingEligibilityChecker({

+ 8 - 2
packages/core/src/config/shipping-method/shipping-calculator.ts

@@ -8,9 +8,15 @@ export type ShippingCalculatorArgType =
     | ConfigArgType.INT
     | ConfigArgType.INT
     | ConfigArgType.MONEY
     | ConfigArgType.MONEY
     | ConfigArgType.STRING
     | ConfigArgType.STRING
+    | ConfigArgType.PERCENTAGE
     | ConfigArgType.BOOLEAN;
     | ConfigArgType.BOOLEAN;
 export type ShippingCalculatorArgs = ConfigArgs<ShippingCalculatorArgType>;
 export type ShippingCalculatorArgs = ConfigArgs<ShippingCalculatorArgType>;
 
 
+export type ShippingPrice = {
+    price: number;
+    priceWithTax: number;
+};
+
 /**
 /**
  * @description
  * @description
  * A function which implements the specific shipping calculation logic. It takes an {@link Order} and
  * A function which implements the specific shipping calculation logic. It takes an {@link Order} and
@@ -21,7 +27,7 @@ export type ShippingCalculatorArgs = ConfigArgs<ShippingCalculatorArgType>;
 export type CalculateShippingFn<T extends ShippingCalculatorArgs> = (
 export type CalculateShippingFn<T extends ShippingCalculatorArgs> = (
     order: Order,
     order: Order,
     args: ConfigArgValues<T>,
     args: ConfigArgValues<T>,
-) => number | Promise<number>;
+) => ShippingPrice | Promise<ShippingPrice>;
 
 
 /**
 /**
  * @description
  * @description
@@ -65,7 +71,7 @@ export class ShippingCalculator<T extends ShippingCalculatorArgs = {}> implement
      *
      *
      * @internal
      * @internal
      */
      */
-    calculate(order: Order, args: ConfigArg[]): number | Promise<number> {
+    calculate(order: Order, args: ConfigArg[]): ShippingPrice | Promise<ShippingPrice> {
         return this.calculateFn(order, argsArrayToHash(args));
         return this.calculateFn(order, argsArrayToHash(args));
     }
     }
 }
 }

+ 5 - 2
packages/core/src/data-import/providers/populator/populator.ts

@@ -194,11 +194,14 @@ export class Populator {
             await this.shippingMethodService.create({
             await this.shippingMethodService.create({
                 checker: {
                 checker: {
                     code: defaultShippingEligibilityChecker.code,
                     code: defaultShippingEligibilityChecker.code,
-                    arguments: [],
+                    arguments: [{ name: 'orderMinimum', value: '0', type: ConfigArgType.MONEY }],
                 },
                 },
                 calculator: {
                 calculator: {
                     code: defaultShippingCalculator.code,
                     code: defaultShippingCalculator.code,
-                    arguments: [{ name: 'rate', value: method.price.toString(), type: ConfigArgType.MONEY }],
+                    arguments: [
+                        { name: 'rate', value: method.price.toString(), type: ConfigArgType.MONEY },
+                        { name: 'taxRate', value: '0', type: ConfigArgType.PERCENTAGE },
+                    ],
                 },
                 },
                 description: method.name,
                 description: method.name,
                 code: normalizeString(method.name, '-'),
                 code: normalizeString(method.name, '-'),

+ 4 - 1
packages/core/src/entity/order/order.entity.ts

@@ -70,6 +70,9 @@ export class Order extends VendureEntity {
     @Column({ default: 0 })
     @Column({ default: 0 })
     shipping: number;
     shipping: number;
 
 
+    @Column({ default: 0 })
+    shippingWithTax: number;
+
     @Calculated()
     @Calculated()
     get totalBeforeTax(): number {
     get totalBeforeTax(): number {
         return this.subTotalBeforeTax + this.promotionAdjustmentsTotal + (this.shipping || 0);
         return this.subTotalBeforeTax + this.promotionAdjustmentsTotal + (this.shipping || 0);
@@ -77,7 +80,7 @@ export class Order extends VendureEntity {
 
 
     @Calculated()
     @Calculated()
     get total(): number {
     get total(): number {
-        return this.subTotal + this.promotionAdjustmentsTotal + (this.shipping || 0);
+        return this.subTotal + this.promotionAdjustmentsTotal + (this.shippingWithTax || 0);
     }
     }
 
 
     @Calculated()
     @Calculated()

+ 6 - 13
packages/core/src/entity/shipping-method/shipping-method.entity.ts

@@ -1,12 +1,12 @@
-import { Adjustment, AdjustmentType, ConfigurableOperation } from '@vendure/common/lib/generated-types';
+import { ConfigurableOperation } from '@vendure/common/lib/generated-types';
 import { DeepPartial } from '@vendure/common/lib/shared-types';
 import { DeepPartial } from '@vendure/common/lib/shared-types';
 import { Column, Entity, JoinTable, ManyToMany } from 'typeorm';
 import { Column, Entity, JoinTable, ManyToMany } from 'typeorm';
 
 
-import { AdjustmentSource } from '../../common/types/adjustment-source';
 import { ChannelAware } from '../../common/types/common-types';
 import { ChannelAware } from '../../common/types/common-types';
 import { getConfig } from '../../config/config-helpers';
 import { getConfig } from '../../config/config-helpers';
-import { ShippingCalculator } from '../../config/shipping-method/shipping-calculator';
+import { ShippingCalculator, ShippingPrice } from '../../config/shipping-method/shipping-calculator';
 import { ShippingEligibilityChecker } from '../../config/shipping-method/shipping-eligibility-checker';
 import { ShippingEligibilityChecker } from '../../config/shipping-method/shipping-eligibility-checker';
+import { VendureEntity } from '../base/base.entity';
 import { Channel } from '../channel/channel.entity';
 import { Channel } from '../channel/channel.entity';
 import { Order } from '../order/order.entity';
 import { Order } from '../order/order.entity';
 
 
@@ -21,8 +21,7 @@ import { Order } from '../order/order.entity';
  * @docsCategory entities
  * @docsCategory entities
  */
  */
 @Entity()
 @Entity()
-export class ShippingMethod extends AdjustmentSource implements ChannelAware {
-    type = AdjustmentType.SHIPPING;
+export class ShippingMethod extends VendureEntity implements ChannelAware {
     private readonly allCheckers: { [code: string]: ShippingEligibilityChecker } = {};
     private readonly allCheckers: { [code: string]: ShippingEligibilityChecker } = {};
     private readonly allCalculators: { [code: string]: ShippingCalculator } = {};
     private readonly allCalculators: { [code: string]: ShippingCalculator } = {};
 
 
@@ -46,16 +45,10 @@ export class ShippingMethod extends AdjustmentSource implements ChannelAware {
     @JoinTable()
     @JoinTable()
     channels: Channel[];
     channels: Channel[];
 
 
-    async apply(order: Order): Promise<Adjustment | undefined> {
+    async apply(order: Order): Promise<ShippingPrice | undefined> {
         const calculator = this.allCalculators[this.calculator.code];
         const calculator = this.allCalculators[this.calculator.code];
         if (calculator) {
         if (calculator) {
-            const amount = await calculator.calculate(order, this.calculator.args);
-            return {
-                amount,
-                type: this.type,
-                description: this.description,
-                adjustmentSource: this.getSourceId(),
-            };
+            return calculator.calculate(order, this.calculator.args);
         }
         }
     }
     }
 
 

+ 4 - 3
packages/core/src/service/helpers/order-calculator/order-calculator.ts

@@ -8,7 +8,7 @@ import { Connection } from 'typeorm';
 
 
 import { RequestContext } from '../../../api/common/request-context';
 import { RequestContext } from '../../../api/common/request-context';
 import { idsAreEqual } from '../../../common/utils';
 import { idsAreEqual } from '../../../common/utils';
-import { PromotionUtils } from '../../../config';
+import { PromotionUtils, ShippingPrice } from '../../../config';
 import { ConfigService } from '../../../config/config.service';
 import { ConfigService } from '../../../config/config.service';
 import { OrderLine, ProductVariant } from '../../../entity';
 import { OrderLine, ProductVariant } from '../../../entity';
 import { Order } from '../../../entity/order/order.entity';
 import { Order } from '../../../entity/order/order.entity';
@@ -134,12 +134,13 @@ export class OrderCalculator {
         const results = await this.shippingCalculator.getEligibleShippingMethods(ctx, order);
         const results = await this.shippingCalculator.getEligibleShippingMethods(ctx, order);
         const currentShippingMethod = order.shippingMethod;
         const currentShippingMethod = order.shippingMethod;
         if (results && results.length && currentShippingMethod) {
         if (results && results.length && currentShippingMethod) {
-            let selected: { method: ShippingMethod; price: number } | undefined;
+            let selected: { method: ShippingMethod; price: ShippingPrice } | undefined;
             selected = results.find(r => idsAreEqual(r.method.id, currentShippingMethod.id));
             selected = results.find(r => idsAreEqual(r.method.id, currentShippingMethod.id));
             if (!selected) {
             if (!selected) {
                 selected = results[0];
                 selected = results[0];
             }
             }
-            order.shipping = selected.price;
+            order.shipping = selected.price.price;
+            order.shippingWithTax = selected.price.priceWithTax;
         }
         }
     }
     }
 
 

+ 7 - 9
packages/core/src/service/helpers/shipping-calculator/shipping-calculator.ts

@@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common';
 import { notNullOrUndefined } from '@vendure/common/lib/shared-utils';
 import { notNullOrUndefined } from '@vendure/common/lib/shared-utils';
 
 
 import { RequestContext } from '../../../api/common/request-context';
 import { RequestContext } from '../../../api/common/request-context';
+import { ShippingPrice } from '../../../config/shipping-method/shipping-calculator';
 import { Order } from '../../../entity/order/order.entity';
 import { Order } from '../../../entity/order/order.entity';
 import { ShippingMethod } from '../../../entity/shipping-method/shipping-method.entity';
 import { ShippingMethod } from '../../../entity/shipping-method/shipping-method.entity';
 import { ShippingMethodService } from '../../services/shipping-method.service';
 import { ShippingMethodService } from '../../services/shipping-method.service';
@@ -17,20 +18,17 @@ export class ShippingCalculator {
     async getEligibleShippingMethods(
     async getEligibleShippingMethods(
         ctx: RequestContext,
         ctx: RequestContext,
         order: Order,
         order: Order,
-    ): Promise<Array<{ method: ShippingMethod; price: number }>> {
+    ): Promise<Array<{ method: ShippingMethod; price: ShippingPrice }>> {
         const shippingMethods = this.shippingMethodService.getActiveShippingMethods(ctx.channel);
         const shippingMethods = this.shippingMethodService.getActiveShippingMethods(ctx.channel);
         const methodsPromiseArray = shippingMethods
         const methodsPromiseArray = shippingMethods
             .filter(async sm => await sm.test(order))
             .filter(async sm => await sm.test(order))
-            .map(async sm => {
-                const adjustment = await sm.apply(order);
-                if (adjustment) {
-                    return {
-                        method: sm,
-                        price: adjustment.amount,
-                    };
+            .map(async method => {
+                const price = await method.apply(order);
+                if (price) {
+                    return { method, price };
                 }
                 }
             });
             });
         const methods = await Promise.all(methodsPromiseArray);
         const methods = await Promise.all(methodsPromiseArray);
-        return methods.filter(notNullOrUndefined).sort((a, b) => a.price - b.price);
+        return methods.filter(notNullOrUndefined).sort((a, b) => a.price.price - b.price.price);
     }
     }
 }
 }

+ 1 - 2
packages/core/src/service/helpers/tax-calculator/tax-calculator.ts

@@ -2,12 +2,11 @@ import { Injectable } from '@nestjs/common';
 
 
 import { RequestContext } from '../../../api/common/request-context';
 import { RequestContext } from '../../../api/common/request-context';
 import { idsAreEqual } from '../../../common/utils';
 import { idsAreEqual } from '../../../common/utils';
+import { ConfigService } from '../../../config/config.service';
 import { Channel } from '../../../entity/channel/channel.entity';
 import { Channel } from '../../../entity/channel/channel.entity';
 import { TaxCategory } from '../../../entity/tax-category/tax-category.entity';
 import { TaxCategory } from '../../../entity/tax-category/tax-category.entity';
 import { TaxRate } from '../../../entity/tax-rate/tax-rate.entity';
 import { TaxRate } from '../../../entity/tax-rate/tax-rate.entity';
 import { Zone } from '../../../entity/zone/zone.entity';
 import { Zone } from '../../../entity/zone/zone.entity';
-
-import { ConfigService } from '../../../config/config.service';
 import { TaxRateService } from '../../services/tax-rate.service';
 import { TaxRateService } from '../../services/tax-rate.service';
 
 
 export interface TaxCalculationResult {
 export interface TaxCalculationResult {

+ 2 - 1
packages/core/src/service/services/order.service.ts

@@ -249,7 +249,8 @@ export class OrderService {
         const eligibleMethods = await this.shippingCalculator.getEligibleShippingMethods(ctx, order);
         const eligibleMethods = await this.shippingCalculator.getEligibleShippingMethods(ctx, order);
         return eligibleMethods.map(result => ({
         return eligibleMethods.map(result => ({
             id: result.method.id as string,
             id: result.method.id as string,
-            price: result.price,
+            price: result.price.price,
+            priceWithTax: result.price.priceWithTax,
             description: result.method.description,
             description: result.method.description,
         }));
         }));
     }
     }

+ 2 - 2
packages/core/src/service/services/shipping-method.service.ts

@@ -114,11 +114,11 @@ export class ShippingMethodService {
      */
      */
     private parseOperationArgs(
     private parseOperationArgs(
         input: ConfigurableOperationInput,
         input: ConfigurableOperationInput,
-        adjustmentSource: ShippingEligibilityChecker | ShippingCalculator,
+        checkerOrCalculator: ShippingEligibilityChecker | ShippingCalculator,
     ): ConfigurableOperation {
     ): ConfigurableOperation {
         const output: ConfigurableOperation = {
         const output: ConfigurableOperation = {
             code: input.code,
             code: input.code,
-            description: adjustmentSource.description,
+            description: checkerOrCalculator.description,
             args: input.arguments,
             args: input.arguments,
         };
         };
         return output;
         return output;

File diff suppressed because it is too large
+ 0 - 0
schema-admin.json


File diff suppressed because it is too large
+ 0 - 0
schema-shop.json


Some files were not shown because too many files changed in this diff