public final class ChangeTransactionState extends UpdateActionImpl<Payment>
See also PaymentUpdateCommand.
withPaymentTransaction(client(), (Payment payment, Transaction transaction) -> { assertThat(transaction.getState()).isEqualTo(TransactionState.INITIAL); final TransactionState transactionState = TransactionState.SUCCESS; final Payment updatedPayment = client().executeBlocking(PaymentUpdateCommand.of(payment, ChangeTransactionState.of(transactionState, transaction.getId()))); final Transaction updatedTransaction = updatedPayment.getTransactions().get(0); assertThat(updatedTransaction.getState()).isEqualTo(transactionState); //check messages assertEventually(() -> { final PagedQueryResult<PaymentTransactionStateChangedMessage> messageQueryResult = client().executeBlocking(MessageQuery.of() .withPredicates(m -> m.resource().is(payment)) .forMessageType(PaymentTransactionStateChangedMessage.MESSAGE_HINT)); assertThat(messageQueryResult.head()).isPresent(); final PaymentTransactionStateChangedMessage message = messageQueryResult.head().get(); assertThat(message.getState()).isEqualTo(transactionState); assertThat(message.getTransactionId()).isEqualTo(transaction.getId()); }); return updatedPayment; });
See the test code.
Modifier and Type | Method and Description |
---|---|
TransactionState |
getState() |
String |
getTransactionId() |
static ChangeTransactionState |
of(TransactionState state,
String transactionId) |
getAction
public static ChangeTransactionState of(TransactionState state, String transactionId)
public TransactionState getState()
public String getTransactionId()