Hi.
There seems to be a major issue with the module completing the order (and thus invoice being sent to the customer) despite eWay returns error:
#############################################
Credit card payment declined: Error: XML not formated correctly to eWAY standards. Reason:Whitespace is not allowed at this location. Error Code:-1072896749:
#############################################
The customer tried to place the order twice and both times the same error appears. The customer also didn't use spaces in the credit card number entered. This is ongoing issue since the first version of the module (the one that hasn't been placed into Drupal projects yet) and now is the latest 5.0.3. This issue happen every 10-15 purchase attempts. Sometimes when customers use too short names (like X Y Lee for example) the transaction brings error as well.
Please let me know if you need more information. I can also help you to debug this issue if needed.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | uc_eway_specialchars.patch | 490 bytes | JayKayAu |
Comments
Comment #1
ssherriff commentedYeah, the most amount of information possible would be good. Ok, so this doesn't happen every time. You mention short names brings the problems, were you able to test the same information that caused the issue with the live system, with the testing merchant id? It would be great if you could give me exact details I could enter that would cause the bug to appear.
Comment #2
grim assim commentedHi,
I think this is going to be caused from this situation
http://www.magentocommerce.com/boards/viewthread/11467/
Perhaps as koyan form the Magento site says
"The PHP example on the eWay site uses a straight version of htmlentities to prepare ALL XML inserts.
They recommended i use the full version formatted for UTF-8 e.g. htmlentities(trim($var),ENT_QUOTES,’UTF-8’)"
Assim
Comment #3
NegaXul commentedI think this is coming from having illegal characters in the various fields (characters like &) one option is to enclose some fields in the CDATA tags. One example is where the title of the product is being used.
Comment #4
agileware commentedNo longer maintaining the 5.x branch.
Comment #5
sirleech commentedI'm getting this error (seemingly randomly) also on Drupal 6 with Ubercart 6.x-2.4 and Eway Module 6.x-2.2. Here is the message:
And with NegaXul's post, it was indeed a problem with the order line item being used in the eWay xml message. I had a funny character (±) in one of the item title's and this was causing the error. We'll need to add some protective parsing with HTMLSPECIALCHARS() or something to filter these out before it's sent-- sort of an injection attack but by an Authorised admin :) Either way I attacked myself with this and caused some headaches for customers.
Will try and have a fix ready for review soon-- has anyone reported this yet in 6.x-2.2? I'm resurrecting this one as this is where I found my workaround for the bug.
Comment #6
JayKayAu commentedI get a very similar error which is occurring in about 20% of transactions:
Credit card payment declined: Error: XML not formated correctly to eWAY standards. Reason:An invalid character was found in text content. Error Code:-1072896760:
Drupal 6.20
Ubercart 6.x-2.4
Ubercart eWay Payment Gateway 6.x-2.2
EDIT: I've done some digging, and noticed that it is because in the product name they're using the "×" character in the title (for width and height). None of the successful transactions had this character, and all of the unsuccessful ones did.
Comment #7
JayKayAu commentedOkay, so I've replaced the following line (uc_eway.module:291):
$xmlstring .= '<' . $key . '>' . htmlentities($value) . '</' . $key . '>';With:
$xmlstring .= '<' . $key . '>' . htmlentities(trim($value),ENT_QUOTES,'UTF-8') . '</' . $key . '>';The result was the following error (which would refer to the "×" symbol):
Credit card payment declined: Error: XML not formated correctly to eWAY standards. Reason:Reference to undefined entity 'times'. Error Code:-1072898046:
Comment #8
JayKayAu commentedAlrighty, solved the problem. Turns out I just had to read further down the Magento issue thread..
In the end I've replaced the following line (uc_eway.module:291):
$xmlstring .= '<' . $key . '>' . htmlentities($value) . '</' . $key . '>';With:
$xmlstring .= '<' . $key . '>' . htmlspecialchars(trim($value),ENT_QUOTES,'UTF-8') . '</' . $key . '>';And it works beautifully.
I've created the following patch to fix the issue. (This is the first patch I've ever made, so you know, caveat emptor and all that.)
Comment #9
agileware commentedIt works with my test product title of
Test product × 1 £ÃÜ'?"áé“”…–™—so looks pretty good.
Committed.
http://drupalcode.org/project/uc_eway.git/commit/ada9986