Class SepaGermanIBAN

Namespace
Subsembly.Sepa
Assembly
Subsembly.Sepa.dll

Helper class for dealing with german IBAN numbers.

public class SepaGermanIBAN
Inheritance
SepaGermanIBAN
Inherited Members

Remarks

This class implements the very sophisticated method DetermineIBAN(string, string, int, out string, out string) for a realiable conversion of bank code and account number to its correct IBAN.

Methods

DetermineBIC(string)

Look up the BIC in the Bundesbank table.

public string DetermineBIC(string sBankCode)

Parameters

sBankCode string

Returns

string

If the bank code was found in the Bundesbank table, then the associated BIC is returned. Otherwise null is returned.

Remarks

Before this method is called the Bundesbank table must be loaded through LoadBundesbankTableFile(string). Otherwise this method always returns null.

This method does not return an exceptional BIC by applying IBAN rules. It always returns just the BIC from the Bundesbank table, which often is different from the BIC that would be returned by DetermineIBAN(string, string, int, out string, out string).

DetermineIBAN(string, string, int, out string, out string)

Determine an IBAN from a given german bank code and account number.

public SepaGermanIBANResult DetermineIBAN(string sBankCode, string sAcctNo, int nRuleID, out string sIBAN, out string sBIC)

Parameters

sBankCode string

A german eight digit bank code. This parameter must not be null.

sAcctNo string

A german account number with up to ten digits. Leading zeroes are ignored, but the total string length must never exceed 10 digits. If this parameter is null, then only the BIC will be determined and the returned IBAN will be null, too.

nRuleID int

Bundesbank IBAN production rule ID in the range from 0 to 9999. This is can be determined via DetermineRuleID(string).

sIBAN string

If an IBAN could be determined, then it is returned in this parameter. If no valid IBAN could be produced, then null is returned in this parameter.

sBIC string

If there is an exceptional BIC associated with the returned IBAN, then this BIC is returned through this parameter. If the standard BIC should be used, then null is returned in this parameter.

Returns

SepaGermanIBANResult

Exceptions

ArgumentNullException

The parameter sBankCode was null.

ArgumentException

Either sBankCode was not an eight digit bank code, or sAcctNo was not a max ten digits account number, or nRuleID was not in the allowed range.

DetermineRuleID(string)

Determine the applicable IBAN conversion rule ID for a given german bank code.

public int DetermineRuleID(string sBankCode)

Parameters

sBankCode string

The german bank code for which to determine the rule ID. This must be a string consisting of exactly eight digits.

Returns

int

The rule ID to be used to convert an account number for the given bank code to an IBAN. The value zero is returned if there is no special rule to be applied and the IBAN can be converted generically. The return value is -1 if the given bank code is not known.

GetAcctNo(string)

Extract the german account number from an IBAN.

public static string GetAcctNo(string sIBAN)

Parameters

sIBAN string

Returns

string

The german account number for a valid german IBAN or null otherwise.

GetBankCode(string)

Extract the german bank code (Bankleitzahl) from an IBAN.

public static string GetBankCode(string sIBAN)

Parameters

sIBAN string

Returns

string

The german bankcode for a valid german IBAN or null otherwise.

IsValid(string)

Checks whether the given IBAN looks like a valid German IBAN number.

public static bool IsValid(string sIBAN)

Parameters

sIBAN string

The IBAN to check. If this is null, then the result will be false.

Returns

bool

Remarks

This does not check whether the bank account really exists. It solely checks whether the IBAN specification is a syntactically correct German IBAN specification.

See Also

LoadBundesbankTable(Stream)

public void LoadBundesbankTable(Stream aStream)

Parameters

aStream Stream

Stream of the official ASCII text format Bundesbank bank code table.

LoadBundesbankTable(TextReader)

public void LoadBundesbankTable(TextReader aReader)

Parameters

aReader TextReader

Text reader that supplies the data of the official text format Bundesbank bank code table.

LoadBundesbankTableFile(string)

public void LoadBundesbankTableFile(string sFileName)

Parameters

sFileName string

File name of the official ASCII text format Bundesbank bank code table.