<?php
require_once __DIR__.'/../includes/functions.php';
require_once __DIR__.'/../includes/v292_admin_portal_helpers.php';
$admin = require_admin();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
  try {
    $disableKeys = [
      'order_online_payment_enabled','order_manual_payment_enabled','order_payment_proof_enabled',
      'order_payment_instructions_visible','order_paypal_enabled','order_stripe_enabled','order_pay_at_shop_enabled'
    ];
    foreach ($disableKeys as $k) { mj_setting_set($k, '0'); }
    mj_setting_set('order_payment_verify_role', 'disabled');
    mj_setting_set('customer_to_user_payments_disabled', '1');
    mj_setting_set('marketplace_payment_scope_locked', '1');
    flash('success', 'Customer-to-seller payment options remain disabled. User-to-admin billing settings are managed under Payment Center / Upgrade Payment Settings.');
  } catch (Throwable $e) { flash('error', $e->getMessage()); }
  redirect('payment-settings.php');
}
$adminTitle = 'Payment Scope Lock';
$adminSubtitle = 'Customer-to-seller payments are disabled across the marketplace.';
include __DIR__.'/_header.php';
?>
<div class="card card-danger card-outline">
  <div class="card-header"><h3 class="card-title"><i class="fas fa-lock mr-2"></i>Customer-to-Seller Payment Lock</h3></div>
  <div class="card-body">
    <?php show_flash(); ?>
    <div class="alert alert-info">
      <b>Locked business rule:</b><br>
      <?=e(function_exists('mj_payment_scope_notice') ? mj_payment_scope_notice() : 'Customer-to-seller payment is disabled across MJ Marketplace.')?>
    </div>
    <div class="row">
      <div class="col-lg-6">
        <div class="card bg-light">
          <div class="card-body">
            <h5 class="font-weight-bold text-danger"><i class="fas fa-ban mr-1"></i>Disabled everywhere</h5>
            <ul class="mb-0">
              <li>Customer checkout to seller/user</li>
              <li>Buyer payment proof upload for seller order</li>
              <li>Buyer wallet payment to seller/user</li>
              <li>PayPal/Stripe buttons for customer-to-seller order</li>
              <li>Deal voucher purchase / merchant payout / deal refund flow</li>
            </ul>
          </div>
        </div>
      </div>
      <div class="col-lg-6">
        <div class="card bg-light">
          <div class="card-body">
            <h5 class="font-weight-bold text-success"><i class="fas fa-check-circle mr-1"></i>Allowed payments</h5>
            <ul class="mb-0">
              <li>User subscription / package payment to admin</li>
              <li>Listing renewal payment to admin</li>
              <li>Sponsored / featured listing payment to admin</li>
              <li>Extra listing/company slot payment to admin</li>
              <li>Wallet top-up paid to admin and approved by admin</li>
              <li>Admin-created payment request paid to admin</li>
            </ul>
          </div>
        </div>
      </div>
    </div>
    <hr>
    <form method="post">
      <?=csrf_input()?>
      <button class="btn btn-danger"><i class="fas fa-lock mr-1"></i>Re-save Lock / Disable Old Order Payment Settings</button>
      <a class="btn btn-primary" href="payment-center.php"><i class="fas fa-credit-card mr-1"></i>User-to-Admin Payment Center</a>
      <a class="btn btn-outline-primary" href="upgrade-payment-settings.php"><i class="fas fa-cogs mr-1"></i>Admin Billing Methods</a>
    </form>
  </div>
</div>
<?php include __DIR__.'/_footer.php'; ?>
