Merge pull request #4962 from totten/master-angular-ts
[civicrm-core.git] / CRM / Core / Payment.php
index d9550928d8d6055281255a2c776fb1affc4eff95..187f1c67eaf28d8d026647935b93c35f77f16a3d 100644 (file)
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 use Civi\Payment\System;
+
 /**
  *
  * @package CRM
@@ -33,7 +34,6 @@ use Civi\Payment\System;
  * $Id$
  *
  */
-
 abstract class CRM_Core_Payment {
 
   /**
@@ -67,7 +67,7 @@ abstract class CRM_Core_Payment {
     RECURRING_PAYMENT_START = 'START',
     RECURRING_PAYMENT_END = 'END';
 
-   protected $_paymentProcessor;
+  protected $_paymentProcessor;
 
   /**
    * Singleton function used to manage this object
@@ -86,7 +86,6 @@ abstract class CRM_Core_Payment {
    *
    * @return CRM_Core_Payment
    * @throws \CRM_Core_Exception
-   * @static
    */
   public static function &singleton($mode = 'test', &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
     // make sure paymentProcessor is not empty
@@ -96,7 +95,7 @@ abstract class CRM_Core_Payment {
     }
     //we use two lines because we can't remove the '&singleton' without risking breakage
     //of extension classes that extend this one
-    $object =  Civi\Payment\System::singleton()->getByProcessor($paymentProcessor);
+    $object = Civi\Payment\System::singleton()->getByProcessor($paymentProcessor);
     return $object;
   }
 
@@ -184,7 +183,8 @@ abstract class CRM_Core_Payment {
   /**
    * Getter for payment form that is using the processor
    * @deprecated
-   * @return CRM_Core_Form  A form object
+   * @return CRM_Core_Form
+   *   A form object
    */
   public function getForm() {
     return $this->_paymentForm;
@@ -303,7 +303,8 @@ abstract class CRM_Core_Payment {
             'rule_message' => ts('Please enter a valid value for your card security code. This is usually the last 3-4 digits on the card\'s signature panel.'),
             'rule_name' => 'integer',
             'rule_parameters' => NULL,
-        )),
+          ),
+        ),
       ),
       'credit_card_exp_date' => array(
         'htmlType' => 'date',
@@ -317,7 +318,8 @@ abstract class CRM_Core_Payment {
             'rule_message' => ts('Card expiration date cannot be a past date.'),
             'rule_name' => 'currentDate',
             'rule_parameters' => TRUE,
-          )),
+          ),
+        ),
       ),
       'credit_card_type' => array(
         'htmlType' => 'select',
@@ -355,7 +357,8 @@ abstract class CRM_Core_Payment {
             'rule_message' => ts('Please enter a valid Bank Identification Number (value must not contain punctuation characters).'),
             'rule_name' => 'nopunctuation',
             'rule_parameters' => NULL,
-        )),
+          ),
+        ),
         'is_required' => TRUE,
       ),
       //e.g. SWIFT-BIC can have maxlength of 11 digits
@@ -375,7 +378,8 @@ abstract class CRM_Core_Payment {
             'rule_message' => ts('Please enter a valid Bank Identification Number (value must not contain punctuation characters).'),
             'rule_name' => 'nopunctuation',
             'rule_parameters' => NULL,
-        )),
+          ),
+        ),
       ),
       'bank_name' => array(
         'htmlType' => 'text',
@@ -404,7 +408,7 @@ abstract class CRM_Core_Payment {
    *   the result in an nice formatted array (or an error object)
    * @abstract
    */
-  abstract function doDirectPayment(&$params);
+  abstract protected function doDirectPayment(&$params);
 
   /**
    * Process payment - this function wraps around both doTransferPayment and doDirectPayment
@@ -438,7 +442,7 @@ abstract class CRM_Core_Payment {
    * @return string
    *   the error message if any
    */
-  abstract function checkConfig();
+  abstract protected function checkConfig();
 
   /**
    * @param $paymentProcessor
@@ -585,7 +589,7 @@ abstract class CRM_Core_Payment {
    * @param string $method
    *   Method to check for.
    *
-   * @return boolean
+   * @return bool
    */
   public function isSupported($method = 'cancelSubscription') {
     return method_exists(CRM_Utils_System::getClassName($this), $method);
@@ -618,11 +622,11 @@ abstract class CRM_Core_Payment {
         break;
     }
 
-    $session       = CRM_Core_Session::singleton();
-    $userId        = $session->get('userID');
-    $contactID     = 0;
+    $session = CRM_Core_Session::singleton();
+    $userId = $session->get('userID');
+    $contactID = 0;
     $checksumValue = '';
-    $entityArg     = '';
+    $entityArg = '';
 
     // Find related Contact
     if ($entityID) {
@@ -667,4 +671,5 @@ INNER JOIN civicrm_contribution con ON ( con.contribution_recur_id = rec.id )
     // Else default
     return $this->_paymentProcessor['url_recur'];
   }
+
 }