public final class SetBillingAddress extends UpdateActionImpl<Cart>
See also CartInStoreUpdateCommand.
final Cart cart = createCartWithCountry(client()); assertThat(cart.getBillingAddress()).isNull(); final Address address = AddressBuilder.of(DE).build(); final Cart cartWithAddress = client().executeBlocking(CartUpdateCommand.of(cart, SetBillingAddress.of(address))); assertThat(cartWithAddress.getBillingAddress()).isEqualTo(address); //you can query by billingAddress fields final CartQuery query = CartQuery.of() .withPredicates(m -> m.billingAddress().country().is(DE).and(m.id().is(cart.getId()))); assertThat(client().executeBlocking(query).head()).contains(cartWithAddress); final Cart cartWithoutAddress = client().executeBlocking(CartUpdateCommand.of(cartWithAddress, SetBillingAddress.of(null))); assertThat(cartWithoutAddress.getBillingAddress()).isNull();
See the test code.
SetShippingAddress
Modifier and Type | Method and Description |
---|---|
Address |
getAddress() |
static SetBillingAddress |
of(Address address) |
getAction
public static SetBillingAddress of(@Nullable Address address)