ondrakoupil / csob

PHP client for ČSOB payment gateway eAPI
MIT License
44 stars 18 forks source link

Malformed UTF8 character causes API returned HTTP code 400, which is not code 200. Probably wrong signature, check crypto keys. #17

Closed pavkriz closed 6 years ago

pavkriz commented 6 years ago

Malformed UTF8 character in cart's item name causes "API returned HTTP code 400, which is not code 200. Probably wrong signature, check crypto keys." exception.

Root cause: json_encode returns enpty string when serializing structure having malformed UTF8 character. One should check json_last_error() before send the request.

janbarasek commented 6 years ago

Do you use bank public key?

pavkriz commented 6 years ago

https://github.com/ondrakoupil/csob/blob/043a42ddca1366115c93303174aeaab8bb51ec9e/src/Client.php#L1409

json_last_error() should be checked before sending the request.

ondrakoupil commented 6 years ago

I'll look into it.

ondrakoupil commented 6 years ago

Should be fixed in https://github.com/ondrakoupil/csob/commit/1efb755b8fd081c3cec53be613c6988326986f6f, please can you verify it is OK now?