ktoblzcheck 1.59.0
|
German bank information database and account code verification. More...
#include <ktoblzcheck.h>
Classes | |
class | Record |
Available information about one bank. More... |
Public Types | |
enum | Result { OK = 0 , UNKNOWN = 1 , ERROR = 2 , BANK_NOT_KNOWN = 3 } |
typedef enum AccountNumberCheck::Result | Result |
Public Member Functions | |
AccountNumberCheck () | |
AccountNumberCheck (const std::string &filename) | |
~AccountNumberCheck () | |
Result | check (const std::string &bankId, const std::string &accountId, const std::string &method="") const |
const Record & | findBank (const std::string &bankId) const |
unsigned int | bankCount () const |
Static Public Member Functions | |
static AccountNumberCheck * | createChecker (const std::string &country) |
Ktoblzcheck library information | |
static const char * | stringEncoding () |
static const char * | libraryVersion () |
static std::string | bankdata_dir () |
static bool | isValidDatabase (const std::string &filename) |
static bool | existDatabase (const std::string &dbname) |
Bankdata validity date range | |
KTOBLZCHECK_DEPRECATED std::time_t | dataValidStartDate () const |
KTOBLZCHECK_DEPRECATED std::time_t | dataValidEndDate () const |
KTOBLZCHECK_DEPRECATED bool | isDataValidForDate (std::time_t date) const |
KTOBLZCHECK_DEPRECATED bool | isValidDataAvailable (std::time_t date) const |
KTOBLZCHECK_DEPRECATED std::time_t | closestValidData (std::time_t date) const |
KTOBLZCHECK_DEPRECATED bool | loadDataForDate (std::time_t date) |
KTOBLZCHECK_DEPRECATED std::string | getFilenameClosestDateToday () const |
void | createIndex () |
static std::string | resultToString (Result r) |
German bank information database and account code verification.
Class that stores a list of known German banks, returns banks with given bank codes, and validates account numbers accordings to the bank's known validation/checking algorithms.
The list of known banks is read from the configuration file when this object is constructed.
typedef enum AccountNumberCheck::Result Result |
Gives information about the success of the check
OK: everything is ok, account and bank match
UNKNOWN: Could not be validated because the validation algorithm is unknown/unimplemented in ktoblzcheck
ERROR: The result of the validation algorithm is that the account and bank probably do not match
BANK_NOT_KNOWN: No bank with the specified bankid could be found
enum Result |
Gives information about the success of the check
OK: everything is ok, account and bank match
UNKNOWN: Could not be validated because the validation algorithm is unknown/unimplemented in ktoblzcheck
ERROR: The result of the validation algorithm is that the account and bank probably do not match
BANK_NOT_KNOWN: No bank with the specified bankid could be found
Default Constructor.
This constructor also initializes the bank-database. The bank data is obtained from several files which are located in a directory looked up at run-time (with a fallback check for a compile-time path). Default is $prefix/share/ktoblzcheck (set in configure.in) where default for $prefix is /usr/local.
Inside the data directory, all bankdata files with a date in the filename are processed, according to the three-month validity periods, because each bankdata file is valid for three months. See README for a more detailed explanation.
Referenced by createChecker().
AccountNumberCheck | ( | const std::string & | filename | ) |
Constructor that initialize the bank-database from a data file at filename
.
If the file could not be found, then the resulting AccountNumberCheck object simply has an empty bank database and a message is printed to stderr.
filename | The absolute location of the KTOBLZCheck-database |
~AccountNumberCheck | ( | ) |
Destructor. All entries of the bank database are deleted as well.
unsigned int bankCount | ( | ) | const |
Returns the number of bank-records currently loaded.
|
static |
Returns the directory where the bankdata file is stored.
This function was introduced in ktoblzcheck-1.13.
Result check | ( | const std::string & | bankId, |
const std::string & | accountId, | ||
const std::string & | method = "" ) const |
Check if bankId
and accountId
form a valid combination.
bankId | The bank code (BLZ) of the bank to test |
accountId | The account id to check |
method | If not set (default), look up the Record for the given bankId and use the method specified there for the check. If set, no look-up is performed, the specified check-method is used directly, and the database of BLZ and methods is not used. |
KTOBLZCHECK_DEPRECATED std::time_t closestValidData | ( | std::time_t | date | ) | const |
Returns the date closest to the specified date at which valid bankdata is available. If bankdata is available on the given date (i.e. isDataAvaliable() is true), returns the given date unchanged.
Whether this file has already been loaded has to be queried separately through isDataValidForDate().
This function was introduced in ktoblzcheck-1.15.
Note: After switching to the SQLite databases, this method has been deprecated.
References KTOBLZCHECK_DEPRECATED.
|
static |
This method is used to create AccountNumberCheck objects for a given country. Based on the value of the parameter country, a suitable installed database is loaded in the program if the country is supported by KtoBlzCheck. Currently supported countries are Germany, Netherlands and Switzerland with country codes DE, NL and CH respectively.
country | The country code for the required country |
References AccountNumberCheck().
void createIndex | ( | ) |
Generates an index over the bankIds. This is supposed to speed up the checking if you want to check 100s of combination (batch-processing)
Currently this does nothing. The bank list structure (std::map) does not need this anyway.
|
inline |
Returns the end date at which the currently loaded bankdata is valid, or 0 if the validity date is unknown.
This function was introduced in ktoblzcheck-1.15.
Note: After switching to the SQLite databases, this method has been deprecated.
References KTOBLZCHECK_DEPRECATED.
|
inline |
Returns the starting date at which the currently loaded bankdata is valid, or 0 if the validity date is unknown.
This function was introduced in ktoblzcheck-1.15.
Note: After switching to the SQLite databases, this method has been deprecated and for compatibility just returns 0.
References KTOBLZCHECK_DEPRECATED.
|
static |
Checks whether any database of name dbname exists in the bankdata directory.
This function was introduced in GSoC2020 //FIXME: Add version
const Record & findBank | ( | const std::string & | bankId | ) | const |
Find the info-record for a bank specified by bankId
or otherwise throw an exception.
int | if a bank with bank code bankId (german BLZ) could not be found in the database |
KTOBLZCHECK_DEPRECATED std::string getFilenameClosestDateToday | ( | ) | const |
Looks up the bank data file name that is closest to today's date and returns that file name. This is also the bank data file that is loaded by default.
Note: After switching to the SQLite databases, this method has been deprecated.
References KTOBLZCHECK_DEPRECATED.
KTOBLZCHECK_DEPRECATED bool isDataValidForDate | ( | std::time_t | date | ) | const |
Returns true if the currently loaded bankdata file is valid for the given date. Returns false if the loaded data is valid for a different time range, or if its validity date range is unknown.
This function was introduced in ktoblzcheck-1.15.
Note: After switching to the SQLite databases, this method has been deprecated.
References KTOBLZCHECK_DEPRECATED.
KTOBLZCHECK_DEPRECATED bool isValidDataAvailable | ( | std::time_t | date | ) | const |
Returns true if a bankdata file valid for the given date is available, otherwise false.
Whether this file has already been loaded has to be queried separately through isDataValidForDate().
This function was introduced in ktoblzcheck-1.15.
Note: After switching to the SQLite databases, this method has been deprecated.
References KTOBLZCHECK_DEPRECATED.
|
static |
Returns true if the supplied string filename exists and is a valid SQLite3 format file.
This function was introduced in GSoC2020 //FIXME: Add version
|
static |
Returns the value of ktoblzcheck's configuration variable VERSION as a string, which can be "1.6" or something similar.
This function was introduced in ktoblzcheck-1.7.
KTOBLZCHECK_DEPRECATED bool loadDataForDate | ( | std::time_t | date | ) |
Loads the bankdata valid for the given date, or bankdata whose validity date is closest to the given date. Returns true if the loaded bankdata is valid for the given date, otherwise false.
(Note: In both cases a new file may or may not have been loaded; this depends on the previously loaded data file. But after this function has been called, it is guaranteed that the closest available bankdata has been loaded by now.)
This function was introduced in ktoblzcheck-1.15.
Note: After switching to the SQLite databases, this method has been deprecated.
References KTOBLZCHECK_DEPRECATED.
|
static |
Returns a meaningful english string explaining the result value
|
static |
Returns the character encoding that is used when strings are returned. So far this has been "ISO-8859-15" (up to and including version ktoblzcheck-1.15) but at some point in the future it might change into "UTF-8". To obtain the encoding string in your application in a form that is backward-compatible to all ktoblzcheck-versions, do the following:
const char *ktoblzcheck_encoding = #ifdef KTOBLZCHECK_VERSION_MAJOR AccountNumberCheck_stringEncoding() #else "ISO-8859-15" #endif ;
This function was introduced in ktoblzcheck-1.7.