Package org.kapott.hbci.structures

Examples of org.kapott.hbci.structures.Value


    protected void extractResults(HBCIMsgStatus msgstatus,String header,int idx)
    {
        Properties result=msgstatus.getData();
        GVRFestList.Entry entry=new GVRFestList.Entry();
       
        entry.anlagebetrag=new Value(
            result.getProperty(header+".Anlagebetrag.value"),
            result.getProperty(header+".Anlagebetrag.curr"));
       
        if (result.getProperty(header+".Anlagekto.number")!=null) {
            entry.anlagekonto=new Konto();
            entry.anlagekonto.blz=result.getProperty(header+".Anlagekto.KIK.blz");
            entry.anlagekonto.country=result.getProperty(header+".Anlagekto.KIK.country");
            entry.anlagekonto.number=result.getProperty(header+".Anlagekto.number");
            entry.anlagekonto.subnumber=result.getProperty(header+".Anlagekto.subnumber");
            getMainPassport().fillAccountInfo(entry.anlagekonto);
        }
       
        if (result.getProperty(header+".Ausbuchungskto.number")!=null) {
            entry.ausbuchungskonto=new Konto();
            entry.ausbuchungskonto.blz=result.getProperty(header+".Ausbuchungskto.KIK.blz");
            entry.ausbuchungskonto.country=result.getProperty(header+".Ausbuchungskto.KIK.country");
            entry.ausbuchungskonto.number=result.getProperty(header+".Ausbuchungskto.number");
            entry.ausbuchungskonto.subnumber=result.getProperty(header+".Ausbuchungskto.subnumber");
            getMainPassport().fillAccountInfo(entry.ausbuchungskonto);
        }
       
        entry.belastungskonto=new Konto();
        entry.belastungskonto.blz=result.getProperty(header+".Belastungskto.KIK.blz");
        entry.belastungskonto.country=result.getProperty(header+".Belastungskto.KIK.country");
        entry.belastungskonto.number=result.getProperty(header+".Belastungskto.number");
        entry.belastungskonto.subnumber=result.getProperty(header+".Belastungskto.subnumber");
        getMainPassport().fillAccountInfo(entry.belastungskonto);
       
        if (result.getProperty(header+".Zinskto.number")!=null) {
            entry.zinskonto=new Konto();
            entry.zinskonto.blz=result.getProperty(header+".Zinskto.KIK.blz");
            entry.zinskonto.country=result.getProperty(header+".Zinskto.KIK.country");
            entry.zinskonto.number=result.getProperty(header+".Zinskto.number");
            entry.zinskonto.subnumber=result.getProperty(header+".Zinskto.subnumber");
            getMainPassport().fillAccountInfo(entry.zinskonto);
        }
       
        entry.id=result.getProperty(header+".kontakt");
       
        String st=result.getProperty(header+".kontoauszug");
        entry.kontoauszug=(st!=null)?Integer.parseInt(st):0;
        st=result.getProperty(header+".status");
        entry.status=(st!=null)?Integer.parseInt(st):0;

        entry.verlaengern=result.getProperty(header+".wiederanlage").equals("2");

        if (result.getProperty(header+".Zinsbetrag.value")!=null) {
            entry.zinsbetrag=new Value(
                result.getProperty(header+".Zinsbetrag.value"),
                result.getProperty(header+".Zinsbetrag.curr"));
        }
       
        entry.konditionen=new GVRFestCondList.Cond();
        entry.konditionen.ablaufdatum=HBCIUtils.string2DateISO(result.getProperty(header+".FestCond.ablaufdate"));
        entry.konditionen.anlagedatum=HBCIUtils.string2DateISO(result.getProperty(header+".FestCond.anlagedate"));
        entry.konditionen.id=result.getProperty(header+".FestCond.condid");
        entry.konditionen.name=result.getProperty(header+".FestCond.condbez");

        if (result.getProperty(header+".FestCondVersion.version")!=null) {
            entry.konditionen.date=HBCIUtils.strings2DateTimeISO(result.getProperty(header+".FestCondVersion.date"),
                                                                  result.getProperty(header+".FestCondVersion.time"));
            entry.konditionen.version=result.getProperty(header+".FestCondVersion.version");
        }
       
        st=result.getProperty(header+".FestCond.zinsmethode");
        if (st.equals("A"))
            entry.konditionen.zinsmethode=GVRFestCondList.Cond.METHOD_30_360;
        else if (st.equals("B"))
            entry.konditionen.zinsmethode=GVRFestCondList.Cond.METHOD_2831_360;
        else if (st.equals("C"))
            entry.konditionen.zinsmethode=GVRFestCondList.Cond.METHOD_2831_365366;
        else if (st.equals("D"))
            entry.konditionen.zinsmethode=GVRFestCondList.Cond.METHOD_30_365366;
        else if (st.equals("E"))
            entry.konditionen.zinsmethode=GVRFestCondList.Cond.METHOD_2831_365;
        else if (st.equals("F"))
            entry.konditionen.zinsmethode=GVRFestCondList.Cond.METHOD_30_365;
       
        entry.konditionen.zinssatz=HBCIUtilsInternal.string2Long(result.getProperty(header+".FestCond.zinssatz"), 1000);
        entry.konditionen.minbetrag=new Value(
            result.getProperty(header+".FestCond.MinBetrag.value"),
            result.getProperty(header+".FestCond.MinBetrag.curr"));
        entry.konditionen.name=result.getProperty(header+".FestCond.condbez");

        if (result.getProperty(header+".FestCond.MaxBetrag.value")!=null) {
            entry.konditionen.maxbetrag=new Value(
                result.getProperty(header+".FestCond.MaxBetrag.value"),
                result.getProperty(header+".FestCond.MaxBetrag.curr"));
        }
       
        if (result.getProperty(header+".Prolong.laufzeit")!=null) {
            entry.verlaengerung=new GVRFestList.Entry.Prolong();
            entry.verlaengerung.betrag=new Value(
                result.getProperty(header+".Prolong.BTG.value"),
                result.getProperty(header+".Prolong.BTG.curr"));
            entry.verlaengerung.laufzeit=Integer.parseInt(result.getProperty(header+".Prolong.laufzeit"));
            entry.verlaengerung.verlaengern=result.getProperty(header+".Prolong.wiederanlage").equals("2");
        }
View Full Code Here


        entry.key=result.getProperty(header+".key");
        entry.addkey=result.getProperty(header+".addkey");
        entry.orderid=result.getProperty(header+".id");
        entry.date=HBCIUtils.string2DateISO(result.getProperty(header+".date"));
       
        entry.value=new Value(
            result.getProperty(header+".BTG.value"),
            result.getProperty(header+".BTG.curr"));
       
        for (int i=0;;i++) {
            String usage=result.getProperty(HBCIUtilsInternal.withCounter(header+".usage.usage",i));
View Full Code Here

        if(sepaResults.isEmpty()) return;
        Properties sepaResult = sepaResults.get(0);
        entry.other.iban = sepaResult.getProperty("dst.iban");
        entry.other.bic = sepaResult.getProperty("dst.bic");
        entry.other.name = sepaResult.getProperty("dst.name");
        entry.value=new Value(
                        sepaResult.getProperty("value"),
                        sepaResult.getProperty("curr"));
        entry.addUsage(sepaResult.getProperty("usage"));
        entry.orderid=result.getProperty(header+".orderid");
View Full Code Here

                        btag.start.timestamp=null;
                    }

                    // hier aus dem CD-Indikator und dem absoluten Saldo-Betrag
                    // einen String f�r den Saldo-Betrag zusamennbauen
                    btag.start.value=new Value(
                        (cd.equals("D")?"-":"")+st_start.substring(10).replace(',','.'),
                        st_start.substring(7,10));
                }

                // looping to get all "umsaetze"

                // TODO: beim MT942 (btag.start==null) m�sste als Initialwert
                // fuer den Saldo hier eigentlich der Abschluss-Saldo aus den
                // gebuchten Ums�tzen verwendet werden (den habe ich an dieser
                // Stelle aber nicht so ohne weiteres)
                long saldo = (btag.start!=null)?btag.start.value.getLongValue():0;
                int  ums_counter=0;

                while (true) {
                    String st_ums=Swift.getTagValue(st_tag,"61",ums_counter);
                    if (st_ums==null)
                        break;

                    GVRKUms.UmsLine line=new GVRKUms.UmsLine();

                    // extract valuta
                    line.valuta=dateFormat.parse(st_ums.substring(0,6));

                    // extract bdate
                    int next=0;
                    if (st_ums.charAt(6)>'9') {
                        // [2012-01-27 - Patch von Frank/Pecunia]
                        // beim :61er Tag ist das Buchungsdatum optional. Wenn es nicht gesetzt ist, muss das Buchungsdatum des
                        // Umsatzes z.B. aus :60F kommen
                        if (btag.start !=  null && btag.start.timestamp != null) line.bdate = btag.start.timestamp;
                        else line.bdate=line.valuta;

                        next=6;

                    } else {
                        line.bdate=dateFormat.parse(st_ums.substring(0,2)+
                            st_ums.substring(6,10));

                        // wenn bdate und valuta um mehr als einen monat voneinander
                        // abweichen, dann ist das jahr des bdate falsch (1.1.2005 vs. 31.12.2004)
                        // korrektur des bdate-jahres in die richtige richtung notwendig
                        // FE: ein Monat reicht nicht, es sollte schon ein halbes Jahr sein - es gab verschiedene Probleme mit Umsaetzen im falschen Jahr!!
                        // http://www.onlinebanking-forum.de/phpBB2/viewtopic.php?p=75348
                        if (Math.abs(line.bdate.getTime()-line.valuta.getTime())>180L*24*3600*1000) {
                            int diff;

                            if (line.bdate.before(line.valuta)) {
                                diff=+1;
                            } else {
                                diff=-1;
                            }
                            Calendar cal=Calendar.getInstance();
                            cal.setTime(line.bdate);
                            cal.set(Calendar.YEAR,cal.get(Calendar.YEAR)+diff);
                            line.bdate=cal.getTime();
                        }

                        next=10;
                    }

                    // extract credit/debit
                    String cd;
                    if (st_ums.charAt(next)=='C' || st_ums.charAt(next)=='D') {
                        line.isStorno=false;
                        cd=st_ums.substring(next,next+1);
                        next++;
                    } else {
                        line.isStorno=true;
                        cd=st_ums.substring(next+1,next+2);
                        next+=2;
                    }

                    // skip part of currency
                    char currpart=st_ums.charAt(next);
                    if (currpart>'9')
                        next++;

                    line.value=new Value();

                    // TODO: bei einem MT942 wird die waehrung hier automatisch auf EUR
                    // gesetzt, weil die auto-erkennung (anhand des anfangssaldos) hier nicht
                    // funktioniert, weil es im MT942 keinen anfangssaldo gibt
                    line.value.setCurr((btag.start!=null)?btag.start.value.getCurr():"EUR");

                    // extract value and skip code
                    int    npos=st_ums.indexOf("N",next);
                    // welcher Code (C/D) zeigt einen negativen Buchungsbetrag
                    // an? Bei einer "normalen" Buchung ist das D(ebit). Bei
                    // einer Storno-Buchung ist der Betrag allerdings negativ,
                    // wenn eine ehemalige Gutschrift (Credit) storniert wird,
                    // in dem Fall w�re als "C" der Indikator f�r den negativen
                    // Buchungsbetrag
                    String negValueIndikator=line.isStorno?"C":"D";
                    line.value.setValue(
                        HBCIUtilsInternal.string2Long(
                            (cd.equals(negValueIndikator)?"-":"") + st_ums.substring(next,npos).replace(',','.'),
                            100));
                    next=npos+4;

                    // update saldo
                    saldo+=line.value.getLongValue();

                    line.saldo=new Saldo();
                    line.saldo.timestamp=line.bdate;
                    // TODO: bei einem MT942 wird die waehrung hier automatisch auf EUR
                    // gesetzt, weil die auto-erkennung (anhand des anfangssaldos) hier nicht
                    // funktioniert, weil es im MT942 keinen anfangssaldo gibt
                    line.saldo.value=new Value(saldo, (btag.start!=null)?btag.start.value.getCurr():"EUR");

                    // extract customerref
                    npos=st_ums.indexOf("//",next);
                    if (npos==-1)
                        npos=st_ums.indexOf("\r\n",next);
                    if (npos==-1)
                        npos=st_ums.length();
                    line.customerref=st_ums.substring(next,npos);
                    next=npos;

                    // check for instref
                    if (next<st_ums.length() && st_ums.substring(next,next+2).equals("//")) {
                        // extract instref
                        next+=2;
                        npos=st_ums.indexOf("\r\n",next);
                        if (npos==-1)
                            npos=st_ums.length();
                        line.instref=st_ums.substring(next,npos);
                        next=npos+2;
                    }
                    if (line.instref==null)
                        line.instref="";

                    // check for additional information
                    if (next<st_ums.length() && st_ums.charAt(next)=='\r') {
                        next+=2;

                        // extract orig Value
                        pos=st_ums.indexOf("/OCMT/",next);
                        if (pos!=-1) {
                            int slashpos=st_ums.indexOf("/",pos+9);
                            if (slashpos==-1)
                                slashpos=st_ums.length();

                            try
                            {
                              line.orig_value=new Value(
                                  st_ums.substring(pos+9,slashpos).replace(',','.'),
                                  st_ums.substring(pos+6,pos+9));
                            }
                            catch (NumberFormatException nfe)
                            {
                              // Der Betrag darf fehlen. Tolerieren wir
                            }
                        }

                        // extract charge Value
                        pos=st_ums.indexOf("/CHGS/",next);
                        if (pos!=-1) {
                            int slashpos=st_ums.indexOf("/",pos+9);
                            if (slashpos==-1)
                                slashpos=st_ums.length();

                            try
                            {
                              line.charge_value=new Value(
                                  st_ums.substring(pos+9,slashpos).replace(',','.'),
                                  st_ums.substring(pos+6,pos+9));
                            }
                            catch (NumberFormatException nfe)
                            {
                              // Der Betrag darf fehlen. Tolerieren wir
                            }
                        }
                    }

                    String st_multi=Swift.getTagValue(st_tag,"86",ums_counter);
                    if (st_multi!=null) {
                        line.gvcode=st_multi.substring(0,3);
                        st_multi=Swift.packMulti(st_multi.substring(3));

                        if (!line.gvcode.equals("999")) {
                            line.isSepa = line.gvcode.startsWith("1");
                            line.text=Swift.getMultiTagValue(st_multi,"00");
                            line.primanota=Swift.getMultiTagValue(st_multi,"10");
                            for (int i=0;i<10;i++) {
                                line.addUsage(Swift.getMultiTagValue(st_multi,Integer.toString(20+i)));
                            }

                            Konto acc=new Konto();
                            acc.blz=Swift.getMultiTagValue(st_multi,"30");
                            acc.number=Swift.getMultiTagValue(st_multi,"31");
                           
                            // fuer den Fall, dass in der BLZ sowas hier drin steht: "GENODEF1S06 SVWZ+ ja"
                            // Siehe http://www.onlinebanking-forum.de/phpBB2/viewtopic.php?t=16182
                            if (acc.blz != null)
                            {
                                int space = acc.blz.indexOf(" ");
                                if (space != -1)
                                {
                                    HBCIUtils.log("blz/bic \"" + acc.blz + "\" contains invalid chars, trimming after first space", HBCIUtils.LOG_DEBUG);
                                    acc.blz = acc.blz.substring(0,space);
                                }
                            }

                            if (line.isSepa)
                            {
                              acc.bic = acc.blz;
                              acc.iban = acc.number;
                            }

                            acc.name=Swift.getMultiTagValue(st_multi,"32");
                            acc.name2=Swift.getMultiTagValue(st_multi,"33");
                            if (acc.blz!=null ||
                                    acc.number!=null ||
                                    acc.name!=null ||
                                    acc.name2!=null) {

                                if (acc.blz==null)
                                    acc.blz="";
                                if (acc.number==null)
                                    acc.number="";
                                if (acc.name==null)
                                    acc.name="";
                                line.other=acc;
                            }

                            line.addkey=Swift.getMultiTagValue(st_multi,"34");
                            for (int i=0;i<4;i++) {
                                line.addUsage(Swift.getMultiTagValue(st_multi,Integer.toString(60+i)));
                            }
                        } else {
                            line.additional=st_multi;
                        }
                    }

                    btag.addLine(line);
                    ums_counter++;
                }

                // extract "schlusssaldo"

                String st_end=Swift.getTagValue(st_tag,"62F",0);
                char   endtype='F';
                btag.endtype='F';
                if (st_end==null) {
                    st_end=Swift.getTagValue(st_tag,"62M",0);
                    endtype='M';
                }
                if (st_end!=null) {
                    // Tag 62 (Schlusssaldo) gibt es in MT942 nicht,
                    // darum wird btag.end nur in MT940 gef�llt

                    btag.end=new Saldo();
                    btag.endtype=endtype;

                    String cd=st_end.substring(0,1);

                    try {
                        btag.end.timestamp=dateFormat.parse(st_end.substring(1,7));
                    } catch (Exception e) {
                        btag.end.timestamp=null;
                    }

                    // set default values for optional non-given bdates
                    if (btag.start != null && btag.start.timestamp==null) {
                        btag.start.timestamp=btag.end.timestamp;
                    }
                    for (Iterator<UmsLine> j=btag.lines.iterator(); j.hasNext(); ) {
                        UmsLine line= j.next();
                        if (line.bdate==null) {
                            line.bdate=btag.end.timestamp;
                        }
                    }

                    btag.end.value=new Value(
                            (cd.equals("D")?"-":"")+st_end.substring(10).replace(',','.'),
                            st_end.substring(7,10));
                }

                // Now check if the end balance (Schlusssaldo) equals balance of last statement. If not, the bank sent a wrong start balance
                // and we have to re-calculate the balances for each statement
                int numLines = btag.lines.size();
                if(numLines > 0 && btag.end != null) {
                    UmsLine lastLine = btag.lines.get(numLines-1);
                    saldo = btag.end.value.getLongValue();
                    if(lastLine.saldo.value.getLongValue() != saldo) {
                        for(int i=numLines-1; i>=0; i--) {
                            lastLine = btag.lines.get(i);
                            lastLine.saldo.value = new Value(saldo, btag.end.value.getCurr());
                            saldo -= lastLine.value.getLongValue();
                        }
                    }
                }

