Skip to content

Commit 8bfc95c

Browse files
committed
Updated API from documentation release
1 parent 549da4f commit 8bfc95c

File tree

9 files changed

+60
-4
lines changed

9 files changed

+60
-4
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"action": "freezeCart"
2+
"action": "freezeCart",
3+
"strategy": "HardFreeze"
34
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ properties:
113113
description: |
114114
Current status of the Cart.
115115
default: Active
116+
freezeStrategy?:
117+
type: FreezeStrategy
118+
description: |
119+
Determines freezing behavior when `cartState` is `Frozen`.
120+
default: SoftFreeze
116121
billingAddress?:
117122
type: Address
118123
description: |

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ enum:
3030
- [Change TaxMode](ctp:api:type:CartChangeTaxModeAction)
3131
- [Set LineItem Price](ctp:api:type:CartSetLineItemPriceAction)
3232
- [Set LineItem TotalPrice](ctp:api:type:CartSetLineItemTotalPriceAction)
33+
34+
Additionally, when using the `HardFreeze` [FreezeStrategy](ctp:api:type:FreezeStrategy), the following update actions are also not allowed:
35+
- [Set ShippingMethod](ctp:api:type:CartSetShippingMethodAction)
36+
- [Set CustomShippingMethod](ctp:api:type:CartSetCustomShippingMethodAction)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#%RAML 1.0 DataType
2+
(package): Cart
3+
displayName: FreezeStrategy
4+
type: string
5+
description: |
6+
Indicates how a [Cart](ctp:api:type:Cart) freeze behaves. For detailed behavior on each of these strategies, see [Freeze a Cart](/../api/carts-orders-overview#freeze-a-cart).
7+
enum:
8+
- SoftFreeze
9+
- HardFreeze
10+
(enumDescriptions):
11+
SoftFreeze: |
12+
More lenient Cart freeze strategy that locks prices as they were when the Cart was frozen. This is the default strategy when not explicitly specified, ensuring backwards compatibility.
13+
HardFreeze: |
14+
Stricter Cart freeze strategy that, in addition to the `SoftFreeze` behavior, also freezes Cart Discounts, Discount Codes, and Shipping Methods, ensuring the final price remains unchanged.

api-specs/api/types/cart/updates/CartFreezeCartAction.raml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,19 @@ displayName: CartFreezeCartAction
55
discriminatorValue: freezeCart
66
example: !include ../../../examples/Cart/CartFreezeCartAction.json
77
description: |
8-
Changes the [CartState](ctp:api:type:CartState) from `Active` to `Frozen`. Results in a [Frozen Cart](ctp:api:type:FrozenCarts).
9-
Fails with [InvalidOperation](ctp:api:type:InvalidOperationError) error when the Cart is empty.
108
11-
Freezing a Cart produces the [CartFrozen](ctp:api:type:CartFrozenMessage) Message.
9+
Freezes the Cart based on the provided [FreezeStrategy](ctp:api:type:FreezeStrategy).
10+
11+
The following behavior occurs:
12+
- Changes the Cart State from `Active` to `Frozen`.
13+
- Sets the corresponding [FreezeStrategy](ctp:api:type:FreezeStrategy) on the Cart's `freezeStrategy` field.
14+
- Produces the [CartFrozen](ctp:api:type:CartFrozenMessage) Message.
15+
16+
If the Cart is empty, an [InvalidOperation](ctp:api:type:InvalidOperationError) error is returned.
17+
18+
properties:
19+
strategy?:
20+
type: FreezeStrategy
21+
description: |
22+
Strategy that determines the freezing behavior.
23+
default: SoftFreeze

api-specs/api/types/cart/updates/CartSetCustomShippingMethodAction.raml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ description: |
1111
1212
To unset a custom Shipping Method on a Cart, use the [Set ShippingMethod](ctp:api:type:CartSetShippingMethodAction) update action
1313
without the `shippingMethod` field instead.
14+
15+
This update is not allowed when the Cart is [frozen](/../api/carts-orders-overview#freeze-a-cart) with
16+
the `HardFreeze` [FreezeStrategy](ctp:api:type:FreezeStrategy).
1417
properties:
1518
shippingMethodName:
1619
type: string

api-specs/api/types/cart/updates/CartSetShippingMethodAction.raml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ discriminatorValue: setShippingMethod
66
example: !include ../../../examples/Cart/CartSetShippingMethodAction.json
77
description: |
88
To set the Cart's Shipping Method the Cart must have the `Single` [ShippingMode](ctp:api:type:ShippingMode) and a `shippingAddress`.
9+
10+
This update is not allowed when the Cart is [frozen](/../api/carts-orders-overview#freeze-a-cart) with the `HardFreeze` [FreezeStrategy](ctp:api:type:FreezeStrategy).
911
properties:
1012
shippingMethod?:
1113
type: ShippingMethodResourceIdentifier

api-specs/api/types/types.raml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ DiscountedTotalPricePortion: !include cart/DiscountedTotalPricePortion.raml
222222
ExternalLineItemTotalPrice: !include cart/ExternalLineItemTotalPrice.raml
223223
ExternalTaxAmountDraft: !include cart/ExternalTaxAmountDraft.raml
224224
ExternalTaxRateDraft: !include cart/ExternalTaxRateDraft.raml
225+
FreezeStrategy: !include cart/FreezeStrategy.raml
225226
InventoryMode: !include cart/InventoryMode.raml
226227
ItemShippingDetails: !include cart/ItemShippingDetails.raml
227228
ItemShippingDetailsDraft: !include cart/ItemShippingDetailsDraft.raml

api-specs/graphql/schema.sdl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,6 +1835,7 @@ type Cart implements Versioned & ReferenceExpandable {
18351835
shippingCustomFields: CustomFieldsType
18361836
discountTypeCombination: DiscountTypeCombination
18371837
cartState: CartState!
1838+
freezeStrategy: FreezeStrategy
18381839
key: String
18391840
lock: CartLock
18401841
custom: CustomFieldsType
@@ -4978,8 +4979,21 @@ input FixedPriceDiscountValueInput {
49784979
money: [CartDiscountValueBaseMoneyInput!]!
49794980
}
49804981

4982+
enum FreezeStrategy {
4983+
"""
4984+
More lenient version of a Cart freeze (See [Freeze a Cart](https://docs.commercetools.com/api/carts-orders-overview#freeze-a-cart) for details).
4985+
"""
4986+
SoftFreeze
4987+
4988+
"""
4989+
Stricter version of a Cart freeze (See [Freeze a Cart](https://docs.commercetools.com/api/carts-orders-overview#freeze-a-cart) for details).
4990+
"""
4991+
HardFreeze
4992+
}
4993+
49814994
input FreezeCart {
49824995
dummy: String
4996+
strategy: FreezeStrategy
49834997
}
49844998

49854999
interface Geometry {

0 commit comments

Comments
 (0)