Skip to content

Commit 0ca606e

Browse files
authored
Merge branch 'develop-10' into ECP-9719
2 parents 9f1a191 + 63122f9 commit 0ca606e

82 files changed

Lines changed: 2832 additions & 5281 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AdminMessage/VersionMessage.php

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,43 +13,32 @@
1313
namespace Adyen\Payment\AdminMessage;
1414

1515
use Adyen\Payment\Helper\Data;
16+
use Adyen\Payment\Helper\PlatformInfo;
1617
use Magento\AdminNotification\Model\InboxFactory;
1718
use Magento\Backend\Model\Auth\Session;
1819
use Magento\Framework\App\RequestInterface;
1920
use Magento\Framework\Notification\MessageInterface;
2021

2122
class VersionMessage implements MessageInterface
2223
{
23-
/**
24-
* @var Session
25-
*/
26-
protected $_authSession;
27-
28-
/**
29-
* @var Data
30-
*/
31-
protected $_adyenHelper;
32-
33-
/**
34-
* @var InboxFactory
35-
*/
36-
protected $_inboxFactory;
37-
38-
/**
39-
* @var RequestInterface
40-
*/
41-
protected $request;
24+
protected Session $_authSession;
25+
protected Data $_adyenHelper;
26+
protected InboxFactory $_inboxFactory;
27+
protected RequestInterface $request;
28+
protected PlatformInfo $_platformInfo;
4229

4330
public function __construct(
4431
Session $authSession,
4532
Data $adyenHelper,
4633
InboxFactory $inboxFactory,
47-
RequestInterface $request
34+
RequestInterface $request,
35+
PlatformInfo $platformInfo
4836
) {
4937
$this->_authSession = $authSession;
5038
$this->_adyenHelper = $adyenHelper;
5139
$this->_inboxFactory = $inboxFactory;
5240
$this->request = $request;
41+
$this->_platformInfo = $platformInfo;
5342
}
5443

5544
const MESSAGE_IDENTITY = 'Adyen Version Control message';
@@ -96,7 +85,7 @@ public function isDisplayed()
9685
* This will compare the currently installed version with the latest available one.
9786
* A message will appear after the login if the two are not matching.
9887
*/
99-
if ($this->_adyenHelper->getModuleVersion() != $githubContent['tag_name']) {
88+
if ($this->_platformInfo->getModuleVersion() != $githubContent['tag_name']) {
10089
return true;
10190
}
10291
} elseif ($this->request->getModuleName() === 'mui' && $this->isNewVersionAvailable()) {
@@ -127,7 +116,7 @@ public function getText()
127116
"<a href= \"" . $githubContent['html_url'] . "\" target='_blank'> " . $githubContent['tag_name'] . "!</a>"
128117
);
129118
$message .= __(
130-
" You are running the " . $this->_adyenHelper->getModuleVersion(
119+
" You are running the " . $this->_platformInfo->getModuleVersion(
131120
) . " version. We advise to update your extension."
132121
);
133122
return __($message);
@@ -177,7 +166,7 @@ private function isNewVersionAvailable()
177166
$githubContent = $this->getSessionData("AdyenGithubVersion");
178167

179168
if (isset($githubContent)) {
180-
return $this->_adyenHelper->getModuleVersion() !== $githubContent['tag_name'];
169+
return $this->_platformInfo->getModuleVersion() !== $githubContent['tag_name'];
181170
}
182171
}
183172
}

Block/Adminhtml/System/Config/Field/Version.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
namespace Adyen\Payment\Block\Adminhtml\System\Config\Field;
1717

