use of org.kuali.kfs.pdp.businessobject.PayeeACHAccount 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.businessobject.PayeeACHAccount in project cu-kfs by CU-CommunityApps.
the class CuFormatServiceImpl method populateDisbursementType.
/**
* This method sets the appropriate disbursement type on the Payment Group to either ACH or CHCK.
*
* @param paymentGroup
*/
protected void populateDisbursementType(PaymentGroup paymentGroup) {
DisbursementType disbursementType = null;
if (paymentGroup.isPayableByCheck()) {
disbursementType = (DisbursementType) businessObjectService.findBySinglePrimaryKey(DisbursementType.class, PdpConstants.DisbursementTypeCodes.CHECK);
paymentGroup.setDisbursementType(disbursementType);
paymentGroup.setDisbursementTypeCode(PdpConstants.DisbursementTypeCodes.CHECK);
} else {
disbursementType = (DisbursementType) businessObjectService.findBySinglePrimaryKey(DisbursementType.class, PdpConstants.DisbursementTypeCodes.ACH);
paymentGroup.setDisbursementType(disbursementType);
paymentGroup.setDisbursementTypeCode(PdpConstants.DisbursementTypeCodes.ACH);
CustomerProfile customer = paymentGroup.getBatch().getCustomerProfile();
PayeeACHAccount payeeAchAccount = SpringContext.getBean(AchService.class).getAchInformation(paymentGroup.getPayeeIdTypeCd(), paymentGroup.getPayeeId(), customer.getAchTransactionType());
paymentGroup.setAchBankRoutingNbr(payeeAchAccount.getBankRoutingNumber());
paymentGroup.setAdviceEmailAddress(payeeAchAccount.getPayeeEmailAddress());
paymentGroup.setAchAccountType(payeeAchAccount.getBankAccountTypeCode());
AchAccountNumber achAccountNumber = new AchAccountNumber();
achAccountNumber.setAchBankAccountNbr(payeeAchAccount.getBankAccountNumber());
achAccountNumber.setId(paymentGroup.getId());
paymentGroup.setAchAccountNumber(achAccountNumber);
}
}
use of org.kuali.kfs.pdp.businessobject.PayeeACHAccount in project cu-kfs by CU-CommunityApps.
the class CuPayeeACHAccountMaintainableImpl method refresh.
@Override
public void refresh(String refreshCaller, Map fieldValues, MaintenanceDocument document) {
super.refresh(refreshCaller, fieldValues, document);
if (StringUtils.isNotEmpty(refreshCaller) && refreshCaller.equalsIgnoreCase("achPayeeLookupable")) {
PayeeACHAccount payeeAchAccount = (PayeeACHAccount) document.getNewMaintainableObject().getBusinessObject();
String payeeIdNumber = payeeAchAccount.getPayeeIdNumber();
String payeeIdentifierTypeCode = payeeAchAccount.getPayeeIdentifierTypeCode();
if (StringUtils.isNotEmpty(payeeAchAccount.getPayeeIdNumber())) {
// for Employee, retrieve from Person table by employee ID
if (StringUtils.equalsIgnoreCase(payeeIdentifierTypeCode, PayeeIdTypeCodes.EMPLOYEE)) {
Person person = SpringContext.getBean(PersonService.class).getPersonByEmployeeId(payeeIdNumber);
if (ObjectUtils.isNotNull(person)) {
payeeAchAccount.setPayeeEmailAddress(person.getEmailAddress());
}
} else // for Entity, retrieve from Entity table by entity ID then from Person table
if (StringUtils.equalsIgnoreCase(payeeIdentifierTypeCode, PayeeIdTypeCodes.ENTITY)) {
if (ObjectUtils.isNotNull(payeeIdNumber)) {
EntityDefault entity = KimApiServiceLocator.getIdentityService().getEntityDefault(payeeIdNumber);
if (ObjectUtils.isNotNull(entity)) {
List<Principal> principals = entity.getPrincipals();
if (principals.size() > 0 && ObjectUtils.isNotNull(principals.get(0))) {
String principalId = principals.get(0).getPrincipalId();
Person person = SpringContext.getBean(PersonService.class).getPerson(principalId);
if (ObjectUtils.isNotNull(person)) {
payeeAchAccount.setPayeeEmailAddress(person.getEmailAddress());
}
}
}
}
}
}
}
}
use of org.kuali.kfs.pdp.businessobject.PayeeACHAccount in project cu-kfs by CU-CommunityApps.
the class CuPayeeACHAccountMaintenanceDocumentPresentationController method getConditionallyReadOnlyPropertyNames.
/**
* Adds the payeeEmailAddress field as readOnly if payee type is Employee or Entity.
* @see org.kuali.kfs.kns.document.authorization.MaintenanceDocumentPresentationControllerBase#getConditionallyReadOnlyPropertyNames(org.kuali.kfs.kns.document.MaintenanceDocument)
*/
@Override
public Set<String> getConditionallyReadOnlyPropertyNames(MaintenanceDocument document) {
Set<String> readOnlyPropertyNames = super.getConditionallyReadOnlyPropertyNames(document);
PayeeACHAccount payeeAccount = (PayeeACHAccount) document.getNewMaintainableObject().getBusinessObject();
String payeeIdTypeCode = payeeAccount.getPayeeIdentifierTypeCode();
// make name and email address readOnly if payee type is Employee or Entity
if (StringUtils.equalsIgnoreCase(payeeIdTypeCode, PayeeIdTypeCodes.EMPLOYEE) || StringUtils.equalsIgnoreCase(payeeIdTypeCode, PayeeIdTypeCodes.ENTITY)) {
if (readOnlyPropertyNames.contains(PdpPropertyConstants.PAYEE_EMAIL_ADDRESS)) {
readOnlyPropertyNames.remove(PdpPropertyConstants.PAYEE_EMAIL_ADDRESS);
}
}
return readOnlyPropertyNames;
}
use of org.kuali.kfs.pdp.businessobject.PayeeACHAccount 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