Skip to content

Commit 175b7fc

Browse files
committed
Updated API from documentation release
1 parent 9c2f053 commit 175b7fc

20 files changed

+274
-11
lines changed

api-specs/api/ruleset.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
<option type="exclude">assetOrder</option>
5454
<option type="exclude">lineItemOrder</option>
5555
<option type="exclude">textLineItemOrder</option>
56+
<option type="exclude">triggerPattern</option>
57+
<option type="exclude">targetPattern</option>
5658
<option type="exclude">syncInfo</option>
5759
<option type="exclude">localeProjection</option>
5860
<option type="exclude">returnInfo</option>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#%RAML 1.0 DataType
2+
(package): 'CartDiscount'
3+
type: CartDiscountTarget
4+
displayName: CartDiscountPatternTarget
5+
discriminatorValue: pattern
6+
description: |
7+
Pattern targets can be used to model Buy and Get discounts.
8+
9+
Unlike [CartDiscountLineItemsTarget](#cartdiscountlineitemstarget) and [CartDiscountCustomLineItemsTarget](#cartdiscountcustomlineitemstarget), it does not apply to a (Custom) Line Item as a whole, but to individual units of a (Custom) Line Item. The discounts can apply multiple times on the same cart, but each unit can be discounted only once.
10+
properties:
11+
triggerPattern?:
12+
type: array
13+
items: PatternComponent
14+
description: |
15+
Units of a (Custom) Line Item that trigger a discount application.
16+
17+
Based on the availability of matching units, the `triggerPattern` can match multiple times, effecting the number of times the discount will be applied.
18+
To further limit the discount application, set the `maxOccurrence`.
19+
20+
If empty or not set, the Discount will apply indefinitely.
21+
targetPattern:
22+
type: array
23+
items: PatternComponent
24+
description: |
25+
Units of (Custom) Line Items on which the Discount is applied.
26+
27+
Based on the availability of matching units and the limits from the `triggerPattern` or `maxOccurence`, the `targetPattern` can match multiple times.
28+
maxOccurrence?:
29+
type: integer
30+
description: |
31+
Maximum number of times the Discount can apply on a Cart.
32+
33+
If empty or not set, the Discount will apply indefinitely.
34+
selectionMode:
35+
type: SelectionMode
36+
description: |
37+
Determines which of the matching units of (Custom) Line Items are discounted.

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,10 @@ properties:
1010
type: TypedMoney[]
1111
description: |
1212
Money values in [cent precision](ctp:api:type:CentPrecisionMoney) or [high precision](ctp:api:type:HighPrecisionMoney) of different currencies.
13+
applicationMode?:
14+
type: DiscountApplicationMode
15+
description: |
16+
Indicates how the discount is applied on [CartDiscountLineItemTarget](ctp:api:type:CartDiscountLineItemsTarget) or [CartDiscountCustomLineItemTarget](ctp:api:type:CartDiscountCustomLineItemsTarget).
17+
18+
For [CartDiscountPatternTarget](ctp:api:type:CartDiscountPatternTarget), the mode can also be `ProportionateDistribution` or `EvenDistribution`.
19+
default: IndividualApplication

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,10 @@ properties:
1313
A fixed Cart Discount will match a price only if the array contains a value with the same currency. For example, if it contains 10€ and 15$, the matching € price will be discounted by 10€ and the matching $ price will be discounted to 15$. If the array has multiple values of the same currency, the API returns an [InvalidOperation](ctp:api:type:InvalidOperationError) error.
1414
1515
If the array is empty, the discount does not apply.
16+
applicationMode?:
17+
type: DiscountApplicationMode
18+
description: |
19+
Determines how the discount applies on [CartDiscountLineItemTarget](ctp:api:type:CartDiscountLineItemsTarget) or [CartDiscountCustomLineItemTarget](ctp:api:type:CartDiscountCustomLineItemsTarget).
20+
21+
For [CartDiscountPatternTarget](ctp:api:type:CartDiscountPatternTarget), you can also set the mode to `ProportionateDistribution` or `EvenDistribution`.
22+
default: IndividualApplication
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#%RAML 1.0 DataType
2+
(package): CartDiscount
3+
type: PatternComponent
4+
(beta): true
5+
displayName: CountOnCustomLineItemUnits
6+
discriminatorValue: CountOnCustomLineItemUnits
7+
properties:
8+
predicate:
9+
type: string
10+
description: |
11+
Valid [CustomLineItem predicate](/../api/projects/predicates#customlineitem-field-identifiers) that determines the units participating in the Discount.
12+
minCount?:
13+
type: integer
14+
description: |
15+
Minimum number of units of a Custom Line Item that match the predicate.
16+
minimum: 0
17+
default: 1
18+
maxCount?:
19+
type: integer
20+
description: |
21+
Maximum number of units of a Custom Line Item that match the predicate.
22+
There might be more units matching the predicate, but they will not be participating to the resulting set.
23+
24+
The value must be greater than or equal to `minCount`.
25+
If not provided, the component will match all units that satisfy the predicate.
26+
minimum: 1
27+
excludeCount?:
28+
type: integer
29+
description: |
30+
Number of units of a Custom Line Item to exclude on every application of the Discount.
31+
32+
Set only when configuring the `targetPattern`.
33+
34+
The units matched first (satisfying the pattern component) will be excluded from the resulting set.
35+
The `minCount`and `maxCount` are considered only after the exclusion. Pattern components are matched only if any further units satisfying the pattern component exist.
36+
For example, if 5 jeans are required but only 3 should be discounted, the `excludeCount` value must be 2.
37+
default: 0
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#%RAML 1.0 DataType
2+
(package): CartDiscount
3+
type: PatternComponent
4+
(beta): true
5+
displayName: CountOnLineItemUnits
6+
discriminatorValue: CountOnLineItemUnits
7+
properties:
8+
predicate:
9+
type: string
10+
description: |
11+
Valid [LineItem predicate](/../api/projects/predicates#lineitem-field-identifiers) that determines the units participating in the Discount.
12+
minCount?:
13+
type: integer
14+
description: |
15+
Minimum number of units of a Line Item that match the predicate.
16+
minimum: 0
17+
default: 1
18+
maxCount?:
19+
type: integer
20+
description: |
21+
Maximum number of units of a Line Item that match the predicate.
22+
There might be more units matching the predicate, but they will not be participating to the resulting set.
23+
24+
The value must be greater than or equal to `minCount`.
25+
If not provided, the component will match all units that satisfy the predicate.
26+
minimum: 1
27+
excludeCount?:
28+
type: integer
29+
description: |
30+
Number of units of a Line Item to exclude on every application of the Discount.
31+
32+
Set only when configuring the `targetPattern`.
33+
34+
The units matched first (satisfying the pattern component) will be excluded from the resulting set.
35+
The `minCount`and `maxCount` are considered only after the exclusion. Pattern components are matched only if any further units satisfying the pattern component exist.
36+
For example, if 5 jeans are required but only 3 should be discounted, the `excludeCount` value must be 2.
37+
default: 0
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#%RAML 1.0 DataType
2+
(package): CartDiscount
3+
type: object
4+
(beta): true
5+
displayName: PatternComponent
6+
discriminator: type
7+
description: |
8+
The pattern component it used to define a set of units based on some criteria. The criteria depends on the type of component used.
9+
properties:
10+
type:
11+
type: string

api-specs/api/types/cart/CustomLineItem.raml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ properties:
8383
priceMode:
8484
type: CustomLineItemPriceMode
8585
description: |
86-
Indicates whether Cart Discounts with a matching [CartDiscountCustomLineItemsTarget](ctp:api:type:CartDiscountCustomLineItemsTarget) are applied to the Custom Line Item.
86+
Indicates whether Cart Discounts with a matching [CartDiscountCustomLineItemsTarget](ctp:api:type:CartDiscountCustomLineItemsTarget), [MultiBuyCustomLineItemsTarget](ctp:api:type:MultiBuyCustomLineItemsTarget), or [CartDiscountPatternTarget](ctp:api:type:CartDiscountPatternTarget) are applied to the Custom Line Item.

api-specs/api/types/cart/CustomLineItemDraft.raml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ properties:
5050
priceMode?:
5151
type: CustomLineItemPriceMode
5252
description: |
53-
- If `Standard`, Cart Discounts with a matching [CartDiscountCustomLineItemsTarget](ctp:api:type:CartDiscountCustomLineItemsTarget)
54-
are applied to the Custom Line Item.
53+
- If `Standard`, Cart Discounts with a matching [CartDiscountCustomLineItemsTarget](ctp:api:type:CartDiscountCustomLineItemsTarget), [MultiBuyCustomLineItemsTarget](ctp:api:type:MultiBuyCustomLineItemsTarget), or [CartDiscountPatternTarget](ctp:api:type:CartDiscountPatternTarget) are applied to the Custom Line Item.
5554
- If `External`, Cart Discounts are not considered on the Custom Line Item.
5655
default: Standard

api-specs/api/types/cart/CustomLineItemPriceMode.raml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ enum:
1313
1414
This is the default mode for backwards compatibility.
1515
External: |
16-
Deactivates application of Cart Discounts for the Custom Line Item, despite a matching [CartDiscountCustomLineItemsTarget](ctp:api:type:CartDiscountCustomLineItemsTarget) and [MultiBuyCustomLineItemsTarget](ctp:api:type:MultiBuyCustomLineItemsTarget).
16+
Deactivates application of Cart Discounts for the Custom Line Item despite a matching [CartDiscountCustomLineItemsTarget](ctp:api:type:CartDiscountCustomLineItemsTarget), [MultiBuyCustomLineItemsTarget](ctp:api:type:MultiBuyCustomLineItemsTarget), or [CartDiscountPatternTarget](ctp:api:type:CartDiscountPatternTarget).

0 commit comments

Comments
 (0)