GnuCash  5.6-150-g038405b370+
gnc-ab-utils.h
Go to the documentation of this file.
1 /*
2  * gnc-ab-utils.h --
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of
7  * the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, contact:
16  *
17  * Free Software Foundation Voice: +1-617-542-5942
18  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
19  * Boston, MA 02110-1301, USA gnu@gnu.org
20  */
21 
33 #ifndef GNC_AB_UTILS_H
34 #define GNC_AB_UTILS_H
35 
36 #include <glib.h>
37 #include <gtk/gtk.h>
38 #include <aqbanking/banking.h>
39 #include <gwenhywfar/version.h>
40 
41 #include "Account.h"
42 
43 G_BEGIN_DECLS
44 
48 #define AQBANKING_VERSION_INT (10000 * AQBANKING_VERSION_MAJOR + 100 * AQBANKING_VERSION_MINOR + AQBANKING_VERSION_PATCHLEVEL)
49 
53 #define GWENHYWFAR_VERSION_INT (10000 * GWENHYWFAR_VERSION_MAJOR + 100 * GWENHYWFAR_VERSION_MINOR + GWENHYWFAR_VERSION_PATCHLEVEL)
54 
55 # define GNC_AB_ACCOUNT_SPEC AB_ACCOUNT_SPEC
56 # define GNC_AB_ACCOUNT_SPEC_LIST AB_ACCOUNT_SPEC_LIST
57 # define GNC_AB_JOB AB_TRANSACTION
58 # define GNC_AB_JOB_LIST2 AB_TRANSACTION_LIST2
59 # define GNC_AB_JOB_LIST2_ITERATOR AB_TRANSACTION_LIST2_ITERATOR
60 # define GNC_AB_JOB_STATUS AB_TRANSACTION_STATUS
61 # define GNC_GWEN_DATE GWEN_DATE
62 
63 #define GNC_PREFS_GROUP_AQBANKING "dialogs.import.hbci"
64 #define GNC_PREF_FORMAT_SWIFT940 "format-swift-mt940"
65 #define GNC_PREF_FORMAT_SWIFT942 "format-swift-mt942"
66 #define GNC_PREF_FORMAT_DTAUS "format-dtaus"
67 #define GNC_PREF_IMPORT_NOTED_TXNS "import-noted-transactions"
68 #define GNC_PREF_USE_TRANSACTION_TXT "use-ns-transaction-text"
69 #define GNC_PREF_VERBOSE_DEBUG "verbose-debug"
70 
71 typedef struct
72 {
73  char* name;
74  char* descr;
75 } AB_Node_Pair;
76 
77 typedef struct _GncABImExContextImport GncABImExContextImport;
78 
79 #define AWAIT_BALANCES 1 << 1
80 #define FOUND_BALANCES 1 << 2
81 #define IGNORE_BALANCES 1 << 3
82 #define AWAIT_TRANSACTIONS 1 << 4
83 #define FOUND_TRANSACTIONS 1 << 5
84 #define IGNORE_TRANSACTIONS 1 << 6
85 
90 void gnc_GWEN_Init (void);
91 
95 void gnc_GWEN_Fini (void);
96 
104 AB_BANKING *gnc_AB_BANKING_new (void);
105 
112 void gnc_AB_BANKING_delete (AB_BANKING *api);
113 
123 gint gnc_AB_BANKING_fini (AB_BANKING *api);
124 
134 GNC_AB_ACCOUNT_SPEC *gnc_ab_get_ab_account (const AB_BANKING *api, Account *gnc_acc);
135 
143 gchar *gnc_AB_VALUE_to_readable_string (const AB_VALUE *value);
144 
151 gchar *gnc_AB_JOB_to_readable_string (const GNC_AB_JOB *job);
152 
159 gchar *gnc_AB_JOB_ID_to_string (gulong job_id);
160 
169 gchar *gnc_ab_get_remote_name (const AB_TRANSACTION *ab_trans);
170 
179 gchar *gnc_ab_get_purpose (const AB_TRANSACTION *ab_trans, gboolean is_ofx);
180 
189 gchar *gnc_ab_description_to_gnc (const AB_TRANSACTION *ab_trans, gboolean is_ofx);
190 
199 gchar *gnc_ab_memo_to_gnc (const AB_TRANSACTION *ab_trans);
200 
209 Transaction *gnc_ab_trans_to_gnc (const AB_TRANSACTION *ab_trans, Account *gnc_acc);
210 
235 GncABImExContextImport *gnc_ab_import_context (AB_IMEXPORTER_CONTEXT *context,
236  guint awaiting,
237  gboolean execute_txns,
238  AB_BANKING *api,
239  GtkWidget *parent);
240 
248 guint gnc_ab_ieci_get_found (GncABImExContextImport *ieci);
249 
256 GNC_AB_JOB_LIST2 *gnc_ab_ieci_get_job_list (GncABImExContextImport *ieci);
257 
264 gboolean gnc_ab_ieci_run_matcher (GncABImExContextImport *ieci);
265 
266 
272 GWEN_DB_NODE *gnc_ab_get_permanent_certs (void);
273 
283 gchar* gnc_ab_create_online_id (const gchar *bankcode, const gchar *accountnumber);
284 
285 #if (AQBANKING_VERSION_INT >= 60400)
286 
292 GList*
293 gnc_ab_trans_templ_list_new_from_ref_accounts (GNC_AB_ACCOUNT_SPEC *ab_acc);
294 #endif
295 
300 GList* gnc_ab_imexporter_list (AB_BANKING* abi);
301 
308 GList* gnc_ab_imexporter_profile_list (AB_BANKING* abi,
309  const char* importer_name);
310 
311 G_END_DECLS
312 
316 #endif /* GNC_AB_UTILS_H */
gchar * gnc_ab_create_online_id(const gchar *bankcode, const gchar *accountnumber)
Creates an online ID from bank code and account number.
Definition: gnc-ab-utils.c:294
gchar * gnc_ab_get_remote_name(const AB_TRANSACTION *ab_trans)
Retrieve the merged "remote name" fields from a transaction.
Definition: gnc-ab-utils.c:349
GList * gnc_ab_imexporter_list(AB_BANKING *abi)
Retrieve the available AQBanking importers.
gchar * gnc_ab_get_purpose(const AB_TRANSACTION *ab_trans, gboolean is_ofx)
Retrieve the merged purpose fields from a transaction.
Definition: gnc-ab-utils.c:369
STRUCTS.
gchar * gnc_AB_VALUE_to_readable_string(const AB_VALUE *value)
Print the value of value with two decimal places and value&#39;s currency appended, or 0...
Definition: gnc-ab-utils.c:282
gchar * gnc_AB_JOB_ID_to_string(gulong job_id)
Return the job_id as string.
Definition: gnc-ab-utils.c:793
gchar * gnc_ab_memo_to_gnc(const AB_TRANSACTION *ab_trans)
Create the appropriate memo field for a GnuCash Split by the information given in the AB_TRANSACTION ...
Definition: gnc-ab-utils.c:439
gboolean gnc_ab_ieci_run_matcher(GncABImExContextImport *ieci)
Run the generic transaction matcher dialog.
GNC_AB_JOB_LIST2 * gnc_ab_ieci_get_job_list(GncABImExContextImport *ieci)
Extract the job list from data.
GWEN_DB_NODE * gnc_ab_get_permanent_certs(void)
get the GWEN_DB_NODE from AqBanking configuration files
gchar * gnc_ab_description_to_gnc(const AB_TRANSACTION *ab_trans, gboolean is_ofx)
Create the appropriate description field for a GnuCash Transaction by the information given in the AB...
Definition: gnc-ab-utils.c:424
Account handling public routines.
Transaction * gnc_ab_trans_to_gnc(const AB_TRANSACTION *ab_trans, Account *gnc_acc)
Create an unbalanced and dirty GnuCash transaction with a split to gnc_acc from the information avail...
Definition: gnc-ab-utils.c:497
gchar * gnc_AB_JOB_to_readable_string(const GNC_AB_JOB *job)
Return the job as string.
Definition: gnc-ab-utils.c:781
AB_BANKING * gnc_AB_BANKING_new(void)
If there is a cached AB_BANKING object, return it initialized.
Definition: gnc-ab-utils.c:162
GList * gnc_ab_imexporter_profile_list(AB_BANKING *abi, const char *importer_name)
Retrieve the available format templates for an AQBanking importer.
gint gnc_AB_BANKING_fini(AB_BANKING *api)
Finish the AB_BANKING api.
Definition: gnc-ab-utils.c:225
void gnc_AB_BANKING_delete(AB_BANKING *api)
Delete the AB_BANKING api.
Definition: gnc-ab-utils.c:206
void gnc_GWEN_Fini(void)
Finalize the gwenhywfar library.
Definition: gnc-ab-utils.c:147
GncABImExContextImport * gnc_ab_import_context(AB_IMEXPORTER_CONTEXT *context, guint awaiting, gboolean execute_txns, AB_BANKING *api, GtkWidget *parent)
Import balances and transactions found in a AB_IMEXPORTER_CONTEXT into GnuCash.
GNC_AB_ACCOUNT_SPEC * gnc_ab_get_ab_account(const AB_BANKING *api, Account *gnc_acc)
Get the corresponding AqBanking account to the GnuCash account gnc_acc.
Definition: gnc-ab-utils.c:248
void gnc_GWEN_Init(void)
Initialize the gwenhywfar library by calling GWEN_Init() and setting up gwenhywfar logging...
Definition: gnc-ab-utils.c:112
guint gnc_ab_ieci_get_found(GncABImExContextImport *ieci)
Extract awaiting from data.