Skip to content

Add your bank parser to the Global Banks array

Timi Ajiboye edited this page Sep 8, 2015 · 5 revisions

In the lib/ng-bank-parsers/banks.rb, information about your new parser must be input. This is to run the tests and to power the API to show supported banks. You can add a completely new bank or another format for an existing bank.

Adding a new bank

The key is the used to recognize the bank. The name is the full name for the bank

For example, if I wanted to add Heritage Bank excel parser, it will be

{
		    key: "gtb",
		    name: "Guaranty Trust Bank"
		},{
		    key: "hb",
		    name: "Heritage Bank"
}

Adding a new parser

Parser information must be added to the banks file in a standard format that contains keys format, valid, invalid, extension.

  • format - This is the generic name of this format. e.g excel
  • valid - This is a link to a valid example file. The file must exist in the lib/ng-bank-parser/fixtures folder and it must match the key of the bank and the format of the parser. e.g glb-excel-valid.xls. Try to make this file as light as possible
  • invalid - This is a link to a file that’ll fail the test (You can just copy any of the other invalid files). It must also match the name of the bank and the format of the parser. e.g glb-excel-invalid.pdf
  • extensions - This is an array of extensions supported in the format. e.g [‘xls’,’xlsx’]

Putting all that together, now we have

{
		    key: "hb",
		    name: "Heritage Bank",
		    parsers: [{
				format: "excel",
				valid: "lib/ng-bank-parser/fixtures/hb-excel-valid.xls",
				invalid: "lib/ng-bank-parser/fixtures/hb-excel-invalid.pdf",
				extensions: ["xls",”xlsx”]
			}]
}

Note: If the bank already exists, you only have to add a new parser. For example, if I wanted to add xls support to UBA

{
		    key: "uba",
		    name: "United Bank for Africa",
		    parsers: [{
				format: "pdf",
				valid: "lib/ng-bank-parser/fixtures/uba-pdf-valid.pdf",
				invalid: "lib/ng-bank-parser/fixtures/uba-pdf-invalid.pdf",
				extensions: ["pdf"]
			},{
				format: "excel",
				valid: "lib/ng-bank-parser/fixtures/uba-excel-valid.pdf",
				invalid: "lib/ng-bank-parser/fixtures/uba-excel-invalid.pdf",
				extensions: ["xls"]
			}]
}
Clone this wiki locally