Exemple #1
0
def login():
    '''
	Authenticates a user against the user database
	And logs the user in
	'''
    clear()
    print("\nBANK ACCOUNT LOGIN PROCESS")
    print("***************************")
    print("Please provide your login details below.")

    try:
        account_number = input("\n\nEnter your account number: ")
        password = input("Enter your password: "******"\n\nWrong account number or password!!!")

        try:
            response = input(
                "Press Enter to try again, 1+Enter to create a new account or 0+Enter to Exit: "
            )
        except:
            error_response(login)

        if response == "0":
            exit()
        elif response == "1":
            signup()
        else:
            login()
def withdraw(client):
    '''
	Takes in a client, prompts them for an amount to withdraw
	and updates their account balance with the amount withdrawn
	'''
    clear()
    print("\nWITHDRAW SUB-MENU")
    print("*****************")
    print(f"Your account balance is ${client.get_balance():,.2f}")

    try:
        amount = float(input("\n\nPlease enter the amount to withdraw: "))
    except:
        error_response(withdraw, client)

    response = client.withdraw(amount)

    if response['success']:
        print(f"Successfully withdrawn ${amount:,.2f}")
        print(f"Your new account balance is ${response['balance']:,.2f}")
        input("\n\nPress Enter to proceed: ")
        user_menu(client)
    else:
        print(f"Error: {response['error']}!!!")
        input("\n\nPress Enter to proceed: ")
        withdraw(client)
def deposit(client):
    '''
	Takes in a client, prompts them for an amount to deposit
	and updates their account balance with the amount deposited
	'''
    clear()
    print("\nDEPOSIT SUB-MENU")
    print("*****************")
    print(f"Your account balance is ${client.get_balance():,.2f}")

    try:
        amount = float(input("\n\nPlease enter the amount to deposit: "))
    except:
        error_response(deposit, client)

    response = client.deposit(amount)

    if response['success']:
        print(f"Successfully deposited ${amount:,.2f}")
        print(f"Your new account balance is ${response['balance']:,.2f}")
        input("\n\nPress Enter to proceed: ")
        user_menu(client)
    else:
        print(f"Error: {response['error']}!!!")
        input("\n\nPress Enter to proceed: ")
        deposit(client)
def user_menu(client):
    '''
	Displays user menu and prompts user 
	to select a menu item
	'''
    clear()
    print("\nUSER ACCOUNT MENU")
    print("******************")
    print("\n1. DEPOSIT FUNDS")
    print("2. WITHDRAW FUNDS")
    print("3. MANAGE ACCOUNT DETAILS")
    print("4. MANAGE COMPLAINTS")
    print("5. EXIT")

    try:
        response = int(input("\n\nPlease select an option to proceed: "))
    except:
        error_response(user_menu)

    if response == 1:
        deposit(client)
    elif response == 2:
        withdraw(client)
    elif response == 3:
        manage_account(client)
    elif response == 4:
        manage_complaint(client)
    elif response == 5:
        exit()
    else:
        print("\n\nInvalid option selected. Enter number from 1 to 5")
        input("Press Enter to continue: ")
        user_menu()
Exemple #5
0
def init():
    '''
	Serves as the landing page for the app
	Displaying the Welcome greeting to the user
	'''

    clear()

    print("\nBANKING MENU OPTIONS")
    print("********************")
    print("For your self-service menu, we have the following options:")
    print("\n1. SIGNUP  (If you are new and have no Account)")
    print("2. LOGIN  (If you already have an Account)")
    print("3. EXIT  (To exit the system)")

    try:
        response = int(input("\n\nPlease select an option to proceed: "))
    except:
        error_response(init)

    if response == 1:
        signup()
    elif response == 2:
        login()
    elif response == 3:
        exit()
    else:
        print("You have entered an invalid input. Valid options are 1, 2 or 3")
        input("\n\nPlease press Enter to proceed: ")
        init()
Exemple #6
0
def signup():
    '''
	Creates a client account and adds it to the client list
	Then invokes the login sequence
	'''
    clear()
    print("\nBANK ACCOUNT CREATION PROCESS")
    print("******************************")
    print("Please provide your account details below.")

    try:
        firstname = input("\n\nEnter your first name: ")
        lastname = input("Enter your last name: ")
        email = input("Enter your email address: ")
        password = input("Enter your password: "******"\n\nCongratulations!! Your Account has been successfully created.")
    print(
        f"Your account number is {userid}. Please note it down since it is used for login"
    )

    response = input(
        "\n\nPress Enter to proceed and login or 0+Enter to Exit: ")

    if response == "0": exit()

    login()