@Deprecated public final class SetAmountPaid extends UpdateActionImpl<Payment>
See also PaymentUpdateCommand.
withPayment(client(), payment -> { //set authorization final MonetaryAmount totalAmount = EURO_30; final ZonedDateTime until = ZonedDateTime.now().plusDays(7); final Payment updatedPayment = client().executeBlocking(PaymentUpdateCommand.of(payment, SetAuthorization.of(totalAmount, until))); assertThat(updatedPayment.getAmountAuthorized()).isEqualTo(totalAmount); assertThat(updatedPayment.getAuthorizedUntil()).isEqualTo(until); assertThat(updatedPayment.getAmountPaid()).isNull(); //remove authorization, set amount paid final Payment updatedPayment2 = client().executeBlocking(PaymentUpdateCommand.of(updatedPayment, asList(SetAuthorization.ofRemove(), SetAmountPaid.of(totalAmount)))); assertThat(updatedPayment2.getAmountAuthorized()).isNull(); assertThat(updatedPayment2.getAuthorizedUntil()).isNull(); assertThat(updatedPayment2.getAmountPaid()).isEqualTo(totalAmount); return updatedPayment2; });
See the test code.
Payment
Modifier and Type | Method and Description |
---|---|
javax.money.MonetaryAmount |
getAmount()
Deprecated.
|
static SetAmountPaid |
of(javax.money.MonetaryAmount amount)
Deprecated.
|
getAction
public static SetAmountPaid of(@Nullable javax.money.MonetaryAmount amount)
@Nullable public javax.money.MonetaryAmount getAmount()