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());
}
}
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;
}
Aggregations