feat(vikon): extract API URL from hardcoded to integration_credentials

- Rename ViconApiToken → ViconApiConfig with token() and apiUrl()
- Replace 9 hardcoded db-nica.ru URLs with dynamic apiUrl()
- Payload now stores both token and api_url with fallback
This commit is contained in:
F4ilji
2026-07-10 16:47:18 +05:00
parent 7748b05547
commit 73a0a6fe9c
4 changed files with 28 additions and 19 deletions
@@ -4,14 +4,14 @@ namespace App\Services\Vicon\DirectionStudy;
use App\Jobs\CreateDirectionStudy;
use App\Jobs\CreateEducationalProgram;
use App\Services\Vicon\ViconApiToken;
use App\Services\Vicon\ViconApiConfig;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
class AdmissionPlanService
{
public function __construct(
private readonly ViconApiToken $viconApiToken,
private readonly ViconApiConfig $viconApiConfig,
) {}
public function getLevelEducationCodes(object $campaign) : array
{
@@ -31,8 +31,8 @@ class AdmissionPlanService
{
try {
$response = $this->callAPI(
"https://db-nica.ru/api/v1/campaigns",
$this->viconApiToken->get()
"{$this->viconApiConfig->apiUrl()}/campaigns",
$this->viconApiConfig->token()
);
if (!is_array($response)) {
Log::channel('app')->warning('Unexpected response type in getCampaigns', [
@@ -55,8 +55,8 @@ class AdmissionPlanService
{
try {
$response = $this->callAPI(
"https://db-nica.ru/api/v1/planPriema/$campaign_levels_code",
$this->viconApiToken->get()
"{$this->viconApiConfig->apiUrl()}/planPriema/$campaign_levels_code",
$this->viconApiConfig->token()
);
if (!is_object($response)) {