From 78b338e07464becd1555a2c7d2d04ac0e4e9180c Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Fri, 16 Apr 2021 08:01:23 +1000 Subject: [PATCH] REF Ensure that getAmount includes 0s in decimal places up to 2 places --- CRM/Core/Payment.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index e19da90c3a..72b407bf2f 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -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); } /** -- 2.25.1