|
2 | 2 |
|
3 | 3 | namespace Square\BankAccounts; |
4 | 4 |
|
5 | | -use GuzzleHttp\ClientInterface; |
| 5 | +use Psr\Http\Client\ClientInterface; |
6 | 6 | use Square\Core\Client\RawClient; |
7 | 7 | use Square\BankAccounts\Requests\ListBankAccountsRequest; |
8 | 8 | use Square\Core\Pagination\Pager; |
|
17 | 17 | use Square\Environments; |
18 | 18 | use Square\Core\Client\HttpMethod; |
19 | 19 | use JsonException; |
20 | | -use GuzzleHttp\Exception\RequestException; |
21 | 20 | use Psr\Http\Client\ClientExceptionInterface; |
22 | 21 | use Square\BankAccounts\Requests\GetByV1IdBankAccountsRequest; |
23 | 22 | use Square\Types\GetBankAccountByV1IdResponse; |
@@ -127,16 +126,6 @@ public function createBankAccount(CreateBankAccountRequest $request, ?array $opt |
127 | 126 | } |
128 | 127 | } catch (JsonException $e) { |
129 | 128 | throw new SquareException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); |
130 | | - } catch (RequestException $e) { |
131 | | - $response = $e->getResponse(); |
132 | | - if ($response === null) { |
133 | | - throw new SquareException(message: $e->getMessage(), previous: $e); |
134 | | - } |
135 | | - throw new SquareApiException( |
136 | | - message: "API request failed", |
137 | | - statusCode: $response->getStatusCode(), |
138 | | - body: $response->getBody()->getContents(), |
139 | | - ); |
140 | 129 | } catch (ClientExceptionInterface $e) { |
141 | 130 | throw new SquareException(message: $e->getMessage(), previous: $e); |
142 | 131 | } |
@@ -182,16 +171,6 @@ public function getByV1Id(GetByV1IdBankAccountsRequest $request, ?array $options |
182 | 171 | } |
183 | 172 | } catch (JsonException $e) { |
184 | 173 | throw new SquareException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); |
185 | | - } catch (RequestException $e) { |
186 | | - $response = $e->getResponse(); |
187 | | - if ($response === null) { |
188 | | - throw new SquareException(message: $e->getMessage(), previous: $e); |
189 | | - } |
190 | | - throw new SquareApiException( |
191 | | - message: "API request failed", |
192 | | - statusCode: $response->getStatusCode(), |
193 | | - body: $response->getBody()->getContents(), |
194 | | - ); |
195 | 174 | } catch (ClientExceptionInterface $e) { |
196 | 175 | throw new SquareException(message: $e->getMessage(), previous: $e); |
197 | 176 | } |
@@ -237,16 +216,6 @@ public function get(GetBankAccountsRequest $request, ?array $options = null): Ge |
237 | 216 | } |
238 | 217 | } catch (JsonException $e) { |
239 | 218 | throw new SquareException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); |
240 | | - } catch (RequestException $e) { |
241 | | - $response = $e->getResponse(); |
242 | | - if ($response === null) { |
243 | | - throw new SquareException(message: $e->getMessage(), previous: $e); |
244 | | - } |
245 | | - throw new SquareApiException( |
246 | | - message: "API request failed", |
247 | | - statusCode: $response->getStatusCode(), |
248 | | - body: $response->getBody()->getContents(), |
249 | | - ); |
250 | 219 | } catch (ClientExceptionInterface $e) { |
251 | 220 | throw new SquareException(message: $e->getMessage(), previous: $e); |
252 | 221 | } |
@@ -292,16 +261,6 @@ public function disableBankAccount(DisableBankAccountRequest $request, ?array $o |
292 | 261 | } |
293 | 262 | } catch (JsonException $e) { |
294 | 263 | throw new SquareException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); |
295 | | - } catch (RequestException $e) { |
296 | | - $response = $e->getResponse(); |
297 | | - if ($response === null) { |
298 | | - throw new SquareException(message: $e->getMessage(), previous: $e); |
299 | | - } |
300 | | - throw new SquareApiException( |
301 | | - message: "API request failed", |
302 | | - statusCode: $response->getStatusCode(), |
303 | | - body: $response->getBody()->getContents(), |
304 | | - ); |
305 | 264 | } catch (ClientExceptionInterface $e) { |
306 | 265 | throw new SquareException(message: $e->getMessage(), previous: $e); |
307 | 266 | } |
@@ -361,16 +320,6 @@ private function _list(ListBankAccountsRequest $request = new ListBankAccountsRe |
361 | 320 | } |
362 | 321 | } catch (JsonException $e) { |
363 | 322 | throw new SquareException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); |
364 | | - } catch (RequestException $e) { |
365 | | - $response = $e->getResponse(); |
366 | | - if ($response === null) { |
367 | | - throw new SquareException(message: $e->getMessage(), previous: $e); |
368 | | - } |
369 | | - throw new SquareApiException( |
370 | | - message: "API request failed", |
371 | | - statusCode: $response->getStatusCode(), |
372 | | - body: $response->getBody()->getContents(), |
373 | | - ); |
374 | 323 | } catch (ClientExceptionInterface $e) { |
375 | 324 | throw new SquareException(message: $e->getMessage(), previous: $e); |
376 | 325 | } |
|
0 commit comments