Add rate plans, room stay rates, and payments ledger
All checks were successful
build-and-deploy / build-deploy (push) Successful in 34s

This commit is contained in:
androidlover5842
2026-01-29 04:56:37 +05:30
parent b6ac87d277
commit 71c70c8554
24 changed files with 902 additions and 4 deletions

View File

@@ -13,6 +13,7 @@ import com.android.trisolarisserver.db.repo.BookingRepo
import com.android.trisolarisserver.models.booking.BookingStatus
import com.android.trisolarisserver.models.booking.TransportMode
import com.android.trisolarisserver.models.room.RoomStay
import com.android.trisolarisserver.models.room.RateSource
import com.android.trisolarisserver.models.property.Role
import com.android.trisolarisserver.repo.AppUserRepo
import com.android.trisolarisserver.repo.PropertyRepo
@@ -142,6 +143,10 @@ class BookingFlow(
room = room,
fromAt = checkInAt,
toAt = null,
rateSource = parseRateSource(request.rateSource),
nightlyRate = request.nightlyRate,
ratePlanCode = request.ratePlanCode,
currency = request.currency ?: booking.property.currency,
createdBy = actor
)
roomStayRepo.save(stay)
@@ -273,6 +278,10 @@ class BookingFlow(
room = room,
fromAt = fromAt,
toAt = toAt,
rateSource = parseRateSource(request.rateSource),
nightlyRate = request.nightlyRate,
ratePlanCode = request.ratePlanCode,
currency = request.currency ?: booking.property.currency,
createdBy = actor
)
roomStayRepo.save(stay)
@@ -303,6 +312,15 @@ class BookingFlow(
}
}
private fun parseRateSource(value: String?): RateSource? {
if (value.isNullOrBlank()) return null
return try {
RateSource.valueOf(value.trim())
} catch (_: IllegalArgumentException) {
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Unknown rate source")
}
}
private fun isTransportModeAllowed(
property: com.android.trisolarisserver.models.property.Property,
mode: TransportMode