public List<FeeBO> getAllApplicableFees(Integer accountId, FeeCategory categoryType) throws PersistenceException { HashMap<String, Object> queryParameters = new HashMap<String, Object>(); queryParameters.put("accountId", accountId); queryParameters.put("active", FeeStatus.ACTIVE.getValue()); if (categoryType.getValue().equals(FeeCategory.LOAN.getValue())) { queryParameters.put("category", FeeCategory.LOAN.getValue()); return executeNamedQuery(NamedQueryConstants.GET_ALL_APPLICABLE_LOAN_FEE, queryParameters); } queryParameters.put("feeFrequencyTypeId", FeeFrequencyType.PERIODIC.getValue()); queryParameters.put("category1", FeeCategory.ALLCUSTOMERS.getValue()); queryParameters.put("category2", categoryType.getValue()); return executeNamedQuery(NamedQueryConstants.GET_ALL_APPLICABLE_CUSTOMER_FEE, queryParameters); }
public void testSuccessfulCreatePeriodicFeeWithFormula() throws Exception { setRequestPathInfo("/feeaction.do"); addRequestParameter("method", "load"); addRequestParameter(Constants.CURRENTFLOWKEY, flowKey); actionPerform(); flowKey = request.getAttribute(Constants.CURRENTFLOWKEY).toString(); setRequestPathInfo("/feeaction.do"); addRequestParameter("method", "preview"); addRequestParameter("categoryType", FeeCategory.LOAN.getValue().toString()); addRequestParameter("currencyId", TestUtils.RUPEE.getCurrencyId().toString()); addRequestParameter("rate", "23"); addRequestParameter("amount", ""); addRequestParameter("feeFormula", FeeFormula.AMOUNT.getValue().toString()); addRequestParameter("feeName", "Loan_Periodic_Fee"); addRequestParameter("customerDefaultFee", "0"); addRequestParameter("feeFrequencyType", FeeFrequencyType.PERIODIC.getValue().toString()); addRequestParameter("feeRecurrenceType", RecurrenceType.WEEKLY.getValue().toString()); addRequestParameter("weekRecurAfter", "2"); addRequestParameter("glCode", GLOCDE_ID); addRequestParameter(Constants.CURRENTFLOWKEY, flowKey); actionPerform(); verifyNoActionErrors(); setRequestPathInfo("/feeaction.do"); addRequestParameter("method", "create"); addRequestParameter( "org.apache.struts.taglib.html.TOKEN", (String) request.getSession().getAttribute("org.apache.struts.action.TOKEN")); addRequestParameter(Constants.CURRENTFLOWKEY, flowKey); actionPerform(); verifyNoActionErrors(); verifyForward(ActionForwards.create_success.toString()); FeeActionForm actionForm = (FeeActionForm) request.getSession().getAttribute("feeactionform"); fee = (FeeBO) TestObjectFactory.getObject(FeeBO.class, actionForm.getFeeIdValue()); Assert.assertEquals("Loan_Periodic_Fee", fee.getFeeName()); Assert.assertEquals(FeeCategory.LOAN.getValue(), fee.getCategoryType().getId()); Assert.assertEquals(RateAmountFlag.RATE, fee.getFeeType()); Assert.assertEquals(23.0, ((RateFeeBO) fee).getRate(), DELTA); Assert.assertEquals( ((RateFeeBO) fee).getFeeFormula().getId(), FeeFormula.AMOUNT.getValue(), DELTA); Assert.assertTrue(fee.isPeriodic()); Assert.assertTrue(fee.isActive()); }
public void testFailurePreviewWith_RateEnteredWithoutFormula() throws Exception { setRequestPathInfo("/feeaction.do"); addRequestParameter("method", "preview"); addRequestParameter("feeName", "CustomerFee"); addRequestParameter("categoryType", FeeCategory.LOAN.getValue().toString()); addRequestParameter("feeFrequencyType", FeeFrequencyType.PERIODIC.getValue().toString()); addRequestParameter("feeRecurrenceType", RecurrenceType.WEEKLY.getValue().toString()); addRequestParameter("weekRecurAfter", "2"); addRequestParameter("rate", "10"); addRequestParameter(Constants.CURRENTFLOWKEY, flowKey); actionPerform(); Assert.assertEquals(2, getErrorSize()); Assert.assertEquals("Fee GlCode", 1, getErrorSize(FeeConstants.INVALID_GLCODE)); Assert.assertEquals("Fee Rate or Formula", 1, getErrorSize("RateAndFormula")); verifyInputForward(); }
public void testFailurePreviewWith_RateAndAmountEnteredWithoutFormula() throws Exception { setRequestPathInfo("/feeaction.do"); addRequestParameter("method", "preview"); addRequestParameter("feeName", "LoanFee"); addRequestParameter("categoryType", FeeCategory.LOAN.getValue().toString()); addRequestParameter("feeFrequencyType", FeeFrequencyType.PERIODIC.getValue().toString()); addRequestParameter("feeRecurrenceType", RecurrenceType.WEEKLY.getValue().toString()); addRequestParameter("weekRecurAfter", "2"); addRequestParameter("amount", "200"); addRequestParameter("rate", "10"); addRequestParameter("glCode", GLOCDE_ID); addRequestParameter(Constants.CURRENTFLOWKEY, flowKey); actionPerform(); Assert.assertEquals(1, getErrorSize()); Assert.assertEquals("Fee Rate or Formula", 1, getErrorSize(FeeConstants.RATE_OR_AMOUNT)); verifyInputForward(); }
public void testSuccessfulPreview() throws Exception { setRequestPathInfo("/feeaction.do"); addRequestParameter("method", "load"); addRequestParameter(Constants.CURRENTFLOWKEY, flowKey); actionPerform(); flowKey = request.getAttribute(Constants.CURRENTFLOWKEY).toString(); setRequestPathInfo("/feeaction.do"); addRequestParameter("method", "preview"); addRequestParameter("feeName", "CustomerFee"); addRequestParameter("categoryType", FeeCategory.LOAN.getValue().toString()); addRequestParameter("feeFrequencyType", FeeFrequencyType.PERIODIC.getValue().toString()); addRequestParameter("feeRecurrenceType", RecurrenceType.WEEKLY.getValue().toString()); addRequestParameter("weekRecurAfter", "2"); addRequestParameter("currencyId", TestUtils.RUPEE.getCurrencyId().toString()); addRequestParameter("rate", "10"); addRequestParameter("feeFormula", FeeFormula.AMOUNT.getValue().toString()); addRequestParameter("glCode", GLOCDE_ID); addRequestParameter(Constants.CURRENTFLOWKEY, flowKey); actionPerform(); Assert.assertEquals(0, getErrorSize()); verifyForward(ActionForwards.preview_success.toString()); verifyNoActionErrors(); verifyNoActionMessages(); }