Skip to content

Commit bfb6e72

Browse files
committed
Add shared iDEAL payment method and reuse images
Introduce a single $payment_method_ideal instance with name, description and image paths and register it earlier in Plugin::init. Reuse its images for the direct-debit-ideal payment method instead of duplicating the image array, and remove the later duplicate iDEAL block. This deduplicates code and ensures consistent iDEAL/Wero branding assets while keeping existing behavior.
1 parent 21a46f3 commit bfb6e72

1 file changed

Lines changed: 15 additions & 17 deletions

File tree

src/Plugin.php

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,20 @@ public function register_payment_methods(): void {
829829

830830
$this->payment_methods->add( $payment_method_credit_card );
831831

832+
// Payment method iDEAL | Wero.
833+
$payment_method_ideal = new PaymentMethod( PaymentMethods::IDEAL );
834+
835+
$payment_method_ideal->descriptions = [
836+
'customer' => \__( 'With iDEAL you can easily pay online in the secure environment of your own bank.', 'pronamic_ideal' ),
837+
];
838+
839+
$payment_method_ideal->name = \__( 'iDEAL | Wero', 'pronamic_ideal' );
840+
841+
$payment_method_ideal->images = [
842+
'640x360' => $image_service->get_path( 'other/ideal-wero/ideal-wero-640x360.svg' ),
843+
'woocommerce' => $image_service->get_path( 'other/ideal-wero/method-ideal-wero-wc-51x32.svg' ),
844+
];
845+
832846
// Direct debit.
833847
$payment_method_direct_debit = new PaymentMethod( PaymentMethods::DIRECT_DEBIT );
834848

@@ -861,9 +875,7 @@ public function register_payment_methods(): void {
861875
'customer' => \sprintf( $description_template, $payment_method_direct_debit_ideal->name ),
862876
];
863877

864-
$payment_method_direct_debit_ideal->images = [
865-
'woocommerce' => $image_service->get_path( 'methods/direct-debit-ideal/method-direct-debit-ideal-wc-107x32.svg' ),
866-
];
878+
$payment_method_direct_debit_ideal->images = $payment_method_ideal->images;
867879

868880
$this->payment_methods->add( $payment_method_direct_debit_ideal );
869881

@@ -903,20 +915,6 @@ public function register_payment_methods(): void {
903915

904916
$this->payment_methods->add( $payment_method_gift_card );
905917

906-
// IDEAL.
907-
$payment_method_ideal = new PaymentMethod( PaymentMethods::IDEAL );
908-
909-
$payment_method_ideal->descriptions = [
910-
'customer' => \__( 'With iDEAL you can easily pay online in the secure environment of your own bank.', 'pronamic_ideal' ),
911-
];
912-
913-
$payment_method_ideal->name = \__( 'iDEAL | Wero', 'pronamic_ideal' );
914-
915-
$payment_method_ideal->images = [
916-
'640x360' => $image_service->get_path( 'other/ideal-wero/ideal-wero-640x360.svg' ),
917-
'woocommerce' => $image_service->get_path( 'other/ideal-wero/method-ideal-wero-wc-51x32.svg' ),
918-
];
919-
920918
/**
921919
* The iDEAL logo rebranding takes effect on January 29, 2026.
922920
*

0 commit comments

Comments
 (0)