From 4553a411f647d6ffa6472fb3b7395c79e340d751 Mon Sep 17 00:00:00 2001 From: Keith Holliday Date: Wed, 7 Jun 2017 10:31:44 -0700 Subject: [PATCH] Paypal ipn options (#8713) * Added more acceptable ipn cancelation options * Fixed lint issue * Fixed spelling issue --- website/server/libs/paypalPayments.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/website/server/libs/paypalPayments.js b/website/server/libs/paypalPayments.js index 2161436964..044983a7f0 100644 --- a/website/server/libs/paypalPayments.js +++ b/website/server/libs/paypalPayments.js @@ -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) {