Skip to content

Commit

Permalink
Merge branch 'release/3.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Aug 16, 2021
2 parents 2573867 + 0ee3176 commit 25ec33e
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 9 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
107 changes: 101 additions & 6 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
}

Expand All @@ -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.
*/
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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 );
}
}
Expand Down

0 comments on commit 25ec33e

Please sign in to comment.