Search in sources :

Example 1 with AchIncomeFileTransactionOpenItemReference

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;
}
Also used : AchIncomeFileTransactionOpenItemReference(edu.cornell.kfs.fp.businessobject.AchIncomeFileTransactionOpenItemReference) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal)

Example 2 with AchIncomeFileTransactionOpenItemReference

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;
}
Also used : AchIncomeFileTransactionOpenItemReference(edu.cornell.kfs.fp.businessobject.AchIncomeFileTransactionOpenItemReference) AchIncomeFileTransactionNote(edu.cornell.kfs.fp.businessobject.AchIncomeFileTransactionNote) ArrayList(java.util.ArrayList)

Example 3 with AchIncomeFileTransactionOpenItemReference

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());
}
Also used : AchIncomeFileTransactionOpenItemReference(edu.cornell.kfs.fp.businessobject.AchIncomeFileTransactionOpenItemReference) FlatFilePrefixObjectSpecification(org.kuali.kfs.sys.batch.FlatFilePrefixObjectSpecification) ArrayList(java.util.ArrayList) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) FlatFilePropertySpecification(org.kuali.kfs.sys.batch.FlatFilePropertySpecification) DelimitedFlatFilePropertySpecification(org.kuali.kfs.sys.batch.DelimitedFlatFilePropertySpecification) AbstractFlatFileObjectSpecification(org.kuali.kfs.sys.batch.AbstractFlatFileObjectSpecification) Test(org.junit.Test)

Example 4 with AchIncomeFileTransactionOpenItemReference

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;
}
Also used : AchIncomeFileTransaction(edu.cornell.kfs.fp.businessobject.AchIncomeFileTransaction) AchIncomeFileTransactionSetTrailer(edu.cornell.kfs.fp.businessobject.AchIncomeFileTransactionSetTrailer) AchIncomeFileGroup(edu.cornell.kfs.fp.businessobject.AchIncomeFileGroup) ArrayList(java.util.ArrayList) AchIncomeFileGroupTrailer(edu.cornell.kfs.fp.businessobject.AchIncomeFileGroupTrailer) Date(java.sql.Date) AchIncomeFileTransactionOpenItemReference(edu.cornell.kfs.fp.businessobject.AchIncomeFileTransactionOpenItemReference) AchIncomeFileTrailer(edu.cornell.kfs.fp.businessobject.AchIncomeFileTrailer) AchIncomeFileTransactionSet(edu.cornell.kfs.fp.businessobject.AchIncomeFileTransactionSet) AchIncomeFile(edu.cornell.kfs.fp.businessobject.AchIncomeFile) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

AchIncomeFileTransactionOpenItemReference (edu.cornell.kfs.fp.businessobject.AchIncomeFileTransactionOpenItemReference)4 ArrayList (java.util.ArrayList)3 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)3 AchIncomeFile (edu.cornell.kfs.fp.businessobject.AchIncomeFile)1 AchIncomeFileGroup (edu.cornell.kfs.fp.businessobject.AchIncomeFileGroup)1 AchIncomeFileGroupTrailer (edu.cornell.kfs.fp.businessobject.AchIncomeFileGroupTrailer)1 AchIncomeFileTrailer (edu.cornell.kfs.fp.businessobject.AchIncomeFileTrailer)1 AchIncomeFileTransaction (edu.cornell.kfs.fp.businessobject.AchIncomeFileTransaction)1 AchIncomeFileTransactionNote (edu.cornell.kfs.fp.businessobject.AchIncomeFileTransactionNote)1 AchIncomeFileTransactionSet (edu.cornell.kfs.fp.businessobject.AchIncomeFileTransactionSet)1 AchIncomeFileTransactionSetTrailer (edu.cornell.kfs.fp.businessobject.AchIncomeFileTransactionSetTrailer)1 Date (java.sql.Date)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Test (org.junit.Test)1 AbstractFlatFileObjectSpecification (org.kuali.kfs.sys.batch.AbstractFlatFileObjectSpecification)1 DelimitedFlatFilePropertySpecification (org.kuali.kfs.sys.batch.DelimitedFlatFilePropertySpecification)1 FlatFilePrefixObjectSpecification (org.kuali.kfs.sys.batch.FlatFilePrefixObjectSpecification)1 FlatFilePropertySpecification (org.kuali.kfs.sys.batch.FlatFilePropertySpecification)1