Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Bunq

This is a wrapper over bunq-js-client, and should have all the business logic to handle notifications and transactions at bunq.

Hierarchy

  • any
    • Bunq

Index

Properties

accounts

accounts: any[]

List of bank accounts.

timerRefresh

timerRefresh: any

Timer to auto refresh user data and accounts.

user

user: any

The main user data.

Accessors

authUrl

  • get authUrl(): string
  • The authentication URL used to start the OAuth2 flow.

    Returns string

authenticated

  • get authenticated(): boolean
  • The authentication URL used to start the OAuth2 flow.

    Returns boolean

Static Export assignment Instance

  • get Instance(): Bunq

Methods

addPaymentNotes

  • addPaymentNotes(accountId: number, paymentId: number, notes: string[], draft?: boolean): Promise<boolean>
  • Add notes to the specified payment.

    Parameters

    • accountId: number

      The ID of the monetary account.

    • paymentId: number

      The ID of the payment that was made previously.

    • notes: string[]

      Array of strings to be added as notes.

    • Optional draft: boolean

    Returns Promise<boolean>

callback

  • Process a callback (notification) sent by bunq.

    Parameters

    Returns Promise<void>

getAccountBalance

  • getAccountBalance(alias: string | number): Promise<number>
  • Get the current account balance for the specified alias.

    Parameters

    • alias: string | number

      The email, phone or IBAN of the account.

    Returns Promise<number>

getAccountFromAlias

  • getAccountFromAlias(alias: string | number, returnAsName?: boolean): any
  • Get the account details for the specified alias. If second parameter is true, it won't throw exception for account not found.

    Parameters

    • alias: string | number

      The email, phone or IBAN of the owner's account.

    • Optional returnAsName: boolean

      If true, will return the account name or the passed alias if account not found.

    Returns any

getAccounts

  • getAccounts(): Promise<any[]>
  • Get all the relevant accounts for the user.

    Returns Promise<any[]>

getCallbacks

  • getCallbacks(): Promise<any>
  • Get list of registered callbacks (URL notification filters) at bunq.

    Returns Promise<any>

getOAuthToken

  • getOAuthToken(code: string): Promise<boolean>
  • Get the OAuth2 access token based on the provided authorization code. This method will return null when it fails to get the token.

    Parameters

    • code: string

      The authorization code provided via the /bunq/auth/callback URL.

    Returns Promise<boolean>

getUser

  • getUser(): Promise<any>
  • Get the main user account.

    Returns Promise<any>

init

  • init(): Promise<void>
  • Create the bunq-js-client and load initial data.

    Returns Promise<void>

makePayment

refreshUserData

  • refreshUserData(): Promise<void>
  • Load user info and its main accounts.

    Returns Promise<void>

remindOAuthRenew

  • remindOAuthRenew(): void
  • Send notification to remind user to renew the OAuth2 tokens by logging in again and approving the access on bunq.

    Returns void

reversePayment

  • Reverse (refund) a payment made by Jarbunq. Will only work if both source and target bunq accounts are owned by the user.

    Parameters

    • payment: Payment

      The payment object to be reversed.

    Returns Promise<Payment>

setupCallbacks

  • setupCallbacks(): Promise<void>
  • Setup the callbacks (notification filters) so bunq will dispatch events related to the user's accounts to Jarbunq. Please note that this will only work if Jarbunq is accessible from the internet!

    Returns Promise<void>

Generated using TypeDoc