View Full Code Here

       info.cardnumber=result.getProperty(header+".cardnumber");
       info.cardordernumber=result.getProperty(header+".nextcardnumber");
       info.cardtype=Integer.parseInt(result.getProperty(header+".cardtype"));
       info.comment=result.getProperty(header+".comment");
       if ((st=result.getProperty(header+".cardlimit.value"))!=null) {
           info.limit=new Value(st,result.getProperty(header+".cardlimit.curr"));
       }
       info.owner=result.getProperty(header+".name");
       if ((st=result.getProperty(header+".validfrom"))!=null) {
           info.validFrom=HBCIUtils.string2DateISO(st);
       }
View Full Code Here

        info.habenzins=((st=result.getProperty(header+".habenzins"))!=null)?HBCIUtilsInternal.string2Long(st,1000):-1;
        info.sollzins=((st=result.getProperty(header+".sollzins"))!=null)?HBCIUtilsInternal.string2Long(st,1000):-1;
        info.ueberzins=((st=result.getProperty(header+".overdrivezins"))!=null)?HBCIUtilsInternal.string2Long(st,1000):-1;
       
        if ((st=result.getProperty(header+".kredit.value"))!=null)
            info.kredit=new Value(st,result.getProperty(header+".kredit.curr"));
        if ((st=result.getProperty(header+".refkto.number"))!=null)
            info.refAccount=new Konto(result.getProperty(header+".refkto.KIK.country"),
                                      result.getProperty(header+".refkto.KIK.blz"),
                                      st,
                                      result.getProperty(header+".refkto.subnumber"));
