Code Duplication    Length = 20-20 lines in 2 locations

includes/gateways/authorizenet.php 1 location

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

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 ) {