Beispiel #1
0
def initiate_govt_users():
	#this it the only Government Org
	org = p.IDENTITY_MARKET[0]
	for person in p.POPULATION:
		account = f.create_account(person,org)
	f.debug(1, "Initiate Government Users")
	return 0
def switchOrg(person, org):
	#still works on random utility, after selcting a random org
	f.shuffleList(person.accounts)
	switch = False
	marketID = org.marketID
	utility = f.calc_utility(person, org)
	for accountID in person.accounts:
		if switch == False:
			account = p.ACCOUNTS[accountID]
			if ((account.marketID == marketID) & (account.status == p.ACTIVE_1)):
				if f.calc_utility(person, p.IDENTITY_MARKET[account.orgID]) > utility:
					f.debug(0, "old account"+str(account.displayACCOUNT()))
					f.end_account(account)
					f.create_account(person, org)
					f.debug(1, "switched account"+str(person.displayPERSON()))
					switch = True
	return 0
def switchOrg(person, org):
    #still works on random utility, after selcting a random org
    f.shuffleList(person.accounts)
    switch = False
    marketID = org.marketID
    utility = f.calc_utility(person, org)
    for accountID in person.accounts:
        if switch == False:
            account = p.ACCOUNTS[accountID]
            if ((account.marketID == marketID) &
                (account.status == p.ACTIVE_1)):
                if f.calc_utility(person,
                                  p.IDENTITY_MARKET[account.orgID]) > utility:
                    f.debug(0, "old account" + str(account.displayACCOUNT()))
                    f.end_account(account)
                    f.create_account(person, org)
                    f.debug(1,
                            "switched account" + str(person.displayPERSON()))
                    switch = True
    return 0
def joinOrg(person, org):

	numAcc = f.num_accounts(person,org.marketID)

	if f.already_account(person, org) == False:
		if numAcc < p.ENGAGE_MAX[org.marketID]:
			account = f.create_account(person, org)
			f.debug(0, "Person:%s Joining Org:%s " % (person.personID, org.orgID))
		else:
			f.debug(0, "TOO many accounts: NEED to SWITCH")
			switchOrg(person, org)	
	else: 
		f.debug(0, "Already an account with org "+str(org.orgID))
	return 0
def joinOrg(person, org):

    numAcc = f.num_accounts(person, org.marketID)

    if f.already_account(person, org) == False:
        if numAcc < p.ENGAGE_MAX[org.marketID]:
            account = f.create_account(person, org)
            f.debug(0,
                    "Person:%s Joining Org:%s " % (person.personID, org.orgID))
        else:
            f.debug(0, "TOO many accounts: NEED to SWITCH")
            switchOrg(person, org)
    else:
        f.debug(0, "Already an account with org " + str(org.orgID))
    return 0
Beispiel #6
0
def login_gui():
    """
    Runs Login window and procedures
    :return: None
    """
    window = functions.login_window('Please Login')  # create login window
    while True:
        event, values = window.read()  # read values
        if event == "Login":
            # Attempt to login
            response = user.login(values[0], values[1])
            if response:  # If true show window and close
                window = functions.login_success()
            else:
                window = functions.login_window('Login Unsuccessful')
        elif event == "Create Account":
            # Open window to create account
            create_account_window = functions.create_account_window(
                "Create Account")
            while True:
                create_event, create_values = create_account_window.read()
                if create_event == "Create Account":
                    # Attempt to create new account
                    response, message = functions.create_account(
                        server, create_values[0], create_values[1],
                        create_values[2], create_values[3], create_values[4],
                        secure)
                    if response:
                        # If we create the account, send back to login window
                        create_account_window.close()
                        window = functions.login_window(
                            "Account Created, Please login!")
                        break
                    else:
                        # If there's an error open the create window again with the error
                        create_account_window = functions.create_account_window(
                            f"Unable to create Account: {message}")
                elif create_event == sg.WIN_CLOSED:
                    break
        elif event == sg.WIN_CLOSED:
            break
Beispiel #7
0
            username = input('Please enter your staff Username: '******'Enter your Password: '******'Press: \n 1 to Create new bank account \n 2 to Check Account Details \n 3 to Logout \n Input: '
                    )
                    if staff_option == '1' or staff_option == '2' or staff_option == '3':
                        if staff_option == '1':
                            account_number = create_account()
                            print(
                                'A new account has been created. The customer account number is '
                                + account_number)

                        elif staff_option == '2':
                            account_number = input(
                                'Enter customer account number: ') + ' '
                            customer_details = check_details(account_number)
                            print('Customer details: ' + customer_details)

                        elif staff_option == '3':
                            delete_session()
                            staff_in_session = False

                    else:
Beispiel #8
0
Date: 14/3/2021
'''

from functions import banner, login_screen, login, create_account, options, withdraw, deposit, current_balance, transaction_history
import sys

while True:
    banner()
    login_screen()
    login_choice = int(input('Option: '))

    if login_choice == 1:
        login()
        break
    elif login_choice == 2:
        create_account()
        break
    elif login_choice == 3:
        sys.exit('Thank you for using UBT banking. Have a good day!')
    else:
        print('Invalid option')
        continue

while True:
    options()
    choice = int(input('Option: '))

    if choice == 1:
        withdraw()
    elif choice == 2:
        deposit()