From e85152fffa9b0a72c6ec26ffc9f381b64b85592d Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Wed, 13 Jul 2022 15:16:52 +0200
Subject: [PATCH 01/15] No longer set payment method on gateway.
This was required for the input fields to render, but we revise this.
---
src/Gateway.php | 6 ------
1 file changed, 6 deletions(-)
diff --git a/src/Gateway.php b/src/Gateway.php
index 4c3d1ff..6095084 100644
--- a/src/Gateway.php
+++ b/src/Gateway.php
@@ -227,12 +227,6 @@ public function payment_fields() {
return;
}
- /*
- * Let the gateway know which payment method to use so it can return the correct inputs.
- * @since 1.2.1
- */
- $gateway->set_payment_method( $this->payment_method );
-
$fields = $gateway->get_input_fields();
// Check if there are fields to display.
From 4c8f5e103c981becda8a3a2fc54bb54c291d4c76 Mon Sep 17 00:00:00 2001
From: Gautam Garg <65900807+knit-pay@users.noreply.github.com>
Date: Sat, 16 Jul 2022 18:53:04 +0530
Subject: [PATCH 02/15] code updated to work with Easy Digital Downloads v3.0.0
Update Extension.php
---
src/Extension.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/Extension.php b/src/Extension.php
index 2c21337..8447283 100644
--- a/src/Extension.php
+++ b/src/Extension.php
@@ -49,6 +49,8 @@ public function __construct() {
$dependencies = $this->get_dependencies();
$dependencies->add( new EasyDigitalDownloadsDependency() );
+
+ add_action( 'plugins_loaded', [ $this, 'setup_extension' ] );
}
/**
@@ -56,7 +58,7 @@ public function __construct() {
*
* @return void
*/
- public function setup() {
+ public function setup_extension() {
add_filter( 'pronamic_payment_source_text_easydigitaldownloads', [ $this, 'source_text' ], 10, 2 );
add_filter( 'pronamic_payment_source_description_easydigitaldownloads', [ $this, 'source_description' ], 10, 2 );
From a498b8c2034f26e74bfac3674714cfbade853d7c Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Thu, 28 Jul 2022 15:03:46 +0200
Subject: [PATCH 03/15] Update Extension.php
---
src/Extension.php | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/Extension.php b/src/Extension.php
index 8447283..bf6d458 100644
--- a/src/Extension.php
+++ b/src/Extension.php
@@ -50,15 +50,21 @@ public function __construct() {
$dependencies->add( new EasyDigitalDownloadsDependency() );
- add_action( 'plugins_loaded', [ $this, 'setup_extension' ] );
+ /**
+ * Plugins loaded.
+ *
+ * @link https://github.com/pronamic/wp-pronamic-pay-easy-digital-downloads/issues/3
+ */
+ add_action( 'plugins_loaded', [ $this, 'plugins_loaded' ] );
}
/**
- * Setup plugin integration.
+ * Plugins loaded.
*
+ * @link https://github.com/pronamic/wp-pronamic-pay-easy-digital-downloads/issues/3
* @return void
*/
- public function setup_extension() {
+ public function plugins_loaded() {
add_filter( 'pronamic_payment_source_text_easydigitaldownloads', [ $this, 'source_text' ], 10, 2 );
add_filter( 'pronamic_payment_source_description_easydigitaldownloads', [ $this, 'source_description' ], 10, 2 );
From db5fd19038b5e67cb8449f71001a3c9cea448f60 Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Wed, 17 Aug 2022 13:15:44 +0200
Subject: [PATCH 04/15] Update Gateway.php
---
src/Gateway.php | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/src/Gateway.php b/src/Gateway.php
index 6095084..3bc2c42 100644
--- a/src/Gateway.php
+++ b/src/Gateway.php
@@ -227,9 +227,14 @@ public function payment_fields() {
return;
}
- $fields = $gateway->get_input_fields();
+ $payment_method = $gateway->get_payment_method( $this->payment_method );
+
+ if ( null === $payment_method ) {
+ return;
+ }
+
+ $fields = $payment_method->get_fields();
- // Check if there are fields to display.
if ( empty( $fields ) ) {
return;
}
@@ -238,13 +243,23 @@ public function payment_fields() {
echo '';
foreach ( $fields as $field ) {
- // Make field required.
- $field['label'] .= ' *';
- $field['required'] = true;
+ $label = $field->get_label();
+
+ if ( $field->is_required() ) {
+ $label .= ' *';
+ }
+
+ echo '
';
+
+ \printf(
+ '',
+ \esc_attr( $field->get_id() ),
+ \esc_html( $label )
+ );
+
+ $field->output();
- // @codingStandardsIgnoreStart
- \printf( '
%s
', Util::input_fields_html( [ $field ] ) );
- // @codingStandardsIgnoreEnd
+ echo '';
}
echo '';
From 66cdc991d71d7d589869fecc44a588332b439063 Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Wed, 17 Aug 2022 13:18:12 +0200
Subject: [PATCH 05/15] Remove 'edd_cc_fields' HTML id attribute.
---
src/Gateway.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Gateway.php b/src/Gateway.php
index 3bc2c42..c8e8446 100644
--- a/src/Gateway.php
+++ b/src/Gateway.php
@@ -239,7 +239,7 @@ public function payment_fields() {
return;
}
- echo '