farit-slv / sumsub-client
API client for cyberity.ru (sumsub.com)
0.8.4
2023-10-24 20:49 UTC
Requires
- php: >=7.1
- ext-json: *
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
Requires (Dev)
- codeception/codeception: ^4.1
- codeception/module-asserts: ^1.3
- guzzlehttp/psr7: ^1.6
- symplify/easy-coding-standard: ^10.2
README
API client for cyberity.ru (sumsub.com)
Installation
composer require farit-slv/sumsub-client
Client configuration
Client works with any PSR-18 compatible HTTP client and require PSR-17 HTTP factory.
use FaritSlv\SumSub\Client; use FaritSlv\SumSub\Request\RequestSigner; $requestSigner = new RequestSigner('Your APP token', 'Your secret'); $client = new Client( $psr18HttpClient, $psr17HttpFactory, $requestSigner );
Getting SDKs access token
use FaritSlv\SumSub\Request\AccessTokenRequest; $externalUserId = 'some-id'; $levelName = 'some-level'; $ttlInSeconds = 3600; $response = $client->getAccessToken(new AccessTokenRequest($externalUserId, $levelName, $ttlInSeconds)); $accessToken = $response->getToken();
Getting applicant data by applicant id
use FaritSlv\SumSub\Request\ApplicantDataRequest; $applicantId = 'some-id'; $response = $client->getApplicantData(new ApplicantDataRequest($applicantId)); $applicantData = $response->asArray();
Getting applicant data by external user id
use FaritSlv\SumSub\Request\ApplicantDataRequest; $externalUserId = 'some-id'; $response = $client->getApplicantData(new ApplicantDataRequest(null, $externalUserId)); $applicantData = $response->asArray();
Resetting an applicant
use FaritSlv\SumSub\Request\ApplicantRequest; $applicantId = 'some-id'; $client->resetApplicant(new ApplicantRequest($applicantId));
Getting applicant status
use FaritSlv\SumSub\Request\ApplicantRequest; $applicantId = 'some-id'; $response = $client->getApplicantStatus(new ApplicantRequest($applicantId)); $applicantStatus = $response->asArray();
Getting document images
use FaritSlv\SumSub\Request\DocumentImageRequest; $inspectionId = 'some-id'; $imageId = '123'; $response = $client->getDocumentImages(new DocumentImageRequest($inspectionId, $imageId)); $stream = $response->asStream(); $contentType = $response->getContentType();
Getting inspection checks
use FaritSlv\SumSub\Request\InspectionChecksRequest; $inspectionId = 'some-id'; $response = $client->getInspectionChecks(new InspectionChecksRequest($inspectionId)); $checksData = $response->asArray();