Skip to content

Commit f5ad000

Browse files
authored
Merge pull request #1277 from BearGroup/5.18.3-rc2
Release 5.18.3 * Added compatibility with Magento 2.4.8/PHP 8.4 * Fixed cron job error caused by function visibility * Fixed security logic around APB flow * Added black as a text color option for promo widget
2 parents d5eb964 + 2d73482 commit f5ad000

25 files changed

+159
-34
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## 5.18.3
4+
* Added compatibility with Magento 2.4.8/PHP 8.4
5+
* Fixed cron job error caused by function visibility
6+
* Fixed security logic around APB flow
7+
* Added black as a text color option for promo widget
8+
39
## 5.18.2
410
* Added security enhancements around Express Checkout
511
* Changed when Magento order ID is sent to Amazon to improve traceability

Command/Async/ProcessCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(
3939
\Amazon\Pay\Model\ResourceModel\Async\CollectionFactory $asyncCollectionFactory,
4040
\Amazon\Pay\Model\AsyncUpdater $asyncUpdater,
4141
\Magento\Framework\App\State $state,
42-
string $name = null
42+
?string $name = null
4343
) {
4444
$this->asyncCollectionFactory = $asyncCollectionFactory;
4545
$this->asyncUpdater = $asyncUpdater;

Controller/Adminhtml/Pay/AutoKeyExchangePoll.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function __construct(
6161
AutoKeyExchange $autoKeyExchange,
6262
ScopeConfigInterface $scopeConfig,
6363
JsonFactory $jsonResultFactory,
64-
ExceptionLogger $exceptionLogger = null
64+
?ExceptionLogger $exceptionLogger = null
6565
) {
6666
parent::__construct($context);
6767
$this->autoKeyExchange = $autoKeyExchange;

Controller/AutoKeyExchange/Listener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct(
5353
\Magento\Framework\App\Action\Context $context,
5454
\Magento\Framework\Controller\Result\JsonFactory $jsonResultFactory,
5555
\Amazon\Pay\Model\Config\AutoKeyExchange $autokeyexchange,
56-
ExceptionLogger $exceptionLogger = null
56+
?ExceptionLogger $exceptionLogger = null
5757
) {
5858
$this->autokeyexchange = $autokeyexchange;
5959
$this->jsonResultFactory = $jsonResultFactory;

Controller/Checkout/CompleteSession.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function __construct(
7272
\Magento\Framework\Stdlib\CookieManagerInterface $cookieManager,
7373
\Magento\Framework\Stdlib\Cookie\CookieMetadataFactory $cookieMetadataFactory,
7474
\Magento\Store\Model\StoreManagerInterface $storeManager,
75-
ExceptionLogger $exceptionLogger = null
75+
?ExceptionLogger $exceptionLogger = null
7676
) {
7777
parent::__construct($context);
7878
$this->amazonCheckoutSessionManagement = $checkoutSessionManagement;

Controller/Checkout/PlaceOrder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function __construct(
6464
JsonFactory $jsonFactory,
6565
ManagerInterface $messageManager,
6666
RequestInterface $request,
67-
ExceptionLogger $exceptionLogger = null
67+
?ExceptionLogger $exceptionLogger = null
6868
) {
6969
$this->amazonCheckoutSessionManagement = $checkoutSessionManagement;
7070
$this->exceptionLogger = $exceptionLogger ?: ObjectManager::getInstance()->get(ExceptionLogger::class);

Gateway/Command/CaptureStrategyCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function __construct(
7777
TransactionRepositoryInterface $transactionRepository,
7878
SearchCriteriaBuilder $searchCriteriaBuilder,
7979
FilterBuilder $filterBuilder,
80-
ExceptionLogger $exceptionLogger = null
80+
?ExceptionLogger $exceptionLogger = null
8181
) {
8282
$this->commandPool = $commandPool;
8383
$this->transactionRepository = $transactionRepository;

Model/Async.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public function __construct(
4444
\Magento\Framework\Model\Context $context,
4545
\Magento\Framework\Registry $registry,
4646
\Magento\Framework\Stdlib\DateTime\DateTimeFactory $dateFactory,
47-
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
48-
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
47+
?\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
48+
?\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
4949
array $data = []
5050
) {
5151
parent::__construct(

Model/CheckoutSessionManagement.php

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -815,17 +815,18 @@ public function completeCheckoutSession($amazonSessionId, $cartId = null, $order
815815
*/
816816
public function placeOrder($amazonSessionId, $quoteId = null)
817817
{
818-
819818
// verify the shipping address has not been modified in Magento, it must match
820819
// the one selected in the Amazon checkout session (express checkout only)
821-
if ($amznShippingAddress = $this->getShippingAddress($amazonSessionId)) {
822-
$amazonAddress = $amznShippingAddress[0];
823-
$magentoAddress = $this->session->getQuoteFromIdOrSession($quoteId)->getShippingAddress();
824-
if (!$this->addressHelper->validateShippingIsSame($amazonAddress, $magentoAddress)) {
825-
return $this->handleCompleteCheckoutSessionError(
826-
self::ADDRESS_CHANGED_CHECKOUT_ERROR_MESSAGE,
827-
$this->getAddressMismatchDetails($amazonAddress, $magentoAddress)
828-
);
820+
if ($this->isExpressCheckoutFlow()) {
821+
if ($amznShippingAddress = $this->getShippingAddress($amazonSessionId)) {
822+
$amazonAddress = $amznShippingAddress[0];
823+
$magentoAddress = $this->session->getQuoteFromIdOrSession($quoteId)->getShippingAddress();
824+
if (!$this->addressHelper->validateShippingIsSame($amazonAddress, $magentoAddress)) {
825+
return $this->handleCompleteCheckoutSessionError(
826+
self::ADDRESS_CHANGED_CHECKOUT_ERROR_MESSAGE,
827+
$this->getAddressMismatchDetails($amazonAddress, $magentoAddress)
828+
);
829+
}
829830
}
830831
}
831832

@@ -915,7 +916,7 @@ public function placeOrder($amazonSessionId, $quoteId = null)
915916
* @param mixed $amazonSession
916917
* @return \Magento\Framework\Phrase|mixed
917918
*/
918-
protected function getCanceledMessage($amazonSession)
919+
public function getCanceledMessage($amazonSession)
919920
{
920921
if ($amazonSession['statusDetails']['reasonCode'] == 'BuyerCanceled') {
921922
return $this->getTranslationString('This transaction was cancelled. Please try again.');
@@ -953,6 +954,20 @@ protected function getAddressMismatchDetails($amazonAddress, $magentoAddress)
953954
]);
954955
}
955956

957+
/**
958+
* Determine whether the checkout session was completed via Express Checkout
959+
*
960+
* @return bool
961+
*/
962+
protected function isExpressCheckoutFlow()
963+
{
964+
$stack = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
965+
return !empty(array_filter($stack, function ($entry) {
966+
return isset($entry['class'])
967+
&& $entry['class'] === 'Amazon\\Pay\\Controller\\Checkout\\PlaceOrder\\Interceptor';
968+
}));
969+
}
970+
956971
/**
957972
* Update vault token
958973
*

Model/Config/File/PrivateKeyPem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ public function __construct(
4646
\Magento\Config\Model\Config\Backend\File\RequestData\RequestDataInterface $requestData,
4747
\Magento\Framework\Filesystem $filesystem,
4848
\Magento\Framework\Encryption\EncryptorInterface $encryptor,
49-
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
50-
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
49+
?\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
50+
?\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
5151
array $data = []
5252
) {
5353
parent::__construct(

0 commit comments

Comments
 (0)