Code Duplication    Length = 29-29 lines in 2 locations

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

@@ 698-726 (lines=29) @@
695
	 *
696
	 * @param int $order_id The ID of the order.
697
	 */
698
	public function display_order_fee( $order_id ) {
699
		if ( apply_filters( 'wc_stripe_hide_display_order_fee', false, $order_id ) ) {
700
			return;
701
		}
702
703
		$order = wc_get_order( $order_id );
704
705
		$fee      = WC_Stripe_Helper::get_stripe_fee( $order );
706
		$currency = WC_Stripe_Helper::get_stripe_currency( $order );
707
708
		if ( ! $fee || ! $currency ) {
709
			return;
710
		}
711
712
		?>
713
714
		<tr>
715
			<td class="label stripe-fee">
716
				<?php echo wc_help_tip( __( 'This represents the fee Stripe collects for the transaction.', 'woocommerce-gateway-stripe' ) ); // wpcs: xss ok. ?>
717
				<?php esc_html_e( 'Stripe Fee:', 'woocommerce-gateway-stripe' ); ?>
718
			</td>
719
			<td width="1%"></td>
720
			<td class="total">
721
				-&nbsp;<?php echo wc_price( $fee, array( 'currency' => $currency ) ); // wpcs: xss ok. ?>
722
			</td>
723
		</tr>
724
725
		<?php
726
	}
727
728
	/**
729
	 * Displays the net total of the transaction without the charges of Stripe.
@@ 735-763 (lines=29) @@
732
	 *
733
	 * @param int $order_id The ID of the order.
734
	 */
735
	public function display_order_payout( $order_id ) {
736
		if ( apply_filters( 'wc_stripe_hide_display_order_payout', false, $order_id ) ) {
737
			return;
738
		}
739
740
		$order = wc_get_order( $order_id );
741
742
		$net      = WC_Stripe_Helper::get_stripe_net( $order );
743
		$currency = WC_Stripe_Helper::get_stripe_currency( $order );
744
745
		if ( ! $net || ! $currency ) {
746
			return;
747
		}
748
749
		?>
750
751
		<tr>
752
			<td class="label stripe-payout">
753
				<?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. ?>
754
				<?php esc_html_e( 'Stripe Payout:', 'woocommerce-gateway-stripe' ); ?>
755
			</td>
756
			<td width="1%"></td>
757
			<td class="total">
758
				<?php echo wc_price( $net, array( 'currency' => $currency ) ); // wpcs: xss ok. ?>
759
			</td>
760
		</tr>
761
762
		<?php
763
	}
764
765
	/**
766
	 * Generates a localized message for an error, adds it as a note and throws it.