Code Duplication    Length = 29-29 lines in 2 locations

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

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