Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IP not customisable #26

Open
peteralewis opened this issue Mar 15, 2022 · 0 comments
Open

IP not customisable #26

peteralewis opened this issue Mar 15, 2022 · 0 comments
Labels

Comments

@peteralewis
Copy link

Description

After successful testing we're now using SagePay plugin v4 which uses protocol 4 on SagePay via Direct integration. Alas over 50% of the payment transactions are failing because the IP is missing: 3333 : The ClientIPAddress is missing.

The problem is the SagePay gateway doesn't support IPv6 (like it's a new thing!), and Craft (Craft::$app->getRequest()->userIP) will return whatever has been passed to it by the browser, device or users connection. So for all the failures, Craft is logging an IPv6 address.

I had assumed this library was based on (or similar to) thephpleague/omnipay-sagepay, which allows for clientIpto be posted with the payment form, but it doesn't: vendor/craftcms/commerce-omnipay/src/base/Gateway.php line 507:
'clientIp' => Craft::$app->getRequest()->userIP ?? '',

So it will always fail for users who have an IPv6 address.

Can this be changed to check and allow for clientIp to be posted with the request as a default, then fallback to pulling from Craft, then fallback to an empty string?

Additional info

  • Craft version: 3.7.36
  • Craft Commerce version: 3.4.11
  • SagePay for Craft Commerce version: 4.0.0
  • PHP version: 7.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant