use of edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestServiceImplTest method testAmountAnalysisForNonQuantityOrderBelowLimit.
public void testAmountAnalysisForNonQuantityOrderBelowLimit() throws Exception {
CuPaymentRequestDocument paymentRequestDocument = createPaymentRequestForTestingPOAmountLimit(PurchaseOrderFixture.PO_NON_B2B_OPEN_WITH_NON_QTY_ITEM_BELOW_5K);
assertTrue("Payment should have passed the within-amount-limit check, due to non-quantity order with amount below the threshold", ((CuPaymentRequestService) paymentRequestService).purchaseOrderForPaymentRequestIsWithinAutoApproveAmountLimit(paymentRequestDocument));
}
use of edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestServiceImplTest method createPaymentRequestForTestingPOAmountLimit.
protected CuPaymentRequestDocument createPaymentRequestForTestingPOAmountLimit(PurchaseOrderFixture poFixture) throws Exception {
changeCurrentUser(UserNameFixture.ccs1);
PurchaseOrderDocument po = poFixture.createPurchaseOrderdDocument(SpringContext.getBean(DocumentService.class));
changeCurrentUser(UserNameFixture.mo14);
PaymentRequestDocument paymentRequestDocument = PaymentRequestFixture.PAYMENT_REQ_DOC.createPaymentRequestDocument(po.getPurapDocumentIdentifier());
paymentRequestDocument.initiateDocument();
paymentRequestDocument.populatePaymentRequestFromPurchaseOrder(po);
return (CuPaymentRequestDocument) paymentRequestDocument;
}
use of edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument in project cu-kfs by CU-CommunityApps.
the class CuPurapGeneralLedgerServiceImplTest method testGenerateEntriesPaymentRequest.
public void testGenerateEntriesPaymentRequest() throws Exception {
changeCurrentUser(UserNameFixture.ccs1);
PurchaseOrderDocument po = PurchaseOrderFixture.PO_NON_B2B_OPEN_WITH_ITEMS.createPurchaseOrderdDocument(SpringContext.getBean(DocumentService.class));
po.setVendorShippingPaymentTermsCode("AL");
po.setVendorPaymentTermsCode("00N30");
po.refreshNonUpdateableReferences();
changeCurrentUser(UserNameFixture.mo14);
CuPaymentRequestDocument preq = (CuPaymentRequestDocument) PaymentRequestFixture.PAYMENT_REQ_DOC.createPaymentRequestDocument(po.getPurapDocumentIdentifier());
preq.initiateDocument();
preq.populatePaymentRequestFromPurchaseOrder(po);
preq.setPaymentMethodCode("F");
preq.setApplicationDocumentStatus(PurapConstants.PaymentRequestStatuses.APPDOC_AWAITING_ACCOUNTS_PAYABLE_REVIEW);
((PaymentRequestItem) (preq.getItems().get(0))).setExtendedPrice(new KualiDecimal(1));
AccountingDocumentTestUtils.saveDocument(preq, SpringContext.getBean(DocumentService.class));
List<SummaryAccount> summaryAccounts = purapAccountingService.generateSummaryAccountsWithNoZeroTotalsNoUseTax(preq);
cuPurapGeneralLedgerServiceImpl.generateEntriesPaymentRequest(preq, null, summaryAccounts, "create");
boolean noBankOffsetGenerated = true;
for (GeneralLedgerPendingEntry pe : preq.getGeneralLedgerPendingEntries()) {
if (KFSKeyConstants.Bank.DESCRIPTION_GLPE_BANK_OFFSET.equalsIgnoreCase(pe.getTransactionLedgerEntryDescription())) {
noBankOffsetGenerated = false;
break;
}
}
assertEquals(2, preq.getGeneralLedgerPendingEntries().size());
assertTrue(noBankOffsetGenerated);
}
use of edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument in project cu-kfs by CU-CommunityApps.
the class CuPurapGeneralLedgerServiceImplTest method testReencumberEncumbrance.
public void testReencumberEncumbrance() throws Exception {
changeCurrentUser(UserNameFixture.ccs1);
PurchaseOrderDocument po = PurchaseOrderFixture.PO_NON_B2B_OPEN_WITH_ITEMS.createPurchaseOrderdDocument(SpringContext.getBean(DocumentService.class));
po.setVendorShippingPaymentTermsCode("AL");
po.setVendorPaymentTermsCode("00N30");
po.getItem(0).setItemQuantity(new KualiDecimal(6));
((PurchaseOrderItem) po.getItem(0)).setItemInvoicedTotalQuantity(new KualiDecimal(4));
po.refreshNonUpdateableReferences();
AccountingDocumentTestUtils.saveDocument(po, SpringContext.getBean(DocumentService.class));
changeCurrentUser(UserNameFixture.mo14);
CuPaymentRequestDocument preq = (CuPaymentRequestDocument) PaymentRequestFixture.PAYMENT_REQ_DOC.createPaymentRequestDocument(po.getPurapDocumentIdentifier());
preq.initiateDocument();
preq.populatePaymentRequestFromPurchaseOrder(po);
preq.setPaymentMethodCode("F");
preq.setApplicationDocumentStatus(PurapConstants.PaymentRequestStatuses.APPDOC_AWAITING_ACCOUNTS_PAYABLE_REVIEW);
((PaymentRequestItem) (preq.getItems().get(0))).setExtendedPrice(KualiDecimal.ZERO);
((PaymentRequestItem) (preq.getItems().get(0))).setItemUnitPrice(BigDecimal.ZERO);
((PaymentRequestItem) (preq.getItems().get(0))).setItemQuantity(new KualiDecimal(2));
AccountingDocumentTestUtils.saveDocument(preq, SpringContext.getBean(DocumentService.class));
cuPurapGeneralLedgerServiceImpl.reencumberEncumbrance(preq);
PurchaseOrderDocument po2 = purchaseOrderService.getCurrentPurchaseOrder(preq.getPurchaseOrderIdentifier());
assertEquals(new KualiDecimal(2), ((PurchaseOrderItem) po2.getItem(0)).getItemInvoicedTotalQuantity());
}
use of edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestServiceImpl method populatePaymentRequest.
@Override
@NonTransactional
public void populatePaymentRequest(PaymentRequestDocument paymentRequestDocument) {
super.populatePaymentRequest(paymentRequestDocument);
// KFSUPGRADE-779
// reset bank code
paymentRequestDocument.setBankCode(null);
paymentRequestDocument.setBank(null);
// set bank code to default bank code in the system parameter
Bank defaultBank = null;
if (StringUtils.equals(PaymentMethod.PM_CODE_WIRE, ((CuPaymentRequestDocument) paymentRequestDocument).getPaymentMethodCode()) || StringUtils.equals(PaymentMethod.PM_CODE_FOREIGN_DRAFT, ((CuPaymentRequestDocument) paymentRequestDocument).getPaymentMethodCode())) {
defaultBank = SpringContext.getBean(CUBankService.class).getDefaultBankByDocType(CuPaymentRequestDocument.DOCUMENT_TYPE_NON_CHECK);
} else if (!StringUtils.equals(PaymentMethod.PM_CODE_INTERNAL_BILLING, ((CuPaymentRequestDocument) paymentRequestDocument).getPaymentMethodCode())) {
defaultBank = SpringContext.getBean(BankService.class).getDefaultBankByDocType(PaymentRequestDocument.class);
}
if (defaultBank != null) {
paymentRequestDocument.setBankCode(defaultBank.getBankCode());
paymentRequestDocument.setBank(defaultBank);
}
}
Aggregations