changes
This commit is contained in:
@@ -152,6 +152,7 @@ app.use((req, res, next) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// In-memory data structures
|
// In-memory data structures
|
||||||
//
|
//
|
||||||
@@ -625,6 +626,13 @@ app.post('/qrcodesu',requireSuperUser,async (req,res) => {
|
|||||||
return res.send({ owner:username, qrcode: URL, magiclink:GetMagicLink(username) });
|
return res.send({ owner:username, qrcode: URL, magiclink:GetMagicLink(username) });
|
||||||
})
|
})
|
||||||
|
|
||||||
|
app.get("/buy",(req,res) => {
|
||||||
|
return res.render("buy",{ username:req.session.username, superuser:req.session.superuser, settings:settings, message: "" });
|
||||||
|
});
|
||||||
|
|
||||||
|
app.post("/buy",(req,res) => {
|
||||||
|
// Stopped here
|
||||||
|
});
|
||||||
|
|
||||||
app.get('/settings',requireSuperUser, (req,res) => {
|
app.get('/settings',requireSuperUser, (req,res) => {
|
||||||
res.render('settings',{ username:req.session.username, superuser:req.session.superuser, settings:settings, message: "" })
|
res.render('settings',{ username:req.session.username, superuser:req.session.superuser, settings:settings, message: "" })
|
||||||
@@ -681,6 +689,7 @@ app.post('/update-setting', requireSuperUser, (req, res) => {
|
|||||||
res.json({ success: true, message: 'Checkbox state updated successfully' });
|
res.json({ success: true, message: 'Checkbox state updated successfully' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
app.post('/pay0',requireLogin,(req,res) => {
|
app.post('/pay0',requireLogin,(req,res) => {
|
||||||
return res.render("pay",{ username:req.session.username, superuser:req.session.superuser, ticket:req.body.ticket, amount:req.body.amount });
|
return res.render("pay",{ username:req.session.username, superuser:req.session.superuser, ticket:req.body.ticket, amount:req.body.amount });
|
||||||
});
|
});
|
||||||
@@ -693,10 +702,10 @@ app.post('/charge', requireLogin, async (req, res) => {
|
|||||||
} else try {
|
} else try {
|
||||||
// Token or Payment Method ID from the client
|
// Token or Payment Method ID from the client
|
||||||
const paymentMethodId = req.body.paymentMethodId;
|
const paymentMethodId = req.body.paymentMethodId;
|
||||||
|
console.log("paymentMethodId: ",paymentMethodId);
|
||||||
|
|
||||||
// Create a PaymentIntent on the server
|
// Create a PaymentIntent on the server
|
||||||
const pennies=Math.round(parseFloat(req.body.amount) * 100);
|
const pennies=Math.round(parseFloat(req.body.amount) * 100);
|
||||||
console.log("Pennies=",pennies);
|
|
||||||
const return_url=base_url+'/mytickets';
|
const return_url=base_url+'/mytickets';
|
||||||
const paymentIntent = await stripe.paymentIntents.create({
|
const paymentIntent = await stripe.paymentIntents.create({
|
||||||
amount: pennies, // Amount in cents
|
amount: pennies, // Amount in cents
|
||||||
|
|||||||
21
views/buy.ejs
Normal file
21
views/buy.ejs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Buy a Ticket</title>
|
||||||
|
<link rel="stylesheet" href="styles.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<%- include('partials/nav') %>
|
||||||
|
<div class="content">
|
||||||
|
<form id="buy" method="post" action="/buy">
|
||||||
|
Email Address to receive tickets:<br>
|
||||||
|
<input type="email" name="email"><br>
|
||||||
|
Number of Tickets:<br>
|
||||||
|
<input type="number" min="1" max="4" step="1" placeholder="1" name="qty"><br>
|
||||||
|
Pay how much for each ticket:<br>
|
||||||
|
<input type="number" min="1.00" max="1000.00" step="0.01" placeholder="50.00" name="amount"><br>
|
||||||
|
<button id="Submit" type="submit">Pay</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
21
views/opencamping.ejs
Normal file
21
views/opencamping.ejs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Buy a Ticket</title>
|
||||||
|
<link rel="stylesheet" href="styles.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<%- include('partials/nav') %>
|
||||||
|
<div class="content">
|
||||||
|
<form id="buy" method="post" action="/buy">
|
||||||
|
Email Address to receive tickets:
|
||||||
|
<input type="email" name="email">
|
||||||
|
Number of Tickets:
|
||||||
|
<input type="number" min="1" max="4" step="1" placeholder="1" name="qty">
|
||||||
|
Pay how much for each ticket:
|
||||||
|
<input type="number" min="1.00" max="1000.00" step="0.01" placeholder="50.00" name="amount">
|
||||||
|
<button id="Submit" type="submit">Pay</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
<!-- views/partials/nav.ejs -->
|
<!-- views/partials/nav.ejs -->
|
||||||
<div class="nav">
|
<div class="nav">
|
||||||
Falls on Fire<br>
|
Falls on Fire<br>
|
||||||
|
<a href="/buy">Buy Tickets</a><br>
|
||||||
|
<%if (typeof username!='undefined' && username) {%>
|
||||||
<a href="/mytickets">View My Tickets</a><br>
|
<a href="/mytickets">View My Tickets</a><br>
|
||||||
|
<%}%>
|
||||||
<%if (typeof superuser!='undefined' && superuser) {%>
|
<%if (typeof superuser!='undefined' && superuser) {%>
|
||||||
<a href="/camps">View Camps (Admin)</a><br>
|
<a href="/camps">View Camps (Admin)</a><br>
|
||||||
<a href="/settings">Settings (Admin)</a><br>
|
<a href="/settings">Settings (Admin)</a><br>
|
||||||
|
|||||||
Reference in New Issue
Block a user