Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-15714

validateCreditCard function makes too many assumptions

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.3.10, 4.4.9, 4.5
    • Fix Version/s: 4.6
    • Component/s: CiviContribute
    • Labels:
      None
    • Documentation Required?:
      Developer Doc

      Description

      the static function validateCreditCard in CRM/Core/Payment/Form.php is used as a form rule in a variety of mostly administrative payment forms. This causes problems for:

      1. SWIPE credit card processing, where the credit card number is passed in as an encrypted string (in combination with the credit card type and expiry).

      2. Non-credit-card payment processing. This is not currently an issue, since those forms generally have other ways that prevent the use of direct debit, but should be fixed for the future.

      The proper solution should involve:

      1. Changing the form rule to instead invoke a function of the payment object, e.g. $paymentObject::validatePaymentInstrument($values, &$errors)

      2. Set that function to default to invoking the existing function CRM_Core_Payment_Form::validateCreditCard

      3. Allow payment processors to override that function.

      For bonus points, maybe check for payment_type = 1 before invoking validateCreditCard in the default function in step 2.

        Attachments

          Activity

            People

            • Assignee:
              dgg David Greenberg
              Reporter:
              adixon Alan Dixon
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 2 days
                2d
                Remaining:
                Remaining Estimate - 2 days
                2d
                Logged:
                Time Spent - Not Specified
                Not Specified