mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-27 21:06:18 +02:00
Initial work on registrar deposit payments
This commit is contained in:
parent
97818e59e0
commit
2236e77d18
2 changed files with 128 additions and 1 deletions
|
@ -26,7 +26,28 @@ class FinancialsController extends Controller
|
||||||
public function deposit(Request $request, Response $response)
|
public function deposit(Request $request, Response $response)
|
||||||
{
|
{
|
||||||
if ($_SESSION["auth_roles"] != 0) {
|
if ($_SESSION["auth_roles"] != 0) {
|
||||||
return $response->withHeader('Location', '/dashboard')->withStatus(302);
|
if ($request->getMethod() === 'POST') {
|
||||||
|
// Retrieve POST data
|
||||||
|
$data = $request->getParsedBody();
|
||||||
|
$db = $this->container->get('db');
|
||||||
|
$balance = $db->selectRow('SELECT name, email, accountBalance, creditLimit FROM registrar WHERE id = ?',
|
||||||
|
[ $_SESSION["auth_registrar_id"] ]
|
||||||
|
);
|
||||||
|
echo "Payment here";
|
||||||
|
|
||||||
|
return view($response,'admin/financials/deposit-registrar.twig', [
|
||||||
|
'balance' => $balance
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = $this->container->get('db');
|
||||||
|
$balance = $db->selectRow('SELECT name, accountBalance, creditLimit FROM registrar WHERE id = ?',
|
||||||
|
[ $_SESSION["auth_registrar_id"] ]
|
||||||
|
);
|
||||||
|
|
||||||
|
return view($response,'admin/financials/deposit-registrar.twig', [
|
||||||
|
'balance' => $balance
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->getMethod() === 'POST') {
|
if ($request->getMethod() === 'POST') {
|
||||||
|
|
106
cp/resources/views/admin/financials/deposit-registrar.twig
Normal file
106
cp/resources/views/admin/financials/deposit-registrar.twig
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
{% extends "layouts/app.twig" %}
|
||||||
|
|
||||||
|
{% block title %}{{ __('Registrar Deposit') }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="page-wrapper">
|
||||||
|
<!-- Page header -->
|
||||||
|
<div class="page-header d-print-none">
|
||||||
|
<div class="container-xl">
|
||||||
|
<div class="row g-2 align-items-center">
|
||||||
|
<div class="col">
|
||||||
|
<!-- Page pre-title -->
|
||||||
|
<div class="page-pretitle">
|
||||||
|
{{ __('Overview') }}
|
||||||
|
</div>
|
||||||
|
<h2 class="page-title">
|
||||||
|
{{ __('Registrar Deposit') }}
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Page body -->
|
||||||
|
<div class="page-body">
|
||||||
|
<div class="container-xl">
|
||||||
|
<div class="col-12">
|
||||||
|
{% if deposit is defined %}
|
||||||
|
<div class="alert alert-important alert-success alert-dismissible" role="alert">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 12l5 5l10 -10" /></svg>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{ __('Deposit successfully added. The registrar\'s account balance has been updated.') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a class="btn-close" data-bs-dismiss="alert" aria-label="close"></a>
|
||||||
|
</div>
|
||||||
|
{% elseif error is defined %}
|
||||||
|
<div class="alert alert-important alert-danger alert-dismissible" role="alert">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0" /><path d="M12 8v4" /><path d="M12 16h.01" /></svg>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{ __('Unable to process the deposit due to a system error. Please retry or contact support for help') }}: <strong>{{ error }}</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a class="btn-close" data-bs-dismiss="alert" aria-label="close"></a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<form id="depositForm" action="/deposit" method="post">
|
||||||
|
{{ csrf.field | raw }}
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="paymentMethod" class="form-label">Payment Method</label>
|
||||||
|
<select class="form-select" id="paymentMethod" name="method" required>
|
||||||
|
<option selected disabled value="">Choose Method...</option>
|
||||||
|
<option value="1">Stripe</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="deposit-info">
|
||||||
|
<h5>Current Balance for {{ balance.name }}</h5>
|
||||||
|
<p class="fs-4">${{ balance.accountBalance }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="amount" class="form-label">Amount</label>
|
||||||
|
<input type="number" step="0.01" class="form-control" id="amount" name="amount" placeholder="Enter deposit amount" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="description" class="form-label">Description</label>
|
||||||
|
<textarea class="form-control" id="description" name="description" rows="3" placeholder="Optional deposit description"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-auto">
|
||||||
|
<button type="submit" class="btn btn-primary">Continue to Payment</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer class="footer footer-transparent d-print-none">
|
||||||
|
<div class="container-xl">
|
||||||
|
<div class="col-12 col-lg-auto mt-3 mt-lg-0">
|
||||||
|
<ul class="list-inline list-inline-dots mb-0">
|
||||||
|
<li class="list-inline-item">
|
||||||
|
Copyright © 2023
|
||||||
|
<a href="https://namingo.org" target="_blank" class="link-secondary">Namingo</a>.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue