<?php
/**
 * Customer renewal requires verification email.
 *
 * @package ArraySubs\Features\Emails\templates
 */

defined('ABSPATH') || exit;

// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WooCommerce core hook.
do_action('woocommerce_email_header', $arraysubs_email_heading, $arraysubs_email);
?>

<p>
<?php
printf(
    /* translators: %s: Customer first name. */
    esc_html__('Hi %s,', 'arraysubs'),
    esc_html($arraysubs_customer['first_name'])
);
?>
</p>

<p><?php esc_html_e('Your subscription renewal payment needs an extra verification step before it can be completed.', 'arraysubs'); ?></p>

<h2><?php esc_html_e('Renewal details', 'arraysubs'); ?></h2>

<table class="td" cellspacing="0" cellpadding="6" style="width: 100%; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;" border="1">
    <tbody>
        <tr>
            <th class="td" scope="row" style="text-align:left;"><?php esc_html_e('Subscription ID', 'arraysubs'); ?></th>
            <td class="td" style="text-align:left;">#<?php echo esc_html($arraysubs_subscription_id); ?></td>
        </tr>
        <tr>
            <th class="td" scope="row" style="text-align:left;"><?php esc_html_e('Renewal Order', 'arraysubs'); ?></th>
            <td class="td" style="text-align:left;">#<?php echo esc_html($arraysubs_order_id); ?></td>
        </tr>
        <?php if (! empty($arraysubs_card_last4)) : ?>
            <tr>
                <th class="td" scope="row" style="text-align:left;"><?php esc_html_e('Payment Method', 'arraysubs'); ?></th>
                <td class="td" style="text-align:left;">
                    <?php
                    printf(
                        /* translators: 1: card brand, 2: last four digits. */
                        esc_html__('%1$s ending in %2$s', 'arraysubs'),
                        esc_html(ucfirst($arraysubs_card_brand ?: __('Card', 'arraysubs'))),
                        esc_html($arraysubs_card_last4)
                    );
                    ?>
                </td>
            </tr>
        <?php endif; ?>
        <tr>
            <th class="td" scope="row" style="text-align:left;"><?php esc_html_e('Grace period', 'arraysubs'); ?></th>
            <td class="td" style="text-align:left;"><?php echo esc_html($arraysubs_grace_period_ends_at); ?></td>
        </tr>
    </tbody>
</table>

<p style="margin-top: 20px; text-align: center;">
    <a href="<?php echo esc_url($arraysubs_action_url); ?>" class="button" style="display: inline-block; padding: 12px 24px; background-color: #2271b1; color: #ffffff; text-decoration: none; border-radius: 4px; font-weight: bold;">
        <?php esc_html_e('Complete verification', 'arraysubs'); ?>
    </a>
</p>

<p><?php esc_html_e('If verification is not completed, the renewal order will remain unpaid and the subscription will continue through the normal grace-period process.', 'arraysubs'); ?></p>

<?php
if ($arraysubs_additional_content) {
    echo wp_kses_post(wpautop(wptexturize($arraysubs_additional_content)));
}

// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WooCommerce core hook.
do_action('woocommerce_email_footer', $arraysubs_email);
