point of sale order contoller with razorpay completed and cash with mail completed

This commit is contained in:
Sibunnayak 2024-04-30 17:13:33 +05:30
parent 105da2bccb
commit 00e6d2227a

View File

@ -68,7 +68,8 @@ export const getRazerpayKey = async (req, res) => {
export const checkout = async (req, res) => { export const checkout = async (req, res) => {
try { try {
const { userr,address, cart, subtotal,orderType } = req.body; const { userr,address, cart, subtotal,orderType } = req.body;
// console.log(req.body); // console.log(req.body.cart[0].product);
// console.log(req.body.cart[0].variant);
if (cart.length < 1) if (cart.length < 1)
return res.status(400).json({ message: "cart is empty!" }); return res.status(400).json({ message: "cart is empty!" });
if (!address) if (!address)
@ -145,7 +146,7 @@ export const checkout = async (req, res) => {
).toFixed(3), ).toFixed(3),
})); }));
// console.log("line", lineItems[0]); // console.log("Order", orderItems[0]);
const Id = await generateUniqueOrderId(); const Id = await generateUniqueOrderId();
const orders = await Order.create({ const orders = await Order.create({
orderID: Id, orderID: Id,