List of usage examples for javax.xml.bind Marshaller JAXB_SCHEMA_LOCATION
String JAXB_SCHEMA_LOCATION
To view the source code for javax.xml.bind Marshaller JAXB_SCHEMA_LOCATION.
Click Source Link
From source file:ws.michalski.sepa.pain.writers.SEPAWriterPain_001_003_03.java
@Override public OutputStream export(SEPAMessage creditMessage) throws SEPAException { // bergabenachricht wird geprft creditMessage.validate();//from w w w . j av a 2 s. co m // Document erstellen Document document = objectFactory.createDocument(); // CstmrCdtTrfInitn erstellen CustomerCreditTransferInitiationV03 cstmrCdtTrfInitn = objectFactory .createCustomerCreditTransferInitiationV03(); document.setCstmrCdtTrfInitn(cstmrCdtTrfInitn); // GrpHdr erstellen GroupHeaderSCT grpHdr = objectFactory.createGroupHeaderSCT(); grpHdr.setMsgId(creditMessage.getMessageId()); grpHdr.setCreDtTm(creditMessage.getCreateDate()); grpHdr.setNbOfTxs(String.valueOf(creditMessage.getNbrOfTransaction())); grpHdr.setCtrlSum(creditMessage.getCtlSum()); grpHdr.setInitgPty(objectFactory.createPartyIdentificationSEPA1()); grpHdr.getInitgPty().setNm(creditMessage.getName()); cstmrCdtTrfInitn.setGrpHdr(grpHdr); // Pro Debitor als CreditTransaction wird PaymentInstructionInformationSCT erstellt // PaymentInstructionInformationSCT entspricht CreditTransaction for (SEPATransaction trns : creditMessage.getTransactionsList()) { CreditTransaction ctrns = null; if (trns instanceof CreditTransaction) { ctrns = (CreditTransaction) trns; } PaymentInstructionInformationSCT pmts = objectFactory.createPaymentInstructionInformationSCT(); // Debitorendaten pmts.setPmtInfId(ctrns.getPaymentInformation()); pmts.setPmtMtd(PaymentMethodSCTCode.TRF); pmts.setNbOfTxs(String.valueOf(ctrns.getNbrOfTransaction())); pmts.setCtrlSum(ctrns.getCtlSum()); pmts.setPmtTpInf(objectFactory.createPaymentTypeInformationSCT1()); pmts.getPmtTpInf().setSvcLvl(objectFactory.createServiceLevelSEPA()); if (ctrns.isUrgendServLev()) { pmts.getPmtTpInf().getSvcLvl().setCd("URGP"); } else { pmts.getPmtTpInf().getSvcLvl().setCd("SEPA"); } // Ausfhrungsdatum von Gregorian auf XMLGregorian pmts.setReqdExctnDt(SEPAUtility.convertYearOnly(ctrns.getExecutionDate())); pmts.setDbtr(objectFactory.createPartyIdentificationSEPA2()); pmts.getDbtr().setNm(ctrns.getName()); pmts.setDbtrAcct(objectFactory.createCashAccountSEPA1()); pmts.getDbtrAcct().setId(objectFactory.createAccountIdentificationSEPA()); pmts.getDbtrAcct().getId().setIBAN(ctrns.getIBAN()); pmts.setDbtrAgt(objectFactory.createBranchAndFinancialInstitutionIdentificationSEPA3()); pmts.getDbtrAgt().setFinInstnId(objectFactory.createFinancialInstitutionIdentificationSEPA3()); pmts.getDbtrAgt().getFinInstnId().setBIC(ctrns.getBIC()); pmts.setChrgBr(ChargeBearerTypeSEPACode.SLEV); // CdtTrfTxInf // Hier werden die einzelne Transaktionen pro Debitor verarbeitet for (CreditTransactionItem ti : ctrns.getCreditTransactionList()) { CreditTransferTransactionInformationSCT ctts = objectFactory .createCreditTransferTransactionInformationSCT(); ctts.setPmtId(objectFactory.createPaymentIdentificationSEPA()); ctts.getPmtId().setEndToEndId(ti.getEndToEndId()); ctts.setAmt(objectFactory.createAmountTypeSEPA()); ctts.getAmt().setInstdAmt(objectFactory.createActiveOrHistoricCurrencyAndAmountSEPA()); ctts.getAmt().getInstdAmt().setCcy(ActiveOrHistoricCurrencyCodeEUR.EUR); ctts.getAmt().getInstdAmt().setValue(ti.getAmount()); ctts.setCdtrAgt(objectFactory.createBranchAndFinancialInstitutionIdentificationSEPA1()); ctts.getCdtrAgt().setFinInstnId(objectFactory.createFinancialInstitutionIdentificationSEPA1()); ctts.getCdtrAgt().getFinInstnId().setBIC(ti.getBIC()); ctts.setCdtr(objectFactory.createPartyIdentificationSEPA2()); ctts.getCdtr().setNm(ti.getName()); ctts.setCdtrAcct(objectFactory.createCashAccountSEPA2()); ctts.getCdtrAcct().setId(objectFactory.createAccountIdentificationSEPA()); ctts.getCdtrAcct().getId().setIBAN(ti.getIBAN()); ctts.setRmtInf(objectFactory.createRemittanceInformationSEPA1Choice()); ctts.getRmtInf().setUstrd(ti.getRemitanceInformation()); if (ti.getPurposeCode() != null) { ctts.setPurp(objectFactory.createPurposeSEPA()); ctts.getPurp().setCd(ti.getPurposeCode().toString()); } // Einzeltransaktion einfgen pmts.getCdtTrfTxInf().add(ctts); } // Debitor Einfgen cstmrCdtTrfInitn.getPmtInf().add(pmts); } // Exportieren try { OutputStream os = new ByteArrayOutputStream(); JAXBContext jc = JAXBContext.newInstance(Document.class); Marshaller m = jc.createMarshaller(); m.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, "urn:iso:std:iso:20022:tech:xsd:pain.001.003.03 pain.001.003.03.xsd"); m.marshal(document, os); return os; } catch (JAXBException e) { log.error(e); } return null; }
From source file:ws.michalski.sepa.pain.writers.SEPAWriterPain_008_001_02.java
@Override public OutputStream export(SEPAMessage debitMessage) throws SEPAException { // bergabenachricht wird geprft debitMessage.validate();/*w w w . jav a 2 s .c o m*/ // Document erstellen Document document = objectFactory.createDocument(); // CstmrCdtTrfInitn erstellen CustomerDirectDebitInitiationV02 cstmrCdtTrfInitn = objectFactory.createCustomerDirectDebitInitiationV02(); document.setCstmrDrctDbtInitn(cstmrCdtTrfInitn); // GrpHdr erstellen GroupHeader39 grpHdr = objectFactory.createGroupHeader39(); grpHdr.setMsgId(debitMessage.getMessageId()); grpHdr.setCreDtTm(debitMessage.getCreateDate()); grpHdr.setNbOfTxs(String.valueOf(debitMessage.getNbrOfTransaction())); grpHdr.setCtrlSum(debitMessage.getCtlSum()); grpHdr.setInitgPty(objectFactory.createPartyIdentification32()); grpHdr.getInitgPty().setNm(debitMessage.getName()); cstmrCdtTrfInitn.setGrpHdr(grpHdr); // Pro Kreditor als DebitTransaction wird PaymentInstructionInformationSDD erstellt // PaymentInstructionInformationSDD entspricht DebitTransaction for (SEPATransaction trns : debitMessage.getTransactionsList()) { DebitTransaction dtrns = null; if (trns instanceof DebitTransaction) { dtrns = (DebitTransaction) trns; } PaymentInstructionInformation4 pmts = objectFactory.createPaymentInstructionInformation4(); // Debitorendaten pmts.setPmtInfId(dtrns.getPaymentInformation()); pmts.setPmtMtd(PaymentMethod2Code.DD); pmts.setNbOfTxs(String.valueOf(dtrns.getNbrOfTransaction())); pmts.setCtrlSum(dtrns.getCtlSum()); pmts.setPmtTpInf(objectFactory.createPaymentTypeInformation20()); pmts.getPmtTpInf().setSvcLvl(objectFactory.createServiceLevel8Choice()); pmts.getPmtTpInf().getSvcLvl().setCd("SEPA"); pmts.getPmtTpInf().setLclInstrm(objectFactory.createLocalInstrument2Choice()); // TODO: In der Version gibt es nicht COR1 -> Ist OK in CORE zu wandeln if (dtrns.getType().equals(Type.B2B)) { pmts.getPmtTpInf().getLclInstrm().setCd("B2B"); } else { pmts.getPmtTpInf().getLclInstrm().setCd("CORE"); } // Sequenz-Typ SeqType sq = dtrns.getSeqType(); switch (sq) { case FNAL: pmts.getPmtTpInf().setSeqTp(SequenceType1Code.FNAL); break; case FRST: pmts.getPmtTpInf().setSeqTp(SequenceType1Code.FRST); break; case OOFF: pmts.getPmtTpInf().setSeqTp(SequenceType1Code.OOFF); break; case RCUR: pmts.getPmtTpInf().setSeqTp(SequenceType1Code.RCUR); break; } // Ausfhrungsdatum von Gregorian auf XMLGregorian pmts.setReqdColltnDt(SEPAUtility.convertYearOnly(dtrns.getExecutionDate())); pmts.setCdtr(objectFactory.createPartyIdentification32()); pmts.getCdtr().setNm(dtrns.getName()); pmts.setCdtrAcct(objectFactory.createCashAccount16()); pmts.getCdtrAcct().setId(objectFactory.createAccountIdentification4Choice()); pmts.getCdtrAcct().getId().setIBAN(dtrns.getIBAN()); pmts.setCdtrAgt(objectFactory.createBranchAndFinancialInstitutionIdentification4()); pmts.getCdtrAgt().setFinInstnId(objectFactory.createFinancialInstitutionIdentification7()); pmts.getCdtrAgt().getFinInstnId().setBIC(dtrns.getBIC()); pmts.setChrgBr(ChargeBearerType1Code.SLEV); // Glubiger-Id pmts.setCdtrSchmeId(objectFactory.createPartyIdentification32()); pmts.getCdtrSchmeId().setId(objectFactory.createParty6Choice()); pmts.getCdtrSchmeId().getId().setPrvtId(objectFactory.createPersonIdentification5()); GenericPersonIdentification1 gpi = new GenericPersonIdentification1(); gpi.setId(dtrns.getCreditorId()); gpi.setSchmeNm(objectFactory.createPersonIdentificationSchemeName1Choice()); gpi.getSchmeNm().setPrtry("SEPA"); pmts.getCdtrSchmeId().getId().getPrvtId().getOthr().add(gpi); // DrctDbtTrfTxInf // Hier werden die einzelne Transaktionen pro Kreditor verarbeitet for (DebitTransactionItem ti : dtrns.getDebitTransactionList()) { DirectDebitTransactionInformation9 dtts = objectFactory.createDirectDebitTransactionInformation9(); dtts.setPmtId(objectFactory.createPaymentIdentification1()); dtts.getPmtId().setEndToEndId(ti.getEndToEndId()); dtts.setInstdAmt(objectFactory.createActiveOrHistoricCurrencyAndAmount()); dtts.getInstdAmt().setCcy("EUR"); dtts.getInstdAmt().setValue(ti.getAmount()); // Mandat dtts.setDrctDbtTx(objectFactory.createDirectDebitTransaction6()); dtts.getDrctDbtTx().setMndtRltdInf(objectFactory.createMandateRelatedInformation6()); dtts.getDrctDbtTx().getMndtRltdInf().setMndtId(ti.getMandate().getReferenz()); dtts.getDrctDbtTx().getMndtRltdInf() .setDtOfSgntr(SEPAUtility.convertYearOnly(ti.getMandate().getSignaturDate())); dtts.getDrctDbtTx().getMndtRltdInf().setAmdmntInd(ti.getMandate().isAmendmentIndicator()); dtts.setDbtrAgt(objectFactory.createBranchAndFinancialInstitutionIdentification4()); dtts.getDbtrAgt().setFinInstnId(objectFactory.createFinancialInstitutionIdentification7()); dtts.getDbtrAgt().getFinInstnId().setBIC(ti.getBIC()); dtts.setDbtr(objectFactory.createPartyIdentification32()); dtts.getDbtr().setNm(ti.getName()); dtts.setDbtrAcct(objectFactory.createCashAccount16()); dtts.getDbtrAcct().setId(objectFactory.createAccountIdentification4Choice()); dtts.getDbtrAcct().getId().setIBAN(ti.getIBAN()); dtts.setRmtInf(objectFactory.createRemittanceInformation5()); dtts.getRmtInf().getUstrd().add(ti.getRemitanceInformation()); if (ti.getPurposeCode() != null) { dtts.setPurp(objectFactory.createPurpose2Choice()); dtts.getPurp().setCd(ti.getPurposeCode().toString()); } // Einzeltransaktion einfgen pmts.getDrctDbtTxInf().add(dtts); } // Debitor Einfgen cstmrCdtTrfInitn.getPmtInf().add(pmts); } // Exportieren try { OutputStream os = new ByteArrayOutputStream(); JAXBContext jc = JAXBContext.newInstance(Document.class); Marshaller m = jc.createMarshaller(); m.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, "urn:iso:std:iso:20022:tech:xsd:pain.008.001.02 pain.008.001.02.xsd"); m.marshal(document, os); return os; } catch (JAXBException e) { log.error(e); } return null; }
From source file:ws.michalski.sepa.pain.writers.SEPAWriterPain_008_002_02.java
@Override public OutputStream export(SEPAMessage debitMessage) throws SEPAException { // bergabenachricht wird geprft debitMessage.validate();//w w w .ja v a 2 s . c o m // Document erstellen Document document = objectFactory.createDocument(); // CstmrCdtTrfInitn erstellen CustomerDirectDebitInitiationV02 cstmrCdtTrfInitn = objectFactory.createCustomerDirectDebitInitiationV02(); document.setCstmrDrctDbtInitn(cstmrCdtTrfInitn); // GrpHdr erstellen GroupHeaderSDD grpHdr = objectFactory.createGroupHeaderSDD(); grpHdr.setMsgId(debitMessage.getMessageId()); grpHdr.setCreDtTm(debitMessage.getCreateDate()); grpHdr.setNbOfTxs(String.valueOf(debitMessage.getNbrOfTransaction())); grpHdr.setCtrlSum(debitMessage.getCtlSum()); grpHdr.setInitgPty(objectFactory.createPartyIdentificationSEPA1()); grpHdr.getInitgPty().setNm(debitMessage.getName()); cstmrCdtTrfInitn.setGrpHdr(grpHdr); // Pro Kreditor als DebitTransaction wird PaymentInstructionInformationSDD erstellt // PaymentInstructionInformationSDD entspricht DebitTransaction for (SEPATransaction trns : debitMessage.getTransactionsList()) { DebitTransaction dtrns = null; if (trns instanceof DebitTransaction) { dtrns = (DebitTransaction) trns; } PaymentInstructionInformationSDD pmts = objectFactory.createPaymentInstructionInformationSDD(); // Debitorendaten pmts.setPmtInfId(dtrns.getPaymentInformation()); pmts.setPmtMtd(PaymentMethod2Code.DD); pmts.setNbOfTxs(String.valueOf(dtrns.getNbrOfTransaction())); pmts.setCtrlSum(dtrns.getCtlSum()); pmts.setPmtTpInf(objectFactory.createPaymentTypeInformationSDD()); pmts.getPmtTpInf().setSvcLvl(objectFactory.createServiceLevelSEPA()); pmts.getPmtTpInf().getSvcLvl().setCd(ServiceLevelSEPACode.SEPA); pmts.getPmtTpInf().setLclInstrm(objectFactory.createLocalInstrumentSEPA()); // TODO: In der Version gibt es nicht COR1 -> Ist OK in CORE zu wandeln if (dtrns.getType().equals(Type.B2B)) { pmts.getPmtTpInf().getLclInstrm().setCd(LocalInstrumentSEPACode.B_2_B); } else { pmts.getPmtTpInf().getLclInstrm().setCd(LocalInstrumentSEPACode.CORE); } // Sequenz-Typ SeqType sq = dtrns.getSeqType(); switch (sq) { case FNAL: pmts.getPmtTpInf().setSeqTp(SequenceType1Code.FNAL); break; case FRST: pmts.getPmtTpInf().setSeqTp(SequenceType1Code.FRST); break; case OOFF: pmts.getPmtTpInf().setSeqTp(SequenceType1Code.OOFF); break; case RCUR: pmts.getPmtTpInf().setSeqTp(SequenceType1Code.RCUR); break; } // Ausfhrungsdatum von Gregorian auf XMLGregorian pmts.setReqdColltnDt(SEPAUtility.convertYearOnly(dtrns.getExecutionDate())); pmts.setCdtr(objectFactory.createPartyIdentificationSEPA5()); pmts.getCdtr().setNm(dtrns.getName()); pmts.setCdtrAcct(objectFactory.createCashAccountSEPA1()); pmts.getCdtrAcct().setId(objectFactory.createAccountIdentificationSEPA()); pmts.getCdtrAcct().getId().setIBAN(dtrns.getIBAN()); pmts.setCdtrAgt(objectFactory.createBranchAndFinancialInstitutionIdentificationSEPA1()); pmts.getCdtrAgt().setFinInstnId(objectFactory.createFinancialInstitutionIdentificationSEPA1()); pmts.getCdtrAgt().getFinInstnId().setBIC(dtrns.getBIC()); pmts.setChrgBr(ChargeBearerTypeSEPACode.SLEV); // Glubiger-Id pmts.setCdtrSchmeId(objectFactory.createPartyIdentificationSEPA3()); pmts.getCdtrSchmeId().setId(objectFactory.createPartySEPA2()); pmts.getCdtrSchmeId().getId().setPrvtId(objectFactory.createPersonIdentificationSEPA2()); pmts.getCdtrSchmeId().getId().getPrvtId() .setOthr(objectFactory.createRestrictedPersonIdentificationSEPA()); pmts.getCdtrSchmeId().getId().getPrvtId().getOthr().setId(dtrns.getCreditorId()); pmts.getCdtrSchmeId().getId().getPrvtId().getOthr() .setSchmeNm(objectFactory.createRestrictedPersonIdentificationSchemeNameSEPA()); pmts.getCdtrSchmeId().getId().getPrvtId().getOthr().getSchmeNm() .setPrtry(IdentificationSchemeNameSEPA.SEPA); // DrctDbtTrfTxInf // Hier werden die einzelne Transaktionen pro Kreditor verarbeitet for (DebitTransactionItem ti : dtrns.getDebitTransactionList()) { DirectDebitTransactionInformationSDD dtts = objectFactory .createDirectDebitTransactionInformationSDD(); dtts.setPmtId(objectFactory.createPaymentIdentificationSEPA()); dtts.getPmtId().setEndToEndId(ti.getEndToEndId()); dtts.setInstdAmt(objectFactory.createActiveOrHistoricCurrencyAndAmountSEPA()); dtts.getInstdAmt().setCcy(ActiveOrHistoricCurrencyCodeEUR.EUR); dtts.getInstdAmt().setValue(ti.getAmount()); // Mandat dtts.setDrctDbtTx(objectFactory.createDirectDebitTransactionSDD()); dtts.getDrctDbtTx().setMndtRltdInf(objectFactory.createMandateRelatedInformationSDD()); dtts.getDrctDbtTx().getMndtRltdInf().setMndtId(ti.getMandate().getReferenz()); dtts.getDrctDbtTx().getMndtRltdInf() .setDtOfSgntr(SEPAUtility.convertYearOnly(ti.getMandate().getSignaturDate())); dtts.getDrctDbtTx().getMndtRltdInf().setAmdmntInd(ti.getMandate().isAmendmentIndicator()); dtts.setDbtrAgt(objectFactory.createBranchAndFinancialInstitutionIdentificationSEPA1()); dtts.getDbtrAgt().setFinInstnId(objectFactory.createFinancialInstitutionIdentificationSEPA1()); dtts.getDbtrAgt().getFinInstnId().setBIC(ti.getBIC()); dtts.setDbtr(objectFactory.createPartyIdentificationSEPA2()); dtts.getDbtr().setNm(ti.getName()); dtts.setDbtrAcct(objectFactory.createCashAccountSEPA2()); dtts.getDbtrAcct().setId(objectFactory.createAccountIdentificationSEPA()); dtts.getDbtrAcct().getId().setIBAN(ti.getIBAN()); dtts.setRmtInf(objectFactory.createRemittanceInformationSEPA1Choice()); dtts.getRmtInf().setUstrd(ti.getRemitanceInformation()); if (ti.getPurposeCode() != null) { dtts.setPurp(objectFactory.createPurposeSEPA()); dtts.getPurp().setCd(ti.getPurposeCode().toString()); } // Einzeltransaktion einfgen pmts.getDrctDbtTxInf().add(dtts); } // Debitor Einfgen cstmrCdtTrfInitn.getPmtInf().add(pmts); } // Exportieren try { OutputStream os = new ByteArrayOutputStream(); JAXBContext jc = JAXBContext.newInstance(Document.class); Marshaller m = jc.createMarshaller(); m.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, "urn:iso:std:iso:20022:tech:xsd:pain.008.002.02 pain.008.002.02.xsd"); m.marshal(document, os); return os; } catch (JAXBException e) { log.error(e); } return null; }
From source file:ws.michalski.sepa.pain.writers.SEPAWriterPain_008_003_02.java
@Override public OutputStream export(SEPAMessage debitMessage) throws SEPAException { // bergabenachricht wird geprft debitMessage.validate();// w w w .j a va2s . com // Document erstellen Document document = objectFactory.createDocument(); // CstmrCdtTrfInitn erstellen CustomerDirectDebitInitiationV02 cstmrCdtTrfInitn = objectFactory.createCustomerDirectDebitInitiationV02(); document.setCstmrDrctDbtInitn(cstmrCdtTrfInitn); // GrpHdr erstellen GroupHeaderSDD grpHdr = objectFactory.createGroupHeaderSDD(); grpHdr.setMsgId(debitMessage.getMessageId()); grpHdr.setCreDtTm(debitMessage.getCreateDate()); grpHdr.setNbOfTxs(String.valueOf(debitMessage.getNbrOfTransaction())); grpHdr.setCtrlSum(debitMessage.getCtlSum()); grpHdr.setInitgPty(objectFactory.createPartyIdentificationSEPA1()); grpHdr.getInitgPty().setNm(debitMessage.getName()); cstmrCdtTrfInitn.setGrpHdr(grpHdr); // Pro Kreditor als DebitTransaction wird PaymentInstructionInformationSDD erstellt // PaymentInstructionInformationSDD entspricht DebitTransaction for (SEPATransaction trns : debitMessage.getTransactionsList()) { DebitTransaction dtrns = null; if (trns instanceof DebitTransaction) { dtrns = (DebitTransaction) trns; } PaymentInstructionInformationSDD pmts = objectFactory.createPaymentInstructionInformationSDD(); // Debitorendaten pmts.setPmtInfId(dtrns.getPaymentInformation()); pmts.setPmtMtd(PaymentMethod2Code.DD); pmts.setNbOfTxs(String.valueOf(dtrns.getNbrOfTransaction())); pmts.setCtrlSum(dtrns.getCtlSum()); pmts.setPmtTpInf(objectFactory.createPaymentTypeInformationSDD()); pmts.getPmtTpInf().setSvcLvl(objectFactory.createServiceLevelSEPA()); pmts.getPmtTpInf().getSvcLvl().setCd("SEPA"); pmts.getPmtTpInf().setLclInstrm(objectFactory.createLocalInstrumentSEPA()); if (dtrns.getType().equals(Type.B2B)) { pmts.getPmtTpInf().getLclInstrm().setCd("B2B"); } else if (dtrns.getType().equals(Type.CORE)) { pmts.getPmtTpInf().getLclInstrm().setCd("CORE"); } else if (dtrns.getType().equals(Type.COR1)) { pmts.getPmtTpInf().getLclInstrm().setCd("COR1"); } // Sequenz-Typ SeqType sq = dtrns.getSeqType(); switch (sq) { case FNAL: pmts.getPmtTpInf().setSeqTp(SequenceType1Code.FNAL); break; case FRST: pmts.getPmtTpInf().setSeqTp(SequenceType1Code.FRST); break; case OOFF: pmts.getPmtTpInf().setSeqTp(SequenceType1Code.OOFF); break; case RCUR: pmts.getPmtTpInf().setSeqTp(SequenceType1Code.RCUR); break; } // Ausfhrungsdatum von Gregorian auf XMLGregorian pmts.setReqdColltnDt(SEPAUtility.convertYearOnly(dtrns.getExecutionDate())); pmts.setCdtr(objectFactory.createPartyIdentificationSEPA5()); pmts.getCdtr().setNm(dtrns.getName()); pmts.setCdtrAcct(objectFactory.createCashAccountSEPA1()); pmts.getCdtrAcct().setId(objectFactory.createAccountIdentificationSEPA()); pmts.getCdtrAcct().getId().setIBAN(dtrns.getIBAN()); pmts.setCdtrAgt(objectFactory.createBranchAndFinancialInstitutionIdentificationSEPA3()); pmts.getCdtrAgt().setFinInstnId(objectFactory.createFinancialInstitutionIdentificationSEPA3()); pmts.getCdtrAgt().getFinInstnId().setBIC(dtrns.getBIC()); pmts.setChrgBr(ChargeBearerTypeSEPACode.SLEV); // Glubiger-Id pmts.setCdtrSchmeId(objectFactory.createPartyIdentificationSEPA3()); pmts.getCdtrSchmeId().setId(objectFactory.createPartySEPA2()); pmts.getCdtrSchmeId().getId().setPrvtId(objectFactory.createPersonIdentificationSEPA2()); pmts.getCdtrSchmeId().getId().getPrvtId() .setOthr(objectFactory.createRestrictedPersonIdentificationSEPA()); pmts.getCdtrSchmeId().getId().getPrvtId().getOthr().setId(dtrns.getCreditorId()); pmts.getCdtrSchmeId().getId().getPrvtId().getOthr() .setSchmeNm(objectFactory.createRestrictedPersonIdentificationSchemeNameSEPA()); pmts.getCdtrSchmeId().getId().getPrvtId().getOthr().getSchmeNm() .setPrtry(IdentificationSchemeNameSEPA.SEPA); // DrctDbtTrfTxInf // Hier werden die einzelne Transaktionen pro Kreditor verarbeitet for (DebitTransactionItem ti : dtrns.getDebitTransactionList()) { DirectDebitTransactionInformationSDD dtts = objectFactory .createDirectDebitTransactionInformationSDD(); dtts.setPmtId(objectFactory.createPaymentIdentificationSEPA()); dtts.getPmtId().setEndToEndId(ti.getEndToEndId()); dtts.setInstdAmt(objectFactory.createActiveOrHistoricCurrencyAndAmountSEPA()); dtts.getInstdAmt().setCcy(ActiveOrHistoricCurrencyCodeEUR.EUR); dtts.getInstdAmt().setValue(ti.getAmount()); // Mandat dtts.setDrctDbtTx(objectFactory.createDirectDebitTransactionSDD()); dtts.getDrctDbtTx().setMndtRltdInf(objectFactory.createMandateRelatedInformationSDD()); dtts.getDrctDbtTx().getMndtRltdInf().setMndtId(ti.getMandate().getReferenz()); dtts.getDrctDbtTx().getMndtRltdInf() .setDtOfSgntr(SEPAUtility.convertYearOnly(ti.getMandate().getSignaturDate())); dtts.getDrctDbtTx().getMndtRltdInf().setAmdmntInd(ti.getMandate().isAmendmentIndicator()); dtts.setDbtrAgt(objectFactory.createBranchAndFinancialInstitutionIdentificationSEPA3()); dtts.getDbtrAgt().setFinInstnId(objectFactory.createFinancialInstitutionIdentificationSEPA3()); dtts.getDbtrAgt().getFinInstnId().setBIC(ti.getBIC()); dtts.setDbtr(objectFactory.createPartyIdentificationSEPA2()); dtts.getDbtr().setNm(ti.getName()); dtts.setDbtrAcct(objectFactory.createCashAccountSEPA2()); dtts.getDbtrAcct().setId(objectFactory.createAccountIdentificationSEPA()); dtts.getDbtrAcct().getId().setIBAN(ti.getIBAN()); dtts.setRmtInf(objectFactory.createRemittanceInformationSEPA1Choice()); dtts.getRmtInf().setUstrd(ti.getRemitanceInformation()); if (ti.getPurposeCode() != null) { dtts.setPurp(objectFactory.createPurposeSEPA()); dtts.getPurp().setCd(ti.getPurposeCode().toString()); } // Einzeltransaktion einfgen pmts.getDrctDbtTxInf().add(dtts); } // Debitor Einfgen cstmrCdtTrfInitn.getPmtInf().add(pmts); } // Exportieren try { OutputStream os = new ByteArrayOutputStream(); JAXBContext jc = JAXBContext.newInstance(Document.class); Marshaller m = jc.createMarshaller(); m.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, "urn:iso:std:iso:20022:tech:xsd:pain.008.003.02 pain.008.003.02.xsd"); m.marshal(document, os); return os; } catch (JAXBException e) { log.error(e); } return null; }