Module mondo-bank

Usage

mondo = require('mondo-bank')

All methods return a promise but can optionally be called with a callback function as the final argument

Promise style

methodPromise = mondo[$method]([$params])
methodPromise
   .then(function(value){
     ...
   })
   .catch(function(err){
     ...
   })

Callback style

mondo[method]([$params], function(err, value){
  if (err) {
   ...
  }
  ...
})
Source:

Methods

(static) accounts(access_token, fnopt) → {object}

Get detailed information about customer’s accounts

accountsPromise = mondo.accounts(accessToken)
Parameters
Name Type Attributes Description
access_token string

Access token

fn function <optional>

Callback function

Source:
See:
Returns

Response value

Type
object

(static) annotateTransaction(transaction_id, metadata, annotation, annotations, access_token, fnopt) → {object}

Annotate a transaction

annotateTransactionPromise = mondo.annotateTransaction(transaction_id, {
  foo: 'bar'
}, access_token)

or

annotateTransactionPromise = mondo.annotateTransaction({
  transaction_id: transaction_id,
  foo: 'bar'
}, access_token)

or

annotateTransactionPromise = mondo.annotateTransaction({
  transaction_id: transaction_id,
  metadata: {
   foo: 'bar'
  }
}, access_token)
Parameters
Name Type Attributes Description
transaction_id string | object

Transaction ID

Properties
Name Type Attributes Description
transaction_id string <optional>

Transaction ID, if passed as object

metadata string <optional>

Metadata, if passed as nested object

metadata object

Annotation metadata object

annotation object

Alias for metadata

annotations object

Alias for metadata

access_token string

Access token

fn function <optional>

Callback function

Source:
See:
Returns

Response value

Type
object

(static) balance(account_id, access_token, fnopt) → {object}

Get balance details for an account

balancePromise = mondo.balance(account_id, access_token)
Parameters
Name Type Attributes Description
account_id string

Account id

access_token string

Access token

fn function <optional>

Callback function

Source:
See:
Returns

Response value

Type
object

(static) createFeedItem(params, access_token, fnopt) → {object}

Publish a new feed entry

createFeedItemPromise = mondo.createFeedItem({
  account_id: accountId,
  params: {
    title: title,
    image_url: image_url
  },
  url: url
}, access_token)
Parameters
Name Type Attributes Description
params object

Params object

Properties
Name Type Attributes Description
account_id string

Account ID

params object

Feed item params

params.​title string

Title for feed item

params.​image_url string

Icon url to use as icon

params.​body string <optional>

Body text to display

params.​background_color string <optional>

Background colour

params.​title_color string <optional>

Title colour

params.​body_color string <optional>

Body colour

url string

Feed item url

access_token string

Access token

fn function <optional>

Callback function

Source:
See:
Returns

Response value

Type
object

(static) deleteWebhook(webhook_id, access_token, fnopt) → {object}

Delete webhook

deleteWebhookPromise = mondo.deleteWebhook(webhook_id, access_token)
Parameters
Name Type Attributes Description
webhook_id string

Webhook ID

access_token string

Access token

fn function <optional>

Callback function

Source:
See:
Returns

Response value

Type
object

(static) deregisterAttachment(attachment_id, access_token, fnopt) → {object}

Deregister attachment

deregisterAttachmentPromise = mondo.deregisterAttachment(attachment_id, access_token)
Parameters
Name Type Attributes Description
attachment_id string

Attachment ID

access_token string

Access token

fn function <optional>

Callback function

Source:
See:
Returns

Response value

Type
object

(static) refreshToken(refresh_token, fnopt) → {object}

Refresh a proviously acquired token

refreshTokenPromise = mondo.refreshToken(refreshToken)

or if the client id and secret have not been previously passed

refreshTokenPromise = mondo.refreshToken({
  refreshToken: refreshToken,
  client_id: client_id,
  client_secret: client_secret
})
Parameters
Name Type Attributes Description
refresh_token string

Refresh token

fn function <optional>

Callback function

Source:
See:
Returns

Response value

Type
object

(static) registerAttachment(params, access_token, fnopt) → {object}

Register attachment

