Removed PayPal API
This commit is contained in:
3
app.js
3
app.js
@ -127,9 +127,6 @@ app.get('/api', apiController.getApi);
|
|||||||
app.get('/api/lastfm', apiController.getLastfm);
|
app.get('/api/lastfm', apiController.getLastfm);
|
||||||
app.get('/api/nyt', apiController.getNewYorkTimes);
|
app.get('/api/nyt', apiController.getNewYorkTimes);
|
||||||
app.get('/api/aviary', apiController.getAviary);
|
app.get('/api/aviary', apiController.getAviary);
|
||||||
app.get('/api/paypal', apiController.getPayPal);
|
|
||||||
app.get('/api/paypal/success', apiController.getPayPalSuccess);
|
|
||||||
app.get('/api/paypal/cancel', apiController.getPayPalCancel);
|
|
||||||
app.get('/api/steam', apiController.getSteam);
|
app.get('/api/steam', apiController.getSteam);
|
||||||
app.get('/api/stripe', apiController.getStripe);
|
app.get('/api/stripe', apiController.getStripe);
|
||||||
app.post('/api/stripe', apiController.postStripe);
|
app.post('/api/stripe', apiController.postStripe);
|
||||||
|
@ -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
|
* GET /api/steam
|
||||||
* Steam API example.
|
* Steam API example.
|
||||||
|
@ -45,11 +45,6 @@ block content
|
|||||||
.panel-body
|
.panel-body
|
||||||
img(src='http://icons.iconarchive.com/icons/dakirby309/windows-8-metro/256/Web-The-New-York-Times-alt-Metro-icon.png', height=40)
|
img(src='http://icons.iconarchive.com/icons/dakirby309/windows-8-metro/256/Web-The-New-York-Times-alt-Metro-icon.png', height=40)
|
||||||
a(href='/api/nyt') New York Times
|
a(href='/api/nyt') New York Times
|
||||||
.col-sm-4
|
|
||||||
.panel.panel-default
|
|
||||||
.panel-body
|
|
||||||
img(src='http://media.idownloadblog.com/wp-content/uploads/2013/11/PayPal-5.2-for-iOS-app-icon-small.png', height=40)
|
|
||||||
a(href='/api/paypal') PayPal
|
|
||||||
.col-sm-4
|
.col-sm-4
|
||||||
.panel.panel-default
|
.panel.panel-default
|
||||||
.panel-body
|
.panel-body
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
extends ../layout
|
|
||||||
|
|
||||||
block content
|
|
||||||
.page-header
|
|
||||||
h2
|
|
||||||
i.fa.fa-dollar
|
|
||||||
| PayPal API
|
|
||||||
|
|
||||||
.btn-group.btn-group-justified
|
|
||||||
a.btn.btn-primary(href='https://developer.paypal.com/docs/integration/direct/make-your-first-call/', target='_blank')
|
|
||||||
i.fa.fa-check-square-o
|
|
||||||
| Quickstart
|
|
||||||
a.btn.btn-primary(href='https://developer.paypal.com/docs/api/', target='_blank')
|
|
||||||
i.fa.fa-code
|
|
||||||
| API Reference
|
|
||||||
a.btn.btn-primary(href='https://devtools-paypal.com/hateoas/index.html', target='_blank')
|
|
||||||
i.fa.fa-gear
|
|
||||||
| API Playground
|
|
||||||
|
|
||||||
|
|
||||||
if result
|
|
||||||
if canceled
|
|
||||||
h3 Payment got canceled!
|
|
||||||
if success
|
|
||||||
h3 Payment got executed successfully!
|
|
||||||
a(href='/api/paypal')
|
|
||||||
button.btn.btn-primary New payment
|
|
||||||
else
|
|
||||||
p.lead Redirects to PayPal and allows authorizing the sample payment.
|
|
||||||
a(href=approval_url)
|
|
||||||
button.btn.btn-primary Authorize payment
|
|
@ -7,13 +7,13 @@ block content
|
|||||||
.btn-group.btn-group-justified
|
.btn-group.btn-group-justified
|
||||||
a.btn.btn-primary(href='https://stripe.com/docs/tutorials/checkout')
|
a.btn.btn-primary(href='https://stripe.com/docs/tutorials/checkout')
|
||||||
i.fa.fa-home
|
i.fa.fa-home
|
||||||
| Integration Checkout
|
| Stripe Checkout
|
||||||
a.btn.btn-primary(href='https://stripe.com/docs/api', target='_blank')
|
a.btn.btn-primary(href='https://stripe.com/docs/api', target='_blank')
|
||||||
i.fa.fa-code
|
i.fa.fa-code
|
||||||
| API Reference
|
| API Reference
|
||||||
a.btn.btn-primary(href='https://manage.stripe.com/account/apikeys', target='_blank')
|
a.btn.btn-primary(href='https://manage.stripe.com/account/apikeys', target='_blank')
|
||||||
i.fa.fa-gear
|
i.fa.fa-gear
|
||||||
| API Keys
|
| Get API Keys
|
||||||
|
|
||||||
br
|
br
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user