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

Dotpay\Exception\BadParameter for currency and language #18

Open
ilnytskyi opened this issue Mar 31, 2021 · 0 comments
Open

Dotpay\Exception\BadParameter for currency and language #18

ilnytskyi opened this issue Mar 31, 2021 · 0 comments

Comments

@ilnytskyi
Copy link
Contributor

ilnytskyi commented Mar 31, 2021

\Dotpay\Resource\Channel\Request

This class throws exception like

Dotpay\Exception\BadParameter\LanguageException: Incorrect language: nl

or

Incorrect currency:

Even when the module is disabled. In our case this happened for Nederlands and Serbia
I looks like the module does not check if a certain feature is active when retreiving the config

payment/dotpay_main/active,0
payment/dotpay_oc/active,0
payment/dotpay_cc/active,0
\Dotpay\Payment\Model\Ui\AbstractConfigProvider::getConfig
and here
\Dotpay\Payment\Model\Ui\AbstractConfigProvider::getAgreements
It always builds and send a request

None of exceptions from \Dotpay\Resource\Channel\Request should happen and no requests to Dotpay server should be sent if the module is disabled under a store or globally.

On timeline view we can see that module performs curl request even when disabled, that cost our CPU additional 450ms.

Selection_580

Please fix both issues.

WORKAROUND:
Patch methods, and add a fallback to accepted values instead of throwing an exception

        if (!Language::validate($language)) {
            //throw new LanguageException($language);
            //fallback to english
            $language = (string) 'en';
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant