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);
}
}
}
}
}
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());
}
}
}
}
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();
}
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());
}
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);
}
Aggregations