Giter VIP home page Giter VIP logo

banking.js's Introduction

Version 1.2.0

Build Status NPM version Gittip

Breaking changes!

see docs below

The Missing API for your bank.

  • Retrieve all of your bank transactions similiar to how quickbooks does it.
  • No need to depend on or pay for third party services
  • Bank statement results in JSON or Valid XML
  • Supports all financial institutions (File an issue if yours does not work)

What is OFX?

The Short Version

The banks crappy malformed version of XML that many financial apps such as quickbooks and quicken use to import your bank transactions from your bank account, credit card, money market, etc..

The Long Version

Open Financial Exchange

  • The file extension .ofx is associated with an Open Financial Exchange file as a standard format for the exchange of financial data between institutions.
  • This file is universally accepted by financial software, including Intuit Quicken, Microsoft Money and GnuCash.

Background

  • The Open Financial Exchange file format was created in 1997 via a joint venture by CheckFree, Intuit and Microsoft.
  • The purpose was to allow for a universally accepted financial format used to broker transactions on the Internet.
  • The .ofx file format is seen when dealing with financial transactions involving consumers, businesses, stocks and mutual funds.
  • OFX on Wikipedia

Installation

$ npm install banking

Usage

Find your banks connection details Here

Banking

Create a new instance of banking

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 */
  
  // headers are only required if your ofx server is very picky, defaults below
  // add only the headers you want sent
  // the order in this array is also the order they are sent
  , headers: ['Host', 'Accept', 'User-Agent', 'Content-Type', 'Content-Length', 'Connection']
});

bank.getStatement(Obj, fn)

Fetch and parse transactions for the selected date rang

// date format YYYYMMDDHHMMSS
bank.getStatement({start:20130101, end:20131101}, function(err, res){
  if(err) console.log(err)
  console.log(res);
});

Banking.parseFile(Str, fn)

Parse an OFX file into JSON

Banking.parseFile('/myfile.ofx', function (res) {
  console.log(res);
});

Banking.parse(Str, fn)

Parse an OFX string into JSON

Banking.parse('SomeSuperLongOfxString', function (res) {
  console.log(res);
});

Response

Object structure

{
  header: {...},
  body: {...},
  xml: '...'
}

Example

{
  header: { 
    OFXHEADER: '100',
    DATA: 'OFXSGML',
    VERSION: '102',
    SECURITY: 'NONE',
    ENCODING: 'USASCII',
    CHARSET: '1252',
    COMPRESSION: 'NONE',
    OLDFILEUID: 'NONE',
    NEWFILEUID: 'boiS5QeFGTVMFtvJvqLtAqCEap3cvo69' 
  },
  body: {
    "OFX": {
      "SIGNONMSGSRSV1": {
        "SONRS": {
          "STATUS": {
            "CODE": "0",
            "SEVERITY": "INFO",
            "MESSAGE": "SUCCESS"
          },
          "DTSERVER": "20120126212302.454[-8:PST]",
          "LANGUAGE": "ENG",
          "FI": {
            "ORG": "DI",
            "FID": "321081669"
          }
        }
      },
      "BANKMSGSRSV1": {
        "STMTTRNRS": {
          "TRNUID": "BiJNgqjvbw5vg18Z5T8kZASgUKmsFnNY",
          "STATUS": {
            "CODE": "0",
            "SEVERITY": "INFO",
            "MESSAGE": "SUCCESS"
          },
          "CLTCOOKIE": "iXus7",
          "STMTRS": {
            "CURDEF": "USD",
            "BANKACCTFROM": {
              "BANKID": "321081669",
              "ACCTID": "3576960405",
              "ACCTTYPE": "CHECKING"
            },
            "BANKTRANLIST": {
              "DTSTART": "20010125120000.000",
              "DTEND": "20120126212302.638[-8:PST]",
              "STMTTRN": [{
                "TRNTYPE": "DEP",
                "DTPOSTED": "20110407070000.000",
                "DTAVAIL": "20110407070000.000",
                "TRNAMT": "1934.65",
                "FITID": "156599402",
                "NAME": "CLIENT DEPOSIT",
                "MEMO": "CLIENT DEPOSIT"
              }, {
                "TRNTYPE": "DEBIT",
                "DTPOSTED": "20110412070000.000",
                "DTAVAIL": "20110412070000.000",
                "TRNAMT": "-700.00",
                "FITID": "156950780",
                "NAME": "DOMESTIC WIRE FUNDS-DEBIT CHRIST",
                "MEMO": "DOMESTIC WIRE FUNDS-DEBIT CHRISTIAN SULLIVAN"
              }, {
                "TRNTYPE": "CHECK",
                "DTPOSTED": "20110414070000.000",
                "DTAVAIL": "20110414070000.000",
                "TRNAMT": "-38.20",
                "FITID": "157222076",
                "CHECKNUM": "10004",
                "NAME": "CHECK WITHDRAWAL",
                "MEMO": "CHECK WITHDRAWAL"
              }, {
                "TRNTYPE": "CHECK",
                "DTPOSTED": "20110414070000.000",
                "DTAVAIL": "20110414070000.000",
                "TRNAMT": "-349.79",
                "FITID": "157222077",
                "CHECKNUM": "10006",
                "NAME": "CHECK WITHDRAWAL",
                "MEMO": "CHECK WITHDRAWAL"
              }]
            },
            "LEDGERBAL": {
              "BALAMT": "1661.41",
              "DTASOF": "20120126212302.751[-8:PST]"
            },
            "AVAILBAL": {
              "BALAMT": "2761.41",
              "DTASOF": "20120126212302.751[-8:PST]"
            }
          }
        }
      }
    }
  },
  xml: '<OFX><SIGNONMSGSRSV1><SONRS>...'
}

