Skip to content

Commit

Permalink
fix frictionless response (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
cesargb authored Oct 7, 2024
1 parent 0b8e3ee commit c3ccbb3
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/Payments/InSite/Emv3DsAuthProcessRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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';
}
}

0 comments on commit c3ccbb3

Please sign in to comment.