Search in sources :

Example 1 with PayeeACHAccountMaintainableImpl

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;
}
Also used : PayeeACHAccountMaintainableImpl(org.kuali.kfs.pdp.document.PayeeACHAccountMaintainableImpl) MaintenanceDocument(org.kuali.kfs.krad.maintenance.MaintenanceDocument) PayeeACHAccount(org.kuali.kfs.pdp.businessobject.PayeeACHAccount) KualiInteger(org.kuali.rice.core.api.util.type.KualiInteger) PayeeACHAccountExtractStep(edu.cornell.kfs.pdp.batch.PayeeACHAccountExtractStep) ValidationException(org.kuali.kfs.krad.exception.ValidationException) MessagingException(javax.mail.MessagingException) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) FileNotFoundException(java.io.FileNotFoundException) InvalidAddressException(org.kuali.kfs.krad.exception.InvalidAddressException) IOException(java.io.IOException) ParseException(org.kuali.kfs.sys.exception.ParseException)

Example 2 with PayeeACHAccountMaintainableImpl

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;
}
Also used : PayeeACHAccountMaintainableImpl(org.kuali.kfs.pdp.document.PayeeACHAccountMaintainableImpl) FinancialSystemMaintainable(org.kuali.kfs.sys.document.FinancialSystemMaintainable) PayeeACHAccount(org.kuali.kfs.pdp.businessobject.PayeeACHAccount)

Aggregations

PayeeACHAccount (org.kuali.kfs.pdp.businessobject.PayeeACHAccount)2 PayeeACHAccountMaintainableImpl (org.kuali.kfs.pdp.document.PayeeACHAccountMaintainableImpl)2 PayeeACHAccountExtractStep (edu.cornell.kfs.pdp.batch.PayeeACHAccountExtractStep)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 MessagingException (javax.mail.MessagingException)1 InvalidAddressException (org.kuali.kfs.krad.exception.InvalidAddressException)1 ValidationException (org.kuali.kfs.krad.exception.ValidationException)1 MaintenanceDocument (org.kuali.kfs.krad.maintenance.MaintenanceDocument)1 FinancialSystemMaintainable (org.kuali.kfs.sys.document.FinancialSystemMaintainable)1 ParseException (org.kuali.kfs.sys.exception.ParseException)1 KualiInteger (org.kuali.rice.core.api.util.type.KualiInteger)1 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)1