From 8ddbccd8e29e2bb4e3b39ce7f3ed2feb221a02aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20=C5=A0mulk=C5=A1tys?= Date: Thu, 23 Nov 2023 10:06:03 +0200 Subject: [PATCH] cs fixes applied --- .../AdminSaferPayOfficialPaymentController.php | 2 +- controllers/front/hostedIframe.php | 2 +- controllers/front/pendingNotify.php | 2 +- controllers/front/return.php | 1 - controllers/front/successIFrame.php | 1 - saferpayofficial.php | 10 +++++----- src/Api/ApiRequest.php | 5 ++--- src/Api/Enum/TransactionStatus.php | 2 +- src/Api/Request/AssertRefundService.php | 6 ------ src/Api/Request/CancelService.php | 2 +- src/Api/Request/RefundService.php | 2 +- src/Config/SaferPayConfig.php | 2 +- .../Verification/CanSendOrderConfirmationEmail.php | 2 +- .../Request/AssertRefund/AssertRefundRequest.php | 4 ++-- src/DTO/Request/Capture/CaptureRequest.php | 2 +- src/DTO/Request/Initialize/InitializeRequest.php | 14 +++++++------- .../ObtainPaymentMethodsRequest.php | 1 - src/DTO/Request/Refund/RefundRequest.php | 5 ++--- src/DTO/Response/AssertRefund/AssertRefundBody.php | 7 ------- src/Enum/ControllerName.php | 2 +- src/Enum/PaymentType.php | 2 +- src/Factory/ModuleFactory.php | 2 +- src/Install/Installer.php | 3 --- src/Install/Uninstaller.php | 3 +-- src/Presentation/Loader/PaymentFormAssetLoader.php | 4 ++-- src/Provider/PaymentRedirectionProvider.php | 4 ---- src/Provider/PaymentRestrictionProvider.php | 8 +++----- src/Provider/PaymentTypeProvider.php | 2 +- src/Repository/SaferPayFieldRepository.php | 2 +- src/Repository/SaferPayPaymentRepository.php | 2 +- .../BasePaymentRestrictionValidation.php | 1 - .../Request/AssertRefundRequestObjectCreator.php | 2 -- src/Service/Request/AssertRequestObjectCreator.php | 1 - .../Request/CaptureRequestObjectCreator.php | 1 - .../Request/InitializeRequestObjectCreator.php | 2 +- .../Request/ObtainPaymentMethodsObjectCreator.php | 1 - src/Service/SaferPayInitialize.php | 2 +- src/Service/SaferPayMailService.php | 14 +++++++++++--- src/Service/SaferPayObtainPaymentMethods.php | 4 ++-- src/Service/SaferPayOrderStatusService.php | 8 ++++---- src/Service/SaferPayPaymentNotation.php | 2 +- src/Service/SaferPayRefreshPaymentsService.php | 9 ++++----- src/ServiceProvider/BaseServiceProvider.php | 2 +- .../LeagueServiceContainerProvider.php | 2 +- .../ServiceContainerProviderInterface.php | 2 +- tests/Unit/Service/SaferPayPaymentNotationTest.php | 2 -- 46 files changed, 66 insertions(+), 95 deletions(-) diff --git a/controllers/admin/AdminSaferPayOfficialPaymentController.php b/controllers/admin/AdminSaferPayOfficialPaymentController.php index aa24a9c6..5a85cc65 100755 --- a/controllers/admin/AdminSaferPayOfficialPaymentController.php +++ b/controllers/admin/AdminSaferPayOfficialPaymentController.php @@ -272,7 +272,7 @@ protected function initForm() foreach ($paymentMethods as $paymentMethod) { $fields[] = [ 'type' => 'free', - 'label' => $saferPayPaymentNotation->getForDisplay($paymentMethod) , + 'label' => $saferPayPaymentNotation->getForDisplay($paymentMethod), 'name' => $paymentMethod, 'form_group_class' => 'saferpay-group', ]; diff --git a/controllers/front/hostedIframe.php b/controllers/front/hostedIframe.php index 7fb3ceb9..b0330637 100755 --- a/controllers/front/hostedIframe.php +++ b/controllers/front/hostedIframe.php @@ -46,7 +46,7 @@ public function initContent() 'credit_card_front_url' => "{$this->module->getPathUri()}views/img/example-card/credit-card-front.png", 'credit_card_back_url' => "{$this->module->getPathUri()}views/img/example-card/credit-card-back.png", 'tos_cms' => SaferPayConfig::isVersionAbove177() ? $this->getDefaultTermsAndConditions() : null, - 'saferpay_selected_card' => $selectedCard + 'saferpay_selected_card' => $selectedCard, ]); if (SaferPayConfig::isVersion17()) { diff --git a/controllers/front/pendingNotify.php b/controllers/front/pendingNotify.php index a9eb8cd3..208aa062 100755 --- a/controllers/front/pendingNotify.php +++ b/controllers/front/pendingNotify.php @@ -99,7 +99,7 @@ private function handleCapturedRefund($orderRefundId) $order = new Order($orderRefund->id_order); - if ((int)$orderAssert->refunded_amount === (int)$orderAssert->amount) { + if ((int) $orderAssert->refunded_amount === (int) $orderAssert->amount) { $saferPayOrder = new SaferPayOrder($orderRefund->id_saferpay_order); $saferPayOrder->refunded = 1; $saferPayOrder->save(); diff --git a/controllers/front/return.php b/controllers/front/return.php index 8696bae7..80e18760 100755 --- a/controllers/front/return.php +++ b/controllers/front/return.php @@ -79,7 +79,6 @@ public function postProcess() ], true )); - } catch (Exception $e) { PrestaShopLogger::addLog( sprintf( diff --git a/controllers/front/successIFrame.php b/controllers/front/successIFrame.php index 5b2c3c9e..8ede330d 100755 --- a/controllers/front/successIFrame.php +++ b/controllers/front/successIFrame.php @@ -22,7 +22,6 @@ */ use Invertus\SaferPay\Api\Enum\TransactionStatus; -use Invertus\SaferPay\Api\Request\AuthorizationService; use Invertus\SaferPay\Config\SaferPayConfig; use Invertus\SaferPay\Controller\AbstractSaferPayController; use Invertus\SaferPay\Enum\ControllerName; diff --git a/saferpayofficial.php b/saferpayofficial.php index 65fedf0a..a3d5fb1e 100755 --- a/saferpayofficial.php +++ b/saferpayofficial.php @@ -231,7 +231,7 @@ public function hookPaymentOptions($params) $inputs['type'] = [ 'name' => 'saferpayPaymentType', 'type' => 'hidden', - 'value' => $paymentTypeProvider->get($paymentMethod['paymentMethod']) + 'value' => $paymentTypeProvider->get($paymentMethod['paymentMethod']), ]; $newOption->setModuleName($this->name) @@ -458,7 +458,7 @@ public function hookDisplayPayment($params) 'redirect' => $paymentRedirectionProvider->provideRedirectionLinkByPaymentMethod($paymentMethod['paymentMethod']), 'imgUrl' => $imageUrl, 'method' => $paymentMethod['paymentMethod'], - 'saferpayPaymentType' => $paymentTypeProvider->get($paymentMethod['paymentMethod']) + 'saferpayPaymentType' => $paymentTypeProvider->get($paymentMethod['paymentMethod']), ] ); @@ -571,7 +571,7 @@ public function hookActionOrderStatusUpdate($params = []) $canSendOrderConfirmationEmail = $this->getService(\Invertus\SaferPay\Core\Order\Verification\CanSendOrderConfirmationEmail::class); if ($canSendOrderConfirmationEmail->verify($order, (int) $orderStatus->id)) { - $mailService->sendOrderConfMail($order, (int)$orderStatus->id); + $mailService->sendOrderConfMail($order, (int) $orderStatus->id); } } @@ -652,8 +652,8 @@ private function displayInAdminOrderPage(array $params) ); } else { $action = $this->context->link->getAdminLink( - self::ADMIN_ORDER_CONTROLLER - ) . '&id_order=' . (int) $orderId; + self::ADMIN_ORDER_CONTROLLER + ) . '&id_order=' . (int) $orderId; } diff --git a/src/Api/ApiRequest.php b/src/Api/ApiRequest.php index f6c964d5..14e4fed5 100755 --- a/src/Api/ApiRequest.php +++ b/src/Api/ApiRequest.php @@ -106,7 +106,7 @@ private function getHeaders() 'Content-Type' => 'application/json', 'Saferpay-ApiVersion' => SaferPayConfig::API_VERSION, 'Saferpay-RequestId' => 'false', - 'Authorization' => "Basic $credentials" + 'Authorization' => "Basic $credentials", ]; } @@ -117,9 +117,8 @@ private function getBaseUrl() private function isValidResponse(Response $response) { - if ($response->code >= 300){ + if ($response->code >= 300) { throw new SaferPayApiException(sprintf('Initialize API failed: %s', $response->raw_body), SaferPayApiException::INITIALIZE); } } } - diff --git a/src/Api/Enum/TransactionStatus.php b/src/Api/Enum/TransactionStatus.php index be7edec3..58e1030e 100644 --- a/src/Api/Enum/TransactionStatus.php +++ b/src/Api/Enum/TransactionStatus.php @@ -33,4 +33,4 @@ class TransactionStatus const CANCELED = 'CANCELED'; const CAPTURED = 'CAPTURED'; const PENDING = 'PENDING'; -} \ No newline at end of file +} diff --git a/src/Api/Request/AssertRefundService.php b/src/Api/Request/AssertRefundService.php index c16c9482..f626f1ab 100755 --- a/src/Api/Request/AssertRefundService.php +++ b/src/Api/Request/AssertRefundService.php @@ -25,16 +25,10 @@ use Exception; use Invertus\SaferPay\Api\ApiRequest; -use Invertus\SaferPay\DTO\Request\Assert\AssertRequest; use Invertus\SaferPay\DTO\Request\AssertRefund\AssertRefundRequest; -use Invertus\SaferPay\DTO\Response\Assert\AssertBody; -use Invertus\SaferPay\DTO\Response\AssertRefund\AssertRefundBody; -use Invertus\SaferPay\EntityBuilder\SaferPayAssertBuilder; use Invertus\SaferPay\EntityBuilder\SaferPayAssertRefundBuilder; use Invertus\SaferPay\Exception\Api\SaferPayApiException; use Invertus\SaferPay\Service\Response\AssertRefundResponseObjectCreator; -use Invertus\SaferPay\Service\Response\AssertResponseObjectCreator; -use SaferPayOrder; if (!defined('_PS_VERSION_')) { exit; diff --git a/src/Api/Request/CancelService.php b/src/Api/Request/CancelService.php index cf7d2105..f6f791ba 100755 --- a/src/Api/Request/CancelService.php +++ b/src/Api/Request/CancelService.php @@ -52,7 +52,7 @@ public function cancel(CancelRequest $cancelRequest) { return $this->apiRequest->post( self::CANCEL_API, - $cancelRequest->getAsArray() + $cancelRequest->getAsArray() ); } } diff --git a/src/Api/Request/RefundService.php b/src/Api/Request/RefundService.php index b5b2236d..3cfb1796 100755 --- a/src/Api/Request/RefundService.php +++ b/src/Api/Request/RefundService.php @@ -52,7 +52,7 @@ public function refund(RefundRequest $refundRequest) { return $this->apiRequest->post( self::REFUND_API, - $refundRequest->getAsArray() + $refundRequest->getAsArray() ); } } diff --git a/src/Config/SaferPayConfig.php b/src/Config/SaferPayConfig.php index 59b04470..3aef29da 100755 --- a/src/Config/SaferPayConfig.php +++ b/src/Config/SaferPayConfig.php @@ -138,7 +138,7 @@ class SaferPayConfig 'Postcard' => self::PAYMENT_POSTCARD, 'BonusCard' => self::PAYMENT_BONUS, 'Lastschrift' => self::PAYMENT_LASTSCHRIFT, - 'SOFORTUEBERWEISUNG' => self::PAYMENT_SOFORT + 'SOFORTUEBERWEISUNG' => self::PAYMENT_SOFORT, ]; const FIELD_SUPPORTED_PAYMENT_METHODS = [ diff --git a/src/Core/Order/Verification/CanSendOrderConfirmationEmail.php b/src/Core/Order/Verification/CanSendOrderConfirmationEmail.php index a3b0598f..a83daeb7 100644 --- a/src/Core/Order/Verification/CanSendOrderConfirmationEmail.php +++ b/src/Core/Order/Verification/CanSendOrderConfirmationEmail.php @@ -60,4 +60,4 @@ private function isOrderStatusValid($orderStatusId) return false; } -} \ No newline at end of file +} diff --git a/src/DTO/Request/AssertRefund/AssertRefundRequest.php b/src/DTO/Request/AssertRefund/AssertRefundRequest.php index 512b03d5..80a2b8e9 100755 --- a/src/DTO/Request/AssertRefund/AssertRefundRequest.php +++ b/src/DTO/Request/AssertRefund/AssertRefundRequest.php @@ -61,8 +61,8 @@ public function getAsArray() 'ClientInfo' => $this->requestHeader->getClientInfo(), ], 'TransactionReference' => [ - 'TransactionId' => $this->transactionId - ] + 'TransactionId' => $this->transactionId, + ], ]; return $return; diff --git a/src/DTO/Request/Capture/CaptureRequest.php b/src/DTO/Request/Capture/CaptureRequest.php index 074297d2..6d3c6da8 100755 --- a/src/DTO/Request/Capture/CaptureRequest.php +++ b/src/DTO/Request/Capture/CaptureRequest.php @@ -73,7 +73,7 @@ public function getAsArray() ], 'TransactionReference' => [ 'TransactionId' => $this->transactionId, - ] + ], ]; return $return; diff --git a/src/DTO/Request/Initialize/InitializeRequest.php b/src/DTO/Request/Initialize/InitializeRequest.php index 860a3c77..9b10f015 100755 --- a/src/DTO/Request/Initialize/InitializeRequest.php +++ b/src/DTO/Request/Initialize/InitializeRequest.php @@ -123,21 +123,21 @@ class InitializeRequest public function __construct( RequestHeader $requestHeader, - $terminalId, - $paymentMethod, + $terminalId, + $paymentMethod, Payment $payment, Payer $payer, ReturnUrl $returnUrl, - $notification, + $notification, DeliveryAddressForm $deliveryAddressForm, - $configSet, - $cssUrl, + $configSet, + $cssUrl, Address $deliveryAddress, Address $billingAddress, - $alias, + $alias, Order $order, PayerProfile $payerProfile, - $fieldToken + $fieldToken ) { $this->requestHeader = $requestHeader; $this->terminalId = $terminalId; diff --git a/src/DTO/Request/ObtainPaymentMethods/ObtainPaymentMethodsRequest.php b/src/DTO/Request/ObtainPaymentMethods/ObtainPaymentMethodsRequest.php index 844e7026..12a53f83 100755 --- a/src/DTO/Request/ObtainPaymentMethods/ObtainPaymentMethodsRequest.php +++ b/src/DTO/Request/ObtainPaymentMethods/ObtainPaymentMethodsRequest.php @@ -23,7 +23,6 @@ namespace Invertus\SaferPay\DTO\Request\ObtainPaymentMethods; -use Invertus\SaferPay\Config\SaferPayConfig; use Invertus\SaferPay\DTO\Request\RequestHeader; if (!defined('_PS_VERSION_')) { diff --git a/src/DTO/Request/Refund/RefundRequest.php b/src/DTO/Request/Refund/RefundRequest.php index 7aca8f19..864c5e1f 100755 --- a/src/DTO/Request/Refund/RefundRequest.php +++ b/src/DTO/Request/Refund/RefundRequest.php @@ -23,7 +23,6 @@ namespace Invertus\SaferPay\DTO\Request\Refund; -use Invertus\SaferPay\Api\Request\RefundService; use Invertus\SaferPay\Config\SaferPayConfig; use Invertus\SaferPay\DTO\Request\Payment; use Invertus\SaferPay\DTO\Request\PendingNotification; @@ -73,7 +72,7 @@ public function getAsArray() { $return = [ 'RequestHeader' => [ - 'SpecVersion' => (string)Configuration::get(RequestHeader::SPEC_REFUND_VERSION), + 'SpecVersion' => (string) Configuration::get(RequestHeader::SPEC_REFUND_VERSION), 'CustomerId' => $this->requestHeader->getCustomerId(), 'RequestId' => $this->requestHeader->getRequestId(), 'RetryIndicator' => $this->requestHeader->getRetryIndicator(), @@ -86,7 +85,7 @@ public function getAsArray() ], 'OrderId' => $this->payment->getOrderReference(), //for delay testing: NotifyRefund_DelayedResponse60 'RestrictRefundAmountToCapturedAmount' => - (bool)Configuration::get(SaferPayConfig::RESTRICT_REFUND_AMOUNT_TO_CAPTURED_AMOUNT), + (bool) Configuration::get(SaferPayConfig::RESTRICT_REFUND_AMOUNT_TO_CAPTURED_AMOUNT), ], 'CaptureReference' => [ 'CaptureId' => $this->transactionId, diff --git a/src/DTO/Response/AssertRefund/AssertRefundBody.php b/src/DTO/Response/AssertRefund/AssertRefundBody.php index d61466f9..4d0c9165 100755 --- a/src/DTO/Response/AssertRefund/AssertRefundBody.php +++ b/src/DTO/Response/AssertRefund/AssertRefundBody.php @@ -23,14 +23,7 @@ namespace Invertus\SaferPay\DTO\Response\AssertRefund; -use Invertus\SaferPay\DTO\Response\Dcc; -use Invertus\SaferPay\DTO\Response\Liability; -use Invertus\SaferPay\DTO\Response\Payer; -use Invertus\SaferPay\DTO\Response\PaymentMeans; -use Invertus\SaferPay\DTO\Response\RegistrationResult; use Invertus\SaferPay\DTO\Response\ResponseHeader; -use Invertus\SaferPay\DTO\Response\ThreeDs; -use Invertus\SaferPay\DTO\Response\Transaction; if (!defined('_PS_VERSION_')) { exit; diff --git a/src/Enum/ControllerName.php b/src/Enum/ControllerName.php index 47eeea74..faed5e1e 100755 --- a/src/Enum/ControllerName.php +++ b/src/Enum/ControllerName.php @@ -44,4 +44,4 @@ class ControllerName const SUCCESS_IFRAME = 'successIframe'; const VALIDATION = 'validation'; const RETURN_URL = 'return'; -} \ No newline at end of file +} diff --git a/src/Enum/PaymentType.php b/src/Enum/PaymentType.php index 33269ed8..865d7c52 100755 --- a/src/Enum/PaymentType.php +++ b/src/Enum/PaymentType.php @@ -32,4 +32,4 @@ class PaymentType const BASIC = 'basic'; const IFRAME = 'iframe'; const HOSTED_IFRAME = 'hosted_iframe'; -} \ No newline at end of file +} diff --git a/src/Factory/ModuleFactory.php b/src/Factory/ModuleFactory.php index ae6abcea..cc0f09c9 100755 --- a/src/Factory/ModuleFactory.php +++ b/src/Factory/ModuleFactory.php @@ -39,4 +39,4 @@ public function getModule() { return Module::getInstanceByName('saferpayofficial'); } -} \ No newline at end of file +} diff --git a/src/Install/Installer.php b/src/Install/Installer.php index 476b11a3..a8f5a0d0 100755 --- a/src/Install/Installer.php +++ b/src/Install/Installer.php @@ -27,9 +27,6 @@ use Context; use Db; use Invertus\SaferPay\Config\SaferPayConfig; -use Invertus\SaferPay\Service\SaferPayLogoCreator; -use Invertus\SaferPay\Service\SaferPayPaymentCreator; -use Invertus\SaferPay\Service\SaferPayRestrictionCreator; use Language; use OrderState; use Tab; diff --git a/src/Install/Uninstaller.php b/src/Install/Uninstaller.php index fa583b19..71a55102 100755 --- a/src/Install/Uninstaller.php +++ b/src/Install/Uninstaller.php @@ -24,7 +24,6 @@ namespace Invertus\SaferPay\Install; use Configuration; -use Db; use Invertus\SaferPay\Config\SaferPayConfig; use Tab; @@ -52,7 +51,7 @@ public function uninstall() foreach ($this->getCommands() as $tableName => $command) { if (false === \Db::getInstance()->execute($command)) { - $this->errors[] = sprintf($this->module->l('Failed to uninstall database table [%s]' , __CLASS__), $tableName); + $this->errors[] = sprintf($this->module->l('Failed to uninstall database table [%s]', __CLASS__), $tableName); return false; } } diff --git a/src/Presentation/Loader/PaymentFormAssetLoader.php b/src/Presentation/Loader/PaymentFormAssetLoader.php index 521b0820..84f6f12c 100755 --- a/src/Presentation/Loader/PaymentFormAssetLoader.php +++ b/src/Presentation/Loader/PaymentFormAssetLoader.php @@ -60,7 +60,7 @@ public function register($controller) 'hosted_iframe' => PaymentType::HOSTED_IFRAME, 'iframe' => PaymentType::IFRAME, 'basic' => PaymentType::BASIC, - ] + ], ]); if (method_exists($controller, 'registerJavascript')) { @@ -89,4 +89,4 @@ public function register($controller) } } } -} \ No newline at end of file +} diff --git a/src/Provider/PaymentRedirectionProvider.php b/src/Provider/PaymentRedirectionProvider.php index 51724023..b2f6f131 100755 --- a/src/Provider/PaymentRedirectionProvider.php +++ b/src/Provider/PaymentRedirectionProvider.php @@ -23,14 +23,10 @@ namespace Invertus\SaferPay\Provider; -use Configuration; -use Context; use Invertus\SaferPay\Adapter\LegacyContext; use Invertus\SaferPay\Config\SaferPayConfig; use Invertus\SaferPay\Enum\ControllerName; use Invertus\SaferPay\Enum\PaymentType; -use Invertus\SaferPay\Factory\ModuleFactory; -use Invertus\SaferPay\Repository\SaferPayFieldRepository; if (!defined('_PS_VERSION_')) { exit; diff --git a/src/Provider/PaymentRestrictionProvider.php b/src/Provider/PaymentRestrictionProvider.php index 3885d3dc..f6b17113 100755 --- a/src/Provider/PaymentRestrictionProvider.php +++ b/src/Provider/PaymentRestrictionProvider.php @@ -49,13 +49,11 @@ class PaymentRestrictionProvider implements PaymentRestrictionProviderInterface */ private $klarnaPaymentRestrictionValidation; - public function __construct - ( + public function __construct( ApplePayPaymentRestrictionValidation $applePayPaymentRestrictionValidation, BasePaymentRestrictionValidation $basePaymentRestrictionValidation, KlarnaPaymentRestrictionValidation $klarnaPaymentRestrictionValidation - ) - { + ) { $this->applePayPaymentRestrictionValidation = $applePayPaymentRestrictionValidation; $this->basePaymentRestrictionValidation = $basePaymentRestrictionValidation; $this->klarnaPaymentRestrictionValidation = $klarnaPaymentRestrictionValidation; @@ -69,7 +67,7 @@ public function getPaymentValidators() return [ $this->applePayPaymentRestrictionValidation, $this->basePaymentRestrictionValidation, - $this->klarnaPaymentRestrictionValidation + $this->klarnaPaymentRestrictionValidation, ]; } } diff --git a/src/Provider/PaymentTypeProvider.php b/src/Provider/PaymentTypeProvider.php index 5ca0331f..1625c057 100755 --- a/src/Provider/PaymentTypeProvider.php +++ b/src/Provider/PaymentTypeProvider.php @@ -95,4 +95,4 @@ private function isHostedIframeRedirect($paymentMethod) return true; } -} \ No newline at end of file +} diff --git a/src/Repository/SaferPayFieldRepository.php b/src/Repository/SaferPayFieldRepository.php index 919cc093..e5dcbcbf 100755 --- a/src/Repository/SaferPayFieldRepository.php +++ b/src/Repository/SaferPayFieldRepository.php @@ -54,7 +54,7 @@ public function getIdByName($paymentName) public function truncateTable() { - $query = 'TRUNCATE TABLE '. _DB_PREFIX_ .'saferpay_field;'; + $query = 'TRUNCATE TABLE ' . _DB_PREFIX_ . 'saferpay_field;'; return Db::getInstance()->execute($query); } diff --git a/src/Repository/SaferPayPaymentRepository.php b/src/Repository/SaferPayPaymentRepository.php index 0221e46d..90852ec0 100755 --- a/src/Repository/SaferPayPaymentRepository.php +++ b/src/Repository/SaferPayPaymentRepository.php @@ -74,7 +74,7 @@ public function getActivePaymentMethods() public function truncateTable() { - $query = 'TRUNCATE TABLE '. _DB_PREFIX_ .'saferpay_payment;'; + $query = 'TRUNCATE TABLE ' . _DB_PREFIX_ . 'saferpay_payment;'; return Db::getInstance()->execute($query); } diff --git a/src/Service/PaymentRestrictionValidation/BasePaymentRestrictionValidation.php b/src/Service/PaymentRestrictionValidation/BasePaymentRestrictionValidation.php index bd326182..b98b49dc 100755 --- a/src/Service/PaymentRestrictionValidation/BasePaymentRestrictionValidation.php +++ b/src/Service/PaymentRestrictionValidation/BasePaymentRestrictionValidation.php @@ -23,7 +23,6 @@ namespace Invertus\SaferPay\Service\PaymentRestrictionValidation; -use Currency; use Invertus\SaferPay\Adapter\LegacyContext; use Invertus\SaferPay\Repository\SaferPayPaymentRepository; use Invertus\SaferPay\Repository\SaferPayRestrictionRepository; diff --git a/src/Service/Request/AssertRefundRequestObjectCreator.php b/src/Service/Request/AssertRefundRequestObjectCreator.php index 7da84439..032b3dbd 100755 --- a/src/Service/Request/AssertRefundRequestObjectCreator.php +++ b/src/Service/Request/AssertRefundRequestObjectCreator.php @@ -24,8 +24,6 @@ namespace Invertus\SaferPay\Service\Request; use Invertus\SaferPay\DTO\Request\AssertRefund\AssertRefundRequest; -use Invertus\SaferPay\Repository\SaferPayOrderRepository; -use SaferPayOrder; if (!defined('_PS_VERSION_')) { exit; diff --git a/src/Service/Request/AssertRequestObjectCreator.php b/src/Service/Request/AssertRequestObjectCreator.php index ea80c70b..5d8dde1f 100755 --- a/src/Service/Request/AssertRequestObjectCreator.php +++ b/src/Service/Request/AssertRequestObjectCreator.php @@ -24,7 +24,6 @@ namespace Invertus\SaferPay\Service\Request; use Invertus\SaferPay\DTO\Request\Assert\AssertRequest; -use Invertus\SaferPay\DTO\Request\AssertRefund\AssertRefundRequest; use Invertus\SaferPay\Repository\SaferPayOrderRepository; use SaferPayOrder; diff --git a/src/Service/Request/CaptureRequestObjectCreator.php b/src/Service/Request/CaptureRequestObjectCreator.php index e5727fe8..c9ab5be2 100755 --- a/src/Service/Request/CaptureRequestObjectCreator.php +++ b/src/Service/Request/CaptureRequestObjectCreator.php @@ -25,7 +25,6 @@ use Cart; use Invertus\SaferPay\DTO\Request\Capture\CaptureRequest; -use Order; if (!defined('_PS_VERSION_')) { exit; diff --git a/src/Service/Request/InitializeRequestObjectCreator.php b/src/Service/Request/InitializeRequestObjectCreator.php index f604b644..805da6b2 100755 --- a/src/Service/Request/InitializeRequestObjectCreator.php +++ b/src/Service/Request/InitializeRequestObjectCreator.php @@ -65,7 +65,7 @@ public function create( $cartDetails = $cart->getSummaryDetails(); $totalPrice = $cartDetails['total_price'] * SaferPayConfig::AMOUNT_MULTIPLIER_FOR_API; - $totalPrice = (int)(round($totalPrice)); + $totalPrice = (int) (round($totalPrice)); $payment = $this->requestObjectCreator->createPayment($cart, $totalPrice); $payer = new Payer(); $returnUrl = $this->requestObjectCreator->createReturnUrl($returnUrl); diff --git a/src/Service/Request/ObtainPaymentMethodsObjectCreator.php b/src/Service/Request/ObtainPaymentMethodsObjectCreator.php index 12db22b6..d9fa89f2 100755 --- a/src/Service/Request/ObtainPaymentMethodsObjectCreator.php +++ b/src/Service/Request/ObtainPaymentMethodsObjectCreator.php @@ -26,7 +26,6 @@ use Invertus\SaferPay\Config\SaferPayConfig; use Configuration; use Invertus\SaferPay\DTO\Request\ObtainPaymentMethods\ObtainPaymentMethodsRequest; -use Invertus\SaferPay\DTO\Request\RequestHeader; if (!defined('_PS_VERSION_')) { exit; diff --git a/src/Service/SaferPayInitialize.php b/src/Service/SaferPayInitialize.php index 8d1f92b8..bf6368d7 100755 --- a/src/Service/SaferPayInitialize.php +++ b/src/Service/SaferPayInitialize.php @@ -92,7 +92,7 @@ public function initialize( 'moduleId' => $this->module->id, 'selectedCard' => $selectedCard, 'isBusinessLicence' => $isBusinessLicence, - 'fieldToken' => $fieldToken + 'fieldToken' => $fieldToken, ], true ); diff --git a/src/Service/SaferPayMailService.php b/src/Service/SaferPayMailService.php index 94e68677..978a7916 100755 --- a/src/Service/SaferPayMailService.php +++ b/src/Service/SaferPayMailService.php @@ -73,12 +73,14 @@ public function sendOrderConfMail(Order $order, $orderStateId) Mail::l('Order confirmation', (int) $order->id_lang), $data, $customer->email, - implode(' ', [$customer->firstname, $customer->lastname]), null, null, $fileAttachment, - null, _PS_MAIL_DIR_, false, (int) $order->id_shop + null, + _PS_MAIL_DIR_, + false, + (int) $order->id_shop ); } @@ -348,7 +350,13 @@ private function getCartRuleList(Order $order, $orderStateId) $params, $customer->email, implode(' ', [$customer->firstname, $customer->lastname]), - null, null, null, null, _PS_MAIL_DIR_, false, (int) $order->id_shop + null, + null, + null, + null, + _PS_MAIL_DIR_, + false, + (int) $order->id_shop ); } diff --git a/src/Service/SaferPayObtainPaymentMethods.php b/src/Service/SaferPayObtainPaymentMethods.php index 21bf77e4..c0635d25 100755 --- a/src/Service/SaferPayObtainPaymentMethods.php +++ b/src/Service/SaferPayObtainPaymentMethods.php @@ -66,7 +66,7 @@ public function obtainPaymentMethods() $paymentMethods[$paymentNotation] = [ 'paymentMethod' => $paymentNotation, 'logoUrl' => $paymentMethodObject->LogoUrl, - 'currencies' => $paymentMethodObject->Currencies + 'currencies' => $paymentMethodObject->Currencies, ]; } } @@ -76,7 +76,7 @@ public function obtainPaymentMethods() $paymentMethods[$wallet->WalletName] = [ 'paymentMethod' => $wallet->WalletName, 'logoUrl' => $wallet->LogoUrl, - 'currencies' => $paymentMethodObject->Currencies + 'currencies' => $paymentMethodObject->Currencies, ]; } } diff --git a/src/Service/SaferPayOrderStatusService.php b/src/Service/SaferPayOrderStatusService.php index 4790ebd6..b3122096 100755 --- a/src/Service/SaferPayOrderStatusService.php +++ b/src/Service/SaferPayOrderStatusService.php @@ -158,7 +158,7 @@ public function capture(Order $order, $refundedAmount = 0, $isRefund = false) $cart = new Cart($order->id_cart); $transactionId = $saferPayOrder->transaction_id; $totalPrice = $order->total_paid_tax_incl * SaferPayConfig::AMOUNT_MULTIPLIER_FOR_API; - $totalPrice = (int)(round($totalPrice)); + $totalPrice = (int) (round($totalPrice)); if ($isRefund) { $transactionId = $saferPayOrder->refund_id; $totalPrice = $refundedAmount; @@ -177,7 +177,7 @@ public function capture(Order $order, $refundedAmount = 0, $isRefund = false) if ($isRefund) { $saferPayAssert->refunded_amount += $refundedAmount; $saferPayAssert->update(); - if ((int)$saferPayAssert->refunded_amount === (int)$saferPayAssert->amount) { + if ((int) $saferPayAssert->refunded_amount === (int) $saferPayAssert->amount) { $saferPayOrder->refunded = 1; $saferPayOrder->update(); $order->setCurrentState(_SAFERPAY_PAYMENT_REFUND_); @@ -222,7 +222,7 @@ public function refund(Order $order, $refundedAmount) $saferPayAssert = new SaferPayAssert($assertId); $refundAmount = $refundedAmount * SaferPayConfig::AMOUNT_MULTIPLIER_FOR_API; - $refundAmount = (int)(round($refundAmount)); + $refundAmount = (int) (round($refundAmount)); $isRefundValid = ($saferPayAssert->amount >= $saferPayAssert->refunded_amount + $refundAmount); if (!$isRefundValid) { @@ -269,7 +269,7 @@ public function refund(Order $order, $refundedAmount) if ($refundResponse->Transaction->Status === SaferPayConfig::TRANSACTION_STATUS_CAPTURED) { $saferPayAssert->refunded_amount += $refundAmount; $saferPayAssert->update(); - if ((int)$saferPayAssert->refunded_amount === (int)$saferPayAssert->amount) { + if ((int) $saferPayAssert->refunded_amount === (int) $saferPayAssert->amount) { $saferPayOrder->refunded = 1; $saferPayOrder->update(); $order->setCurrentState(_SAFERPAY_PAYMENT_REFUND_); diff --git a/src/Service/SaferPayPaymentNotation.php b/src/Service/SaferPayPaymentNotation.php index 5e80e551..e9b12d33 100755 --- a/src/Service/SaferPayPaymentNotation.php +++ b/src/Service/SaferPayPaymentNotation.php @@ -35,7 +35,7 @@ class SaferPayPaymentNotation 'BONUS' => 'BonusCard', 'DIRECTDEBIT' => 'Lastschrift', 'POSTFINANCE' => 'PostEFinance', - 'MAESTRO' => 'Maestro-Intl.' + 'MAESTRO' => 'Maestro-Intl.', ]; public function getForDisplay($payment) diff --git a/src/Service/SaferPayRefreshPaymentsService.php b/src/Service/SaferPayRefreshPaymentsService.php index 9ee994e0..4940f74b 100755 --- a/src/Service/SaferPayRefreshPaymentsService.php +++ b/src/Service/SaferPayRefreshPaymentsService.php @@ -23,7 +23,6 @@ namespace Invertus\SaferPay\Service; -use Invertus\SaferPay\Config\SaferPayConfig; use Invertus\SaferPay\Exception\Api\SaferPayApiException; use Exception; use Invertus\SaferPay\Repository\SaferPayFieldRepository; @@ -83,17 +82,17 @@ public function refreshPayments() $this->fieldRepository->truncateTable(); foreach ($paymentsFromAPI as $payment) { - $paymentActive = (isset($paymentsInfo[$payment]['active'])) ? (int)$paymentsInfo[$payment]['active'] : 0; - $fieldActive = (isset($paymentsInfo[$payment]['field'])) ? (int)$paymentsInfo[$payment]['field'] : 0; + $paymentActive = (isset($paymentsInfo[$payment]['active'])) ? (int) $paymentsInfo[$payment]['active'] : 0; + $fieldActive = (isset($paymentsInfo[$payment]['field'])) ? (int) $paymentsInfo[$payment]['field'] : 0; $this->paymentRepository->insertPayment([ 'name' => $payment, - 'active' => $paymentActive + 'active' => $paymentActive, ]); $this->fieldRepository->insertField([ 'name' => $payment, - 'active' => $fieldActive + 'active' => $fieldActive, ]); } } diff --git a/src/ServiceProvider/BaseServiceProvider.php b/src/ServiceProvider/BaseServiceProvider.php index 457266a1..fb547e64 100755 --- a/src/ServiceProvider/BaseServiceProvider.php +++ b/src/ServiceProvider/BaseServiceProvider.php @@ -65,4 +65,4 @@ public function getService($className, $service) return $service; } -} \ No newline at end of file +} diff --git a/src/ServiceProvider/LeagueServiceContainerProvider.php b/src/ServiceProvider/LeagueServiceContainerProvider.php index 502f85ee..8b526b97 100755 --- a/src/ServiceProvider/LeagueServiceContainerProvider.php +++ b/src/ServiceProvider/LeagueServiceContainerProvider.php @@ -54,4 +54,4 @@ public function extend($id, $concrete = null) return $this; } -} \ No newline at end of file +} diff --git a/src/ServiceProvider/ServiceContainerProviderInterface.php b/src/ServiceProvider/ServiceContainerProviderInterface.php index 26e11698..986804c9 100755 --- a/src/ServiceProvider/ServiceContainerProviderInterface.php +++ b/src/ServiceProvider/ServiceContainerProviderInterface.php @@ -35,4 +35,4 @@ public function getService($serviceName); * @return mixed */ public function extend($id, $concrete = null); -} \ No newline at end of file +} diff --git a/tests/Unit/Service/SaferPayPaymentNotationTest.php b/tests/Unit/Service/SaferPayPaymentNotationTest.php index 3a7bdc14..277a3b2c 100755 --- a/tests/Unit/Service/SaferPayPaymentNotationTest.php +++ b/tests/Unit/Service/SaferPayPaymentNotationTest.php @@ -23,7 +23,6 @@ namespace Invertus\SaferPay\Tests\Unit\Service; -use Invertus\SaferPay\Service\SaferPayPaymentNotation; use Invertus\SaferPay\Tests\Unit\Tools\UnitTestCase; class SaferPayPaymentNotationTest extends UnitTestCase @@ -63,5 +62,4 @@ public function getPaymentMethodForDisplayDataProvider() ['paymentMethod' => 'AMEX', 'expected' => 'AmericanExpress'], ]; } - }