private void fillUnifiedPayerIds(ExchangeContext ctx, DataRequest dataRequest) { if (ctx.getVariable("payerIdBlock") == null) return; Long countPayers = (Long) ctx.getVariable("payerIdBlock"); if (countPayers > 0) { DataRequest.Payers payers = new DataRequest.Payers(); dataRequest.setPayers(payers); for (int idx = 0; idx < countPayers; idx++) { payers.getPayerIdentifier().add(buildUnifiedPayerID(ctx, "_" + (idx + 1))); } } }
private void fillApplicationIds(ExchangeContext ctx, DataRequest dataRequest) { if (ctx.getVariable("ApplicationIdBlock") == null) return; Long countApplicationIds = (Long) ctx.getVariable("ApplicationIdBlock"); if (countApplicationIds > 0) { DataRequest.ApplicationIDs applicationIDs = new DataRequest.ApplicationIDs(); dataRequest.setApplicationIDs(applicationIDs); for (int idx = 0; idx < countApplicationIds; idx++) { Object supplierBillID = ctx.getVariable("ApplicationId_" + (idx + 1)); if (supplierBillID != null) applicationIDs.getApplicationID().add((String) supplierBillID); } } }
String createAppDataForExportOperation(ExchangeContext ctx) { ExportData exportData = new ExportData(); DataRequest dataRequest = new DataRequest(); Date startDate = (Date) ctx.getVariable("startDate"); if (startDate != null) { dataRequest.setStartDate( XmlTypes.dateTimeAndZeroMilliseconds(formatDate(startDate, "dd.MM.yyyy HH:mm:ss"))); } Date endDate = (Date) ctx.getVariable("endDate"); if (endDate != null) { dataRequest.setEndDate( XmlTypes.dateTimeAndZeroMilliseconds(formatDate(endDate, "dd.MM.yyyy HH:mm:ss"))); } exportData.setDataRequest(dataRequest); dataRequest.setKind((String) ctx.getVariable("exportRequestType")); String postBlockSenderIdentifier = (String) ctx.getVariable("postBlockSenderIdentifier"); final PostBlock postBlock = createPostBlock(ctx, postBlockSenderIdentifier); dataRequest.setPostBlock(postBlock); fillSupplierBillIds(ctx, dataRequest); fillApplicationIds(ctx, dataRequest); fillUnifiedPayerIds(ctx, dataRequest); return new XmlTypes(ExportData.class).toXml(exportData); }