In relation to tracker.openpetra.org/view.php?id=2680:

I have now this code, that is quite useful in the german office:

        private static bool ConvertBankAccountCodeToIBANandBic(string AAccountNumber, string ABankSortCode, out string AIBAN, out string ABIC)
        {
            string url =
                TAppSettingsManager.GetValue("SEPA.ConvertBankAccountNumbersToIBAN.URL", "https://kontocheck.solidcharity.com/index.php", false) +
                "?kto=" + AAccountNumber + "&blz=" + ABankSortCode;
            string result = THTTPUtils.ReadWebsite(url);

        if (result == null)
        {
            throw new Exception("ConvertBankAccountCodeToIBANandBic: problem reading IBAN and BIC from " + url);
        }

        XmlDocument doc = new XmlDocument();

        doc.LoadXml(result);

        if (TXMLParser.FindNodeRecursive(doc.DocumentElement, "kontocheck").InnerText != "ok")
        {
            TLogging.Log("Problem with converting bank account number to IBAN " + AAccountNumber + " " + ABankSortCode);
            TLogging.Log(result);
            ABIC = string.Empty;
            AIBAN = string.Empty;
            return false;
        }

        AIBAN = TXMLParser.FindNodeRecursive(doc.DocumentElement, "iban").InnerText;
        ABIC = TXMLParser.FindNodeRecursive(doc.DocumentElement, "bic").InnerText;
        return true;
    }

    private static bool ValidateIBANandBic(string AIban, ref string ABic)
    {
        string url =
            TAppSettingsManager.GetValue("SEPA.ConvertBankAccountNumbersToIBAN.URL", "https://kontocheck.solidcharity.com/index.php", false) +
            "?iban=" + AIban + "&bic=" + ABic;
        string result = THTTPUtils.ReadWebsite(url);

        if (result == null)
        {
            throw new Exception("ValidateIBANandBic: problem validating IBAN and BIC from " + url);
        }

        XmlDocument doc = new XmlDocument();

        doc.LoadXml(result);

        if (TXMLParser.FindNodeRecursive(doc.DocumentElement, "iban").InnerText != "1")
        {
            return false;
        }

        if (TXMLParser.FindNodeRecursive(doc.DocumentElement, "bic").InnerText != "1")
        {
            // use the proposed BIC
            ABic = TXMLParser.FindNodeRecursive(doc.DocumentElement, "bic").InnerText;
            // return false;
        }

        return true;
    }

This makes use of the GPL software konto_check, which I have installed on my server. For installing it anywhere else, see kontocheck.solidcharity.com/

I guess there are too many rules for validating IBAN numbers, so it is better to use a library that was specifically written for this purpose.
I tried to compile it to a dll, but was not sure if that works on Mono too.
So the web service was the easiest solution.

Hi Timotheus!

That sounds indeed useful!

What we would need for OpenPetra, though, is an additional way that would allow the separate checking of an IBAN and the checking of a BIC indpendent of that, as these are maintained in different Tabs on the Partner Edit screen and we need to be able to verify them independently. Your webservice (perhaps konto_check, too?) only allows a combined check of both at once. Would that be possible?

Would it be hard to try to compile it to a DLL and to check whether it would work on Linux with mono? A web service is certainly handy, esp. from the point of central maintenance, but there can be circumstances where an OpenPetra site will not (always) have access to the Internet but OpenPetra would still need to be able to verify IBANs and BICs even if Internet access is not available...

Kind regards,

ChristianK

Hello Christian,
the use of BIC will be not needed in 2015 anymore, as far as I know. Then you only need the IBAN.
You can have a look at the source of konto_check, there should be a function for checking the BIC.

I tried to compile the DLL, but did not succeed on the first try. It should be possible though.
Michael, the author of konto_check, is a brother, and he is a helpful man! :)
His comment in July 2013 was:

Mit dem C# kann ich gut verstehen, daß es nicht ganz einfach ist. Unter Windows ist es noch überschaubar; ich hatte eine erste Interface-Bibliothek von einem anderen Benutzer bekommen, und habe sie dann nur noch komplettiert. Aber mit Mono müßte man wohl nochmal fast von vorn anfangen... PHP benutze ich unter Linux auch regelmäßig für schnelle Tests, mit der PHP-Konsole kann man doch viele Sachen komfortabel erledigen.

See also the C# sample here: kontocheck.sourceforge.net/konto ... be=5&sub=4

I came to the conclusion that it was easier for me to install the kontocheck rpm as a PHP module on the SLS, than to work on the DLL.
installation instructions: software.opensuse.org/download/p ... kontocheck

In Europe, where SEPA is used, most offices are on the Internet, or are using terminal services anyway to access Petra.

all the best,
Timotheus

pokorra wrote

Hello Christian,
the use of BIC will be not needed in 2015 anymore, as far as I know. Then you only need the IBAN.
You can have a look at the source of konto_check, there should be a function for checking the BIC.
...

BIC is not needed in the future if the following is true:
a) The money transfer is in Euro. (SEPA transfers do not handle currencies other than Euro).
b) The transfer takes place between banks within the SEPA zone. At present the IBAN already is sufficient within Germany and will be from Feb 2016 onwards within the SEPA zone.

International money transfers to countries outside EU/SEPA still require the BIC/SWIFT Code.

11 days later

For now we'll stick to the internal validation within OpenPetra and leave out external tools.

9 days later
christiankatict wrote

What we would need for OpenPetra, though, is an additional way that would allow the separate checking of an IBAN and the checking of a BIC indpendent of that, as these are maintained in different Tabs on the Partner Edit screen and we need to be able to verify them independently. Your webservice (perhaps konto_check, too?) only allows a combined check of both at once. Would that be possible?

I have implemented a check for the BIC only:

for example:
kontocheck.solidcharity.com/ind ... NGDDEFFXXX