Adds order subscriber for slack

This commit is contained in:
olivermrbl
2020-07-12 11:26:01 +02:00
parent a8eaf2589c
commit 58051fdb0f

View File

@@ -1,15 +1,11 @@
class OrderSubscriber {
constructor({ economicService, eventBusService }) {
this.economicService_ = economicService
constructor({ slackService, eventBusService }) {
this.slackService_ = slackService
this.eventBus_ = eventBusService
this.eventBus_.subscribe("order.placed", async (order) => {
await this.economicService_.draftEconomicInvoice(order)
})
this.eventBus_.subscribe("order.completed", async (order) => {
await this.economicService_.bookEconomicInvoice(order._id)
await this.slackService_.orderNotification(order._id)
})
}
}