Package org.mifosplatform.portfolio.interestratechart.domain

Examples of org.mifosplatform.portfolio.interestratechart.domain.InterestIncentivesFields


    private InterestIncentives assembleFrom(final JsonElement element, final InterestRateChartSlab interestRateChartSlab,
            final Locale locale) {
        final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
        final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(INCENTIVE_RESOURCE_NAME);
        InterestIncentivesFields incentivesFields = createInterestIncentiveFields(element, baseDataValidator, locale);
        throwExceptionIfValidationWarningsExist(dataValidationErrors);
        return new InterestIncentives(interestRateChartSlab, incentivesFields);
    }
View Full Code Here


    @Override
    public BigDecimal calculateIncentive(IncentiveDTO incentiveDTO) {
        final Client client = incentiveDTO.client();
        BigDecimal interest = incentiveDTO.interest();
        final InterestIncentivesFields incentivesFields = incentiveDTO.incentives();
        boolean applyIncentive = false;
        switch (incentivesFields.attributeName()) {
            case GENDER:
                if (client.genderId() != null) {
                    applyIncentive = applyIncentive(incentivesFields.conditionType(), Long.valueOf(incentivesFields.attributeValue()),
                            client.genderId());
                }
            break;
            case AGE:
                if (client.dateOfBirth() != null) {
                    final LocalDate dobLacalDate = LocalDate.fromDateFields(client.dateOfBirth());
                    final int age = Years.yearsBetween(dobLacalDate, LocalDate.now()).getYears();
                    applyIncentive = applyIncentive(incentivesFields.conditionType(), Long.valueOf(incentivesFields.attributeValue()),
                            Long.valueOf(age));
                }
            break;
            case CLIENT_TYPE:
                if (client.clientTypeId() != null) {
                    applyIncentive = applyIncentive(incentivesFields.conditionType(), Long.valueOf(incentivesFields.attributeValue()),
                            client.clientTypeId());
                }
            break;
            case CLIENT_CLASSIFICATION:
                if (client.clientClassificationId() != null) {
                    applyIncentive = applyIncentive(incentivesFields.conditionType(), Long.valueOf(incentivesFields.attributeValue()),
                            client.clientClassificationId());
                }
            break;

            default:
            break;

        }
        if (applyIncentive) {
            switch (incentivesFields.incentiveType()) {
                case FIXED:
                    interest = incentivesFields.amount();
                break;
                case INCENTIVE:
                    interest = interest.add(incentivesFields.amount());
                break;
                default:
                break;

            }
View Full Code Here

TOP

Related Classes of org.mifosplatform.portfolio.interestratechart.domain.InterestIncentivesFields

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.