X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FPayment%2FPayPalImpl.php;h=0af967fd7dac5d77898728de15a47b19bb9a74ab;hb=3a1ac5e5b567f155a28311060e126a12db72db12;hp=68a4b168d2ed588baecfcda90a1425babbd22819;hpb=9fc166d0859b59ef6d95da7fe485d1749e12d511;p=civicrm-core.git diff --git a/CRM/Core/Payment/PayPalImpl.php b/CRM/Core/Payment/PayPalImpl.php index 68a4b168d2..0af967fd7d 100644 --- a/CRM/Core/Payment/PayPalImpl.php +++ b/CRM/Core/Payment/PayPalImpl.php @@ -124,7 +124,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { * Billing mode button is basically synonymous with paypal express - this is probably a good example of 'odds & sods' code we * need to find a way for the payment processor to assign. A tricky aspect is that the payment processor may need to set the order * - * @param $form + * @param CRM_Core_Form $form */ protected function addPaypalExpressCode(&$form) { if (empty($form->isBackOffice)) { @@ -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 * @@ -936,6 +951,21 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { return $result; } + /** + * Get array of fields that should be displayed on the payment form. + * + * @return array + * @throws CiviCRM_API3_Exception + */ + public function getPaymentFormFields() { + if ($this->_processorName == ts('PayPal Pro')) { + return $this->getCreditCardFormFields(); + } + else { + return array(); + } + } + /** * Map the paypal params to CiviCRM params using a field map. *