Search in sources :

Example 6 with AccountApplyPaymentActionForm

use of org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm in project head by mifos.

the class AccountApplyGroupPaymentAction method previous.

@TransactionDemarcate(joinToken = true)
public ActionForward previous(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, @SuppressWarnings("unused") HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    //workaround for checkbox problem
    AccountApplyPaymentActionForm accountApplyPaymentActionForm = (AccountApplyPaymentActionForm) form;
    accountApplyPaymentActionForm.setTruePrintReceipt(accountApplyPaymentActionForm.getPrintReceipt());
    accountApplyPaymentActionForm.setPrintReceipt(false);
    return mapping.findForward(ActionForwards.previous_success.toString());
}
Also used : AccountApplyPaymentActionForm(org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 7 with AccountApplyPaymentActionForm

use of org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm in project head by mifos.

the class AccountApplyPaymentAction method validate.

@TransactionDemarcate(joinToken = true)
public ActionForward validate(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    String method = (String) request.getAttribute("methodCalled");
    String forward = null;
    //workaround for checkbox problem
    AccountApplyPaymentActionForm accountApplyPaymentActionForm = (AccountApplyPaymentActionForm) form;
    accountApplyPaymentActionForm.setTruePrintReceipt(accountApplyPaymentActionForm.getPrintReceipt());
    accountApplyPaymentActionForm.setPrintReceipt(false);
    if (method != null) {
        forward = method + "_failure";
    }
    return mapping.findForward(forward);
}
Also used : AccountApplyPaymentActionForm(org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 8 with AccountApplyPaymentActionForm

use of org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm in project head by mifos.

the class ApplyPaymentActionStrutsTest method xtestApplyPaymentForLoanWhenReceiptDateisNull.

public void xtestApplyPaymentForLoanWhenReceiptDateisNull() throws Exception {
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    accountBO = createLoanAccount();
    SessionUtils.setAttribute(Constants.ACCOUNT_VERSION, accountBO.getVersionNo(), request);
    SessionUtils.setAttribute(Constants.ACCOUNT_TYPE, AccountTypes.getAccountType(accountBO.getAccountType().getAccountTypeId()).name(), request);
    SessionUtils.setAttribute(Constants.ACCOUNT_ID, accountBO.getAccountId(), request);
    accountBO.setUserContext(TestObjectFactory.getContext());
    PersonnelBO loggedInUser = IntegrationTestObjectMother.testUser();
    accountBO.changeStatus(AccountState.LOAN_ACTIVE_IN_BAD_STANDING, null, "", loggedInUser);
    AccountApplyPaymentActionForm accountApplyPaymentActionForm = new AccountApplyPaymentActionForm();
    accountApplyPaymentActionForm.setAmount("212");
    request.getSession().setAttribute("applyPaymentActionForm", accountApplyPaymentActionForm);
    setRequestPathInfo("/applyPaymentAction");
    addRequestParameter("input", "loan");
    addRequestParameter("method", "applyPayment");
    addRequestParameter("accountId", accountBO.getAccountId().toString());
    addRequestParameter("receiptId", "101");
    String currentDate = DateUtils.makeDateAsSentFromBrowser();
    addRequestDateParameter("receiptDate", "");
    addRequestDateParameter("transactionDate", currentDate);
    addRequestParameter("paymentTypeId", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
    actionPerform();
    verifyForward("loan_detail_page");
    Assert.assertEquals(new Money(getCurrency()), accountBO.getTotalPaymentDue());
    Assert.assertEquals(0, accountBO.getTotalInstallmentsDue().size());
    Assert.assertEquals(AccountStates.LOANACC_ACTIVEINGOODSTANDING, accountBO.getAccountState().getId().shortValue());
}
Also used : Money(org.mifos.framework.util.helpers.Money) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) AccountApplyPaymentActionForm(org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm)

Example 9 with AccountApplyPaymentActionForm

use of org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm in project head by mifos.

the class ApplyPaymentActionStrutsTest method testApplyPaymentPreviewDateValidation.

@Test
public void testApplyPaymentPreviewDateValidation() throws Exception {
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    accountBO = createLoanAccount();
    accountBO.setUserContext(TestObjectFactory.getContext());
    PersonnelBO loggedInUser = IntegrationTestObjectMother.testUser();
    accountBO.changeStatus(AccountState.LOAN_ACTIVE_IN_BAD_STANDING, null, "", loggedInUser);
    AccountApplyPaymentActionForm accountApplyPaymentActionForm = new AccountApplyPaymentActionForm();
    accountApplyPaymentActionForm.setAmount("212");
    request.getSession().setAttribute("applyPaymentActionForm", accountApplyPaymentActionForm);
    setRequestPathInfo("/applyPaymentAction");
    addRequestParameter("input", "loan");
    addRequestParameter("method", "preview");
    addRequestParameter("accountId", accountBO.getAccountId().toString());
    addRequestParameter("receiptId", "101");
    // date fields added individually because we're adding an invalid dat
    addRequestParameter("transactionDateDD", "4");
    addRequestParameter("transactionDateMM", "20");
    addRequestParameter("transactionDateYY", "2007");
    addRequestParameter("paymentTypeId", "1");
    addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
    actionPerform();
    verifyActionErrors(new String[] { AccountConstants.ERROR_INVALIDDATE });
    verifyInputForward();
}
Also used : PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) AccountApplyPaymentActionForm(org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm) Test(org.junit.Test)

Example 10 with AccountApplyPaymentActionForm

use of org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm in project head by mifos.

the class AccountApplyGroupIndividualAction method load.

@TransactionDemarcate(joinToken = true)
public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    UserContext userContext = getUserContext(request);
    AccountApplyPaymentActionForm actionForm = (AccountApplyPaymentActionForm) form;
    actionForm.setReceiptDate(null);
    actionForm.setReceiptId(null);
    actionForm.setPaymentTypeId(null);
    actionForm.setTransactionDate(DateUtils.makeDateAsSentFromBrowser());
    actionForm.setPrintReceipt(false);
    actionForm.setTruePrintReceipt(false);
    final AccountReferenceDto accountReferenceDto = new AccountReferenceDto(Integer.valueOf(actionForm.getAccountId()));
    AccountPaymentDto accountPaymentDto = accountServiceFacade.getAccountPaymentInformation(accountReferenceDto.getAccountId(), request.getParameter(Constants.INPUT), userContext.getLocaleId(), new UserReferenceDto(userContext.getId()), DateUtils.getCurrentJavaDateTime());
    setValuesInSession(request, actionForm, accountPaymentDto);
    actionForm.setLastPaymentDate(accountPaymentDto.getLastPaymentDate());
    actionForm.setAmount(accountPaymentDto.getTotalPaymentDue());
    actionForm.setTransferPaymentTypeId(this.legacyAcceptedPaymentTypeDao.getSavingsTransferId());
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : UserReferenceDto(org.mifos.dto.domain.UserReferenceDto) UserContext(org.mifos.security.util.UserContext) AccountReferenceDto(org.mifos.dto.domain.AccountReferenceDto) AccountPaymentDto(org.mifos.accounts.servicefacade.AccountPaymentDto) AccountApplyPaymentActionForm(org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

AccountApplyPaymentActionForm (org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm)21 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)14 AccountPaymentDto (org.mifos.accounts.servicefacade.AccountPaymentDto)7 UserContext (org.mifos.security.util.UserContext)7 AccountReferenceDto (org.mifos.dto.domain.AccountReferenceDto)6 UserReferenceDto (org.mifos.dto.domain.UserReferenceDto)6 BigDecimal (java.math.BigDecimal)5 Test (org.junit.Test)4 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)4 ActionForward (org.apache.struts.action.ActionForward)3 LoanBO (org.mifos.accounts.loan.business.LoanBO)3 AccountPaymentParametersDto (org.mifos.dto.domain.AccountPaymentParametersDto)3 PaymentTypeDto (org.mifos.dto.domain.PaymentTypeDto)3 CloseSession (org.mifos.framework.util.helpers.CloseSession)3 Money (org.mifos.framework.util.helpers.Money)3 GroupIndividualLoanDto (org.mifos.dto.domain.GroupIndividualLoanDto)2 Date (java.util.Date)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 AccountBO (org.mifos.accounts.business.AccountBO)1 PageExpiredException (org.mifos.framework.exceptions.PageExpiredException)1