Is there any chance of Sagepay_server payment working?

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
thepurpleblob
Posts: 20
Joined: 22 Oct 2020, 15:39

Is there any chance of Sagepay_server payment working?

Post by thepurpleblob » 04 Nov 2020, 20:40

I can't get this to work... I've been trying to debug it but I'm really struggling.

I'm not expecting anybody (unless I'm lucky) to be familiar with Sagepay. But the critical bit is that the redirect to the payment screens works and contains a parameter called 'NotificationURL'. Aimeos sends something like this...

http://my.shop.com/update?code=SagePay&orderid=16

The idea is that Sagepay sends a POST to the above callback which is supposed to confirm the transaction (this is done in the background, no redirects). I can't see how this can result in a call back to the omnipay/Sagepay code. The router appears to call

Aimeos\Shop\Controller\CheckoutController@updateAction

...I have no idea what that does. It just seems to result in a view with this in it...

<?php echo $aibody['checkout/update']; ?>

I'll keep at it but I'm a bit lost. Is this sort of payment plugin ever going to work? Does aimeos have a provision to handle this callback or am I just wasting my time?

EDIT:
I stuck a (sophisticated) error_log(print_r($_POST, true)) at the start of the updateAction function and it's definitely getting called...

Code: Select all

Array\n(\n    [VPSProtocol] => 3.00\n    [TxType] => PAYMENT\n    [VendorTxCode] => 23\n    [VPSTxId] => {967123D4-C0AF-F4BF-2976-EA58EA6CEEDD}\n    [Status] => OK\n    [StatusDetail] => 0000 : The Authorisation was Successful.\n    [TxAuthNo] => 7778781....
...but it doesn't seem to be doing anything useful

EDIT EDIT:
I dug more and ended up in the depths of some terrifying factory classes in ext/ai-client-html/client/html/src/Client/Html/Checkout/Update which I *think* is what gets called to process the update request. However, I've really hit a brick wall now as I can't figure out what these are doing (or, how I might replace them as I suspect that's what's coming next)

EDIT EDIT EDIT:
It's this I take it... https://aimeos.org/docs/Configuration/C ... out_update

The problem is that I really don't understand that code enough (at all!) to come up with a version that will work :(

User avatar
aimeos
Administrator
Posts: 7881
Joined: 01 Jan 1970, 00:00

Re: Is there any chance of Sagepay_server payment working?

Post by aimeos » 07 Nov 2020, 08:37

The Checkout Update component you have already found uses the updatePush() method of the Omnipay integration:
https://github.com/aimeoscom/ai-payment ... #L487-L520

The Omnipay integration calles the acceptNotification() method where the SagePay driver should evaluate the parameters sent by SagePay within the request:
https://github.com/aimeoscom/ai-payment ... #L504-L505

The acceptNotification() method seems to be implemented by both, ServerGateway and DirectGateway:
https://github.com/thephpleague/omnipay ... hp#L44-L47

Hope that helps you to dig deeper ...
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

thepurpleblob
Posts: 20
Joined: 22 Oct 2020, 15:39

Re: Is there any chance of Sagepay_server payment working?

Post by thepurpleblob » 08 Nov 2020, 22:25

Thanks for the help but it's way too complicated - it was going to take too long to figure it all out.

I managed to get SagePay working in a different payment mode which isn't ideal but will do for now. I appreciate you taking the trouble to look at this. I may well come back to it once I have more time (I'm under pressure to get something working)

Post Reply