@@ 406-417 (lines=12) @@ | ||
403 | } |
|
404 | ||
405 | // If we couldn't find a Stripe customer linked to the account, fallback to the order meta data. |
|
406 | if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) { |
|
407 | $stripe_customer_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id() ), '_stripe_customer_id', true ); |
|
408 | $stripe_source_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id() ), '_stripe_source_id', true ); |
|
409 | ||
410 | // For BW compat will remove in future. |
|
411 | if ( empty( $stripe_source_id ) ) { |
|
412 | $stripe_source_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id() ), '_stripe_card_id', true ); |
|
413 | ||
414 | // Take this opportunity to update the key name. |
|
415 | WC_Stripe_Helper::is_pre_30() ? update_post_meta( $subscription->order->id, '_stripe_source_id', $stripe_source_id ) : update_post_meta( $subscription->get_parent_id(), '_stripe_source_id', $stripe_source_id ); |
|
416 | } |
|
417 | } |
|
418 | ||
419 | $stripe_customer->set_id( $stripe_customer_id ); |
|
420 | $sources = $stripe_customer->get_sources(); |
@@ 452-463 (lines=12) @@ | ||
449 | } |
|
450 | ||
451 | // If we couldn't find a Stripe customer linked to the account, fallback to the order meta data. |
|
452 | if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) { |
|
453 | $stripe_customer_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id() ), '_stripe_customer_id', true ); |
|
454 | $stripe_source_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id() ), '_stripe_source_id', true ); |
|
455 | ||
456 | // For BW compat will remove in future. |
|
457 | if ( empty( $stripe_source_id ) ) { |
|
458 | $stripe_source_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id() ), '_stripe_card_id', true ); |
|
459 | ||
460 | // Take this opportunity to update the key name. |
|
461 | WC_Stripe_Helper::is_pre_30() ? update_post_meta( $subscription->order->id, '_stripe_source_id', $stripe_source_id ) : update_post_meta( $subscription->get_parent_id(), '_stripe_source_id', $stripe_source_id ); |
|
462 | } |
|
463 | } |
|
464 | ||
465 | $stripe_customer->set_id( $stripe_customer_id ); |
|
466 | $sources = $stripe_customer->get_sources(); |