use of iso.std.iso._20022.tech.xsd.pain_001_001.GroupHeader32 in project estatio by estatio.
the class PaymentBatch method convertToXmlDocument.
// region > convertToXmlDocument
Document convertToXmlDocument() {
final List<CreditTransfer> transfers = getTransfers();
Document document = new Document();
CustomerCreditTransferInitiationV03 cstmrCdtTrfInitn = new CustomerCreditTransferInitiationV03();
document.setCstmrCdtTrfInitn(cstmrCdtTrfInitn);
GroupHeader32 grpHdr = new GroupHeader32();
cstmrCdtTrfInitn.setGrpHdr(grpHdr);
grpHdr.setMsgId(msgId());
grpHdr.setCreDtTm(newDateTime(getCreatedOn()));
grpHdr.setNbOfTxs("" + transfers.size());
grpHdr.setCtrlSum(ctrlSum());
grpHdr.setInitgPty(newPartyIdentification32ForDebtorOwner());
List<PaymentInstructionInformation3> pmtInfList = cstmrCdtTrfInitn.getPmtInves();
PaymentInstructionInformation3 pmtInf = new PaymentInstructionInformation3();
pmtInfList.add(pmtInf);
pmtInf.setPmtInfId(getId());
pmtInf.setPmtMtd(PaymentMethod3Code.TRF);
pmtInf.setBtchBookg(false);
pmtInf.setReqdExctnDt(newDateTime(getRequestedExecutionDate()));
pmtInf.setDbtr(newPartyIdentification32ForDebtorOwner());
pmtInf.setDbtrAcct(cashAccountFor(getDebtorBankAccount()));
pmtInf.setDbtrAgt(agentFor(getDebtorBankAccount()));
final List<CreditTransferTransactionInformation10> cdtTrfTxInfList = pmtInf.getCdtTrfTxInves();
cdtTrfTxInfList.addAll(transfers.stream().map(CreditTransfer::asXml).collect(Collectors.toList()));
return document;
}
Aggregations