PHP code example of exbico / underwriting-api-client

1. Go to this page and download the library: Download exbico/underwriting-api-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/ */

    

exbico / underwriting-api-client example snippets


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'

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'


$leadId = 12345; // Exbico Lead Id

$reportStatus = $client->reports()->scoring()->requestLeadReport($leadId);
$requestId = $reportStatus->getRequestId(); // 21320130
$statusLabel = $reportStatus->getStatus(); // 'inProgress'

// 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);