Skip to content

Commit c885cc0

Browse files
committed
Updated API from documentation release
1 parent e233738 commit c885cc0

File tree

8 files changed

+38
-3
lines changed

8 files changed

+38
-3
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"type": "relative",
3-
"permyriad": 1000
3+
"permyriad": 1000,
4+
"applicationMode": "ProportionateDistribution"
45
}

api-specs/api/resources/cart-discounts.raml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ post:
5353
],
5454
},
5555
]
56-
description: Creating a Cart Discount produces the [CartDiscountCreated](ctp:api:type:CartDiscountCreatedMessage) Message.
56+
description: |
57+
Creating a Cart Discount produces the [CartDiscountCreated](ctp:api:type:CartDiscountCreatedMessage) Message.
5758
body:
5859
application/json:
5960
example: !include ../examples/cart-discount-create.example.json

api-specs/api/types/cart-discount/CartDiscountValueRelative.raml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,11 @@ properties:
1212
format: int64
1313
description: |
1414
Fraction (per ten thousand) the price is reduced by. For example, `1000` will result in a 10% price reduction.
15+
applicationMode?:
16+
type: DiscountApplicationMode
17+
default: IndividualApplication
18+
description: |
19+
Indicates how the discount applies when using [CartDiscountPatternTarget](ctp:api:type:CartDiscountPatternTarget).
20+
21+
- If the mode is `IndividualApplication`, the discounted percentage is applied on each unit's price. The units matching the `triggerPattern` are not considered.
22+
- If the mode is `ProportionateDistribution` and `EvenDistribution` the discounted value is calculated from the total value of the units matching the `targetPattern` and distributed among the units matching the `targetPattern` or `triggerPattern`. These modes are allowed only if [CartDiscountPatternTarget](ctp:api:type:CartDiscountPatternTarget) `triggerPattern` is non-empty.

api-specs/api/types/cart-discount/CartDiscountValueRelativeDraft.raml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,11 @@ properties:
1010
format: int64
1111
description: |
1212
Fraction (per ten thousand) the price is reduced by. For example, `1000` will result in a 10% price reduction.
13+
applicationMode?:
14+
type: DiscountApplicationMode
15+
default: IndividualApplication
16+
description: |
17+
Determines how the discount applies when using [CartDiscountPatternTarget](ctp:api:type:CartDiscountPatternTarget).
18+
19+
- If the mode is `IndividualApplication`, the discounted percentage is applied on each unit's price. The units matching the `triggerPattern` are not considered.
20+
- If the mode is `ProportionateDistribution` and `EvenDistribution` the discounted value is calculated from the total value of the units matching the `targetPattern` and distributed among the units matching the `targetPattern` or `triggerPattern`. These modes are allowed only if [CartDiscountPatternTarget](ctp:api:type:CartDiscountPatternTarget) `triggerPattern` is non-empty.

api-specs/api/types/cart-discount/DiscountApplicationMode.raml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
type: string
44
displayName: DiscountApplicationMode
55
description: |
6-
This mode determines how absolute Discounts are applied on Line Items or Custom Line Items.
6+
This mode determines how Discounts are distributed among items in a Cart.
77
(enumDescriptions):
88
ProportionateDistribution: Distributes the Discount proportionately across eligible Line Items or Custom Line Items.
99
EvenDistribution: Distributes the Discount evenly across eligible Line Items or Custom Line Items.

api-specs/api/types/cart-discount/updates/CartDiscountChangeTargetAction.raml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ properties:
99
type: CartDiscountTarget
1010
description: |
1111
New value to set.
12+
13+
For a [CartDiscountValueRelative](ctp:api:type:CartDiscountValueRelative), if `applicationMode` is set, the target must be [CartDiscountPatternTarget](ctp:api:type:CartDiscountPatternTarget).
14+
If `applicationMode` is `ProportionateDistribution` or `EvenDistribution`, the [CartDiscountPatternTarget](ctp:api:type:CartDiscountPatternTarget) `triggerPattern` must be non-empty.
15+
If either conditions are not met, an [InvalidOperation](ctp:api:type:InvalidOperationError) error is returned.

api-specs/api/types/cart-discount/updates/CartDiscountChangeValueAction.raml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ properties:
1212
type: CartDiscountValueDraft
1313
description: |
1414
New value to set.
15+
1516
When trying to set a [CartDiscountValueGiftLineItemDraft](ctp:api:type:CartDiscountValueGiftLineItemDraft) an [InvalidInput](ctp:api:type:InvalidInputError) error is returned.

api-specs/graphql/schema.sdl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,6 +2021,7 @@ input CartDiscountValueBaseMoneyInput {
20212021

20222022
input CartDiscountValueInput {
20232023
relative: RelativeDiscountValueInput
2024+
relativeCart: RelativeCartDiscountValueInput
20242025
absolute: AbsoluteDiscountValueInput
20252026
absoluteCart: AbsoluteCartDiscountValueInput
20262027
fixed: FixedPriceDiscountValueInput
@@ -11117,6 +11118,17 @@ input RejectApprovalFlow {
1111711118
reason: String
1111811119
}
1111911120

11121+
type RelativeCartDiscountValue implements CartDiscountValue {
11122+
permyriad: Int!
11123+
applicationMode: DiscountApplicationMode!
11124+
type: String!
11125+
}
11126+
11127+
input RelativeCartDiscountValueInput {
11128+
permyriad: Int!
11129+
applicationMode: DiscountApplicationMode!
11130+
}
11131+
1112011132
type RelativeDiscountValue implements CartDiscountValue & ProductDiscountValue {
1112111133
permyriad: Int!
1112211134
type: String!

0 commit comments

Comments
 (0)