Skip to content

Commit a261b64

Browse files
committed
Add Trustly payment method.
1 parent d076320 commit a261b64

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/Gateway.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public function __construct( Config $config ) {
6363
$this->register_payment_method( new PaymentMethod( Core_PaymentMethods::MASTERCARD ) );
6464
$this->register_payment_method( new PaymentMethod( Core_PaymentMethods::PAYPAL ) );
6565
$this->register_payment_method( new PaymentMethod( Core_PaymentMethods::SOFORT ) );
66+
$this->register_payment_method( new PaymentMethod( Core_PaymentMethods::TRUSTLY ) );
6667
$this->register_payment_method( new PaymentMethod( Core_PaymentMethods::V_PAY ) );
6768
$this->register_payment_method( new PaymentMethod( Core_PaymentMethods::VISA ) );
6869
}
@@ -475,6 +476,36 @@ public function start( Payment $payment ) {
475476

476477
break;
477478
/**
479+
* Payment method Trustly.
480+
*
481+
* @link https://dev.buckaroo.nl/PaymentMethods/Description/trustly#pay
482+
*/
483+
case Core_PaymentMethods::TRUSTLY:
484+
$data->Services->ServiceList[] = (object) [
485+
'Action' => 'Pay',
486+
'Name' => 'Trustly',
487+
'Parameters' => [
488+
(object) [
489+
'Name' => 'CustomerFirstName',
490+
'Value' => $customer?->get_name()->get_first_name(),
491+
],
492+
(object) [
493+
'Name' => 'CustomerLastName',
494+
'Value' => $customer?->get_name()->get_last_name(),
495+
],
496+
(object) [
497+
'Name' => 'CustomerCountryCode',
498+
'Value' => $payment?->get_billing_address()->get_country()->get_code(),
499+
],
500+
(object) [
501+
'Name' => 'consumeremail',
502+
'Value' => $customer?->get_email()
503+
],
504+
],
505+
];
506+
507+
break;
508+
/**
478509
* Payment method V PAY.
479510
*
480511
* @link https://dev.buckaroo.nl/PaymentMethods/Description/creditcards#top

0 commit comments

Comments
 (0)