Skip to content

Commit

Permalink
Merge branch 'release/3.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Apr 11, 2022
2 parents e2963d6 + f5b9905 commit 53a25c3
Show file tree
Hide file tree
Showing 13 changed files with 164 additions and 99 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/build/
/node_modules/
/vendor/
/vendor-bin/
/wordpress/
/wp-content/
47 changes: 26 additions & 21 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased][unreleased]

## [3.1.0] - 2022-04-11
- Set payment failure reason and redirect Drop-in on refusal (resolves #2).
- Only set `applePayMerchantValidationUrl` when certificate is configured.

## [3.0.1] - 2022-02-16
- Added support for Klarna Pay Now and Klarna Pay Over Time.
- Added support for Afterpay and the Adyen `afterpaytouch` payment method indicator.
Expand Down Expand Up @@ -119,25 +123,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## 1.0.0 - 2019-03-28
- First release.

[unreleased]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/3.0.1...HEAD
[unreleased]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/3.1.0...HEAD
[3.1.0]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/3.0.1...3.1.0
[3.0.1]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/3.0.0...3.0.1
[3.0.0]: https://github.com/wp-pay-gateways/adyen/compare/2.0.4...3.0.0
[2.0.4]: https://github.com/wp-pay-gateways/adyen/compare/2.0.3...2.0.4
[2.0.3]: https://github.com/wp-pay-gateways/adyen/compare/2.0.2...2.0.3
[2.0.2]: https://github.com/wp-pay-gateways/adyen/compare/2.0.1...2.0.2
[2.0.1]: https://github.com/wp-pay-gateways/adyen/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/wp-pay-gateways/adyen/compare/1.3.2...2.0.0
[1.3.2]: https://github.com/wp-pay-gateways/adyen/compare/1.3.1...1.3.2
[1.3.1]: https://github.com/wp-pay-gateways/adyen/compare/1.3.0...1.3.1
[1.3.0]: https://github.com/wp-pay-gateways/adyen/compare/1.2.1...1.3.0
[1.2.1]: https://github.com/wp-pay-gateways/adyen/compare/1.2.0...1.2.1
[1.2.0]: https://github.com/wp-pay-gateways/adyen/compare/1.1.2...1.2.0
[1.1.2]: https://github.com/wp-pay-gateways/adyen/compare/1.1.1...1.1.2
[1.1.1]: https://github.com/wp-pay-gateways/adyen/compare/1.1.0...1.1.1
[1.1.0]: https://github.com/wp-pay-gateways/adyen/compare/1.0.6...1.1.0
[1.0.6]: https://github.com/wp-pay-gateways/adyen/compare/1.0.5...1.0.6
[1.0.5]: https://github.com/wp-pay-gateways/adyen/compare/1.0.4...1.0.5
[1.0.4]: https://github.com/wp-pay-gateways/adyen/compare/1.0.3...1.0.4
[1.0.3]: https://github.com/wp-pay-gateways/adyen/compare/1.0.2...1.0.3
[1.0.2]: https://github.com/wp-pay-gateways/adyen/compare/1.0.1...1.0.2
[1.0.1]: https://github.com/wp-pay-gateways/adyen/compare/1.0.0...1.0.1
[3.0.0]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/2.0.4...3.0.0
[2.0.4]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/2.0.3...2.0.4
[2.0.3]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/2.0.2...2.0.3
[2.0.2]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/2.0.1...2.0.2
[2.0.1]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/1.3.2...2.0.0
[1.3.2]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/1.3.1...1.3.2
[1.3.1]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/1.3.0...1.3.1
[1.3.0]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/1.2.1...1.3.0
[1.2.1]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/1.2.0...1.2.1
[1.2.0]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/1.1.2...1.2.0
[1.1.2]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/1.1.1...1.1.2
[1.1.1]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/1.1.0...1.1.1
[1.1.0]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/1.0.6...1.1.0
[1.0.6]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/1.0.5...1.0.6
[1.0.5]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/1.0.4...1.0.5
[1.0.4]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/1.0.3...1.0.4
[1.0.3]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/1.0.2...1.0.3
[1.0.2]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/1.0.1...1.0.2
[1.0.1]: https://github.com/pronamic/wp-pronamic-pay-adyen/compare/1.0.0...1.0.1
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
21 changes: 16 additions & 5 deletions js/dist/checkout-drop-in.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/dist/checkout-drop-in.js.map

Large diffs are not rendered by default.

21 changes: 15 additions & 6 deletions js/src/checkout-drop-in.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,13 @@
* @return object
*/
const getPaymentMethodsConfiguration = () => {
// Compliment Apple Pay configuration.
if ( pronamicPayAdyenCheckout.paymentMethodsConfiguration.applepay ) {
/**
* Complement Apple Pay configuration with `onValidateMerchant`
* callback when using your own Apple Pay certificate.
*
* @link https://github.com/pronamic/wp-pronamic-pay-adyen/issues/5#issue-1154083692
*/
if ( pronamicPayAdyenCheckout.paymentMethodsConfiguration.applepay && pronamicPayAdyenCheckout.applePayMerchantValidationUrl ) {
pronamicPayAdyenCheckout.paymentMethodsConfiguration.applepay.onValidateMerchant = ( resolve, reject, validationUrl ) => {
send_request(
pronamicPayAdyenCheckout.applePayMerchantValidationUrl,
Expand Down Expand Up @@ -178,12 +183,14 @@
* You'll receive a `refusalReason` in the same response, indicating the cause of the error.
*/
if ( response.refusalReason ) {
if ( pronamicPayAdyenCheckout.refusalRedirectUrl ) {
window.location.href = pronamicPayAdyenCheckout.refusalRedirectUrl;
}

throw new Error( response.refusalReason );
}

throw new Error( pronamicPayAdyenCheckout.unknownError );

break;
case 'Pending':
// The shopper has completed the payment but the final result is not yet known.

Expand All @@ -207,6 +214,10 @@
case 'Refused':
// The payment was refused.

if ( pronamicPayAdyenCheckout.refusalRedirectUrl ) {
window.location.href = pronamicPayAdyenCheckout.refusalRedirectUrl;
}

/*
* Inform the shopper that the payment was refused. Ask the shopper to try the payment again using a different payment method or card.
*/
Expand All @@ -215,8 +226,6 @@
}

throw new Error( pronamicPayAdyenCheckout.paymentRefused );

break;
case 'Received':
// For some payment methods, it can take some time before the final status of the payment is known.
dropin.setStatus( 'success', { message: pronamicPayAdyenCheckout.paymentReceived } );
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": "adyen",
"version": "3.0.1",
"version": "3.1.0",
"description": "Adyen driver for the WordPress payment processing library.",
"repository": {
"type": "git",
Expand Down
20 changes: 18 additions & 2 deletions pronamic-pay-adyen.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin URI: https://www.pronamic.eu/plugins/pronamic-pay-adyen/
* Description: Extend the Pronamic Pay plugin with the Adyen gateway to receive payments with Adyen through a variety of WordPress plugins.
*
* Version: 3.0.0
* Version: 3.1.0
* Requires at least: 4.7
*
* Author: Pronamic
Expand All @@ -28,7 +28,23 @@
add_filter(
'pronamic_pay_gateways',
function( $gateways ) {
$gateways[] = new \Pronamic\WordPress\Pay\Gateways\Adyen\Integration();
$gateways[] = new \Pronamic\WordPress\Pay\Gateways\Adyen\Integration(
array(
'id' => 'adyen',
'name' => 'Adyen',
'mode' => 'live',
'dashboard_url' => 'https://ca-live.adyen.com/ca/ca/login.shtml',
)
);

$gateways[] = new \Pronamic\WordPress\Pay\Gateways\Adyen\Integration(
array(
'id' => 'adyen-test',
'name' => 'Adyen - Test',
'mode' => 'test',
'dashboard_url' => 'https://ca-test.adyen.com/ca/ca/login.shtml',
)
);

return $gateways;
}
Expand Down
22 changes: 5 additions & 17 deletions src/AbstractGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ abstract class AbstractGateway extends Core_Gateway {
*
* @var Config
*/
protected $adyen_config;
protected $config;

/**
* Client.
Expand All @@ -42,9 +42,9 @@ abstract class AbstractGateway extends Core_Gateway {
* @param Config $config Config.
*/
public function __construct( Config $config ) {
parent::__construct( $config );
parent::__construct();

$this->adyen_config = $config;
$this->config = $config;

$this->set_method( self::METHOD_HTTP_REDIRECT );

Expand All @@ -64,13 +64,7 @@ public function __construct( Config $config ) {
public function get_available_payment_methods() {
$core_payment_methods = array();

try {
$payment_methods_response = $this->client->get_payment_methods( new PaymentMethodsRequest( $this->adyen_config->get_merchant_account() ) );
} catch ( \Exception $e ) {
$this->error = new \WP_Error( 'adyen_error', $e->getMessage() );

return $core_payment_methods;
}
$payment_methods_response = $this->client->get_payment_methods( new PaymentMethodsRequest( $this->config->get_merchant_account() ) );

foreach ( $payment_methods_response->get_payment_methods() as $payment_method ) {
$type = $payment_method->get_type();
Expand Down Expand Up @@ -99,13 +93,7 @@ public function get_available_payment_methods() {
public function get_issuers() {
$issuers = array();

try {
$payment_methods_response = $this->client->get_payment_methods( new PaymentMethodsRequest( $this->adyen_config->get_merchant_account() ) );
} catch ( \Exception $e ) {
$this->error = new \WP_Error( 'adyen_error', $e->getMessage() );

return $issuers;
}
$payment_methods_response = $this->client->get_payment_methods( new PaymentMethodsRequest( $this->config->get_merchant_account() ) );

$payment_methods = $payment_methods_response->get_payment_methods();

Expand Down
Loading

0 comments on commit 53a25c3

Please sign in to comment.