Last active
January 4, 2021 13:10
-
-
Save JohnChangUK/c973d5ee1739bec3f3e455b94a61ba84 to your computer and use it in GitHub Desktop.
PaymentEventHandler
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
public TransactionEvent handleEvent(PaymentEvent event) { | |
Mono.fromRunnable(() -> transactionRepository.save( | |
new Transaction() | |
.setOrderId(event.getOrderId()) | |
.setPrice(event.getPrice()))) | |
.subscribeOn(jdbcScheduler) | |
.subscribe(); | |
return new TransactionEvent() | |
.orderId(event.getOrderId()) | |
.status(() -> APPROVED.equals(event.getStatus()) | |
? SUCCESSFUL | |
: UNSUCCESSFUL); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment