<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * @var string|null $main_icon
 * @var \Simplyin\Simplyin_W_Plugin\Payments\View_Model\Classic_Checkout\Payment_Method_Item_Provider|null $provider
 */

$simplyin_provider_logo_url = '';
$simplyin_provider_name     = '';

if (
	isset( $provider )
	&& is_object( $provider )
	&& method_exists( $provider, 'get_logo_url' )
	&& method_exists( $provider, 'get_name' )
) {
	$simplyin_provider_logo_url = (string) $provider->get_logo_url();
	$simplyin_provider_name     = (string) $provider->get_name();
}
?>

<?php if ( $simplyin_provider_logo_url ) : ?>
	<img class="simplyin-payment-provider-logo"
		 src="<?php echo esc_url( add_query_arg( 'v', '1.0', $simplyin_provider_logo_url ) ); ?>"
		 alt="<?php echo esc_attr( $simplyin_provider_name ); ?>">
<?php elseif ( ! empty( $main_icon ) ) : ?>
	<img class="simplyin-payment-provider-logo"
		 src="<?php echo esc_url( $main_icon ); ?>"
		 alt="Simply.IN">
<?php endif; ?>
