geniusee-software / geniusee-moneyhub-php-sdk
PHP client for the Moneyhub API
Requires
- php: ^8.0
- firebase/php-jwt: ^5.5
- guzzlehttp/guzzle: ^7.4
- laravel/helpers: ^1.5
- league/oauth2-client: ^2.6
- moneyphp/money: ^4.0
- symfony/validator: ^6.0
- webmozart/assert: ^1.10
Requires (Dev)
- brainmaestro/composer-git-hooks: ^2.8
- dg/bypass-finals: ^1.3
- friendsofphp/php-cs-fixer: ^3.4
- mockery/mockery: ^1.4
- nunomaduro/phpinsights: ^2.0
- phpmetrics/phpmetrics: ^2.7
- phpunit/phpunit: ^9.5
- vimeo/psalm: ^4.12
This package is not auto-updated.
Last update: 2024-04-23 20:30:14 UTC
README
Introduction
This is an PHP client for the Moneyhub API. It currently supports the following features:
- Registering users
- Deleting users
- Generating authorisation urls for new and existing users
- Getting access tokens and refresh tokens from an authorisation code
- Refreshing access tokens
- Deleting user connections
- Getting access tokens with client credentials
- CRUD actions for accounts
- CRUD actions for transactions
- Generate authorisation url for payments
- Add Payees
- Get Payees and payments
- Get categories
- CRUD actions on projects
- CRUD actions on transaction attachments
- CRUD actions on transaction splits
- Get a tax return for a subset of transactions
- Get the regular transactions on an account
- Get beneficiaries
Installation
composer require geniusee-software/geniusee-moneyhub-php-sdk
Currently this library supports client_secret_basic
authentication.
JSON example for client_secret_basic
{ "clientId": "clientId", "clientSecret": "clientSecret", "responseType": "code" }
Commands
make psalm - run psalm
make test - run unit tests
make style-fix - run cs-fixer
Usage
This module exposes a factory function that accepts the following configuration:
$factory = new MoneyHubFactory('path_to_config');
Now supports php, json file formats.
Accounts
Accounts API Moneyhub docs - https://docs.moneyhubenterprise.com/reference/get_accounts
$factory->accounts();
Supported functions
$factory->accounts()->delete(string $userid, string $accountId); $factory->accounts()->all(string $userId): AccountBalanceCollection; $factory->accounts()->addNewBalanceForAnAccount(string $userId, string $accountId): AccountBalanceCollection; $factory->accounts()->one(string $userId, string $accountId): Account; $factory->accounts()->retrieveTheHistoricalBalancesForAnAccount( string $userId, string $accountId ): AccountBalanceCollection; $factory->accounts()->updateSingleAccount(string $userId, string $accountId): Account;
To add our scopes you can use withScopes method
$factory->accounts()->withScopes();
Additional methods
$factory->accounts()->withGrantType(); $factory->accounts()->withParams(); $factory->accounts()->withBodyParams();
Counterparties
Counterparties API Moneyhub docs - https://docs.moneyhubenterprise.com/reference/get_accounts-accountid-counterparties
$factory->transactions();
Supported functions
$factory->transactions()->all(string $userId): TransactionCollection; $factory->transactions()->one(string $userId, string $transactionId): Transaction; $factory->transactions()->createSingleTransaction(string $userId): Transaction; $factory->transactions()->createMultipleTransactions(string $userId): array; $factory->transactions()->updateSingleTransaction(string $userId, string $transactionId): Transaction $factory->transactions()->transactionAttachments(string $userId, string $transactionId): TransactionAttachmentCollection; $factory->transactions()->retrieveTransactionAttachments( string $userId, string $transactionId, string $fileId ): array; $factory->transactions()->retrieveTransactionSplit( string $userId, string $transactionId, ): array; $factory->transactions()->splitTransaction( string $userId, string $transactionId, ): TransactionSplit; $factory->transactions()->pathSplitTransaction( string $userId, string $transactionId, string $splitId, ): array; $factory->transactions()->mergeSplitTransaction(string $userId,string $transactionId): void; $factory->transactions()->deleteTransactionAttachments(string $userId,string $transactionId, string $fileId): void; $factory->transactions()->delete(string $userid, string $transactionId): void;
Additional methods
$factory->transactions()->withGrantType(); $factory->transactions()->withParams(); $factory->transactions()->withBodyParams(); $factory->transactions()->withScopes();
Notification Thresholds
Notification Thresholds API Moneyhub docs - https://docs.moneyhubenterprise.com/reference/get_accounts-accountid-notification-thresholds
$factory->notificationThresholds();
Supported functions
$factory->notificationThresholds()->all(string $userId, string $accountId): NotificationThresholdsCollection; $factory->notificationThresholds()->create(string $userId, string $accountId): NotificationThreshold; $factory->notificationThresholds()->update(string $userId, string $accountId, string $thresholdId): NotificationThreshold; $factory->notificationThresholds()->delete(string $userId, string $accountId, string $thresholdId): void;
Additional methods
$factory->notificationThresholds()->withGrantType(); $factory->notificationThresholds()->withParams(); $factory->notificationThresholds()->withBodyParams(); $factory->notificationThresholds()->withScopes();
Transactions
Transactions API Moneyhub docs - https://docs.moneyhubenterprise.com/reference/get_transactions
$factory->transactions();
Supported functions
$factory->transactions()->all(string $userId): TransactionCollection; $factory->transactions()->one(string $userId, string $transactionId): Transaction; $factory->transactions()->createSingleTransaction(string $userId): Transaction; $factory->transactions()->createMultipleTransactions(string $userId): array; $factory->transactions()->updateSingleTransaction(string $userId, string $transactionId): Transaction; $factory->transactions()->transactionAttachments(string $userId, string $transactionId): TransactionAttachmentCollection; $factory->transactions()->retrieveTransactionAttachments( string $userId, string $transactionId, string $fileId ): TransactionAttachment; $factory->transactions()->retrieveTransactionSplit( string $userId, string $transactionId, ): array; $factory->transactions()->splitTransaction( string $userId, string $transactionId, ): TransactionSplit; $factory->transactions()->pathSplitTransaction( string $userId, string $transactionId, string $splitId, ): array; $factory->transactions()->mergeSplitTransaction( string $userId, string $transactionId, ): void; $factory->transactions()->deleteTransactionAttachments( string $userId, string $transactionId, string $fileId ): void; $factory->transactions()->delete(string $userid, string $transactionId): void
Additional methods
$factory->transactions()->withGrantType(); $factory->transactions()->withParams(); $factory->transactions()->withBodyParams(); $factory->transactions()->withScopes();
Categories
Categories API Moneyhub docs - https://docs.moneyhubenterprise.com/reference/get_categories
$factory->categories();
Supported functions
$factory->categories()->all(string $userId): CategoriesCollection; $factory->categories()->one(string $userId, string $categoryId): Category; $factory->categories()->allCategoryGroups(string $userId): CategoriesGroupCollection; $factory->categories()->create(string $userId): Category;
Additional methods
$factory->categories()->withGrantType(); $factory->categories()->withParams(); $factory->categories()->withBodyParams(); $factory->categories()->withScopes();
Projects
Projects API Moneyhub docs - https://docs.moneyhubenterprise.com/reference/get_projects
$factory->projects();
Supported functions
$factory->projects()->all(string $userId): ProjectsCollection; $factory->projects()->one(string $userId, string $projectId): Project; $factory->projects()->createSingleProject(string $userId): Project; $factory->projects()->updateSingleProject(string $userId, string $projectId): Project; $factory->projects()->delete(string $userid, string $accountId): void;
Additional methods
$factory->projects()->withGrantType(); $factory->projects()->withParams(); $factory->projects()->withBodyParams(); $factory->projects()->withScopes();
TAX
Tax API Moneyhub docs - https://docs.moneyhubenterprise.com/reference/get_tax
$factory->tax();
Supported functions
$factory->tax()->retrieveTransactions( string $userId, string $startDate, string $endDate, ?string $projectId = null, ?string $accountId = null ): TaxesCollection;
Additional methods
$factory->tax()->withScopes();
Users
Users API Moneyhub docs - https://docs.moneyhubenterprise.com/reference/get_users
$factory->users();
Supported functions
$factory->users()->all(): UsersCollection; $factory->users()->one(string $moneyHubUserId): User; $factory->users()->create(string $clientUserId): User; $factory->users()->delete(string $moneyHubUserId): void;
Additional methods
$factory->users()->withGrantType(); $factory->users()->withParams(); $factory->users()->withBodyParams(); $factory->users()->withScopes();
Sync
Sync API Moneyhub docs - https://docs.moneyhubenterprise.com/reference/post_sync-connectionid
$factory->sync();
Supported functions
$factory->sync()-ЮsyncAnExistingConnection(string $userId, string $connectionId): SyncDto;
Additional methods
$factory->sync()->withScopes();