paysera / lib-event-notification-client
本包最新版本(1.0.0)没有可用的许可信息。
Paysera事件通知的PHP REST客户端
1.0.0
2019-05-22 07:57 UTC
Requires
- php: >=5.5
- fig/http-message-util: ^1.0
- paysera/lib-rest-client-common: ^1.0 | ^2.1
This package is auto-updated.
Last update: 2024-09-24 18:48:40 UTC
README
提供操作EventNotification
API的方法。它将自动验证所有请求并为您映射所需的数据结构。
使用方法
此库提供ClientFactory
类,您应使用此类来获取API客户端本身
use Paysera\Client\EventNotificationClient\ClientFactory; $clientFactory = ClientFactory::create([ 'base_url' => 'https://checkout-eu-a.paysera.com/notification/rest/v1/', // optional, in case you need a custom one. 'basic' => [ // use this, it API requires Basic authentication. 'username' => 'username', 'password' => 'password', ], 'oauth' => [ // use this, it API requires OAuth v2 authentication. 'token' => [ 'access_token' => 'my-access-token', 'refresh_token' => 'my-refresh-token', ], ], // other configuration options, if needed ]); $eventNotificationClient = $clientFactory->getEventNotificationClient();
请只使用Vendor
提供的单一认证机制。
现在,您已经拥有了EventNotificationClient
实例,可以使用以下方法
方法
标记(读取)通知为已处理
$result = $eventNotificationClient->readNotification($notificationId);
获取带有解析数据的通知
$result = $eventNotificationClient->getNotification($notificationId);
获取带有解析数据的过滤通知
use Paysera\Client\EventNotificationClient\Entity as Entities; $notificationFilter = new Entities\NotificationFilter(); $notificationFilter->setStatus($status); $result = $eventNotificationClient->getNotifications($notificationFilter);