Skip to content

Commit

Permalink
Merge pull request #2812 from irontec/PROVIDER-2084-fix-currentDayUsa…
Browse files Browse the repository at this point in the history
…ge-not-updated

Added daily usage sync to microservices/balance
  • Loading branch information
danigargar authored Nov 13, 2024
2 parents cdfafdd + 79f9b54 commit d1698d7
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 d1698d7

Please sign in to comment.