diff --git a/controllers/admin/AdminSaferPayOfficialPaymentController.php b/controllers/admin/AdminSaferPayOfficialPaymentController.php index 5a85cc65..3dea2ccc 100755 --- a/controllers/admin/AdminSaferPayOfficialPaymentController.php +++ b/controllers/admin/AdminSaferPayOfficialPaymentController.php @@ -64,6 +64,7 @@ public function postProcess() // Refresh payments. /** @var SaferPayRefreshPaymentsService $refreshPaymentsService */ $refreshPaymentsService = $this->module->getService(SaferPayRefreshPaymentsService::class); + try { $refreshPaymentsService->refreshPayments(); } catch (SaferPayApiException $exception) { diff --git a/controllers/admin/AdminSaferPayOfficialSettingsController.php b/controllers/admin/AdminSaferPayOfficialSettingsController.php index fdd33062..3b310c5c 100755 --- a/controllers/admin/AdminSaferPayOfficialSettingsController.php +++ b/controllers/admin/AdminSaferPayOfficialSettingsController.php @@ -400,7 +400,7 @@ private function displayConfigurationSettings() 'title' => $this->module->l('Description', self::FILE_NAME), 'type' => 'text', 'desc' => 'This description is visible in payment page also in payment confirmation email', - 'class' => 'fixed-width-xxl' + 'class' => 'fixed-width-xxl', ], ], 'buttons' => [ diff --git a/controllers/front/ajax.php b/controllers/front/ajax.php index 697fe27e..0cd60cc7 100755 --- a/controllers/front/ajax.php +++ b/controllers/front/ajax.php @@ -145,7 +145,7 @@ public function initializeSavedCardPayment() $this->ajaxDie(json_encode([ 'error' => false, 'url' => $redirectUrl, - 'successUrl' => $this->getRedirectionToControllerUrl('success') + 'successUrl' => $this->getRedirectionToControllerUrl('success'), ])); } catch (Exception $e) { $this->ajaxDie(json_encode([ diff --git a/controllers/front/iframe.php b/controllers/front/iframe.php index cd036253..c02c806c 100755 --- a/controllers/front/iframe.php +++ b/controllers/front/iframe.php @@ -90,14 +90,13 @@ public function initContent() $checkoutController = $this->module->getService(CheckoutController::class); $checkoutData = CheckoutData::create( - (int)$this->context->cart->id, + (int) $this->context->cart->id, $paymentMethod, - (int)Tools::getValue(SaferPayConfig::IS_BUSINESS_LICENCE), + (int) Tools::getValue(SaferPayConfig::IS_BUSINESS_LICENCE), $selectedCard ); $redirectUrl = $checkoutController->execute($checkoutData); - } catch (\Exception $exception) { $redirectUrl = $this->context->link->getModuleLink( $this->module->name, diff --git a/controllers/front/notify.php b/controllers/front/notify.php index 584dc479..b4860443 100755 --- a/controllers/front/notify.php +++ b/controllers/front/notify.php @@ -180,7 +180,8 @@ public function postProcess() die($this->module->l('Success', self::FILENAME)); } - private function assertTransaction($cartId) { + private function assertTransaction($cartId) + { /** @var SaferPayTransactionAssertion $transactionAssert */ $transactionAssert = $this->module->getService(SaferPayTransactionAssertion::class); diff --git a/controllers/front/successHosted.php b/controllers/front/successHosted.php index 9998633d..63794782 100755 --- a/controllers/front/successHosted.php +++ b/controllers/front/successHosted.php @@ -21,12 +21,9 @@ *@license SIX Payment Services */ -use Invertus\SaferPay\Api\Enum\TransactionStatus; use Invertus\SaferPay\Config\SaferPayConfig; use Invertus\SaferPay\Controller\AbstractSaferPayController; use Invertus\SaferPay\Enum\ControllerName; -use Invertus\SaferPay\Service\SaferPayOrderStatusService; -use Invertus\SaferPay\Service\TransactionFlow\SaferPayTransactionAuthorization; if (!defined('_PS_VERSION_')) { exit; diff --git a/controllers/front/successIFrame.php b/controllers/front/successIFrame.php index 611d5d56..699cb404 100755 --- a/controllers/front/successIFrame.php +++ b/controllers/front/successIFrame.php @@ -21,13 +21,8 @@ *@license SIX Payment Services */ -use Invertus\SaferPay\Api\Enum\TransactionStatus; use Invertus\SaferPay\Config\SaferPayConfig; use Invertus\SaferPay\Controller\AbstractSaferPayController; -use Invertus\SaferPay\Enum\ControllerName; -use Invertus\SaferPay\Exception\Api\SaferPayApiException; -use Invertus\SaferPay\Service\SaferPayOrderStatusService; -use Invertus\SaferPay\Service\TransactionFlow\SaferPayTransactionAuthorization; if (!defined('_PS_VERSION_')) { exit; @@ -62,37 +57,6 @@ public function postProcess() $this->redirectWithNotifications($this->getOrderLink()); } - - try { - Tools::redirect($this->getOrderConfirmationLink($cartId, $moduleId, $orderId, $secureKey)); - } catch (Exception $e) { - PrestaShopLogger::addLog( - sprintf( - '%s has caught an error: %s', - __CLASS__, - $e->getMessage() - ), - 1, - null, - null, - null, - true - ); - - Tools::redirect( - $this->context->link->getModuleLink( - $this->module->name, - ControllerName::FAIL_IFRAME, - [ - 'cartId' => $cartId, - 'secureKey' => $secureKey, - 'orderId' => $orderId, - \Invertus\SaferPay\Config\SaferPayConfig::IS_BUSINESS_LICENCE => true, - ], - true - ) - ); - } } public function initContent() diff --git a/saferpayofficial.php b/saferpayofficial.php index 48932744..ba6efce5 100755 --- a/saferpayofficial.php +++ b/saferpayofficial.php @@ -625,7 +625,7 @@ public function hookActionOrderHistoryAddAfter($params = []) } if ((int) \Configuration::get(SaferPayConfig::SAFERPAY_PAYMENT_AUTHORIZED) === (int) $orderStatus->id) { - $mailService->sendOrderConfMail($order, (int) $orderStatus->id); + $mailService->sendOrderConfMail($order, (int) $orderStatus->id); } } } diff --git a/src/Api/Request/AssertService.php b/src/Api/Request/AssertService.php index c430dbce..fc0d2871 100755 --- a/src/Api/Request/AssertService.php +++ b/src/Api/Request/AssertService.php @@ -83,7 +83,7 @@ public function assert(AssertRequest $assertRequest, $saferPayOrderId) // also we call authorize method in some of the success controllers, so if we leave the logic here, // we get an error with TRANSACTION_IN_WRONG_STATE if ($saferPayOrder->is_transaction) { - $assertApi = self::ASSERT_API_TRANSACTION; + $assertApi = self::ASSERT_API_TRANSACTION; } try { diff --git a/src/Controller/Front/index.php b/src/Controller/Front/index.php index 7487f261..6b778722 100644 --- a/src/Controller/Front/index.php +++ b/src/Controller/Front/index.php @@ -21,7 +21,7 @@ *@license SIX Payment Services */ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); -header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); +header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); diff --git a/src/Core/Order/Action/UpdateOrderStatusAction.php b/src/Core/Order/Action/UpdateOrderStatusAction.php index 316bbd66..58f93ba3 100644 --- a/src/Core/Order/Action/UpdateOrderStatusAction.php +++ b/src/Core/Order/Action/UpdateOrderStatusAction.php @@ -60,6 +60,5 @@ public function run($orderId, $orderStatusId) } catch (\Exception $exception) { throw CouldNotChangeOrderStatus::unknownError($exception); } - } } diff --git a/src/Core/Payment/DTO/CheckoutData.php b/src/Core/Payment/DTO/CheckoutData.php index 7281cfe9..b81208c4 100644 --- a/src/Core/Payment/DTO/CheckoutData.php +++ b/src/Core/Payment/DTO/CheckoutData.php @@ -44,15 +44,14 @@ class CheckoutData private $status; public function __construct( - $cartId, - $paymentMethod, - $isBusinessLicense, - $selectedCard = -1, - $fieldToken = null, - $successController = null, - $isTransaction = false - ) - { + $cartId, + $paymentMethod, + $isBusinessLicense, + $selectedCard = -1, + $fieldToken = null, + $successController = null, + $isTransaction = false + ) { $this->cartId = $cartId; $this->paymentMethod = $paymentMethod; $this->isBusinessLicense = $isBusinessLicense; @@ -65,15 +64,14 @@ public function __construct( } public static function create( - $cartId, - $paymentMethod, - $isBusinessLicense, - $selectedCard = -1, - $fieldToken = null, - $successController = null, - $isTransaction = false - ) - { + $cartId, + $paymentMethod, + $isBusinessLicense, + $selectedCard = -1, + $fieldToken = null, + $successController = null, + $isTransaction = false + ) { return new self( $cartId, $paymentMethod, @@ -184,4 +182,4 @@ public function setOrderStatus($status) { $this->status = $status; } -} \ No newline at end of file +} diff --git a/src/Exception/CouldNotProcessCheckout.php b/src/Exception/CouldNotProcessCheckout.php index b8b19281..e495daa4 100644 --- a/src/Exception/CouldNotProcessCheckout.php +++ b/src/Exception/CouldNotProcessCheckout.php @@ -75,4 +75,4 @@ public static function failedToCreateSaferPayOrder($cartId) ] ); } -} \ No newline at end of file +} diff --git a/src/Exception/SaferPayException.php b/src/Exception/SaferPayException.php index 41906751..851bd257 100644 --- a/src/Exception/SaferPayException.php +++ b/src/Exception/SaferPayException.php @@ -35,8 +35,7 @@ final public function __construct( $internalMessage, $code, array $context = [] - ) - { + ) { parent::__construct($internalMessage, $code); $this->context = $context; } @@ -53,4 +52,4 @@ public static function unknownError() ExceptionCode::UNKNOWN_ERROR ); } -} \ No newline at end of file +} diff --git a/src/Processor/CheckoutProcessor.php b/src/Processor/CheckoutProcessor.php index eac6cc4a..771b6691 100644 --- a/src/Processor/CheckoutProcessor.php +++ b/src/Processor/CheckoutProcessor.php @@ -66,8 +66,8 @@ public function __construct( $this->saferPayOrderRepository = $saferPayOrderRepository; } - public function run(CheckoutData $data) { - + public function run(CheckoutData $data) + { $cart = new Cart($data->getCartId()); if (!$cart) { diff --git a/src/Processor/index.php b/src/Processor/index.php index 7487f261..6b778722 100644 --- a/src/Processor/index.php +++ b/src/Processor/index.php @@ -21,7 +21,7 @@ *@license SIX Payment Services */ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); -header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); +header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); diff --git a/src/Service/Request/InitializeRequestObjectCreator.php b/src/Service/Request/InitializeRequestObjectCreator.php index 0ca1e5e4..906cd5aa 100755 --- a/src/Service/Request/InitializeRequestObjectCreator.php +++ b/src/Service/Request/InitializeRequestObjectCreator.php @@ -27,10 +27,8 @@ use Configuration; use Customer; use Invertus\SaferPay\Config\SaferPayConfig; -use Invertus\SaferPay\DTO\Request\RequestHeader; use Invertus\SaferPay\DTO\Request\Initialize\InitializeRequest; use Invertus\SaferPay\DTO\Request\Payer; -use PrestaShop\PrestaShop\Adapter\Shop\Context; if (!defined('_PS_VERSION_')) { exit; diff --git a/src/Service/TransactionFlow/SaferPayTransactionAuthorization.php b/src/Service/TransactionFlow/SaferPayTransactionAuthorization.php index 92c1b2fa..b79bc354 100755 --- a/src/Service/TransactionFlow/SaferPayTransactionAuthorization.php +++ b/src/Service/TransactionFlow/SaferPayTransactionAuthorization.php @@ -30,7 +30,6 @@ use Invertus\SaferPay\Repository\SaferPayOrderRepository; use Invertus\SaferPay\Service\Request\AuthorizationRequestObjectCreator; use Invertus\SaferPay\Service\SaferPayOrderStatusService; -use Order; use SaferPayOrder; if (!defined('_PS_VERSION_')) { diff --git a/upgrade/install-1.1.8.php b/upgrade/install-1.1.8.php index d52c8914..636a4cb3 100644 --- a/upgrade/install-1.1.8.php +++ b/upgrade/install-1.1.8.php @@ -41,4 +41,4 @@ function upgrade_module_1_1_8(SaferPayOfficial $module) $module->registerHook('actionObjectOrderPaymentAddAfter'); return true; -} \ No newline at end of file +} diff --git a/upgrade/install-1.2.2.php b/upgrade/install-1.2.2.php index 64323f4f..7424b1ae 100644 --- a/upgrade/install-1.2.2.php +++ b/upgrade/install-1.2.2.php @@ -36,4 +36,3 @@ function upgrade_module_1_2_2($module) && $module->unregisterHook('actionOrderStatusUpdate') && Configuration::deleteByName('SAFERPAY_SEND_ORDER_CONFIRMATION'); } -