write find code for harim
This commit is contained in:
@@ -21,6 +21,13 @@ class PanjareVahedController extends Controller
|
||||
|
||||
public function receiveNewRequest(ReceiveNewRequest $request): JsonResponse
|
||||
{
|
||||
$iv = config('harim_web_services.Get_Info.iv');
|
||||
$keyString = config('harim_web_services.Get_Info.keyString');
|
||||
|
||||
$key = hash('sha256',$keyString, true);
|
||||
|
||||
$decrypted = openssl_decrypt($request->data, 'aes-256-cbc', $key, false, $iv);
|
||||
|
||||
$wkt = 'POLYGON(('.implode(',', array_map(fn ($c) => "{$c[0]} {$c[1]}", $request->primary_area['coordinates'])).'))';
|
||||
$result = DB::selectOne('SELECT ST_AsText(ST_PointOnSurface(ST_GeomFromText(?, 4326))) AS point', [$wkt]);
|
||||
preg_match('/POINT\(([^ ]+) ([^ ]+)\)/', $result->point, $matches);
|
||||
@@ -62,12 +69,11 @@ class PanjareVahedController extends Controller
|
||||
'response_options' => json_encode($request->response_options),
|
||||
'isic' => $request->isic,
|
||||
'primary_area' => json_encode($request->primary_area),
|
||||
'data' => $request->data['data'],
|
||||
'token' => $request->data['token'],
|
||||
'data' => $decrypted,
|
||||
'token' => $decrypted->token,
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'request_id' => $request->request_id,
|
||||
'id' => $harim->id,
|
||||
'city' => $city->edarateShahri()->first()->name_fa,
|
||||
'province' => $city->province()->first()->name_fa,
|
||||
|
||||
@@ -33,12 +33,14 @@ class ReceiveNewRequest extends FormRequest
|
||||
'plan_group' => 'required',
|
||||
'plan_title' => 'required',
|
||||
'worksheet' => 'required',
|
||||
'response_options' => 'required',
|
||||
'response_options' => 'required|array',
|
||||
'response_options.*.id' => 'required|integer',
|
||||
'response_options.*.value' => 'required|string',
|
||||
'isic' => 'required',
|
||||
'primary_area' => 'required|array',
|
||||
'primary_area.type' => 'required|string',
|
||||
'primary_area.coordinates' => 'required|array',
|
||||
'data' => 'required|array',
|
||||
'data' => 'required|string',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -30,4 +30,9 @@ return [
|
||||
'password' => env('HARIM_NEED_GUARANTEE_LETTER_PASSWORD'),
|
||||
'username' => env('HARIM_NEED_GUARANTEE_LETTER_USERNAME'),
|
||||
],
|
||||
|
||||
'Get_Info' => [
|
||||
'key' => env('HARIM_ENCRYPTION_KEY'),
|
||||
'iv' => env('HARIM_ENCRYPTION_IV'),
|
||||
],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user