2021-05-31 16:37:46 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Gateways\Checkout3ds;
|
|
|
|
|
2021-09-09 13:18:04 +02:00
|
|
|
use App\Libraries\MultiDB;
|
2021-05-31 16:37:46 +02:00
|
|
|
use App\Models\Client;
|
2021-06-01 11:54:15 +02:00
|
|
|
use App\Models\Company;
|
2021-05-31 16:37:46 +02:00
|
|
|
use App\Models\CompanyGateway;
|
|
|
|
use App\Models\PaymentHash;
|
|
|
|
use App\Utils\Traits\MakesHash;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
|
|
|
class Checkout3dsRequest extends FormRequest
|
|
|
|
{
|
|
|
|
use MakesHash;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine if the user is authorized to make this request.
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function authorize()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the validation rules that apply to the request.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
//
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2021-06-01 11:54:15 +02:00
|
|
|
public function getCompany()
|
|
|
|
{
|
2021-09-09 13:18:04 +02:00
|
|
|
MultiDB::findAndSetDbByCompanyKey($this->company_key);
|
2022-06-16 03:51:42 +02:00
|
|
|
|
2021-06-01 11:54:15 +02:00
|
|
|
return Company::where('company_key', $this->company_key)->first();
|
|
|
|
}
|
|
|
|
|
2021-05-31 16:37:46 +02:00
|
|
|
public function getCompanyGateway()
|
|
|
|
{
|
2022-06-16 03:21:10 +02:00
|
|
|
MultiDB::findAndSetDbByCompanyKey($this->company_key);
|
|
|
|
|
2021-06-01 11:54:15 +02:00
|
|
|
return CompanyGateway::find($this->decodePrimaryKey($this->company_gateway_id));
|
2021-05-31 16:37:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getPaymentHash()
|
|
|
|
{
|
2022-06-16 03:21:10 +02:00
|
|
|
MultiDB::findAndSetDbByCompanyKey($this->company_key);
|
|
|
|
|
2021-06-01 11:54:15 +02:00
|
|
|
return PaymentHash::where('hash', $this->hash)->first();
|
2021-05-31 16:37:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getClient()
|
|
|
|
{
|
2022-06-16 03:51:42 +02:00
|
|
|
MultiDB::findAndSetDbByCompanyKey($this->company_key);
|
|
|
|
|
2022-06-16 03:21:10 +02:00
|
|
|
return Client::withTrashed()->find($this->getPaymentHash()->data->client_id);
|
2021-05-31 16:37:46 +02:00
|
|
|
}
|
|
|
|
}
|