Skip to content

Commit

Permalink
Reduce get_pronamic_payment() calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Nov 6, 2023
1 parent daaa077 commit 49ced02
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -1226,17 +1226,20 @@ public function replace_merge_tags( $text, $form, $entry, $url_encode, $esc_html
$subscription_renew_url = $subscription->get_renewal_url();
}

$payment_id = gform_get_meta( rgar( $entry, 'id' ), 'pronamic_payment_id' );
$subscription_payment_id = gform_get_meta( rgar( $entry, 'id' ), 'pronamic_subscription_payment_id' );
$payment_id = (string) gform_get_meta( rgar( $entry, 'id' ), 'pronamic_payment_id' );
$subscription_payment_id = (string) gform_get_meta( rgar( $entry, 'id' ), 'pronamic_subscription_payment_id' );

/**
* Bank transfer recipient details.
*
* Use bank transfer details from last subscription payment if available.
*/
// Use bank transfer details from last subscription payment if available.
$payment = \get_pronamic_payment( $subscription_payment_id );
$payment = null;

$payment = ( '' === $subscription_payment_id ) ? $payment : \get_pronamic_payment( $subscription_payment_id );

if ( null === $payment ) {
$payment = \get_pronamic_payment( $payment_id );
$payment = ( '' === $payment_id ) ? $payment : \get_pronamic_payment( $payment_id );
}

$bank_transfer_recipient_reference = '';
Expand Down

0 comments on commit 49ced02

Please sign in to comment.