public final class PaymentStatusStateTransitionMessage extends GenericMessageImpl<Payment>
TransitionState
update action.
withStateByBuilder(client(), stateBuilder -> stateBuilder.initial(true).type(PAYMENT_STATE), validNextStateForPaymentStatus -> { withPayment(client(), payment -> { final Payment updatedPayment = client().executeBlocking(PaymentUpdateCommand.of(payment, TransitionState.of(validNextStateForPaymentStatus))); assertThat(updatedPayment.getPaymentStatus().getState()).isEqualTo(validNextStateForPaymentStatus.toReference()); assertEventually(() -> { final PagedQueryResult<PaymentStatusStateTransitionMessage> messageQueryResult = client().executeBlocking(MessageQuery.of() .withPredicates(m -> m.resource().is(payment)) .forMessageType(PaymentStatusStateTransitionMessage.MESSAGE_HINT)); assertThat(messageQueryResult.head()).isPresent(); assertThat(messageQueryResult.head().get().getState()).isEqualTo(validNextStateForPaymentStatus.toReference()); }); return updatedPayment; }); });
See the test code.
Payment
,
TransitionState
Modifier and Type | Field and Description |
---|---|
static MessageDerivateHint<PaymentStatusStateTransitionMessage> |
MESSAGE_HINT |
static String |
MESSAGE_TYPE |
resource, resourceUserProvidedIdentifiers, resourceVersion, sequenceNumber, type
Modifier and Type | Method and Description |
---|---|
Reference<State> |
getState() |
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<PaymentStatusStateTransitionMessage> MESSAGE_HINT