fix(medusa): Missing withTransaction on calculateDiscountForLineItem (#3247)
This commit is contained in:
@@ -53,16 +53,18 @@ export default async (req, res) => {
|
||||
const cartService: CartService = req.scope.resolve("cartService")
|
||||
|
||||
await manager.transaction(async (m) => {
|
||||
const cartServiceTx = cartService.withTransaction(m)
|
||||
|
||||
// Remove the line item
|
||||
await cartService.withTransaction(m).removeLineItem(id, line_id)
|
||||
await cartServiceTx.removeLineItem(id, line_id)
|
||||
|
||||
// If the cart has payment sessions update these
|
||||
const updated = await cartService.withTransaction(m).retrieve(id, {
|
||||
const updated = await cartServiceTx.retrieve(id, {
|
||||
relations: ["payment_sessions"],
|
||||
})
|
||||
|
||||
if (updated.payment_sessions?.length) {
|
||||
await cartService.withTransaction(m).setPaymentSessions(id)
|
||||
await cartServiceTx.setPaymentSessions(id)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user