update composre

This commit is contained in:
2025-03-24 01:11:33 +05:00
parent 785e48d175
commit 2785f4afdf
6 changed files with 248 additions and 242 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\Modules\LoanRemainingOrder\Actions\FetchRemainingLoanFromBilling;
use App\Repos\System\Settings\Legal\PassportRepo;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -22,67 +23,12 @@ class FetchLoanRemainingController extends Controller
'account_number' => ['required', 'string', 'max:255'],
]);
if (app()->isLocal()) {
return $this->sampleResponse();
}
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'http://10.3.158.102:9999/api/loaninfo',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => sprintf('
{
"idSeria": "%s",
"idNo": "%s",
"accountCode": "%s"
}
',
$request->passport_serie,
$request->passport_id,
$request->account_number,
),
CURLOPT_HTTPHEADER => [
'Authorization: Basic dGJ1c2VyOlFBWndzeDEyMw==',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
$response = FetchRemainingLoanFromBilling::make()->handle(
passport_serie: $request->passport_serie,
passport_id: $request->passport_id,
account_number: $request->account_number,
);
return response()->json($response);
}
/**
* Sample request
*/
public function sampleResponse(): JsonResponse
{
return response()->json([
'idSeria' => 'I-AS',
'idNo' => '379514',
'accountCode' => '14208934130700002997232',
'clientName' => 'Joraýew Mämmetjan Galandarowiç',
'docNum' => '530/23',
'docSum' => 20000,
'docMonthSum' => 556,
'docPayed' => 10860,
'balans' => 9140,
'percentBalance' => 0,
'branchName' => '"TÜRKMENBAŞY" TPTB-nyň Çandybil şahamçasy',
'branchMfo' => '390101307',
'errCode' => 0,
'message' => 'ÜSTÜNLIKLI.',
'messageRu' => 'УСПЕШНО.',
'messageEn' => 'SUCCESS.',
]);
}
}