So far:
- I mode all my subscriptions into Blaze templates.
- I removed Iron Router and Added:
- meteorhacks:picker,
- kadira:flow-router,
- kadira:blaze-layout,
- arillo:flow-router-helpers.
- I changed a lot of layout and links
- I converted all but on server side routes to methods
So far so good.
The only issue I’m now having is with my one server side route I can’t get rid of – my paypal route. And this is where I’m having an issue.
Specifically once I converted my Iron Router route to a Picker route I get an error.
Here’s the Iron Router code that worked:
Router.route('/pp', function (req, res) {
var params = req.body || {};
// STEP 1: read POST data
// Must respond to PayPal IPN request with an empty 200 first
req.statusCode = 200;
res.end('OK');
// Step 2: POST IPN data back to PayPal to validate
Transactions.verify_org(params, {'allow_sandbox': false}, function callback(err, mes) {
if (err) {
console.log(err);
}
else {
if (params.payment_status == 'Completed') {
Fiber(function () {
if (params.payment_status === 'Completed') {
// can run this meteor call because it's inside a fiber
// do stuff with params
}
}
}).run();
}
}
});
}, {where: 'server'});
This is the first version of the Picker.route that doesn’t work. I basically just took what I had in IR.
if (Meteor.isServer) {
Picker.route('/pp', function (params, req, res, next) {
var params = req.body || {};
req.statusCode = 200;
res.end('OK');
Transactions.verify_org(params, {'allow_sandbox': false}, function callback(err, mes) {
if (err) console.log(err);
else {
if (params.payment_status == 'Completed') {
Fiber(function () {
// do stuff with params
}).run();
}
}
});
});
}
With the above I get the following error:
Posting back to paypal
[Error: IPN Verification status: INVALID]