Skip to content

Commit

Permalink
feat(core): Implement OrderItem-level cancellation
Browse files Browse the repository at this point in the history
Relates to #120
  • Loading branch information
michaelbromley committed Jun 27, 2019
1 parent 3f9d605 commit 35084f3
Show file tree
Hide file tree
Showing 20 changed files with 449 additions and 250 deletions.
1 change: 1 addition & 0 deletions packages/common/src/generated-shop-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1368,6 +1368,7 @@ export type OrderItem = Node & {
id: Scalars['ID'];
createdAt: Scalars['DateTime'];
updatedAt: Scalars['DateTime'];
cancelled: Scalars['Boolean'];
unitPrice: Scalars['Int'];
unitPriceWithTax: Scalars['Int'];
unitPriceIncludesTax: Scalars['Boolean'];
Expand Down
128 changes: 67 additions & 61 deletions packages/common/src/generated-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ export type Cancellation = Node & StockMovement & {
orderLine: OrderLine,
};

export type CancelOrderLinesInput = {
lines: Array<OrderLineInput>,
reason?: Maybe<Scalars['String']>,
};

export type Channel = Node & {
__typename?: 'Channel',
id: Scalars['ID'],
Expand Down Expand Up @@ -449,7 +454,7 @@ export type CreateFacetValueWithFacetInput = {
};

export type CreateFulfillmentInput = {
lines: Array<FulfillmentLineInput>,
lines: Array<OrderLineInput>,
method: Scalars['String'],
trackingCode?: Maybe<Scalars['String']>,
};
Expand Down Expand Up @@ -1049,11 +1054,6 @@ export type Fulfillment = Node & {
trackingCode?: Maybe<Scalars['String']>,
};

export type FulfillmentLineInput = {
orderLineId: Scalars['ID'],
quantity: Scalars['Int'],
};

export type GlobalSettings = {
__typename?: 'GlobalSettings',
id: Scalars['ID'],
Expand Down Expand Up @@ -1544,7 +1544,7 @@ export type Mutation = {
importProducts?: Maybe<ImportInfo>,
settlePayment?: Maybe<Payment>,
createFulfillment?: Maybe<Fulfillment>,
cancelOrder?: Maybe<Order>,
cancelOrderLines: Array<OrderLine>,
/** Update an existing PaymentMethod */
updatePaymentMethod: PaymentMethod,
/** Create a new ProductOptionGroup */
Expand All @@ -1566,25 +1566,25 @@ export type Mutation = {
generateVariantsForProduct: Product,
/** Update existing ProductVariants */
updateProductVariants: Array<Maybe<ProductVariant>>,
createPromotion: Promotion,
updatePromotion: Promotion,
deletePromotion: DeletionResponse,
/** Create a new Role */
createRole: Role,
/** Update an existing Role */
updateRole: Role,
createPromotion: Promotion,
updatePromotion: Promotion,
deletePromotion: DeletionResponse,
/** Create a new ShippingMethod */
createShippingMethod: ShippingMethod,
/** Update an existing ShippingMethod */
updateShippingMethod: ShippingMethod,
/** Create a new TaxCategory */
createTaxCategory: TaxCategory,
/** Update an existing TaxCategory */
updateTaxCategory: TaxCategory,
/** Create a new TaxRate */
createTaxRate: TaxRate,
/** Update an existing TaxRate */
updateTaxRate: TaxRate,
/** Create a new TaxCategory */
createTaxCategory: TaxCategory,
/** Update an existing TaxCategory */
updateTaxCategory: TaxCategory,
/** Create a new Zone */
createZone: Zone,
/** Update an existing Zone */
Expand Down Expand Up @@ -1772,8 +1772,8 @@ export type MutationCreateFulfillmentArgs = {
};


export type MutationCancelOrderArgs = {
id: Scalars['ID']
export type MutationCancelOrderLinesArgs = {
input: CancelOrderLinesInput
};


Expand Down Expand Up @@ -1832,28 +1832,28 @@ export type MutationUpdateProductVariantsArgs = {
};


export type MutationCreatePromotionArgs = {
input: CreatePromotionInput
export type MutationCreateRoleArgs = {
input: CreateRoleInput
};


export type MutationUpdatePromotionArgs = {
input: UpdatePromotionInput
export type MutationUpdateRoleArgs = {
input: UpdateRoleInput
};


export type MutationDeletePromotionArgs = {
id: Scalars['ID']
export type MutationCreatePromotionArgs = {
input: CreatePromotionInput
};


export type MutationCreateRoleArgs = {
input: CreateRoleInput
export type MutationUpdatePromotionArgs = {
input: UpdatePromotionInput
};


export type MutationUpdateRoleArgs = {
input: UpdateRoleInput
export type MutationDeletePromotionArgs = {
id: Scalars['ID']
};


Expand All @@ -1867,23 +1867,23 @@ export type MutationUpdateShippingMethodArgs = {
};


export type MutationCreateTaxCategoryArgs = {
input: CreateTaxCategoryInput
export type MutationCreateTaxRateArgs = {
input: CreateTaxRateInput
};


export type MutationUpdateTaxCategoryArgs = {
input: UpdateTaxCategoryInput
export type MutationUpdateTaxRateArgs = {
input: UpdateTaxRateInput
};


export type MutationCreateTaxRateArgs = {
input: CreateTaxRateInput
export type MutationCreateTaxCategoryArgs = {
input: CreateTaxCategoryInput
};


export type MutationUpdateTaxRateArgs = {
input: UpdateTaxRateInput
export type MutationUpdateTaxCategoryArgs = {
input: UpdateTaxCategoryInput
};


Expand Down Expand Up @@ -1991,6 +1991,7 @@ export type OrderItem = Node & {
id: Scalars['ID'],
createdAt: Scalars['DateTime'],
updatedAt: Scalars['DateTime'],
cancelled: Scalars['Boolean'],
unitPrice: Scalars['Int'],
unitPriceWithTax: Scalars['Int'],
unitPriceIncludesTax: Scalars['Boolean'],
Expand All @@ -2016,6 +2017,11 @@ export type OrderLine = Node & {
customFields?: Maybe<Scalars['JSON']>,
};

export type OrderLineInput = {
orderLineId: Scalars['ID'],
quantity: Scalars['Int'],
};

export type OrderList = PaginatedList & {
__typename?: 'OrderList',
items: Array<Order>,
Expand Down Expand Up @@ -2414,10 +2420,10 @@ export type Query = {
facets: FacetList,
facet?: Maybe<Facet>,
globalSettings: GlobalSettings,
job?: Maybe<JobInfo>,
jobs: Array<JobInfo>,
order?: Maybe<Order>,
orders: OrderList,
job?: Maybe<JobInfo>,
jobs: Array<JobInfo>,
paymentMethods: PaymentMethodList,
paymentMethod?: Maybe<PaymentMethod>,
productOptionGroups: Array<ProductOptionGroup>,
Expand All @@ -2426,19 +2432,19 @@ export type Query = {
products: ProductList,
/** Get a Product either by id or slug. If neither id nor slug is speicified, an error will result. */
product?: Maybe<Product>,
roles: RoleList,
role?: Maybe<Role>,
promotion?: Maybe<Promotion>,
promotions: PromotionList,
adjustmentOperations: AdjustmentOperations,
roles: RoleList,
role?: Maybe<Role>,
shippingMethods: ShippingMethodList,
shippingMethod?: Maybe<ShippingMethod>,
shippingEligibilityCheckers: Array<ConfigurableOperation>,
shippingCalculators: Array<ConfigurableOperation>,
taxCategories: Array<TaxCategory>,
taxCategory?: Maybe<TaxCategory>,
taxRates: TaxRateList,
taxRate?: Maybe<TaxRate>,
taxCategories: Array<TaxCategory>,
taxCategory?: Maybe<TaxCategory>,
zones: Array<Zone>,
zone?: Maybe<Zone>,
};
Expand Down Expand Up @@ -2518,23 +2524,23 @@ export type QueryFacetArgs = {
};


export type QueryJobArgs = {
jobId: Scalars['String']
export type QueryOrderArgs = {
id: Scalars['ID']
};


export type QueryJobsArgs = {
input?: Maybe<JobListInput>
export type QueryOrdersArgs = {
options?: Maybe<OrderListOptions>
};


export type QueryOrderArgs = {
id: Scalars['ID']
export type QueryJobArgs = {
jobId: Scalars['String']
};


export type QueryOrdersArgs = {
options?: Maybe<OrderListOptions>
export type QueryJobsArgs = {
input?: Maybe<JobListInput>
};


Expand Down Expand Up @@ -2578,23 +2584,23 @@ export type QueryProductArgs = {
};


export type QueryPromotionArgs = {
id: Scalars['ID']
export type QueryRolesArgs = {
options?: Maybe<RoleListOptions>
};


export type QueryPromotionsArgs = {
options?: Maybe<PromotionListOptions>
export type QueryRoleArgs = {
id: Scalars['ID']
};


export type QueryRolesArgs = {
options?: Maybe<RoleListOptions>
export type QueryPromotionArgs = {
id: Scalars['ID']
};


export type QueryRoleArgs = {
id: Scalars['ID']
export type QueryPromotionsArgs = {
options?: Maybe<PromotionListOptions>
};


Expand All @@ -2608,11 +2614,6 @@ export type QueryShippingMethodArgs = {
};


export type QueryTaxCategoryArgs = {
id: Scalars['ID']
};


export type QueryTaxRatesArgs = {
options?: Maybe<TaxRateListOptions>
};
Expand All @@ -2623,6 +2624,11 @@ export type QueryTaxRateArgs = {
};


export type QueryTaxCategoryArgs = {
id: Scalars['ID']
};


export type QueryZoneArgs = {
id: Scalars['ID']
};
Expand Down
1 change: 1 addition & 0 deletions packages/core/e2e/graphql/fragments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ export const ORDER_FRAGMENT = gql`
export const ORDER_ITEM_FRAGMENT = gql`
fragment OrderItem on OrderItem {
id
cancelled
unitPrice
unitPriceIncludesTax
unitPriceWithTax
Expand Down
Loading

0 comments on commit 35084f3

Please sign in to comment.