<?php
/**
 * Template for Refund & Cancellation Policy
 */
defined('ABSPATH') or exit;

$fajaedeseo_company_name = get_option('fajaedeseo_company_name', get_bloginfo('name'));
$fajaedeseo_email = get_option('fajaedeseo_company_email', get_option('admin_email'));
$fajaedeseo_refunds = get_option('fajaedeseo_refunds_offered', '14_days');
$fajaedeseo_conditions = get_option('fajaedeseo_refund_conditions', '');
$fajaedeseo_method = get_option('fajaedeseo_cancellation_method', 'account');
$fajaedeseo_period = get_option('fajaedeseo_cancellation_period', 'end_of_period');
$fajaedeseo_proration = get_option('fajaedeseo_proration', 'no_proration');
?>
<p><strong>Last Updated:</strong> <?php echo esc_html(gmdate('F j, Y')); ?></p>

<h3>1. Cancellations</h3>
<p>
    You can cancel your subscription or service at any time.
    <?php if ($fajaedeseo_method === 'account') : ?>
        To cancel, please log in to your account dashboard and navigate to the billing or subscription settings.
    <?php elseif ($fajaedeseo_method === 'support') : ?>
        To cancel, please contact our support team at <a href="mailto:<?php echo esc_attr($fajaedeseo_email); ?>"><?php echo esc_html($fajaedeseo_email); ?></a>.
    <?php else : ?>
        You can cancel via your account dashboard or by contacting our support team at <a href="mailto:<?php echo esc_attr($fajaedeseo_email); ?>"><?php echo esc_html($fajaedeseo_email); ?></a>.
    <?php endif; ?>
</p>
<p>
    <?php if ($fajaedeseo_period === 'immediate') : ?>
        Upon cancellation, your access to the service will be terminated immediately.
    <?php else : ?>
        Your cancellation will take effect at the end of the current billing cycle. You will retain access to the service until your current billing period ends.
    <?php endif; ?>
</p>

<h3>2. Refunds</h3>
<p>
    <?php if ($fajaedeseo_refunds === 'no') : ?>
        All sales are final, and we do not offer refunds for any products or services purchased.
    <?php elseif ($fajaedeseo_refunds === '14_days') : ?>
        We offer a 14-day money-back guarantee. If you are not satisfied with your purchase, you may request a full refund within 14 days of your initial purchase date.
    <?php elseif ($fajaedeseo_refunds === '30_days') : ?>
        We offer a 30-day money-back guarantee. If you are not satisfied with your purchase, you may request a full refund within 30 days of your initial purchase date.
    <?php endif; ?>
</p>

<?php if ($fajaedeseo_refunds !== 'no' && !empty($fajaedeseo_conditions)) : ?>
    <p><strong>Conditions for Refund:</strong><br>
    <?php echo nl2br(esc_html($fajaedeseo_conditions)); ?></p>
<?php endif; ?>

<h3>3. Proration</h3>
<p>
    <?php if ($fajaedeseo_proration === 'no_proration') : ?>
        We do not provide pro-rated refunds for unused time if you cancel your subscription before the end of the billing cycle.
    <?php else : ?>
        If you cancel early or downgrade your plan, we will issue a pro-rated refund or credit for the unused time remaining in your current billing cycle.
    <?php endif; ?>
</p>

<h3>4. Contact Us</h3>
<p>If you have any questions or concerns regarding our Refund & Cancellation Policy, please contact us at <a href="mailto:<?php echo esc_attr($fajaedeseo_email); ?>"><?php echo esc_html($fajaedeseo_email); ?></a>.</p>