ai removed boilerplate
All checks were successful
build-and-deploy / build-deploy (push) Successful in 31s

This commit is contained in:
androidlover5842
2026-01-31 06:35:06 +05:30
parent 812211f62b
commit f7c0cf5c18
15 changed files with 151 additions and 292 deletions

View File

@@ -257,24 +257,4 @@ class PayuQrPayments(
return request.remoteAddr?.trim()?.ifBlank { null }
}
private fun computeExpectedPay(stays: List<com.android.trisolarisserver.models.room.RoomStay>, timezone: String?): Long {
if (stays.isEmpty()) return 0
val now = nowForProperty(timezone)
var total = 0L
stays.forEach { stay ->
val rate = stay.nightlyRate ?: 0L
if (rate == 0L) return@forEach
val start = stay.fromAt.toLocalDate()
val endAt = stay.toAt ?: now
val end = endAt.toLocalDate()
val nights = daysBetweenInclusive(start, end)
total += rate * nights
}
return total
}
private fun daysBetweenInclusive(start: java.time.LocalDate, end: java.time.LocalDate): Long {
val diff = end.toEpochDay() - start.toEpochDay()
return if (diff <= 0) 1L else diff
}
}