Data.AccountFactory
index
/home/flempriere/personal_projects/Languages/Python/BeginToCodeWithPython/03_UsefulPython/13_PythonAndGraphicalUserInterfaces/Exercises/03_GraphicalBankingApplication/Data/AccountFactory.py

Exercise 13.3b Account Factory
 
Provides implementations for instantiating bank accounts with valid id's and interest rates
 
Classes
-------
AccountAuthoriser
    class representing an account authorisation system that issues new accounts with an account number, interest rates, and limits

 
Modules
       
Data.Account
random

 
Classes
       
builtins.object
AccountAuthoriser

 
class AccountAuthoriser(builtins.object)
    AccountAuthoriser(account_system)
 
Class representing a system for authorising accounts and issuing interest rates
 
Attributes
----------
savings_interest : int | float
    monthly interest applied to new savings accounts
credit_interest : int | float
    monthly interest applied to new credit accounts
factory_map : dict[str, function]
    mapping from an account type string to the respective factory function
 
  Methods defined here:
__init__(self, account_system)
Create a new `AccountAuthoriser`
 
Parameters
----------
account_system : AccountSystem
    class that supports the Account System Data Management API
calculate_long_term_interest(self, term_limit)
Calculates the bonus interest assigned to a long term savings account
 
Parameters
----------
term_limit : int
    proposed term limit in weeks
 
Returns
-------
float
    interest rate for a long-term savings account
create_credit_account(self, account_holder, withdrawal_limit)
Issue a new credit account to the account holder
 
Parameters
----------
account_holder : str
    Person whose name the account will be registered in
withdrawal_limit : int | float
    Maximum amount that can be withdrawn from the account
 
Returns
-------
CreditAccount
    The new credit account
 
Raises
------
ValueError
    Raised if the account holder is not allowed to open the credit account
create_long_term_savings_account(self, account_holder, term_limit)
Issue a new `LongTermSavingsAccount` to the account holder
 
Parameters
----------
account_holder : str
    Person whose name the account will be registered in. That person
    must hold at least one existing savings account
term_limit : int
    term limit in weeks
 
Returns
-------
LongTermSavingsAccount
    The new long term savings account
 
Raises
------
ValueError
    Raised if the term limit is invalid
ValueError
    Raised if the account holder is not eligible for a long term deposit
create_savings_account(self, account_holder)
Issue a new `SavingsAccount` to the account holder
 
Parameters
---------
account_holder : str
    Person whose name the account will be registered in
 
Returns
-------
SavingsAccount
    The new savings account

Data descriptors defined here:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object