Skip to content

Commit

Permalink
feat(core): Include with/without tax amounts on discounts
Browse files Browse the repository at this point in the history
Relates to #749

BREAKING CHANGE: A minor breaking change has been made to the GraphQL API: The `Order.discounts` and
`OrderLine.discounts` fields now return `amount` and `amountWithTax`. Previously they only had
`amount`, which was actually the tax-inclusive value. So if you want to show discount amounts with
tax, use `amountWithTax` and otherwise use `amount`.
  • Loading branch information
michaelbromley committed Mar 23, 2021
1 parent 10899f3 commit 2de6bf5
Show file tree
Hide file tree
Showing 15 changed files with 4,940 additions and 4,450 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ export type Order = Node & {
* @deprecated Use `discounts` instead
*/
adjustments: Array<Adjustment>;
discounts: Array<Adjustment>;
discounts: Array<Discount>;
/** An array of all coupon codes applied to the Order */
couponCodes: Array<Scalars['String']>;
/** Promotions applied to the order. Only gets populated after the payment process has completed. */
Expand Down Expand Up @@ -3691,7 +3691,15 @@ export type ShippingLine = {
priceWithTax: Scalars['Int'];
discountedPrice: Scalars['Int'];
discountedPriceWithTax: Scalars['Int'];
discounts: Array<Adjustment>;
discounts: Array<Discount>;
};

export type Discount = {
adjustmentSource: Scalars['String'];
type: AdjustmentType;
description: Scalars['String'];
amount: Scalars['Int'];
amountWithTax: Scalars['Int'];
};

export type OrderItem = Node & {
Expand Down Expand Up @@ -3790,7 +3798,7 @@ export type OrderLine = Node & {
lineTax: Scalars['Int'];
/** @deprecated Use `discounts` instead */
adjustments: Array<Adjustment>;
discounts: Array<Adjustment>;
discounts: Array<Discount>;
taxLines: Array<TaxLine>;
order: Order;
customFields?: Maybe<Scalars['JSON']>;
Expand Down
4,160 changes: 2,091 additions & 2,069 deletions packages/common/src/generated-shop-types.ts

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions packages/common/src/generated-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,7 @@ export type Order = Node & {
* @deprecated Use `discounts` instead
*/
adjustments: Array<Adjustment>;
discounts: Array<Adjustment>;
discounts: Array<Discount>;
/** An array of all coupon codes applied to the Order */
couponCodes: Array<Scalars['String']>;
/** Promotions applied to the order. Only gets populated after the payment process has completed. */
Expand Down Expand Up @@ -3911,7 +3911,16 @@ export type ShippingLine = {
priceWithTax: Scalars['Int'];
discountedPrice: Scalars['Int'];
discountedPriceWithTax: Scalars['Int'];
discounts: Array<Adjustment>;
discounts: Array<Discount>;
};

export type Discount = {
__typename?: 'Discount';
adjustmentSource: Scalars['String'];
type: AdjustmentType;
description: Scalars['String'];
amount: Scalars['Int'];
amountWithTax: Scalars['Int'];
};

export type OrderItem = Node & {
Expand Down Expand Up @@ -4012,7 +4021,7 @@ export type OrderLine = Node & {
lineTax: Scalars['Int'];
/** @deprecated Use `discounts` instead */
adjustments: Array<Adjustment>;
discounts: Array<Adjustment>;
discounts: Array<Discount>;
taxLines: Array<TaxLine>;
order: Order;
customFields?: Maybe<Scalars['JSON']>;
Expand Down
14 changes: 11 additions & 3 deletions packages/core/e2e/graphql/generated-e2e-admin-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ export type Order = Node & {
* @deprecated Use `discounts` instead
*/
adjustments: Array<Adjustment>;
discounts: Array<Adjustment>;
discounts: Array<Discount>;
/** An array of all coupon codes applied to the Order */
couponCodes: Array<Scalars['String']>;
/** Promotions applied to the order. Only gets populated after the payment process has completed. */
Expand Down Expand Up @@ -3691,7 +3691,15 @@ export type ShippingLine = {
priceWithTax: Scalars['Int'];
discountedPrice: Scalars['Int'];
discountedPriceWithTax: Scalars['Int'];
discounts: Array<Adjustment>;
discounts: Array<Discount>;
};

export type Discount = {
adjustmentSource: Scalars['String'];
type: AdjustmentType;
description: Scalars['String'];
amount: Scalars['Int'];
amountWithTax: Scalars['Int'];
};

export type OrderItem = Node & {
Expand Down Expand Up @@ -3790,7 +3798,7 @@ export type OrderLine = Node & {
lineTax: Scalars['Int'];
/** @deprecated Use `discounts` instead */
adjustments: Array<Adjustment>;
discounts: Array<Adjustment>;
discounts: Array<Discount>;
taxLines: Array<TaxLine>;
order: Order;
customFields?: Maybe<Scalars['JSON']>;
Expand Down
Loading

0 comments on commit 2de6bf5

Please sign in to comment.