Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
31 changes: 31 additions & 0 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
$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 ) );
}
Expand Down Expand Up @@ -475,6 +476,36 @@

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
Expand Down Expand Up @@ -550,7 +581,7 @@
throw new \Exception(
\sprintf(
'Unsupported Buckaroo action: %s',
$object->RequiredAction->Name

Check failure on line 584 in src/Gateway.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$object'.
)
);
}
Expand All @@ -569,9 +600,9 @@
throw new \Exception(
\sprintf(
/* translators: 1: payment provider name, 2: status message, 3: status sub message*/
__( 'Unable to create payment at gateway: %1$s%2$s', 'pronamic_ideal' ),

Check failure on line 603 in src/Gateway.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
$object->Status->Code->Description,

Check failure on line 604 in src/Gateway.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$object'.
\property_exists( $object->Status, 'SubCode' ) ? ' – ' . $object->Status->SubCode->Description : ''

Check failure on line 605 in src/Gateway.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$object'.
)
);
}
Expand Down Expand Up @@ -651,7 +682,7 @@

// Check authorization error.
if ( \JSON_ERROR_NONE !== $json_error && 400 === $response->status() ) {
throw new \Exception( $response->body() );

Check failure on line 685 in src/Gateway.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$response'.
}

// Re-throw original response exception.
Expand Down Expand Up @@ -816,8 +847,8 @@
throw new \Exception(
sprintf(
/* translators: %s: transaction key */
__( 'Unable to create refund for transaction with transaction key: %s', 'pronamic_ideal' ),

Check failure on line 850 in src/Gateway.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
$transaction_id

Check failure on line 851 in src/Gateway.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$transaction_id'.
)
);
}
Expand All @@ -828,7 +859,7 @@
throw new \Exception(
sprintf(
/* translators: %s: transaction key */
__( 'Unable to create refund for transaction without service name. Transaction key: %s', 'pronamic_ideal' ),

Check failure on line 862 in src/Gateway.php

View workflow job for this annotation

GitHub Actions / phpcs / phpcs

All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
$transaction_id
)
);
Expand Down
Loading