bank.getAccounts(fn)

Get a list of your accounts on the bank server

bank.getAccounts(function(err, res){
  if(err) console.log(err)
  console.log(res);
});

Response

{
  "header": {
    "Content-Type": " application/x-ofx",
    "Date": " Mon, 02 Jul 2018 02",
    "Content-Length": " 707",
    "Connection": " close",
    "Set-Cookie": " DCID=www21; path=/; domain=xxxxxxx",
    "OFXHEADER": "100",
    "DATA": "OFXSGML",
    "VERSION": "102",
    "SECURITY": "NONE",
    "ENCODING": "USASCII",
    "CHARSET": "1252",
    "COMPRESSION": "NONE",
    "OLDFILEUID": "NONE",
    "NEWFILEUID": "xxxxxxxxxxxxxxxxxxxx"
  },
  "body": {
    "OFX": {
      "SIGNONMSGSRSV1": {
        "SONRS": {
          "STATUS": {
            "CODE": "0",
            "SEVERITY": "INFO"
          },
          "DTSERVER": "20180701224054.774[-4:EDT]",
          "LANGUAGE": "ENG",
          "FI": {
            "ORG": "xxx xxx xx",
            "FID": "####"
          }
        }
      },
      "SIGNUPMSGSRSV1": {
        "ACCTINFOTRNRS": {
          "TRNUID": "xxxxxxxxxxxxxxxxxxxxxxx",
          "STATUS": {
            "CODE": "0",
            "SEVERITY": "INFO"
          },
          "ACCTINFORS": {
            "DTACCTUP": "19990101170000",
            "ACCTINFO": {
              "CCACCTINFO": {
                "CCACCTFROM": {
                  "ACCTID": "xxxxxxxxxxxxxxxxxxxxx"
                },
                "SUPTXDL": "Y",
                "XFERSRC": "N",
                "XFERDEST": "N",
                "SVCSTATUS": "ACTIVE"
              }
            }
          }
        }
      }
    }
  }
}

More Information

License

(The MIT License)

Copyright (c) 2015 Christian Sullivan <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

banking.js's People

Contributors

anirishduck avatar buwilliams avatar chrismagnuson avatar datfinesoul avatar euforic avatar jasonlfunk avatar marcosmoski avatar mdlavin avatar nknotts avatar overflow636 avatar pradippsardar avatar the-darc avatar webmonarch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

banking.js's Issues

TypeError: Cannot read property 'headers' of undefined

Hey, I'm getting the following error

TypeError: Cannot read property 'headers' of undefined
at Request.exports.getStatement as _callback
at Request.init.self.callback (/Users/dannybullis/Sites/cog_finance/node_modules/banking/node_modules/request/main.js:122:22)
at Request.EventEmitter.emit (events.js:96:17)
at Request.init (/Users/dannybullis/Sites/cog_finance/node_modules/banking/node_modules/request/main.js:170:10)
at new Request (/Users/dannybullis/Sites/cog_finance/node_modules/banking/node_modules/request/main.js:105:8)
at request (/Users/dannybullis/Sites/cog_finance/node_modules/banking/node_modules/request/main.js:995:11)
at Object.exports.getStatement (/Users/dannybullis/Sites/cog_finance/node_modules/banking/lib/banking.js:144:5)
at Object. (/Users/dannybullis/Sites/cog_finance/scripts/ofx_request.js:21:9)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)

