From 160e67d1fb5776ab6760fcc9c38422224cffa733 Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Thu, 17 Feb 2022 11:58:27 +0100
Subject: [PATCH 01/21] No longer use mode from core.
---
pronamic-pay-adyen.php | 18 +++++++++++++++++-
src/Integration.php | 41 +++++++++++++++++++++--------------------
2 files changed, 38 insertions(+), 21 deletions(-)
diff --git a/pronamic-pay-adyen.php b/pronamic-pay-adyen.php
index aa72148..d699bc5 100644
--- a/pronamic-pay-adyen.php
+++ b/pronamic-pay-adyen.php
@@ -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;
}
diff --git a/src/Integration.php b/src/Integration.php
index e2ad601..731ef4f 100644
--- a/src/Integration.php
+++ b/src/Integration.php
@@ -40,13 +40,11 @@ public function __construct( $args = array() ) {
array(
'id' => 'adyen',
'name' => 'Adyen',
+ 'mode' => 'live',
'provider' => 'adyen',
'url' => \__( 'https://www.adyen.com/', 'pronamic_ideal' ),
'product_url' => \__( 'https://www.adyen.com/pricing', 'pronamic_ideal' ),
- 'dashboard_url' => array(
- \__( 'test', 'pronamic_ideal' ) => 'https://ca-test.adyen.com/ca/ca/login.shtml',
- \__( 'live', 'pronamic_ideal' ) => 'https://ca-live.adyen.com/ca/ca/login.shtml',
- ),
+ 'dashboard_url' => 'https://ca-live.adyen.com/ca/ca/login.shtml',
'manual_url' => \__( 'https://www.pronamic.eu/manuals/using-adyen-pronamic-pay/', 'pronamic_ideal' ),
'supports' => array(
'webhook',
@@ -241,21 +239,23 @@ public function get_settings_fields() {
),
);
- // Live API URL prefix.
- $fields[] = array(
- 'section' => 'general',
- 'filter' => FILTER_SANITIZE_STRING,
- 'meta_key' => '_pronamic_gateway_adyen_api_live_url_prefix',
- 'title' => _x( 'API Live URL Prefix', 'adyen', 'pronamic_ideal' ),
- 'type' => 'text',
- 'classes' => array( 'regular-text', 'code' ),
- 'tooltip' => __( 'The unique prefix for the live API URL, as mentioned at Account » API URLs in the Adyen dashboard.', 'pronamic_ideal' ),
- 'description' => sprintf(
- '%s',
- esc_url( 'https://docs.adyen.com/developers/development-resources/live-endpoints#liveurlprefix' ),
- esc_html__( 'Adyen documentation: "Live URL prefix".', 'pronamic_ideal' )
- ),
- );
+ if ( 'live' === $this->get_mode() ) {
+ // Live API URL prefix.
+ $fields[] = array(
+ 'section' => 'general',
+ 'filter' => FILTER_SANITIZE_STRING,
+ 'meta_key' => '_pronamic_gateway_adyen_api_live_url_prefix',
+ 'title' => _x( 'API Live URL Prefix', 'adyen', 'pronamic_ideal' ),
+ 'type' => 'text',
+ 'classes' => array( 'regular-text', 'code' ),
+ 'tooltip' => __( 'The unique prefix for the live API URL, as mentioned at Account » API URLs in the Adyen dashboard.', 'pronamic_ideal' ),
+ 'description' => sprintf(
+ '%s',
+ esc_url( 'https://docs.adyen.com/developers/development-resources/live-endpoints#liveurlprefix' ),
+ esc_html__( 'Adyen documentation: "Live URL prefix".', 'pronamic_ideal' )
+ ),
+ );
+ }
// Origin Key.
$fields[] = array(
@@ -722,7 +722,8 @@ public function save_post( $post_id ) {
public function get_config( $post_id ) {
$config = new Config();
- $config->mode = $this->get_meta( $post_id, 'mode' );
+ $config->mode = $this->get_mode();
+
$config->api_key = $this->get_meta( $post_id, 'adyen_api_key' );
$config->api_live_url_prefix = $this->get_meta( $post_id, 'adyen_api_live_url_prefix' );
$config->merchant_account = $this->get_meta( $post_id, 'adyen_merchant_account' );
From e81f3282da5c4e2781058668c7206e15caa0b7ae Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Thu, 17 Feb 2022 13:38:06 +0100
Subject: [PATCH 02/21] Remove gateway error usage, exception should be handled
downstream.
---
src/AbstractGateway.php | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/src/AbstractGateway.php b/src/AbstractGateway.php
index 52bd2ea..47bb5c8 100644
--- a/src/AbstractGateway.php
+++ b/src/AbstractGateway.php
@@ -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->adyen_config->get_merchant_account() ) );
foreach ( $payment_methods_response->get_payment_methods() as $payment_method ) {
$type = $payment_method->get_type();
@@ -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->adyen_config->get_merchant_account() ) );
$payment_methods = $payment_methods_response->get_payment_methods();
From f4089795720b4be71ea2d5e690c3f58150333bf5 Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Thu, 17 Feb 2022 13:38:26 +0100
Subject: [PATCH 03/21] Remove gateway error usage, exception should be handled
downstream.
---
src/WebSdkGateway.php | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/src/WebSdkGateway.php b/src/WebSdkGateway.php
index 894ef45..bbfc088 100644
--- a/src/WebSdkGateway.php
+++ b/src/WebSdkGateway.php
@@ -180,13 +180,7 @@ public function start( Payment $payment ) {
$payment_session_request->set_allowed_payment_methods( array( $payment_method_type ) );
}
- try {
- $payment_session_response = $this->client->create_payment_session( $payment_session_request );
- } catch ( Exception $e ) {
- $this->error = new WP_Error( 'adyen_error', $e->getMessage() );
-
- return;
- }
+ $payment_session_response = $this->client->create_payment_session( $payment_session_request );
$payment->set_meta( 'adyen_sdk_version', self::SDK_VERSION );
$payment->set_meta( 'adyen_payment_session', $payment_session_response->get_payment_session() );
From db47296d2203771a42037f0d44084c7e7894dcaf Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Thu, 24 Feb 2022 12:47:11 +0100
Subject: [PATCH 04/21] Update Integration.php
---
src/Integration.php | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/Integration.php b/src/Integration.php
index 731ef4f..9a1899b 100644
--- a/src/Integration.php
+++ b/src/Integration.php
@@ -748,9 +748,17 @@ public function get_gateway( $post_id ) {
$config = $this->get_config( $post_id );
if ( empty( $config->origin_key ) ) {
- return new WebSdkGateway( $config );
+ $gateway = new WebSdkGateway( $config );
+
+ $gateway->set_mode( $this->get_mode() );
+
+ return $gateway;
}
- return new DropInGateway( $config );
+ $gateway = new DropInGateway( $config );
+
+ $gateway->set_mode( $this->get_mode() );
+
+ return $gateway;
}
}
From 5c2e8f429507fe5f5d1c3ecaccea50f73563ccea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?=
Date: Thu, 24 Feb 2022 14:09:25 +0100
Subject: [PATCH 05/21] Unset shopper IP if it exceeds BLIKs maximum length
restriction.
---
src/PaymentRequestHelper.php | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/PaymentRequestHelper.php b/src/PaymentRequestHelper.php
index d3e59f9..973c121 100644
--- a/src/PaymentRequestHelper.php
+++ b/src/PaymentRequestHelper.php
@@ -11,6 +11,7 @@
namespace Pronamic\WordPress\Pay\Gateways\Adyen;
use Pronamic\WordPress\Money\TaxedMoney;
+use Pronamic\WordPress\Pay\Core\PaymentMethods;
use Pronamic\WordPress\Pay\Payments\Payment;
/**
@@ -52,6 +53,13 @@ public static function complement( Payment $payment, AbstractPaymentRequest $req
$request->set_telephone_number( $customer->get_phone() );
$request->set_shopper_email( $customer->get_email() );
+ // Unset shopper IP if it exceeds BLIKs maximum length restriction.
+ $shopper_ip = $request->get_shopper_ip();
+
+ if ( PaymentMethods::BLIK === $payment->get_payment_method() && null !== $shopper_ip && strlen( $shopper_ip ) > 25 ) {
+ $request->set_shopper_ip( null );
+ }
+
// Shopper name.
$name = $customer->get_name();
From e58b7a58357c41b48f09717549644dcc58e392e8 Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Mon, 28 Feb 2022 11:17:49 +0100
Subject: [PATCH 06/21] Update DropInGateway.php
---
src/DropInGateway.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/DropInGateway.php b/src/DropInGateway.php
index 2eac286..83c3612 100644
--- a/src/DropInGateway.php
+++ b/src/DropInGateway.php
@@ -605,7 +605,7 @@ public function get_checkout_payment_methods_configuration( $payment_method_type
*/
if ( \in_array( PaymentMethodType::GOOGLE_PAY, $payment_method_types, true ) ) {
$configuration['paywithgoogle'] = array(
- 'environment' => ( self::MODE_TEST === $this->config->mode ? 'TEST' : 'PRODUCTION' ),
+ 'environment' => ( self::MODE_TEST === $this->get_mode() ? 'TEST' : 'PRODUCTION' ),
'amount' => array(
'currency' => $payment->get_total_amount()->get_currency()->get_alphabetic_code(),
'value' => $payment->get_total_amount()->get_minor_units()->to_int(),
From a9ebbfa67940396b1d411fa573d90a535672210e Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Mon, 28 Feb 2022 11:48:55 +0100
Subject: [PATCH 07/21] Revert "Unset shopper IP if it exceeds BLIKs maximum
length restriction."
This reverts commit 5c2e8f429507fe5f5d1c3ecaccea50f73563ccea.
---
src/PaymentRequestHelper.php | 8 --------
1 file changed, 8 deletions(-)
diff --git a/src/PaymentRequestHelper.php b/src/PaymentRequestHelper.php
index 973c121..d3e59f9 100644
--- a/src/PaymentRequestHelper.php
+++ b/src/PaymentRequestHelper.php
@@ -11,7 +11,6 @@
namespace Pronamic\WordPress\Pay\Gateways\Adyen;
use Pronamic\WordPress\Money\TaxedMoney;
-use Pronamic\WordPress\Pay\Core\PaymentMethods;
use Pronamic\WordPress\Pay\Payments\Payment;
/**
@@ -53,13 +52,6 @@ public static function complement( Payment $payment, AbstractPaymentRequest $req
$request->set_telephone_number( $customer->get_phone() );
$request->set_shopper_email( $customer->get_email() );
- // Unset shopper IP if it exceeds BLIKs maximum length restriction.
- $shopper_ip = $request->get_shopper_ip();
-
- if ( PaymentMethods::BLIK === $payment->get_payment_method() && null !== $shopper_ip && strlen( $shopper_ip ) > 25 ) {
- $request->set_shopper_ip( null );
- }
-
// Shopper name.
$name = $customer->get_name();
From 3a0485a0141f464bb9e01f6a096f637b94fae0bc Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Mon, 28 Feb 2022 15:01:47 +0100
Subject: [PATCH 08/21] Use `$this->config` instead of `$this->adyen_config`.
---
src/WebSdkGateway.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/WebSdkGateway.php b/src/WebSdkGateway.php
index bbfc088..68904ce 100644
--- a/src/WebSdkGateway.php
+++ b/src/WebSdkGateway.php
@@ -112,7 +112,7 @@ public function start( Payment $payment ) {
// API integration.
$payment_request = new PaymentRequest(
$amount,
- $this->adyen_config->get_merchant_account(),
+ $this->config->get_merchant_account(),
(string) $payment->get_id(),
$payment->get_return_url(),
new PaymentMethod( (object) $payment_method )
@@ -152,7 +152,7 @@ public function start( Payment $payment ) {
*/
$payment_session_request = new PaymentSessionRequest(
$amount,
- $this->adyen_config->get_merchant_account(),
+ $this->config->get_merchant_account(),
(string) $payment->get_id(),
$payment->get_return_url(),
$country_code
From ce923be7d7dc2626186f75edee8cd615a2cfa7e1 Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Mon, 28 Feb 2022 15:01:52 +0100
Subject: [PATCH 09/21] Use `$this->config` instead of `$this->adyen_config`.
---
src/DropInGateway.php | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/DropInGateway.php b/src/DropInGateway.php
index 83c3612..6da9053 100644
--- a/src/DropInGateway.php
+++ b/src/DropInGateway.php
@@ -171,7 +171,7 @@ public function payment_redirect( Payment $payment ) {
/**
* Payment methods.
*/
- $request = new PaymentMethodsRequest( $this->adyen_config->get_merchant_account() );
+ $request = new PaymentMethodsRequest( $this->config->get_merchant_account() );
$payment_method = $payment->get_payment_method();
@@ -185,7 +185,7 @@ public function payment_redirect( Payment $payment ) {
}
// Prevent Apple Pay if no merchant identifier has been configured.
- $apple_pay_merchant_id = $this->adyen_config->get_apple_pay_merchant_id();
+ $apple_pay_merchant_id = $this->config->get_apple_pay_merchant_id();
if ( empty( $apple_pay_merchant_id ) ) {
$request->set_blocked_payment_methods( array( PaymentMethodType::APPLE_PAY ) );
@@ -268,7 +268,7 @@ public function payment_redirect( Payment $payment ) {
$configuration = array(
'locale' => Util::get_payment_locale( $payment ),
'environment' => ( self::MODE_TEST === $payment->get_mode() ? 'test' : 'live' ),
- 'originKey' => $this->adyen_config->origin_key,
+ 'originKey' => $this->config->origin_key,
'paymentMethodsResponse' => $payment_methods->get_original_object(),
'amount' => AmountTransformer::transform( $payment->get_total_amount() )->get_json(),
);
@@ -450,7 +450,7 @@ public function create_payment( Payment $payment, PaymentMethod $payment_method,
// Payment request.
$payment_request = new PaymentRequest(
$amount,
- $this->adyen_config->get_merchant_account(),
+ $this->config->get_merchant_account(),
(string) $payment->get_id(),
$payment->get_return_url(),
$payment_method
@@ -468,7 +468,7 @@ public function create_payment( Payment $payment, PaymentMethod $payment_method,
// phpcs:enable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase -- Adyen JSON object.
// Merchant order reference.
- $payment_request->set_merchant_order_reference( $payment->format_string( $this->adyen_config->get_merchant_order_reference() ) );
+ $payment_request->set_merchant_order_reference( $payment->format_string( $this->config->get_merchant_order_reference() ) );
/**
* Application info.
@@ -549,7 +549,7 @@ public function get_checkout_payment_methods_configuration( $payment_method_type
'currencyCode' => $payment->get_total_amount()->get_currency()->get_alphabetic_code(),
'configuration' => array(
'merchantName' => \get_bloginfo( 'name' ),
- 'merchantIdentifier' => $this->adyen_config->get_apple_pay_merchant_id(),
+ 'merchantIdentifier' => $this->config->get_apple_pay_merchant_id(),
),
);
@@ -611,12 +611,12 @@ public function get_checkout_payment_methods_configuration( $payment_method_type
'value' => $payment->get_total_amount()->get_minor_units()->to_int(),
),
'configuration' => array(
- 'gatewayMerchantId' => $this->adyen_config->merchant_account,
+ 'gatewayMerchantId' => $this->config->merchant_account,
),
);
if ( self::MODE_LIVE === $this->config->mode ) {
- $configuration['paywithgoogle']['configuration']['merchantIdentifier'] = $this->adyen_config->get_google_pay_merchant_identifier();
+ $configuration['paywithgoogle']['configuration']['merchantIdentifier'] = $this->config->get_google_pay_merchant_identifier();
}
}
From a0b6237ac44e6dcbbf101413c7098068332c2b6d Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Mon, 28 Feb 2022 15:01:55 +0100
Subject: [PATCH 10/21] Use `$this->config` instead of `$this->adyen_config`.
---
src/AbstractGateway.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/AbstractGateway.php b/src/AbstractGateway.php
index 47bb5c8..697aa2d 100644
--- a/src/AbstractGateway.php
+++ b/src/AbstractGateway.php
@@ -27,7 +27,7 @@ abstract class AbstractGateway extends Core_Gateway {
*
* @var Config
*/
- protected $adyen_config;
+ protected $config;
/**
* Client.
@@ -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 );
@@ -64,7 +64,7 @@ public function __construct( Config $config ) {
public function get_available_payment_methods() {
$core_payment_methods = array();
- $payment_methods_response = $this->client->get_payment_methods( new PaymentMethodsRequest( $this->adyen_config->get_merchant_account() ) );
+ $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();
@@ -93,7 +93,7 @@ public function get_available_payment_methods() {
public function get_issuers() {
$issuers = array();
- $payment_methods_response = $this->client->get_payment_methods( new PaymentMethodsRequest( $this->adyen_config->get_merchant_account() ) );
+ $payment_methods_response = $this->client->get_payment_methods( new PaymentMethodsRequest( $this->config->get_merchant_account() ) );
$payment_methods = $payment_methods_response->get_payment_methods();
From f7ea277cd10391f18a75d3dfea8e95bae20dff7e Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Mon, 28 Feb 2022 15:02:28 +0100
Subject: [PATCH 11/21] Only set `applePayMerchantValidationUrl` when
certificate is configured.
---
src/DropInGateway.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/DropInGateway.php b/src/DropInGateway.php
index 6da9053..66aea65 100644
--- a/src/DropInGateway.php
+++ b/src/DropInGateway.php
@@ -305,7 +305,7 @@ public function payment_redirect( Payment $payment ) {
'paymentMethodsConfiguration' => $this->get_checkout_payment_methods_configuration( $payment_method_types, $payment ),
'paymentsUrl' => rest_url( Integration::REST_ROUTE_NAMESPACE . '/payments/' . $payment_id ),
'paymentsDetailsUrl' => rest_url( Integration::REST_ROUTE_NAMESPACE . '/payments/details/' . $payment_id ),
- 'applePayMerchantValidationUrl' => rest_url( Integration::REST_ROUTE_NAMESPACE . '/payments/applepay/merchant-validation/' . $payment_id ),
+ 'applePayMerchantValidationUrl' => empty( $this->config->apple_pay_merchant_id_certificate ) ? false : \rest_url( Integration::REST_ROUTE_NAMESPACE . '/payments/applepay/merchant-validation/' . $payment_id ),
'paymentReturnUrl' => $payment->get_return_url(),
'configuration' => $configuration,
'paymentAuthorised' => __( 'Payment completed successfully.', 'pronamic_ideal' ),
From 3a4d38f4121f26d7d1f09c701f286892b500bb5c Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Mon, 28 Feb 2022 15:02:52 +0100
Subject: [PATCH 12/21] Complement Apple Pay configuration with
`onValidateMerchant` callback when using your own Apple Pay certificate.
---
js/src/checkout-drop-in.js | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/js/src/checkout-drop-in.js b/js/src/checkout-drop-in.js
index dc825cc..e45cee8 100644
--- a/js/src/checkout-drop-in.js
+++ b/js/src/checkout-drop-in.js
@@ -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,
From 22e2cd1c9d6afb91790fd935ae4825bee6b06a33 Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Mon, 28 Feb 2022 15:24:01 +0100
Subject: [PATCH 13/21] Remove break, no longer needed.
---
js/src/checkout-drop-in.js | 4 ----
1 file changed, 4 deletions(-)
diff --git a/js/src/checkout-drop-in.js b/js/src/checkout-drop-in.js
index e45cee8..4dc3fbf 100644
--- a/js/src/checkout-drop-in.js
+++ b/js/src/checkout-drop-in.js
@@ -187,8 +187,6 @@
}
throw new Error( pronamicPayAdyenCheckout.unknownError );
-
- break;
case 'Pending':
// The shopper has completed the payment but the final result is not yet known.
@@ -220,8 +218,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 } );
From 88178306c95830658ea758b593b5d273ec197289 Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Mon, 28 Feb 2022 15:24:13 +0100
Subject: [PATCH 14/21] npm run babel
---
js/dist/checkout-drop-in.js | 11 +++++++----
js/dist/checkout-drop-in.js.map | 2 +-
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/js/dist/checkout-drop-in.js b/js/dist/checkout-drop-in.js
index 48f1a82..e8d9235 100644
--- a/js/dist/checkout-drop-in.js
+++ b/js/dist/checkout-drop-in.js
@@ -81,8 +81,13 @@
var getPaymentMethodsConfiguration = function 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 = function (resolve, reject, validationUrl) {
send_request(pronamicPayAdyenCheckout.applePayMerchantValidationUrl, {
validation_url: validationUrl
@@ -168,7 +173,6 @@
}
throw new Error(pronamicPayAdyenCheckout.unknownError);
- break;
case 'Pending':
// The shopper has completed the payment but the final result is not yet known.
@@ -202,7 +206,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.
diff --git a/js/dist/checkout-drop-in.js.map b/js/dist/checkout-drop-in.js.map
index 604a292..c5adce7 100644
--- a/js/dist/checkout-drop-in.js.map
+++ b/js/dist/checkout-drop-in.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/checkout-drop-in.js"],"names":["send_request","url","data","fetch","method","cache","headers","body","JSON","stringify","validate_response","response","json","then","status","Error","message","cause","process_response","action","dropin","handleAction","resultCode","paymentResult","handle_error","error","name","pronamicPayAdyenCheckout","syntaxError","setStatus","getPaymentMethodsConfiguration","paymentMethodsConfiguration","applepay","onValidateMerchant","resolve","reject","validationUrl","applePayMerchantValidationUrl","validation_url","statusMessage","catch","paypal","onCancel","checkout","AdyenCheckout","configuration","create","onSelect","showPayButton","submit","onSubmit","state","paymentsUrl","onAdditionalDetails","paymentsDetailsUrl","mount","paymentAuthorised","window","location","href","paymentReturnUrl","refusalReason","unknownError","paymentRefused","paymentReceived","setTimeout"],"mappings":";;AAAA;AACA,CAAE,YAAY;AACb;AAEA;AACD;AACA;;AACC,MAAMA,YAAY,GAAG,SAAfA,YAAe,CAAEC,GAAF,EAAOC,IAAP,EAAiB;AACrC,WAAOC,KAAK,CACXF,GADW,EAEX;AACCG,MAAAA,MAAM,EAAE,MADT;AAECC,MAAAA,KAAK,EAAE,UAFR;AAGCC,MAAAA,OAAO,EAAE;AAAE,wBAAgB;AAAlB,OAHV;AAICC,MAAAA,IAAI,EAAEC,IAAI,CAACC,SAAL,CAAgBP,IAAhB;AAJP,KAFW,CAAZ;AASA,GAVD;A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C,CAAN;AAEA;;AACD,WAAK,SAAL;AACC;;AAEA;AACJ;AACA;AACIL,QAAAA,MAAM,CAACC,QAAP,CAAgBC,IAAhB,GAAuBhC,wBAAwB,CAACiC,gBAAhD;AAEA;;AACD,WAAK,kBAAL;AACC;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACI;;AACD,WAAK,SAAL;AACC;;AAEA;AACJ;AACA;AACI,YAAKjD,QAAQ,CAACkD,aAAd,EAA8B;AAC7B,gBAAM,IAAI9C,KAAJ,CAAWY,wBAAwB,CAACoC,cAAzB,GAA0C,IAA1C,GAAiDpD,QAAQ,CAACkD,aAA1D,GAA0E,GAArF,CAAN;AACA;;AAED,cAAM,IAAI9C,KAAJ,CAAWY,wBAAwB,CAACoC,cAApC,CAAN;AAEA;;AACD,WAAK,UAAL;AACC;AACA3C,QAAAA,MAAM,CAACS,SAAP,CAAkB,SAAlB,EAA6B;AAAEb,UAAAA,OAAO,EAAEW,wBAAwB,CAACqC;AAApC,SAA7B;AAEA;AACJ;AACA;;AACIC,QAAAA,UAAU,CACT,YAAM;AACLR,UAAAA,MAAM,CAACC,QAAP,CAAgBC,IAAhB,GAAuBhC,wBAAwB,CAACiC,gBAAhD;AACA,SAHQ,EAIT,IAJS,CAAV;AAOA;AAvEF;AAyEA,GA1ED;AA2EA,CA3OD","sourcesContent":["/* global AdyenCheckout, pronamicPayAdyenCheckout */\n( function () {\n\t'use strict';\n\n\t/**\n\t * Send request using Fetch API.\n\t */\n\tconst send_request = ( url, data ) => {\n\t\treturn fetch(\n\t\t\turl,\n\t\t\t{\n\t\t\t\tmethod: 'POST',\n\t\t\t\tcache: 'no-cache',\n\t\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\t\tbody: JSON.stringify( data )\n\t\t\t}\n\t\t);\n\t};\n\n\t/**\n\t * Parse JSON and check response status.\n\t *\n\t * @param response Fetch request response.\n\t * @link https://stackoverflow.com/questions/47267221/fetch-response-json-and-response-status\n\t */\n\tconst validate_response = response => {\n\t\treturn response.json()\n\t\t\t.then( data => {\n\t\t\t\tif ( 200 !== response.status ) {\n\t\t\t\t\tthrow new Error( data.message, {\n\t\t\t\t\t\tcause: data\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\treturn data;\n\t\t\t} );\n\t};\n\n\t/**\n\t * Process response.\n\t *\n\t * @param data Object from JSON response.\n\t */\n\tconst process_response = data => {\n\t\t// Handle action object.\n\t\tif ( data.action ) {\n\t\t\tdropin.handleAction( data.action );\n\n\t\t\treturn;\n\t\t}\n\n\t\t// Handle result code.\n\t\tif ( data.resultCode ) {\n\t\t\tpaymentResult( data );\n\t\t}\n\t}\n\n\t/**\n\t * Handle error.\n\t *\n\t * @param error\n\t */\n\tconst handle_error = error => {\n\t\t// Check syntax error name.\n\t\tif ( 'SyntaxError' === error.name ) {\n\t\t\terror.message = pronamicPayAdyenCheckout.syntaxError;\n\t\t}\n\n\t\t// Show error message.\n\t\tdropin.setStatus( 'error', { message: error.message } );\n\t}\n\n\t/**\n\t * Get payment methods configuration.\n\t *\n\t * @return object\n\t */\n\tconst getPaymentMethodsConfiguration = () => {\n\t\t// Compliment Apple Pay configuration.\n\t\tif ( pronamicPayAdyenCheckout.paymentMethodsConfiguration.applepay ) {\n\t\t\tpronamicPayAdyenCheckout.paymentMethodsConfiguration.applepay.onValidateMerchant = ( resolve, reject, validationUrl ) => {\n\t\t\t\tsend_request(\n\t\t\t\t\tpronamicPayAdyenCheckout.applePayMerchantValidationUrl,\n\t\t\t\t\t{\n\t\t\t\t\t\tvalidation_url: validationUrl\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t\t.then( validate_response )\n\t\t\t\t.then( data => {\n\t\t\t\t\t// Handle Apple error.\n\t\t\t\t\tif ( data.statusMessage ) {\n\t\t\t\t\t\tthrow new Error( data.statusMessage, {\n\t\t\t\t\t\t\tcause: data\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\n\t\t\t\t\tresolve( data );\n\t\t\t\t} )\n\t\t\t\t.catch( error => {\n\t\t\t\t\thandle_error( error );\n\n\t\t\t\t\t// Reject to dismiss Apple Pay overlay.\n\t\t\t\t\treject( error );\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\n\t\t// Compliment PayPal configuration.\n\t\tif ( pronamicPayAdyenCheckout.paymentMethodsConfiguration.paypal ) {\n\t\t\tpronamicPayAdyenCheckout.paymentMethodsConfiguration.paypal.onCancel = ( data, dropin ) => {\n\t\t\t\tdropin.setStatus( 'ready' );\n\t\t\t};\n\t\t}\n\n\t\treturn pronamicPayAdyenCheckout.paymentMethodsConfiguration;\n\t};\n\n\t/**\n\t * Adyen Checkout.\n\t */\n\tconst checkout = new AdyenCheckout( pronamicPayAdyenCheckout.configuration );\n\n\tconst dropin = checkout.create( 'dropin', {\n\t\tpaymentMethodsConfiguration: getPaymentMethodsConfiguration(),\n\t\tonSelect: dropin => {\n\t\t\tlet configuration = pronamicPayAdyenCheckout.configuration;\n\n\t\t\tif ( false === configuration.showPayButton ) {\n\t\t\t\tdropin.submit();\n\t\t\t}\n\t\t},\n\t\tonSubmit: ( state ) => {\n\t\t\t// Set loading status to prevent duplicate submits.\n\t\t\tdropin.setStatus( 'loading' );\n\n\t\t\tsend_request(\n\t\t\t\tpronamicPayAdyenCheckout.paymentsUrl,\n\t\t\t\tstate.data\n\t\t\t)\n\t\t\t.then( validate_response )\n\t\t\t.then( process_response )\n\t\t\t.catch( handle_error );\n\t\t},\n\t\tonAdditionalDetails: ( state ) => {\n\t\t\tsend_request(\n\t\t\t\tpronamicPayAdyenCheckout.paymentsDetailsUrl,\n\t\t\t\tstate.data\n\t\t\t)\n\t\t\t.then( validate_response )\n\t\t\t.then( process_response )\n\t\t\t.catch( handle_error );\n\t\t}\n\t} )\n\t.mount( '#pronamic-pay-checkout' );\n\n\t/**\n\t * Handle payment result.\n\t *\n\t * @param response Object from JSON response data.\n\t * @link https://docs.adyen.com/checkout/drop-in-web#step-6-present-payment-result\n\t */\n\tconst paymentResult = response => {\n\t\tswitch ( response.resultCode ) {\n\t\t\tcase 'Authorised':\n\t\t\t\t// The payment was successful.\n\t\t\t\tdropin.setStatus( 'success', { message: pronamicPayAdyenCheckout.paymentAuthorised } );\n\n\t\t\t\t/*\n\t\t\t\t * Inform the shopper that the payment was successful.\n\t\t\t\t */\n\t\t\t\twindow.location.href = pronamicPayAdyenCheckout.paymentReturnUrl;\n\n\t\t\t\tbreak;\n\t\t\tcase 'Error':\n\t\t\t\t// Inform the shopper that there was an error processing their payment.\n\n\t\t\t\t/*\n\t\t\t\t * You'll receive a `refusalReason` in the same response, indicating the cause of the error.\n\t\t\t\t */\n\t\t\t\tif ( response.refusalReason ) {\n\t\t\t\t\tthrow new Error( response.refusalReason );\n\t\t\t\t}\n\n\t\t\t\tthrow new Error( pronamicPayAdyenCheckout.unknownError );\n\n\t\t\t\tbreak;\n\t\t\tcase 'Pending':\n\t\t\t\t// The shopper has completed the payment but the final result is not yet known.\n\n\t\t\t\t/*\n\t\t\t\t * Inform the shopper that you've received their order, and are waiting for the payment to be completed.\n\t\t\t\t */\n\t\t\t\twindow.location.href = pronamicPayAdyenCheckout.paymentReturnUrl;\n\n\t\t\t\tbreak;\n\t\t\tcase 'PresentToShopper':\n\t\t\t\t// Present the voucher or the QR code to the shopper.\n\n\t\t\t\t/*\n\t\t\t\t * For a voucher payment method, inform the shopper that you are waiting for their payment. You will receive the final result of the payment in an AUTHORISATION notification.\n\t\t\t\t *\n\t\t\t\t * For a qrCode payment method, wait for the AUTHORISATION notification before presenting the payment result to the shopper.\n\t\t\t\t *\n\t\t\t\t * @todo\n\t\t\t\t */\n\t\t\t\tbreak;\n\t\t\tcase 'Refused':\n\t\t\t\t// The payment was refused.\n\n\t\t\t\t/*\n\t\t\t\t * Inform the shopper that the payment was refused. Ask the shopper to try the payment again using a different payment method or card.\n\t\t\t\t */\n\t\t\t\tif ( response.refusalReason ) {\n\t\t\t\t\tthrow new Error( pronamicPayAdyenCheckout.paymentRefused + ' (' + response.refusalReason + ')' );\n\t\t\t\t}\n\n\t\t\t\tthrow new Error( pronamicPayAdyenCheckout.paymentRefused );\n\n\t\t\t\tbreak;\n\t\t\tcase 'Received':\n\t\t\t\t// For some payment methods, it can take some time before the final status of the payment is known.\n\t\t\t\tdropin.setStatus( 'success', { message: pronamicPayAdyenCheckout.paymentReceived } );\n\n\t\t\t\t/*\n\t\t\t\t * Inform the shopper that you've received their order, and are waiting for the payment to clear.\n\t\t\t\t */\n\t\t\t\tsetTimeout(\n\t\t\t\t\t() => {\n\t\t\t\t\t\twindow.location.href = pronamicPayAdyenCheckout.paymentReturnUrl;\n\t\t\t\t\t},\n\t\t\t\t\t3000\n\t\t\t\t);\n\n\t\t\t\tbreak;\n\t\t}\n\t};\n} )();\n"],"file":"checkout-drop-in.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/checkout-drop-in.js"],"names":["send_request","url","data","fetch","method","cache","headers","body","JSON","stringify","validate_response","response","json","then","status","Error","message","cause","process_response","action","dropin","handleAction","resultCode","paymentResult","handle_error","error","name","pronamicPayAdyenCheckout","syntaxError","setStatus","getPaymentMethodsConfiguration","paymentMethodsConfiguration","applepay","applePayMerchantValidationUrl","onValidateMerchant","resolve","reject","validationUrl","validation_url","statusMessage","catch","paypal","onCancel","checkout","AdyenCheckout","configuration","create","onSelect","showPayButton","submit","onSubmit","state","paymentsUrl","onAdditionalDetails","paymentsDetailsUrl","mount","paymentAuthorised","window","location","href","paymentReturnUrl","refusalReason","unknownError","paymentRefused","paymentReceived","setTimeout"],"mappings":";;AAAA;AACA,CAAE,YAAY;AACb;AAEA;AACD;AACA;;AACC,MAAMA,YAAY,GAAG,SAAfA,YAAe,CAAEC,GAAF,EAAOC,IAAP,EAAiB;AACrC,WAAOC,KAAK,CACXF,GADW,EAEX;AACCG,MAAAA,MAAM,EAAE,MADT;AAECC,MAAAA,KAAK,EAAE,UAFR;AAGCC,MAAAA,OAAO,EAAE;AAAE,wBAAgB;AAAlB,OAHV;AAICC,MAAAA,IAAI,EAA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AC7B,gBAAM,IAAI9C,KAAJ,CAAWJ,QAAQ,CAACkD,aAApB,CAAN;AACA;;AAED,cAAM,IAAI9C,KAAJ,CAAWY,wBAAwB,CAACmC,YAApC,CAAN;;AACD,WAAK,SAAL;AACC;;AAEA;AACJ;AACA;AACIL,QAAAA,MAAM,CAACC,QAAP,CAAgBC,IAAhB,GAAuBhC,wBAAwB,CAACiC,gBAAhD;AAEA;;AACD,WAAK,kBAAL;AACC;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACI;;AACD,WAAK,SAAL;AACC;;AAEA;AACJ;AACA;AACI,YAAKjD,QAAQ,CAACkD,aAAd,EAA8B;AAC7B,gBAAM,IAAI9C,KAAJ,CAAWY,wBAAwB,CAACoC,cAAzB,GAA0C,IAA1C,GAAiDpD,QAAQ,CAACkD,aAA1D,GAA0E,GAArF,CAAN;AACA;;AAED,cAAM,IAAI9C,KAAJ,CAAWY,wBAAwB,CAACoC,cAApC,CAAN;;AACD,WAAK,UAAL;AACC;AACA3C,QAAAA,MAAM,CAACS,SAAP,CAAkB,SAAlB,EAA6B;AAAEb,UAAAA,OAAO,EAAEW,wBAAwB,CAACqC;AAApC,SAA7B;AAEA;AACJ;AACA;;AACIC,QAAAA,UAAU,CACT,YAAM;AACLR,UAAAA,MAAM,CAACC,QAAP,CAAgBC,IAAhB,GAAuBhC,wBAAwB,CAACiC,gBAAhD;AACA,SAHQ,EAIT,IAJS,CAAV;AAOA;AAnEF;AAqEA,GAtED;AAuEA,CA5OD","sourcesContent":["/* global AdyenCheckout, pronamicPayAdyenCheckout */\n( function () {\n\t'use strict';\n\n\t/**\n\t * Send request using Fetch API.\n\t */\n\tconst send_request = ( url, data ) => {\n\t\treturn fetch(\n\t\t\turl,\n\t\t\t{\n\t\t\t\tmethod: 'POST',\n\t\t\t\tcache: 'no-cache',\n\t\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\t\tbody: JSON.stringify( data )\n\t\t\t}\n\t\t);\n\t};\n\n\t/**\n\t * Parse JSON and check response status.\n\t *\n\t * @param response Fetch request response.\n\t * @link https://stackoverflow.com/questions/47267221/fetch-response-json-and-response-status\n\t */\n\tconst validate_response = response => {\n\t\treturn response.json()\n\t\t\t.then( data => {\n\t\t\t\tif ( 200 !== response.status ) {\n\t\t\t\t\tthrow new Error( data.message, {\n\t\t\t\t\t\tcause: data\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\treturn data;\n\t\t\t} );\n\t};\n\n\t/**\n\t * Process response.\n\t *\n\t * @param data Object from JSON response.\n\t */\n\tconst process_response = data => {\n\t\t// Handle action object.\n\t\tif ( data.action ) {\n\t\t\tdropin.handleAction( data.action );\n\n\t\t\treturn;\n\t\t}\n\n\t\t// Handle result code.\n\t\tif ( data.resultCode ) {\n\t\t\tpaymentResult( data );\n\t\t}\n\t}\n\n\t/**\n\t * Handle error.\n\t *\n\t * @param error\n\t */\n\tconst handle_error = error => {\n\t\t// Check syntax error name.\n\t\tif ( 'SyntaxError' === error.name ) {\n\t\t\terror.message = pronamicPayAdyenCheckout.syntaxError;\n\t\t}\n\n\t\t// Show error message.\n\t\tdropin.setStatus( 'error', { message: error.message } );\n\t}\n\n\t/**\n\t * Get payment methods configuration.\n\t *\n\t * @return object\n\t */\n\tconst getPaymentMethodsConfiguration = () => {\n\t\t/**\n\t\t * Complement Apple Pay configuration with `onValidateMerchant`\n\t\t * callback when using your own Apple Pay certificate.\n\t\t * \n\t\t * @link https://github.com/pronamic/wp-pronamic-pay-adyen/issues/5#issue-1154083692\n\t\t */\n\t\tif ( pronamicPayAdyenCheckout.paymentMethodsConfiguration.applepay && pronamicPayAdyenCheckout.applePayMerchantValidationUrl ) {\n\t\t\tpronamicPayAdyenCheckout.paymentMethodsConfiguration.applepay.onValidateMerchant = ( resolve, reject, validationUrl ) => {\n\t\t\t\tsend_request(\n\t\t\t\t\tpronamicPayAdyenCheckout.applePayMerchantValidationUrl,\n\t\t\t\t\t{\n\t\t\t\t\t\tvalidation_url: validationUrl\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t\t.then( validate_response )\n\t\t\t\t.then( data => {\n\t\t\t\t\t// Handle Apple error.\n\t\t\t\t\tif ( data.statusMessage ) {\n\t\t\t\t\t\tthrow new Error( data.statusMessage, {\n\t\t\t\t\t\t\tcause: data\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\n\t\t\t\t\tresolve( data );\n\t\t\t\t} )\n\t\t\t\t.catch( error => {\n\t\t\t\t\thandle_error( error );\n\n\t\t\t\t\t// Reject to dismiss Apple Pay overlay.\n\t\t\t\t\treject( error );\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\n\t\t// Compliment PayPal configuration.\n\t\tif ( pronamicPayAdyenCheckout.paymentMethodsConfiguration.paypal ) {\n\t\t\tpronamicPayAdyenCheckout.paymentMethodsConfiguration.paypal.onCancel = ( data, dropin ) => {\n\t\t\t\tdropin.setStatus( 'ready' );\n\t\t\t};\n\t\t}\n\n\t\treturn pronamicPayAdyenCheckout.paymentMethodsConfiguration;\n\t};\n\n\t/**\n\t * Adyen Checkout.\n\t */\n\tconst checkout = new AdyenCheckout( pronamicPayAdyenCheckout.configuration );\n\n\tconst dropin = checkout.create( 'dropin', {\n\t\tpaymentMethodsConfiguration: getPaymentMethodsConfiguration(),\n\t\tonSelect: dropin => {\n\t\t\tlet configuration = pronamicPayAdyenCheckout.configuration;\n\n\t\t\tif ( false === configuration.showPayButton ) {\n\t\t\t\tdropin.submit();\n\t\t\t}\n\t\t},\n\t\tonSubmit: ( state ) => {\n\t\t\t// Set loading status to prevent duplicate submits.\n\t\t\tdropin.setStatus( 'loading' );\n\n\t\t\tsend_request(\n\t\t\t\tpronamicPayAdyenCheckout.paymentsUrl,\n\t\t\t\tstate.data\n\t\t\t)\n\t\t\t.then( validate_response )\n\t\t\t.then( process_response )\n\t\t\t.catch( handle_error );\n\t\t},\n\t\tonAdditionalDetails: ( state ) => {\n\t\t\tsend_request(\n\t\t\t\tpronamicPayAdyenCheckout.paymentsDetailsUrl,\n\t\t\t\tstate.data\n\t\t\t)\n\t\t\t.then( validate_response )\n\t\t\t.then( process_response )\n\t\t\t.catch( handle_error );\n\t\t}\n\t} )\n\t.mount( '#pronamic-pay-checkout' );\n\n\t/**\n\t * Handle payment result.\n\t *\n\t * @param response Object from JSON response data.\n\t * @link https://docs.adyen.com/checkout/drop-in-web#step-6-present-payment-result\n\t */\n\tconst paymentResult = response => {\n\t\tswitch ( response.resultCode ) {\n\t\t\tcase 'Authorised':\n\t\t\t\t// The payment was successful.\n\t\t\t\tdropin.setStatus( 'success', { message: pronamicPayAdyenCheckout.paymentAuthorised } );\n\n\t\t\t\t/*\n\t\t\t\t * Inform the shopper that the payment was successful.\n\t\t\t\t */\n\t\t\t\twindow.location.href = pronamicPayAdyenCheckout.paymentReturnUrl;\n\n\t\t\t\tbreak;\n\t\t\tcase 'Error':\n\t\t\t\t// Inform the shopper that there was an error processing their payment.\n\n\t\t\t\t/*\n\t\t\t\t * You'll receive a `refusalReason` in the same response, indicating the cause of the error.\n\t\t\t\t */\n\t\t\t\tif ( response.refusalReason ) {\n\t\t\t\t\tthrow new Error( response.refusalReason );\n\t\t\t\t}\n\n\t\t\t\tthrow new Error( pronamicPayAdyenCheckout.unknownError );\n\t\t\tcase 'Pending':\n\t\t\t\t// The shopper has completed the payment but the final result is not yet known.\n\n\t\t\t\t/*\n\t\t\t\t * Inform the shopper that you've received their order, and are waiting for the payment to be completed.\n\t\t\t\t */\n\t\t\t\twindow.location.href = pronamicPayAdyenCheckout.paymentReturnUrl;\n\n\t\t\t\tbreak;\n\t\t\tcase 'PresentToShopper':\n\t\t\t\t// Present the voucher or the QR code to the shopper.\n\n\t\t\t\t/*\n\t\t\t\t * For a voucher payment method, inform the shopper that you are waiting for their payment. You will receive the final result of the payment in an AUTHORISATION notification.\n\t\t\t\t *\n\t\t\t\t * For a qrCode payment method, wait for the AUTHORISATION notification before presenting the payment result to the shopper.\n\t\t\t\t *\n\t\t\t\t * @todo\n\t\t\t\t */\n\t\t\t\tbreak;\n\t\t\tcase 'Refused':\n\t\t\t\t// The payment was refused.\n\n\t\t\t\t/*\n\t\t\t\t * Inform the shopper that the payment was refused. Ask the shopper to try the payment again using a different payment method or card.\n\t\t\t\t */\n\t\t\t\tif ( response.refusalReason ) {\n\t\t\t\t\tthrow new Error( pronamicPayAdyenCheckout.paymentRefused + ' (' + response.refusalReason + ')' );\n\t\t\t\t}\n\n\t\t\t\tthrow new Error( pronamicPayAdyenCheckout.paymentRefused );\n\t\t\tcase 'Received':\n\t\t\t\t// For some payment methods, it can take some time before the final status of the payment is known.\n\t\t\t\tdropin.setStatus( 'success', { message: pronamicPayAdyenCheckout.paymentReceived } );\n\n\t\t\t\t/*\n\t\t\t\t * Inform the shopper that you've received their order, and are waiting for the payment to clear.\n\t\t\t\t */\n\t\t\t\tsetTimeout(\n\t\t\t\t\t() => {\n\t\t\t\t\t\twindow.location.href = pronamicPayAdyenCheckout.paymentReturnUrl;\n\t\t\t\t\t},\n\t\t\t\t\t3000\n\t\t\t\t);\n\n\t\t\t\tbreak;\n\t\t}\n\t};\n} )();\n"],"file":"checkout-drop-in.js"}
\ No newline at end of file
From 1ed0c52b4d0893fc4a22d5184c8dc46d9a7016ff Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Mon, 28 Feb 2022 15:24:45 +0100
Subject: [PATCH 15/21] Update to `3.23.0`.
---
src/DropInGateway.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/DropInGateway.php b/src/DropInGateway.php
index 66aea65..0436e97 100644
--- a/src/DropInGateway.php
+++ b/src/DropInGateway.php
@@ -35,7 +35,7 @@ class DropInGateway extends AbstractGateway {
*
* @var string
*/
- const SDK_VERSION = '3.15.0';
+ const SDK_VERSION = '3.23.0';
/**
* Constructs and initializes an Adyen gateway.
From 1b786c258b6b24a9196b6c1cad8babc60b0b7280 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?=
Date: Wed, 9 Mar 2022 09:30:28 +0100
Subject: [PATCH 16/21] Update .eslintignore
---
.eslintignore | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.eslintignore b/.eslintignore
index 34932e6..4bd07c7 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,4 +1,6 @@
/build/
/node_modules/
/vendor/
+/vendor-bin/
/wordpress/
+/wp-content/
From 815375e9661070eaa1d03b09bbce8c9d923d8140 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?=
Date: Tue, 15 Mar 2022 10:25:42 +0100
Subject: [PATCH 17/21] Update mode in payment methods configuration.
---
src/DropInGateway.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/DropInGateway.php b/src/DropInGateway.php
index 0436e97..93f9dc9 100644
--- a/src/DropInGateway.php
+++ b/src/DropInGateway.php
@@ -615,7 +615,7 @@ public function get_checkout_payment_methods_configuration( $payment_method_type
),
);
- if ( self::MODE_LIVE === $this->config->mode ) {
+ if ( self::MODE_LIVE === $this->get_mode() ) {
$configuration['paywithgoogle']['configuration']['merchantIdentifier'] = $this->config->get_google_pay_merchant_identifier();
}
}
@@ -627,7 +627,7 @@ public function get_checkout_payment_methods_configuration( $payment_method_type
*/
if ( \in_array( PaymentMethodType::PAYPAL, $payment_method_types, true ) ) {
$configuration['paypal'] = array(
- 'environment' => ( self::MODE_TEST === $this->config->mode ? 'test' : 'live' ),
+ 'environment' => ( self::MODE_TEST === $this->get_mode() ? 'test' : 'live' ),
'amount' => array(
'currency' => $payment->get_total_amount()->get_currency()->get_alphabetic_code(),
'value' => $payment->get_total_amount()->get_minor_units()->get_value(),
From 689d561afed0102ab4460d4fa66746ad7917b942 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?=
Date: Tue, 15 Mar 2022 12:19:38 +0100
Subject: [PATCH 18/21] Set payment failure reason and redirect Drop-in on
refusal (resolves #2).
---
js/dist/checkout-drop-in.js | 10 +++++++++-
js/dist/checkout-drop-in.js.map | 2 +-
js/src/checkout-drop-in.js | 8 ++++++++
src/DropInGateway.php | 8 ++++++++
src/PaymentResponseHelper.php | 19 ++++++++++++++++++-
5 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/js/dist/checkout-drop-in.js b/js/dist/checkout-drop-in.js
index e8d9235..69ce886 100644
--- a/js/dist/checkout-drop-in.js
+++ b/js/dist/checkout-drop-in.js
@@ -169,6 +169,10 @@
* 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);
}
@@ -197,10 +201,14 @@
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.
*/
+
+
if (response.refusalReason) {
throw new Error(pronamicPayAdyenCheckout.paymentRefused + ' (' + response.refusalReason + ')');
}
diff --git a/js/dist/checkout-drop-in.js.map b/js/dist/checkout-drop-in.js.map
index c5adce7..771a46a 100644
--- a/js/dist/checkout-drop-in.js.map
+++ b/js/dist/checkout-drop-in.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/checkout-drop-in.js"],"names":["send_request","url","data","fetch","method","cache","headers","body","JSON","stringify","validate_response","response","json","then","status","Error","message","cause","process_response","action","dropin","handleAction","resultCode","paymentResult","handle_error","error","name","pronamicPayAdyenCheckout","syntaxError","setStatus","getPaymentMethodsConfiguration","paymentMethodsConfiguration","applepay","applePayMerchantValidationUrl","onValidateMerchant","resolve","reject","validationUrl","validation_url","statusMessage","catch","paypal","onCancel","checkout","AdyenCheckout","configuration","create","onSelect","showPayButton","submit","onSubmit","state","paymentsUrl","onAdditionalDetails","paymentsDetailsUrl","mount","paymentAuthorised","window","location","href","paymentReturnUrl","refusalReason","unknownError","paymentRefused","paymentReceived","setTimeout"],"mappings":";;AAAA;AACA,CAAE,YAAY;AACb;AAEA;AACD;AACA;;AACC,MAAMA,YAAY,GAAG,SAAfA,YAAe,CAAEC,GAAF,EAAOC,IAAP,EAAiB;AACrC,WAAOC,KAAK,CACXF,GADW,EAEX;AACCG,MAAAA,MAAM,EAAE,MADT;AAECC,MAAAA,KAAK,EAAE,UAFR;AAGCC,MAAAA,OAAO,EAAE;AAAE,wBAAgB;AAAlB,OAHV;AAICC,MAAAA,IAAI,EAAEC,IAAI,CAACC,SAAL,CAAgBP,IAAhB;AAJP,KAFW,CAAZ;AASA,GAVD;AAYA;AACD;AACA;AACA;AACA;AACA;;;AACC,MAAMQ,iBAAiB,GAAG,SAApBA,iBAAoB,CAAAC,QAAQ,EAAI;AACrC,WAAOA,QAAQ,CAACC,IAAT,GACLC,IADK,CACC,UAAAX,IAAI,EAAI;AACd,UAAK,QAAQS,QAAQ,CAACG,MAAtB,EAA+B;AAC9B,cAAM,IAAIC,KAAJ,CAAWb,IAAI,CAACc,OAAhB,EAAyB;AAC9BC,UAAAA,KAAK,EAAEf;AADuB,SAAzB,CAAN;AAGA;;AAED,aAAOA,IAAP;AACA,KATK,CAAP;AAUA,GAXD;AAaA;AACD;AACA;AACA;AACA;;;AACC,MAAMgB,gBAAgB,GAAG,SAAnBA,gBAAmB,CAAAhB,IAAI,EAAI;AAChC;AACA,QAAKA,IAAI,CAACiB,MAAV,EAAmB;AAClBC,MAAAA,MAAM,CAACC,YAAP,CAAqBnB,IAAI,CAACiB,MAA1B;AAEA;AACA,KAN+B,CAQhC;;;AACA,QAAKjB,IAAI,CAACoB,UAAV,EAAuB;AACtBC,MAAAA,aAAa,CAAErB,IAAF,CAAb;AACA;AACD,GAZD;AAcA;AACD;AACA;AACA;AACA;;;AACC,MAAMsB,YAAY,GAAG,SAAfA,YAAe,CAAAC,KAAK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AAwB,CAACiC,gBAAhD;AACA,SAHQ,EAIT,IAJS,CAAV;AAOA;AAnEF;AAqEA,GAtED;AAuEA,CA5OD","sourcesContent":["/* global AdyenCheckout, pronamicPayAdyenCheckout */\n( function () {\n\t'use strict';\n\n\t/**\n\t * Send request using Fetch API.\n\t */\n\tconst send_request = ( url, data ) => {\n\t\treturn fetch(\n\t\t\turl,\n\t\t\t{\n\t\t\t\tmethod: 'POST',\n\t\t\t\tcache: 'no-cache',\n\t\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\t\tbody: JSON.stringify( data )\n\t\t\t}\n\t\t);\n\t};\n\n\t/**\n\t * Parse JSON and check response status.\n\t *\n\t * @param response Fetch request response.\n\t * @link https://stackoverflow.com/questions/47267221/fetch-response-json-and-response-status\n\t */\n\tconst validate_response = response => {\n\t\treturn response.json()\n\t\t\t.then( data => {\n\t\t\t\tif ( 200 !== response.status ) {\n\t\t\t\t\tthrow new Error( data.message, {\n\t\t\t\t\t\tcause: data\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\treturn data;\n\t\t\t} );\n\t};\n\n\t/**\n\t * Process response.\n\t *\n\t * @param data Object from JSON response.\n\t */\n\tconst process_response = data => {\n\t\t// Handle action object.\n\t\tif ( data.action ) {\n\t\t\tdropin.handleAction( data.action );\n\n\t\t\treturn;\n\t\t}\n\n\t\t// Handle result code.\n\t\tif ( data.resultCode ) {\n\t\t\tpaymentResult( data );\n\t\t}\n\t}\n\n\t/**\n\t * Handle error.\n\t *\n\t * @param error\n\t */\n\tconst handle_error = error => {\n\t\t// Check syntax error name.\n\t\tif ( 'SyntaxError' === error.name ) {\n\t\t\terror.message = pronamicPayAdyenCheckout.syntaxError;\n\t\t}\n\n\t\t// Show error message.\n\t\tdropin.setStatus( 'error', { message: error.message } );\n\t}\n\n\t/**\n\t * Get payment methods configuration.\n\t *\n\t * @return object\n\t */\n\tconst getPaymentMethodsConfiguration = () => {\n\t\t/**\n\t\t * Complement Apple Pay configuration with `onValidateMerchant`\n\t\t * callback when using your own Apple Pay certificate.\n\t\t * \n\t\t * @link https://github.com/pronamic/wp-pronamic-pay-adyen/issues/5#issue-1154083692\n\t\t */\n\t\tif ( pronamicPayAdyenCheckout.paymentMethodsConfiguration.applepay && pronamicPayAdyenCheckout.applePayMerchantValidationUrl ) {\n\t\t\tpronamicPayAdyenCheckout.paymentMethodsConfiguration.applepay.onValidateMerchant = ( resolve, reject, validationUrl ) => {\n\t\t\t\tsend_request(\n\t\t\t\t\tpronamicPayAdyenCheckout.applePayMerchantValidationUrl,\n\t\t\t\t\t{\n\t\t\t\t\t\tvalidation_url: validationUrl\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t\t.then( validate_response )\n\t\t\t\t.then( data => {\n\t\t\t\t\t// Handle Apple error.\n\t\t\t\t\tif ( data.statusMessage ) {\n\t\t\t\t\t\tthrow new Error( data.statusMessage, {\n\t\t\t\t\t\t\tcause: data\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\n\t\t\t\t\tresolve( data );\n\t\t\t\t} )\n\t\t\t\t.catch( error => {\n\t\t\t\t\thandle_error( error );\n\n\t\t\t\t\t// Reject to dismiss Apple Pay overlay.\n\t\t\t\t\treject( error );\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\n\t\t// Compliment PayPal configuration.\n\t\tif ( pronamicPayAdyenCheckout.paymentMethodsConfiguration.paypal ) {\n\t\t\tpronamicPayAdyenCheckout.paymentMethodsConfiguration.paypal.onCancel = ( data, dropin ) => {\n\t\t\t\tdropin.setStatus( 'ready' );\n\t\t\t};\n\t\t}\n\n\t\treturn pronamicPayAdyenCheckout.paymentMethodsConfiguration;\n\t};\n\n\t/**\n\t * Adyen Checkout.\n\t */\n\tconst checkout = new AdyenCheckout( pronamicPayAdyenCheckout.configuration );\n\n\tconst dropin = checkout.create( 'dropin', {\n\t\tpaymentMethodsConfiguration: getPaymentMethodsConfiguration(),\n\t\tonSelect: dropin => {\n\t\t\tlet configuration = pronamicPayAdyenCheckout.configuration;\n\n\t\t\tif ( false === configuration.showPayButton ) {\n\t\t\t\tdropin.submit();\n\t\t\t}\n\t\t},\n\t\tonSubmit: ( state ) => {\n\t\t\t// Set loading status to prevent duplicate submits.\n\t\t\tdropin.setStatus( 'loading' );\n\n\t\t\tsend_request(\n\t\t\t\tpronamicPayAdyenCheckout.paymentsUrl,\n\t\t\t\tstate.data\n\t\t\t)\n\t\t\t.then( validate_response )\n\t\t\t.then( process_response )\n\t\t\t.catch( handle_error );\n\t\t},\n\t\tonAdditionalDetails: ( state ) => {\n\t\t\tsend_request(\n\t\t\t\tpronamicPayAdyenCheckout.paymentsDetailsUrl,\n\t\t\t\tstate.data\n\t\t\t)\n\t\t\t.then( validate_response )\n\t\t\t.then( process_response )\n\t\t\t.catch( handle_error );\n\t\t}\n\t} )\n\t.mount( '#pronamic-pay-checkout' );\n\n\t/**\n\t * Handle payment result.\n\t *\n\t * @param response Object from JSON response data.\n\t * @link https://docs.adyen.com/checkout/drop-in-web#step-6-present-payment-result\n\t */\n\tconst paymentResult = response => {\n\t\tswitch ( response.resultCode ) {\n\t\t\tcase 'Authorised':\n\t\t\t\t// The payment was successful.\n\t\t\t\tdropin.setStatus( 'success', { message: pronamicPayAdyenCheckout.paymentAuthorised } );\n\n\t\t\t\t/*\n\t\t\t\t * Inform the shopper that the payment was successful.\n\t\t\t\t */\n\t\t\t\twindow.location.href = pronamicPayAdyenCheckout.paymentReturnUrl;\n\n\t\t\t\tbreak;\n\t\t\tcase 'Error':\n\t\t\t\t// Inform the shopper that there was an error processing their payment.\n\n\t\t\t\t/*\n\t\t\t\t * You'll receive a `refusalReason` in the same response, indicating the cause of the error.\n\t\t\t\t */\n\t\t\t\tif ( response.refusalReason ) {\n\t\t\t\t\tthrow new Error( response.refusalReason );\n\t\t\t\t}\n\n\t\t\t\tthrow new Error( pronamicPayAdyenCheckout.unknownError );\n\t\t\tcase 'Pending':\n\t\t\t\t// The shopper has completed the payment but the final result is not yet known.\n\n\t\t\t\t/*\n\t\t\t\t * Inform the shopper that you've received their order, and are waiting for the payment to be completed.\n\t\t\t\t */\n\t\t\t\twindow.location.href = pronamicPayAdyenCheckout.paymentReturnUrl;\n\n\t\t\t\tbreak;\n\t\t\tcase 'PresentToShopper':\n\t\t\t\t// Present the voucher or the QR code to the shopper.\n\n\t\t\t\t/*\n\t\t\t\t * For a voucher payment method, inform the shopper that you are waiting for their payment. You will receive the final result of the payment in an AUTHORISATION notification.\n\t\t\t\t *\n\t\t\t\t * For a qrCode payment method, wait for the AUTHORISATION notification before presenting the payment result to the shopper.\n\t\t\t\t *\n\t\t\t\t * @todo\n\t\t\t\t */\n\t\t\t\tbreak;\n\t\t\tcase 'Refused':\n\t\t\t\t// The payment was refused.\n\n\t\t\t\t/*\n\t\t\t\t * Inform the shopper that the payment was refused. Ask the shopper to try the payment again using a different payment method or card.\n\t\t\t\t */\n\t\t\t\tif ( response.refusalReason ) {\n\t\t\t\t\tthrow new Error( pronamicPayAdyenCheckout.paymentRefused + ' (' + response.refusalReason + ')' );\n\t\t\t\t}\n\n\t\t\t\tthrow new Error( pronamicPayAdyenCheckout.paymentRefused );\n\t\t\tcase 'Received':\n\t\t\t\t// For some payment methods, it can take some time before the final status of the payment is known.\n\t\t\t\tdropin.setStatus( 'success', { message: pronamicPayAdyenCheckout.paymentReceived } );\n\n\t\t\t\t/*\n\t\t\t\t * Inform the shopper that you've received their order, and are waiting for the payment to clear.\n\t\t\t\t */\n\t\t\t\tsetTimeout(\n\t\t\t\t\t() => {\n\t\t\t\t\t\twindow.location.href = pronamicPayAdyenCheckout.paymentReturnUrl;\n\t\t\t\t\t},\n\t\t\t\t\t3000\n\t\t\t\t);\n\n\t\t\t\tbreak;\n\t\t}\n\t};\n} )();\n"],"file":"checkout-drop-in.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/checkout-drop-in.js"],"names":["send_request","url","data","fetch","method","cache","headers","body","JSON","stringify","validate_response","response","json","then","status","Error","message","cause","process_response","action","dropin","handleAction","resultCode","paymentResult","handle_error","error","name","pronamicPayAdyenCheckout","syntaxError","setStatus","getPaymentMethodsConfiguration","paymentMethodsConfiguration","applepay","applePayMerchantValidationUrl","onValidateMerchant","resolve","reject","validationUrl","validation_url","statusMessage","catch","paypal","onCancel","checkout","AdyenCheckout","configuration","create","onSelect","showPayButton","submit","onSubmit","state","paymentsUrl","onAdditionalDetails","paymentsDetailsUrl","mount","paymentAuthorised","window","location","href","paymentReturnUrl","refusalReason","refusalRedirectUrl","unknownError","paymentRefused","paymentReceived","setTimeout"],"mappings":";;AAAA;AACA,CAAE,YAAY;AACb;AAEA;AACD;AACA;;AACC,MAAMA,YAAY,GAAG,SAAfA,YAAe,CAAEC,GAAF,EAAOC,IAAP,EAAiB;AACrC,WAAOC,KAAK,CACXF,GADW,EAEX;AACCG,MAAAA,MAAM,EAAE,MADT;AAECC,MAAAA,KAAK,EAAE,UAFR;AAGCC,MAAAA,OAAO,EAAE;AAAE,wBAAgB;AAAlB,OAHV;AAICC,MAAAA,IAAI,EAAEC,IAAI,CAACC,SAAL,CAAgBP,IAAhB;AAJP,KAFW,CAAZ;AASA,GAVD;AAYA;AACD;AACA;AACA;AACA;AACA;;;AACC,MAAMQ,iBAAiB,GAAG,SAApBA,iBAAoB,CAAAC,QAAQ,EAAI;AACrC,WAAOA,QAAQ,CAACC,IAAT,GACLC,IADK,CACC,UAAAX,IAAI,EAAI;AACd,UAAK,QAAQS,QAAQ,CAACG,MAAtB,EAA+B;AAC9B,cAAM,IAAIC,KAAJ,CAAWb,IAAI,CAACc,OAAhB,EAAyB;AAC9BC,UAAAA,KAAK,EAAEf;AADuB,SAAzB,CAAN;AAGA;;AAED,aAAOA,IAAP;AACA,KATK,CAAP;AAUA,GAXD;AAaA;AACD;AACA;AACA;AACA;;;AACC,MAAMgB,gBAAgB,GAAG,SAAnBA,gBAAmB,CAAAhB,IAAI,EAAI;AAChC;AACA,QAAKA,IAAI,CAACiB,MAAV,EAAmB;AAClBC,MAAAA,MAAM,CA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kBAAhD;AACA;AAED;AACJ;AACA;;;AACI,YAAKnD,QAAQ,CAACkD,aAAd,EAA8B;AAC7B,gBAAM,IAAI9C,KAAJ,CAAWY,wBAAwB,CAACqC,cAAzB,GAA0C,IAA1C,GAAiDrD,QAAQ,CAACkD,aAA1D,GAA0E,GAArF,CAAN;AACA;;AAED,cAAM,IAAI9C,KAAJ,CAAWY,wBAAwB,CAACqC,cAApC,CAAN;;AACD,WAAK,UAAL;AACC;AACA5C,QAAAA,MAAM,CAACS,SAAP,CAAkB,SAAlB,EAA6B;AAAEb,UAAAA,OAAO,EAAEW,wBAAwB,CAACsC;AAApC,SAA7B;AAEA;AACJ;AACA;;AACIC,QAAAA,UAAU,CACT,YAAM;AACLT,UAAAA,MAAM,CAACC,QAAP,CAAgBC,IAAhB,GAAuBhC,wBAAwB,CAACiC,gBAAhD;AACA,SAHQ,EAIT,IAJS,CAAV;AAOA;AA3EF;AA6EA,GA9ED;AA+EA,CApPD","sourcesContent":["/* global AdyenCheckout, pronamicPayAdyenCheckout */\n( function () {\n\t'use strict';\n\n\t/**\n\t * Send request using Fetch API.\n\t */\n\tconst send_request = ( url, data ) => {\n\t\treturn fetch(\n\t\t\turl,\n\t\t\t{\n\t\t\t\tmethod: 'POST',\n\t\t\t\tcache: 'no-cache',\n\t\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\t\tbody: JSON.stringify( data )\n\t\t\t}\n\t\t);\n\t};\n\n\t/**\n\t * Parse JSON and check response status.\n\t *\n\t * @param response Fetch request response.\n\t * @link https://stackoverflow.com/questions/47267221/fetch-response-json-and-response-status\n\t */\n\tconst validate_response = response => {\n\t\treturn response.json()\n\t\t\t.then( data => {\n\t\t\t\tif ( 200 !== response.status ) {\n\t\t\t\t\tthrow new Error( data.message, {\n\t\t\t\t\t\tcause: data\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\treturn data;\n\t\t\t} );\n\t};\n\n\t/**\n\t * Process response.\n\t *\n\t * @param data Object from JSON response.\n\t */\n\tconst process_response = data => {\n\t\t// Handle action object.\n\t\tif ( data.action ) {\n\t\t\tdropin.handleAction( data.action );\n\n\t\t\treturn;\n\t\t}\n\n\t\t// Handle result code.\n\t\tif ( data.resultCode ) {\n\t\t\tpaymentResult( data );\n\t\t}\n\t}\n\n\t/**\n\t * Handle error.\n\t *\n\t * @param error\n\t */\n\tconst handle_error = error => {\n\t\t// Check syntax error name.\n\t\tif ( 'SyntaxError' === error.name ) {\n\t\t\terror.message = pronamicPayAdyenCheckout.syntaxError;\n\t\t}\n\n\t\t// Show error message.\n\t\tdropin.setStatus( 'error', { message: error.message } );\n\t}\n\n\t/**\n\t * Get payment methods configuration.\n\t *\n\t * @return object\n\t */\n\tconst getPaymentMethodsConfiguration = () => {\n\t\t/**\n\t\t * Complement Apple Pay configuration with `onValidateMerchant`\n\t\t * callback when using your own Apple Pay certificate.\n\t\t * \n\t\t * @link https://github.com/pronamic/wp-pronamic-pay-adyen/issues/5#issue-1154083692\n\t\t */\n\t\tif ( pronamicPayAdyenCheckout.paymentMethodsConfiguration.applepay && pronamicPayAdyenCheckout.applePayMerchantValidationUrl ) {\n\t\t\tpronamicPayAdyenCheckout.paymentMethodsConfiguration.applepay.onValidateMerchant = ( resolve, reject, validationUrl ) => {\n\t\t\t\tsend_request(\n\t\t\t\t\tpronamicPayAdyenCheckout.applePayMerchantValidationUrl,\n\t\t\t\t\t{\n\t\t\t\t\t\tvalidation_url: validationUrl\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t\t.then( validate_response )\n\t\t\t\t.then( data => {\n\t\t\t\t\t// Handle Apple error.\n\t\t\t\t\tif ( data.statusMessage ) {\n\t\t\t\t\t\tthrow new Error( data.statusMessage, {\n\t\t\t\t\t\t\tcause: data\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\n\t\t\t\t\tresolve( data );\n\t\t\t\t} )\n\t\t\t\t.catch( error => {\n\t\t\t\t\thandle_error( error );\n\n\t\t\t\t\t// Reject to dismiss Apple Pay overlay.\n\t\t\t\t\treject( error );\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\n\t\t// Compliment PayPal configuration.\n\t\tif ( pronamicPayAdyenCheckout.paymentMethodsConfiguration.paypal ) {\n\t\t\tpronamicPayAdyenCheckout.paymentMethodsConfiguration.paypal.onCancel = ( data, dropin ) => {\n\t\t\t\tdropin.setStatus( 'ready' );\n\t\t\t};\n\t\t}\n\n\t\treturn pronamicPayAdyenCheckout.paymentMethodsConfiguration;\n\t};\n\n\t/**\n\t * Adyen Checkout.\n\t */\n\tconst checkout = new AdyenCheckout( pronamicPayAdyenCheckout.configuration );\n\n\tconst dropin = checkout.create( 'dropin', {\n\t\tpaymentMethodsConfiguration: getPaymentMethodsConfiguration(),\n\t\tonSelect: dropin => {\n\t\t\tlet configuration = pronamicPayAdyenCheckout.configuration;\n\n\t\t\tif ( false === configuration.showPayButton ) {\n\t\t\t\tdropin.submit();\n\t\t\t}\n\t\t},\n\t\tonSubmit: ( state ) => {\n\t\t\t// Set loading status to prevent duplicate submits.\n\t\t\tdropin.setStatus( 'loading' );\n\n\t\t\tsend_request(\n\t\t\t\tpronamicPayAdyenCheckout.paymentsUrl,\n\t\t\t\tstate.data\n\t\t\t)\n\t\t\t.then( validate_response )\n\t\t\t.then( process_response )\n\t\t\t.catch( handle_error );\n\t\t},\n\t\tonAdditionalDetails: ( state ) => {\n\t\t\tsend_request(\n\t\t\t\tpronamicPayAdyenCheckout.paymentsDetailsUrl,\n\t\t\t\tstate.data\n\t\t\t)\n\t\t\t.then( validate_response )\n\t\t\t.then( process_response )\n\t\t\t.catch( handle_error );\n\t\t}\n\t} )\n\t.mount( '#pronamic-pay-checkout' );\n\n\t/**\n\t * Handle payment result.\n\t *\n\t * @param response Object from JSON response data.\n\t * @link https://docs.adyen.com/checkout/drop-in-web#step-6-present-payment-result\n\t */\n\tconst paymentResult = response => {\n\t\tswitch ( response.resultCode ) {\n\t\t\tcase 'Authorised':\n\t\t\t\t// The payment was successful.\n\t\t\t\tdropin.setStatus( 'success', { message: pronamicPayAdyenCheckout.paymentAuthorised } );\n\n\t\t\t\t/*\n\t\t\t\t * Inform the shopper that the payment was successful.\n\t\t\t\t */\n\t\t\t\twindow.location.href = pronamicPayAdyenCheckout.paymentReturnUrl;\n\n\t\t\t\tbreak;\n\t\t\tcase 'Error':\n\t\t\t\t// Inform the shopper that there was an error processing their payment.\n\n\t\t\t\t/*\n\t\t\t\t * You'll receive a `refusalReason` in the same response, indicating the cause of the error.\n\t\t\t\t */\n\t\t\t\tif ( response.refusalReason ) {\n\t\t\t\t\tif ( pronamicPayAdyenCheckout.refusalRedirectUrl ) {\n\t\t\t\t\t\twindow.location.href = pronamicPayAdyenCheckout.refusalRedirectUrl;\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow new Error( response.refusalReason );\n\t\t\t\t}\n\n\t\t\t\tthrow new Error( pronamicPayAdyenCheckout.unknownError );\n\t\t\tcase 'Pending':\n\t\t\t\t// The shopper has completed the payment but the final result is not yet known.\n\n\t\t\t\t/*\n\t\t\t\t * Inform the shopper that you've received their order, and are waiting for the payment to be completed.\n\t\t\t\t */\n\t\t\t\twindow.location.href = pronamicPayAdyenCheckout.paymentReturnUrl;\n\n\t\t\t\tbreak;\n\t\t\tcase 'PresentToShopper':\n\t\t\t\t// Present the voucher or the QR code to the shopper.\n\n\t\t\t\t/*\n\t\t\t\t * For a voucher payment method, inform the shopper that you are waiting for their payment. You will receive the final result of the payment in an AUTHORISATION notification.\n\t\t\t\t *\n\t\t\t\t * For a qrCode payment method, wait for the AUTHORISATION notification before presenting the payment result to the shopper.\n\t\t\t\t *\n\t\t\t\t * @todo\n\t\t\t\t */\n\t\t\t\tbreak;\n\t\t\tcase 'Refused':\n\t\t\t\t// The payment was refused.\n\n\t\t\t\tif ( pronamicPayAdyenCheckout.refusalRedirectUrl ) {\n\t\t\t\t\twindow.location.href = pronamicPayAdyenCheckout.refusalRedirectUrl;\n\t\t\t\t}\n\n\t\t\t\t/*\n\t\t\t\t * Inform the shopper that the payment was refused. Ask the shopper to try the payment again using a different payment method or card.\n\t\t\t\t */\n\t\t\t\tif ( response.refusalReason ) {\n\t\t\t\t\tthrow new Error( pronamicPayAdyenCheckout.paymentRefused + ' (' + response.refusalReason + ')' );\n\t\t\t\t}\n\n\t\t\t\tthrow new Error( pronamicPayAdyenCheckout.paymentRefused );\n\t\t\tcase 'Received':\n\t\t\t\t// For some payment methods, it can take some time before the final status of the payment is known.\n\t\t\t\tdropin.setStatus( 'success', { message: pronamicPayAdyenCheckout.paymentReceived } );\n\n\t\t\t\t/*\n\t\t\t\t * Inform the shopper that you've received their order, and are waiting for the payment to clear.\n\t\t\t\t */\n\t\t\t\tsetTimeout(\n\t\t\t\t\t() => {\n\t\t\t\t\t\twindow.location.href = pronamicPayAdyenCheckout.paymentReturnUrl;\n\t\t\t\t\t},\n\t\t\t\t\t3000\n\t\t\t\t);\n\n\t\t\t\tbreak;\n\t\t}\n\t};\n} )();\n"],"file":"checkout-drop-in.js"}
\ No newline at end of file
diff --git a/js/src/checkout-drop-in.js b/js/src/checkout-drop-in.js
index 4dc3fbf..03eb4b4 100644
--- a/js/src/checkout-drop-in.js
+++ b/js/src/checkout-drop-in.js
@@ -183,6 +183,10 @@
* 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 );
}
@@ -210,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.
*/
diff --git a/src/DropInGateway.php b/src/DropInGateway.php
index 93f9dc9..7502e3f 100644
--- a/src/DropInGateway.php
+++ b/src/DropInGateway.php
@@ -298,6 +298,13 @@ public function payment_redirect( Payment $payment ) {
*/
$configuration = apply_filters( 'pronamic_pay_adyen_checkout_configuration', $configuration );
+ // Refused payment redirect URL.
+ $refusal_redirect_url = null;
+
+ if ( 'woocommerce' === $payment->get_source() ) {
+ $refusal_redirect_url = $payment->get_return_url();
+ }
+
wp_localize_script(
'pronamic-pay-adyen-checkout',
'pronamicPayAdyenCheckout',
@@ -307,6 +314,7 @@ public function payment_redirect( Payment $payment ) {
'paymentsDetailsUrl' => rest_url( Integration::REST_ROUTE_NAMESPACE . '/payments/details/' . $payment_id ),
'applePayMerchantValidationUrl' => empty( $this->config->apple_pay_merchant_id_certificate ) ? false : \rest_url( Integration::REST_ROUTE_NAMESPACE . '/payments/applepay/merchant-validation/' . $payment_id ),
'paymentReturnUrl' => $payment->get_return_url(),
+ 'refusalRedirectUrl' => $refusal_redirect_url,
'configuration' => $configuration,
'paymentAuthorised' => __( 'Payment completed successfully.', 'pronamic_ideal' ),
'paymentReceived' => __( 'The order has been received and we are waiting for the payment to clear.', 'pronamic_ideal' ),
diff --git a/src/PaymentResponseHelper.php b/src/PaymentResponseHelper.php
index 012f4af..4fe2811 100644
--- a/src/PaymentResponseHelper.php
+++ b/src/PaymentResponseHelper.php
@@ -10,8 +10,8 @@
namespace Pronamic\WordPress\Pay\Gateways\Adyen;
+use Pronamic\WordPress\Pay\Payments\FailureReason;
use Pronamic\WordPress\Pay\Payments\Payment;
-use Pronamic\WordPress\Pay\Payments\PaymentStatus;
/**
* Payment response helper
@@ -82,6 +82,23 @@ public static function update_payment( Payment $payment, PaymentResponse $respon
$payment->set_status( $status );
}
+ // Refusal reason.
+ $refusal_reason = $response->get_refusal_reason();
+
+ if ( null !== $refusal_reason ) {
+ $failure_reason = new FailureReason();
+
+ $message = sprintf(
+ /* translators: %s: refusal reason */
+ __( 'The payment has been refused. (%s)', 'pronamic_ideal' ),
+ $refusal_reason
+ );
+
+ $failure_reason->set_message( $message );
+
+ $payment->set_failure_reason( $failure_reason );
+ }
+
$payment->save();
}
}
From b3e3bb374066a4e9d0a83645325b11aca93ddd85 Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Fri, 25 Mar 2022 09:52:11 +0100
Subject: [PATCH 19/21] vendor/bin/phpcbf
---
pronamic-pay-adyen.php | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/pronamic-pay-adyen.php b/pronamic-pay-adyen.php
index d699bc5..10d3cb5 100644
--- a/pronamic-pay-adyen.php
+++ b/pronamic-pay-adyen.php
@@ -37,14 +37,14 @@ function( $gateways ) {
)
);
- $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',
- )
- );
+ $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;
}
From b2edf58fa94701093d6000fdc661e9b161bd1237 Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Mon, 11 Apr 2022 16:06:55 +0200
Subject: [PATCH 20/21] 3.1.0
---
CHANGELOG.md | 47 +++++++++++++++++++++++-------------------
package.json | 2 +-
pronamic-pay-adyen.php | 2 +-
3 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 52c1526..f33d3e1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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.
@@ -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
diff --git a/package.json b/package.json
index d67eb6f..778a47d 100644
--- a/package.json
+++ b/package.json
@@ -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",
diff --git a/pronamic-pay-adyen.php b/pronamic-pay-adyen.php
index 10d3cb5..0d7e2e6 100644
--- a/pronamic-pay-adyen.php
+++ b/pronamic-pay-adyen.php
@@ -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
From f5b99056424f9c2f31bb8b577fb7e381d83e5723 Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Mon, 11 Apr 2022 16:07:32 +0200
Subject: [PATCH 21/21] composer update
---
composer.json | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index 365a4b4..fd085b4 100644
--- a/composer.json
+++ b/composer.json
@@ -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",