diff --git a/app/Http/Controllers/Gateways/Checkout3dsController.php b/app/Http/Controllers/Gateways/Checkout3dsController.php index 461db33e0603..af6a4217f3f1 100644 --- a/app/Http/Controllers/Gateways/Checkout3dsController.php +++ b/app/Http/Controllers/Gateways/Checkout3dsController.php @@ -13,12 +13,14 @@ namespace App\Http\Controllers\Gateways; use App\Http\Controllers\Controller; -use Illuminate\Http\Request; +use App\Http\Requests\Gateways\Checkout3ds\Checkout3dsRequest; 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); } } diff --git a/app/Http/Requests/Gateways/Checkout3ds/Checkout3dsRequest.php b/app/Http/Requests/Gateways/Checkout3ds/Checkout3dsRequest.php new file mode 100644 index 000000000000..3b218f50548c --- /dev/null +++ b/app/Http/Requests/Gateways/Checkout3ds/Checkout3dsRequest.php @@ -0,0 +1,51 @@ +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); + } +} diff --git a/app/Http/Requests/Payments/PaymentWebhookRequest.php b/app/Http/Requests/Payments/PaymentWebhookRequest.php index 2642f2458e93..2fc33f6494f9 100644 --- a/app/Http/Requests/Payments/PaymentWebhookRequest.php +++ b/app/Http/Requests/Payments/PaymentWebhookRequest.php @@ -100,14 +100,15 @@ class PaymentWebhookRequest extends Request /** * Resolve client from payment hash. * - * @return null|\App\Models\Client + * @return null|\App\Models\Client|bool */ public function getClient() { $hash = $this->getPaymentHash(); - if($hash) + if($hash) { return Client::find($hash->data->client_id)->firstOrFail(); + } return false; } diff --git a/app/PaymentDrivers/CheckoutComPaymentDriver.php b/app/PaymentDrivers/CheckoutComPaymentDriver.php index 1e9b041fab22..df8609096582 100644 --- a/app/PaymentDrivers/CheckoutComPaymentDriver.php +++ b/app/PaymentDrivers/CheckoutComPaymentDriver.php @@ -13,6 +13,7 @@ namespace App\PaymentDrivers; use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest; +use App\Http\Requests\Gateways\Checkout3ds\Checkout3dsRequest; use App\Http\Requests\Payments\PaymentWebhookRequest; use App\Jobs\Mail\PaymentFailureMailer; use App\Jobs\Util\SystemLogger; @@ -287,6 +288,11 @@ class CheckoutComPaymentDriver extends BaseDriver } public function processWebhookRequest(PaymentWebhookRequest $request, Payment $payment = null) + { + return true; + } + + public function process3dsConfirmation(Checkout3dsRequest $request) { $this->init(); $this->setPaymentHash($request->getPaymentHash());