Skip to content

Commit

Permalink
cs fixes applied
Browse files Browse the repository at this point in the history
  • Loading branch information
mant02 committed Nov 23, 2023
1 parent d5b4988 commit 8ddbccd
Show file tree
Hide file tree
Showing 46 changed files with 66 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
Expand Down
2 changes: 1 addition & 1 deletion controllers/front/hostedIframe.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion controllers/front/pendingNotify.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion controllers/front/return.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public function postProcess()
],
true
));

} catch (Exception $e) {
PrestaShopLogger::addLog(
sprintf(
Expand Down
1 change: 0 additions & 1 deletion controllers/front/successIFrame.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions saferpayofficial.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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']),
]
);

Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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;
}


Expand Down
5 changes: 2 additions & 3 deletions src/Api/ApiRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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",
];
}

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

2 changes: 1 addition & 1 deletion src/Api/Enum/TransactionStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ class TransactionStatus
const CANCELED = 'CANCELED';
const CAPTURED = 'CAPTURED';
const PENDING = 'PENDING';
}
}
6 changes: 0 additions & 6 deletions src/Api/Request/AssertRefundService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Request/CancelService.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function cancel(CancelRequest $cancelRequest)
{
return $this->apiRequest->post(
self::CANCEL_API,
$cancelRequest->getAsArray()
$cancelRequest->getAsArray()
);
}
}
2 changes: 1 addition & 1 deletion src/Api/Request/RefundService.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function refund(RefundRequest $refundRequest)
{
return $this->apiRequest->post(
self::REFUND_API,
$refundRequest->getAsArray()
$refundRequest->getAsArray()
);
}
}
2 changes: 1 addition & 1 deletion src/Config/SaferPayConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ private function isOrderStatusValid($orderStatusId)

return false;
}
}
}
4 changes: 2 additions & 2 deletions src/DTO/Request/AssertRefund/AssertRefundRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public function getAsArray()
'ClientInfo' => $this->requestHeader->getClientInfo(),
],
'TransactionReference' => [
'TransactionId' => $this->transactionId
]
'TransactionId' => $this->transactionId,
],
];

return $return;
Expand Down
2 changes: 1 addition & 1 deletion src/DTO/Request/Capture/CaptureRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function getAsArray()
],
'TransactionReference' => [
'TransactionId' => $this->transactionId,
]
],
];

return $return;
Expand Down
14 changes: 7 additions & 7 deletions src/DTO/Request/Initialize/InitializeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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_')) {
Expand Down
5 changes: 2 additions & 3 deletions src/DTO/Request/Refund/RefundRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(),
Expand All @@ -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,
Expand Down
7 changes: 0 additions & 7 deletions src/DTO/Response/AssertRefund/AssertRefundBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Enum/ControllerName.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ class ControllerName
const SUCCESS_IFRAME = 'successIframe';
const VALIDATION = 'validation';
const RETURN_URL = 'return';
}
}
2 changes: 1 addition & 1 deletion src/Enum/PaymentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ class PaymentType
const BASIC = 'basic';
const IFRAME = 'iframe';
const HOSTED_IFRAME = 'hosted_iframe';
}
}
2 changes: 1 addition & 1 deletion src/Factory/ModuleFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ public function getModule()
{
return Module::getInstanceByName('saferpayofficial');
}
}
}
3 changes: 0 additions & 3 deletions src/Install/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/Install/Uninstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
namespace Invertus\SaferPay\Install;

use Configuration;
use Db;
use Invertus\SaferPay\Config\SaferPayConfig;
use Tab;

Expand Down Expand Up @@ -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;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Presentation/Loader/PaymentFormAssetLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function register($controller)
'hosted_iframe' => PaymentType::HOSTED_IFRAME,
'iframe' => PaymentType::IFRAME,
'basic' => PaymentType::BASIC,
]
],
]);

if (method_exists($controller, 'registerJavascript')) {
Expand Down Expand Up @@ -89,4 +89,4 @@ public function register($controller)
}
}
}
}
}
4 changes: 0 additions & 4 deletions src/Provider/PaymentRedirectionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 3 additions & 5 deletions src/Provider/PaymentRestrictionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -69,7 +67,7 @@ public function getPaymentValidators()
return [
$this->applePayPaymentRestrictionValidation,
$this->basePaymentRestrictionValidation,
$this->klarnaPaymentRestrictionValidation
$this->klarnaPaymentRestrictionValidation,
];
}
}
2 changes: 1 addition & 1 deletion src/Provider/PaymentTypeProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ private function isHostedIframeRedirect($paymentMethod)

return true;
}
}
}
2 changes: 1 addition & 1 deletion src/Repository/SaferPayFieldRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Repository/SaferPayPaymentRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 8ddbccd

Please sign in to comment.