Skip to content

Commit

Permalink
Added new field
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Moffat authored and Mark Moffat committed Mar 14, 2020
1 parent 16d5bc8 commit c591263
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions routes/payments/blockonomics.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ router.get('/checkout_return', async (req, res, next) => {
// send the email with the response
// TODO: Should fix this to properly handle result
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){
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;
}
Expand All @@ -65,10 +65,10 @@ router.get('/checkout_return', async (req, res, next) => {
return;
}
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 config = req.app.config;
const db = req.app.db;
Expand All @@ -95,6 +95,7 @@ router.post('/checkout_action', (req, res, next) => {
orderItemCount: req.session.totalCartItems,
orderProductCount: req.session.totalCartProducts,
orderEmail: req.session.customerEmail,
orderCompany: req.session.customerCompany,
orderFirstname: req.session.customerFirstname,
orderLastname: req.session.customerLastname,
orderAddr1: req.session.customerAddress1,
Expand All @@ -117,15 +118,15 @@ router.post('/checkout_action', (req, res, next) => {
const newId = newDoc.insertedId;
// add to lunr index
indexOrders(req.app)
.then(() => {
.then(() => {
// set the order ID in the session, to link to it from blockonomics payment page
blockonomicsParams.pendingOrderId = newId;
req.session.blockonomicsParams = blockonomicsParams;
res.redirect('/blockonomics_payment');
});
});
res.redirect('/blockonomics_payment');
});
});
});
});
});
});

module.exports = router;

0 comments on commit c591263

Please sign in to comment.