Describe the bug
When a PayPal payment subscription fails, sometimes there are two IPN sent. This is a case where the payment fails and the admin would receive the email from PayPal "An automatic payment failed. You didn't get your money."
The first IPN sent in this scenario has the IPN txn_type recurring_payment_failed the value for the next_payment_date is one year out. Then, a second IPN is sent with the txn_type recurring_payment_profile_cancel and the value for the next_payment_date is "N/A".
We should probably add logic before this line to first process the IPN txn_type recurring_payment_failed and use the built-in pmpro_next_payment function to cancel immediately.
Describe the bug When a PayPal payment subscription fails, sometimes there are two IPN sent. This is a case where the payment fails and the admin would receive the email from PayPal "An automatic payment failed. You didn't get your money."
The first IPN sent in this scenario has the IPN txn_type
recurring_payment_failed
the value for thenext_payment_date
is one year out. Then, a second IPN is sent with the txn_typerecurring_payment_profile_cancel
and the value for thenext_payment_date
is "N/A".The CONPD code here (https://github.com/strangerstudios/pmpro-cancel-on-next-payment-date/blob/dev/pmpro-cancel-on-next-payment-date.php#L50) processes the logic to set cancellation on next payment date one year out when the first IPN is received. The second IPN is ignored.
We should probably add logic before this line to first process the IPN txn_type
recurring_payment_failed
and use the built-inpmpro_next_payment
function to cancel immediately.