public final class SetDefaultBillingAddress extends UpdateActionImpl<Customer>
See also CustomerInStoreUpdateCommand.
withCustomerWithOneAddress(client(), customer -> {
final Address address = customer.getAddresses().get(0);
assertThat(address.getId())
.overridingErrorMessage("only fetched address contains an ID")
.isNotNull();
assertThat(customer.getDefaultBillingAddressId()).isNull();
assertThat(customer.getDefaultBillingAddress()).isNull();
final Customer updatedCustomer =
client().executeBlocking(CustomerUpdateCommand.of(customer, SetDefaultBillingAddress.ofAddress(address)));
assertThat(updatedCustomer.getDefaultBillingAddressId()).contains(address.getId());
assertThat(updatedCustomer.getDefaultBillingAddress()).isEqualTo(address);
});
See the test code.
Customer
Modifier and Type | Method and Description |
---|---|
String |
getAddressId() |
String |
getAddressKey() |
static SetDefaultBillingAddress |
of(String addressId) |
static SetDefaultBillingAddress |
ofAddress(Address address) |
static SetDefaultBillingAddress |
ofKey(String addressKey) |
getAction
public static SetDefaultBillingAddress ofKey(String addressKey)
public static SetDefaultBillingAddress of(String addressId)
public static SetDefaultBillingAddress ofAddress(Address address)