Aggiungi il codice alla cassa in automatico
This commit is contained in:
@@ -244,6 +244,10 @@ module.exports.updateStatusOrdersElements = async function (arrOrders, myelement
|
||||
module.exports.updateTotals = function (order) {
|
||||
|
||||
try {
|
||||
if (!order) {
|
||||
return;
|
||||
}
|
||||
|
||||
let mypricecalc = 0;
|
||||
order.TotalPriceProduct = 0;
|
||||
|
||||
|
||||
@@ -57,8 +57,12 @@ router.post('/:userId', authenticate, async function (req, res, next) {
|
||||
try {
|
||||
let mycart = await Cart.getCartByUserId(userId, idapp);
|
||||
|
||||
if (!order) {
|
||||
return res.send({ code: server_constants.RIS_CODE_OK, cart: null });
|
||||
}
|
||||
|
||||
// const myorder = Order.getOrderByID(order._id);
|
||||
if (!addqty && !subqty) {
|
||||
if (!addqty && !subqty && order) {
|
||||
order._id = await Order.createOrder(order);
|
||||
if (!order._id) {
|
||||
return res.send({ code: server_constants.RIS_CODE_ERR, cart: 0 });
|
||||
@@ -228,6 +232,14 @@ router.post('/:userId/createorderscart', authenticate, async function (req, res,
|
||||
try {
|
||||
let mycart = await Cart.findOne({ _id: cart_id });
|
||||
|
||||
if (!mycart) {
|
||||
return res.send({
|
||||
code: server_constants.RIS_CODE_OK,
|
||||
status: 0,
|
||||
recOrderCart: null,
|
||||
});
|
||||
}
|
||||
|
||||
let numorder = await OrdersCart.getLastNumOrder(idapp);
|
||||
let numord_pers = await OrdersCart.getLastNumOrdPers(userId, idapp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user