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

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