Search in sources :

Example 11 with ProductDetailsDto

use of org.mifos.dto.domain.ProductDetailsDto in project head by mifos.

the class LoanProductFormBeanAssembler method translateToLoanProductDetails.

private ProductDetailsDto translateToLoanProductDetails(LoanProductFormBean loanProductFormBean) {
    Integer category = Integer.valueOf(loanProductFormBean.getGeneralDetails().getSelectedCategory());
    Integer applicableFor = Integer.valueOf(loanProductFormBean.getGeneralDetails().getSelectedApplicableFor());
    DateTime startDate = new DateTime().withDate(Integer.valueOf(loanProductFormBean.getGeneralDetails().getStartDateYear()), loanProductFormBean.getGeneralDetails().getStartDateMonth(), loanProductFormBean.getGeneralDetails().getStartDateDay());
    DateTime endDate = null;
    if (StringUtils.isNotBlank(loanProductFormBean.getGeneralDetails().getEndDateYear())) {
        endDate = new DateTime().withDate(Integer.valueOf(loanProductFormBean.getGeneralDetails().getEndDateYear()), loanProductFormBean.getGeneralDetails().getEndDateMonth(), loanProductFormBean.getGeneralDetails().getEndDateDay());
    }
    ProductDetailsDto productDetailsDto = new ProductDetailsDto(loanProductFormBean.getGeneralDetails().getName(), loanProductFormBean.getGeneralDetails().getShortName(), loanProductFormBean.getGeneralDetails().getDescription(), category, startDate, endDate, applicableFor);
    productDetailsDto.setId(loanProductFormBean.getGeneralDetails().getId());
    if (StringUtils.isNotBlank(loanProductFormBean.getGeneralDetails().getSelectedStatus())) {
        productDetailsDto.setStatus(Integer.valueOf(loanProductFormBean.getGeneralDetails().getSelectedStatus()));
    }
    return productDetailsDto;
}
Also used : ProductDetailsDto(org.mifos.dto.domain.ProductDetailsDto) DateTime(org.joda.time.DateTime)

Example 12 with ProductDetailsDto

use of org.mifos.dto.domain.ProductDetailsDto in project head by mifos.

the class LoanProductFormBeanAssembler method toLoanProductDto.

public LoanProductRequest toLoanProductDto(LoanProductFormBean loanProductFormBean) {
    ProductDetailsDto loanProductDetails = translateToLoanProductDetails(loanProductFormBean);
    LoanAmountDetailsDto loanAmountDetails = translateToLoanAmountDetails(loanProductFormBean);
    Integer interestRateType = Integer.valueOf(loanProductFormBean.getSelectedInterestRateCalculationType());
    Double maxInterest = Double.valueOf(loanProductFormBean.getMaxInterestRate());
    Double minInterest = Double.valueOf(loanProductFormBean.getMinInterestRate());
    Double defaultInterest = Double.valueOf(loanProductFormBean.getDefaultInterestRate());
    MinMaxDefaultDto interestRateRange = MinMaxDefaultDto.create(minInterest, maxInterest, defaultInterest);
    RepaymentDetailsDto repaymentDetails = translateToRepaymentDetails(loanProductFormBean);
    List<Integer> applicableFees = new ArrayList<Integer>();
    if (loanProductFormBean.getSelectedFees() != null) {
        for (String feeId : loanProductFormBean.getSelectedFees()) {
            applicableFees.add(Integer.valueOf(feeId));
        }
    }
    List<Integer> applicablePenalties = new ArrayList<Integer>();
    if (loanProductFormBean.getSelectedPenalties() != null) {
        for (String penaltyId : loanProductFormBean.getSelectedPenalties()) {
            applicablePenalties.add(Integer.valueOf(penaltyId));
        }
    }
    AccountingDetailsDto accountDetails = translateToAccountingDetails(loanProductFormBean);
    Integer currencyId = null;
    if (StringUtils.isNotBlank(loanProductFormBean.getSelectedCurrency())) {
        currencyId = Integer.valueOf(loanProductFormBean.getSelectedCurrency());
    }
    return new LoanProductRequest(loanProductDetails, loanProductFormBean.isIncludeInLoanCycleCounter(), loanProductFormBean.isWaiverInterest(), currencyId, loanAmountDetails, interestRateType, interestRateRange, repaymentDetails, applicableFees, applicablePenalties, accountDetails);
}
Also used : LoanAmountDetailsDto(org.mifos.dto.screen.LoanAmountDetailsDto) ArrayList(java.util.ArrayList) ProductDetailsDto(org.mifos.dto.domain.ProductDetailsDto) MinMaxDefaultDto(org.mifos.dto.domain.MinMaxDefaultDto) LowerUpperMinMaxDefaultDto(org.mifos.dto.domain.LowerUpperMinMaxDefaultDto) AccountingDetailsDto(org.mifos.dto.screen.AccountingDetailsDto) RepaymentDetailsDto(org.mifos.dto.domain.RepaymentDetailsDto) LoanProductRequest(org.mifos.dto.domain.LoanProductRequest)

Aggregations

ProductDetailsDto (org.mifos.dto.domain.ProductDetailsDto)12 ArrayList (java.util.ArrayList)5 DateTime (org.joda.time.DateTime)5 BigDecimal (java.math.BigDecimal)4 MifosRuntimeException (org.mifos.core.MifosRuntimeException)3 SavingsProductDto (org.mifos.dto.domain.SavingsProductDto)3 LoanAmountDetailsDto (org.mifos.dto.screen.LoanAmountDetailsDto)3 PersistenceException (org.mifos.framework.exceptions.PersistenceException)3 FeeBO (org.mifos.accounts.fees.business.FeeBO)2 GLCodeEntity (org.mifos.accounts.financial.business.GLCodeEntity)2 FundBO (org.mifos.accounts.fund.business.FundBO)2 PenaltyBO (org.mifos.accounts.penalties.business.PenaltyBO)2 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)2 PrdApplicableMasterEntity (org.mifos.accounts.productdefinition.business.PrdApplicableMasterEntity)2 PrdStatusEntity (org.mifos.accounts.productdefinition.business.PrdStatusEntity)2 ProductCategoryBO (org.mifos.accounts.productdefinition.business.ProductCategoryBO)2 PrdOfferingPersistence (org.mifos.accounts.productdefinition.persistence.PrdOfferingPersistence)2 ApplicableTo (org.mifos.accounts.productdefinition.util.helpers.ApplicableTo)2 InterestType (org.mifos.accounts.productdefinition.util.helpers.InterestType)2 MeetingBO (org.mifos.application.meeting.business.MeetingBO)2