++ Cassa - parte 1
This commit is contained in:
@@ -97,7 +97,7 @@ router.post('/:userId', authenticate, async function (req, res, next) {
|
||||
myord = arrord ? arrord[0] : null;
|
||||
}
|
||||
} else {
|
||||
return res.send({ code: server_constants.RIS_CODE_ERR, cart: null, myord: null, msgerr: 'Non è possibile acquistare nello stesso ordine, su negozi differenti!' });
|
||||
return res.send({ code: server_constants.RIS_CODE_ERR, cart: null, myord: null, msgerr: 'Non è possibile acquistare nello stesso ordine, su negozi differenti!' });
|
||||
}
|
||||
} else {
|
||||
await newCart.updatetotals();
|
||||
@@ -239,6 +239,7 @@ router.post('/:userId/createorderscart', authenticate, async function (req, res,
|
||||
const user = req.user;
|
||||
let status = req.body.status;
|
||||
let note = req.body.note;
|
||||
let options = req.body.options;
|
||||
|
||||
try {
|
||||
let mycart = await Cart.findOne({ _id: cart_id });
|
||||
@@ -290,7 +291,7 @@ router.post('/:userId/createorderscart', authenticate, async function (req, res,
|
||||
return res.send({ code: server_constants.RIS_CODE_ERR, status: 0 });
|
||||
else {
|
||||
|
||||
await Order.updateStatusOrders(mycart.items, status);
|
||||
await Order.updateStatusOrders(mycart.items, status);
|
||||
|
||||
const myris = ris;
|
||||
// Cancella il Cart appena salvato in OrdersCart
|
||||
@@ -299,10 +300,10 @@ router.post('/:userId/createorderscart', authenticate, async function (req, res,
|
||||
.then((ris) => {
|
||||
|
||||
return OrdersCart.getOrdersCartByUserId(userId, idapp, numorder)
|
||||
.then((orders) => {
|
||||
.then(async (orders) => {
|
||||
if (!!orders) {
|
||||
|
||||
OrdersCart.updateCmd(orders[0], status, true);
|
||||
await OrdersCart.updateCmd(orders[0], status, true, req, options);
|
||||
|
||||
// Invia la email dell'Ordine
|
||||
sendemail.sendEmail_OrderProduct(user.lang, idapp, orders[0], user)
|
||||
@@ -351,6 +352,7 @@ router.post('/:userId/ordercartstatus', authenticate, async function (req, res,
|
||||
let order_id = req.body.order_id;
|
||||
const user = req.user;
|
||||
let status = req.body.status;
|
||||
let options = req.body.options;
|
||||
|
||||
const { User } = require('../models/user');
|
||||
|
||||
@@ -373,7 +375,7 @@ router.post('/:userId/ordercartstatus', authenticate, async function (req, res,
|
||||
if (ris) {
|
||||
|
||||
// Aggiorna gli Stati Interni !
|
||||
orderCart = await OrdersCart.updateCmd(orderCart, status, true);
|
||||
orderCart = await OrdersCart.updateCmd(orderCart, status, true, options);
|
||||
|
||||
let ordertype = '';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user