Search in sources :

Example 26 with KualiInteger

use of org.kuali.kfs.core.api.util.type.KualiInteger in project cu-kfs by CU-CommunityApps.

the class PaymentSourceExtractionServiceImpl method extractSingleImmediatePayment.

/**
 * Extracts a single 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.kfs.core.api.util.type.KualiInteger) KualiDecimal(org.kuali.kfs.core.api.util.type.KualiDecimal) Date(java.util.Date) Principal(org.kuali.kfs.kim.impl.identity.principal.Principal)

Aggregations

KualiInteger (org.kuali.kfs.core.api.util.type.KualiInteger)26 ArrayList (java.util.ArrayList)8 KualiDecimal (org.kuali.kfs.core.api.util.type.KualiDecimal)7 PaymentDetail (org.kuali.kfs.pdp.businessobject.PaymentDetail)7 Date (java.sql.Date)5 HashMap (java.util.HashMap)5 CustomerProfile (org.kuali.kfs.pdp.businessobject.CustomerProfile)5 PaymentNoteText (org.kuali.kfs.pdp.businessobject.PaymentNoteText)5 Date (java.util.Date)4 GlPendingTransaction (org.kuali.kfs.pdp.businessobject.GlPendingTransaction)4 PaymentAccountDetail (org.kuali.kfs.pdp.businessobject.PaymentAccountDetail)4 CheckReconciliation (com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation)3 AccountingPeriod (org.kuali.kfs.coa.businessobject.AccountingPeriod)3 OffsetDefinition (org.kuali.kfs.coa.businessobject.OffsetDefinition)3 Batch (org.kuali.kfs.pdp.businessobject.Batch)3 PaymentGroup (org.kuali.kfs.pdp.businessobject.PaymentGroup)3 GeneralLedgerPendingEntrySequenceHelper (org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySequenceHelper)3 Timestamp (java.sql.Timestamp)2 Calendar (java.util.Calendar)2 List (java.util.List)2