Merge branch 'develop' into feature/cierres
This commit is contained in:
@ -61,7 +61,7 @@ class ArrayBuilder
|
|||||||
$params = [
|
$params = [
|
||||||
$this->container->get(Predis\ClientInterface::class),
|
$this->container->get(Predis\ClientInterface::class),
|
||||||
"logs:{$handlerData['name']}",
|
"logs:{$handlerData['name']}",
|
||||||
'capSize' => 100
|
'capSize' => $handlerData['capSize'] ?? 100
|
||||||
];
|
];
|
||||||
} catch (NotFoundExceptionInterface | ContainerExceptionInterface $exception) {
|
} catch (NotFoundExceptionInterface | ContainerExceptionInterface $exception) {
|
||||||
$this->log($exception, ['handlerData' => $handlerData]);
|
$this->log($exception, ['handlerData' => $handlerData]);
|
||||||
|
@ -33,7 +33,7 @@ Editar Propietario
|
|||||||
<div class="fields">
|
<div class="fields">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="calle">Dirección</label>
|
<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>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="numero">Número</label>
|
<label for="numero">Número</label>
|
||||||
|
@ -126,13 +126,6 @@ return [
|
|||||||
'body' => $request->getBody()->getContents(),
|
'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([
|
return new GuzzleHttp\Client([
|
||||||
'handler' => $stack,
|
'handler' => $stack,
|
||||||
'base_uri' => $container->get('TOKU_URL'),
|
'base_uri' => $container->get('TOKU_URL'),
|
||||||
|
@ -92,7 +92,6 @@ class Persona extends Ideal\Service
|
|||||||
throw new Create(__CLASS__, $exception);
|
throw new Create(__CLASS__, $exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$this->addDatos($persona, $data);
|
$this->addDatos($persona, $data);
|
||||||
|
|
||||||
|
@ -68,12 +68,24 @@ class Queue extends Ideal\Service
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (Exception $exception) {
|
} 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++;
|
$job->retries++;
|
||||||
try {
|
try {
|
||||||
$this->jobService->update($job);
|
$this->jobService->update($job);
|
||||||
} catch (Update $exception) {
|
} 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -103,8 +103,12 @@ class Customer extends AbstractEndPoint
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!str_starts_with($value, '+')) {
|
if (!str_starts_with($value, '+')) {
|
||||||
|
if (str_starts_with($value, '56')) {
|
||||||
|
$value = "+{$value}";
|
||||||
|
} else {
|
||||||
$value = "+56{$value}";
|
$value = "+56{$value}";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$params[$key] = $value;
|
$params[$key] = $value;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,6 @@ class Propietario extends Service
|
|||||||
} catch (EmptyResult) {
|
} catch (EmptyResult) {
|
||||||
try {
|
try {
|
||||||
$propietario = $this->propietarioRepository->create($filtered_data);
|
$propietario = $this->propietarioRepository->create($filtered_data);
|
||||||
$this->logger->info('Propietario', ['propietario' => $propietario]);
|
|
||||||
$propietario = $this->propietarioRepository->save($propietario);
|
$propietario = $this->propietarioRepository->save($propietario);
|
||||||
} catch (PDOException $exception) {
|
} catch (PDOException $exception) {
|
||||||
throw new Create(__CLASS__, $exception);
|
throw new Create(__CLASS__, $exception);
|
||||||
|
@ -5,12 +5,10 @@ use Psr\Log\LoggerInterface;
|
|||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Faker;
|
use Faker;
|
||||||
use Incoviba\Common\Implement;
|
use Incoviba\Common\Implement;
|
||||||
use Incoviba\Exception\ServiceAction;
|
|
||||||
use Incoviba\Model;
|
use Incoviba\Model;
|
||||||
use Incoviba\Repository;
|
use Incoviba\Repository;
|
||||||
use Incoviba\Service;
|
use Incoviba\Service;
|
||||||
use Incoviba\Common\Define;
|
use Tests\Extension\Faker\Provider\Rut;
|
||||||
use Incoviba\Common\Ideal;
|
|
||||||
|
|
||||||
class PersonaTest extends TestCase
|
class PersonaTest extends TestCase
|
||||||
{
|
{
|
||||||
@ -51,10 +49,11 @@ class PersonaTest extends TestCase
|
|||||||
$personaService = new Service\Persona($this->logger, $this->personaRepository, $this->datosPersonaRepository,
|
$personaService = new Service\Persona($this->logger, $this->personaRepository, $this->datosPersonaRepository,
|
||||||
$this->propietarioRepository, $this->direccionService);
|
$this->propietarioRepository, $this->direccionService);
|
||||||
$faker = Faker\Factory::create('es_ES');
|
$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 = [
|
$data = [
|
||||||
'rut' => $faker->randomNumber(8),
|
'rut' => $rut,
|
||||||
'digito' => $digit,
|
'digito' => $faker->digitoVerificador($rut),
|
||||||
'nombres' => $faker->name(),
|
'nombres' => $faker->name(),
|
||||||
'apellido_paterno' => $faker->lastName(),
|
'apellido_paterno' => $faker->lastName(),
|
||||||
'apellido_materno' => $faker->lastName(),
|
'apellido_materno' => $faker->lastName(),
|
||||||
@ -62,4 +61,64 @@ class PersonaTest extends TestCase
|
|||||||
$persona = $personaService->add($data);
|
$persona = $personaService->add($data);
|
||||||
$this->assertEquals($data['rut'], $persona->rut);
|
$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