<?php

/**
 * Customer SCA Authentication Required 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: %s: Product name */
    esc_html__('Your recent payment for %s requires additional authentication to complete.', 'arraysubs'),
    esc_html($arraysubs_product ? $arraysubs_product->get_name() : __('N/A', 'arraysubs'))
);
echo "\n\n";

echo '*** ' . esc_html__('ACTION REQUIRED: Your bank requires you to verify this payment.', 'arraysubs') . ' ***';
echo "\n\n";

echo "----------\n";
echo esc_html__('PAYMENT 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";

if (!empty($arraysubs_payment_amount)) {
    echo esc_html__('Payment Amount: ', 'arraysubs') . esc_html(wp_strip_all_tags(wc_price($arraysubs_payment_amount))) . "\n";
}

echo esc_html__('Status: ', 'arraysubs') . esc_html__('Awaiting Authentication', 'arraysubs') . "\n";

if (!empty($arraysubs_auth_url)) {
    echo "\n";
    echo esc_html__('AUTHENTICATE YOUR PAYMENT:', 'arraysubs') . "\n";
    echo esc_url($arraysubs_auth_url);
    echo "\n";
}

echo "\n";
echo "----------\n";
echo esc_html__('Why is this needed?', 'arraysubs') . "\n";
echo "----------\n\n";

echo esc_html__('Your bank requires Strong Customer Authentication (SCA) for this transaction. This is a security measure required by European banking regulations to protect you from fraud.', 'arraysubs');
echo "\n\n";

echo esc_html__('If you do not authenticate this payment within 7 days, the payment will 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')));
