Fixes for import correcting amounts

This commit is contained in:
David Bomba 2021-08-30 07:53:51 +10:00
parent ac763b3a0a
commit 4ca034c9f6
2 changed files with 22 additions and 1 deletions

View File

@ -146,7 +146,7 @@ class BaseTransformer
$number = 0;
}
return Number::parseStringFloat($number);
return Number::parseFloat($number);
}
/**

View File

@ -41,6 +41,27 @@ class NumberTest extends TestCase
$this->assertEquals(2.15, $rounded);
}
//this method proved an error! removing this method from production
// public function testImportFloatConversion()
// {
// $amount = '€7,99';
// $converted_amount = Number::parseStringFloat($amount);
// $this->assertEquals(799, $converted_amount);
// }
public function testParsingStringCurrency()
{
$amount = '€7,99';
$converted_amount = Number::parseFloat($amount);
$this->assertEquals(7.99, $converted_amount);
}
// public function testParsingFloats()
// {
// Currency::all()->each(function ($currency) {