Revert "CRM-15714 CiviContribute convert validateCreditCard to validatePaymentInstrument"
authorKurund Jalmi <kurund@civicrm.org>
Tue, 23 Dec 2014 19:20:33 +0000 (00:50 +0530)
committerKurund Jalmi <kurund@civicrm.org>
Tue, 23 Dec 2014 19:20:33 +0000 (00:50 +0530)
CRM/Contribute/Form/Contribution/Main.php
CRM/Contribute/Form/UpdateBilling.php
CRM/Core/Payment.php
CRM/Core/Payment/Form.php
CRM/Event/Cart/Form/Checkout/Payment.php
CRM/Event/Form/Participant.php
CRM/Event/Form/Registration/AdditionalParticipant.php
CRM/Event/Form/Registration/Register.php
CRM/Member/Form/Membership.php

index 1c4c339fd3d65d67897aca602a69ccab6007c019..4daba4f89bdb814e5bafe6d6dae7de63ea65398a 100644 (file)
@@ -1074,7 +1074,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     if (!empty($self->_paymentFields)) {
       CRM_Core_Form::validateMandatoryFields($self->_paymentFields, $fields, $errors);
     }
-    CRM_Core_Payment_Form::validatePaymentInstrument($fields, $errors, $self);
+    CRM_Core_Payment_Form::validateCreditCard($fields, $errors);
 
     foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
       if ($greetingType = CRM_Utils_Array::value($greeting, $fields)) {
index 638589226a44ae651ebe9c3e4caf05a152e3f8c0..46986518c6cfcf66ce6999fa9097e08846a3a5b1 100644 (file)
@@ -230,7 +230,7 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Core_Form {
     CRM_Core_Form::validateMandatoryFields($self->_fields, $fields, $errors);
 
     // make sure that credit card number and cvv are valid
-    CRM_Core_Payment_Form::validatePaymentInstrument($fields, $errors, $self);
+    CRM_Core_Payment_Form::validateCreditCard($fields, $errors);
 
     return empty($errors) ? TRUE : $errors;
   }
index 28cb94dc673fb856b30b02555b3cf7380f8ae754..c964ce2a9ea0717489b0298623fe5edc8c04c0a3 100644 (file)
@@ -194,17 +194,6 @@ abstract class CRM_Core_Payment {
     return FALSE;
   }
 
-  /**
-   * Default payment instrument validation
-   * Implement the usual Luhn algorithm via a static function in the CRM_Core_Payment_Form if it's a credit card
-   * Not a static function, because I need to check for payment_type
-   */
-  public function validatePaymentInstrument($values, &$errors) {
-    if ($this->_paymentProcessor['payment_type'] == 1) {
-      CRM_Core_Payment_Form::validateCreditCard($values, $errors);
-    }
-  }
-
   /**
    * Setter for the payment form that wants to use the processor
    *
index 5ca94e5055c5db9cf7de089b9891945984be6a53..72f863446a54ab2414059a461a1baa0bf84efa35 100644 (file)
@@ -312,17 +312,6 @@ class CRM_Core_Payment_Form {
     }
   }
 
-  /**
-   * Validate the payment instrument values before passing it to the payment processor
-   * We want this to be overrideable by the payment processor, and default to using
-   * this object's validCreditCard for credit cards (implemented as the default in the Payment class).
-   */
-  public function validatePaymentInstrument($values, &$errors, $form) {
-    $paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($values['payment_processor'],'live');
-    $payment = CRM_Core_Payment::singleton('live', $paymentProcessor, $form);
-    $payment->validatePaymentInstrument($values, $errors);
-  }
-
   /**
    * The credit card pseudo constant results only the CC label, not the key ID
    * So we normalize the name to use it as a CSS class.
index 001bc524477949dab976a0df1cdfe8af5e334177..6767bce06ba93139236b90c8215f82e45c5e2771 100644 (file)
@@ -400,7 +400,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart {
       CRM_Core_Form::validateMandatoryFields($self->_fields, $fields, $errors);
 
       // make sure that credit card number and cvv are valid
-      CRM_Core_Payment_Form::validatePaymentInstrument($fields, $errors, $self);
+      CRM_Core_Payment_Form::validateCreditCard($fields, $errors);
     }
 
     return empty($errors) ? TRUE : $errors;
index 91d23d6ac398b9524ad4592463c686b2308a9a6f..a57d376bea6703b5ec4df23428025d748c1ce471 100644 (file)
@@ -821,7 +821,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment
 
     if (!empty($values['payment_processor_id'])) {
       // make sure that credit card number and cvv are valid
-      CRM_Core_Payment_Form::validatePaymentInstrument($values, $errorMsg, $self);
+      CRM_Core_Payment_Form::validateCreditCard($values, $errorMsg);
     }
 
     if (!empty($values['record_contribution'])) {
index 35731a5b17767614565bc91d4554771dbaf72d38..40eb6fd667c785d11a56b6dc01f337b7a4e8140e 100644 (file)
@@ -552,7 +552,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R
     CRM_Core_Form::validateMandatoryFields($self->_fields, $fields, $errors);
 
     // make sure that credit card number and cvv are valid
-    CRM_Core_Payment_Form::validatePaymentInstrument($self->_params[0], $errors, $self);
+    CRM_Core_Payment_Form::validateCreditCard($self->_params[0], $errors);
 
     if ($errors) {
       return FALSE;
index 2dd0416785fee29213645232bf27b2dac03d69ee..aa68f9b115c982c02c1cf7868f0ca70fc34b6c76 100644 (file)
@@ -931,7 +931,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
       if (!empty($self->_paymentFields)) {
         CRM_Core_Form::validateMandatoryFields($self->_paymentFields, $fields, $errors);
       }
-      CRM_Core_Payment_Form::validatePaymentInstrument($fields, $errors, $self);
+      CRM_Core_Payment_Form::validateCreditCard($fields, $errors);
     }
 
     foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
index 38b3d6e432c127040fec20c570336183b0669af6..57ea44a997f80df36c9d5dcbb3a7e7a0faf93b95 100644 (file)
@@ -842,7 +842,7 @@ WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
 
     if (!empty($params['payment_processor_id'])) {
       // make sure that credit card number and cvv are valid
-      CRM_Core_Payment_Form::validatePaymentInstrument($params, $errors, $self);
+      CRM_Core_Payment_Form::validateCreditCard($params, $errors);
     }
 
     $joinDate = NULL;