Exemplo n.º 1
0
def show_loginmenu():  #When the user logs in, and is prompted what todo
    account = input('Enter Account #: ')
    pin_num = input("Enter Pin #: ")
    # check if account number is in the json file
    if not account.isnumeric():
        print("Invalid input. Account Number must have numeric values")
        return
        if not pin_num.isnumeric():
            print("Invalid input. Pin # must have numeric values!")
            return
    data = model.load()
    if account in data and pin_num in data[account][
            "pin_num"]:  #checks account num and pin number in data
        print("Please choose an option:")
        print("1. Withdraw")
        print("2. Deposit")
        print("3. Check Balance")
        print("4. Exit")
        option = input()
        while option not in ['1', '2', '3', '4']:
            option = input(
                "Sorry, that's an invalid option! Please choose 1, 2 or 3: ")

        if option == '1':
            model.withdraw(account)
        elif option == '2':
            model.deposit(account)
        elif option == '3':
            model.balance(account)
        elif option == '4':
            return
Exemplo n.º 2
0
def mainmenu(account):
    while True:
        view.show_menu(account)
        selection = view.get_input()
        if selection == '4':
            answer = view.quit_input()
            if answer == "y":
                model.save()
                break
            if answer == "n":
                view.show_menu(account)
        elif selection == '1':
            balance = model.check_balance(account)
            view.show_balance(balance)
        elif selection == '2':
            depbalance = float(view.get_amount_input())
            model.deposit(account, depbalance)
            balance = model.check_balance(account)
            view.show_balance(balance)
        elif selection == '3':
            wdbalance = float(view.get_amount_input())
            model.withdraw(account, wdbalance)
            balance = model.check_balance(account)
            view.show_balance(balance)
        else:
            view.bad_input()
Exemplo n.º 3
0
def customer_menu():
    while True:
        choice = viewer.existing_customer_menu()
        #Deposit
        if choice == "1":
            #Authentication
            name = viewer.get_name()
            pin = viewer.get_pin()
            auth_validation = model.authentication(name, pin)
            if auth_validation == True:
                deposit = viewer.get_deposit_input()
                model.deposit(name, deposit)
            else:
                viewer.wrong_pin()

        #Get Balance
        elif choice == "2":
            #Authentication
            name = viewer.get_name()
            pin = viewer.get_pin()
            print(name, pin)
            auth_validation = model.authentication(name, pin)
            print(auth_validation)
            if auth_validation == True:
                balance = model.get_balance(name)
                viewer.show_balance(balance)
            else:
                viewer.wrong_pin()
        #Withdraw
        elif choice == "3":
            #Authentication
            name = viewer.get_name()
            pin = viewer.get_pin()
            auth_validation = model.authentication(name, pin)
            if auth_validation == True:
                #Withdraw
                withdraw_amount = viewer.get_withdraw_input()
                model.withdraw(name, withdraw_amount)
            else:
                viewer.wrong_pin()
        #Update Pin
        elif choice == "4":
            #Authentication
            name = viewer.get_name()
            pin = viewer.get_pin()
            auth_validation = model.authentication(name, pin)
            if auth_validation == True:
                #Update Pin
                new_pin = viewer.change_pin()
                model.update_pin(name, new_pin)
            else:
                viewer.wrong_pin()

        elif choice == "5":
            viewer.goodbye()
        else:
            viewer.bad_input()
def main_menu(user):
    while True:
        view.print_main_menu(user)
        choice = view.main_prompt()
        """ TODO: add bad input message """
        if choice not in ("1", "2", "3", "4"):
            view.bad_login_input()
            return main_menu(user)
        if choice == "4":
            # user["balance"] += 1.0 # delete this, just demonstrating model.save()
            # model.save(user)
            return login_menu()
        if choice == "3":
            amount = round(float(view.enter_deposit_info()), 2)
            model.deposit(user, amount)
            return main_menu(user)
        if choice == "2":
            amount = round(float(view.enter_withdraw_info()), 2)
            answer = model.withdraw(user, amount)
            if answer == 0:
                view.insufficient_funds()
            return main_menu(user)
        if choice == "1":
            balance = round(model.get_balance(user), 2)
            view.give_balance(balance)
        """ TODO: implement the various options """
Exemplo n.º 5
0
def mainmenu(clientname, accountcheck):
    while True:
        view.show_mainmenu(clientname, accountcheck)
        selection = view.get_input()
        print(selection)
        if selection == '1':
            view.show_balance(model.get_balance(clientname))
        elif selection == '3':
            model.add_fund(clientname, view.get_deposit())

        elif selection == '2':
            model.withdraw(clientname, view.get_withdraw())
            pass
        elif selection == '4':
            view.goodby()
            initialmenu()
        else:
            view.bad_input()