Skip to content

Instantly share code, notes, and snippets.

@MuizMahdi
Last active November 23, 2020 23:53
Show Gist options
  • Save MuizMahdi/5dc1032c3cbebcb7749eaabeb5e19a58 to your computer and use it in GitHub Desktop.
Save MuizMahdi/5dc1032c3cbebcb7749eaabeb5e19a58 to your computer and use it in GitHub Desktop.
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