I seem to get this transaction error every now and then through the site.

Reading up on it a bit, and talking to SagePay, it appears they do not accept IPv6 addresses.

Apparently the only fix is to not submit the client IP address.

What would be the best way to handle this? Remove the Client IP address functionality? Or provide a setting in the module to turn it on and off for anyone else running into this problem?

Comments

Collins405 created an issue. See original summary.

Collins405’s picture

Priority: Normal » Major

Marking this as Major, as 3 out of 10 customers were not able to complete the transaction, and only one of those phoned up to order over the phone, so this issue is losing my client money.

Status: INVALID
StatusDetail: 3067 : The ClientIPAddress is too long.

The issue seems to be on line 444 of uc_sagepay.module in the transaction array.

'ClientIPAddress' => ip_address(),

Commenting this out seems to be working.

Collins405’s picture

With the above in mind, and not wanting to just remove ClientIPAddress incase someone wants it, are we better to just exclude IPv6 addresses seeing as SagePay do not support them yet anyway?

I spoke to a nice lady at SagePay today who confirmed this for us.

So, something like this would work...

$clientip = ip_address();    
if(filter_var($clientip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
    unset($transaction['ClientIPAddress']);
}

Added to line 448 after the $transaction array is put together.

hanoii’s picture

Status: Active » Needs review
StatusFileSize
new917 bytes

nice catch, what about the following patch, simply instead of unsetting, I am setting if it's a valid ipv4 ip. Can you try and let me know?

I'll commit and release a new version.

Collins405’s picture

Nice! That looks like its all good.

Tricky one to test, as you need to have a IPv6 client IP, and not all customers have that!

hanoii’s picture

At least test if it works properly with an ipv4 address :)?

Collins405’s picture

Yes that works perfectly, tested on a dev environment with test transactions, and after that i pushed it to my client production site and tested it there as well.

Status: OK
StatusDetail: 0000 : The Authorisation was Successful.

Collins405’s picture

Status: Needs review » Reviewed & tested by the community
hanoii’s picture

have you checked if the ip was actually properly recorded on sagepay, the ipv4 IP?

  • hanoii committed 2f88336 on 7.x-3.x
    Issue #2835764 by hanoii, Collins405: 3067 The Client IP address is too...
hanoii’s picture

Status: Reviewed & tested by the community » Fixed
hanoii’s picture

Title: 3067 The Client IP address is too long » 3067 The Client IP address is too long due to IPv6
Collins405’s picture

Im comparing two orders, one with the new patch, and one without, and neither of them seem to report the Client IP address in ubercart anyway.

I'm afraid I dont have access to my clients MySagePay account.

hanoii’s picture

That's fine, I'll try to confirm that it works looking at SagePay but at least it doesn't break anything. Patch was simple and clear though.

Thanks for reporting and testing!

Status: Fixed » Closed (fixed)

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