File indexing completed on 2024-06-09 05:02:29

0001 /*
0002     SPDX-FileCopyrightText: 2018 Martin Preuss <martin@libchipcard.de>
0003     SPDX-FileCopyrightText: 2004-2019 Thomas Baumgart <tbaumgart@kde.org>
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 /** @file
0008  * @short A C++ wrapper of the main aqbanking interface
0009  */
0010 
0011 // krazy:excludeall=license
0012 
0013 #ifndef AQ_BANKING_CPP_H
0014 #define AQ_BANKING_CPP_H
0015 
0016 
0017 #include <aqbanking/banking.h>
0018 #include <aqbanking/system.h>
0019 
0020 #include <list>
0021 #include <string>
0022 
0023 /**
0024  * @brief A C++ binding for the C module @ref AB_BANKING
0025  *
0026  * This class simply is a C++ binding for the C module @ref AB_BANKING.
0027  * It redirects C callbacks used by AB_BANKING to virtual functions in
0028  * this class. It also transforms some return values inconvenient for
0029  * C++ into STL objects (such as "list<T>").
0030  *
0031  * @ingroup G_AB_CPP_INTERFACE
0032  *
0033  * @author Martin Preuss<martin@aquamaniac.de>
0034  */
0035 class AB_Banking
0036 {
0037 private:
0038   AB_BANKING *_banking;
0039 
0040 public:
0041   AB_Banking(const char *appname,
0042              const char *fname);
0043   virtual ~AB_Banking();
0044 
0045 
0046   AB_BANKING *getCInterface();
0047 
0048 
0049   /**
0050    * See @ref AB_Banking_Init
0051    */
0052   virtual int init();
0053 
0054   /**
0055    * See @ref AB_Banking_Fini
0056    */
0057   virtual int fini();
0058 
0059   /**
0060    * Returns the application name as given to @ref AB_Banking_new.
0061    */
0062   const char *getAppName();
0063 
0064   /**
0065    * Returns a list of pointers to currently known accounts.
0066    * Please note that the pointers in this list are still owned by
0067    * AqBanking, so you MUST NOT free them.
0068    * However, destroying the list will not free the accounts, so it is
0069    * safe to do that.
0070    */
0071   std::list<AB_ACCOUNT_SPEC*> getAccounts();
0072 
0073   /**
0074    * This function does an account lookup based on the given unique id.
0075    * This id is assigned by AqBanking when an account is created.
0076    * The pointer returned is still owned by AqBanking, so you MUST NOT free
0077    * it.
0078    */
0079   AB_ACCOUNT_SPEC *getAccount(uint32_t uniqueId);
0080 
0081   std::list<std::string> getActiveProviders();
0082 
0083   int getUserDataDir(GWEN_BUFFER *buf) const ;
0084 
0085   void setAccountAlias(AB_ACCOUNT_SPEC *a, const char *alias);
0086 
0087   /**
0088    * Provide interface to setup ZKA FinTS registration
0089    */
0090   void registerFinTs(const char* regKey, const char* version) const;
0091 
0092   /** @name Enqueueing, Dequeueing and Executing Jobs
0093    *
0094    * Enqueued jobs are preserved across shutdowns. As soon as a job has been
0095    * sent to the appropriate backend it will be removed from the queue.
0096    * Only those jobs are saved/reloaded which have been enqueued but never
0097    * presented to the backend. This means after calling
0098    * @ref AB_Banking_ExecuteQueue only those jobs are still in the queue which
0099    * have not been processed (e.g. because they belonged to a second backend
0100    * but the user aborted while the jobs for a first backend were in process).
0101    */
0102   /*@{*/
0103   /**
0104    * This function sends all jobs in the list to their corresponding backends
0105    * and allows that backend to process it.
0106    */
0107   virtual int executeJobs(AB_TRANSACTION_LIST2 *jl,
0108                           AB_IMEXPORTER_CONTEXT *ctx);
0109 
0110   /*@}*/
0111 
0112   /**
0113    * Let the application import a given statement context.
0114    */
0115   virtual bool importContext(AB_IMEXPORTER_CONTEXT *ctx,
0116                              uint32_t flags);
0117 
0118   virtual bool importAccountInfo(AB_IMEXPORTER_CONTEXT *ctx, AB_IMEXPORTER_ACCOUNTINFO *ai, uint32_t flags);
0119 };
0120 
0121 #endif /* AQ_BANKING_CPP_H */
0122 
0123