Skip to content

Commit

Permalink
Merge pull request #107 from Invertus/SL-160/bug/payment-applepay
Browse files Browse the repository at this point in the history
SL-160/bug/payment-applepay
  • Loading branch information
mant02 authored Apr 28, 2023
2 parents c63b2ad + b2d20bd commit 10c1b53
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion controllers/front/failValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion saferpayofficial.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
8 changes: 8 additions & 0 deletions src/Adapter/LegacyContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,12 @@ public function getLink()
{
return $this->getContext()->link;
}

/**
* @return int
*/
public function getDeviceDetect()
{
return (int) $this->getContext()->getDevice();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand All @@ -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;
}
}

0 comments on commit 10c1b53

Please sign in to comment.