From 10f18ae43ceebd64c19d28f0795539e320d92c63 Mon Sep 17 00:00:00 2001 From: paeddl Date: Wed, 25 Mar 2026 11:21:31 +0100 Subject: [PATCH] v5.12.3 --- CHANGELOG_de-DE.md | 3 ++ CHANGELOG_en-GB.md | 5 ++- composer.json | 2 +- src/Installer/PaymentInstaller.php | 62 +++++++++++++++++++++++++++--- 4 files changed, 65 insertions(+), 7 deletions(-) diff --git a/CHANGELOG_de-DE.md b/CHANGELOG_de-DE.md index f3a1bbd8..6e7141e1 100644 --- a/CHANGELOG_de-DE.md +++ b/CHANGELOG_de-DE.md @@ -1,3 +1,6 @@ +# 5.12.3 +* Aktualisierung iDEAL Payment Naming + # 5.12.2 * Fehler behoben, bei dem die AGB nicht bis zum Akzeptieren-Häkchen gescrollt wurden * Falsche UI-Komponente für B2B-Rechnung korrigiert diff --git a/CHANGELOG_en-GB.md b/CHANGELOG_en-GB.md index 7dc00597..8f2643a6 100644 --- a/CHANGELOG_en-GB.md +++ b/CHANGELOG_en-GB.md @@ -1,4 +1,7 @@ -# 5.12.2 +# 5.12.3 +* Updated iDEAL Payment naming + +* # 5.12.2 * Fix for Terms and Conditions no scroll to accept checkmark * Fix incorrect UI Comp. for B2B invoice * Fix for incorrect customer data for UPL diff --git a/composer.json b/composer.json index f9559ba9..305f927d 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "unzerdev/shopware6", "description": "Unzer payment integration for Shopware 6", - "version": "5.12.2", + "version": "5.12.3", "type": "shopware-platform-plugin", "license": "Apache-2.0", "minimum-stability": "dev", diff --git a/src/Installer/PaymentInstaller.php b/src/Installer/PaymentInstaller.php index a5a010c9..64640348 100755 --- a/src/Installer/PaymentInstaller.php +++ b/src/Installer/PaymentInstaller.php @@ -5,6 +5,7 @@ namespace UnzerPayment6\Installer; use League\Flysystem\Filesystem; +use Shopware\Core\Checkout\Payment\Aggregate\PaymentMethodTranslation\PaymentMethodTranslationEntity; use Shopware\Core\Checkout\Payment\PaymentMethodEntity; use Shopware\Core\Framework\Context; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; @@ -153,16 +154,16 @@ class PaymentInstaller implements InstallerInterface [ 'id' => self::PAYMENT_ID_IDEAL, 'handlerIdentifier' => UnzerIdealPaymentHandler::class, - 'name' => 'iDEAL', + 'name' => 'iDEAL | Wero', 'technicalName' => 'unzer_ideal', 'translations' => [ 'de-DE' => [ - 'name' => 'iDEAL', - 'description' => 'iDEAL Zahlungen mit Unzer payments', + 'name' => 'iDEAL | Wero', + 'description' => 'iDEAL | Wero Zahlungen mit Unzer payments', ], 'en-GB' => [ - 'name' => 'iDEAL', - 'description' => 'iDEAL payments with Unzer payments', + 'name' => 'iDEAL | Wero', + 'description' => 'iDEAL | Wero payments with Unzer payments', ], ], ], @@ -494,11 +495,13 @@ private function upsertPaymentMethods(InstallContext $context): void foreach (self::PAYMENT_METHODS as $paymentMethod) { if (!$this->isPaymentMethodInstalled($paymentMethod['id'], $context->getContext())) { + // method does not exist > create with complete data $paymentMethod['pluginId'] = $pluginId; $paymentMethod['active'] = true; $this->paymentMethodRepository->upsert([$paymentMethod], $context->getContext()); } else { + // method does exist > only update necessary fields $upsertPayload = [ 'id' => $paymentMethod['id'], 'pluginId' => $pluginId, @@ -509,6 +512,55 @@ private function upsertPaymentMethods(InstallContext $context): void } $this->removeOldPaymentMethods($context); $this->deprecatePaymentMethods($context); + $this->renameIdeal($context->getContext()); + } + + private function renameIdeal(Context $context): void + { + $criteria = new Criteria([self::PAYMENT_ID_IDEAL]); + $criteria->addAssociation('translations.language.locale'); + /** @var PaymentMethodEntity $existingPaymentMethod */ + $existingPaymentMethod = $this->paymentMethodRepository->search($criteria, $context)->first(); + if ($existingPaymentMethod === null) { + return; + } + $translations = []; + /** @var PaymentMethodTranslationEntity $translation */ + foreach ($existingPaymentMethod->getTranslations()->getElements() as $uniqueId => $translation) { + $newName = null; + $newDescription = null; + if (stripos($translation->getName(), 'wero') === false) { + $newName = str_replace('iDEAL', 'iDEAL | Wero', $translation->getName()); + } + if (stripos($translation->getDescription(), 'wero') === false) { + $newDescription = str_replace('iDEAL', 'iDEAL | Wero', $translation->getDescription()); + } + + if ($newName === null && $newDescription === null) { + continue; + } + + $localeCode = $translation->getLanguage()->getLocale()->getCode(); + + $translations[$localeCode] = [ + 'languageId' => $translation->getLanguageId(), + ]; + if ($newName !== null) { + $translations[$localeCode]['name'] = $newName; + } + if ($newDescription !== null) { + $translations[$localeCode]['description'] = $newDescription; + } + } + + if (empty($translations)) { + return; + } + + $this->paymentMethodRepository->update([[ + 'id' => $existingPaymentMethod->getId(), + 'translations' => $translations, + ]], $context); } private function deprecatePaymentMethods(InstallContext $context): void