Skip to content

Commit

Permalink
Don't display old klarna GWs on Settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhuesken committed Jan 16, 2025
1 parent 96922db commit 1455736
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/Settings/Page/Section/PaymentMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ public function renderGateways(): string
'mollie-payments-for-woocommerce'
);
$descriptionActivePaymentMethods = __(
'These payment methods are active in your Mollie profile.
'These payment methods are active in your Mollie profile.
You can enable these payment methods in their settings to make them available for your customers.',
'mollie-payments-for-woocommerce'
);
$titleInactivePaymentMethods = __('Inactive Payment Methods', 'mollie-payments-for-woocommerce');
$descriptionInactivePaymentMethods = __(
'These payment methods are available in your Mollie profile but are
'These payment methods are available in your Mollie profile but are
not currently active. Activate them to offer more payment options to your customers.',
'mollie-payments-for-woocommerce'
);
Expand All @@ -61,6 +61,13 @@ public function renderGateways(): string
$gatewayKey = 'mollie_wc_gateway_' . $paymentMethodId;
$enabledInMollie = array_key_exists($gatewayKey, $this->mollieGateways);

//don't display old klarna GWs
if (isset($this->paymentMethods['klarna']) && in_array($paymentMethodId, ['klarnasliceit', 'klarnapaylater', 'klarnapaynow'], true)) {
if (!$enabledInMollie) {
continue;
}
}

$paymentGatewayButton = $this->paymentGatewayButton($paymentMethod, $enabledInMollie);
if ($enabledInMollie) {
$activatedGateways .= $paymentGatewayButton;
Expand Down Expand Up @@ -88,7 +95,7 @@ protected function paymentGatewaysBlock(string $title, string $description, stri
<h3><?= esc_html($title); ?></h3>
<p><?= esc_html($description); ?></p>
<div class="mollie-settings-pm__list">
<?= $html; // WPCS: XSS ok. ?>
<?= $html; // phpcs:ignore XSS ok. ?>
</div>
</div>
<?php
Expand Down Expand Up @@ -232,10 +239,10 @@ protected function paymentGatewayButton(AbstractPaymentMethod $paymentMethod, $e
ob_start();
?>
<div class="mollie-settings-pm__single">
<?= $paymentMethod->getIconUrl(); // WPCS: XSS ok.?>
<?= $paymentMethod->getIconUrl(); // phpcs:ignore XSS ok.?>
<?= esc_html($paymentMethod->title());?>
<?= $messageOrLink; // WPCS: XSS ok.?>
<?= $button; // WPCS: XSS ok.?>
<?= $messageOrLink; // phpcs:ignore XSS ok.?>
<?= $button; // phpcs:ignore XSS ok.?>
</div>
<?php
return ob_get_clean();
Expand Down

0 comments on commit 1455736

Please sign in to comment.