Revert "fix: make packages/medusa/src/api/routes/store/carts pass eslint (#652)" (#689)

Integration tests not passing.
This commit is contained in:
Oliver Windall Juhl authored and GitHub committed 2021-10-29 11:27:40 +02:00
1 parent 1ba63cce08
commit 5ce949f3b0
16 files changed
+59

No files matched your search

+1
View File
@@ -26,6 +26,7 @@
/packages/medusa/src/api/routes/admin/collections
/packages/medusa/src/api/routes/admin/notes
/packages/medusa/src/api/routes/admin/store
/packages/medusa/src/api/routes/store/carts
/packages/medusa/src/api/routes/store/return-reasons
/packages/medusa/src/api/routes/store/returns
/packages/medusa/src/api/routes/store/swaps
@@ -1,3 +1,4 @@
import _ from "lodash"
import { Validator, MedusaError } from "medusa-core-utils"
import { defaultFields, defaultRelations } from "./"
@@ -35,6 +36,7 @@ export default async (req, res) => {
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
}
try {
const manager = req.scope.resolve("manager")
const cartService = req.scope.resolve("cartService")
@@ -58,4 +60,7 @@ export default async (req, res) => {
})
res.status(200).json({ cart: updatedCart })
} catch (err) {
throw err
}
}
@@ -57,6 +57,7 @@ export default async (req, res) => {
res.setHeader("Access-Control-Expose-Headers", "Idempotency-Key")
res.setHeader("Idempotency-Key", idempotencyKey.idempotency_key)
try {
const cartService = req.scope.resolve("cartService")
const orderService = req.scope.resolve("orderService")
const swapService = req.scope.resolve("swapService")
@@ -275,4 +276,7 @@ export default async (req, res) => {
}
res.status(idempotencyKey.response_code).json(idempotencyKey.response_body)
} catch (error) {
throw error
}
}
@@ -70,6 +70,7 @@ export default async (req, res) => {
user_agent: req.get("user-agent"),
}
try {
const lineItemService = req.scope.resolve("lineItemService")
const cartService = req.scope.resolve("cartService")
@@ -136,4 +137,7 @@ export default async (req, res) => {
res.status(200).json({ cart })
})
} catch (err) {
throw err
}
}
@@ -38,6 +38,7 @@ export default async (req, res) => {
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
}
try {
const manager = req.scope.resolve("manager")
const lineItemService = req.scope.resolve("lineItemService")
const cartService = req.scope.resolve("cartService")
@@ -68,4 +69,7 @@ export default async (req, res) => {
})
res.status(200).json({ cart })
} catch (err) {
throw err
}
}
@@ -22,6 +22,7 @@ import { defaultFields, defaultRelations } from "./"
export default async (req, res) => {
const { id } = req.params
try {
const cartService = req.scope.resolve("cartService")
await cartService.setPaymentSessions(id)
@@ -32,4 +33,7 @@ export default async (req, res) => {
})
res.status(200).json({ cart })
} catch (err) {
throw err
}
}
@@ -23,6 +23,7 @@ import { defaultFields, defaultRelations } from "./"
export default async (req, res) => {
const { id, code } = req.params
try {
const manager = req.scope.resolve("manager")
const cartService = req.scope.resolve("cartService")
@@ -46,4 +47,7 @@ export default async (req, res) => {
})
res.status(200).json({ cart })
} catch (err) {
throw err
}
}
@@ -23,6 +23,7 @@ import { defaultFields, defaultRelations } from "./"
export default async (req, res) => {
const { id, line_id } = req.params
try {
const manager = req.scope.resolve("manager")
const cartService = req.scope.resolve("cartService")
@@ -46,4 +47,7 @@ export default async (req, res) => {
})
res.status(200).json({ cart })
} catch (err) {
throw err
}
}
@@ -23,6 +23,7 @@ import { defaultFields, defaultRelations } from "./"
export default async (req, res) => {
const { id, provider_id } = req.params
try {
const cartService = req.scope.resolve("cartService")
await cartService.deletePaymentSession(id, provider_id)
@@ -32,4 +33,7 @@ export default async (req, res) => {
})
res.status(200).json({ cart })
} catch (err) {
throw err
}
}
@@ -22,6 +22,7 @@ import { defaultFields, defaultRelations } from "./"
export default async (req, res) => {
const { id } = req.params
try {
const cartService = req.scope.resolve("cartService")
let cart = await cartService.retrieve(id, {
@@ -47,4 +48,7 @@ export default async (req, res) => {
})
res.json({ cart })
} catch (err) {
throw err
}
}
@@ -21,6 +21,7 @@
export default async (req, res) => {
const { id, provider_id } = req.params
try {
const cartService = req.scope.resolve("cartService")
await cartService.refreshPaymentSession(id, provider_id)
@@ -43,4 +44,7 @@ export default async (req, res) => {
})
res.status(200).json({ cart })
} catch (err) {
throw err
}
}
@@ -33,6 +33,7 @@ export default async (req, res) => {
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
}
try {
const cartService = req.scope.resolve("cartService")
let cart = await cartService.setPaymentSession(id, value.provider_id)
@@ -42,4 +43,7 @@ export default async (req, res) => {
})
res.status(200).json({ cart })
} catch (err) {
throw err
}
}
@@ -1,3 +1,4 @@
import _ from "lodash"
import { Validator, MedusaError } from "medusa-core-utils"
import { defaultFields, defaultRelations } from "./"
@@ -34,6 +34,7 @@ export default async (req, res) => {
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
}
try {
const manager = req.scope.resolve("manager")
const cartService = req.scope.resolve("cartService")
@@ -79,4 +80,7 @@ export default async (req, res) => {
relations: defaultRelations,
})
res.status(200).json({ cart })
} catch (err) {
throw err
}
}
@@ -14,6 +14,7 @@ export default async (req, res) => {
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
}
try {
const cartService = req.scope.resolve("cartService")
let cart = await cartService.setPaymentMethod(id, value)
@@ -23,4 +24,7 @@ export default async (req, res) => {
})
res.status(200).json({ cart })
} catch (err) {
throw err
}
}
@@ -35,6 +35,7 @@ export default async (req, res) => {
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
}
try {
const cartService = req.scope.resolve("cartService")
await cartService.setPaymentSession(id, provider_id)
@@ -46,4 +47,7 @@ export default async (req, res) => {
})
res.status(200).json({ cart })
} catch (err) {
throw err
}
}