use of edu.cornell.kfs.fp.businessobject.AchIncomeFileTransactionOpenItemReference in project cu-kfs by CU-CommunityApps.
the class AdvanceDepositServiceImplTest method setupOpenItemReference.
private AchIncomeFileTransactionOpenItemReference setupOpenItemReference(String type, String invoiceNumber) {
AchIncomeFileTransactionOpenItemReference openItemReference = new AchIncomeFileTransactionOpenItemReference();
openItemReference.setInvoiceAmount(new KualiDecimal("12761.79"));
openItemReference.setNetAmount(new KualiDecimal("12761.79"));
openItemReference.setType(type);
openItemReference.setInvoiceNumber(invoiceNumber);
return openItemReference;
}
use of edu.cornell.kfs.fp.businessobject.AchIncomeFileTransactionOpenItemReference in project cu-kfs by CU-CommunityApps.
the class AdvanceDepositServiceImpl method addRMRAndNTELinesToNotes.
private List<String> addRMRAndNTELinesToNotes(AchIncomeFileTransaction achIncomeFileTransaction, StringBuilder notes) {
List<String> achNotes = new ArrayList<>();
boolean header = true;
Integer lineCount = 1;
for (AchIncomeFileTransactionOpenItemReference openItemReference : achIncomeFileTransaction.getOpenItemReferences()) {
int leftNoteSize = MAX_NOTE_SIZE - notes.length();
if ((notes.length() >= MAX_NOTE_SIZE) || (leftNoteSize <= MIN_NOTE_SIZE)) {
achNotes.add(notes.toString());
notes = new StringBuilder();
header = true;
}
String type = openItemReference.getType();
if (CuFPConstants.AchIncomeFileTransactionOpenItemReference.RMR_REFERENCE_TYPE_CR.equals(type) || CuFPConstants.AchIncomeFileTransactionOpenItemReference.RMR_REFERENCE_TYPE_IV.equals(type) || CuFPConstants.AchIncomeFileTransactionOpenItemReference.RMR_REFERENCE_TYPE_OI.equals(type)) {
if (header) {
notes.append(StringUtils.rightPad("LINE", CuFPConstants.AchIncomeFileTransactionOpenItemReference.RMR_NOTE_LINE_COLUMN_WIDTH));
notes.append(StringUtils.rightPad("INVOICE NUMBER", CuFPConstants.AchIncomeFileTransactionOpenItemReference.RMR_NOTE_INVOICE_NUMBER_COLUMN_WIDTH));
notes.append(StringUtils.rightPad("NETAMOUNT PAID", CuFPConstants.AchIncomeFileTransactionOpenItemReference.RMR_NOTE_NET_AMOUNT_COLUMN_WIDTH));
notes.append(StringUtils.rightPad("INVOICE AMOUNT", CuFPConstants.AchIncomeFileTransactionOpenItemReference.RMR_NOTE_INVOICE_AMOUNT_COLUMN_WIDTH));
notes.append("\n");
header = false;
}
notes.append(StringUtils.rightPad(getFormattedAmount("00000", lineCount), CuFPConstants.AchIncomeFileTransactionOpenItemReference.RMR_NOTE_LINE_COLUMN_WIDTH));
notes.append(StringUtils.rightPad(openItemReference.getInvoiceNumber(), CuFPConstants.AchIncomeFileTransactionOpenItemReference.RMR_NOTE_INVOICE_NUMBER_COLUMN_WIDTH));
if (openItemReference.getNetAmount() != null) {
notes.append(StringUtils.leftPad(getFormattedAmount("##,##,###.00", openItemReference.getNetAmount()), CuFPConstants.AchIncomeFileTransactionOpenItemReference.RMR_NOTE_NET_AMOUNT_COLUMN_WIDTH));
}
if (openItemReference.getInvoiceAmount() != null) {
notes.append(StringUtils.leftPad(getFormattedAmount("##,##,###.00", openItemReference.getInvoiceAmount()), CuFPConstants.AchIncomeFileTransactionOpenItemReference.RMR_NOTE_INVOICE_AMOUNT_COLUMN_WIDTH));
}
notes.append("\n");
lineCount++;
}
}
List<AchIncomeFileTransactionNote> fileTransactionNotes = achIncomeFileTransaction.getNotes();
for (AchIncomeFileTransactionNote fileTransactionNote : fileTransactionNotes) {
if (fileTransactionNote.getType() != null) {
String nteTxt = fileTransactionNote.getType().toUpperCase() + ": " + fileTransactionNote.getValue();
int notesPlusNoteTxtLength = nteTxt.length() + notes.length();
if (notesPlusNoteTxtLength >= MAX_NOTE_SIZE) {
achNotes.add(notes.toString());
notes = new StringBuilder();
}
notes.append(nteTxt.trim());
notes.append("\n");
}
}
achNotes.add(notes.toString());
return achNotes;
}
use of edu.cornell.kfs.fp.businessobject.AchIncomeFileTransactionOpenItemReference in project cu-kfs by CU-CommunityApps.
the class AchIncomeDelimitedFlatFileSpecificationTest method testParseLineIntoObjectAchIncomeFileTransactionOpenItemReference.
@Test
public void testParseLineIntoObjectAchIncomeFileTransactionOpenItemReference() throws Exception {
AbstractFlatFileObjectSpecification flatFileObjectSpecification = new FlatFilePrefixObjectSpecification();
List<FlatFilePropertySpecification> parseProperties = new ArrayList<>();
setFlatFileProperty(parseProperties, 1, "type");
setFlatFileProperty(parseProperties, 2, "invoiceNumber");
setFlatFileProperty(parseProperties, 4, "netAmount", KualiDecimalFormatter.class);
setFlatFileProperty(parseProperties, 5, "invoiceAmount", KualiDecimalFormatter.class);
flatFileObjectSpecification.setParseProperties(parseProperties);
AchIncomeFileTransactionOpenItemReference achIncomeFileTransactionOpenItemReference = new AchIncomeFileTransactionOpenItemReference();
achIncomeDelimitedFlatFileSpecification.parseLineIntoObject(flatFileObjectSpecification, RMR_LINE, achIncomeFileTransactionOpenItemReference, 1);
assertEquals("IV", achIncomeFileTransactionOpenItemReference.getType());
assertEquals("20", achIncomeFileTransactionOpenItemReference.getInvoiceNumber());
assertEquals(new KualiDecimal("3131.04"), achIncomeFileTransactionOpenItemReference.getNetAmount());
assertEquals(new KualiDecimal("2424.65"), achIncomeFileTransactionOpenItemReference.getInvoiceAmount());
}
use of edu.cornell.kfs.fp.businessobject.AchIncomeFileTransactionOpenItemReference in project cu-kfs by CU-CommunityApps.
the class AdvanceDepositServiceImplTest method setupAchIncomeFilesMissingPayee.
protected List<AchIncomeFile> setupAchIncomeFilesMissingPayee() throws ParseException {
List<AchIncomeFile> achIncomeFiles = new ArrayList<>();
AchIncomeFile achIncomeFile = new AchIncomeFile();
achIncomeFile.setFileDate("160223");
achIncomeFile.setFileTime("2143");
achIncomeFile.setProductionOrTestIndicator("P");
achIncomeFile.setInterchangeControlNumber("000000000");
List<AchIncomeFileGroup> groups = new ArrayList<>();
AchIncomeFileGroup achIncomeFileGroup = new AchIncomeFileGroup();
achIncomeFileGroup.setGroupControlNumber("0");
achIncomeFileGroup.setGroupFunctionIdentifierCode("RA");
List<AchIncomeFileTransactionSet> achIncomeFileTransactionSets = new ArrayList<>();
AchIncomeFileTransactionSet achIncomeFileTransactionSet = new AchIncomeFileTransactionSet();
achIncomeFileTransactionSet.setTransactionSetControlNumber("0001");
AchIncomeFileTransactionSetTrailer achIncomeFileTransactionSetTrailer = new AchIncomeFileTransactionSetTrailer();
achIncomeFileTransactionSetTrailer.setTransactionSetControlNumber("0001");
achIncomeFileTransactionSet.setTransactionSetTrailer(achIncomeFileTransactionSetTrailer);
List<AchIncomeFileTransaction> transactionGuts = new ArrayList<>();
AchIncomeFileTransaction achIncomeFileTransaction = new AchIncomeFileTransaction();
achIncomeFileTransaction.setTransactionAmount(new KualiDecimal("12761.79"));
achIncomeFileTransaction.setCreditDebitIndicator("C");
achIncomeFileTransaction.setCompanyId("1111541330");
achIncomeFileTransaction.setPaymentMethodCode("ACH");
Date expectedDate = new Date(new SimpleDateFormat("yyyyMMdd").parse("20160223").getTime());
achIncomeFileTransaction.setEffectiveDate(expectedDate);
List<AchIncomeFileTransactionOpenItemReference> openItemReferences = new ArrayList<>();
openItemReferences.add(setupOpenItemReference("OI", "71201-16"));
achIncomeFileTransaction.setOpenItemReferences(openItemReferences);
transactionGuts.add(achIncomeFileTransaction);
achIncomeFileTransactionSet.setTransactionGuts(transactionGuts);
achIncomeFileTransactionSets.add(achIncomeFileTransactionSet);
achIncomeFileGroup.setTransactionSets(achIncomeFileTransactionSets);
AchIncomeFileGroupTrailer achIncomeFileGroupTrailer = new AchIncomeFileGroupTrailer();
achIncomeFileGroupTrailer.setGroupControlNumber("0");
achIncomeFileGroupTrailer.setTotalTransactionSets(1);
achIncomeFileGroup.setGroupTrailer(achIncomeFileGroupTrailer);
groups.add(achIncomeFileGroup);
achIncomeFile.setGroups(groups);
AchIncomeFileTrailer achIncomeFileTrailer = new AchIncomeFileTrailer();
achIncomeFileTrailer.setInterchangeControlNumber("000000000");
achIncomeFileTrailer.setTotalGroups(1);
achIncomeFile.setTrailer(achIncomeFileTrailer);
achIncomeFiles.add(achIncomeFile);
return achIncomeFiles;
}
Aggregations