Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

HBCI::API Class Reference

This is the central OpenHBCI wrapper class. More...

#include <api.h>

Inheritance diagram for HBCI::API:

Inheritance graph
[legend]
List of all members.

Public Methods

 API (bool readonly=false, bool retrievalOnly=false)
 ~API ()
File operations
Error loadEnvironment (const string &filename, unsigned int fl=HBCILOADER_DEFAULT)
Error saveEnvironment (const string &filename, unsigned int fl=HBCILOADER_DEFAULT) const
Object Retrieval
const list< Pointer< Bank > > & bankList () const
const list< Pointer< Bank > > & banks () const
Pointer< BankfindBank (int country, const string &instcode) const
Pointer< MediumfindMedium (const string &name) const
list< Pointer< Account > > getAccounts (int country=0, const string &bankId="*", const string &accountId="*") const
list< Pointer< User > > getUsers (int country=0, const string &instid="*", const string &userid="*") const
list< Pointer< Customer > > getCustomers (int country=0, const string &instid="*", const string &custid="*") const
Convenience Object Retrieval
Pointer< AccountfindAccount (int country, const string &instcode, const string &accnr, const string &suffix="") const
Pointer< UserfindUser (int country, const string &instcode, const string &user) const
Pointer< CustomerfindCustomer (int country, const string &instcode, const string &cust) const
int totalAccounts () const
int totalUsers () const
Manage Objects
void addBank (Pointer< Bank > b)
void removeBank (Pointer< Bank > b)
OutboxJob Management
Error addJob (Pointer< OutboxJob > job)
Error executeQueue (bool chg=true)
list< Pointer< OutboxJob > > queuedJobs () const
void clearQueueByResult (OutboxJob_Result result=HBCI_JOB_RESULT_NONE)
void clearQueueByStatus (OutboxJob_Status status=HBCI_JOB_STATUS_NONE)
void removeQueuedJob (Pointer< OutboxJob > job)
User Interaction
Pointer< ProgressMonitormonitor () const
void setMonitor (Pointer< ProgressMonitor > monitor)
Factory Methods
Pointer< BankbankFactory (int country=280, const string &bankCode="", const string &server="", int hbciVersion=HBCI_VERSION_201) const
Pointer< MediummediumFactory (const string &name, const string &mediumType)
Pointer< MediumcreateNewMedium (const string &mtype, bool readonly, int country, const string &bankId, const string &userId, const string &name)
Pointer< MediummediumFromConfig (SimpleConfig &cfg, cfgPtr group)
Error mediumToConfig (Pointer< Medium > m, SimpleConfig &cfg, cfgPtr group)
MediumType mediumType (const string &mtype)
string pluginPath () const
Pointer< MediumPluginListenumerateMediumPlugins ()
Medium Plugin Management
Error registerMediumPlugin (Pointer< MediumPlugin > mp)
Error loadMediumPlugin (const string &path)

Static Public Methods

Static Factory Methods
Pointer< UseruserFactory (Pointer< Bank > b, Pointer< Medium > m, const string &userid, int version=0, const string &userName="", bool knowsSupportedJobs=false)
Pointer< CustomercustomerFactory (Pointer< User > u, const string &id, const string &role)
Pointer< AccountaccountFactory (Pointer< Bank > b, const string &accountId="", const string &accountSubId="")
Counter for transaction ids
unsigned nextTransactionId ()
unsigned lastTransactionId ()
void setLastTransactionId (unsigned int i)

Friends

class OutboxJobKeys
class OutboxJobSynchronize
class OutboxJobDisableKeys
class OutboxJobChangeKeys

Detailed Description

This is the central OpenHBCI wrapper class.

Once you got an existing OpenHBCI configuration file and setup, you only need a few steps to use it:

For first-time use, there are a few additional steps. As an example, have a look at aqmoney and/or cmoney and what they do. In short:
Author:
Martin Preuss<martin@libchipcard.de>


Constructor & Destructor Documentation

