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) {
...
}
...
})
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
|
|||||||||||||
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 |
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
|
|||||||||||||||||||||||||||||||||||||||||
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 |
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
|
|||||||||||||||||||||||||||||||||
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 |
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
|
||||||||||||||||
fn |
function |
<optional> |
Callback function |
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 |
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
|
|||||||||||||
access_token |
string | Access token |
|||||||||||||
fn |
function |
<optional> |
Callback function |
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
|
|||||||||||||||||||||
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
|
|||||||||||||||||||||||||
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