geniusee-software / geniusee-moneyhub-php-sdk
Moneyhub API 的 PHP 客户端
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-09-24 22:26:49 UTC
README
简介
这是一个 Moneyhub API 的 PHP 客户端。它目前支持以下功能
- 注册用户
- 删除用户
- 为新旧用户生成授权 URL
- 从授权码中获取访问令牌和刷新令牌
- 刷新访问令牌
- 删除用户连接
- 使用客户端凭据获取访问令牌
- 账户的 CRUD 操作
- 交易的 CRUD 操作
- 生成支付授权 URL
- 添加收款人
- 获取收款人和支付信息
- 获取类别
- 对项目的 CRUD 操作
- 对交易附件的 CRUD 操作
- 对交易分录的 CRUD 操作
- 获取交易子集的税务报告
- 获取账户上的常规交易
- 获取受益人
安装
composer require geniusee-software/geniusee-moneyhub-php-sdk
目前此库支持 client_secret_basic
身份验证。
client_secret_basic 的 JSON 示例
{ "clientId": "clientId", "clientSecret": "clientSecret", "responseType": "code" }
命令
make psalm - run psalm
make test - run unit tests
make style-fix - run cs-fixer
用法
此模块公开了一个工厂函数,该函数接受以下配置
$factory = new MoneyHubFactory('path_to_config');
现在支持 php、json 文件格式。
账户
账户 API Moneyhub 文档 - https://docs.moneyhubenterprise.com/reference/get_accounts
$factory->accounts();
支持的功能
$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;
要添加我们的作用域,可以使用 withScopes 方法
$factory->accounts()->withScopes();
其他方法
$factory->accounts()->withGrantType(); $factory->accounts()->withParams(); $factory->accounts()->withBodyParams();
对方
对方 API Moneyhub 文档 - https://docs.moneyhubenterprise.com/reference/get_accounts-accountid-counterparties
$factory->transactions();
支持的功能
$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;
其他方法
$factory->transactions()->withGrantType(); $factory->transactions()->withParams(); $factory->transactions()->withBodyParams(); $factory->transactions()->withScopes();
通知阈值
通知阈值 API Moneyhub 文档 - https://docs.moneyhubenterprise.com/reference/get_accounts-accountid-notification-thresholds
$factory->notificationThresholds();
支持的功能
$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;
其他方法
$factory->notificationThresholds()->withGrantType(); $factory->notificationThresholds()->withParams(); $factory->notificationThresholds()->withBodyParams(); $factory->notificationThresholds()->withScopes();
交易
交易 API Moneyhub 文档 - https://docs.moneyhubenterprise.com/reference/get_transactions
$factory->transactions();
支持的功能
$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
其他方法
$factory->transactions()->withGrantType(); $factory->transactions()->withParams(); $factory->transactions()->withBodyParams(); $factory->transactions()->withScopes();
类别
类别 API Moneyhub 文档 - https://docs.moneyhubenterprise.com/reference/get_categories
$factory->categories();
支持的功能
$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;
其他方法
$factory->categories()->withGrantType(); $factory->categories()->withParams(); $factory->categories()->withBodyParams(); $factory->categories()->withScopes();
项目
项目 API Moneyhub 文档 - https://docs.moneyhubenterprise.com/reference/get_projects
$factory->projects();
支持的功能
$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;
其他方法
$factory->projects()->withGrantType(); $factory->projects()->withParams(); $factory->projects()->withBodyParams(); $factory->projects()->withScopes();
税务
税务 API Moneyhub 文档 - https://docs.moneyhubenterprise.com/reference/get_tax
$factory->tax();
支持的功能
$factory->tax()->retrieveTransactions( string $userId, string $startDate, string $endDate, ?string $projectId = null, ?string $accountId = null ): TaxesCollection;
其他方法
$factory->tax()->withScopes();
用户
用户 API Moneyhub 文档 - https://docs.moneyhubenterprise.com/reference/get_users
$factory->users();
支持的功能
$factory->users()->all(): UsersCollection; $factory->users()->one(string $moneyHubUserId): User; $factory->users()->create(string $clientUserId): User; $factory->users()->delete(string $moneyHubUserId): void;
其他方法
$factory->users()->withGrantType(); $factory->users()->withParams(); $factory->users()->withBodyParams(); $factory->users()->withScopes();
同步
同步 API Moneyhub 文档 - https://docs.moneyhubenterprise.com/reference/post_sync-connectionid
$factory->sync();
支持的功能
$factory->sync()-ЮsyncAnExistingConnection(string $userId, string $connectionId): SyncDto;
其他方法
$factory->sync()->withScopes();