Code Duplication    Length = 10-10 lines in 2 locations

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

@@ 281-290 (lines=10) @@
278
		$user_email           = '';
279
280
		// If paying from order, we need to get total from order not cart.
281
		if ( isset( $_GET['pay_for_order'] ) && ! empty( $_GET['key'] ) ) {
282
			$order      = wc_get_order( wc_get_order_id_by_order_key( wc_clean( $_GET['key'] ) ) );
283
			$total      = $order->get_total();
284
			$user_email = WC_Stripe_Helper::is_pre_30() ? $order->billing_email : $order->get_billing_email();
285
		} else {
286
			if ( $user->ID ) {
287
				$user_email = get_user_meta( $user->ID, 'billing_email', true );
288
				$user_email = $user_email ? $user_email : $user->user_email;
289
			}
290
		}
291
292
		if ( is_add_payment_method_page() ) {
293
			$pay_button_text = __( 'Add Card', 'woocommerce-gateway-stripe' );
@@ 532-541 (lines=10) @@
529
		$display_tokenization = $this->supports( 'tokenization' ) && $this->saved_cards;
530
531
		// If paying from order, we need to get total from order not cart.
532
		if ( ! empty( $_GET['key'] ) ) {
533
			$order      = wc_get_order( wc_get_order_id_by_order_key( wc_clean( $_GET['key'] ) ) );
534
			$total      = $order->get_total();
535
			$user_email = WC_Stripe_Helper::is_pre_30() ? $order->billing_email : $order->get_billing_email();
536
		} else {
537
			if ( $user->ID ) {
538
				$user_email = get_user_meta( $user->ID, 'billing_email', true );
539
				$user_email = $user_email ? $user_email : $user->user_email;
540
			}
541
		}
542
543
		ob_start();
544