feat(core): Add support for CI workflows and update gitignore
This commit is contained in:
55
ts/fidor/csv-fidor.classes.csvfidor.ts
Normal file
55
ts/fidor/csv-fidor.classes.csvfidor.ts
Normal file
@ -0,0 +1,55 @@
|
||||
import * as plugins from '../csvparser.plugins.js';
|
||||
|
||||
import { ExtendedDate } from '@push.rocks/smarttime';
|
||||
|
||||
import * as interfaces from './interfaces/index.js';
|
||||
|
||||
export class CsvFidor extends plugins.portablefinance.AcCsvParser<plugins.portablefinance.IMonetaryTransaction> {
|
||||
|
||||
// INSTANCE
|
||||
public paymentProviderName: string = 'Fidor Bank AG';
|
||||
public description: string = 'a csv parser optimized for csv files from Fidor.';
|
||||
public csvDescriptorArray: plugins.portablefinance.ICsvDescriptor[] = [];
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
addCsvDecriptor (csvDescriptorArg: plugins.portablefinance.ICsvDescriptor): void {
|
||||
this.csvDescriptorArray.push(csvDescriptorArg);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the transactions
|
||||
*/
|
||||
public async getTransactions(): Promise<plugins.portablefinance.IMonetaryTransaction[]> {
|
||||
const payments: plugins.portablefinance.IMonetaryTransaction[] = [];
|
||||
|
||||
for (const csvDescriptor of this.csvDescriptorArray) {
|
||||
const csvInstance = new plugins.smartcsv.Csv(csvDescriptor.contentString, {
|
||||
headers: true
|
||||
});
|
||||
|
||||
const fidorTransactionArray: interfaces.IFidorOriginalTransaction[] = await csvInstance.exportAsObject();
|
||||
for (const transaction of fidorTransactionArray) {
|
||||
payments.push({
|
||||
id: await plugins.smarthash.sha265FromObject(transaction),
|
||||
data: {
|
||||
additionalIds: [],
|
||||
amount: parseFloat(transaction.Wert.replace('.', '').replace(',', '.')),
|
||||
date: plugins.smarttime.ExtendedDate.fromEuropeanDate(transaction.Datum).getTime(),
|
||||
name: transaction.Beschreibung,
|
||||
description: transaction.Beschreibung2,
|
||||
originAccountId: null,
|
||||
originTransactionId: null,
|
||||
paymentAccountId: null,
|
||||
justForLooks: null,
|
||||
voucherData: null,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return payments;
|
||||
}
|
||||
}
|
1
ts/fidor/index.ts
Normal file
1
ts/fidor/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './csv-fidor.classes.csvfidor.js';
|
1
ts/fidor/interfaces/index.ts
Normal file
1
ts/fidor/interfaces/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './interfaces.fidortransaction.js';
|
6
ts/fidor/interfaces/interfaces.fidortransaction.ts
Normal file
6
ts/fidor/interfaces/interfaces.fidortransaction.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export interface IFidorOriginalTransaction {
|
||||
Datum: string;
|
||||
Beschreibung: string;
|
||||
Beschreibung2: string;
|
||||
Wert: string;
|
||||
}
|
Reference in New Issue
Block a user