Adds order subscriber for slack
This commit is contained in:
1 parent
a8eaf2589c
commit
58051fdb0f
1 file changed
+3
-7
@@ -1,15 +1,11 @@
|
|||||||
class OrderSubscriber {
|
class OrderSubscriber {
|
||||||
constructor({ economicService, eventBusService }) {
|
constructor({ slackService, eventBusService }) {
|
||||||
this.economicService_ = economicService
|
this.slackService_ = slackService
|
||||||
|
|
||||||
this.eventBus_ = eventBusService
|
this.eventBus_ = eventBusService
|
||||||
|
|
||||||
this.eventBus_.subscribe("order.placed", async (order) => {
|
this.eventBus_.subscribe("order.placed", async (order) => {
|
||||||
await this.economicService_.draftEconomicInvoice(order)
|
await this.slackService_.orderNotification(order._id)
|
||||||
})
|
|
||||||
|
|
||||||
this.eventBus_.subscribe("order.completed", async (order) => {
|
|
||||||
await this.economicService_.bookEconomicInvoice(order._id)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user