Code Duplication    Length = 12-12 lines in 2 locations

includes/compat/class-wc-stripe-sepa-subs-compat.php 1 location

@@ 466-477 (lines=12) @@
463
		}
464
465
		// If we couldn't find a Stripe customer linked to the account, fallback to the order meta data.
466
		if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) {
467
			$stripe_customer_id = get_post_meta( $subscription->get_parent_id(), '_stripe_customer_id', true );
468
			$stripe_source_id   = get_post_meta( $subscription->get_parent_id(), '_stripe_source_id', true );
469
470
			// For BW compat will remove in future.
471
			if ( empty( $stripe_source_id ) ) {
472
				$stripe_source_id = get_post_meta( $subscription->get_parent_id(), '_stripe_card_id', true );
473
474
				// Take this opportunity to update the key name.
475
				update_post_meta( $subscription->get_parent_id(), '_stripe_source_id', $stripe_source_id );
476
			}
477
		}
478
479
		$stripe_customer->set_id( $stripe_customer_id );
480

includes/compat/class-wc-stripe-subs-compat.php 1 location

@@ 575-586 (lines=12) @@
572
		}
573
574
		// If we couldn't find a Stripe customer linked to the account, fallback to the order meta data.
575
		if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) {
576
			$stripe_customer_id = get_post_meta( $subscription->get_parent_id(), '_stripe_customer_id', true );
577
			$stripe_source_id   = get_post_meta( $subscription->get_parent_id(), '_stripe_source_id', true );
578
579
			// For BW compat will remove in future.
580
			if ( empty( $stripe_source_id ) ) {
581
				$stripe_source_id = get_post_meta( $subscription->get_parent_id(), '_stripe_card_id', true );
582
583
				// Take this opportunity to update the key name.
584
				update_post_meta( $subscription->get_parent_id(), '_stripe_source_id', $stripe_source_id );
585
			}
586
		}
587
588
		$stripe_customer->set_id( $stripe_customer_id );
589