1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-22 17:31:35 +02:00
invoiceninja/app/Http/Requests/Gateways/Checkout3ds/Checkout3dsRequest.php

67 lines
1.4 KiB
PHP
Raw Normal View History

<?php
namespace App\Http\Requests\Gateways\Checkout3ds;
2021-09-09 13:18:04 +02:00
use App\Libraries\MultiDB;
use App\Models\Client;
use App\Models\Company;
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 [
//
];
}
public function getCompany()
{
2021-09-09 13:18:04 +02:00
MultiDB::findAndSetDbByCompanyKey($this->company_key);
return Company::where('company_key', $this->company_key)->first();
}
public function getCompanyGateway()
{
2022-06-16 03:21:10 +02:00
MultiDB::findAndSetDbByCompanyKey($this->company_key);
return CompanyGateway::find($this->decodePrimaryKey($this->company_gateway_id));
}
public function getPaymentHash()
{
2022-06-16 03:21:10 +02:00
MultiDB::findAndSetDbByCompanyKey($this->company_key);
return PaymentHash::where('hash', $this->hash)->first();
}
public function getClient()
{
MultiDB::findAndSetDbByCompanyKey($this->company_key);
2022-06-16 03:21:10 +02:00
return Client::withTrashed()->find($this->getPaymentHash()->data->client_id);
}
}