Skip to content

Commit

Permalink
Merge pull request #15 from MarcoStuurman/add-confirmation-code
Browse files Browse the repository at this point in the history
Added confirmation code to login credentials overview (bunq/tinker_php#25)
  • Loading branch information
OGKevin committed Sep 4, 2018
2 parents dfe9812 + e43cdbd commit e6bac34
Showing 1 changed file with 56 additions and 52 deletions.
108 changes: 56 additions & 52 deletions tinker/libs/share_lib.py
Expand Up @@ -38,6 +38,7 @@ class ShareLib(object):

_POINTER_TYPE_EMAIL = 'EMAIL'
_POINTER_TYPE_IBAN = 'IBAN'
_POINTER_TYPE_PHONE = 'PHONE_NUMBER'

environment_type = None

Expand Down Expand Up @@ -197,11 +198,11 @@ def print_user(cls, user):

print(cls._ECHO_USER)
print(f'''
┌───────────────────────────────────────────────────────────────────────
│ ID │ {user.id_}
├───────────────────────────────────────────────────────────────────────
│ Username │ {user.display_name}
└───────────────────────────────────────────────────────────────────────''')
┌───────────────────────────────────────────────────────────────────────
│ ID {user.id_}
├───────────────────────────────────────────────────────────────────────
│ Username {user.display_name}
└───────────────────────────────────────────────────────────────────────''')

@classmethod
def print_all_monetary_account_bank(cls, all_monetary_account_bank):
Expand All @@ -223,19 +224,19 @@ def print_monetary_account_bank(cls, monetary_account_bank):
pointer_iban = cls.get_first_pointer_iban(monetary_account_bank)

print(f'''
┌───────────────────────────────────────────────────────────────────────
│ ID │ {monetary_account_bank.id_}
├───────────────────────────────────────────────────────────────────────
│ Description │ {monetary_account_bank.description}
├───────────────────────────────────────────────────────────────────────
│ IBAN │ {pointer_iban.value}''')
┌───────────────────────────────────────────────────────────────────────
│ ID {monetary_account_bank.id_}
├───────────────────────────────────────────────────────────────────────
│ Description {monetary_account_bank.description}
├───────────────────────────────────────────────────────────────────────
│ IBAN {pointer_iban.value}''')

if monetary_account_bank.balance is not None:
print(f''' ├───────────────────────────────────────────────────────────────────────
│ Balance │ {monetary_account_bank.balance.currency} {monetary_account_bank.balance.value}''')
print(f''' ├───────────────────────────────────────────────────────────────────────
│ Balance {monetary_account_bank.balance.currency} {monetary_account_bank.balance.value}''')

print(
f' └───────────────────────────────────────────────────────────────────────')
f' └───────────────────────────────────────────────────────────────────────')

@classmethod
def get_first_pointer_iban(cls, monetary_account_bank):
Expand Down Expand Up @@ -267,15 +268,15 @@ def print_payment(cls, payment):
"""

print(f'''
┌───────────────────────────────────────────────────────────────────────
│ ID │ {payment.id_}
├───────────────────────────────────────────────────────────────────────
│ Description │ {payment.description}
├───────────────────────────────────────────────────────────────────────
│ Amount │ {payment.amount.currency} {payment.amount.value}
├───────────────────────────────────────────────────────────────────────
│ Recipient │ {payment.counterparty_alias.label_monetary_account.display_name}
└───────────────────────────────────────────────────────────────────────''')
┌───────────────────────────────────────────────────────────────────────
│ ID {payment.id_}
├───────────────────────────────────────────────────────────────────────
│ Description {payment.description}
├───────────────────────────────────────────────────────────────────────
│ Amount {payment.amount.currency} {payment.amount.value}
├───────────────────────────────────────────────────────────────────────
│ Recipient {payment.counterparty_alias.label_monetary_account.display_name}
└───────────────────────────────────────────────────────────────────────''')

@classmethod
def print_all_request(cls, all_request):
Expand All @@ -295,17 +296,17 @@ def print_request(cls, request):
"""

print(f'''
┌───────────────────────────────────────────────────────────────────────
│ ID │ {request.id_}
├───────────────────────────────────────────────────────────────────────
│ Description │ {request.description}
├───────────────────────────────────────────────────────────────────────
│ Status │ {request.status}
├───────────────────────────────────────────────────────────────────────
│ Amount │ {request.amount_inquired.currency} {request.amount_inquired.value}
├───────────────────────────────────────────────────────────────────────
│ Recipient │ {request.counterparty_alias.label_monetary_account.display_name}
└───────────────────────────────────────────────────────────────────────''')
┌───────────────────────────────────────────────────────────────────────
│ ID {request.id_}
├───────────────────────────────────────────────────────────────────────
│ Description {request.description}
├───────────────────────────────────────────────────────────────────────
│ Status {request.status}
├───────────────────────────────────────────────────────────────────────
│ Amount {request.amount_inquired.currency} {request.amount_inquired.value}
├───────────────────────────────────────────────────────────────────────
│ Recipient {request.counterparty_alias.label_monetary_account.display_name}
└───────────────────────────────────────────────────────────────────────''')

@classmethod
def print_all_card(cls, all_card, all_monetary_account):
Expand Down Expand Up @@ -337,17 +338,17 @@ def print_card(cls, card, all_monetary_account):
f'({card.label_monetary_account_current.label_monetary_account.iban})'

print(f'''
┌───────────────────────────────────────────────────────────────────────
│ ID │ {card.id_}
├───────────────────────────────────────────────────────────────────────
│ Type │ {card.type_}
├───────────────────────────────────────────────────────────────────────
│ Name on Card │ {card.name_on_card}
├───────────────────────────────────────────────────────────────────────
│ Description │ {card.second_line or cls._DEFAULT_CARD_SECOND_LINE}
├───────────────────────────────────────────────────────────────────────
│ Linked Account │ {linked_account}
└───────────────────────────────────────────────────────────────────────''')
┌───────────────────────────────────────────────────────────────────────
│ ID {card.id_}
├───────────────────────────────────────────────────────────────────────
│ Type {card.type_}
├───────────────────────────────────────────────────────────────────────
│ Name on Card {card.name_on_card}
├───────────────────────────────────────────────────────────────────────
│ Description {card.second_line or cls._DEFAULT_CARD_SECOND_LINE}
├───────────────────────────────────────────────────────────────────────
│ Linked Account {linked_account}
└───────────────────────────────────────────────────────────────────────''')

@classmethod
def get_monetary_account_from_label(cls, label_monetary_account_current,
Expand Down Expand Up @@ -379,10 +380,13 @@ def print_all_user_alias(all_user_alias):

for alias in all_user_alias:
print(f'''
┌────────────────┬───────────────────────────────────────────────────────
│ Value │ {alias.value}
├────────────────┼───────────────────────────────────────────────────────
│ Type │ {alias.type_}
├────────────────┼───────────────────────────────────────────────────────
│ Login Code │ 000000
└────────────────┴───────────────────────────────────────────────────────''')
┌───────────────────┬────────────────────────────────────────────────────
│ Value │ {alias.value}
├───────────────────┼────────────────────────────────────────────────────
│ Type │ {alias.type_}
├───────────────────┼────────────────────────────────────────────────────''')
if alias.type_ == ShareLib._POINTER_TYPE_PHONE:
print(''' │ Confirmation Code │ 123456
├───────────────────┼────────────────────────────────────────────────────''')
print(''' │ Login Code │ 000000
└───────────────────┴────────────────────────────────────────────────────''')

0 comments on commit e6bac34

Please sign in to comment.