Code Duplication    Length = 29-29 lines in 2 locations

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

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