diff --git a/api-specs/api/types/cart-discount/CartDiscountTotalPriceTarget.raml b/api-specs/api/types/cart-discount/CartDiscountTotalPriceTarget.raml new file mode 100644 index 000000000..2aa08443c --- /dev/null +++ b/api-specs/api/types/cart-discount/CartDiscountTotalPriceTarget.raml @@ -0,0 +1,8 @@ +#%RAML 1.0 DataType +(package): CartDiscount +(beta): true +type: CartDiscountTarget +displayName: CartDiscountTotalPriceTarget +discriminatorValue: totalPrice +description: | + Discount is applied to the total price of the [Cart](ctp:api:type:Cart). diff --git a/api-specs/api/types/cart/Cart.raml b/api-specs/api/types/cart/Cart.raml index 90812b50b..a441d38be 100644 --- a/api-specs/api/types/cart/Cart.raml +++ b/api-specs/api/types/cart/Cart.raml @@ -63,6 +63,7 @@ properties: type: CentPrecisionMoney description: | Sum of the `totalPrice` field of all [LineItems](ctp:api:type:LineItem) and [CustomLineItems](ctp:api:type:CustomLineItem), and if available, the `price` field of [ShippingInfo](ctp:api:type:ShippingInfo). + If a discount applies on `totalPrice`, this field holds the discounted value. Taxes are included if [TaxRate](ctp:api:type:TaxRate) `includedInPrice` is `true` for each price. taxedPrice?: @@ -70,10 +71,17 @@ properties: description: | - For a Cart with `Platform` [TaxMode](ctp:api:type:TaxMode), it is automatically set when a [shipping address is set](ctp:api:type:CartSetShippingAddressAction). - For a Cart with `External` [TaxMode](ctp:api:type:TaxMode), it is automatically set when the external Tax Rate for all Line Items, Custom Line Items, and Shipping Methods in the Cart are set. + + If a discount applies on `totalPrice`, this field holds the discounted values. taxedShippingPrice?: type: TaxedPrice description: |- Sum of the `taxedPrice` field of [ShippingInfo](ctp:api:type:ShippingInfo) across all Shipping Methods. + discountOnTotalPrice?: + type: DiscountOnTotalPrice + (beta): true + description: |- + Discounts that apply on the Cart `totalPrice`. taxMode: type: TaxMode description: | diff --git a/api-specs/api/types/cart/DiscountOnTotalPrice.raml b/api-specs/api/types/cart/DiscountOnTotalPrice.raml new file mode 100644 index 000000000..c0ab26433 --- /dev/null +++ b/api-specs/api/types/cart/DiscountOnTotalPrice.raml @@ -0,0 +1,25 @@ +#%RAML 1.0 DataType +(package): Cart +(beta): true +(docs-uri): https://docs.commercetools.com/api/projects/carts#discountontotalprice +displayName: DiscountOnTotalPrice +type: object +properties: + discountedAmount: + type: TypedMoney + description: | + Money value of the discount on the total price of the Cart or Order. + includedDiscounts: + type: DiscountedTotalPricePortion[] + description: | + Discounts that impact the total price of the Cart or Order. + discountedNetAmount?: + type: TypedMoney + description: | + Money value of the discount on the total net price of the Cart or Order. + Present only when `taxedPrice` of the Cart or Order exists. + discountedGrossAmount?: + type: TypedMoney + description: | + Money value of the discount on the total gross price of the Cart or Order. + Present only when `taxedPrice` of the Cart or Order exists. diff --git a/api-specs/api/types/cart/DiscountedTotalPricePortion.raml b/api-specs/api/types/cart/DiscountedTotalPricePortion.raml new file mode 100644 index 000000000..a32530dd0 --- /dev/null +++ b/api-specs/api/types/cart/DiscountedTotalPricePortion.raml @@ -0,0 +1,15 @@ +#%RAML 1.0 DataType +(package): Cart +(beta): true +(docs-uri): https://docs.commercetools.com/api/projects/carts#discountedtotalpriceportion +displayName: DiscountedTotalPricePortion +type: object +properties: + discount: + type: CartDiscountReference + description: | + Cart Discount related to the discounted price. + discountedAmount: + type: TypedMoney + description: | + Money value of the discount. diff --git a/api-specs/api/types/order/Order.raml b/api-specs/api/types/order/Order.raml index e34abeddf..eb279dba2 100644 --- a/api-specs/api/types/order/Order.raml +++ b/api-specs/api/types/order/Order.raml @@ -62,16 +62,25 @@ properties: type: TypedMoney description: | Sum of the `totalPrice` field of all [LineItems](ctp:api:type:LineItem) and [CustomLineItems](ctp:api:type:CustomLineItem), and if available, the `price` field of [ShippingInfo](ctp:api:type:ShippingInfo). + If a discount applies on `totalPrice`, this field holds the discounted value. + Taxes are included if [TaxRate](ctp:api:type:TaxRate) `includedInPrice` is `true` for each price. taxedPrice?: type: TaxedPrice description: | - For `Platform` [TaxMode](ctp:api:type:TaxMode), it is automatically set when a [shipping address is set](ctp:api:type:OrderSetShippingAddressAction). - For `External` [TaxMode](ctp:api:type:TaxMode), it is automatically set when the external Tax Rate for all Line Items, Custom Line Items, and Shipping Methods in the Cart are set. + + If a discount applies on `totalPrice`, this field holds the discounted values. taxedShippingPrice?: type: TaxedPrice description: | Sum of the `taxedPrice` field of [ShippingInfo](ctp:api:type:ShippingInfo) across all Shipping Methods. + discountOnTotalPrice?: + type: DiscountOnTotalPrice + (beta): true + description: |- + Discounts that apply on the total price of the Order. taxMode?: type: TaxMode description: | diff --git a/api-specs/api/types/types.raml b/api-specs/api/types/types.raml index 993fed113..983def7fe 100644 --- a/api-specs/api/types/types.raml +++ b/api-specs/api/types/types.raml @@ -125,6 +125,7 @@ CartDiscountReference: !include cart-discount/CartDiscountReference.raml CartDiscountResourceIdentifier: !include cart-discount/CartDiscountResourceIdentifier.raml CartDiscountShippingCostTarget: !include cart-discount/CartDiscountShippingCostTarget.raml CartDiscountTarget: !include cart-discount/CartDiscountTarget.raml +CartDiscountTotalPriceTarget: !include cart-discount/CartDiscountTotalPriceTarget.raml CartDiscountUpdate: !include cart-discount/CartDiscountUpdate.raml CartDiscountUpdateAction: !include cart-discount/CartDiscountUpdateAction.raml CartDiscountValue: !include cart-discount/CartDiscountValue.raml @@ -180,9 +181,11 @@ DirectDiscountDraft: !include cart/DirectDiscountDraft.raml DirectDiscountReference: !include cart/DirectDiscountReference.raml DiscountCodeInfo: !include cart/DiscountCodeInfo.raml DiscountCodeState: !include cart/DiscountCodeState.raml +DiscountOnTotalPrice: !include cart/DiscountOnTotalPrice.raml DiscountedLineItemPortion: !include cart/DiscountedLineItemPortion.raml DiscountedLineItemPrice: !include cart/DiscountedLineItemPrice.raml DiscountedLineItemPriceForQuantity: !include cart/DiscountedLineItemPriceForQuantity.raml +DiscountedTotalPricePortion: !include cart/DiscountedTotalPricePortion.raml ExternalLineItemTotalPrice: !include cart/ExternalLineItemTotalPrice.raml ExternalTaxAmountDraft: !include cart/ExternalTaxAmountDraft.raml ExternalTaxRateDraft: !include cart/ExternalTaxRateDraft.raml diff --git a/api-specs/graphql/schema.sdl b/api-specs/graphql/schema.sdl index f86b7b964..6cddf01c2 100644 --- a/api-specs/graphql/schema.sdl +++ b/api-specs/graphql/schema.sdl @@ -1699,6 +1699,8 @@ type Cart implements Versioned & ReferenceExpandable { customLineItems: [CustomLineItem!]! totalPrice: Money! taxedPrice: TaxedPrice + "BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta" + discountOnTotalPrice: DiscountOnTotalPrice shippingAddress: Address billingAddress: Address inventoryMode: InventoryMode! @@ -1857,8 +1859,18 @@ input CartDiscountTargetInput { shipping: ShippingTargetInput multiBuyLineItems: MultiBuyLineItemsTargetInput multiBuyCustomLineItems: MultiBuyCustomLineItemsTargetInput - } + totalPrice: CartDiscountTotalPriceTargetInput +} +"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta" +type CartDiscountTotalPriceTarget implements CartDiscountTarget { + type: String! +} + +"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta" +input CartDiscountTotalPriceTargetInput { + dummy: String +} input CartDiscountUpdateAction { "BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta" setStores: SetCartDiscountStores @@ -4068,6 +4080,13 @@ type DiscountedProductSearchPriceValue { discount: ProductDiscount } +"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta" +type DiscountedTotalPricePortion { + discount: CartDiscount + discountRef: Reference! + discountedAmount: BaseMoney! +} + type EnumAttribute implements Attribute { key: String! label: String! @@ -6420,6 +6439,8 @@ type Order implements Versioned & ReferenceExpandable { customLineItems: [CustomLineItem!]! totalPrice: Money! taxedPrice: TaxedPrice + "BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta" + discountOnTotalPrice: DiscountOnTotalPrice shippingAddress: Address billingAddress: Address inventoryMode: InventoryMode! @@ -13652,6 +13673,14 @@ type TimeType implements FieldType { name: String! } +"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta" +type DiscountOnTotalPrice { + discountedAmount: BaseMoney! + includedDiscounts: [DiscountedTotalPricePortion!]! + discountedNetAmount: BaseMoney + discountedGrossAmount: BaseMoney +} + type TrackingData { trackingId: String carrier: String