Closed phoenix-schwarz closed 4 years ago
Thanks for the contribution! Looks good to me, moved to QA queue.
@phoenix-schwarz thanks! Any reason why you do not use the suggested "epsilon technique"?
@phoenix-schwarz thanks! Any reason why you do not use the suggested "epsilon technique"?
Just a personal preference. One value is a string, and one is a float. Comparing strings in that case seems to be more safe for me, but feel free to change it. I thought about using it, but it "feels" more safe for me to NOT do an additional calculation. There is a constant available as well: PHP_FLOAT_EPSILON but requires PHP 7.2.0 - up to you.
I'd share @phoenix-schwarz preference for the number_format()
option, it seems just more compatible to me.
I added another bugfix and the 1 cent difference tolerance modification as well
Thanks!
The feature toggle for the rounding issues will follow in a separate PR.
Under some circumstances, there is the error "Sorry, your transaction with Amazon Pay was not successful. Please try again." thrown, even if the values seem to be identical. After implementing a logging, we figured out, that there seems to be a comparison between a string and a floating point number, which is not safe anyway. See: https://stackoverflow.com/questions/3148937/compare-floats-in-php
To avoid this, the value is converted to a string before writing the value into the session and to convert both values to the same "number_format" value with 4 digits