Aplikasi Keuangan yang mengatur lalu lintas transaksi antara bank dan aplikasi internal Kampus
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

28 lines
765 B

<?php
namespace App\Domains\Channel\Actions\Api;
use App\Domains\Channel\Enums\Api\ApiType;
use App\Domains\Channel\Models\ApiEndpoint;
use Illuminate\Support\Facades\Http;
class SynchronizeWithApi
{
public function execute(ApiType $apiType): void
{
$endpoint = ApiEndpoint::query()
->with('client')
->where('key', $apiType)
->first();
$domain = $endpoint->client->domain;
$url = $endpoint->value;
$credentials = $endpoint->client->credentials;
$authType = $endpoint->client->auth_type;
$url = "https://$domain$url";
$header = $authType->buildCredentials($credentials);
$response = Http::withHeaders($header)->get($url);
dd($response);
}
}