コード例 #1
0
ファイル: imexporter.c プロジェクト: Zauberstuhl/aqbanking
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);
}
コード例 #2
0
ファイル: imexporter.c プロジェクト: Zauberstuhl/aqbanking
AB_IMEXPORTER_ACCOUNTINFO *AB_ImExporterContext__GetAccountInfoForTransaction(AB_IMEXPORTER_CONTEXT *iec,
									      const AB_TRANSACTION *t){
  AB_IMEXPORTER_ACCOUNTINFO *iea;
  const char *tIban;
  const char *tBankCode;
  const char *tAccountNumber;

  tBankCode=AB_Transaction_GetLocalBankCode(t);
  if (!tBankCode) tBankCode="";
  tAccountNumber=AB_Transaction_GetLocalAccountNumber(t);
  if (!tAccountNumber) tAccountNumber="";
  tIban=AB_Transaction_GetLocalIban(t);
  if (!tIban) tIban="";

  iea=AB_ImExporterAccountInfo_List_First(iec->accountInfoList);
  while(iea) {
    const char *sBankCode;
    const char *sAccountNumber;
    const char *sIban;

    sBankCode=AB_ImExporterAccountInfo_GetBankCode(iea);
    if (!sBankCode) sBankCode="";
    sAccountNumber=AB_ImExporterAccountInfo_GetAccountNumber(iea);
    if (!sAccountNumber) sAccountNumber="";
    sIban=AB_ImExporterAccountInfo_GetIban(iea);
    if (!sIban) sIban="";

    if (strcasecmp(sIban, tIban)==0)
      return iea;

    if ((strcasecmp(sBankCode, tBankCode)==0) &&
	(strcasecmp(sAccountNumber, tAccountNumber)==0))
      return iea;

    iea=AB_ImExporterAccountInfo_List_Next(iea);
  }

  /* not found, append it */
  iea=AB_ImExporterAccountInfo_new();
  if (tIban && *tIban)
    AB_ImExporterAccountInfo_SetIban(iea, tIban);
  if (tBankCode && *tBankCode)
    AB_ImExporterAccountInfo_SetBankCode(iea, tBankCode);
  if (tAccountNumber && *tAccountNumber)
    AB_ImExporterAccountInfo_SetAccountNumber(iea, tAccountNumber);
  AB_ImExporterAccountInfo_List_Add(iea, iec->accountInfoList);

  return iea;
}
コード例 #3
0
ファイル: imexporter.c プロジェクト: Zauberstuhl/aqbanking
AB_IMEXPORTER_ACCOUNTINFO*
AB_ImExporterContext_GetAccountInfo(AB_IMEXPORTER_CONTEXT *iec,
                                    const char *bankCode,
                                    const char *accountNumber){
  AB_IMEXPORTER_ACCOUNTINFO *iea;

  if (!bankCode)
    bankCode="";
  if (!accountNumber)
    accountNumber="";

  assert(iec);
  iea=AB_ImExporterContext_FindAccountInfo(iec, bankCode, accountNumber);
  if (!iea) {
    /* not found, append it */
    iea=AB_ImExporterAccountInfo_new();
    AB_ImExporterAccountInfo_SetBankCode(iea, bankCode);
    AB_ImExporterAccountInfo_SetAccountNumber(iea, accountNumber);
    AB_ImExporterAccountInfo_List_Add(iea, iec->accountInfoList);
  }
  return iea;
}
コード例 #4
0
ファイル: ofx-libofx.c プロジェクト: cstim/aqbanking
int AH_ImExporterOFX_AccountCallback_cb(const struct OfxAccountData data,
                                        void *user_data)
{
  AH_IMEXPORTER_OFX *ieh;
  AB_IMEXPORTER_ACCOUNTINFO *ai;

  DBG_INFO(AQBANKING_LOGDOMAIN,
           "Account callback");
  ieh=(AH_IMEXPORTER_OFX *)user_data;

  ai=AB_ImExporterAccountInfo_new();
#ifdef HAVE_OFX_WITH_CONNECT
  if (data.account_number_valid) {
    AB_ImExporterAccountInfo_SetAccountNumber(ai, data.account_number);
    if (*(data.account_name))
      AB_ImExporterAccountInfo_SetAccountName(ai, data.account_name);
  }
  else if (data.account_id_valid)
    AB_ImExporterAccountInfo_SetAccountNumber(ai, data.account_id);
  else
    AB_ImExporterAccountInfo_SetAccountNumber(ai, "----");

  if (data.bank_id_valid)
    AB_ImExporterAccountInfo_SetBankCode(ai, data.bank_id);
#else
  if (data.account_id_valid) {
    AB_ImExporterAccountInfo_SetAccountNumber(ai, data.account_id);
    if (*(data.account_name))
      AB_ImExporterAccountInfo_SetAccountName(ai, data.account_name);
  }
  else {
    AB_ImExporterAccountInfo_SetAccountNumber(ai, "----");
  }
#endif

  if (data.account_type_valid) {
    AB_ACCOUNT_TYPE at;

    switch (data.account_type) {
    case OFX_CHECKING:
      at=AB_AccountType_Checking;
      break;
    case OFX_SAVINGS:
      at=AB_AccountType_Savings;
      break;
    case OFX_MONEYMRKT:
      at=AB_AccountType_Investment;
      break;
    case OFX_CREDITLINE:
      at=AB_AccountType_Bank;
      break;
    case OFX_CMA:
      at=AB_AccountType_Cash;
      break;
    case OFX_CREDITCARD:
      at=AB_AccountType_CreditCard;
      break;
    case OFX_INVESTMENT:
      at=AB_AccountType_Investment;
      break;
    default:
      at=AB_AccountType_Bank;
      break;
    }
    AB_ImExporterAccountInfo_SetType(ai, at);
  }
  else {
    AB_ImExporterAccountInfo_SetType(ai, AB_AccountType_Bank);
  }

  AB_ImExporterContext_AddAccountInfo(ieh->context, ai);
  ieh->lastAccountInfo=ai;
  return 0;
}