Here's the script I'm trying to run:
var banking = require('banking');
var bankData = require('../secure/banking_data').bankData;
var userData = require('../secure/banking_data').userData;
var appData = require('../secure/banking_data').appData;

var bankInfo = {
fid: bankData.fid,
fidorg: bankData.org,
url: bankData.url,
bankid: bankData.bankid,
user: userData.id,
pass: userData.pass,
accid: userData.acct_number,
acctype: userData.acct_type,
date_start: 20130301,
date_end: 20130322,
};

banking.getStatement(bankInfo, function(res, err){
if(err) console.log(err)
console.log(res);
});

Doesn't appear to be something on my end, is there a bug somewhere? Thanks for the help! I'm stoked to use the module...once I get it working

Call to Citicards doesn't seem to be working

Request:

var Banking = require('banking');

var bank = Banking({
    fid: 24909
  , fidOrg: 'Citigroup'
  , url: 'https://www.accountonline.com/cards/svc/CitiOfxManager.do'
  , bankId: '' /* If bank account use your bank routing number otherwise set to null */
  , user: 'xxxx'
  , password: 'xxxx'
  , accId: 'xxxx' /* Account Number */
  , accType: 'CREDITCARD' /* CHECKING || SAVINGS || MONEYMRKT || CREDITCARD */
  , ofxVer: 103 /* default 102 */
  , app: 'QBKS' /* default  'QWIN' */
  , appVer: '1900' /* default 1700 */
});

bank.getStatement({start:20170101, end:20170330}, function(err, res){
  if(err) console.log(err)
  console.log(res);
});

Part of Output

<STATUS><CODE>2000</CODE><SEVERITY>ERROR</SEVERITY><MESSAGE>We\'ve had a problem processing your request.  It may take 24 to 36 hours for the problem to be resolved.  Please try again at that time.</MESSAGE></STATUS>

CSV Output for transactions

I was wondering if you could add a feature to produce CSV output of the core transactions? This will help importing to xls or loading to a database.

Thanks!

Discover Card

Discover made some changes on their ofx server and now im no longer able to access it. Anyone have any good ways to debug?

all i get from the server is

<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>

You don't have permission to access "http&#58;&#47;&#47;ofx&#46;discovercard&#46;com&#47;" on this server.<P>
Reference&#32;&#35;18&#46;f6a83d42&#46;148987705&#46;100e5d5d
</BODY>
</HTML>

heres the connection info http://www.ofxhome.com/index.php/institution/view/444

Unable to parse request with USAA

var bank = Banking({
        fid: "24591",
        fidOrg: "USAA",
        url: "https://service2.usaa.com/ofx/OFXServlet",
        bankId: "",
        user: "",
        password: "",
        accId: "",
        accType: "CHECKING",
        ofxVer: "103",
        app: "QBKS",
        appVer: "1900"
});

Using the above configuration I am getting the following error:

OFXAdapter: Failed to parse request: Unable to parse a composite field "OFXRequest.OFXRequest": postTag "/OFX" not found.
Remaining unparsed data:

It then has a bunch of XML data with some private information in it (looks like my original configuration data).

Parse is returning Arrays with a single object inside instead of the object directly

In previous versions of the banking.js, the JSON in the body property of the returned object of methods Banking.parseFile and Banking.parse respected the interface documented in the Readme.md#Response.

Since the version 1.0.0 it uses arrays with a single object inside instead of the object directly.

Example:

Response body for sample.ofx in v0.3.3 and previous versions:

