Expand API to return transaction groups.

This commit is contained in:
James Cole
2023-08-08 15:03:58 +02:00
parent 7a2d4c9bd2
commit 02c906afe6
12 changed files with 412 additions and 107 deletions

View File

@@ -41,7 +41,7 @@ trait TransactionFilter
*/
protected function mapTransactionTypes(string $type): array
{
$types = [
$types = [
'all' => [
TransactionType::WITHDRAWAL,
TransactionType::DEPOSIT,
@@ -65,7 +65,11 @@ trait TransactionFilter
'specials' => [TransactionType::OPENING_BALANCE, TransactionType::RECONCILIATION,],
'default' => [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER,],
];
return $types[$type] ?? $types['default'];
$return = [];
$parts = explode(',', $type);
foreach ($parts as $part) {
$return = array_merge($return, $types[$part] ?? $types['default']);
}
return array_unique($return);
}
}