Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit d99cf5f

Browse files
authored
Merge pull request #2237 from commercetools/frozenCart
add cart frozen state
2 parents 9268215 + 76fac85 commit d99cf5f

File tree

25 files changed

+127
-75
lines changed

25 files changed

+127
-75
lines changed

commercetools-internal-docs/src/main/java/io/sphere/sdk/meta/ReleaseNotes.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@
154154
</ul>
155155
-->
156156
-->
157+
<h3 class=released-version id="v2_16_0">2.16.0 (01.03.2023)</h3>
158+
<ul>
159+
<li class=new-in-release>Support for freezing carts</li>
160+
</ul>
157161
<h3 class=released-version id="v2_15_0">2.15.0 (11.08.2023)</h3>
158162
<ul>
159163
<li class=change-in-release>Update Jackson to 2.13.5</li>

commercetools-models/src/main/java/io/sphere/sdk/carts/CartState.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ public enum CartState implements SphereEnumeration {
2020
/**
2121
The cart was ordered. No further operations on the cart are allowed.
2222
*/
23-
ORDERED;
23+
ORDERED,
24+
25+
FROZEN
26+
;
2427

2528
public static CartState defaultValue() {
2629
return CartState.ACTIVE;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package io.sphere.sdk.carts.commands.updateactions;
2+
3+
import io.sphere.sdk.carts.Cart;
4+
import io.sphere.sdk.commands.UpdateActionImpl;
5+
6+
public final class FreezeCart extends UpdateActionImpl<Cart> {
7+
private FreezeCart() {
8+
super("freezeCart");
9+
}
10+
11+
public static FreezeCart of() {
12+
return new FreezeCart();
13+
}
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package io.sphere.sdk.carts.commands.updateactions;
2+
3+
import io.sphere.sdk.carts.Cart;
4+
import io.sphere.sdk.commands.UpdateActionImpl;
5+
6+
public final class UnfreezeCart extends UpdateActionImpl<Cart> {
7+
private UnfreezeCart() {
8+
super("unfreezeCart");
9+
}
10+
11+
public static UnfreezeCart of() {
12+
return new UnfreezeCart();
13+
}
14+
}

commercetools-models/src/test/java/io/sphere/sdk/carts/commands/CartUpdateCommandIntegrationTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,23 @@ public void recalculate() throws Exception {
595595
});
596596
}
597597

598+
@Test
599+
public void freezeUnfreeze() throws Exception {
600+
withLineItemAndCustomLineItemFilledCart(client(), emptyCart -> {
601+
assertThat(emptyCart.getCartState())
602+
.isEqualTo(CartState.ACTIVE);
603+
final Cart frozenCart = client().executeBlocking(CartUpdateCommand.of(emptyCart, FreezeCart.of()));
604+
605+
assertThat(frozenCart.getCartState())
606+
.isEqualTo(CartState.FROZEN);
607+
608+
final Cart unfrozenCart = client().executeBlocking(CartUpdateCommand.of(frozenCart, UnfreezeCart.of()));
609+
assertThat(unfrozenCart.getCartState())
610+
.isEqualTo(CartState.ACTIVE);
611+
return unfrozenCart;
612+
});
613+
}
614+
598615
@Test
599616
public void recalculateAndUpdateProductData() throws Exception {
600617
withEmptyCartAndProduct(client(), (emptyCart, product) -> {

licenses/commercetools-convenience/index.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"dependencies": [
33
{
44
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-apache-async",
5-
"moduleVersion": "2.15.0-SNAPSHOT",
5+
"moduleVersion": "2.16.0-SNAPSHOT",
66
"moduleLicenses": [
77
{
88
"moduleLicense": "Apache License 2.0"
@@ -11,7 +11,7 @@
1111
},
1212
{
1313
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-core",
14-
"moduleVersion": "2.15.0-SNAPSHOT",
14+
"moduleVersion": "2.16.0-SNAPSHOT",
1515
"moduleLicenses": [
1616
{
1717
"moduleLicense": "Apache License 2.0"
@@ -20,7 +20,7 @@
2020
},
2121
{
2222
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-models",
23-
"moduleVersion": "2.15.0-SNAPSHOT",
23+
"moduleVersion": "2.16.0-SNAPSHOT",
2424
"moduleLicenses": [
2525
{
2626
"moduleLicense": "Apache License 2.0"
@@ -29,7 +29,7 @@
2929
},
3030
{
3131
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-sdk-base",
32-
"moduleVersion": "2.15.0-SNAPSHOT",
32+
"moduleVersion": "2.16.0-SNAPSHOT",
3333
"moduleLicenses": [
3434
{
3535
"moduleLicense": "Apache License 2.0"
@@ -38,7 +38,7 @@
3838
},
3939
{
4040
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http",
41-
"moduleVersion": "2.15.0-SNAPSHOT",
41+
"moduleVersion": "2.16.0-SNAPSHOT",
4242
"moduleLicenses": [
4343
{
4444
"moduleLicense": "Apache License 2.0"
@@ -47,7 +47,7 @@
4747
},
4848
{
4949
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http-apache-async",
50-
"moduleVersion": "2.15.0-SNAPSHOT",
50+
"moduleVersion": "2.16.0-SNAPSHOT",
5151
"moduleLicenses": [
5252
{
5353
"moduleLicense": "Apache License 2.0"

licenses/commercetools-internal-docs/index.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
},
4848
{
4949
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-convenience",
50-
"moduleVersion": "2.15.0-SNAPSHOT",
50+
"moduleVersion": "2.16.0-SNAPSHOT",
5151
"moduleLicenses": [
5252
{
5353
"moduleLicense": "Apache License 2.0"
@@ -56,7 +56,7 @@
5656
},
5757
{
5858
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client",
59-
"moduleVersion": "2.15.0-SNAPSHOT",
59+
"moduleVersion": "2.16.0-SNAPSHOT",
6060
"moduleLicenses": [
6161
{
6262
"moduleLicense": "Apache License 2.0"
@@ -65,7 +65,7 @@
6565
},
6666
{
6767
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-ahc-2_0",
68-
"moduleVersion": "2.15.0-SNAPSHOT",
68+
"moduleVersion": "2.16.0-SNAPSHOT",
6969
"moduleLicenses": [
7070
{
7171
"moduleLicense": "Apache License 2.0"
@@ -74,7 +74,7 @@
7474
},
7575
{
7676
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-apache-async",
77-
"moduleVersion": "2.15.0-SNAPSHOT",
77+
"moduleVersion": "2.16.0-SNAPSHOT",
7878
"moduleLicenses": [
7979
{
8080
"moduleLicense": "Apache License 2.0"
@@ -83,7 +83,7 @@
8383
},
8484
{
8585
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-core",
86-
"moduleVersion": "2.15.0-SNAPSHOT",
86+
"moduleVersion": "2.16.0-SNAPSHOT",
8787
"moduleLicenses": [
8888
{
8989
"moduleLicense": "Apache License 2.0"
@@ -92,7 +92,7 @@
9292
},
9393
{
9494
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-models",
95-
"moduleVersion": "2.15.0-SNAPSHOT",
95+
"moduleVersion": "2.16.0-SNAPSHOT",
9696
"moduleLicenses": [
9797
{
9898
"moduleLicense": "Apache License 2.0"
@@ -101,7 +101,7 @@
101101
},
102102
{
103103
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-sdk-base",
104-
"moduleVersion": "2.15.0-SNAPSHOT",
104+
"moduleVersion": "2.16.0-SNAPSHOT",
105105
"moduleLicenses": [
106106
{
107107
"moduleLicense": "Apache License 2.0"
@@ -110,7 +110,7 @@
110110
},
111111
{
112112
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-test-lib",
113-
"moduleVersion": "2.15.0-SNAPSHOT",
113+
"moduleVersion": "2.16.0-SNAPSHOT",
114114
"moduleLicenses": [
115115
{
116116
"moduleLicense": "Apache License 2.0"
@@ -119,7 +119,7 @@
119119
},
120120
{
121121
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http",
122-
"moduleVersion": "2.15.0-SNAPSHOT",
122+
"moduleVersion": "2.16.0-SNAPSHOT",
123123
"moduleLicenses": [
124124
{
125125
"moduleLicense": "Apache License 2.0"
@@ -128,7 +128,7 @@
128128
},
129129
{
130130
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http-ahc-2_0",
131-
"moduleVersion": "2.15.0-SNAPSHOT",
131+
"moduleVersion": "2.16.0-SNAPSHOT",
132132
"moduleLicenses": [
133133
{
134134
"moduleLicense": "Apache License 2.0"
@@ -137,7 +137,7 @@
137137
},
138138
{
139139
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http-apache-async",
140-
"moduleVersion": "2.15.0-SNAPSHOT",
140+
"moduleVersion": "2.16.0-SNAPSHOT",
141141
"moduleLicenses": [
142142
{
143143
"moduleLicense": "Apache License 2.0"

licenses/commercetools-internal-processors/index.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"dependencies": [
33
{
44
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-sdk-base",
5-
"moduleVersion": "2.15.0-SNAPSHOT",
5+
"moduleVersion": "2.16.0-SNAPSHOT",
66
"moduleLicenses": [
77
{
88
"moduleLicense": "Apache License 2.0"
@@ -11,7 +11,7 @@
1111
},
1212
{
1313
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http",
14-
"moduleVersion": "2.15.0-SNAPSHOT",
14+
"moduleVersion": "2.16.0-SNAPSHOT",
1515
"moduleLicenses": [
1616
{
1717
"moduleLicense": "Apache License 2.0"

licenses/commercetools-java-client-ahc-1_9/index.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"dependencies": [
33
{
44
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-core",
5-
"moduleVersion": "2.15.0-SNAPSHOT",
5+
"moduleVersion": "2.16.0-SNAPSHOT",
66
"moduleLicenses": [
77
{
88
"moduleLicense": "Apache License 2.0"
@@ -11,7 +11,7 @@
1111
},
1212
{
1313
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-sdk-base",
14-
"moduleVersion": "2.15.0-SNAPSHOT",
14+
"moduleVersion": "2.16.0-SNAPSHOT",
1515
"moduleLicenses": [
1616
{
1717
"moduleLicense": "Apache License 2.0"
@@ -20,7 +20,7 @@
2020
},
2121
{
2222
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http",
23-
"moduleVersion": "2.15.0-SNAPSHOT",
23+
"moduleVersion": "2.16.0-SNAPSHOT",
2424
"moduleLicenses": [
2525
{
2626
"moduleLicense": "Apache License 2.0"
@@ -29,7 +29,7 @@
2929
},
3030
{
3131
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http-ahc-1_9",
32-
"moduleVersion": "2.15.0-SNAPSHOT",
32+
"moduleVersion": "2.16.0-SNAPSHOT",
3333
"moduleLicenses": [
3434
{
3535
"moduleLicense": "Apache License 2.0"

licenses/commercetools-java-client-ahc-2_0/index.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"dependencies": [
33
{
44
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-core",
5-
"moduleVersion": "2.15.0-SNAPSHOT",
5+
"moduleVersion": "2.16.0-SNAPSHOT",
66
"moduleLicenses": [
77
{
88
"moduleLicense": "Apache License 2.0"
@@ -11,7 +11,7 @@
1111
},
1212
{
1313
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-sdk-base",
14-
"moduleVersion": "2.15.0-SNAPSHOT",
14+
"moduleVersion": "2.16.0-SNAPSHOT",
1515
"moduleLicenses": [
1616
{
1717
"moduleLicense": "Apache License 2.0"
@@ -20,7 +20,7 @@
2020
},
2121
{
2222
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http",
23-
"moduleVersion": "2.15.0-SNAPSHOT",
23+
"moduleVersion": "2.16.0-SNAPSHOT",
2424
"moduleLicenses": [
2525
{
2626
"moduleLicense": "Apache License 2.0"
@@ -29,7 +29,7 @@
2929
},
3030
{
3131
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http-ahc-2_0",
32-
"moduleVersion": "2.15.0-SNAPSHOT",
32+
"moduleVersion": "2.16.0-SNAPSHOT",
3333
"moduleLicenses": [
3434
{
3535
"moduleLicense": "Apache License 2.0"

0 commit comments

Comments
 (0)