Page 1 of 1

Aimeos send incorrect successUrl to Payment Provider

Posted: 22 Oct 2021, 08:18
by gizmo
Hi There

I'm setting up Datarans as a Payment provider for Visa and Mastercard. on TYPO3 V10.4.21 And Aimeos for Typo3 21.7.2. Omnipay 3.1.2 and and the academe/omnipay-datatrans v3.0.5 is being used.

The Service works and the user is sent to the datatrans Page to enter the creditcard details. The Problem is that Aimeos sends the wrong return URLs to Datatrans. It sends the return URLs without the "https:" and therefore the customer cant return.

The url it sends with the POST Call:
//mydomain.com/confirm?action=confirm&code=visa&controller=Checkout

What it should send:
https://mydomain.com/confirm?action=con ... r=Checkout

If I set the url manually in the payment service with "payment.url-success" then it works. But this is very tedious and error prone.

On Typo3 I set the Site Config correct with the "https:" --> base url is: https://mydomain.com

Do I have to set the base url somewhere specific in Aimeos? Or do I have to overwrite the Config?

I've read this docs page, but it explains how to add and not overwrite a paramter
https://aimeos.org/docs/2021.x/provider ... figuration

Thanks for the Help!

Re: Aimeos send incorrect successUrl to Payment Provider

Posted: 23 Oct 2021, 06:29
by aimeos
This is a behavior of the TYPO3 UriBuilder Aimeos uses for generating URLs and seem to happen in a few installations but we don't know why and were never able to reproduce that locally. Asking one of the TYPO3 core developers also revealed no solution.

Can you debug the TYPO3 URL code of your installation to see where and why the protocol is missing?

Re: Aimeos send incorrect successUrl to Payment Provider

Posted: 23 Oct 2021, 09:56
by gizmo
Thanks for the hint, I think I found the problem (at least it works).

Aimeos doesn't deliver the scheme ('https') to the TYPO3 UriBuilder, so it return nothing. I'm not sure why the Typo3 UriBuilder doesnt return a default scheme if the option absuoluteUri is set to 'true'.
(https://github.com/TYPO3/typo3/blob/c18 ... r.php#L287).

The config for the UriBuilder is set here in the Function "getUrlUpdate" and "getUrlConfirm".

So I set in TYPO3 manually the config for the scheme and now it works.

Here is config I set in TypoScript:
plugin.tx_aimeos.settings.client.html.checkout.update.url.config.scheme = https
plugin.tx_aimeos.settings.client.html.checkout.confirm.url.config.scheme = https

I think it would make sense to include this in the aimeos EXT. I'm not sure where this would be added, since the config/controller.php file (https://github.com/aimeos/ai-client-htm ... roller.php) doesn't contain any other url config settings.

Re: Aimeos send incorrect successUrl to Payment Provider

Posted: 27 Oct 2021, 09:31
by aimeos
The problem exists since TYPO3 10.4.17:
https://forge.typo3.org/issues/95796

Re: Aimeos send incorrect successUrl to Payment Provider

Posted: 27 Oct 2021, 15:43
by aimeos
Problem solved in aimeos/ai-typo3:2021.10.2
There was a patch in TYPO3 10.4.17+ which changed the behavior of setAbsoluteUriScheme() of the UriBuilder.