Commit f3d67c3b authored by Jadyn Jäger's avatar Jadyn Jäger 🦄

added info option

parent ff3db308
......@@ -15,11 +15,12 @@ def help():
print('bankingCLI by @dl6jj')
print('--password [str] / -p \t can be used to enter the password noninteractivly MAKE SURE THE COMMAND IS NOT SAVED IN .bash_history or similiar')
print('--silent \t\t disables text, only the requested values will be shown')
print('--account / -a \t set the account for the following args (IBAN)')
print('--account [IBAN] / -a \t set the account for the following args')
print('--accounts \t\t returns a list of your accounts (IBAN)')
print('--balance \t\t returns the current balance (-a reqired)')
print('--transactions [days] \t returns a list of the last n transactions (max. 90 days)(-a reqired)')
print('--overview \t shows the current balance and the last transactions(-a reqired)')
print('--balance \t\t returns the current balance (-a required)')
print('--transactions [days] \t returns a list of the last n transactions (max. 90 days)(-a required)')
print('--overview \t\t shows the current balance and the last transactions(-a required)')
print('--info \t\t\t shows more information about the selected account or the bank (if no account is selected)')
print('--setup \t\t runs the setup process (interactive)')
print('--help \t\t\t shows this')
......@@ -99,13 +100,40 @@ def getAccountByIBAN(iban):
return account
return None
def print_loud(str):
def showAccountInfo(iban):
connectFinTS()
account = getAccountByIBAN(iban)
if(account == None):
info = finTS.get_information()
print_loud("Bank:", end =" ")
print(info["bank"]["name"])
else:
info = finTS.get_information()
print_loud("IBAN:", end =" ")
print(account.iban)
print_loud("BIC:", end =" ")
print(account.bic)
print_loud("Accountnumber:", end =" ")
print(account.accountnumber)
print_loud("BLZ:", end =" ")
print(account.blz)
for account_info in info["accounts"]:
if account_info["iban"] == iban:
print_loud("Owner:", end =" ")
print(account_info["owner_name"][0])
print_loud("Customer ID:", end =" ")
print(account_info["customer_id"])
print_loud("Name:", end =" ")
print(account_info["product_name"])
def print_loud(str, *args, **kwargs):
if not silent:
print(str)
print(str, *args, **kwargs)
def main(argv):
try:
opts, args = getopt.getopt(argv,"h?a:p:",["balance","transactions=","setup","help","accounts","account=", "silent", "password=", "overview"])
opts, args = getopt.getopt(argv,"h?a:p:",["balance","transactions=","setup","help","accounts","account=", "silent", "password=", "overview", "info"])
except getopt.GetoptError:
help()
sys.exit(2)
......@@ -135,6 +163,8 @@ def main(argv):
elif opt == "--overview":
showBalance(account)
showTransactions(account, "30")
elif opt == "--info":
showAccountInfo(account)
exit()
if __name__ == "__main__":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment