Search in sources :

Example 21 with Principal

use of org.kuali.kfs.kim.impl.identity.principal.Principal 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)

Example 22 with Principal

use of org.kuali.kfs.kim.impl.identity.principal.Principal in project cu-kfs by CU-CommunityApps.

the class PaymentSourceExtractionServiceImpl method extractPayments.

/**
 * This method extracts all payments from a disbursement voucher with a status code of "A" and uploads them as a
 * batch for processing.
 *
 * @return Always returns true if the method completes.
 */
@Override
public boolean extractPayments() {
    if (LOG.isDebugEnabled()) {
        LOG.debug("extractPayments() started");
    }
    final Date processRunDate = dateTimeService.getCurrentDate();
    final Principal user = KimApiServiceLocator.getIdentityService().getPrincipalByPrincipalName(KFSConstants.SYSTEM_USER);
    if (user == null) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("extractPayments() Unable to find user " + KFSConstants.SYSTEM_USER);
        }
        throw new IllegalArgumentException("Unable to find user " + KFSConstants.SYSTEM_USER);
    }
    // Get a list of campuses that have documents with an 'A' (approved) status.
    Map<String, List<PaymentSource>> campusListMap = paymentSourceToExtractService.retrievePaymentSourcesByCampus(false);
    if (campusListMap != null && !campusListMap.isEmpty()) {
        // Process each campus one at a time
        for (String campusCode : campusListMap.keySet()) {
            extractPaymentsForCampus(campusCode, user.getPrincipalId(), processRunDate, campusListMap.get(campusCode));
        }
    }
    return true;
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) Date(java.util.Date) Principal(org.kuali.kfs.kim.impl.identity.principal.Principal)

Aggregations

Principal (org.kuali.kfs.kim.impl.identity.principal.Principal)22 HashMap (java.util.HashMap)6 ArrayList (java.util.ArrayList)4 Date (java.util.Date)3 IWantDocUserOptions (edu.cornell.kfs.module.purap.businessobject.IWantDocUserOptions)2 List (java.util.List)2 EntityEmployment (org.kuali.kfs.kim.impl.identity.employment.EntityEmployment)2 EntityName (org.kuali.kfs.kim.impl.identity.name.EntityName)2 Cacheable (org.springframework.cache.annotation.Cacheable)2 IWantDocument (edu.cornell.kfs.module.purap.document.IWantDocument)1 IWantDocumentService (edu.cornell.kfs.module.purap.document.service.IWantDocumentService)1 PurApFavoriteAccountLineBuilderForIWantDocument (edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument)1 Map (java.util.Map)1 ActionForward (org.apache.struts.action.ActionForward)1 DateTime (org.joda.time.DateTime)1 Account (org.kuali.kfs.coa.businessobject.Account)1 KfsKimDocDelegateMember (org.kuali.kfs.coa.identity.KfsKimDocDelegateMember)1 KualiDecimal (org.kuali.kfs.core.api.util.type.KualiDecimal)1 KualiInteger (org.kuali.kfs.core.api.util.type.KualiInteger)1 WorkflowServiceErrorException (org.kuali.kfs.kew.exception.WorkflowServiceErrorException)1