FIX: IPC y factura
This commit is contained in:
@ -5,11 +5,12 @@ use DateTimeInterface;
|
||||
use DateTimeImmutable;
|
||||
use DateInterval;
|
||||
use Incoviba\Common\Implement\Exception\EmptyRedis;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class IPC
|
||||
{
|
||||
protected string $redisKey = 'ipc';
|
||||
public function __construct(protected Redis $redisService, protected Money $moneyService) {}
|
||||
public function __construct(protected Redis $redisService, protected Money $moneyService, protected LoggerInterface $logger) {}
|
||||
|
||||
public function get(DateTimeInterface $from, DateTimeInterface $to = new DateTimeImmutable()): float
|
||||
{
|
||||
@ -38,7 +39,7 @@ class IPC
|
||||
public function readjust(float $base, DateTimeInterface $from, DateTimeInterface $to = new DateTimeImmutable()):float
|
||||
{
|
||||
if (($ipc = $this->get($from, $to->sub(new DateInterval('P1M')))) === 0.0) {
|
||||
return 0;
|
||||
return $base;
|
||||
}
|
||||
return $base * (1 + $ipc);
|
||||
}
|
||||
|
Reference in New Issue
Block a user