-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge magento/2.3-develop into magento-techdivision/varnish6_update
- Loading branch information
Showing
57 changed files
with
1,201 additions
and
386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
app/code/Magento/AuthorizenetCardinal/Gateway/Validator/CavvResponseValidator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Magento\AuthorizenetCardinal\Gateway\Validator; | ||
|
||
use Magento\AuthorizenetAcceptjs\Gateway\SubjectReader; | ||
use Magento\AuthorizenetCardinal\Model\Config; | ||
use Magento\Payment\Gateway\Validator\AbstractValidator; | ||
use Magento\Payment\Gateway\Validator\ResultInterface; | ||
use Magento\Payment\Gateway\Validator\ResultInterfaceFactory; | ||
|
||
/** | ||
* Validates cardholder authentication verification response code. | ||
*/ | ||
class CavvResponseValidator extends AbstractValidator | ||
{ | ||
/** | ||
* The result code that authorize.net returns if CAVV passed validation. | ||
*/ | ||
private const RESULT_CODE_SUCCESS = '2'; | ||
|
||
/** | ||
* @var SubjectReader | ||
*/ | ||
private $subjectReader; | ||
|
||
/** | ||
* @var ResultInterfaceFactory | ||
*/ | ||
private $resultFactory; | ||
|
||
/** | ||
* @var Config | ||
*/ | ||
private $config; | ||
|
||
/** | ||
* @param ResultInterfaceFactory $resultFactory | ||
* @param SubjectReader $subjectReader | ||
* @param Config $config | ||
*/ | ||
public function __construct( | ||
ResultInterfaceFactory $resultFactory, | ||
SubjectReader $subjectReader, | ||
Config $config | ||
) { | ||
parent::__construct($resultFactory); | ||
|
||
$this->resultFactory = $resultFactory; | ||
$this->subjectReader = $subjectReader; | ||
$this->config = $config; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function validate(array $validationSubject): ResultInterface | ||
{ | ||
if ($this->config->isActive() === false) { | ||
return $this->createResult(true); | ||
} | ||
|
||
$response = $this->subjectReader->readResponse($validationSubject); | ||
$transactionResponse = $response['transactionResponse']; | ||
|
||
$cavvResultCode = $transactionResponse['cavvResultCode'] ?? ''; | ||
$isValid = $cavvResultCode === self::RESULT_CODE_SUCCESS; | ||
$errorCodes = []; | ||
$errorMessages = []; | ||
|
||
if (!$isValid) { | ||
$errorCodes[] = $transactionResponse['cavvResultCode']; | ||
$errorMessages[] = 'CAVV failed validation'; | ||
} | ||
|
||
return $this->createResult($isValid, $errorMessages, $errorCodes); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
app/code/Magento/CardinalCommerce/Model/Response/JwtParserInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\CardinalCommerce\Model\Response; | ||
|
||
/** | ||
* Parses content of CardinalCommerce response JWT. | ||
*/ | ||
interface JwtParserInterface | ||
{ | ||
/** | ||
* Returns response JWT content. | ||
* | ||
* @param string $jwt | ||
* @return array | ||
*/ | ||
public function execute(string $jwt): array; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,9 +13,8 @@ | |
<resource>Magento_Sales::three_d_secure</resource> | ||
<group id="cardinal" type="text" sortOrder="13" showInDefault="1" showInWebsite="1" showInStore="0"> | ||
<group id="config" translate="label comment" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="0"> | ||
<label>Configuration</label> | ||
<comment><![CDATA[For support contact <a href="mailto:[email protected]">[email protected]</a>.]]> | ||
</comment> | ||
<label>CardinalCommerce</label> | ||
<comment><![CDATA[Please visit <a href="https://www.cardinalcommerce.com/" target="_blank">www.cardinalcommerce.com</a> to get the CardinalCommerce credentials and find out more details about PSD2 SCA requirements. For support contact <a href="mailto:[email protected]">[email protected]</a>.]]></comment> | ||
<field id="environment" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0"> | ||
<label>Environment</label> | ||
<source_model>Magento\CardinalCommerce\Model\Adminhtml\Source\Environment</source_model> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.