diff --git a/CHANGELOG.md b/CHANGELOG.md index 42e2a1c..0bb4e4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C ## [Unreleased][unreleased] - +## [1.2.0] - 2015-11-02 +- Renamed namespace prefix from 'class Pronamic_WP_Pay_Buckaroo_' to 'Pronamic_WP_Pay_Gateways_Buckaroo_'. + ## [1.1.2] - 2015-10-14 - Fix incorrect signature due to slashes in data. diff --git a/README.md b/README.md index 127502d..d65c0bb 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **Buckaroo driver for the WordPress payment processing library.** [![Build Status](https://travis-ci.org/wp-pay-gateways/buckaroo.svg?branch=develop)](https://travis-ci.org/wp-pay-gateways/buckaroo) -[![Coverage Status](https://coveralls.io/repos/wp-pay-gateways/buckaroo/badge.png?branch=develop)](https://coveralls.io/r/wp-pay-gateways/buckaroo?branch=develop) +[![Coverage Status](https://coveralls.io/repos/wp-pay-gateways/buckaroo/badge.svg?branch=master&service=github)](https://coveralls.io/github/wp-pay-gateways/buckaroo?branch=master) [![Latest Stable Version](https://poser.pugx.org/wp-pay-gateways/buckaroo/v/stable.svg)](https://packagist.org/packages/wp-pay-gateways/buckaroo) [![Total Downloads](https://poser.pugx.org/wp-pay-gateways/buckaroo/downloads.svg)](https://packagist.org/packages/wp-pay-gateways/buckaroo) [![Latest Unstable Version](https://poser.pugx.org/wp-pay-gateways/buckaroo/v/unstable.svg)](https://packagist.org/packages/wp-pay-gateways/buckaroo) diff --git a/composer.lock b/composer.lock index 771ae01..90e6af2 100644 --- a/composer.lock +++ b/composer.lock @@ -9,16 +9,16 @@ "packages": [ { "name": "wp-pay/core", - "version": "1.2.1", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/wp-pay/core.git", - "reference": "d40c40f742e5bddea6e10751b515c865fb56915f" + "reference": "a389f2c3910a3e71632a0e8fd53f0d5f0fae8bf5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-pay/core/zipball/d40c40f742e5bddea6e10751b515c865fb56915f", - "reference": "d40c40f742e5bddea6e10751b515c865fb56915f", + "url": "https://api.github.com/repos/wp-pay/core/zipball/a389f2c3910a3e71632a0e8fd53f0d5f0fae8bf5", + "reference": "a389f2c3910a3e71632a0e8fd53f0d5f0fae8bf5", "shasum": "" }, "require": { @@ -58,7 +58,7 @@ "wordpress", "wp" ], - "time": "2015-04-29 14:48:49" + "time": "2015-10-19 10:18:32" } ], "packages-dev": [ @@ -272,25 +272,22 @@ }, { "name": "symfony/config", - "version": "v2.7.5", + "version": "v2.7.6", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "9698fdf0a750d6887d5e7729d5cf099765b20e61" + "reference": "831f88908b51b9ce945f5e6f402931d1ac544423" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/9698fdf0a750d6887d5e7729d5cf099765b20e61", - "reference": "9698fdf0a750d6887d5e7729d5cf099765b20e61", + "url": "https://api.github.com/repos/symfony/config/zipball/831f88908b51b9ce945f5e6f402931d1ac544423", + "reference": "831f88908b51b9ce945f5e6f402931d1ac544423", "shasum": "" }, "require": { "php": ">=5.3.9", "symfony/filesystem": "~2.3" }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, "type": "library", "extra": { "branch-alias": { @@ -318,20 +315,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2015-09-21 15:02:29" + "time": "2015-10-11 09:39:48" }, { "name": "symfony/console", - "version": "v2.7.5", + "version": "v2.7.6", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "06cb17c013a82f94a3d840682b49425cd00a2161" + "reference": "5efd632294c8320ea52492db22292ff853a43766" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/06cb17c013a82f94a3d840682b49425cd00a2161", - "reference": "06cb17c013a82f94a3d840682b49425cd00a2161", + "url": "https://api.github.com/repos/symfony/console/zipball/5efd632294c8320ea52492db22292ff853a43766", + "reference": "5efd632294c8320ea52492db22292ff853a43766", "shasum": "" }, "require": { @@ -340,7 +337,6 @@ "require-dev": { "psr/log": "~1.0", "symfony/event-dispatcher": "~2.1", - "symfony/phpunit-bridge": "~2.7", "symfony/process": "~2.1" }, "suggest": { @@ -375,20 +371,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2015-09-25 08:32:23" + "time": "2015-10-20 14:38:46" }, { "name": "symfony/event-dispatcher", - "version": "v2.7.5", + "version": "v2.7.6", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "ae4dcc2a8d3de98bd794167a3ccda1311597c5d9" + "reference": "87a5db5ea887763fa3a31a5471b512ff1596d9b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ae4dcc2a8d3de98bd794167a3ccda1311597c5d9", - "reference": "ae4dcc2a8d3de98bd794167a3ccda1311597c5d9", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/87a5db5ea887763fa3a31a5471b512ff1596d9b8", + "reference": "87a5db5ea887763fa3a31a5471b512ff1596d9b8", "shasum": "" }, "require": { @@ -399,7 +395,6 @@ "symfony/config": "~2.0,>=2.0.5", "symfony/dependency-injection": "~2.6", "symfony/expression-language": "~2.6", - "symfony/phpunit-bridge": "~2.7", "symfony/stopwatch": "~2.3" }, "suggest": { @@ -433,28 +428,25 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2015-09-22 13:49:29" + "time": "2015-10-11 09:39:48" }, { "name": "symfony/filesystem", - "version": "v2.7.5", + "version": "v2.7.6", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab" + "reference": "56fd6df73be859323ff97418d97edc1d756df6df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/a17f8a17c20e8614c15b8e116e2f4bcde102cfab", - "reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/56fd6df73be859323ff97418d97edc1d756df6df", + "reference": "56fd6df73be859323ff97418d97edc1d756df6df", "shasum": "" }, "require": { "php": ">=5.3.9" }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, "type": "library", "extra": { "branch-alias": { @@ -482,28 +474,25 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2015-09-09 17:42:36" + "time": "2015-10-18 20:23:18" }, { "name": "symfony/stopwatch", - "version": "v2.7.5", + "version": "v2.7.6", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "08dd97b3f22ab9ee658cd16e6758f8c3c404336e" + "reference": "f8ab957c17e4b85a73c4df03bdf94ee597f2bd55" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/08dd97b3f22ab9ee658cd16e6758f8c3c404336e", - "reference": "08dd97b3f22ab9ee658cd16e6758f8c3c404336e", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/f8ab957c17e4b85a73c4df03bdf94ee597f2bd55", + "reference": "f8ab957c17e4b85a73c4df03bdf94ee597f2bd55", "shasum": "" }, "require": { "php": ">=5.3.9" }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, "type": "library", "extra": { "branch-alias": { @@ -531,28 +520,25 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2015-09-22 13:49:29" + "time": "2015-10-12 12:42:24" }, { "name": "symfony/yaml", - "version": "v2.7.5", + "version": "v2.7.6", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770" + "reference": "eca9019c88fbe250164affd107bc8057771f3f4d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/31cb2ad0155c95b88ee55fe12bc7ff92232c1770", - "reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770", + "url": "https://api.github.com/repos/symfony/yaml/zipball/eca9019c88fbe250164affd107bc8057771f3f4d", + "reference": "eca9019c88fbe250164affd107bc8057771f3f4d", "shasum": "" }, "require": { "php": ">=5.3.9" }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, "type": "library", "extra": { "branch-alias": { @@ -580,7 +566,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2015-09-14 14:14:09" + "time": "2015-10-11 09:39:48" } ], "aliases": [], diff --git a/package.json b/package.json index 1a15f0d..1291d99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "buckaroo", - "version": "1.1.2", + "version": "1.2.0", "description": "Buckaroo driver for the WordPress payment processing library.", "repository": { "type": "git", diff --git a/src/Client.php b/src/Client.php index 7197eeb..067e635 100644 --- a/src/Client.php +++ b/src/Client.php @@ -9,7 +9,7 @@ * @version 1.1.1 * @since 1.0.0 */ -class Pronamic_WP_Pay_Buckaroo_Client { +class Pronamic_WP_Pay_Gateways_Buckaroo_Client { /** * Gateway URL * @@ -374,23 +374,23 @@ public function set_return_cancel_url( $url ) { */ public function get_fields() { $data = array( - Pronamic_WP_Pay_Buckaroo_Parameters::WEBSITE_KEY => $this->get_website_key(), - Pronamic_WP_Pay_Buckaroo_Parameters::INVOICE_NUMBER => $this->get_invoice_number(), - Pronamic_WP_Pay_Buckaroo_Parameters::AMOUNT => number_format( $this->get_amount(), 2, '.', '' ), - Pronamic_WP_Pay_Buckaroo_Parameters::CURRENCY => $this->get_currency(), - Pronamic_WP_Pay_Buckaroo_Parameters::CULTURE => $this->get_culture(), - Pronamic_WP_Pay_Buckaroo_Parameters::DESCRIPTION => $this->get_description(), - Pronamic_WP_Pay_Buckaroo_Parameters::PAYMENT_METHOD => $this->get_payment_method(), - Pronamic_WP_Pay_Buckaroo_Parameters::RETURN_URL => $this->get_return_url(), - Pronamic_WP_Pay_Buckaroo_Parameters::RETURN_REJECT_URL => $this->get_return_reject_url(), - Pronamic_WP_Pay_Buckaroo_Parameters::RETURN_ERROR_URL => $this->get_return_error_url(), - Pronamic_WP_Pay_Buckaroo_Parameters::RETURN_CANCEL_URL => $this->get_return_cancel_url(), - Pronamic_WP_Pay_Buckaroo_Parameters::REQUESTED_SERVICES => implode( ',', $this->get_requested_services() ), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::WEBSITE_KEY => $this->get_website_key(), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::INVOICE_NUMBER => $this->get_invoice_number(), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::AMOUNT => number_format( $this->get_amount(), 2, '.', '' ), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::CURRENCY => $this->get_currency(), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::CULTURE => $this->get_culture(), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::DESCRIPTION => $this->get_description(), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::PAYMENT_METHOD => $this->get_payment_method(), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::RETURN_URL => $this->get_return_url(), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::RETURN_REJECT_URL => $this->get_return_reject_url(), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::RETURN_ERROR_URL => $this->get_return_error_url(), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::RETURN_CANCEL_URL => $this->get_return_cancel_url(), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::REQUESTED_SERVICES => implode( ',', $this->get_requested_services() ), ); - $signature = Pronamic_WP_Pay_Buckaroo_Security::create_signature( $data, $this->get_secret_key() ); + $signature = Pronamic_WP_Pay_Gateways_Buckaroo_Security::create_signature( $data, $this->get_secret_key() ); - $data[ Pronamic_WP_Pay_Buckaroo_Parameters::SIGNATURE ] = $signature; + $data[ Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::SIGNATURE ] = $signature; return $data; } @@ -403,28 +403,28 @@ public function get_fields() { public function verify_request( $data ) { $result = false; - $signature = Pronamic_WP_Pay_Buckaroo_Security::get_signature( $data ); + $signature = Pronamic_WP_Pay_Gateways_Buckaroo_Security::get_signature( $data ); - $signature_check = Pronamic_WP_Pay_Buckaroo_Security::create_signature( $data, $this->get_secret_key() ); + $signature_check = Pronamic_WP_Pay_Gateways_Buckaroo_Security::create_signature( $data, $this->get_secret_key() ); if ( 0 === strcasecmp( $signature, $signature_check ) ) { $data = array_change_key_case( $data, CASE_LOWER ); $result = filter_var_array( $data, array( - Pronamic_WP_Pay_Buckaroo_Parameters::PAYMENT => FILTER_SANITIZE_STRING, - Pronamic_WP_Pay_Buckaroo_Parameters::PAYMENT_METHOD => FILTER_SANITIZE_STRING, - Pronamic_WP_Pay_Buckaroo_Parameters::STATUS_CODE => FILTER_VALIDATE_INT, - Pronamic_WP_Pay_Buckaroo_Parameters::STATUS_CODE_DETAIL => FILTER_SANITIZE_STRING, - Pronamic_WP_Pay_Buckaroo_Parameters::STATUS_MESSAGE => FILTER_SANITIZE_STRING, - Pronamic_WP_Pay_Buckaroo_Parameters::INVOICE_NUMBER => FILTER_SANITIZE_STRING, - Pronamic_WP_Pay_Buckaroo_Parameters::AMOUNT => FILTER_VALIDATE_FLOAT, - Pronamic_WP_Pay_Buckaroo_Parameters::CURRENCY => FILTER_SANITIZE_STRING, - Pronamic_WP_Pay_Buckaroo_Parameters::TIMESTAMP => FILTER_SANITIZE_STRING, - Pronamic_WP_Pay_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_ISSUER => FILTER_SANITIZE_STRING, - Pronamic_WP_Pay_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_NAME => FILTER_SANITIZE_STRING, - Pronamic_WP_Pay_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_IBAN => FILTER_SANITIZE_STRING, - Pronamic_WP_Pay_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_BIC => FILTER_SANITIZE_STRING, - Pronamic_WP_Pay_Buckaroo_Parameters::TRANSACTIONS => FILTER_SANITIZE_STRING, + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::PAYMENT => FILTER_SANITIZE_STRING, + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::PAYMENT_METHOD => FILTER_SANITIZE_STRING, + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::STATUS_CODE => FILTER_VALIDATE_INT, + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::STATUS_CODE_DETAIL => FILTER_SANITIZE_STRING, + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::STATUS_MESSAGE => FILTER_SANITIZE_STRING, + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::INVOICE_NUMBER => FILTER_SANITIZE_STRING, + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::AMOUNT => FILTER_VALIDATE_FLOAT, + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::CURRENCY => FILTER_SANITIZE_STRING, + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::TIMESTAMP => FILTER_SANITIZE_STRING, + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_ISSUER => FILTER_SANITIZE_STRING, + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_NAME => FILTER_SANITIZE_STRING, + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_IBAN => FILTER_SANITIZE_STRING, + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_BIC => FILTER_SANITIZE_STRING, + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::TRANSACTIONS => FILTER_SANITIZE_STRING, ) ); } diff --git a/src/Config.php b/src/Config.php index 444c39b..6508fdd 100644 --- a/src/Config.php +++ b/src/Config.php @@ -8,7 +8,7 @@ * @author Remco Tolsma * @version 1.0.0 */ -class Pronamic_WP_Pay_Buckaroo_Config extends Pronamic_WP_Pay_GatewayConfig { +class Pronamic_WP_Pay_Gateways_Buckaroo_Config extends Pronamic_WP_Pay_GatewayConfig { public $website_key; public $secret_key; diff --git a/src/ConfigFactory.php b/src/ConfigFactory.php index 4fcce91..36531b0 100644 --- a/src/ConfigFactory.php +++ b/src/ConfigFactory.php @@ -8,9 +8,9 @@ * @author Remco Tolsma * @version 1.0.0 */ -class Pronamic_WP_Pay_Buckaroo_ConfigFactory extends Pronamic_WP_Pay_GatewayConfigFactory { +class Pronamic_WP_Pay_Gateways_Buckaroo_ConfigFactory extends Pronamic_WP_Pay_GatewayConfigFactory { public function get_config( $post_id ) { - $config = new Pronamic_WP_Pay_Buckaroo_Config(); + $config = new Pronamic_WP_Pay_Gateways_Buckaroo_Config(); $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 ); diff --git a/src/Gateway.php b/src/Gateway.php index f133b42..9a7185a 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -9,7 +9,7 @@ * @version 1.1.1 * @since 1.0.0 */ -class Pronamic_WP_Pay_Buckaroo_Gateway extends Pronamic_WP_Pay_Gateway { +class Pronamic_WP_Pay_Gateways_Buckaroo_Gateway extends Pronamic_WP_Pay_Gateway { /** * Slug of this gateway * @@ -22,9 +22,9 @@ class Pronamic_WP_Pay_Buckaroo_Gateway extends Pronamic_WP_Pay_Gateway { /** * Constructs and initializes an Buckaroo gateway * - * @param Pronamic_WP_Pay_Buckaroo_Config $config + * @param Pronamic_WP_Pay_Gateways_Buckaroo_Config $config */ - public function __construct( Pronamic_WP_Pay_Buckaroo_Config $config ) { + public function __construct( Pronamic_WP_Pay_Gateways_Buckaroo_Config $config ) { parent::__construct( $config ); $this->set_method( Pronamic_WP_Pay_Gateway::METHOD_HTML_FORM ); @@ -32,12 +32,12 @@ public function __construct( Pronamic_WP_Pay_Buckaroo_Config $config ) { $this->set_amount_minimum( 0.01 ); $this->set_slug( self::SLUG ); - $this->client = new Pronamic_WP_Pay_Buckaroo_Client(); + $this->client = new Pronamic_WP_Pay_Gateways_Buckaroo_Client(); $this->client->set_website_key( $config->website_key ); $this->client->set_secret_key( $config->secret_key ); - if ( Pronamic_IDeal_IDeal::MODE_TEST === $config->mode ) { - $this->client->set_payment_server_url( Pronamic_WP_Pay_Buckaroo_Client::GATEWAY_TEST_URL ); + if ( 'test' === $config->mode ) { + $this->client->set_payment_server_url( Pronamic_WP_Pay_Gateways_Buckaroo_Client::GATEWAY_TEST_URL ); } } @@ -59,18 +59,18 @@ public function start( Pronamic_Pay_PaymentDataInterface $data, Pronamic_Pay_Pay switch ( $payment_method ) { case Pronamic_WP_Pay_PaymentMethods::IDEAL : - $this->client->set_payment_method( Pronamic_WP_Pay_Buckaroo_PaymentMethods::IDEAL ); + $this->client->set_payment_method( Pronamic_WP_Pay_Gateways_Buckaroo_PaymentMethods::IDEAL ); break; case Pronamic_WP_Pay_PaymentMethods::CREDIT_CARD : - $this->client->add_requested_service( Pronamic_WP_Pay_Buckaroo_PaymentMethods::AMERICAN_EXPRESS ); - $this->client->add_requested_service( Pronamic_WP_Pay_Buckaroo_PaymentMethods::MAESTRO ); - $this->client->add_requested_service( Pronamic_WP_Pay_Buckaroo_PaymentMethods::MASTERCARD ); - $this->client->add_requested_service( Pronamic_WP_Pay_Buckaroo_PaymentMethods::VISA ); + $this->client->add_requested_service( Pronamic_WP_Pay_Gateways_Buckaroo_PaymentMethods::AMERICAN_EXPRESS ); + $this->client->add_requested_service( Pronamic_WP_Pay_Gateways_Buckaroo_PaymentMethods::MAESTRO ); + $this->client->add_requested_service( Pronamic_WP_Pay_Gateways_Buckaroo_PaymentMethods::MASTERCARD ); + $this->client->add_requested_service( Pronamic_WP_Pay_Gateways_Buckaroo_PaymentMethods::VISA ); break; case Pronamic_WP_Pay_PaymentMethods::MISTER_CASH : - $this->client->set_payment_method( Pronamic_WP_Pay_Buckaroo_PaymentMethods::BANCONTACT_MISTER_CASH ); + $this->client->set_payment_method( Pronamic_WP_Pay_Gateways_Buckaroo_PaymentMethods::BANCONTACT_MISTER_CASH ); break; } @@ -124,34 +124,34 @@ public function update_status( Pronamic_Pay_Payment $payment ) { break; } - $data = Pronamic_WP_Pay_Buckaroo_Util::urldecode( $data ); + $data = Pronamic_WP_Pay_Gateways_Buckaroo_Util::urldecode( $data ); $data = stripslashes_deep( $data ); $data = $this->client->verify_request( $data ); if ( $data ) { - $payment->set_transaction_id( $data[ Pronamic_WP_Pay_Buckaroo_Parameters::PAYMENT ] ); - $payment->set_status( Pronamic_WP_Pay_Buckaroo_Statuses::transform( $data[ Pronamic_WP_Pay_Buckaroo_Parameters::STATUS_CODE ] ) ); - $payment->set_consumer_iban( $data[ Pronamic_WP_Pay_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_IBAN ] ); - $payment->set_consumer_bic( $data[ Pronamic_WP_Pay_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_BIC ] ); - $payment->set_consumer_name( $data[ Pronamic_WP_Pay_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_NAME ] ); + $payment->set_transaction_id( $data[ Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::PAYMENT ] ); + $payment->set_status( Pronamic_WP_Pay_Gateways_Buckaroo_Statuses::transform( $data[ Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::STATUS_CODE ] ) ); + $payment->set_consumer_iban( $data[ Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_IBAN ] ); + $payment->set_consumer_bic( $data[ Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_BIC ] ); + $payment->set_consumer_name( $data[ Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_NAME ] ); $labels = array( - Pronamic_WP_Pay_Buckaroo_Parameters::PAYMENT => __( 'Payment', 'pronamic_ideal' ), - Pronamic_WP_Pay_Buckaroo_Parameters::PAYMENT_METHOD => __( 'Payment Method', 'pronamic_ideal' ), - Pronamic_WP_Pay_Buckaroo_Parameters::STATUS_CODE => __( 'Status Code', 'pronamic_ideal' ), - Pronamic_WP_Pay_Buckaroo_Parameters::STATUS_CODE_DETAIL => __( 'Status Code Detail', 'pronamic_ideal' ), - Pronamic_WP_Pay_Buckaroo_Parameters::STATUS_MESSAGE => __( 'Status Message', 'pronamic_ideal' ), - Pronamic_WP_Pay_Buckaroo_Parameters::INVOICE_NUMBER => __( 'Invoice Number', 'pronamic_ideal' ), - Pronamic_WP_Pay_Buckaroo_Parameters::AMOUNT => __( 'Amount', 'pronamic_ideal' ), - Pronamic_WP_Pay_Buckaroo_Parameters::CURRENCY => __( 'Currency', 'pronamic_ideal' ), - Pronamic_WP_Pay_Buckaroo_Parameters::TIMESTAMP => __( 'Timestamp', 'pronamic_ideal' ), - Pronamic_WP_Pay_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_ISSUER => __( 'Service iDEAL Consumer Issuer', 'pronamic_ideal' ), - Pronamic_WP_Pay_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_NAME => __( 'Service iDEAL Consumer Name', 'pronamic_ideal' ), - Pronamic_WP_Pay_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_IBAN => __( 'Service iDEAL Consumer IBAN', 'pronamic_ideal' ), - Pronamic_WP_Pay_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_BIC => __( 'Service iDEAL Consumer BIC', 'pronamic_ideal' ), - Pronamic_WP_Pay_Buckaroo_Parameters::TRANSACTIONS => __( 'Transactions', 'pronamic_ideal' ), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::PAYMENT => __( 'Payment', 'pronamic_ideal' ), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::PAYMENT_METHOD => __( 'Payment Method', 'pronamic_ideal' ), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::STATUS_CODE => __( 'Status Code', 'pronamic_ideal' ), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::STATUS_CODE_DETAIL => __( 'Status Code Detail', 'pronamic_ideal' ), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::STATUS_MESSAGE => __( 'Status Message', 'pronamic_ideal' ), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::INVOICE_NUMBER => __( 'Invoice Number', 'pronamic_ideal' ), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::AMOUNT => __( 'Amount', 'pronamic_ideal' ), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::CURRENCY => __( 'Currency', 'pronamic_ideal' ), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::TIMESTAMP => __( 'Timestamp', 'pronamic_ideal' ), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_ISSUER => __( 'Service iDEAL Consumer Issuer', 'pronamic_ideal' ), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_NAME => __( 'Service iDEAL Consumer Name', 'pronamic_ideal' ), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_IBAN => __( 'Service iDEAL Consumer IBAN', 'pronamic_ideal' ), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::SERVICE_IDEAL_CONSUMER_BIC => __( 'Service iDEAL Consumer BIC', 'pronamic_ideal' ), + Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::TRANSACTIONS => __( 'Transactions', 'pronamic_ideal' ), ); $note = ''; diff --git a/src/Listener.php b/src/Listener.php index 4c7f6b4..908237a 100644 --- a/src/Listener.php +++ b/src/Listener.php @@ -9,7 +9,7 @@ * @version 1.1.0 * @since 1.0.0 */ -class Pronamic_WP_Pay_Buckaroo_Listener implements Pronamic_Pay_Gateways_ListenerInterface { +class Pronamic_WP_Pay_Gateways_Buckaroo_Listener implements Pronamic_Pay_Gateways_ListenerInterface { public static function listen() { if ( filter_has_var( INPUT_GET, 'buckaroo_push' ) ) { $method = Pronamic_WP_Pay_Server::get( 'REQUEST_METHOD', FILTER_SANITIZE_STRING ); @@ -30,10 +30,10 @@ public static function listen() { $data = array_change_key_case( $data, CASE_LOWER ); if ( isset( - $data[ Pronamic_WP_Pay_Buckaroo_Parameters::INVOICE_NUMBER ], - $data[ Pronamic_WP_Pay_Buckaroo_Parameters::STATUS_CODE ] + $data[ Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::INVOICE_NUMBER ], + $data[ Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::STATUS_CODE ] ) ) { - $payment_id = $data[ Pronamic_WP_Pay_Buckaroo_Parameters::INVOICE_NUMBER ]; + $payment_id = $data[ Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::INVOICE_NUMBER ]; $payment = get_pronamic_payment( $payment_id ); diff --git a/src/Parameters.php b/src/Parameters.php index 80cf02f..f9149f7 100644 --- a/src/Parameters.php +++ b/src/Parameters.php @@ -8,7 +8,7 @@ * @author Remco Tolsma * @version 1.0.0 */ -class Pronamic_WP_Pay_Buckaroo_Parameters { +class Pronamic_WP_Pay_Gateways_Buckaroo_Parameters { /** * Indicator for the 'brq_websitekey' parameter * diff --git a/src/PaymentMethods.php b/src/PaymentMethods.php index 72564cf..5771a66 100644 --- a/src/PaymentMethods.php +++ b/src/PaymentMethods.php @@ -8,7 +8,7 @@ * @author Remco Tolsma * @version 1.0.0 */ -class Pronamic_WP_Pay_Buckaroo_PaymentMethods { +class Pronamic_WP_Pay_Gateways_Buckaroo_PaymentMethods { /** * Indicator for the 'Achteraf Betalen' payment method * diff --git a/src/Security.php b/src/Security.php index 5cba5b1..b8ad350 100644 --- a/src/Security.php +++ b/src/Security.php @@ -8,7 +8,7 @@ * @author Remco Tolsma * @version 1.0.0 */ -class Pronamic_WP_Pay_Buckaroo_Security { +class Pronamic_WP_Pay_Gateways_Buckaroo_Security { /** * Find the signature from an data array * @@ -19,7 +19,7 @@ public static function get_signature( $data ) { $result = null; foreach ( $data as $key => $value ) { - if ( Pronamic_WP_Pay_Buckaroo_Util::string_equals( $key, Pronamic_WP_Pay_Buckaroo_Parameters::SIGNATURE ) ) { + if ( Pronamic_WP_Pay_Gateways_Buckaroo_Util::string_equals( $key, Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::SIGNATURE ) ) { $result = $value; break; @@ -43,9 +43,17 @@ public static function filter_data( $data ) { // List all parameters prefixed with brq_, add_ or cust_, except brq_signature foreach ( $data as $key => $value ) { if ( - ( Pronamic_WP_Pay_Buckaroo_Util::string_starts_with( $key, 'brq_' ) || Pronamic_WP_Pay_Buckaroo_Util::string_starts_with( $key, 'add_' ) || Pronamic_WP_Pay_Buckaroo_Util::string_starts_with( $key, 'cust_' ) ) + ( + Pronamic_WP_Pay_Gateways_Buckaroo_Util::string_starts_with( $key, 'brq_' ) + || + Pronamic_WP_Pay_Gateways_Buckaroo_Util::string_starts_with( $key, 'add_' ) + || + Pronamic_WP_Pay_Gateways_Buckaroo_Util::string_starts_with( $key, 'cust_' ) + ) && - ( ! Pronamic_WP_Pay_Buckaroo_Util::string_equals( $key, Pronamic_WP_Pay_Buckaroo_Parameters::SIGNATURE ) ) + ( + ! Pronamic_WP_Pay_Gateways_Buckaroo_Util::string_equals( $key, Pronamic_WP_Pay_Gateways_Buckaroo_Parameters::SIGNATURE ) + ) ) { $filter[ $key ] = $value; } diff --git a/src/Statuses.php b/src/Statuses.php index ca7b9a9..c8c32ea 100644 --- a/src/Statuses.php +++ b/src/Statuses.php @@ -8,7 +8,7 @@ * @author Remco Tolsma * @version 1.0.0 */ -class Pronamic_WP_Pay_Buckaroo_Statuses { +class Pronamic_WP_Pay_Gateways_Buckaroo_Statuses { /** * Payment success * @var string diff --git a/src/Util.php b/src/Util.php index 8ad6b73..ecc382a 100644 --- a/src/Util.php +++ b/src/Util.php @@ -8,7 +8,7 @@ * @author Remco Tolsma * @version 1.0.0 */ -class Pronamic_WP_Pay_Buckaroo_Util { +class Pronamic_WP_Pay_Gateways_Buckaroo_Util { /** * Buckaroo check if the specified string is the specified key * diff --git a/tests/ConfigProviderTest.php b/tests/ConfigProviderTest.php index a3c19cb..c6c142e 100644 --- a/tests/ConfigProviderTest.php +++ b/tests/ConfigProviderTest.php @@ -1,11 +1,11 @@ assertInstanceOf( 'Pronamic_WP_Pay_Buckaroo_Config', $config ); + $this->assertInstanceOf( 'Pronamic_WP_Pay_Gateways_Buckaroo_Config', $config ); } } diff --git a/tests/GatewayFactoryTest.php b/tests/GatewayFactoryTest.php index 39b9449..6f1d9bc 100644 --- a/tests/GatewayFactoryTest.php +++ b/tests/GatewayFactoryTest.php @@ -1,13 +1,13 @@ assertInstanceOf( 'Pronamic_Gateways_Buckaroo_Gateway', $gateway ); + $this->assertInstanceOf( 'Pronamic_WP_Pay_Gateways_Buckaroo_Gateway', $gateway ); } } diff --git a/tests/SignatureSortingTest.php b/tests/SignatureSortingTest.php index e2474b3..8f9c1c7 100644 --- a/tests/SignatureSortingTest.php +++ b/tests/SignatureSortingTest.php @@ -9,7 +9,7 @@ * @author Remco Tolsma * @version 1.0.0 */ -class Pronamic_WP_Pay_Buckaroo_SignatureSortingTest extends PHPUnit_Framework_TestCase { +class Pronamic_WP_Pay_Gateways_Buckaroo_SignatureSortingTest extends PHPUnit_Framework_TestCase { /** * Test signature sorting. */ @@ -34,7 +34,7 @@ function test_signature_sorting() { ); // Sort - $data = Pronamic_WP_Pay_Buckaroo_Security::sort( $data ); + $data = Pronamic_WP_Pay_Gateways_Buckaroo_Security::sort( $data ); // Keys $keys_data = implode( "\n", array_keys( $data ) ); diff --git a/tests/SignatureTest.php b/tests/SignatureTest.php index 2243f16..b0233cc 100644 --- a/tests/SignatureTest.php +++ b/tests/SignatureTest.php @@ -9,14 +9,14 @@ * @author Remco Tolsma * @version 1.0.0 */ -class Pronamic_WP_Pay_Buckaroo_SignatureTest extends PHPUnit_Framework_TestCase { +class Pronamic_WP_Pay_Gateways_Buckaroo_SignatureTest extends PHPUnit_Framework_TestCase { /** * Test get signature. * * @dataProvider provider_case_mix */ function test_get_signature( $data ) { - $signature = Pronamic_WP_Pay_Buckaroo_Security::get_signature( $data ); + $signature = Pronamic_WP_Pay_Gateways_Buckaroo_Security::get_signature( $data ); $this->assertEquals( '84e9802d60d727ade4a845c43033051d5758ce25', $signature ); } @@ -27,7 +27,7 @@ function test_get_signature( $data ) { * @dataProvider provider_case_mix */ function test_signature_filter( $data ) { - $data = Pronamic_WP_Pay_Buckaroo_Security::filter_data( $data ); + $data = Pronamic_WP_Pay_Gateways_Buckaroo_Security::filter_data( $data ); $this->assertArrayNotHasKey( 'random_1234567890', $data ); } @@ -42,11 +42,11 @@ function test_signature_filter( $data ) { function test_create_signature( $data ) { $secret_key = '29E9BEB3F3428B2BCAA678DEC489A86A'; - $data = Pronamic_WP_Pay_Buckaroo_Util::urldecode( $data ); + $data = Pronamic_WP_Pay_Gateways_Buckaroo_Util::urldecode( $data ); - $signature = Pronamic_WP_Pay_Buckaroo_Security::get_signature( $data ); + $signature = Pronamic_WP_Pay_Gateways_Buckaroo_Security::get_signature( $data ); - $signature_check = Pronamic_WP_Pay_Buckaroo_Security::create_signature( $data, $secret_key, true ); + $signature_check = Pronamic_WP_Pay_Gateways_Buckaroo_Security::create_signature( $data, $secret_key, true ); $this->assertEquals( $signature, $signature_check ); } diff --git a/tests/StatusesTest.php b/tests/StatusesTest.php index 0b3c553..b6bc549 100644 --- a/tests/StatusesTest.php +++ b/tests/StatusesTest.php @@ -9,14 +9,14 @@ * @version 1.0.0 * @see https://www.mollie.nl/support/documentatie/betaaldiensten/ideal/en/ */ -class Pronamic_WP_Pay_Buckaroo_StatusesTest extends PHPUnit_Framework_TestCase { +class Pronamic_WP_Pay_Gateways_Buckaroo_StatusesTest extends PHPUnit_Framework_TestCase { /** * Test transform. * * @dataProvider statusMatrixProvider */ public function testTransform( $buckarooStatus, $expected ) { - $status = Pronamic_WP_Pay_Buckaroo_Statuses::transform( $buckarooStatus ); + $status = Pronamic_WP_Pay_Gateways_Buckaroo_Statuses::transform( $buckarooStatus ); $this->assertEquals( $expected, $status ); } @@ -24,20 +24,20 @@ public function testTransform( $buckarooStatus, $expected ) { public function statusMatrixProvider() { return array( // Success - array( Pronamic_WP_Pay_Buckaroo_Statuses::PAYMENT_SUCCESS, Pronamic_WP_Pay_Statuses::SUCCESS ), + array( Pronamic_WP_Pay_Gateways_Buckaroo_Statuses::PAYMENT_SUCCESS, Pronamic_WP_Pay_Statuses::SUCCESS ), // Failure - array( Pronamic_WP_Pay_Buckaroo_Statuses::PAYMENT_FAILURE, Pronamic_WP_Pay_Statuses::FAILURE ), - array( Pronamic_WP_Pay_Buckaroo_Statuses::VALIDATION_FAILURE, Pronamic_WP_Pay_Statuses::FAILURE ), - array( Pronamic_WP_Pay_Buckaroo_Statuses::TECHNICAL_ERROR, Pronamic_WP_Pay_Statuses::FAILURE ), - array( Pronamic_WP_Pay_Buckaroo_Statuses::PAYMENT_REJECTED, Pronamic_WP_Pay_Statuses::FAILURE ), + array( Pronamic_WP_Pay_Gateways_Buckaroo_Statuses::PAYMENT_FAILURE, Pronamic_WP_Pay_Statuses::FAILURE ), + array( Pronamic_WP_Pay_Gateways_Buckaroo_Statuses::VALIDATION_FAILURE, Pronamic_WP_Pay_Statuses::FAILURE ), + array( Pronamic_WP_Pay_Gateways_Buckaroo_Statuses::TECHNICAL_ERROR, Pronamic_WP_Pay_Statuses::FAILURE ), + array( Pronamic_WP_Pay_Gateways_Buckaroo_Statuses::PAYMENT_REJECTED, Pronamic_WP_Pay_Statuses::FAILURE ), // Open - array( Pronamic_WP_Pay_Buckaroo_Statuses::WAITING_FOR_USER_INPUT, Pronamic_WP_Pay_Statuses::OPEN ), - array( Pronamic_WP_Pay_Buckaroo_Statuses::WAITING_FOR_PROCESSOR, Pronamic_WP_Pay_Statuses::OPEN ), - array( Pronamic_WP_Pay_Buckaroo_Statuses::WAITING_ON_CONSUMER_ACTION, Pronamic_WP_Pay_Statuses::OPEN ), - array( Pronamic_WP_Pay_Buckaroo_Statuses::PAYMENT_ON_HOLD, Pronamic_WP_Pay_Statuses::OPEN ), + array( Pronamic_WP_Pay_Gateways_Buckaroo_Statuses::WAITING_FOR_USER_INPUT, Pronamic_WP_Pay_Statuses::OPEN ), + array( Pronamic_WP_Pay_Gateways_Buckaroo_Statuses::WAITING_FOR_PROCESSOR, Pronamic_WP_Pay_Statuses::OPEN ), + array( Pronamic_WP_Pay_Gateways_Buckaroo_Statuses::WAITING_ON_CONSUMER_ACTION, Pronamic_WP_Pay_Statuses::OPEN ), + array( Pronamic_WP_Pay_Gateways_Buckaroo_Statuses::PAYMENT_ON_HOLD, Pronamic_WP_Pay_Statuses::OPEN ), // Cancelled - array( Pronamic_WP_Pay_Buckaroo_Statuses::CANCELLED_BY_CONSUMER, Pronamic_WP_Pay_Statuses::CANCELLED ), - array( Pronamic_WP_Pay_Buckaroo_Statuses::CANCELLED_BY_MERCHANT, Pronamic_WP_Pay_Statuses::CANCELLED ), + array( Pronamic_WP_Pay_Gateways_Buckaroo_Statuses::CANCELLED_BY_CONSUMER, Pronamic_WP_Pay_Statuses::CANCELLED ), + array( Pronamic_WP_Pay_Gateways_Buckaroo_Statuses::CANCELLED_BY_MERCHANT, Pronamic_WP_Pay_Statuses::CANCELLED ), // Other array( 'not existing status', null ), );