Merge pull request #3 from arings/hotfix/paypal-stripe

Fix bugs in Stripe and crashes in Paypal modules
react_convert
Mark Moffat 2018-02-01 12:24:11 +01:00 committed by GitHub
commit 0b5320e924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 7 deletions

View File

@ -12,7 +12,7 @@ router.get('/checkout_return', (req, res, next) => {
let db = req.app.db;
let config = common.getConfig();
let paymentId = req.session.paymentId;
let payerId = req.param('PayerID');
let payerId = req.query['PayerID'];
let details = {'payer_id': payerId};
paypal.payment.execute(paymentId, details, (error, payment) => {
@ -190,10 +190,7 @@ router.post('/checkout_action', (req, res, next) => {
}
// get the new ID
let newId = '';
if(newDoc.insertedIds.length > 0){
newId = newDoc.insertedIds[0].toString();
}
let newId = newDoc.insertedIds['0'];
// set the order ID in the session
req.session.orderId = newId;

View File

@ -60,7 +60,7 @@ router.post('/checkout_action', (req, res, next) => {
}
// get the new ID
let newId = newDoc.insertedIds;
let newId = newDoc.insertedIds['0'];
// add to lunr index
common.indexOrders(req.app)
@ -70,7 +70,7 @@ router.post('/checkout_action', (req, res, next) => {
// set the results
req.session.messageType = 'success';
req.session.message = 'Your payment was successfully completed';
req.session.paymentEmailAddr = newDoc.orderEmail;
req.session.paymentEmailAddr = newDoc.ops[0].orderEmail;
req.session.paymentApproved = true;
req.session.paymentDetails = '<p><strong>Order ID: </strong>' + newId + '</p><p><strong>Transaction ID: </strong>' + charge.id + '</p>';