Skip to content

Commit

Permalink
core: added daily usar sync to microservices/balance
Browse files Browse the repository at this point in the history
  • Loading branch information
danigargar authored and cruzccl committed Nov 13, 2024
1 parent cdfafdd commit 79f9b54
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion microservices/balances/src/Controller/Sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Ivoz\Core\Domain\Service\DomainEventPublisher;
use Ivoz\Provider\Domain\Service\Carrier\SyncBalances as SyncCarrierBalances;
use Ivoz\Provider\Domain\Service\Company\SyncBalances;
use Ivoz\Provider\Domain\Service\Company\SyncDailyUsage;
use Symfony\Component\HttpFoundation\Response;

class Sync
Expand All @@ -19,17 +20,21 @@ class Sync

protected $syncBalances;
protected $syncCarrierBalances;
/** @var SyncDailyUsage */
protected $syncDailyUsage;

public function __construct(
DomainEventPublisher $eventPublisher,
RequestId $requestId,
SyncBalances $syncBalances,
SyncCarrierBalances $syncCarrierBalances
SyncCarrierBalances $syncCarrierBalances,
SyncDailyUsage $syncDailyUsage
) {
$this->eventPublisher = $eventPublisher;
$this->requestId = $requestId;
$this->syncBalances = $syncBalances;
$this->syncCarrierBalances = $syncCarrierBalances;
$this->syncDailyUsage = $syncDailyUsage;
}

public function index(): Response
Expand All @@ -44,6 +49,10 @@ public function index(): Response
->syncCarrierBalances
->updateAll();

$this
->syncDailyUsage
->updateAll();

return new Response("Company and carrier balances updated successfully!\n");
}
}

0 comments on commit 79f9b54

Please sign in to comment.