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