From a9ad2718c73fb9edfc0d01ca6f48bd61154bf043 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 16 Aug 2021 10:17:26 +0200 Subject: [PATCH 1/4] Currency code cannot be empty. --- src/Gateway.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Gateway.php b/src/Gateway.php index 1edc1ac..a29b58c 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -104,10 +104,6 @@ public function start( Payment $payment ) { */ $currency_code = $payment->get_total_amount()->get_currency()->get_alphabetic_code(); - if ( null === $currency_code ) { - throw new \InvalidArgumentException( 'Can not start payment with empty currency code.' ); - } - /** * Push URL. */ From 89cf9b2560c5c44917133fe31ec46e2e68841f5f Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 16 Aug 2021 12:43:47 +0200 Subject: [PATCH 2/4] Add support for American Express, Maestro, Mastercard, V PAY and Visa. --- src/Gateway.php | 65 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/src/Gateway.php b/src/Gateway.php index a29b58c..b03afef 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -81,13 +81,18 @@ public function get_issuers() { */ 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, ); } @@ -268,6 +273,18 @@ public function start( Payment $payment ) { $payment_method = $payment->get_method(); switch ( $payment_method ) { + /** + * Paymet method American Express. + * + * @link + */ + case Core_PaymentMethods::AMERICAN_EXPRESS: + $data->Services->ServiceList[] = (object) array( + 'Action' => 'Pay', + 'Name' => PaymentMethods::AMERICAN_EXPRESS, + ); + + break; /** * Payment method creditcard. * @@ -339,6 +356,30 @@ public function start( Payment $payment ) { break; /** + * Paymet method Maestro. + * + * @link + */ + case Core_PaymentMethods::MAESTRO: + $data->Services->ServiceList[] = (object) array( + 'Action' => 'Pay', + 'Name' => PaymentMethods::MAESTRO, + ); + + break; + /** + * Paymet method Mastercard. + * + * @link + */ + case Core_PaymentMethods::MASTERCARD: + $data->Services->ServiceList[] = (object) array( + 'Action' => 'Pay', + 'Name' => PaymentMethods::MASTERCARD, + ); + + break; + /** * Payment method Giropay. * * @link https://dev.buckaroo.nl/PaymentMethods/Description/giropay#pay @@ -373,6 +414,30 @@ public function start( Payment $payment ) { 'Name' => 'sofortueberweisung', ); + break; + /** + * Paymet method V PAY. + * + * @link https://dev.buckaroo.nl/PaymentMethods/Description/creditcards#top + */ + case Core_PaymentMethods::V_PAY: + $data->Services->ServiceList[] = (object) array( + 'Action' => 'Pay', + 'Name' => PaymentMethods::V_PAY, + ); + + break; + /** + * Paymet method Visa. + * + * @link https://dev.buckaroo.nl/PaymentMethods/Description/creditcards#top + */ + case Core_PaymentMethods::VISA: + $data->Services->ServiceList[] = (object) array( + 'Action' => 'Pay', + 'Name' => PaymentMethods::VISA, + ); + break; } From 81f383c8ea1be9d07be600be11e0a2a5409431ff Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:43:14 +0200 Subject: [PATCH 3/4] Save `CustomerIBAN` and `CustomerBIC` for Sofort payments. --- CHANGELOG.md | 3 ++- src/Gateway.php | 38 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f28037f..94199e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ All notable changes to this project will be documented in this file. This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a CHANGELOG](http://keepachangelog.com/). ## [Unreleased][unreleased] -- +- Added support for American Express, Maestro, Mastercard, V PAY and Visa. +- Save `CustomerIBAN` and `CustomerBIC` for Sofort payments. ## [3.0.0] - 2021-08-05 - Updated to `pronamic/wp-pay-core` version `3.0.0`. diff --git a/src/Gateway.php b/src/Gateway.php index b03afef..4b1127b 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -627,11 +627,45 @@ public function update_status( Payment $payment ) { $consumer_bank_details->set_name( $parameter->Value ); } - if ( 'consumerIBAN' === $parameter->Name ) { + if ( \in_array( + $parameter->Name, + array( + /** + * 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 ( 'consumerBIC' === $parameter->Name ) { + if ( \in_array( + $parameter->Name, + array( + /** + * 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 0ee317638712e1d7e9cb950336a3e98dbaa0c8fa Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 16 Aug 2021 16:19:19 +0200 Subject: [PATCH 4/4] 3.0.1 --- CHANGELOG.md | 6 +++++- package.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94199e3..bfd1e5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a CHANGELOG](http://keepachangelog.com/). ## [Unreleased][unreleased] +- + +## [3.0.1] - 2021-08-16 - Added support for American Express, Maestro, Mastercard, V PAY and Visa. - Save `CustomerIBAN` and `CustomerBIC` for Sofort payments. @@ -98,7 +101,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/3.0.0...HEAD +[unreleased]: https://github.com/wp-pay-gateways/buckaroo/compare/3.0.1...HEAD +[3.0.1]: https://github.com/wp-pay-gateways/buckaroo/compare/3.0.0...3.0.1 [3.0.0]: https://github.com/wp-pay-gateways/buckaroo/compare/2.2.0...3.0.0 [2.2.0]: https://github.com/wp-pay-gateways/buckaroo/compare/2.1.2...2.2.0 [2.1.2]: https://github.com/wp-pay-gateways/buckaroo/compare/2.1.1...2.1.2 diff --git a/package.json b/package.json index b7336e4..08a4d90 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "buckaroo", - "version": "3.0.0", + "version": "3.0.1", "description": "Buckaroo driver for the WordPress payment processing library.", "repository": { "type": "git",