Search in sources :

Example 11 with AccountState

use of org.mifos.accounts.util.helpers.AccountState in project head by mifos.

the class SavingsAccountRESTController method createSavingsAccount.

@RequestMapping(value = "/account/savings/create", method = RequestMethod.POST)
@ResponseBody
public Map<String, String> createSavingsAccount(@RequestParam String globalCustomerNum, @RequestParam(required = false) String amount, @RequestParam Integer productId) throws Throwable {
    CustomerBO customer = validateGlobalCustNum(globalCustomerNum);
    SavingsOfferingBO product = validateProductId(productId);
    String recommendedAmount = null != amount ? amount : product.getRecommendedAmount().toString();
    Integer customerId = customer.getCustomerId();
    AccountState accountState = AccountState.SAVINGS_PENDING_APPROVAL;
    SavingsAccountCreationDto savingsAccountCreation = new SavingsAccountCreationDto(productId, customerId, accountState.getValue(), recommendedAmount);
    Long savings = savingsServiceFacade.createSavingsAccount(savingsAccountCreation);
    SavingsAccountDetailDto details = savingsServiceFacade.retrieveSavingsAccountDetails(savings);
    Map<String, String> map = new HashMap<String, String>();
    map.put("customerName", customer.getDisplayName());
    map.put("productName", product.getPrdOfferingName());
    map.put("interesRate", details.getProductDetails().getInterestRate().toString());
    map.put("interestRatePeriod", details.getProductDetails().getInterestCalculationFrequency().toString());
    map.put("recommendedAmount", recommendedAmount);
    return map;
}
Also used : HashMap(java.util.HashMap) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) CustomerBO(org.mifos.customers.business.CustomerBO) SavingsAccountCreationDto(org.mifos.dto.domain.SavingsAccountCreationDto) AccountState(org.mifos.accounts.util.helpers.AccountState) SavingsAccountDetailDto(org.mifos.dto.domain.SavingsAccountDetailDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 12 with AccountState

use of org.mifos.accounts.util.helpers.AccountState in project head by mifos.

the class LoanBO method openGroupLoanForAccount.

public static LoanBO openGroupLoanForAccount(LoanBO parentLoan, LoanOfferingBO loanProduct, ClientBO member, MeetingBO repaymentDayMeeting, LoanSchedule loanSchedule, LoanProductOverridenDetail overridenDetail, LoanScheduleConfiguration configuration, InstallmentRange installmentRange, AmountRange loanAmountRange, CreationDetail creationDetail, PersonnelBO createdBy, Boolean groupLoan) {
    AccountState loanState = AccountState.LOAN_PENDING_APPROVAL;
    LoanBO standardLoan = new LoanBO(loanProduct, member, loanState, overridenDetail, repaymentDayMeeting, loanSchedule, configuration, installmentRange, loanAmountRange, creationDetail, AccountTypes.GROUP_LOAN_ACCOUNT);
    standardLoan.setParentAccount(parentLoan);
    standardLoan.addAccountStatusChangeHistory(new AccountStatusChangeHistoryEntity(standardLoan.getAccountState(), standardLoan.getAccountState(), createdBy, standardLoan));
    return standardLoan;
}
Also used : AccountState(org.mifos.accounts.util.helpers.AccountState) AccountStatusChangeHistoryEntity(org.mifos.accounts.business.AccountStatusChangeHistoryEntity)

Example 13 with AccountState

use of org.mifos.accounts.util.helpers.AccountState in project head by mifos.

the class LoanBO method isOpen.

@Override
public boolean isOpen() {
    AccountState loanAccountState = AccountState.fromShort(getAccountState().getId());
    List<AccountState> notOpenAccountStates = Arrays.asList(AccountState.LOAN_CANCELLED, AccountState.LOAN_CLOSED_RESCHEDULED, AccountState.LOAN_CLOSED_OBLIGATIONS_MET, AccountState.LOAN_CLOSED_WRITTEN_OFF);
    return !notOpenAccountStates.contains(loanAccountState);
}
Also used : AccountState(org.mifos.accounts.util.helpers.AccountState)

Example 14 with AccountState

use of org.mifos.accounts.util.helpers.AccountState in project head by mifos.

the class LoanAccountServiceFacadeWebTier method retrieveLoanApplicationState.

@Override
public LoanApplicationStateDto retrieveLoanApplicationState() {
    AccountState applicationState = AccountState.LOAN_APPROVED;
    boolean loanPendingApprovalEnabled = ProcessFlowRules.isLoanPendingApprovalStateEnabled();
    if (loanPendingApprovalEnabled) {
        applicationState = AccountState.LOAN_PENDING_APPROVAL;
    }
    return new LoanApplicationStateDto(AccountState.LOAN_PARTIAL_APPLICATION.getValue().intValue(), applicationState.getValue().intValue());
}
Also used : LoanApplicationStateDto(org.mifos.clientportfolio.newloan.applicationservice.LoanApplicationStateDto) AccountState(org.mifos.accounts.util.helpers.AccountState)

Aggregations

AccountState (org.mifos.accounts.util.helpers.AccountState)14 AccountException (org.mifos.accounts.exceptions.AccountException)5 CustomerBO (org.mifos.customers.business.CustomerBO)5 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)5 PersistenceException (org.mifos.framework.exceptions.PersistenceException)5 Money (org.mifos.framework.util.helpers.Money)5 MifosRuntimeException (org.mifos.core.MifosRuntimeException)4 HibernateSearchException (org.mifos.framework.exceptions.HibernateSearchException)4 PageExpiredException (org.mifos.framework.exceptions.PageExpiredException)4 ServiceException (org.mifos.framework.exceptions.ServiceException)4 StatesInitializationException (org.mifos.framework.exceptions.StatesInitializationException)4 MifosUser (org.mifos.security.MifosUser)4 BusinessRuleException (org.mifos.service.BusinessRuleException)4 AccountStatusChangeHistoryEntity (org.mifos.accounts.business.AccountStatusChangeHistoryEntity)3 SavingsOfferingBO (org.mifos.accounts.productdefinition.business.SavingsOfferingBO)3 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)3 InvalidDateException (org.mifos.application.admin.servicefacade.InvalidDateException)3 UserContext (org.mifos.security.util.UserContext)3 LocalDate (org.joda.time.LocalDate)2 AccountStateEntity (org.mifos.accounts.business.AccountStateEntity)2