diff --git a/lib/PayPal/Converter/FormatConverter.php b/lib/PayPal/Converter/FormatConverter.php index a237766e..82c1be50 100644 --- a/lib/PayPal/Converter/FormatConverter.php +++ b/lib/PayPal/Converter/FormatConverter.php @@ -46,10 +46,10 @@ public static function formatToNumber($value, $decimals = 2) public static function formatToPrice($value, $currency = null) { $decimals = 2; - $currencyDecimals = array('JPY' => 0, 'TWD' => 0); + $currencyDecimals = array('JPY' => 0, 'TWD' => 0, 'HUF' => 0); if ($currency && array_key_exists($currency, $currencyDecimals)) { if (strpos($value, ".") !== false && (floor($value) != $value)) { - //throw exception if it has decimal values for JPY and TWD which does not ends with .00 + //throw exception if it has decimal values for JPY, TWD and HUF which does not ends with .00 throw new \InvalidArgumentException("value cannot have decimals for $currency currency"); } $decimals = $currencyDecimals[$currency]; diff --git a/tests/PayPal/Test/Common/FormatConverterTest.php b/tests/PayPal/Test/Common/FormatConverterTest.php index c6201af2..b3c5f83b 100644 --- a/tests/PayPal/Test/Common/FormatConverterTest.php +++ b/tests/PayPal/Test/Common/FormatConverterTest.php @@ -38,7 +38,8 @@ public static function CurrencyListWithNoDecimalsProvider() { return array( array('JPY'), - array('TWD') + array('TWD'), + array('HUF') ); }