Expand API and refactor for user groups.

This commit is contained in:
James Cole
2023-09-21 15:50:49 +02:00
parent 7dbdf0c4ff
commit 0b220f3288
45 changed files with 950 additions and 243 deletions

View File

@@ -139,7 +139,7 @@ trait DepositValidation
// if the user submits an ID, but that ID is not of the correct type,
// return false.
if (null !== $accountId) {
$search = $this->accountRepository->find($accountId);
$search = $this->getRepository()->find($accountId);
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {
Log::debug(sprintf('User submitted an ID (#%d), which is a "%s", so this is not a valid source.', $accountId, $search->accountType->type));
Log::debug(sprintf('Firefly III accepts ID #%d as valid account data.', $accountId));
@@ -153,7 +153,7 @@ trait DepositValidation
// if user submits an IBAN:
if (null !== $accountIban) {
$search = $this->accountRepository->findByIbanNull($accountIban, $validTypes);
$search = $this->getRepository()->findByIbanNull($accountIban, $validTypes);
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {
Log::debug(sprintf('User submitted IBAN ("%s"), which is a "%s", so this is not a valid source.', $accountIban, $search->accountType->type));
$result = false;
@@ -167,7 +167,7 @@ trait DepositValidation
// if user submits a number:
if (null !== $accountNumber && '' !== $accountNumber) {
$search = $this->accountRepository->findByAccountNumber($accountNumber, $validTypes);
$search = $this->getRepository()->findByAccountNumber($accountNumber, $validTypes);
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {
Log::debug(
sprintf('User submitted number ("%s"), which is a "%s", so this is not a valid source.', $accountNumber, $search->accountType->type)

View File

@@ -115,7 +115,7 @@ trait OBValidation
// return false.
if (null !== $accountId && null === $accountName) {
Log::debug('Source ID is not null, but name is null.');
$search = $this->accountRepository->find($accountId);
$search = $this->getRepository()->find($accountId);
// the source resulted in an account, but it's not of a valid type.
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {

View File

@@ -108,7 +108,7 @@ trait WithdrawalValidation
// if there's an ID it must be of the "validTypes".
if (null !== $accountId && 0 !== $accountId) {
$found = $this->accountRepository->find($accountId);
$found = $this->getRepository()->find($accountId);
if (null !== $found) {
$type = $found->accountType->type;
if (in_array($type, $validTypes, true)) {