Search in sources :

Example 1 with AchIncomeFileTransaction

use of edu.cornell.kfs.fp.businessobject.AchIncomeFileTransaction in project cu-kfs by CU-CommunityApps.

the class AdvanceDepositServiceImpl method setAchTransactions.

protected void setAchTransactions(AchIncomeFile achIncomeFile, List achIncomeTransactions) {
    Timestamp bankTimestamp = getFormattedTimestamp(achIncomeFile, "fileDate/time");
    for (AchIncomeFileGroup achIncomeFileGroup : achIncomeFile.getGroups()) {
        for (AchIncomeFileTransactionSet achIncomeFileTransactionSet : achIncomeFileGroup.getTransactionSets()) {
            for (AchIncomeFileTransaction achIncomeFileTransaction : achIncomeFileTransactionSet.getTransactionGuts()) {
                if (KFSConstants.GL_CREDIT_CODE.equals(achIncomeFileTransaction.getCreditDebitIndicator())) {
                    AchIncomeTransaction achIncomeTransaction = new AchIncomeTransaction();
                    achIncomeTransaction.setPaymentMethodCode(achIncomeFileTransaction.getPaymentMethodCode());
                    achIncomeTransaction.setEffectiveDate(achIncomeFileTransaction.getEffectiveDate());
                    achIncomeTransaction.setLoadTimestamp(dateTimeService.getCurrentTimestamp());
                    achIncomeTransaction.setBankTimestamp(bankTimestamp);
                    achIncomeTransaction.setTransactionAmount(achIncomeFileTransaction.getTransactionAmount());
                    achIncomeTransaction.setPayerName(truncatePayerNameIfNecessary(achIncomeFileTransaction));
                    achIncomeTransaction.setNotes(createNotes(achIncomeFileTransaction));
                    achIncomeTransactions.add(achIncomeTransaction);
                }
            }
        }
    }
}
Also used : AchIncomeFileTransaction(edu.cornell.kfs.fp.businessobject.AchIncomeFileTransaction) AchIncomeTransaction(edu.cornell.kfs.fp.businessobject.AchIncomeTransaction) AchIncomeFileGroup(edu.cornell.kfs.fp.businessobject.AchIncomeFileGroup) AchIncomeFileTransactionSet(edu.cornell.kfs.fp.businessobject.AchIncomeFileTransactionSet) Timestamp(java.sql.Timestamp)

Example 2 with AchIncomeFileTransaction

use of edu.cornell.kfs.fp.businessobject.AchIncomeFileTransaction in project cu-kfs by CU-CommunityApps.

the class AdvanceDepositServiceImpl method setAchIncomeTransactionCountsAndAmounts.

private void setAchIncomeTransactionCountsAndAmounts(List<AchIncomeFileTransaction> achIncomeFileTransaction) {
    for (AchIncomeFileTransaction transaction : achIncomeFileTransaction) {
        boolean isSkippedTransaction = false;
        if (KFSConstants.GL_DEBIT_CODE.equals(transaction.getCreditDebitIndicator())) {
            isSkippedTransaction = true;
        }
        if (CuFPConstants.AchIncomeFileTransaction.TRANS_PAYMENT_METHOD_ACH.equals(transaction.getPaymentMethodCode())) {
            if (isSkippedTransaction) {
                achTotalSkippedTransactions++;
                achTotalSkippedTransactionAmount = achTotalSkippedTransactionAmount.add(transaction.getTransactionAmount());
            } else {
                achTotalPostedTransactions++;
                achTotalPostedTransactionAmount = achTotalPostedTransactionAmount.add(transaction.getTransactionAmount());
            }
        } else if (CuFPConstants.AchIncomeFileTransaction.TRANS_PAYMENT_METHOD_FWT.equals(transaction.getPaymentMethodCode())) {
            if (isSkippedTransaction) {
                wiredTotalSkippedTransactions++;
                wiredTotalSkippedTransactionAmount = wiredTotalSkippedTransactionAmount.add(transaction.getTransactionAmount());
            } else {
                wiredTotalPostedTransactions++;
                wiredTotalPostedTransactionAmount = wiredTotalPostedTransactionAmount.add(transaction.getTransactionAmount());
            }
        }
    }
}
Also used : AchIncomeFileTransaction(edu.cornell.kfs.fp.businessobject.AchIncomeFileTransaction)

Example 3 with AchIncomeFileTransaction

