Generic Financial Data Importer/Exporter.
More...
|
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) |
|
|
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) |
|
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.
◆ AB_IMEXPORTER_FLAGS_GETPROFILEEDITOR_SUPPORTED
#define AB_IMEXPORTER_FLAGS_GETPROFILEEDITOR_SUPPORTED 0x00000001 |
◆ AB_IMEXPORTER
◆ AB_IMEXPORTER_ACCOUNTINFO
◆ AB_IMEXPORTER_CONTEXT
◆ AB_Banking_ExportToBuffer()
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
-
ab | banking API object |
ctx | export context containing the accounts, transactions etc to export |
exporterName | name of the exporter module (e.g. "csv", "swift", "ofx" etc) |
profileName | name 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) |
buf | buffer to write the exported data to |
◆ AB_Banking_ExportToFile()
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
-
ab | banking API object |
ctx | export context containing the accounts, transactions etc to export |
exporterName | name of the exporter module (e.g. "csv", "swift", "ofx" etc) |
profileName | name 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) |
fileName | name 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
-
ab | banking API object |
ctx | export context containing the accounts, transactions etc to export |
exporterName | name of the exporter module (e.g. "csv", "swift", "ofx" etc) |
profileName | name of the exporter settings profile stored in the file whose name is given in profileFile |
profileFile | name of the file to load the exporter settings profile from. |
outFileName | name 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()
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
-
ab | pointer to the AB_BANKING object |
iec | pointer 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()
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
-
ab | pointer to the AB_BANKING object |
localAccount | account from which local info is copied (may be NULL) |
t | transaction to fill |
◆ AB_Banking_GetImExporter()
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
-
ab | pointer 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
-
ab | pointer to the AB_BANKING object |
name | name of the importer whose profiles are to be read |
◆ AB_Banking_ImportBuffer()
◆ 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
-
ab | banking API object |
ctx | import context to receive the imported accounts, transactions etc |
importerName | name of the importer module (e.g. "csv", "swift", "ofx" etc) |
profileName | name of the importer settings profile stored in the file whose name is given in profileFile |
profileFile | name 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 |
sio | IO 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
-
ab | pointer to the AB_BANKING object |
imexporterName | name of the im-/exporter whose profile is to be written |
dbProfile | DB group containing the profile |
fname | name 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()
Writes all data to the given stream.
- Parameters
-
ie | pointer to the importer/exporter |
ctx | export context |
bio | stream to write to (usually a file, see GWEN_BufferedIO_File_new) |
dbProfile | configuration data for the exporter. You can get this using AB_Banking_GetImExporterProfiles. |
◆ AB_ImExporter_ExportToBuffer()
◆ AB_ImExporter_ExportToFile()
◆ AB_ImExporter_GetBanking()
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
-
ie | pointer to the importer/exporter |
dbProfile | configuration data for the exporter. You can get this using AB_Banking_GetImExporterProfiles. |
pDlg | pointer to a dialog pointer (receives the created dialog if any) |
- Returns
- 0 on success, error code otherwise
◆ AB_ImExporter_GetFlags()
Returns the flags if this im/exporter which specify the supported features.
◆ AB_ImExporter_GetName()
Returns the name of the im/exporter.
◆ AB_ImExporter_Import()
Reads the given stream and imports all data from it. This imported data is stored within the given context.
- Parameters
-
ie | pointer to the importer/exporter |
ctx | import context |
bio | stream to read from (usually a file, see GWEN_BufferedIO_File_new) |
dbProfile | configuration data for the importer. You can get this using AB_Banking_GetImExporterProfiles. |
◆ AB_ImExporter_ImportBuffer()
◆ AB_ImExporter_ImportFile()