Adds account support
This commit is contained in:
1 parent
3eb2e9fe49
commit
60b8bca753
18 files changed
+200
-44
No files matched your search
@@ -1,6 +1,13 @@
|
||||
class OrderSubscriber {
|
||||
constructor({ paymentProviderService, eventBusService }) {
|
||||
constructor({
|
||||
paymentProviderService,
|
||||
cartService,
|
||||
customerService,
|
||||
eventBusService,
|
||||
}) {
|
||||
this.paymentProviderService_ = paymentProviderService
|
||||
this.customerService_ = customerService
|
||||
this.cartService_ = cartService
|
||||
|
||||
this.eventBus_ = eventBusService
|
||||
|
||||
@@ -11,6 +18,14 @@ class OrderSubscriber {
|
||||
|
||||
await paymentProvider.capturePayment(order._id)
|
||||
})
|
||||
|
||||
this.eventBus_.subscribe("order.placed", async order => {
|
||||
await this.customerService_.addOrder(order.customer_id, order._id)
|
||||
})
|
||||
|
||||
this.eventBus_.subscribe("order.placed", async order => {
|
||||
await this.cartService_.delete(order.cart_id)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user