Skip to content

Commit

Permalink
Updated API from documentation release
Browse files Browse the repository at this point in the history
  • Loading branch information
Auto Mation committed Sep 28, 2023
1 parent 67d35c4 commit a44de0c
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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).
8 changes: 8 additions & 0 deletions api-specs/api/types/cart/Cart.raml
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,25 @@ 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?:
type: TaxedPrice
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: |
Expand Down
25 changes: 25 additions & 0 deletions api-specs/api/types/cart/DiscountOnTotalPrice.raml
Original file line number Diff line number Diff line change
@@ -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.
15 changes: 15 additions & 0 deletions api-specs/api/types/cart/DiscountedTotalPricePortion.raml
Original file line number Diff line number Diff line change
@@ -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.
9 changes: 9 additions & 0 deletions api-specs/api/types/order/Order.raml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
3 changes: 3 additions & 0 deletions api-specs/api/types/types.raml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
31 changes: 30 additions & 1 deletion api-specs/graphql/schema.sdl
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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!
Expand Down Expand Up @@ -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!
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a44de0c

Please sign in to comment.