Problem/Motivation
I was seeing the above error on my client's live site when attempting to check out with only some products.
After filling out my credit card information and attempting to submit, the error on the checkout page says "We encountered an unexpected error processing your payment method. Please try again later." And when I check the recent log messages it says "Cancelled: Error bad character content for element 'amount' __________________".
I discovered that the only products that weren't working were the ones that ended in .00.
It turns out it was changing 10.00, for example, into 10 when a decimal number was expected. I tested the number as a string, eg. '10.00' and this was accepted. Formatting the number to two decimal places resolves the issue.
Proposed resolution
I am including a patch which uses the number_format function to properly format all amount number variables.
Remaining tasks
Patch needs review.
Release notes snippet
Fixes issue where whole number integers are rejected by the Moneris API.
Original report by embeau
I am currently seeing the above error on my client's live site when attempting to check out with only some products.
After filling out my credit card information and attempting to submit, the error on the checkout page says "We encountered an unexpected error processing your payment method. Please try again later." And when I check the recent log messages it says "Cancelled: Error bad character content for element 'amount' __________________".
We have copied the live site into a dev environment and replaced the client's live Moneris credentials with my own test store id and token. In this test environment, all products are getting this error.
The site is on Drupal 8.7.3 and using the Commerce Moneris module with on-site payment. So far we've found that only 2 out of about 16 products are getting this error. I see no issue with the amounts inputted for these products that are not working, so I do not know how to proceed from here.
Any help would be greatly appreciated. Thank you!
Comment | File | Size | Author |
---|---|---|---|
#3 | commerce_moneris-3063729-3.patch | 1.41 KB | embeau |
Comments
Comment #2
embeau CreditAttribution: embeau at Aptitude Digital commentedComment #3
embeau CreditAttribution: embeau at Aptitude Digital commentedFound the issue. Was able to resolve. Issuing a patch.
Comment #4
rbrownellComment #5
rbrownellComment #7
rbrownell