public final class AddShippingAddressId extends UpdateActionImpl<Customer>
Customer.getAddresses()
- referred to by its `id` - to Customer.getShippingAddressIds()
.
See also CustomerInStoreUpdateCommand.
final List<Address> addresses = asList(Address.of(DE), Address.of(FR));
final CustomerDraft draft = newCustomerDraft().withAddresses(addresses);
withCustomer(client(), draft, customer -> {
assertThat(customer.getShippingAddressIds()).isEmpty();
final Address addressForShipping = customer.getAddresses().get(1);
final String addressId = addressForShipping.getId();
final AddShippingAddressId updateAction = AddShippingAddressId.of(addressId);
final Customer updatedCustomer =
client().executeBlocking(CustomerUpdateCommand.of(customer, updateAction));
assertThat(updatedCustomer.getShippingAddressIds()).containsExactly(addressId);
});
See the test code.
Customer
Modifier and Type | Method and Description |
---|---|
String |
getAddressId() |
String |
getAddressKey() |
static AddShippingAddressId |
of(String addressId) |
static AddShippingAddressId |
ofKey(String addressKey) |
getAction
public static AddShippingAddressId of(String addressId)
public static AddShippingAddressId ofKey(String addressKey)
public String getAddressId()
public String getAddressKey()