Removed PayPal API
This commit is contained in:
@ -261,84 +261,6 @@ exports.getTwitter = function(req, res, next) {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* GET /api/paypal
|
||||
* PayPal SDK example.
|
||||
*/
|
||||
|
||||
exports.getPayPal = function(req, res, next) {
|
||||
paypal.configure(secrets.paypal);
|
||||
|
||||
var paymentDetails = {
|
||||
intent: 'sale',
|
||||
payer: {
|
||||
payment_method: 'paypal'
|
||||
},
|
||||
redirect_urls: {
|
||||
return_url: secrets.paypal.returnUrl,
|
||||
cancel_url: secrets.paypal.cancelUrl
|
||||
},
|
||||
transactions: [
|
||||
{
|
||||
description: 'Node.js Boilerplate',
|
||||
amount: {
|
||||
currency: 'USD',
|
||||
total: '2.99'
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
paypal.payment.create(paymentDetails, function(err, payment) {
|
||||
if (err) return next(err);
|
||||
req.session.paymentId = payment.id;
|
||||
var links = payment.links;
|
||||
for (var i = 0; i < links.length; i++) {
|
||||
if (links[i].rel === 'approval_url') {
|
||||
res.render('api/paypal', {
|
||||
approval_url: links[i].href
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* GET /api/paypal/success
|
||||
* PayPal SDK example.
|
||||
*/
|
||||
|
||||
exports.getPayPalSuccess = function(req, res, next) {
|
||||
var paymentId = req.session.paymentId;
|
||||
var paymentDetails = { 'payer_id': req.query.PayerID };
|
||||
paypal.payment.execute(paymentId, paymentDetails, function(err, payment) {
|
||||
if (err) {
|
||||
res.render('api/paypal', {
|
||||
result: true,
|
||||
success: false
|
||||
});
|
||||
} else {
|
||||
res.render('api/paypal', {
|
||||
result: true,
|
||||
success: true
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* GET /api/paypal/cancel
|
||||
* PayPal SDK example.
|
||||
*/
|
||||
|
||||
exports.getPayPalCancel = function(req, res, next) {
|
||||
req.session.payment_id = null;
|
||||
res.render('api/paypal', {
|
||||
result: true,
|
||||
canceled: true
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* GET /api/steam
|
||||
* Steam API example.
|
||||
|
Reference in New Issue
Block a user