registerAttachmentPromise = mondo.registerAttachment({
  external_id: transaction_id,
  file_type: file_type,
  file_url: file_url
}, access_token)
Parameters
Name Type Attributes Description
params object

Params object

Properties
Name Type Attributes Description
external_id string

Transaction ID

file_type string

File type

file_url string

File url

transaction_id string <optional>

Alias for external_id

id string <optional>

Alias for external_id

type string <optional>

Alias for file_type

url string <optional>

Alias for file_url

access_token string

Access token

fn function <optional>

Callback function

Source:
See:
Returns

Response value

Type
object

(static) registerWebhook(account_id, url, access_token, fnopt) → {object}

Register a webhook

registerWebhookPromise = mondo.registerWebhook(account_id, url, access_token)

See https://getmondo.co.uk/docs/#transaction-created for details of the transaction.created event which is sent to the webhook each time a new transaction is created in a user’s account

Parameters
Name Type Attributes Description
account_id string

Account ID

url string

Webhook url

access_token string

Access token

fn function <optional>

Callback function

Source:
See:
Returns

Response value

Type
object

(static) token(credentials, fnopt) → {object}

Acquire an access token

tokenPromise = mondo.token({
  client_id: client_id,
  client_secret: client_secret,
  username: username,
  password: password
})
Parameters
Name Type Attributes Description
credentials object

Mondo credentials

Properties
Name Type Description
client_id string

Dev API client id

client_secret string

Dev API client secret

username string

Mondo user’s username

password string

Mondo user’s password

fn function <optional>

Callback function

Source:
See:
Returns

Response value

Type
object

(static) tokenInfo(access_token, fnopt) → {object}

Get information about an access token

tokenInfoPromise = mondo.tokenInfo(accessToken)
Parameters
Name Type Attributes Description
access_token string

Access token

fn function <optional>

Callback function

Source:
See:
Returns

Response value

Type
object

(static) transaction(params, access_token, fnopt) → {object}

Get details about a transaction

transactionPromise = mondo.transaction(transaction_id, access_token)

or to see expanded info for the merchant

transactionPromise = mondo.transaction({
  transaction_id: transaction_id,
  expand: 'merchant'
}, access_token)
Parameters
Name Type Attributes Description
params object | String

Transaction params

Properties
Name Type Attributes Description
transaction_id string

Transaction ID

expand string <optional>

Property to expand (merchant)

access_token string

Access token

fn function <optional>

Callback function

Source:
See:
Returns

Response value

Type
object

(static) transactions(params, access_token, fnopt) → {object}

List transactions

transactionsPromise = mondo.transactions(account_id, access_token)

or to filter the results

transactionsPromise = mondo.transactions({
  account_id: account_id,
  since: since,
  before: before
  limit: limit
}, access_token)
Parameters
Name Type Attributes Description
params object | string

Query object If passed as a string, used as account_id

Properties
Name Type Attributes Description
account_id string

Account id

since date | string <optional>

Date after which to show results (Date object or ISO string)

before date | string <optional>

Date before which to show results (Date object or ISO string)

limit int <optional>

Max number of transactions to return (100 max)

access_token string

Access token

fn function <optional>

Callback function

Source:
See:
Returns

Response value

Type
object

(static) uploadAttachment(params, access_token, fnopt) → {object}

Request upload attachment url

uploadAttachmentPromise = mondo.uploadAttachment({
  file_name: file_name,
  file_type: file_type
}, access_token)
Parameters
Name Type Attributes Description
params object

params object

Properties
Name Type Attributes Description
file_name string

File name

file_type string

File type

file string <optional>

Alias for file_name

name string <optional>

Alias for file_name

type string <optional>

Alias for file_type

access_token string

Access token

fn function <optional>

Callback function

Source:
See:
Returns

Response value

Type
object

(static) webhooks(account_id, access_token, fnopt) → {object}

List webhooks

webhooksPromise = mondo.webhooks(account_id, access_token)
Parameters
Name Type Attributes Description
account_id string

Account ID

access_token string

Access token

fn function <optional>

Callback function

Source:
See:
Returns

Response value

Type
object