Created
January 19, 2021 15:48
-
-
Save jongravois/f76560fcdf4c59ba5daf17828795f2ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Actions; | |
use Carbon\Carbon; | |
use Composer\Config; | |
use Illuminate\Support\Facades\Http; | |
class DeniedParty | |
{ | |
public static function check($name=null) | |
{ | |
$reporter = []; | |
if(! $name) { | |
$reporter['status'] = 'NOCHECK'; | |
$reporter['results'] = ''; | |
return $reporter; | |
} // end if | |
$path = 'https://api.trade.gov/gateway/v1/consolidated_screening_list/search?name=' . $name; | |
$srch = Http::withHeaders(['Authorization' => config('services.itar.basic')]) | |
->get($path)->json(); | |
if(! isset($srch['total'])) { | |
$reporter['status'] = 'NORESPONSE'; | |
$reporter['results'] = ''; | |
} elseif($srch['total'] > 0) { | |
$reporter['status'] = 'FAIL'; | |
$reporter['results'] = $srch['results'][0]['source']; | |
// $company->update([ | |
// 'denied_party_checked' => true, | |
// 'denied_party_cleared' => false, | |
// 'last_denied_party_check' => Carbon::today() | |
// ]); | |
} else { | |
$reporter['status'] = 'PASS'; | |
$reporter['results'] = ''; | |
// $company->update([ | |
// 'denied_party_checked' => true, | |
// 'denied_party_cleared' => true, | |
// 'last_denied_party_check' => Carbon::today() | |
// ]); | |
} //end if | |
return $reporter; | |
} // end function | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment