fix/add-venta (#44)
FIXES: - cast Comuna.id to int in Propietario - Inmobiliaria without tipoSociedad not loading descripcion Log exception processor Get Money values when stored as 0 Co-authored-by: Juan Pablo Vial <jpvialb@incoviba.cl> Reviewed-on: #44
This commit is contained in:
@ -53,7 +53,7 @@ class Money
|
||||
}
|
||||
try {
|
||||
$this->data[$provider] = (array) $this->fetchRedis($redisService, $redisKey);
|
||||
if (!isset($this->data[$provider][$date->format('Y-m-d')])) {
|
||||
if (!isset($this->data[$provider][$date->format('Y-m-d')]) or $this->data[$provider][$date->format('Y-m-d')] === 0) {
|
||||
throw new EmptyRedis($redisKey);
|
||||
}
|
||||
} catch (EmptyRedis) {
|
||||
|
@ -21,7 +21,7 @@ class IPC
|
||||
$ipcs = [];
|
||||
try {
|
||||
$ipcs = json_decode($this->redisService->get($this->redisKey), JSON_OBJECT_AS_ARRAY);
|
||||
if (!isset($ipcs[$dateKey])) {
|
||||
if (!isset($ipcs[$dateKey]) or $ipcs[$dateKey] === 0) {
|
||||
throw new EmptyRedis($this->redisKey);
|
||||
}
|
||||
} catch (EmptyRedis) {
|
||||
|
@ -48,8 +48,8 @@ class Ine implements Provider
|
||||
]);
|
||||
try {
|
||||
$response = $this->client->get($request_uri);
|
||||
} catch (GuzzleException) {
|
||||
throw new EmptyResponse($request_uri);
|
||||
} catch (GuzzleException $exception) {
|
||||
throw new EmptyResponse($request_uri, $exception);
|
||||
}
|
||||
$body = $response->getBody();
|
||||
$json = json_decode($body->getContents());
|
||||
|
@ -79,13 +79,7 @@ class Queue extends Ideal\Service
|
||||
try {
|
||||
$this->jobService->update($job);
|
||||
} catch (Update $exception) {
|
||||
$this->logger->error($exception->getMessage(), ['job' => $job, 'exception' => [
|
||||
'code' => $exception->getCode(),
|
||||
'message' => $exception->getMessage(),
|
||||
'file' => $exception->getFile(),
|
||||
'line' => $exception->getLine(),
|
||||
'trace' => $exception->getTraceAsString(),
|
||||
]]);
|
||||
$this->logger->error($exception->getMessage(), ['job' => $job, 'exception' => $exception]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class UF
|
||||
if ($date === null) {
|
||||
$date = new DateTimeImmutable();
|
||||
}
|
||||
if ($date->diff($today)->days < 0) {
|
||||
if ($date->diff($today)->invert === 1) {
|
||||
return 0.0;
|
||||
}
|
||||
/**
|
||||
@ -32,7 +32,7 @@ class UF
|
||||
*/
|
||||
try {
|
||||
$ufs = $this->getRedisUFs();
|
||||
if (!isset($ufs[$date->format('Y-m-d')])) {
|
||||
if (!isset($ufs[$date->format('Y-m-d')]) or $ufs[$date->format('Y-m-d')] === 0) {
|
||||
throw new EmptyRedis($this->redisKey);
|
||||
}
|
||||
return $ufs[$date->format('Y-m-d')];
|
||||
@ -54,12 +54,16 @@ class UF
|
||||
}
|
||||
public function updateMany(array $dates): array
|
||||
{
|
||||
$today = new DateTimeImmutable();
|
||||
$ufs = [];
|
||||
try {
|
||||
$ufs = json_decode($this->redisService->get($this->redisKey), JSON_OBJECT_AS_ARRAY);
|
||||
} catch (EmptyRedis) {}
|
||||
$updated = [];
|
||||
foreach ($dates as $date) {
|
||||
if ($date->diff($today)->invert === 1) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($ufs[$date->format('Y-m-d')]) or $ufs[$date->format('Y-m-d')] === 0) {
|
||||
$uf = $this->moneyService->getUF($date);
|
||||
if ($uf === 0.0) {
|
||||
|
@ -19,7 +19,7 @@ class USD
|
||||
$usds = [];
|
||||
try {
|
||||
$usds = json_decode($this->redisService->get($this->redisKey), JSON_OBJECT_AS_ARRAY);
|
||||
if (!isset($usds[$date->format('Y-m-d')])) {
|
||||
if (!isset($usds[$date->format('Y-m-d')]) or $usds[$date->format('Y-m-d')] === 0) {
|
||||
throw new EmptyRedis($this->redisKey);
|
||||
}
|
||||
$usd = $usds[$date->format('Y-m-d')];
|
||||
|
@ -181,7 +181,8 @@ class Propietario extends Service
|
||||
]);
|
||||
$filtered_data = array_intersect_key($data, $fields);
|
||||
try {
|
||||
$direccion = $this->direccionRepository->fetchByCalleAndNumeroAndExtraAndComuna($filtered_data['calle'], $filtered_data['numero'], $filtered_data['extra'], $filtered_data['comuna']);
|
||||
$direccion = $this->direccionRepository->fetchByCalleAndNumeroAndExtraAndComuna($filtered_data['calle'],
|
||||
$filtered_data['numero'], $filtered_data['extra'], (int) $filtered_data['comuna']);
|
||||
} catch (EmptyResult) {
|
||||
try {
|
||||
$direccion = $this->direccionRepository->create($filtered_data);
|
||||
|
@ -174,7 +174,7 @@ class Reservation extends Ideal\Service\API
|
||||
$this->reservationRepository->getConnection()->getPDO()->commit();
|
||||
}
|
||||
} catch (PDOException $exception) {
|
||||
$this->logger->warning($exception->getMessage(), ['exception' => $exception->getTraceAsString()]);
|
||||
$this->logger->warning($exception->getMessage(), ['exception' => $exception]);
|
||||
if ($this->reservationRepository->getConnection()->getPDO()->inTransaction()) {
|
||||
$this->reservationRepository->getConnection()->getPDO()->rollBack();
|
||||
}
|
||||
|
Reference in New Issue
Block a user