Spaces:
Runtime error
Runtime error
File size: 828 Bytes
9d9d2a1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 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()
|