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; }
/* --------------------------------------------------------------- FUNCTION */ AH_JOB *AH_AccountJob_new(const char *name, AB_USER *u, AB_ACCOUNT *account){ AH_ACCOUNTJOB *aj; AH_JOB *j; GWEN_DB_NODE *dbArgs; const char *s; int jobVersion=0; assert(name); assert(u); assert(account); if (!(AH_Account_GetFlags(account) & AH_BANK_FLAGS_KTV2)) { int maxVer=0; /* no account suffix, so we try to determine the highest usable * version of the job which still doesn't need the suffix */ if (strcasecmp(name, "JobGetTransactions")==0) maxVer=4; else if (strcasecmp(name, "JobGetBalance")==0) maxVer=4; else if (strcasecmp(name, "JobSingleTransfer")==0) maxVer=3; else if (strcasecmp(name, "JobSingleDebitNote")==0) maxVer=3; else if (strcasecmp(name, "JobInternalTransfer")==0 || strcasecmp(name, "JobLoadCellPhone")==0) /* this job needs a suffix, so if there is none you don't get it */ maxVer=-1; else if (strcasecmp(name, "JobGetDatedTransfers")==0) maxVer=1; else if (strcasecmp(name, "JobCreateDatedTransfer")==0) maxVer=2; else if (strcasecmp(name, "JobModifyDatedTransfer")==0) maxVer=2; else if (strcasecmp(name, "JobDeleteDatedTransfer")==0) maxVer=1; else if (strcasecmp(name, "JobCreateStandingOrder")==0) maxVer=2; else if (strcasecmp(name, "JobModifyStandingOrder")==0) maxVer=2; else if (strcasecmp(name, "JobDeleteStandingOrder")==0) maxVer=1; if (maxVer==-1) { DBG_ERROR(AQHBCI_LOGDOMAIN, "This job needs an account suffix, but your bank didn't provide one. " "Therefore this job is not supported with your account."); GWEN_Gui_ProgressLog(0, GWEN_LoggerLevel_Error, I18N("This job needs an account suffix, but your bank did not provide one. " "Therefore this job is not supported with your account.\n" "Setting a higher HBCI version in the user settings might fix " "the problem.")); return NULL; } if (maxVer>0) { jobVersion=AH_Job_GetMaxVersionUpUntil(name, u, maxVer); if (jobVersion<1) { DBG_ERROR(AQHBCI_LOGDOMAIN, "No job [%s] below version %d, falling back to 0", name, maxVer); GWEN_Gui_ProgressLog2(0, GWEN_LoggerLevel_Warning, "No version for job [%s] up to %d found, falling back to 0", name, maxVer); jobVersion=0; } else { DBG_INFO(AQHBCI_LOGDOMAIN, "Reducing version of job [%s] to %d", name, jobVersion); } } } j=AH_Job_new(name, u, AB_Account_GetAccountNumber(account), AB_Account_GetSubAccountId(account), jobVersion); if (!j) return 0; GWEN_NEW_OBJECT(AH_ACCOUNTJOB, aj); GWEN_INHERIT_SETDATA(AH_JOB, AH_ACCOUNTJOB, j, aj, AH_AccountJob_FreeData); aj->account=account; /* set some known arguments */ dbArgs=AH_Job_GetArguments(j); assert(dbArgs); s=AB_Account_GetAccountNumber(account); if (s && *s) GWEN_DB_SetCharValue(dbArgs, GWEN_DB_FLAGS_DEFAULT, "accountId", s); s=AB_Account_GetSubAccountId(account); if (s && *s) GWEN_DB_SetCharValue(dbArgs, GWEN_DB_FLAGS_DEFAULT, "accountSubId", s); s=AB_Account_GetBankCode(account); if (s && *s) GWEN_DB_SetCharValue(dbArgs, GWEN_DB_FLAGS_DEFAULT, "bankCode", s); GWEN_DB_SetIntValue(dbArgs, GWEN_DB_FLAGS_DEFAULT, "country", 280); /* new for SEPA jobs */ s=AB_Account_GetIBAN(account); if (s && *s) GWEN_DB_SetCharValue(dbArgs, GWEN_DB_FLAGS_DEFAULT, "iban", s); s=AB_Account_GetBIC(account); if (s && *s) GWEN_DB_SetCharValue(dbArgs, GWEN_DB_FLAGS_DEFAULT, "bic", s); return j; }
GWEN_DB_NODE *AH_User_GetUpdForAccount(const AB_USER *u, const AB_ACCOUNT *acc){ return AH_User_GetUpdForAccountIdAndSuffix(u, AB_Account_GetAccountNumber(acc), AB_Account_GetSubAccountId(acc)); }