Skip to content

Commit 6d71d4b

Browse files
committed
remove Klarna old title and descripitons
1 parent 888ce25 commit 6d71d4b

4 files changed

Lines changed: 45 additions & 2 deletions

File tree

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Author: Buckaroo
77
Author URI: http://www.buckaroo.nl
88
Description: Buckaroo payment system plugin for WooCommerce.
9-
Version: 4.7.2
9+
Version: 4.7.3
1010
Text Domain: wc-buckaroo-bpe-gateway
1111
Domain Path: /languages
1212
License: GPLv2 or later

src/Core/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Plugin
1616
*
1717
* @var string
1818
*/
19-
public const VERSION = '4.7.2';
19+
public const VERSION = '4.7.3';
2020

2121
/**
2222
* Instance of PaymentGatewayRegistry.

src/Install/Migration/MigrationHandler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Throwable;
1010
use Buckaroo\Woocommerce\Install\Migration\Versions\DisableAutoloadForSettings;
1111
use Buckaroo\Woocommerce\Install\Migration\Versions\MigrateIdealToIdealWero;
12+
use Buckaroo\Woocommerce\Install\Migration\Versions\MigrateKlarnaPayLaterLabels;
1213

1314
/**
1415
* Core class for handling migrations
@@ -187,6 +188,7 @@ protected function get_migration_items()
187188
new SetupTransactionsAndLogs(),
188189
new DisableAutoloadForSettings(),
189190
new MigrateIdealToIdealWero(),
191+
new MigrateKlarnaPayLaterLabels(),
190192
];
191193
}
192194

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace Buckaroo\Woocommerce\Install\Migration\Versions;
4+
5+
use Buckaroo\Woocommerce\Install\Migration\Migration;
6+
7+
/**
8+
* Cleans up legacy "Klarna: Pay later" front-end label and description values
9+
* stored for the Klarna (MoR) gateway (`buckaroo_klarnapay`) in earlier plugin
10+
* versions, before the gateway was renamed to just "Klarna".
11+
*/
12+
class MigrateKlarnaPayLaterLabels implements Migration
13+
{
14+
public $version = '4.7.3';
15+
16+
public function execute()
17+
{
18+
$optionKey = 'woocommerce_buckaroo_klarnapay_settings';
19+
$settings = get_option($optionKey);
20+
21+
if (! is_array($settings)) {
22+
return;
23+
}
24+
25+
$needsUpdate = false;
26+
27+
if (isset($settings['title']) && stripos($settings['title'], 'Pay later') !== false) {
28+
$settings['title'] = 'Klarna';
29+
$needsUpdate = true;
30+
}
31+
32+
if (isset($settings['description']) && stripos($settings['description'], 'Pay later') !== false) {
33+
$settings['description'] = 'Pay with Klarna';
34+
$needsUpdate = true;
35+
}
36+
37+
if ($needsUpdate) {
38+
update_option($optionKey, $settings, 'no');
39+
}
40+
}
41+
}

0 commit comments

Comments
 (0)