-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBillingController.py
More file actions
55 lines (52 loc) · 1.78 KB
/
BillingController.py
File metadata and controls
55 lines (52 loc) · 1.78 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File: BillingController.py
# Description: This file uses Bill file as a subclass to generate bills,
# process payments, add charges, and get bill details.
# Author: Enrique Gauna
# Date: 2024-11-24
from Bill import Bill
class BillingController:
def __init__(self):
self.bills = []
def generate_bill(self, bill_id, guest_id, booking_id, total_amount):
new_bill = Bill(bill_id, guest_id, booking_id, total_amount)
self.bills.append(new_bill)
print(f"Bill {bill_id} Has been generated")
return new_bill
def payments(self, bill_id, payment_amount):
bill = None
for b in self.bills:
if b.bill_id == bill_id:
bill = b
break
if bill:
bill.process_payment(payment_amount)
else:
print(f"Bill {bill_id} not found.")
def add_charge(self, bill_id, amount):
bill = None
for b in self.bills:
if b.bill_id == bill_id:
bill = b
break
if bill:
bill.add_charge(amount)
else:
print(f"Bill {bill_id} not found.")
def get_bill_details(self, bill_id):
bill = None
for b in self.bills:
if b.bill_id == bill_id:
bill = b
break
if bill:
details = bill.get_bill_details()
print(
f"Bill ID: {details['bill_id']}\n"
f"Guest ID: {details['guest_id']}\n"
f"Booking ID: {details['booking_id']}\n"
f"Total Amount: ${details['total_amount']:.2f}\n"
f"Status: {details['status']}"
)
return bill.get_bill_details()
else:
return f"Bill {bill_id} not found."