Skip to content
This repository has been archived by the owner on Jan 22, 2021. It is now read-only.

Fixed the problem with prices for some locales #217

Closed
wants to merge 7 commits into from

Conversation

itelmenko
Copy link

Some locales have decimal comma instead of dot. But in this case converting from string to float is incorrect:

setlocale(LC_NUMERIC, 'ru_RU.UTF-8'); 
$amount = '10.95';
$fAmount = (float) $amount;
var_dump($fAmount);  // result is 10.95
$amount = '10,95';
$fAmount = (float) $amount; 
var_dump($fAmount);  // result is 10

I have fixed it.

Also BitPay package works fine for php 5.3.15. I have tested it on production

@pieterpoorthuis
Copy link

Rejecting this PR, because it can cause problems with merchants using , as a thousand separator.

@itelmenko
Copy link
Author

itelmenko commented May 9, 2017

So you have problems with some locales. Why you closed it?

@pieterpoorthuis
Copy link

BitPay's PHP library should not replace characters in the price.

Instead, the local implementation of the merchant should reformat the price in such a way that it can be passed to BitPay's PHP library.

@itelmenko
Copy link
Author

itelmenko commented May 9, 2017

And merchants using comma as a thousand separator? They also do that?
Also where in documentation I can read it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants