Search in sources :

Example 1 with PaymentRequestService

use of org.kuali.kfs.module.purap.document.service.PaymentRequestService in project cu-kfs by CU-CommunityApps.

the class CuPurchasingAccountsPayableModuleServiceImpl method handlePurchasingBatchCancels.

/**
 * @see org.kuali.kfs.integration.pdp.service.PurchasingAccountsPayableModuleService#handlePurchasingBatchCancels(java.lang.String)
 */
public void handlePurchasingBatchCancels(String documentNumber, String documentTypeCode, boolean primaryCancel, boolean disbursedPayment, boolean crCancel) {
    ParameterService parameterService = SpringContext.getBean(ParameterService.class);
    PaymentRequestService paymentRequestService = SpringContext.getBean(PaymentRequestService.class);
    CreditMemoService creditMemoService = SpringContext.getBean(CreditMemoService.class);
    String preqCancelNote = parameterService.getParameterValueAsString(PaymentRequestDocument.class, PurapParameterConstants.PURAP_PDP_PREQ_CANCEL_NOTE);
    String preqResetNote = parameterService.getParameterValueAsString(PaymentRequestDocument.class, PurapParameterConstants.PURAP_PDP_PREQ_RESET_NOTE);
    String cmCancelNote = parameterService.getParameterValueAsString(VendorCreditMemoDocument.class, PurapParameterConstants.PURAP_PDP_CM_CANCEL_NOTE);
    String cmResetNote = parameterService.getParameterValueAsString(VendorCreditMemoDocument.class, PurapParameterConstants.PURAP_PDP_CM_RESET_NOTE);
    if (PurapConstants.PurapDocTypeCodes.PAYMENT_REQUEST_DOCUMENT.equals(documentTypeCode)) {
        PaymentRequestDocument pr = paymentRequestService.getPaymentRequestByDocumentNumber(documentNumber);
        if (pr != null) {
            if (disbursedPayment || primaryCancel || crCancel) {
                if (!crCancel) {
                    paymentRequestService.cancelExtractedPaymentRequest(pr, preqCancelNote);
                }
            } else {
                paymentRequestService.resetExtractedPaymentRequest(pr, preqResetNote);
            }
        } else {
            LOG.error("processPdpCancels() DOES NOT EXIST, CANNOT PROCESS - Payment Request with doc type of " + documentTypeCode + " with id " + documentNumber);
        }
    } else if (PurapConstants.PurapDocTypeCodes.CREDIT_MEMO_DOCUMENT.equals(documentTypeCode)) {
        VendorCreditMemoDocument cm = creditMemoService.getCreditMemoByDocumentNumber(documentNumber);
        if (cm != null) {
            if (disbursedPayment || primaryCancel || crCancel) {
                if (!crCancel) {
                    creditMemoService.cancelExtractedCreditMemo(cm, cmCancelNote);
                }
            } else {
                creditMemoService.resetExtractedCreditMemo(cm, cmResetNote);
            }
        } else {
            LOG.error("processPdpCancels() DOES NOT EXIST, CANNOT PROCESS - Credit Memo with doc type of " + documentTypeCode + " with id " + documentNumber);
        }
    }
}
Also used : VendorCreditMemoDocument(org.kuali.kfs.module.purap.document.VendorCreditMemoDocument) ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) PaymentRequestService(org.kuali.kfs.module.purap.document.service.PaymentRequestService) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument) CreditMemoService(org.kuali.kfs.module.purap.document.service.CreditMemoService)

Example 2 with PaymentRequestService

use of org.kuali.kfs.module.purap.document.service.PaymentRequestService in project cu-kfs by CU-CommunityApps.

the class CuPaymentRequestAction method clearTaxInfo.

/**
 * Calls service to clear tax info.
 */
public ActionForward clearTaxInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PaymentRequestForm prForm = (PaymentRequestForm) form;
    PaymentRequestDocument document = (PaymentRequestDocument) prForm.getDocument();
    PaymentRequestService taxService = SpringContext.getBean(PaymentRequestService.class);
    /* call service to clear previous lines */
    taxService.clearTax(document);
    return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Also used : PaymentRequestForm(org.kuali.kfs.module.purap.document.web.struts.PaymentRequestForm) PaymentRequestService(org.kuali.kfs.module.purap.document.service.PaymentRequestService) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument)

Example 3 with PaymentRequestService

use of org.kuali.kfs.module.purap.document.service.PaymentRequestService in project cu-kfs by CU-CommunityApps.

the class CuPaymentRequestServiceImplTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    paymentRequestService = SpringContext.getBean(PaymentRequestService.class);
    // Override auto-approval-limit parameter for the duration of the test. The old value will be restored by the post-test rollback.
    // NOTE: If this test class ever gets configured to not roll back, then this override should change accordingly to restore the old param value.
    ParameterService parameterService = SpringContext.getBean(ParameterService.class);
    Parameter oldAmountLimit = parameterService.getParameter(PaymentRequestDocument.class, CUPurapParameterConstants.DEFAULT_PURCHASE_ORDER_POS_APRVL_LMT_FOR_PREQ);
    Parameter.Builder newAmountLimit = Parameter.Builder.create(oldAmountLimit);
    newAmountLimit.setValue(RequisitionItemFixture.REQ_QTY_ITEM_AMOUNT_AT_5K.extendedPrice.toString());
    parameterService.updateParameter(newAmountLimit.build());
}
Also used : ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) CuPaymentRequestService(edu.cornell.kfs.module.purap.document.service.CuPaymentRequestService) PaymentRequestService(org.kuali.kfs.module.purap.document.service.PaymentRequestService) Parameter(org.kuali.kfs.coreservice.api.parameter.Parameter)

Aggregations

PaymentRequestService (org.kuali.kfs.module.purap.document.service.PaymentRequestService)3 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)2 PaymentRequestDocument (org.kuali.kfs.module.purap.document.PaymentRequestDocument)2 CuPaymentRequestService (edu.cornell.kfs.module.purap.document.service.CuPaymentRequestService)1 Parameter (org.kuali.kfs.coreservice.api.parameter.Parameter)1 VendorCreditMemoDocument (org.kuali.kfs.module.purap.document.VendorCreditMemoDocument)1 CreditMemoService (org.kuali.kfs.module.purap.document.service.CreditMemoService)1 PaymentRequestForm (org.kuali.kfs.module.purap.document.web.struts.PaymentRequestForm)1