Merge branch 'develop' into feature/cierres
This commit is contained in:
@ -61,7 +61,7 @@ class ArrayBuilder
|
||||
$params = [
|
||||
$this->container->get(Predis\ClientInterface::class),
|
||||
"logs:{$handlerData['name']}",
|
||||
'capSize' => 100
|
||||
'capSize' => $handlerData['capSize'] ?? 100
|
||||
];
|
||||
} catch (NotFoundExceptionInterface | ContainerExceptionInterface $exception) {
|
||||
$this->log($exception, ['handlerData' => $handlerData]);
|
||||
|
@ -33,7 +33,7 @@ Editar Propietario
|
||||
<div class="fields">
|
||||
<div class="field">
|
||||
<label for="calle">Dirección</label>
|
||||
<input type="text" name="calle" id="calle" value="{'{$propietario->datos->direccion->calle}}" />
|
||||
<input type="text" name="calle" id="calle" value="{{$propietario->datos->direccion->calle}}" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="numero">Número</label>
|
||||
|
@ -126,13 +126,6 @@ return [
|
||||
'body' => $request->getBody()->getContents(),
|
||||
]);
|
||||
}));
|
||||
$stack->push(GuzzleHttp\Middleware::mapResponse(function(Psr\Http\Message\ResponseInterface $response) use ($logger) {
|
||||
$logger->info('Toku Response', [
|
||||
'status' => $response->getStatusCode(),
|
||||
'headers' => $response->getHeaders(),
|
||||
'body' => $response->getBody()->getContents(),
|
||||
]);
|
||||
}));
|
||||
return new GuzzleHttp\Client([
|
||||
'handler' => $stack,
|
||||
'base_uri' => $container->get('TOKU_URL'),
|
||||
|
@ -92,7 +92,6 @@ class Persona extends Ideal\Service
|
||||
throw new Create(__CLASS__, $exception);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$this->addDatos($persona, $data);
|
||||
|
||||
|
@ -68,12 +68,24 @@ class Queue extends Ideal\Service
|
||||
return false;
|
||||
}
|
||||
} catch (Exception $exception) {
|
||||
$this->logger->warning("Could not run job {$job->id}", ['exception' => $exception]);
|
||||
$this->logger->warning("Could not run job {$job->id}", ['exception' => [
|
||||
'code' => $exception->getCode(),
|
||||
'message' => $exception->getMessage(),
|
||||
'file' => $exception->getFile(),
|
||||
'line' => $exception->getLine(),
|
||||
'trace' => $exception->getTraceAsString(),
|
||||
]]);
|
||||
$job->retries++;
|
||||
try {
|
||||
$this->jobService->update($job);
|
||||
} catch (Update $exception) {
|
||||
$this->logger->error($exception->getMessage(), ['job' => $job, 'exception' => $exception]);
|
||||
$this->logger->error($exception->getMessage(), ['job' => $job, 'exception' => [
|
||||
'code' => $exception->getCode(),
|
||||
'message' => $exception->getMessage(),
|
||||
'file' => $exception->getFile(),
|
||||
'line' => $exception->getLine(),
|
||||
'trace' => $exception->getTraceAsString(),
|
||||
]]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -103,8 +103,12 @@ class Customer extends AbstractEndPoint
|
||||
continue;
|
||||
}
|
||||
if (!str_starts_with($value, '+')) {
|
||||
if (str_starts_with($value, '56')) {
|
||||
$value = "+{$value}";
|
||||
} else {
|
||||
$value = "+56{$value}";
|
||||
}
|
||||
}
|
||||
$params[$key] = $value;
|
||||
continue;
|
||||
}
|
||||
|
@ -104,7 +104,6 @@ class Propietario extends Service
|
||||
} catch (EmptyResult) {
|
||||
try {
|
||||
$propietario = $this->propietarioRepository->create($filtered_data);
|
||||
$this->logger->info('Propietario', ['propietario' => $propietario]);
|
||||
$propietario = $this->propietarioRepository->save($propietario);
|
||||
} catch (PDOException $exception) {
|
||||
throw new Create(__CLASS__, $exception);
|
||||
|
@ -5,12 +5,10 @@ use Psr\Log\LoggerInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Faker;
|
||||
use Incoviba\Common\Implement;
|
||||
use Incoviba\Exception\ServiceAction;
|
||||
use Incoviba\Model;
|
||||
use Incoviba\Repository;
|
||||
use Incoviba\Service;
|
||||
use Incoviba\Common\Define;
|
||||
use Incoviba\Common\Ideal;
|
||||
use Tests\Extension\Faker\Provider\Rut;
|
||||
|
||||
class PersonaTest extends TestCase
|
||||
{
|
||||
@ -51,10 +49,11 @@ class PersonaTest extends TestCase
|
||||
$personaService = new Service\Persona($this->logger, $this->personaRepository, $this->datosPersonaRepository,
|
||||
$this->propietarioRepository, $this->direccionService);
|
||||
$faker = Faker\Factory::create('es_ES');
|
||||
$digit = $faker->boolean(100-round(1/11*100)) ? $faker->randomNumber(1) : 'K';
|
||||
$faker->addProvider(new Rut($faker));
|
||||
$rut = $faker->rut(false, false);
|
||||
$data = [
|
||||
'rut' => $faker->randomNumber(8),
|
||||
'digito' => $digit,
|
||||
'rut' => $rut,
|
||||
'digito' => $faker->digitoVerificador($rut),
|
||||
'nombres' => $faker->name(),
|
||||
'apellido_paterno' => $faker->lastName(),
|
||||
'apellido_materno' => $faker->lastName(),
|
||||
@ -62,4 +61,64 @@ class PersonaTest extends TestCase
|
||||
$persona = $personaService->add($data);
|
||||
$this->assertEquals($data['rut'], $persona->rut);
|
||||
}
|
||||
public function testGetById(): void
|
||||
{
|
||||
$faker = Faker\Factory::create('es_ES');
|
||||
$faker->addProvider(new Rut($faker));
|
||||
$direccion = $this->getMockBuilder(Model\Direccion::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$direccion->id = $faker->randomNumber(2);
|
||||
$datos = new Model\Venta\Datos();
|
||||
$datos->direccion = $direccion;
|
||||
$datos->telefono = $faker->randomNumber(8);
|
||||
$datos->email = $faker->email();
|
||||
$datos->sexo = $faker->randomElement(['M', 'F']);
|
||||
$rut = $faker->rut(false, false);
|
||||
$propietario = new Model\Venta\Propietario();
|
||||
$propietario->rut = $rut;
|
||||
$propietario->dv = $faker->digitoVerificador($rut);
|
||||
$propietario->nombres = $faker->name();
|
||||
$propietario->apellidos['paterno'] = $faker->lastName();
|
||||
$propietario->apellidos['materno'] = $faker->lastName();
|
||||
$propietario->datos = $datos;
|
||||
$propietarioRepository = $this->getMockBuilder(Repository\Venta\Propietario::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$personaRepository = $this->getMockBuilder(Repository\Persona::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$personaRepository->method('fetchById')->willThrowException(new Implement\Exception\EmptyResult(''));
|
||||
$personaRepository->method('create')->willReturnCallback(function($data) {
|
||||
$persona = new Model\Persona();
|
||||
$persona->rut = $data['rut'];
|
||||
$persona->digito = $data['digito'];
|
||||
$persona->nombres = $data['nombres'];
|
||||
$persona->apellidoPaterno = $data['apellido_paterno'];
|
||||
$persona->apellidoMaterno = $data['apellido_materno'];
|
||||
return $persona;
|
||||
});
|
||||
$personaRepository->method('save')->willReturnArgument(0);
|
||||
$datosPersona = new Model\Persona\Datos();
|
||||
$datosPersona->direccion = $direccion;
|
||||
$datosPersona->telefono = $datos->telefono;
|
||||
$datosPersona->email = $datos->email;
|
||||
$datosPersona->sexo = $datos->sexo;
|
||||
$datosPersonaRepository = $this->getMockBuilder(Repository\Persona\Datos::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$datosPersonaRepository->method('fetchByPersona')->willReturn($datosPersona);
|
||||
$propietarioRepository->method('fetchById')->willReturn($propietario);
|
||||
$direccionService = $this->getMockBuilder(Service\Direccion::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$direccionService->method('add')->willReturn($direccion);
|
||||
$personaService = new Service\Persona($this->logger, $personaRepository, $datosPersonaRepository,
|
||||
$propietarioRepository, $direccionService);
|
||||
$persona = $personaService->getById($rut);
|
||||
$this->assertEquals($rut, $persona->rut);
|
||||
$this->assertEquals($propietario->dv, $persona->digito);
|
||||
$this->assertEquals($propietario->nombres, $persona->nombres);
|
||||
$this->assertEquals($propietario->apellidos['paterno'], $persona->apellidoPaterno);
|
||||
$this->assertEquals($propietario->apellidos['materno'], $persona->apellidoMaterno);
|
||||
$this->assertEquals($datos->direccion, $persona->datos->direccion);
|
||||
$this->assertEquals($datos->telefono, $persona->datos->telefono);
|
||||
$this->assertEquals($datos->email, $persona->datos->email);
|
||||
$this->assertEquals($datos->sexo, $persona->datos->sexo);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user