Code Duplication    Length = 29-29 lines in 2 locations

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

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