public final class SetCustomerEmail extends UpdateActionImpl<Order>
See also OrderUpdateCommand.
withOrder(client(), order -> {
assertThat(order.getCustomerEmail()).isNotEmpty();
final String email = "info@commercetools.de";
final Order updatedOrder = client().executeBlocking(OrderUpdateCommand.of(order, SetCustomerEmail.of(email)));
assertThat(updatedOrder.getCustomerEmail()).contains(email);
//there is also a message
final Query<OrderCustomerEmailSetMessage> messageQuery = MessageQuery.of()
.withPredicates(m -> m.resource().is(order))
.forMessageType(OrderCustomerEmailSetMessage.MESSAGE_HINT);
assertEventually(() -> {
final Optional<OrderCustomerEmailSetMessage> customerEmailSetMessageOptional =
client().executeBlocking(messageQuery).head();
assertThat(customerEmailSetMessageOptional).isPresent();
final OrderCustomerEmailSetMessage orderCustomerEmailSetMessage = customerEmailSetMessageOptional.get();
assertThat(orderCustomerEmailSetMessage.getEmail()).isEqualTo(email);
});
return updatedOrder;
});
See the test code.
Modifier and Type | Method and Description |
---|---|
String |
getEmail() |
static SetCustomerEmail |
of(String email) |
getAction
public static SetCustomerEmail of(String email)
public String getEmail()