View Full Code Here

        if(sepaResults.isEmpty()) return;
        Properties sepaResult = sepaResults.get(0);
        entry.other.iban = sepaResult.getProperty("dst.iban");
        entry.other.bic = sepaResult.getProperty("dst.bic");
        entry.other.name = sepaResult.getProperty("dst.name");
        entry.value=new Value(
                        sepaResult.getProperty("value"),
                        sepaResult.getProperty("curr"));
        entry.addUsage(sepaResult.getProperty("usage"));
        String st;
        entry.orderid=result.getProperty(header+".orderid");

        entry.firstdate=HBCIUtils.string2DateISO(result.getProperty(header+".DauerDetails.firstdate"));
        entry.timeunit=result.getProperty(header+".DauerDetails.timeunit");
        entry.turnus=Integer.parseInt(result.getProperty(header+".DauerDetails.turnus"));
        entry.execday=Integer.parseInt(result.getProperty(header+".DauerDetails.execday"));
        if ((st=result.getProperty(header+".DauerDetails.lastdate"))!=null)
            entry.lastdate=HBCIUtils.string2DateISO(st);

        entry.aus_available=result.getProperty(header+".Aussetzung.annual")!=null;
        if (entry.aus_available) {
            entry.aus_annual=result.getProperty(header+".Aussetzung.annual").equals("J");
            if ((st=result.getProperty(header+".Aussetzung.startdate"))!=null)
                entry.aus_start=HBCIUtils.string2DateISO(st);
            if ((st=result.getProperty(header+".Aussetzung.enddate"))!=null)
                entry.aus_end=HBCIUtils.string2DateISO(st);
            entry.aus_breakcount=result.getProperty(header+".Aussetzung.number");
            if ((st=result.getProperty(header+".Aussetzung.newvalue.value"))!=null) {
                entry.aus_newvalue=new Value(
                    st,
                    result.getProperty(header+".Aussetzung.newvalue.curr"));
            }
        }
       
