Ejemplo n.º 1
0
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);
}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
0
AB_IMEXPORTER_ACCOUNTINFO*
AB_ImExporterContext_GetAccountInfoByIban(AB_IMEXPORTER_CONTEXT *iec, const char *iban){
  AB_IMEXPORTER_ACCOUNTINFO *iea;

  if (!iban)
    iban="";

  assert(iec);
  iea=AB_ImExporterContext_FindAccountInfoByIban(iec, iban);
  if (!iea) {
    /* not found, append it */
    iea=AB_ImExporterAccountInfo_new();
    AB_ImExporterAccountInfo_SetIban(iea, iban);
    AB_ImExporterAccountInfo_List_Add(iea, iec->accountInfoList);
  }
  return iea;
}
Ejemplo n.º 4
0
AB_IMEXPORTER_ACCOUNTINFO *AB_ImExporterYN__ReadAccountInfo(AB_IMEXPORTER *ie,
                                                            AB_IMEXPORTER_CONTEXT *ctx,
                                                            GWEN_XMLNODE *doc)
{
  GWEN_XMLNODE *n;
  AB_IMEXPORTER_ACCOUNTINFO *ai;

  ai=AB_ImExporterAccountInfo_new();

  n=GWEN_XMLNode_FindFirstTag(doc, "SG2", 0, 0);
  if (n)
    n=GWEN_XMLNode_FindFirstTag(n, "FII", 0, 0);
  if (n) {
    GWEN_XMLNODE *nn;
    const char *s;

    nn=GWEN_XMLNode_FindFirstTag(n, "C078", 0, 0);
    if (nn) {
      GWEN_XMLNODE *nnn;

      /* account number */
      s=GWEN_XMLNode_GetCharValue(nn, "D_3194", 0);
      if (s)
        AB_ImExporterAccountInfo_SetAccountNumber(ai, s);
      /* IBAN */
      s=GWEN_XMLNode_GetCharValue(nn, "D_3192", 0);
      if (s)
        AB_ImExporterAccountInfo_SetIban(ai, s);
      /* currency */
      nnn=GWEN_XMLNode_FindFirstTag(nn, "D_6345", 0, 0);
      if (nnn) {
        s=GWEN_XMLNode_GetProperty(nnn, "value", 0);
        if (s)
          AB_ImExporterAccountInfo_SetCurrency(ai, s);
      }
    }

    /* account number */
    s=GWEN_XMLNode_GetCharValue(n, "PF:D_5388", 0);
    if (s)
      AB_ImExporterAccountInfo_SetAccountName(ai, s);
  }

  /* owner name */
  n=GWEN_XMLNode_GetNodeByXPath(doc, "SG3[1]/NAD",
                                GWEN_PATH_FLAGS_NAMEMUSTEXIST);
  if (n) {
    GWEN_XMLNODE *nn;

    nn=GWEN_XMLNode_FindFirstTag(n, "D_3035", 0, 0);
    if (nn) {
      const char *s;

      s=GWEN_XMLNode_GetProperty(nn, "Value", 0);
      if (s && strcasecmp(s, "HQ")==0) {
        nn=GWEN_XMLNode_FindFirstTag(n, "C058", 0, 0);
        if (nn) {
          s=GWEN_XMLNode_GetCharValue(nn, "D_3124", 0);
          if (s && *s) {
            GWEN_BUFFER *xbuf;

            xbuf=GWEN_Buffer_new(0, 256, 0, 1);
            AB_ImExporter_Iso8859_1ToUtf8(s, strlen(s), xbuf);
            AB_ImExporterAccountInfo_SetOwner(ai, GWEN_Buffer_GetStart(xbuf));
            GWEN_Buffer_free(xbuf);
          }
        }
      }
    }
  }

  return ai;
}