Skip to content

Commit 15b0849

Browse files
authored
Merge pull request #57 from pronamic/56-remove-action-gform_ideal_fulfillment
Remove action `gform_ideal_fulfillment`.
2 parents c2b668b + 12d0493 commit 15b0849

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

pronamic-pay-gravity-forms.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Version: 4.10.2
88
* Requires at least: 4.7
9-
* Requires PHP: 7.4
9+
* Requires PHP: 8.1
1010
*
1111
* Author: Pronamic
1212
* Author URI: https://www.pronamic.eu/

src/Extension.php

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ public function init() {
146146

147147
\add_filter( 'gform_payment_statuses', [ $this, 'gform_payment_statuses' ] );
148148

149+
\add_action( 'gform_post_payment_completed', $this->fulfill_order( ... ) );
150+
149151
$this->maybe_display_confirmation();
150152
}
151153

@@ -639,9 +641,6 @@ public function update_status( Payment $payment, $can_redirect = false ) {
639641
$this->payment_action( 'create_subscription', $lead, $action );
640642
}
641643

642-
// Fulfill order.
643-
$this->fulfill_order( $lead );
644-
645644
break;
646645
case PaymentStatus::OPEN:
647646
default:
@@ -971,13 +970,20 @@ public function payment_action( $type, $lead, $action, $payment_status = null )
971970
* @param array $entry Gravity Forms entry.
972971
*/
973972
public function fulfill_order( $entry ) {
973+
$entry_id = \rgar( $entry, 'id' );
974+
975+
// Check if one of our feeds is linked to the entry.
976+
$feed_id = \gform_get_meta( $entry_id, 'ideal_feed_id' );
977+
978+
if ( empty( $feed_id ) ) {
979+
return;
980+
}
981+
974982
// Check if already fulfilled.
975983
if ( Entry::is_fulfilled( $entry ) ) {
976984
return;
977985
}
978986

979-
$entry_id = rgar( $entry, 'id' );
980-
981987
// Get entry with current payment status.
982988
$entry = RGFormsModel::get_lead( $entry_id );
983989

@@ -1053,18 +1059,6 @@ public function fulfill_order( $entry ) {
10531059

10541060
// Store entry payment fulfillment in custom meta.
10551061
gform_update_meta( $entry_id, 'pronamic_pay_payment_fulfilled', true );
1056-
1057-
/**
1058-
* Execute payment fulfillment action (PayPal uses `gform_paypal_fulfillment`).
1059-
*
1060-
* @link https://docs.gravityforms.com/gform_paypal_fulfillment/
1061-
* @link https://docs.gravityforms.com/entry-object/
1062-
* @since 1.0.0
1063-
* @param object $entry The entry used to generate the (iDEAL) payment.
1064-
* @param object $feed The feed configuration data used to generate the payment.
1065-
* @deprecated Fulfillment of payments without amount (free) will be removed in the future. Use `gform_post_payment_completed` action instead.
1066-
*/
1067-
\do_action( 'gform_ideal_fulfillment', $entry, $feed );
10681062
}
10691063

10701064
/**

0 commit comments

Comments
 (0)