Spaces:
Runtime error
Runtime error
| from typing import List, Dict | |
| from src.db.connection import get_conn | |
| from src.db.payments import add_payment, list_payments_for_reservation, sum_payments | |
| def add(db_path: str, reservation_id: int, amount_ro: float, method: str, note: str, changed_by: str) -> int: | |
| conn = get_conn(db_path) | |
| try: | |
| return add_payment(conn, reservation_id, float(amount_ro), method, note, changed_by) | |
| finally: | |
| conn.close() | |
| def list_for_reservation(db_path: str, reservation_id: int) -> List[Dict]: | |
| conn = get_conn(db_path) | |
| try: | |
| return list_payments_for_reservation(conn, reservation_id) | |
| finally: | |
| conn.close() | |
| def total_paid(db_path: str, reservation_id: int) -> float: | |
| conn = get_conn(db_path) | |
| try: | |
| return sum_payments(conn, reservation_id) | |
| finally: | |
| conn.close() | |