Files
medusa-store/packages/medusa-plugin-economic/src/subscribers/order.js
2020-07-09 18:16:45 +02:00

18 lines
472 B
JavaScript

class OrderSubscriber {
constructor({ economicService, eventBusService }) {
this.economicService_ = economicService
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)
})
}
}
export default OrderSubscriber