treure logs perque funcioni
This commit is contained in:
parent
30146d6411
commit
08fb7fa2e2
|
@ -7,15 +7,17 @@ class PaymentServices {
|
||||||
try {
|
try {
|
||||||
//parameters to return the products that will be purchased
|
//parameters to return the products that will be purchased
|
||||||
const { products, dateExpired, postalCode, customer, type } = req.body
|
const { products, dateExpired, postalCode, customer, type } = req.body
|
||||||
const _products = await db.getProducts(dateExpired, postalCode)
|
// const _products = await db.getProducts(dateExpired, postalCode)
|
||||||
|
|
||||||
const productsFilter = _products[0].filter((item) => {
|
/* const productsFilter = _products[0].filter((item) => {
|
||||||
if (products.includes(item.itemFk)) {
|
if (products.includes(item.id)) {
|
||||||
return item
|
return item
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
|
|
||||||
if (productsFilter.length !== products.length) {
|
const productsFilter = await db.getProductById(products[0]);
|
||||||
|
|
||||||
|
if (productsFilter[0][0].length !== products.length) {
|
||||||
return res.status(422).send({
|
return res.status(422).send({
|
||||||
data: {
|
data: {
|
||||||
message: "Uno de los productos no existe."
|
message: "Uno de los productos no existe."
|
||||||
|
@ -42,8 +44,8 @@ class PaymentServices {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
const order = await db.orderData_put(jsonOrderData);
|
const order = await db.orderData_put(jsonOrderData);
|
||||||
//const orderFk = order[0][0].orderFk
|
const orderFk = order[0][0].catalogueFk;
|
||||||
const orderFk = jsonOrderData.customer.customerData.products[0].id;
|
//const orderFk = jsonOrderData.customer.customerData.products[0].id;
|
||||||
|
|
||||||
if (type === "paypal") {
|
if (type === "paypal") {
|
||||||
const data = await payPalProviders.New(orderFk, price)
|
const data = await payPalProviders.New(orderFk, price)
|
||||||
|
@ -102,4 +104,4 @@ class PaymentServices {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = new PaymentServices();
|
module.exports = new PaymentServices();
|
Loading…
Reference in New Issue