use of edu.cornell.kfs.pdp.businessobject.PayeeACHAccountExtractDetail in project cu-kfs by CU-CommunityApps.
the class PayeeACHAccountExtractCsvBuilder method buildACHDetailFromDataMap.
private static PayeeACHAccountExtractDetail buildACHDetailFromDataMap(Map<String, String> rowDataMap) {
PayeeACHAccountExtractDetail achDetail = new PayeeACHAccountExtractDetail();
// Use toString() instead of name() to get the column values, due to column naming customizations for this case.
achDetail.setEmployeeID(rowDataMap.get(PayeeACHAccountExtractCsv.EMPL_ID.toString()));
achDetail.setNetID(rowDataMap.get(PayeeACHAccountExtractCsv.NET_ID.toString()));
achDetail.setLastName(rowDataMap.get(PayeeACHAccountExtractCsv.LAST_NAME.toString()));
achDetail.setFirstName(rowDataMap.get(PayeeACHAccountExtractCsv.FIRST_NAME.toString()));
achDetail.setPaymentType(rowDataMap.get(PayeeACHAccountExtractCsv.PAYMENT_TYPE.toString()));
achDetail.setBalanceAccount(rowDataMap.get(PayeeACHAccountExtractCsv.BALANCE_ACCT_.toString()));
achDetail.setCompletedDate(rowDataMap.get(PayeeACHAccountExtractCsv.COMPLETE_DT.toString()));
achDetail.setBankName(rowDataMap.get(PayeeACHAccountExtractCsv.BANK_NAME.toString()));
achDetail.setBankRoutingNumber(rowDataMap.get(PayeeACHAccountExtractCsv.ROUTING_NO.toString()));
achDetail.setBankAccountNumber(rowDataMap.get(PayeeACHAccountExtractCsv.ACCOUNT_NO.toString()));
achDetail.setBankAccountType(rowDataMap.get(PayeeACHAccountExtractCsv.ACCOUNT_TYPE.toString()));
return achDetail;
}
use of edu.cornell.kfs.pdp.businessobject.PayeeACHAccountExtractDetail in project cu-kfs by CU-CommunityApps.
the class PayeeACHAccountExtractServiceImpl method loadACHBatchDetailFile.
/**
* Processes a single ACH input file.
*/
// Portions of this method are based on the code and logic from CustomerLoadServiceImpl.loadFile
protected List<String> loadACHBatchDetailFile(String inputFileName, BatchInputFileType batchInputFileType) {
List<String> failedRowsErrors = new ArrayList();
byte[] fileByteContent = safelyLoadFileBytes(inputFileName);
LOG.info("loadACHBatchDetailFile: Attempting to parse the file.");
Object parsedObject = null;
try {
parsedObject = batchInputFileService.parse(batchInputFileType, fileByteContent);
} catch (ParseException e) {
String errorMessage = "loadACHBatchDetailFile: Error parsing batch file: " + e.getMessage();
LOG.error(errorMessage, e);
throw new RuntimeException(errorMessage);
}
if (!(parsedObject instanceof List)) {
String errorMessage = "loadACHBatchDetailFile: Parsed file was not of the expected type. Expected [" + List.class + "] but got [" + parsedObject.getClass() + "].";
criticalError(errorMessage);
}
List<PayeeACHAccountExtractDetail> achDetails = (List<PayeeACHAccountExtractDetail>) parsedObject;
for (PayeeACHAccountExtractDetail achDetail : achDetails) {
String error = processACHBatchDetail(achDetail);
if (StringUtils.isNotBlank(error)) {
failedRowsErrors.add(error);
}
}
return failedRowsErrors;
}
use of edu.cornell.kfs.pdp.businessobject.PayeeACHAccountExtractDetail in project cu-kfs by CU-CommunityApps.
the class PayeeACHAccountExtractServiceImplTest method assertExtractedDetailsAreCorrect.
private void assertExtractedDetailsAreCorrect(List<PayeeACHAccountExtractDetail> expectedSuccessfulDetails, List<PayeeACHAccountExtractDetail> actualSuccessfulDetails) throws Exception {
assertEquals("Wrong number of payee details processed", expectedSuccessfulDetails.size(), actualSuccessfulDetails.size());
for (int i = 0; i < expectedSuccessfulDetails.size(); i++) {
PayeeACHAccountExtractDetail expectedDetail = expectedSuccessfulDetails.get(i);
PayeeACHAccountExtractDetail actualDetail = actualSuccessfulDetails.get(i);
assertEquals("Wrong payment detail employee ID", expectedDetail.getEmployeeID(), actualDetail.getEmployeeID());
assertEquals("Wrong payment detail netID", expectedDetail.getNetID(), actualDetail.getNetID());
assertEquals("Wrong payment detail last name", expectedDetail.getLastName(), actualDetail.getLastName());
assertEquals("Wrong payment detail first name", expectedDetail.getFirstName(), actualDetail.getFirstName());
assertEquals("Wrong payment detail payment type", expectedDetail.getPaymentType(), actualDetail.getPaymentType());
assertEquals("Wrong payment detail balance account indicator", expectedDetail.getBalanceAccount(), actualDetail.getBalanceAccount());
assertEquals("Wrong payment detail routing number", expectedDetail.getBankRoutingNumber(), actualDetail.getBankRoutingNumber());
assertEquals("Wrong payment detail account number", expectedDetail.getBankAccountNumber(), actualDetail.getBankAccountNumber());
assertEquals("Wrong payment detail account type", expectedDetail.getBankAccountType(), actualDetail.getBankAccountType());
}
}
use of edu.cornell.kfs.pdp.businessobject.PayeeACHAccountExtractDetail in project cu-kfs by CU-CommunityApps.
the class PayeeACHAccountExtractServiceImplTest method getExpectedExtractDetailForAlternateTestAccount.
private PayeeACHAccountExtractDetail getExpectedExtractDetailForAlternateTestAccount() {
PayeeACHAccountExtractDetail detail = new PayeeACHAccountExtractDetail();
detail.setEmployeeID(TEST_ALT_EMPLOYEEID);
detail.setNetID(TEST_ALT_PRINCIPALNAME);
detail.setLastName(StringUtils.substringBefore(TEST_ALT_NAME, ","));
detail.setFirstName(StringUtils.substringAfter(TEST_ALT_NAME, ", "));
detail.setPaymentType(CUPdpConstants.PAYEE_ACH_ACCOUNT_EXTRACT_DIRECT_DEPOSIT_PAYMENT_TYPE);
detail.setBalanceAccount(CUPdpConstants.PAYEE_ACH_ACCOUNT_EXTRACT_BALANCE_ACCOUNT_YES_INDICATOR);
detail.setCompletedDate(COMPLETED_DATE_FROM_TEST_FILES);
detail.setBankName(TEST_ALT_BANK_NAME);
detail.setBankRoutingNumber(TEST_ALT_BANK_ROUTING_NUMBER);
detail.setBankAccountNumber(TEST_ALT_ACCOUNT_NUMBER);
detail.setBankAccountType(TEST_ALT_BANK_ACCOUNT_TYPE);
return detail;
}
use of edu.cornell.kfs.pdp.businessobject.PayeeACHAccountExtractDetail in project cu-kfs by CU-CommunityApps.
the class PayeeACHAccountExtractServiceImplTest method getExpectedExtractDetailForTestAccount.
private PayeeACHAccountExtractDetail getExpectedExtractDetailForTestAccount() {
PayeeACHAccountExtractDetail detail = new PayeeACHAccountExtractDetail();
detail.setEmployeeID(TEST_EMPLOYEEID);
detail.setNetID(TEST_PRINCIPALNAME);
detail.setLastName(StringUtils.substringBefore(TEST_NAME, ","));
detail.setFirstName(StringUtils.substringBetween(TEST_NAME, ", ", " "));
detail.setPaymentType(CUPdpConstants.PAYEE_ACH_ACCOUNT_EXTRACT_DIRECT_DEPOSIT_PAYMENT_TYPE);
detail.setBalanceAccount(CUPdpConstants.PAYEE_ACH_ACCOUNT_EXTRACT_BALANCE_ACCOUNT_YES_INDICATOR);
detail.setCompletedDate(COMPLETED_DATE_FROM_TEST_FILES);
detail.setBankName(TEST_BANK_NAME);
detail.setBankRoutingNumber(TEST_BANK_ROUTING_NUMBER);
detail.setBankAccountNumber(TEST_ACCOUNT_NUMBER);
detail.setBankAccountType(TEST_BANK_ACCOUNT_TYPE);
return detail;
}
Aggregations