PHP code example of apihub-cdc / audit-firma-simulacion-client-php

1. Go to this page and download the library: Download apihub-cdc/audit-firma-simulacion-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 / audit-firma-simulacion-client-php example snippets


public function setUp()
{
    $config = new Configuration();
    $config->setHost('the_url');
    $this->x_api_key = "your_x_api_key";
    $client = new Client();
    $this->apiInstance = new Instance($client,$config);
}

public function testNip()
{
    try {
        $peticion = new SustitucionNIPPeticion();
        $persona = new Persona();
        $domicilio = new Domicilio();
        $catalogoEstados = new CatalogoEstados(); 
        $catalogoTipoPersona = new CatalogoTipoPersona();


        $domicilio->setCalleNumero("AV 535 84");
        $domicilio->setColonia("SAN JUAN DE ARAGON 1RA SECC");
        $domicilio->setCiudad( "CIUDAD DE MEXICO");
        $domicilio->setEstado($catalogoEstados::CDMX);
        
        $persona->setPrimerNombre("NOMBRE");
        $persona->setSegundoNombre("SEGUNDONOMBRE");
        $persona->setApellidoPaterno("PATERNO");
        $persona->setApellidoMaterno("MATERNO");
        $persona->setApellidoAdicional(null);
        $persona->setRFC("PUAP850316MI1");
        $persona->setDomicilio($domicilio);

        $peticion->setFolioCDC(763211111);
        $peticion->setFechaConsulta("2021/04/15");
        $peticion->setHoraConsulta("10/12/35");
        $peticion->setTipoConsulta($catalogoTipoPersona::PF);
        $peticion->setUsuario("NGA9915CC5");
        $peticion->setFechaAprobacionConsulta("2021/04/15");
        $peticion->setHoraAprobacionConsulta("10/12/35");
        $peticion->setIngresoNuevamenteNIP(true);
        $peticion->setRespuestaLeyendaAutorizacion(true);
        $peticion->setAceptaTerminosCondiciones(true);
        $peticion->setNumeroFirma("1234F");
        $peticion->setPersona($persona);

        $result = $this->apiInstance->nip($this->x_api_key, $peticion);
        print_r($result);
    } catch (ApiException | Exception $e) {
        echo 'Exception when calling ApiTest->testNip: ', $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