<?php

/**
 * Customer Card Expiring email (plain text)
 *
 * @package ArraySubs\Features\Emails\templates\plain
 * @version 1.0.0
 */

defined('ABSPATH') || exit;

echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n";
echo esc_html(wp_strip_all_tags($arraysubs_email_heading));
echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";

printf(
    /* translators: %s: Customer first name */
    esc_html__('Hi %s,', 'arraysubs'),
    esc_html($arraysubs_customer['first_name'])
);
echo "\n\n";

printf(
    /* translators: %1$s: Card last 4 digits, %2$s: Card expiry date */
    esc_html__('The payment card ending in %1$s that is used for your subscription is expiring on %2$s.', 'arraysubs'),
    esc_html($arraysubs_card_last4),
    esc_html($arraysubs_card_expiry)
);
echo "\n\n";

echo esc_html__('To ensure uninterrupted service, please update your payment method before the expiration date.', 'arraysubs');
echo "\n\n";

echo "----------\n";
echo esc_html__('SUBSCRIPTION DETAILS', 'arraysubs') . "\n";
echo "----------\n\n";

echo esc_html__('Subscription ID: ', 'arraysubs') . '#' . esc_html($arraysubs_subscription_id) . "\n";
echo esc_html__('Product: ', 'arraysubs') . esc_html($arraysubs_product ? $arraysubs_product->get_name() : __('N/A', 'arraysubs')) . "\n";
echo esc_html__('Card Ending In: ', 'arraysubs') . '**** **** **** ' . esc_html($arraysubs_card_last4) . "\n";
echo esc_html__('Card Expires: ', 'arraysubs') . esc_html($arraysubs_card_expiry) . "\n";

echo "\n";
echo esc_html__('UPDATE YOUR PAYMENT METHOD:', 'arraysubs') . "\n";
echo esc_url($arraysubs_update_payment_url);
echo "\n\n";

echo esc_html__('If you do not update your payment method, your next renewal payment may fail and your subscription may be put on hold.', 'arraysubs');
echo "\n\n";

/**
 * Show user-defined additional content - this is set in each email's settings.
 */
if ($arraysubs_additional_content) {
    echo "----------\n\n";
    echo esc_html(wp_strip_all_tags(wptexturize($arraysubs_additional_content)));
    echo "\n\n";
}

// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WooCommerce core hook
echo wp_kses_post(apply_filters('woocommerce_email_footer_text', get_option('woocommerce_email_footer_text')));
