RetailCRM API Client

Verification extends AbstractApiResourceGroup

Class Verification

Tags
category

Verification

Table of Contents

Methods

smsConfirm()  : SmsVerificationConfirmResponse
Makes POST "/api/v5/verification/sms/confirm" request.
smsStatus()  : SmsVerificationStatusResponse
Makes GET "/api/v5/verification/sms/{checkId}/status" request.

Methods

smsConfirm()

Makes POST "/api/v5/verification/sms/confirm" request.

public smsConfirm(SmsVerificationConfirmRequest $request) : SmsVerificationConfirmResponse

Example:

use RetailCrm\Api\Factory\SimpleClientFactory;
use RetailCrm\Api\Interfaces\ApiExceptionInterface;
use RetailCrm\Api\Model\Entity\Verification\SmsVerificationConfirm;
use RetailCrm\Api\Model\Request\Verification\SmsVerificationConfirmRequest;

$client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');

$confirm = new SmsVerificationConfirm();
$confirm->code = 'code';
$confirm->checkId = 'checkId';

try {
    $response = $client->verification->smsConfirm(new SmsVerificationConfirmRequest($confirm));
} catch (ApiExceptionInterface $exception) {
    echo sprintf(
        'Error from RetailCRM API (status code: %d): %s',
        $exception->getStatusCode(),
        $exception->getMessage()
    );

    if (count($exception->getErrorResponse()->errors) > 0) {
        echo PHP_EOL . 'Errors: ' . implode(', ', $exception->getErrorResponse()->errors);
    }

    return;
}

echo 'Verification: ' . print_r($response->verification, true);
Parameters
$request : SmsVerificationConfirmRequest
Tags
throws
ApiExceptionInterface
throws
ClientExceptionInterface
throws
AccountDoesNotExistException
throws
ApiErrorException
throws
MissingCredentialsException
throws
MissingParameterException
throws
ValidationException
throws
HandlerException
throws
HttpClientException
Return values
SmsVerificationConfirmResponse

smsStatus()

Makes GET "/api/v5/verification/sms/{checkId}/status" request.

public smsStatus(string $checkId) : SmsVerificationStatusResponse

Example:

use RetailCrm\Api\Factory\SimpleClientFactory;
use RetailCrm\Api\Interfaces\ApiExceptionInterface;

$client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');

try {
    $response = $client->verification->smsStatus('checkId');
} catch (ApiExceptionInterface $exception) {
    echo sprintf(
        'Error from RetailCRM API (status code: %d): %s',
        $exception->getStatusCode(),
        $exception->getMessage()
    );

    if (count($exception->getErrorResponse()->errors) > 0) {
        echo PHP_EOL . 'Errors: ' . implode(', ', $exception->getErrorResponse()->errors);
    }

    return;
}

echo 'Verification: ' . print_r($response->verification, true);
Parameters
$checkId : string
Tags
throws
ApiExceptionInterface
throws
ClientExceptionInterface
throws
AccountDoesNotExistException
throws
ApiErrorException
throws
MissingCredentialsException
throws
MissingParameterException
throws
ValidationException
throws
HandlerException
throws
HttpClientException
Return values
SmsVerificationStatusResponse

        
On this page

Search results