Add check for existing key index in table
[civicrm-core.git] / CRM / Core / Payment.php
index c26f8f4a0ca217940f26ef72f25b27908fa5685f..0bfe0c2d2ec4788790076f2a2687c836e0d2abfa 100644 (file)
@@ -60,6 +60,18 @@ abstract class CRM_Core_Payment {
     BILLING_MODE_BUTTON = 2,
     BILLING_MODE_NOTIFY = 4;
 
+  /**
+   * Which payment type(s) are we using?
+   *
+   * credit card
+   * direct debit
+   * or both
+   * @todo create option group - nb omnipay uses a 3rd type - transparent redirect cc
+   */
+  const
+    PAYMENT_TYPE_CREDIT_CARD = 1,
+    PAYMENT_TYPE_DIRECT_DEBIT = 2;
+
   /**
    * Subscription / Recurring payment Status
    * START, END
@@ -779,8 +791,16 @@ abstract class CRM_Core_Payment {
         'attributes' => array(
           'size' => 4,
           'maxlength' => 4,
+          'minlength' => 4,
           'autocomplete' => 'off',
         ),
+        'rules' => array(
+          array(
+            'rule_message' => ts('Please enter valid last 4 digit card number.'),
+            'rule_name' => 'numeric',
+            'rule_parameters' => NULL,
+          ),
+        ),
       ),
     );
   }