Adds update payment + minor fixes

This commit is contained in:
olivermrbl
2020-08-20 08:19:03 +02:00
parent f68c3fe067
commit 9028a5afab
9 changed files with 94 additions and 36 deletions
+1 -13
View File
@@ -603,19 +603,7 @@ class OrderService extends BaseService {
provider_id
)
const captureData = await paymentProvider.capturePayment(data)
// If Adyen is used as payment provider, we need to check the
// validity of the capture request
if (
captureData.data.pspReference &&
captureData.data.response !== "[capture-received]"
) {
throw new MedusaError(
MedusaError.Types.INVALID_ARGUMENT,
"Could not process capture"
)
}
await paymentProvider.capturePayment(data)
return this.orderModel_
.updateOne(
-8
View File
@@ -30,14 +30,6 @@ class OrderSubscriber {
await this.customerService_.addAddress(order.customer_id, address)
})
this.eventBus_.subscribe("order.placed", async order => {
await this.cartService_.delete(order.cart_id).catch(err => {
if (err.type !== "not_found") {
throw err
}
})
})
this.eventBus_.subscribe("order.placed", this.handleDiscounts)
}