
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
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 either
<script src="path/to/ofx4js.min.js"></script>
or
var ofx4js = require("ofx4js");
To parse an OFX response:
// aliases
var AggregateUnmarshaller = ofx4js.io.AggregateUnmarshaller;
var ResponseEnvelope = ofx4js.domain.data.ResponseEnvelope;
// 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].getStatementResponse();
To download a bank's profile information:
// aliases
var BaseFinancialInstitutionData = ofx4js.client.impl.BaseFinancialInstitutionData;
var OFXV1Connection = ofx4js.client.net.OFXV1Connection;
// 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
The npm package ofx4js receives a total of 35 weekly downloads. As such, ofx4js popularity was classified as not popular.
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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.