diff --git a/src/com/apmath/calculations/application/v1/actions/GetNextPayment.kt b/src/com/apmath/calculations/application/v1/actions/GetNextPayment.kt index 98bf5d7..46238df 100644 --- a/src/com/apmath/calculations/application/v1/actions/GetNextPayment.kt +++ b/src/com/apmath/calculations/application/v1/actions/GetNextPayment.kt @@ -70,6 +70,6 @@ suspend fun ApplicationCall.v1GetNextPayment(paymentService: PaymentServiceInter } catch (e: PaymentLessThanRegularException) { throw BadRequestException("Payment amount can not be less than regular payment amount") } catch (e: PaymentMoreThanFullEarlyRepaimentException) { - throw BadRequestException("Payment amount cannot be more than credit full early repaiment amount") + throw BadRequestException("Payment amount cannot be more than credit full early repaiment amount = ${e.fullEarlyRepayment}") } } diff --git a/src/com/apmath/calculations/domain/payments/payment/PaymentService.kt b/src/com/apmath/calculations/domain/payments/payment/PaymentService.kt index e9758e9..7f8ca73 100644 --- a/src/com/apmath/calculations/domain/payments/payment/PaymentService.kt +++ b/src/com/apmath/calculations/domain/payments/payment/PaymentService.kt @@ -44,7 +44,7 @@ class PaymentService(loanInitService: LoanInitServiceInterface) : AbstractPaymen presentLoanWithPayment.paymentAmount < 100 && presentLoanWithPayment.paymentAmount != nextPayment.amount -> throw PaymentLessThanMinimalException() presentLoanWithPayment.paymentAmount > nextPayment.fullEarlyRepayment - -> throw PaymentMoreThanFullEarlyRepaimentException() + -> throw PaymentMoreThanFullEarlyRepaimentException(nextPayment.fullEarlyRepayment) presentLoanWithPayment.paymentAmount < presentLoanWithPayment.regularPaymentAmount && presentLoanWithPayment.regularPaymentAmount < nextPayment.fullEarlyRepayment -> throw PaymentLessThanRegularException() diff --git a/src/com/apmath/calculations/domain/payments/payment/exceptions/PaymentMoreThanFullEarlyRepaimentException.kt b/src/com/apmath/calculations/domain/payments/payment/exceptions/PaymentMoreThanFullEarlyRepaimentException.kt index 4258e8d..9dfbc4d 100644 --- a/src/com/apmath/calculations/domain/payments/payment/exceptions/PaymentMoreThanFullEarlyRepaimentException.kt +++ b/src/com/apmath/calculations/domain/payments/payment/exceptions/PaymentMoreThanFullEarlyRepaimentException.kt @@ -1,4 +1,6 @@ package com.apmath.calculations.domain.payments.payment.exceptions +import com.apmath.calculations.domain.data.Money -class PaymentMoreThanFullEarlyRepaimentException : Exception() + +class PaymentMoreThanFullEarlyRepaimentException(val fullEarlyRepayment: Money) : Exception()