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