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 085d251..e4717f9 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