aqbanking  5.7.8
Modules | Typedefs | Functions
Generic Im- and Exporter

Generic Financial Data Importer/Exporter. More...

Modules

 Im- and Exporter Context
 
 Im- and Exporter Account Info
 

Typedefs

typedef struct AB_IMEXPORTER AB_IMEXPORTER
 
typedef struct AB_IMEXPORTER_CONTEXT AB_IMEXPORTER_CONTEXT
 
typedef struct AB_IMEXPORTER_ACCOUNTINFO AB_IMEXPORTER_ACCOUNTINFO
 

Functions

AB_BANKINGAB_ImExporter_GetBanking (const AB_IMEXPORTER *ie)
 
const char * AB_ImExporter_GetName (const AB_IMEXPORTER *ie)
 
uint32_t AB_ImExporter_GetFlags (const AB_IMEXPORTER *ie)
 

Plugin Handling

GWEN_PLUGIN_DESCRIPTION_LIST2 * AB_Banking_GetImExporterDescrs (AB_BANKING *ab)
 
AB_IMEXPORTERAB_Banking_GetImExporter (AB_BANKING *ab, const char *name)
 
GWEN_DB_NODE * AB_Banking_GetImExporterProfiles (AB_BANKING *ab, const char *imExporterName)
 
GWEN_DB_NODE * AB_Banking_GetImExporterProfile (AB_BANKING *ab, const char *imExporterName, const char *profileName)
 
int AB_Banking_SaveLocalImExporterProfile (AB_BANKING *ab, const char *imexporterName, GWEN_DB_NODE *dbProfile, const char *fname)
 

Convenience Functions for Import/Export

For import and exports the following objects are generally needed:

  • im/exporter module (e.g. "csv", "ofx", "swift")
  • im/export profile with the settings for the im/exporter module (e.g. "SWIFT-MT940" for the "swift" importer)
  • im/export context (needed on import to store imported data, on export to hold the data to export)
  • source/destination for the data to import/export (e.g. a CSV-file, OFX file etc)

To make it easier for applications to import/export data this group contains some convenience functions which automatically load the appropriate im/exporter plugin and a selected im/exporter settings profile.

The raw im/export API of AqBanking works with GWEN_SYNCIO objects as source/destination for the formatted data. Such a GWEN_SYNCIO object can be a file or a buffer in memory. However, the functions in this group allow you just to specify the file to import from/export to and leave the gory details of setting up a GWEN_SYNCIO to AqBanking.

There are functions to:

  • import from a file
  • import from a memory buffer
  • export to a file
  • export to a memory buffer
int AB_Banking_FillGapsInImExporterContext (AB_BANKING *ab, AB_IMEXPORTER_CONTEXT *iec)
 
void AB_Banking_FillGapsInTransaction (AB_BANKING *ab, AB_ACCOUNT *localAccount, AB_TRANSACTION *t)
 
int AB_Banking_ExportToBuffer (AB_BANKING *ab, AB_IMEXPORTER_CONTEXT *ctx, const char *exporterName, const char *profileName, GWEN_BUFFER *buf)
 
int AB_Banking_ExportToFile (AB_BANKING *ab, AB_IMEXPORTER_CONTEXT *ctx, const char *exporterName, const char *profileName, const char *fileName)
 
int AB_Banking_ExportToFileWithProfile (AB_BANKING *ab, const char *exporterName, AB_IMEXPORTER_CONTEXT *ctx, const char *profileName, const char *profileFile, const char *outputFileName)
 
int AB_Banking_ExportWithProfile (AB_BANKING *ab, const char *exporterName, AB_IMEXPORTER_CONTEXT *ctx, const char *profileName, const char *profileFile, GWEN_SYNCIO *sio)
 
int AB_Banking_ImportBuffer (AB_BANKING *ab, AB_IMEXPORTER_CONTEXT *ctx, const char *exporterName, const char *profileName, GWEN_BUFFER *buf)
 
int AB_Banking_ImportFileWithProfile (AB_BANKING *ab, const char *importerName, AB_IMEXPORTER_CONTEXT *ctx, const char *profileName, const char *profileFile, const char *inputFileName)
 
