Added new field

master
Mark Moffat 2020-03-14 11:38:13 +10:30
parent 16d5bc80f4
commit c591263eb9
1 changed files with 10 additions and 9 deletions

View File

@ -41,10 +41,10 @@ router.get('/checkout_return', async (req, res, next) => {
// send the email with the response // send the email with the response
// TODO: Should fix this to properly handle result // TODO: Should fix this to properly handle result
common.sendEmail(req.session.paymentEmailAddr, 'Your payment with ' + config.cartTitle, common.getEmailTemplate(paymentResults)); common.sendEmail(req.session.paymentEmailAddr, 'Your payment with ' + config.cartTitle, common.getEmailTemplate(paymentResults));
res.status(200).json({ err: '' }); res.status(200).json({ err: '' });
}catch(ex){ }catch(ex){
console.info('Error updating status success blockonomics', ex); console.info('Error updating status success blockonomics', ex);
res.status(200).json({ err: 'Error updating status' }); res.status(200).json({ err: 'Error updating status' });
} }
return; return;
} }
@ -65,10 +65,10 @@ router.get('/checkout_return', async (req, res, next) => {
return; return;
} }
res.status(200).json({ err: 'Payment not final' }); res.status(200).json({ err: 'Payment not final' });
console.info('Payment not final blockonomics', address); console.info('Payment not final blockonomics', address);
}); });
router.post('/checkout_action', (req, res, next) => { router.post('/checkout_action', (req, res, next) => {
const blockonomicsConfig = common.getPaymentConfig(); const blockonomicsConfig = common.getPaymentConfig();
const config = req.app.config; const config = req.app.config;
const db = req.app.db; const db = req.app.db;
@ -95,6 +95,7 @@ router.post('/checkout_action', (req, res, next) => {
orderItemCount: req.session.totalCartItems, orderItemCount: req.session.totalCartItems,
orderProductCount: req.session.totalCartProducts, orderProductCount: req.session.totalCartProducts,
orderEmail: req.session.customerEmail, orderEmail: req.session.customerEmail,
orderCompany: req.session.customerCompany,
orderFirstname: req.session.customerFirstname, orderFirstname: req.session.customerFirstname,
orderLastname: req.session.customerLastname, orderLastname: req.session.customerLastname,
orderAddr1: req.session.customerAddress1, orderAddr1: req.session.customerAddress1,
@ -117,15 +118,15 @@ router.post('/checkout_action', (req, res, next) => {
const newId = newDoc.insertedId; const newId = newDoc.insertedId;
// add to lunr index // add to lunr index
indexOrders(req.app) indexOrders(req.app)
.then(() => { .then(() => {
// set the order ID in the session, to link to it from blockonomics payment page // set the order ID in the session, to link to it from blockonomics payment page
blockonomicsParams.pendingOrderId = newId; blockonomicsParams.pendingOrderId = newId;
req.session.blockonomicsParams = blockonomicsParams; req.session.blockonomicsParams = blockonomicsParams;
res.redirect('/blockonomics_payment'); res.redirect('/blockonomics_payment');
}); });
}); });
}); });
}); });
}); });
module.exports = router; module.exports = router;