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 BranchAndFinancialInstitutionIdentificationSEPA3());
//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 FinancialInstitutionIdentificationSEPA3());
String srcBic = sepaParams.getProperty("src.bic");
if (srcBic != null && srcBic.length() > 0) // BIC ist inzwischen optional
{
pmtInf.getCdtrAgt().getFinInstnId().setBIC(srcBic);
}
else
{
pmtInf.getCdtrAgt().getFinInstnId().setOthr(new OthrIdentification());
pmtInf.getCdtrAgt().getFinInstnId().getOthr().setId(OthrIdentificationCode.NOTPROVIDED);
}
//Payment Information - ChargeBearer
pmtInf.setChrgBr(ChargeBearerTypeSEPACode.SLEV);
pmtInf.setPmtTpInf(new PaymentTypeInformationSDD());
pmtInf.getPmtTpInf().setSvcLvl(new ServiceLevelSEPA());
pmtInf.getPmtTpInf().getSvcLvl().setCd("SEPA");
pmtInf.getPmtTpInf().setLclInstrm(new LocalInstrumentSEPA());
pmtInf.getPmtTpInf().getLclInstrm().setCd(sepaParams.getProperty("type"));
pmtInf.getPmtTpInf().setSeqTp(SequenceType1Code.fromValue(sepaParams.getProperty("sequencetype")));
//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);
}