public void testSuccessfulUpdate_RateFee() throws Exception { fee = TestObjectFactory.createOneTimeRateFee( "One Time Fee", FeeCategory.ALLCUSTOMERS, 24.0, FeeFormula.AMOUNT, FeePayment.UPFRONT); request.setAttribute(Constants.CURRENTFLOWKEY, flowKey); SessionUtils.setAttribute(Constants.BUSINESS_KEY, fee, request); setRequestPathInfo("/feeaction.do"); addRequestParameter("method", "manage"); addRequestParameter(Constants.CURRENTFLOWKEY, flowKey); actionPerform(); setRequestPathInfo("/feeaction.do"); addRequestParameter("method", "editPreview"); addRequestParameter(Constants.CURRENTFLOWKEY, flowKey); addRequestParameter("rate", "30"); actionPerform(); setRequestPathInfo("/feeaction.do"); addRequestParameter("method", "update"); addRequestParameter(Constants.CURRENTFLOWKEY, flowKey); actionPerform(); verifyNoActionErrors(); verifyForward(ActionForwards.update_success.toString()); fee = (FeeBO) TestObjectFactory.getObject(FeeBO.class, fee.getFeeId()); Assert.assertTrue(fee.isActive()); Assert.assertEquals(30.0, ((RateFeeBO) fee).getRate(), DELTA); }
public void testSuccessfulUpdate_AmountFee() throws Exception { fee = TestObjectFactory.createOneTimeAmountFee( "One Time Fee", FeeCategory.ALLCUSTOMERS, "100", FeePayment.UPFRONT); request.setAttribute(Constants.CURRENTFLOWKEY, flowKey); SessionUtils.setAttribute(Constants.BUSINESS_KEY, fee, request); setRequestPathInfo("/feeaction.do"); addRequestParameter("method", "manage"); addRequestParameter(Constants.CURRENTFLOWKEY, flowKey); actionPerform(); setRequestPathInfo("/feeaction.do"); addRequestParameter("method", "editPreview"); addRequestParameter(Constants.CURRENTFLOWKEY, flowKey); addRequestParameter("amount", "200.0"); addRequestParameter("feeStatus", FeeStatus.INACTIVE.getValue().toString()); actionPerform(); setRequestPathInfo("/feeaction.do"); addRequestParameter("method", "update"); addRequestParameter(Constants.CURRENTFLOWKEY, flowKey); actionPerform(); verifyNoActionErrors(); verifyForward(ActionForwards.update_success.toString()); fee = (FeeBO) TestObjectFactory.getObject(FeeBO.class, fee.getFeeId()); Assert.assertFalse(fee.isActive()); Assert.assertEquals(new Money(getCurrency(), "200.0"), ((AmountFeeBO) fee).getFeeAmount()); }
public void testSuccessfulCreateOneTimeFee() throws Exception { setRequestPathInfo("/feeaction.do"); addRequestParameter("method", "load"); actionPerform(); flowKey = request.getAttribute(Constants.CURRENTFLOWKEY).toString(); setRequestPathInfo("/feeaction.do"); addRequestParameter("method", "preview"); addRequestParameter("categoryType", FeeCategory.ALLCUSTOMERS.getValue().toString()); addRequestParameter("currencyId", TestUtils.RUPEE.getCurrencyId().toString()); addRequestParameter("amount", "100"); addRequestParameter("feeName", "Customer_One_time"); addRequestParameter("feeFrequencyType", FeeFrequencyType.ONETIME.getValue().toString()); addRequestParameter("customerCharge", FeePayment.UPFRONT.getValue().toString()); addRequestParameter("glCode", GLOCDE_ID); addRequestParameter(Constants.CURRENTFLOWKEY, flowKey); actionPerform(); verifyNoActionErrors(); setRequestPathInfo("/feeaction.do"); addRequestParameter("method", "create"); 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("Customer_One_time", fee.getFeeName()); Assert.assertEquals(FeeCategory.ALLCUSTOMERS.getValue(), fee.getCategoryType().getId()); Assert.assertEquals(RateAmountFlag.AMOUNT, fee.getFeeType()); Assert.assertEquals(new Money(getCurrency(), "100.0"), ((AmountFeeBO) fee).getFeeAmount()); Assert.assertTrue(fee.isOneTime()); Assert.assertFalse(fee.isCustomerDefaultFee()); Assert.assertTrue(fee.isActive()); }
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()); }