improve service

This commit is contained in:
2025-12-15 12:03:15 +03:30
parent 1d763a3221
commit 71a0fe9769
4 changed files with 18 additions and 13 deletions

View File

@@ -53,7 +53,9 @@ PAYMENT_LINK=
HARIM_PAYMENT_USERNAME= HARIM_PAYMENT_USERNAME=
HARIM_PAYMENT_PASSWORD= HARIM_PAYMENT_PASSWORD=
HARIM_PAYMENT_URL= HARIM_PAYMENT_URL=
HARIM_PAYMENT_LINK= HARIM_PAYMENT_SERIAL=
HARIM_PAYMENT_INSTANCE_ID=
RMS_VERSION=3.0 RMS_VERSION=3.0
RMS_CTO_PHONE_NUMBER= RMS_CTO_PHONE_NUMBER=

View File

@@ -36,13 +36,13 @@ class AllocateRequest extends FormRequest
return [ return [
function (Validator $validator) { function (Validator $validator) {
$duplicateMission = Mission::query()->where('machine_id', '=', $this->machine_id) $duplicateMission = Mission::query()->where('machine_id', '=', $this->machine_id)
->whereBetween('start_date', [$this->mission->start_date, $this->mission->end_date]) ->where('start_date', '<=', $this->mission->end_date)
->orWhereBetween('end_date', [$this->mission->start_date, $this->mission->end_date]) ->where('end_date', '>=', $this->mission->start_date)
->exists(); ->exists();
if ($duplicateMission) { if ($duplicateMission) {
$validator->errors()->add( $validator->errors()->add(
'machine', 'machine_id',
'خودروی مورد نظر در این زمان رزرو می باشد' 'خودروی مورد نظر در این زمان رزرو می باشد'
); );
} }

View File

@@ -21,14 +21,16 @@ class HarimPaymentService
'username' => config('harim_web_services.Harim_Payment.username'), 'username' => config('harim_web_services.Harim_Payment.username'),
'password' => config('harim_web_services.Harim_Payment.PASSWORD'), 'password' => config('harim_web_services.Harim_Payment.PASSWORD'),
'amount' => $payment_amount, 'amount' => $payment_amount,
'serial' => "12345", 'serial' => config('harim_web_services.Harim_Payment.serial'),
'type' => 1, 'type' => 1,
'instanceid' => 123, 'instanceid' => config('harim_web_services.Harim_Payment.instanceid'),
'ownerid' => $national_id, 'ownerid' => $national_id,
'calculationBox' => "{\"rows\":[{\"amount\":" . $payment_amount . ",\"code\":\"7070011026200593\"}]}" 'calculationBox' => "{\"rows\":[{\"amount\":" . $payment_amount . ",\"code\":\"7070011026200593\"}]}"
); );
$response = Http::retry(3, 100)->withBody(http_build_query($payload)) $response = Http::withBody(http_build_query($payload))
->throw()
->withoutVerifying()
->post(config('harim_web_services.Harim_Payment.url')); ->post(config('harim_web_services.Harim_Payment.url'));
return $response->body(); return $response->body();
@@ -52,12 +54,12 @@ class HarimPaymentService
$result = "{$url}/{$username}/{$password}/{$bill_code}"; $result = "{$url}/{$username}/{$password}/{$bill_code}";
$response = Http::timeout(10)->get($result); return Http::get($result)
->throw()
->body();
}catch (\Throwable $th) {
return $response; throw new ProhibitedAction('خطا در دریافت');
} catch (\Throwable $th) {
abort(500);
} }
} }
return json_encode(['isPayed' => 1]); return json_encode(['isPayed' => 1]);

View File

@@ -41,6 +41,7 @@ return [
'username' => env('HARIM_ENCRYPTION_USERNAME'), 'username' => env('HARIM_ENCRYPTION_USERNAME'),
'password' => env('HARIM_ENCRYPTION_PASSWORD'), 'password' => env('HARIM_ENCRYPTION_PASSWORD'),
'url' => env('HARIM_ENCRYPTION_URL'), 'url' => env('HARIM_ENCRYPTION_URL'),
'LINK' => env('HARIM_ENCRYPTION_LINK'), 'serial' => env('HARIM_ENCRYPTION_SERIAL'),
'instanceid' => env('HARIM_ENCRYPTION_INSTANCE_ID'),
] ]
]; ];