Skip to content
Snippets Groups Projects
Commit abd7f702 authored by mattwire's avatar mattwire
Browse files

Code cleanup

parent a0277735
No related branches found
No related tags found
1 merge request!1246.5
...@@ -897,7 +897,7 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment { ...@@ -897,7 +897,7 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
private function getDescription($params, $type = 'description') { private function getDescription($params, $type = 'description') {
$description = NULL; $description = NULL;
# See https://stripe.com/docs/statement-descriptors # See https://stripe.com/docs/statement-descriptors
$disallowed_characters = array('<', '>', '\\', "'", '"', '*'); $disallowed_characters = ['<', '>', '\\', "'", '"', '*'];
if (!isset(\Civi::$statics[__CLASS__]['description']['contact_contribution'])) { if (!isset(\Civi::$statics[__CLASS__]['description']['contact_contribution'])) {
\Civi::$statics[__CLASS__]['description']['contact_contribution'] = $params['contactID'] . '-' . ($params['contributionID'] ?? 'XX'); \Civi::$statics[__CLASS__]['description']['contact_contribution'] = $params['contactID'] . '-' . ($params['contributionID'] ?? 'XX');
......
...@@ -21,13 +21,6 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN { ...@@ -21,13 +21,6 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
*/ */
protected $_paymentProcessor; protected $_paymentProcessor;
/**
* Transaction ID is the contribution in the redirect flow and a random number in the on-site->POST flow
* Ideally the contribution id would always be created at this point in either flow for greater consistency
* @var
*/
protected $transaction_id;
// By default, always retrieve the event from stripe to ensure we are // By default, always retrieve the event from stripe to ensure we are
// not being fed garbage. However, allow an override so when we are // not being fed garbage. However, allow an override so when we are
// testing, we can properly test a failed recurring contribution. // testing, we can properly test a failed recurring contribution.
...@@ -58,8 +51,6 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN { ...@@ -58,8 +51,6 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
protected $plan_name = NULL; protected $plan_name = NULL;
protected $plan_start = NULL; protected $plan_start = NULL;
// Derived properties.
/** /**
* @var int The recurring contribution ID (linked to Stripe Subscription) (if available) * @var int The recurring contribution ID (linked to Stripe Subscription) (if available)
*/ */
...@@ -369,7 +360,6 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN { ...@@ -369,7 +360,6 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
* @throws \CRM_Core_Exception * @throws \CRM_Core_Exception
*/ */
public function setInfo() { public function setInfo() {
$abort = FALSE;
$stripeObjectName = get_class($this->_inputParameters->data->object); $stripeObjectName = get_class($this->_inputParameters->data->object);
$this->customer_id = CRM_Stripe_Api::getObjectParam('customer_id', $this->_inputParameters->data->object); $this->customer_id = CRM_Stripe_Api::getObjectParam('customer_id', $this->_inputParameters->data->object);
if (empty($this->customer_id)) { if (empty($this->customer_id)) {
...@@ -377,16 +367,17 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN { ...@@ -377,16 +367,17 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
} }
$this->previous_plan_id = CRM_Stripe_Api::getParam('previous_plan_id', $this->_inputParameters); $this->previous_plan_id = CRM_Stripe_Api::getParam('previous_plan_id', $this->_inputParameters);
$this->subscription_id = $this->retrieve('subscription_id', 'String', $abort); $this->subscription_id = $this->retrieve('subscription_id', 'String', FALSE);
$this->invoice_id = $this->retrieve('invoice_id', 'String', $abort); $this->invoice_id = $this->retrieve('invoice_id', 'String', FALSE);
$this->receive_date = $this->retrieve('receive_date', 'String', $abort); $this->receive_date = $this->retrieve('receive_date', 'String', FALSE);
$this->charge_id = $this->retrieve('charge_id', 'String', $abort); $this->charge_id = $this->retrieve('charge_id', 'String', FALSE);
$this->plan_id = $this->retrieve('plan_id', 'String', $abort); $this->plan_id = $this->retrieve('plan_id', 'String', FALSE);
$this->plan_amount = $this->retrieve('plan_amount', 'String', $abort); $this->plan_amount = $this->retrieve('plan_amount', 'String', FALSE);
$this->frequency_interval = $this->retrieve('frequency_interval', 'String', $abort); $this->frequency_interval = $this->retrieve('frequency_interval', 'String', FALSE);
$this->frequency_unit = $this->retrieve('frequency_unit', 'String', $abort); $this->frequency_unit = $this->retrieve('frequency_unit', 'String', FALSE);
$this->plan_name = $this->retrieve('plan_name', 'String', $abort); $this->plan_name = $this->retrieve('plan_name', 'String', FALSE);
$this->plan_start = $this->retrieve('plan_start', 'String', $abort); $this->plan_start = $this->retrieve('plan_start', 'String', FALSE);
$this->amount = $this->retrieve('amount', 'String', FALSE);
if (($stripeObjectName !== 'Stripe\Charge') && ($this->charge_id !== NULL)) { if (($stripeObjectName !== 'Stripe\Charge') && ($this->charge_id !== NULL)) {
$charge = \Stripe\Charge::retrieve($this->charge_id); $charge = \Stripe\Charge::retrieve($this->charge_id);
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
| and copyright information, see https://civicrm.org/licensing | | and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+ +--------------------------------------------------------------------+
*} *}
{* Manually create the CRM.vars.stripe here for drupal webform because \Civi::resources()->addVars() does not work in this context *} {* Manually create the CRM.vars.stripe here for drupal webform because \Civi::resources()->addVars() does not work in this context *}
{literal} {literal}
<script type="text/javascript"> <script type="text/javascript">
......
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