mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 11:14:37 -04:00
Return JSON response if some of required records wasn't found
This commit is contained in:
parent
588aeefb35
commit
9119f57a35
@ -19,6 +19,22 @@ class Checkout3dsController extends Controller
|
|||||||
{
|
{
|
||||||
public function index(Checkout3dsRequest $request, string $company_key, string $company_gateway_id, string $hash)
|
public function index(Checkout3dsRequest $request, string $company_key, string $company_gateway_id, string $hash)
|
||||||
{
|
{
|
||||||
|
if (!$request->getCompany()) {
|
||||||
|
return response()->json(['message' => 'Company record not found.', 'company_key' => $company_key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$request->getCompanyGateway()) {
|
||||||
|
return response()->json(['message' => 'Company gateway record not found.', 'company_gateway_id' => $company_gateway_id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$request->getPaymentHash()) {
|
||||||
|
return response()->json(['message' => 'Hash record not found.', 'hash' => $hash]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$request->getClient()) {
|
||||||
|
return response()->json(['message' => 'Client record not found.']);
|
||||||
|
}
|
||||||
|
|
||||||
return $request->getCompanyGateway()
|
return $request->getCompanyGateway()
|
||||||
->driver($request->getClient())
|
->driver($request->getClient())
|
||||||
->process3dsConfirmation($request);
|
->process3dsConfirmation($request);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Requests\Gateways\Checkout3ds;
|
namespace App\Http\Requests\Gateways\Checkout3ds;
|
||||||
|
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
|
use App\Models\Company;
|
||||||
use App\Models\CompanyGateway;
|
use App\Models\CompanyGateway;
|
||||||
use App\Models\PaymentHash;
|
use App\Models\PaymentHash;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
@ -34,18 +35,23 @@ class Checkout3dsRequest extends FormRequest
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCompany()
|
||||||
|
{
|
||||||
|
return Company::where('company_key', $this->company_key)->first();
|
||||||
|
}
|
||||||
|
|
||||||
public function getCompanyGateway()
|
public function getCompanyGateway()
|
||||||
{
|
{
|
||||||
return CompanyGateway::findOrFail($this->decodePrimaryKey($this->company_gateway_id));
|
return CompanyGateway::find($this->decodePrimaryKey($this->company_gateway_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPaymentHash()
|
public function getPaymentHash()
|
||||||
{
|
{
|
||||||
return PaymentHash::where('hash', $this->hash)->firstOrFail();
|
return PaymentHash::where('hash', $this->hash)->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getClient()
|
public function getClient()
|
||||||
{
|
{
|
||||||
return Client::findOrFail($this->getPaymentHash()->data->client_id);
|
return Client::find($this->getPaymentHash()->data->client_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user