Ubercart stores price information to multiple decimal places, 5 I believe. This is so when any percentage based price modifier is used, tax rules, discounts etc the price is only rounded once at the checkout process rather than rounding it to two decimal places every time a percentage based price modifier is applied.
The MSP module expects prices only to be to 2 decimal places. Under normal circumstance this is ok, you enter your product price to 2 dp and it is stored to 5 dp but the trailing 3 digits are all zeros. MSP ignore the trailing zeros.
As soon as you use a percentage based price modifier which gives a price with digits in all 5 decimal places ie product price £9.86 then add a tax rule of 17.5% the price is stored as 11.5855, When you try and pass £11.5855 to MSP he throws an error.
Attached is a patch for uc_multisafepay which rounds the price to 2 decimal places before passing it to MSP.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | uc_multisafepay.patch | 1.53 KB | berenddeboer |
| #5 | uc_multisafepay.patch | 0 bytes | berenddeboer |
| #4 | uc_multisafepay.patch | 1.08 KB | berenddeboer |
| #1 | uc_msp.patch | 1.39 KB | mrsimonelliott |
Comments
Comment #1
mrsimonelliott commentedForgot to attach patch, ooops
Comment #2
dtrdewaele commentedFixed in release 6.x-1.1
Comment #4
berenddeboer commentedThe patch was NOT applied correctly (no doubt someone did this by hand). The amount the current code generates would be 11743.13 for 117.4313 EUR.
Here is the correct patch against the 1.1 version.
Comment #5
berenddeboer commentedIt appears I missed one location as there was still a failure after payment. Here the full patch.
Comment #6
berenddeboer commentedOnce again, can't update a file once posted it appears.
Comment #7
miechiel commentedThis patch works for me. Thanx.