Last active
May 4, 2019 19:46
-
-
Save AlicanAkkus/4d6c3c9aa28cc8480852f6bba0ba4784 to your computer and use it in GitHub Desktop.
order create
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 OrderCreateFacade { | |
OrderCommissionCalculator orderCommissionCalculator | |
OrderCreateFacade(OrderCommissionCalculator orderCommissionCalculator) { | |
this.orderCommissionCalculator = orderCommissionCalculator | |
} | |
Order create(Long userId, String paymentMethod, BigDecimal price) { | |
return new Order().tap { | |
it.userId = userId | |
it.paymentMethod = paymentMethod | |
it.price = price | |
it.commissionAmount = orderCommissionCalculator.calculate(paymentMethod, price) | |
it.orderCreatedDate = LocalDateTime.now() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment