A Mondo Bank API Client - https://getmondo.co.uk/docs
This library is an MVP and only supports the basic functionality. Doesn't yet support pagination, expansions and file uploads. Pull requests happily accepted.
composer require thepixeldeveloper/mondo-client
// Get a client from the factory.
$client = (new Thepixeldeveloper\Mondo\ClientFactory('access_token'))->getClient();
// Pass the client into the relevant Client class.
$ping = new Thepixeldeveloper\Mondo\Client\Ping($client);
// Response is of the type \Psr\Http\Message\ResponseInterface
$response = $ping->whoAmI();
var_dump($response->getBody()->getContents());
Should give us ...
{
"authenticated": true,
"client_id": "...",
"user_id": "..."
}
$accounts = new Thepixeldeveloper\Mondo\Client\Accounts($client);
var_dump($accounts->getAccounts()->getBody()->getContents())
{
"accounts": [
{
"id": "...",
"account_number": "...",
"sort_code": "...",
"created": "2016-01-12T12:44:45.367Z",
"description": "John Smith"
}
]
}
$balance = new Thepixeldeveloper\Mondo\Client\Balance($client);
var_dump($balance->getBalanceForAccountId('...')->getBody()->getContents())
{
"balance": 0,
"currency": "GBP",
"spend_today": 0
}
All transactions
$transactions = new Thepixeldeveloper\Mondo\Client\Transactions($client);
var_dump($transactions->getTransactionsForAccountId('...')->getBody()->getContents())
{
"transactions": [
{
"id": "...",
"created": "2016-02-23T12:34:54.683Z",
"description": "Initial top up",
"amount": 10000,
"currency": "GBP",
"merchant": null,
"notes": "",
"metadata": {},
"account_balance": 10000,
"attachments": [],
"category": "mondo",
"is_load": true,
"settled": "2016-02-23T12:34:54.683Z",
"local_amount": 10000,
"local_currency": "GBP"
},
...
]
}
Specific transaction
$transactions = new Thepixeldeveloper\Mondo\Client\Transactions($client);
var_dump($transactions->getTransaction('...')->getBody()->getContents())
{
"transaction": {
"id": "...",
"created": "2016-02-23T12:34:54.683Z",
"description": "Initial top up",
"amount": 10000,
"currency": "GBP",
"merchant": null,
"notes": "",
"metadata": {},
"account_balance": 10000,
"attachments": [],
"category": "mondo",
"is_load": true,
"settled": "2016-02-23T12:34:54.683Z",
"local_amount": 10000,
"local_currency": "GBP"
}
}
I've decided to leave out authentication for the MVP. Use a library like League/oauth2-client to get yourself an access token.
Run the phpSpec tests with ...
composer test