Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
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.
Install with
npm install ofx4js
Then
import * as ofx4js from 'ofx4js';
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
Presently it can parse ofx strings, create ofx requests, and contact servers. Good enough to get started, but expect bugs.
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
Github push requests are welcome. Please create test cases. Bugs that are originally in Ofx4j should be contributed to that project.
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.
FAQs
A javascript OFX library, ported from OFX4J
We found that ofx4js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.