More logging
This commit is contained in:
parent
5d87d91333
commit
53656446bc
@ -33,6 +33,7 @@ export const checkout = functions.https.onRequest((request, response) => {
|
|||||||
|
|
||||||
// Fill in information from DB
|
// Fill in information from DB
|
||||||
let promises = [];
|
let promises = [];
|
||||||
|
console.log(request.body);
|
||||||
let cart = request.body.cart.filter(row => row.quantity > 0);
|
let cart = request.body.cart.filter(row => row.quantity > 0);
|
||||||
cart.forEach(async row =>
|
cart.forEach(async row =>
|
||||||
promises.push(
|
promises.push(
|
||||||
@ -46,6 +47,7 @@ export const checkout = functions.https.onRequest((request, response) => {
|
|||||||
let products = await Promise.all(promises);
|
let products = await Promise.all(promises);
|
||||||
req.transactions[0].item_list.items = products.map((row, i) => {
|
req.transactions[0].item_list.items = products.map((row, i) => {
|
||||||
const data = row.data();
|
const data = row.data();
|
||||||
|
console.log(data);
|
||||||
return {name: data.name, sku: data.name, price: data.price, currency: 'CAD', quantity: cart[i].quantity};
|
return {name: data.name, sku: data.name, price: data.price, currency: 'CAD', quantity: cart[i].quantity};
|
||||||
});
|
});
|
||||||
req.transactions[0].amount.total = req.transactions[0].item_list.items.reduce((acc, row, i) => {
|
req.transactions[0].amount.total = req.transactions[0].item_list.items.reduce((acc, row, i) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user