Search in sources :

Example 21 with ConversionError

use of org.mifos.framework.util.helpers.ConversionError in project head by mifos.

the class InstallmentFormatValidatorImpl method processConversionErrors.

private void processConversionErrors(RepaymentScheduleInstallment installment, String identifier, List<ConversionError> conversionErrors, List<ErrorEntry> errorEntries) {
    for (ConversionError error : conversionErrors) {
        String errorText = error.toLocalizedMessage(installment.getCurrency());
        errorEntries.add(new ErrorEntry(INSTALLMENT_TOTAL_AMOUNT_INVALID, identifier, errorText));
    }
}
Also used : ConversionError(org.mifos.framework.util.helpers.ConversionError) ErrorEntry(org.mifos.platform.validations.ErrorEntry)

Example 22 with ConversionError

use of org.mifos.framework.util.helpers.ConversionError in project head by mifos.

the class InstallmentFormatValidatorImpl method setTotalAmountValue.

private void setTotalAmountValue(RepaymentScheduleInstallment installment, String identifier, List<ErrorEntry> errorEntries) {
    LocalizationConverter localizationConverter = new LocalizationConverter(installment.getCurrency());
    DoubleConversionResult conversionResult = localizationConverter.parseDoubleForInstallmentTotalAmount(installment.getTotal());
    List<ConversionError> conversionErrors = conversionResult.getErrors();
    if (conversionErrors.isEmpty()) {
        installment.setTotalValue(conversionResult.getDoubleValue());
    } else {
        processConversionErrors(installment, identifier, conversionErrors, errorEntries);
    }
}
Also used : LocalizationConverter(org.mifos.framework.util.LocalizationConverter) ConversionError(org.mifos.framework.util.helpers.ConversionError) DoubleConversionResult(org.mifos.framework.util.helpers.DoubleConversionResult)

Aggregations

ConversionError (org.mifos.framework.util.helpers.ConversionError)22 DoubleConversionResult (org.mifos.framework.util.helpers.DoubleConversionResult)20 ArrayList (java.util.ArrayList)6 LocalizationConverter (org.mifos.framework.util.LocalizationConverter)1 ErrorEntry (org.mifos.platform.validations.ErrorEntry)1