exbico / underwriting-api-client
The Exbico Underwriting PHP Client Library enables you to work with Exbico Underwriting API on your server.
1.5.0
2021-10-20 11:20 UTC
Requires
- php: ^7.3 || ^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.2
- psr/log: ^1.1
Requires (Dev)
- monolog/monolog: ^2.2
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2025-02-23 00:05:16 UTC
README
Библиотека для работы с Exbico Underwriting API.
Установка
composer require exbico/underwriting-api-client
Использование
Инициализация клиента
use Exbico\Underwriting\Client; use Exbico\Underwriting\ApiSettings; $apiSettings = new ApiSettings('EBC_API_TOKEN'); $client = new Client($apiSettings);
Получение стоимости отчета
use Exbico\Underwriting\Dto\V1\Request\ReportPriceRequestDto; $reportPriceRequestDto = new ReportPriceRequestDto(); $reportPriceRequestDto->setReportType('credit-rating-nbch'); $reportPriceRequestDto->setLeadId(15); $reportPriceDto = $client->reports()->reportPrice()->getReportPrice($reportPriceRequestDto); $reportPrice = $reportPriceDto->getPrice();
Запрос кредитного рейтинга НБКИ по ФИО и паспортным данным
use Exbico\Underwriting\Dto\V1\Request\DocumentWithIssueDateDto; use Exbico\Underwriting\Dto\V1\Request\PersonWithBirthDateDto; use Exbico\Underwriting\Dto\V1\Request\IncomeDto; // Document data $document = new DocumentWithIssueDateDto(); $document->setNumber('333222'); $document->setSeries('6500'); $document->setIssueDate('2010-02-10'); // Person data $person = new PersonWithBirthDateDto(); $person->setFirstName('Иван'); $person->setLastName('Иванов'); $person->setPatronymic('Иванович'); $person->setBirthDate('1990-01-01'); $income = new IncomeDto(); $income->setMonthlyIncome(70000); $reportStatus = $client->reports()->creditRatingNbch()->requestReport($person, $document, $income); $requestId = $reportStatus->getRequestId(); // 21320130 $statusLabel = $reportStatus->getStatus(); // 'inProgress'
Запрос кредитного рейтинга НБКИ по ID лида и паспортным данным
use Exbico\Underwriting\Dto\V1\Request\DocumentWithIssueDateDto; use Exbico\Underwriting\Dto\V1\Request\IncomeDto; // Document data $document = new DocumentWithIssueDateDto(); $document->setNumber('333222'); $document->setSeries('6500'); $document->setIssueDate('2010-02-10'); $income = new IncomeDto(); $income->setMonthlyIncome(70000); $leadId = 12345; // Exbico Lead Id $reportStatus = $client->reports()->creditRatingNbch()->requestLeadReport($leadId, $document, $income); $requestId = $reportStatus->getRequestId(); // 21320130 $statusLabel = $reportStatus->getStatus(); // 'inProgress'
Запрос скоринга по ФИО, дате рождения и паспортным данным
use Exbico\Underwriting\Dto\V1\Request\DocumentWithIssueDateDto; use Exbico\Underwriting\Dto\V1\Request\PersonWithBirthDateDto; // Document data $document = new DocumentWithIssueDateDto(); $document->setNumber('333333'); $document->setSeries('5555'); $document->setIssueDate('2020-10-20'); // Person data $person = new PersonWithBirthDateDto(); $person->setFirstName('Иван'); $person->setLastName('Иванов'); $person->setPatronymic('Иванович'); $person->setBirthDate('2000-12-12'); $reportStatus = $client->reports()->scoring()->requestReport($person, $document); $requestId = $reportStatus->getRequestId(); // 21320130 $statusLabel = $reportStatus->getStatus(); // 'inProgress'
Запрос скоринга по ID лида
$leadId = 12345; // Exbico Lead Id $reportStatus = $client->reports()->scoring()->requestLeadReport($leadId); $requestId = $reportStatus->getRequestId(); // 21320130 $statusLabel = $reportStatus->getStatus(); // 'inProgress'
Запрос скоринга по ID лида и паспортным данным
// Exbico lead id $leadId = 12345; // Document data $document = new DocumentWithIssueDateDto(); $document->setNumber('333333'); $document->setSeries('5555'); $document->setIssueDate('2020-10-20'); $reportStatus = $client->reports()->scoring()->requestLeadReport($leadId, $document); $requestId = $reportStatus->getRequestId(); // 21320130 $statusLabel = $reportStatus->getStatus(); // 'inProgress'
Получение статуса подготовки отчета
$requestId = 21320130; $reportStatus = $client->reports()->reportStatus()->getReportStatus($requestId); $statusLabel = $reportStatus->getStatus(); // 'success'
Получение отчета кредитного рейтинга НБКИ
// ... Check status of report is 'success' $requestId = 21320130; $filename = 'report.pdf'; $client->reports()->creditRatingNbch()->downloadPdfReport($requestId, $filename);
Получение отчета по продукту "Скоринг"
// ... Check status of report is 'success' $requestId = 21320130; $filename = 'report.pdf'; $client->reports()->scoring()->downloadPdfReport($requestId, $filename);
Примеры использования находятся в папке examples
.
Тесты
./vendor/bin/phpunit tests