can cancel a rental request before owner approval

This commit is contained in:
jackiettran
2026-01-10 19:22:15 -05:00
parent 860b6d6160
commit 86cb8b3fe0
2 changed files with 70 additions and 6 deletions

View File

@@ -93,8 +93,12 @@ class RefundService {
};
}
// Check payment status - allow cancellation for both paid and free rentals
if (rental.paymentStatus !== "paid" && rental.paymentStatus !== "not_required") {
// Allow cancellation for pending rentals (before owner approval) or paid/free rentals
const isPendingRequest = rental.status === "pending";
const isPaymentSettled =
rental.paymentStatus === "paid" || rental.paymentStatus === "not_required";
if (!isPendingRequest && !isPaymentSettled) {
return {
canCancel: false,
reason: "Cannot cancel rental that hasn't been paid",