Add bank synchronization features with FinTS support and update dependencies
This commit is contained in:
73
convex/bank/types.ts
Normal file
73
convex/bank/types.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import type { Id } from "../_generated/dataModel";
|
||||
|
||||
export type BankProviderName = "comdirect" | "fints";
|
||||
|
||||
export type NormalizedAccount = {
|
||||
externalId: string;
|
||||
name: string;
|
||||
iban?: string;
|
||||
balance: number;
|
||||
currency: string;
|
||||
};
|
||||
|
||||
export type NormalizedBalance = {
|
||||
externalId: string;
|
||||
balance: number;
|
||||
currency: string;
|
||||
};
|
||||
|
||||
export type NormalizedTransaction = {
|
||||
externalRef?: string;
|
||||
bookingDate?: string;
|
||||
valueDate?: string;
|
||||
description: string;
|
||||
counterparty?: string;
|
||||
amount: number;
|
||||
vorgang?: string;
|
||||
isPending: boolean;
|
||||
rawText?: string;
|
||||
categoryName?: string;
|
||||
assignedMonth?: string;
|
||||
effectiveMonth?: string;
|
||||
};
|
||||
|
||||
export interface BankDataProvider {
|
||||
readonly name: BankProviderName;
|
||||
getAccounts(): Promise<NormalizedAccount[]>;
|
||||
getBalance(accountExternalId: string): Promise<NormalizedBalance>;
|
||||
getTransactions(
|
||||
accountExternalId: string,
|
||||
from: string,
|
||||
to: string,
|
||||
): Promise<NormalizedTransaction[]>;
|
||||
}
|
||||
|
||||
export type SyncJobState = {
|
||||
phase: "init" | "fetch_accounts" | "fetch_transactions" | "persist" | "done";
|
||||
from: string;
|
||||
to: string;
|
||||
accountId?: Id<"accounts">;
|
||||
provider: BankProviderName;
|
||||
accounts: NormalizedAccount[];
|
||||
accountIndex: number;
|
||||
rows: Array<{
|
||||
accountExternalId: string;
|
||||
transactions: NormalizedTransaction[];
|
||||
}>;
|
||||
};
|
||||
|
||||
export type ImportRow = {
|
||||
accountId?: Id<"accounts">;
|
||||
categoryName: string;
|
||||
bookingDate?: string;
|
||||
valueDate?: string;
|
||||
description: string;
|
||||
counterparty?: string;
|
||||
amount: number;
|
||||
vorgang?: string;
|
||||
isPending: boolean;
|
||||
rawText?: string;
|
||||
assignedMonth?: string;
|
||||
effectiveMonth?: string;
|
||||
externalRef?: string;
|
||||
};
|
||||
Reference in New Issue
Block a user