Skip to content

Commit

Permalink
Merge pull request #2805 from Adyen/develop-8
Browse files Browse the repository at this point in the history
Release v8.24.0
  • Loading branch information
candemiralp authored Nov 18, 2024
2 parents 059e459 + 9ef9c6e commit c4d4e06
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Gateway/Request/CheckoutDataBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Adyen\Payment\Helper\Data;
use Adyen\Payment\Helper\StateData;
use Adyen\Payment\Helper\OpenInvoice;
use Adyen\Payment\Model\Config\Source\ThreeDSFlow;
use Adyen\Payment\Model\Ui\AdyenBoletoConfigProvider;
use Adyen\Payment\Model\Ui\AdyenPayByLinkConfigProvider;
use Adyen\Payment\Observer\AdyenCcDataAssignObserver;
Expand Down Expand Up @@ -216,7 +217,8 @@ public function build(array $buildSubject): array
unset($requestBody['installments']);
}

$requestBody['additionalData']['allow3DS2'] = true;
$requestBody['additionalData']['allow3DS2'] =
$this->configHelper->getThreeDSFlow($storeId) === ThreeDSFlow::THREEDS_NATIVE;

if (isset($requestBodyPaymentMethod)) {
$requestBody['paymentMethod'] = $requestBodyPaymentMethod;
Expand Down
4 changes: 3 additions & 1 deletion Gateway/Request/RecurringVaultDataBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Adyen\Payment\Helper\Config;
use Adyen\Payment\Helper\StateData;
use Adyen\Payment\Helper\Vault;
use Adyen\Payment\Model\Config\Source\ThreeDSFlow;
use Adyen\Payment\Model\Ui\AdyenCcConfigProvider;
use Adyen\Payment\Model\Ui\AdyenHppConfigProvider;
use Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider;
Expand Down Expand Up @@ -82,7 +83,8 @@ public function build(array $buildSubject)
*/
if ($paymentMethod->getCode() === AdyenCcConfigProvider::CC_VAULT_CODE ||
$paymentMethod->getCode() === AdyenOneclickConfigProvider::CODE) {
$requestBody['additionalData']['allow3DS2'] = true;
$requestBody['additionalData']['allow3DS2'] =
$this->configHelper->getThreeDSFlow($order->getStoreId()) === ThreeDSFlow::THREEDS_NATIVE;
$requestBody['paymentMethod']['holderName'] = $details['cardHolderName'] ?? null;
}

Expand Down
16 changes: 16 additions & 0 deletions Helper/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Config
const XML_CONFIGURATION_MODE = 'configuration_mode';
const XML_ADYEN_POS_CLOUD = 'adyen_pos_cloud';
const XML_WEBHOOK_NOTIFICATION_PROCESSOR = 'webhook_notification_processor';
const XML_THREEDS_FLOW = 'threeds_flow';

/**
* @var ScopeConfigInterface
Expand Down Expand Up @@ -544,6 +545,21 @@ public function getConfigurationMode(int $storeId): string
);
}

/**
* Returns the preferred ThreeDS authentication type for card and card vault payments.
*
* @param int|null $storeId
* @return string
*/
public function getThreeDSFlow(int $storeId = null): string
{
return $this->getConfigData(
self::XML_THREEDS_FLOW,
self::XML_ADYEN_CC,
$storeId
);
}

/**
* Retrieve information from payment configuration
*
Expand Down
31 changes: 31 additions & 0 deletions Model/Config/Source/ThreeDSFlow.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2024 Adyen N.V. (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <[email protected]>
*/

namespace Adyen\Payment\Model\Config\Source;

use Magento\Framework\Data\OptionSourceInterface;

class ThreeDSFlow implements OptionSourceInterface
{
const THREEDS_NATIVE = 'native';
const THREEDS_REDIRECT = 'redirect';

/**
* @return array
*/
public function toOptionArray(): array
{
return [
['value' => self::THREEDS_NATIVE, 'label' => __('Native 3D Secure 2')],
['value' => self::THREEDS_REDIRECT, 'label' => __('Redirect 3D Secure 2')],
];
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "adyen/module-payment",
"description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.",
"type": "magento2-module",
"version": "8.23.4",
"version": "8.24.0",
"license": "MIT",
"repositories": [
{
Expand Down
9 changes: 7 additions & 2 deletions etc/adminhtml/system/adyen_cc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,13 @@
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/adyen_cc/enable_click_to_pay</config_path>
</field>
<field id="threeds_flow" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1">
<label>3D Secure 2 authentication flow</label>
<source_model>Adyen\Payment\Model\Config\Source\ThreeDSFlow</source_model>
<config_path>payment/adyen_cc/threeds_flow</config_path>
</field>
<group id="adyen_cc_advanced_settings" translate="label" showInDefault="1" showInWebsite="1" showInStore="1"
sortOrder="60">
sortOrder="80">
<label>Installments Setup</label>
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
<field id="enable_installments" translate="label" type="select" sortOrder="10" showInDefault="1"
Expand All @@ -74,7 +79,7 @@
<config_path>payment/adyen_cc/installments</config_path>
</field>
</group>
<group id="adyen_cc_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="70">
<group id="adyen_cc_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="90">
<label>Country Specific Settings</label>
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="10" showInDefault="1"
Expand Down
1 change: 1 addition & 0 deletions etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<can_cancel>1</can_cancel>
<can_authorize_vault>1</can_authorize_vault>
<can_capture_vault>1</can_capture_vault>
<threeds_flow>native</threeds_flow>
<group>adyen</group>
</adyen_cc>
<adyen_cc_vault>
Expand Down

0 comments on commit c4d4e06

Please sign in to comment.