Code Duplication    Length = 20-20 lines in 2 locations

includes/legacy/class-wc-gateway-stripe.php 1 location

@@ 404-423 (lines=20) @@
401
	 * @param object $order
402
	 * @return object
403
	 */
404
	protected function get_order_source( $order = null ) {
405
		$stripe_customer = new WC_Stripe_Customer();
406
		$stripe_source   = false;
407
		$token_id        = false;
408
409
		if ( $order ) {
410
			if ( $meta_value = get_post_meta( $order->id, '_stripe_customer_id', true ) ) {
411
				$stripe_customer->set_id( $meta_value );
412
			}
413
			if ( $meta_value = get_post_meta( $order->id, '_stripe_card_id', true ) ) {
414
				$stripe_source = $meta_value;
415
			}
416
		}
417
418
		return (object) array(
419
			'token_id' => $token_id,
420
			'customer' => $stripe_customer ? $stripe_customer->get_id() : false,
421
			'source'   => $stripe_source,
422
		);
423
	}
424
425
	/**
426
	 * Process the payment

includes/class-wc-gateway-stripe.php 1 location

@@ 556-575 (lines=20) @@
553
	 * @param object $order
554
	 * @return object
555
	 */
556
	protected function get_order_source( $order = null ) {
557
		$stripe_customer = new WC_Stripe_Customer();
558
		$stripe_source   = false;
559
		$token_id        = false;
560
561
		if ( $order ) {
562
			if ( $meta_value = get_post_meta( $order->id, '_stripe_customer_id', true ) ) {
563
				$stripe_customer->set_id( $meta_value );
564
			}
565
			if ( $meta_value = get_post_meta( $order->id, '_stripe_card_id', true ) ) {
566
				$stripe_source = $meta_value;
567
			}
568
		}
569
570
		return (object) array(
571
			'token_id' => $token_id,
572
			'customer' => $stripe_customer ? $stripe_customer->get_id() : false,
573
			'source'   => $stripe_source,
574
		);
575
	}
576
577
	/**
578
	 * Process the payment