| Total Complexity | 2 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | trait Transactions |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Get a list of transactions for the current user. |
||
| 11 | * |
||
| 12 | * @param string|null $account |
||
| 13 | * @return \Amelia\Monzo\Models\Transaction[]|\Illuminate\Support\Collection |
||
| 14 | */ |
||
| 15 | public function transactions(string $account = null) |
||
| 16 | { |
||
| 17 | $results = $this->expand('merchant') |
||
| 18 | ->call('GET', 'transactions', [ |
||
| 19 | 'account_id' => $account ?? $this->getAccountId(), |
||
| 20 | ], [], 'transactions', false); |
||
| 21 | |||
| 22 | return collect($results)->map(function ($item) { |
||
| 23 | return new Transaction($item, $this); |
||
| 24 | }); |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Get a single transaction for a given ID. |
||
| 29 | * |
||
| 30 | * @param string $id |
||
| 31 | * @return \Amelia\Monzo\Models\Transaction |
||
| 32 | */ |
||
| 33 | public function transaction(string $id) |
||
| 39 | } |
||
| 40 | } |
||
| 41 |