PAYONE-GmbH / magento-1

PAYONE Payment Extension for Magento 1
22 stars 41 forks source link

eliminated another (seldom) rounding issue #409

Closed phoenix-schwarz closed 5 months ago

phoenix-schwarz commented 4 years ago

The difference calculation should be based on "rounded" values and total cents, to avoid a seldom rounding issue discovered from our logging. See comment in the code and try it yourself. I'm not sure if there is a cleaner way to do the calculation.

Try:

php > echo (number_format(abs((float) '244.68' - (float) '244.67'), 2) > 0.01);

php > echo (number_format(abs((float) '244.68' - (float) '244.66'), 2) > 0.01);
phoenix-schwarz commented 4 years ago

see: https://github.com/PAYONE-GmbH/magento-1/pull/408 (it fixes an issue introduced in this code)

fjbender commented 4 years ago

Thanks for the patch! Are you sure though that #408 is the right reference here? It's concerned with RatePay, that got me confused.

phoenix-schwarz commented 4 years ago

Sorry, meant #407 ;-)

fjbender commented 4 years ago

All right! We'll probably incorporate this change in the PR we're preparing for the feature toggle.