18+
use Adyen\Payment\Helper\PlatformInfo;
19+
use Magento\Backend\Block\Template\Context;
20+
1821
class Version extends \Magento\Config\Block\System\Config\Form\Field
1922
{
2023

@@ -23,20 +26,25 @@ class Version extends \Magento\Config\Block\System\Config\Form\Field
2326
*/
2427
protected $_adyenHelper;
2528

29+
/**
30+
* @var PlatformInfo
31+
*/
32+
protected $_platformInfo;
33+
2634
/**
2735
* Version constructor.
2836
*
29-
* @param \Magento\Framework\Module\ModuleListInterface $moduleList
30-
* @param \Magento\Backend\Block\Template\Context $context
37+
* @param PlatformInfo $platformInfo
38+
* @param Context $context
3139
* @param array $data
3240
*/
3341
public function __construct(
34-
\Adyen\Payment\Helper\Data $adyenHelper,
42+
PlatformInfo $platformInfo,
3543
\Magento\Backend\Block\Template\Context $context,
3644
array $data = []
3745
) {
3846
parent::__construct($context, $data);
39-
$this->_adyenHelper = $adyenHelper;
47+
$this->_platformInfo = $platformInfo;
4048
}
4149

4250
/**
@@ -47,6 +55,6 @@ public function __construct(
4755
*/
4856
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
4957
{
50-
return $this->_adyenHelper->getModuleVersion();
58+
return $this->_platformInfo->getModuleVersion();
5159
}
5260
}

Block/Checkout/Multishipping/Success.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
use Adyen\Payment\Helper\Data;
1616
use Adyen\Payment\Helper\Config;
17+
use Adyen\Payment\Helper\Locale;
1718
use Adyen\Payment\Helper\PaymentMethods;
1819
use Adyen\Payment\Helper\PaymentResponseHandler;
1920
use Adyen\Payment\Model\ResourceModel\PaymentResponse\Collection;
@@ -38,6 +39,7 @@ class Success extends \Magento\Multishipping\Block\Checkout\Success
3839
private SearchCriteriaBuilder $searchCriteriaBuilder;
3940
private Config $configHelper;
4041
private PaymentMethods $paymentMethodsHelper;
42+
private Locale $localeHelper;
4143

4244
/**
4345
* @var
@@ -56,6 +58,7 @@ public function __construct(
5658
OrderRepositoryInterface $orderRepository,
5759
SearchCriteriaBuilder $searchCriteriaBuilder,
5860
Config $configHelper,
61+
Locale $localeHelper,
5962
array $data = []
6063
) {
6164
$this->adyenHelper = $adyenHelper;
@@ -66,6 +69,7 @@ public function __construct(
6669
$this->orderRepository = $orderRepository;
6770
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
6871
$this->configHelper = $configHelper;
72+
$this->localeHelper = $localeHelper;
6973
parent::__construct($context, $multishipping, $data);
7074

7175
$orderIds = $this->getOrderIds();
@@ -97,7 +101,7 @@ public function getPaymentResponseEntities()
97101

98102
public function getLocale()
99103
{
100-
return $this->adyenHelper->getCurrentLocaleCode(
104+
return $this->localeHelper->getCurrentLocaleCode(
101105
$this->storeManager->getStore()->getId()
102106
);
103107
}

Block/Checkout/Success.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Adyen\Payment\Helper\Config;
1515
use Adyen\Payment\Helper\Data;
16+
use Adyen\Payment\Helper\Locale;
1617
use Adyen\Payment\Helper\PaymentResponseHandler;
1718
use Adyen\Payment\Model\Ui\AdyenCheckoutSuccessConfigProvider;
1819
use Magento\Checkout\Model\Session as CheckoutSession;
@@ -40,7 +41,7 @@ class Success extends Template
4041
private AdyenCheckoutSuccessConfigProvider $configProvider;
4142
private QuoteIdToMaskedQuoteId $quoteIdToMaskedQuoteId;
4243
private OrderRepositoryInterface $orderRepository;
43-
/** @deprecated This property has been deprecated and will be removed on V10. */
44+
private Locale $localeHelper;
4445
protected OrderFactory $orderFactory;
4546

