uwkluis/client
Composer 安装命令:
composer require uwkluis/client
包简介
Client package for the UwKluis APIs
README 文档
README
This package can assist in connecting to the UwKluis API. An OpenAPI compatible schema and Swagger -generated documentation about the individual endpoints can be found at the root of this domain.
Structure
src/
src/Consumer
src/Exception
src/Organization
src/Traits
tests/
Install
Via Composer
$ composer require uwkluis/client
Usage
First setup the route and controller to handle the OAuth2 callback. Store the (data from the) token response in some fashion.
$config = new \UwKluis\Client\Organization\Config(
'registered-client-name',
'registered-callback-url',
1,
'registered-client-secret',
['read-person-data', 'read-write-mortgages-data']
);
$guzzleClient = new GuzzleHttp\Client();
$organizationConnect = new UwKluis\Client\Organization\Connect($config, $guzzleClient);
$accessTokenResponse = $organizationConnect->processResponse($psr7request);
$accessToken = $accessTokenResponse->getAccessToken();
$refreshToken = $accessTokenResponse->getRefreshToken();
$expiration = $accessTokenResponse->getExpiration();
Send organization users to the Oauth2 url to establish a connection. A request will be sent to the callback route in response.
/** @var $connect UwKluis\Client\Organization\Connect */
echo '<a href="' . $connect->getAuthorizeUrl() . '">Connect</a>';
A user can then have an invitation sent to the consumer based on their phone number and e-mail address. Your client now needs the previously stored access token. The resulting response object will contain the organization consumer id and the UFO consumer id (a UUID). Store these for future requests.
$organizationConsumerId = 'JOHNSON_AMSTERDAM_001';
$consumerConnect = new \UwKluis\Client\Consumer\Connect($config, $guzzleClient);
$connection = $consumerConnect->inviteConsumer('johnson@example.org', '0612345678');
$uwKluisConsumerId = $connection->getUwKluisConsumerId();
If the user's organization already has a connection, the request will fail, throwing a
\UwKluis\Client\Exception\ConsumerConnectionConflict, which contains the conflicting connection. This can be extracted via
\UwKluis\Client\Exception\ConsumerConnectionConflict::getConflictingConnection().
Information about an existing connection, such as one returned by the aforementioned exception, can be retrieved using:
/** @var $consumerConnect \UwKluis\Client\Consumer\Connect */
/** @var $token \Lcobucci\JWT\Token */
/** @var $uwKluisConsumerId \Ramsey\Uuid\UuidInterface */
/** @var $connection \UwKluis\Client\Consumer\Connect */
$connection = $consumerConnect->getConnectionStatus($token, $uwKluisConsumerId);
If an invitation has been sent to a consumer, but they are unable to accept it because either the phonenumber or the e-mail address are incorrect, or they are unable to find the invitation, one can send a new invitation using the existing connection ID:
/** @var $consumerConnect \UwKluis\Client\Consumer\Connect */
/** @var $token \Lcobucci\JWT\Token */
/** @var $uwKluisConsumerId \Ramsey\Uuid\UuidInterface */
$consumerConnect->updateAndReinviteConsumer($token, $uwKluisConsumerId, 'newEmail@example.org', '0612345678');
First request the current consumer dossier, using the organization's access token, the organization consumer id and the desired consumer dossier json schema version:
$dossier = new \UwKluis\Client\Consumer\Dossier($config, $guzzleClient);
$response = $dossier->getData(
$accessToken,
$uwKluisConsumerId,
1
);
$data = $response['data'];
If you wish to update the consumer dossier data, first merge the retrieved data with your own, and then send that back using the updateData() method.
/** @var array $mergedData */
$dossier->updateData(
$accessToken,
$uwKluisConsumerId,
$mergedData
1,
false
);
Webhooks
The UwKluis API provides several webhook options, so your client can be notified if a consumer connection changes (for instance when a consumer establishes a connection, or changes the granted scopes) or when a consumer dossier changes (either by the consumer or by another client application or organization). Registering webhooks can be done after an organization user has established a connection using Oauth2. The uwkluis/webhook-client package can help implementing webhooks in your client application.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email info@hypotheekbond.nl instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
uwkluis/client 适用场景与选型建议
uwkluis/client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 37.19k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 10 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 uwkluis/client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 uwkluis/client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 37.19k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-10-21