diff --git a/src/DependencyInjection/listeners.xml b/src/DependencyInjection/listeners.xml index 7a3f69c5..65bd0211 100644 --- a/src/DependencyInjection/listeners.xml +++ b/src/DependencyInjection/listeners.xml @@ -74,6 +74,10 @@ + + + + diff --git a/src/EventListener/PaymentDistinguishableNameEventListener.php b/src/EventListener/PaymentDistinguishableNameEventListener.php new file mode 100644 index 00000000..08dba353 --- /dev/null +++ b/src/EventListener/PaymentDistinguishableNameEventListener.php @@ -0,0 +1,35 @@ + 'updateDistinguishablePaymentNameForPayPalV2', + ]; + } + + public function updateDistinguishablePaymentNameForPayPalV2(EntityLoadedEvent $event): void + { + /** @var PaymentMethodEntity $payment */ + foreach ($event->getEntities() as $payment) { + // Technical name is nullable <6.7.0 + $technicalName = $payment->getTechnicalName() ?? ''; + + if (\in_array($technicalName, [PayonePaypalV2::TECHNICAL_NAME, PayonePaypalV2Express::TECHNICAL_NAME], true)) { + $distinguishableName = str_replace('PayPal', 'PayPal v2', $payment->getTranslation('distinguishableName')); + $payment->setDistinguishableName($distinguishableName); + $payment->addTranslated('distinguishableName', $distinguishableName); + } + } + } +} diff --git a/src/PaymentMethod/PayonePaypalV2.php b/src/PaymentMethod/PayonePaypalV2.php index 8a761bab..de61fcd7 100644 --- a/src/PaymentMethod/PayonePaypalV2.php +++ b/src/PaymentMethod/PayonePaypalV2.php @@ -15,9 +15,9 @@ class PayonePaypalV2 extends AbstractPaymentMethod protected string $id = self::UUID; - protected string $name = 'PAYONE PayPal v2'; + protected string $name = 'PAYONE PayPal'; - protected string $description = 'Pay easily and secure with PayPal v2.'; + protected string $description = 'Pay easily and secure with PayPal.'; protected string $paymentHandler = PayonePaypalV2PaymentHandler::class; @@ -25,12 +25,12 @@ class PayonePaypalV2 extends AbstractPaymentMethod protected array $translations = [ 'de-DE' => [ - 'name' => 'PAYONE PayPal v2', - 'description' => 'Zahlen Sie sicher und bequem mit PayPal v2.', + 'name' => 'PAYONE PayPal', + 'description' => 'Zahlen Sie sicher und bequem mit PayPal.', ], 'en-GB' => [ - 'name' => 'PAYONE PayPal v2', - 'description' => 'Pay easily and secure with PayPal v2.', + 'name' => 'PAYONE PayPal', + 'description' => 'Pay easily and secure with PayPal.', ], ]; diff --git a/src/PaymentMethod/PayonePaypalV2Express.php b/src/PaymentMethod/PayonePaypalV2Express.php index 6fa78384..32a0934e 100644 --- a/src/PaymentMethod/PayonePaypalV2Express.php +++ b/src/PaymentMethod/PayonePaypalV2Express.php @@ -15,9 +15,9 @@ class PayonePaypalV2Express extends AbstractPaymentMethod protected string $id = self::UUID; - protected string $name = 'PAYONE Paypal Express v2'; + protected string $name = 'PAYONE Paypal Express'; - protected string $description = 'Pay easily and secure with PayPal Express v2.'; + protected string $description = 'Pay easily and secure with PayPal Express.'; protected string $paymentHandler = PayonePaypalV2ExpressPaymentHandler::class; @@ -25,12 +25,12 @@ class PayonePaypalV2Express extends AbstractPaymentMethod protected array $translations = [ 'de-DE' => [ - 'name' => 'PAYONE PayPal Express v2', - 'description' => 'Zahlen Sie sicher und bequem mit PayPal Express v2.', + 'name' => 'PAYONE PayPal Express', + 'description' => 'Zahlen Sie sicher und bequem mit PayPal Express.', ], 'en-GB' => [ - 'name' => 'PAYONE PayPal Express v2', - 'description' => 'Pay easily and secure with PayPal Express v2.', + 'name' => 'PAYONE PayPal Express', + 'description' => 'Pay easily and secure with PayPal Express.', ], ];