Skip to content

Commit

Permalink
simplify branching logic
Browse files Browse the repository at this point in the history
  • Loading branch information
timur27 committed Jun 25, 2024
1 parent 886b452 commit ece0e83
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions includes/class-wc-payments-token-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,16 @@ private function get_gateway_specific_retrievable_payment_types( $gateway_id ) {
$types = [];

foreach ( self::REUSABLE_GATEWAYS_BY_PAYMENT_METHOD as $payment_method => $gateway ) {
if ( $gateway === $gateway_id ) {
// Stripe Link is part of the card gateway, so we need to check separately if Link is enabled.
if ( Payment_Method::LINK === $payment_method ) {
if ( $this->is_payment_method_enabled( Payment_Method::LINK ) ) {
$types[] = Payment_Method::LINK;
}
} else {
$types[] = $payment_method;
}
if ( $gateway !== $gateway_id ) {
continue;
}

// Stripe Link is part of the card gateway, so we need to check separately if Link is enabled.
if ( Payment_Method::LINK === $payment_method && ! $this->is_payment_method_enabled( Payment_Method::LINK ) ) {
continue;
}

$types[] = $payment_method;
}

return $types;
Expand Down

0 comments on commit ece0e83

Please sign in to comment.