Code Duplication    Length = 29-29 lines in 2 locations

includes/class-wc-gateway-stripe.php 2 locations

@@ 729-757 (lines=29) @@
726
	 *
727
	 * @param int $order_id The ID of the order.
728
	 */
729
	public function display_order_fee( $order_id ) {
730
		if ( apply_filters( 'wc_stripe_hide_display_order_fee', false, $order_id ) ) {
731
			return;
732
		}
733
734
		$order = wc_get_order( $order_id );
735
736
		$fee      = WC_Stripe_Helper::get_stripe_fee( $order );
737
		$currency = WC_Stripe_Helper::get_stripe_currency( $order );
738
739
		if ( ! $fee || ! $currency ) {
740
			return;
741
		}
742
743
		?>
744
745
		<tr>
746
			<td class="label stripe-fee">
747
				<?php echo wc_help_tip( __( 'This represents the fee Stripe collects for the transaction.', 'woocommerce-gateway-stripe' ) ); // wpcs: xss ok. ?>
748
				<?php esc_html_e( 'Stripe Fee:', 'woocommerce-gateway-stripe' ); ?>
749
			</td>
750
			<td width="1%"></td>
751
			<td class="total">
752
				-&nbsp;<?php echo wc_price( $fee, array( 'currency' => $currency ) ); // wpcs: xss ok. ?>
753
			</td>
754
		</tr>
755
756
		<?php
757
	}
758
759
	/**
760
	 * Displays the net total of the transaction without the charges of Stripe.
@@ 766-794 (lines=29) @@
763
	 *
764
	 * @param int $order_id The ID of the order.
765
	 */
766
	public function display_order_payout( $order_id ) {
767
		if ( apply_filters( 'wc_stripe_hide_display_order_payout', false, $order_id ) ) {
768
			return;
769
		}
770
771
		$order = wc_get_order( $order_id );
772
773
		$net      = WC_Stripe_Helper::get_stripe_net( $order );
774
		$currency = WC_Stripe_Helper::get_stripe_currency( $order );
775
776
		if ( ! $net || ! $currency ) {
777
			return;
778
		}
779
780
		?>
781
782
		<tr>
783
			<td class="label stripe-payout">
784
				<?php echo wc_help_tip( __( 'This represents the net total that will be credited to your Stripe bank account. This may be in the currency that is set in your Stripe account.', 'woocommerce-gateway-stripe' ) ); // wpcs: xss ok. ?>
785
				<?php esc_html_e( 'Stripe Payout:', 'woocommerce-gateway-stripe' ); ?>
786
			</td>
787
			<td width="1%"></td>
788
			<td class="total">
789
				<?php echo wc_price( $net, array( 'currency' => $currency ) ); // wpcs: xss ok. ?>
790
			</td>
791
		</tr>
792
793
		<?php
794
	}
795
796
	/**
797
	 * Generates a localized message for an error from a response.