Add advance-booking cancellation policy engine
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:
@@ -5,6 +5,7 @@ import com.android.trisolarisserver.controller.common.requireMember
|
||||
import com.android.trisolarisserver.component.auth.PropertyAccess
|
||||
import com.android.trisolarisserver.controller.dto.payment.BookingBalanceResponse
|
||||
import com.android.trisolarisserver.repo.booking.BookingRepo
|
||||
import com.android.trisolarisserver.repo.booking.ChargeRepo
|
||||
import com.android.trisolarisserver.repo.booking.PaymentRepo
|
||||
import com.android.trisolarisserver.repo.room.RoomStayRepo
|
||||
import com.android.trisolarisserver.security.MyPrincipal
|
||||
@@ -23,6 +24,7 @@ class BookingBalances(
|
||||
private val propertyAccess: PropertyAccess,
|
||||
private val bookingRepo: BookingRepo,
|
||||
private val roomStayRepo: RoomStayRepo,
|
||||
private val chargeRepo: ChargeRepo,
|
||||
private val paymentRepo: PaymentRepo
|
||||
) {
|
||||
|
||||
@@ -43,10 +45,11 @@ class BookingBalances(
|
||||
roomStayRepo.findByBookingId(bookingId),
|
||||
booking.property.timezone
|
||||
)
|
||||
val charges = chargeRepo.sumAmountByBookingId(bookingId)
|
||||
val collected = paymentRepo.sumAmountByBookingId(bookingId)
|
||||
val pending = expected - collected
|
||||
val pending = expected + charges - collected
|
||||
return BookingBalanceResponse(
|
||||
expectedPay = expected,
|
||||
expectedPay = expected + charges,
|
||||
amountCollected = collected,
|
||||
pending = pending
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user