From cbd409f43ccd78fe7a551c90b7cfa11461001fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Fri, 20 May 2022 11:18:23 +0200 Subject: [PATCH 01/38] Update Composer allowed plugins (https://getcomposer.org/doc/06-config.md#allow-plugins). --- composer.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4a3c705..d2b5574 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,13 @@ } }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "composer/installers": true, + "dealerdirect/phpcodesniffer-composer-installer": true, + "roots/wordpress-core-installer": true, + "bamarni/composer-bin-plugin": true + } }, "require": { "php": ">=5.6.20", From 1209fd552dd73617080402e0d8576c2479dc3018 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Mon, 20 Jun 2022 12:08:32 +0200 Subject: [PATCH 02/38] Fix documentation typo. --- src/CLI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CLI.php b/src/CLI.php index a7d5deb..2f6772e 100644 --- a/src/CLI.php +++ b/src/CLI.php @@ -33,7 +33,7 @@ class CLI { * Construct CLI. * * @param Integration $integration Integration. - * @retrun void + * @return void */ public function __construct( $integration ) { $this->integration = $integration; From 6a852e1b5595b6e2e2322a5f81e7e9894c659d31 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Wed, 13 Jul 2022 10:08:58 +0200 Subject: [PATCH 03/38] Use payment methods register methods. --- src/Gateway.php | 54 ++++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/src/Gateway.php b/src/Gateway.php index 722fb3f..ac4b39e 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -5,7 +5,11 @@ use Pronamic\WordPress\Money\Money; use Pronamic\WordPress\Pay\Banks\BankAccountDetails; use Pronamic\WordPress\Pay\Core\Gateway as Core_Gateway; +use Pronamic\WordPress\Pay\Core\PaymentMethod; +use Pronamic\WordPress\Pay\Core\PaymentMethods; +use Pronamic\WordPress\Pay\Core\PaymentMethods; use Pronamic\WordPress\Pay\Core\PaymentMethods as Core_PaymentMethods; +use Pronamic\WordPress\Pay\Core\SelectField; use Pronamic\WordPress\Pay\Payments\Payment; use Pronamic\WordPress\Pay\Payments\PaymentStatus; use WP_Error; @@ -48,16 +52,39 @@ public function __construct( Config $config ) { 'webhook_log', 'webhook_no_config', ); + + // Methods. + $ideal_payment_method = new PaymentMethod( PaymentMethods::IDEAL ); + + $ideal_issuer_field = new SelectField( 'ideal-issuer' ); + $ideal_issuer_field->set_required( true ); + $ideal_issuer_field->set_options_callback( function() { + return $this->get_issuers(); + } ); + + $ideal_payment_method->add_field( $ideal_issuer_field ); + + $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::AMERICAN_EXPRESS ) ); + $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::BANK_TRANSFER ) ); + $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::BANCONTACT ) ); + $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::CREDIT_CARD ) ); + $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::GIROPAY ) ); + $this->register_payment_method( $ideal_payment_method ); + $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::MAESTRO ) ); + $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::V_PAY ) ); + $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::VISA ) ); } /** * Get issuers. * * @since 1.2.4 - * @see Core_Gateway::get_issuers() * @return array>> */ - public function get_issuers() { + private function get_issuers() { $groups = array(); // Check non-empty keys in configuration. @@ -100,29 +127,6 @@ public function get_issuers() { return $groups; } - /** - * Get supported payment methods - * - * @see Core_Gateway::get_supported_payment_methods() - * @return string[] - */ - public function get_supported_payment_methods() { - return array( - Core_PaymentMethods::AMERICAN_EXPRESS, - Core_PaymentMethods::BANK_TRANSFER, - Core_PaymentMethods::BANCONTACT, - Core_PaymentMethods::CREDIT_CARD, - Core_PaymentMethods::GIROPAY, - Core_PaymentMethods::IDEAL, - Core_PaymentMethods::MAESTRO, - Core_PaymentMethods::MASTERCARD, - Core_PaymentMethods::PAYPAL, - Core_PaymentMethods::SOFORT, - Core_PaymentMethods::V_PAY, - Core_PaymentMethods::VISA, - ); - } - /** * Start * From dccd51b2a9d87821ddd5334ef2bade1b11f14a9a Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Wed, 13 Jul 2022 11:15:10 +0200 Subject: [PATCH 04/38] Update Gateway.php --- src/Gateway.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Gateway.php b/src/Gateway.php index ac4b39e..fa7a9f8 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -6,8 +6,6 @@ use Pronamic\WordPress\Pay\Banks\BankAccountDetails; use Pronamic\WordPress\Pay\Core\Gateway as Core_Gateway; use Pronamic\WordPress\Pay\Core\PaymentMethod; -use Pronamic\WordPress\Pay\Core\PaymentMethods; -use Pronamic\WordPress\Pay\Core\PaymentMethods; use Pronamic\WordPress\Pay\Core\PaymentMethods as Core_PaymentMethods; use Pronamic\WordPress\Pay\Core\SelectField; use Pronamic\WordPress\Pay\Payments\Payment; @@ -54,7 +52,7 @@ public function __construct( Config $config ) { ); // Methods. - $ideal_payment_method = new PaymentMethod( PaymentMethods::IDEAL ); + $ideal_payment_method = new PaymentMethod( Core_PaymentMethods::IDEAL ); $ideal_issuer_field = new SelectField( 'ideal-issuer' ); $ideal_issuer_field->set_required( true ); From cc19e1669be84808fa8b89af9c9c797ae5c5e4b7 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Wed, 13 Jul 2022 16:05:39 +0200 Subject: [PATCH 05/38] Clarify iDEAL issuers method. --- src/Gateway.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Gateway.php b/src/Gateway.php index fa7a9f8..47a18dd 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -57,7 +57,7 @@ public function __construct( Config $config ) { $ideal_issuer_field = new SelectField( 'ideal-issuer' ); $ideal_issuer_field->set_required( true ); $ideal_issuer_field->set_options_callback( function() { - return $this->get_issuers(); + return $this->get_ideal_issuers(); } ); $ideal_payment_method->add_field( $ideal_issuer_field ); @@ -77,12 +77,12 @@ public function __construct( Config $config ) { } /** - * Get issuers. + * Get iDEAL issuers. * * @since 1.2.4 * @return array>> */ - private function get_issuers() { + private function get_ideal_issuers() { $groups = array(); // Check non-empty keys in configuration. From 8186b60b76a04d7b98903326e754f2b84e4e25ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Mon, 15 Aug 2022 17:02:19 +0200 Subject: [PATCH 06/38] Working on Sisow via Buckaroo integration (pronamic/wp-pronamic-pay-sisow#3). --- src/Integration.php | 56 ++++++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/src/Integration.php b/src/Integration.php index 41122d9..748a7e3 100644 --- a/src/Integration.php +++ b/src/Integration.php @@ -29,6 +29,20 @@ class Integration extends AbstractGatewayIntegration { */ private $host; + /** + * Meta key website key. + * + * @var string + */ + private $meta_key_website_key; + + /** + * Meta key secret key. + * + * @var string + */ + private $meta_key_secret_key; + /** * Construct Buckaroo integration. * @@ -37,28 +51,32 @@ class Integration extends AbstractGatewayIntegration { public function __construct( $args = array() ) { $args = wp_parse_args( $args, - array( - 'id' => 'buckaroo', - 'name' => 'Buckaroo', - 'host' => 'checkout.buckaroo.nl', - 'url' => 'https://plaza.buckaroo.nl/', - 'product_url' => \__( 'http://www.buckaroo-payments.com', 'pronamic_ideal' ), - 'dashboard_url' => 'https://plaza.buckaroo.nl/', - 'provider' => 'buckaroo', - 'supports' => array( + [ + 'id' => 'buckaroo', + 'name' => 'Buckaroo', + 'host' => 'checkout.buckaroo.nl', + 'url' => 'https://plaza.buckaroo.nl/', + 'product_url' => \__( 'http://www.buckaroo-payments.com', 'pronamic_ideal' ), + 'dashboard_url' => 'https://plaza.buckaroo.nl/', + 'provider' => 'buckaroo', + 'supports' => [ 'payment_status_request', 'refunds', 'webhook', 'webhook_log', 'webhook_no_config', - ), - 'manual_url' => \__( 'https://www.pronamic.eu/support/how-to-connect-buckaroo-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ), - ) + ], + 'manual_url' => \__( 'https://www.pronamic.eu/support/how-to-connect-buckaroo-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ), + 'meta_key_website_key' => 'buckaroo_website_key', + 'meta_key_secret_key' => 'buckaroo_secret_key', + ] ); parent::__construct( $args ); - $this->host = $args['host']; + $this->host = $args['host']; + $this->meta_key_website_key = $args['meta_key_website_key']; + $this->meta_key_secret_key = $args['meta_key_secret_key']; /** * CLI. @@ -112,7 +130,7 @@ public function get_settings_fields() { $fields[] = array( 'section' => 'general', 'filter' => FILTER_SANITIZE_STRING, - 'meta_key' => '_pronamic_gateway_buckaroo_website_key', + 'meta_key' => '_pronamic_gateway_' . $this->meta_key_website_key, 'title' => __( 'Website Key', 'pronamic_ideal' ), 'type' => 'text', 'classes' => array( 'code' ), @@ -123,7 +141,7 @@ public function get_settings_fields() { $fields[] = array( 'section' => 'general', 'filter' => FILTER_SANITIZE_STRING, - 'meta_key' => '_pronamic_gateway_buckaroo_secret_key', + 'meta_key' => '_pronamic_gateway_'. $this->meta_key_secret_key, 'title' => __( 'Secret Key', 'pronamic_ideal' ), 'type' => 'text', 'classes' => array( 'regular-text', 'code' ), @@ -193,10 +211,10 @@ public function get_config( $post_id ) { $config->set_host( $this->host ); - $config->website_key = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_website_key', true ); - $config->secret_key = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_secret_key', true ); - $config->excluded_services = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_excluded_services', true ); - $config->invoice_number = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_invoice_number', true ); + $config->website_key = $this->get_meta( $post_id, $this->meta_key_website_key ); + $config->secret_key = $this->get_meta( $post_id, $this->meta_key_secret_key ); + $config->excluded_services = $this->get_meta( $post_id, 'buckaroo_excluded_services' ); + $config->invoice_number = $this->get_meta( $post_id, 'buckaroo_invoice_number' ); return $config; } From 96f7ebc94237c5bd72ba090342ca354d2637c978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Tue, 16 Aug 2022 12:28:54 +0200 Subject: [PATCH 07/38] Add backwards compatibility for Sisow test mode (pronamic/wp-pronamic-pay-sisow#3). --- src/Integration.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Integration.php b/src/Integration.php index 748a7e3..4d780f3 100644 --- a/src/Integration.php +++ b/src/Integration.php @@ -209,6 +209,21 @@ public function get_settings_fields() { public function get_config( $post_id ) { $config = new Config(); + // Backwards compatibility for Sisow test mode setting. + if ( 'sisow-ideal' === $this->id ) { + $test_mode = $this->get_meta( $post_id, 'sisow_test_mode' ); + + if ( '' === $test_mode ) { + $test_mode = ( 'test' === $this->get_meta( $post_id, 'mode' ) ); + } + + if ( $test_mode ) { + $this->host = 'testcheckout.buckaroo.nl'; + + $this->set_mode( 'test' ); + } + } + $config->set_host( $this->host ); $config->website_key = $this->get_meta( $post_id, $this->meta_key_website_key ); From 3028bb3e9e417e5c5ebc88deda95fae7c51cc59c Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Tue, 16 Aug 2022 13:49:04 +0200 Subject: [PATCH 08/38] Revert "Working on Sisow via Buckaroo integration (pronamic/wp-pronamic-pay-sisow#3)." This reverts commit 8186b60b76a04d7b98903326e754f2b84e4e25ae. --- src/Integration.php | 56 +++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 37 deletions(-) diff --git a/src/Integration.php b/src/Integration.php index 4d780f3..e75556f 100644 --- a/src/Integration.php +++ b/src/Integration.php @@ -29,20 +29,6 @@ class Integration extends AbstractGatewayIntegration { */ private $host; - /** - * Meta key website key. - * - * @var string - */ - private $meta_key_website_key; - - /** - * Meta key secret key. - * - * @var string - */ - private $meta_key_secret_key; - /** * Construct Buckaroo integration. * @@ -51,32 +37,28 @@ class Integration extends AbstractGatewayIntegration { public function __construct( $args = array() ) { $args = wp_parse_args( $args, - [ - 'id' => 'buckaroo', - 'name' => 'Buckaroo', - 'host' => 'checkout.buckaroo.nl', - 'url' => 'https://plaza.buckaroo.nl/', - 'product_url' => \__( 'http://www.buckaroo-payments.com', 'pronamic_ideal' ), - 'dashboard_url' => 'https://plaza.buckaroo.nl/', - 'provider' => 'buckaroo', - 'supports' => [ + array( + 'id' => 'buckaroo', + 'name' => 'Buckaroo', + 'host' => 'checkout.buckaroo.nl', + 'url' => 'https://plaza.buckaroo.nl/', + 'product_url' => \__( 'http://www.buckaroo-payments.com', 'pronamic_ideal' ), + 'dashboard_url' => 'https://plaza.buckaroo.nl/', + 'provider' => 'buckaroo', + 'supports' => array( 'payment_status_request', 'refunds', 'webhook', 'webhook_log', 'webhook_no_config', - ], - 'manual_url' => \__( 'https://www.pronamic.eu/support/how-to-connect-buckaroo-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ), - 'meta_key_website_key' => 'buckaroo_website_key', - 'meta_key_secret_key' => 'buckaroo_secret_key', - ] + ), + 'manual_url' => \__( 'https://www.pronamic.eu/support/how-to-connect-buckaroo-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ), + ) ); parent::__construct( $args ); - $this->host = $args['host']; - $this->meta_key_website_key = $args['meta_key_website_key']; - $this->meta_key_secret_key = $args['meta_key_secret_key']; + $this->host = $args['host']; /** * CLI. @@ -130,7 +112,7 @@ public function get_settings_fields() { $fields[] = array( 'section' => 'general', 'filter' => FILTER_SANITIZE_STRING, - 'meta_key' => '_pronamic_gateway_' . $this->meta_key_website_key, + 'meta_key' => '_pronamic_gateway_buckaroo_website_key', 'title' => __( 'Website Key', 'pronamic_ideal' ), 'type' => 'text', 'classes' => array( 'code' ), @@ -141,7 +123,7 @@ public function get_settings_fields() { $fields[] = array( 'section' => 'general', 'filter' => FILTER_SANITIZE_STRING, - 'meta_key' => '_pronamic_gateway_'. $this->meta_key_secret_key, + 'meta_key' => '_pronamic_gateway_buckaroo_secret_key', 'title' => __( 'Secret Key', 'pronamic_ideal' ), 'type' => 'text', 'classes' => array( 'regular-text', 'code' ), @@ -226,10 +208,10 @@ public function get_config( $post_id ) { $config->set_host( $this->host ); - $config->website_key = $this->get_meta( $post_id, $this->meta_key_website_key ); - $config->secret_key = $this->get_meta( $post_id, $this->meta_key_secret_key ); - $config->excluded_services = $this->get_meta( $post_id, 'buckaroo_excluded_services' ); - $config->invoice_number = $this->get_meta( $post_id, 'buckaroo_invoice_number' ); + $config->website_key = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_website_key', true ); + $config->secret_key = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_secret_key', true ); + $config->excluded_services = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_excluded_services', true ); + $config->invoice_number = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_invoice_number', true ); return $config; } From 59ca740cdeedca7ede2d8f35ae502c2ead9dcf88 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Tue, 16 Aug 2022 13:49:06 +0200 Subject: [PATCH 09/38] Revert "Add backwards compatibility for Sisow test mode (pronamic/wp-pronamic-pay-sisow#3)." This reverts commit 96f7ebc94237c5bd72ba090342ca354d2637c978. --- src/Integration.php | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/Integration.php b/src/Integration.php index e75556f..41122d9 100644 --- a/src/Integration.php +++ b/src/Integration.php @@ -191,21 +191,6 @@ public function get_settings_fields() { public function get_config( $post_id ) { $config = new Config(); - // Backwards compatibility for Sisow test mode setting. - if ( 'sisow-ideal' === $this->id ) { - $test_mode = $this->get_meta( $post_id, 'sisow_test_mode' ); - - if ( '' === $test_mode ) { - $test_mode = ( 'test' === $this->get_meta( $post_id, 'mode' ) ); - } - - if ( $test_mode ) { - $this->host = 'testcheckout.buckaroo.nl'; - - $this->set_mode( 'test' ); - } - } - $config->set_host( $this->host ); $config->website_key = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_website_key', true ); From ad4d0164c7e6e3ba75d34d2ff269cf3c2ac62e45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Mon, 15 Aug 2022 17:02:19 +0200 Subject: [PATCH 10/38] Add backwards compatibility for Sisow test mode (pronamic/wp-pronamic-pay-sisow#3). Working on Sisow via Buckaroo integration (pronamic/wp-pronamic-pay-sisow#3). --- src/Integration.php | 71 +++++++++++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 19 deletions(-) diff --git a/src/Integration.php b/src/Integration.php index 41122d9..4d780f3 100644 --- a/src/Integration.php +++ b/src/Integration.php @@ -29,6 +29,20 @@ class Integration extends AbstractGatewayIntegration { */ private $host; + /** + * Meta key website key. + * + * @var string + */ + private $meta_key_website_key; + + /** + * Meta key secret key. + * + * @var string + */ + private $meta_key_secret_key; + /** * Construct Buckaroo integration. * @@ -37,28 +51,32 @@ class Integration extends AbstractGatewayIntegration { public function __construct( $args = array() ) { $args = wp_parse_args( $args, - array( - 'id' => 'buckaroo', - 'name' => 'Buckaroo', - 'host' => 'checkout.buckaroo.nl', - 'url' => 'https://plaza.buckaroo.nl/', - 'product_url' => \__( 'http://www.buckaroo-payments.com', 'pronamic_ideal' ), - 'dashboard_url' => 'https://plaza.buckaroo.nl/', - 'provider' => 'buckaroo', - 'supports' => array( + [ + 'id' => 'buckaroo', + 'name' => 'Buckaroo', + 'host' => 'checkout.buckaroo.nl', + 'url' => 'https://plaza.buckaroo.nl/', + 'product_url' => \__( 'http://www.buckaroo-payments.com', 'pronamic_ideal' ), + 'dashboard_url' => 'https://plaza.buckaroo.nl/', + 'provider' => 'buckaroo', + 'supports' => [ 'payment_status_request', 'refunds', 'webhook', 'webhook_log', 'webhook_no_config', - ), - 'manual_url' => \__( 'https://www.pronamic.eu/support/how-to-connect-buckaroo-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ), - ) + ], + 'manual_url' => \__( 'https://www.pronamic.eu/support/how-to-connect-buckaroo-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ), + 'meta_key_website_key' => 'buckaroo_website_key', + 'meta_key_secret_key' => 'buckaroo_secret_key', + ] ); parent::__construct( $args ); - $this->host = $args['host']; + $this->host = $args['host']; + $this->meta_key_website_key = $args['meta_key_website_key']; + $this->meta_key_secret_key = $args['meta_key_secret_key']; /** * CLI. @@ -112,7 +130,7 @@ public function get_settings_fields() { $fields[] = array( 'section' => 'general', 'filter' => FILTER_SANITIZE_STRING, - 'meta_key' => '_pronamic_gateway_buckaroo_website_key', + 'meta_key' => '_pronamic_gateway_' . $this->meta_key_website_key, 'title' => __( 'Website Key', 'pronamic_ideal' ), 'type' => 'text', 'classes' => array( 'code' ), @@ -123,7 +141,7 @@ public function get_settings_fields() { $fields[] = array( 'section' => 'general', 'filter' => FILTER_SANITIZE_STRING, - 'meta_key' => '_pronamic_gateway_buckaroo_secret_key', + 'meta_key' => '_pronamic_gateway_'. $this->meta_key_secret_key, 'title' => __( 'Secret Key', 'pronamic_ideal' ), 'type' => 'text', 'classes' => array( 'regular-text', 'code' ), @@ -191,12 +209,27 @@ public function get_settings_fields() { public function get_config( $post_id ) { $config = new Config(); + // Backwards compatibility for Sisow test mode setting. + if ( 'sisow-ideal' === $this->id ) { + $test_mode = $this->get_meta( $post_id, 'sisow_test_mode' ); + + if ( '' === $test_mode ) { + $test_mode = ( 'test' === $this->get_meta( $post_id, 'mode' ) ); + } + + if ( $test_mode ) { + $this->host = 'testcheckout.buckaroo.nl'; + + $this->set_mode( 'test' ); + } + } + $config->set_host( $this->host ); - $config->website_key = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_website_key', true ); - $config->secret_key = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_secret_key', true ); - $config->excluded_services = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_excluded_services', true ); - $config->invoice_number = get_post_meta( $post_id, '_pronamic_gateway_buckaroo_invoice_number', true ); + $config->website_key = $this->get_meta( $post_id, $this->meta_key_website_key ); + $config->secret_key = $this->get_meta( $post_id, $this->meta_key_secret_key ); + $config->excluded_services = $this->get_meta( $post_id, 'buckaroo_excluded_services' ); + $config->invoice_number = $this->get_meta( $post_id, 'buckaroo_invoice_number' ); return $config; } From 053f6ed9fac584a7319acd3383f7b2e2ca3e2f01 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 22 Aug 2022 11:41:55 +0200 Subject: [PATCH 11/38] Add support for VOID payment method. --- src/Gateway.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Gateway.php b/src/Gateway.php index 47a18dd..eb84006 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -74,6 +74,7 @@ public function __construct( Config $config ) { $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::SOFORT ) ); $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::V_PAY ) ); $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::VISA ) ); + $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::VOID ) ); } /** From eae63bc42ceb0acf1440dedc1e765decb486c274 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 22 Aug 2022 12:16:43 +0200 Subject: [PATCH 12/38] Use cached callback options class. --- src/Config.php | 18 +++++++++++++++++- src/Gateway.php | 15 +++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/Config.php b/src/Config.php index 4bef05d..5f8ce69 100644 --- a/src/Config.php +++ b/src/Config.php @@ -2,6 +2,7 @@ namespace Pronamic\WordPress\Pay\Gateways\Buckaroo; +use JsonSerializable; use Pronamic\WordPress\Pay\Core\GatewayConfig; /** @@ -14,7 +15,7 @@ * @version 2.0.0 * @since 1.0.0 */ -class Config extends GatewayConfig { +class Config extends GatewayConfig implements JsonSerializable { /** * Host. * @@ -110,4 +111,19 @@ public function get_excluded_services() { public function get_invoice_number() { return $this->invoice_number; } + + /** + * Serialize to JSON. + * + * @link https://www.w3.org/TR/json-ld11/#specifying-the-type + * @return mixed|void + */ + public function jsonSerialize() { + return [ + '@type' => __CLASS__, + 'host' => $this->host, + 'website_key' => (string) $this->website_key, + 'secret_key' => (string) $this->secret_key, + ]; + } } diff --git a/src/Gateway.php b/src/Gateway.php index eb84006..c6f47e3 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -8,6 +8,8 @@ use Pronamic\WordPress\Pay\Core\PaymentMethod; use Pronamic\WordPress\Pay\Core\PaymentMethods as Core_PaymentMethods; use Pronamic\WordPress\Pay\Core\SelectField; +use Pronamic\WordPress\Pay\Fields\CachedCallbackOptions; +use Pronamic\WordPress\Pay\Fields\IDealIssuerSelectField; use Pronamic\WordPress\Pay\Payments\Payment; use Pronamic\WordPress\Pay\Payments\PaymentStatus; use WP_Error; @@ -54,11 +56,16 @@ public function __construct( Config $config ) { // Methods. $ideal_payment_method = new PaymentMethod( Core_PaymentMethods::IDEAL ); - $ideal_issuer_field = new SelectField( 'ideal-issuer' ); + $ideal_issuer_field = new IDealIssuerSelectField( 'ideal-issuer' ); + $ideal_issuer_field->set_required( true ); - $ideal_issuer_field->set_options_callback( function() { - return $this->get_ideal_issuers(); - } ); + + $ideal_issuer_field->set_options( new CachedCallbackOptions( + function() { + return $this->get_ideal_issuers(); + }, + 'pronamic_pay_ideal_issuers_' . \md5( \wp_json_encode( $config ) ) + ) ); $ideal_payment_method->add_field( $ideal_issuer_field ); From a59d4e2f776f53fae0cf55bfb27fa5a80201159f Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 22 Aug 2022 12:31:59 +0200 Subject: [PATCH 13/38] Fix support for cached callback options class. --- src/Gateway.php | 51 +++++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/src/Gateway.php b/src/Gateway.php index c6f47e3..5f9c9e7 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -10,6 +10,8 @@ use Pronamic\WordPress\Pay\Core\SelectField; use Pronamic\WordPress\Pay\Fields\CachedCallbackOptions; use Pronamic\WordPress\Pay\Fields\IDealIssuerSelectField; +use Pronamic\WordPress\Pay\Fields\SelectFieldOption; +use Pronamic\WordPress\Pay\Fields\SelectFieldOptionGroup; use Pronamic\WordPress\Pay\Payments\Payment; use Pronamic\WordPress\Pay\Payments\PaymentStatus; use WP_Error; @@ -88,49 +90,44 @@ function() { * Get iDEAL issuers. * * @since 1.2.4 - * @return array>> + * @return iterable */ private function get_ideal_issuers() { - $groups = array(); - // Check non-empty keys in configuration. if ( empty( $this->config->website_key ) || empty( $this->config->secret_key ) ) { - return $groups; + return []; } // Get iDEAL issuers. $object = $this->request( 'GET', 'Transaction/Specification/ideal?serviceVersion=2' ); - if ( \property_exists( $object, 'Actions' ) ) { - foreach ( $object->Actions as $action ) { - // Check action name. - if ( 'Pay' !== $action->Name ) { - continue; - } + if ( ! \property_exists( $object, 'Actions' ) ) { + return []; + } - foreach ( $action->RequestParameters as $request_parameter ) { - // Check request parameter name. - if ( 'issuer' !== $request_parameter->Name ) { - continue; - } + $groups = []; - foreach ( $request_parameter->ListItemDescriptions as $item ) { - // Make sure to add group. - if ( ! array_key_exists( $item->GroupName, $groups ) ) { - $groups[ $item->GroupName ] = array( - 'name' => $item->GroupName, - 'options' => array(), - ); - } - - // Add issuer to group. - $groups[ $item->GroupName ]['options'][ $item->Value ] = $item->Description; + $actions_pay = \array_filter( $object->Actions, function( $action ) { + return 'Pay' === $action->Name; + } ); + + foreach ( $actions_pay as $action ) { + $request_parameters = \array_filter( $action->RequestParameters, function( $request_parameter ) { + return 'issuer' === $request_parameter->Name; + } ); + + foreach ( $request_parameters as $request_parameter ) { + foreach ( $request_parameter->ListItemDescriptions as $item ) { + if ( ! \array_key_exists( $item->GroupName, $groups ) ) { + $groups[ $item->GroupName ] = new SelectFieldOptionGroup( $item->GroupName ); } + + $groups[ $item->GroupName ]->options[] = new SelectFieldOption( $item->Value, $item->Description ); } } } - return $groups; + return array_values( $groups ); } /** From da24df9c3ab91902a14faea4ff100fcd89594ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Tue, 23 Aug 2022 10:44:01 +0200 Subject: [PATCH 14/38] Simplify using legacy Sisow integration meta. --- src/Integration.php | 79 ++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 47 deletions(-) diff --git a/src/Integration.php b/src/Integration.php index 4d780f3..601665d 100644 --- a/src/Integration.php +++ b/src/Integration.php @@ -29,20 +29,6 @@ class Integration extends AbstractGatewayIntegration { */ private $host; - /** - * Meta key website key. - * - * @var string - */ - private $meta_key_website_key; - - /** - * Meta key secret key. - * - * @var string - */ - private $meta_key_secret_key; - /** * Construct Buckaroo integration. * @@ -52,31 +38,27 @@ public function __construct( $args = array() ) { $args = wp_parse_args( $args, [ - 'id' => 'buckaroo', - 'name' => 'Buckaroo', - 'host' => 'checkout.buckaroo.nl', - 'url' => 'https://plaza.buckaroo.nl/', - 'product_url' => \__( 'http://www.buckaroo-payments.com', 'pronamic_ideal' ), - 'dashboard_url' => 'https://plaza.buckaroo.nl/', - 'provider' => 'buckaroo', - 'supports' => [ + 'id' => 'buckaroo', + 'name' => 'Buckaroo', + 'host' => 'checkout.buckaroo.nl', + 'url' => 'https://plaza.buckaroo.nl/', + 'product_url' => \__( 'http://www.buckaroo-payments.com', 'pronamic_ideal' ), + 'dashboard_url' => 'https://plaza.buckaroo.nl/', + 'provider' => 'buckaroo', + 'supports' => [ 'payment_status_request', 'refunds', 'webhook', 'webhook_log', 'webhook_no_config', ], - 'manual_url' => \__( 'https://www.pronamic.eu/support/how-to-connect-buckaroo-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ), - 'meta_key_website_key' => 'buckaroo_website_key', - 'meta_key_secret_key' => 'buckaroo_secret_key', + 'manual_url' => \__( 'https://www.pronamic.eu/support/how-to-connect-buckaroo-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ), ] ); parent::__construct( $args ); - $this->host = $args['host']; - $this->meta_key_website_key = $args['meta_key_website_key']; - $this->meta_key_secret_key = $args['meta_key_secret_key']; + $this->host = $args['host']; /** * CLI. @@ -124,28 +106,34 @@ public function gateway_configuration_display_value( $display_value, $post_id ) * @return array>> */ public function get_settings_fields() { + global $post; + + $config = $this->get_config( $post->ID ); + $fields = array(); // Website Key. $fields[] = array( 'section' => 'general', 'filter' => FILTER_SANITIZE_STRING, - 'meta_key' => '_pronamic_gateway_' . $this->meta_key_website_key, + 'meta_key' => '_pronamic_gateway_buckaroo_merchant_key', 'title' => __( 'Website Key', 'pronamic_ideal' ), 'type' => 'text', 'classes' => array( 'code' ), 'tooltip' => __( 'Website key as mentioned in the Buckaroo dashboard on the page "Profile » Website".', 'pronamic_ideal' ), + 'default' => $config->get_website_key(), ); // Secret Key. $fields[] = array( 'section' => 'general', 'filter' => FILTER_SANITIZE_STRING, - 'meta_key' => '_pronamic_gateway_'. $this->meta_key_secret_key, + 'meta_key' => '_pronamic_gateway_buckaroo_secret_key', 'title' => __( 'Secret Key', 'pronamic_ideal' ), 'type' => 'text', 'classes' => array( 'regular-text', 'code' ), 'tooltip' => __( 'Secret key as mentioned in the Buckaroo dashboard on the page "Configuration » Secret Key for Digital Signature".', 'pronamic_ideal' ), + 'default' => $config->get_secret_key(), ); // Excluded services. @@ -209,28 +197,25 @@ public function get_settings_fields() { public function get_config( $post_id ) { $config = new Config(); - // Backwards compatibility for Sisow test mode setting. - if ( 'sisow-ideal' === $this->id ) { - $test_mode = $this->get_meta( $post_id, 'sisow_test_mode' ); - - if ( '' === $test_mode ) { - $test_mode = ( 'test' === $this->get_meta( $post_id, 'mode' ) ); - } - - if ( $test_mode ) { - $this->host = 'testcheckout.buckaroo.nl'; - - $this->set_mode( 'test' ); - } - } - $config->set_host( $this->host ); - $config->website_key = $this->get_meta( $post_id, $this->meta_key_website_key ); - $config->secret_key = $this->get_meta( $post_id, $this->meta_key_secret_key ); + $config->website_key = $this->get_meta( $post_id, 'buckaroo_website_key' ); + $config->secret_key = $this->get_meta( $post_id, 'buckaroo_secret_key' ); $config->excluded_services = $this->get_meta( $post_id, 'buckaroo_excluded_services' ); $config->invoice_number = $this->get_meta( $post_id, 'buckaroo_invoice_number' ); + // Legacy Sisow integration meta. + $meta = get_post_meta( $post_id ); + + if ( + \array_key_exists( '_pronamic_gateway_id', $meta ) + && + 'sisow-ideal' === reset( $meta['_pronamic_gateway_id'] ) + ) { + $config->website_key = $this->get_meta( $post_id, 'sisow_merchant_id' ); + $config->secret_key = $this->get_meta( $post_id, 'sisow_merchant_key' ); + } + return $config; } From 47d3241486e17f277088e08920b61e18771169a8 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Tue, 23 Aug 2022 12:28:19 +0200 Subject: [PATCH 15/38] Add support for website and secret key callback. --- src/Integration.php | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/Integration.php b/src/Integration.php index 601665d..e669db2 100644 --- a/src/Integration.php +++ b/src/Integration.php @@ -53,6 +53,12 @@ public function __construct( $args = array() ) { 'webhook_no_config', ], 'manual_url' => \__( 'https://www.pronamic.eu/support/how-to-connect-buckaroo-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ), + 'callback_website_key' => function( $post_id ) { + return $this->get_meta( $post_id, 'buckaroo_website_key' ); + }, + 'callback_secret_key' => function( $post_id ) { + return $this->get_meta( $post_id, 'buckaroo_secret_key' ); + }, ] ); @@ -60,6 +66,9 @@ public function __construct( $args = array() ) { $this->host = $args['host']; + $this->callback_website_key = $args['callback_website_key']; + $this->callback_secret_key = $args['callback_secret_key']; + /** * CLI. * @@ -199,23 +208,11 @@ public function get_config( $post_id ) { $config->set_host( $this->host ); - $config->website_key = $this->get_meta( $post_id, 'buckaroo_website_key' ); - $config->secret_key = $this->get_meta( $post_id, 'buckaroo_secret_key' ); + $config->website_key = \call_user_func( $this->callback_website_key, $post_id ); + $config->secret_key = \call_user_func( $this->callback_secret_key, $post_id ); $config->excluded_services = $this->get_meta( $post_id, 'buckaroo_excluded_services' ); $config->invoice_number = $this->get_meta( $post_id, 'buckaroo_invoice_number' ); - // Legacy Sisow integration meta. - $meta = get_post_meta( $post_id ); - - if ( - \array_key_exists( '_pronamic_gateway_id', $meta ) - && - 'sisow-ideal' === reset( $meta['_pronamic_gateway_id'] ) - ) { - $config->website_key = $this->get_meta( $post_id, 'sisow_merchant_id' ); - $config->secret_key = $this->get_meta( $post_id, 'sisow_merchant_key' ); - } - return $config; } From 254d96f3186388352630e4fc8fbd937a25665376 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Wed, 24 Aug 2022 13:33:08 +0200 Subject: [PATCH 16/38] Use unique field name. --- src/Gateway.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Gateway.php b/src/Gateway.php index 5f9c9e7..04b17cc 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -58,7 +58,7 @@ public function __construct( Config $config ) { // Methods. $ideal_payment_method = new PaymentMethod( Core_PaymentMethods::IDEAL ); - $ideal_issuer_field = new IDealIssuerSelectField( 'ideal-issuer' ); + $ideal_issuer_field = new IDealIssuerSelectField( 'buckaroo_ideal_issuer' ); $ideal_issuer_field->set_required( true ); @@ -356,7 +356,7 @@ public function start( Payment $payment ) { 'Parameters' => array( array( 'Name' => 'issuer', - 'Value' => $payment->get_meta( 'issuer' ), + 'Value' => $payment->get_meta( 'buckaroo_ideal_issuer' ), ), ), ); From e6616a6c5175402614a892b616794f4c2eabfbee Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Wed, 24 Aug 2022 13:33:52 +0200 Subject: [PATCH 17/38] Revert "Use unique field name." This reverts commit 254d96f3186388352630e4fc8fbd937a25665376. --- src/Gateway.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Gateway.php b/src/Gateway.php index 04b17cc..5f9c9e7 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -58,7 +58,7 @@ public function __construct( Config $config ) { // Methods. $ideal_payment_method = new PaymentMethod( Core_PaymentMethods::IDEAL ); - $ideal_issuer_field = new IDealIssuerSelectField( 'buckaroo_ideal_issuer' ); + $ideal_issuer_field = new IDealIssuerSelectField( 'ideal-issuer' ); $ideal_issuer_field->set_required( true ); @@ -356,7 +356,7 @@ public function start( Payment $payment ) { 'Parameters' => array( array( 'Name' => 'issuer', - 'Value' => $payment->get_meta( 'buckaroo_ideal_issuer' ), + 'Value' => $payment->get_meta( 'issuer' ), ), ), ); From f2af617d2340e75bdf9e4ef665e04b826129ac47 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Wed, 24 Aug 2022 15:45:17 +0200 Subject: [PATCH 18/38] No longer use callback but meta key, also for saving. --- src/Integration.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/Integration.php b/src/Integration.php index e669db2..3a78acd 100644 --- a/src/Integration.php +++ b/src/Integration.php @@ -53,12 +53,8 @@ public function __construct( $args = array() ) { 'webhook_no_config', ], 'manual_url' => \__( 'https://www.pronamic.eu/support/how-to-connect-buckaroo-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ), - 'callback_website_key' => function( $post_id ) { - return $this->get_meta( $post_id, 'buckaroo_website_key' ); - }, - 'callback_secret_key' => function( $post_id ) { - return $this->get_meta( $post_id, 'buckaroo_secret_key' ); - }, + 'meta_key_website_key' => 'buckaroo_website_key', + 'meta_key_secret_key' => 'buckaroo_secret_key', ] ); @@ -66,8 +62,8 @@ public function __construct( $args = array() ) { $this->host = $args['host']; - $this->callback_website_key = $args['callback_website_key']; - $this->callback_secret_key = $args['callback_secret_key']; + $this->meta_key_website_key = $args['meta_key_website_key']; + $this->meta_key_secret_key = $args['meta_key_secret_key']; /** * CLI. @@ -125,6 +121,7 @@ public function get_settings_fields() { $fields[] = array( 'section' => 'general', 'filter' => FILTER_SANITIZE_STRING, + 'meta_key' => '_pronamic_gateway_' . $this->meta_key_website_key, 'meta_key' => '_pronamic_gateway_buckaroo_merchant_key', 'title' => __( 'Website Key', 'pronamic_ideal' ), 'type' => 'text', @@ -137,7 +134,7 @@ public function get_settings_fields() { $fields[] = array( 'section' => 'general', 'filter' => FILTER_SANITIZE_STRING, - 'meta_key' => '_pronamic_gateway_buckaroo_secret_key', + 'meta_key' => '_pronamic_gateway_' . $this->meta_key_secret_key, 'title' => __( 'Secret Key', 'pronamic_ideal' ), 'type' => 'text', 'classes' => array( 'regular-text', 'code' ), @@ -208,8 +205,8 @@ public function get_config( $post_id ) { $config->set_host( $this->host ); - $config->website_key = \call_user_func( $this->callback_website_key, $post_id ); - $config->secret_key = \call_user_func( $this->callback_secret_key, $post_id ); + $config->website_key = $this->get_meta( $post_id, $this->meta_key_website_key ); + $config->secret_key = $this->get_meta( $post_id, $this->meta_key_secret_key ); $config->excluded_services = $this->get_meta( $post_id, 'buckaroo_excluded_services' ); $config->invoice_number = $this->get_meta( $post_id, 'buckaroo_invoice_number' ); From f17e0ebb04411f6381d70156cf8df89332129643 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Wed, 24 Aug 2022 15:47:49 +0200 Subject: [PATCH 19/38] Update Integration.php --- src/Integration.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Integration.php b/src/Integration.php index 3a78acd..de34ef5 100644 --- a/src/Integration.php +++ b/src/Integration.php @@ -122,7 +122,6 @@ public function get_settings_fields() { 'section' => 'general', 'filter' => FILTER_SANITIZE_STRING, 'meta_key' => '_pronamic_gateway_' . $this->meta_key_website_key, - 'meta_key' => '_pronamic_gateway_buckaroo_merchant_key', 'title' => __( 'Website Key', 'pronamic_ideal' ), 'type' => 'text', 'classes' => array( 'code' ), From c43a91041649f03af8e8e51660eba75e0d402f08 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Wed, 24 Aug 2022 15:49:08 +0200 Subject: [PATCH 20/38] vendor/bin/phpcbf --- src/CLI.php | 8 +- src/Gateway.php | 162 +++++++++++++++++++------------------ src/Integration.php | 54 ++++++------- src/PaymentMethods.php | 4 +- src/PushController.php | 22 ++--- src/Util.php | 4 +- tests/src/StatusesTest.php | 28 +++---- tests/src/UtilTest.php | 32 ++++---- 8 files changed, 161 insertions(+), 153 deletions(-) diff --git a/src/CLI.php b/src/CLI.php index 2f6772e..ff06894 100644 --- a/src/CLI.php +++ b/src/CLI.php @@ -48,9 +48,9 @@ public function __construct( $integration ) { function( $args, $assoc_args ) { $this->wp_cli_transaction_status( $args, $assoc_args ); }, - array( + [ 'shortdesc' => 'This returns the status for the provided transaction', - ) + ] ); \WP_CLI::add_command( @@ -58,9 +58,9 @@ function( $args, $assoc_args ) { function( $args, $assoc_args ) { $this->wp_cli_transaction_refund_info( $args, $assoc_args ); }, - array( + [ 'shortdesc' => 'This returns the refund info', - ) + ] ); } diff --git a/src/Gateway.php b/src/Gateway.php index 5f9c9e7..41a8f4a 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -47,13 +47,13 @@ public function __construct( Config $config ) { $this->set_method( self::METHOD_HTTP_REDIRECT ); // Supported features. - $this->supports = array( + $this->supports = [ 'payment_status_request', 'refunds', 'webhook', 'webhook_log', 'webhook_no_config', - ); + ]; // Methods. $ideal_payment_method = new PaymentMethod( Core_PaymentMethods::IDEAL ); @@ -62,12 +62,14 @@ public function __construct( Config $config ) { $ideal_issuer_field->set_required( true ); - $ideal_issuer_field->set_options( new CachedCallbackOptions( - function() { - return $this->get_ideal_issuers(); - }, - 'pronamic_pay_ideal_issuers_' . \md5( \wp_json_encode( $config ) ) - ) ); + $ideal_issuer_field->set_options( + new CachedCallbackOptions( + function() { + return $this->get_ideal_issuers(); + }, + 'pronamic_pay_ideal_issuers_' . \md5( \wp_json_encode( $config ) ) + ) + ); $ideal_payment_method->add_field( $ideal_issuer_field ); @@ -107,14 +109,20 @@ private function get_ideal_issuers() { $groups = []; - $actions_pay = \array_filter( $object->Actions, function( $action ) { - return 'Pay' === $action->Name; - } ); + $actions_pay = \array_filter( + $object->Actions, + function( $action ) { + return 'Pay' === $action->Name; + } + ); foreach ( $actions_pay as $action ) { - $request_parameters = \array_filter( $action->RequestParameters, function( $request_parameter ) { - return 'issuer' === $request_parameter->Name; - } ); + $request_parameters = \array_filter( + $action->RequestParameters, + function( $request_parameter ) { + return 'issuer' === $request_parameter->Name; + } + ); foreach ( $request_parameters as $request_parameter ) { foreach ( $request_parameter->ListItemDescriptions as $item ) { @@ -164,7 +172,7 @@ public function start( Payment $payment ) { * * @link https://testcheckout.buckaroo.nl/json/Docs/Api/POST-json-Transaction */ - $data = (object) array( + $data = (object) [ 'Currency' => $currency_code, /** * The debit amount for the request. This is in decimal format, @@ -218,9 +226,9 @@ public function start( Payment $payment ) { * * @link https://dev.buckaroo.nl/Apis */ - 'Services' => (object) array( - 'ServiceList' => array(), - ), + 'Services' => (object) [ + 'ServiceList' => [], + ], /** * Continue On Incomplete. * @@ -260,13 +268,13 @@ public function start( Payment $payment ) { * * @link https://testcheckout.buckaroo.nl/json/Docs/Api/POST-json-Transaction */ - 'CustomParameters' => array( - (object) array( + 'CustomParameters' => [ + (object) [ 'Name' => 'pronamic_payment_id', 'Value' => $payment->get_id(), - ), - ), - ); + ], + ], + ]; /** * Client IP. @@ -290,10 +298,10 @@ public function start( Payment $payment ) { $ip_address = $customer->get_ip_address(); if ( null !== $ip_address ) { - $data->ClientIP = (object) array( + $data->ClientIP = (object) [ 'Type' => false === \strpos( $ip_address, ':' ) ? 0 : 1, 'Address' => $ip_address, - ); + ]; } } @@ -311,10 +319,10 @@ public function start( Payment $payment ) { * @link */ case Core_PaymentMethods::AMERICAN_EXPRESS: - $data->Services->ServiceList[] = (object) array( + $data->Services->ServiceList[] = (object) [ 'Action' => 'Pay', 'Name' => PaymentMethods::AMERICAN_EXPRESS, - ); + ]; break; /** @@ -323,25 +331,25 @@ public function start( Payment $payment ) { * @link https://dev.buckaroo.nl/PaymentMethods/Description/creditcards#pay */ case Core_PaymentMethods::CREDIT_CARD: - $data->Services->ServiceList[] = (object) array( + $data->Services->ServiceList[] = (object) [ 'Action' => 'Pay', 'Name' => PaymentMethods::AMERICAN_EXPRESS, - ); + ]; - $data->Services->ServiceList[] = (object) array( + $data->Services->ServiceList[] = (object) [ 'Action' => 'Pay', 'Name' => PaymentMethods::MAESTRO, - ); + ]; - $data->Services->ServiceList[] = (object) array( + $data->Services->ServiceList[] = (object) [ 'Action' => 'Pay', 'Name' => PaymentMethods::MASTERCARD, - ); + ]; - $data->Services->ServiceList[] = (object) array( + $data->Services->ServiceList[] = (object) [ 'Action' => 'Pay', 'Name' => PaymentMethods::VISA, - ); + ]; break; /** @@ -350,16 +358,16 @@ public function start( Payment $payment ) { * @link https://dev.buckaroo.nl/PaymentMethods/Description/ideal#pay */ case Core_PaymentMethods::IDEAL: - $data->Services->ServiceList[] = (object) array( + $data->Services->ServiceList[] = (object) [ 'Action' => 'Pay', 'Name' => 'ideal', - 'Parameters' => array( - array( + 'Parameters' => [ + [ 'Name' => 'issuer', 'Value' => $payment->get_meta( 'issuer' ), - ), - ), - ); + ], + ], + ]; break; /** @@ -368,10 +376,10 @@ public function start( Payment $payment ) { * @link https://dev.buckaroo.nl/PaymentMethods/Description/transfer#pay */ case Core_PaymentMethods::BANK_TRANSFER: - $data->Services->ServiceList[] = (object) array( + $data->Services->ServiceList[] = (object) [ 'Action' => 'Pay', 'Name' => 'transfer', - ); + ]; break; /** @@ -381,10 +389,10 @@ public function start( Payment $payment ) { */ case Core_PaymentMethods::BANCONTACT: case Core_PaymentMethods::MISTER_CASH: - $data->Services->ServiceList[] = (object) array( + $data->Services->ServiceList[] = (object) [ 'Action' => 'Pay', 'Name' => 'bancontactmrcash', - ); + ]; break; /** @@ -393,10 +401,10 @@ public function start( Payment $payment ) { * @link */ case Core_PaymentMethods::MAESTRO: - $data->Services->ServiceList[] = (object) array( + $data->Services->ServiceList[] = (object) [ 'Action' => 'Pay', 'Name' => PaymentMethods::MAESTRO, - ); + ]; break; /** @@ -405,10 +413,10 @@ public function start( Payment $payment ) { * @link */ case Core_PaymentMethods::MASTERCARD: - $data->Services->ServiceList[] = (object) array( + $data->Services->ServiceList[] = (object) [ 'Action' => 'Pay', 'Name' => PaymentMethods::MASTERCARD, - ); + ]; break; /** @@ -417,10 +425,10 @@ public function start( Payment $payment ) { * @link https://dev.buckaroo.nl/PaymentMethods/Description/giropay#pay */ case Core_PaymentMethods::GIROPAY: - $data->Services->ServiceList[] = (object) array( + $data->Services->ServiceList[] = (object) [ 'Action' => 'Pay', 'Name' => 'giropay', - ); + ]; break; /** @@ -429,10 +437,10 @@ public function start( Payment $payment ) { * @link https://dev.buckaroo.nl/PaymentMethods/Description/paypal#pay */ case Core_PaymentMethods::PAYPAL: - $data->Services->ServiceList[] = (object) array( + $data->Services->ServiceList[] = (object) [ 'Action' => 'Pay', 'Name' => 'paypal', - ); + ]; break; /** @@ -441,10 +449,10 @@ public function start( Payment $payment ) { * @link https://dev.buckaroo.nl/PaymentMethods/Description/sofort#pay */ case Core_PaymentMethods::SOFORT: - $data->Services->ServiceList[] = (object) array( + $data->Services->ServiceList[] = (object) [ 'Action' => 'Pay', 'Name' => 'sofortueberweisung', - ); + ]; break; /** @@ -453,10 +461,10 @@ public function start( Payment $payment ) { * @link https://dev.buckaroo.nl/PaymentMethods/Description/creditcards#top */ case Core_PaymentMethods::V_PAY: - $data->Services->ServiceList[] = (object) array( + $data->Services->ServiceList[] = (object) [ 'Action' => 'Pay', 'Name' => PaymentMethods::V_PAY, - ); + ]; break; /** @@ -465,10 +473,10 @@ public function start( Payment $payment ) { * @link https://dev.buckaroo.nl/PaymentMethods/Description/creditcards#top */ case Core_PaymentMethods::VISA: - $data->Services->ServiceList[] = (object) array( + $data->Services->ServiceList[] = (object) [ 'Action' => 'Pay', 'Name' => PaymentMethods::VISA, - ); + ]; break; } @@ -579,7 +587,7 @@ public function request( $method, $endpoint, $data = null ) { $values = \implode( '', - array( + [ $website_key, $request_http_method, \strtolower( \rawurlencode( $request_uri ) ), @@ -587,7 +595,7 @@ public function request( $method, $endpoint, $data = null ) { $nonce, // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode null === $data ? '' : \base64_encode( \md5( (string) $request_content, true ) ), - ) + ] ); $hash = \hash_hmac( 'sha256', $values, (string) $this->config->secret_key, true ); @@ -605,14 +613,14 @@ public function request( $method, $endpoint, $data = null ) { $response = \Pronamic\WordPress\Http\Facades\Http::request( 'https://' . $request_uri, - array( + [ 'method' => $request_http_method, - 'headers' => array( + 'headers' => [ 'Authorization' => $authorization, 'Content-Type' => 'application/json', - ), + ], 'body' => $request_content, - ) + ] ); try { @@ -684,7 +692,7 @@ public function update_status( Payment $payment ) { if ( \in_array( $parameter->Name, - array( + [ /** * Payment method iDEAL. * @@ -697,7 +705,7 @@ public function update_status( Payment $payment ) { * @link https://dev.buckaroo.nl/PaymentMethods/Description/sofort */ 'CustomerIBAN', - ), + ], true ) ) { $consumer_bank_details->set_iban( $parameter->Value ); @@ -705,7 +713,7 @@ public function update_status( Payment $payment ) { if ( \in_array( $parameter->Name, - array( + [ /** * Payment method iDEAL. * @@ -718,7 +726,7 @@ public function update_status( Payment $payment ) { * @link https://dev.buckaroo.nl/PaymentMethods/Description/sofort */ 'CustomerBIC', - ), + ], true ) ) { $consumer_bank_details->set_bic( $parameter->Value ); @@ -790,7 +798,7 @@ public function create_refund( $transaction_id, Money $amount, $description = nu } // Refund request. - $data = (object) array( + $data = (object) [ 'Channel' => 'Web', 'Currency' => $amount->get_currency()->get_alphabetic_code(), /** @@ -806,15 +814,15 @@ public function create_refund( $transaction_id, Money $amount, $description = nu 'AmountCredit' => $amount->number_format( null, '.', '' ), 'Invoice' => $invoice, 'OriginalTransactionKey' => $transaction_id, - 'Services' => array( - 'ServiceList' => array( - array( + 'Services' => [ + 'ServiceList' => [ + [ 'Name' => $service_name, 'Action' => 'Refund', - ), - ), - ), - ); + ], + ], + ], + ]; $refund = $this->request( 'POST', 'Transaction', $data ); diff --git a/src/Integration.php b/src/Integration.php index de34ef5..4c9e046 100644 --- a/src/Integration.php +++ b/src/Integration.php @@ -34,25 +34,25 @@ class Integration extends AbstractGatewayIntegration { * * @param array> $args Arguments. */ - public function __construct( $args = array() ) { + public function __construct( $args = [] ) { $args = wp_parse_args( $args, [ - 'id' => 'buckaroo', - 'name' => 'Buckaroo', - 'host' => 'checkout.buckaroo.nl', - 'url' => 'https://plaza.buckaroo.nl/', - 'product_url' => \__( 'http://www.buckaroo-payments.com', 'pronamic_ideal' ), - 'dashboard_url' => 'https://plaza.buckaroo.nl/', - 'provider' => 'buckaroo', - 'supports' => [ + 'id' => 'buckaroo', + 'name' => 'Buckaroo', + 'host' => 'checkout.buckaroo.nl', + 'url' => 'https://plaza.buckaroo.nl/', + 'product_url' => \__( 'http://www.buckaroo-payments.com', 'pronamic_ideal' ), + 'dashboard_url' => 'https://plaza.buckaroo.nl/', + 'provider' => 'buckaroo', + 'supports' => [ 'payment_status_request', 'refunds', 'webhook', 'webhook_log', 'webhook_no_config', ], - 'manual_url' => \__( 'https://www.pronamic.eu/support/how-to-connect-buckaroo-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ), + 'manual_url' => \__( 'https://www.pronamic.eu/support/how-to-connect-buckaroo-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ), 'meta_key_website_key' => 'buckaroo_website_key', 'meta_key_secret_key' => 'buckaroo_secret_key', ] @@ -81,7 +81,7 @@ public function __construct( $args = array() ) { public function setup() { \add_filter( 'pronamic_gateway_configuration_display_value_' . $this->get_id(), - array( $this, 'gateway_configuration_display_value' ), + [ $this, 'gateway_configuration_display_value' ], 10, 2 ); @@ -115,55 +115,55 @@ public function get_settings_fields() { $config = $this->get_config( $post->ID ); - $fields = array(); + $fields = []; // Website Key. - $fields[] = array( + $fields[] = [ 'section' => 'general', 'filter' => FILTER_SANITIZE_STRING, 'meta_key' => '_pronamic_gateway_' . $this->meta_key_website_key, 'title' => __( 'Website Key', 'pronamic_ideal' ), 'type' => 'text', - 'classes' => array( 'code' ), + 'classes' => [ 'code' ], 'tooltip' => __( 'Website key as mentioned in the Buckaroo dashboard on the page "Profile » Website".', 'pronamic_ideal' ), 'default' => $config->get_website_key(), - ); + ]; // Secret Key. - $fields[] = array( + $fields[] = [ 'section' => 'general', 'filter' => FILTER_SANITIZE_STRING, 'meta_key' => '_pronamic_gateway_' . $this->meta_key_secret_key, 'title' => __( 'Secret Key', 'pronamic_ideal' ), 'type' => 'text', - 'classes' => array( 'regular-text', 'code' ), + 'classes' => [ 'regular-text', 'code' ], 'tooltip' => __( 'Secret key as mentioned in the Buckaroo dashboard on the page "Configuration » Secret Key for Digital Signature".', 'pronamic_ideal' ), 'default' => $config->get_secret_key(), - ); + ]; // Excluded services. - $fields[] = array( + $fields[] = [ 'section' => 'advanced', 'filter' => FILTER_SANITIZE_STRING, 'meta_key' => '_pronamic_gateway_buckaroo_excluded_services', 'title' => __( 'Excluded services', 'pronamic_ideal' ), 'type' => 'text', - 'classes' => array( 'regular-text', 'code' ), + 'classes' => [ 'regular-text', 'code' ], 'tooltip' => sprintf( /* translators: %s: brq_parameter */ __( 'This controls the Buckaroo %s parameter.', 'pronamic_ideal' ), sprintf( '%s', 'brq_exludedservices' ) ), - ); + ]; // Invoice number. - $fields[] = array( + $fields[] = [ 'section' => 'advanced', 'filter' => FILTER_SANITIZE_STRING, 'meta_key' => '_pronamic_gateway_buckaroo_invoice_number', 'title' => __( 'Invoice number', 'pronamic_ideal' ), 'type' => 'text', - 'classes' => array( 'regular-text', 'code' ), + 'classes' => [ 'regular-text', 'code' ], 'tooltip' => sprintf( /* translators: %s: brq_parameter */ __( 'This controls the Buckaroo %s parameter.', 'pronamic_ideal' ), @@ -176,18 +176,18 @@ public function get_settings_fields() { /* translators: %s: default code */ sprintf( __( 'Default: %s', 'pronamic_ideal' ), '{payment_id}' ) ), - ); + ]; // Push URL. - $fields[] = array( + $fields[] = [ 'section' => 'feedback', 'title' => __( 'Push URL', 'pronamic_ideal' ), 'type' => 'text', - 'classes' => array( 'large-text', 'code' ), + 'classes' => [ 'large-text', 'code' ], 'value' => \rest_url( self::REST_ROUTE_NAMESPACE . '/push' ), 'readonly' => true, 'tooltip' => __( 'The Push URL as sent with each transaction to receive automatic payment status updates on.', 'pronamic_ideal' ), - ); + ]; return $fields; } diff --git a/src/PaymentMethods.php b/src/PaymentMethods.php index d3787da..6ea58c9 100644 --- a/src/PaymentMethods.php +++ b/src/PaymentMethods.php @@ -125,7 +125,7 @@ class PaymentMethods { * * @var array */ - private static $map = array( + private static $map = [ Core_PaymentMethods::AMERICAN_EXPRESS => self::AMERICAN_EXPRESS, Core_PaymentMethods::BANK_TRANSFER => self::TRANSFER, Core_PaymentMethods::BANCONTACT => self::BANCONTACT_MISTER_CASH, @@ -138,7 +138,7 @@ class PaymentMethods { Core_PaymentMethods::SOFORT => self::SOFORTUEBERWEISING, Core_PaymentMethods::V_PAY => self::V_PAY, Core_PaymentMethods::VISA => self::VISA, - ); + ]; /** * Transform WordPress payment method to Buckaroo method. diff --git a/src/PushController.php b/src/PushController.php index c14c9dd..c76d284 100644 --- a/src/PushController.php +++ b/src/PushController.php @@ -27,9 +27,9 @@ class PushController { * @return void */ public function setup() { - \add_action( 'rest_api_init', array( $this, 'rest_api_init' ) ); + \add_action( 'rest_api_init', [ $this, 'rest_api_init' ] ); - \add_action( 'wp_loaded', array( $this, 'wp_loaded' ) ); + \add_action( 'wp_loaded', [ $this, 'wp_loaded' ] ); } /** @@ -43,14 +43,14 @@ public function rest_api_init() { \register_rest_route( Integration::REST_ROUTE_NAMESPACE, '/push', - array( - 'methods' => array( + [ + 'methods' => [ 'GET', 'POST', - ), - 'callback' => array( $this, 'rest_api_buckaroo_push' ), + ], + 'callback' => [ $this, 'rest_api_buckaroo_push' ], 'permission_callback' => '__return_true', - ) + ] ); } @@ -78,7 +78,7 @@ public function rest_api_buckaroo_push( \WP_REST_Request $request ) { 'Unknown Buckaroo push request content type: %s.', (string) $request->get_header( 'Content-Type' ) ), - array( 'status' => 500 ) + [ 'status' => 500 ] ); } @@ -160,7 +160,7 @@ private function handle_transaction_key( $transaction_key ) { \__( 'Unable to find payment for transaction key: %s.', 'pronamic_ideal ' ), $transaction_key ), - array( 'status' => 400 ) + [ 'status' => 400 ] ); } @@ -180,10 +180,10 @@ private function handle_transaction_key( $transaction_key ) { Plugin::update_payment( $payment, false ); return \rest_ensure_response( - array( + [ 'success' => true, 'transaction_key' => $transaction_key, - ) + ] ); } diff --git a/src/Util.php b/src/Util.php index abbf6bd..cb74b04 100644 --- a/src/Util.php +++ b/src/Util.php @@ -25,10 +25,10 @@ class Util { */ public static function get_invoice_number( $invoice_number, Payment $payment ) { // Replacements definition - $replacements = array( + $replacements = [ '{order_id}' => $payment->get_order_id(), '{payment_id}' => $payment->get_id(), - ); + ]; // Find and replace $invoice_number = str_replace( diff --git a/tests/src/StatusesTest.php b/tests/src/StatusesTest.php index f915719..1af5110 100644 --- a/tests/src/StatusesTest.php +++ b/tests/src/StatusesTest.php @@ -43,24 +43,24 @@ public function test_transform( $buckaroo_status, $expected ) { * @return array */ public function transform_provider() { - return array( + return [ // Success. - array( Statuses::PAYMENT_SUCCESS, Core_Statuses::SUCCESS ), + [ Statuses::PAYMENT_SUCCESS, Core_Statuses::SUCCESS ], // Failure. - array( Statuses::PAYMENT_FAILURE, Core_Statuses::FAILURE ), - array( Statuses::VALIDATION_FAILURE, Core_Statuses::FAILURE ), - array( Statuses::TECHNICAL_ERROR, Core_Statuses::FAILURE ), - array( Statuses::PAYMENT_REJECTED, Core_Statuses::FAILURE ), + [ Statuses::PAYMENT_FAILURE, Core_Statuses::FAILURE ], + [ Statuses::VALIDATION_FAILURE, Core_Statuses::FAILURE ], + [ Statuses::TECHNICAL_ERROR, Core_Statuses::FAILURE ], + [ Statuses::PAYMENT_REJECTED, Core_Statuses::FAILURE ], // Open. - array( Statuses::WAITING_FOR_USER_INPUT, Core_Statuses::OPEN ), - array( Statuses::WAITING_FOR_PROCESSOR, Core_Statuses::OPEN ), - array( Statuses::WAITING_ON_CONSUMER_ACTION, Core_Statuses::OPEN ), - array( Statuses::PAYMENT_ON_HOLD, Core_Statuses::OPEN ), + [ Statuses::WAITING_FOR_USER_INPUT, Core_Statuses::OPEN ], + [ Statuses::WAITING_FOR_PROCESSOR, Core_Statuses::OPEN ], + [ Statuses::WAITING_ON_CONSUMER_ACTION, Core_Statuses::OPEN ], + [ Statuses::PAYMENT_ON_HOLD, Core_Statuses::OPEN ], // Cancelled. - array( Statuses::CANCELLED_BY_CONSUMER, Core_Statuses::CANCELLED ), - array( Statuses::CANCELLED_BY_MERCHANT, Core_Statuses::CANCELLED ), + [ Statuses::CANCELLED_BY_CONSUMER, Core_Statuses::CANCELLED ], + [ Statuses::CANCELLED_BY_MERCHANT, Core_Statuses::CANCELLED ], // Other. - array( 'not existing status', null ), - ); + [ 'not existing status', null ], + ]; } } diff --git a/tests/src/UtilTest.php b/tests/src/UtilTest.php index dc7554b..c411a60 100644 --- a/tests/src/UtilTest.php +++ b/tests/src/UtilTest.php @@ -34,14 +34,14 @@ public function test_get_invoice_number( $payment_id, $order_id, $invoice_number * @return array[] */ public function invoice_number_provider() { - return array( - array( 99, 12345, 'invoice', 'invoice99' ), - array( 99, 12345, '{payment_id}', '99' ), - array( 99, null, '{order_id}', '' ), - array( 99, 12345, '{order_id}', '12345' ), - array( 99, 12345, 'INV{order_id}', 'INV12345' ), - array( 99, 12345, '{payment_id}-{order_id}', '99-12345' ), - ); + return [ + [ 99, 12345, 'invoice', 'invoice99' ], + [ 99, 12345, '{payment_id}', '99' ], + [ 99, null, '{order_id}', '' ], + [ 99, 12345, '{order_id}', '12345' ], + [ 99, 12345, 'INV{order_id}', 'INV12345' ], + [ 99, 12345, '{payment_id}-{order_id}', '99-12345' ], + ]; } /** @@ -52,15 +52,15 @@ public function invoice_number_provider() { */ public function test_get_transaction_service( $service ) { // Build transaction. - $services = array( (object) array() ); + $services = [ (object) [] ]; if ( null !== $service ) { - $services[] = (object) array( 'Name' => $service ); + $services[] = (object) [ 'Name' => $service ]; } - $transaction = (object) array( + $transaction = (object) [ 'Services' => $services, - ); + ]; // Assertion. $this->assertEquals( $service, Util::get_transaction_service( $transaction ) ); @@ -72,9 +72,9 @@ public function test_get_transaction_service( $service ) { * @return array[] */ public function transaction_service_provider() { - return array( - array( 'ideal' ), - array( null ), - ); + return [ + [ 'ideal' ], + [ null ], + ]; } } From 4a47d9eefa0ae0243c97d3dd0e8c0e29c89f36f1 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 25 Aug 2022 13:20:55 +0200 Subject: [PATCH 21/38] Update Gateway.php --- src/Gateway.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Gateway.php b/src/Gateway.php index 41a8f4a..e5dfb4d 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -40,7 +40,7 @@ class Gateway extends Core_Gateway { * @param Config $config Config. */ public function __construct( Config $config ) { - parent::__construct( $config ); + parent::__construct(); $this->config = $config; From 0a0aea46346983971223992acd4f70e6ace743db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Thu, 1 Sep 2022 17:00:42 +0200 Subject: [PATCH 22/38] Remove void payment method. --- src/Gateway.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Gateway.php b/src/Gateway.php index e5dfb4d..c79413c 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -85,7 +85,6 @@ function() { $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::SOFORT ) ); $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::V_PAY ) ); $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::VISA ) ); - $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::VOID ) ); } /** From f18485955c5758cf7bde5468de34586f55a9a98f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Fri, 2 Sep 2022 15:26:46 +0200 Subject: [PATCH 23/38] Fix "Notice: Trying to get property 'ID' of non-object". --- src/Integration.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Integration.php b/src/Integration.php index 4c9e046..bba0c8b 100644 --- a/src/Integration.php +++ b/src/Integration.php @@ -3,6 +3,7 @@ namespace Pronamic\WordPress\Pay\Gateways\Buckaroo; use Pronamic\WordPress\Pay\AbstractGatewayIntegration; +use WP_Post; /** * Title: Buckaroo integration @@ -113,12 +114,12 @@ public function gateway_configuration_display_value( $display_value, $post_id ) public function get_settings_fields() { global $post; - $config = $this->get_config( $post->ID ); + $config = ( $post instanceof WP_Post ) ? $this->get_config( $post->ID ) : null; $fields = []; // Website Key. - $fields[] = [ + $fields[] = [ 'section' => 'general', 'filter' => FILTER_SANITIZE_STRING, 'meta_key' => '_pronamic_gateway_' . $this->meta_key_website_key, @@ -126,7 +127,7 @@ public function get_settings_fields() { 'type' => 'text', 'classes' => [ 'code' ], 'tooltip' => __( 'Website key as mentioned in the Buckaroo dashboard on the page "Profile » Website".', 'pronamic_ideal' ), - 'default' => $config->get_website_key(), + 'default' => null === $config ? '' : $config->get_website_key(), ]; // Secret Key. @@ -138,7 +139,7 @@ public function get_settings_fields() { 'type' => 'text', 'classes' => [ 'regular-text', 'code' ], 'tooltip' => __( 'Secret key as mentioned in the Buckaroo dashboard on the page "Configuration » Secret Key for Digital Signature".', 'pronamic_ideal' ), - 'default' => $config->get_secret_key(), + 'default' => null === $config ? '' : $config->get_secret_key(), ]; // Excluded services. From 612e8504b4b34dcbd6c68c96d643285494cd3ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Fri, 2 Sep 2022 15:28:21 +0200 Subject: [PATCH 24/38] Website Key and Secret Key setting fields are required. --- src/Integration.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Integration.php b/src/Integration.php index bba0c8b..5a19bc9 100644 --- a/src/Integration.php +++ b/src/Integration.php @@ -128,6 +128,7 @@ public function get_settings_fields() { 'classes' => [ 'code' ], 'tooltip' => __( 'Website key as mentioned in the Buckaroo dashboard on the page "Profile » Website".', 'pronamic_ideal' ), 'default' => null === $config ? '' : $config->get_website_key(), + 'required' => true, ]; // Secret Key. @@ -140,6 +141,7 @@ public function get_settings_fields() { 'classes' => [ 'regular-text', 'code' ], 'tooltip' => __( 'Secret key as mentioned in the Buckaroo dashboard on the page "Configuration » Secret Key for Digital Signature".', 'pronamic_ideal' ), 'default' => null === $config ? '' : $config->get_secret_key(), + 'required' => true, ]; // Excluded services. From a78450f343f4065e2b82410285af5dbc95ddfb86 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 5 Sep 2022 15:45:55 +0200 Subject: [PATCH 25/38] Improve exception handling. --- src/Gateway.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Gateway.php b/src/Gateway.php index c79413c..fea48dd 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -90,20 +90,22 @@ function() { /** * Get iDEAL issuers. * + * @link https://dev.buckaroo.nl/Playground * @since 1.2.4 * @return iterable */ private function get_ideal_issuers() { - // Check non-empty keys in configuration. - if ( empty( $this->config->website_key ) || empty( $this->config->secret_key ) ) { - return []; - } - // Get iDEAL issuers. $object = $this->request( 'GET', 'Transaction/Specification/ideal?serviceVersion=2' ); - if ( ! \property_exists( $object, 'Actions' ) ) { - return []; + if ( 0 === $object->Version ) { + throw new \Exception( + \sprintf( + 'No versioned specification found for iDEAL payment method: version: "%s", name: "%s".', + $object->Version, + $object->Name + ) + ); } $groups = []; From acffb9dca0265a4c8c9aefe8b46e941f1aed0b74 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 19 Sep 2022 14:06:16 +0200 Subject: [PATCH 26/38] Add wp-env. --- .wp-env.json | 14 ++++++++++++++ package.json | 8 ++++++++ 2 files changed, 22 insertions(+) create mode 100644 .wp-env.json diff --git a/.wp-env.json b/.wp-env.json new file mode 100644 index 0000000..3be6550 --- /dev/null +++ b/.wp-env.json @@ -0,0 +1,14 @@ +{ + "core": null, + "plugins": [ + ".", + "../../../", + "pronamic/wp-pronamic-pay-test-helper", + "https://downloads.wordpress.org/plugin/pronamic-client.zip", + "https://downloads.wordpress.org/plugin/query-monitor.zip", + "https://downloads.wordpress.org/plugin/one-time-login.zip" + ], + "config": { + "PRONAMIC_PAY_DEBUG": true + } +} diff --git a/package.json b/package.json index 80f9f0a..2276918 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ }, "homepage": "http://www.wp-pay.org/gateways/buckaroo/", "devDependencies": { + "@wordpress/env": "^5.2.0", "grunt": "^1.0.4", "grunt-contrib-jshint": "^2.1.0", "grunt-phpcs": "^0.4.0", @@ -39,5 +40,12 @@ "grunt-phpmd": "^0.1.1", "grunt-phpunit": "^0.3.6", "load-grunt-tasks": "^5.1.0" + }, + "scripts": { + "start": "wp-env start && npm run setup && npm run login", + "setup": "npm-run-all setup-*", + "setup-buckaroo-website-key": "wp-env run cli wp config set BUCKAROO_WEBSITE_KEY $BUCKAROO_WEBSITE_KEY", + "setup-buckaroo-secret-key": "wp-env run cli wp config set BUCKAROO_SECRET_KEY $BUCKAROO_SECRET_KEY", + "login": "wp-env run cli wp user one-time-login admin" } } From 24a014ad6c7294ed7ee53891956c420c33324a7c Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 19 Sep 2022 14:54:46 +0200 Subject: [PATCH 27/38] Update to pronamic/wp-coding-standards 1.2. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d2b5574..ccd152c 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,7 @@ "php-coveralls/php-coveralls": "^2.4", "phpmd/phpmd": "^2.7", "phpunit/phpunit": "^5.7 || ^6.0", - "pronamic/wp-coding-standards": "^1.0", + "pronamic/wp-coding-standards": "^1.2", "roots/wordpress": "^5.8", "wp-cli/wp-cli": "^2.3", "wp-phpunit/wp-phpunit": "^5.8", From 5de3f836cee335adb4dc7517dcc0e6bf82799000 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 19 Sep 2022 14:54:56 +0200 Subject: [PATCH 28/38] Improve wp-env. --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 2276918..c872d09 100644 --- a/package.json +++ b/package.json @@ -39,10 +39,11 @@ "grunt-phplint": "0.1.0", "grunt-phpmd": "^0.1.1", "grunt-phpunit": "^0.3.6", + "npm-run-all": "^4.1.5", "load-grunt-tasks": "^5.1.0" }, "scripts": { - "start": "wp-env start && npm run setup && npm run login", + "start": "wp-env start --xdebug && npm run setup && npm run login", "setup": "npm-run-all setup-*", "setup-buckaroo-website-key": "wp-env run cli wp config set BUCKAROO_WEBSITE_KEY $BUCKAROO_WEBSITE_KEY", "setup-buckaroo-secret-key": "wp-env run cli wp config set BUCKAROO_SECRET_KEY $BUCKAROO_SECRET_KEY", From 5a0be38fc5de41d452e8236a2080042c98049218 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 19 Sep 2022 14:55:01 +0200 Subject: [PATCH 29/38] Create pronamic-pay-buckaroo.php --- pronamic-pay-buckaroo.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 pronamic-pay-buckaroo.php diff --git a/pronamic-pay-buckaroo.php b/pronamic-pay-buckaroo.php new file mode 100644 index 0000000..92478bc --- /dev/null +++ b/pronamic-pay-buckaroo.php @@ -0,0 +1,26 @@ + + * @copyright 2005-2022 Pronamic + * @license GPL-3.0-or-later + * @package Pronamic\WordPress\Pay\Gateways\Buckaroo + */ From 5de0c8f238de665f861404b930c3cc6697d9f777 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 19 Sep 2022 14:56:09 +0200 Subject: [PATCH 30/38] Introduce a `from_buckaroo_to_pronamic( $method )` function. --- src/PaymentMethods.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/PaymentMethods.php b/src/PaymentMethods.php index 6ea58c9..a448041 100644 --- a/src/PaymentMethods.php +++ b/src/PaymentMethods.php @@ -161,4 +161,20 @@ public static function transform( $payment_method, $default = null ) { return $default; } + + /** + * Convert method from Buckaroo indicator to a Pronamic indicator. + * + * @param string $method Method. + * @return string|null + */ + public static function from_buckaroo_to_pronamic( $method ) { + $key = \array_search( $method, self::$map ); + + if ( false === $key ) { + return null; + } + + return $key; + } } From d1502de547686813e82bb50bef65e0974a05ef59 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 19 Sep 2022 14:56:18 +0200 Subject: [PATCH 31/38] vendor/bin/phpcbf --- src/Integration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Integration.php b/src/Integration.php index 5a19bc9..fe7e6f3 100644 --- a/src/Integration.php +++ b/src/Integration.php @@ -119,7 +119,7 @@ public function get_settings_fields() { $fields = []; // Website Key. - $fields[] = [ + $fields[] = [ 'section' => 'general', 'filter' => FILTER_SANITIZE_STRING, 'meta_key' => '_pronamic_gateway_' . $this->meta_key_website_key, From 3210cf5062dcdb98c14f0c79b9107db5aca4e6c8 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 19 Sep 2022 14:56:36 +0200 Subject: [PATCH 32/38] Enrich payment methods. --- src/Gateway.php | 102 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 84 insertions(+), 18 deletions(-) diff --git a/src/Gateway.php b/src/Gateway.php index fea48dd..71efe8c 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -7,6 +7,7 @@ use Pronamic\WordPress\Pay\Core\Gateway as Core_Gateway; use Pronamic\WordPress\Pay\Core\PaymentMethod; use Pronamic\WordPress\Pay\Core\PaymentMethods as Core_PaymentMethods; +use Pronamic\WordPress\Pay\Core\PaymentMethodsCollection; use Pronamic\WordPress\Pay\Core\SelectField; use Pronamic\WordPress\Pay\Fields\CachedCallbackOptions; use Pronamic\WordPress\Pay\Fields\IDealIssuerSelectField; @@ -87,6 +88,59 @@ function() { $this->register_payment_method( new PaymentMethod( Core_PaymentMethods::VISA ) ); } + /** + * Get payment methods. + * + * @param array $args Query arguments. + * @return PaymentMethodsCollection + */ + public function get_payment_methods( array $args = [] ) : PaymentMethodsCollection { + try { + $this->maybe_enrich_payment_methods(); + } catch ( \Exception $e ) { + // No problem. + } + + return parent::get_payment_methods( $args ); + } + + /** + * Maybe enrich payment methods. + * + * @return void + */ + private function maybe_enrich_payment_methods() { + $cache_key = 'pronamic_pay_buckaroo_transaction_specifications_' . \md5( \wp_json_encode( $this->config ) ); + + $buckaroo_transaction_specifications = \get_transient( $cache_key ); + + if ( false === $buckaroo_transaction_specifications ) { + $buckaroo_transaction_specifications = $this->request_transaction_specifications(); + + \set_transient( $cache_key, $buckaroo_transaction_specifications, \DAY_IN_SECONDS ); + } + + foreach ( $this->payment_methods as $payment_method ) { + $payment_method->set_status( 'inactive' ); + } + + foreach ( $buckaroo_transaction_specifications->Services as $service ) { + $payment_method_id = PaymentMethods::from_buckaroo_to_pronamic( $service->Name ); + + if ( null === $payment_method_id ) { + continue; + } + + $payment_method = $this->get_payment_method( $payment_method_id ); + + if ( null === $payment_method ) { + continue; + } + + $payment_method->set_status( 'active' ); + } + } + /** * Get iDEAL issuers. * @@ -139,6 +193,19 @@ function( $request_parameter ) { return array_values( $groups ); } + /** + * Request transaction specifications. + * + * @link https://github.com/search?q=org%3Abuckaroo-it+specifications&type=code + * @link https://dev.buckaroo.nl/Playground + * @return object + */ + private function request_transaction_specifications() { + $object = $this->request( 'POST', 'Transaction/Specifications', (object) [] ); + + return $object; + } + /** * Start * @@ -332,25 +399,24 @@ public function start( Payment $payment ) { * @link https://dev.buckaroo.nl/PaymentMethods/Description/creditcards#pay */ case Core_PaymentMethods::CREDIT_CARD: - $data->Services->ServiceList[] = (object) [ - 'Action' => 'Pay', - 'Name' => PaymentMethods::AMERICAN_EXPRESS, - ]; - - $data->Services->ServiceList[] = (object) [ - 'Action' => 'Pay', - 'Name' => PaymentMethods::MAESTRO, - ]; - - $data->Services->ServiceList[] = (object) [ - 'Action' => 'Pay', - 'Name' => PaymentMethods::MASTERCARD, - ]; + $payment_methods = $this->get_payment_methods( + [ + 'id' => [ + PaymentMethods::AMERICAN_EXPRESS, + PaymentMethods::MAESTRO, + PaymentMethods::MASTERCARD, + PaymentMethods::VISA, + ], + 'status' => 'active', + ] + ); - $data->Services->ServiceList[] = (object) [ - 'Action' => 'Pay', - 'Name' => PaymentMethods::VISA, - ]; + foreach ( $payment_methods as $payment_method ) { + $data->Services->ServiceList[] = (object) [ + 'Action' => 'Pay', + 'Name' => PaymentMethods::transform( $payment_method->get_id() ), + ]; + } break; /** From 3dc95e8da5681621aac7dbe6ec9c7d1c5f9abe79 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 19 Sep 2022 15:06:43 +0200 Subject: [PATCH 33/38] Update Gateway.php --- src/Gateway.php | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/src/Gateway.php b/src/Gateway.php index 71efe8c..6e405f4 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -104,6 +104,20 @@ public function get_payment_methods( array $args = [] ) : PaymentMethodsCollecti return parent::get_payment_methods( $args ); } + /** + * Get credit card payment methods. + * + * @return string[] + */ + private function get_credit_card_payment_methods() { + return [ + Core_PaymentMethods::AMERICAN_EXPRESS, + Core_PaymentMethods::MAESTRO, + Core_PaymentMethods::MASTERCARD, + Core_PaymentMethods::VISA, + ]; + } + /** * Maybe enrich payment methods. * @@ -139,6 +153,24 @@ private function maybe_enrich_payment_methods() { $payment_method->set_status( 'active' ); } + + /** + * Credit card. + */ + $credit_card_payment_methods = parent::get_payment_methods( + [ + 'id' => $this->get_credit_card_payment_methods(), + 'status' => 'active', + ] + ); + + if ( count( $credit_card_payment_methods ) > 0 ) { + $payment_method = $this->get_payment_method( Core_PaymentMethods::CREDIT_CARD ); + + if ( null !== $payment_method ) { + $payment_method->set_status( 'active' ); + } + } } /** @@ -401,12 +433,7 @@ public function start( Payment $payment ) { case Core_PaymentMethods::CREDIT_CARD: $payment_methods = $this->get_payment_methods( [ - 'id' => [ - PaymentMethods::AMERICAN_EXPRESS, - PaymentMethods::MAESTRO, - PaymentMethods::MASTERCARD, - PaymentMethods::VISA, - ], + 'id' => $this->get_credit_card_payment_methods(), 'status' => 'active', ] ); From 42b1ff983641b6c49f223285ae838060f011e7e1 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 19 Sep 2022 15:09:22 +0200 Subject: [PATCH 34/38] Update Gateway.php --- src/Gateway.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Gateway.php b/src/Gateway.php index 6e405f4..94b14bb 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -160,7 +160,7 @@ private function maybe_enrich_payment_methods() { $credit_card_payment_methods = parent::get_payment_methods( [ 'id' => $this->get_credit_card_payment_methods(), - 'status' => 'active', + 'status' => [ '', 'active' ], ] ); @@ -434,7 +434,7 @@ public function start( Payment $payment ) { $payment_methods = $this->get_payment_methods( [ 'id' => $this->get_credit_card_payment_methods(), - 'status' => 'active', + 'status' => [ '', 'active' ], ] ); From 89e72dd25b137bea34416c5e56fa1283e6aef5a9 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 19 Sep 2022 15:33:40 +0200 Subject: [PATCH 35/38] Fix `$result->Services` is `null`. --- src/Gateway.php | 96 +++++++++++++++++++++++++------------------------ 1 file changed, 50 insertions(+), 46 deletions(-) diff --git a/src/Gateway.php b/src/Gateway.php index 94b14bb..963e685 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -778,52 +778,56 @@ public function update_status( Payment $payment ) { * Services. */ if ( \property_exists( $result, 'Services' ) ) { - foreach ( $result->Services as $service ) { - foreach ( $service->Parameters as $parameter ) { - if ( 'consumerName' === $parameter->Name ) { - $consumer_bank_details->set_name( $parameter->Value ); - } - - if ( \in_array( - $parameter->Name, - [ - /** - * Payment method iDEAL. - * - * @link https://dev.buckaroo.nl/PaymentMethods/Description/ideal - */ - 'consumerIBAN', - /** - * Payment method Sofort. - * - * @link https://dev.buckaroo.nl/PaymentMethods/Description/sofort - */ - 'CustomerIBAN', - ], - true - ) ) { - $consumer_bank_details->set_iban( $parameter->Value ); - } - - if ( \in_array( - $parameter->Name, - [ - /** - * Payment method iDEAL. - * - * @link https://dev.buckaroo.nl/PaymentMethods/Description/ideal - */ - 'consumerName', - /** - * Payment method Sofort. - * - * @link https://dev.buckaroo.nl/PaymentMethods/Description/sofort - */ - 'CustomerBIC', - ], - true - ) ) { - $consumer_bank_details->set_bic( $parameter->Value ); + $services = $result->Services; + + if ( null !== $services ) { + foreach ( $services as $service ) { + foreach ( $service->Parameters as $parameter ) { + if ( 'consumerName' === $parameter->Name ) { + $consumer_bank_details->set_name( $parameter->Value ); + } + + if ( \in_array( + $parameter->Name, + [ + /** + * Payment method iDEAL. + * + * @link https://dev.buckaroo.nl/PaymentMethods/Description/ideal + */ + 'consumerIBAN', + /** + * Payment method Sofort. + * + * @link https://dev.buckaroo.nl/PaymentMethods/Description/sofort + */ + 'CustomerIBAN', + ], + true + ) ) { + $consumer_bank_details->set_iban( $parameter->Value ); + } + + if ( \in_array( + $parameter->Name, + [ + /** + * Payment method iDEAL. + * + * @link https://dev.buckaroo.nl/PaymentMethods/Description/ideal + */ + 'consumerName', + /** + * Payment method Sofort. + * + * @link https://dev.buckaroo.nl/PaymentMethods/Description/sofort + */ + 'CustomerBIC', + ], + true + ) ) { + $consumer_bank_details->set_bic( $parameter->Value ); + } } } } From d01cb0e93acdf2137bd1b70c9cf44038635d8480 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 19 Sep 2022 15:39:30 +0200 Subject: [PATCH 36/38] Update Gateway.php --- src/Gateway.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Gateway.php b/src/Gateway.php index 963e685..6580435 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -97,7 +97,7 @@ function() { public function get_payment_methods( array $args = [] ) : PaymentMethodsCollection { try { $this->maybe_enrich_payment_methods(); - } catch ( \Exception $e ) { + } catch ( \Exception $e ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch // No problem. } From 58c2250d8b71e3c3462eeafb2b3030d21de4531a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Mon, 26 Sep 2022 10:28:25 +0200 Subject: [PATCH 37/38] Disable Xdebug in `phpcbf` Composer command. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ccd152c..615c2f9 100644 --- a/composer.json +++ b/composer.json @@ -56,7 +56,7 @@ }, "scripts": { "coveralls": "vendor/bin/php-coveralls -v", - "phpcbf": "vendor/bin/phpcbf", + "phpcbf": "XDEBUG_MODE=off vendor/bin/phpcbf", "phpcs": "XDEBUG_MODE=off vendor/bin/phpcs -s -v", "phplint": "vendor/bin/phplint", "phpmd": "vendor/bin/phpmd src,tests text phpmd.ruleset.xml --suffixes php", From 8fe18e52633291269a95bb0adce99607ab2072f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Mon, 26 Sep 2022 12:18:09 +0200 Subject: [PATCH 38/38] Getting ready for version 4.2.0. --- CHANGELOG.md | 7 ++++++- package.json | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fd1cd9..8a4fe07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C ## [Unreleased][unreleased] - +## [4.2.0] - 2022-09-26 +- Updated payment methods registration. +- Updated for Sisow via Buckaroo integration (pronamic/wp-pronamic-pay-sisow#3). + ## [4.1.0] - 2022-04-11 - No longer catch exception, should be handled downstream. - No longer use core gateway mode. @@ -115,7 +119,8 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C ## [1.0.0] - 2015-01-19 - First release. -[unreleased]: https://github.com/wp-pay-gateways/buckaroo/compare/4.1.0...HEAD +[unreleased]: https://github.com/wp-pay-gateways/buckaroo/compare/4.2.0...HEAD +[4.2.0]: https://github.com/pronamic/wp-pronamic-pay-buckaroo/compare/4.1.0...4.2.0 [4.1.0]: https://github.com/wp-pay-gateways/buckaroo/compare/4.0.0...4.1.0 [4.0.0]: https://github.com/wp-pay-gateways/buckaroo/compare/3.0.2...4.0.0 [3.0.2]: https://github.com/wp-pay-gateways/buckaroo/compare/3.0.1...3.0.2 diff --git a/package.json b/package.json index c872d09..c6ff42a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "buckaroo", - "version": "4.1.0", + "version": "4.2.0", "description": "Buckaroo driver for the WordPress payment processing library.", "repository": { "type": "git",