diff --git a/app/Http/Controllers/TacController.php b/app/Http/Controllers/TacController.php index a5d4b52..7bf8dbb 100644 --- a/app/Http/Controllers/TacController.php +++ b/app/Http/Controllers/TacController.php @@ -175,22 +175,22 @@ class TacController extends Controller $CustomerInfo_PKB = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/customers/' . $icno)->json(); $CustomerInfo_KOOPKB = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') .'/api/customers/' . $icno)->json(); - if($CustomerInfo_PKB){ + if($CustomerInfo_KOOPKB){ if($details == true){ - $poskod = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/poskod/' . $CustomerInfo_PKB['poskod'])->json(); + $poskod = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/poskod/' . $CustomerInfo_KOOPKB['poskod'])->json(); $daerah = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/daerah/' . $poskod['koddaerah'])->json(); $negeri =Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/negeri/' . $poskod['kodnegeri'])->json(); - return ['customerinfo' => $CustomerInfo_PKB,'poskod' => $poskod,'daerah' => $daerah,'negeri' => $negeri]; - } - $CustomerInfo = $CustomerInfo_PKB; - }else if($CustomerInfo_KOOPKB){ - if($details == true){ - $poskod = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') . '/api/poskod/' . $CustomerInfo_KOOPKB['poskod'])->json(); - $daerah = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') .'/api/daerah/' . $poskod['koddaerah'])->json(); - $negeri =Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') .'/api/negeri/' . $poskod['kodnegeri'])->json(); return ['customerinfo' => $CustomerInfo_KOOPKB,'poskod' => $poskod,'daerah' => $daerah,'negeri' => $negeri]; } $CustomerInfo = $CustomerInfo_KOOPKB; + }else if($CustomerInfo_PKB){ + if($details == true){ + $poskod = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') . '/api/poskod/' . $CustomerInfo_PKB['poskod'])->json(); + $daerah = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') .'/api/daerah/' . $poskod['koddaerah'])->json(); + $negeri =Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') .'/api/negeri/' . $poskod['kodnegeri'])->json(); + return ['customerinfo' => $CustomerInfo_PKB,'poskod' => $poskod,'daerah' => $daerah,'negeri' => $negeri]; + } + $CustomerInfo = $CustomerInfo_PKB; }else{ $CustomerInfo = null; }