Skip to content

Instantly share code, notes, and snippets.

@5AbhishekSaxena
Created December 2, 2022 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 5AbhishekSaxena/61277eeb98a5c2cc7da6375450652f8d to your computer and use it in GitHub Desktop.
Save 5AbhishekSaxena/61277eeb98a5c2cc7da6375450652f8d to your computer and use it in GitHub Desktop.
class OrderFacade(
private val orderNotificationSender: OrderNotificationSender,
private val orderInvoiceGenerator: OrderInvoiceGenerator,
private val orderRepository: OrderRepository
) {
fun sendNotification(order: Order) {
// sends notification about order updates to the user.
orderNotificationSender.sendNotification(order)
}
fun generateInvoice(order: Order) {
// generates invoice
orderInvoiceGenerator.generateInvoice(order)
}
fun save(order: Order) {
// insert/update data in the db
orderRepository.save(order)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment