From a261b64a830b3350d895351e741f3bcd0a20427f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Wed, 25 Feb 2026 12:26:07 +0100 Subject: [PATCH 1/4] Add Trustly payment method. --- src/Gateway.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/Gateway.php b/src/Gateway.php index 085d251..96e8116 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -63,6 +63,7 @@ public function __construct( Config $config ) { $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::MASTERCARD ) ); $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::PAYPAL ) ); $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::SOFORT ) ); + $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::TRUSTLY ) ); $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::V_PAY ) ); $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::VISA ) ); } @@ -475,6 +476,36 @@ public function start( Payment $payment ) { break; /** + * Payment method Trustly. + * + * @link https://dev.buckaroo.nl/PaymentMethods/Description/trustly#pay + */ + case Core_PaymentMethods::TRUSTLY: + $data->Services->ServiceList[] = (object) [ + 'Action' => 'Pay', + 'Name' => 'Trustly', + 'Parameters' => [ + (object) [ + 'Name' => 'CustomerFirstName', + 'Value' => $customer?->get_name()->get_first_name(), + ], + (object) [ + 'Name' => 'CustomerLastName', + 'Value' => $customer?->get_name()->get_last_name(), + ], + (object) [ + 'Name' => 'CustomerCountryCode', + 'Value' => $payment?->get_billing_address()->get_country()->get_code(), + ], + (object) [ + 'Name' => 'consumeremail', + 'Value' => $customer?->get_email() + ], + ], + ]; + + break; + /** * Payment method V PAY. * * @link https://dev.buckaroo.nl/PaymentMethods/Description/creditcards#top From 31f43dba73961457e0af92348642e5c47edf90b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Re=C3=BCel=20van=20der=20Steege?= Date: Fri, 27 Feb 2026 11:59:43 +0100 Subject: [PATCH 2/4] Null-safe chained method calls. --- src/Gateway.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Gateway.php b/src/Gateway.php index 96e8116..dd52dcc 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -487,15 +487,15 @@ public function start( Payment $payment ) { 'Parameters' => [ (object) [ 'Name' => 'CustomerFirstName', - 'Value' => $customer?->get_name()->get_first_name(), + 'Value' => $customer?->get_name()?->get_first_name(), ], (object) [ 'Name' => 'CustomerLastName', - 'Value' => $customer?->get_name()->get_last_name(), + 'Value' => $customer?->get_name()?->get_last_name(), ], (object) [ 'Name' => 'CustomerCountryCode', - 'Value' => $payment?->get_billing_address()->get_country()->get_code(), + 'Value' => $payment?->get_billing_address()?->get_country()?->get_code(), ], (object) [ 'Name' => 'consumeremail', From d04f64169bc89b83f822ba2444c0c8d843ca3063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Re=C3=BCel=20van=20der=20Steege?= Date: Fri, 27 Feb 2026 12:12:22 +0100 Subject: [PATCH 3/4] Coding standards. --- composer.json | 2 +- src/Gateway.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 0d1071c..fe4bc42 100644 --- a/composer.json +++ b/composer.json @@ -54,7 +54,7 @@ "phpmd/phpmd": "^2.7", "phpstan/phpstan": "^1.11", "pronamic/pronamic-cli": "^1.0", - "pronamic/wp-coding-standards": "^1.3", + "pronamic/wp-coding-standards": "^2.4", "roots/wordpress": "^6.0", "szepeviktor/phpstan-wordpress": "^1.3", "vimeo/psalm": "^5.25", diff --git a/src/Gateway.php b/src/Gateway.php index dd52dcc..498e27e 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -482,8 +482,8 @@ public function start( Payment $payment ) { */ case Core_PaymentMethods::TRUSTLY: $data->Services->ServiceList[] = (object) [ - 'Action' => 'Pay', - 'Name' => 'Trustly', + 'Action' => 'Pay', + 'Name' => 'Trustly', 'Parameters' => [ (object) [ 'Name' => 'CustomerFirstName', @@ -499,7 +499,7 @@ public function start( Payment $payment ) { ], (object) [ 'Name' => 'consumeremail', - 'Value' => $customer?->get_email() + 'Value' => $customer?->get_email(), ], ], ]; From abd42660f3abc31a337e38f1c0f62f109e849aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Re=C3=BCel=20van=20der=20Steege?= Date: Fri, 27 Feb 2026 12:26:48 +0100 Subject: [PATCH 4/4] Fix using nullsafe method call on non-nullable type `Pronamic\WordPress\Pay\Payments\Payment`. --- src/Gateway.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Gateway.php b/src/Gateway.php index 498e27e..e4717f9 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -495,7 +495,7 @@ public function start( Payment $payment ) { ], (object) [ 'Name' => 'CustomerCountryCode', - 'Value' => $payment?->get_billing_address()?->get_country()?->get_code(), + 'Value' => $payment->get_billing_address()?->get_country()?->get_code(), ], (object) [ 'Name' => 'consumeremail',