Validate Razorpay refund amount against payment
All checks were successful
build-and-deploy / build-deploy (push) Successful in 35s

This commit is contained in:
androidlover5842
2026-02-01 16:56:07 +05:30
parent 758919c969
commit 5d4748043f

View File

@@ -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")
}