diff --git a/src/Payments/InSite/Emv3DsAuthProcessRequest.php b/src/Payments/InSite/Emv3DsAuthProcessRequest.php index cdc263f..b57110e 100644 --- a/src/Payments/InSite/Emv3DsAuthProcessRequest.php +++ b/src/Payments/InSite/Emv3DsAuthProcessRequest.php @@ -6,7 +6,6 @@ use Descom\Redsys\Events\Events; use Descom\Redsys\Events\FailedPayment; use Descom\Redsys\Events\PaidCompletedSuccessfully; -use Descom\Redsys\Exceptions\ParamsNotFound; use Descom\Redsys\Merchants\Merchant; use Descom\Redsys\Payments\Request; use Descom\Redsys\Payments\Response as PaymentResponse; @@ -53,14 +52,10 @@ public function process(string $cardToken, string $urlNotification, array $scree $response = $this->getResponseWithoutValidate($this->merchant, $jsonResponse); - try { - if ($response->emv3ds['threeDSInfo'] === 'ChallengeRequest') { - return $response; - } - } catch (ParamsNotFound $exception) { + if ($this->challengerRequired($response)) { + return $response; } - $response = $this->getValidResponse($this->merchant, $jsonResponse); if ($response->successful()) { @@ -106,4 +101,11 @@ private function getHeader(string $name, $default): ?string return $this->request->header($name, $default); } + + private function challengerRequired(Response $response): bool + { + $threeDSInfo = $response->emv3ds['threeDSInfo'] ?? null; + + return $threeDSInfo === 'ChallengeRequest'; + } }