Merge pull request #21965 from civicrm/5.43
[civicrm-core.git] / CRM / Core / Payment.php
index 433c68457cecaed020891322f50095ee94c57914..16f4691d06e630a79115ec12df758c96b221ccc1 100644 (file)
@@ -1164,7 +1164,11 @@ abstract class CRM_Core_Payment {
    * @throws \CRM_Core_Exception
    */
   protected function getAmount($params = []) {
-    return CRM_Utils_Money::format($params['amount'], NULL, NULL, TRUE);
+    if (!CRM_Utils_Rule::numeric($params['amount'])) {
+      CRM_Core_Error::deprecatedWarning('Passing Amount value that is not numeric is deprecated please report this in gitlab');
+      return CRM_Utils_Money::formatUSLocaleNumericRounded(filter_var($params['amount'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION), 2);
+    }
+    return CRM_Utils_Money::formatUSLocaleNumericRounded($params['amount'], 2);
   }
 
   /**
@@ -1275,7 +1279,7 @@ abstract class CRM_Core_Payment {
    *   URL to notify outcome of transaction.
    */
   protected function getNotifyUrl() {
-    $url = CRM_Utils_System::url(
+    $url = CRM_Utils_System::getNotifyUrl(
       'civicrm/payment/ipn/' . $this->_paymentProcessor['id'],
       [],
       TRUE,
@@ -1374,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);
@@ -1381,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'])) {