ofx4js
A javascript OFX library, ported from OFX4J
Last updated a year ago by arolson101 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ofx4js 
SYNC missed versions from official npm registry.

Ofx4js

A pure javascript port of OFX4J- an OFX implementation. Works in node.js and in browsers (see security note below).

Note: There is no affiliation between the Ofx4j and Ofx4js projects.

Installation

Install with

  npm install ofx4js

Then

  import * as ofx4js from 'ofx4js';

Usage

To parse an OFX response:

  // aliases
  import { AggregateUnmarshaller, ResponseEnvelope } from 'ofx4js';

  // your ofx data
  var ofxData = "OFXHEADER:100...";

  // an unmarshaller that will read responses.  Note you will use a
  //  ResponseEnvelope to read responses, and a RequestEnvelope to read
  //  requests.
  var m = new AggregateUnmarshaller(ResponseEnvelope);

  // parse the string into the ofx data structures
  var data = m.unmarshal(ofxData);

  // read the data
  var messageSets = data.getMessageSets();
  var bankingResponse = messageSets[1].cast<BankingResponseMessageSet>().getStatementResponse();

To download a bank's profile information:

  // aliases
  import { BaseFinancialInstitutionData, OFXV1Connection } from 'ofx4js';

  // input your bank's information.  See http://www.ofxhome.com/
  var bank = new BaseFinancialInstitutionData();
  bank.setFinancialInstitutionId(...);
  bank.setOrganization(...);
  bank.setOFXURL(...);
  bank.setName(...);

  var connection = new OFXV1Connection();

  var service = new FinancialInstitutionImpl(bank, connection);
  return service.readProfile()
  .then(function(data) {
    // data successfully retrieved
    console.log(data);
  });

NOTE: making an OFX connection will fail security checks in browsers. On Chrome you can make it run with the "--disable-web-security" command-line option

e.g. (OSX): open /Applications/Google\ Chrome.app --args --disable-web-security

Status

Presently it can parse ofx strings, create ofx requests, and contact servers. Good enough to get started, but expect bugs.

Port

Ofx4js was ported from Ofx4j at r45 (1.7)

This project contains a lot of files that were ported from java to javascript by a combination of a perl script and a lot of hand editing. Because of syntax differences between the two languages, not everything ported especially cleanly. There are probably hidden bugs stemming from the port.

Because the code is a port, there are a lot of java-isms (e.g. property accessors) that don't make sense in javascript and could probably be simplified. There are no plans to address this.

This is not a full port of ofx4j- specifically, the server portion is gone, as are the FinancialInstitutionDataStore-related classes. That is, you will have to provide your own financial insitution

Contributing

Github push requests are welcome. Please create test cases. Bugs that are originally in Ofx4j should be contributed to that project.

License

Ofx4j was released under the Apache License V2.0. The license has been kept on files originally from that project, and where applicable the files remain under that license. Where not specified (i.e., the files created especially for the javascript port) the files are released under the MIT license.

Current Tags

  • 2.1.0                                ...           latest (a year ago)

13 Versions

  • 2.1.0                                ...           a year ago
  • 2.0.1                                ...           a year ago
  • 2.0.0                                ...           a year ago
  • 1.1.4                                ...           3 years ago
  • 1.1.3                                ...           3 years ago
  • 1.1.2                                ...           4 years ago
  • 1.1.1                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.4                                ...           5 years ago
  • 1.0.3                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 14
Dependencies (4)
Dev Dependencies (15)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |