Skip to content

Commit

Permalink
PIOXD-236: Ported renaming of in3 to iDEAL in3
Browse files Browse the repository at this point in the history
  • Loading branch information
markusmichalski-fc committed May 13, 2024
1 parent 2875f22 commit 8a13e54
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Application/Helper/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Payment
'mollieapplepay' => array('title' => 'Apple Pay', 'model' => \Mollie\Payment\Application\Model\Payment\ApplePay::class),
'mollieprzelewy24' => array('title' => 'Przelewy24', 'model' => \Mollie\Payment\Application\Model\Payment\Przelewy24::class),
'molliemybank' => array('title' => 'MyBank', 'model' => \Mollie\Payment\Application\Model\Payment\MyBank::class),
'molliein3' => array('title' => 'in3', 'model' => \Mollie\Payment\Application\Model\Payment\In3::class),
'molliein3' => array('title' => 'iDEAL in3', 'model' => \Mollie\Payment\Application\Model\Payment\In3::class),
'molliebillie' => array('title' => 'Billie', 'model' => \Mollie\Payment\Application\Model\Payment\Billie::class),
);

Expand Down
34 changes: 34 additions & 0 deletions Core/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ class Events
'mollieinghomepay',
);

/**
* List of all payment methods to rename
*
* @var array
*/
public static $aRenamePaymentMethods = array(
'molliein3' => 'iDeal in3',
);

/**
* Execute action on activate event.
*
Expand All @@ -57,6 +66,7 @@ public static function onActivate()
self::addDatabaseStructure();
self::addData();
self::deleteRemovedPaymentMethods();
self::renamePaymentMethods();
self::regenerateViews();
self::clearTmp();
}
Expand Down Expand Up @@ -306,4 +316,28 @@ protected static function deactivePaymentMethods()
$aInValues = array_keys(self::getMolliePaymentMethods());
DatabaseProvider::getDb()->Execute("UPDATE oxpayments SET oxactive = 0 WHERE oxid IN ".Database::getInstance()->getPreparedInStatement($aInValues), $aInValues);
}

/**
* Rename payment methods
*
* @return void
*/
protected static function renamePaymentMethods()
{
foreach (self::$aRenamePaymentMethods as $sPaymentId => $sNewPaymentName) {
self::renamePaymentMethod($sPaymentId, $sNewPaymentName);
}
}

/**
* Rename payment method in database
*
* @param string $sPaymentId
* @param string $sNewPaymentName
* @return void
*/
protected static function renamePaymentMethod($sPaymentId, $sNewPaymentName)
{
DatabaseProvider::getDb()->Execute("Update oxpayments set oxdesc= ? WHERE oxid = ?", array($sNewPaymentName, $sPaymentId));
}
}
2 changes: 1 addition & 1 deletion metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
",
],
'thumbnail' => 'img/mollie_logo.png',
'version' => '1.0.0',
'version' => '1.1.0_RC1',
'author' => 'Fatchip GmbH',
'email' => '[email protected]',
'url' => 'https://www.mollie.com/',
Expand Down

0 comments on commit 8a13e54

Please sign in to comment.