improve service
This commit is contained in:
@@ -36,13 +36,13 @@ class AllocateRequest extends FormRequest
|
||||
return [
|
||||
function (Validator $validator) {
|
||||
$duplicateMission = Mission::query()->where('machine_id', '=', $this->machine_id)
|
||||
->whereBetween('start_date', [$this->mission->start_date, $this->mission->end_date])
|
||||
->orWhereBetween('end_date', [$this->mission->start_date, $this->mission->end_date])
|
||||
->where('start_date', '<=', $this->mission->end_date)
|
||||
->where('end_date', '>=', $this->mission->start_date)
|
||||
->exists();
|
||||
|
||||
if ($duplicateMission) {
|
||||
$validator->errors()->add(
|
||||
'machine',
|
||||
'machine_id',
|
||||
'خودروی مورد نظر در این زمان رزرو می باشد'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -21,14 +21,16 @@ class HarimPaymentService
|
||||
'username' => config('harim_web_services.Harim_Payment.username'),
|
||||
'password' => config('harim_web_services.Harim_Payment.PASSWORD'),
|
||||
'amount' => $payment_amount,
|
||||
'serial' => "12345",
|
||||
'serial' => config('harim_web_services.Harim_Payment.serial'),
|
||||
'type' => 1,
|
||||
'instanceid' => 123,
|
||||
'instanceid' => config('harim_web_services.Harim_Payment.instanceid'),
|
||||
'ownerid' => $national_id,
|
||||
'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'));
|
||||
|
||||
return $response->body();
|
||||
@@ -52,12 +54,12 @@ class HarimPaymentService
|
||||
|
||||
$result = "{$url}/{$username}/{$password}/{$bill_code}";
|
||||
|
||||
$response = Http::timeout(10)->get($result);
|
||||
return Http::get($result)
|
||||
->throw()
|
||||
->body();
|
||||
|
||||
|
||||
return $response;
|
||||
} catch (\Throwable $th) {
|
||||
abort(500);
|
||||
}catch (\Throwable $th) {
|
||||
throw new ProhibitedAction('خطا در دریافت');
|
||||
}
|
||||
}
|
||||
return json_encode(['isPayed' => 1]);
|
||||
|
||||
Reference in New Issue
Block a user