Skip to content
Snippets Groups Projects
Commit 752072ee authored by mattwire's avatar mattwire Committed by mattwire
Browse files

Fix #270 500 Internal Server error for the customer.subscription.updated event

parent 98231856
No related branches found
No related tags found
1 merge request!132Issue262
...@@ -46,11 +46,9 @@ class CRM_Core_Payment_StripeIPN { ...@@ -46,11 +46,9 @@ class CRM_Core_Payment_StripeIPN {
protected $customer_id = NULL; protected $customer_id = NULL;
protected $charge_id = NULL; protected $charge_id = NULL;
protected $previous_plan_id = NULL; protected $previous_plan_id = NULL;
protected $plan_id = NULL;
protected $plan_amount = NULL; protected $plan_amount = NULL;
protected $frequency_interval = NULL; protected $frequency_interval = NULL;
protected $frequency_unit = NULL; protected $frequency_unit = NULL;
protected $plan_name = NULL;
protected $plan_start = NULL; protected $plan_start = NULL;
/** /**
...@@ -356,7 +354,7 @@ class CRM_Core_Payment_StripeIPN { ...@@ -356,7 +354,7 @@ class CRM_Core_Payment_StripeIPN {
return TRUE; return TRUE;
case 'customer.subscription.updated': case 'customer.subscription.updated':
if (!$this->setInfo()) { if (!$this->getSubscriptionDetails()) {
return TRUE; return TRUE;
} }
if (empty($this->previous_plan_id)) { if (empty($this->previous_plan_id)) {
...@@ -430,16 +428,9 @@ class CRM_Core_Payment_StripeIPN { ...@@ -430,16 +428,9 @@ class CRM_Core_Payment_StripeIPN {
return FALSE; return FALSE;
} }
$this->previous_plan_id = CRM_Stripe_Api::getParam('previous_plan_id', $this->_inputParameters);
$this->invoice_id = $this->retrieve('invoice_id', 'String', FALSE); $this->invoice_id = $this->retrieve('invoice_id', 'String', FALSE);
$this->receive_date = $this->retrieve('receive_date', 'String', FALSE); $this->receive_date = $this->retrieve('receive_date', 'String', FALSE);
$this->charge_id = $this->retrieve('charge_id', 'String', FALSE); $this->charge_id = $this->retrieve('charge_id', 'String', FALSE);
$this->plan_id = $this->retrieve('plan_id', 'String', FALSE);
$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);
$this->plan_name = $this->retrieve('plan_name', 'String', FALSE);
$this->plan_start = $this->retrieve('plan_start', 'String', FALSE);
$this->amount = $this->retrieve('amount', 'String', FALSE); $this->amount = $this->retrieve('amount', 'String', FALSE);
if (($this->_inputParameters->data->object->object !== 'charge') && ($this->charge_id !== NULL)) { if (($this->_inputParameters->data->object->object !== 'charge') && ($this->charge_id !== NULL)) {
...@@ -481,6 +472,11 @@ class CRM_Core_Payment_StripeIPN { ...@@ -481,6 +472,11 @@ class CRM_Core_Payment_StripeIPN {
return FALSE; 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);
$this->plan_start = $this->retrieve('plan_start', 'String', FALSE);
return TRUE; return TRUE;
} }
......
...@@ -115,12 +115,6 @@ class CRM_Stripe_Api { ...@@ -115,12 +115,6 @@ class CRM_Stripe_Api {
case 'currency': case 'currency':
return (string) mb_strtoupper($stripeObject->plan->currency); return (string) mb_strtoupper($stripeObject->plan->currency);
case 'plan_id':
return (string) $stripeObject->plan->id;
case 'plan_name':
return (string) $stripeObject->plan->name;
case 'plan_start': case 'plan_start':
return self::formatDate($stripeObject->start_date); return self::formatDate($stripeObject->start_date);
......
...@@ -13,7 +13,7 @@ Releases use the following numbering system: ...@@ -13,7 +13,7 @@ Releases use the following numbering system:
* Fix [#258](https://lab.civicrm.org/extensions/stripe/-/issues/258) Credit card element doesn't load in "Submit credit card contribution" popup form on backend. * Fix [#258](https://lab.civicrm.org/extensions/stripe/-/issues/258) Credit card element doesn't load in "Submit credit card contribution" popup form on backend.
* Fix [#262](https://lab.civicrm.org/extensions/stripe/-/issues/262) Fix `customer.subscription.deleted` webhook event not working (500 internal server error). * Fix [#262](https://lab.civicrm.org/extensions/stripe/-/issues/262) Fix `customer.subscription.deleted` webhook event not working (500 internal server error).
* Fix [#270](https://lab.civicrm.org/extensions/stripe/-/issues/270) Fix 500 Internal Server error for the customer.subscription.updated event
## Release 6.5.2 ## Release 6.5.2
* [!129](https://lab.civicrm.org/extensions/stripe/-/merge_requests/129) Don't check inactive membership blocks for separate payment setting. * [!129](https://lab.civicrm.org/extensions/stripe/-/merge_requests/129) Don't check inactive membership blocks for separate payment setting.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment