Paypal ipn options (#8713)

* Added more acceptable ipn cancelation options

* Fixed lint issue

* Fixed spelling issue
This commit is contained in:
Keith Holliday 2017-06-07 10:31:44 -07:00 committed by Sabe Jones
parent 613f51b08d
commit 4553a411f6

View file

@ -231,7 +231,14 @@ api.ipn = async function ipnApi (options = {}) {
let {txn_type, recurring_payment_id} = options;
if (['recurring_payment_profile_cancel', 'subscr_cancel'].indexOf(txn_type) === -1) return;
let ipnAcceptableTypes = [
'recurring_payment_profile_cancel',
'recurring_payment_failed',
'recurring_payment_expired',
'subscr_cancel',
'subscr_failed'];
if (ipnAcceptableTypes.indexOf(txn_type) === -1) return;
// @TODO: Should this request billing date?
let user = await User.findOne({ 'purchased.plan.customerId': recurring_payment_id }).exec();
if (user) {