int AB_Banking_ImportWithProfile (AB_BANKING *ab, const char *importerName, AB_IMEXPORTER_CONTEXT *ctx, const char *profileName, const char *profileFile, GWEN_SYNCIO *sio)
 

Flags returned by @ref AB_ImExporter_GetFlags

#define AB_IMEXPORTER_FLAGS_GETPROFILEEDITOR_SUPPORTED   0x00000001
 

Virtual Functions for Backends

int AB_ImExporter_Import (AB_IMEXPORTER *ie, AB_IMEXPORTER_CONTEXT *ctx, GWEN_SYNCIO *sio, GWEN_DB_NODE *dbProfile)
 
int AB_ImExporter_Export (AB_IMEXPORTER *ie, AB_IMEXPORTER_CONTEXT *ctx, GWEN_SYNCIO *sio, GWEN_DB_NODE *dbProfile)
 
int AB_ImExporter_GetEditProfileDialog (AB_IMEXPORTER *ie, GWEN_DB_NODE *dbProfile, const char *testFileName, GWEN_DIALOG **pDlg)
 
int AB_ImExporter_ImportFile (AB_IMEXPORTER *ie, AB_IMEXPORTER_CONTEXT *ctx, const char *fname, GWEN_DB_NODE *dbProfile)
 
int AB_ImExporter_ImportBuffer (AB_IMEXPORTER *ie, AB_IMEXPORTER_CONTEXT *ctx, GWEN_BUFFER *buf, GWEN_DB_NODE *dbProfile)
 
int AB_ImExporter_ExportToBuffer (AB_IMEXPORTER *ie, AB_IMEXPORTER_CONTEXT *ctx, GWEN_BUFFER *buf, GWEN_DB_NODE *dbProfile)
 
int AB_ImExporter_ExportToFile (AB_IMEXPORTER *ie, AB_IMEXPORTER_CONTEXT *ctx, const char *fname, GWEN_DB_NODE *dbProfile)
 
int AB_ImExporter_CheckFile (AB_IMEXPORTER *ie, const char *fname)
 

Detailed Description

Generic Financial Data Importer/Exporter.

This group contains a generic importer/exporter.

Importing

When importing this group reads transactions and accounts from a given stream (in most cases a file) and stores them in a given importer context.

The application can later browse through all transactions stored within the given context and import them into its own database as needed.

Macro Definition Documentation

◆ AB_IMEXPORTER_FLAGS_GETPROFILEEDITOR_SUPPORTED

#define AB_IMEXPORTER_FLAGS_GETPROFILEEDITOR_SUPPORTED   0x00000001

This module supports the function AB_ImExporter_GetEditProfileDialog

Definition at line 52 of file imexporter.h.

Typedef Documentation

◆ AB_IMEXPORTER

typedef struct AB_IMEXPORTER AB_IMEXPORTER

Definition at line 63 of file imexporter.h.

◆ AB_IMEXPORTER_ACCOUNTINFO

Definition at line 67 of file imexporter.h.

◆ AB_IMEXPORTER_CONTEXT

Definition at line 66 of file imexporter.h.

Function Documentation

◆ AB_Banking_ExportToBuffer()

int AB_Banking_ExportToBuffer ( AB_BANKING ab,
AB_IMEXPORTER_CONTEXT ctx,
const char *  exporterName,
const char *  profileName,
GWEN_BUFFER *  buf 
)

This function loads the given im/exporter plugin (if necessary) and also loads the given im/exporter settings profile. The resulting data is written to a GWEN_BUFFER (which is basically a memory buffer).

Returns
0 on success, an error code otherwise
Parameters
abbanking API object
ctxexport context containing the accounts, transactions etc to export
exporterNamename of the exporter module (e.g. "csv", "swift", "ofx" etc)
profileNamename of the exporter settings profile to use (most plugins only provide the "default" profile, but especially the CSV im/exporter has many profiles from which to choose)
bufbuffer to write the exported data to

◆ AB_Banking_ExportToFile()

int AB_Banking_ExportToFile ( AB_BANKING ab,
AB_IMEXPORTER_CONTEXT ctx,
const char *  exporterName,
const char *  profileName,
const char *  fileName 
)

