Esempio n. 1
0
AB_BANKING *
gnc_AB_BANKING_new(void)
{
    AB_BANKING *api;

    if (gnc_AB_BANKING)
    {
        /* API cached. */
        api = gnc_AB_BANKING;

        /* Init the API again. */
        if (gnc_AB_BANKING_refcount == 0)
            g_return_val_if_fail(AB_Banking_Init(api) == 0, NULL);

    }
    else
    {
        api = AB_Banking_new("gnucash", NULL, 0);
        g_return_val_if_fail(api, NULL);

#ifdef AQBANKING_VERSION_4_PLUS
        /* Check for config migration */
        if (AB_Banking_HasConf4(api
# ifndef AQBANKING_VERSION_5_PLUS
                                , 0
# endif
                               ) != 0)
        {
            if (AB_Banking_HasConf3(api
# ifndef AQBANKING_VERSION_5_PLUS
                                    , 0
# endif
                                   ) == 0)
            {
                g_message("gnc_AB_BANKING_new: importing aqbanking3 configuration\n");
                if (AB_Banking_ImportConf3(api
# ifndef AQBANKING_VERSION_5_PLUS
                                           , 0
# endif
                                          ) < 0)
                {
                    g_message("gnc_AB_BANKING_new: unable to import aqbanking3 configuration\n");
                }
            }
            else if (AB_Banking_HasConf2(api
# ifndef AQBANKING_VERSION_5_PLUS
                                         , 0
# endif
                                        ) == 0)
            {
                g_message("gnc_AB_BANKING_new: importing aqbanking2 configuration\n");
                if (AB_Banking_ImportConf2(api
# ifndef AQBANKING_VERSION_5_PLUS
                                           , 0
# endif
                                          ) < 0)
                {
                    g_message("gnc_AB_BANKING_new: unable to import aqbanking2 configuration\n");
                }
            }
        }
#endif /* AQBANKING_VERSION_4_PLUS */

        /* Init the API */
        g_return_val_if_fail(AB_Banking_Init(api) == 0, NULL);

#ifdef AQBANKING_VERSION_5_PLUS
        gnc_gwengui_extended_by_ABBanking = GWEN_Gui_GetGui();
        AB_Gui_Extend(gnc_gwengui_extended_by_ABBanking, api);
#endif /* AQBANKING_VERSION_5_PLUS */

        /* Cache it */
        gnc_AB_BANKING = api;
        gnc_AB_BANKING_refcount = 0;
    }

    gnc_AB_BANKING_refcount++;

    return api;
}
Esempio n. 2
0
int test3(int argc, char **argv) {
#ifdef USE_GWENGUI_GTK2
  GWEN_GUI *gui;
  GWEN_DIALOG *dlg;
  int rv;
  AB_BANKING *ab;

  rv=GWEN_Init();
  if (rv) {
    fprintf(stderr, "ERROR: Unable to init Gwen.\n");
    exit(2);
  }

  GWEN_Logger_SetLevel(AQBANKING_LOGDOMAIN, GWEN_LoggerLevel_Info);
  GWEN_Logger_SetLevel(AQOFXCONNECT_LOGDOMAIN, GWEN_LoggerLevel_Info);
  GWEN_Logger_SetLevel(GWEN_LOGDOMAIN, GWEN_LoggerLevel_Debug);

  gtk_init(&argc, &argv);

  gui=Gtk2_Gui_new();
  GWEN_Gui_SetGui(gui);

  ab=AB_Banking_new("test-ofxhome", NULL, 0);
  rv=AB_Banking_Init(ab);
  if (rv<0){
    fprintf(stderr, "Error on banking init: %d\n", rv);
    exit(2);
  }
  AB_Gui_Extend(gui, ab);

  dlg=OH_GetInstituteDialog_new("/tmp/ofx", NULL);
  if (dlg==NULL) {
    fprintf(stderr, "Could not create dialog\n");
    exit(2);
  }
  rv=GWEN_Gui_ExecDialog(dlg, 0);
  if (rv<=0){
    fprintf(stderr, "Dialog was aborted/rejected\n");
  }
  else {
    const OH_INSTITUTE_DATA *od;

    fprintf(stderr, "Dialog accepted, all fine\n");
    od=OH_GetInstituteDialog_GetSelectedInstitute(dlg);
    if (od) {
      fprintf(stderr, "- Id  : %d\n", OH_InstituteData_GetId(od));
      fprintf(stderr, "- Name: %s\n", OH_InstituteData_GetName(od));
      fprintf(stderr, "- FID : %s\n", OH_InstituteData_GetFid(od));
      fprintf(stderr, "- ORG : %s\n", OH_InstituteData_GetOrg(od));
      fprintf(stderr, "- URL : %s\n", OH_InstituteData_GetUrl(od));
    }

  }
  GWEN_Dialog_free(dlg);

  AB_Gui_Unextend(gui);

  rv=AB_Banking_Fini(ab);
  if (rv<0){
    fprintf(stderr, "Error on banking fini: %d\n", rv);
    exit(2);
  }
  AB_Banking_free(ab);
  GWEN_Gui_free(gui);
#endif
  return 0;
}
Esempio n. 3
0
int main(int argc, char **argv) {
  GWEN_DB_NODE *db;
  const char *cmd;
  const char *pinFile;
  int nonInteractive=0;
  const char *s;
  int rv;
  AB_BANKING *ab;
  GWEN_GUI *gui;
  const GWEN_ARGS args[]={
  {
    GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
    GWEN_ArgsType_Char,            /* type */
    "cfgfile",                    /* name */
    0,                            /* minnum */
    1,                            /* maxnum */
    "C",                          /* short option */
    "cfgfile",                    /* long option */
    "Specify the configuration file",     /* short description */
    "Specify the configuration file"      /* long description */
  },
  {
    GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
    GWEN_ArgsType_Char,           /* type */
    "pinfile",                    /* name */
    0,                            /* minnum */
    1,                            /* maxnum */
    "P",                          /* short option */
    "pinfile",                    /* long option */
    "Specify the PIN file",       /* short description */
    "Specify the PIN file"        /* long description */
  },
  {
    0,                            /* flags */
    GWEN_ArgsType_Int,            /* type */
    "nonInteractive",             /* name */
    0,                            /* minnum */
    1,                            /* maxnum */
    "n",                          /* short option */
    "noninteractive",             /* long option */
    "Select non-interactive mode",/* short description */
    "Select non-interactive mode.\n"        /* long description */
    "This automatically returns a confirmative answer to any non-critical\n"
    "message."
  },
  {
    0,                           
    GWEN_ArgsType_Int,           
    "verbosity",
    0,                           
    10,                          
    "v",                         
    0,                            
    "Increase the verbosity level",
    "Increase the verbosity level"
  },
  {
    GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
    GWEN_ArgsType_Char,           /* type */
    "charset",                    /* name */
    0,                            /* minnum */
    1,                            /* maxnum */
    0,                            /* short option */
    "charset",                    /* long option */
    "Specify the output character set",       /* short description */
    "Specify the output character set"        /* long description */
  },
  {
    GWEN_ARGS_FLAGS_HELP | GWEN_ARGS_FLAGS_LAST, /* flags */
    GWEN_ArgsType_Int,             /* type */
    "help",                       /* name */
    0,                            /* minnum */
    0,                            /* maxnum */
    "h",                          /* short option */
    "help",                       /* long option */
    "Show this help screen",      /* short description */
    "Show this help screen"       /* long description */
  }
  };

  rv=GWEN_Init();
  if (rv<0) {
    fprintf(stderr, "ERROR: Unable to init GWEN (%d).\n", rv);
    return 2;
  }

  GWEN_Logger_Open("aqpaypal-tool", "aqpaypal-tool", 0,
		   GWEN_LoggerType_Console,
                   GWEN_LoggerFacility_User);
  GWEN_Logger_SetLevel("aqpaypal-tool", GWEN_LoggerLevel_Warning);
  GWEN_Logger_SetLevel(0, GWEN_LoggerLevel_Warning);

  db=GWEN_DB_Group_new("arguments");
  rv=GWEN_Args_Check(argc, argv, 1,
		     GWEN_ARGS_MODE_ALLOW_FREEPARAM |
		     GWEN_ARGS_MODE_STOP_AT_FREEPARAM,
		     args,
		     db);
  if (rv==GWEN_ARGS_RESULT_ERROR) {
    fprintf(stderr, "ERROR: Could not parse arguments main\n");
    return -1;
  }
  else if (rv==GWEN_ARGS_RESULT_HELP) {
    GWEN_BUFFER *ubuf;

    ubuf=GWEN_Buffer_new(0, 1024, 0, 1);
    GWEN_Buffer_AppendString(ubuf,
                             I18N("Usage: "));
    GWEN_Buffer_AppendString(ubuf, argv[0]);
    GWEN_Buffer_AppendString(ubuf,
                             I18N(" [GLOBAL OPTIONS] COMMAND "
                                  "[LOCAL OPTIONS]\n"));
    GWEN_Buffer_AppendString(ubuf,
                             I18N("\nGlobal Options:\n"));
    if (GWEN_Args_Usage(args, ubuf, GWEN_ArgsOutType_Txt)) {
      fprintf(stderr, "ERROR: Could not create help string\n");
      return 1;
    }
    GWEN_Buffer_AppendString(ubuf,
                             I18N("\nCommands:\n\n"));
    GWEN_Buffer_AppendString(ubuf,
                             I18N("  listusers:\n"
                                  "    blurb "
                                  "file\n\n"));
   GWEN_Buffer_AppendString(ubuf,
                             I18N("  listaccounts:\n"
                                  "    blurb "
                                  "file\n\n"));
   GWEN_Buffer_AppendString(ubuf,
                             I18N("  adduser:\n"
                                  "    blurb "
                                  "file\n\n"));
   GWEN_Buffer_AppendString(ubuf,
                             I18N("  addaccount:\n"
                                  "    blurb "
                                  "file\n\n"));
   GWEN_Buffer_AppendString(ubuf,
                             I18N("  setsecret:\n"
                                  "    blurb "
                                  "file\n\n"));

    fprintf(stdout, "%s\n", GWEN_Buffer_GetStart(ubuf));
    GWEN_Buffer_free(ubuf);
    return 0;
  }
  if (rv) {
    argc-=rv-1;
    argv+=rv-1;
  }

  cmd=GWEN_DB_GetCharValue(db, "params", 0, 0);
  if (!cmd) {
    fprintf(stderr, "ERROR: Command needed.\n");
    return 1;
  }

  gui=GWEN_Gui_CGui_new();
  s=GWEN_DB_GetCharValue(db, "charset", 0, "ISO-8859-15");
  GWEN_Gui_SetCharSet(gui, s);
  nonInteractive=GWEN_DB_GetIntValue(db, "nonInteractive", 0, 0);
  if (nonInteractive)
    GWEN_Gui_AddFlags(gui, GWEN_GUI_FLAGS_NONINTERACTIVE);
  else
    GWEN_Gui_SubFlags(gui, GWEN_GUI_FLAGS_NONINTERACTIVE);
  pinFile=GWEN_DB_GetCharValue(db, "pinFile", 0, NULL);
  if (pinFile) {
    GWEN_DB_NODE *dbPins;

    dbPins=GWEN_DB_Group_new("pins");
    if (GWEN_DB_ReadFile(dbPins, pinFile,
			 GWEN_DB_FLAGS_DEFAULT |
			 GWEN_PATH_FLAGS_CREATE_GROUP)) {
      fprintf(stderr, "Error reading pinfile \"%s\"\n", pinFile);
      return 2;
    }
    /* set argument "persistent" to one in non-interactive mode */
    GWEN_Gui_CGui_SetPasswordDb(gui, dbPins, nonInteractive);
  }
  GWEN_Gui_SetGui(gui);

  ab=AB_Banking_new("aqpaypal-tool",
		    GWEN_DB_GetCharValue(db, "cfgfile", 0, 0),
		    0);
  AB_Gui_Extend(gui, ab);

  if (strcasecmp(cmd, "listusers")==0) {
    rv=listUsers(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "listaccounts")==0) {
    rv=listAccounts(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "adduser")==0) {
    rv=addUser(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "addaccount")==0) {
    rv=addAccount(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "setsecrets")==0) {
    rv=setSecrets(ab, db, argc, argv);
  }
  else {
    fprintf(stderr, "ERROR: Unknown command \"%s\".\n", cmd);
    rv=1;
  }

  return rv;
}
Esempio n. 4
0
int main(int argc, char **argv) {
  GWEN_DB_NODE *db;
  const char *cmd;
  int rv;
  AB_BANKING *ab;
  GWEN_GUI *gui;
  int nonInteractive=0;
  int acceptValidCerts=0;
  const char *pinFile;
  const char *cfgDir;
  const char *s;
  const GWEN_ARGS args[]={
  {
    GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
    GWEN_ArgsType_Char,           /* type */
    "cfgdir",                     /* name */
    0,                            /* minnum */
    1,                            /* maxnum */
    "D",                          /* short option */
    "cfgdir",                     /* long option */
    I18S("Specify the configuration folder"),
    I18S("Specify the configuration folder")
  },
  {
    0,                            /* flags */
    GWEN_ArgsType_Int,            /* type */
    "nonInteractive",             /* name */
    0,                            /* minnum */
    1,                            /* maxnum */
    "n",                          /* short option */
    "noninteractive",             /* long option */
    "Select non-interactive mode",/* short description */
    "Select non-interactive mode.\n"        /* long description */
    "This automatically returns a confirmative answer to any non-critical\n"
    "message."
  },
  {
    0,                            /* flags */
    GWEN_ArgsType_Int,            /* type */
    "acceptValidCerts",           /* name */
    0,                            /* minnum */
    1,                            /* maxnum */
    "A",                          /* short option */
    "acceptvalidcerts",           /* long option */
    "Automatically accept all valid TLS certificate",
    "Automatically accept all valid TLS certificate"
  },
  {
    GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
    GWEN_ArgsType_Char,           /* type */
    "charset",                    /* name */
    0,                            /* minnum */
    1,                            /* maxnum */
    0,                            /* short option */
    "charset",                    /* long option */
    "Specify the output character set",       /* short description */
    "Specify the output character set"        /* long description */
  },
  {
    GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
    GWEN_ArgsType_Char,           /* type */
    "pinfile",                    /* name */
    0,                            /* minnum */
    1,                            /* maxnum */
    "P",                          /* short option */
    "pinfile",                    /* long option */
    "Specify the PIN file",       /* short description */
    "Specify the PIN file"        /* long description */
  },
  {
    GWEN_ARGS_FLAGS_HELP | GWEN_ARGS_FLAGS_LAST, /* flags */
    GWEN_ArgsType_Int,            /* type */
    "help",                       /* name */
    0,                            /* minnum */
    0,                            /* maxnum */
    "h",                          /* short option */
    "help",
    I18S("Show this help screen. For help on commands, "
	 "run aqbanking-cli <COMMAND> --help."),
    I18S("Show this help screen. For help on commands, run aqbanking-cli <COMMAND> --help.")
  }
  };

  rv=GWEN_Init();
  if (rv) {
    fprintf(stderr, "ERROR: Unable to init Gwen.\n");
    exit(2);
  }

  GWEN_Logger_Open(0, "aqbanking-cli", 0,
		   GWEN_LoggerType_Console,
		   GWEN_LoggerFacility_User);
  GWEN_Logger_SetLevel(0, GWEN_LoggerLevel_Warning);

  rv=GWEN_I18N_BindTextDomain_Dir(PACKAGE, LOCALEDIR);
  if (rv) {
    DBG_ERROR(0, "Could not bind textdomain (%d)", rv);
  }
  else {
    rv=GWEN_I18N_BindTextDomain_Codeset(PACKAGE, "UTF-8");
    if (rv) {
      DBG_ERROR(0, "Could not set codeset (%d)", rv);
    }
  }

  db=GWEN_DB_Group_new("arguments");
  rv=GWEN_Args_Check(argc, argv, 1,
		     GWEN_ARGS_MODE_ALLOW_FREEPARAM |
		     GWEN_ARGS_MODE_STOP_AT_FREEPARAM,
		     args,
		     db);
  if (rv==GWEN_ARGS_RESULT_ERROR) {
    fprintf(stderr, "ERROR: Could not parse arguments main\n");
    GWEN_DB_Group_free(db);
    return 1;
  }
  else if (rv==GWEN_ARGS_RESULT_HELP) {
    GWEN_BUFFER *ubuf;

    ubuf=GWEN_Buffer_new(0, 1024, 0, 1);
    GWEN_Buffer_AppendString(ubuf, I18N("This is version "));
    GWEN_Buffer_AppendString(ubuf, AQHBCI_VERSION_STRING "\n");
    GWEN_Buffer_AppendString(ubuf,
                             I18N("Usage: "));
    GWEN_Buffer_AppendString(ubuf, argv[0]);
    GWEN_Buffer_AppendString(ubuf,
                             I18N(" [GLOBAL OPTIONS] COMMAND "
                                  "[LOCAL OPTIONS]\n"));
    GWEN_Buffer_AppendString(ubuf,
                             I18N("\nGlobal Options:\n"));
    if (GWEN_Args_Usage(args, ubuf, GWEN_ArgsOutType_Txt)) {
      fprintf(stderr, "ERROR: Could not create help string\n");
      GWEN_DB_Group_free(db);
      return 1;
    }
    GWEN_Buffer_AppendString(ubuf,
                             I18N("\nCommands:\n"));
    cmdAddHelpStr(ubuf, "senddtazv",
                  I18N("Sends a DTAZV file to the bank"));

    cmdAddHelpStr(ubuf, "listaccs",
                  I18N("Prints the list of accounts"));

    cmdAddHelpStr(ubuf, "listbal",
                  I18N("Export balances from a context file."));

    cmdAddHelpStr(ubuf, "listtrans",
                  I18N("Export transactions from a context file."));

    cmdAddHelpStr(ubuf, "listtransfers",
                  I18N("Export transactions from a context file which match certain status."));

    cmdAddHelpStr(ubuf, "request",
                  I18N("Requests transactions, balances, standing orders etc."));

    cmdAddHelpStr(ubuf, "chkacc",
                  I18N("Check a combination of bank id and account number"));

    cmdAddHelpStr(ubuf, "chkiban",
                  I18N("Check an IBAN"));

    cmdAddHelpStr(ubuf, "import",
                  I18N("Import a file into an import context file"));

    cmdAddHelpStr(ubuf, "transfer",
                  I18N("Issue a single transfer (data from command line)"));

    cmdAddHelpStr(ubuf, "transfers",
                  I18N("Issue a number of transfers (data from a file)"));

    cmdAddHelpStr(ubuf, "sepatransfer",
                  I18N("Issue a single SEPA transfer (data from command line)"));

    cmdAddHelpStr(ubuf, "sepatransfers",
                  I18N("Issue a number of SEPA transfers (data from a file)"));

    cmdAddHelpStr(ubuf, "debitnote",
                  I18N("Issue a single debit note (data from command line)"));

    cmdAddHelpStr(ubuf, "debitnotes",
                  I18N("Issue a number of debit notes (data from a file)"));

    cmdAddHelpStr(ubuf, "sepadebitnote",
                  I18N("Issue a single SEPA debit note (data from command line)"));

    cmdAddHelpStr(ubuf, "sepaflashdebitnote",
                  I18N("Issue a single flash SEPA debit note COR1 (data from command line)"));

    cmdAddHelpStr(ubuf, "sepadebitnotes",
                  I18N("Issue a number of SEPA debit notes (data from a file)"));

    cmdAddHelpStr(ubuf, "addtrans",
                  I18N("Add a transfer to an existing import context file"));

    cmdAddHelpStr(ubuf, "addsepadebitnote",
                  I18N("Add a SEPA debit note to an existing import context file"));

    cmdAddHelpStr(ubuf, "sepasto",
                  I18N("Manage SEPA standing orders"));

    cmdAddHelpStr(ubuf, "fillgaps",
                  I18N("Fill gaps in an import context file from configuration settings"));

    cmdAddHelpStr(ubuf, "updateconf",
                  I18N("Update configuration from previous AqBanking versions"));

    cmdAddHelpStr(ubuf, "listprofiles",
                  I18N("Print existing profiles"));

    cmdAddHelpStr(ubuf, "versions",
                  I18N("Print the program and library versions"));

    GWEN_Buffer_AppendString(ubuf, "\n");

    fprintf(stderr, "%s\n", GWEN_Buffer_GetStart(ubuf));
    GWEN_Buffer_free(ubuf);
    GWEN_DB_Group_free(db);
    return 0;
  }
  if (rv) {
    argc-=rv-1;
    argv+=rv-1;
  }

  nonInteractive=GWEN_DB_GetIntValue(db, "nonInteractive", 0, 0);
  acceptValidCerts=GWEN_DB_GetIntValue(db, "acceptValidCerts", 0, 0);
  cfgDir=GWEN_DB_GetCharValue(db, "cfgdir", 0, 0);

  cmd=GWEN_DB_GetCharValue(db, "params", 0, 0);
  if (!cmd) {
    fprintf(stderr, "ERROR: Command needed.\n");
    GWEN_DB_Group_free(db);
    return 1;
  }

  gui=GWEN_Gui_CGui_new();
  s=GWEN_DB_GetCharValue(db, "charset", 0, NULL);
  if (s && *s)
    GWEN_Gui_SetCharSet(gui, s);

  if (nonInteractive)
    GWEN_Gui_AddFlags(gui, GWEN_GUI_FLAGS_NONINTERACTIVE);
  else
    GWEN_Gui_SubFlags(gui, GWEN_GUI_FLAGS_NONINTERACTIVE);

  if (acceptValidCerts)
    GWEN_Gui_AddFlags(gui, GWEN_GUI_FLAGS_ACCEPTVALIDCERTS);
  else
    GWEN_Gui_SubFlags(gui, GWEN_GUI_FLAGS_ACCEPTVALIDCERTS);

  pinFile=GWEN_DB_GetCharValue(db, "pinFile", 0, NULL);
  if (pinFile) {
    GWEN_DB_NODE *dbPins;

    dbPins=GWEN_DB_Group_new("pins");
    if (GWEN_DB_ReadFile(dbPins, pinFile,
			 GWEN_DB_FLAGS_DEFAULT |
			 GWEN_PATH_FLAGS_CREATE_GROUP)) {
      fprintf(stderr, "Error reading pinfile \"%s\"\n", pinFile);
      GWEN_DB_Group_free(dbPins);
      GWEN_DB_Group_free(db);
      return 2;
    }
    GWEN_Gui_SetPasswordDb(gui, dbPins, 1);
  }
				    
  GWEN_Gui_SetGui(gui);

  ab=AB_Banking_new("aqbanking-cli", cfgDir, 0);
  AB_Gui_Extend(gui, ab);

  if (strcasecmp(cmd, "senddtazv")==0) {
    rv=sendDtazv(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "listaccs")==0) {
    rv=listAccs(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "listbal")==0) {
    rv=listBal(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "listtrans")==0) {
    rv=listTrans(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "listtransfers")==0) {
    rv=listTransfers(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "request")==0) {
    rv=request(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "chkacc")==0) {
    rv=chkAcc(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "chkiban")==0) {
    rv=chkIban(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "import")==0) {
    rv=import(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "transfer")==0) {
    rv=transfer(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "transfers")==0) {
    rv=transfers(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "sepatransfer")==0) {
    rv=sepaTransfer(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "sepatransfers")==0) {
    rv=sepaMultiJobs(ab, db, argc, argv, AQBANKING_TOOL_SEPA_TRANSFERS);
  }
  else if (strcasecmp(cmd, "debitnote")==0) {
    rv=debitNote(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "debitnotes")==0) {
    rv=debitNotes(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "sepadebitnote")==0) {
    rv=sepaDebitNote(ab, db, argc, argv, 0);
  }
  else if (strcasecmp(cmd, "sepaFlashDebitNote")==0) {
    rv=sepaDebitNote(ab, db, argc, argv, 1);
  }
  else if (strcasecmp(cmd, "sepadebitnotes")==0) {
    rv=sepaMultiJobs(ab, db, argc, argv, AQBANKING_TOOL_SEPA_DEBITNOTES);
  }
  else if (strcasecmp(cmd, "addtrans")==0) {
    rv=addTransaction(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "addsepadebitnote")==0) {
    rv=addSepaDebitNote(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "sepasto")==0) {
    rv=sepaRecurTransfer(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "fillgaps")==0) {
    rv=fillGaps(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "updateconf")==0) {
    rv=updateConf(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "listprofiles")==0) {
    rv=listProfiles(ab, db, argc, argv);
  }
  else if (strcasecmp(cmd, "versions")==0) {
    rv=versions(ab, db, argc, argv);
  }
  else {
    fprintf(stderr, "ERROR: Unknown command \"%s\".\n", cmd);
    rv=1;
  }

  GWEN_DB_Group_free(db);
  return rv;
}