Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cart frozen state #2237

Merged
merged 5 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@
</ul>
-->
-->
<h3 class=released-version id="v2_16_0">2.16.0 (01.03.2023)</h3>
<ul>
<li class=new-in-release>Support for freezing carts</li>
</ul>
<h3 class=released-version id="v2_15_0">2.15.0 (11.08.2023)</h3>
<ul>
<li class=change-in-release>Update Jackson to 2.13.5</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ public enum CartState implements SphereEnumeration {
/**
The cart was ordered. No further operations on the cart are allowed.
*/
ORDERED;
ORDERED,

FROZEN
;

public static CartState defaultValue() {
return CartState.ACTIVE;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.sphere.sdk.carts.commands.updateactions;

import io.sphere.sdk.carts.Cart;
import io.sphere.sdk.commands.UpdateActionImpl;

public final class FreezeCart extends UpdateActionImpl<Cart> {
private FreezeCart() {
super("freezeCart");
}

public static FreezeCart of() {
return new FreezeCart();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.sphere.sdk.carts.commands.updateactions;

import io.sphere.sdk.carts.Cart;
import io.sphere.sdk.commands.UpdateActionImpl;

public final class UnfreezeCart extends UpdateActionImpl<Cart> {
private UnfreezeCart() {
super("unfreezeCart");
}

public static UnfreezeCart of() {
return new UnfreezeCart();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,23 @@ public void recalculate() throws Exception {
});
}

@Test
public void freezeUnfreeze() throws Exception {
withLineItemAndCustomLineItemFilledCart(client(), emptyCart -> {
assertThat(emptyCart.getCartState())
.isEqualTo(CartState.ACTIVE);
final Cart frozenCart = client().executeBlocking(CartUpdateCommand.of(emptyCart, FreezeCart.of()));

assertThat(frozenCart.getCartState())
.isEqualTo(CartState.FROZEN);

final Cart unfrozenCart = client().executeBlocking(CartUpdateCommand.of(frozenCart, UnfreezeCart.of()));
assertThat(unfrozenCart.getCartState())
.isEqualTo(CartState.ACTIVE);
return unfrozenCart;
});
}

@Test
public void recalculateAndUpdateProductData() throws Exception {
withEmptyCartAndProduct(client(), (emptyCart, product) -> {
Expand Down
12 changes: 6 additions & 6 deletions licenses/commercetools-convenience/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dependencies": [
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-apache-async",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -11,7 +11,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-core",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -20,7 +20,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-models",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -29,7 +29,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-sdk-base",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -38,7 +38,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -47,7 +47,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http-apache-async",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand Down
22 changes: 11 additions & 11 deletions licenses/commercetools-internal-docs/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-convenience",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -56,7 +56,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -65,7 +65,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-ahc-2_0",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -74,7 +74,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-apache-async",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -83,7 +83,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-core",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -92,7 +92,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-models",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -101,7 +101,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-sdk-base",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -110,7 +110,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-test-lib",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -119,7 +119,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -128,7 +128,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http-ahc-2_0",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -137,7 +137,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http-apache-async",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand Down
4 changes: 2 additions & 2 deletions licenses/commercetools-internal-processors/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dependencies": [
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-sdk-base",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -11,7 +11,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand Down
8 changes: 4 additions & 4 deletions licenses/commercetools-java-client-ahc-1_9/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dependencies": [
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-core",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -11,7 +11,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-sdk-base",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -20,7 +20,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -29,7 +29,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http-ahc-1_9",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand Down
8 changes: 4 additions & 4 deletions licenses/commercetools-java-client-ahc-2_0/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dependencies": [
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-core",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -11,7 +11,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-sdk-base",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -20,7 +20,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -29,7 +29,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http-ahc-2_0",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand Down
8 changes: 4 additions & 4 deletions licenses/commercetools-java-client-ahc-2_12/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dependencies": [
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-core",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -11,7 +11,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-sdk-base",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -20,7 +20,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -29,7 +29,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http-ahc-2_12",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand Down
8 changes: 4 additions & 4 deletions licenses/commercetools-java-client-ahc-2_5/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dependencies": [
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-java-client-core",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -11,7 +11,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:commercetools-sdk-base",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -20,7 +20,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand All @@ -29,7 +29,7 @@
},
{
"moduleName": "com.commercetools.sdk.jvm.core:sdk-http-ahc-2_5",
"moduleVersion": "2.15.0-SNAPSHOT",
"moduleVersion": "2.16.0-SNAPSHOT",
"moduleLicenses": [
{
"moduleLicense": "Apache License 2.0"
Expand Down
Loading
Loading