diff --git a/CRM/Core/Payment/StripeIPN.php b/CRM/Core/Payment/StripeIPN.php index 70e52b15ee63cfc16e1b19fa6249a9af0adb5627..51cae3546bbc800404e942ffefde76281bd3624b 100644 --- a/CRM/Core/Payment/StripeIPN.php +++ b/CRM/Core/Payment/StripeIPN.php @@ -362,24 +362,7 @@ class CRM_Core_Payment_StripeIPN { return TRUE; case 'customer.subscription.updated': - if (!$this->getSubscriptionDetails()) { - // Not matched with an existing subscription in CiviCRM - return TRUE; - } - if (empty($this->previous_plan_id)) { - // Not a plan change...don't care. - return TRUE; - } - - // The Stripe "plan" has been changed. Update the following information within CiviCRM: - // Amount, frequency_unit, frequency_interval - civicrm_api3('ContributionRecur', 'create', [ - 'id' => $this->contribution_recur_id, - 'amount' => $this->plan_amount, - 'auto_renew' => 1, - 'frequency_unit' => $this->frequency_unit, - 'frequency_interval' => $this->frequency_interval, - ]); + // Subscription is updated. This used to be "implemented" but didn't work return TRUE; case 'customer.subscription.deleted': @@ -483,7 +466,6 @@ class CRM_Core_Payment_StripeIPN { } return FALSE; } - $this->previous_plan_id = CRM_Stripe_Api::getParam('previous_plan_id', $this->_inputParameters); $this->plan_amount = $this->retrieve('plan_amount', 'String', FALSE); $this->frequency_interval = $this->retrieve('frequency_interval', 'String', FALSE); $this->frequency_unit = $this->retrieve('frequency_unit', 'String', FALSE); diff --git a/CRM/Stripe/Api.php b/CRM/Stripe/Api.php index 5e79f5a87be7c84538015a65ee55ac66ffb4c685..08204c5475a7b8340164d3d3bcabfabff1546d6e 100644 --- a/CRM/Stripe/Api.php +++ b/CRM/Stripe/Api.php @@ -182,12 +182,6 @@ class CRM_Stripe_Api { case 'id': return (string) $stripeObject->id; - - case 'previous_plan_id': - if (preg_match('/\.updated$/', $stripeObject->type)) { - return (string) $stripeObject->data->previous_attributes->plan->id; - } - break; } return NULL; } diff --git a/docs/releasenotes.md b/docs/releasenotes.md index d7c019063695a7f35b8c782f269dd882e174893b..e2306835bd57549125c41758c475013e1559988f 100644 --- a/docs/releasenotes.md +++ b/docs/releasenotes.md @@ -11,7 +11,7 @@ Releases use the following numbering system: ## Release 6.5.7 (not yet released 2021-01-23) -* Don't change 'created_date' when subscription is updated. +* Remove handling for `customer.subscription.updated` webhooks - they were not working and could lead to broken recurring contributions. * Rename ProcessStripe job to "Stripe: Cleanup". ## Release 6.5.6 diff --git a/info.xml b/info.xml index 0ec76125ad9468b5e585f2d27d3ec37cb5c6c4f4..6c1121156fc7377aa17a9f4b21e3ac0e7d25a06f 100644 --- a/info.xml +++ b/info.xml @@ -15,7 +15,7 @@ <author>Matthew Wire (MJW Consulting)</author> <email>mjw@mjwconsult.co.uk</email> </maintainer> - <releaseDate>2021-01-23</releaseDate> + <releaseDate>2021-02-07</releaseDate> <version>6.5.7-dev</version> <develStage>beta</develStage> <compatibility> diff --git a/stripe.php b/stripe.php index 79059ed489cb12a8da92195782c23382c9979f82..f1d32269c3d2d0cf9f678541d635122b5c6fa9c9 100644 --- a/stripe.php +++ b/stripe.php @@ -10,7 +10,7 @@ */ require_once 'stripe.civix.php'; -require_once __DIR__.'/vendor/autoload.php'; +require_once __DIR__ . '/vendor/autoload.php'; use CRM_Stripe_ExtensionUtil as E;