diff --git a/app/Helpers/Bank/Nordigen/Transformer/TransactionTransformer.php b/app/Helpers/Bank/Nordigen/Transformer/TransactionTransformer.php index 0d98b30c0033..f8fb444797f9 100644 --- a/app/Helpers/Bank/Nordigen/Transformer/TransactionTransformer.php +++ b/app/Helpers/Bank/Nordigen/Transformer/TransactionTransformer.php @@ -105,8 +105,8 @@ class TransactionTransformer implements BankRevenueInterface 'category_type' => array_key_exists('additionalInformation', $transaction) ? $transaction["additionalInformation"] : '', // TODO: institution specific keys like: GUTSCHRIFT, ABSCHLUSS, MONATSABSCHLUSS etc 'date' => $transaction["bookingDate"], 'description' => $description, - // 'description' => `IBAN: ${elem . json["bank_debtorAccount"] && elem . json["bank_debtorAccount"]["iban"] ? elem . json["bank_debtorAccount"]["iban"] : ' -'}\nVerwendungszweck: ${elem . json["bank_remittanceInformationStructured"] || ' -'}\nName: ${elem . json["bank_debtorName"] || ' -'}`, // 2 fields to get data from (structured and structuredArray (have to be joined)) - // TODO: debitor name & iban & bic + 'debitor' => array_key_exists('debtorAccount', $transaction) && array_key_exists('iban', $transaction["debtorAccount"]) ? $transaction['debtorAccount']['iban'] : null, + 'debitor_name' => array_key_exists('debtorName', $transaction) ? $transaction['debtorName'] : null, 'base_type' => (int) $transaction["transactionAmount"]["amount"] <= 0 ? 'DEBIT' : 'CREDIT', ]; diff --git a/app/Models/BankTransaction.php b/app/Models/BankTransaction.php index c3a7321e5c50..378945656705 100644 --- a/app/Models/BankTransaction.php +++ b/app/Models/BankTransaction.php @@ -34,6 +34,8 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @property string|null $date * @property int $bank_account_id * @property string|null $description + * @property string|null $debitor + * @property string|null $debitor_name * @property string $invoice_ids * @property int|null $expense_id * @property int|null $vendor_id @@ -68,7 +70,7 @@ class BankTransaction extends BaseModel use SoftDeletes; use MakesHash; use Filterable; - + const STATUS_UNMATCHED = 1; const STATUS_MATCHED = 2; @@ -84,10 +86,12 @@ class BankTransaction extends BaseModel 'base_type', 'expense_id', 'vendor_id', - 'amount' + 'amount', + 'debitor', + 'debitor_name' ]; - + public function getInvoiceIds() { $collection = collect(); @@ -162,7 +166,7 @@ class BankTransaction extends BaseModel // return $this->belongsTo(Expense::class)->withTrashed(); // } - public function service() :BankService + public function service(): BankService { return new BankService($this); } diff --git a/database/migrations/2023_11_26_082959_add_bank_integration_id.php b/database/migrations/2023_11_26_082959_add_bank_integration_id.php index faa2bd68cb68..11d777a7e55c 100644 --- a/database/migrations/2023_11_26_082959_add_bank_integration_id.php +++ b/database/migrations/2023_11_26_082959_add_bank_integration_id.php @@ -31,6 +31,12 @@ return new class extends Migration { $table->renameColumn('bank_integration_account_id', 'bank_integration_yodlee_account_id'); }); + // MAYBE migration of account->bank_account_id etc + Schema::table('bank_transactions', function (Blueprint $table) { + $table->string('debitor')->nullable(); // iban, credit-card info or else + $table->string('debitor_name')->nullable(); // name + }); + } /**