public enum AnonymousCartSignInMode extends Enum<AnonymousCartSignInMode> implements SphereEnumeration
Enum Constant and Description |
---|
MERGE_WITH_EXISTING_CUSTOMER_CART
LineItems of the anonymous cart will be copied to the customer’s cart.
|
USE_AS_NEW_ACTIVE_CUSTOMER_CART
The anonymous cart is used as new active customer cart.
|
Modifier and Type | Method and Description |
---|---|
static AnonymousCartSignInMode |
ofSphereValue(String value) |
static AnonymousCartSignInMode |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static AnonymousCartSignInMode[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
findBySphereName, name, toSphereName
public static final AnonymousCartSignInMode MERGE_WITH_EXISTING_CUSTOMER_CART
withCustomerCustomerCartAndAnonymousCart(client(), customer -> customersCart -> anonymousCart -> { final CustomerSignInCommand cmd = CustomerSignInCommand .of(customer.getEmail(), PASSWORD, anonymousCart.getId()) .withAnonymousCartSignInMode(MERGE_WITH_EXISTING_CUSTOMER_CART); final CustomerSignInResult result = client().executeBlocking(cmd); final Cart resultingCart = result.getCart(); assertThat(resultingCart.getId()) .as("the old customers cart stays the cart") .isEqualTo(customersCart.getId()); });
See the test code.
public static final AnonymousCartSignInMode USE_AS_NEW_ACTIVE_CUSTOMER_CART
withCustomerCustomerCartAndAnonymousCart(client(), customer -> customersCart -> anonymousCart -> { final CustomerSignInCommand cmd = CustomerSignInCommand .of(customer.getEmail(), PASSWORD, anonymousCart.getId()) .withAnonymousCartSignInMode(USE_AS_NEW_ACTIVE_CUSTOMER_CART); final CustomerSignInResult result = client().executeBlocking(cmd); final Cart resultingCart = result.getCart(); assertThat(resultingCart.getId()) .as("anonymous cart becomes the new customer cart") .isEqualTo(anonymousCart.getId()); });
See the test code.
public static AnonymousCartSignInMode[] values()
for (AnonymousCartSignInMode c : AnonymousCartSignInMode.values()) System.out.println(c);
public static AnonymousCartSignInMode valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static AnonymousCartSignInMode ofSphereValue(String value)