Fix account validation

This commit is contained in:
James Cole
2023-06-12 20:24:45 +02:00
parent e96d28b981
commit fe8635f1ce
4 changed files with 15 additions and 12 deletions

View File

@@ -56,12 +56,13 @@ trait WithdrawalValidation
{
$accountId = array_key_exists('id', $array) ? $array['id'] : null;
$accountName = array_key_exists('name', $array) ? $array['name'] : null;
$accountIban = array_key_exists('iban', $array) ? $array['iban'] : null;
Log::debug('Now in validateGenericSource', $array);
// source can be any of the following types.
$validTypes = [AccountType::ASSET, AccountType::REVENUE, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE];
if (null === $accountId && null === $accountName && false === $this->canCreateTypes($validTypes)) {
if (null === $accountId && null === $accountName && null === $accountIban && false === $this->canCreateTypes($validTypes)) {
// if both values are NULL we return TRUE
// because we assume the user doesnt want to submit / change anything.
// because we assume the user doesn't want to submit / change anything.
$this->sourceError = (string)trans('validation.withdrawal_source_need_data');
app('log')->warning('[a] Not a valid source. Need more data.');