void AB_ImExporterAccountInfo_FillFromAccount(AB_IMEXPORTER_ACCOUNTINFO *iea, const AB_ACCOUNT *a) { const char *s; AB_ACCOUNT_TYPE at; assert(iea); assert(a); s=AB_Account_GetBankCode(a); AB_ImExporterAccountInfo_SetBankCode(iea, s); s=AB_Account_GetBankName(a); AB_ImExporterAccountInfo_SetBankName(iea, s); s=AB_Account_GetAccountNumber(a); AB_ImExporterAccountInfo_SetAccountNumber(iea, s); s=AB_Account_GetAccountName(a); AB_ImExporterAccountInfo_SetAccountName(iea, s); s=AB_Account_GetIBAN(a); AB_ImExporterAccountInfo_SetIban(iea, s); s=AB_Account_GetBIC(a); AB_ImExporterAccountInfo_SetBic(iea, s); s=AB_Account_GetCurrency(a); AB_ImExporterAccountInfo_SetCurrency(iea, s); s=AB_Account_GetOwnerName(a); AB_ImExporterAccountInfo_SetOwner(iea, s); at=AB_Account_GetAccountType(a); AB_ImExporterAccountInfo_SetType(iea, at); }
int AB_Provider_AccountToAccountSpec(AB_PROVIDER *pro, const AB_ACCOUNT *acc, AB_ACCOUNT_SPEC *as, int doLock) { int rv; assert(acc); assert(as); AB_AccountSpec_SetType(as, AB_Account_GetAccountType(acc)); AB_AccountSpec_SetUniqueId(as, AB_Account_GetUniqueId(acc)); AB_AccountSpec_SetBackendName(as, AB_Account_GetBackendName(acc)); AB_AccountSpec_SetOwnerName(as, AB_Account_GetOwnerName(acc)); AB_AccountSpec_SetAccountName(as, AB_Account_GetAccountName(acc)); AB_AccountSpec_SetCurrency(as, AB_Account_GetCurrency(acc)); AB_AccountSpec_SetIban(as, AB_Account_GetIban(acc)); AB_AccountSpec_SetBic(as, AB_Account_GetBic(acc)); AB_AccountSpec_SetCountry(as, AB_Account_GetCountry(acc)); AB_AccountSpec_SetBankCode(as, AB_Account_GetBankCode(acc)); AB_AccountSpec_SetAccountNumber(as, AB_Account_GetAccountNumber(acc)); AB_AccountSpec_SetSubAccountNumber(as, AB_Account_GetSubAccountId(acc)); rv=AB_Provider_UpdateAccountSpec(pro, as, doLock); if (rv<0 && rv!=GWEN_ERROR_NOT_IMPLEMENTED) { DBG_INFO(AQBANKING_LOGDOMAIN, "here (%d)", rv); return rv; } return 0; }
static void createAccountListBoxString(const AB_ACCOUNT *a, GWEN_BUFFER *tbuf) { const char *s; char numbuf[32]; uint32_t uid; /* column 1 */ uid=AB_Account_GetUniqueId(a); snprintf(numbuf, sizeof(numbuf)-1, "%06d", uid); numbuf[sizeof(numbuf)-1]=0; GWEN_Buffer_AppendString(tbuf, numbuf); GWEN_Buffer_AppendString(tbuf, "\t"); /* column 2 */ s=AB_Account_GetBankCode(a); if (s && *s) GWEN_Buffer_AppendString(tbuf, s); GWEN_Buffer_AppendString(tbuf, "\t"); /* column 3 */ s=AB_Account_GetBankName(a); if (s && *s) GWEN_Buffer_AppendString(tbuf, s); GWEN_Buffer_AppendString(tbuf, "\t"); /* column 4 */ s=AB_Account_GetAccountNumber(a); if (s && *s) GWEN_Buffer_AppendString(tbuf, s); GWEN_Buffer_AppendString(tbuf, "\t"); /* column 5 */ s=AB_Account_GetAccountName(a); if (s && *s) GWEN_Buffer_AppendString(tbuf, s); GWEN_Buffer_AppendString(tbuf, "\t"); /* column 6 */ s=AB_Account_GetOwnerName(a); if (s && *s) GWEN_Buffer_AppendString(tbuf, s); GWEN_Buffer_AppendString(tbuf, "\t"); /* column 7 */ s=AB_Account_GetBackendName(a); if (s && *s) GWEN_Buffer_AppendString(tbuf, s); }
void KBAccountListViewItem::_populate() { QString tmp; int i; assert(_account); i = 0; // unique id setText(i++, QString::number(AB_Account_GetUniqueId(_account))); // bank code setText(i++, QString::fromUtf8(AB_Account_GetBankCode(_account))); // bank name tmp = AB_Account_GetBankName(_account); if (tmp.isEmpty()) tmp = i18nc("replacement for institution or account w/o name", "(unnamed)"); setText(i++, tmp); // account id setText(i++, QString::fromUtf8(AB_Account_GetAccountNumber(_account))); // account name tmp = QString::fromUtf8(AB_Account_GetAccountName(_account)); if (tmp.isEmpty()) tmp = i18nc("replacement for institution or account w/o name", "(unnamed)"); setText(i++, tmp); tmp = QString::fromUtf8(AB_Account_GetOwnerName(_account)); if (tmp.isEmpty()) tmp = ""; setText(i++, tmp); tmp = QString::fromUtf8(AB_Provider_GetName(AB_Account_GetProvider(_account))); if (tmp.isEmpty()) tmp = i18nc("replacement for institution or account w/o name", "(unnamed)"); setText(i++, tmp); }
static PyObject * aqbanking_listacc(PyObject *self, PyObject *args) { int rv; AB_ACCOUNT_LIST2 *accs; // List of accounts => to return. PyObject *accountList; aqbanking_Account *account; accountList = PyList_New(0); // Initialize aqbanking. rv = AB_create(NULL); if (rv > 0) { return NULL; } /* Get a list of accounts which are known to AqBanking. * There are some pecularities about the list returned: * The list itself is owned by the caller (who must call * AB_Account_List2_free() as we do below), but the elements of that * list (->the accounts) are still owned by AqBanking. * Therefore you MUST NOT free any of the accounts within the list returned. * This also rules out calling AB_Account_List2_freeAll() which not only * frees the list itself but also frees all its elements. * * The rest of this tutorial shows how lists are generally used by * AqBanking. */ accs = AB_Banking_GetAccounts(ab); if (accs) { AB_ACCOUNT_LIST2_ITERATOR *it; /* List2's are traversed using iterators. An iterator is an object * which points to a single element of a list. * If the list is empty NULL is returned. */ it=AB_Account_List2_First(accs); if (it) { AB_ACCOUNT *a; /* this function returns a pointer to the element of the list to * which the iterator currently points to */ a=AB_Account_List2Iterator_Data(it); while(a) { AB_PROVIDER *pro; account = (aqbanking_Account*) PyObject_CallObject((PyObject *) &aqbanking_AccountType, NULL); /* every account is assigned to a backend (sometimes called provider) * which actually performs online banking tasks. We get a pointer * to that provider/backend with this call to show its name in our * example.*/ pro = AB_Account_GetProvider(a); // Populate the object. account->no = PyUnicode_FromString(AB_Account_GetAccountNumber(a)); account->name = PyUnicode_FromString(AB_Account_GetAccountName(a)); account->description = PyUnicode_FromString(AB_Provider_GetName(pro)); account->bank_code = PyUnicode_FromString(AB_Account_GetBankCode(a)); account->bank_name = PyUnicode_FromString(AB_Account_GetBankName(a)); PyList_Append(accountList, (PyObject *)account); Py_DECREF(account); /* this function lets the iterator advance to the next element in * the list, so a following call to AB_Account_List2Iterator_Data() * would return a pointer to the next element. * This function also returns a pointer to the next element of the * list. If there is no next element then NULL is returned. */ a = AB_Account_List2Iterator_Next(it); } /* the iterator must be freed after using it */ AB_Account_List2Iterator_free(it); } /* as discussed the list itself is only a container which has to be freed * after use. This explicitly does not free any of the elements in that * list, and it shouldn't because AqBanking still is the owner of the * accounts */ AB_Account_List2_free(accs); } // Exit aqbanking. rv = AB_free(NULL); if (rv > 0) { Py_DECREF(account); Py_DECREF(accountList); return NULL; } return accountList; }
int main(int argc, char **argv) { AB_BANKING *ab; AB_ACCOUNT_LIST2 *accs; int rv; GWEN_GUI *gui; gui=GWEN_Gui_CGui_new(); GWEN_Gui_SetGui(gui); ab=AB_Banking_new("tutorial2", 0, 0); rv=AB_Banking_Init(ab); if (rv) { fprintf(stderr, "Error on init (%d)\n", rv); return 2; } rv=AB_Banking_OnlineInit(ab); if (rv) { fprintf(stderr, "Error on onlineinit (%d)\n", rv); return 2; } fprintf(stderr, "AqBanking successfully initialized.\n"); /* Get a list of accounts which are known to AqBanking. * There are some pecularities about the list returned: * The list itself is owned by the caller (who must call * AB_Account_List2_free() as we do below), but the elements of that * list (->the accounts) are still owned by AqBanking. * Therefore you MUST NOT free any of the accounts within the list returned. * This also rules out calling AB_Account_List2_freeAll() which not only * frees the list itself but also frees all its elements. * * The rest of this tutorial shows how lists are generally used by * AqBanking. */ accs=AB_Banking_GetAccounts(ab); if (accs) { AB_ACCOUNT_LIST2_ITERATOR *it; /* List2's are traversed using iterators. An iterator is an object * which points to a single element of a list. * If the list is empty NULL is returned. */ it=AB_Account_List2_First(accs); if (it) { AB_ACCOUNT *a; /* this function returns a pointer to the element of the list to * which the iterator currently points to */ a=AB_Account_List2Iterator_Data(it); while(a) { AB_PROVIDER *pro; /* every account is assigned to a backend (sometimes called provider) * which actually performs online banking tasks. We get a pointer * to that provider/backend with this call to show its name in our * example.*/ pro=AB_Account_GetProvider(a); fprintf(stderr, "Account: %s (%s) %s (%s) [%s]\n", AB_Account_GetBankCode(a), AB_Account_GetBankName(a), AB_Account_GetAccountNumber(a), AB_Account_GetAccountName(a), /* the name of the provider/backend as decribed above */ AB_Provider_GetName(pro)); /* this function lets the iterator advance to the next element in * the list, so a following call to AB_Account_List2Iterator_Data() * would return a pointer to the next element. * This function also returns a pointer to the next element of the * list. If there is no next element then NULL is returned. */ a=AB_Account_List2Iterator_Next(it); } /* the iterator must be freed after using it */ AB_Account_List2Iterator_free(it); } /* as discussed the list itself is only a container which has to be freed * after use. This explicitly does not free any of the elements in that * list, and it shouldn't because AqBanking still is the owner of the * accounts */ AB_Account_List2_free(accs); } rv=AB_Banking_OnlineFini(ab); if (rv) { fprintf(stderr, "ERROR: Error on online deinit (%d)\n", rv); return 3; } rv=AB_Banking_Fini(ab); if (rv) { fprintf(stderr, "ERROR: Error on deinit (%d)\n", rv); return 3; } AB_Banking_free(ab); return 0; }
int AB_SetupDialog_DelAccount(GWEN_DIALOG *dlg) { AB_SETUP_DIALOG *xdlg; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SETUP_DIALOG, dlg); assert(xdlg); if (xdlg->currentAccountList) { uint32_t aid; aid=AB_SetupDialog_GetCurrentAccountId(dlg); if (aid) { AB_ACCOUNT *a; a=AB_Account_List_GetByUniqueId(xdlg->currentAccountList, aid); if (a) { int rv; char nbuf[512]; char ibuf[32]; const char *an; an=AB_Account_GetAccountName(a); if (!(an && *an)) an=AB_Account_GetAccountNumber(a); if (!(an && *an)) { snprintf(ibuf, sizeof(ibuf)-1, "%d", (int) AB_Account_GetUniqueId(a)); ibuf[sizeof(ibuf)-1]=0; an=ibuf; } snprintf(nbuf, sizeof(nbuf)-1, I18N("<html>" "<p>Do you really want to delete the account <i>%s</i>?" "</html>" "Do you really want to delete the account \"%s\"?"), an, an); nbuf[sizeof(nbuf)-1]=0; rv=GWEN_Gui_MessageBox(GWEN_GUI_MSG_FLAGS_TYPE_WARN | GWEN_GUI_MSG_FLAGS_SEVERITY_DANGEROUS, I18N("Delete Account"), nbuf, I18N("Yes"), I18N("No"), NULL, 0); if (rv!=1) { DBG_INFO(AQBANKING_LOGDOMAIN, "Aborted by user"); return GWEN_DialogEvent_ResultHandled; } rv=AB_Provider_DeleteAccount(AB_Account_GetProvider(a), aid); if (rv<0) { GWEN_Gui_ShowError(I18N("Error"), I18N("Error deleting account: %d"), rv); AB_SetupDialog_Reload(dlg); return GWEN_DialogEvent_ResultHandled; } AB_SetupDialog_Reload(dlg); } /* if a */ } /* if aid */ } /* if xdlg->currentAccountList */ return GWEN_DialogEvent_ResultHandled; }
void KBJobListViewItem::_populate() { QString tmp; int i; AB_ACCOUNT *a; const char *p; assert(_job); i = 0; a = AB_Job_GetAccount(_job); assert(a); // job id setText(i++, QString::number(AB_Job_GetJobId(_job))); // job type switch (AB_Job_GetType(_job)) { case AB_Job_TypeGetBalance: tmp = i18n("Get Balance"); break; case AB_Job_TypeGetTransactions: tmp = i18n("Get Transactions"); break; case AB_Job_TypeTransfer: tmp = i18n("Transfer"); break; case AB_Job_TypeDebitNote: tmp = i18n("Debit Note"); break; default: tmp = i18nc("Unknown job type", "(unknown)"); break; } setText(i++, tmp); // bank name tmp = AB_Account_GetBankName(a); if (tmp.isEmpty()) tmp = AB_Account_GetBankCode(a); if (tmp.isEmpty()) tmp = i18nc("Unknown bank code", "(unknown)"); setText(i++, tmp); // account name tmp = AB_Account_GetAccountName(a); if (tmp.isEmpty()) tmp = AB_Account_GetAccountNumber(a); if (tmp.isEmpty()) tmp = i18nc("Unknown account number", "(unknown)"); setText(i++, tmp); // status switch (AB_Job_GetStatus(_job)) { case AB_Job_StatusNew: tmp = i18nc("Status of the job", "new"); break; case AB_Job_StatusUpdated: tmp = i18nc("Status of the job", "updated"); break; case AB_Job_StatusEnqueued: tmp = i18nc("Status of the job", "enqueued"); break; case AB_Job_StatusSent: tmp = i18nc("Status of the job", "sent"); break; case AB_Job_StatusPending: tmp = i18nc("Status of the job", "pending"); break; case AB_Job_StatusFinished: tmp = i18nc("Status of the job", "finished"); break; case AB_Job_StatusError: tmp = i18nc("Status of the job", "error"); break; default: tmp = i18nc("Status of the job", "(unknown)"); break; } setText(i++, tmp); p = AB_Provider_GetName(AB_Account_GetProvider(a)); if (!p) tmp = i18nc("Unknown account provider", "(unknown)"); else tmp = p; setText(i++, tmp); p = AB_Job_GetCreatedBy(_job); if (!p) tmp = i18nc("Unknown creator of the job", "(unknown)"); else tmp = p; setText(i++, tmp); }