public final class SetBillingAddress extends UpdateActionImpl<Order>
See also OrderUpdateCommand.
withOrder(client(), order -> {
assertThat(order.getBillingAddress()).isNull();
final Address newAddress = Address.of(DE).withStreetNumber("5");
final Order updatedOrder = client().executeBlocking(OrderUpdateCommand.of(order, SetBillingAddress.of(newAddress)));
assertThat(updatedOrder.getBillingAddress().getStreetNumber()).isEqualTo("5");
//there is also a message
final Query<OrderBillingAddressSetMessage> messageQuery = MessageQuery.of()
.withPredicates(m -> m.resource().is(order))
.forMessageType(OrderBillingAddressSetMessage.MESSAGE_HINT);
assertEventually(() -> {
final Optional<OrderBillingAddressSetMessage> billingAddressSetMessageOptional =
client().executeBlocking(messageQuery).head();
assertThat(billingAddressSetMessageOptional).isPresent();
final OrderBillingAddressSetMessage orderBillingAddressSetMessage = billingAddressSetMessageOptional.get();
assertThat(orderBillingAddressSetMessage.getAddress()).isEqualTo(newAddress);
});
return updatedOrder;
});
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)