Skip to content

Commit

Permalink
PHPMD, PHPStan, CodeStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
mariolorenz committed Sep 20, 2024
1 parent 732b3bf commit d454fd6
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 13 deletions.
9 changes: 6 additions & 3 deletions src/Controller/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
namespace OxidSolutionCatalysts\Adyen\Controller;

use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Application\Controller\PaymentController;
use OxidSolutionCatalysts\Adyen\Model\Payment;
use OxidSolutionCatalysts\Adyen\Service\TranslationMapper;
use OxidSolutionCatalysts\Adyen\Service\OrderReturnService;
use OxidSolutionCatalysts\Adyen\Traits\ServiceContainer;
Expand Down Expand Up @@ -56,8 +58,10 @@ public function return(): ?string
*/
public function execute()
{
if ($this->getPayment()->isAdyenCreditCardPayment()) {
$paymentController = oxNew(\OxidEsales\Eshop\Application\Controller\PaymentController::class);
/** @var Payment $payment */
$payment = $this->getPayment();
if ($payment->isAdyenCreditCardPayment()) {
$paymentController = oxNew(PaymentController::class);

if ($paymentController->validatePayment() !== "order") {
Registry::getUtils()->redirect(Registry::getConfig()->getShopHomeUrl() . 'cl=payment');
Expand All @@ -66,5 +70,4 @@ public function execute()

return parent::execute();
}

}
3 changes: 2 additions & 1 deletion src/Controller/PaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ public function validatePayment()
$newPaymentId = $this->getStringRequestData('paymentid');
$pspReference = $session->getPspReference();

//if the payment is adyen credit card, it will be validated from the order step where a new paymentId is impossible
// if the payment is adyen credit card, it will be validated
// from the order step where a new paymentId is impossible
$isAdyenCreditCard = $this->getAdyenPaymentConfigService()->isAdyenCreditCardPayment($actualPaymentId);
$paymentChanged = !$isAdyenCreditCard && ($actualPaymentId !== $newPaymentId);

Expand Down
5 changes: 0 additions & 5 deletions src/Core/ViewConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,6 @@ public function getAdyenErrorInvalidSession(): string
return Module::ADYEN_ERROR_INVALIDSESSION_NAME;
}

public function getAdyenCreditCardTooltipText(): string
{
return Registry::getLang()->translateString("OSC_ADYEN_ORDER_TOOLTIP");
}

/**
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function isAdyenPayment(): bool
/**
* Checks if the payment method is an Adyen credit card payment method
*/
public function isAdyenCreditCardPayment() :bool
public function isAdyenCreditCardPayment(): bool
{
return $this->getAdyenPaymentConfigService()->isAdyenCreditCardPayment($this->getId());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Service/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public function isAdyenPayment(string $paymentId): bool
return (isset(ModuleCore::PAYMENT_DEFINTIONS[$paymentId]));
}

public function isAdyenCreditCardPayment(string $paymentId) :bool
public function isAdyenCreditCardPayment(string $paymentId): bool
{
return $paymentId === ModuleCore::PAYMENT_CREDITCARD_ID;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Service/PaymentConfigService.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function isAdyenPayment(string $paymentId): bool
/**
* Checks if the payment method is an Adyen credit card payment method
*/
public function isAdyenCreditCardPayment(string $paymentId) : bool
public function isAdyenCreditCardPayment(string $paymentId): bool
{
return $this->moduleService->isAdyenCreditCardPayment($paymentId);
}
Expand Down
2 changes: 1 addition & 1 deletion views/frontend/tpl/payment/adyen_assets.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
[{elseif $isOrderPage}]
[{if $orderPaymentCreditCard}]
orderSubmitButton.disabled = true;
orderSubmitButton.title = '[{$oViewConf->getAdyenCreditCardTooltipText()}]';
orderSubmitButton.title = '[{assign var="template_title" value="OSC_ADYEN_ORDER_TOOLTIP"|oxmultilangassign}]';
const cardComponent = checkout.create(
'card',
{
Expand Down

0 comments on commit d454fd6

Please sign in to comment.