PHP code example of apihub-cdc / rc-ficoscore-client-php

1. Go to this page and download the library: Download apihub-cdc/rc-ficoscore-client-php 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/ */

    

apihub-cdc / rc-ficoscore-client-php example snippets



public function setUp()
    {
        $password = getenv('KEY_PASSWORD');
        $this->signer = new KeyHandler(null, null, $password);

        
        $events = new MiddlewareEvents($this->signer);
        $handler = \GuzzleHttp\HandlerStack::create();
        $handler->push($events->add_signature_header('x-signature'));
        $handler->push($events->verify_signature_header('x-signature'));
        $config = new \rc\ficoscore\Client\Configuration();
        $config->setHost('the_url');
        
        $client = new \GuzzleHttp\Client(['handler' => $handler]);
        $this->apiInstance = new ReporteDeCreditoConFicoScoreApi($client, $config);


        $this->x_api_key = "your_api_key";
        $this->username = "your_username";
        $this->password = "your_password";
    }


public function testGetReporte()
    {

        $persona = new PersonaPeticion();
        $estado = new CatalogoEstados();
        $domicilio = new DomicilioPeticion();

        $persona->setPrimerNombre("XX");
        $persona->setApellidoPaterno("XX");
        $persona->setApellidoMaterno("XX");
        $persona->setFechaNacimiento("XX");
        $persona->setRfc("XX");
        $persona->setNacionalidad("XX");

        $domicilio->setDireccion("XX");
        $domicilio->setColoniaPoblacion("XX");
        $domicilio->setDelegacionMunicipio("XX");
        $domicilio->setCiudad("XX");
        $domicilio->setEstado($estado::MEX);
        $domicilio->setCp("XX");
        $domicilio->setFechaResidencia("XX");
        $domicilio->setNumeroTelefono("XX");
        $domicilio->setTipoDomicilio("XX");
        $domicilio->setTipoAsentamiento("XX");

        $persona->setDomicilio($domicilio);

        try {
            $result = $this->apiInstance->getReporte($this->x_api_key, $this->username, $this->password, $persona);
            $this->signer->close();
            print_r($result);
            $this->assertTrue($result->getFolioConsulta()!==null);
            return $result->getFolioConsulta();
        } catch (ApiException $e) {
            echo 'Exception when calling ReporteDeCreditoConFicoScoreApi->getReporte: ', $e->getMessage(), PHP_EOL;
        }

    }


sh
#ejemplo con php en versión 7.3 para otra versión colocar php{version}-curl
apt-get install php7.3-curl
apt-get install php7.3-mbstring