Closed fritzmg closed 1 year ago
@Novalnet-Technic it has been brought to my attention (externally) that this error could not be reproduced on your end. Though I do not see how that can be the case. These are the original code lines:
You can see this code in action here, where I have replaced the function calls with static values - e.g. $order->getTotal()
returns 1171.0
in my example: https://3v4l.org/YmGEk
As you can see the value of "amount"
is int(100)
instead of int(117100)
- i.e. the customer is only charged 1.00 EURO instead of 1171.00 EURO.
Currently there is a critical error in the extension if the total of the payment exceeds 999.99. In that case the customer is only charged 1.00 USD/EUR/etc.
The reason is that
number_format
is used in order to transform the total number to a maximum of two decimal places. However, PHP'snumber_format
will by default introduce a thousands separator. So for example, if the total amount is1117
will result in
This then cannot be parsed as a number by PHP anymore and thus it is interpreted as
1
instead when casting to an integer or float by the multiplication operation.This PR fixes that by using
floor($order->getTotal() * 100)
instead.