Search in sources :

Example 1 with PaymentWorksNewVendorRequestsBatchReportData

use of edu.cornell.kfs.pmw.batch.report.PaymentWorksNewVendorRequestsBatchReportData in project cu-kfs by CU-CommunityApps.

the class PaymentWorksNewVendorRequestsServiceImpl method processEachPaymentWorksNewVendorRequestIntoKFS.

private void processEachPaymentWorksNewVendorRequestIntoKFS(List<String> identifiersForPendingNewVendorsToProcess) {
    PaymentWorksNewVendorRequestsBatchReportData reportData = new PaymentWorksNewVendorRequestsBatchReportData();
    reportData.getPendingNewVendorsFoundInPmw().setRecordCount(identifiersForPendingNewVendorsToProcess.size());
    for (String pmwNewVendorRequestId : identifiersForPendingNewVendorsToProcess) {
        LOG.info("processEachPaymentWorksNewVendorRequestIntoKFS: Processing started for PMW-vendor-id=" + pmwNewVendorRequestId);
        PaymentWorksVendor stgNewVendorRequestDetailToProcess = getPaymentWorksWebServiceCallsService().obtainPmwNewVendorRequestDetailForPmwIdentifier(pmwNewVendorRequestId, reportData);
        if (canPaymentWorksNewVendorRequestProcessingContinueForVendor(stgNewVendorRequestDetailToProcess, reportData)) {
            PaymentWorksVendor savedStgNewVendorRequestDetailToProcess = pmwPendingNewVendorRequestInitialSaveToKfsStagingTable(stgNewVendorRequestDetailToProcess);
            if (pmwNewVendorSaveToStagingTableWasSuccessful(savedStgNewVendorRequestDetailToProcess, reportData)) {
                if (pmwNewVendorRequestProcessingIntoKfsWasSuccessful(savedStgNewVendorRequestDetailToProcess, reportData)) {
                    getPaymentWorksWebServiceCallsService().sendApprovedStatusToPaymentWorksForNewVendor(savedStgNewVendorRequestDetailToProcess.getPmwVendorRequestId());
                } else {
                    getPaymentWorksWebServiceCallsService().sendRejectedStatusToPaymentWorksForNewVendor(savedStgNewVendorRequestDetailToProcess.getPmwVendorRequestId());
                }
            } else {
                // save of pmw data to staging table failed for some reason, cannot process or track request
                getPaymentWorksWebServiceCallsService().sendRejectedStatusToPaymentWorksForNewVendor(savedStgNewVendorRequestDetailToProcess.getPmwVendorRequestId());
            }
        } else {
            // either duplicate request or data issue exists preventing save to staging table
            getPaymentWorksWebServiceCallsService().sendRejectedStatusToPaymentWorksForNewVendor(stgNewVendorRequestDetailToProcess.getPmwVendorRequestId());
        }
    }
    getPaymentWorksNewVendorRequestsReportService().generateAndEmailProcessingReport(reportData);
}
Also used : PaymentWorksVendor(edu.cornell.kfs.pmw.batch.businessobject.PaymentWorksVendor) PaymentWorksNewVendorRequestsBatchReportData(edu.cornell.kfs.pmw.batch.report.PaymentWorksNewVendorRequestsBatchReportData)

Aggregations

PaymentWorksVendor (edu.cornell.kfs.pmw.batch.businessobject.PaymentWorksVendor)1 PaymentWorksNewVendorRequestsBatchReportData (edu.cornell.kfs.pmw.batch.report.PaymentWorksNewVendorRequestsBatchReportData)1