Files
sparebank1_actual_budget_in…/src/mappings.ts
Martin Berg Alstad 480c0356f9 Fixes
- Added Actual account ids and log level to .env.example.
- Fixed timestamp error by downloading the budget after init.
- Hardcoded date in test.
- Separate logging file for configurations.
- Organized test
- More logging in main
- Fixed wrong paths for some files
- Load a .env.test.local file when running tests

Signed-off-by: Martin Berg Alstad <git@martials.no>
2024-12-23 16:47:07 +01:00

27 lines
831 B
TypeScript

import type { Transaction } from "@/bank/sparebank1.ts"
import type { TransactionEntity } from "@actual-app/api/@types/loot-core/types/models"
import type { UUID } from "node:crypto"
// TODO more fields / correct fields?
export function bankTransactionIntoActualTransaction(
transaction: Transaction,
accountId: UUID,
): TransactionEntity {
return {
id: transaction.id,
// Transactions with the same id will be ignored
imported_id: transaction.id,
account: accountId,
// The value without decimals
amount: transaction.amount * 100,
date: transaction.date,
payee: transaction.description,
}
}
// TODO take the account from the bank and match it to the actual account
// Use ENV
export function bankAccountIntoActualAccount(account: string): string {
throw new Error("Not implemented")
}