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