doc.getCstmrDrctDbtInitn().getGrpHdr().setCtrlSum(SepaUtil.sumBtgValue(sepaParams, maxIndex));
//Payment Information
ArrayList<PaymentInstructionInformationSDD> pmtInfs = (ArrayList<PaymentInstructionInformationSDD>) doc.getCstmrDrctDbtInitn().getPmtInf();
PaymentInstructionInformationSDD pmtInf = new PaymentInstructionInformationSDD();
pmtInfs.add(pmtInf);
pmtInf.setPmtInfId(pmtInfId != null && pmtInfId.length() > 0 ? pmtInfId : sepaId);
pmtInf.setPmtMtd(PaymentMethod2Code.DD);
pmtInf.setNbOfTxs(String.valueOf(maxIndex != null ? maxIndex + 1 : 1));
pmtInf.setCtrlSum(SepaUtil.sumBtgValue(sepaParams, maxIndex));
pmtInf.setReqdColltnDt(SepaUtil.createCalendar(sepaParams.getProperty("targetdate")));
pmtInf.setCdtr(new PartyIdentificationSEPA5());
pmtInf.setCdtrAcct(new CashAccountSEPA1());
pmtInf.setCdtrAgt(new BranchAndFinancialInstitutionIdentificationSEPA1());
//Payment Information
pmtInf.getCdtr().setNm(sepaParams.getProperty("src.name"));
//Payment Information
pmtInf.getCdtrAcct().setId(new AccountIdentificationSEPA());
pmtInf.getCdtrAcct().getId().setIBAN(sepaParams.getProperty("src.iban"));
//Payment Information
pmtInf.getCdtrAgt().setFinInstnId(new FinancialInstitutionIdentificationSEPA1());
pmtInf.getCdtrAgt().getFinInstnId().setBIC(sepaParams.getProperty("src.bic"));
//Payment Information - ChargeBearer
pmtInf.setChrgBr(ChargeBearerTypeSEPACode.SLEV);
pmtInf.setPmtTpInf(new PaymentTypeInformationSDD());
pmtInf.getPmtTpInf().setSeqTp(SequenceType1Code.fromValue(sepaParams.getProperty("sequencetype")));
pmtInf.getPmtTpInf().setSvcLvl(new ServiceLevelSEPA());
pmtInf.getPmtTpInf().getSvcLvl().setCd(ServiceLevelSEPACode.SEPA);
pmtInf.getPmtTpInf().setLclInstrm(new LocalInstrumentSEPA());
String type = sepaParams.getProperty("type");
try
{
pmtInf.getPmtTpInf().getLclInstrm().setCd(LocalInstrumentSEPACode.fromValue(type));
}
catch (IllegalArgumentException e)
{
throw new HBCI_Exception("Lastschrift-Art " + type + " wird in der SEPA-Version 008.002.02 Ihrer Bank noch nicht unterst�tzt",e);
}
//Payment Information - Credit Transfer Transaction Information
ArrayList<DirectDebitTransactionInformationSDD> drctDbtTxInfs = (ArrayList<DirectDebitTransactionInformationSDD>) pmtInf.getDrctDbtTxInf();
if (maxIndex != null)
{
for (int tnr = 0; tnr <= maxIndex; tnr++)
{
drctDbtTxInfs.add(createDirectDebitTransactionInformationSDD(sepaParams, tnr));
}
}
else
{
drctDbtTxInfs.add(createDirectDebitTransactionInformationSDD(sepaParams, null));
}
String batch = SepaUtil.getProperty(sepaParams,"batchbook",null);
if (batch != null)
pmtInf.setBtchBookg(batch.equals("1"));
ObjectFactory of = new ObjectFactory();
this.marshal(of.createDocument(doc), os, validate);
}