This function loads the given im/exporter plugin (if necessary) and also loads the given im/exporter settings profile. The resulting data is written to the given file.

Returns
0 on success, an error code otherwise
Parameters
abbanking API object
ctxexport context containing the accounts, transactions etc to export
exporterNamename of the exporter module (e.g. "csv", "swift", "ofx" etc)
profileNamename of the exporter settings profile to use (most plugins only provide the "default" profile, but especially the CSV im/exporter has many profiles from which to choose)
fileNamename of the file to create and to write the formatted data to

◆ AB_Banking_ExportToFileWithProfile()

int AB_Banking_ExportToFileWithProfile ( AB_BANKING ab,
const char *  exporterName,
AB_IMEXPORTER_CONTEXT ctx,
const char *  profileName,
const char *  profileFile,
const char *  outputFileName 
)

This function basically does the same as AB_Banking_ExportToFile. However, it loads the exporter settings profile from a given file (as opposed to the forementioned function which loads the profile by name from the set of system- or user-wide installed profiles). So this functions allows for loading of special profiles which aren't installed.

Returns
0 on success, an error code otherwise
Parameters
abbanking API object
ctxexport context containing the accounts, transactions etc to export
exporterNamename of the exporter module (e.g. "csv", "swift", "ofx" etc)
profileNamename of the exporter settings profile stored in the file whose name is given in profileFile
profileFilename of the file to load the exporter settings profile from.
outFileNamename of the file to create and to write the formatted data to

◆ AB_Banking_ExportWithProfile()

int AB_Banking_ExportWithProfile ( AB_BANKING ab,
const char *  exporterName,
AB_IMEXPORTER_CONTEXT ctx,
const char *  profileName,
const char *  profileFile,
GWEN_SYNCIO *  sio 
)

◆ AB_Banking_FillGapsInImExporterContext()

int AB_Banking_FillGapsInImExporterContext ( AB_BANKING ab,
AB_IMEXPORTER_CONTEXT iec 
)

This function tries to fill missing fields in a given imexporter context. It tries to find the online banking accounts for all account info objects in the context and copies missing information (like IBAN, BIC, owner name etc).

Parameters
abpointer to the AB_BANKING object
iecpointer to the imexporter context to fill
Returns
0 if all accounts were found, 1 if there was at least 1 unknown account

◆ AB_Banking_FillGapsInTransaction()

void AB_Banking_FillGapsInTransaction ( AB_BANKING ab,
AB_ACCOUNT localAccount,
AB_TRANSACTION t 
)

This function tries to fill missing fields in a given transaction. It tries to fill missing data from the given local account (IBAN, BIC, owner name etc). It also fills in remote IBAN and BIC if the remote account is located in Germany.

Parameters
abpointer to the AB_BANKING object
localAccountaccount from which local info is copied (may be NULL)
ttransaction to fill

◆ AB_Banking_GetImExporter()

AB_IMEXPORTER* AB_Banking_GetImExporter ( AB_BANKING ab,
const char *  name 
)

Loads an importer/exporter backend with the given name. You can use AB_Banking_GetImExporterDescrs to retrieve a list of available im-/exporters. AqBanking remains the owner of the object returned (if any), so you must not free it.

◆ AB_Banking_GetImExporterDescrs()

GWEN_PLUGIN_DESCRIPTION_LIST2* AB_Banking_GetImExporterDescrs ( AB_BANKING ab)

Returns a list2 of available importers and exporters. You must free this list after using it via GWEN_PluginDescription_List2_freeAll. Please note that a simple GWEN_PluginDescription_List2_free would not suffice, since that would only free the list but not the objects stored within the list !

Parameters
abpointer to the AB_BANKING object

◆ AB_Banking_GetImExporterProfile()

GWEN_DB_NODE* AB_Banking_GetImExporterProfile ( AB_BANKING ab,
const char *  imExporterName,
const char *  profileName 
)

◆ AB_Banking_GetImExporterProfiles()

GWEN_DB_NODE* AB_Banking_GetImExporterProfiles ( AB_BANKING ab,
const char *  imExporterName 
)

