Package org.kapott.hbci.xml

Examples of org.kapott.hbci.xml.XMLCreator2


    {
        // open SEPA descriptor and create an XML-Creator using it
        /* TODO: load correct schema files depending on the SEPA descriptor set
         * above, depending on the supported SEPA descriptors (BPD) */
        InputStream f=this.getClass().getClassLoader().getResourceAsStream("pain.008.002.02.xsd");
        XMLCreator2 creator=new XMLCreator2(f);

        int size = 1
        /* TODO: Mehr als Eintrag
        float sumvalue = 0;
        for (int i=0; i<size ; ++i)
          sumvalue += btg.value;
          */
       
        // define data to be filled into SEPA document
        XMLData xmldata=new XMLData();
        xmldata.setValue("Document/pain.008.002.02/GrpHdr/MsgId",                              getSEPAMessageId());
        xmldata.setValue("Document/pain.008.002.02/GrpHdr/CreDtTm",                            createSEPATimestamp());
        xmldata.setValue("Document/pain.008.002.02/GrpHdr/NbOfTxs",                            "1");
        // TODO: Gesamtbetrag wenn size > 1 bei mehr als einem Eintrag
        xmldata.setValue("Document/pain.008.002.02/GrpHdr/CtrlSum",                            getSEPAParam("btg.value"));
        xmldata.setValue("Document/pain.008.002.02/GrpHdr/InitgPty/Nm",                        getSEPAParam("dst.name"));

        xmldata.setValue("Document/pain.008.002.02/PmtInf/PmntInfId",              getSEPAParam("dst.CdtrIdentifier"));
        xmldata.setValue("Document/pain.008.002.02/PmtInf/PmntInfMtd",              "DD");
        // TODO: Wert auf Anzahl bei mehr als einem Eintrag
        xmldata.setValue("Document/pain.008.002.02/PmtInf/NbOfTxs",                            "1");
        // TODO: Gesamtbetrag wenn size > 1
        xmldata.setValue("Document/pain.008.002.02/PmtInf/CtrlSum",                            getSEPAParam("btg.value"));

        // Payment Type Id: Basislastschrift
        xmldata.setValue("Document/pain.008.002.02/PmtInf/PmtTpInf/SvcLvl/Cd",                 "SEPA");
        // TODO: wenn Kunde kein Verbraucher, muss hier B2B stehen, f�r die Business-Kunden
        xmldata.setValue("Document/pain.008.002.02/PmtInf/PmtTpInf/LclInstrm/Cd",              "CORE");
        // TODO: Nur bei einmaliger Einreichung: sonst FRST bei erster, RCUR bei allen weiteren.
        xmldata.setValue("Document/pain.008.002.02/PmtInf/PmtTpInf/SeqTp",                   "OOFF");
        xmldata.setValue("Document/pain.008.002.02/PmtInf/ReqdColltnDt",                        "1999-01-01"); // hart kodiert

        // Angaben zum Empf�nger der Lastschrift
        xmldata.setValue("Document/pain.008.002.02/PmtInf/Cdtr/Nm",                getSEPAParam("dst.name"));
        xmldata.setValue("Document/pain.008.002.02/PmtInf/CdtrAgt/FinInstnId/BIC", getSEPAParam("dst.bic"));
        xmldata.setValue("Document/pain.008.002.02/PmtInf/CdtrAcct/Id/IBAN",       getSEPAParam("dst.iban"));
        xmldata.setValue("Document/pain.008.002.02/PmtInf/ChrgBr",                "SLEV");
     // NEU Gl�ubiger-Identifikationsnummer: muss der Einreicher der Lastschrift angeben
        xmldata.setValue("Document/pain.008.002.02/PmtInf/CdtrSchmeId/Id/PrvtId/Othr/Id",       getSEPAParam("dst.CdtrIdentifier"));
        xmldata.setValue("Document/pain.008.002.02/PmtInf/CdtrSchmeId/Id/PrvtId/Othr/SchmeNm/Prtry",       "SEPA");
       
        // for (int i=0; i<size ; ++i) TODO: Mehr als Eintrag
        {
          // Angaben zum Schuldner
          xmldata.setValue("Document/pain.008.002.02/PmtInf/DrctDbtTxInf/InstdAmt",           getSEPAParam("btg.value"));
          xmldata.setValue("Document/pain.008.002.02/PmtInf/DrctDbtTxInf/InstdAmt:Ccy",       getSEPAParam("btg.curr"));
       // NEU Mandatsreferenznummer, wird vom Einreicher jedem Kunden zugewiesen
          xmldata.setValue("Document/pain.008.002.02/PmtInf/DrctDbtTxInf/DrctDbtTx/MndtRltdInf/MndtId",      
              getSEPAParam("src.MandateId"));
       // NEU Datum der Einzugserm�chtigung
          xmldata.setValue("Document/pain.008.002.02/PmtInf/DrctDbtTxInf/DrctDbtTx/MndtRltdInf/DtOfSgntr",      
              getSEPAParam("src.DtOfSgntr"));
       // NEU laut [ksk] optional
          xmldata.setValue("Document/pain.008.002.02/PmtInf/DrctDbtTxInf/DrctDbtTx/MndtRltdInf/AmdmntInd",       "false");
 
          xmldata.setValue("Document/pain.008.002.02/PmtInf/DrctDbtTxInf/Dbtr/Nm",                           
              getSEPAParam("src.name"));
      xmldata.setValue("Document/pain.008.002.02/PmtInf/DrctDbtTxInf/DbtrAgt/FinInstnId/BIC",            
          getSEPAParam("src.bic"));
      xmldata.setValue("Document/pain.008.002.02/PmtInf/DrctDbtTxInf/DbtrAcct/Id/IBAN",                  
          getSEPAParam("src.iban"));
    // TODO: bei mehreren Eintr�gen Unterschiedlich f�r alle
      xmldata.setValue("Document/pain.008.002.02/PmtInf/DrctDbtTxInf/PmtId/EndToEndId",           getSEPAMessageId());
    // TODO: muss Richtlinien entsprechen
      xmldata.setValue("Document/pain.008.002.02/PmtInf/DrctDbtTxInf/RmtInf/Ustrd",           getSEPAParam("usage"));
        }
       
       
        /*
         *
         * Quellen:
         * Beispiel-Datei: http://www.ebics.de/fileadmin/unsecured/anlage3/anlage3_archiv/Anlage3_V2_6_gueltigBis2013-11-03.zip
         * [ksk] https://www.ksk-koeln.de/erstellung-einer-sepa-lastschriftdatei-aus-dta-dateien.xlsx?forced=true
         * [bayernlb]  http://www.bayernlb.de/internet/media/internet_4/de_1/downloads_5/0800_financial_office_it_operations_5/4200_1/sepa_5/sepaaktuell/Newsletter_SEPA_006.pdf
        <PmtInf>
    !<PmtInfId>Payment-ID</PmtInfId>
    !<PmtMtd>DD</PmtMtd>
    !<NbOfTxs>2</NbOfTxs>
    !<CtrlSum>6655.86</CtrlSum>
    !<PmtTpInf>
    !  <SvcLvl>
    !    <Cd>SEPA</Cd>
    !  </SvcLvl>
    !  <LclInstrm>
    !    <Cd>CORE</Cd>
    !  </LclInstrm>
    !  <SeqTp>FRST</SeqTp>
    !</PmtTpInf>
    !<ReqdColltnDt>2010-12-03</ReqdColltnDt>
    !<Cdtr>
    !  <Nm>Creditor Name</Nm>
    !</Cdtr>
    !<CdtrAcct>
    !  <Id>
    !    <IBAN>DE87200500001234567890</IBAN>
    !  </Id>
    !</CdtrAcct>
    !<CdtrAgt>
    !  <FinInstnId>
    !    <BIC>BANKDEFFXXX</BIC>
    !  </FinInstnId>
    !</CdtrAgt>
    <ChrgBr>SLEV</ChrgBr>
    !<CdtrSchmeId>    <Id>
    !    <PrvtId>
    !      <Othr>
    !        <Id>DE00ZZZ00099999999</Id>
    !        <SchmeNm>
    !          <Prtry>SEPA</Prtry>
    !        </SchmeNm>
    !      </Othr>
    !    </PrvtId>
    !  </Id>
    !</CdtrSchmeId>
    <DrctDbtTxInf>
      <PmtId>
        <EndToEndId>OriginatorID1234</EndToEndId>
        // ist optional, erstmal weggelassen [bayernlb]
      </PmtId>
    !  <InstdAmt Ccy="EUR">6543.14</InstdAmt>
    !  <DrctDbtTx>
    !    <MndtRltdInf>
    !      <MndtId>Mandate-Id</MndtId>
    !      <DtOfSgntr>2010-11-20</DtOfSgntr>
    !      ! Dtls optional wenn auf false [ksk], weggelassen
    !      <AmdmntInd>true</AmdmntInd>
    !      <AmdmntInfDtls>
    !        <OrgnlCdtrSchmeId>
    !          <Nm>Original Creditor Name</Nm>
    !          <Id>
    !            <PrvtId>
    !              <Othr>
    !                <Id>AA00ZZZOriginalCreditorID</Id>
    !                <SchmeNm>
    !                  <Prtry>SEPA</Prtry>
    !                </SchmeNm>
    !              </Othr>
    !            </PrvtId>
    !          </Id>
    !        </OrgnlCdtrSchmeId>
    !      </AmdmntInfDtls>
    !    </MndtRltdInf>
    !  </DrctDbtTx>
    !  <DbtrAgt>
    !    <FinInstnId>
    !      <BIC>SPUEDE2UXXX</BIC>
    !    </FinInstnId>
    !  </DbtrAgt>
    !  <Dbtr>
    !    <Nm>Debtor Name</Nm>
    !  </Dbtr>
    !  <DbtrAcct>
    !    <Id>
    !      <IBAN>DE21500500009876543210</IBAN>
    !    </Id>
    !  </DbtrAcct>
      <UltmtDbtr>
        <Nm>Ultimate Debtor Name</Nm>
      </UltmtDbtr>
      <RmtInf>
        <Ustrd>Unstructured Remittance Information</Ustrd>
      </RmtInf>
    </DrctDbtTxInf>
    <DrctDbtTxInf>
      <PmtId>
        <EndToEndId>OriginatorID1235</EndToEndId>
      </PmtId>
      <InstdAmt Ccy="EUR">112.72</InstdAmt>
      <DrctDbtTx>
        <MndtRltdInf>
          <MndtId>Other-Mandate-Id</MndtId>
          <DtOfSgntr>2010-11-20</DtOfSgntr>
          <AmdmntInd>false</AmdmntInd>
        </MndtRltdInf>
      </DrctDbtTx>
      <DbtrAgt>
        <FinInstnId>
          <BIC>SPUEDE2UXXX</BIC>
        </FinInstnId>
      </DbtrAgt>
      <Dbtr>
        <Nm>Other Debtor Name</Nm>
      </Dbtr>
      <DbtrAcct>
        <Id>
          <IBAN>DE21500500001234567897</IBAN>
        </Id>
      </DbtrAcct>
      <UltmtDbtr>
        <Nm>Ultimate Debtor Name</Nm>
      </UltmtDbtr>
      <RmtInf>
        <Ustrd>Unstructured Remittance Information</Ustrd>
      </RmtInf>
    </DrctDbtTxInf>
  </PmtInf>
     
      */
        // create SEPA document
        ByteArrayOutputStream o=new ByteArrayOutputStream();
        creator.createXMLFromSchemaAndData(xmldata, o);
       
        // store SEPA document as parameter
        try {
            setParam("_sepapain", "B"+o.toString("ISO-8859-1"));
        } catch (UnsupportedEncodingException e) {
View Full Code Here

TOP

Related Classes of org.kapott.hbci.xml.XMLCreator2

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.