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

Problem with empty parameters #3

Open
devnix opened this issue Nov 17, 2020 · 2 comments
Open

Problem with empty parameters #3

devnix opened this issue Nov 17, 2020 · 2 comments

Comments

@devnix
Copy link

devnix commented Nov 17, 2020

There is a funny problem with the optional parameters. I was getting a SIS0024 error (Ds_Merchant_ConsumerLanguage has a length superior to 3), and I've found that when JSON encoding, of course, the generated JSON has a null parameter.

Unfortunately, Redsys does not parse the JSON well and reads the null parameter as a string, interpreting the parameter Ds_Merchant_ConsumerLanguage as "null". Also, once I've solved that parameter, Redsys redirected me to https://sis-t.redsys.es:25443/sis/null?[...] leading to a 404 page, and I guess that it is caused for the same reason.

Maybe a solution could be to iterate through the params array, unsettling the null ones? (not the empty() ones to avoid unsetting a 0 or "0" value)
https://github.com/PatronBase/omnipay-redsys/blob/master/src/Message/PurchaseRequest.php#L161-L175

@leith
Copy link
Member

leith commented Nov 24, 2020

I'd need to review the documentation. From memory I thought the consumer language was a required parameter, so unsetting it (or setting it to an invalid value like null) should rightly break the integration, as it hasn't been set up properly. Anything optional which is null can probably be unset, though. Happy to review a PR/tests.

@devnix
Copy link
Author

devnix commented Nov 24, 2020

It's not a mandatory field. The real problem is that Redsys reads null as a string. No joke.

I'm working on a fork, I could make a PR, but I'm afraid some things are not BC compatible! (but maybe we could leave a deprecated API still available)

For example, I've renamed the parameter consumerLanguage to language. Omnipay doesn't seem to define a standard parameter for language selection for a payment gateway, but the implementations I've seen around uses a plain language parameter, accepting only ISO 639 alpha 2 codes.

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

2 participants