/* --------------------------------------------------------------- FUNCTION */ int AH_Job_GetBalance_Exchange(AH_JOB *j, AB_JOB *bj, AH_JOB_EXCHANGE_MODE m, AB_IMEXPORTER_CONTEXT *ctx){ AH_JOB_GETBALANCE *aj; DBG_INFO(AQHBCI_LOGDOMAIN, "Exchanging (%d)", m); assert(j); aj=GWEN_INHERIT_GETDATA(AH_JOB, AH_JOB_GETBALANCE, j); assert(aj); if (AB_Job_GetType(bj)!=AB_Job_TypeGetBalance) { DBG_ERROR(AQHBCI_LOGDOMAIN, "Not a GetBalance job"); return GWEN_ERROR_INVALID; } switch(m) { case AH_Job_ExchangeModeParams: DBG_NOTICE(AQHBCI_LOGDOMAIN, "No params to exchange"); return 0; case AH_Job_ExchangeModeArgs: DBG_NOTICE(AQHBCI_LOGDOMAIN, "No arguments to exchange"); return 0; case AH_Job_ExchangeModeResults: return 0; default: DBG_NOTICE(AQHBCI_LOGDOMAIN, "Unsupported exchange mode"); return GWEN_ERROR_NOT_SUPPORTED; } /* switch */ }
/* --------------------------------------------------------------- FUNCTION */ int AH_Job_SepaStandingOrdersGet_Exchange(AH_JOB *j, AB_JOB *bj, AH_JOB_EXCHANGE_MODE m, AB_IMEXPORTER_CONTEXT *ctx){ DBG_INFO(AQHBCI_LOGDOMAIN, "Exchanging (%d)", m); assert(j); if (AB_Job_GetType(bj)!=AB_Job_TypeSepaGetStandingOrders) { DBG_ERROR(AQHBCI_LOGDOMAIN, "Not a GetStandingOrders job"); return GWEN_ERROR_INVALID; } switch(m) { case AH_Job_ExchangeModeParams: return 0; case AH_Job_ExchangeModeArgs: return 0; case AH_Job_ExchangeModeResults: return 0; default: DBG_NOTICE(AQHBCI_LOGDOMAIN, "Unsupported exchange mode"); return GWEN_ERROR_NOT_SUPPORTED; } /* switch */ }
void AB_AccountQueue_AddJob(AB_ACCOUNTQUEUE *aq, AB_JOB *j) { AB_JOBQUEUE *jq; jq=AB_AccountQueue_FindJobQueue(aq, AB_Job_GetType(j)); if (jq==NULL) { jq=AB_JobQueue_new(); AB_JobQueue_List_Add(jq, aq->jobQueueList); } AB_Job_List2_PushBack(AB_JobQueue_GetJobList(jq), j); }
void multijob_cb (gpointer element, gpointer user_data) { AB_JOB *job = element; GtkWidget *parent = user_data; if ((AB_Job_GetStatus (job) == AB_Job_StatusPending) || (AB_Job_GetStatus (job) == AB_Job_StatusError)) { /* There was some error in this job. */ if (AB_Job_GetType (job) == AB_Job_TypeDebitNote) { const AB_TRANSACTION *h_trans = AB_JobSingleDebitNote_GetTransaction (job); gchar *descr_name = gnc_hbci_descr_tognc (h_trans); gchar *value = gnc_AB_VALUE_toReadableString (AB_Transaction_GetValue (h_trans)); gchar *errortext; errortext = g_strdup_printf(_("A debit note has been refused by the bank. The refused debit note has the following data:\n" "Remote bank code: \"%s\"\n" "Remote account number: \"%s\"\n" "Description and remote name: \"%s\"\n" "Value: \"%s\"\n"), AB_Transaction_GetRemoteBankCode (h_trans), AB_Transaction_GetRemoteAccountNumber (h_trans), descr_name, value); g_warning ("%s", errortext); gnc_error_dialog (parent, "%s", errortext); g_free (errortext); g_free (descr_name); } else { gnc_error_dialog (parent, "%s", _("One of the jobs was sent to the bank successfully, but the " "bank is refusing to execute the job. Please check " "the log window for the exact error message of the " "bank. The line with the error message contains a " "code number that is greater than 9000.\n" "\n" "The job has been removed from the queue.")); /* FIXME: Might make more useful user feedback here. */ } } }
int EBC_Provider_AddJob(AB_PROVIDER *pro, AB_JOB *j) { EBC_PROVIDER *dp; AB_ACCOUNT *a; AB_USER *u; EBC_USERQUEUE *uq; int doAdd=1; GWEN_DB_NODE *dbJob; assert(pro); dp=GWEN_INHERIT_GETDATA(AB_PROVIDER, EBC_PROVIDER, pro); assert(dp); a=AB_Job_GetAccount(j); assert(a); u=AB_Account_GetFirstUser(a); if (u==NULL) { DBG_ERROR(AQEBICS_LOGDOMAIN, "No user assigned to account."); GWEN_Gui_ProgressLog(0, GWEN_LoggerLevel_Error, I18N("No user assigned to account.")); GWEN_Gui_ShowError(I18N("Setup Error"), I18N("No user assigned to this account. Please assign one in the online banking setup dialog " "for this account.\n")); return GWEN_ERROR_INTERNAL; } dbJob=AB_Job_GetProviderData(j, pro); assert(dbJob); switch(AB_Job_GetType(j)) { case AB_Job_TypeGetTransactions: case AB_Job_TypeTransfer: case AB_Job_TypeDebitNote: break; case AB_Job_TypeGetBalance: default: DBG_INFO(AQEBICS_LOGDOMAIN, "Job not yet supported (%d)", AB_Job_GetType(j)); return GWEN_ERROR_NOT_SUPPORTED; } /* switch */ uq=EBC_Queue_GetUserQueue(dp->queue, u); assert(uq); if (AB_Job_GetType(j)==AB_Job_TypeGetTransactions) { AB_JOB *firstJob; firstJob=EBC_Queue_FindFirstJobLikeThis(dp->queue, u, j); if (firstJob) { GWEN_DB_NODE *dbCurrJob; /* this job is just a copy of the firstJob, reference it */ dbCurrJob=AB_Job_GetProviderData(j, pro); assert(dbCurrJob); GWEN_DB_SetIntValue(dbCurrJob, GWEN_DB_FLAGS_OVERWRITE_VARS, "refJob", AB_Job_GetJobId(firstJob)); /* don't add to queues */ doAdd=0; } } if (doAdd) { /* only add to queue if needed */ EBC_UserQueue_AddJob(uq, j); } /* always add to linear list */ AB_Job_List2_PushBack(dp->bankingJobs, j); return 0; }
int EBC_Provider_UpdateJob(AB_PROVIDER *pro, AB_JOB *j) { EBC_PROVIDER *dp; AB_ACCOUNT *a; AB_USER *u; assert(pro); dp=GWEN_INHERIT_GETDATA(AB_PROVIDER, EBC_PROVIDER, pro); assert(dp); a=AB_Job_GetAccount(j); assert(a); u=AB_Account_GetFirstUser(a); if (u==NULL) { DBG_ERROR(AQEBICS_LOGDOMAIN, "No user assigned to this account."); GWEN_Gui_ProgressLog(0, GWEN_LoggerLevel_Error, I18N("No user assigned to this account.")); GWEN_Gui_ShowError(I18N("Setup Error"), I18N("No user assigned to this account. Please assign one in the online banking setup dialog " "for this account.\n")); return GWEN_ERROR_INTERNAL; } switch(AB_Job_GetType(j)) { case AB_Job_TypeTransfer: { AB_TRANSACTION_LIMITS *lim; lim=AB_TransactionLimits_new(); AB_TransactionLimits_SetMaxLenPurpose(lim, 27); AB_TransactionLimits_SetMaxLenRemoteName(lim, 27); AB_TransactionLimits_SetMaxLinesRemoteName(lim, 1); AB_TransactionLimits_SetMaxLinesPurpose(lim, 2); AB_TransactionLimits_AddValuesTextKey(lim, "51", 0); AB_Job_SetFieldLimits(j, lim); AB_TransactionLimits_free(lim); break; } case AB_Job_TypeDebitNote: { AB_TRANSACTION_LIMITS *lim; lim=AB_TransactionLimits_new(); AB_TransactionLimits_SetMaxLenPurpose(lim, 27); AB_TransactionLimits_SetMaxLenRemoteName(lim, 27); AB_TransactionLimits_SetMaxLinesRemoteName(lim, 1); AB_TransactionLimits_SetMaxLinesPurpose(lim, 2); AB_TransactionLimits_AddValuesTextKey(lim, "05", 0); AB_Job_SetFieldLimits(j, lim); AB_TransactionLimits_free(lim); break; } case AB_Job_TypeGetTransactions: break; case AB_Job_TypeGetBalance: default: DBG_INFO(AQEBICS_LOGDOMAIN, "Job not yet supported (%d)", AB_Job_GetType(j)); return GWEN_ERROR_NOT_SUPPORTED; } /* switch */ return 0; }
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); }
/** Return the HBCI return code of the given 'job', or zero if none was * found. If 'verbose' is TRUE, make a lot of debugging messages about * this outboxjob. */ static int gnc_hbci_debug_outboxjob (GNCInteractor *inter, AB_JOB *job, gboolean verbose) { int cause = 0; AB_JOB_STATUS jobstatus; g_assert (job); if (verbose) { g_warning("gnc_hbci_debug_outboxjob: Job status: %s", AB_Job_Status2Char(AB_Job_GetStatus(job))); g_warning(", result: %s", AB_Job_GetResultText(job) ? AB_Job_GetResultText(job) : "(none)"); g_warning("\n"); } jobstatus = AB_Job_GetStatus (job); if (jobstatus == AB_Job_StatusError) { if (AB_Job_GetResultText (job)) { /* Add the "result text" to the log window */ char *logstring = g_strdup_printf("Job %s had an error: %s\n", AB_Job_Type2Char(AB_Job_GetType(job)), AB_Job_GetResultText(job)); GNCInteractor_add_log_text (inter, logstring); g_free (logstring); } if (!verbose) g_warning("gnc_hbci_debug_outboxjob: Job %s had an error: %s\n", AB_Job_Type2Char(AB_Job_GetType(job)), AB_Job_GetResultText(job) ? AB_Job_GetResultText(job) : "(none)"); cause = 9000; } else { cause = 0; } #if 0 /* hbci debugging code; might be adapted to aqbanking at a later point in time */ list = AB_JOB_resultCodes (job); if (list_int_size (list) > 0) { cause = get_resultcode_error (list); if (verbose) { g_warning("OutboxJob resultcodes: "); print_list_int (list); switch (cause) { case 9310: msg = "Schluessel noch nicht hinterlegt"; break; case 9320: msg = "Schluessel noch nicht freigeschaltet"; break; case 9330: msg = "Schluessel gesperrt"; break; case 9340: msg = "Schluessel falsch"; break; default: msg = "Unknown"; } g_warning("Probable cause of error was: code %d, msg: %s\n", cause, msg); } } else { if (verbose) g_warning("OutboxJob's resultCodes list has zero length.\n"); } list_int_delete (list); #endif return cause; }
/* --------------------------------------------------------------- FUNCTION */ int AH_Job_GetTransactions_Exchange(AH_JOB *j, AB_JOB *bj, AH_JOB_EXCHANGE_MODE m, AB_IMEXPORTER_CONTEXT *ctx){ AH_JOB_GETTRANSACTIONS *aj; DBG_INFO(AQHBCI_LOGDOMAIN, "Exchanging (%d)", m); assert(j); aj=GWEN_INHERIT_GETDATA(AH_JOB, AH_JOB_GETTRANSACTIONS, j); assert(aj); if (AB_Job_GetType(bj)!=AB_Job_TypeGetTransactions) { DBG_ERROR(AQHBCI_LOGDOMAIN, "Not a GetTransactions job"); return GWEN_ERROR_INVALID; } switch(m) { case AH_Job_ExchangeModeParams: { GWEN_DB_NODE *dbParams; dbParams=AH_Job_GetParams(j); AB_JobGetTransactions_SetMaxStoreDays(bj, GWEN_DB_GetIntValue(dbParams, "storeDays", 0, 0) ); return 0; } case AH_Job_ExchangeModeArgs: { const GWEN_TIME *ti; ti=AB_JobGetTransactions_GetFromTime(bj); if (ti) { int year, month, day; char dbuf[16]; GWEN_DB_NODE *dbArgs; dbArgs=AH_Job_GetArguments(j); if (GWEN_Time_GetBrokenDownDate(ti, &day, &month, &year)) { DBG_ERROR(AQHBCI_LOGDOMAIN, "Internal error: bad fromTime"); return GWEN_ERROR_INVALID; } snprintf(dbuf, sizeof(dbuf), "%04d%02d%02d", year, month+1, day); GWEN_DB_SetCharValue(dbArgs, GWEN_DB_FLAGS_OVERWRITE_VARS, "fromDate", dbuf); } ti=AB_JobGetTransactions_GetToTime(bj); if (ti) { int year, month, day; char dbuf[16]; GWEN_DB_NODE *dbArgs; dbArgs=AH_Job_GetArguments(j); if (GWEN_Time_GetBrokenDownDate(ti, &day, &month, &year)) { DBG_ERROR(AQHBCI_LOGDOMAIN, "Internal error: bad toTime"); return GWEN_ERROR_INVALID; } snprintf(dbuf, sizeof(dbuf), "%04d%02d%02d", year, month+1, day); GWEN_DB_SetCharValue(dbArgs, GWEN_DB_FLAGS_OVERWRITE_VARS, "toDate", dbuf); } return 0; } case AH_Job_ExchangeModeResults: return 0; default: DBG_NOTICE(AQHBCI_LOGDOMAIN, "Unsupported exchange mode"); return GWEN_ERROR_NOT_SUPPORTED; } /* switch */ }