-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtutorial.py
More file actions
73 lines (58 loc) · 1.77 KB
/
Copy pathtutorial.py
File metadata and controls
73 lines (58 loc) · 1.77 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from pizzapy import Customer, StoreLocator, Order, ConsoleInput
def searchMenu(menu):
print("You are now searching the menu...")
item = input("Type an item to look for: ").strip().lower()
if len(item) > 1:
item = item[0].upper() + item[1:]
print(f"Results for: {item}\n")
menu.search(Name=item)
print()
else:
print("No Results")
def addToOrder(order):
print("Please type the codes of the items you'd like to order...")
print("Press ENTER to stop ordering.")
while True:
item = input("Code: ").upper()
try:
order.add_item(item)
except:
if item == "":
break
print("Invalid Code...")
customer = ConsoleInput.get_new_customer()
my_local_dominos = StoreLocator.find_closest_store_to_customer(customer)
print("\nClosest Store:")
print(my_local_dominos)
ans = input("Would you like to order from this store? (Y/N)")
if ans.lower() not in ["yes", "y"]:
print("Goodbye!")
quit()
print("\nMENU\n")
menu = my_local_dominos.get_menu()
order = Order.begin_customer_order(customer, my_local_dominos, "us")
while True:
searchMenu(menu)
addToOrder(order)
answer = input("Would you like to add more items (y/n)? ")
if answer.lower() not in ["yes", "y"]:
break
total = 0
print("\nYour order is as follows: ")
for item in order.data["Products"]:
price = item["Price"]
print(item["Name"] + " $" + price)
total += float(price)
print("\nYour order total is: $" + str(total) + " + TAX\n")
payment = input("\nWill you be paying CASH or CREDIT CARD? (CASH, CREDIT CARD)")
if payment.lower() in ["card", "credit card"]:
card = ConsoleInput.get_credit_card()
else:
card = False
ans = input("Would you like to place this order? (y/n)")
if ans.lower() in ["y", "yes"]:
order.place(card)
my_local_dominos.place_order(order, card)
print("Order Placed!")
else:
print("Goodbye!")