-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Description
Hi team,
I was integrating the SDK and was glad to see support for granular response code handling. However, it appears this isn’t actually used due to the call to ->returnApiResponse()
:
PayPal-PHP-Server-SDK/src/Controllers/PaymentsController.php
Lines 123 to 133 in 671a2b2
->throwErrorOn( | |
'422', | |
ErrorType::init( | |
'The request failed because it is semantically incorrect or failed business validation.', | |
ErrorException::class | |
) | |
) | |
->throwErrorOn('500', ErrorType::init('The request failed because an internal server error occurred.')) | |
->throwErrorOn('0', ErrorType::init('The error response.', ErrorException::class)) | |
->type(CapturedPayment::class) | |
->returnApiResponse(); |
This forces the implementing app to manually check isSuccessful()
and handle errors without context, which can be cumbersome.
I understand that removing ->returnApiResponse()
would be a breaking change, but doing so would also unlock better type safety and IDE support by allowing response models to be proper return types.
AlbinoDrought
Metadata
Metadata
Assignees
Labels
No labels