{
    "OFX": {
      "SIGNONMSGSRSV1": {
        "SONRS": {
          "STATUS": {
            "CODE": "0",
            "SEVERITY": "INFO",
            "MESSAGE": "SUCCESS"
          },
          "DTSERVER": "20120126212302.454[-8:PST]",
          "LANGUAGE": "ENG",
          "FI": {
            "ORG": "DI",
            "FID": "321081669"
          }
        }
      },
      (... and more ...)
}

Response body for sample.ofx in v1.0.0:

{
  "OFX":{
    "SIGNONMSGSRSV1":[
      {
        "SONRS":[
          {
            "STATUS":[
              {
                "CODE":[
                  "0"
                ],
                "SEVERITY":[
                  "INFO"
                ]
              }
            ],
            "DTSERVER":[
              "20120127235919.500"
            ],
            "LANGUAGE":[
              "ENG"
            ],
            "DTPROFUP":[
              "20050531070000.000"
            ],
            "FI":[
              {
                "ORG":[
                  "WFB"
                ],
                "FID":[
                  "3000"
                ]
              }
            ],
      (... and more ...)
}

loans?

Hey @euforic
Great job on this package!

Say if I wanted to consolidate all of my loan details, do you know if there API or common agreed-upon standard for that?

Cheers

The JSON parsing is not working with OXF files that use end-tags in the OFX elements

I have some OFX files that contain end-tags in your elements. Example:

(... HEADER ...)

<OFX>
<SIGNONMSGSRSV1>
<SONRS>
<STATUS>
<CODE>0</CODE>
<SEVERITY>INFO</SEVERITY>
</STATUS>

(... MORE CONTENT ...)

And for those files the result of Banking.parseFile() is an object with undefined in the body property:

{
  xml: '<OFX><SIGNONMSGSRSV1><SONRS><STATUS><CODE>0</CODE></CODE><SEVERITY>INFO</SEVERITY></SEVERITY></STATUS>...',
  body: undefined,
  header: { OFXHEADER: '100', ...}
}

As mentioned above, is expected that the OFX parser accepts OFX files with and without end tags:

2.8 Backward Compatibility with Pre-OFX 2.2 Systems
Post-OFX 2.0 differs from pre-OFX 2.0 mainly through the required use of end tags on all elements and through the use of an XML compliant header. OFX 1.0.2 required any parser to accept end tags but did not require clients or servers to send elements with end tags.
From: Specification 2.2 Public DRAFT

Support for Promises

Hello,
I would like to use promises like this:

return bank.getStatement({start:20170101, end:20180201}).then(function(response){
    //Do Something
},function(error){
    //Handle Error
});

but when I do that it only returns the XML with no parsed body. If I'm doing something wrong please correct me, otherwise what would it look like to add this feature?

bank.getStatement() returning "true"?

Hello - I'm very new to javascript, so sorry if this is obvious, but I can't figure out why my code isn't working. I've written a script, to be launched from windows command line via "node myscript.js" (node, npm, and banking are all installed and working). The script runs, but when I get to the bank.getStatement() function, it just returns:
true
Error 500: java.lang.NullPointerException

I'd expected it to return the parsed ofx data to the console ... is that wrong? When I changed the bank info from my checking account to an American Express credit card, it returned "false" instead of true - which makes me think it's at least accessing the bank with the below info?

If anyone can point me in the right direction I'd appreciate it. Thanks.
Here's my code:

console.log('Script is running');

var Banking = require('banking');

var bank = Banking({
fid: 5829,
fidOrg: 'Fifth Third Bancorp',
url: 'https://banking.53.com/ofx/OFXServlet',
bankID: '042000314',
user: 'MY USERNAME',
password: 'MY PASSWORD',
accID: 'MY CHECKING ACCT NUMBER',
accType: 'CHECKING',
ofxVer: 102,
app: 'QWIN',
appver: '1700',
});

bank.getStatement({start:20160701, end:20160801}, function(err, res){
if(err) console.log(err)
console.log(res);
});

Citibank not returning valid OFX?

Hello,

I am unable to retrieve valid OFX data from my Citibank account. I'll attach a gist here to show what parameters I'm using and the OFX I do get back.

-Peyton Sherwood

Front end

Not really an issue... but I was wondering if any of the users wrote a quick/dirty (or elegant!) front end for this?

I added account gathering code

Added this to
FX.createRequest = function(opts) {

}else
    if (type == 'INFO') {
    var reqStr = getOfxHeaders(opts) +
      '<OFX>' +
      getSignOnMsg(opts) +
      '<SIGNUPMSGSRQV1>' + 
      '<ACCTINFOTRNRQ>' +
      '<TRNUID>' + util.uuid(32) +
      '<ACCTINFORQ>' +
      '<DTACCTUP>20121012111027.000' + 
      '</ACCTINFORQ>' +
      '</ACCTINFOTRNRQ>' +
      '</SIGNUPMSGSRQV1>' +
      '</OFX>';

Would like to submit a pull request to make function parameters clearer

It has taken me a while to get my head around what lines like the following are doing:

Banking.prototype.getStatement = function(args, fn) {
  //Takes this.opts, mixes all of its properties into args and then returns args to be assigned to a local opts
  var opts = util.mixin(this.opts, args);
  //Uses the new local opts to create an ofxReq
  var ofxReq = ofx.createRequest(opts);

  var req = request
    //Uses the Banking version of opts not the local version
    .post(this.opts.url)

I would like to rewrite functions to use named parameters instead of an object that contains a lot of parameters to make these functions and ultimately this module easier to read and use and make calling things the right way more discoverable.

This would be a substantial change to the API of this module.

Would you be up for me submitting a pull request that rewrote things in this way?

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

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?

headerString[key].split()

I had problems with the function "parse()".
The last object of array headerString on "lib/ofx.js" is a function, the split() doesn't work in that case.

I corrected it with if(typeof != "function")

image

This code is found in "banking/lib/ofx.js".

Critical Dependencies Warnings

Hi

I am getting these areas

WARNING in ./~/formidable/lib/incoming_form.js
Critical dependencies:
1:43-50 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/formidable/lib/incoming_form.js 1:43-50

WARNING in ./~/formidable/lib/file.js
Critical dependencies:
1:43-50 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/formidable/lib/file.js 1:43-50

WARNING in ./~/formidable/lib/querystring_parser.js
Critical dependencies:
1:43-50 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/formidable/lib/querystring_parser.js 1:43-50

WARNING in ./~/formidable/lib/json_parser.js
Critical dependencies:
1:43-50 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/formidable/lib/json_parser.js 1:43-50

Best Practice for daily download

Not an issue really.

In case anyone stores the data that was downloaded, just wanted to find out what are the best practices (if there are any) for downloading transaction data daily considering:

  1. Transactions that are posted late
  2. Pending transactions (like the ones on credit card)

Thanks!

No response / no transactions with USAA

I'm trying to use this module to download transaction data from USAA. I can't really tell if I'm even getting a response - it looks like the "res" parameter is just echoing the request, as there is no BANKMSGSRSV1 element (or any other ofx "response" elements, even the signon), only BANKMSGSRQV1. I'm not sure how much more info I can give you without posting my bank info, so let me know what else would be helpful.

OFX parsing breaks with OFX files from my bank

Hey, I'm trying to use Banking JS to parse OFX data from my bank, but I'm getting the following error:

/path-to-nodejs-project/app.js:177
    var CCSTMTTRNRS = res.body.OFX.CREDITCARDMSGSRSV1.CCSTMTTRNRS;
                              ^

TypeError: Cannot read property 'OFX' of undefined
    at /path-to-nodejs-project/app.js:177:31
    at /path-to-nodejs-project/node_modules/banking/lib/banking.js:70:7
    at Object.OFX.parse (/path-to-nodejs-project/node_modules/banking/lib/ofx.js:173:3)
    at path-to-nodejs-project/node_modules/banking/lib/banking.js:69:9
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
Steve-2:path-to-nodejs-project steveharrison$ 

It works fine with OFX files from other credit card providers, but fails for any OFX files from my bank.

This is an OFX file that breaks (modified to remove personal info):

OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:NONE
<OFX>
<SIGNONMSGSRSV1>
<SONRS>
<STATUS>
<CODE>0
<SEVERITY>INFO
</STATUS>
<DTSERVER>20170844045844
<LANGUAGE>ENG
</SONRS>
</SIGNONMSGSRSV1>
<CREDITCARDMSGSRSV1>
<CCSTMTTRNRS>
<TRNUID>1
<STATUS>
<CODE>0
<SEVERITY>INFO
</STATUS>
<CCSTMTRS>
<CURDEF>AUD
<CCACCTFROM>
<ACCTID>1234567890123456
</CCACCTFROM>
<BANKTRANLIST>
<DTSTART>20150808000000
<DTEND>20170808000000
<STMTTRN>
<TRNTYPE>CREDIT
<DTPOSTED>20170701
<DTUSER>201700701
<TRNAMT>63.10
<FITID>A123456789012
<MEMO>RECEIVED PAYMENT            
</STMTTRN>
<STMTTRN>
<TRNTYPE>CREDIT
<DTPOSTED>20170702
<DTUSER>20170702
<TRNAMT>39.00
<FITID>A821582159120
<MEMO>RECEIVED PAYMENT            
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20170801
<DTUSER>20170801
<TRNAMT>-20.50
<FITID>
<MEMO>MERCHANT NAME, LOCATION  
</STMTTRN>
</BANKTRANLIST>
<LEDGERBAL>
<BALAMT>-1234.00
<DTASOF>20170844045844
</LEDGERBAL>
<AVAILBAL>
<BALAMT>1234.00
<DTASOF>20170844045844
</AVAILBAL>
</CCSTMTRS>
</CCSTMTTRNRS>
</CREDITCARDMSGSRSV1>
</OFX>

Any ideas?

Unable to get transactions from Tangerine (Canada)

Here is what I get:

{ SIGNONMSGSRSV1:
   { SONRS:
      { STATUS: 
          { CODE: '0',
            SEVERITY: 'INFO',
            MESSAGE: 'Authentication Successful.' },
        DTSERVER: '20180624232758.373[-4:EDT]',
        LANGUAGE: 'ENG',
        FI: { ORG: 'TangerineBank', FID: '10951' } } },
  BANKMSGSRSV1:
   { STMTTRNRS:
      { TRNUID: 'CrtFKOellYoIErC0YT2Lmdg8zGNmljoY',
        STATUS: { CODE: '2003', SEVERITY: 'ERROR' },
        CLTCOOKIE: 'TN9fO' } } }

So it looks like it authenticated successfully, however something went wrong with BANKMSGSRSV1 (error code 2003).

I wonder if this would have anything to do with the security questions tangerine asks when connecting from a new device.

Or maybe I need to try different headers? Not sure how to do that or what values to try.

Any tips much appreciated.

Citibank not returning proper output

I'm pretty sure this is not an issue with banking.js

@peytons reported this in 2012 #3

It's mid 2017 now, and I'm seeing the same response as that issue. A Google search indicates that Citibank stopped supporting Direct Connect in 2015, and unfortunately their OFX response does not indicate this. If they stopped Direct Connect, they should've directly rejected the request with an error, rather than providing a proper looking response. So, I'm really not sure what to make out of the response.

Even though Citibank does not give the proper results, I notice that Citicards does! :-) Of course, that would work only for Credit Cards, and not for bank accounts.

Any ideas / workarounds?

setting DTCLIENT to args.end leads to client/server date mismatch error

I think DTCLIENT should be set to the current time, not args.end.

I followed the docs...

// date format YYYYMMDDHHMMSS
bank.getStatement({start:20130101, end:20131101}, function(err, res){
  if(err) console.log(err)
  console.log(res);
});

but I got:

<OFX><SIGNONMSGSRSV1><SONRS><STATUS><CODE>2000</CODE><SEVERITY>ERROR</SEVERITY><MESSAGE>We\'ve detected that the date set on your computer does not match that of ours. ...

I've used ofxclient with success, so I compared its code, and where it does _field("DTCLIENT", now(), I see args.end instead of now() here in banking.js.

So I set args.end to an appropriate DSTART value, and it worked:

var now = new Date();

function ofxDateFmt(d) {
  return d.toISOString().substring(0, 20).replace(/[^0-9]/g, '');
}

card.getStatement({start: '20151001',
           end: ofxDateFmt(now)}, function(err, res){
  if(err) console.log(err)
  console.log(res);
});

American Express does not seem to work

Using http://www.ofxhome.com/index.php/institution/view/424 & http://wiki.gnucash.org/wiki/OFX_Direct_Connect_Bank_Settings as a guide I have the following bank options:

fid: 3101

, fidOrg: 'AMEX'
, url: 'https://online.americanexpress.com/myca/ofxdl/desktop/desktopDownload.do?request_type=nl_ofxdownload'
, bankId: 'americanexpress.com' /* If bank account use your bank routing number otherwise set to null /
, user: 'XXX'
, password: 'XXX'
, accId: 'XXX' /
Account Number /
, accType: 'CREDITCARD' /
CHECKING || SAVINGS || MONEYMRKT || CREDITCARD /
//, ofxVer: 103 /
default 102 /
, app: 'QWIN' /
default 'QWIN' /
, appVer: '1700' /
default 1700 */

I get a valid OFX response but it's just an error which contains the following error The server does not support the CREDITCARDMSGSRQV1 request, or a request was made against an invalid organization.

Any ideas?

Convert xml2json to xml2js

Can we look into converting over to https://www.npmjs.com/package/xml2js?

It removes the dependencies on any C libs and also looks much more robust and active.

Looking through the code it looks like you could get away by simply modifying lines 151 and 153 in ofx.js to something like,

parseString(xml, function (err, result) {
    console.dir(result);
});

May have to wrap it in JSON.parse() but not a huge change.

Thoughts?

Credit card requests are not getting the DTEND field added

Pardon my very amateur knowledge in the OFX world, but it looks like not adding the DTEND field during credit card requests (the final else block in createRequest) is causing my bank to always return all of my transactions. Adding in the DTEND field results in the proper amount of transactions (at least with my bank).

Is there any reason why this field isn't appended to the OFX request for credit card requests?

Chase OFX parsing error

After digging through the issues, I am getting a response for my Chase credit card. But, the body is still returning as :

body: { OFX: { SIGNONMSGSRSV1: [Object], CREDITCARDMSGSRSV1: [Object] } },`

Thanks in advance.

Send request to bank using HTTPS

@euforic , I noticed in banking.js the request sent to the secure bank server is just using a standard HTTP request via superagent. I haven't used superagent much, but a brief search through their module didn't turn anything up for HTTPS, but maybe I'm blind. FYI, I might clone this repo and do a pull request for a version of banking.js that uses an HTTPS request instead. Very soon.

Cheers

npm install banking fail

Hey I feel like a failure, but I need some help, after install node and npm and all that. I type in the command npm install banking and get.

npm ERR! Error: No compatible version found: banking
npm ERR! No valid targets found.
npm ERR! Perhaps not compatible with your version of node?
npm ERR! at installTargetsError (/usr/local/lib/node_modules/npm/lib/cache.js:424:10)
npm ERR! at /usr/local/lib/node_modules/npm/lib/cache.js:406:17
npm ERR! at saved (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:136:7)
npm ERR! at Object.cb as oncomplete
npm ERR! Report this entire log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]
npm ERR!
npm ERR! System Linux 2.6.38-13-generic
npm ERR! command "node" "/usr/local/bin/npm" "install" "banking"
npm ERR! cwd /home/khansen/node
npm ERR! node -v v0.5.11-pre
npm ERR! npm -v 1.0.106

Please help me out!

Critical warning in Webpack: require function is used in a way in which dependencies cannot be statically extracted

When building a project with banking.js and webpack, the following warning is emitted on build:

WARNING in ./~/banking/lib/ofx.js
7:17-24 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

webpack doesn't seem to like the use of require this way here: https://github.com/euforic/banking.js/blob/master/lib/ofx.js#L7

Seems like a easy tweak to fix this warning.

APPVER=2000

Just an FYI, I had to change APPVER to 2000 in order for my bank ( Wells Fargo ) to accept a connection. Here's some data I found:

  • Intuit Quicken Windows 2011 (APPID=QWIN, APPVER=2000, Header Ver=102)
  • Intuit Quicken Windows 2010 (APPID=QWIN, APPVER=1900, Header Ver=102)
  • Intuit QuickBooks Windows 2008 (APPID=QBW, APPVER=1800, Header Ver=102)
  • Intuit Quicken Mac 2008 (APPID=QMOFX, APPVER=1700, Header Ver=102)

Oregon Community Credit Union "Signon invalid" "Invalid user signon"

I am trying to connect to my OCCU account. Using this info and getting

{ xml: '<OFX><SIGNONMSGSRSV1><SONRS><STATUS><CODE>15500</CODE><SEVERITY>ERROR</SEVERITY><MESSAGE>Signon invalid</MESSAGE></STATUS><DTSERVER>20150907232127.798[-4.00:EDT]</DTSERVER><LANGUAGE>ENG</LANGUAGE><FI><ORG>ORCC</ORG><FID>2077</FID></FI></SONRS></SIGNONMSGSRSV1><BANKMSGSRSV1><STMTTRNRS><TRNUID>JBXDbXp045aNqcd5iSRy9kGhNoK50j0x</TRNUID><STATUS><CODE>15500</CODE><SEVERITY>ERROR</SEVERITY><MESSAGE>Invalid user signon</MESSAGE></STATUS></STMTTRNRS></BANKMSGSRSV1></OFX>',
  body: { OFX: { SIGNONMSGSRSV1: [Object], BANKMSGSRSV1: [Object] } },
  header:
   { OFXHEADER: '100',
     DATA: 'OFXSGML',
     VERSION: '102',
     SECURITY: 'NONE',
     ENCODING: 'USASCII',
     CHARSET: '1252',
     COMPRESSION: 'NONE',
     OLDFILEUID: 'NONE',
     NEWFILEUID: 'rHs4jL1ftBsJyE8taXLuy2GvgllDjBC1' } }

This is my javascript:

var Banking = require('banking');
var chalk = require('chalk');
console.log(chalk.green('Connecting...'));

var bank = Banking({
    fid: 2077
  , fidOrg: 'ORCC'
  , url: 'https://www20.onlinebank.com/OROFX16Listener'
  , bankId: 323274461 /* If bank account use your bank routing number otherwise set to null */
  , user: '******'
  , password: '*****'
  , accId: ******** /* Account Number */
  , accType: 'CHECKING' /* CHECKING || SAVINGS || MONEYMRKT || CREDITCARD */
  , ofxVer: 102 /* default 102 */
  , app: 'QWIN' /* default  'QWIN' */
  , appVer: '1700' /* default 1700 */
});


bank.getStatement({start:20140101, end:20151101}, function(err, res){
  if(err) console.log(err)
  console.log(res);
});

I'm sure my credentials are correct. I even tried using my member number instead of my username for user value.

Credit Cards with USAA

I can't seem to get connected to USAAs Credit Card information this is the object I'm creating with:

var bank = Banking({
    fid: 24591
  , fidOrg: 'USAA'
  , url: 'https://service2.usaa.com/ofx/OFXServlet'
  , bankId: '314074269' /* If bank account use your bank routing number otherwise set to null */
  , user: '{usaacustomer number}'
  , password: '{pincode}'
  , accId: '{ccnumber}' /* Account Number */
  , accType: 'CREDITCARD' /* CHECKING || SAVINGS || MONEYMRKT || CREDITCARD */
  , ofxVer: 102 /* default 102 */
  , app: 'QBKS' /* default  'QWIN' */
  , appVer: '1900' /* default 1700 */
  , headers: ['Host', 'Accept', 'User-Agent', 'Content-Type', 'Content-Length', 'Connection']

I've tried it with and without the headers but keep getting this error:

Some or all of the information you have entered is invalid. Please call toll free (1-800-531-6347) for assistance.

Any ideas?

doesn't work with La Banque Postale ?

Hi I've been struggling getting my transactions from my accounts at La Banque Postale through banking.js.
I'm using iCompta's direct connect capability with these accounts so I know the backend is setup correctly & working.

here is my code :

var Banking = require('banking');
var bank = Banking({
  fid: null,
  fidOrg: null,
  url: 'https://ofx.videoposte.com',
  bankId: '20041',
  user: 'xxx',
  password: 'xxx',
  accId: 'xxx',
  accType: 'CHECKING'
  ofxVer: 102,
  app: 'QWIN',
  appVer: '1900',
});
bank.getStatment({start:20131204, end:20131231}, function(res, err){
    if(err) console.log(err);
    console.log(res);
});

The OFX request seems quite similar on both sides :

banking.js

OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:928PdsplCtYppfbfFHcd8mfahCSvQAq6

<OFX>
  <SIGNONMSGSRQV1>
    <SONRQ>
      <DTCLIENT>20131231
      <USERID>***
      <USERPASS>***
      <LANGUAGE>ENG
      <FI>
        <ORG>
        <FID>
      </FI>
      <APPID>QWIN
      <APPVER>1900
    </SONRQ>
  </SIGNONMSGSRQV1>
  <BANKMSGSRQV1>
    <STMTTRNRQ>
      <TRNUID>UBAY7vJAX1wvCErCi74mNwQ1RNZeDEvj
      <CLTCOOKIE>YtAFn
      <STMTRQ>
        <BANKACCTFROM>
          <BANKID>20041
          <ACCTID>xxx
          <ACCTTYPE>CHECKING
        </BANKACCTFROM>
        <INCTRAN>
          <DTSTART>20131204
          <INCLUDE>Y
        </INCTRAN>
      </STMTRQ>
    </STMTTRNRQ>
  </BANKMSGSRQV1>
</OFX>

iCompta

OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:NONE

<OFX>
  <SIGNONMSGSRQV1>
    <SONRQ>
      <DTCLIENT>20131204
      <USERID>***
      <USERPASS>***
      <LANGUAGE>ENG
      <FI>
        <ORG>
      </FI>
      <APPID>QWIN
      <APPVER>1900
    </SONRQ>
  </SIGNONMSGSRQV1>
  <BANKMSGSRQV1>
    <STMTTRNRQ>
      <TRNUID>115A9E95-C806-429A-BCF9-5369AF813D97
      <STMTRQ>
        <BANKACCTFROM>
          <BANKID>20041
          <ACCTID>xxx
          <ACCTTYPE>CHECKING
        </BANKACCTFROM>
        <INCTRAN>
          <DTSTART>20131204
          <INCLUDE>Y
        </INCTRAN>
      </STMTRQ>
    </STMTTRNRQ>
  </BANKMSGSRQV1>
</OFX>

But all I'm getting as a result is the html of this page : https://ofx.videoposte.com/

I've not been able to get more information about the requests (method, port, other params..etc) but could it be related to a bankingjs limitation ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.