diff --git a/CHANGELOG.md b/CHANGELOG.md index f28037f..bfd1e5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,11 @@ 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. ## [3.0.0] - 2021-08-05 - Updated to `pronamic/wp-pay-core` version `3.0.0`. @@ -97,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", diff --git a/src/Gateway.php b/src/Gateway.php index 1edc1ac..4b1127b 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, ); } @@ -104,10 +109,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. */ @@ -272,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. * @@ -343,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 @@ -377,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; } @@ -566,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 ); } }