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.

Comments

mrsimonelliott’s picture

StatusFileSize
new1.39 KB

Forgot to attach patch, ooops

dtrdewaele’s picture

Status: Needs review » Fixed

Fixed in release 6.x-1.1

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

berenddeboer’s picture

Version: 6.x-1.0 » 6.x-1.1
Priority: Normal » Critical
Status: Closed (fixed) » Needs review
StatusFileSize
new1.08 KB

The 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.

berenddeboer’s picture

StatusFileSize
new0 bytes

It appears I missed one location as there was still a failure after payment. Here the full patch.

berenddeboer’s picture

StatusFileSize
new1.53 KB

Once again, can't update a file once posted it appears.

miechiel’s picture

This patch works for me. Thanx.