Ejemplo n.º 1
0
    def create_account(self):
        """Function to create an account in the bank

        Args:
            None

        """
        account_type = DataValidation.check_valid_account_type("Would you like a checking or savings account? ")
        # exit create_account if user types '0' without proceeding to first_name prompt
        if not account_type:
            return None
        first_name = DataValidation.check_valid_name("What is your first name? ")
        # exit create_account if user types '0' without proceeding to last_name prompt
        if not first_name:
            return None
        last_name = DataValidation.check_valid_name("What is your last name? ")
        # exit create_account if user types '0' without proceeding to ssn prompt
        if not last_name:
            return None
        ssn = DataValidation.check_valid_ssn("What is your social security number? ")
        # exit create_account if user types '0' without proceeding to initial deposit prompt
        if not ssn:
            return None
        initial_deposit = DataValidation.get_valid_initial_deposit(account_type, "What is your initial deposit? ")
        # exit create_account if user types '0' without proceeding to instanciate account
        if not initial_deposit:
            return None

        # create account and add customer to bank
        account = self.bank.add_account(initial_deposit, account_type)
        customer = Customer(first_name, last_name, ssn, account)
        self.bank.add_customer(customer)