use of org.kuali.kfs.module.purap.document.PurchaseOrderDocument in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestServiceImplTest method testMarkPaid.
public void testMarkPaid() throws Exception {
changeCurrentUser(UserNameFixture.ccs1);
PurchaseOrderDocument po = PurchaseOrderFixture.PO_NON_B2B_OPEN.createPurchaseOrderdDocument(SpringContext.getBean(DocumentService.class));
po.setVendorShippingPaymentTermsCode("AL");
po.setVendorPaymentTermsCode("00N30");
po.refreshNonUpdateableReferences();
changeCurrentUser(UserNameFixture.mo14);
PaymentRequestDocument paymentRequestDocument = PaymentRequestFixture.PAYMENT_REQ_DOC.createPaymentRequestDocument(po.getPurapDocumentIdentifier());
paymentRequestDocument.initiateDocument();
paymentRequestDocument.populatePaymentRequestFromPurchaseOrder(po);
paymentRequestDocument.setPaymentPaidTimestamp(null);
paymentRequestDocument.prepareForSave();
AccountingDocumentTestUtils.saveDocument(paymentRequestDocument, SpringContext.getBean(DocumentService.class));
paymentRequestService.markPaid(paymentRequestDocument, SpringContext.getBean(DateTimeService.class).getCurrentSqlDate());
assertNotNull(paymentRequestDocument.getPaymentPaidTimestamp());
}
use of org.kuali.kfs.module.purap.document.PurchaseOrderDocument in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestServiceImplTest method testRemoveIneligibleAdditionalCharges_WithEligibleItems.
public void testRemoveIneligibleAdditionalCharges_WithEligibleItems() throws Exception {
changeCurrentUser(UserNameFixture.ccs1);
PurchaseOrderDocument po = PurchaseOrderFixture.PO_NON_B2B_OPEN_TRADE_IN_ITEMS.createPurchaseOrderdDocument(SpringContext.getBean(DocumentService.class));
changeCurrentUser(UserNameFixture.mo14);
PaymentRequestDocument paymentRequestDocument = PaymentRequestFixture.PAYMENT_REQ_DOC.createPaymentRequestDocument(po.getPurapDocumentIdentifier());
paymentRequestDocument.initiateDocument();
paymentRequestDocument.populatePaymentRequestFromPurchaseOrder(po);
PaymentRequestItem preqItem = new PaymentRequestItem();
preqItem.setItemTypeCode(ItemTypeCodes.ITEM_TYPE_TRADE_IN_CODE);
preqItem.setItemDescription("test");
preqItem.setItemUnitOfMeasureCode("EA");
paymentRequestDocument.addItem(preqItem);
int numberOfItems = paymentRequestDocument.getItems().size();
paymentRequestService.removeIneligibleAdditionalCharges(paymentRequestDocument);
assertFalse(numberOfItems == paymentRequestDocument.getItems().size());
}
use of org.kuali.kfs.module.purap.document.PurchaseOrderDocument in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestServiceImplTest method testPopulatePaymentRequest.
public void testPopulatePaymentRequest() throws Exception {
changeCurrentUser(UserNameFixture.ccs1);
PurchaseOrderDocument po = PurchaseOrderFixture.PO_NON_B2B_OPEN.createPurchaseOrderdDocument(SpringContext.getBean(DocumentService.class));
po.setVendorShippingPaymentTermsCode("AL");
po.setVendorPaymentTermsCode("00N30");
po.refreshNonUpdateableReferences();
changeCurrentUser(UserNameFixture.mo14);
CuPaymentRequestDocument paymentRequestDocument = (CuPaymentRequestDocument) PaymentRequestFixture.PAYMENT_REQ_DOC.createPaymentRequestDocument(po.getPurapDocumentIdentifier());
paymentRequestDocument.initiateDocument();
paymentRequestDocument.populatePaymentRequestFromPurchaseOrder(po);
paymentRequestDocument.prepareForSave();
AccountingDocumentTestUtils.saveDocument(paymentRequestDocument, SpringContext.getBean(DocumentService.class));
paymentRequestService.populatePaymentRequest(paymentRequestDocument);
assertNotNull(paymentRequestDocument.getBankCode());
}
use of org.kuali.kfs.module.purap.document.PurchaseOrderDocument in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestServiceImplTest method testClearTax.
public void testClearTax() throws Exception {
changeCurrentUser(UserNameFixture.ccs1);
PurchaseOrderDocument po = PurchaseOrderFixture.PO_NON_B2B_OPEN.createPurchaseOrderdDocument(SpringContext.getBean(DocumentService.class));
po.setVendorShippingPaymentTermsCode("AL");
po.setVendorPaymentTermsCode("00N30");
po.refreshNonUpdateableReferences();
changeCurrentUser(UserNameFixture.mo14);
CuPaymentRequestDocument paymentRequestDocument = (CuPaymentRequestDocument) PaymentRequestFixture.PAYMENT_REQ_DOC.createPaymentRequestDocument(po.getPurapDocumentIdentifier());
paymentRequestDocument.initiateDocument();
paymentRequestDocument.populatePaymentRequestFromPurchaseOrder(po);
paymentRequestDocument.setTaxClassificationCode("XX");
paymentRequestDocument.setTaxFederalPercent(new BigDecimal(30));
paymentRequestDocument.setTaxStatePercent(new BigDecimal(10));
paymentRequestDocument.setTaxCountryCode("US");
paymentRequestDocument.setTaxNQIId(null);
paymentRequestDocument.setTaxForeignSourceIndicator(true);
paymentRequestDocument.setTaxExemptTreatyIndicator(true);
paymentRequestDocument.setTaxOtherExemptIndicator(true);
paymentRequestDocument.setTaxGrossUpIndicator(true);
paymentRequestDocument.setTaxUSAIDPerDiemIndicator(true);
paymentRequestDocument.setTaxSpecialW4Amount(new KualiDecimal(10));
PaymentRequestItem paymentRequestItem = new PaymentRequestItem();
paymentRequestItem.setItemTypeCode(ItemTypeCodes.ITEM_TYPE_FEDERAL_TAX_CODE);
paymentRequestService.clearTax(paymentRequestDocument);
assertNull(paymentRequestDocument.getTaxClassificationCode());
assertNull(paymentRequestDocument.getTaxFederalPercent());
assertNull(paymentRequestDocument.getTaxStatePercent());
assertNull(paymentRequestDocument.getTaxCountryCode());
assertNull(paymentRequestDocument.getTaxNQIId());
assertFalse(paymentRequestDocument.getTaxForeignSourceIndicator());
assertFalse(paymentRequestDocument.getTaxExemptTreatyIndicator());
assertFalse(paymentRequestDocument.getTaxOtherExemptIndicator());
assertFalse(paymentRequestDocument.getTaxGrossUpIndicator());
assertFalse(paymentRequestDocument.getTaxUSAIDPerDiemIndicator());
assertNull(paymentRequestDocument.getTaxSpecialW4Amount());
}
use of org.kuali.kfs.module.purap.document.PurchaseOrderDocument in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestServiceImplTest method testRequestCancelOnPaymentRequest.
public void testRequestCancelOnPaymentRequest() throws Exception {
changeCurrentUser(UserNameFixture.ccs1);
PurchaseOrderDocument po = PurchaseOrderFixture.PO_NON_B2B_OPEN.createPurchaseOrderdDocument(SpringContext.getBean(DocumentService.class));
po.setVendorShippingPaymentTermsCode("AL");
po.setVendorPaymentTermsCode("00N30");
po.refreshNonUpdateableReferences();
changeCurrentUser(UserNameFixture.mo14);
PaymentRequestDocument paymentRequestDocument = PaymentRequestFixture.PAYMENT_REQ_DOC.createPaymentRequestDocument(po.getPurapDocumentIdentifier());
paymentRequestDocument.initiateDocument();
paymentRequestDocument.populatePaymentRequestFromPurchaseOrder(po);
paymentRequestDocument.prepareForSave();
AccountingDocumentTestUtils.saveDocument(paymentRequestDocument, SpringContext.getBean(DocumentService.class));
paymentRequestService.requestCancelOnPaymentRequest(paymentRequestDocument, "test");
assertTrue(paymentRequestDocument.isPaymentRequestedCancelIndicator());
assertNotNull(paymentRequestDocument.getLastActionPerformedByPersonId());
assertNotNull(paymentRequestDocument.getAccountsPayableRequestCancelIdentifier());
}
Aggregations