Hi,

I'm getting the 'There was an error processing the purchase. Please contact us' error when testing on the Sagepay simulator.

Drupal has logged the error 'The Basket is incorrectly formatted. Check you have the correct 'number of lines of detail' at the beginning of the field'. I'm wondering which field Drupal is referring to.

I don't have a delivery address as I'm selling event registrations and using euro's as the currency. I know that this module uses the billing address if a delivery address is missing so that shouldn't be a problem.

I'm using:
Drupal 6.19
Ubercart 6.x-2.4
Sage pay server 6.x-1.3

Thanks

CommentFileSizeAuthor
#5 917994-basket_format.patch538 bytesjelenex

Comments

aireworth’s picture

Hi spa1969

Do you have any punctuation in your product's name? I was getting this from an item with "50:50" in its title. When I removed the colon, the error went away. Put it back, it reappears. Place a colon in another (previously working) product's name and the error surfaces again. I haven't tested this with any other non alphabetical characters, but it might be a parsing error caused by the colon somewhere.

Regards

Colin

Anonymous’s picture

Hi Colin,

Yes, I do have a colon in the product name. I will check it out and post back if that is indeed the case.

Thanks for the pointer

Cheers

Anonymous’s picture

Status: Active » Closed (fixed)

As stated by aireworth, having a colon : in the product title was causing this error. I have removed the colon and tested the product and the transactions are now being correctly handled by Sagepay server.

leo pitt’s picture

Status: Closed (fixed) » Active

Thanks for the updates - I think the module should be able to handle having a colon in the product title though, so I'm setting this to "active" again.

One of the fields of data sent to Sagepay when registering the transaction is "Basket", which is supposed to contain details of the customer's order for use in "My Sagepay"... It's an optional field so if it's causing a problem then it could be removed completely.

I had assumed that this information would get displayed to the customer at some point but examining the Sagepay Server integration documentation more closely, it does imply that it's just for the benefit of whoever is administering the Sagepay account.

Any way, the Basket field has to conform to a convention:

The shopping basket contents can be passed in a single, colon-delimited field, in the following format:

Number of lines of detail in the basket field:
Item 1 Description:
Quantity of item 1:
Unit cost item 1 without tax:
Tax applied to item 1:
Cost of Item 1 including tax:
Total cost of item 1 (Quantity x cost including tax):
Item 2 Description:
Quantity of item 2:
....
Cost of Item n including tax:
Total cost of item n

So I guess the colons in the product name are breaking the formatting of the Basket field.. Sagepay interprets them as field delimiters.

I think the solution is probably to have this module strip colons from product names before populating the Basket field - so that way people can use whatever product names they want.

Should be pretty easy to implement... will try to fix in the next day or two.

jelenex’s picture

Version: 6.x-1.3 » 6.x-1.4
Status: Active » Needs review
StatusFileSize
new538 bytes

As I've just found out (the hard way) this bug is still present in the latest stable and dev version.
Here's a quick patch, which fixes the error for me.

Deimos-dupe’s picture

I think this issue extends to other fields sent to Sage Pay. I've seen errors such as "Invalid characters in postcode". This is more of an issue because the customer doesn't get to see what the problem is, they just get redirected back to the order submission screen with no errors.

I think we need to strip more characters than are currently, from all fields, before sending the request to Sage Pay. I don't know what the set of allowed characters is, or what characters had been entered in my postcode field to cause the problem for me.

leo pitt’s picture

Thanks - I have added the patch at #5 to the dev version, please try it out.

leo pitt’s picture

Also, @deimos, your point noted - I just want to get the patch at @5 out the door while I'm here and without further ado but intend to check back on this next chance I have

drupal_jon’s picture

Hi all, just confirming that the patch at #5 works for me.

leo pitt’s picture

Status: Needs review » Closed (fixed)

Fixed in 6.x-1.5