euforic / banking.js

The Missing API for Banks - Get all of your transactions and balances using node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

If the routing number has a leading 0 it is removed and you will get error responses from the bank indicating that the routing ID is in correct

ChrisMagnuson opened this issue · comments

Using the example:

var Banking = require('banking');

var bank = Banking({
    fid: 10898
  , fidOrg: 'B1'
  , url: 'https://yourBanksOfxApiURL.com'
  , bankId: 0123456 /* If bank account use your bank routing number otherwise set to null */
  , user: 'username'
  , password: 'password'
  , accId: 0123456789 /* Account Number */
  , accType: 'CHECKING' /* CHECKING || SAVINGS || MONEYMRKT || CREDITCARD */
  , ofxVer: 103 /* default 102 */
  , app: 'QBKS' /* default  'QWIN' */
  , appVer: '1900' /* default 1700 */
});

The actual bankId sent in the resulting request would be 123456 as the leading 0 is removed.

If you make the bankId a string, , bankId: '0123456', the leading 0 is not removed and 0123456 is sent as the Bank ID.

I am new to java script and node.js, is there a way to fix this so that the leading 0 wont be stripped from an integer, make bankId required to be a string, or at least add something in the wiki calling out this gotcha?

if the program reads numbers from the first position, it will automatically omit the 0, because its before the first number. Try starting your string from the 0

I just started using this package and like it... I will be submitting a pull request with some enhancements soon.

Banks often have leading zeroes in account numbers that do matter. The accId and bankId should probably be strings instead of integers. Since JavaScript is not strongly typed all you need to do is surround the value with quotes:

, accId: '0123456789' /* Account Number */

I have tested and this works as you would expect. @ChrisMagnuson you mentioned that the bankId is replaced by the accId if you surround with quotes? I'm not seeing that the code would cause that to occur but i'm testing investments not banks with my use case.

@zambien Sorry that was a typo, I have corrected the original post.

Sounds like a documentation update is in order. FWIW I work at a large well established investment company on the US East Coast and have worked on banking code for years. As I said before the zeroes do matter. Some banks will not match 12345 but will 00012345 because they are storing the value as a string. Some banks are getting better about this and others aren't so generally speaking it is best to allow passing a string for account and routing number in lieu of an integer.

I'm closing since the docs show account id as a string now