New code for transaction processing and frontend

This commit is contained in:
James Cole
2023-08-22 08:25:06 +02:00
parent f67ff98d78
commit 2404f5299c
13 changed files with 380 additions and 51 deletions

View File

@@ -0,0 +1,47 @@
/*
* parse-from-entries.js
* Copyright (c) 2023 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
*
* @param entries
*/
export function parseFromEntries(entries) {
let returnArray = [];
for (let i in entries) {
if (entries.hasOwnProperty(i)) {
const entry = entries[i];
let current = {};
// fields for transaction
current.description = entry.description;
current.source_name = entry.source_account.name;
current.destination_name = entry.destination_account.name;
current.amount = entry.amount;
current.date = entry.date;
// TODO transaction type is hard coded:
current.type = 'withdrawal';
returnArray.push(current);
}
}
return returnArray;
}