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

@@ 512-531 (lines=20) @@
509
	 * @param object $order
510
	 * @return object
511
	 */
512
	protected function get_order_source( $order = null ) {
513
		$stripe_customer = new WC_Stripe_Customer();
514
		$stripe_source   = false;
515
		$token_id        = false;
516
517
		if ( $order ) {
518
			if ( $meta_value = get_post_meta( $order->id, '_stripe_customer_id', true ) ) {
519
				$stripe_customer->set_id( $meta_value );
520
			}
521
			if ( $meta_value = get_post_meta( $order->id, '_stripe_card_id', true ) ) {
522
				$stripe_source = $meta_value;
523
			}
524
		}
525
526
		return (object) array(
527
			'token_id' => $token_id,
528
			'customer' => $stripe_customer ? $stripe_customer->get_id() : false,
529
			'source'   => $stripe_source,
530
		);
531
	}
532
533
	/**
534
	 * Process the payment