public static AddPayment of(final Referenceable<Payment> payment) { return new AddPayment(Optional.ofNullable(payment).map(Referenceable::toReference).orElse(null)); }
@Test public void addPayment() { withPayment(client(), payment -> { withOrder(client(), order -> { //add payment final OrderUpdateCommand orderUpdateCommand = OrderUpdateCommand.of(order, AddPayment.of(payment)) .withExpansionPaths(m -> m.paymentInfo().payments()); final Order orderWithPayment = client().executeBlocking(orderUpdateCommand); final Reference<Payment> paymentReference = orderWithPayment.getPaymentInfo().getPayments().get(0); assertThat(paymentReference).isEqualTo(payment.toReference()); assertThat(paymentReference).is(expanded(payment)); //remove payment final Order orderWithoutPayment = client().executeBlocking(OrderUpdateCommand.of(orderWithPayment, RemovePayment.of(payment))); assertThat(orderWithoutPayment.getPaymentInfo()).isNull(); return orderWithoutPayment; }); return payment; }); }
public static AddPayment of(final Referenceable<Payment> payment) { return new AddPayment(Optional.ofNullable(payment).map(Referenceable::toReference).orElse(null)); }
public static AddPayment of(final Referenceable<Payment> payment) { return new AddPayment(Optional.ofNullable(payment).map(Referenceable::toReference).orElse(null)); }