Last active
November 23, 2020 23:53
-
-
Save MuizMahdi/5dc1032c3cbebcb7749eaabeb5e19a58 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
class CreateOrderStageHandler implements Stage<CreateOrderCommand, String> { | |
private String process(CreateOrderCommand order) { | |
// Get shopper account Id | |
var shopperId = accountRepository.getAccountId(order.shopperName); | |
// Delete item from shopper's cart | |
cartRepository.deleteShopperItem(shopperId, order.item); | |
// Add the order | |
var order = orderRepository.createOrder(shopperId, order); | |
// Return the created order item | |
return order.item; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment