REF Ensure that getAmount includes 0s in decimal places up to 2 places
authorSeamus Lee <seamuslee001@gmail.com>
Thu, 15 Apr 2021 22:01:23 +0000 (08:01 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Thu, 15 Apr 2021 22:01:23 +0000 (08:01 +1000)
CRM/Core/Payment.php

index e19da90c3a5e19e2617fef8ac78cf0a21befb0e5..72b407bf2f2bdfd0f0ed46e6c54eae11e5a8c411 100644 (file)
@@ -1166,9 +1166,9 @@ abstract class CRM_Core_Payment {
   protected function getAmount($params = []) {
     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 filter_var($params['amount'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
+      return CRM_Utils_Money::formatLocaleNumericRoundedByPrecision(filter_var($params['amount'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION), 2);
     }
-    return $params['amount'];
+    return CRM_Utils_Money::formatLocaleNumericRoundedByPrecision($params['amount'], 2);
   }
 
   /**