From c4bc741ceb69e2e547a01d836dd23f0cdef59fda Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Sat, 14 Feb 2004 12:12:49 +0000 Subject: [PATCH] 2004-02-14 Christian Stimming * configure.in: Require the correct openhbci2 version. Add verbose error message for the currently unavailable mt940 support. * src/import-export/hbci/hbci-druid-initial.c, gnc-hbci-utils.c: Finally finish openhbci2 support, phew. Requires openhbci2-1.9beta7 from http://sourceforge.net/projects/openhbci git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9838 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 9 ++ configure.in | 3 +- src/import-export/hbci/druid-hbci-initial.c | 146 ++++++++++++++++++-- src/import-export/hbci/glade/hbci.glade | 6 +- src/import-export/hbci/gnc-hbci-utils.c | 55 ++++++++ src/import-export/hbci/hbci-interaction.c | 6 +- src/import-export/hbci/hbci-interaction.h | 1 + src/import-export/hbci/hbci-interactionP.h | 4 - 8 files changed, 210 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 597d046f20..5e93698a9f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-02-14 Christian Stimming + + * configure.in: Require the correct openhbci2 version. Add verbose + error message for the currently unavailable mt940 support. + + * src/import-export/hbci/hbci-druid-initial.c, gnc-hbci-utils.c: + Finally finish openhbci2 support, phew. Requires + openhbci2-1.9beta7 from http://sourceforge.net/projects/openhbci + 2004-02-04 Derek Atkins * src/business/business-core/gncJob.c: Linas checked the wrong diff --git a/configure.in b/configure.in index 653e00c680..2de09fe8dd 100644 --- a/configure.in +++ b/configure.in @@ -568,6 +568,7 @@ AC_ARG_ENABLE( mt940, fi) if test x${MT940_DIR} = xmt940 ; then + AC_MSG_ERROR([Sorry, MT940 support is currently broken since it depends on the hbci module with the old openhbci 0.9.x library. But the hbci module now has been ported to the new openhbci2 library. The MT940 importer needs to be ported to openhbci2 as well before this can be enabled again.]) AM_PATH_OPENHBCI(0.9.13.2) # Note: HBCI_LIBS is changed again below in the --enable-hbci # section. So check for mt940 first and *not* the other way round! @@ -589,7 +590,7 @@ AC_ARG_ENABLE( hbci, fi) if test x${HBCI_DIR} = xhbci ; then - AM_PATH_OPENHBCI2(1.9.0.1) + AM_PATH_OPENHBCI2(1.9.0.8) #all_libraries="$all_libraries $OPENHBCI_LIBS" #all_includes="$all_includes $OPENHBCI_CXXFLAGS" #AM_PATH_OPENHBCI(0.9.13) diff --git a/src/import-export/hbci/druid-hbci-initial.c b/src/import-export/hbci/druid-hbci-initial.c index 588c647515..48fb03b432 100644 --- a/src/import-export/hbci/druid-hbci-initial.c +++ b/src/import-export/hbci/druid-hbci-initial.c @@ -1102,18 +1102,78 @@ on_accountinfo_next (GnomeDruidPage *gnomedruidpage, { HBCI_OutboxJob *job; + /* FIXME: Only do this sync job if this is a rdh medium. */ /* Execute a Synchronize job, then a GetAccounts job. */ - /*job = HBCI_OutboxJob_new("JobSync", - (HBCI_Customer *)info->newcustomer, ""); - HBCI_Outbox_addJob (info->outbox, job);*/ + job = HBCI_OutboxJob_new("JobSync", + (HBCI_Customer *)info->newcustomer, ""); + HBCI_Outbox_addJob (info->outbox, job); + { + HBCI_Job *jjob = HBCI_OutboxJob_Job(job); + HBCI_Job_setIntProperty + (jjob, "open/ident/country", + HBCI_Bank_country(HBCI_User_bank + (HBCI_Customer_user(info->newcustomer)))); + HBCI_Job_setProperty + (jjob, "open/ident/bankcode", + HBCI_Bank_bankCode(HBCI_User_bank + (HBCI_Customer_user(info->newcustomer)))); + HBCI_Job_setProperty + (jjob, "open/ident/customerid", HBCI_Customer_custId(info->newcustomer)); + + /* for getting a system id */ + HBCI_Job_setIntProperty(jjob, "open/sync/mode",0); + HBCI_Job_setProperty(jjob, "open/ident/systemid", "0"); + } + /* Execute Outbox. */ - /*if (!gnc_hbci_api_execute (info->window, info->api, info->outbox, - job, info->interactor)) {*/ - /* HBCI_API_executeOutbox failed. */ - /*return FALSE;*/ - /* -- it seems to be no problem if this fails ?! */ - /*}*/ + if (!gnc_hbci_api_execute (info->window, info->api, info->outbox, + job, info->interactor)) { + /* HBCI_API_executeOutbox failed. */ + GWEN_DB_NODE *rsp = HBCI_Outbox_response(info->outbox); + printf("on_accountinfo_next: oops, executeOutbox of JobSync failed.\n"); + + printf("on_accountinfo_next: Complete HBCI_Outbox response:\n"); + GWEN_DB_Dump(rsp, stdout, 1); + GWEN_DB_Group_free(rsp); + + rsp = HBCI_Job_responseData(HBCI_OutboxJob_Job(job)); + printf("on_accountinfo_next: Complete HBCI_Job response:\n"); + if (rsp) + GWEN_DB_Dump(rsp, stderr, 1); + /*return FALSE;*/ + /* -- it seems to be no problem if this fails ?! */ + } + + /* Now process the response of the JobSync */ + { + const char *sysid = + HBCI_Job_getProperty(HBCI_OutboxJob_Job(job), + "response/syncresponse/systemid", ""); + g_assert(sysid); + + if (strlen(sysid) > 0) { + HBCI_User_setSystemId((HBCI_User*) HBCI_Customer_user(info->newcustomer), sysid); + printf("on_accountinfo_next: Ok. Got sysid '%s'.\n", sysid); + } + else { + /* Got no sysid. */ + GWEN_DB_NODE *rsp = HBCI_Outbox_response(info->outbox); + printf("on_accountinfo_next: oops, got no sysid.\n"); + + printf("on_accountinfo_next: Complete HBCI_Outbox response:\n"); + GWEN_DB_Dump(rsp, stdout, 1); + GWEN_DB_Group_free(rsp); + + rsp = HBCI_Job_responseData(HBCI_OutboxJob_Job(job)); + printf("on_accountinfo_next: Complete HBCI_Job response:\n"); + if (rsp) + GWEN_DB_Dump(rsp, stderr, 1); + return FALSE; + } + } + + /* Now the GetAccounts job. */ job = HBCI_OutboxJob_new("JobGetAccounts", @@ -1121,6 +1181,7 @@ on_accountinfo_next (GnomeDruidPage *gnomedruidpage, HBCI_Outbox_addJob (info->outbox, job); { + char *mediumid; HBCI_Job *jjob = HBCI_OutboxJob_Job(job); HBCI_Job_setIntProperty (jjob, "open/ident/country", @@ -1133,6 +1194,15 @@ on_accountinfo_next (GnomeDruidPage *gnomedruidpage, HBCI_Job_setProperty (jjob, "open/ident/customerid", HBCI_Customer_custId(info->newcustomer)); HBCI_Job_setIntProperty(jjob, "open/prepare/updversion",0); + + /* FIXME: Only set this for RDH medium */ + mediumid = HBCI_Medium_mediumId((HBCI_Medium *)HBCI_User_medium(HBCI_Customer_user(info->newcustomer))); + g_assert(mediumid); + if (strlen(mediumid)==0) + HBCI_Job_setProperty(jjob, "open/ident/systemId", "0"); + else + HBCI_Job_setProperty(jjob, "open/ident/systemId", mediumid); + free(mediumid); } @@ -1140,7 +1210,20 @@ on_accountinfo_next (GnomeDruidPage *gnomedruidpage, if (!gnc_hbci_api_execute (info->window, info->api, info->outbox, job, info->interactor)) { /* HBCI_API_executeOutbox failed. */ - printf("on_accountinfo_next: oops, executeOutbox failed.\n"); + GWEN_DB_NODE *rsp = HBCI_Outbox_response(info->outbox); + printf("on_accountinfo_next: oops, executeOutbox of JobGetAccounts failed.\n"); + + printf("on_accountinfo_next: Complete HBCI_Outbox response:\n"); + GWEN_DB_Dump(rsp, stdout, 1); + GWEN_DB_Group_free(rsp); + + rsp = HBCI_Job_responseData(HBCI_OutboxJob_Job(job)); + printf("on_accountinfo_next: Complete HBCI_Job response:\n"); + if (rsp) + GWEN_DB_Dump(rsp, stderr, 1); + + /* And clean everything up */ + HBCI_Outbox_removeByStatus (info->outbox, HBCI_JOB_STATUS_NONE); return FALSE; } @@ -1299,6 +1382,20 @@ on_iniletter_info_next (GnomeDruidPage *gnomedruidpage, if (!gnc_hbci_api_execute (info->window, info->api, info->outbox, job, info->interactor)) { /* HBCI_API_executeOutbox failed. */ + GWEN_DB_NODE *rsp = HBCI_Outbox_response(info->outbox); + printf("on_iniletter_info_next: oops, executeOutbox failed.\n"); + + printf("Complete HBCI_Outbox response:\n"); + GWEN_DB_Dump(rsp, stdout, 1); + GWEN_DB_Group_free(rsp); + + rsp = HBCI_Job_responseData(HBCI_OutboxJob_Job(job)); + printf("Complete HBCI_Job response:\n"); + if (rsp) + GWEN_DB_Dump(rsp, stderr, 1); + + /* And clean everything up */ + HBCI_Outbox_removeByStatus (info->outbox, HBCI_JOB_STATUS_NONE); return FALSE; } @@ -1314,6 +1411,9 @@ on_iniletter_info_next (GnomeDruidPage *gnomedruidpage, } else if (info->gotkeysforCustomer != info->newcustomer) { printf("on_iniletter_info_next: Oops, already got keys for another customer. Not yet implemented.\n"); + + /* And clean everything up */ + HBCI_Outbox_removeByStatus (info->outbox, HBCI_JOB_STATUS_NONE); return TRUE; } @@ -1482,8 +1582,34 @@ on_iniletter_userinfo_next (GnomeDruidPage *gnomedruidpage, if (!gnc_hbci_api_execute (info->window, info->api, info->outbox, job, info->interactor)) { /* HBCI_API_executeOutbox failed. */ + GWEN_DB_NODE *rsp = HBCI_Outbox_response(info->outbox); + printf("on_iniletter_userinfo_next: Oops, api_execute failed.\n"); + printf("on_iniletter_userinfo_next: Complete HBCI_Outbox response:\n"); + GWEN_DB_Dump(rsp, stdout, 1); + GWEN_DB_Group_free(rsp); + + rsp = HBCI_Job_responseData(HBCI_OutboxJob_Job(job)); + printf("on_iniletter_userinfo_next: Complete HBCI_Job response:\n"); + if (rsp) + GWEN_DB_Dump(rsp, stderr, 1); + + /* And clean everything up */ + HBCI_Outbox_removeByStatus (info->outbox, HBCI_JOB_STATUS_NONE); return FALSE; } + + { + GWEN_DB_NODE *rsp = HBCI_Outbox_response(info->outbox); + printf("on_iniletter_userinfo_next: Complete HBCI_Outbox response:\n"); + GWEN_DB_Dump(rsp, stdout, 1); + GWEN_DB_Group_free(rsp); + + rsp = HBCI_Job_responseData(HBCI_OutboxJob_Job(job)); + printf("on_iniletter_userinfo_next: Complete HBCI_Job response:\n"); + if (rsp) + GWEN_DB_Dump(rsp, stderr, 1); + } + HBCI_Outbox_removeByStatus (info->outbox, HBCI_JOB_STATUS_NONE); } diff --git a/src/import-export/hbci/glade/hbci.glade b/src/import-export/hbci/glade/hbci.glade index cb897eb4c1..f5a3ce27bb 100644 --- a/src/import-export/hbci/glade/hbci.glade +++ b/src/import-export/hbci/glade/hbci.glade @@ -1404,7 +1404,8 @@ before this whole druid has finished. GtkLabel label8477411 - + GTK_JUSTIFY_CENTER False 0.5 @@ -1576,7 +1577,8 @@ connection in the HBCI connection window. GtkLabel label8477345 -