paypal: add configurable merchant and sandbox/production environment

This commit is contained in:
Tyler Renelle
2013-10-12 17:05:21 -07:00
parent 5de0c928fe
commit f8328d3eeb
4 changed files with 4 additions and 2 deletions

View File

@@ -13,4 +13,5 @@
"SMTP_SERVICE":"Gmail", "SMTP_SERVICE":"Gmail",
"STRIPE_API_KEY":"aaaabbbbccccddddeeeeffff00001111", "STRIPE_API_KEY":"aaaabbbbccccddddeeeeffff00001111",
"STRIPE_PUB_KEY":"22223333444455556666777788889999" "STRIPE_PUB_KEY":"22223333444455556666777788889999"
"PAYPAL_MERCHANT":"paypal-merchant@gmail.com"
} }

View File

@@ -47,7 +47,7 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
address: false, address: false,
amount: 500, amount: 500,
name: "Checkout", name: "Checkout",
//description: "Buy 20 Gems, Disable Ads, Support the Developers", description: "Buy 20 Gems, Disable Ads, Support the Developers",
panelLabel: "Checkout", panelLabel: "Checkout",
token: function(data) { token: function(data) {
$scope.$apply(function(){ $scope.$apply(function(){

View File

@@ -64,6 +64,7 @@ module.exports.locals = function(req, res, next) {
_.defaults(res.locals.habitrpg, { _.defaults(res.locals.habitrpg, {
NODE_ENV: nconf.get('NODE_ENV'), NODE_ENV: nconf.get('NODE_ENV'),
BASE_URL: nconf.get('BASE_URL'), BASE_URL: nconf.get('BASE_URL'),
PAYPAL_MERCHANT: nconf.get('PAYPAL_MERCHANT'),
IS_MOBILE: /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(req.header('User-Agent')), IS_MOBILE: /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(req.header('User-Agent')),
STRIPE_PUB_KEY: nconf.get('STRIPE_PUB_KEY'), STRIPE_PUB_KEY: nconf.get('STRIPE_PUB_KEY'),
getBuildUrl: getBuildUrl getBuildUrl: getBuildUrl

View File

@@ -15,7 +15,7 @@ div(modal='modals.buyGems')
.btn.btn-primary(ng-click='showStripe()') Pay with Card .btn.btn-primary(ng-click='showStripe()') Pay with Card
.span6.well .span6.well
h3 Pay with PayPal h3 Pay with PayPal
script(src='/bower_components/JavaScriptButtons/dist/paypal-button.min.js?merchant=tylerrenelle-facilitator@gmail.com', data-button='buynow', data-name='20 Gems, Disable Ads, Donation to the Developers', data-quantity='1', data-amount='.1', data-currency='USD', data-shipping='0', data-tax='0', data-callback='#{env.BASE_URL}/api/v1/user/buy-gems/paypal-ipn', data-env='sandbox', data-custom='?uid={{user._id}}&apiToken={{user.apiToken}}') script(src='/bower_components/JavaScriptButtons/dist/paypal-button.min.js?merchant=#{env.PAYPAL_MERCHANT}', data-button='buynow', data-name='20 Gems, Disable Ads, Donation to the Developers', data-quantity='1', data-amount='5', data-currency='USD', data-shipping='0', data-tax='0', data-callback='#{env.BASE_URL}/api/v1/user/buy-gems/paypal-ipn', data-env="#{env.NODE_ENV == 'production' ? '' : 'sandbox'}", data-custom='?uid={{user._id}}&apiToken={{user.apiToken}}', data-return='#{env.BASE_URL}', data-no_shipping='1')
.modal-footer .modal-footer
button.btn.btn-default.cancel(ng-click='modals.buyGems = false') Cancel button.btn.btn-default.cancel(ng-click='modals.buyGems = false') Cancel