HBCI::API::API bool    readonly = false,
bool    retrievalOnly = false
 

Constructor.

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
readonly  if true then no jobs are allowed which actually do something with your account at the bank. (e.g. JobSingleTransfer)
retrievalOnly  If set to true, OpenHBCI will only store the minimum of data per account required for subsequent retrieval of account data. I.e. it will not store the balance, transactions, and standing orders of an account.

HBCI::API::~API  
 

Default Destructor.


Member Function Documentation

Pointer<Account> HBCI::API::accountFactory Pointer< Bank   b,
const string &    accountId = "",
const string &    accountSubId = ""
[static]
 

Creates an account object.

This will NOT be automatically added to internally stored lists.

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
b  The bank that this account belongs to.
accountId  The account number (id) that identifies this account.
accountSubId  New in HBCI2.2: The suffix of the account number.

void HBCI::API::addBank Pointer< Bank   b
 

Add a bank.

Add a bank to the internally stored list. Throws an Error if this bank already exists.

Author:
Martin Preuss<martin@libchipcard.de>

Error HBCI::API::addJob Pointer< OutboxJob   job
 

Add a job to the internal outbox queue.

This method accepts a HBCI::Pointer to an OutboxJob, not one to a derived class OutboxJobSomething. Since the HBCI::Pointer doesn't do automatic (up)casting, you need to use the Pointer's Pointer::cast() method explicitly: Use myApi.addJob(myDerivedJob.cast<OutboxJob>()).

Unlike in former versions you still have access to the jobs, since you only supply a pointer with this method.

For now no error is returned (i.e. it will always indicate success), but maybe later this method will check if the given job fits into the current queue.

Author:
Martin Preuss<martin@libchipcard.de>

Pointer<Bank> HBCI::API::bankFactory int    country = 280,
const string &    bankCode = "",
const string &    server = "",
int    hbciVersion = HBCI_VERSION_201
const
 

Creates a bank object.

This will NOT be automatically added to internally stored lists.

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
country  The ISO-3166 country code of this bank. ("280" is for Germany; see also HBCI::Bank::countryCode.)
bankCode  The bank code of this bank.
server  The IP address of the HBCI server of this bank.
hbciVersion  The HBCI protocol version used with this bank in dotted notation.

const list<Pointer<Bank> >& HBCI::API::bankList   const [inline]
 

Returns the list of known banks.

List of known banks. May be used for browsing or saving them to disk. This method is deprecated, newer programs should use banks() instead.

Returns :
a list of all known banks
Author:
Martin Preuss<martin@libchipcard.de>

const list<Pointer<Bank> >& HBCI::API::banks   const [inline]
 

Returns the list of known banks.

List of known banks. May be used for browsing or saving them to disk.

Returns :
a list of all known banks
Author:
Martin Preuss<martin@libchipcard.de>

void HBCI::API::clearQueueByResult OutboxJob_Result    result = HBCI_JOB_RESULT_NONE
 

Remove all jobs with the given result code.

Parameters:
result  The result code, where all jobs with that result code are removed from the queue. If HBCI_JOB_RESULT_NONE is given then ALL jobs are removed.
Author:
Martin Preuss<martin@libchipcard.de>

void HBCI::API::clearQueueByStatus OutboxJob_Status    status = HBCI_JOB_STATUS_NONE
 

Remove all jobs with the given status code.

Parameters:
status  The status code, where all jobs with that status code are removed from the queue. If HBCI_JOB_RESULT_NONE is given then ALL jobs are removed.
Author:
Martin Preuss<martin@libchipcard.de>

Pointer<Medium> HBCI::API::createNewMedium const string &    mtype,
bool    readonly,
int    country,
const string &    bankId,
const string &    userId,
const string &    name
 

Creates a new Medium object (and perhaps a new medium file).

The newly created object will not be added to internally stored lists; also, no bank, user, or customer object is being created.

In case of a DDV medium (chip card) there is not much to be done since all the information is on the DDV chipcard -- therefore simply the Medium object is created and returned.

