Procházet zdrojové kódy

feat(core): Add `code` field to ShippingMethodQuote

Closes #780
Michael Bromley před 4 roky
rodič
revize
847b4e20d7

+ 1 - 0
packages/admin-ui/src/lib/core/src/common/generated-types.ts

@@ -3004,6 +3004,7 @@ export type ShippingMethodQuote = {
   id: Scalars['ID'];
   price: Scalars['Int'];
   priceWithTax: Scalars['Int'];
+  code: Scalars['String'];
   name: Scalars['String'];
   description: Scalars['String'];
   /** Any optional metadata returned by the ShippingCalculator in the ShippingCalculationResult */

+ 1 - 0
packages/asset-server-plugin/e2e/graphql/generated-e2e-asset-server-plugin-types.ts

@@ -2764,6 +2764,7 @@ export type ShippingMethodQuote = {
     id: Scalars['ID'];
     price: Scalars['Int'];
     priceWithTax: Scalars['Int'];
+    code: Scalars['String'];
     name: Scalars['String'];
     description: Scalars['String'];
     /** Any optional metadata returned by the ShippingCalculator in the ShippingCalculationResult */

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

@@ -799,6 +799,7 @@ export type ShippingMethodQuote = {
     id: Scalars['ID'];
     price: Scalars['Int'];
     priceWithTax: Scalars['Int'];
+    code: Scalars['String'];
     name: Scalars['String'];
     description: Scalars['String'];
     /** Any optional metadata returned by the ShippingCalculator in the ShippingCalculationResult */

+ 1 - 0
packages/common/src/generated-types.ts

@@ -2966,6 +2966,7 @@ export type ShippingMethodQuote = {
   id: Scalars['ID'];
   price: Scalars['Int'];
   priceWithTax: Scalars['Int'];
+  code: Scalars['String'];
   name: Scalars['String'];
   description: Scalars['String'];
   /** Any optional metadata returned by the ShippingCalculator in the ShippingCalculationResult */

+ 1 - 0
packages/core/e2e/graphql/generated-e2e-admin-types.ts

@@ -2764,6 +2764,7 @@ export type ShippingMethodQuote = {
     id: Scalars['ID'];
     price: Scalars['Int'];
     priceWithTax: Scalars['Int'];
+    code: Scalars['String'];
     name: Scalars['String'];
     description: Scalars['String'];
     /** Any optional metadata returned by the ShippingCalculator in the ShippingCalculationResult */

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

@@ -769,6 +769,7 @@ export type ShippingMethodQuote = {
     id: Scalars['ID'];
     price: Scalars['Int'];
     priceWithTax: Scalars['Int'];
+    code: Scalars['String'];
     name: Scalars['String'];
     description: Scalars['String'];
     /** Any optional metadata returned by the ShippingCalculator in the ShippingCalculationResult */
@@ -2992,7 +2993,9 @@ export type RemoveItemFromOrderMutation = {
 export type GetShippingMethodsQueryVariables = Exact<{ [key: string]: never }>;
 
 export type GetShippingMethodsQuery = {
-    eligibleShippingMethods: Array<Pick<ShippingMethodQuote, 'id' | 'price' | 'name' | 'description'>>;
+    eligibleShippingMethods: Array<
+        Pick<ShippingMethodQuote, 'id' | 'code' | 'price' | 'name' | 'description'>
+    >;
 };
 
 export type SetShippingMethodMutationVariables = Exact<{

+ 1 - 0
packages/core/e2e/graphql/shop-definitions.ts

@@ -392,6 +392,7 @@ export const GET_ELIGIBLE_SHIPPING_METHODS = gql`
     query GetShippingMethods {
         eligibleShippingMethods {
             id
+            code
             price
             name
             description

+ 14 - 2
packages/core/e2e/shop-order.e2e-spec.ts

@@ -876,8 +876,20 @@ describe('Shop orders', () => {
                 shippingMethods = result.eligibleShippingMethods;
 
                 expect(shippingMethods).toEqual([
-                    { id: 'T_1', price: 500, name: 'Standard Shipping', description: '' },
-                    { id: 'T_2', price: 1000, name: 'Express Shipping', description: '' },
+                    {
+                        id: 'T_1',
+                        price: 500,
+                        code: 'standard-shipping',
+                        name: 'Standard Shipping',
+                        description: '',
+                    },
+                    {
+                        id: 'T_2',
+                        price: 1000,
+                        code: 'express-shipping',
+                        name: 'Express Shipping',
+                        description: '',
+                    },
                 ]);
             });
 

+ 1 - 0
packages/core/src/api/schema/common/common-types.graphql

@@ -178,6 +178,7 @@ type ShippingMethodQuote {
     id: ID!
     price: Int!
     priceWithTax: Int!
+    code: String!
     name: String!
     description: String!
     "Any optional metadata returned by the ShippingCalculator in the ShippingCalculationResult"

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

@@ -93,6 +93,7 @@ export class OrderTestingService {
                     price: priceIncludesTax ? netPriceOf(price, taxRate) : price,
                     priceWithTax: priceIncludesTax ? price : grossPriceOf(price, taxRate),
                     name: result.method.name,
+                    code: result.method.code,
                     description: result.method.description,
                     metadata: result.result.metadata,
                 };

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

@@ -603,6 +603,7 @@ export class OrderService {
                 priceWithTax: priceIncludesTax ? price : grossPriceOf(price, taxRate),
                 description: eligible.method.description,
                 name: eligible.method.name,
+                code: eligible.method.code,
                 metadata,
             };
         });

+ 1 - 0
packages/elasticsearch-plugin/e2e/graphql/generated-e2e-elasticsearch-plugin-types.ts

@@ -2764,6 +2764,7 @@ export type ShippingMethodQuote = {
     id: Scalars['ID'];
     price: Scalars['Int'];
     priceWithTax: Scalars['Int'];
+    code: Scalars['String'];
     name: Scalars['String'];
     description: Scalars['String'];
     /** Any optional metadata returned by the ShippingCalculator in the ShippingCalculationResult */

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
schema-admin.json


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
schema-shop.json


Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů