Compare commits
101 Commits
Author | SHA1 | Date | |
---|---|---|---|
3ba3f4d0f6 | |||
98fb250a16 | |||
3ee95398c4 | |||
21e67b0298 | |||
0fc4b7219c | |||
06e8c8e61d | |||
a467b2c5bf | |||
d6511f3eb7 | |||
5618e147f3 | |||
|
fbde1a0406 | ||
|
dfc5b993f6 | ||
|
4a20995bc3 | ||
a62fdd9491 | |||
16035fee7a | |||
8552933a52 | |||
|
4bde697558 | ||
|
ee1d1e9df2 | ||
|
184dbd5b4e | ||
|
ad9f70dc32 | ||
|
dd942e48f9 | ||
|
d78ad2abf2 | ||
|
9983c63af3 | ||
fccd921545 | |||
fe9d31a076 | |||
d982b97455 | |||
6e0e8cbd7c | |||
|
d5dbf1a3e8 | ||
|
6cd6cb29e2 | ||
6674c9e800 | |||
40b7b321ec | |||
5d998b0e33 | |||
8883d28453 | |||
87907bb633 | |||
ffaa72dda0 | |||
7f0e94d67a | |||
6088788d32 | |||
|
c8521ff824 | ||
|
7db872748e | ||
|
497bf5ce24 | ||
|
71415260e4 | ||
|
526f27d1e7 | ||
8e0ee10171 | |||
|
6a63c39da9 | ||
70729d7309 | |||
f3bcc012e1 | |||
dea9ff308f | |||
a3e27dc82f | |||
|
3e698e2f4c | ||
|
ad991dc7f5 | ||
819c91e319 | |||
516ced5152 | |||
4f47ae6a55 | |||
929f1773c7 | |||
316124aa26 | |||
afc472e7d7 | |||
|
fff00893aa | ||
ffe56bcf9b | |||
|
c275c8f874 | ||
|
32cb70e6d9 | ||
|
51943439f2 | ||
a7af62f7cb | |||
cb4a743c2a | |||
|
980162fd39 | ||
|
c6adea280e | ||
|
7188940141 | ||
1f9f6478e6 | |||
ff4d832ad5 | |||
550e8619d2 | |||
50e548feb5 | |||
|
6026905ad0 | ||
|
426253c93c | ||
|
8e13f14d11 | ||
|
6425d3e524 | ||
68cb3611a4 | |||
d01a5db0ff | |||
ab8f1efa5d | |||
ca17ede359 | |||
90201e85cd | |||
014adeed65 | |||
40d3ec9052 | |||
45db7e7b93 | |||
55b8b75c0e | |||
|
ae01fc27e5 | ||
|
2dc0cd5919 | ||
|
b846fb34f3 | ||
|
4cf28e762e | ||
|
bcc3f22459 | ||
|
222effbfd8 | ||
3d1e47bdf5 | |||
1c54254c74 | |||
471b1cd75c | |||
|
99d6e19487 | ||
|
d500318a33 | ||
ee8e189da5 | |||
75c0442e9a | |||
|
10c8093ed5 | ||
|
caa567d963 | ||
36caeccb74 | |||
efa5baedb6 | |||
500223390d | |||
c6791eefad |
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
/vendor/
|
/vendor/
|
||||||
/logs/*
|
/logs/*
|
||||||
|
/tmp/
|
||||||
|
4
.htaccess
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
RewriteEngine on
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteRule ^(.*)$ index.php/$1 [NC,L,QSA]
|
8
DATABASE.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
Om phpMyAdmin te gebruiken voor de database moet je het volgende doen:
|
||||||
|
|
||||||
|
Inloggen op http://cpanel.verictas.nl met:
|
||||||
|
|
||||||
|
gebruikersnaam: inforbank
|
||||||
|
wachtwoord: inforban
|
||||||
|
|
||||||
|
Klik op phpMyAdmin onder "Databases".
|
11
README.md
@ -4,7 +4,7 @@ Om te kunnen werken aan dit project moet je het volgende doen:
|
|||||||
|
|
||||||
Je doet een git clone (in een random map) (het spreekt voor zich dat je hiervoor eerst git (https://git-scm.com/downloads) moet installeren) met `git clone https://git.verictas.com/InformaticaD4p/informatica-eindproject.git`. Er verschijnt nu een nieuwe map genaamd `informatica-eindproject`. In deze map ga je werken.
|
Je doet een git clone (in een random map) (het spreekt voor zich dat je hiervoor eerst git (https://git-scm.com/downloads) moet installeren) met `git clone https://git.verictas.com/InformaticaD4p/informatica-eindproject.git`. Er verschijnt nu een nieuwe map genaamd `informatica-eindproject`. In deze map ga je werken.
|
||||||
|
|
||||||
Om te starten heb je ook een PHP installatie nodig op je PC. Ik heb een zip bestand met de php installatie op http://christiaangoossens.nl/uploads/afc06760-f1b9-4458-8d93-fc6ea8b2a828/php7.zip. Je pakt dit bestand uit en vindt dan een map genaamd `php7`. Deze map zet je neer op een logische plek (bijvoorbeeld C:/php7 of C:/Program Files/php7) en die voeg je dan toe aan je windows path (dat kun je doen via Configuratischerm>System>Opstartvariabelen of met dit commando in de shell (cmd): `set PATH=%PATH%;C:\php7` (let op, wel het path veranderen naar de map waar je de `php7` map hebt neergezet).
|
Om te starten heb je ook een PHP installatie nodig op je PC. Ik heb een zip bestand met de php installatie op http://christiaangoossens.nl/uploads/afc06760-f1b9-4458-8d93-fc6ea8b2a828/php7.zip. Je pakt dit bestand uit en vindt dan een map genaamd `php7`. Deze map zet je neer op een logische plek (bijvoorbeeld C:/php7 of C:/Program Files/php7) en die voeg je dan toe aan je windows path (dat kun je doen via Configuratischerm>System>Opstartvariabelen (let op, wel het path veranderen naar de map waar je de `php7` map hebt neergezet).
|
||||||
|
|
||||||
|
|
||||||
Als het goed is kun je in de `informatica-eindproject` map nu het volgende commando uitvoeren (mag in CMD of de Git shell): `php -v`. Je krijgt dan het volgende te zien:
|
Als het goed is kun je in de `informatica-eindproject` map nu het volgende commando uitvoeren (mag in CMD of de Git shell): `php -v`. Je krijgt dan het volgende te zien:
|
||||||
@ -15,11 +15,10 @@ Copyright (c) 1997-2017 The PHP Group
|
|||||||
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
|
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
|
||||||
```
|
```
|
||||||
|
|
||||||
Je bent nu klaar om Composer te installeren. Composer is een hulpprogramma dat alle benodigdheden voor jouw project automatisch downloadt en toevoegt. Je kunt de Composer installer vinden op: https://getcomposer.org/download/.
|
(Je kunt ook zelf updaten naar de laatste versie van PHP, deze is een beetje verouderd.)
|
||||||
|
|
||||||
|
Switch nu naar de dev branch en je dan ben je klaar om Composer te installeren. Composer is een hulpprogramma dat alle benodigdheden voor jouw project automatisch downloadt en toevoegt. Je kunt de Composer installer vinden op: https://getcomposer.org/download/.
|
||||||
|
|
||||||
Composer zal je tijdens de installatie vragen om je php versie op te geven, dit staat waarschijnlijk automatisch goed, maar je kunt hem ook zelf zoeken.
|
Composer zal je tijdens de installatie vragen om je php versie op te geven, dit staat waarschijnlijk automatisch goed, maar je kunt hem ook zelf zoeken.
|
||||||
|
|
||||||
|
Je kunt je website nu starten via `composer run`. Er zal dan een webserver voor je worden gestart en de benodigdheden worden automatisch geinstalleerd. Je kunt nu zelf een webbrowser openen om naar `http://localhost:8080` te gaan en dan zul je je website zien.
|
||||||
Zodra alles geïnstalleerd is, ga je terug naar de `informatica-eindproject` map en doe je een `composer install` in de commandline. Alle benodigdheden worden nu gedownload en geïnstalleerd.
|
|
||||||
|
|
||||||
Je kunt je website nu starten via `composer start`. Er zal dan een webserver voor je worden gestart. Je kunt nu zelf een webbrowser openen om naar `http://localhost:8080` te gaan en dan zul je je website zien.
|
|
||||||
|
14
assets/chart.min.js
vendored
Normal file
117
assets/css/login.css
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
.appinfodiv{
|
||||||
|
background-color: #DDDDDD;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.formdiv{
|
||||||
|
background-color: #AAAAAA;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
@import url(http://fonts.googleapis.com/css?family=Roboto);
|
||||||
|
|
||||||
|
/****** LOGIN MODAL ******/
|
||||||
|
.loginmodal-container {
|
||||||
|
padding: 30px;
|
||||||
|
max-width: 350px;
|
||||||
|
width: 100% !important;
|
||||||
|
background-color: #F7F7F7;
|
||||||
|
margin: 0 auto;
|
||||||
|
border-radius: 2px;
|
||||||
|
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
|
||||||
|
overflow: hidden;
|
||||||
|
font-family: roboto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loginmodal-container h1 {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1.8em;
|
||||||
|
font-family: roboto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loginmodal-container input[type=submit] {
|
||||||
|
width: 100%;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loginmodal-container input[type=text], input[type=password] {
|
||||||
|
height: 44px;
|
||||||
|
font-size: 16px;
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid #d9d9d9;
|
||||||
|
border-top: 1px solid #c0c0c0;
|
||||||
|
padding: 0 8px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loginmodal-container input[type=text]:hover, input[type=password]:hover {
|
||||||
|
border: 1px solid #b9b9b9;
|
||||||
|
border-top: 1px solid #a0a0a0;
|
||||||
|
-moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
|
||||||
|
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
|
||||||
|
box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.loginmodal {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 14px;
|
||||||
|
font-family: 'Arial', sans-serif;
|
||||||
|
font-weight: 700;
|
||||||
|
height: 36px;
|
||||||
|
padding: 0 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loginmodal-submit {
|
||||||
|
border: 0px;
|
||||||
|
color: #fff;
|
||||||
|
text-shadow: 0 1px rgba(0,0,0,0.1);
|
||||||
|
background-color: #4d90fe;
|
||||||
|
padding: 17px 0px;
|
||||||
|
font-family: roboto;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loginmodal-submit:hover {
|
||||||
|
border: 0px;
|
||||||
|
text-shadow: 0 1px rgba(0,0,0,0.3);
|
||||||
|
background-color: #357ae8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loginmodal-container a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #666;
|
||||||
|
font-weight: 400;
|
||||||
|
text-align: center;
|
||||||
|
display: inline-block;
|
||||||
|
opacity: 0.6;
|
||||||
|
transition: opacity ease 0.5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
body{
|
||||||
|
color: #ff6000;
|
||||||
|
}
|
||||||
|
|
||||||
|
html, body{
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo{
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.full{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
82
assets/css/main.css
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
/** Header **/
|
||||||
|
.header {
|
||||||
|
height: 150px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top > .container {
|
||||||
|
position: relative;
|
||||||
|
padding-top: 20px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user {
|
||||||
|
text-align: right;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 30px;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu {
|
||||||
|
background: #0094ff;
|
||||||
|
padding: 15px 0;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.nv {
|
||||||
|
list-style-type: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nv > li {
|
||||||
|
float: left;
|
||||||
|
margin-right: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nv > li > a {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nv > li > a:hover {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.circle {
|
||||||
|
color: #0094ff;
|
||||||
|
text-align: center;
|
||||||
|
background: #ffffff;
|
||||||
|
height: 20px;
|
||||||
|
width: 20px;
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Index **/
|
||||||
|
.clickable {
|
||||||
|
cursor: pointer;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clickable:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clickable:hover > div {
|
||||||
|
background: #eaeaea;
|
||||||
|
}
|
||||||
|
|
||||||
|
.big {
|
||||||
|
font-size: 24px;
|
||||||
|
color: #0094ff;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Footer **/
|
||||||
|
.footer {
|
||||||
|
color: grey;
|
||||||
|
margin-top: 50px;
|
||||||
|
}
|
BIN
assets/logo.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
7
assets/moment.min.js
vendored
Normal file
@ -2,15 +2,19 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.5.0",
|
"php": ">=5.5.0",
|
||||||
"slim/slim": "^3.1",
|
"slim/slim": "^3.1",
|
||||||
"slim/php-view": "^2.0"
|
"slim/php-view": "^2.0",
|
||||||
|
"vrana/notorm": "dev-master"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"process-timeout" : 0
|
"process-timeout" : 0
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "php -S 0.0.0.0:8080 -t public public/index.php"
|
"run": "composer install && composer start",
|
||||||
|
"start": "php -S 0.0.0.0:8080"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {"InfD4p\\": "src/"}
|
"psr-4": {
|
||||||
|
"Inforbank\\": "src/"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
58
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "37fe8b36d00a40955cbd52e4949aa8f1",
|
"content-hash": "ca8f6133814e92e4e70538a15c4b1a32",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "container-interop/container-interop",
|
"name": "container-interop/container-interop",
|
||||||
@ -276,23 +276,24 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "slim/slim",
|
"name": "slim/slim",
|
||||||
"version": "3.7.0",
|
"version": "3.8.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/slimphp/Slim.git",
|
"url": "https://github.com/slimphp/Slim.git",
|
||||||
"reference": "4254e40d81559e35cdf856bcbaca5f3af468b7ef"
|
"reference": "5385302707530b2bccee1769613ad769859b826d"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/slimphp/Slim/zipball/4254e40d81559e35cdf856bcbaca5f3af468b7ef",
|
"url": "https://api.github.com/repos/slimphp/Slim/zipball/5385302707530b2bccee1769613ad769859b826d",
|
||||||
"reference": "4254e40d81559e35cdf856bcbaca5f3af468b7ef",
|
"reference": "5385302707530b2bccee1769613ad769859b826d",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"container-interop/container-interop": "^1.1",
|
"container-interop/container-interop": "^1.2",
|
||||||
"nikic/fast-route": "^1.0",
|
"nikic/fast-route": "^1.0",
|
||||||
"php": ">=5.5.0",
|
"php": ">=5.5.0",
|
||||||
"pimple/pimple": "^3.0",
|
"pimple/pimple": "^3.0",
|
||||||
|
"psr/container": "^1.0",
|
||||||
"psr/http-message": "^1.0"
|
"psr/http-message": "^1.0"
|
||||||
},
|
},
|
||||||
"provide": {
|
"provide": {
|
||||||
@ -342,13 +343,54 @@
|
|||||||
"micro",
|
"micro",
|
||||||
"router"
|
"router"
|
||||||
],
|
],
|
||||||
"time": "2016-12-20T20:30:47+00:00"
|
"time": "2017-03-19T17:55:20+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "vrana/notorm",
|
||||||
|
"version": "dev-master",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/vrana/notorm.git",
|
||||||
|
"reference": "e49d5d2f1bfe440dc82b61f46172635dfcb6f6dd"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/vrana/notorm/zipball/e49d5d2f1bfe440dc82b61f46172635dfcb6f6dd",
|
||||||
|
"reference": "e49d5d2f1bfe440dc82b61f46172635dfcb6f6dd",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"NotORM.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"Apache-2.0",
|
||||||
|
"GPL-2.0+"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Jakub Vrána",
|
||||||
|
"homepage": "http://www.vrana.cz/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "NotORM is a PHP library for simple working with data in the database.",
|
||||||
|
"homepage": "http://www.notorm.com/",
|
||||||
|
"keywords": [
|
||||||
|
"database",
|
||||||
|
"dbal"
|
||||||
|
],
|
||||||
|
"time": "2014-10-30 16:55:08"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [],
|
"packages-dev": [],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": [],
|
"stability-flags": {
|
||||||
|
"vrana/notorm": 20
|
||||||
|
},
|
||||||
"prefer-stable": false,
|
"prefer-stable": false,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": {
|
"platform": {
|
||||||
|
BIN
docs/Berichten.png
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
docs/Database.png
Normal file
After Width: | Height: | Size: 83 KiB |
BIN
docs/Documentatie.docx
Normal file
BIN
docs/Documentatie.pdf
Normal file
BIN
docs/Loginscherm.png
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
docs/Nieuwe-overboeking.png
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
docs/Ontwerpfase.pdf
Normal file
BIN
docs/Rekeningenoverzicht.png
Normal file
After Width: | Height: | Size: 49 KiB |
BIN
docs/Statistieken.png
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
docs/Testrapport.pdf
Normal file
BIN
docs/Transactieoverzicht.png
Normal file
After Width: | Height: | Size: 75 KiB |
BIN
docs/Volledige documentatie.pdf
Normal file
@ -12,6 +12,13 @@
|
|||||||
* Jelmer Hinssen
|
* Jelmer Hinssen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Session fix for development
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (session_save_path() === "") {
|
||||||
|
ini_set('session.save_path', realpath(__DIR__ . '/../tmp'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the script is running in CLI mode
|
* Check if the script is running in CLI mode
|
||||||
@ -21,6 +28,7 @@ if (PHP_SAPI == 'cli-server') {
|
|||||||
// something which should probably be served as a static file
|
// something which should probably be served as a static file
|
||||||
$url = parse_url($_SERVER['REQUEST_URI']);
|
$url = parse_url($_SERVER['REQUEST_URI']);
|
||||||
$file = __DIR__ . $url['path'];
|
$file = __DIR__ . $url['path'];
|
||||||
|
|
||||||
if (is_file($file)) {
|
if (is_file($file)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -29,10 +37,10 @@ if (PHP_SAPI == 'cli-server') {
|
|||||||
/**
|
/**
|
||||||
* Require the Composer autoloader to load dependencies
|
* Require the Composer autoloader to load dependencies
|
||||||
*/
|
*/
|
||||||
require __DIR__ . '/../vendor/autoload.php';
|
require __DIR__ . '/vendor/autoload.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the bootstrapping script
|
* Load the bootstrapping script
|
||||||
*/
|
*/
|
||||||
|
|
||||||
include __DIR__ . '/../src/bootstrap.php';
|
include __DIR__ . '/src/bootstrap.php';
|
@ -1,10 +0,0 @@
|
|||||||
RewriteEngine On
|
|
||||||
|
|
||||||
# Some hosts may require you to use the `RewriteBase` directive.
|
|
||||||
# If you need to use the `RewriteBase` directive, it should be the
|
|
||||||
# absolute physical path to the directory that contains this htaccess file.
|
|
||||||
#
|
|
||||||
# RewriteBase /
|
|
||||||
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
|
||||||
RewriteRule ^ index.php [QSA,L]
|
|
45
src/Application.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank;
|
||||||
|
|
||||||
|
class Application
|
||||||
|
{
|
||||||
|
public static $container;
|
||||||
|
public static $app;
|
||||||
|
|
||||||
|
public static function set($app)
|
||||||
|
{
|
||||||
|
self::$app = $app;
|
||||||
|
self::$container = $app->getContainer();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets dependency injection container
|
||||||
|
* @return Slim\Container
|
||||||
|
*/
|
||||||
|
public static function getContainer()
|
||||||
|
{
|
||||||
|
return self::$container;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Slim application object
|
||||||
|
* @return Slim\App;
|
||||||
|
*/
|
||||||
|
public static function getApplication()
|
||||||
|
{
|
||||||
|
return self::$app;
|
||||||
|
}
|
||||||
|
}
|
186
src/Application/API/Handler.php
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application\API;
|
||||||
|
|
||||||
|
use \Slim\App;
|
||||||
|
use Inforbank\Application\Helper\Idob\Client;
|
||||||
|
use Inforbank\Application\Helper\Idob\Transactie;
|
||||||
|
|
||||||
|
class Handler
|
||||||
|
{
|
||||||
|
public function __construct(App $app)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create the API route group
|
||||||
|
*/
|
||||||
|
$app->group('/api', function () {
|
||||||
|
/**
|
||||||
|
* TransactionRequest API Endpoint
|
||||||
|
*
|
||||||
|
* Requires the following POST arguments:
|
||||||
|
* - clientId
|
||||||
|
* - transactionId
|
||||||
|
* - amount
|
||||||
|
* - description
|
||||||
|
* - returnUrl
|
||||||
|
* - hash
|
||||||
|
*/
|
||||||
|
$this->post('/transactionRequest', function ($request, $response, $args) {
|
||||||
|
$parsedBody = $request->getParsedBody();
|
||||||
|
|
||||||
|
if (isset($parsedBody['clientId']) && isset($parsedBody['transactionId']) && isset($parsedBody['amount']) && isset($parsedBody['description']) && isset($parsedBody['returnUrl']) && isset($parsedBody['hash'])) {
|
||||||
|
try {
|
||||||
|
$client = new Client($parsedBody['clientId']);
|
||||||
|
$clientSecret = $client->getClientSecret();
|
||||||
|
|
||||||
|
$sha = hash("sha256", $parsedBody['transactionId'] . $parsedBody['amount'] . $clientSecret);
|
||||||
|
|
||||||
|
if ($sha === $parsedBody['hash']) {
|
||||||
|
if ($parsedBody['returnUrl'] === $client->getClientRedirectURI()) {
|
||||||
|
// Voeg de transactie toe aan de lijst en stuur een response
|
||||||
|
try {
|
||||||
|
$reference = $parsedBody['transactionId'];
|
||||||
|
$amount = ((double) $parsedBody['amount']) / 100;
|
||||||
|
$description = $parsedBody['description'];
|
||||||
|
$clientId = $parsedBody['clientId'];
|
||||||
|
|
||||||
|
$transactie = Transactie::createTransactie($reference, $clientId, $amount, $description);
|
||||||
|
|
||||||
|
$uri = $request->getUri();
|
||||||
|
|
||||||
|
$responseJSON = array(
|
||||||
|
"success" => true,
|
||||||
|
"redirect" => $uri->getBaseUrl() . "/idob/betalen?trxid=" . $transactie
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$response = $response->withStatus(500);
|
||||||
|
$responseJSON = array(
|
||||||
|
"success" => false,
|
||||||
|
"error" => $e->getMessage()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$response = $response->withStatus(400);
|
||||||
|
$responseJSON = array(
|
||||||
|
"success" => false,
|
||||||
|
"error" => "Unknown return URI."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$response = $response->withStatus(403);
|
||||||
|
$responseJSON = array(
|
||||||
|
"success" => false,
|
||||||
|
"error" => "Incorrect verification hash."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$response = $response->withStatus(403);
|
||||||
|
$responseJSON = array(
|
||||||
|
"success" => false,
|
||||||
|
"error" => "Incorrect client id."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$response = $response->withStatus(400);
|
||||||
|
$responseJSON = array(
|
||||||
|
"success" => false,
|
||||||
|
"error" => "Missing one of the following attributes: [clientId, transactionId, amount, description, returnUrl, hash]"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$body = $response->getBody();
|
||||||
|
$body->write(json_encode($responseJSON));
|
||||||
|
return $response->withBody($body);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* StatusRequest API Endpoint
|
||||||
|
*
|
||||||
|
* Requires the following POST arguments:
|
||||||
|
* - clientId
|
||||||
|
* - transactionId
|
||||||
|
* - hash
|
||||||
|
*/
|
||||||
|
$this->post('/statusRequest', function ($request, $response, $args) {
|
||||||
|
$parsedBody = $request->getParsedBody();
|
||||||
|
|
||||||
|
if (isset($parsedBody['clientId']) && isset($parsedBody['transactionId']) && isset($parsedBody['hash'])) {
|
||||||
|
try {
|
||||||
|
$client = new Client($parsedBody['clientId']);
|
||||||
|
$clientSecret = $client->getClientSecret();
|
||||||
|
|
||||||
|
$sha = hash("sha256", $parsedBody['transactionId'] . $clientSecret);
|
||||||
|
|
||||||
|
if ($sha === $parsedBody['hash']) {
|
||||||
|
try {
|
||||||
|
$transactie = Transactie::getTransactie($parsedBody['transactionId']);
|
||||||
|
|
||||||
|
if ($transactie['clientId'] === $parsedBody['clientId']) {
|
||||||
|
$responseJSON = array(
|
||||||
|
"success" => true,
|
||||||
|
"transaction" => array(
|
||||||
|
"reference" => $transactie['reference'],
|
||||||
|
"status" => $transactie['status']
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$response = $response->withStatus(500);
|
||||||
|
$responseJSON = array(
|
||||||
|
"success" => false,
|
||||||
|
"error" => "Transaction not found."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$response = $response->withStatus(500);
|
||||||
|
$responseJSON = array(
|
||||||
|
"success" => false,
|
||||||
|
"error" => $e->getMessage()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$response = $response->withStatus(403);
|
||||||
|
$responseJSON = array(
|
||||||
|
"success" => false,
|
||||||
|
"error" => "Incorrect verification hash."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$response = $response->withStatus(403);
|
||||||
|
$responseJSON = array(
|
||||||
|
"success" => false,
|
||||||
|
"error" => "Incorrect client id."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$response = $response->withStatus(400);
|
||||||
|
$responseJSON = array(
|
||||||
|
"success" => false,
|
||||||
|
"error" => "Missing one of the following attributes: [clientId, transactionId, hash]"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$body = $response->getBody();
|
||||||
|
$body->write(json_encode($responseJSON));
|
||||||
|
return $response->withBody($body);
|
||||||
|
});
|
||||||
|
})->add(function ($request, $response, $next) {
|
||||||
|
/**
|
||||||
|
* Add the correct JSON headers to the responses
|
||||||
|
*/
|
||||||
|
$response = $response->withHeader('Content-type', 'application/json');
|
||||||
|
return $next($request, $response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
76
src/Application/Auth/Authorization.php
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application\Auth;
|
||||||
|
|
||||||
|
use Inforbank\Application;
|
||||||
|
|
||||||
|
class Authorization
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Login user
|
||||||
|
* @param $rekeningnr
|
||||||
|
* @param $passcode
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function login($rekeningnr, $passcode)
|
||||||
|
{
|
||||||
|
$container = Application::getContainer();
|
||||||
|
$db = $container->db;
|
||||||
|
|
||||||
|
$rekeningen = $db->rekeningen->where('rekeningnr', $rekeningnr);
|
||||||
|
|
||||||
|
if (count($rekeningen) !== 1) {
|
||||||
|
throw new \Exception("Rekening niet bekend.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = $rekeningen->max("id");
|
||||||
|
$klantnr = $rekeningen[$id]['klantid'];
|
||||||
|
|
||||||
|
$klant = $db->klanten->where('id', $klantnr)[$klantnr];
|
||||||
|
|
||||||
|
if ($klant['code'] === $passcode) {
|
||||||
|
$_SESSION['userid'] = $klant['id'];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return current user id
|
||||||
|
* @return any
|
||||||
|
*/
|
||||||
|
public function getUserID()
|
||||||
|
{
|
||||||
|
return $_SESSION['userid'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return if the current user is authenticated
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isUserAuthenticated()
|
||||||
|
{
|
||||||
|
return $this->getUserID() !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete user session data
|
||||||
|
*/
|
||||||
|
public function logout()
|
||||||
|
{
|
||||||
|
unset($_SESSION['userid']);
|
||||||
|
}
|
||||||
|
}
|
52
src/Application/Auth/Middleware.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application\Auth;
|
||||||
|
|
||||||
|
use Inforbank\Application;
|
||||||
|
use Inforbank\Application\Helper\Redirect;
|
||||||
|
|
||||||
|
class Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Middleware (https://www.slimframework.com/docs/concepts/middleware.html) om te checken of de gebruiker is ingelogd
|
||||||
|
*/
|
||||||
|
public function __invoke($request, $response, $next)
|
||||||
|
{
|
||||||
|
$container = Application::getContainer();
|
||||||
|
$uri = $request->getUri();
|
||||||
|
|
||||||
|
$path = $uri->getPath();
|
||||||
|
|
||||||
|
if (substr($path, 0, 1) != '/') {
|
||||||
|
$path = "/".$path;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = $uri->getQuery();
|
||||||
|
|
||||||
|
// Check for an existing session
|
||||||
|
if ($container->auth->isUserAuthenticated()) {
|
||||||
|
return $next($request, $response);
|
||||||
|
} else {
|
||||||
|
// Redirect to the login page
|
||||||
|
if ($query !== "") {
|
||||||
|
return Redirect::create($request, $response, '/login?redirect='.$path."&".$query);
|
||||||
|
} elseif ($path === "/") {
|
||||||
|
return Redirect::create($request, $response, '/login');
|
||||||
|
} else {
|
||||||
|
return Redirect::create($request, $response, '/login?redirect='.$path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
32
src/Application/Berichten.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application;
|
||||||
|
|
||||||
|
use \Slim\App;
|
||||||
|
use Inforbank\Application\Helper\Header;
|
||||||
|
use Inforbank\Application\Helper\Berichten as BerichtHelper;
|
||||||
|
|
||||||
|
class Berichten
|
||||||
|
{
|
||||||
|
public function __construct(App $app)
|
||||||
|
{
|
||||||
|
$app->get('/berichten', function ($request, $response, $args) {
|
||||||
|
return $this->renderer->render($response, 'berichten.phtml', [
|
||||||
|
'header' => Header::getHeaderData(),
|
||||||
|
'berichten' => BerichtHelper::getUserBerichten()
|
||||||
|
]);
|
||||||
|
})->add(new Auth\Middleware());
|
||||||
|
}
|
||||||
|
}
|
73
src/Application/Helper/Berichten.php
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application\Helper;
|
||||||
|
|
||||||
|
use Inforbank\Application;
|
||||||
|
|
||||||
|
class Berichten
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get all messages for a user
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getUserBerichten()
|
||||||
|
{
|
||||||
|
$container = Application::getContainer();
|
||||||
|
$db = $container->db;
|
||||||
|
$berichten = $db->berichten->where('klantid', $container->auth->getUserID())->order('datum DESC, id DESC');
|
||||||
|
|
||||||
|
$berichtArray = array();
|
||||||
|
|
||||||
|
foreach ($berichten as $bericht) {
|
||||||
|
$datum = new \DateTime($bericht['datum']);
|
||||||
|
$datum = $datum->format('d-m-Y');
|
||||||
|
|
||||||
|
$berichtArray[] = array(
|
||||||
|
"afzender" => $bericht['afzender'],
|
||||||
|
"bericht" => $bericht['bericht'],
|
||||||
|
"datum" => $datum,
|
||||||
|
"gelezen" => $bericht['gelezen']
|
||||||
|
);
|
||||||
|
if (!$bericht['gelezen']) {
|
||||||
|
$bericht->update([
|
||||||
|
"gelezen" => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $berichtArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send new message
|
||||||
|
* @param int $user Klantid
|
||||||
|
* @param string $afzender String name of the sender
|
||||||
|
* @param string $bericht Message
|
||||||
|
*/
|
||||||
|
public static function newBericht($user, $afzender, $bericht)
|
||||||
|
{
|
||||||
|
$container = Application::getContainer();
|
||||||
|
$db = $container->db;
|
||||||
|
|
||||||
|
$array = array(
|
||||||
|
'klantid' => (int) $user,
|
||||||
|
'afzender' => $afzender,
|
||||||
|
'bericht' => $bericht,
|
||||||
|
'datum' => date('Y-m-d')
|
||||||
|
);
|
||||||
|
|
||||||
|
$row = $db->berichten->insert($array);
|
||||||
|
}
|
||||||
|
}
|
32
src/Application/Helper/Header.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application\Helper;
|
||||||
|
|
||||||
|
use Inforbank\Application;
|
||||||
|
use Inforbank\Application\Helper\Klant;
|
||||||
|
use Inforbank\Proxy;
|
||||||
|
|
||||||
|
class Header
|
||||||
|
{
|
||||||
|
public static function getHeaderData()
|
||||||
|
{
|
||||||
|
$klant = Klant::getCurrentUser();
|
||||||
|
$base = Proxy::$route->getBaseUrl() . "/";
|
||||||
|
return array(
|
||||||
|
'klant' => $klant,
|
||||||
|
'base' => $base
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
95
src/Application/Helper/IBAN.php
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application\Helper;
|
||||||
|
|
||||||
|
class IBAN
|
||||||
|
{
|
||||||
|
private static function wordToNumbers($word)
|
||||||
|
{
|
||||||
|
$newword = "";
|
||||||
|
$wordarray = str_split($word);
|
||||||
|
foreach ($wordarray as $v) {
|
||||||
|
if (ctype_alpha($v)) {
|
||||||
|
$newword .= ord(strtolower($v)) - 87;
|
||||||
|
} else {
|
||||||
|
$newword .= $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $newword;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function getCheckDigits($bignum)
|
||||||
|
{
|
||||||
|
//Modulo staartdeling
|
||||||
|
$modulo97 = (int)substr($bignum, 0, 6);
|
||||||
|
$modulo97 = $modulo97 % 97;
|
||||||
|
$modulo97 = (1000000 * $modulo97) + (int)substr($bignum, 6, 6);
|
||||||
|
$modulo97 = $modulo97 % 97;
|
||||||
|
$modulo97 = (1000000 * $modulo97) + (int)substr($bignum, 12, 6);
|
||||||
|
$modulo97 = $modulo97 % 97;
|
||||||
|
$modulo97 = (1000000 * $modulo97) + (int)substr($bignum, 18, 6);
|
||||||
|
$modulo97 = $modulo97 % 97;
|
||||||
|
$checkdigits = 98 - $modulo97;
|
||||||
|
if (strlen($checkdigits) < 2) {
|
||||||
|
$checkdigits = '0' . $checkdigits;
|
||||||
|
}
|
||||||
|
return $checkdigits;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function isValidIBAN($iban)
|
||||||
|
{
|
||||||
|
$iban = str_replace(" ", "", $iban);
|
||||||
|
$landcode = substr($iban, 0, 2);
|
||||||
|
$controle = substr($iban, 2, 2);
|
||||||
|
$identificatie = substr($iban, 4);
|
||||||
|
$identificatie .= $landcode;
|
||||||
|
$identificatie .= "00";
|
||||||
|
$nummer = self::wordToNumbers($identificatie);
|
||||||
|
return $controle == self::getCheckDigits($nummer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRekeningNummer($iban)
|
||||||
|
{
|
||||||
|
return substr(str_replace(" ", "", $iban), 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getBank($iban)
|
||||||
|
{
|
||||||
|
return substr(str_replace(" ", "", $iban), 4, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getLand($iban)
|
||||||
|
{
|
||||||
|
return substr(str_replace(" ", "", $iban), 0, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getIBAN($rekeningnr)
|
||||||
|
{
|
||||||
|
$landcode = "NL"; // NL in vertaling
|
||||||
|
$landnumber = self::wordToNumbers($landcode);
|
||||||
|
|
||||||
|
|
||||||
|
$bankcode = "INFO";
|
||||||
|
$banknumber = self::wordToNumbers($bankcode);
|
||||||
|
|
||||||
|
$rekeningnr = str_pad($rekeningnr, 10, 0, STR_PAD_LEFT);
|
||||||
|
|
||||||
|
$bignum = $banknumber . $rekeningnr . $landnumber . "00";
|
||||||
|
$checkdigits = self::getCheckDigits($bignum);
|
||||||
|
|
||||||
|
$rekeningnrarr = str_split($rekeningnr, 4);
|
||||||
|
return $landcode.$checkdigits." ".$bankcode." ".$rekeningnrarr[0]." ".$rekeningnrarr[1]." ".$rekeningnrarr[2];
|
||||||
|
}
|
||||||
|
}
|
57
src/Application/Helper/Idob/Client.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application\Helper\Idob;
|
||||||
|
|
||||||
|
use Inforbank\Application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for client authentication in IDOB
|
||||||
|
*/
|
||||||
|
class Client
|
||||||
|
{
|
||||||
|
private $client;
|
||||||
|
|
||||||
|
public function __construct($id)
|
||||||
|
{
|
||||||
|
$container = Application::getContainer();
|
||||||
|
$db = $container->db;
|
||||||
|
|
||||||
|
$this->client = $db->idobc->where("clientId", $id)->limit(1)->fetch();
|
||||||
|
|
||||||
|
if (!$this->client) {
|
||||||
|
throw new \Exception("There is no client with this id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClientSecret()
|
||||||
|
{
|
||||||
|
return $this->client['clientSecret'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClientRedirectURI()
|
||||||
|
{
|
||||||
|
return $this->client['redirectUri'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClientName()
|
||||||
|
{
|
||||||
|
return $this->client['naam'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClientRekening()
|
||||||
|
{
|
||||||
|
return $this->client['rekeningnr'];
|
||||||
|
}
|
||||||
|
}
|
93
src/Application/Helper/Idob/Transactie.php
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application\Helper\Idob;
|
||||||
|
|
||||||
|
use Inforbank\Application;
|
||||||
|
|
||||||
|
class Transactie
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create IDOB transaction
|
||||||
|
* @param string $reference Reference passed by the client (webshop)
|
||||||
|
* @param string $clientId Client identifier
|
||||||
|
* @param double $amount Transaction amount
|
||||||
|
* @param string $description Description for the user
|
||||||
|
* @return int Transaction identifier
|
||||||
|
*/
|
||||||
|
public static function createTransactie($reference, $clientId, $amount, $description)
|
||||||
|
{
|
||||||
|
$container = Application::getContainer();
|
||||||
|
$db = $container->db;
|
||||||
|
|
||||||
|
$trans = $db->idobt->insert([
|
||||||
|
"reference" => $reference,
|
||||||
|
"clientId" => $clientId,
|
||||||
|
"amount" => $amount,
|
||||||
|
"description" => $description,
|
||||||
|
"status" => 1
|
||||||
|
]);
|
||||||
|
return $trans['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get IDOB transaction data
|
||||||
|
* @param int $id Transaction identifier
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getTransactie($id)
|
||||||
|
{
|
||||||
|
$container = Application::getContainer();
|
||||||
|
$db = $container->db;
|
||||||
|
|
||||||
|
$transactie = $db->idobt->where("transactieId", $id)->limit(1)->fetch();
|
||||||
|
|
||||||
|
if (!$transactie) {
|
||||||
|
throw new \Exception("Transaction not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
"transactieId" => $transactie['transactieId'],
|
||||||
|
"reference" => $transactie['reference'],
|
||||||
|
"clientId" => $transactie['clientId'],
|
||||||
|
"amount" => (double) $transactie['amount'],
|
||||||
|
"description" => $transactie['description'],
|
||||||
|
"status" => (int) $transactie['status']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the IDOB transaction status
|
||||||
|
* @param int $id Transaction identifier
|
||||||
|
* @param int $status Status: 1 for pending, 2 for paid, 3 for unknown
|
||||||
|
*/
|
||||||
|
public static function setTransactionStatus($id, $status)
|
||||||
|
{
|
||||||
|
$container = Application::getContainer();
|
||||||
|
$db = $container->db;
|
||||||
|
|
||||||
|
$transactie = $db->idobt->where("transactieId", $id)->limit(1);
|
||||||
|
if (!$transactie) {
|
||||||
|
throw new \Exception("Transaction not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
$transactie->update(array(
|
||||||
|
"status" => $status
|
||||||
|
));
|
||||||
|
|
||||||
|
if (!$transactie) {
|
||||||
|
throw new \Exception("Failed to update status");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
47
src/Application/Helper/Klant.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application\Helper;
|
||||||
|
|
||||||
|
use Inforbank\Application;
|
||||||
|
|
||||||
|
class Klant
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get current user data
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getCurrentUser()
|
||||||
|
{
|
||||||
|
$container = Application::getContainer();
|
||||||
|
$user = $container->auth->getUserID();
|
||||||
|
|
||||||
|
$db = $container->db;
|
||||||
|
|
||||||
|
$klant = $db->klanten->where('id', $user)[$user];
|
||||||
|
$ongelezen = $db->berichten->where("klantid", $user)
|
||||||
|
->and("gelezen", 0);
|
||||||
|
return array(
|
||||||
|
'voornaam' => $klant['voornaam'],
|
||||||
|
'tussenvoegsel' => $klant['tussenvoegsel'],
|
||||||
|
'achternaam' => $klant['achternaam'],
|
||||||
|
'bedrijfsnaam' => $klant['bedrijfsnaam'],
|
||||||
|
'straat' => $klant['straat'],
|
||||||
|
'huisnummer' => $klant['huisnummer'],
|
||||||
|
'postcode' => $klant['postcode'],
|
||||||
|
'woonplaats' => $klant['woonplaats'],
|
||||||
|
'ongelezen' => count($ongelezen)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
191
src/Application/Helper/Overboekingen.php
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Inforbank\Application\Helper;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use Inforbank\Application;
|
||||||
|
use Inforbank\Application\Helper\Rekeningen;
|
||||||
|
|
||||||
|
class Overboekingen
|
||||||
|
{
|
||||||
|
public static $EIGENAAR = 1;
|
||||||
|
public static $IBAN = 2;
|
||||||
|
public static $BANK = 3;
|
||||||
|
public static $BESTAAN = 4;
|
||||||
|
public static $ZELFDE = 5;
|
||||||
|
public static $GETAL = 6;
|
||||||
|
public static $POSITIEF = 7;
|
||||||
|
public static $SALDO = 8;
|
||||||
|
public static $OMSCHRIJVING = 9;
|
||||||
|
public static $SPAARREKENING = 10;
|
||||||
|
|
||||||
|
public static function getErrorMessage($code)
|
||||||
|
{
|
||||||
|
switch ($code) {
|
||||||
|
case Overboekingen::$EIGENAAR:
|
||||||
|
$message = "U bent niet de eigenaar van de betalende rekening.";
|
||||||
|
break;
|
||||||
|
case Overboekingen::$IBAN:
|
||||||
|
$message = "Het ontvangende rekeningnummer is ongeldig.";
|
||||||
|
break;
|
||||||
|
case Overboekingen::$BANK:
|
||||||
|
$message = "U kunt alleen binnen de InforBank geld overmaken.";
|
||||||
|
break;
|
||||||
|
case Overboekingen::$BESTAAN:
|
||||||
|
$message = "De 'naar' rekening bestaat niet.";
|
||||||
|
break;
|
||||||
|
case Overboekingen::$ZELFDE:
|
||||||
|
$message = "De 'van' en 'naar' rekening mogen niet hetzelfde zijn.";
|
||||||
|
break;
|
||||||
|
case Overboekingen::$GETAL:
|
||||||
|
$message = "Het bedrag moet een getal zijn met maximaal 9 cijfers voor en 2 achter de komma.";
|
||||||
|
break;
|
||||||
|
case Overboekingen::$POSITIEF:
|
||||||
|
$message = "Het bedrag moet positief zijn.";
|
||||||
|
break;
|
||||||
|
case Overboekingen::$SALDO:
|
||||||
|
$message = "Uw saldo is te laag voor deze betaling.";
|
||||||
|
break;
|
||||||
|
case Overboekingen::$OMSCHRIJVING:
|
||||||
|
$message = "De omschrijving mag niet langer dan 40 tekens zijn.";
|
||||||
|
break;
|
||||||
|
case Overboekingen::$SPAARREKENING:
|
||||||
|
$message = "Je kan geen geld overmaken van of naar een spaarrekening van een ander.";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$message = "";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function isValidFloat($bedrag)
|
||||||
|
{
|
||||||
|
$komma = 0;
|
||||||
|
$decimalen = 0;
|
||||||
|
$cijfers = 0;
|
||||||
|
for ($i = 0; $i < strlen($bedrag); $i++) {
|
||||||
|
$char = substr($bedrag, $i, 1);
|
||||||
|
$ascii = ord($char);
|
||||||
|
if ($char === "." || $char === ",") {
|
||||||
|
$komma++;
|
||||||
|
if ($komma > 1) {
|
||||||
|
//Twee komma's
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} elseif (($ascii >= ord("0") && $ascii <= ord("9") || $char === "-")) {
|
||||||
|
if ($komma >= 1) {
|
||||||
|
$decimalen++;
|
||||||
|
if ($decimalen > 2) {
|
||||||
|
//Meer dan twee cijfers achter de komma
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$cijfers++;
|
||||||
|
if ($cijfers > 9) {
|
||||||
|
//Te veel cijfers voor de komma
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//Ongeldig teken
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function error($code)
|
||||||
|
{
|
||||||
|
throw new Exception(Overboekingen::getErrorMessage($code), $code);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maak een nieuwe overboeking aan
|
||||||
|
* @param IBAN $van De rekening waar het bedrag vanaf wordt gehaald
|
||||||
|
* @param IBAN $naar De rekening waar het bedrag bijkomt
|
||||||
|
* @param double $bedrag Het bedrag
|
||||||
|
* @param string $omschrijving De omschrijving van de overoeking
|
||||||
|
* $param string $type Het type overboeking
|
||||||
|
*/
|
||||||
|
public static function createOverboeking($van, $naar, $bedrag, $omschrijving, $type)
|
||||||
|
{
|
||||||
|
$vanRekening = Rekeningen::isEigenRekeningIBAN($van);
|
||||||
|
if (!$vanRekening) {
|
||||||
|
//error: rekening is niet van klant
|
||||||
|
Overboekingen::error(Overboekingen::$EIGENAAR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IBAN::isValidIBAN($naar)) {
|
||||||
|
//error: ongeldige iban
|
||||||
|
throw new Exception("De IBAN van de ontvanger is ongeldig.", Overboekingen::$IBAN);
|
||||||
|
} elseif (!(IBAN::getLand($naar) == "NL" && IBAN::getBank($naar) === "INFO")) {
|
||||||
|
//error: andere bank
|
||||||
|
Overboekingen::error(Overboekingen::$BANK);
|
||||||
|
}
|
||||||
|
$naarRekeningnr = IBAN::getRekeningNummer($naar);
|
||||||
|
|
||||||
|
//Controleer of de rekening bestaat
|
||||||
|
$db = Application::getContainer()->db;
|
||||||
|
$naarRekeningen = $db->rekeningen->where("rekeningnr", $naarRekeningnr);
|
||||||
|
if (count($naarRekeningen) !== 1) {
|
||||||
|
//error: rekening bestaat niet
|
||||||
|
Overboekingen::error(Overboekingen::$BESTAAN);
|
||||||
|
}
|
||||||
|
$naarRekening = $naarRekeningen[array("rekeningnr" => $naarRekeningnr)];
|
||||||
|
if ($naarRekeningnr == $vanRekening['nr']) {
|
||||||
|
//error: afzender is hetzelfde als ontvanger
|
||||||
|
Overboekingen::error(Overboekingen::$ZELFDE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Rekeningen::isEigenRekeningnr($naarRekeningnr)
|
||||||
|
&& ((int)$naarRekening['typeid'] === Rekeningen::$SPAARREKENING
|
||||||
|
|| (int)$vanRekening['typeid'] === Rekeningen::$SPAARREKENING)) {
|
||||||
|
Overboekingen::error(Overboekingen::$SPAARREKENING);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Overboekingen::isValidFloat($bedrag)) {
|
||||||
|
Overboekingen::error(Overboekingen::$GETAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$bedragvalue = doubleval(str_replace(",", ".", $bedrag));
|
||||||
|
|
||||||
|
if ($bedragvalue <= 0) {
|
||||||
|
Overboekingen::error(Overboekingen::$POSITIEF);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($bedragvalue > $vanRekening['saldo']) {
|
||||||
|
Overboekingen::error(Overboekingen::$SALDO);
|
||||||
|
}
|
||||||
|
if (strlen($omschrijving) > 40 && $type !== "id") {
|
||||||
|
//error: te lange omschrijving
|
||||||
|
Overboekingen::error(Overboekingen::$OMSCHRIJVING);
|
||||||
|
}
|
||||||
|
//Voeg transactie toe
|
||||||
|
$db->transacties->insert([
|
||||||
|
"van" => $vanRekening['nr'],
|
||||||
|
"naar" => $naarRekeningnr,
|
||||||
|
"bedrag" => $bedragvalue,
|
||||||
|
"type" => $type,
|
||||||
|
"omschrijving" => $omschrijving,
|
||||||
|
"datum" => date("Y-m-d")
|
||||||
|
]);
|
||||||
|
|
||||||
|
//Wijzig saldo
|
||||||
|
$db->rekeningen->where("rekeningnr", $vanRekening['nr'])->update([
|
||||||
|
"saldo" => ((double) $vanRekening['saldo'] - $bedragvalue)
|
||||||
|
]);
|
||||||
|
$naarRekening->update([
|
||||||
|
"saldo" => ((double) $naarRekening['saldo'] + $bedragvalue)
|
||||||
|
]);
|
||||||
|
//Stuur bericht bij laag saldo
|
||||||
|
if ($vanRekening['saldo'] - $bedragvalue < 20) {
|
||||||
|
Berichten::newBericht(Application::getContainer()->auth->getUserID(), "Bank", "U heeft een laag saldo op uw rekening: " . IBAN::getIBAN($vanRekening['nr']) . ".<br/>Uw huidige saldo is " . money_format('%(#1n', $vanRekening['saldo'] - $bedragvalue) . ".");
|
||||||
|
}
|
||||||
|
//In de database worden de getallen met 10 cijfers voor de komma opgeslagen
|
||||||
|
//Als het saldo te hoog wordt heb je een probleem
|
||||||
|
if ($naarRekening['saldo'] + $bedragvalue > 9000000000) {
|
||||||
|
Berichten::newBericht($naarRekening['klantid'], "Bank", "Uw saldo is te hoog!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
33
src/Application/Helper/Redirect.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application\Helper;
|
||||||
|
|
||||||
|
class Redirect
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create a new redirect to the given path
|
||||||
|
* @param Request $request
|
||||||
|
* @param Response $response
|
||||||
|
* @param string $path
|
||||||
|
* @return Response object
|
||||||
|
*/
|
||||||
|
public static function create($request, $response, $path)
|
||||||
|
{
|
||||||
|
$basePath = $request->getUri()->getBaseUrl();
|
||||||
|
$response = $response->withStatus(302);
|
||||||
|
$response = $response->withHeader('Location', $basePath . $path);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
}
|
92
src/Application/Helper/Rekeningen.php
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application\Helper;
|
||||||
|
|
||||||
|
use Inforbank\Application;
|
||||||
|
|
||||||
|
class Rekeningen
|
||||||
|
{
|
||||||
|
public static $BETAALREKENING = 1;
|
||||||
|
public static $SPAARREKENING = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current user bank accounts
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getCurrentUserRekeningen()
|
||||||
|
{
|
||||||
|
$container = Application::getContainer();
|
||||||
|
$user = $container->auth->getUserID();
|
||||||
|
|
||||||
|
$db = $container->db;
|
||||||
|
|
||||||
|
$rekeningen = $db->rekeningen->where('klantid', $user);
|
||||||
|
|
||||||
|
$returnArray = array();
|
||||||
|
|
||||||
|
foreach ($rekeningen as $rekening) {
|
||||||
|
$type = $db->types->where('id', $rekening['typeid'])[$rekening['typeid']];
|
||||||
|
|
||||||
|
$returnArray[] = array(
|
||||||
|
"iban" => IBAN::getIBAN($rekening['rekeningnr']),
|
||||||
|
"nr" => $rekening['rekeningnr'],
|
||||||
|
"saldo" => (double) $rekening['saldo'],
|
||||||
|
"naam" => $type['rekeningnaam'],
|
||||||
|
"rente" => $type['rente']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $returnArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the current user is the owner of this bank account
|
||||||
|
* @param string $iban
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function isEigenRekeningIBAN($iban)
|
||||||
|
{
|
||||||
|
$rekeningen = Rekeningen::getCurrentUserRekeningen();
|
||||||
|
$vanRekening = false;
|
||||||
|
//Controleer of de rekening wel van de ingelogde klant is
|
||||||
|
foreach ($rekeningen as $rek) {
|
||||||
|
if ($rek['iban'] === $iban) {
|
||||||
|
$vanRekening = $rek;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $vanRekening;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the current user is the owner of this bank account
|
||||||
|
* @param string $nr Internal bank account number
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function isEigenRekeningnr($nr)
|
||||||
|
{
|
||||||
|
$rekeningen = Rekeningen::getCurrentUserRekeningen();
|
||||||
|
$vanRekening = false;
|
||||||
|
|
||||||
|
//Controleer of de rekening wel van de ingelogde klant is
|
||||||
|
foreach ($rekeningen as $rek) {
|
||||||
|
if ((int) $rek['nr'] === (int) $nr) {
|
||||||
|
$vanRekening = $rek;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $vanRekening;
|
||||||
|
}
|
||||||
|
}
|
58
src/Application/Helper/Statistieken.php
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Inforbank\Application\Helper;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use Inforbank\Application;
|
||||||
|
|
||||||
|
class Statistieken
|
||||||
|
{
|
||||||
|
public static $EIGENAAR = 1;
|
||||||
|
|
||||||
|
public static function getSaldoverloop($dagen, $rekeningNummer)
|
||||||
|
{
|
||||||
|
if (!Rekeningen::isEigenRekeningnr($rekeningNummer)) {
|
||||||
|
throw new Exception("Dit is niet uw eigen rekening", Statistieken::$EIGENAAR);
|
||||||
|
}
|
||||||
|
$xas = array();
|
||||||
|
for ($i = $dagen; $i >= 0; $i--) {
|
||||||
|
$xas[] = date("Y-m-d", strtotime("now") - $i * 86400);
|
||||||
|
}
|
||||||
|
$container = Application::getContainer();
|
||||||
|
$db = $container->db;
|
||||||
|
$saldo = $db->rekeningen->where("rekeningnr", $rekeningNummer)[array("rekeningnr" => $rekeningNummer)]['saldo'];
|
||||||
|
$eraf = $db->transacties->select("datum, SUM(bedrag) as bedr")->where("van", $rekeningNummer)
|
||||||
|
->and("`datum` >= '" . date("Y-m-d", strtotime("now") - $dagen * 86400) . "'")->group("datum")->order("datum DESC");
|
||||||
|
$erbij = $db->transacties->select("datum, SUM(bedrag) as bedr")->where("naar", $rekeningNummer)
|
||||||
|
->group("datum")->order("datum DESC");
|
||||||
|
$huidigSaldo = (double)$saldo;
|
||||||
|
$vandaag = strtotime("now");
|
||||||
|
$yas = array_fill(0, $dagen + 1, 0);
|
||||||
|
foreach ($eraf as $af) {
|
||||||
|
$dag = strtotime($af['datum']);
|
||||||
|
$diff = floor(($vandaag - $dag)/86400);
|
||||||
|
if ($diff <= $dagen) {
|
||||||
|
$yas[$dagen - $diff] = (double)$af['bedr'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($erbij as $bij) {
|
||||||
|
$dag = strtotime($bij['datum']);
|
||||||
|
$diff = floor(($vandaag - $dag)/86400);
|
||||||
|
if ($diff <= $dagen) {
|
||||||
|
$yas[$dagen - $diff + 1] -= (double)$bij['bedr'];
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$verandering = 0;
|
||||||
|
for ($i = $dagen; $i >= 0; $i--) {
|
||||||
|
$huidigSaldo += $verandering;
|
||||||
|
$verandering = $yas[$i];
|
||||||
|
$yas[$i] = $huidigSaldo;
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
"x-as" => $xas,
|
||||||
|
"y-as" => $yas
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
102
src/Application/Idob.php
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application;
|
||||||
|
|
||||||
|
use \Slim\App;
|
||||||
|
use Inforbank\Application\Auth\Middleware;
|
||||||
|
use Inforbank\Application\Helper\Header;
|
||||||
|
use Inforbank\Application\Helper\Idob\Transactie;
|
||||||
|
use Inforbank\Application\Helper\Idob\Client;
|
||||||
|
use Inforbank\Application\Helper\Rekeningen as RekeningHelper;
|
||||||
|
use Inforbank\Application\Helper\Berichten as BerichtenHelper;
|
||||||
|
use Inforbank\Application\Helper\Overboekingen;
|
||||||
|
use Inforbank\Application\Helper\Redirect;
|
||||||
|
use Inforbank\Application\Helper\IBAN;
|
||||||
|
|
||||||
|
class Idob
|
||||||
|
{
|
||||||
|
public function __construct(App $app)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create the API route group
|
||||||
|
*/
|
||||||
|
$app->group('/idob', function () {
|
||||||
|
$this->get('/betalen', function ($request, $response, $args) {
|
||||||
|
$query = $request->getQueryParams();
|
||||||
|
$rekeningen = RekeningHelper::getCurrentUserRekeningen();
|
||||||
|
|
||||||
|
try {
|
||||||
|
$transactie = Transactie::getTransactie($query['trxid']);
|
||||||
|
$client = new Client($transactie['clientId']);
|
||||||
|
$naam = $client->getClientName();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$transactie = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->renderer->render($response, 'idob.phtml', [
|
||||||
|
'header' => Header::getHeaderData(),
|
||||||
|
'transactie' => $transactie,
|
||||||
|
'webwinkel' => $naam,
|
||||||
|
'rekeningen' => $rekeningen
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
$this->get('/mislukt', function ($request, $response, $args) {
|
||||||
|
return $this->renderer->render($response, 'idobmislukt.phtml', [
|
||||||
|
'header' => Header::getHeaderData()
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
$this->post('/betalen', function ($request, $response, $args) {
|
||||||
|
$query = $request->getQueryParams();
|
||||||
|
$post = $request->getParsedBody();
|
||||||
|
$van = $post['van'];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$transactie = Transactie::getTransactie($query['trxid']);
|
||||||
|
$client = new Client($transactie['clientId']);
|
||||||
|
$redirectUri = $client->getClientRedirectURI();
|
||||||
|
$rekening = $client->getClientRekening();
|
||||||
|
$naam = $client->getClientName();
|
||||||
|
|
||||||
|
try {
|
||||||
|
/**
|
||||||
|
* All set to pay!
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Do overboeking
|
||||||
|
Overboekingen::createOverboeking(IBAN::getIBAN($van), IBAN::getIBAN($rekening), $transactie['amount'], "Betaling aan " . $naam . " voor transactie " . $transactie['reference'], "id");
|
||||||
|
|
||||||
|
// Do Status update
|
||||||
|
Transactie::setTransactionStatus($transactie['transactieId'], 2);
|
||||||
|
|
||||||
|
// Do bericht
|
||||||
|
BerichtenHelper::newBericht($this->auth->getUserID(), $naam, "Betaling met transactiereferentie " . $transactie['reference'] . " gelukt.");
|
||||||
|
|
||||||
|
$response = $response->withStatus(302);
|
||||||
|
$response = $response->withHeader('Location', $redirectUri . "?trxid=".$transactie['transactieId']);
|
||||||
|
return $response;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$response = $response->withStatus(302);
|
||||||
|
$response = $response->withHeader('Location', $redirectUri . "?error=".$e->getMessage());
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return Redirect::create($request, $response, "/idob/mislukt");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})->add(new Middleware());
|
||||||
|
}
|
||||||
|
}
|
69
src/Application/Login.php
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application;
|
||||||
|
|
||||||
|
use \Slim\App;
|
||||||
|
use Inforbank\Application\Helper\Redirect;
|
||||||
|
use Inforbank\Proxy;
|
||||||
|
|
||||||
|
class Login
|
||||||
|
{
|
||||||
|
public function __construct(App $app)
|
||||||
|
{
|
||||||
|
$app->get('/login', function ($request, $response, $args) {
|
||||||
|
$query = $request->getQueryParams();
|
||||||
|
$error = isset($query['error']);
|
||||||
|
|
||||||
|
// Render index view
|
||||||
|
return $this->renderer->render($response, 'login.phtml', array(
|
||||||
|
'base' => Proxy::$route->getBaseUrl() . "/",
|
||||||
|
'error' => $error
|
||||||
|
));
|
||||||
|
});
|
||||||
|
|
||||||
|
$app->post('/login', function ($request, $response, $args) {
|
||||||
|
// Render index view
|
||||||
|
$post = $request->getParsedBody();
|
||||||
|
$query = $request->getQueryParams();
|
||||||
|
$redirect = $query['redirect'];
|
||||||
|
unset($query['redirect']);
|
||||||
|
|
||||||
|
$queryString = http_build_query($query);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$resp = $this->auth->login($post['rekeningnr'], $post['pascode']);
|
||||||
|
|
||||||
|
if ($resp && $redirect !== "") {
|
||||||
|
if ($queryString !== "") {
|
||||||
|
return Redirect::create($request, $response, $redirect . "?" . $queryString);
|
||||||
|
} else {
|
||||||
|
return Redirect::create($request, $response, $redirect);
|
||||||
|
}
|
||||||
|
} elseif ($resp) {
|
||||||
|
return Redirect::create($request, $response, '/rekeningen');
|
||||||
|
} else {
|
||||||
|
return Redirect::create($request, $response, '/login?error&redirect='.$redirect);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return Redirect::create($request, $response, '/login?error&redirect='.$redirect);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$app->get('/logout', function ($request, $response, $args) {
|
||||||
|
$this->auth->logout();
|
||||||
|
return Redirect::create($request, $response, '/login');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -12,12 +12,13 @@
|
|||||||
* Jelmer Hinssen
|
* Jelmer Hinssen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace InfD4p\Application;
|
namespace Inforbank\Application;
|
||||||
|
|
||||||
use \Slim\App;
|
use \Slim\App;
|
||||||
|
use Inforbank\Application\Helper\Redirect;
|
||||||
|
|
||||||
class Main {
|
class Main
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Constructor function
|
* Constructor function
|
||||||
* @param App $app App Dependency Injection
|
* @param App $app App Dependency Injection
|
||||||
@ -29,10 +30,10 @@ class Main {
|
|||||||
* Hier wordt onze applicatie gestart. De functie hieronder wordt aangeroepen bij het starten van de app. Hier kun je dus routes toevoegen.
|
* Hier wordt onze applicatie gestart. De functie hieronder wordt aangeroepen bij het starten van de app. Hier kun je dus routes toevoegen.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function __construct(App $app) {
|
public function __construct(App $app)
|
||||||
$app->get('/[{name}]', function ($request, $response, $args) {
|
{
|
||||||
// Render index view
|
$app->get('/', function ($request, $response, $args) {
|
||||||
return $this->renderer->render($response, 'index.phtml', $args);
|
return Redirect::create($request, $response, '/rekeningen');
|
||||||
});
|
})->add(new Auth\Middleware());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
54
src/Application/Overboeking.php
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use Inforbank\Application\Auth\Middleware;
|
||||||
|
use Inforbank\Application\Helper\Header;
|
||||||
|
use Inforbank\Application\Helper\IBAN;
|
||||||
|
use Inforbank\Application\Helper\Overboekingen;
|
||||||
|
use Inforbank\Application\Helper\Redirect;
|
||||||
|
use Inforbank\Application\Helper\Rekeningen;
|
||||||
|
use Slim\App;
|
||||||
|
|
||||||
|
class Overboeking
|
||||||
|
{
|
||||||
|
public function __construct(App $app)
|
||||||
|
{
|
||||||
|
$app->get('/overboeking', function ($request, $response, $args) use ($app) {
|
||||||
|
$rekeningen = Rekeningen::getCurrentUserRekeningen();
|
||||||
|
return $this->renderer->render($response, 'overboeking.phtml', [
|
||||||
|
'header' => Header::getHeaderData(),
|
||||||
|
'rekeningen' => $rekeningen,
|
||||||
|
'error' => $_GET['error']
|
||||||
|
]);
|
||||||
|
})->add(new Middleware());
|
||||||
|
|
||||||
|
$app->post('/overboeking', function ($request, $response, $args) {
|
||||||
|
$post = $request->getParsedBody();
|
||||||
|
$van = $post['van'];
|
||||||
|
$naar = $post['naar'];
|
||||||
|
$bedrag = $post['bedrag'];
|
||||||
|
$omschrijving = $post['omschrijving'];
|
||||||
|
|
||||||
|
try {
|
||||||
|
Overboekingen::createOverboeking(IBAN::getIBAN($van), $naar, $bedrag, $omschrijving, "bg");
|
||||||
|
return Redirect::create($request, $response, "/rekeningen/$van?geslaagd=1");
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return Redirect::create($request, $response, "/overboeking?error=" . $e->getCode() . "");
|
||||||
|
}
|
||||||
|
})->add(new Middleware());
|
||||||
|
}
|
||||||
|
}
|
36
src/Application/Rekeningen.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application;
|
||||||
|
|
||||||
|
use \Slim\App;
|
||||||
|
use Inforbank\Application\Helper\Header;
|
||||||
|
use Inforbank\Application\Helper\Rekeningen as RekeningHelper;
|
||||||
|
|
||||||
|
class Rekeningen
|
||||||
|
{
|
||||||
|
public function __construct(App $app)
|
||||||
|
{
|
||||||
|
$app->get('/rekeningen', function ($request, $response, $args) {
|
||||||
|
// Ophalen klant
|
||||||
|
$rekeningen = RekeningHelper::getCurrentUserRekeningen();
|
||||||
|
|
||||||
|
// Render index view
|
||||||
|
return $this->renderer->render($response, 'index.phtml', [
|
||||||
|
'header' => Header::getHeaderData(),
|
||||||
|
'rekeningen' => $rekeningen
|
||||||
|
]);
|
||||||
|
})->add(new Auth\Middleware());
|
||||||
|
}
|
||||||
|
}
|
46
src/Application/Statistieken.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application;
|
||||||
|
|
||||||
|
use Inforbank\Application\Auth\Middleware;
|
||||||
|
use Inforbank\Application\Helper\Header;
|
||||||
|
use Inforbank\Application\Helper\Statistieken as StatistiekenHelper;
|
||||||
|
use Slim\App;
|
||||||
|
|
||||||
|
class Statistieken
|
||||||
|
{
|
||||||
|
public function __construct(App $app)
|
||||||
|
{
|
||||||
|
$app->get('/statistieken/{rekeningnummer}', function ($request, $response, $args) {
|
||||||
|
try {
|
||||||
|
$verloop = StatistiekenHelper::getSaldoverloop(30, $args['rekeningnummer']);
|
||||||
|
return $this->renderer->render($response, "statistieken.phtml", [
|
||||||
|
"header" => Header::getHeaderData(),
|
||||||
|
"rekeningnr" => $args['rekeningnummer'],
|
||||||
|
"statistieken" => [
|
||||||
|
"x-as" => $verloop['x-as'],
|
||||||
|
"y-as" => $verloop['y-as']
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->renderer->render($response, "statistieken.phtml", [
|
||||||
|
"header" => Header::getHeaderData(),
|
||||||
|
"rekeningnr" => $args['rekeningnummer'],
|
||||||
|
"statistieken" => false
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
})->add(new Middleware());
|
||||||
|
}
|
||||||
|
}
|
62
src/Application/Transacties.php
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank\Application;
|
||||||
|
|
||||||
|
use \Slim\App;
|
||||||
|
use Inforbank\Application\Helper\Header;
|
||||||
|
use Inforbank\Application\Helper\Rekeningen;
|
||||||
|
use Inforbank\Application\Helper\IBAN;
|
||||||
|
use Inforbank\Application;
|
||||||
|
|
||||||
|
class Transacties
|
||||||
|
{
|
||||||
|
public function __construct(App $app)
|
||||||
|
{
|
||||||
|
$app->get('/rekeningen/{rekeningnummer}', function ($request, $response, $args) {
|
||||||
|
$rekeningen = Rekeningen::getCurrentUserRekeningen();
|
||||||
|
$rekening = $rekening = Rekeningen::isEigenRekeningnr($args['rekeningnummer']);
|
||||||
|
$rekeningnr = $args['rekeningnummer'];
|
||||||
|
if (!$rekening) {
|
||||||
|
return $this->renderer->render($response, 'transacties.phtml', [
|
||||||
|
'header' => Header::getHeaderData(),
|
||||||
|
'rekening' => false
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
$container = Application::getContainer();
|
||||||
|
$db = $container->db;
|
||||||
|
$transacties = $db->transacties->where('van', $rekeningnr)->or('naar', $rekeningnr)
|
||||||
|
->order("datum DESC, id DESC");
|
||||||
|
|
||||||
|
$returnArray = array();
|
||||||
|
|
||||||
|
foreach ($transacties as $transactie) {
|
||||||
|
$returnArray[] = array(
|
||||||
|
"van" => IBAN::getIBAN($transactie['van']),
|
||||||
|
"naar" => IBAN::getIBAN($transactie['naar']),
|
||||||
|
"bedrag" => $transactie['bedrag'],
|
||||||
|
"type" => $transactie['type'],
|
||||||
|
"omschrijving" => $transactie['omschrijving'],
|
||||||
|
"datum" => $transactie['datum']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $this->renderer->render($response, 'transacties.phtml', [
|
||||||
|
'header' => Header::getHeaderData(),
|
||||||
|
'rekening' => $rekening,
|
||||||
|
'transacties' => $returnArray,
|
||||||
|
'geslaagd' => $_GET['geslaagd']
|
||||||
|
]);
|
||||||
|
})->add(new Auth\Middleware());
|
||||||
|
}
|
||||||
|
}
|
119
src/Proxy.php
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informatica Eindproject D4p
|
||||||
|
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||||
|
* Docent: Hans de Wolf
|
||||||
|
*
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Daniel Boutros,
|
||||||
|
* Christiaan Goossens,
|
||||||
|
* Jelmer Hinssen
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Inforbank;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Proxy class om de limitaties van de sgni.nl webserver te omzeilen. Het is mogelijk om de site te bezoeken via zowel /login als /index.php/login op een goed geconfigureerde webserver, maar als de /index.php/login url wordt gebruikt is de onderstaande static file proxy nodig.
|
||||||
|
*/
|
||||||
|
class Proxy
|
||||||
|
{
|
||||||
|
public static $route;
|
||||||
|
|
||||||
|
public function __invoke($request, $response, $next)
|
||||||
|
{
|
||||||
|
$uri = $request->getUri();
|
||||||
|
|
||||||
|
self::$route = $uri;
|
||||||
|
|
||||||
|
$path = $uri->getPath();
|
||||||
|
$pa = explode('assets/', $path, 2);
|
||||||
|
|
||||||
|
if (isset($pa[1])) {
|
||||||
|
$path = __DIR__ . '/../assets/'.$pa[1];
|
||||||
|
$path = realpath($path);
|
||||||
|
|
||||||
|
if ($path) {
|
||||||
|
$ext = pathinfo($path, PATHINFO_EXTENSION);
|
||||||
|
$ext2Mime = array(
|
||||||
|
|
||||||
|
'txt' => 'text/plain',
|
||||||
|
'htm' => 'text/html',
|
||||||
|
'html' => 'text/html',
|
||||||
|
'php' => 'text/html',
|
||||||
|
'css' => 'text/css',
|
||||||
|
'js' => 'application/javascript',
|
||||||
|
'json' => 'application/json',
|
||||||
|
'xml' => 'application/xml',
|
||||||
|
'swf' => 'application/x-shockwave-flash',
|
||||||
|
'flv' => 'video/x-flv',
|
||||||
|
|
||||||
|
// images
|
||||||
|
'png' => 'image/png',
|
||||||
|
'jpe' => 'image/jpeg',
|
||||||
|
'jpeg' => 'image/jpeg',
|
||||||
|
'jpg' => 'image/jpeg',
|
||||||
|
'gif' => 'image/gif',
|
||||||
|
'bmp' => 'image/bmp',
|
||||||
|
'ico' => 'image/vnd.microsoft.icon',
|
||||||
|
'tiff' => 'image/tiff',
|
||||||
|
'tif' => 'image/tiff',
|
||||||
|
'svg' => 'image/svg+xml',
|
||||||
|
'svgz' => 'image/svg+xml',
|
||||||
|
|
||||||
|
// archives
|
||||||
|
'zip' => 'application/zip',
|
||||||
|
'rar' => 'application/x-rar-compressed',
|
||||||
|
'exe' => 'application/x-msdownload',
|
||||||
|
'msi' => 'application/x-msdownload',
|
||||||
|
'cab' => 'application/vnd.ms-cab-compressed',
|
||||||
|
|
||||||
|
// audio/video
|
||||||
|
'mp3' => 'audio/mpeg',
|
||||||
|
'qt' => 'video/quicktime',
|
||||||
|
'mov' => 'video/quicktime',
|
||||||
|
|
||||||
|
// adobe
|
||||||
|
'pdf' => 'application/pdf',
|
||||||
|
'psd' => 'image/vnd.adobe.photoshop',
|
||||||
|
'ai' => 'application/postscript',
|
||||||
|
'eps' => 'application/postscript',
|
||||||
|
'ps' => 'application/postscript',
|
||||||
|
|
||||||
|
// ms office
|
||||||
|
'doc' => 'application/msword',
|
||||||
|
'rtf' => 'application/rtf',
|
||||||
|
'xls' => 'application/vnd.ms-excel',
|
||||||
|
'ppt' => 'application/vnd.ms-powerpoint',
|
||||||
|
|
||||||
|
// open office
|
||||||
|
'odt' => 'application/vnd.oasis.opendocument.text',
|
||||||
|
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
|
||||||
|
);
|
||||||
|
|
||||||
|
if (array_key_exists($ext, $ext2Mime)) {
|
||||||
|
$mime = $ext2Mime[$ext];
|
||||||
|
} else {
|
||||||
|
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||||
|
if (false !== ($_mime = finfo_file($finfo, $path))) {
|
||||||
|
$mime = $_mime;
|
||||||
|
}
|
||||||
|
finfo_close($finfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Content-Type: ' . $mime);
|
||||||
|
header('Content-Length: ' . filesize($path));
|
||||||
|
|
||||||
|
ob_clean();
|
||||||
|
flush();
|
||||||
|
readfile($path);
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
return $next($request, $response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request, $response);
|
||||||
|
}
|
||||||
|
}
|
@ -16,9 +16,25 @@
|
|||||||
* BOOTSTRAPPING SCRIPT
|
* BOOTSTRAPPING SCRIPT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
// Get the Slim framework settings
|
// Get the Slim framework settings
|
||||||
$settings = require __DIR__ . '/settings.php';
|
$settings = require __DIR__ . '/settings.php';
|
||||||
|
|
||||||
|
// Set Locale
|
||||||
|
setlocale(LC_MONETARY, 'nl_NL.UTF-8');
|
||||||
|
date_default_timezone_set('Europe/Amsterdam');
|
||||||
|
|
||||||
|
//De functie money_format bestaat alleen op systemen met strfmon, dus niet op Windows
|
||||||
|
//Om een foutmelding tijdens het testen te voorkomen definiëren we deze functie
|
||||||
|
//als money_format niet bestaat
|
||||||
|
if (!function_exists("money_format")) {
|
||||||
|
function money_format($format, $value)
|
||||||
|
{
|
||||||
|
return "€ " . $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create the Slim application object with the settings
|
// Create the Slim application object with the settings
|
||||||
/**
|
/**
|
||||||
* ==============
|
* ==============
|
||||||
@ -60,6 +76,45 @@ $container['renderer'] = function ($c) {
|
|||||||
return new Slim\Views\PhpRenderer($settings['template_path']);
|
return new Slim\Views\PhpRenderer($settings['template_path']);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Add the database layer
|
||||||
|
/**
|
||||||
|
* ==============
|
||||||
|
* INSTRUCTIEBLOK
|
||||||
|
* ==============
|
||||||
|
*
|
||||||
|
* Je kunt de database gebruiken in je code via $this->db. Vermijd het direct gebruiken van het PDO object via $this->get('db.pdo').
|
||||||
|
* Je kunt hiervoor beter de ingebouwde functies van NotORM gebruiken.
|
||||||
|
*/
|
||||||
|
$container['db.pdo'] = function ($c) {
|
||||||
|
$settings = $c->get('settings')['db'];
|
||||||
|
$host = $settings['host'];
|
||||||
|
$name = $settings['name'];
|
||||||
|
$user = $settings['user'];
|
||||||
|
$pass = $settings['pass'];
|
||||||
|
$charset = $settings['charset'];
|
||||||
|
|
||||||
|
return new PDO("mysql:dbname=$name;host=$host;charset=$charset", $user, $pass,
|
||||||
|
array(
|
||||||
|
PDO::ATTR_TIMEOUT => 5,
|
||||||
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
|
||||||
|
));
|
||||||
|
};
|
||||||
|
|
||||||
|
$container['db'] = function ($c) {
|
||||||
|
$settings = $c->get('settings')['db'];
|
||||||
|
$pdo = $c->get('db.pdo');
|
||||||
|
return new NotORM($pdo);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add auth object
|
||||||
|
$container['auth'] = function () {
|
||||||
|
return new \Inforbank\Application\Auth\Authorization();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Link static objects
|
||||||
|
Inforbank\Application::set($app);
|
||||||
|
|
||||||
// Inject the application main class
|
// Inject the application main class
|
||||||
/**
|
/**
|
||||||
* ==============
|
* ==============
|
||||||
@ -72,7 +127,29 @@ $container['renderer'] = function ($c) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
new InfD4p\Application\Main($app);
|
|
||||||
|
/**
|
||||||
|
* Basis
|
||||||
|
*/
|
||||||
|
|
||||||
|
new Inforbank\Application\Main($app);
|
||||||
|
new Inforbank\Application\Login($app);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pagina's
|
||||||
|
*/
|
||||||
|
|
||||||
|
new Inforbank\Application\Transacties($app);
|
||||||
|
new Inforbank\Application\Overboeking($app);
|
||||||
|
new Inforbank\Application\Rekeningen($app);
|
||||||
|
new Inforbank\Application\Berichten($app);
|
||||||
|
new Inforbank\Application\Statistieken($app);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Idob
|
||||||
|
*/
|
||||||
|
new Inforbank\Application\API\Handler($app);
|
||||||
|
new Inforbank\Application\Idob($app);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bij het maken van dit object is in de class de __construct functie aangeroepen met de parameter $app. De functies die daar in staan zullen nu worden uitgevoerd.
|
* Bij het maken van dit object is in de class de __construct functie aangeroepen met de parameter $app. De functies die daar in staan zullen nu worden uitgevoerd.
|
||||||
@ -84,5 +161,8 @@ new InfD4p\Application\Main($app);
|
|||||||
* - http://php.net/manual/en/language.oop5.basic.php (over de class)
|
* - http://php.net/manual/en/language.oop5.basic.php (over de class)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Add the asset Proxy
|
||||||
|
$app->add(new Inforbank\Proxy());
|
||||||
|
|
||||||
// Run app
|
// Run app
|
||||||
$app->run();
|
$app->run();
|
||||||
|
@ -1,12 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
return [
|
return [
|
||||||
'settings' => [
|
'settings' => [
|
||||||
'displayErrorDetails' => true, // set to false in production
|
'displayErrorDetails' => true,
|
||||||
'addContentLengthHeader' => false, // Allow the web server to send the content-length header
|
'addContentLengthHeader' => false,
|
||||||
|
|
||||||
// Renderer settings
|
// Renderer settings
|
||||||
'renderer' => [
|
'renderer' => [
|
||||||
'template_path' => __DIR__ . '/../templates/',
|
'template_path' => __DIR__ . '/../templates/',
|
||||||
|
],
|
||||||
|
|
||||||
|
// Database settings
|
||||||
|
'db' => [
|
||||||
|
'host' => '185.56.145.27',
|
||||||
|
'user' => 'inforban_db',
|
||||||
|
'pass' => 'inforbank',
|
||||||
|
'name' => 'inforban_db',
|
||||||
|
'charset' => 'utf8'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
8
templates/__footer.phtml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
</div>
|
||||||
|
<div class="footer">
|
||||||
|
<div class="container">
|
||||||
|
Copyright Daniel Boutros, Christiaan Goossens & Jelmer Hinssen 2017.<br/>In opdracht van het Stedelijk Gymnasium Nijmegen.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
39
templates/__header.phtml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<title>Inforbank</title>
|
||||||
|
<link rel="stylesheet" href="<?= $header['base'] ?>assets/css/main.css">
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||||
|
<script src="<?= $header['base']?>assets/moment.min.js"></script>
|
||||||
|
<script src="<?= $header['base']?>assets/chart.min.js"></script>
|
||||||
|
<base href="<?= $header['base'] ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="header">
|
||||||
|
<div class="top">
|
||||||
|
<div class="container">
|
||||||
|
<img src="assets/logo.png" alt="Inforbank"></img>
|
||||||
|
<div class="user">
|
||||||
|
Welkom <?= $header['klant']['voornaam'] ?> <?php
|
||||||
|
if ($header['klant']['tussenvoegsel'] !== "") {
|
||||||
|
echo " " . $header['klant']['tussenvoegsel'];
|
||||||
|
}
|
||||||
|
?> <?= $header['klant']['achternaam'] ?><br/>
|
||||||
|
<a href="logout">Uitloggen</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="menu">
|
||||||
|
<div class="container">
|
||||||
|
<ul class="nv">
|
||||||
|
<li><a href="rekeningen">Rekeningen</a></li>
|
||||||
|
<li><a href="berichten">Berichten<?php if ($header['klant']['ongelezen'] > 0) {
|
||||||
|
?><span class="circle"><?php echo$header['klant']['ongelezen']; ?></span><?php
|
||||||
|
}?></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
32
templates/berichten.phtml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php include '__header.phtml'; ?>
|
||||||
|
|
||||||
|
<h2 class="page-header">Berichten</h2>
|
||||||
|
|
||||||
|
<?php foreach ($berichten as $bericht) {
|
||||||
|
?>
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<?php if (!$bericht['gelezen']) {
|
||||||
|
?>
|
||||||
|
<span class="label label-info">Nieuw bericht</span><br/><br/>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
} ?>
|
||||||
|
<h3 class="panel-title"><?php echo $bericht['datum']; ?></h3>
|
||||||
|
<small>Afzender: </small><?php echo $bericht['afzender']; ?></div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<?php echo $bericht['bericht']; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($berichten) === 0) {
|
||||||
|
?>U heeft geen berichten.<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php include '__footer.phtml'; ?>
|
65
templates/idob.phtml
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?php include '__header.phtml'; ?>
|
||||||
|
|
||||||
|
<h2 class="page-header">Betalen via Inforbank Direct Online Betalen</h2>
|
||||||
|
|
||||||
|
<?php if (!$transactie) {
|
||||||
|
?>
|
||||||
|
<div class="alert alert-danger" role="alert"><b>Fout!</b> Deze transactie bestaat niet.</div>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">Transactie</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<b>Transactiereferentie</b>
|
||||||
|
<p><?php echo $transactie['reference']; ?></p>
|
||||||
|
<br/>
|
||||||
|
<b>Ontvangende partij:</b>
|
||||||
|
<p><?php echo $webwinkel; ?></p>
|
||||||
|
<br/>
|
||||||
|
<b>Te betalen:</b>
|
||||||
|
<h3><?php echo money_format('%(#1n', $transactie['amount']); ?></h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">Omschrijving</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<?php echo $transactie['description']; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<form class="form-horizontal" method="post" action="">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="van" class="col-sm-2 control-label">Betalen met</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<select name="van" class="form-control">
|
||||||
|
<?php
|
||||||
|
foreach ($rekeningen as $rekening) {
|
||||||
|
echo "<option value=" . $rekening['nr'] . ">" . $rekening['iban'] . "</option>\n";
|
||||||
|
} ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-offset-2 col-sm-10"><br/>
|
||||||
|
<p>Door het klikken op "Accepteren" hieronder, accepteert u de betaling en zal er <b><?php echo money_format('%(#1n', $transactie['amount']); ?></b> worden overgemaakt aan <b><?php echo $webwinkel; ?></b> ter betaling van het order met de transactierefrentie <b><?php echo $transactie['reference']; ?></b>.<br/><br/>Ga alleen verder als u zeker weet dat deze gegevens kloppen. U kunt ook de omschrijving van de transactie bekijken. Na de betaling wordt u teruggestuurd naar de webshop.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
<button type="submit" class="btn btn-default">Accepteren</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
} ?>
|
||||||
|
|
||||||
|
<?php include '__footer.phtml'; ?>
|
5
templates/idobmislukt.phtml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php include '__header.phtml'; ?>
|
||||||
|
|
||||||
|
<div class="alert alert-danger" role="alert"><b>Oeps!</b> De betaling via Inforbank Direct Online Betalen is mislukt. We konden je niet terugsturen naar de webshop. Sorry.</div>
|
||||||
|
|
||||||
|
<?php include '__footer.phtml'; ?>
|
@ -1,38 +1,24 @@
|
|||||||
<!DOCTYPE html>
|
<?php include '__header.phtml'; ?>
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8"/>
|
|
||||||
<title>Slim 3</title>
|
|
||||||
<link href='//fonts.googleapis.com/css?family=Lato:300' rel='stylesheet' type='text/css'>
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
margin: 50px 0 0 0;
|
|
||||||
padding: 0;
|
|
||||||
width: 100%;
|
|
||||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
||||||
text-align: center;
|
|
||||||
color: #aaa;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
<h2 class="page-header">Mijn rekeningen<a class="btn btn-default pull-right" href="overboeking" role="button">Nieuwe overboeking</a></h2>
|
||||||
color: #719e40;
|
|
||||||
letter-spacing: -3px;
|
|
||||||
font-family: 'Lato', sans-serif;
|
|
||||||
font-size: 100px;
|
|
||||||
font-weight: 200;
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Slim</h1>
|
|
||||||
<div>a microframework for PHP</div>
|
|
||||||
|
|
||||||
<?php if (isset($name)) : ?>
|
<?php
|
||||||
<h2>Hello <?= htmlspecialchars($name); ?>!</h2>
|
foreach ($rekeningen as $rekening) {
|
||||||
<?php else: ?>
|
?>
|
||||||
<p>Try <a href="http://www.slimframework.com">SlimFramework</a>
|
<a class="clickable" onclick="document.location.href = 'rekeningen/<?php echo $rekening['nr'] ?>'"><div class="panel panel-default">
|
||||||
<?php endif; ?>
|
<div class="panel-body">
|
||||||
</body>
|
<h4><?php echo $rekening['naam']; ?><span class="pull-right big"><?php echo money_format('%(#1n', $rekening['saldo']); ?></span></h4>
|
||||||
</html>
|
<p><?php echo $rekening['iban']; ?></p>
|
||||||
|
</div>
|
||||||
|
</div></a>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($rekeningen) === 0) {
|
||||||
|
?>U heeft geen rekeningen.<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php include '__footer.phtml'; ?>
|
||||||
|
40
templates/login.phtml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<title>Inforbank</title>
|
||||||
|
<link rel="stylesheet" href="<?= $base ?>/assets/css/login.css">
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||||
|
<base href="<?= $base ?>">
|
||||||
|
</head>
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
|
<body>
|
||||||
|
<div class="full">
|
||||||
|
<div class="col-md-6 appinfodiv">
|
||||||
|
<div>
|
||||||
|
<img class="logo" alt="logo" src="assets/logo.png"/>
|
||||||
|
<h3>Welkom bij de InforBank</h1>
|
||||||
|
Bij InforBank krijg je zelfs 10% rente op betaalrekeningen.<br/><br/>
|
||||||
|
Je kunt bij InforBank ook online betalen.<br/><br/>
|
||||||
|
BIC: INFONL2N
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 formdiv">
|
||||||
|
<div class="loginmodal-container">
|
||||||
|
<h1>Inloggen bij de Inforbank</h1><br>
|
||||||
|
<?php if ($error) {
|
||||||
|
?>
|
||||||
|
<div class="alert alert-warning" role="alert">De ingevulde gegevens zijn incorrect. Probeer het opnieuw.</div><br/>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
} ?>
|
||||||
|
<form method="post" action="">
|
||||||
|
<input type="text" name="rekeningnr" placeholder="Rekeningnummer (alleen cijfers)">
|
||||||
|
<input type="password" name="pascode" placeholder="Pascode">
|
||||||
|
<input type="submit" name="login" class="login loginmodal-submit" value="Login">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
61
templates/overboeking.phtml
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<?php include '__header.phtml'; ?>
|
||||||
|
|
||||||
|
<h2 class="page-header">Nieuwe overboeking</h2>
|
||||||
|
<?php
|
||||||
|
if (isset($error)) {
|
||||||
|
?>
|
||||||
|
<div class="alert alert-danger" role="alert"><?php echo Inforbank\Application\Helper\Overboekingen::getErrorMessage($error) ?></div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-body">
|
||||||
|
<form method="post" action="" class="form-horizontal">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="van" class="col-sm-2 control-label">Van</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<select name="van" class="form-control">
|
||||||
|
<?php
|
||||||
|
foreach ($rekeningen as $rekening) {
|
||||||
|
echo "<option value=" . $rekening['nr'] . ">" . $rekening['iban'] . "</option>\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="naar" class="col-sm-2 control-label">Naar (IBAN)</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<input name="naar" type="text" class="form-control" placeholder="NL00 INFO 0000 0000 00"></input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<br/>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="bedrag" class="col-sm-2 control-label">Bedrag</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-addon">€</div><input class="form-control" name="bedrag" type="decimal" placeholder=""></input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="omschrijving" class="col-sm-2 control-label">Omschrijving (40 tekens)</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<textarea class="form-control" name="omschrijving" maxlength=40></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<br/>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
<button type="submit" class="btn btn-default">Overboeking bevestigen</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php include '__footer.phtml'; ?>
|
65
templates/statistieken.phtml
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?php include '__header.phtml'; ?>
|
||||||
|
<?php
|
||||||
|
if (!$statistieken) {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="alert alert-danger" role="alert"><b>Fout!</b> Dit is niet een aan jouw account gekoppelde rekening.</div>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<a class="btn btn-default pull-left" href="rekeningen/<?= $rekeningnr ?>" role="button">Terug</a>
|
||||||
|
<canvas id="grafiek" height="100"></canvas>
|
||||||
|
<script>
|
||||||
|
Chart.defaults.global.legend.display = false;//Geen legenda
|
||||||
|
var grafiek = document.getElementById("grafiek");
|
||||||
|
var myChart = new Chart(grafiek, {
|
||||||
|
type: "line",
|
||||||
|
options: {
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
text: "Saldo van de afgelopen maand"
|
||||||
|
},
|
||||||
|
scales: {
|
||||||
|
xAxes: [{
|
||||||
|
type: "time",
|
||||||
|
unit: "day",
|
||||||
|
time: {
|
||||||
|
displayFormats: {
|
||||||
|
"day": "D MMM"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
yAxes: [{
|
||||||
|
ticks: {
|
||||||
|
min: 0
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
//Laad de dagen in
|
||||||
|
labels: <?php echo json_encode($statistieken['x-as']); ?>,
|
||||||
|
datasets: [{
|
||||||
|
label: "Saldo",
|
||||||
|
//Laad de saldo's in
|
||||||
|
data: <?php echo json_encode($statistieken['y-as']); ?>,
|
||||||
|
borderWidth: 2,
|
||||||
|
lineTension: 0, //Rechte lijnen
|
||||||
|
fill: false,
|
||||||
|
borderColor: "black",
|
||||||
|
pointRadius: 5,
|
||||||
|
pointBorderColor: "rgba(0, 0, 0, 0)", //Onzichtbare punten
|
||||||
|
pointBackgroundColor: "rgba(0, 0, 0, 0)",
|
||||||
|
pointHoverRadius: 5,
|
||||||
|
pointHoverBackgroundColor: "black"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
} ?>
|
||||||
|
</script>
|
||||||
|
<?php include '__footer.phtml'; ?>
|
79
templates/transacties.phtml
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<?php include '__header.phtml'; ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if (!$rekening) {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="alert alert-danger" role="alert"><b>Fout!</b> Dit is niet een aan jouw account gekoppelde rekening.</div>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if ($geslaagd) {
|
||||||
|
?>
|
||||||
|
<div class="alert alert-info" role="alert">De transactie is geslaagd</div>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
} ?>
|
||||||
|
<h2 class="page-header">Transactieoverzicht
|
||||||
|
<div class="btn-group pull-right" role="group">
|
||||||
|
|
||||||
|
<a class="btn btn-default" href="statistieken/<?= $rekening['nr'] ?>" role="button">Statistieken</a>
|
||||||
|
<a class="btn btn-default" href="overboeking" role="button">Nieuwe overboeking</a>
|
||||||
|
</div>
|
||||||
|
</h2>
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8">
|
||||||
|
IBAN/rekeningnummer<br/>
|
||||||
|
<h4><?php echo $rekening['iban'] ?></h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-2">Rentetarief<br/>
|
||||||
|
<h4><?php echo $rekening['rente']; ?>%</h4>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">Saldo<br/>
|
||||||
|
<h4><b><?php echo money_format('%(#1n', $rekening['saldo']); ?></b></h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<th>Datum</th>
|
||||||
|
<th>Code</th>
|
||||||
|
<th>Omschrijving</th>
|
||||||
|
<th>Tegenrekening</th>
|
||||||
|
<th>AF/BIJ</th>
|
||||||
|
<th>Bedrag</th>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
foreach ($transacties as $transactie) {
|
||||||
|
if (!isset($transactie['omschrijving'])) {
|
||||||
|
$transactie['omschrijving'] = "";
|
||||||
|
}
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td>" . $transactie['datum'] . "</td>";
|
||||||
|
echo "<td>" . $transactie['type'] . "</td>\n";
|
||||||
|
echo "<td>" . $transactie['omschrijving'] . "</td>\n";
|
||||||
|
|
||||||
|
if ($transactie['van'] === $rekening['iban']) {
|
||||||
|
echo "<td>" . $transactie['naar'] . "</td>\n";
|
||||||
|
echo "<td>AF</td>\n";
|
||||||
|
} else {
|
||||||
|
echo "<td>" . $transactie['van'] . "</td>\n";
|
||||||
|
echo "<td>BIJ</td>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<td>" . money_format('%(#1n', $transactie['bedrag']) . "</td>\n";
|
||||||
|
echo "</tr>";
|
||||||
|
} ?>
|
||||||
|
</table>
|
||||||
|
<br/>
|
||||||
|
<small>ba = betaalautomaat, bg = bankgiro/SEPA opdracht, id = Inforbank Direct Online Betalen (iDeal), sp = spoedbetaling</small>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php include '__footer.phtml'; ?>
|