Search in sources :

Example 6 with CustomerProfile

use of org.kuali.kfs.pdp.businessobject.CustomerProfile 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);
    }
}
Also used : AchAccountNumber(org.kuali.kfs.pdp.businessobject.AchAccountNumber) PayeeACHAccount(org.kuali.kfs.pdp.businessobject.PayeeACHAccount) DisbursementType(org.kuali.kfs.pdp.businessobject.DisbursementType) CustomerProfile(org.kuali.kfs.pdp.businessobject.CustomerProfile) AchService(org.kuali.kfs.pdp.service.AchService)

Example 7 with CustomerProfile

use of org.kuali.kfs.pdp.businessobject.CustomerProfile in project cu-kfs by CU-CommunityApps.

the class CuFormatAction method prepare.

@Override
public ActionForward prepare(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    CuFormatForm formatForm = (CuFormatForm) form;
    DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class);
    if (formatForm.getCampus() == null) {
        return mapping.findForward(PdpConstants.MAPPING_SELECTION);
    }
    // Figure out which ones they have selected
    List selectedCustomers = new ArrayList();
    for (CustomerProfile customer : formatForm.getCustomers()) {
        if (customer.isSelectedForFormat()) {
            selectedCustomers.add(customer);
        }
    }
    Date paymentDate = dateTimeService.convertToSqlDate(formatForm.getPaymentDate());
    Person kualiUser = GlobalVariables.getUserSession().getPerson();
    FormatProcessSummary formatProcessSummary = ((CuFormatService) formatService).startFormatProcess(kualiUser, formatForm.getCampus(), selectedCustomers, paymentDate, formatForm.getPaymentTypes(), formatForm.getPaymentDistribution());
    if (formatProcessSummary.getProcessSummaryList().size() == 0) {
        KNSGlobalVariables.getMessageList().add(PdpKeyConstants.Format.ERROR_PDP_NO_MATCHING_PAYMENT_FOR_FORMAT);
        return mapping.findForward(PdpConstants.MAPPING_SELECTION);
    }
    formatForm.setFormatProcessSummary(formatProcessSummary);
    return mapping.findForward(PdpConstants.MAPPING_CONTINUE);
}
Also used : FormatProcessSummary(org.kuali.kfs.pdp.businessobject.FormatProcessSummary) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) CustomerProfile(org.kuali.kfs.pdp.businessobject.CustomerProfile) DateTimeService(org.kuali.rice.core.api.datetime.DateTimeService) Person(org.kuali.rice.kim.api.identity.Person) Date(java.util.Date) CuFormatService(edu.cornell.kfs.pdp.service.CuFormatService)

Example 8 with CustomerProfile

use of org.kuali.kfs.pdp.businessobject.CustomerProfile in project cu-kfs by CU-CommunityApps.

the class FormatAction method prepare.

/**
 * This method marks the payments for format
 *
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return
 * @throws Exception
 */
public ActionForward prepare(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    FormatForm formatForm = (FormatForm) form;
    DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class);
    if (formatForm.getCampus() == null) {
        return mapping.findForward(PdpConstants.MAPPING_SELECTION);
    }
    // Figure out which ones they have selected
    List selectedCustomers = new ArrayList();
    for (CustomerProfile customer : formatForm.getCustomers()) {
        if (customer.isSelectedForFormat()) {
            selectedCustomers.add(customer);
        }
    }
    Date paymentDate = dateTimeService.convertToSqlDate(formatForm.getPaymentDate());
    Person kualiUser = GlobalVariables.getUserSession().getPerson();
    FormatProcessSummary formatProcessSummary = formatService.startFormatProcess(kualiUser, formatForm.getCampus(), selectedCustomers, paymentDate, formatForm.getPaymentTypes());
    if (formatProcessSummary.getProcessSummaryList().size() == 0) {
        KNSGlobalVariables.getMessageList().add(PdpKeyConstants.Format.ERROR_PDP_NO_MATCHING_PAYMENT_FOR_FORMAT);
        return mapping.findForward(PdpConstants.MAPPING_SELECTION);
    }
    formatForm.setFormatProcessSummary(formatProcessSummary);
    return mapping.findForward(PdpConstants.MAPPING_CONTINUE);
}
Also used : FormatProcessSummary(org.kuali.kfs.pdp.businessobject.FormatProcessSummary) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) CustomerProfile(org.kuali.kfs.pdp.businessobject.CustomerProfile) DateTimeService(org.kuali.rice.core.api.datetime.DateTimeService) Person(org.kuali.rice.kim.api.identity.Person) Date(java.util.Date)

Example 9 with CustomerProfile

use of org.kuali.kfs.pdp.businessobject.CustomerProfile in project cu-kfs by CU-CommunityApps.

the class FormatAction method clear.

/**
 * This method clears all the customer checkboxes.
 *
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return
 * @throws Exception
 */
public ActionForward clear(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    FormatForm formatForm = (FormatForm) form;
    List<CustomerProfile> customers = formatForm.getCustomers();
    for (CustomerProfile customerProfile : customers) {
        customerProfile.setSelectedForFormat(false);
    }
    formatForm.setCustomers(customers);
    return mapping.findForward(PdpConstants.MAPPING_SELECTION);
}
Also used : CustomerProfile(org.kuali.kfs.pdp.businessobject.CustomerProfile)

Example 10 with CustomerProfile

use of org.kuali.kfs.pdp.businessobject.CustomerProfile in project cu-kfs by CU-CommunityApps.

the class CuAchAdviceNotificationServiceImpl method sendAdviceNotifications.

/**
 * Set to NonTransactional so the payment advice email sent date will be updated and saved after the email is sent
 *
 * @see org.kuali.kfs.pdp.batch.service.AchAdviceNotificationService#sendAdviceNotifications()
 */
@NonTransactional
public void sendAdviceNotifications() {
    if (achBundlerHelperService.shouldBundleAchPayments()) {
        // ACH payments were bundled so the corresponding advice email notifications should also be bundled
        HashSet<Integer> disbNbrs = achBundlerAdviceDao.getDistinctDisbursementNumbersForAchPaymentsNeedingAdviceNotification();
        for (Iterator<Integer> disbIter = disbNbrs.iterator(); disbIter.hasNext(); ) {
            Integer disbursementNbr = disbIter.next();
            // get all payment details to include in the advice based on disbursement number which is associated to a single vendor
            List<PaymentDetail> paymentDetails = achBundlerAdviceDao.getAchPaymentDetailsNeedingAdviceNotificationByDisbursementNumber(disbursementNbr);
            // get one payment detail record so that we can get the needed payment group record, since all payment details are for the same vendor, all payment group records should match
            Iterator<PaymentDetail> paymentDetailsIter = paymentDetails.iterator();
            PaymentDetail payDetail = paymentDetailsIter.next();
            PaymentGroup payGroup = payDetail.getPaymentGroup();
            CustomerProfile customer = payGroup.getBatch().getCustomerProfile();
            // verify the customer profile is setup to create advices
            if (customer.getAdviceCreate()) {
                pdpEmailService.sendAchAdviceEmail(payGroup, paymentDetails, customer);
            }
            // update sent date on the payment, must loop through all payment details because payment groups could be unique.
            for (Iterator<PaymentDetail> paymentDetailsIter2 = paymentDetails.iterator(); paymentDetailsIter2.hasNext(); ) {
                PaymentDetail pd = paymentDetailsIter2.next();
                PaymentGroup pg = pd.getPaymentGroup();
                pg.setAdviceEmailSentDate(dateTimeService.getCurrentTimestamp());
                businessObjectService.save(pg);
            }
        }
    // for each disb number
    } else {
        // Execute the original KFS code to send unbundled ACH advice email notifications with a
        // change to the looping on the payment detail records as noted below with notation KFSPTS-1460
        // get list of payments to send notification for
        List<PaymentGroup> paymentGroups = paymentGroupService.getAchPaymentsNeedingAdviceNotification();
        for (PaymentGroup paymentGroup : paymentGroups) {
            CustomerProfile customer = paymentGroup.getBatch().getCustomerProfile();
            // verify the customer profile is setup to create advices
            if (customer.getAdviceCreate()) {
                // KFSPTS-1460 - for loop removed
                // for (PaymentDetail paymentDetail : paymentGroup.getPaymentDetails()) {
                // pdpEmailService.sendAchAdviceEmail(paymentGroup, paymentDetail, customer);
                // }
                List<PaymentDetail> paymentDetails = paymentGroup.getPaymentDetails();
                pdpEmailService.sendAchAdviceEmail(paymentGroup, paymentDetails, customer);
            }
            // update advice sent date on payment
            paymentGroup.setAdviceEmailSentDate(dateTimeService.getCurrentTimestamp());
            businessObjectService.save(paymentGroup);
        }
    }
}
Also used : PaymentGroup(org.kuali.kfs.pdp.businessobject.PaymentGroup) PaymentDetail(org.kuali.kfs.pdp.businessobject.PaymentDetail) CustomerProfile(org.kuali.kfs.pdp.businessobject.CustomerProfile) NonTransactional(org.kuali.kfs.sys.service.NonTransactional)

Aggregations

CustomerProfile (org.kuali.kfs.pdp.businessobject.CustomerProfile)17 ArrayList (java.util.ArrayList)6 Date (java.util.Date)6 PaymentDetail (org.kuali.kfs.pdp.businessobject.PaymentDetail)6 KualiInteger (org.kuali.rice.core.api.util.type.KualiInteger)6 IOException (java.io.IOException)5 PaymentGroup (org.kuali.kfs.pdp.businessobject.PaymentGroup)5 DateTimeService (org.kuali.rice.core.api.datetime.DateTimeService)4 Person (org.kuali.rice.kim.api.identity.Person)4 BufferedWriter (java.io.BufferedWriter)3 FileWriter (java.io.FileWriter)3 Timestamp (java.sql.Timestamp)3 SimpleDateFormat (java.text.SimpleDateFormat)3 List (java.util.List)3 FormatProcessSummary (org.kuali.kfs.pdp.businessobject.FormatProcessSummary)3 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)3 Date (java.sql.Date)2 Calendar (java.util.Calendar)2 Iterator (java.util.Iterator)2 AccountingPeriod (org.kuali.kfs.coa.businessobject.AccountingPeriod)2