Skip to content

A local-first personal finance app

node-libofx: add transaction_acct_name function (#670)

Jed Fox4a3fe1d9fb41
diff --git a/packages/node-libofx/emscripten.cpp b/packages/node-libofx/emscripten.cpp
index 49657ada31..ae8f34710c 100644
--- a/packages/node-libofx/emscripten.cpp
+++ b/packages/node-libofx/emscripten.cpp
@@ -69,6 +69,13 @@ extern "C" {
// Transaction accessors
+ char *transaction_acct_name(OfxTransactionData *trans) {
+ if (trans->account_ptr && trans->account_ptr->account_id_valid) {
+ return trans->account_ptr->account_id;
+ }
+ return "";
+ }
+
double transaction_amount(OfxTransactionData *trans) {
return trans->amount;
}
diff --git a/packages/node-libofx/ffi.js b/packages/node-libofx/ffi.js
index f3e9d7dfcc..422ec69477 100644
--- a/packages/node-libofx/ffi.js
+++ b/packages/node-libofx/ffi.js
@@ -8,11 +8,14 @@ function create(libofx) {
ofx_set_transaction_cb: libofx.cwrap('ofx_set_transaction_cb', null, [
'number',
'number',
- 'number'
+ 'number',
]),
+ transaction_acct_name: libofx.cwrap('transaction_acct_name', 'string', [
+ 'number',
+ ]),
transaction_amount: libofx.cwrap('transaction_amount', 'number', [
- 'number'
+ 'number',
]),
transaction_fi_id: libofx.cwrap('transaction_fi_id', 'string', ['number']),
transaction_date: libofx.cwrap('transaction_date', 'number', ['number']),
@@ -22,10 +25,13 @@ function create(libofx) {
set_ofx_version: libofx.cwrap('set_ofx_version', null, [
'number',
- 'string'
+ 'string',
]),
set_app_id: libofx.cwrap('set_app_id', null, ['number', 'string']),
- set_app_version: libofx.cwrap('set_app_version', null, ['number', 'string'])
+ set_app_version: libofx.cwrap('set_app_version', null, [
+ 'number',
+ 'string',
+ ]),
};
}
diff --git a/upcoming-release-notes/670.md b/upcoming-release-notes/670.md
new file mode 100644
index 0000000000..2db228d6fa
--- /dev/null
+++ b/upcoming-release-notes/670.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [j-f1]
+---
+
+`node-libofx`: add transaction_acct_name function