Code Duplication    Length = 29-29 lines in 2 locations

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

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