public final class PaymentTransactionStateChangedMessage extends GenericMessageImpl<Payment>
ChangeTransactionState
update action.
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 | Field and Description |
---|---|
static MessageDerivateHint<PaymentTransactionStateChangedMessage> |
MESSAGE_HINT |
static String |
MESSAGE_TYPE |
resource, resourceUserProvidedIdentifiers, resourceVersion, sequenceNumber, type
Modifier and Type | Method and Description |
---|---|
TransactionState |
getState() |
String |
getTransactionId() |
as, equals, getPayload, getResource, getResourceUserProvidedIdentifiers, getResourceVersion, getSequenceNumber, getType, hashCode, toReference
getCreatedAt, getId, getLastModifiedAt, getVersion
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
referenceOfId, referenceTypeId, typeReference
getCreatedAt, getId, getLastModifiedAt, getVersion
hasSameIdAs, toResourceIdentifier
public static final String MESSAGE_TYPE
public static final MessageDerivateHint<PaymentTransactionStateChangedMessage> MESSAGE_HINT
public TransactionState getState()
public String getTransactionId()