Loads all available profiles for the given importer/exporter. This includes global profiles as well as local ones.

Local profiles overwrite global ones, allowing the user to customize the profiles. Local profiles are expected in a folder below the user local folder (e.g. "$HOME/.aqbanking"). The local profile folder for the CSV plugin is in "$HOME/.aqbanking/imexporters/csv/profiles".

The GWEN_DB returned contains one group for every loaded profile. Every group has the name of the profile it contains. Every group contains at least three variables:

  • char "name": name of the profile
  • int "isGlobal": this is 0 for profiles loaded from the users home directory and 1 otherwise.
  • char "fileName": name of the loaded file (without path, so it can be used for AB_Banking_SaveLocalImExporterProfile)

The remaining content of each group is completely defined by the importer/exporter.

You can use GWEN_DB_GetFirstGroup and GWEN_DB_GetNextGroup to browse the profiles.

The caller becomes the new owner of the object returned (if any). This makes him/her responsible for freeing it via GWEN_DB_Group_free.

You can use any of the subgroups below the returned one as argument to AB_ImExporter_Import.

Parameters
abpointer to the AB_BANKING object
namename of the importer whose profiles are to be read

◆ AB_Banking_ImportBuffer()

int AB_Banking_ImportBuffer ( AB_BANKING ab,
AB_IMEXPORTER_CONTEXT ctx,
const char *  exporterName,
const char *  profileName,
GWEN_BUFFER *  buf 
)

◆ AB_Banking_ImportFileWithProfile()

int AB_Banking_ImportFileWithProfile ( AB_BANKING ab,
const char *  importerName,
AB_IMEXPORTER_CONTEXT ctx,
const char *  profileName,
const char *  profileFile,
const char *  inputFileName 
)

Another convenience function to import a given file. (introduced in AqBanking 4.3.0)

◆ AB_Banking_ImportWithProfile()

int AB_Banking_ImportWithProfile ( AB_BANKING ab,
const char *  importerName,
AB_IMEXPORTER_CONTEXT ctx,
const char *  profileName,
const char *  profileFile,
GWEN_SYNCIO *  sio 
)

Imports data using a profile.

Parameters
abbanking API object
ctximport context to receive the imported accounts, transactions etc
importerNamename of the importer module (e.g. "csv", "swift", "ofx" etc)
profileNamename of the importer settings profile stored in the file whose name is given in profileFile
profileFilename of the file to load the exporter settings profile from. This should contain at least one profile in a "profile" group. If you want to use profiles installed with AqBanking you can specify its name via profileName and use NULL here
sioIO from which to import

Example for a profile file:

profile {
char name="test"
char shortDescr="Test"
char version="5.0.4"
char longDescr="Test Profile"
int import="1"
int export="1"
char type="csv"
char groupNames="transaction", "transfer", "debitnote", "line"
char dateFormat="DD.MM.YYYY"
int utc="0"
char subject="transactions"
int usePosNegField="0"
char posNegFieldName="posNeg"
int defaultIsPositive="1"
char valueFormat="float"
params {
quote="0"
title="1"
delimiter=";"
group="transaction"
columns {
1="remoteBankCode"
2="remoteAccountNumber"
3="remoteName[0]"
4="value/value"
5="purpose[0]"
6="purpose[1]"
} # columns
} # params
} # profile

◆ AB_Banking_SaveLocalImExporterProfile()

int AB_Banking_SaveLocalImExporterProfile ( AB_BANKING ab,
const char *  imexporterName,
GWEN_DB_NODE *  dbProfile,
const char *  fname 
)

Save the given profile in the local user folder of the given im-/exporter module. After that this profile will appear in the list returned by AB_Banking_GetImExporterProfiles. Existing profiles with the same file name (argument fname) will be overwritten. It is best practice to use the name of the profile plus ".conf" as file name (e.g. "testprofile.conf"). The caller has to make sure that the name of the profile is unique among all profiles of the given im-/exporter module, otherwise some profiles can not be loaded.

