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

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

dckc opened this issue · comments

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);
});

Help me find the fix for this? I can't see it.