blazedd Posted June 22, 2016 Report Share Posted June 22, 2016 On the `currencies.php` model there is a method `toDecimal` which is labeled as the "precision" of a currency. As I understand it the intention is to turn a float similar to "12.622222" into "12.62". The functionality it actually provides is via the AppModel->truncateDecimal method which is a `minimum` precision as per the documentation. This leads to raw pricing data without truncated precision as per the currency's database configuration. For example USD pricing will result in: { "id": "1", "pricing_id": "1", "package_id": "1", "term": "1", "period": "month", "price": "10.00", "setup_fee": "0.00", "cancel_fee": "0.00", "currency": "USD" } but pricing for GBP is { "id": "1", "pricing_id": "1", "package_id": "1", "term": "1", "period": "month", "price": "6.9834", "setup_fee": "0.00", "cancel_fee": "0.00", "currency": "GBP" } I believe the frontend or view layer of Blesta is obfuscating this minor problem from being apparent. It's a significant issue for identifying the accurate pricing when the Blesta API is being consumed directly. Blesta Addons and CyberHour 2 Quote Link to comment Share on other sites More sharing options...
Tyson Posted June 23, 2016 Report Share Posted June 23, 2016 Could you provide example input to the API request(s) you're calling that generates those responses? Quote Link to comment Share on other sites More sharing options...
blazedd Posted June 28, 2016 Author Report Share Posted June 28, 2016 The Packages model has a method called getPackageItems which is what we use to get the items and currency. A basic request to /api/packages/getPackageItems.json with package_pricing and a non default currency Quote Link to comment Share on other sites More sharing options...
blazedd Posted July 10, 2016 Author Report Share Posted July 10, 2016 Is there any potential for an update on this? Quote Link to comment Share on other sites More sharing options...
evolvewh Posted July 11, 2016 Report Share Posted July 11, 2016 Is there any potential for an update on this? They created a task to include it in v4.0 https://dev.blesta.com/browse/CORE-2219 Michael and blazedd 2 Quote Link to comment Share on other sites More sharing options...
blazedd Posted July 11, 2016 Author Report Share Posted July 11, 2016 They created a task to include it in v4.0 https://dev.blesta.com/browse/CORE-2219 Thanks, I did not see the bug report! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.