Ejemplo n.º 1
0
def get_new_customer() -> Customer:
    """
    Collects information from console input and returns a new
    Customer object
    :return: Customer
    """
    print("\n-- PERSONAL INFORMATION --")
    print("To start an order you must provide the following details.\n")

    print("- NAME -")
    first_name = get_valid_input("Please type your FIRST NAME: ", validate_name)
    last_name = get_valid_input("Please type your LAST NAME: ", validate_name)

    print("\n- CONTACT -")
    email = get_valid_input("Please type your EMAIL address: ", validate_email)
    phone = get_valid_input("Please type your PHONE NUMBER: ", validate_phone).replace("-","").replace("(", "").replace(")", "")

    print("\n- ADDRESS -")
    print("Please type your ADDRESS using the following form.")
    print("HOUSE # Street Name, City, State/Province, ZIP/Postal Code")
    print("EXAMPLE: 700 Pennsylvania Avenue NW, Washington, DC, 20408")

    address = get_valid_input("ADDRESS: ", validate_address)

    customer = Customer(last_name, first_name, email, phone, address)
    return customer
Ejemplo n.º 2
0
 def __init__(self, *args, **kwargs):
     tk.Tk.__init__(self, *args, **kwargs)
     self.frames = {}
     container = tk.Frame(self)
     container.pack(side="top", fill="both", expand=True)
     container.grid_rowconfigure(0, weight=1)
     container.grid_columnconfigure(0, weight=1)
     self.title_font = tkfont.Font(family='Helvetica',
                                   size=18,
                                   weight="bold",
                                   slant="italic")
     self.total_price = 0.0
     self.customer = Customer(
         "a", "b", "*****@*****.**", '3467837773',
         "700 Pennsylvaia Avenue NW, Washington, DC, 20408")
     self.order = None
     # ADD ALL OTHER PAGES HERE IN THIS list
     for F in (StartPage, InfoPage, RestPage, MenuPage, CheckoutPage,
               PayPage, CreditCardPage):
         page_name = F.__name__
         frame = F(parent=container, controller=self)
         frame.configure(bg="blue")
         self.frames[page_name] = frame
         # put all of the pages in the same location;
         # the one on the top of the stacking order
         # will be the one that is visible.
         frame.grid(row=0, column=0, sticky="nsew")
     self.show_frame("StartPage")
Ejemplo n.º 3
0
def get_menu():
    customer = Customer('Barack', 'Obama', '*****@*****.**',
                        '2024561111', '40 Bay St, Toronto, ON, M5J2X2')
    my_local_dominos = StoreLocator.find_closest_store_to_customer(customer)
    if (my_local_dominos):
        print(my_local_dominos)
        menu = my_local_dominos.get_menu()
        return 1, menu.search(Name='Coke'), menu.search(Name='Pizza')
    else:
        return 0, [[]], [[]]
Ejemplo n.º 4
0
    def get_new_customer() -> Customer:
        """
        Collects information from console input and returns a new
        Customer object

        :return: Customer
        """
        print("-- PERSONAL INFORMATION --")
        print("To start an order you must provide the following details.\n")
        print("- COUNTRY -")
        is_canada = input(
            "If you are ordering from Canada please type \"YES\" now: ")
        if is_canada.strip().upper() in ["YES", "Y", "YA"]:
            ConsoleInput.country = "IN"

        print("\n- NAME -")
        first_name = ConsoleInput.get_valid_input(
            "Please type your FIRST NAME: ", ConsoleInput.validate_name)
        last_name = ConsoleInput.get_valid_input(
            "Please type your LAST NAME: ", ConsoleInput.validate_name)

        print("\n- CONTACT -")
        email = ConsoleInput.get_valid_input(
            "Please type your EMAIL address: ", ConsoleInput.validate_email)
        phone = ConsoleInput.get_valid_input(
            "Please type your PHONE NUMBER (no area code): ",
            ConsoleInput.validate_phone).replace("-", "").replace("(",
                                                                  "").replace(
                                                                      ")", "")

        print("\n- ADDRESS -")
        print("Please type your ADDRESS using the following form.")
        print(
            "HOUSE #, Full Street Name, City, State/Province, ZIP/Postal Code")
        if ConsoleInput.country == "US":
            print("EXAMPLE: 700 Pennsylvania Avenue NW, Washington, DC, 20408")
        else:
            print(
                "CANADA ADDRESS EXAMPLE: 100 Wellington St, Ottawa, ON, K1A0A9"
            )

        address = ConsoleInput.get_valid_input("ADDRESS: ",
                                               ConsoleInput.validate_address)

        customer = Customer(last_name, first_name, email, phone, address)
        return customer
Ejemplo n.º 5
0
from pizzapy import Customer, StoreLocator, Menu, Order, CreditCard
import requests

customer = Customer("Saul", "Tobias", "*****@*****.**", "7138150697", "4823 Bayou Ln, Rosharon, TX, 77583")

service = 'Carryout'

print(customer)
try:
    myLocalDominos = StoreLocator.find_closest_store_to_customer(customer, service)
except Exception:
    print("No stores open at this moment")
    print("Exiting Program.....")
    exit()

print(myLocalDominos)
details = myLocalDominos.get_details()
print(details['ServiceHoursDescription'])

#menu = myLocalDominos.get_menu()

#print(menu)

#menu.search(Name="Coke")

#order = Order.begin_customer_order(customer, myLocalDominos)
#order.add_item('P12IPAZA')

#print(order)
 def load_customer(filename):
     return Customer.load(filename)
Ejemplo n.º 7
0
        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 = Customer("Tim", "Tech", "*****@*****.**", "9057678989",
                    "32 Lanewood Drive, Aurora, ON, L4G4T7")

my_local_dominos = StoreLocator.find_closest_store_to_customer(customer)
print(my_local_dominos)
print("\nMENU\n")

menu = my_local_dominos.get_menu()
order = Order.begin_customer_order(customer, my_local_dominos)

searchMenu(menu)
addToOrder(order)
Ejemplo n.º 8
0
        print(
            "Please enter the item code you would like to add to your order..."
        )
        print("Press Enter to stop ordering")
        itemID = input("Code: ").upper()
        try:
            pizzaOrder.add_item(itemID, 1)
        except:
            if itemID == "":
                break
            print("Invalid Code...")
            break


# Initialize Necessary Values
customer = Customer('Pranav', 'Chati', '*****@*****.**', '5133109580',
                    '6562 Glenstone Way, Mason, OH, 45040')

my_local_dominos = StoreLocator.find_closest_store_to_customer(customer)
menu = my_local_dominos.get_menu()
order = Order.begin_customer_order(customer, my_local_dominos)
savedOrder = Order.begin_customer_order(customer, my_local_dominos)
# TODO add savedOrder

while True:
    searchedSavedOrder = input("Enter Saved Order: ").strip().lower()
    if searchedSavedOrder == "me":
        # TODO add only a pizza for myself
        break
    elif searchedSavedOrder == "family":
        # TODO add family pizza order
        break
Ejemplo n.º 9
0
                break
            print("Invalid Code...")


def show_stores(customer, k):
    print("\nFinding Closest Stores...")
    print("\n- CLOSEST STORES -")
    k_local_dominos = StoreLocator.find_k_closest_stores_to_customer(
        customer, k)
    for i, store in enumerate(k_local_dominos):
        print(str(i + 1) + ".")
        print(store)
        print()


customer = Customer("Noah", "Foley", "*****@*****.**", "9039181598",
                    "40 Bay Street, Toronto, ON, M5J2X2")
# 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, "ca")

while True: