Skip to content

Commit 716768b

Browse files
Remove legacy CiviCRM version support from extension.
Going forwards each release will support the current latest. Older releases will continue to support older versions
1 parent 31f0051 commit 716768b

File tree

6 files changed

+15
-634
lines changed

6 files changed

+15
-634
lines changed

CRM/Core/Page/PaymentPage.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@ public function run() {
2121
$formData = $this->getTransparentRedirectFormData(CRM_Utils_Request::retrieve('key', 'String', CRM_Core_DAO::$_nullObject, TRUE));
2222
$paymentProcessorID = $formData['payment_processor_id'];
2323
$paymentProcessor = civicrm_api3('payment_processor', 'getsingle', array('id' => $paymentProcessorID));
24-
if (omnipaymultiprocessor__versionAtLeast(4.7)) {
25-
$processor = Civi\Payment\System::singleton()->getByProcessor($paymentProcessor);
26-
}
27-
else {
28-
$processor = CRM_Core_Payment::singleton('contribute', $paymentProcessor);
29-
}
24+
25+
$processor = Civi\Payment\System::singleton()->getByProcessor($paymentProcessor);
26+
3027
$displayFields = $processor->getTransparentDirectDisplayFields();
3128
foreach ($displayFields as $fieldName => $displayField) {
3229
if ($displayField['htmlType'] == 'date') {

CRM/Core/Payment/OmnipayMultiProcessor.php

Lines changed: 1 addition & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ private function saveBillingAddressIfRequired($params) {
265265
* @return bool
266266
*/
267267
private function hasBillingAddressFields($params) {
268-
$billingFields = array_intersect_key($params, array_flip($this->getBillingAddressFieldsPre47()));
268+
$billingFields = array_intersect_key($params, array_flip($this->getBillingAddressFields()));
269269
return !empty($billingFields);
270270
}
271271

@@ -446,38 +446,6 @@ public function getPaymentFormFields() {
446446
return $this->_paymentProcessor['payment_type'] == 1 ? $this->getCreditCardFormFields() : $this->getDirectDebitFormFields();
447447
}
448448

449-
/**
450-
* Get name for the payment information type.
451-
* @todo - use option group + name field (like Omnipay does)
452-
* @return string
453-
*/
454-
public function getPaymentTypeName() {
455-
return $this->_paymentProcessor['payment_type'] == 1 ? 'credit_card' : 'direct_debit';
456-
}
457-
458-
/**
459-
* Get label for the payment information type.
460-
*
461-
* We are overriding this for the transparent redirect use case.
462-
* Cybersource (our current example) adds billing details which is what we
463-
* are calling this here.
464-
*
465-
* @return string
466-
*/
467-
public function getPaymentTypeLabel() {
468-
switch ($this->_paymentProcessor['payment_type']) {
469-
case 1:
470-
return 'Credit Card';
471-
472-
case 2:
473-
return 'Direct Debit';
474-
475-
default:
476-
return 'Billing';
477-
}
478-
return $this->_paymentProcessor['payment_type'] == 1 ? 'Credit Card' : 'Direct Debit';
479-
}
480-
481449
/**
482450
* Get billing fields required for this block.
483451
*
@@ -632,147 +600,6 @@ public function getBillingAddressFields($billingLocationID = NULL) {
632600
return $billingFields;
633601
}
634602

635-
/**
636-
* Get core CiviCRM address fields.
637-
*
638-
* @return array
639-
*/
640-
private function getBillingAddressFieldsPre47() {
641-
$billingFields = array();
642-
foreach (array(
643-
'street_address',
644-
'city',
645-
'state_province_id',
646-
'postal_code',
647-
'country_id',
648-
) as $addressField) {
649-
$billingFields[$addressField] = 'billing_' . $addressField . '-' . CRM_Core_BAO_LocationType::getBilling();
650-
}
651-
return $billingFields;
652-
}
653-
654-
/**
655-
* Get metadata for payment form fields.
656-
*
657-
* @return array
658-
*/
659-
public function getPaymentFormFieldsMetadata() {
660-
// @todo - handle redirect for 4.7
661-
return parent::getPaymentFormFieldsMetadata();
662-
return self::getBillingAddressFieldsMetadataPre47();
663-
}
664-
665-
/**
666-
* Get form metadata for address fields.
667-
*
668-
* At the moment this is being called from getPaymentFormFields when we are
669-
* dealing with a transparent redirect. It is a bit Cybersource use-casey.
670-
*
671-
* @return array
672-
* Array of metadata for address fields.
673-
*/
674-
public function getBillingAddressFieldsMetadataPre47() {
675-
$metadata = array();
676-
$billingID = CRM_Core_BAO_LocationType::getBilling();
677-
$metadata['billing_first_name'] = array(
678-
'htmlType' => 'text',
679-
'name' => 'billing_first_name',
680-
'title' => ts('Billing First Name'),
681-
'cc_field' => TRUE,
682-
'attributes' => array(
683-
'size' => 30,
684-
'maxlength' => 60,
685-
'autocomplete' => 'off',
686-
),
687-
'is_required' => TRUE,
688-
);
689-
690-
$metadata['billing_middle_name'] = array(
691-
'htmlType' => 'text',
692-
'name' => 'billing_middle_name',
693-
'title' => ts('Billing Middle Name'),
694-
'cc_field' => TRUE,
695-
'attributes' => array(
696-
'size' => 30,
697-
'maxlength' => 60,
698-
'autocomplete' => 'off',
699-
),
700-
'is_required' => FALSE,
701-
);
702-
703-
$metadata['billing_last_name'] = array(
704-
'htmlType' => 'text',
705-
'name' => 'billing_last_name',
706-
'title' => ts('Billing Last Name'),
707-
'cc_field' => TRUE,
708-
'attributes' => array(
709-
'size' => 30,
710-
'maxlength' => 60,
711-
'autocomplete' => 'off',
712-
),
713-
'is_required' => TRUE,
714-
);
715-
716-
$metadata["billing_street_address-{$billingID}"] = array(
717-
'htmlType' => 'text',
718-
'name' => "billing_street_address-{$billingID}",
719-
'title' => ts('Street Address'),
720-
'cc_field' => TRUE,
721-
'attributes' => array(
722-
'size' => 30,
723-
'maxlength' => 60,
724-
'autocomplete' => 'off',
725-
),
726-
'is_required' => TRUE,
727-
);
728-
729-
$metadata["billing_city-{$billingID}"] = array(
730-
'htmlType' => 'text',
731-
'name' => "billing_city-{$billingID}",
732-
'title' => ts('City'),
733-
'cc_field' => TRUE,
734-
'attributes' => array(
735-
'size' => 30,
736-
'maxlength' => 60,
737-
'autocomplete' => 'off',
738-
),
739-
'is_required' => TRUE,
740-
);
741-
742-
$metadata["billing_state_province_id-{$billingID}"] = array(
743-
'htmlType' => 'chainSelect',
744-
'title' => ts('State/Province'),
745-
'name' => "billing_state_province_id-{$billingID}",
746-
'cc_field' => TRUE,
747-
'is_required' => TRUE,
748-
);
749-
750-
$metadata["billing_postal_code-{$billingID}"] = array(
751-
'htmlType' => 'text',
752-
'name' => "billing_postal_code-{$billingID}",
753-
'title' => ts('Postal Code'),
754-
'cc_field' => TRUE,
755-
'attributes' => array(
756-
'size' => 30,
757-
'maxlength' => 60,
758-
'autocomplete' => 'off',
759-
),
760-
'is_required' => TRUE,
761-
);
762-
763-
$metadata["billing_country_id-{$billingID}"] = array(
764-
'htmlType' => 'select',
765-
'name' => "billing_country_id-{$billingID}",
766-
'title' => ts('Country'),
767-
'cc_field' => TRUE,
768-
'attributes' => array(
769-
'' => ts('- select -'),
770-
) + CRM_Core_PseudoConstant::country(),
771-
'is_required' => TRUE,
772-
);
773-
return $metadata;
774-
}
775-
776603
/**
777604
* Handle response from processor.
778605
*
@@ -933,9 +760,6 @@ protected function redirectOrExit($outcome) {
933760
* @throws \CiviCRM_API3_Exception
934761
*/
935762
protected function storePaymentToken($params, $contribution, $tokenReference) {
936-
if (!omnipaymultiprocessor__versionAtLeast(4.6)) {
937-
return;
938-
}
939763
$contributionRecurID = $contribution['contribution_recur_id'];
940764
$token = civicrm_api3('payment_token', 'create', array(
941765
'contact_id' => $contribution['contact_id'],

CRM/Core/Payment/PaymentExtended.php

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -182,26 +182,13 @@ protected function getGoBackUrl($qfKey) {
182182
* URL to notify outcome of transaction.
183183
*/
184184
protected function getNotifyUrl($allowLocalHost = FALSE) {
185-
if (omnipaymultiprocessor__versionAtLeast(4.6)) {
186-
$url = CRM_Utils_System::url(
187-
'civicrm/payment/ipn/' . $this->transaction_id . '/' . $this->_paymentProcessor['id'],
188-
array(),
189-
TRUE,
190-
NULL,
191-
FALSE
192-
);
193-
}
194-
else {
195-
$url = CRM_Utils_System::url(
196-
'civicrm/payment/ipn',
197-
array(
198-
'processor_id' => $this->_paymentProcessor['id'],
199-
),
200-
TRUE,
201-
NULL,
202-
FALSE
203-
);
204-
}
185+
$url = CRM_Utils_System::url(
186+
'civicrm/payment/ipn/' . $this->transaction_id . '/' . $this->_paymentProcessor['id'],
187+
array(),
188+
TRUE,
189+
NULL,
190+
FALSE
191+
);
205192
return $allowLocalHost ? $url : ((stristr($url, '.')) ? $url : '');
206193
}
207194

@@ -288,20 +275,12 @@ protected function handleError($level, $message, $context, $errorCode = 9001, $u
288275
// Reset gateway to NULL so don't cache it. The size of the object or closures within it could
289276
// cause problems when serializing & saving.
290277
$this->gateway = NULL;
291-
if (omnipaymultiprocessor__versionAtLeast(4.5)) {
292-
$log = new CRM_Utils_SystemLogger();
293-
$log->log($level, $message, (array) $context);
294-
}
295-
else {
296-
CRM_Core_Error::debug($errorCode . ': ' . $message . print_r($context, TRUE));
297-
}
278+
$log = new CRM_Utils_SystemLogger();
279+
$log->log($level, $message, (array) $context);
280+
298281
$userMessage = $userMessage ? $userMessage : $message;
299282
CRM_Core_Session::setStatus($userMessage);
300-
if (omnipaymultiprocessor__versionAtLeast(4.7)) {
301-
throw new \Civi\Payment\Exception\PaymentProcessorException($userMessage);
302-
}
303-
304-
return new CRM_Core_Error();
283+
throw new \Civi\Payment\Exception\PaymentProcessorException($userMessage);
305284
}
306285

307286
/**

info.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
<version>1.9</version>
1919
<develStage>stable</develStage>
2020
<compatibility>
21-
<ver>4.4</ver>
22-
<ver>4.5</ver>
23-
<ver>4.6</ver>
2421
<ver>4.7</ver>
2522
</compatibility>
2623
<comments>This module integrates the omnipay library with CiviCRM</comments>

0 commit comments

Comments
 (0)