sumup / sumup-ecom-php-sdk

SumUp eCom PHP SDK
Other
42 stars 19 forks source link

403 - Account temporary locked is not handled properly #6

Closed ofog closed 5 years ago

ofog commented 5 years ago

Accessing an account that is temporary locked (due to too many failed logins) results in a SumUp\HttpClients\Response of:

object(SumUp\HttpClients\Response)#261 (2) { ["httpResponseCode":protected]=> int(403) ["body":protected]=> object(stdClass)#268 (2) { ["error_message"]=> string(24) "Account temporary locked" ["error_code"]=> string(16) "TEMPORARY_LOCKED" } }

This isn't properly handled in the following file (line 102) and results in null being passed to SumUpResponseException which results in a Fatal Error.

https://github.com/sumup/sumup-ecom-php-sdk/blob/fe9d6ad5c9a5febfda3d5a7394b7906bd401a605/src/SumUp/HttpClients/Response.php#L101-L104

Error Detail:

Fatal error: Uncaught Error: Wrong parameters for SumUp\Exceptions\SumUpResponseException([string $message [, long $code [, Throwable $previous = NULL]]]) in vendor/sumup/sumup-ecom-php-sdk/src/SumUp/HttpClients/Response.php:103 Stack trace: #0 vendor/sumup/sumup-ecom-php-sdk/src/SumUp/HttpClients/Response.php(103): Exception->__construct(Object(stdClass), 403)
lyubomir-sumup commented 5 years ago

@ofog thanks for reporting this. It's now fixed in version 1.0.1