otp
This commit is contained in:
@@ -251,10 +251,53 @@ class CustomersController extends Controller
|
||||
}
|
||||
|
||||
$otp_token = Http::get(config('api.url') . '/api/otp/' . $nokp) ->json();
|
||||
$otp_token_used = Http::get(config('api.url') . '/api/otp/used/' . $nokp) ->json();
|
||||
|
||||
if (is_array($otp_token) || is_object($otp_token)){
|
||||
if($otp_token){
|
||||
return response(['error' => "OTP Akaun Telah Di Jana"]);
|
||||
}else{
|
||||
if (is_array($otp_token_used) || is_object($otp_token_used)){
|
||||
if($otp_token_used){
|
||||
return response(['error' => "Pelanggan Sudah Mendaftar Pada Customer Portal"]);
|
||||
}else{
|
||||
$random = token(6);
|
||||
|
||||
$otp_baru = Http::post(config('api.url'). '/api/otp/generateotp/' . $nokp,[
|
||||
'otptoken' => $random,
|
||||
'expired' => $expired,
|
||||
'kodcaw' => $auth_user['cawangan']
|
||||
]);
|
||||
|
||||
return response()->json(['otp'=>$random]);
|
||||
}
|
||||
}else{
|
||||
$random = token(6);
|
||||
|
||||
$otp_baru = Http::post(config('api.url'). '/api/otp/generateotp/' . $nokp,[
|
||||
'otptoken' => $random,
|
||||
'expired' => $expired,
|
||||
'kodcaw' => $auth_user['cawangan']
|
||||
]);
|
||||
|
||||
return response()->json(['otp'=>$random]);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if (is_array($otp_token_used) || is_object($otp_token_used)){
|
||||
if($otp_token_used){
|
||||
return response(['error' => "Pelanggan Sudah Mendaftar Pada Customer Portal"]);
|
||||
}else{
|
||||
$random = token(6);
|
||||
|
||||
$otp_baru = Http::post(config('api.url'). '/api/otp/generateotp/' . $nokp,[
|
||||
'otptoken' => $random,
|
||||
'expired' => $expired,
|
||||
'kodcaw' => $auth_user['cawangan']
|
||||
]);
|
||||
|
||||
return response()->json(['otp'=>$random]);
|
||||
}
|
||||
}else{
|
||||
$random = token(6);
|
||||
|
||||
@@ -266,16 +309,6 @@ class CustomersController extends Controller
|
||||
|
||||
return response()->json(['otp'=>$random]);
|
||||
}
|
||||
}else{
|
||||
$random = token(6);
|
||||
|
||||
$otp_baru = Http::post(config('api.url'). '/api/otp/generateotp/' . $nokp,[
|
||||
'otptoken' => $random,
|
||||
'expired' => $expired,
|
||||
'kodcaw' => $auth_user['cawangan']
|
||||
]);
|
||||
|
||||
return response()->json(['otp'=>$random]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user