Skip to content

Commit 7e9eb99

Browse files
committed
- Created backwards compatible changes.
- Deprecated old function with hard coded precision.
1 parent 252b199 commit 7e9eb99

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

app/code/Magento/Directory/Model/PriceCurrency.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function convert($amount, $scope = null, $currency = null)
6262
*/
6363
public function convertAndRound($amount, $scope = null, $currency = null, $precision = self::DEFAULT_PRECISION)
6464
{
65-
return $this->round($this->convert($amount, $scope, $currency), $precision);
65+
return $this->roundPrice($this->convert($amount, $scope, $currency), $precision);
6666
}
6767

6868
/**
@@ -148,7 +148,15 @@ protected function getStore($scope = null)
148148
/**
149149
* {@inheritdoc}
150150
*/
151-
public function round($price, $precision = self::DEFAULT_PRECISION)
151+
public function round($price)
152+
{
153+
return round($price, 2);
154+
}
155+
156+
/**
157+
* {@inheritdoc}
158+
*/
159+
public function roundPrice($price, $precision = self::DEFAULT_PRECISION)
152160
{
153161
return round($price, $precision);
154162
}

lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,20 @@ public function convertAndFormat(
7878
/**
7979
* Round price
8080
*
81+
* @deprecated
82+
* @param float $price
83+
* @return float
84+
*/
85+
public function round($price);
86+
87+
/**
88+
* Round price with precision
89+
*
8190
* @param float $price
8291
* @param int $precision
8392
* @return float
8493
*/
85-
public function round($price, $precision = self::DEFAULT_PRECISION);
94+
public function roundPrice($price, $precision = self::DEFAULT_PRECISION);
8695

8796
/**
8897
* Get currency model

0 commit comments

Comments
 (0)