diff --git a/changelog.md b/changelog.md index fac27bb5d..c8e8e06d6 100755 --- a/changelog.md +++ b/changelog.md @@ -113,3 +113,7 @@ - BO : Module compatible with PS 1.6.* - 8.0.* - FO : Module compatible with PS 1.6.* - 8.0.* + +## [1.1.1] - * + +- FO : Fixed ApplePay payment method was not displayed on Macintosh PC's. diff --git a/controllers/front/failValidation.php b/controllers/front/failValidation.php index ca805f17a..581402138 100755 --- a/controllers/front/failValidation.php +++ b/controllers/front/failValidation.php @@ -51,8 +51,8 @@ public function postProcess() $order = new Order($orderId); $order->setCurrentState(_SAFERPAY_PAYMENT_AUTHORIZATION_FAILED_); /** @var SaferPayOrderRepository $orderRepo */ + $orderRepo = $this->module->getService(SaferPayOrderRepository::class); /** @var CartDuplicationService $cartDuplicationService */ - $orderRepo = $this->module->getService('saferpay.order.repository'); $cartDuplicationService = $this->module->getService(CartDuplicationService::class); $saferPayOrderId = $orderRepo->getIdByOrderId($orderId); diff --git a/saferpayofficial.php b/saferpayofficial.php index 3b7594ffc..bcd7018d2 100755 --- a/saferpayofficial.php +++ b/saferpayofficial.php @@ -36,7 +36,7 @@ public function __construct($name = null) { $this->name = 'saferpayofficial'; $this->author = 'Invertus'; - $this->version = '1.1.0'; + $this->version = '1.1.1'; $this->module_key = '3d3506c3e184a1fe63b936b82bda1bdf'; $this->displayName = 'SaferpayOfficial'; $this->description = 'Saferpay Payment module'; diff --git a/src/Adapter/LegacyContext.php b/src/Adapter/LegacyContext.php index 9766ca587..c32a1bf9b 100755 --- a/src/Adapter/LegacyContext.php +++ b/src/Adapter/LegacyContext.php @@ -61,4 +61,12 @@ public function getLink() { return $this->getContext()->link; } + + /** + * @return int + */ + public function getDeviceDetect() + { + return (int) $this->getContext()->getDevice(); + } } diff --git a/src/Service/PaymentRestrictionValidation/ApplePayPaymentRestrictionValidation.php b/src/Service/PaymentRestrictionValidation/ApplePayPaymentRestrictionValidation.php index 9b13e7dd9..65dfb141f 100755 --- a/src/Service/PaymentRestrictionValidation/ApplePayPaymentRestrictionValidation.php +++ b/src/Service/PaymentRestrictionValidation/ApplePayPaymentRestrictionValidation.php @@ -43,11 +43,7 @@ public function __construct(LegacyContext $context) */ public function isValid($paymentName) { - if (!$this->isIosDevice()) { - return false; - } - - return true; + return $this->isIosDevice() || $this->isMacDesktop(); } /** @@ -71,4 +67,15 @@ private function isIosDevice() return (bool) $this->context->getMobileDetect()->is('ios'); } + + private function isMacDesktop() + { + if (SaferPayConfig::isTestMode()) { + return true; + } + + $device = $this->context->getDeviceDetect(); + + return $device === \Context::DEVICE_COMPUTER && preg_match('/macintosh|mac os x|mac_powerpc/i', $_SERVER['HTTP_USER_AGENT']) !== false; + } }