nikarayan and payment service
This commit is contained in:
37
app/Services/NikarayanService.php
Normal file
37
app/Services/NikarayanService.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\RoadObserved;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use SoapClient;
|
||||
|
||||
class NikarayanService
|
||||
{
|
||||
protected SoapClient $soapClient;
|
||||
|
||||
public function __construct(SoapClient $soapClient)
|
||||
{
|
||||
$this->soapClient = $soapClient;
|
||||
}
|
||||
|
||||
public function updateRoadObservedInfoByNikarayan(Request $request, RoadObserved $roadObserved, $files)
|
||||
{
|
||||
if (App::isProduction())
|
||||
{
|
||||
$array = array('strUserName' => 'vaytelrop',
|
||||
'strPassword' => 'VaYtelROP*2024',
|
||||
'strAutoID' => $roadObserved->fk_RegisteredEventMessage,
|
||||
'strStateID' => ($request->input('rms-status') == 1) ? '2' : '3',
|
||||
'strDescription' => $request->input('rms-description') ?? $roadObserved->rms_description,
|
||||
'strPreviousImageLink' => "https://rms.rmto.ir/".$files,
|
||||
'strNextImageLink' => "https://rms.rmto.ir/".$files,
|
||||
'strRMSDateAndTime' => $roadObserved->updated_at
|
||||
);
|
||||
return $this->soapClient->UpdateInfo_RoadObservedProblems($array);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
72
app/Services/PaymentService.php
Normal file
72
app/Services/PaymentService.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
||||
class PaymentService
|
||||
{
|
||||
public function invoiceBillApi($driver_national_code, $final_amount)
|
||||
{
|
||||
if (App::isProduction())
|
||||
{
|
||||
try {
|
||||
$post = array(
|
||||
'username' => env("PAYMENT_USERNAME"),
|
||||
'password' => env("PAYMENT_PASSWORD"),
|
||||
'amount' => $final_amount,
|
||||
'serial' => "12345",
|
||||
'type' => 1,
|
||||
'instanceid' => 123,
|
||||
'ownerid' => $driver_national_code,
|
||||
'calculationBox' => "{\"rows\":[{\"amount\":" . $final_amount . ",\"code\":\"7070021060000015\"}]}"
|
||||
);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, "http://payment.rmto.ir/acc/rest/payid/gen");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return $response;
|
||||
}
|
||||
catch (\Throwable $th) {
|
||||
abort(500);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function callPaymentStatusBillApi($bill_code)
|
||||
{
|
||||
if (App::isProduction())
|
||||
{
|
||||
try {
|
||||
$post = array(
|
||||
// 'username' => env("PAYMENT_USERNAME"),
|
||||
// 'password' => env("PAYMENT_PASSWORD"),
|
||||
// 'amount' => $final_amount,
|
||||
// 'serial' => "12345",
|
||||
// 'type' => 1,
|
||||
// 'instanceid' => 123,
|
||||
// 'ownerid' => $driver_national_code,
|
||||
// 'calculationBox' => "{\"rows\":[{\"amount\":". $final_amount .",\"code\":\"7070021060000015\"}]}"
|
||||
);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, "http://payment.rmto.ir/acc/rest/payid/track2/" . env("PAYMENT_USERNAME") . "/" . env("PAYMENT_PASSWORD") . "/" . $bill_code);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
// curl_setopt($ch, CURLOPT_POST, true);
|
||||
// curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
return $response;
|
||||
} catch (\Throwable $th) {
|
||||
abort(500);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user