mirror of
https://github.com/anikeen-com/id.git
synced 2026-03-15 22:56:13 +00:00
refactored code
Signed-off-by: Maurice Preuß (envoyr) <hello@envoyr.com>
This commit is contained in:
@@ -4,6 +4,7 @@ namespace Anikeen\Id\Concerns;
|
||||
|
||||
use Anikeen\Id\ApiOperations\Request;
|
||||
use Anikeen\Id\Exceptions\RequestRequiresClientIdException;
|
||||
use Anikeen\Id\Resources\Transactions;
|
||||
use Anikeen\Id\Result;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
@@ -17,33 +18,9 @@ trait ManagesTransactions
|
||||
* @throws RequestRequiresClientIdException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function transactions(): Result
|
||||
public function transactions(): Transactions
|
||||
{
|
||||
return $this->request('GET', 'v1/transactions');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new transaction for the current user.
|
||||
*
|
||||
* @param array $attributes The attributes for the transaction.
|
||||
* @throws RequestRequiresClientIdException
|
||||
* @throws GuzzleException
|
||||
* @todo Add type hinting for the attributes array.
|
||||
*/
|
||||
public function createTransaction(array $attributes = []): Result
|
||||
{
|
||||
return $this->request('POST', 'v1/transactions', $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get given transaction from current current user.
|
||||
*
|
||||
* @param string $transactionId The transaction ID.
|
||||
* @throws RequestRequiresClientIdException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function transaction(string $transactionId): Result
|
||||
{
|
||||
return $this->request('GET', sprintf('v1/transactions/%s', $transactionId));
|
||||
return (new Transactions($this->request('GET', 'v1/transactions')))
|
||||
->setBillable($this);;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user