View Full Code Here

        int source_acc_idx = Integer.parseInt(params.getProperty("source_account_idx"));
        job.setParam("src",passport.getAccounts()[source_acc_idx]);
        job.setParam("dst",acc);
        String value = params.getProperty("value");
        if(value == null) value = "100";
        job.setParam("btg",new Value(Integer.parseInt(value),"EUR"));
        job.setParam("usage","SEPA Dauerauftrag");
        job.setParam("firstdate", params.getProperty("firstdate"));
        job.setParam("timeunit", "M");
        job.setParam("turnus", "1");
        job.setParam("execday", "1");
View Full Code Here

    HBCIJobImpl job = (HBCIJobImpl) handler.newJob("Ueb");
   
    // wir nehmen einfach das erste verfuegbare Konto
    job.setParam("src",passport.getAccounts()[0]);
    job.setParam("dst",passport.getAccounts()[0]);
    job.setParam("btg",new Value(1L,"EUR"));
    job.setParam("usage","test");
    job.setParam("name","test");
    job.setParam("key","51");
   
    job.addToQueue();
View Full Code Here

        job.setParam("src",passport.getAccounts()[source_acc_idx]);
        job.setParam("dst",acc);
       
        String value = params.getProperty("value");
        if(value == null) value = "100";
        job.setParam("btg",new Value(Integer.parseInt(value),"EUR"));
        job.setParam("usage",params.getProperty("usage"));
        job.setParam("targetdate", params.getProperty("date"));
        job.setParam("creditorid", params.getProperty("creditorid"));
        job.setParam("mandateid", params.getProperty("mandateid"));
        job.setParam("manddateofsig", params.getProperty("date_of_sig"));
View Full Code Here

TOP

Related Classes of org.kapott.hbci.structures.Value

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.