mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 22:04:35 -04:00
Moving logic for confirming the 3ds process into own method
This commit is contained in:
parent
8ca1b904d7
commit
588aeefb35
@ -13,12 +13,14 @@
|
|||||||
namespace App\Http\Controllers\Gateways;
|
namespace App\Http\Controllers\Gateways;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use App\Http\Requests\Gateways\Checkout3ds\Checkout3dsRequest;
|
||||||
|
|
||||||
class Checkout3dsController extends Controller
|
class Checkout3dsController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request)
|
public function index(Checkout3dsRequest $request, string $company_key, string $company_gateway_id, string $hash)
|
||||||
{
|
{
|
||||||
return $request->all();
|
return $request->getCompanyGateway()
|
||||||
|
->driver($request->getClient())
|
||||||
|
->process3dsConfirmation($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Gateways\Checkout3ds;
|
||||||
|
|
||||||
|
use App\Models\Client;
|
||||||
|
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 getCompanyGateway()
|
||||||
|
{
|
||||||
|
return CompanyGateway::findOrFail($this->decodePrimaryKey($this->company_gateway_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPaymentHash()
|
||||||
|
{
|
||||||
|
return PaymentHash::where('hash', $this->hash)->firstOrFail();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClient()
|
||||||
|
{
|
||||||
|
return Client::findOrFail($this->getPaymentHash()->data->client_id);
|
||||||
|
}
|
||||||
|
}
|
@ -100,14 +100,15 @@ class PaymentWebhookRequest extends Request
|
|||||||
/**
|
/**
|
||||||
* Resolve client from payment hash.
|
* Resolve client from payment hash.
|
||||||
*
|
*
|
||||||
* @return null|\App\Models\Client
|
* @return null|\App\Models\Client|bool
|
||||||
*/
|
*/
|
||||||
public function getClient()
|
public function getClient()
|
||||||
{
|
{
|
||||||
$hash = $this->getPaymentHash();
|
$hash = $this->getPaymentHash();
|
||||||
|
|
||||||
if($hash)
|
if($hash) {
|
||||||
return Client::find($hash->data->client_id)->firstOrFail();
|
return Client::find($hash->data->client_id)->firstOrFail();
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
namespace App\PaymentDrivers;
|
namespace App\PaymentDrivers;
|
||||||
|
|
||||||
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
|
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
|
||||||
|
use App\Http\Requests\Gateways\Checkout3ds\Checkout3dsRequest;
|
||||||
use App\Http\Requests\Payments\PaymentWebhookRequest;
|
use App\Http\Requests\Payments\PaymentWebhookRequest;
|
||||||
use App\Jobs\Mail\PaymentFailureMailer;
|
use App\Jobs\Mail\PaymentFailureMailer;
|
||||||
use App\Jobs\Util\SystemLogger;
|
use App\Jobs\Util\SystemLogger;
|
||||||
@ -287,6 +288,11 @@ class CheckoutComPaymentDriver extends BaseDriver
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function processWebhookRequest(PaymentWebhookRequest $request, Payment $payment = null)
|
public function processWebhookRequest(PaymentWebhookRequest $request, Payment $payment = null)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function process3dsConfirmation(Checkout3dsRequest $request)
|
||||||
{
|
{
|
||||||
$this->init();
|
$this->init();
|
||||||
$this->setPaymentHash($request->getPaymentHash());
|
$this->setPaymentHash($request->getPaymentHash());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user