Parameters
abpointer to the AB_BANKING object
imexporterNamename of the im-/exporter whose profile is to be written
dbProfileDB group containing the profile
fnamename of the file to write without path (e.g. "testprofile.conf") (if NULL then the path is determined by AqBanking using the given name of the im-/exporter).

◆ AB_ImExporter_CheckFile()

int AB_ImExporter_CheckFile ( AB_IMEXPORTER ie,
const char *  fname 
)

This function checks whether the given importer supports the given file.

◆ AB_ImExporter_Export()

int AB_ImExporter_Export ( AB_IMEXPORTER ie,
AB_IMEXPORTER_CONTEXT ctx,
GWEN_SYNCIO *  sio,
GWEN_DB_NODE *  dbProfile 
)

Writes all data to the given stream.

Parameters
iepointer to the importer/exporter
ctxexport context
biostream to write to (usually a file, see GWEN_BufferedIO_File_new)
dbProfileconfiguration data for the exporter. You can get this using AB_Banking_GetImExporterProfiles.

◆ AB_ImExporter_ExportToBuffer()

int AB_ImExporter_ExportToBuffer ( AB_IMEXPORTER ie,
AB_IMEXPORTER_CONTEXT ctx,
GWEN_BUFFER *  buf,
GWEN_DB_NODE *  dbProfile 
)

◆ AB_ImExporter_ExportToFile()

int AB_ImExporter_ExportToFile ( AB_IMEXPORTER ie,
AB_IMEXPORTER_CONTEXT ctx,
const char *  fname,
GWEN_DB_NODE *  dbProfile 
)

◆ AB_ImExporter_GetBanking()

AB_BANKING* AB_ImExporter_GetBanking ( const AB_IMEXPORTER ie)

Returns the AB_BANKING object to which the im/exporter belongs.

◆ AB_ImExporter_GetEditProfileDialog()

int AB_ImExporter_GetEditProfileDialog ( AB_IMEXPORTER ie,
GWEN_DB_NODE *  dbProfile,
const char *  testFileName,
GWEN_DIALOG **  pDlg 
)

This function should return a dialog (see GWEN_DIALOG) which allows editing of the given profile. You can use AB_ImExporter_GetFlags to determine beforehand whether this function is supported (look for AB_IMEXPORTER_FLAGS_GETPROFILEEDITOR_SUPPORTED). (introduced in AqBanking 4.3.0)

Parameters
iepointer to the importer/exporter
dbProfileconfiguration data for the exporter. You can get this using AB_Banking_GetImExporterProfiles.
pDlgpointer to a dialog pointer (receives the created dialog if any)
Returns
0 on success, error code otherwise

◆ AB_ImExporter_GetFlags()

uint32_t AB_ImExporter_GetFlags ( const AB_IMEXPORTER ie)

Returns the flags if this im/exporter which specify the supported features.

◆ AB_ImExporter_GetName()

const char* AB_ImExporter_GetName ( const AB_IMEXPORTER ie)

Returns the name of the im/exporter.

◆ AB_ImExporter_Import()

int AB_ImExporter_Import ( AB_IMEXPORTER ie,
AB_IMEXPORTER_CONTEXT ctx,
GWEN_SYNCIO *  sio,
GWEN_DB_NODE *  dbProfile 
)

Reads the given stream and imports all data from it. This imported data is stored within the given context.

Parameters
iepointer to the importer/exporter
ctximport context
biostream to read from (usually a file, see GWEN_BufferedIO_File_new)
dbProfileconfiguration data for the importer. You can get this using AB_Banking_GetImExporterProfiles.

◆ AB_ImExporter_ImportBuffer()

int AB_ImExporter_ImportBuffer ( AB_IMEXPORTER ie,
AB_IMEXPORTER_CONTEXT ctx,
GWEN_BUFFER *  buf,
GWEN_DB_NODE *  dbProfile 
)

◆ AB_ImExporter_ImportFile()

int AB_ImExporter_ImportFile ( AB_IMEXPORTER ie,
AB_IMEXPORTER_CONTEXT ctx,
const char *  fname,
GWEN_DB_NODE *  dbProfile 
)

This is just a convenience function for AB_ImExporter_Import.