FIX: Cartolas not adding Movimientos or adding cargos and abonos

This commit is contained in:
Juan Pablo Vial
2025-10-04 14:14:13 -03:00
parent 6d871d77fe
commit 0c640d6cab
4 changed files with 70 additions and 36 deletions

View File

@ -12,6 +12,9 @@ class MiIndicador implements Provider
public function __construct(protected ClientInterface $client) {}
/**
* @param string $money_symbol
* @param DateTimeInterface|null $dateTime
* @return float
* @throws EmptyResponse
*/
public function get(string $money_symbol, ?DateTimeInterface $dateTime = null): float
@ -33,7 +36,7 @@ class MiIndicador implements Provider
$body = $response->getBody();
$json = json_decode($body->getContents());
if (empty($json) or $json->codigo !== $money_symbol or count($json->serie) === 0) {
if (empty($json) or !isset($json->codigo) or !isset($json->serie) or $json->codigo !== $money_symbol or count($json->serie) === 0) {
throw new EmptyResponse($request_uri);
}
return $json->serie[0]->valor;