Last active
October 31, 2016 16:41
-
-
Save pawelkaczor/2637975e6337666cc7ac6a8679cadd21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
startWhen { | |
case _: ReservationConfirmed => New | |
} andThen { | |
case New => { | |
case ReservationConfirmed(reservationId, customerId, totalAmount) => | |
WaitingForPayment { | |
⟶ (CreateInvoice(sagaId, reservationId, customerId, totalAmount, now())) | |
⟵ (PaymentExpired(sagaId, reservationId)) in 3.minutes | |
} | |
} | |
case WaitingForPayment => { | |
case PaymentExpired(invoiceId, orderId) => | |
⟶ (CancelInvoice(invoiceId, orderId)) | |
case OrderBilled(_, orderId, _, _) => | |
DeliveryInProgress { | |
⟶ (CloseReservation(orderId)) | |
⟶ (CreateShipment(UUID(), orderId)) | |
} | |
case OrderBillingFailed(_, orderId) => | |
Failed { | |
⟶ (CancelReservation(orderId)) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment