From afce400c65f362f7dd6307a5670dc3873d74ab79 Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Sun, 11 Jan 2015 21:42:45 -0500 Subject: stub in subscriptions admin pages --- server/lib/views/staff.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'server/lib/views') diff --git a/server/lib/views/staff.js b/server/lib/views/staff.js index 97ecde6..4351ef0 100644 --- a/server/lib/views/staff.js +++ b/server/lib/views/staff.js @@ -500,6 +500,27 @@ var staff = module.exports = { staff.plans.update ); + + // + // subscriptions + app.get('/staff/subscriptions', + middleware.ensureAuthenticated, + middleware.ensureIsStaff, + + staff.middleware.ensureSubscriptions, + staff.middleware.ensureSubscriptionsUsers, + + staff.subscriptions.index + ); + app.get('/staff/subscriptions/:id', + middleware.ensureAuthenticated, + middleware.ensureIsStaff, + + staff.middleware.ensureSubscription, + staff.middleware.ensureSubscriptionUser, + + staff.subscriptions.edit + ); }, paginate: function(req, res){ @@ -669,6 +690,17 @@ var staff = module.exports = { res.redirect("/staff/plans/") }) }, - } + }, + + subscriptions: { + index: function(req, res){ + res.locals.subscriptions = req.subscriptions + res.render('staff/plans/index') + }, + show: function(req, res){ + res.locals.subscription = req.subscription + res.render('staff/plans/show') + }, + }, } -- cgit v1.2.3-70-g09d2 From a1c9bdecff30d72eeaef54c66c7211966a97d4e4 Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Sun, 11 Jan 2015 21:57:17 -0500 Subject: crud --- server/lib/views/staff.js | 69 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 3 deletions(-) (limited to 'server/lib/views') diff --git a/server/lib/views/staff.js b/server/lib/views/staff.js index 4351ef0..39a8dca 100644 --- a/server/lib/views/staff.js +++ b/server/lib/views/staff.js @@ -124,7 +124,35 @@ var staff = module.exports = { next() }) }, - + + ensureSubscriptions: function(req, res, next){ + var paginationInfo = res.locals.pagination = {} + var criteria = req.criteria || {} + var limit = paginationInfo.limit = Math.min( Number(req.query.limit) || 50, 200 ) + var offset = paginationInfo.offset = Number(req.query.offset) || 0 + var sort + paginationInfo.sort = req.query.sort + paginationInfo.sortOptions = ["date", "name"] + switch (req.query.sort) { + case 'created': + sort = {'created_at': -1} + break + default: + case 'date': + sort = {'updated_at': -1} + break + } + Subscription.find(criteria) + .select(staff.fields.project) + .sort(sort) + .skip(offset) + .limit(limit) + .exec(function (err, subscriptions) { + res.locals.subscriptions = subscriptions.map(staff.helpers.subscription) + next() + }) + }, + ensurePlans: function(req, res, next){ Plan.find(function (err, plans) { res.locals.plans = (plans || []).map(staff.helpers.plan) @@ -150,6 +178,24 @@ var staff = module.exports = { } }, + ensureSubscription: function (req, res, next) { + if (req.params.id) { + Subscription.findOne({ _id: req.params.id }, function(err, subscription){ + if (err || ! subscription) { + console.error(err) + res.redirect("/staff/subscriptions/") + } + else { + req.subscription = subscription + next() + } + }) + } + else { + res.redirect("/staff/subscriptions/") + } + }, + ensureRecentProjects: function(req, res, next){ var dreq = { params: { sort: 'created_at', limit: 20, offset: 0 } } staff.middleware.ensureProjects(dreq, res, next) @@ -160,11 +206,23 @@ var staff = module.exports = { staff.middleware.ensureObjectsUsers(res.locals.projects, next) }, + ensureSubscriptionsUsers: function(req, res, next){ + if (! res.locals.subscriptions || ! res.locals.subscriptions.length) { return next() } + staff.middleware.ensureObjectsUsers(res.locals.subscriptions, next) + }, + ensureMediaUsers: function(req, res, next){ if (! res.locals.media || ! res.locals.media.length) { return next() } staff.middleware.ensureObjectsUsers(res.locals.media, next) }, + ensureSubscriptionUser: function(req, res, next){ + if (! res.locals.subscription) { return next() } + staff.middleware.ensureObjectsUsers([ res.locals.subscription ], function(){ + next() + }) + }, + ensureMediaUser: function(req, res, next){ if (! res.locals.media) { return next() } staff.middleware.ensureObjectsUsers([ res.locals.media ], function(){ @@ -338,6 +396,13 @@ var staff = module.exports = { plan.user = {} return plan }, + + subscription: function(subscription){ + subscription = subscription.toObject() + subscription.date = moment( subscription.updated_at || subscription.created_at ).format("M/DD/YYYY hh:mm a") + subscription.user = {} + return subscription + }, }, route: function(app){ @@ -694,11 +759,9 @@ var staff = module.exports = { subscriptions: { index: function(req, res){ - res.locals.subscriptions = req.subscriptions res.render('staff/plans/index') }, show: function(req, res){ - res.locals.subscription = req.subscription res.render('staff/plans/show') }, }, -- cgit v1.2.3-70-g09d2 From ffdee0615c775466053daff3ce4afd1d11c83e33 Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Sun, 11 Jan 2015 22:37:07 -0500 Subject: pagination --- server/lib/views/staff.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'server/lib/views') diff --git a/server/lib/views/staff.js b/server/lib/views/staff.js index 39a8dca..64cfe77 100644 --- a/server/lib/views/staff.js +++ b/server/lib/views/staff.js @@ -759,10 +759,13 @@ var staff = module.exports = { subscriptions: { index: function(req, res){ - res.render('staff/plans/index') + res.locals.pagination.count = res.locals.subscriptions.length + res.locals.pagination.max = res.locals.subscriptionCount + staff.paginate(req, res) + res.render('staff/subscriptions/index') }, show: function(req, res){ - res.render('staff/plans/show') + res.render('staff/subscriptions/show') }, }, -- cgit v1.2.3-70-g09d2 From 77c4c8d066611ad651af8df7290fb3e54d074081 Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Sun, 11 Jan 2015 23:37:49 -0500 Subject: fix --- server/lib/views/staff.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'server/lib/views') diff --git a/server/lib/views/staff.js b/server/lib/views/staff.js index 64cfe77..d4abf1f 100644 --- a/server/lib/views/staff.js +++ b/server/lib/views/staff.js @@ -584,7 +584,7 @@ var staff = module.exports = { staff.middleware.ensureSubscription, staff.middleware.ensureSubscriptionUser, - staff.subscriptions.edit + staff.subscriptions.show ); }, @@ -765,7 +765,7 @@ var staff = module.exports = { res.render('staff/subscriptions/index') }, show: function(req, res){ - res.render('staff/subscriptions/show') + res.render('staff/subscriptions /show') }, }, -- cgit v1.2.3-70-g09d2 From dcfbf734436fad76f5ca2e1cecadf4051118d56f Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Mon, 12 Jan 2015 12:24:57 -0500 Subject: stubbing webhook --- server/index.js | 2 ++ server/lib/views/staff.js | 2 +- server/lib/views/subscription.js | 21 ++++++--------------- 3 files changed, 9 insertions(+), 16 deletions(-) (limited to 'server/lib/views') diff --git a/server/index.js b/server/index.js index 9a9323c..a14eaab 100644 --- a/server/index.js +++ b/server/index.js @@ -70,6 +70,8 @@ site.setup = function(){ app.all('*', middleware.ensureLocals); app.all('*', middleware.ensureIP); + app.get('/subscribe/webhook', views.subscription.webhook); + server = http.createServer(app) server.listen(app.get('port'), function () { console.log('Express server listening on port ' + app.get('port')); diff --git a/server/lib/views/staff.js b/server/lib/views/staff.js index d4abf1f..74dd7cd 100644 --- a/server/lib/views/staff.js +++ b/server/lib/views/staff.js @@ -765,7 +765,7 @@ var staff = module.exports = { res.render('staff/subscriptions/index') }, show: function(req, res){ - res.render('staff/subscriptions /show') + res.render('staff/subscriptions/show') }, }, diff --git a/server/lib/views/subscription.js b/server/lib/views/subscription.js index ba54bb4..e29e40d 100644 --- a/server/lib/views/subscription.js +++ b/server/lib/views/subscription.js @@ -32,19 +32,10 @@ var subscription = module.exports = { return project }, }, - - route: function(app){ - app.get('/staff', - middleware.ensureAuthenticated, - middleware.ensureIsStaff, - - staff.middleware.ensureRecentUsers, - staff.middleware.ensureUsersCount, - staff.middleware.ensureProjectsCount, - staff.middleware.ensureMediaCount, - - staff.index - ); - }, - + + // need a route for the webhook, + // then calls to get appropriate info from the recurly api + webhook: function(req, res){ + res.status(200).end() + }, } -- cgit v1.2.3-70-g09d2 From 034f8343f2d194c2b1e3dbb20cfb8658e2795ce0 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 12 Jan 2015 18:38:42 -0500 Subject: parsing some xml for webhooks --- package.json | 37 +++++++++--------- server/index.js | 1 + server/lib/views/subscription.js | 81 +++++++++++++++++++++++++++++++++++----- 3 files changed, 92 insertions(+), 27 deletions(-) (limited to 'server/lib/views') diff --git a/package.json b/package.json index adefb82..34e0c4c 100644 --- a/package.json +++ b/package.json @@ -6,32 +6,33 @@ "url": "git://github.com/okfocus/vvalls.git" }, "dependencies": { - "express": "~3.4.8", - "monk": "~0.7.1", - "socket.io": "~0.9.16", + "body-parser": "1.3.0", "connect-mongo": "~0.4.1", - "passport": "~0.2.0", - "passport-local": "~1.0.0", - "passport-twitter": "~1.0.2", - "passport-facebook": "~1.0.3", - "passport.socketio": "~3.0.1", - "node-restful": "~0.1.14", "ejs": "^0.8.8", - "useful-string": "0.0.1", + "emailjs": "~0.3.6", + "express": "~3.4.8", "express-subdomain-handler": "~0.1.0", "express-subdomains": "0.0.5", + "html-entities": "~1.0.10", + "intro.js": "^0.9.0", + "knox": "~0.8.10", "lodash": "~2.4.1", + "marked": "~0.3.2", + "moment": "~2.6.0", "mongoose": "~3.8.8", - "mongoose-unique-validator": "~0.3.0", "mongoose-lifecycle": "~1.0.0", - "knox": "~0.8.10", - "moment": "~2.6.0", - "html-entities": "~1.0.10", + "mongoose-unique-validator": "~0.3.0", + "monk": "~0.7.1", "multer": "~0.1.0", - "body-parser": "1.3.0", - "marked": "~0.3.2", - "emailjs": "~0.3.6", - "intro.js": "^0.9.0" + "node-restful": "~0.1.14", + "passport": "~0.2.0", + "passport-facebook": "~1.0.3", + "passport-local": "~1.0.0", + "passport-twitter": "~1.0.2", + "passport.socketio": "~3.0.1", + "socket.io": "~0.9.16", + "useful-string": "0.0.1", + "xml2js": "^0.4.4" }, "devDependencies": { "grunt": "~0.4.1", diff --git a/server/index.js b/server/index.js index a14eaab..0f4941a 100644 --- a/server/index.js +++ b/server/index.js @@ -70,6 +70,7 @@ site.setup = function(){ app.all('*', middleware.ensureLocals); app.all('*', middleware.ensureIP); + // where should this live? app.get('/subscribe/webhook', views.subscription.webhook); server = http.createServer(app) diff --git a/server/lib/views/subscription.js b/server/lib/views/subscription.js index e29e40d..251e217 100644 --- a/server/lib/views/subscription.js +++ b/server/lib/views/subscription.js @@ -6,7 +6,15 @@ var User = require('../schemas/User'), middleware = require('../middleware'), util = require('../util'), _ = require('lodash'), - moment = require('moment'); + moment = require('moment'), + xml2js = require('xml2js'); + +var parser = new xml2js.Parser(); +// fs.readFile('./foo.xml', function(err, data) { +// parser.parseString(data, function (err, result) { +// console.log(inspect(result, { colors: true, depth: Infinity })); +// }); +// }); var subscription = module.exports = { @@ -24,18 +32,73 @@ var subscription = module.exports = { middleware: { }, - helpers: { - project: function(project){ - project = project.toObject() - project.date = moment( project.updated_at || project.created_at ).format("M/DD/YYYY hh:mm a") - project.user = {} - return project - }, - }, + fields: [ + "new_account_notification", + "canceled_account_notification", + "billing_info_updated_notification", + "reactivated_account_notification", + "new_invoice_notification", + "closed_invoice_notification", + "past_due_invoice_notification", + "new_subscription_notification", + "updated_subscription_notification", + "canceled_subscription_notification", + "expired_subscription_notification", + "renewed_subscription_notification", + "successful_payment_notification", + "failed_payment_notification", + "successful_refund_notification", + "void_payment_notification", + ], + + callbacks: { + // accounts + new_account_notification: function(data){ + }, + canceled_account_notification: function(data){ + }, + billing_info_updated_notification: function(data){ + }, + reactivated_account_notification: function(data){ + }, + + // invoices + new_invoice_notification: function(data){ + }, + closed_invoice_notification: function(data){ + }, + past_due_invoice_notification: function(data){ + }, + + // subscriptions + new_subscription_notification: function(data){ + }, + updated_subscription_notification: function(data){ + }, + canceled_subscription_notification: function(data){ + }, + expired_subscription_notification: function(data){ + }, + renewed_subscription_notification: function(data){ + }, + + // payments + successful_payment_notification: function(data){ + }, + failed_payment_notification: function(data){ + }, + successful_refund_notification: function(data){ + }, + void_payment_notification: function(data){ + }, + }, // need a route for the webhook, // then calls to get appropriate info from the recurly api webhook: function(req, res){ res.status(200).end() + parser.parseString(data, function (err, result) { + console.log(inspect(result, { colors: true, depth: Infinity })); + }); }, } -- cgit v1.2.3-70-g09d2 From ffa627b1032f9244df8c685c86fd24f3e7c2881a Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Mon, 12 Jan 2015 23:35:57 -0500 Subject: etc --- server/lib/views/subscription.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'server/lib/views') diff --git a/server/lib/views/subscription.js b/server/lib/views/subscription.js index 251e217..b9c79cb 100644 --- a/server/lib/views/subscription.js +++ b/server/lib/views/subscription.js @@ -18,39 +18,35 @@ var parser = new xml2js.Parser(); var subscription = module.exports = { - fields: { - user: "_id username displayName photo created_at updated_at last_seen created_ip last_ip", - }, - - defaults: { - user: { - _id: "", username: "", displayName: "", - created_at: "", updated_at: "", created_ip: "", last_ip: "", - }, - }, - - middleware: { - }, - fields: [ + // accounts "new_account_notification", "canceled_account_notification", "billing_info_updated_notification", "reactivated_account_notification", + + // invoices "new_invoice_notification", "closed_invoice_notification", "past_due_invoice_notification", + + // subscriptions "new_subscription_notification", "updated_subscription_notification", "canceled_subscription_notification", "expired_subscription_notification", "renewed_subscription_notification", + + // payments "successful_payment_notification", "failed_payment_notification", "successful_refund_notification", "void_payment_notification", ], + middleware: { + }, + callbacks: { // accounts new_account_notification: function(data){ @@ -99,6 +95,11 @@ var subscription = module.exports = { res.status(200).end() parser.parseString(data, function (err, result) { console.log(inspect(result, { colors: true, depth: Infinity })); + for (var i in data) { + if (subscription.callbacks[i]) { + subscription.callbacks[i](data) + } + } }); }, } -- cgit v1.2.3-70-g09d2 From 717e87b7422db8e1eda655fbf04e45fe5f877c9b Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 20 Jan 2015 00:10:23 -0500 Subject: combining webhook stuff --- package.json | 1 + server/index.js | 3 -- server/lib/api/profile.js | 1 + server/lib/schemas/Subscription.js | 1 + server/lib/schemas/User.js | 4 +- server/lib/views/index.js | 1 - server/lib/views/subscription.js | 105 ------------------------------------- server/lib/webhook/config.js | 6 +++ server/lib/webhook/index.js | 88 +++++++++++++++++++++++++++++++ 9 files changed, 100 insertions(+), 110 deletions(-) delete mode 100644 server/lib/views/subscription.js create mode 100644 server/lib/webhook/config.js create mode 100644 server/lib/webhook/index.js (limited to 'server/lib/views') diff --git a/package.json b/package.json index 34e0c4c..8afb96e 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "mongoose-unique-validator": "~0.3.0", "monk": "~0.7.1", "multer": "~0.1.0", + "node-recurly": "^2.1.0", "node-restful": "~0.1.14", "passport": "~0.2.0", "passport-facebook": "~1.0.3", diff --git a/server/index.js b/server/index.js index 0f4941a..9a9323c 100644 --- a/server/index.js +++ b/server/index.js @@ -70,9 +70,6 @@ site.setup = function(){ app.all('*', middleware.ensureLocals); app.all('*', middleware.ensureIP); - // where should this live? - app.get('/subscribe/webhook', views.subscription.webhook); - server = http.createServer(app) server.listen(app.get('port'), function () { console.log('Express server listening on port ' + app.get('port')); diff --git a/server/lib/api/profile.js b/server/lib/api/profile.js index 996505f..d72a2c3 100644 --- a/server/lib/api/profile.js +++ b/server/lib/api/profile.js @@ -32,6 +32,7 @@ var profile = { delete data.old_password delete data.new_password delete data.isStaff + delete data.plan_level data.updated_at = new Date () if (req.files.avatar) { diff --git a/server/lib/schemas/Subscription.js b/server/lib/schemas/Subscription.js index 8315009..7f2579b 100644 --- a/server/lib/schemas/Subscription.js +++ b/server/lib/schemas/Subscription.js @@ -15,6 +15,7 @@ var SubscriptionSchema = new mongoose.Schema({ plans: [{ tier: { type: String }, monthly: { type: Boolean }, + projects: [{ type: mongoose.Schema.ObjectId }], }], created_at: { type: Date, default: Date.now }, diff --git a/server/lib/schemas/User.js b/server/lib/schemas/User.js index 180a140..ae1d912 100644 --- a/server/lib/schemas/User.js +++ b/server/lib/schemas/User.js @@ -54,7 +54,9 @@ var UserSchema = new mongoose.Schema({ type: String, default: "", }, - + + plan_level: { type: Number, default: 0 }, + location: { type: String, default: "" }, photo: { type: String, default: "" }, bio: { type: String, default: "" }, diff --git a/server/lib/views/index.js b/server/lib/views/index.js index 2a8f921..0ce0357 100644 --- a/server/lib/views/index.js +++ b/server/lib/views/index.js @@ -22,7 +22,6 @@ marked.setOptions({ var views = module.exports = { staff: require('./staff'), - subscription: require('./subscription'), editor_new: function (req, res) { if (! req.user) { diff --git a/server/lib/views/subscription.js b/server/lib/views/subscription.js deleted file mode 100644 index b9c79cb..0000000 --- a/server/lib/views/subscription.js +++ /dev/null @@ -1,105 +0,0 @@ -/* jshint node: true */ - -var User = require('../schemas/User'), - Subscription = require('../schemas/Subscription'), - config = require('../../../config'), - middleware = require('../middleware'), - util = require('../util'), - _ = require('lodash'), - moment = require('moment'), - xml2js = require('xml2js'); - -var parser = new xml2js.Parser(); -// fs.readFile('./foo.xml', function(err, data) { -// parser.parseString(data, function (err, result) { -// console.log(inspect(result, { colors: true, depth: Infinity })); -// }); -// }); - -var subscription = module.exports = { - - fields: [ - // accounts - "new_account_notification", - "canceled_account_notification", - "billing_info_updated_notification", - "reactivated_account_notification", - - // invoices - "new_invoice_notification", - "closed_invoice_notification", - "past_due_invoice_notification", - - // subscriptions - "new_subscription_notification", - "updated_subscription_notification", - "canceled_subscription_notification", - "expired_subscription_notification", - "renewed_subscription_notification", - - // payments - "successful_payment_notification", - "failed_payment_notification", - "successful_refund_notification", - "void_payment_notification", - ], - - middleware: { - }, - - callbacks: { - // accounts - new_account_notification: function(data){ - }, - canceled_account_notification: function(data){ - }, - billing_info_updated_notification: function(data){ - }, - reactivated_account_notification: function(data){ - }, - - // invoices - new_invoice_notification: function(data){ - }, - closed_invoice_notification: function(data){ - }, - past_due_invoice_notification: function(data){ - }, - - // subscriptions - new_subscription_notification: function(data){ - }, - updated_subscription_notification: function(data){ - }, - canceled_subscription_notification: function(data){ - }, - expired_subscription_notification: function(data){ - }, - renewed_subscription_notification: function(data){ - }, - - // payments - successful_payment_notification: function(data){ - }, - failed_payment_notification: function(data){ - }, - successful_refund_notification: function(data){ - }, - void_payment_notification: function(data){ - }, - }, - - // need a route for the webhook, - // then calls to get appropriate info from the recurly api - webhook: function(req, res){ - res.status(200).end() - parser.parseString(data, function (err, result) { - console.log(inspect(result, { colors: true, depth: Infinity })); - for (var i in data) { - if (subscription.callbacks[i]) { - subscription.callbacks[i](data) - } - } - }); - }, -} diff --git a/server/lib/webhook/config.js b/server/lib/webhook/config.js new file mode 100644 index 0000000..ecafeb3 --- /dev/null +++ b/server/lib/webhook/config.js @@ -0,0 +1,6 @@ +module.exports = { + API_KEY: require('process').env['VVALLS_RECURLY_SECRET'], + SUBDOMAIN: 'vvalls', + ENVIRONMENT: 'sandbox', + DEBUG: true, +}; diff --git a/server/lib/webhook/index.js b/server/lib/webhook/index.js new file mode 100644 index 0000000..c4b4b76 --- /dev/null +++ b/server/lib/webhook/index.js @@ -0,0 +1,88 @@ +// // where should this live? +// app.get('/subscribe/webhook', views.subscription.webhook); + +/* jshint node: true */ + +var User = require('../schemas/User'), + Subscription = require('../schemas/Subscription'), + config = require('../../../config'), + middleware = require('../middleware'), + util = require('../util'), + _ = require('lodash'), + moment = require('moment'), + xml2js = require('xml2js'), + Recurly = require('node-recurly'), + recurly = new Recurly(require('./config')); + +var parser = new xml2js.Parser(); +// fs.readFile('./foo.xml', function(err, data) { +// parser.parseString(data, function (err, result) { +// console.log(inspect(result, { colors: true, depth: Infinity })); +// }); +// }); + +/* +app.use(express.basicAuth(function(user, pass, callback) { + var result = (user === 'testUser' && pass === 'testPass'); + callback(null, result); +})); +*/ + +var subscription = module.exports = { + + callbacks: { + // accounts + new_account_notification: function(data){ + }, + canceled_account_notification: function(data){ + }, + billing_info_updated_notification: function(data){ + }, + reactivated_account_notification: function(data){ + }, + + // invoices + new_invoice_notification: function(data){ + }, + closed_invoice_notification: function(data){ + }, + past_due_invoice_notification: function(data){ + }, + + // subscriptions + new_subscription_notification: function(data){ + }, + updated_subscription_notification: function(data){ + }, + canceled_subscription_notification: function(data){ + }, + expired_subscription_notification: function(data){ + }, + renewed_subscription_notification: function(data){ + }, + + // payments + successful_payment_notification: function(data){ + }, + failed_payment_notification: function(data){ + }, + successful_refund_notification: function(data){ + }, + void_payment_notification: function(data){ + }, + }, + + // need a route for the webhook, + // then calls to get appropriate info from the recurly api + webhook: function(req, res){ + res.status(200).end() + parser.parseString(data, function (err, result) { + console.log(inspect(result, { colors: true, depth: Infinity })); + for (var i in data) { + if (subscription.callbacks[i]) { + subscription.callbacks[i](data[i]) + } + } + }); + }, +} -- cgit v1.2.3-70-g09d2