diff --git a/.env.example b/.env.example index 5ce02157..994bd3e2 100644 --- a/.env.example +++ b/.env.example @@ -101,4 +101,6 @@ HARIM_ENCRYPTION_IV="1111000011110101" CHECKE_LIST_MACHINES_ACTIVITY_URL='fms.141.ir:7030/api/RMS/GetMovingVehicles', CHECKE_LIST_MACHINES_ACTIVITY_PASSWORD= -CHECKE_LIST_MACHINES_ACTIVITY_USERNAME= \ No newline at end of file +CHECKE_LIST_MACHINES_ACTIVITY_USERNAME= + +HARIM_AMOUNT_PER=1 \ No newline at end of file diff --git a/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/ComputingPaymentRequest.php b/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/ComputingPaymentRequest.php index 0e51e601..63116bce 100644 --- a/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/ComputingPaymentRequest.php +++ b/app/Http/Requests/V3/Dashboard/Harim/HarimOffice/ComputingPaymentRequest.php @@ -29,10 +29,42 @@ class ComputingPaymentRequest extends FormRequest 'traffic' => 'required|numeric|decimal:0,1', 'road_type' => 'required|numeric|decimal:0,1', 'position' => 'required|numeric|decimal:0,1', - 'final_area_space' => 'required|numeric|decimal:0,2', - 'final_plan_space' => 'required|numeric|decimal:0,2', - 'payment_amount' => 'required|numeric|decimal:0,2', + 'final_area_space' => 'required|numeric|decimal:0,2', //عرصه + 'final_plan_space' => 'required|numeric|decimal:0,2', // عیان + 'payment_amount' => 'required|numeric', 'expert_description' => 'required|string', ]; } + + public function after(): array + { + return [ + function () { + $fe = config('harim_web_services.Harim_Payment.per'); + $arse = ( + $this->traffic * + $this->road_type * + $this->position * + $fe* + $this->final_area_space + ); + $ayan =( + $this->traffic * + $this->road_type * + $this->position * + $fe* + $this->final_plan_space + ); + $result = floor($arse + $ayan); + + if ($result !== $this->payment_amount) { + $this->validator->errors()->add( + 'payment_amount', + 'payment_amount مقادیر بدست امده صحیح نمی باشد.' + ); + } + } + ]; + } + } diff --git a/config/harim_web_services.php b/config/harim_web_services.php index 437739e7..1b1e6f65 100644 --- a/config/harim_web_services.php +++ b/config/harim_web_services.php @@ -35,4 +35,8 @@ return [ 'key' => env('HARIM_ENCRYPTION_KEY'), 'iv' => env('HARIM_ENCRYPTION_IV'), ], + + 'Harim_Payment' => [ + 'per' => env('HARIM_AMOUNT_PER'), + ] ];