mirror of
https://github.com/myronblair/tomsjavajive-app
synced 2026-06-30 17:50:56 -05:00
170 lines
7.4 KiB
PHP
170 lines
7.4 KiB
PHP
<?php
|
|
ob_start();
|
|
/**
|
|
* Tom's Java Jive - Admin Payment Settings
|
|
*/
|
|
|
|
$pageTitle = 'Payment Settings';
|
|
require_once __DIR__ . '/includes/header.php';
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$section = $_POST['section'] ?? '';
|
|
|
|
if ($section === 'stripe') {
|
|
setSetting('payment_stripe', [
|
|
'enabled' => isset($_POST['stripe_enabled']),
|
|
'test_mode' => isset($_POST['stripe_test_mode']),
|
|
'publishable_key' => trim($_POST['stripe_publishable_key'] ?? ''),
|
|
'secret_key' => trim($_POST['stripe_secret_key'] ?? ''),
|
|
'webhook_secret' => trim($_POST['stripe_webhook_secret'] ?? '')
|
|
]);
|
|
setFlash('success', 'Stripe settings updated');
|
|
}
|
|
|
|
if ($section === 'methods') {
|
|
setSetting('payment_methods', [
|
|
'card' => isset($_POST['method_card']),
|
|
'cash' => isset($_POST['method_cash']),
|
|
'wallet' => isset($_POST['method_wallet']),
|
|
'gift_card' => isset($_POST['method_gift_card'])
|
|
]);
|
|
setFlash('success', 'Payment methods updated');
|
|
}
|
|
|
|
header('Location: /admin/payments.php');
|
|
exit;
|
|
}
|
|
|
|
$stripe = getSetting('payment_stripe', [
|
|
'enabled' => true,
|
|
'test_mode' => true,
|
|
'publishable_key' => '',
|
|
'secret_key' => '',
|
|
'webhook_secret' => ''
|
|
]);
|
|
|
|
$methods = getSetting('payment_methods', [
|
|
'card' => true,
|
|
'cash' => true,
|
|
'wallet' => true,
|
|
'gift_card' => true
|
|
]);
|
|
?>
|
|
|
|
<div class="page-header">
|
|
<h1 class="page-title">Payment Settings</h1>
|
|
</div>
|
|
|
|
<?php if (hasFlash('success')): ?>
|
|
<div class="alert alert-success"><i class="fas fa-check-circle"></i> <?= getFlash('success') ?></div>
|
|
<?php endif; ?>
|
|
|
|
<div style="display: grid; grid-template-columns: 200px 1fr; gap: 1.5rem;">
|
|
<div>
|
|
<div class="admin-card">
|
|
<div class="admin-card-body" style="padding: 0.5rem;">
|
|
<a href="/admin/settings.php" class="nav-item"><i class="fas fa-store"></i> General</a>
|
|
<a href="/admin/shipping.php" class="nav-item"><i class="fas fa-truck"></i> Shipping</a>
|
|
<a href="/admin/payments.php" class="nav-item active"><i class="fas fa-credit-card"></i> Payments</a>
|
|
<a href="/admin/emails.php" class="nav-item"><i class="fas fa-envelope"></i> Emails</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<!-- Stripe Settings -->
|
|
<form method="POST">
|
|
<input type="hidden" name="section" value="stripe">
|
|
<div class="admin-card">
|
|
<div class="admin-card-header">
|
|
<h3 class="admin-card-title"><i class="fab fa-stripe" style="color: #635BFF;"></i> Stripe</h3>
|
|
</div>
|
|
<div class="admin-card-body">
|
|
<div class="form-group">
|
|
<label style="display: flex; align-items: center; gap: 0.5rem; cursor: pointer;">
|
|
<input type="checkbox" name="stripe_enabled" <?= $stripe['enabled'] ? 'checked' : '' ?>>
|
|
Enable Stripe payments
|
|
</label>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label style="display: flex; align-items: center; gap: 0.5rem; cursor: pointer;">
|
|
<input type="checkbox" name="stripe_test_mode" <?= $stripe['test_mode'] ? 'checked' : '' ?>>
|
|
Test mode (use test keys)
|
|
</label>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label">Publishable Key</label>
|
|
<input type="text" name="stripe_publishable_key" class="form-input"
|
|
value="<?= htmlspecialchars($stripe['publishable_key']) ?>"
|
|
placeholder="pk_test_... or pk_live_...">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label">Secret Key</label>
|
|
<input type="password" name="stripe_secret_key" class="form-input"
|
|
value="<?= htmlspecialchars($stripe['secret_key']) ?>"
|
|
placeholder="sk_test_... or sk_live_...">
|
|
</div>
|
|
|
|
<div class="form-group mb-0">
|
|
<label class="form-label">Webhook Secret</label>
|
|
<input type="password" name="stripe_webhook_secret" class="form-input"
|
|
value="<?= htmlspecialchars($stripe['webhook_secret']) ?>"
|
|
placeholder="whsec_...">
|
|
<small class="text-muted">Get this from your Stripe webhook settings</small>
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-primary mt-2">Save Stripe Settings</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<!-- POS Payment Methods -->
|
|
<form method="POST">
|
|
<input type="hidden" name="section" value="methods">
|
|
<div class="admin-card">
|
|
<div class="admin-card-header">
|
|
<h3 class="admin-card-title">POS Payment Methods</h3>
|
|
</div>
|
|
<div class="admin-card-body">
|
|
<p class="text-muted" style="margin-bottom: 1rem;">Select which payment methods are available in the Point of Sale system.</p>
|
|
|
|
<div class="form-group">
|
|
<label style="display: flex; align-items: center; gap: 0.5rem; cursor: pointer;">
|
|
<input type="checkbox" name="method_card" <?= $methods['card'] ? 'checked' : '' ?>>
|
|
<i class="fas fa-credit-card"></i> Card (Terminal)
|
|
</label>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label style="display: flex; align-items: center; gap: 0.5rem; cursor: pointer;">
|
|
<input type="checkbox" name="method_cash" <?= $methods['cash'] ? 'checked' : '' ?>>
|
|
<i class="fas fa-money-bill"></i> Cash
|
|
</label>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label style="display: flex; align-items: center; gap: 0.5rem; cursor: pointer;">
|
|
<input type="checkbox" name="method_wallet" <?= $methods['wallet'] ? 'checked' : '' ?>>
|
|
<i class="fas fa-wallet"></i> Customer Wallet
|
|
</label>
|
|
</div>
|
|
|
|
<div class="form-group mb-0">
|
|
<label style="display: flex; align-items: center; gap: 0.5rem; cursor: pointer;">
|
|
<input type="checkbox" name="method_gift_card" <?= $methods['gift_card'] ? 'checked' : '' ?>>
|
|
<i class="fas fa-gift"></i> Gift Card
|
|
</label>
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-primary mt-2">Save Payment Methods</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<?php require_once __DIR__ . '/includes/footer.php'; ?>
|