4647
public function __construct(
@@ -55,6 +56,7 @@ public function __construct(
5556
StoreManagerInterface $storeManager,
5657
SerializerInterface $serializerInterface,
5758
OrderRepositoryInterface $orderRepository,
59+
Locale $localeHelper,
5860
array $data = []
5961
) {
6062
parent::__construct($context, $data);
@@ -69,6 +71,7 @@ public function __construct(
6971
$this->storeManager = $storeManager;
7072
$this->serializerInterface = $serializerInterface;
7173
$this->orderRepository = $orderRepository;
74+
$this->localeHelper = $localeHelper;
7275
}
7376

7477
/**
@@ -128,7 +131,7 @@ public function getSerializedCheckoutConfig()
128131

129132
public function getLocale()
130133
{
131-
return $this->adyenHelper->getCurrentLocaleCode(
134+
return $this->localeHelper->getCurrentLocaleCode(
132135
$this->storeManager->getStore()->getId()
133136
);
134137
}

Block/Form/Moto.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414
use Adyen\Payment\Helper\Config;
1515
use Adyen\Payment\Helper\Data;
1616
use Adyen\Payment\Helper\Installments;
17+
use Adyen\Payment\Helper\Locale;
1718
use Adyen\Payment\Logger\AdyenLogger;
1819
use Magento\Backend\Model\Session\Quote;
1920
use Magento\Checkout\Model\Session;
21+
use Magento\Framework\Exception\LocalizedException;
22+
use Magento\Framework\Exception\NoSuchEntityException;
2023
use Magento\Framework\View\Element\Template\Context;
2124

2225
class Moto extends \Magento\Payment\Block\Form\Cc
@@ -31,6 +34,11 @@ class Moto extends \Magento\Payment\Block\Form\Cc
3134
*/
3235
protected $adyenHelper;
3336

37+
/**
38+
* @var Locale
39+
*/
40+
protected $localeHelper;
41+
3442
/**
3543
* @var \Magento\Framework\App\State
3644
*/
@@ -65,10 +73,12 @@ class Moto extends \Magento\Payment\Block\Form\Cc
6573
* @param Context $context
6674
* @param \Magento\Payment\Model\Config $paymentConfig
6775
* @param Data $adyenHelper
68-
* @param \Magento\Checkout\Model\Session $checkoutSession
76+
* @param Session $checkoutSession
6977
* @param Installments $installmentsHelper
7078
* @param AdyenLogger $adyenLogger
7179
* @param Config $configHelper
80+
* @param Quote $backendSession
81+
* @param Locale $localeHelper
7282
*/
7383
public function __construct(
7484
Context $context,
@@ -78,7 +88,8 @@ public function __construct(
7888
Installments $installmentsHelper,
7989
AdyenLogger $adyenLogger,
8090
Config $configHelper,
81-
Quote $backendSession
91+
Quote $backendSession,
92+
Locale $localeHelper
8293
) {
8394
parent::__construct($context, $paymentConfig);
8495
$this->adyenHelper = $adyenHelper;
@@ -88,10 +99,13 @@ public function __construct(
8899
$this->adyenLogger = $adyenLogger;
89100
$this->configHelper = $configHelper;
90101
$this->backendSession = $backendSession;
102+
$this->localeHelper = $localeHelper;
91103
}
92104

93105
/**
94106
* @return string
107+
* @throws LocalizedException
108+
* @throws NoSuchEntityException
95109
*/
96110
public function getCheckoutEnvironment()
97111
{
@@ -103,7 +117,7 @@ public function getCheckoutEnvironment()
103117
*/
104118
public function getLocale()
105119
{
106-
return $this->adyenHelper->getStoreLocale($this->checkoutSession->getQuote()->getStore()->getId());
120+
return $this->localeHelper->getStoreLocale($this->checkoutSession->getQuote()->getStore()->getId());
107121
}
108122

109123
/**

Gateway/Data/Order/OrderAdapter.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,4 @@ public function __construct(
3232
$this->order = $order;
3333
parent::__construct($order, $addressAdapterFactory);
3434
}
35-
36-
/**
37-
* @deprecated Use Magento\Sales\Api\Data\OrderInterface::getQuoteId() instead
38-
*
39-
* @return float|int|null
40-
*/
41-
public function getQuoteId()
42-
{
43-
return $this->order->getQuoteId();
44-
}
4535
}

Gateway/Http/Client/TransactionCancel.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Adyen\Model\Checkout\PaymentCancelRequest;
1717
use Adyen\Payment\Helper\Data;
1818
use Adyen\Payment\Helper\Idempotency;
19+
use Adyen\Payment\Helper\PlatformInfo;
1920
use Magento\Framework\Exception\NoSuchEntityException;
2021
use Magento\Payment\Gateway\Http\ClientInterface;
2122
use Magento\Payment\Gateway\Http\TransferInterface;
@@ -32,16 +33,24 @@ class TransactionCancel implements ClientInterface
3233
*/
3334
private Idempotency $idempotencyHelper;
3435

36+
/**
37+
* @var PlatformInfo
38+
*/
39+
private PlatformInfo $platformInfo;
40+
3541
/**
3642
* @param Data $adyenHelper
3743
* @param Idempotency $idempotencyHelper
44+
* @param PlatformInfo $platformInfo
3845
*/
3946
public function __construct(
4047
Data $adyenHelper,
41-
Idempotency $idempotencyHelper
48+
Idempotency $idempotencyHelper,
49+
PlatformInfo $platformInfo
4250
) {
4351
$this->adyenHelper = $adyenHelper;
4452
$this->idempotencyHelper = $idempotencyHelper;
53+
$this->platformInfo = $platformInfo;
4554
}
4655

4756
/**
@@ -68,7 +77,7 @@ public function placeRequest(TransferInterface $transferObject): array
6877
$requestOptions['idempotencyKey'] = $idempotencyKey;
6978
$requestOptions['headers'] = $headers;
7079
$this->adyenHelper->logRequest($request, Client::API_CHECKOUT_VERSION, '/cancels');
71-
$request['applicationInfo'] = $this->adyenHelper->buildApplicationInfo($client);
80+
$request['applicationInfo'] = $this->platformInfo->buildApplicationInfo($client);
7281
$paymentCancelRequest = new PaymentCancelRequest($request);
7382

7483
try {

Gateway/Http/Client/TransactionCapture.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Adyen\Payment\Helper\Requests;
2121
use Adyen\Payment\Logger\AdyenLogger;
2222
use Adyen\Service\Checkout\ModificationsApi;
23+
use Adyen\Payment\Helper\PlatformInfo;
2324
use Magento\Framework\Exception\NoSuchEntityException;
2425
use Magento\Payment\Gateway\Http\ClientInterface;
2526
use Magento\Payment\Gateway\Http\TransferInterface;
@@ -47,19 +48,27 @@ class TransactionCapture implements ClientInterface
4748
*/
4849
private Idempotency $idempotencyHelper;
4950

51+
/**
52+
* @var PlatformInfo
53+
*/
54+
private PlatformInfo $platformInfo;
55+
5056
/**
5157
* @param Data $adyenHelper
5258
* @param AdyenLogger $adyenLogger
5359
* @param Idempotency $idempotencyHelper
60+
* @param PlatformInfo $platformInfo
5461
*/
5562
public function __construct(
5663
Data $adyenHelper,
5764
AdyenLogger $adyenLogger,
58-
Idempotency $idempotencyHelper
65+
Idempotency $idempotencyHelper,
66+
PlatformInfo $platformInfo
5967
) {
6068
$this->adyenHelper = $adyenHelper;
6169
$this->adyenLogger = $adyenLogger;
6270
$this->idempotencyHelper = $idempotencyHelper;
71+
$this->platformInfo = $platformInfo;
6372
}
6473

6574
/**
@@ -78,7 +87,7 @@ public function placeRequest(TransferInterface $transferObject): array
7887
$service = $this->adyenHelper->initializeModificationsApi($client);
7988

8089
$requestOptions['headers'] = $headers;
81-
$request['applicationInfo'] = $this->adyenHelper->buildApplicationInfo($client);
90+
$request['applicationInfo'] = $this->platformInfo->buildApplicationInfo($client);
8291

8392
if (array_key_exists(self::MULTIPLE_AUTHORIZATIONS, $request)) {
8493
return $this->placeMultipleCaptureRequests($service, $request, $requestOptions);

0 commit comments

Comments
 (0)