use of org.kuali.kfs.pdp.document.PayeeACHAccountMaintainableImpl in project cu-kfs by CU-CommunityApps.
the class PayeeACHAccountExtractServiceImpl method addACHAccount.
/**
* Creates and routes a PAAT document to create a new ACH Account of the given payee type.
*/
protected String addACHAccount(Person payee, PayeeACHAccountExtractDetail achDetail, String payeeType) {
// Create and route a new PAAT (Payee ACH Account Maintenance) document.
String processingError = null;
try {
// Create document and set description.
MaintenanceDocument paatDocument = (MaintenanceDocument) documentService.getNewDocument(CUPdpConstants.PAYEE_ACH_ACCOUNT_EXTRACT_MAINT_DOC_TYPE);
paatDocument.getDocumentHeader().setDocumentDescription(getDocumentDescription(payee, PayeeIdTypeCodes.ENTITY.equals(payeeType), true));
// Configure as "New" maintenance and get maintained object.
PayeeACHAccountMaintainableImpl maintainable = (PayeeACHAccountMaintainableImpl) paatDocument.getNewMaintainableObject();
maintainable.setMaintenanceAction(KFSConstants.MAINTENANCE_NEW_ACTION);
PayeeACHAccount achAccount = (PayeeACHAccount) maintainable.getDataObject();
// Setup payee ID and type.
if (PayeeIdTypeCodes.ENTITY.equals(payeeType)) {
achAccount.setPayeeIdNumber(payee.getEntityId());
} else if (PayeeIdTypeCodes.EMPLOYEE.equals(payeeType)) {
achAccount.setPayeeIdNumber(payee.getEmployeeId());
} else {
processingError = new String("addACHAccount: " + achDetail.getLogData() + ": Unexpected payee ID type '" + payeeType + "' for automated Payee during ACH Account creation attempt.");
LOG.error(processingError);
return processingError;
}
achAccount.setPayeeIdentifierTypeCode(payeeType);
// Setup other fields.
achAccount.setAchAccountGeneratedIdentifier(new KualiInteger(sequenceAccessorService.getNextAvailableSequenceNumber(PdpConstants.ACH_ACCOUNT_IDENTIFIER_SEQUENCE_NAME)));
achAccount.setAchTransactionType(getDirectDepositTransactionType());
achAccount.setBankRoutingNumber(achDetail.getBankRoutingNumber());
achAccount.setBankAccountNumber(achDetail.getBankAccountNumber());
achAccount.setBankAccountTypeCode(getACHTransactionCode(achDetail.getBankAccountType()));
if (StringUtils.isNotBlank(payee.getNameUnmasked())) {
achAccount.setPayeeName(payee.getNameUnmasked());
}
if (StringUtils.isNotBlank(payee.getEmailAddressUnmasked())) {
achAccount.setPayeeEmailAddress(payee.getEmailAddressUnmasked());
}
achAccount.setActive(true);
// Add a note indicating that this document was generated by a batch process.
addNote(paatDocument, parameterService.getParameterValueAsString(PayeeACHAccountExtractStep.class, CUPdpParameterConstants.GENERATED_PAYEE_ACH_ACCOUNT_DOC_NOTE_TEXT));
// Route the document and send notifications.
paatDocument = (MaintenanceDocument) documentService.routeDocument(paatDocument, KFSConstants.EMPTY_STRING, null);
sendPayeeACHAccountAddOrUpdateEmail((PayeeACHAccount) paatDocument.getNewMaintainableObject().getDataObject(), payee, getPayeeACHAccountAddOrUpdateEmailSubject(true), getUnresolvedPayeeACHAccountAddOrUpdateEmailBody(true));
} catch (Exception e) {
LOG.error("addACHAccount STE " + e.getStackTrace() + e.toString());
LOG.error(getFailRequestMessage(e));
processingError = new String("addACHAccount: " + achDetail.getLogData() + " STE was generated. " + getFailRequestMessage(e));
}
return processingError;
}
use of org.kuali.kfs.pdp.document.PayeeACHAccountMaintainableImpl in project cu-kfs by CU-CommunityApps.
the class PayeeACHAccountExtractServiceImplTest method createNewMaintainableForPAAT.
private FinancialSystemMaintainable createNewMaintainableForPAAT() {
FinancialSystemMaintainable maintainable = new PayeeACHAccountMaintainableImpl();
maintainable.setBoClass(PayeeACHAccount.class);
maintainable.setDataObject(new PayeeACHAccount());
return maintainable;
}
Aggregations