1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 22:22:32 +01:00

Transactions

This commit is contained in:
David Bomba 2022-07-30 12:10:42 +10:00
parent 3e84dbc357
commit a2b89d1476
2 changed files with 53 additions and 5 deletions

View File

@ -78,6 +78,31 @@ class Yodlee
}
public function getTransactions($token)
{
//$response = $this->bankRequest('/transactions', 'get', ['categoryId' => '2xx', 'fromDate' => '20xx22-07-29'], );
$response = Http::withHeaders($this->getHeaders(["Authorization" => "Bearer {$token}"]))->get($this->api_endpoint. "/transactions", ['categoryId' => '2']);
if($response->successful())
return $response->object();
if($response->failed())
return $response->body();
}
public function getTransactionCategories($token)
{
$response = $this->bankRequest('/transactions/categories', 'get', [], ["Authorization" => "Bearer {$token}"]);
return $response;
}
private function bankRequest(string $uri, string $verb, array $data = [], array $headers = [])
{

View File

@ -40,20 +40,43 @@ class YodleeApiTest extends TestCase
$this->assertNotNull($access_token);
}
public function testGetCategories()
{
$yodlee = new Yodlee(true);
$access_token = $yodlee->getAccessToken('sbMem62e1e69547bfb1');
$transactions = $yodlee->getTransactionCategories($access_token);
// nlog($transactions);
}
public function testGetAccounts()
{
$yodlee = new Yodlee(true);
// $data = [
// 'providerAccountId' => 11308693,
// ];
$access_token = $yodlee->getAccessToken('sbMem62e1e69547bfb1');
$accounts = $yodlee->getAccounts($access_token);
nlog($accounts);
// nlog($accounts);
}
public function testGetTransactions()
{
$yodlee = new Yodlee(true);
$access_token = $yodlee->getAccessToken('sbMem62e1e69547bfb1');
$transactions = $yodlee->getTransactions($access_token);
nlog($transactions);
}
// public function testCreateUser()