Search in sources :

Example 21 with CreateAccountFeeDto

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

the class LoanCreationHelper method translateToAdditionalAccountFeeDtos.

public static List<CreateAccountFeeDto> translateToAdditionalAccountFeeDtos(LoanAccountFormBean formBean) {
    List<CreateAccountFeeDto> accountFees = new ArrayList<CreateAccountFeeDto>();
    int index = 0;
    CreateAccountFeeDto accountFee = null;
    for (Number feeId : formBean.getSelectedFeeId()) {
        if (feeId != null) {
            Number feeAmountOrRate = formBean.getSelectedFeeAmount()[index];
            accountFee = new CreateAccountFeeDto(feeId.intValue(), feeAmountOrRate.toString());
            accountFees.add(accountFee);
        }
        index++;
    }
    return accountFees;
}
Also used : ArrayList(java.util.ArrayList) CreateAccountFeeDto(org.mifos.dto.domain.CreateAccountFeeDto)

Example 22 with CreateAccountFeeDto

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

the class LoanCreationHelper method translateToMemberAccountsFeeDtos.

public static Map<String, List<CreateAccountFeeDto>> translateToMemberAccountsFeeDtos(LoanAccountFormBean formBean) {
    Map<String, List<CreateAccountFeeDto>> memberAccountsFees = new HashMap<String, List<CreateAccountFeeDto>>();
    Number[] defaultFeeIds = formBean.getDefaultFeeId();
    String[] memberGlobalIds = formBean.getClientGlobalId();
    if (defaultFeeIds != null) {
        int memberIndex = 0;
        CreateAccountFeeDto accountFee = null;
        for (String memberId : memberGlobalIds) {
            if (formBean.getClientAmount()[memberIndex] != null) {
                List<CreateAccountFeeDto> accountFees = new ArrayList<CreateAccountFeeDto>();
                int feeIndex = 0;
                for (Number feeId : defaultFeeIds) {
                    Boolean removeDefaultFeeSelected = formBean.getDefaultFeeSelected()[feeIndex];
                    if (removeDefaultFeeSelected == null || !removeDefaultFeeSelected) {
                        Number amount = formBean.getDefaultFeeIndividualAmounts()[feeIndex][memberIndex];
                        accountFee = new CreateAccountFeeDto(feeId.intValue(), amount.toString());
                        accountFees.add(accountFee);
                    }
                    feeIndex++;
                }
                memberAccountsFees.put(memberId, accountFees);
            }
            memberIndex++;
        }
    }
    return memberAccountsFees;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) CreateAccountFeeDto(org.mifos.dto.domain.CreateAccountFeeDto)

Example 23 with CreateAccountFeeDto

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

the class LoanArrearsAgingHelperIntegrationTest method createBasicLoanAccount.

private LoanBO createBasicLoanAccount(final CustomerBO customer, final AccountState state, final LoanOfferingBO loanOffering, String loanAmountAsString, short numInstallments, double interestRate) {
    MeetingBO meeting = TestObjectFactory.createLoanMeeting(customer.getCustomerMeeting().getMeeting());
    List<Date> meetingDates = TestObjectFactory.getMeetingDates(customer.getOfficeId(), meeting, numInstallments);
    LoanOfferingBO loanProduct = IntegrationTestObjectMother.findLoanProductBySystemId(loanOffering.getGlobalPrdOfferingNum());
    BigDecimal loanAmount = BigDecimal.valueOf(Double.valueOf(loanAmountAsString));
    BigDecimal minAllowedLoanAmount = loanAmount;
    BigDecimal maxAllowedLoanAmount = loanAmount;
    LocalDate disbursementDate = new LocalDate(meetingDates.get(0));
    int numberOfInstallments = numInstallments;
    int minAllowedNumberOfInstallments = loanProduct.getEligibleInstallmentSameForAllLoan().getMaxNoOfInstall();
    int maxAllowedNumberOfInstallments = loanProduct.getEligibleInstallmentSameForAllLoan().getMaxNoOfInstall();
    int graceDuration = 0;
    Integer sourceOfFundId = null;
    Integer loanPurposeId = null;
    Integer collateralTypeId = null;
    String collateralNotes = null;
    String externalId = null;
    boolean repaymentScheduleIndependentOfCustomerMeeting = false;
    RecurringSchedule recurringSchedule = null;
    List<CreateAccountFeeDto> accountFees = new ArrayList<CreateAccountFeeDto>();
    CreateLoanAccount createLoanAccount = new CreateLoanAccount(customer.getCustomerId(), loanProduct.getPrdOfferingId().intValue(), state.getValue().intValue(), loanAmount, minAllowedLoanAmount, maxAllowedLoanAmount, interestRate, disbursementDate, null, numberOfInstallments, minAllowedNumberOfInstallments, maxAllowedNumberOfInstallments, graceDuration, sourceOfFundId, loanPurposeId, collateralTypeId, collateralNotes, externalId, repaymentScheduleIndependentOfCustomerMeeting, recurringSchedule, accountFees, new ArrayList<CreateAccountPenaltyDto>());
    return IntegrationTestObjectMother.createClientLoan(createLoanAccount);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) ArrayList(java.util.ArrayList) LocalDate(org.joda.time.LocalDate) Date(java.util.Date) LocalDate(org.joda.time.LocalDate) BigDecimal(java.math.BigDecimal) RecurringSchedule(org.mifos.clientportfolio.loan.service.RecurringSchedule) CreateLoanAccount(org.mifos.clientportfolio.newloan.applicationservice.CreateLoanAccount) CreateAccountPenaltyDto(org.mifos.dto.domain.CreateAccountPenaltyDto) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) CreateAccountFeeDto(org.mifos.dto.domain.CreateAccountFeeDto)

Aggregations

CreateAccountFeeDto (org.mifos.dto.domain.CreateAccountFeeDto)23 ArrayList (java.util.ArrayList)21 LocalDate (org.joda.time.LocalDate)15 RecurringSchedule (org.mifos.clientportfolio.loan.service.RecurringSchedule)13 CreateAccountPenaltyDto (org.mifos.dto.domain.CreateAccountPenaltyDto)13 BigDecimal (java.math.BigDecimal)12 CreateLoanAccount (org.mifos.clientportfolio.newloan.applicationservice.CreateLoanAccount)12 MeetingBO (org.mifos.application.meeting.business.MeetingBO)9 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)8 List (java.util.List)6 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)6 HashMap (java.util.HashMap)5 FeeBO (org.mifos.accounts.fees.business.FeeBO)5 LoanCreationResultDto (org.mifos.dto.screen.LoanCreationResultDto)5 MifosUser (org.mifos.security.MifosUser)5 Date (java.util.Date)4 DateTime (org.joda.time.DateTime)4 Map (java.util.Map)3 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)3 CreateGroupLoanAccount (org.mifos.clientportfolio.newloan.applicationservice.CreateGroupLoanAccount)3