BankCheck - Using the BankCheck Service in Visual Studio
  • BankCheck has been developed in Dot Net for easy interfacing for Visual basic and Visual C# developers. To make use of the service add a Web Reference to your project. The following examples are all in C# however the same applies to VB.

  • Once you have created your project, in the solution explorer select “Add Web Reference”. This will present you with the following dialog box to enter the url. Once the url has been entered the BankCheck interface will be displayed. http://www.mosaicsoftware.co.uk/services/bankcheck/bankcheck.asmx

  • As BankCheck is now provided solely as a web-based service, the Industry Sortcode Directory (ISCD) is updated automatically when we receive a new copy from Bacs. Older methods to download the ISCD have been made obsolete.

  • Create a simple form with a TextBox for the sortcode and for the account. In our examples we have named the TextBoxes sortcode and account respectively. We have also placed a textbox on the form in which to display the results.

 
       
private void checkButton_Click(object sender, EventArgs e)
{
    try {
        Service.BankCheck bankcheck = new Service.BankCheck();
        bankcheck.BankcheckHeaderValue = new Service.BankcheckHeader();
        bankcheck.BankcheckHeaderValue.UserId = "youruserid";
        bankcheck.BankcheckHeaderValue.Password = "yourpassword";
        Service.Bank bank = bankcheck.GetBank(sortcode.Text);
        results.Text = string.Format("{0}\r\n{1}\r\n{2}\r\n{3}\r\n{4}\r\n{5}",
        bank.FullBranchTitle, bank.Address1, bank.Address2, bank.Address3, bank.Address4, bank.City);

        if (bankcheck.ModulusCheck(sortcode.Text, account.Text))
            MessageBox.Show("The sortcode and account IS valid");
        else
            MessageBox.Show("The sortcode and account IS NOT valid");  
    }
    catch (Exception ex)      
    {  
        MessageBox.Show(ex.ToString());        
    }
}
        
        

Calls available in BankCheck API

In the following examples it is assumed when the web reference was created it was named "Service". In addition text fields were created on your form named "sortcode" and "account"

Note that a full working example is available here. The example is written in C# and the solution was created in Visual Studio 2005.
GetBank Gets the bank details from the service The method 'GetBank' will return the name and address details of a bank held in the the ISCD. Returns a type Bank from a sort code. See Bank for details of the fields. scValue is a 6 character sortcode string. e.g. 804050 
 
       
Service.BankCheck bankcheck = new Service.BankCheck();
bankcheck.BankcheckHeaderValue = new Service.BankcheckHeader();
bankcheck.BankcheckHeaderValue.UserId = "youruserid";
bankcheck.BankcheckHeaderValue.Password = "yourpassword";
Service.Bank bank = bankcheck.GetBank(sortcode.Text);
   
        
The result is of type Service.Bank
 
       
Service.Bank bank = bankcheck.GetBank(sortcode.Text);

Console.WriteLine(bank.Address1);
Console.WriteLine(bank.Address2);
Console.WriteLine(bank.Address3);
Console.WriteLine(bank.Address4);
   
        
ModulusCheck Performs a ModulusCheck on the sortcode and bank account number. The method returns a boolean true if the check is a success, otherwise a false.
 
       
Service.BankCheck bankcheck = new Service.BankCheck();
bankcheck.BankcheckHeaderValue = new Service.BankcheckHeader();
bankcheck.BankcheckHeaderValue.UserId = "youruserid";
bankcheck.BankcheckHeaderValue.Password = "yourpassword";

bool result = bankcheck.ModulusCheck(sortcode.Text, account.Text);
if (result==true)
    Console.WriteLine("Test Passed");
else
    Console.WriteLine("Test Failed");  
   
        
ValidateSortcode Validates a sort code and returns a true or false depending on whether the sortcode exists in the ISCD directory. Sortcodes although always numeric are passed in as a string to ensure no loss of leading zeros. A sortcode is always 6 numerics. e.g. 804050
 
       
Service.BankCheck bankcheck = new Service.BankCheck();
bankcheck.BankcheckHeaderValue = new Service.BankcheckHeader();
bankcheck.BankcheckHeaderValue.UserId = "youruserid";
bankcheck.BankcheckHeaderValue.Password = "yourpassword";

bool result = bankcheck.ValidateSortcode(sortcode.Text);
if (result==true)
    Console.WriteLine("Test Passed");
else
    Console.WriteLine("Test Failed");