Observed on a customer site which was generating amounts like '12.5' at checkout (possibly specific to customisations/modules).

Established with DPS that this was because the GenerateRequest contained amount=12.5 instead of 12.50

I would have thought commerce_currency_amount_to_decimal(12.5, 'NZD') would handle this.

Comments

xurizaemon’s picture

xurizaemon’s picture

Status: Active » Needs review
millionleaves’s picture

I just hit this issue on a new site when trying to implement Shipwire. Looks like the Shipwire Commerce module was passing values like '11.9' rather than '11.90'.

This patch fixed the issue on the latest -dev version (June 14 release).

Thanks, as always!

xurizaemon’s picture

Issue summary: View changes

I don't *really* want to commit this patch because I suspect it'll wreak havoc with other currencies. Need to take a moment to work out why commerce_currency_amount_to_decimal(12.5, 'NZD') is not doing what I expected instead ...

xurizaemon’s picture

OK, here's a revised patch @millionleaves.

Turns out commerce_currency_amount_to_decimal(12.5, 'NZD') makes sure the number is a decimal, but doesn't try to round or format to two decimal places. So I added a tiny function to handle that.

Keen for feedback esp if you have a multicurrency site. (Tests OK for me so far.)

millionleaves’s picture

Thanks for the revised patch - sorry, hadn't seen it earlier.

I had another site come up with the same issue today, and the latest patch fixed it.

This site is not running Shipwire. The only thing I can can think of is that the site is using the Commerce Bulk Product Creation module. It's possible that there is a flaw in the way it creates prices for each product variation.

  • xurizaemon committed 94d01f0 on 7.x-1.x
    Issue #2482407 by xurizaemon: PxPay: "IU" message at DPS payment page
    
xurizaemon’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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