Code Duplication    Length = 29-29 lines in 2 locations

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

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