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

PayIn->BrowserInfo->Language: validation regex blocks some values like "en-GB-oxendict" #623

Open
kapposds opened this issue Jan 23, 2024 · 0 comments

Comments

@kapposds
Copy link

kapposds commented Jan 23, 2024

Attempting to create a MangoPay\PayIn object with type "card", I encounter an error when I assign a \MangoPay\BrowserInfo on the property "BrowserInfo". This happens when I assign "en-GB-oxendict" value to the "Language" property of the browser info object.

That is because the API's validation logic does not accept this language value. The error I get is the following:

Response JSON : {"Message":"One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.","Type":"param_error","Id":"feca8b2f-542c-434b-aa57-abaeaaaed92f","Date":1705938605.0,"errors":{"BrowserInfo.Language":"The field Language must match the regular expression '^.{0,6}$'."}}

The implementation that I do to collect the language values is the following:

    if (window && window.navigator) {
        language = window.navigator.language
            ? window.navigator.language
            : window.navigator.browserLanguage; // Else is for IE <+ 10
    }

So I think that Mangopay's should allow value of length more than 6 characters

@kapposds kapposds changed the title Payin Browser Info: validation regex blocks some values like "en-GB-oxendict" Payin->BrowserInfo->Language: validation regex blocks some values like "en-GB-oxendict" Jan 23, 2024
@kapposds kapposds changed the title Payin->BrowserInfo->Language: validation regex blocks some values like "en-GB-oxendict" PayIn->BrowserInfo->Language: validation regex blocks some values like "en-GB-oxendict" Jan 23, 2024
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