public final class RemoveShippingAddressId extends UpdateActionImpl<Customer>
Customer.getShippingAddressIds()
.
If the shipping address is the Customer's default shipping address the Customer.getDefaultShippingAddressId()
will be unset.
See also CustomerInStoreUpdateCommand.
final List<Address> addresses = asList(Address.of(DE), Address.of(FR));
final CustomerDraft draft = newCustomerDraft()
.withAddresses(addresses)
.withShippingAddresses(singletonList(1));
withCustomer(client(), draft, customer -> {
assertThat(customer.getShippingAddressIds()).isNotEmpty();
final String addressId = customer.getShippingAddressIds().get(0);
final RemoveShippingAddressId updateAction = RemoveShippingAddressId.of(addressId);
final Customer updatedCustomer =
client().executeBlocking(CustomerUpdateCommand.of(customer, updateAction));
assertThat(updatedCustomer.getShippingAddressIds()).isEmpty();
});
See the test code.
Customer
Modifier and Type | Method and Description |
---|---|
String |
getAddressId() |
String |
getAddressKey() |
static RemoveShippingAddressId |
of(String addressId) |
static RemoveShippingAddressId |
ofKey(String addressKey) |
getAction
public static RemoveShippingAddressId of(String addressId)
public static RemoveShippingAddressId ofKey(String addressKey)
public String getAddressId()
public String getAddressKey()