Class SepaGermanIBAN
Helper class for dealing with german IBAN numbers.
Inheritance
Inherited Members
Namespace: Subsembly.Sepa
Assembly: Subsembly.Sepa.dll
Syntax
public class SepaGermanIBAN
Remarks
This class implements the very sophisticated method DetermineIBAN(String, String, Int32, 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.
Declaration
public string DetermineBIC(string sBankCode)
Parameters
Type | Name | Description |
---|---|---|
System.String | sBankCode |
Returns
Type | Description |
---|---|
System.String | If the bank code was found in the Bundesbank table, then the associated BIC is
returned. Otherwise |
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, Int32, out String, out String).
DetermineIBAN(String, String, Int32, out String, out String)
Determine an IBAN from a given german bank code and account number.
Declaration
public SepaGermanIBANResult DetermineIBAN(string sBankCode, string sAcctNo, int nRuleID, out string sIBAN, out string sBIC)
Parameters
Type | Name | Description |
---|---|---|
System.String | sBankCode | A german eight digit bank code. This parameter must not be |
System.String | sAcctNo | 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 |
System.Int32 | nRuleID | Bundesbank IBAN production rule ID in the range from 0 to 9999. This is can be determined via DetermineRuleID(String). |
System.String | sIBAN | 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. |
System.String | sBIC | 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
Type | Description |
---|---|
SepaGermanIBANResult |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The parameter sBankCode was null. |
System.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.
Declaration
public int DetermineRuleID(string sBankCode)
Parameters
Type | Name | Description |
---|---|---|
System.String | sBankCode | The german bank code for which to determine the rule ID. This must be a string consisting of exactly eight digits. |
Returns
Type | Description |
---|---|
System.Int32 | 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.
Declaration
public static string GetAcctNo(string sIBAN)
Parameters
Type | Name | Description |
---|---|---|
System.String | sIBAN |
Returns
Type | Description |
---|---|
System.String | The german account number for a valid german IBAN or |
GetBankCode(String)
Extract the german bank code (Bankleitzahl) from an IBAN.
Declaration
public static string GetBankCode(string sIBAN)
Parameters
Type | Name | Description |
---|---|---|
System.String | sIBAN |
Returns
Type | Description |
---|---|
System.String | The german bankcode for a valid german IBAN or |
IsValid(String)
Checks whether the given IBAN looks like a valid German IBAN number.
Declaration
public static bool IsValid(string sIBAN)
Parameters
Type | Name | Description |
---|---|---|
System.String | sIBAN | The IBAN to check. If this is |
Returns
Type | Description |
---|---|
System.Boolean |
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)
Declaration
public void LoadBundesbankTable(Stream aStream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | aStream | Stream of the official ASCII text format Bundesbank bank code table. |
LoadBundesbankTable(TextReader)
Declaration
public void LoadBundesbankTable(TextReader aReader)
Parameters
Type | Name | Description |
---|---|---|
System.IO.TextReader | aReader | Text reader that supplies the data of the official text format Bundesbank bank code table. |
LoadBundesbankTableFile(String)
Declaration
public void LoadBundesbankTableFile(string sFileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | sFileName | File name of the official ASCII text format Bundesbank bank code table. |