From 383e392ff03679dc97e754f009747cfe59a75dd0 Mon Sep 17 00:00:00 2001 From: "B. Endres" Date: Fri, 22 Nov 2019 15:04:51 +0100 Subject: [PATCH] [#13] removed ::isSDD dependency from CiviSEPA --- CRM/Twingle/Form/Profile.php | 15 +-------------- CRM/Twingle/Tools.php | 2 +- api/v3/TwingleDonation/Cancel.php | 2 +- api/v3/TwingleDonation/Endrecurring.php | 2 +- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/CRM/Twingle/Form/Profile.php b/CRM/Twingle/Form/Profile.php index 59dee93..33fecfc 100644 --- a/CRM/Twingle/Form/Profile.php +++ b/CRM/Twingle/Form/Profile.php @@ -602,20 +602,7 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form { // enabled. if ( CRM_Twingle_Submission::civiSepaEnabled() - && ( - ( - method_exists('CRM_Sepa_Logic_PaymentInstruments', 'isSDD') - && CRM_Sepa_Logic_PaymentInstruments::isSDD(array( - 'payment_instrument_id' => $payment_instrument['value'], - )) - ) - || ( - method_exists('CRM_Sepa_Logic_Settings', 'isSDD') - && CRM_Sepa_Logic_Settings::isSDD(array( - 'payment_instrument_id' => $payment_instrument['value'], - )) - ) - ) + && CRM_Twingle_Tools::isSDD($payment_instrument['value']) ) { if (!isset(self::$_paymentInstruments['sepa'])) { self::$_paymentInstruments['sepa'] = E::ts('CiviSEPA'); diff --git a/CRM/Twingle/Tools.php b/CRM/Twingle/Tools.php index 6af1999..787d10c 100644 --- a/CRM/Twingle/Tools.php +++ b/CRM/Twingle/Tools.php @@ -55,7 +55,7 @@ class CRM_Twingle_Tools { 'id' => $recurring_contribution_id]); // check if this is a SEPA transaction - //if (self::isSDD($recurring_contribution['payment_instrument_id'])) return; + if (self::isSDD($recurring_contribution['payment_instrument_id'])) return; // check if it's really a termination (i.e. current status is 2 or 5) if (!in_array($recurring_contribution['contribution_status_id'], [2,5])) return; diff --git a/api/v3/TwingleDonation/Cancel.php b/api/v3/TwingleDonation/Cancel.php index 4883217..bfd49e3 100644 --- a/api/v3/TwingleDonation/Cancel.php +++ b/api/v3/TwingleDonation/Cancel.php @@ -97,7 +97,7 @@ function civicrm_api3_twingle_donation_Cancel($params) { // End SEPA mandate if applicable. if ( CRM_Twingle_Submission::civiSepaEnabled() - && CRM_Sepa_Logic_Settings::isSDD($contribution) + && CRM_Twingle_Tools::isSDD($contribution['payment_instrument_id']) ) { $mandate_id = CRM_Sepa_Logic_Settings::getMandateFor($contribution['id']); // Mandates can not be terminated in the past. diff --git a/api/v3/TwingleDonation/Endrecurring.php b/api/v3/TwingleDonation/Endrecurring.php index aa5d967..c5015cb 100644 --- a/api/v3/TwingleDonation/Endrecurring.php +++ b/api/v3/TwingleDonation/Endrecurring.php @@ -80,7 +80,7 @@ function civicrm_api3_twingle_donation_endrecurring($params) { // recurring contributions. if ( CRM_Twingle_Submission::civiSepaEnabled() - && CRM_Sepa_Logic_Settings::isSDD($contribution) + && CRM_Twingle_Tools::isSDD($contribution['payment_instrument_id']) ) { $mandate_id = CRM_Sepa_Logic_Settings::getMandateFor($contribution['id']); // Mandates can not be terminated in the past.