use of edu.cornell.kfs.fp.businessobject.AchIncomeFileTransaction in project cu-kfs by CU-CommunityApps.

the class AdvanceDepositServiceImpl method validatePayerName.

private String validatePayerName(List<AchIncomeFileTransaction> achIncomeFileTransaction) {
    StringBuilder payerMessage = new StringBuilder();
    for (AchIncomeFileTransaction transaction : achIncomeFileTransaction) {
        if (StringUtils.equals(CuFPConstants.AchIncomeFileTransaction.PAYER_NOT_IDENTIFIED, transaction.getPayerName())) {
            payerMessage.append("Payer Name was not found for transaction amount $" + getFormattedAmount("##,##,##0.00", transaction.getTransactionAmount()));
            payerMessage.append(" [Date: ");
            payerMessage.append(transaction.getEffectiveDate());
            payerMessage.append("]");
            payerMessage.append("\n");
        }
    }
    return payerMessage.toString();
}
Also used : AchIncomeFileTransaction(edu.cornell.kfs.fp.businessobject.AchIncomeFileTransaction)

Example 4 with AchIncomeFileTransaction

use of edu.cornell.kfs.fp.businessobject.AchIncomeFileTransaction in project cu-kfs by CU-CommunityApps.

the class AchIncomeDelimitedFlatFileSpecificationTest method testParseLineIntoObjectAchIncomeFileTransactionWithDate.

@Test
public void testParseLineIntoObjectAchIncomeFileTransactionWithDate() throws Exception {
    AbstractFlatFileObjectSpecification flatFileObjectSpecification = new FlatFilePrefixObjectSpecification();
    List<FlatFilePropertySpecification> parseProperties = new ArrayList<>();
    setFlatFileProperty(parseProperties, 2, "transactionAmount", KualiDecimalFormatter.class);
    setFlatFileProperty(parseProperties, 3, "creditDebitIndicator");
    setFlatFileProperty(parseProperties, 4, "paymentMethodCode");
    setFlatFileProperty(parseProperties, 16, "effectiveDate", BatchDateFormatter.class, DATE_FORMAT);
    setFlatFileProperty(parseProperties, 10, "companyId");
    flatFileObjectSpecification.setParseProperties(parseProperties);
    AchIncomeFileTransaction achIncomeFileTransaction = new AchIncomeFileTransaction();
    achIncomeDelimitedFlatFileSpecification.parseLineIntoObject(flatFileObjectSpecification, BPR_LINE2, achIncomeFileTransaction, 1);
    Date expectedDate = new SimpleDateFormat(DATE_FORMAT).parse("20160223");
    assertEquals(new KualiDecimal("3131.04"), achIncomeFileTransaction.getTransactionAmount());
    assertEquals("C", achIncomeFileTransaction.getCreditDebitIndicator());
    assertEquals("ACH", achIncomeFileTransaction.getPaymentMethodCode());
    assertEquals(expectedDate, achIncomeFileTransaction.getEffectiveDate());
    assertEquals("3041036004", achIncomeFileTransaction.getCompanyId());
}
Also used : AchIncomeFileTransaction(edu.cornell.kfs.fp.businessobject.AchIncomeFileTransaction) 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) SimpleDateFormat(java.text.SimpleDateFormat) AbstractFlatFileObjectSpecification(org.kuali.kfs.sys.batch.AbstractFlatFileObjectSpecification) Date(java.util.Date) Test(org.junit.Test)

Example 5 with AchIncomeFileTransaction

use of edu.cornell.kfs.fp.businessobject.AchIncomeFileTransaction in project cu-kfs by CU-CommunityApps.

the class AdvanceDepositServiceImplTest method testTruncatePayerNameIfNecessary.

@Test
public void testTruncatePayerNameIfNecessary() {
    AchIncomeFileTransaction achIncomeFileTransaction = new AchIncomeFileTransaction();
    achIncomeFileTransaction.setPayerOrPayees(setupPayerAndPayee("THIS NAME IS TOO LONG BECAUSE IT IS LONGER THAN 40 CHARACTERS"));
    String payerName = advanceDepositService.truncatePayerNameIfNecessary(achIncomeFileTransaction);
    assertEquals("name wasn't truncated as expected?", "THIS NAME IS TOO LONG BECAUSE IT IS LONG", payerName);
}
Also used : AchIncomeFileTransaction(edu.cornell.kfs.fp.businessobject.AchIncomeFileTransaction) Test(org.junit.Test)

Aggregations

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