Code Duplication    Length = 10-10 lines in 2 locations

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

@@ 273-282 (lines=10) @@
270
		$lastname             = '';
271
272
		// If paying from order, we need to get total from order not cart.
273
		if ( isset( $_GET['pay_for_order'] ) && ! empty( $_GET['key'] ) ) {
274
			$order      = wc_get_order( wc_get_order_id_by_order_key( wc_clean( $_GET['key'] ) ) );
275
			$total      = $order->get_total();
276
			$user_email = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->billing_email : $order->get_billing_email();
277
		} else {
278
			if ( $user->ID ) {
279
				$user_email = get_user_meta( $user->ID, 'billing_email', true );
280
				$user_email = $user_email ? $user_email : $user->user_email;
281
			}
282
		}
283
284
		if ( is_add_payment_method_page() ) {
285
			$pay_button_text = __( 'Add Card', 'woocommerce-gateway-stripe' );
@@ 543-552 (lines=10) @@
540
		$display_tokenization = $this->supports( 'tokenization' ) && $this->saved_cards;
541
542
		// If paying from order, we need to get total from order not cart.
543
		if ( ! empty( $_GET['key'] ) ) {
544
			$order      = wc_get_order( wc_get_order_id_by_order_key( wc_clean( $_GET['key'] ) ) );
545
			$total      = $order->get_total();
546
			$user_email = WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $order->billing_email : $order->get_billing_email();
547
		} else {
548
			if ( $user->ID ) {
549
				$user_email = get_user_meta( $user->ID, 'billing_email', true );
550
				$user_email = $user_email ? $user_email : $user->user_email;
551
			}
552
		}
553
554
		ob_start();
555