Created
January 9, 2020 21:26
-
-
Save cokeSchlumpf/d101c48ebc373ab2fdc5ce0fc2e2d910 to your computer and use it in GitHub Desktop.
Sample
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
def orderEntry(order: Order): Try[OrderEntryProcessed] = { | |
order.items foreach { item => | |
val stock = stockRepository.getProductById(item.product) | |
stock.amount = stock.amount - item.amount | |
stockRepository.updateStockItem(stock) | |
} | |
incredible_ai.checkForFraud(order) | |
payments.makePayment(order.paymentDetails) | |
coolBonusPointsSystem.giveBonusForOrder(order) | |
Success(OrderEntryProcessed(order.id, Instant.now())) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment