checking/saving statement requests

Christian Lupien <[email protected]> Sun, 17 Dec 2006 23:52:44 -0500
Newsgroups gmane.comp.finance.libofx.devel
Message-ID <[email protected]>
Hello

I sent this email three weeks ago but I was not a list member and it
never made it out. So here it is again.



I was trying to use gnucash (2.0.2) with aqbanking (2.2.3) and libofx
(0.8.2) to access an ING direct account which is a SAVINGS account. The
system worked for a CHECKING account but because this is hardcoded in
the statement-request, I was unable to get the savings to work (reply was
always account does not exist).

So I did the following hack. It fixes my problem and keeps binary
compatibility. A better fix fix might be to force both AccountType enum
to be the same but that would break the binary compatibility of the
library.

I also included the aqbanking patch to make it work. If you do make the
change, you could send it to them.

Cheers
Christian

Anyway here is the libofx patch:
----------------------------------------------
--- libofx-0.8.2-old/inc/libofx.h       2006-11-26 12:54:59.000000000 -0500
+++ libofx-0.8.2/inc/libofx.h   2006-11-26 13:00:20.000000000 -0500
@@ -705,7 +705,12 @@
   OFX_BANK_ACCOUNT,
   OFX_INVEST_ACCOUNT,
   OFX_CREDITCARD_ACCOUNT,
-  OFX_INVALID_ACCOUNT
+  OFX_INVALID_ACCOUNT,
+  OFX_CHECKING_ACCOUNT,
+  OFX_SAVINGS_ACCOUNT,
+  OFX_MONEYMRKT_ACCOUNT,
+  OFX_CREDITLINE_ACCOUNT,
+  OFX_CMA_ACCOUNT
 } AccountType;

  /**
--- libofx-0.8.2-old/lib/ofx_request_statement.cpp      2006-11-26 12:54:48.000000000 -0500
+++ libofx-0.8.2/lib/ofx_request_statement.cpp  2006-11-26 13:07:49.000000000 -0500
@@ -61,8 +61,16 @@
   OfxAggregate bankacctfromTag("BANKACCTFROM");
   bankacctfromTag.Add( "BANKID", m_account.bankid );
   bankacctfromTag.Add( "ACCTID", m_account.accountid );
-  bankacctfromTag.Add( "ACCTTYPE", "CHECKING" );
-  // FIXME "CHECKING" should not be hard-coded
+  if ( m_account.type == OFX_CHECKING_ACCOUNT || m_account.type == OFX_BANK_ACCOUNT )
+    bankacctfromTag.Add( "ACCTTYPE", "CHECKING" );
+  else if  ( m_account.type == OFX_SAVINGS_ACCOUNT )
+    bankacctfromTag.Add( "ACCTTYPE", "SAVINGS" );
+  else if  ( m_account.type == OFX_MONEYMRKT_ACCOUNT )
+    bankacctfromTag.Add( "ACCTTYPE", "MONEYMRKT" );
+  else if  ( m_account.type == OFX_CREDITLINE_ACCOUNT )
+    bankacctfromTag.Add( "ACCTTYPE", "CREDITLINE" );
+  else if  ( m_account.type == OFX_CMA_ACCOUNT )
+    bankacctfromTag.Add( "ACCTTYPE", "CMA" );

   OfxAggregate inctranTag("INCTRAN");
   inctranTag.Add( "DTSTART", time_t_to_ofxdate( m_date_from ) );
-----------------------------------------------


And the aqbanking patch

---------------------------------------------
--- aqbanking-2.2.3.orig/src/plugins/backends/aqofxconnect/plugin/context.c 2006-11-26 03:41:32.000000000 -0500
+++ aqbanking-2.2.3/src/plugins/backends/aqofxconnect/plugin/context.c  2006-11-26 13:19:13.000000000 -0500
@@ -190,11 +190,20 @@
     case AB_AccountType_Investment:
       t=OFX_INVEST_ACCOUNT;
       break;
+    /* Note that there is a missing type for OFX_MONEYMRKT_ACCOUNT */

     case AB_AccountType_Checking:
+      t=OFX_CHECKING_ACCOUNT;
+      break;
     case AB_AccountType_Savings:
+      t=OFX_SAVINGS_ACCOUNT;
+      break;
     case AB_AccountType_Cash:
+      t=OFX_CMA_ACCOUNT;
+      break;
     case AB_AccountType_Bank:
+      t=OFX_CREDITLINE_ACCOUNT;
+      break;
     case AB_AccountType_Unknown:
     default:
       t=OFX_BANK_ACCOUNT;
---------------------------------------------


-- 
------------------------------------------------------------------
Christian Lupien             Phone: (819) 821-8000 ext 62052
Departement de Physique        Fax: (819) 821-8046
Faculte des Sciences         email: [email protected]
Universite de Sherbrooke
Sherbrooke, Qc   J1K 2R1
Canada


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV