Search in sources :

Example 6 with Batch

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

the class PaymentSourceExtractionServiceImpl method extractSingleImmediatePayment.

/**
 * Extracts a single DisbursementVoucherDocument
 *
 * @see org.kuali.kfs.fp.batch.service.DisbursementVoucherExtractService#extractImmediatePayment(org.kuali.kfs.fp.document.DisbursementVoucherDocument)
 */
@Override
public void extractSingleImmediatePayment(PaymentSource paymentSource) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("extractImmediatePayment(DisbursementVoucherDocument) started");
    }
    if (getPaymentSourceToExtractService().shouldExtractPayment(paymentSource)) {
        final Date processRunDate = dateTimeService.getCurrentDate();
        final Principal principal = KimApiServiceLocator.getIdentityService().getPrincipalByPrincipalName(KFSConstants.SYSTEM_USER);
        if (principal == null) {
            LOG.debug("extractPayments() Unable to find user " + KFSConstants.SYSTEM_USER);
            throw new IllegalArgumentException("Unable to find user " + KFSConstants.SYSTEM_USER);
        }
        Batch batch = createBatch(paymentSource.getCampusCode(), principal.getPrincipalId(), processRunDate);
        KualiDecimal totalAmount = KualiDecimal.ZERO;
        addPayment(paymentSource, batch, processRunDate, true);
        totalAmount = totalAmount.add(getPaymentSourceToExtractService().getPaymentAmount(paymentSource));
        batch.setPaymentCount(new KualiInteger(1));
        batch.setPaymentTotalAmount(totalAmount);
        businessObjectService.save(batch);
        paymentFileEmailService.sendPaymentSourceImmediateExtractEmail(paymentSource, getPaymentSourceToExtractService().getImmediateExtractEMailFromAddress(), getPaymentSourceToExtractService().getImmediateExtractEmailToAddresses());
    }
}
Also used : Batch(org.kuali.kfs.pdp.businessobject.Batch) KualiInteger(org.kuali.rice.core.api.util.type.KualiInteger) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) Date(java.util.Date) Principal(org.kuali.rice.kim.api.identity.principal.Principal)

Example 7 with Batch

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

the class CuPaymentFileServiceImpl method loadPayments.

@Override
public void loadPayments(PaymentFileLoad paymentFile, LoadPaymentStatus status, String incomingFileName) {
    status.setChart(paymentFile.getChart());
    status.setUnit(paymentFile.getUnit());
    status.setSubUnit(paymentFile.getSubUnit());
    status.setCreationDate(paymentFile.getCreationDate());
    status.setDetailCount(paymentFile.getActualPaymentCount());
    status.setDetailTotal(paymentFile.getCalculatedPaymentTotalAmount());
    // create batch record for payment load
    Batch batch = createNewBatch(paymentFile, getBaseFileName(incomingFileName));
    businessObjectService.save(batch);
    paymentFile.setBatchId(batch.getId());
    status.setBatchId(batch.getId());
    // do warnings and set defaults
    List<String> warnings = paymentFileValidationService.doSoftEdits(paymentFile);
    status.setWarnings(warnings);
    // store groups
    for (PaymentGroup paymentGroup : paymentFile.getPaymentGroups()) {
        assignDisbursementTypeCode(paymentGroup);
        updatePaymentFieldsForEmployeePayee(paymentFile, paymentGroup);
        businessObjectService.save(paymentGroup);
    }
    // CU Customization: Check for and warn about inactive vendors.
    checkForInactiveVendors(paymentFile.getPaymentGroups(), batch.getCustomerProfile());
    // send list of warnings
    paymentFileEmailService.sendLoadEmail(paymentFile, warnings);
    if (paymentFile.isTaxEmailRequired()) {
        paymentFileEmailService.sendTaxEmail(paymentFile);
    }
    removeDoneFile(incomingFileName);
    LOG.debug("loadPayments() was successful");
    status.setLoadStatus(LoadPaymentStatus.LoadStatus.SUCCESS);
}
Also used : PaymentGroup(org.kuali.kfs.pdp.businessobject.PaymentGroup) Batch(org.kuali.kfs.pdp.businessobject.Batch)

Aggregations

Batch (org.kuali.kfs.pdp.businessobject.Batch)7 KualiInteger (org.kuali.rice.core.api.util.type.KualiInteger)4 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)3 Timestamp (java.sql.Timestamp)2 CustomerProfile (org.kuali.kfs.pdp.businessobject.CustomerProfile)2 PaymentGroup (org.kuali.kfs.pdp.businessobject.PaymentGroup)2 PaymentSource (org.kuali.kfs.sys.document.PaymentSource)2 Calendar (java.util.Calendar)1 Date (java.util.Date)1 Principal (org.kuali.rice.kim.api.identity.principal.Principal)1