Skip to content

Commit 3398519

Browse files
committed
try
1 parent 3865229 commit 3398519

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

src/TellerClient.php

+1-21
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ public function accountsCount(): int
4141

4242
public function getAccountDetails($accountId)
4343
{
44-
$response = $this->request('GET', "/accounts/{$accountId}/details");
45-
$data = $this->parseJsonResponse($response);
46-
return $data;
44+
return $this->get("/accounts/{$accountId}/details");
4745
}
4846

4947
public function getAccountBalances($accountId)
@@ -200,22 +198,4 @@ private function request($method, $path, $data = null): bool|string
200198
}
201199
}
202200

203-
public function parseJsonResponse($response)
204-
{
205-
// Check if the response is empty or not a string
206-
if (empty($response) || !is_string($response)) {
207-
throw new Exception("Invalid or empty response");
208-
}
209-
210-
// Attempt to decode the JSON response
211-
$data = json_decode($response, false, 512, JSON_THROW_ON_ERROR);
212-
213-
// Check for JSON decoding errors
214-
if (json_last_error() !== JSON_ERROR_NONE) {
215-
throw new Exception("JSON Error: " . json_last_error_msg());
216-
}
217-
218-
return $data;
219-
}
220-
221201
}

tests/TellerClientTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testListAccountDetails()
4343
$result = $teller->listAccounts();
4444
$accountId = $result[0]->id;
4545
$details = $teller->getAccountDetails($accountId);
46-
dd($details);
46+
$this->assertNotEmpty($details);
4747
}
4848

4949
public function testListAccountTransactions()

0 commit comments

Comments
 (0)