Skip to content

Commit

Permalink
Use default confirmation if conditions are not met for confirmation s…
Browse files Browse the repository at this point in the history
…et in payment feed links.
  • Loading branch information
rvdsteege committed Jan 10, 2025
1 parent 9225108 commit ddabccb
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -1145,13 +1145,19 @@ public function get_confirmation( $lead, $payment_status = PaymentStatus::OPEN )
require_once GFCommon::get_base_path() . '/form_display.php';
}

// Use only link confirmation if set.
/*
* When a confirmation is set in the payment feed links, only use
* configured confirmation or default confirmation if conditions are not met.
*/
if ( isset( $feed->links[ $link ]['confirmation_id'] ) && ! empty( $feed->links[ $link ]['confirmation_id'] ) ) {
$confirmation_id = $feed->links[ $link ]['confirmation_id'];

if ( isset( $form['confirmations'][ $confirmation_id ] ) ) {
$form['confirmations'] = array_intersect_key( $form['confirmations'], [ $confirmation_id => true ] );
}
$form['confirmations'] = \wp_filter_object_list(
$form['confirmations'],
[
'id' => $feed->links[ $link ]['confirmation_id'],
'isDefault' => true,
],
'OR'
);
}

return GFFormDisplay::handle_confirmation( $form, $lead, false );
Expand Down

0 comments on commit ddabccb

Please sign in to comment.