In case of a RDH medium (keyfile), this method will perform the following steps:

  • Create the keyfile if it does not exist. If a file with the same name does exist already, then this method will assume that this file already is a keyfile and will return the MediumRDHBase object with the path of that file (without further checking, i.e. if that file isn't a keyfile, you will run into errors upon medium mounting).
  • For a new file, create the given user on the medium.
  • For a new file, generate new sign and crypt keys for this user
  • Save the new keyfile and return the MediumRDHBase object pointing to that file.
Throws an Error upon error, e.g. when bankId or userid are empty.

Please note that under no circumstances this method will overwrite a file. If the file already exists, then this method assumes that the file contains a valid medium. In that case no keys will be created. You can try to mount the medium after calling this method to check if the existing file really is a medium. But beware: when changing data in the medium prior to mounting it (e.g. by creating new keys) then the file may be overwritten by the medium class. (see also MediumRDHBase )

Author:
Martin Preuss<martin@libchipcard.de>
Returns :
smart pointer to the new medium created
Parameters:
mtype  chooses the kind of medium to be created
readonly  REMOVE_ME
country  ISO-3166 country code. In HBCI, "280" stands for Germany (see also Bank::countryCode)
bankId  The bank code of the bank of this user (German "Bankleitzahl")
userId  The user ID of the user; assigned by the bank
name  For DDV media (chip card), this should be the unique card number stored on the card, or simply an empty string. For RDH media (keyfile), this MUST be the full path and filename of the keyfile.

Pointer<Customer> HBCI::API::customerFactory Pointer< User   u,
const string &    id,
const string &    role
[static]
 

Creates a customer object.

This will NOT be automatically added to the given user.

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
u  The user this customer (role) belongs to
id  The customer ID that the bank assigned to this customer.
role  The name of this customer. You can choose this name as you like, e.g. "business", "private" or whatever you prefer. I.e. you can set this to any arbitrary string you consider helpful.

Pointer<MediumPluginList> HBCI::API::enumerateMediumPlugins  
 

Error HBCI::API::executeQueue bool    chg = true
 

Execute jobs in queue.

This method executes all jobs in the outbox queue.

The jobs remain in the queue until you remove them either via clearQueueByStatus() or via clearQueueByResult(). Since the queue contains a list of (reference-counting) Pointers, the jobs will only be destroyed via clearQueueBy*() if you don't have any further Pointers stored on your own, otherwise your own Pointers will still be valid and will take care of deletion.

Parameters:
chg  Specifies whether the jobs in the queue are allowed to change your OpenHBCI data. This affects both HBCI-specific data such as the UPD/BPD (user/bank parameter data) as well as financial data of your accounts such as balance, transactions and standing orders. If this flag is false, then NO changes are made in your OpenHBCI data at all. FIXME: Maybe we should modify this, at least the UPD/BPD should be updated accordingly ! (Martin)
Author:
Martin Preuss<martin@libchipcard.de>

Pointer<Account> HBCI::API::findAccount int    country,
const string &    instcode,
const string &    accnr,
const string &    suffix = ""
const
 

Searches for an account in the internally stored list. No joker or wildcard allowed.

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
country  Country code of the bank
instcode  Bank code of the bank
accnr  Account number of the account
suffix  New in HBCI2.2: Account number suffix

Pointer<Bank> HBCI::API::findBank int    country,
const string &    instcode
const
 

Search for a bank.

Searches for a bank in the internally stored list. No joker or wildcard allowed.

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
country  Country code
instcode  Bank code

Pointer<Customer> HBCI::API::findCustomer int    country,
const string &    instcode,
const string &    cust
const
 

Searches for a customer in the internally stored lists. No joker or wildcard allowed.

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
country  Country code of the bank
instcode  Bank code of the bank
cust  Customer ID of the customer

Pointer<Medium> HBCI::API::findMedium const string &    name const
 

Searches for a medium of the given name. It therefore checks the media of all already knowncustomers.

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
name  medium name (card number in case of a chip card (DDV), file path and name in case of a keyfile (RDH))

Pointer<User> HBCI::API::findUser int    country,
const string &    instcode,
const string &    user
const
 

Searches for a user in the internally stored lists. No joker or wildcard allowed.

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
country  Country code of the bank
instcode  Bank code of the bank
user  User ID of the user

list<Pointer<Account> > HBCI::API::getAccounts int    country = 0,
const string &    bankId = "*",
const string &    accountId = "*"
const
 

Get a list of matching accounts.

Returns a list of all matching accounts known to the system. This method creates a new list and returns it. Please note that changes made to the accounts in the list returned WILL affect these accounts in any list. This is due to the usage of Pointer. This way it is much easier to modify accounts.

Author:
Martin Preuss<martin@libchipcard.de>

list<Pointer<Customer> > HBCI::API::getCustomers int    country = 0,
const string &    instid = "*",
const string &    custid = "*"
const
 

Get a list of matching customers.

This method collects a list of customers that match the given criteria.

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
country  country code (280 for Germany, 0 matches all)
instid  institute id (German "Bankleitzahl"), joker ("?") and wildcards ("*") are allowed
custid  id assigned to you by your bank, joker ("?") and wildcards ("*") are allowed

list<Pointer<User> > HBCI::API::getUsers int    country = 0,
const string &    instid = "*",
const string &    userid = "*"
const
 

Get a list of matching users.

This method collects a list of users that match the given criteria.

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
country  country code (280 for Germany, 0 matches all)
instid  institute id (German "Bankleitzahl"), joker ("?") and wildcards ("*") are allowed
userid  id assigned to you by your bank, joker ("?") and wildcards ("*") are allowed

unsigned HBCI::API::lastTransactionId   [static]
 

Error HBCI::API::loadEnvironment const string &    filename,
unsigned int    fl = HBCILOADER_DEFAULT
 

Load all banks, users and accounts.

There is a flag to define which parts of the data are supposed to be loaded. Generally you wouldn't need to specify anything else than the default. If you are really sure that you need to specify something non-default, then please study the implementation of the data loading and saving process in the HBCI::Loader class.

Parameters:
filename  The name of the file where data is loaded from.
fl  Flag to define which part of the data should be loaded
Author:
Martin Preuss<martin@libchipcard.de>

Error HBCI::API::loadMediumPlugin const string &    path
 

This method loads and registers a medium plugin.

Author:
Martin Preuss<martin@libchipcard.de>

Pointer<Medium> HBCI::API::mediumFactory const string &    name,
const string &    mediumType
 

Creates an medium object.

This will NOT be automatically added to internally stored lists.

This method rather than HBCI::API::createNewMedium is to be used when the actual medium already exists (i.e. the RDH keyfile).

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
name  The name of this medium (see createNewMedium)
mediumType  Chooses the kind of medium to be created.

Pointer<Medium> HBCI::API::mediumFromConfig SimpleConfig &    cfg,
cfgPtr    group
 

This method is used to create a medium object using the data given in a configuration file. The only mandatory variable is "typename", because its content is used to determine which plugin has to provide the medium. This method loads the appropriate plugin if needed. The plugin may then use whichever variables it finds necessary. If the corresponding plugin is not available an exception will be thrown

Error HBCI::API::mediumToConfig Pointer< Medium   m,
SimpleConfig &    cfg,
cfgPtr    group
 

This method is used to store information from a medium to a configuration file (in order to be restorable by mediumFromConfig). The only mandatory variable is "typename", because its content is used to determine which plugin has to provide the medium. The plugin may then use whichever variables it finds necessary.

MediumType HBCI::API::mediumType const string &    mtype
 

This method returns the enum MediumType of the named mediumtype. The responsible plugin is loaded if needed. If the corresponding plugin is not available an exception will be thrown

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
mtype  named type (like "DDVCard", "RDHFile" etc)

Pointer<ProgressMonitor> HBCI::API::monitor   const
 

Returns a pointer to the current progress monitor.

The default monitor dumps all messages to stderr. Set a new monitor if you want to use other means to show a progress.

Author:
Martin Preuss<martin@libchipcard.de>

unsigned HBCI::API::nextTransactionId   [static]
 

string HBCI::API::pluginPath   const
 

Returns the folder which is used to load plugins from.

Author:
Martin Preuss<martin@libchipcard.de>

list<Pointer<OutboxJob> > HBCI::API::queuedJobs   const
 

Returns a list of all queued jobs.

Returns a list of all queued jobs, of all customers and banks.

Author:
Martin Preuss<martin@libchipcard.de>

Error HBCI::API::registerMediumPlugin Pointer< MediumPlugin   mp
 

Register a medium plugin. After successfull registration the new medium type is available to OpenHBCI. This method is called from within the PluginFile upon PluginFile::registerYourSelf().

Author:
Martin Preuss<martin@libchipcard.de>

void HBCI::API::removeBank Pointer< Bank   b
 

Remove a bank.

Removes the given bank from the internal list. The object itself is not destroyed (since Pointers have automatic reference-counting). After this method call, the object is in the same state as one returned by HBCI::API::bankFactory(). I.e. since it doesn't belong to any internal lists it is not allowed to be used in subsequent calls to OpenHBCI.

Author:
Martin Preuss<martin@libchipcard.de>

void HBCI::API::removeQueuedJob Pointer< OutboxJob   job
 

Removes a given job from the queue.

Author:
Martin Preuss<martin@libchipcard.de>

Error HBCI::API::saveEnvironment const string &    filename,
unsigned int    fl = HBCILOADER_DEFAULT
const
 

Save all banks, users, accounts.

There is a flag to define which parts of the data are supposed to be saved. Generally you wouldn't need to specify anything else than the default. If you are really sure that you need to specify something non-default, then please study the implementation of the data loading and saving process in the HBCI::Loader class.

Parameters:
filename  The name of the file where data is saved to.
fl  Flag to define which part of the data should be saved
Author:
Martin Preuss<martin@libchipcard.de>

void HBCI::API::setLastTransactionId unsigned int    i [static]
 

void HBCI::API::setMonitor Pointer< ProgressMonitor   monitor
 

Set the current progress monitor.

Set a new progress monitor to be used.

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
monitor  pointer to the monitor to use

int HBCI::API::totalAccounts   const
 

Returns the total number of accounts that exist within all banks of this API.

Author:
Christian Stimming <stimming@tuhh.de>
Returns :
Number of accounts in this API.

int HBCI::API::totalUsers   const
 

Returns the total number of users that exist within all banks of this API.

Author:
Christian Stimming <stimming@tuhh.de>
Returns :
Number of users in this API.

Pointer<User> HBCI::API::userFactory Pointer< Bank   b,
Pointer< Medium   m,
const string &    userid,
int    version = 0,
const string &    userName = "",
bool    knowsSupportedJobs = false
[static]
 

Creates a user object.

This will NOT be automatically added to internally stored lists.

Author:
Martin Preuss<martin@libchipcard.de>
Parameters:
b  The bank that this user belongs to.
m  The security medium this user owns.
userid  The user id that identifies this user to his bank.
version  The UPD version (User Parameter Data) of this user (only nonzero if there has been HBCI connectivity for this user before)
userName  The clear-text name of this user; this not given by the bank, but can be chosen arbitrarily.
knowsSupportedJobs  True if the UPD contain all supported jobs


Friends And Related Function Documentation

friend class OutboxJobChangeKeys [friend]
 

friend class OutboxJobDisableKeys [friend]
 

friend class OutboxJobKeys [friend]
 

friend class OutboxJobSynchronize [friend]
 


The documentation for this class was generated from the following file:
Generated on Mon Jun 23 13:41:09 2003 for openhbci by doxygen1.2.17