CRM-16808 follow up - paypal express being validated as paypal pro
authoreileenmcnaugton <eileen@fuzion.co.nz>
Sat, 15 Aug 2015 19:48:57 +0000 (07:48 +1200)
committereileenmcnaugton <eileen@fuzion.co.nz>
Sat, 15 Aug 2015 19:54:39 +0000 (07:54 +1200)
CRM/Core/Payment/PayPalImpl.php

index 72e86d23e92fb852dee76427396151caef133246..0af967fd7dac5d77898728de15a47b19bb9a74ab 100644 (file)
@@ -155,6 +155,21 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
     return TRUE;
   }
 
+  /**
+   * 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.
+   *
+   * @param array $values
+   * @param array $errors
+   */
+  public function validatePaymentInstrument($values, &$errors) {
+    if ($this->_paymentProcessor['payment_processor_type'] == 'PayPal_Pro') {
+      CRM_Core_Payment_Form::validateCreditCard($values, $errors);
+    }
+  }
+
   /**
    * Express checkout code. Check PayPal documentation for more information
    *