Validate Razorpay refund amount against payment
All checks were successful
build-and-deploy / build-deploy (push) Successful in 35s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 35s
This commit is contained in:
@@ -67,6 +67,11 @@ class RazorpayRefundsController(
|
||||
if (payment.booking.id != bookingId || payment.property.id != propertyId) {
|
||||
throw ResponseStatusException(HttpStatus.NOT_FOUND, "Payment not found for booking")
|
||||
}
|
||||
request.amount?.let {
|
||||
if (it > payment.amount) {
|
||||
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "amount must be <= payment amount")
|
||||
}
|
||||
}
|
||||
payment.gatewayPaymentId
|
||||
?: throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Payment is missing gateway id")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user