payment-poc/templates/info.gohtml

79 lines
3.5 KiB
Plaintext

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Index</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
<style>
th {text-align: left}
h2 {
margin-top: 16px;
}
</style>
</head>
<body>
<!-- As a link -->
<nav class="navbar navbar-dark bg-dark">
<section class="container">
<a class="navbar-brand" href="/">Payment-poc</a>
</section>
</nav>
<section class="container">
<h2>Plaćanje {{.Entry.Id}}</h2>
{{if not (eq .Entry.State "preinitialized")}}
<form method="post" action="/entries/{{.Entry.Id}}/refresh">
<button class="btn btn-primary">Ažuriraj</button>
</form>
{{end}}
<table class="table">
<tr><th>Id: </th><td>{{.Entry.Id}}</td></tr>
<tr><th>Datum izrade: </th><td>{{.Entry.Created.Format "Jan 02, 2006 15:04:05 UTC"}}</td></tr>
<tr><th>Zadnja izmjena: </th><td>{{or (.Entry.Modified.Format "Jan 02, 2006 15:04:05 UTC") .Entry.Created.Format "Jan 02, 2006 15:04:05 UTC"}}</td></tr>
<tr><th>Gateway: </th><td>{{.Entry.Gateway}}</td></tr>
<tr><th>Naplaćena vrijednost: </th><td>{{formatCurrencyPtr .Entry.Amount}}</td></tr>
<tr><th>Ukupna vrijednost: </th><td>{{formatCurrency .Entry.TotalAmount}}</td></tr>
<tr><th>Jezik: </th><td>{{or .Entry.Lang "-"}}</td></tr>
<tr><th>Greške: </th><td>{{or .Entry.Error "-"}}</td></tr>
<tr><th>Stanje: </th><td>{{formatState .Entry.State}}</td></tr>
{{if eq .Entry.Gateway "wspay"}}
<tr><th>WsPay</th><td></td></tr>
<tr><th>Success: </th><td>{{or .Entry.Success "-"}}</td></tr>
{{end}}
{{if eq .Entry.Gateway "stripe"}}
<tr><th>Stripe</th><td></td></tr>
<tr><th>Payment intent ID: </th><td>{{or .Entry.PaymentIntentId "-"}}</td></tr>
{{end}}
{{if eq .Entry.Gateway "viva-wallet"}}
<tr><th>Viva wallet</th><td></td></tr>
<tr><th>Order ID: </th><td>{{or .Entry.OrderId "-"}}</td></tr>
<tr><th>Transaction ID: </th><td>{{or .Entry.TransactionId "-"}}</td></tr>
<tr><th>Event ID: </th><td>{{or .Entry.EventId "-"}}</td></tr>
{{end}}
</table>
{{if eq .Entry.State "accepted"}}
<form class="mb-3" method="post" action="/entries/{{.Entry.Id}}/complete">
<div class="mb-3">
<label class="form-label" for="amount">Završi plaćanje</label>
<input class="form-control" id="amount" required name="amount" type="number" value="{{decimalCurrency .Entry.TotalAmount}}" step="0.01" min="0.01" max="{{decimalCurrency .Entry.TotalAmount}}">
</div>
<button class="btn btn-primary" type="submit">Završi plaćanje</button>
</form>
<form method="post" action="/entries/{{.Entry.Id}}/cancel">
<button class="btn btn-primary" type="submit">Otkaži plaćanje</button>
</form>
{{end}}
</section>
</body>
</html>