{"id":17442764,"url":"https://github.com/twang2218/node-cba-netbank","last_synced_at":"2025-04-14T22:51:19.689Z","repository":{"id":31374490,"uuid":"34937506","full_name":"twang2218/node-cba-netbank","owner":"twang2218","description":"Unofficial The Commonwealth Bank of Australia NetBank API wrap for Node.js","archived":false,"fork":false,"pushed_at":"2022-12-06T18:25:35.000Z","size":824,"stargazers_count":75,"open_issues_count":13,"forks_count":24,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-28T10:54:09.711Z","etag":null,"topics":["api","banking","cba","cli","js","node"],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/twang2218.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-02T06:03:57.000Z","updated_at":"2024-10-03T03:15:37.000Z","dependencies_parsed_at":"2023-01-14T19:01:15.609Z","dependency_job_id":null,"html_url":"https://github.com/twang2218/node-cba-netbank","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twang2218%2Fnode-cba-netbank","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twang2218%2Fnode-cba-netbank/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twang2218%2Fnode-cba-netbank/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twang2218%2Fnode-cba-netbank/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twang2218","download_url":"https://codeload.github.com/twang2218/node-cba-netbank/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248473121,"owners_count":21109629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","banking","cba","cli","js","node"],"created_at":"2024-10-17T16:29:20.019Z","updated_at":"2025-04-14T22:51:19.672Z","avatar_url":"https://github.com/twang2218.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-cba-netbank\n\n[![NPM version][npm-version-image]][npm-url]\n[![MIT License][license-image]][license-url]\n[![Build Status][travis-image]][travis-url]\n[![Dependency Status][dependency-image]][dependency-url]\n[![Coverage Status][coverage-image]][coverage-url]\n\n[![NPM][npm-classy-badge-image]][npm-classy-badge-url]\n\nUnofficial The Commonwealth Bank of Australia NetBank API wrap for\nNode.js\n\n# Usage\n\n## CLI\n\n### Install\n\n```bash\nnpm install node-cba-netbank -g\n```\n\n### Usage\n\n```bash\n$ cba-netbank --help\nCBA Netbank CLI\nUsage: cba-netbank \u003ccommand\u003e [args]\n\nCommands:\n  list      List accounts\n  download  Download transactions history for given account\n  ui        Interactive user interface.\n\nOptions:\n  -u, --username  client number [string] [required] [default: $NETBANK_USERNAME]\n  -p, --password  password      [string] [required] [default: $NETBANK_PASSWORD]\n  --help          Show help                                            [boolean]\n```\n\nThere are 3 commands, `list`, `download` and `ui`.\n\nUsername and password can be given via the arguments, `--username` and `--password`, as well as the environment variables, `NETBANK_USERNAME` and `NETBANK_PASSWORD`.\n\nYou can use `list` command to see the account list, and use `download` command to download the transaction history in given format, there are more arguments for `download` command:\n\n```bash\n$ cba-netbank download --help\ncba-netbank download\n\nOptions:\n  -u, --username  client number [string] [required] [default: $NETBANK_USERNAME]\n  -p, --password  password      [string] [required] [default: $NETBANK_PASSWORD]\n  --help          Show help                                            [boolean]\n  -a, --account   account name or number                     [string] [required]\n  -f, --from      history range from date       [string] [default: \"03/04/2017\"]\n  -t, --to        history range to date         [string] [default: \"03/07/2017\"]\n  -o, --output    output file name\n                 [string] [default: \"[\u003cname\u003e](\u003cnumber\u003e) [\u003cfrom\u003e to \u003cto\u003e].\u003cext\u003e\"]\n  --format        the output file format\n  [string] [choices: \"json\", \"csv\", \"qif\", \"aus.qif\", \"us.qif\", \"ofx\"] [default:\n                                                                         \"json\"]\n```\n\nYou can use `-a` to specify which account you want to download the history from, and the value can be part of the name or account number. For example, if the account name you want to specified is `Smart Access`, then you can use `-a smart` to save some time.\n\nCurrently, `JSON`, `CSV`, `QIF` and `OFX` format is supported for the transactions history export format.\n\nAbout the QIF format, there are several options:\n\n* `qif` is most common one, which is for `QIF(MYOB, MSMoney, or Quicken 2005 or later)`;\n* `aus.qif` is for some old software, such as `QIF (Quicken AUS 2004 or earlier)`;\n* `us.qif` is for some old software, such as `QIF (Quicken US 2004 or earlier)`.\n\n### Interactive UI\n\nThis is an UI you can just use `\u003cUP\u003e` and `\u003cDOWN\u003e` key to list accounts and its recent transactions.\n\n```bash\n$ cba-netbank ui\nLogon as account 1234567 ...\n? Which account?\n❯ Smart Access \t(062001 12340001)\t Balance: $987.65 \t Available Funds: $907.65\n  NetBank Saver \t(062002 12340012)\t Balance: $4321.01 \t Available Funds: $4021.00\n  GoalSaver \t(062003 12340013)\t Balance: $32109.87 \t Available Funds: $32109.87\n  Complete Access \t(062004 12340014)\t Balance: $1234.56 \t Available Funds: $1023.45\n  MasterCard Platinum \t( 5520123456789012)\t Balance: $-1234.56 \t Available Funds: $12345.67\n  \u003cQuit\u003e\n```\n\nUse `\u003cUP\u003e` and `\u003cDOWN\u003e` key to select an account then press `\u003cENTER\u003e`, the recent transaction history will be downloaded and shown below.\n\n```bash\nDownloading history [03/05/2017 =\u003e 03/07/2017] ...\nTime              Description                                                                     Amount    Balance\n----------------  ------------------------------------------------------------------------------  --------  --------\n2017-07-01 00:00  PENDING - HURSTSVILLE TONGLI S   HURSTVILLE , 0701; LAST 4 CARD DIGITS 4341     $-3.09\n2017-07-01 00:00  PENDING - DAMS APPLE AT THE STAT HURSTVILLE , 0701; LAST 4 CARD DIGITS 4341     $-12.37\n...\n2017-07-01 04:39  THE NAKED DUCK DARLING SYDNEY NS AUS; Card xx4341; Value Date: 28/06/2017       $-13.50   $909.66\n2017-07-01 04:39  TOPSHOP TOPMAN SYDNE SYDNEY  AUS; Card xx4341; Value Date: 30/06/2017           $-80.00   $927.16\n...\n2017-06-12 16:13  Cardless Cash for collection                                                    $-40.00   $1111.83\n\nTotal 69 transactions and 12 pending transactions.\n```\n\nTo quit the CLI, just select `\u003cQuit\u003e` then press `\u003cEnter\u003e`.\n\n## Library\n\n### Install\n\n```bash\nnpm install node-cba-netbank --save\n```\n\n### List Accounts\n\nAPI: `netbank.logon(username, password)`\n\n* `username`: the netbank client number;\n* `password`: the netbank password;\n\nReturned object will contains an `accounts` field, which contains all the account information.\n\n#### Example of list accounts\n\n```js\nconst Netbank = require('node-cba-netbank');\n\nconst netbank = new Netbank();\n\nnetbank.logon('76543210', 'YOUR_PASSWORD')\n  .then(resp =\u003e {\n    //  output account to console\n    resp.accounts.forEach(\n      a =\u003e console.log(`${a.name} (${a.bsb} ${a.account}) =\u003e ${a.balance}/${a.available}`)\n    );\n  })\n  .catch(console.error);\n```\n\nJust replace `76543210` with your client number, and replace\n`YOUR_PASSWORD` with your netbank password.\n\nThe result will look like below:\n\n```js\nSmart Access (062001 12340001) =\u003e 987.65/907.65\nNetBank Saver (062002 12340012) =\u003e 4321.01/4021.00\n...\n```\n\nFor each account, there are following properties:\n\n* `name`: Account name;\n* `url`: Transaction page for the account, it will be different everytime you logged in;\n* `bsb`: BSB number;\n* `account`: Account number (without BSB part);\n* `number`: The entire account number, `bsb`+`account`, without space;\n* `balance`: Current account balance. It might be different from the available funds;\n* `available`: Current available funds of the account.\n\n### Retrieve Transactions for Given Account\n\nAPI: `netbank.getTransactionHistory(account, from, to)`\n\n* `account`: one of the account object retrieved from the previous `.logon()` api\n* `from`: the begin date of the search period. format is `DD/MM/YYYY`, *[default: 6 years ago (bank may not store transactions for such long time.)]*\n* `to`: the end date of the search period. format is `DD/MM/YYYY`, *[default: today]*\n\nThe returned object will contains following field:\n\n* `transactions`: the processed transactions;\n* `pendings`: the pending transactions;\n\n#### Example of retrieve transactions\n\n```js\nconst Netbank = require('node-cba-netbank');\n\nconst netbank = new Netbank();\n\nnetbank.logon('76543210', 'YOUR_PASSWORD')\n  // Assume we are going to retrieve the transactions of the first account, from '1/1/2017' to today\n  .then(resp =\u003e netbank.getTransactionHistory(resp.accounts[0], '1/1/2017'))\n  .then((resp) =\u003e {\n    //  output transactions to console\n    resp.transactions.forEach(t =\u003e console.log(`${t.date} ${t.description} =\u003e ${t.amount}`));\n  })\n  .catch(console.error);\n```\n\n **Be aware, it might take several minutes if there are thousands transactions.**\n\n The transaction list will look like below:\n\n```bash\n2015-04-20T00:00:00.004Z SO THAI RESTAURANT       KOGARAH =\u003e -13.9\n2015-04-20T00:00:00.003Z NOK NOK                  SYDNEY =\u003e -41.8\n...\n```\n\nFor each transaction object, there are following properties:\n\n* ```timestamp```: Timestamp of given transaction, it's milliseconds since epoch. Although, it might be pretty accurate for some accounts (non-credit card account), it might just be accurate at date level;\n* ```date```: It's human readable date format;\n* ```description```: Transaction description;\n* ```amount```: Transaction amount, negative value is DR, positive value is CR;\n* ```balance```: The balance of the account after the transaction happened, however, the field might be empty for some accounts, such as credit card account;\n* ```trancode```: It's a category code for the transaction, such as ATM, EFTPOS, cash out might be different code;\n* ```receiptnumber```: The receipt number for the transaction. However, I cannot found it on my real paper receipt, and the field might be missing for some accounts, such as credit card account;\n\n### Testing\n\nOffline test can be done by simply run `yarn test`.\n\nTo enable real world testing, please set environment variables `NETBANK_USERNAME` and `NETBANK_PASSWORD` to your client number and password for online banking.\n\nThen run command:\n\n```bash\nyarn test\n```\n\nto have more details, you can run `yarn test-debug` for more verbose output.\n\nThe test will try to login and get transactions from the first account, and if it will fail if the retrieved transactions number is less than 400. It's ok if you don't have that much transactions in the account. The purpose of checking whether it get more than 400 transactions is to check whether it can overcome the maximum transactions limits.\n\n[license-image]: http://img.shields.io/badge/license-Apache%202.0-blue.svg?style=flat\n[license-url]: LICENSE.txt\n\n[npm-url]: https://npmjs.org/package/node-cba-netbank\n[npm-version-image]: http://img.shields.io/npm/v/node-cba-netbank.svg?style=flat\n[npm-downloads-image]: http://img.shields.io/npm/dm/node-cba-netbank.svg?style=flat\n[npm-classy-badge-image]: https://nodei.co/npm/node-cba-netbank.png?downloads=true\u0026downloadRank=true\u0026stars=true\n[npm-classy-badge-url]: https://nodei.co/npm/node-cba-netbank/\n\n[travis-url]: http://travis-ci.org/twang2218/node-cba-netbank\n[travis-image]: http://img.shields.io/travis/twang2218/node-cba-netbank.svg?style=flat\n\n[dependency-url]: https://gemnasium.com/twang2218/node-cba-netbank\n[dependency-image]: http://img.shields.io/gemnasium/twang2218/node-cba-netbank.svg\n\n[coverage-url]: https://coveralls.io/r/twang2218/node-cba-netbank\n[coverage-image]: http://img.shields.io/coveralls/twang2218/node-cba-netbank.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwang2218%2Fnode-cba-netbank","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwang2218%2Fnode-cba-netbank","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwang2218%2Fnode-cba-netbank/lists"}