Пример #1
0
def main():
    all_option = ShareLib.parse_all_option()
    environment_type = ShareLib.determine_environment_type_from_all_option(all_option)

    ShareLib.print_header()

    bunq = BunqLib(environment_type)

    account_id = ShareLib.determine_account_id_from_all_option_or_std_in(all_option)
    name = ShareLib.determine_name_from_all_option_or_std_in(all_option)

    print(f'''
  | Updating Name:      {name}
  | of Account:         {account_id}
   
    ...
''')

    bunq.update_account(name, account_id)

    print('''
  | ✅  Account updated

  | ▶  Check your changed overview

''')

    bunq.update_context()
Пример #2
0
def main():
    all_option = ShareLib.parse_all_option()
    environment_type = ShareLib.determine_environment_type_from_all_option(
        all_option)

    ShareLib.print_header()

    bunq = BunqLib(environment_type)

    amount = ShareLib.determine_amount_from_all_option_or_std_in(all_option)
    description = ShareLib.determine_description_from_all_option_or_std_in(
        all_option)
    recipient = ShareLib.determine_recipient_from_all_option_or_std_in(
        all_option)

    print(f'''
  | Requesting:   € {amount}
  | From:         {recipient}
  | Description:  {description}
   
    ...
''')

    bunq.make_request(amount, description, recipient)

    print('''
  | ✅  Request sent

  | ▶  Check your changed overview

''')

    bunq.update_context()
Пример #3
0
def main():
    all_option = ShareLib.parse_all_option()
    environment_type = ShareLib.determine_environment_type_from_all_option(all_option)

    ShareLib.print_header()

    bunq = BunqLib(environment_type)

    callback_url = ShareLib.determine_callback_url_from_all_option_or_std_in(all_option)

    print(f'''
  | Adding Callback URL:    {callback_url}
   
    ...
''')

    bunq.add_callback_url(callback_url)

    print('''
  | ✅  Callback URL added

  | ▶  Check your changed overview

''')

    bunq.update_context()
Пример #4
0
def main():
    all_option = ShareLib.parse_all_option()
    environment_type = ShareLib.determine_environment_type_from_all_option(all_option)

    ShareLib.print_header()

    bunq = BunqLib(environment_type)

    card_id = ShareLib.determine_card_id_from_all_option_or_std_in(all_option)
    account_id = ShareLib.determine_account_id_from_all_option_or_std_in(all_option)

    print(f'''
  | Link Card:    {card_id}
  | To Account:   {account_id}
   
    ...
''')

    bunq.link_card(card_id, account_id)

    print('''
  | ✅  Account switched

  | ▶  Check your changed overview

''')

    bunq.update_context()
Пример #5
0
def main():
    all_option = ShareLib.parse_all_option()
    environment_type = ShareLib.determine_environment_type_from_all_option(all_option)

    ShareLib.print_header()

    bunq = BunqLib(environment_type)

    bunq.make_request("500", "none", "*****@*****.**")

    all_request = bunq.get_all_request(10)
    ShareLib.print_all_request(all_request)

    bunq.update_context()
Пример #6
0
def main():
    all_option = ShareLib.parse_all_option()
    environment_type = ShareLib.determine_environment_type_from_all_option(
        all_option)

    ShareLib.print_header()

    bunq = BunqLib(environment_type)

    user = bunq.get_current_user()
    ShareLib.print_user(user)

    all_monetary_account_bank_active = bunq.get_all_monetary_account_active(1)
    ShareLib.print_all_monetary_account_bank(all_monetary_account_bank_active)

    all_payment = bunq.get_all_payment(10)
    ShareLib.print_all_payment(all_payment)

    all_request = bunq.get_all_request(1)
    ShareLib.print_all_request(all_request)

    all_card = bunq.get_all_card(1)
    ShareLib.print_all_card(all_card, all_monetary_account_bank_active)

    if environment_type is ApiEnvironmentType.SANDBOX:
        all_alias = bunq.get_all_user_alias()
        ShareLib.print_all_user_alias(all_alias)

    bunq.update_context()

    print("""


   Want to see more monetary accounts, payments, requests or even cards?
   Adjust this file.


""")
Пример #7
0
def main():

    all_option = ShareLib.parse_all_option()
    environment_type = ShareLib.determine_environment_type_from_all_option(all_option)

    bunq = BunqLib(environment_type)

    account_a = None
    account_b = None

    account_a_id = "17952"
    account_b_id = "17958"

    if all_option.topdown_from_account:
        try:
            # Try usingbunq account id
            account_a = MonetaryAccountBank.get(all_option.topdown_from_account)
            account_a = account_a.value
            account_a_id = account_a.id_
            print(" Watching (bunq_id): %s" % all_option.topdown_from_account)
        except Exception as e:
            # Check for iban / phone /whatever alias
            for account in bunq.get_all_monetary_account_active():
                for alias in account.alias:
                    if alias.value == all_option.topdown_from_account:
                        account_a = account
                        account_a_id = account_a.id_
                        print(" Watching: %s" % all_option.topdown_from_account)
    else:
        return

    if all_option.topdown_to_account:
        try:
            # Try using bunq account id
            account_b = MonetaryAccountBank.get(all_option.topdown_to_account)
            account_b = account_b.value
            account_b_id = account_b.id_
            print(" Sending extra Money to (bunq_id): %s" % all_option.topdown_to_account)
        except Exception as e:
            # Check for iban / phone / whatever alias
            for account in bunq.get_all_monetary_account_active():
                for alias in account.alias:
                    if alias.value == all_option.topdown_to_account:
                        account_b = account
                        account_b_id = account_b.id_
                        print(" Sending extra Money To: %s" % all_option.topdown_to_account)
    else:
        return

    max_value = Decimal(125)
    if all_option.amount:
        max_value = Decimal(all_option.amount)
        print("Maximum Money to keep: %s" % max_value)
    else:
        return

    if environment_type is ApiEnvironmentType.SANDBOX:
        # In Sandbox use Fallback

        if account_b is None:
            print("Using Sandbox fallback")
            account_b_id = "17958"

        if account_a is None:
            account_a_id = "17952"
            print("Using Sandbox fallback")
            try:
                account_a = MonetaryAccountBank.get(account_a_id)
                account_a = account_a.value
            except:
                pass
            finally:
                if account_a is None:
                    return

    if account_a is not None and account_b_id is not None:
        a_balance = Decimal(account_a.balance.value)
        print("Balance (%s): %s of Max %s" % (account_a.id_, a_balance, max_value))
        if account_a.balance.currency != account_b.balance.currency:
            print("Auto Top-Down not Possible, currencies don't match!")
            return
        if a_balance > max_value:
            delta = a_balance - max_value
            # send delta amount to b
            print(" Moving %s to %s" % (delta, account_b_id))
            description = "Auto Down"
            amount_string = str(delta)
            Payment.create(
                amount=Amount(amount_string, account_a.balance.currency),
                monetary_account_id=account_a_id,
                counterparty_alias=ShareLib.get_first_pointer_iban(account_b),
                description=description
            )
        else:
            print(" Balance OK")

    bunq.update_context()