1. Go to this page and download the library: Download covery/client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
covery / client example snippets
use Covery\Client\Facade;
use Covery\Client\Transport\Curl;
$connectTimeoutSeconds = 5.0;
$requestTimeoutSeconds = 2.0;
Facade::setTransport(new Curl($connectTimeoutSeconds, $requestTimeoutSeconds));
Facade::setCredentials('<token>', '<secret>');
use Covery\Client\Loggers\FileLogger;
//directory must be writable!
$filePath = "path_to_file/error.log";
Facade::setLogger(new FileLogger($filePath));
use Covery\Client\Envelopes\Builder;
use Covery\Client\Facade;
use Covery\Client\Identities\Stub;
$event = Builder::loginEvent(md5($userId), string($userId), time(), '[email protected]', false) // Using builder
->addIdentity(new Stub()) // stub identity
->build(); // building envelope
$result = Facade::makeDecision($event);
if ($result->isReject()) {
// ...
}
use Covery\Client\Envelopes\Builder;
use Covery\Client\Facade;
$event = Builder::postbackEvent($requestId, null, 'code', 'reason')->build(); //postback for event with id $requestId
$postbackRequestId = Facade::sendPostback($event);
use Covery\Client\Envelopes\Builder;
use Covery\Client\Facade;
$event = Builder::kycProofEvent($kycStartId)->build();
$kycProofData = Facade::sendKycProof($event);
use Covery\Client\CardId\Builder;
use Covery\Client\Facade;
$event = Builder::cardIdEvent('curdNumber')->build();
$result = Facade::sendCardId($event);
use Covery\Client\DocumentStorage\Builder;
use Covery\Client\Facade;
$event = Builder::documentStorageEvent(\Covery\Client\ContentType::JPEG, \Covery\Client\ContentDescription::GENERAL_DOCUMENT, null, false)->build();
$result = Facade::sendDocumentStorage($event);
use Covery\Client\DocumentConnection\Builder;
use Covery\Client\Facade;
$event = Builder::documentConnectionEvent(1, [1])->build();
$result = Facade::attachDocumentConnection($event);
use Covery\Client\DocumentConnection\Builder;
use Covery\Client\Facade;
$event = Builder::documentConnectionEvent(1, [1])->build();
$result = Facade::detachDocumentConnection($event);
use Covery\Client\Facade;
$accountConfigurationStatus = Facade::getAccountConfigurationStatus();
use Covery\Client\Facade;
use Covery\Client\IndividualProfile\Builder;
// Create a new individual profile (POST). sequence_id is mandatory.
$profile = Builder::createIndividualProfileEvent('sequenceId', 'userMerchantId')->build();
$result = Facade::createIndividualProfile($profile);
$clientProfileId = $result->getClientProfileId();
// Update an existing individual profile (PUT). client_profile_id is mandatory.
// PUT replaces all data: any field not passed is sent as null and cleared on Covery side.
$profile = Builder::updateIndividualProfileEvent($clientProfileId, 'userMerchantId')->build();
$result = Facade::updateIndividualProfile($profile);
use Covery\Client\Facade;
use Covery\Client\EntityProfile\Builder;
// Create a new entity profile (POST). sequence_id is mandatory.
$profile = Builder::createEntityProfileEvent('sequenceId', 'userMerchantId')->build();
$result = Facade::createEntityProfile($profile);
$clientProfileId = $result->getClientProfileId();
// Update an existing entity profile (PUT). client_profile_id is mandatory.
// PUT replaces all data: any field not passed is sent as null and cleared on Covery side.
$profile = Builder::updateEntityProfileEvent($clientProfileId, 'userMerchantId')->build();
$result = Facade::updateEntityProfile($profile);
use Covery\Client\Facade;
use Covery\Client\Relationships\Builder;
use Covery\Client\RelationshipType;
$relationships = Builder::create()
->addRelationship($receiverProfileId, $providerProfileId, RelationshipType::OWNER_COMPANY)
->addRelationship($receiverProfileId, $providerProfileId, RelationshipType::RELATED_PERSON, 'role', 100.00)
->build();
// Create or change relationships (PUT)
$statusCode = Facade::putRelationships($relationships);
// Delete relationships (DELETE)
$statusCode = Facade::deleteRelationships($relationships);
// Review relationships (POST) - by receiver and/or provider
$query = Builder::reviewQuery($receiverProfileId, $providerProfileId);
$result = Facade::getRelationships($query);
foreach ($result->getRelationships() as $relationship) {
$type = $relationship->getRelationshipType();
}
use Covery\Client\Facade;
use Covery\Client\ClientProfile\Builder;
// Fetch a full client profile (POST) by client_profile_id
$profile = Builder::clientProfileEvent($clientProfileId)->build();
$result = Facade::getClientProfile($profile);
$email = $result->getEmail();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.