restructure files for ejs support

moved style to index.ejs
render views
This commit is contained in:
Aljaz S
2021-11-23 12:56:30 +01:00
parent 74c9519e08
commit abb7476f26
4 changed files with 100 additions and 69 deletions

20
src/views/form.ejs Normal file
View File

@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>UPN-QR :: FORM</title>
</head>
<style>
</style>
<body>
<div>
</div>
</body>
<script>
</script>
</html>

255
src/views/index.ejs Normal file
View File

@@ -0,0 +1,255 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>UPN-QR | Open generator for UPN QR codes</title>
</head>
<style>
body,
html {
margin: 0;
padding: 0;
max-width: 100vw;
overflow-x: hidden;
--c-dark: #202124;
--c-darkish: #303134;
--c-primary: #e8eaed;
--c-accent: #C58AF9;
}
html {
padding: 0 0;
width: 100vw;
display: grid;
grid-template-columns: auto minmax(50vw, 650px) auto;
background-color: var(--c-dark);
}
body {
grid-column: 2;
padding: 15px;
margin: 30px 10px;
display: grid;
grid-template-columns: auto;
grid-auto-rows: auto;
row-gap: 2rem;
border-radius: 1rem;
background-color: var(--c-darkish);
color: var(--c-primary);
font-family: monospace;
font-size: 16px;
line-height: 1.6em;
word-break: normal;
}
a {
color: var(--c-accent);
text-decoration: none;
}
code,
pre {
background-color: var(--c-dark);
padding: 6px 4px 2px 4px;
word-break: break-all;
}
pre {
overflow-x: scroll;
}
section div {
padding-left: 25px;
display: grid;
}
.credits {
display: grid;
align-items: center;
justify-content: center;
text-align: center;
}
</style>
<body>
<section>
<h1>About</h1>
<p>
This API was developed for personal use, but modified and later released for public use.
It is an unofficial application with the sole purpose of simplifying QR code generation for universal payment ordes (<a href="https://upn-qr.si">https://upn-qr.si</a>).
The application does not keep any long-term logs.
</p>
</section>
<section>
<h1>Terms of usage</h1>
<p>Because Public Payments Administration <a href="https://www.gov.si/zbirke/storitve/vkljucitev-v-izdajanje-upn-s-kodo-qr/" target="_blank">prohibits</a> the generation and use of UPN-QR codes by any unapthorized party, you must be <a href="https://www.upn-qr.si/sl/registracija-izdajatelja">authorized</a> in order to use this application and publish the content that it generates.</p>
</section>
<section>
<h1 id="maker"><a href="#maker">&#128279;</a> Form maker</h1>
<div class="maker">
<div>
</div>
</div>
<h1 id="api"><a href="#api">&#128279;</a> API</h1>
<h4 id="api-qrcode"><a href="#api-qrcode">&#128279;</a> <code>GET /api/qrcode</code></h4>
<div>
<span>Returns a <code>image/png</code> image if successful (OK 200), else returns the following JSON <code>{ ok: false, errors: String[] }</code> where <code>errors</code> is an array of descriptive strings.</span>
<br>
<pre>
&#x3C;!-- Meant to be used as direct image source, for example --&#x3E;
&#x3C;img src="https://upn-qr.gitapp.si/api/qrcode?client_name=Šolski center Nova Gorica&client_address=Cankarjeva ulica 8a&client_city=5000 Nova Gorica&amount=00000001000&payment_purpose=placilo&iban=SI56020170014356205&reference=SI121234567890120&issuer_name=Hitre Spletne Strani Na 123&issuer_address=Namisljena ulica 1a&issuer_city=1000 Ljubljana"&#x3E;
</pre>
<img src="/api/qrcode?client_name=Šolski center Nova Gorica&client_address=Cankarjeva ulica 8a&client_city=5000 Nova Gorica&amount=00000001000&payment_purpose=placilo&iban=SI56020170014356205&reference=SI121234567890120&issuer_name=Hitre Spletne Strani Na 123&issuer_address=Namisljena ulica 1a&issuer_city=1000 Ljubljana">
</div>
<br>
<div>
<b>Query parameters:</b>
<p>Following the specification from official documentation - <a href="https://www.upn-qr.si/uploads/files/NavodilaZaProgramerjeUPNQR.pdf">NavodilaZaProgramerjeUPNQR.pdf</a>, section <code>4. Vsebina kode QR</code>.</p>
<h5 id="api-qrcode-client_name"><a href="#api-qrcode-client_name">&#128279;</a> <code>client_name</code></h5>
<div>
<span>Regex: <code>^[a-zA-Z0-9ČŠŽĐ](?:[A-Z0-9 ČŠŽĐ]{0,31}[A-Z0-9ČŠŽĐ])?$/i</code></span>
<br>
<span>Demo: <a href="https://regex101.com/r/t9EaM3/1">regex101.com/r/t9EaM3/1</a></span>
<br>
<span>Description: Name and surname of the client. Max length 33 characters including spaces and numbers.</span>
<br>
<span>Example: Peter Novak</span>
</div>
<h5 id="api-qrcode-client_address"><a href="#api-qrcode-client_address">&#128279;</a> <code>client_address</code></h5>
<div>
<span>Regex: <code>^[a-zA-Z0-9ČŠŽĐ](?:[A-Z0-9 ČŠŽĐ]{0,31}[A-Z0-9ČŠŽĐ])?$/i</code></span>
<br>
<span>Demo: <a href="https://regex101.com/r/JA4wmM/1">regex101.com/r/JA4wmM/1</a></span>
<br>
<span>Description: Full client address in long form. Max length 33 characters including spaces and numbers.</span>
<br>
<span>Example: Ravna ulica 13 a</span>
</div>
<h5 id="api-qrcode-client_city"><a href="#api-qrcode-client_city">&#128279;</a> <code>client_city</code></h5>
<div>
<span>Regex: <code>^[a-zA-Z0-9ČŠŽĐ](?:[A-Z0-9 ČŠŽĐ]{0,31}[A-Z0-9ČŠŽĐ])?$/i</code></span>
<br>
<span>Demo: <a href="https://regex101.com/r/pK3oEm/1">regex101.com/r/5QMpTn/1</a></span>
<br>
<span>Description: Client's city including postal code</span>
<br>
<span>Example: 1000 Ljubljana</span>
</div>
<h5 id="api-qrcode-amount"><a href="#api-qrcode-amount">&#128279;</a> <code>amount</code></h5>
<div>
<span>Regex: <code>^(?=.{11}$)[0]{1,11}[0-9]{0,11}$</code></span>
<br>
<span>Demo: <a href="https://regex101.com/r/Tyq5S1/1">regex101.com/r/Tyq5S1/1</a></span>
<br>
<span>Description: Total amount to pay. Must contain 11 numbers. Last two numbers are decimal places (cents).</span>
<br>
<span>Example (11,32€): 00000001132</span>
</div>
<h5 id="api-qrcode-purpose_code"><a href="#api-qrcode-purpose_code">&#128279;</a> <code>purpose_code</code></h5>
<div>
<span>Regex: <code>^[A-Z]{4}$</code></span>
<br>
<span>Demo: <a href="https://regex101.com/r/TsiZQJ/1">regex101.com/r/TsiZQJ/1</a></span>
<br>
<span>Default: OTHR</span>
<br>
<span>Description: Must contain 4 uppercase characters compliant with public purpose code library <a href="https://www.nlb.si/sepa-koda-namena-prebivalstvo">www.nlb.si/sepa-koda-namena-prebivalstvo</a></span>
<br>
<span>Example: OTHR</span>
</div>
<h5 id="api-qrcode-payment_purpose"><a href="#api-qrcode-payment_purpose">&#128279;</a> <code>payment_purpose</code></h5>
<div>
<span>Regex: <code>^[A-Z0-9ČŠŽĐ](?:[A-Z0-9 ČŠŽĐ]{0,40}[A-Z0-9ČŠŽĐ])?$</code></span>
<br>
<span>Demo: <a href="https://regex101.com/r/y7kUXP/1">regex101.com/r/y7kUXP/1</a></span>
<br>
<span>Description: A Can contain any character including ŠČŽĐ and space. Max length 33 characters including space.</span>
<br>
<span>Example: moutain bike first half</span>
</div>
<h5 id="api-qrcode-iban"><a href="#api-qrcode-iban">&#128279;</a> <code>iban</code></h5>
<div>
<span>Regex: <code>^[A-Z]{2}\d{17}$</code></span>
<br>
<span>Demo: <a href="https://regex101.com/r/8bXDvh/1">regex101.com/r/8bXDvh/1</a></span>
<br>
<span>Description: Must contain country code (exp. SI56). No spaces allowed. Max length 34 characters</span>
<br>
<span>Example: SI56047500000280672</span>
</div>
<h5 id="api-qrcode-reference"><a href="#api-qrcode-reference">&#128279;</a> <code>reference</code></h5>
<div>
<span>Regex: <code>^[A-Z]{2}[0-9\-]{1,24}$</code></span>
<br>
<span>Demo: <a href="https://regex101.com/r/2tSYMw/1">regex101.com/r/2tSYMw/1</a></span>
<br>
<span>Description: Must contain reference model (exp. SI00) and reference (1234-2002). Max length 4+22 numbers and minus symbols. No spaces allowed.</span>
<br>
<span>Example: SI121234567890120</span>
</div>
<h5 id="api-qrcode-issuer_name"><a href="#api-qrcode-issuer_name">&#128279;</a> <code>issuer_name</code></h5>
<div>
<span>Regex: <code>^[a-zA-Z0-9ČŠŽĐ](?:[A-Z0-9 ČŠŽĐ]{0,31}[A-Z0-9ČŠŽĐ])?$/i</code></span>
<br>
<span>Demo: <a href="https://regex101.com/r/DFjB0D/1">regex101.com/r/DFjB0D/1</a></span>
<br>
<span>Description: Name and surname of the issuer or company name. Max length 33 characters including spaces and numbers.</span>
<br>
<span>Example: Spletne strani na 123</span>
</div>
<h5 id="api-qrcode-issuer_address"><a href="#api-qrcode-issuer_address">&#128279;</a> <code>issuer_address</code></h5>
<div>
<span>Regex: <code>^[a-zA-Z0-9ČŠŽĐ](?:[A-Z0-9 ČŠŽĐ]{0,31}[A-Z0-9ČŠŽĐ])?$/i</code></span>
<br>
<span>Demo: <a href="https://regex101.com/r/5oKk0T/1">regex101.com/r/5oKk0T/1</a></span>
<br>
<span>Description: Full issuer address in long form. Max length 33 characters including spaces and numbers.</span>
<br>
<span>Example: Za deveto smreko 15 k</span>
</div>
<h5 id="api-qrcode-issuer_city"><a href="#api-qrcode-issuer_city">&#128279;</a> <code>issuer_city</code></h5>
<div>
<span>Regex: <code>^[a-zA-Z0-9ČŠŽĐ](?:[A-Z0-9 ČŠŽĐ]{0,31}[A-Z0-9ČŠŽĐ])?$/i</code></span>
<br>
<span>Demo: <a href="https://regex101.com/r/JfuNU1/1">regex101.com/r/JfuNU1/1</a></span>
<br>
<span>Description: Issuer city including postal code</span>
<br>
<span>Example: 1000 Ljubljana</span>
</div>
<!-- <h5><code>query</code></h5>
<div>
Regex: <code></code>
<br>
Demo: <a href=""></a>
</div> -->
</div>
<div class="credits">
<span>-- - --</span>
Development and hosting: <a href="https://aljaxus.eu">Aljaž Starc</a>
Insight and needy-greedy-details: <a href="http://www.valentincic.eu/">Tjaž Valentinčič</a>
<span>-</span>
<a href="https://gitplac.si/aljaxus/upn-qr">gitplac.si/aljaxus/upn-qr</a>
<span>-</span>
</div>
</section>
</body>
</html>