Code Duplication    Length = 20-20 lines in 2 locations

includes/gateways/paypal.php 1 location

@@ 780-799 (lines=20) @@
777
}
778
add_filter( 'wpinv_payment_details_transaction_id-paypal', 'wpinv_paypal_link_transaction_id', 10, 3 );
779
780
function wpinv_paypal_profile_id_link( $profile_id, $subscription ) {
781
    $link = $profile_id;
782
783
    if ( ! empty( $profile_id ) && ! empty( $subscription ) && ( $invoice_id = $subscription->get_original_payment_id() ) ) {
784
        $invoice = wpinv_get_invoice( $invoice_id );
785
786
        if ( ! empty( $invoice ) && ! empty( $invoice->mode ) ) {
787
            $mode = $invoice->mode;
788
        } else {
789
            $mode = wpinv_is_test_mode( 'paypal' ) ? 'test' : 'live';
790
        }
791
792
        $sandbox = $mode == 'test' ? '.sandbox' : '';
793
        $url = 'https://www' . $sandbox . '.paypal.com/cgi-bin/webscr?cmd=_profile-recurring-payments&encrypted_profile_id=' . $profile_id;
794
795
        $link = '<a href="' . esc_url( $url ) . '" target="_blank">' . $profile_id . '</a>';
796
    }
797
    
798
    return apply_filters( 'wpinv_paypal_profile_id_link', $link, $profile_id, $subscription );
799
}
800
add_filter( 'wpinv_subscription_profile_link_paypal', 'wpinv_paypal_profile_id_link', 10, 2 );
801
802
function wpinv_paypal_transaction_id_link( $transaction_id, $subscription ) {

includes/gateways/authorizenet.php 1 location

@@ 687-706 (lines=20) @@
684
}
685
add_filter( 'wpinv_subscription_transaction_link_authorizenet', 'wpinv_authorizenet_transaction_id_link', 10, 2 );
686
687
function wpinv_authorizenet_profile_id_link( $profile_id, $subscription ) {
688
    $link = $profile_id;
689
690
    if ( ! empty( $profile_id ) && ! empty( $subscription ) && ( $invoice_id = $subscription->get_original_payment_id() ) ) {
691
        $invoice = wpinv_get_invoice( $invoice_id );
692
693
        if ( ! empty( $invoice ) && ! empty( $invoice->mode ) ) {
694
            $mode = $invoice->mode;
695
        } else {
696
            $mode = wpinv_is_test_mode( 'authorizenet' ) ? 'test' : 'live';
697
        }
698
699
        $url = $mode == 'test' ? 'https://sandbox.authorize.net/' : 'https://authorize.net/';
700
        $url .= 'ui/themes/sandbox/ARB/SubscriptionDetail.aspx?SubscrID=' . $profile_id;
701
702
        $link = '<a href="' . esc_url( $url ) . '" target="_blank">' . $profile_id . '</a>';
703
    }
704
    
705
    return apply_filters( 'wpinv_authorizenet_profile_id_link', $link, $profile_id, $subscription );
706
}
707
add_filter( 'wpinv_subscription_profile_link_authorizenet', 'wpinv_authorizenet_profile_id_link', 10, 2 );