Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -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()