Merge pull request #22551 from eileenmcnaughton/phpcs
[civicrm-core.git] / CRM / Core / Payment.php
index 4254f3ce47a885b5b0a047ac6b00f587a71fbce8..26a62af3a98ed9b43341a7cbc21fa4b41798ba55 100644 (file)
@@ -1378,6 +1378,7 @@ abstract class CRM_Core_Payment {
     }
 
     if ($this->_paymentProcessor['billing_mode'] == 4) {
+      CRM_Core_Error::deprecatedFunctionWarning('doPayment', 'doTransferCheckout');
       $result = $this->doTransferCheckout($params, $component);
       if (is_array($result) && !isset($result['payment_status_id'])) {
         $result['payment_status_id'] = array_search('Pending', $statuses);
@@ -1385,6 +1386,7 @@ abstract class CRM_Core_Payment {
       }
     }
     else {
+      CRM_Core_Error::deprecatedFunctionWarning('doPayment', 'doDirectPayment');
       $result = $this->doDirectPayment($params, $component);
       if (is_array($result) && !isset($result['payment_status_id'])) {
         if (!empty($params['is_recur'])) {
@@ -1672,8 +1674,7 @@ abstract class CRM_Core_Payment {
    * it is better to standardise to being here.
    *
    * @param int $invoiceId The ID to check.
-   *
-   * @param null $contributionID
+   * @param int|null $contributionID
    *   If a contribution exists pass in the contribution ID.
    *
    * @return bool
@@ -1691,8 +1692,8 @@ abstract class CRM_Core_Payment {
   /**
    * Get url for users to manage this recurring contribution for this processor.
    *
-   * @param int $entityID
-   * @param null $entity
+   * @param int|null $entityID
+   * @param string|null $entity
    * @param string $action
    *
    * @return string|null
@@ -1722,6 +1723,10 @@ abstract class CRM_Core_Payment {
         }
         $url = 'civicrm/contribute/updaterecur';
         break;
+
+      default:
+        $url = '';
+        break;
     }
 
     $userId = CRM_Core_Session::singleton()->get('userID');
@@ -1743,17 +1748,7 @@ abstract class CRM_Core_Payment {
           break;
 
         case 'recur':
-          $sql = "
-    SELECT DISTINCT con.contact_id
-      FROM civicrm_contribution_recur rec
-INNER JOIN civicrm_contribution con ON ( con.contribution_recur_id = rec.id )
-     WHERE rec.id = %1";
-          $contactID = CRM_Core_DAO::singleValueQuery($sql, [
-            1 => [
-              $entityID,
-              'Integer',
-            ],
-          ]);
+          $contactID = CRM_Core_DAO::getFieldValue("CRM_Contribute_DAO_ContributionRecur", $entityID, "contact_id");
           $entityArg = 'crid';
           break;
       }