Code Duplication    Length = 29-29 lines in 2 locations

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

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