Adyen / adyen-shopware6

Adyen Payment plugin for Shopware 6
MIT License
21 stars 22 forks source link

[ECP-8842] AbstractPaymentMethodHandler - Might result in TypeError upon adding the product URL $isOpenInvoice=true #405

Closed AndreasA closed 1 month ago

AndreasA commented 1 year ago

Describe the bug In https://github.com/Adyen/adyen-shopware6/blob/develop/src/Handlers/AbstractPaymentMethodHandler.php#L637

you use $salesChannelContext->getSalesChannel()->getDomains()->first()->getUrl(), to retrieve a potential URL.

However, the domains might be empty - e.g. headless sales channels do not require those except for rare cases like double opt-in etc. so this might fail. also it ignores langauge etc.

Change that code to something like:

$productUrl = null;
if (!is_null($product->getId())) {
$domainUrl = $salesChannelContext->getSalesChannel()->getDomains()?->first()?->getUrl();
if (!is_null($domainUrl)) {
                    $productUrl = sprintf(
                        "%s/detail/%s",
                        $domainUrl
                        $product->getId()
                    );
}
}

Versions Shopware version: 6.5.3.3 Plugin version: 3.12.0

candemiralp commented 10 months ago

Hello @AndreasA,

We have created an investigation ticket for this issue. Thank you for raising this one.

Best Regards, Can

adyen-integrations-support commented 1 month ago

Hey all,

This issue is fixed and new V4 and V3 plugin versions are released.

Best Regards.