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

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

Open
AndreasA opened this issue Aug 3, 2023 · 1 comment
Assignees
Labels
Bug report Indicates that issue has been marked as a possible bug

Comments

@AndreasA
Copy link
Contributor

AndreasA commented Aug 3, 2023

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 candemiralp self-assigned this Dec 22, 2023
@candemiralp candemiralp changed the title AbstractPaymentMethodHandler - Might result in TypeError upon adding the product URL $isOpenInvoice=true [ECP-8842] AbstractPaymentMethodHandler - Might result in TypeError upon adding the product URL $isOpenInvoice=true Dec 22, 2023
@candemiralp
Copy link
Member

Hello @AndreasA,

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

Best Regards,
Can

@candemiralp candemiralp added the Bug report Indicates that issue has been marked as a possible bug label Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug report Indicates that issue has been marked as a possible bug
Projects
None yet
Development

No branches or pull requests

2 participants