Merge pull request #4865 from eileenmcnaughton/my-first-factory
[civicrm-core.git] / CRM / Core / Payment / Form.php
index 72f863446a54ab2414059a461a1baa0bf84efa35..cd42687044e3d77ab06b365cd7d8b3e8d1f3f8c6 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -45,8 +45,10 @@ class CRM_Core_Payment_Form {
    *  Note that this code is written to accommodate the possibility CiviCRM will switch to implementing pay later as a manual processor in future
    *
    * @param CRM_Contribute_Form_AbstractEditPayment|CRM_Contribute_Form_Contribution_Main $form
-   * @param array $processor array of properties including 'object' as loaded from CRM_Financial_BAO_PaymentProcessor::getPaymentProcessors
-   * @param bool $forceBillingFieldsForPayLater display billing fields even for pay later
+   * @param array $processor
+   *   Array of properties including 'object' as loaded from CRM_Financial_BAO_PaymentProcessor::getPaymentProcessors.
+   * @param bool $forceBillingFieldsForPayLater
+   *   Display billing fields even for pay later.
    */
   static public function setPaymentFieldsByProcessor(&$form, $processor, $forceBillingFieldsForPayLater = FALSE) {
     $form->billingFieldSets = array();
@@ -85,7 +87,6 @@ class CRM_Core_Payment_Form {
    * @param CRM_Core_Form $form
    *
    * @return void
-   * @access protected
    */
   static protected function setBillingDetailsFields(&$form) {
     $bltID = $form->_bltID;
@@ -206,7 +207,7 @@ class CRM_Core_Payment_Form {
    *
    * @return array
    */
-  static function getPaymentFields($paymentProcessor) {
+  public static function getPaymentFields($paymentProcessor) {
     $paymentProcessorObject = CRM_Core_Payment::singleton(($paymentProcessor['is_test'] ? 'test' : 'live'), $paymentProcessor);
     return $paymentProcessorObject->getPaymentFormFields();
   }
@@ -216,7 +217,7 @@ class CRM_Core_Payment_Form {
    *
    * @return array
    */
-  static function getPaymentFieldMetadata($paymentProcessor) {
+  public static function getPaymentFieldMetadata($paymentProcessor) {
     $paymentProcessorObject = CRM_Core_Payment::singleton(($paymentProcessor['is_test'] ? 'test' : 'live'), $paymentProcessor);
     return $paymentProcessorObject->getPaymentFormFieldsMetadata();
   }
@@ -226,7 +227,7 @@ class CRM_Core_Payment_Form {
    *
    * @return string
    */
-  static function getPaymentTypeName($paymentProcessor) {
+  public static function getPaymentTypeName($paymentProcessor) {
     $paymentProcessorObject = CRM_Core_Payment::singleton(($paymentProcessor['is_test'] ? 'test' : 'live'), $paymentProcessor);
     return $paymentProcessorObject->getPaymentTypeName();
   }
@@ -236,21 +237,23 @@ class CRM_Core_Payment_Form {
    *
    * @return string
    */
-  static function getPaymentTypeLabel($paymentProcessor) {
+  public static function getPaymentTypeLabel($paymentProcessor) {
     $paymentProcessorObject = CRM_Core_Payment::singleton(($paymentProcessor['is_test'] ? 'test' : 'live'), $paymentProcessor);
     return ts(($paymentProcessorObject->getPaymentTypeLabel()) . ' Information');
   }
 
   /**
    * @param CRM_Contribute_Form_AbstractEditPayment|CRM_Contribute_Form_Contribution_Main|CRM_Core_Payment_ProcessorForm|CRM_Contribute_Form_UpdateBilling $form
-   * @param array $processor array of properties including 'object' as loaded from CRM_Financial_BAO_PaymentProcessor::getPaymentProcessors
-   * @param bool $isBillingDataOptional This manifests for 'NULL' (pay later) payment processor as the addition of billing fields to the form and
+   * @param array $processor
+   *   Array of properties including 'object' as loaded from CRM_Financial_BAO_PaymentProcessor::getPaymentProcessors.
+   * @param bool $isBillingDataOptional
+   *   This manifests for 'NULL' (pay later) payment processor as the addition of billing fields to the form and.
    *   for payment processors that gather payment data on site as rendering the fields as not being required. (not entirely sure why but this
    *   is implemented for back office forms)
    *
    * @return bool
    */
-  static function buildPaymentForm($form, $processor, $isBillingDataOptional){
+  public static function buildPaymentForm($form, $processor, $isBillingDataOptional) {
     //if the form has address fields assign to the template so the js can decide what billing fields to show
     $profileAddressFields = $form->get('profileAddressFields');
     if (!empty($profileAddressFields)) {
@@ -273,7 +276,8 @@ class CRM_Core_Payment_Form {
 
   /**
    * @param CRM_Core_Form $form
-   * @param array $paymentFields array of properties including 'object' as loaded from CRM_Financial_BAO_PaymentProcessor::getPaymentProcessors
+   * @param array $paymentFields
+   *   Array of properties including 'object' as loaded from CRM_Financial_BAO_PaymentProcessor::getPaymentProcessors.
 
    * @param $paymentFields
    */
@@ -316,7 +320,7 @@ class CRM_Core_Payment_Form {
    * The credit card pseudo constant results only the CC label, not the key ID
    * So we normalize the name to use it as a CSS class.
    */
-  static function getCreditCardCSSNames() {
+  public static function getCreditCardCSSNames() {
     $creditCardTypes = array();
     foreach (CRM_Contribute_PseudoConstant::creditCard() as $key => $name) {
       // Replace anything not css-friendly by an underscore
@@ -334,7 +338,7 @@ class CRM_Core_Payment_Form {
    * Make sure that credit card number and cvv are valid
    * Called within the scope of a QF formRule function
    */
-  static function validateCreditCard($values, &$errors) {
+  public static function validateCreditCard($values, &$errors) {
     if (!empty($values['credit_card_type'])) {
       if (!empty($values['credit_card_number']) &&
         !CRM_Utils_Rule::creditCardNumber($values['credit_card_number'], $values['credit_card_type'])
@@ -363,7 +367,7 @@ class CRM_Core_Payment_Form {
    * @return void
    * @static
    */
-  static function mapParams($id, &$src, &$dst, $reverse = FALSE) {
+  public static function mapParams($id, &$src, &$dst, $reverse = FALSE) {
     static $map = NULL;
     if (!$map) {
       $map = array(
@@ -404,7 +408,7 @@ class CRM_Core_Payment_Form {
    * @return int
    * @static
    */
-  static function getCreditCardExpirationMonth($src) {
+  public static function getCreditCardExpirationMonth($src) {
     if ($month = CRM_Utils_Array::value('M', $src['credit_card_exp_date'])) {
       return $month;
     }
@@ -422,7 +426,7 @@ class CRM_Core_Payment_Form {
    * @return int
    * @static
    */
-  static function getCreditCardExpirationYear($src) {
+  public static function getCreditCardExpirationYear($src) {
     return CRM_Utils_Array::value('Y', $src['credit_card_exp_date']);
   }
 }