Code Duplication    Length = 20-20 lines in 2 locations

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

includes/gateways/paypal.php 1 location

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