Exemplo 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);
}
Exemplo n.º 2
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;
}