Merge branch 'dev' into 'master'
RC (Release Candidate) See merge request !3
@ -1,2 +1,4 @@
|
||||
RewriteEngine On
|
||||
RewriteRule ^$ /public [L]
|
||||
RewriteEngine on
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php/$1 [NC,L,QSA]
|
||||
|
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
@ -10,9 +10,11 @@
|
||||
},
|
||||
"scripts": {
|
||||
"run": "composer install && composer start",
|
||||
"start": "php -S 0.0.0.0:8080 -t public public/index.php"
|
||||
"start": "php -S 0.0.0.0:8080"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {"Inforbank\\": "src/"}
|
||||
"psr-4": {
|
||||
"Inforbank\\": "src/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
13
composer.lock
generated
@ -276,23 +276,24 @@
|
||||
},
|
||||
{
|
||||
"name": "slim/slim",
|
||||
"version": "3.7.0",
|
||||
"version": "3.8.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/slimphp/Slim.git",
|
||||
"reference": "4254e40d81559e35cdf856bcbaca5f3af468b7ef"
|
||||
"reference": "5385302707530b2bccee1769613ad769859b826d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/slimphp/Slim/zipball/4254e40d81559e35cdf856bcbaca5f3af468b7ef",
|
||||
"reference": "4254e40d81559e35cdf856bcbaca5f3af468b7ef",
|
||||
"url": "https://api.github.com/repos/slimphp/Slim/zipball/5385302707530b2bccee1769613ad769859b826d",
|
||||
"reference": "5385302707530b2bccee1769613ad769859b826d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"container-interop/container-interop": "^1.1",
|
||||
"container-interop/container-interop": "^1.2",
|
||||
"nikic/fast-route": "^1.0",
|
||||
"php": ">=5.5.0",
|
||||
"pimple/pimple": "^3.0",
|
||||
"psr/container": "^1.0",
|
||||
"psr/http-message": "^1.0"
|
||||
},
|
||||
"provide": {
|
||||
@ -342,7 +343,7 @@
|
||||
"micro",
|
||||
"router"
|
||||
],
|
||||
"time": "2016-12-20T20:30:47+00:00"
|
||||
"time": "2017-03-19T17:55:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "vrana/notorm",
|
||||
|
BIN
docs/Berichten.png
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
docs/Documentatie.docx
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/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 |
@ -28,20 +28,19 @@ if (PHP_SAPI == 'cli-server') {
|
||||
// something which should probably be served as a static file
|
||||
$url = parse_url($_SERVER['REQUEST_URI']);
|
||||
$file = __DIR__ . $url['path'];
|
||||
|
||||
if (is_file($file)) {
|
||||
return false;
|
||||
} elseif (pathinfo($url['path'], PATHINFO_EXTENSION) !== "") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Require the Composer autoloader to load dependencies
|
||||
*/
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
/**
|
||||
* Load the bootstrapping script
|
||||
*/
|
||||
|
||||
include __DIR__ . '/../src/bootstrap.php';
|
||||
include __DIR__ . '/src/bootstrap.php';
|
@ -1,4 +0,0 @@
|
||||
RewriteEngine on
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php/$1 [NC,L,QSA]
|
@ -15,6 +15,8 @@
|
||||
namespace Inforbank\Application\API;
|
||||
|
||||
use \Slim\App;
|
||||
use Inforbank\Application\Helper\Idob\Client;
|
||||
use Inforbank\Application\Helper\Idob\Transactie;
|
||||
|
||||
class Handler
|
||||
{
|
||||
@ -38,29 +40,64 @@ class Handler
|
||||
$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['sha1'])) {
|
||||
if (isset($parsedBody['clientId']) && isset($parsedBody['transactionId']) && isset($parsedBody['amount']) && isset($parsedBody['description']) && isset($parsedBody['returnUrl']) && isset($parsedBody['hash'])) {
|
||||
// Correct request
|
||||
try {
|
||||
$client = new Client($parsedBody['clientId']);
|
||||
$clientSecret = $client->getClientSecret();
|
||||
|
||||
$clientSecret = Handler::getClientSecret($parsedBody['clientId']);
|
||||
$sha = sha1($parsedBody['transactionId'] . $parsedBody['amount'] . $clientSecret);
|
||||
$sha = hash("sha256", $parsedBody['transactionId'] . $parsedBody['amount'] . $clientSecret);
|
||||
|
||||
if ($sha === $parsedBody['sha1']) {
|
||||
$responseJSON = array(
|
||||
"success" => true,
|
||||
"redirect" => "https://example.com"
|
||||
);
|
||||
} else {
|
||||
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 sha1 verification hash."
|
||||
"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, sha1]"
|
||||
"error" => "Missing one of the following attributes: [clientId, transactionId, amount, description, returnUrl, hash]"
|
||||
);
|
||||
}
|
||||
|
||||
@ -80,33 +117,59 @@ class Handler
|
||||
$this->post('/statusRequest', function ($request, $response, $args) {
|
||||
$parsedBody = $request->getParsedBody();
|
||||
|
||||
if (isset($parsedBody['clientId']) && isset($parsedBody['transactionId']) && isset($parsedBody['sha1'])) {
|
||||
if (isset($parsedBody['clientId']) && isset($parsedBody['transactionId']) && isset($parsedBody['hash'])) {
|
||||
// Correct request
|
||||
try {
|
||||
$client = new Client($parsedBody['clientId']);
|
||||
$clientSecret = $client->getClientSecret();
|
||||
|
||||
$clientSecret = Handler::getClientSecret($parsedBody['clientId']);
|
||||
$sha = sha1($parsedBody['transactionId'] . $clientSecret);
|
||||
$sha = hash("sha256", $parsedBody['transactionId'] . $clientSecret);
|
||||
|
||||
if ($sha === $parsedBody['sha1']) {
|
||||
$responseJSON = array(
|
||||
"success" => true,
|
||||
"transaction" => array(
|
||||
"status" => "Success",
|
||||
"transactionId" => "notyetfromdb",
|
||||
"someotherrandomkey" => "changethis"
|
||||
)
|
||||
);
|
||||
} else {
|
||||
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 sha1 verification hash."
|
||||
"error" => "Incorrect client id."
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$response = $response->withStatus(400);
|
||||
$responseJSON = array(
|
||||
"success" => false,
|
||||
"error" => "Missing one of the following attributes: [clientId, transactionId, sha1]"
|
||||
"error" => "Missing one of the following attributes: [clientId, transactionId, hash]"
|
||||
);
|
||||
}
|
||||
|
||||
@ -122,9 +185,4 @@ class Handler
|
||||
return $next($request, $response);
|
||||
});
|
||||
}
|
||||
|
||||
public static function getClientSecret($clientId)
|
||||
{
|
||||
return '3';
|
||||
}
|
||||
}
|
||||
|
@ -22,13 +22,28 @@ class Middleware
|
||||
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
|
||||
return Redirect::create($response, '/login');
|
||||
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());
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Informatica Eindproject D4p
|
||||
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||
* Docent: Hans de Wolf
|
||||
*
|
||||
* ==================
|
||||
*
|
||||
* Daniel Boutros,
|
||||
* Christiaan Goossens,
|
||||
* Jelmer Hinssen
|
||||
*/
|
||||
|
||||
namespace Inforbank\Application;
|
||||
|
||||
use \Slim\App;
|
||||
|
||||
class Daniel
|
||||
{
|
||||
public function __construct(App $app)
|
||||
{
|
||||
$app->get('/daniel', function ($request, $response, $args) {
|
||||
// Render index view
|
||||
return $this->renderer->render($response, 'Daniel.phtml', $args);
|
||||
});
|
||||
}
|
||||
}
|
63
src/Application/Helper/Berichten.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?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
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
@ -21,11 +21,59 @@ class IBAN
|
||||
$newword = "";
|
||||
$wordarray = str_split($word);
|
||||
foreach ($wordarray as $v) {
|
||||
$newword .= ord(strtolower($v)) - 87;
|
||||
if (ctype_alpha($v)) {
|
||||
$newword .= ord(strtolower($v)) - 87;
|
||||
} else {
|
||||
$newword .= $v;
|
||||
}
|
||||
}
|
||||
return $newword;
|
||||
}
|
||||
|
||||
private 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 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 = $this->wordToNumbers($identificatie);
|
||||
return $controle == $this->getCheckDigits($nummer);
|
||||
}
|
||||
|
||||
public function getRekeningNummer($iban)
|
||||
{
|
||||
return substr(str_replace(" ", "", $iban), 8);
|
||||
}
|
||||
|
||||
public function getBank($iban)
|
||||
{
|
||||
return substr(str_replace(" ", "", $iban), 4, 4);
|
||||
}
|
||||
|
||||
public function getLand($iban)
|
||||
{
|
||||
return substr(str_replace(" ", "", $iban), 0, 2);
|
||||
}
|
||||
|
||||
public function getIBAN($rekeningnr)
|
||||
{
|
||||
@ -39,24 +87,7 @@ class IBAN
|
||||
$rekeningnr = str_pad($rekeningnr, 10, 0, STR_PAD_LEFT);
|
||||
|
||||
$bignum = $banknumber . $rekeningnr . $landnumber . "00";
|
||||
|
||||
$modulo97 = '';
|
||||
$checkdigits = '00';
|
||||
|
||||
// begin 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;
|
||||
// einde modulo staartdeling
|
||||
if (strlen($checkdigits) < 2) {
|
||||
$checkdigits = '0' . $checkdigits;
|
||||
}
|
||||
$checkdigits = $this->getCheckDigits($bignum);
|
||||
|
||||
$rekeningnrarr = str_split($rekeningnr, 4);
|
||||
return $landcode.$checkdigits." ".$bankcode." ".$rekeningnrarr[0]." ".$rekeningnrarr[1]." ".$rekeningnrarr[2];
|
||||
|
54
src/Application/Helper/Idob/Client.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\Helper\Idob;
|
||||
|
||||
use Inforbank\Application;
|
||||
|
||||
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'];
|
||||
}
|
||||
}
|
75
src/Application/Helper/Idob/Transactie.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?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
|
||||
{
|
||||
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'];
|
||||
}
|
||||
|
||||
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']
|
||||
);
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ use Inforbank\Application;
|
||||
|
||||
class Klant
|
||||
{
|
||||
public function getCurrentUser()
|
||||
public static function getCurrentUser()
|
||||
{
|
||||
$container = Application::getContainer();
|
||||
$user = $container->auth->getUserID();
|
||||
@ -26,7 +26,8 @@ class Klant
|
||||
$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'],
|
||||
@ -35,7 +36,8 @@ class Klant
|
||||
'straat' => $klant['straat'],
|
||||
'huisnummer' => $klant['huisnummer'],
|
||||
'postcode' => $klant['postcode'],
|
||||
'woonplaats' => $klant['woonplaats']
|
||||
'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);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
$ibanHelper = new IBAN();
|
||||
if (!$ibanHelper->isValidIBAN($naar)) {
|
||||
//error: ongeldige iban
|
||||
throw new Exception("De IBAN van de ontvanger is ongeldig.", Overboekingen::$IBAN);
|
||||
} elseif (!($ibanHelper->getLand($naar) == "NL" && $ibanHelper->getBank($naar) === "INFO")) {
|
||||
//error: andere bank
|
||||
Overboekingen::error(Overboekingen::$BANK);
|
||||
}
|
||||
$naarRekeningnr = $ibanHelper->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: " . $ibanHelper->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!");
|
||||
}
|
||||
}
|
||||
}
|
@ -16,20 +16,11 @@ namespace Inforbank\Application\Helper;
|
||||
|
||||
class Redirect
|
||||
{
|
||||
public static function create($response, $path)
|
||||
public static function create($request, $response, $path)
|
||||
{
|
||||
$basePath = $request->getUri()->getBaseUrl();
|
||||
$response = $response->withStatus(302);
|
||||
$response = $response->withHeader('Location', Redirect::getBasepath() . $path);
|
||||
$response = $response->withHeader('Location', $basePath . $path);
|
||||
return $response;
|
||||
}
|
||||
|
||||
private static function getBasepath()
|
||||
{
|
||||
if (isset($_SERVER['HTTPS'])) {
|
||||
$protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http";
|
||||
} else {
|
||||
$protocol = 'http';
|
||||
}
|
||||
return $protocol . "://" . $_SERVER['HTTP_HOST'];
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,10 @@ use Inforbank\Application;
|
||||
|
||||
class Rekeningen
|
||||
{
|
||||
public function getCurrentUserRekeningen()
|
||||
public static $BETAALREKENING = 1;
|
||||
public static $SPAARREKENING = 2;
|
||||
|
||||
public static function getCurrentUserRekeningen()
|
||||
{
|
||||
$container = Application::getContainer();
|
||||
$user = $container->auth->getUserID();
|
||||
@ -31,12 +34,46 @@ class Rekeningen
|
||||
$returnArray = array();
|
||||
|
||||
foreach ($rekeningen as $rekening) {
|
||||
$type = $db->types->where('id', $rekening['typeid'])[$rekening['typeid']];
|
||||
|
||||
$returnArray[] = array(
|
||||
"rekeningnr" => $ibanhelper->getIBAN($rekening['rekeningnr']),
|
||||
"saldo" => (double) $rekening['saldo']
|
||||
"iban" => $ibanhelper->getIBAN($rekening['rekeningnr']),
|
||||
"nr" => $rekening['rekeningnr'],
|
||||
"saldo" => (double) $rekening['saldo'],
|
||||
"naam" => $type['rekeningnaam'],
|
||||
"rente" => $type['rente']
|
||||
);
|
||||
}
|
||||
|
||||
return $returnArray;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
56
src/Application/Helper/Statistieken.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?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
|
||||
];
|
||||
}
|
||||
}
|
103
src/Application/Idob.php
Normal file
@ -0,0 +1,103 @@
|
||||
<?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!
|
||||
*/
|
||||
$ibanhelper = new IBAN();
|
||||
|
||||
// Do overboeking
|
||||
Overboekingen::createOverboeking($ibanhelper->getIBAN($van), $ibanhelper->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());
|
||||
}
|
||||
}
|
@ -16,36 +16,54 @@ 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', $args);
|
||||
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) {
|
||||
return Redirect::create($response, '/');
|
||||
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($response, '/login?error');
|
||||
return Redirect::create($request, $response, '/login?error&redirect='.$redirect);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return Redirect::create($response, '/login?error');
|
||||
return Redirect::create($request, $response, '/login?error&redirect='.$redirect);
|
||||
}
|
||||
});
|
||||
|
||||
$app->get('/logout', function ($request, $response, $args) {
|
||||
$this->auth->logout();
|
||||
return Redirect::create($response, '/login');
|
||||
return Redirect::create($request, $response, '/login');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,7 @@
|
||||
namespace Inforbank\Application;
|
||||
|
||||
use \Slim\App;
|
||||
use Inforbank\Application\Helper\Klant;
|
||||
use Inforbank\Application\Helper\Rekeningen;
|
||||
use Inforbank\Application\Helper\Redirect;
|
||||
|
||||
class Main
|
||||
{
|
||||
@ -34,15 +33,7 @@ class Main
|
||||
public function __construct(App $app)
|
||||
{
|
||||
$app->get('/', function ($request, $response, $args) {
|
||||
// Ophalen klant
|
||||
$klant = Klant::getCurrentUser();
|
||||
$rekeningen = Rekeningen::getCurrentUserRekeningen();
|
||||
|
||||
// Render index view
|
||||
return $this->renderer->render($response, 'index.phtml', [
|
||||
'klant' => $klant,
|
||||
'rekeningen' => $rekeningen
|
||||
]);
|
||||
return Redirect::create($request, $response, '/rekeningen');
|
||||
})->add(new Auth\Middleware());
|
||||
}
|
||||
}
|
||||
|
55
src/Application/Overboeking.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?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 {
|
||||
$ibanhelper = new IBAN();
|
||||
Overboekingen::createOverboeking($ibanhelper->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());
|
||||
}
|
||||
}
|
64
src/Application/Transacties.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?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();
|
||||
|
||||
$ibanhelper = new IBAN;
|
||||
$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" => $ibanhelper->getIBAN($transactie['van']),
|
||||
"naar" => $ibanhelper->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());
|
||||
}
|
||||
}
|
116
src/Proxy.php
Normal file
@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Informatica Eindproject D4p
|
||||
* 6in3, Stedelijk Gymnasium Nijmegen
|
||||
* Docent: Hans de Wolf
|
||||
*
|
||||
* ==================
|
||||
*
|
||||
* Daniel Boutros,
|
||||
* Christiaan Goossens,
|
||||
* Jelmer Hinssen
|
||||
*/
|
||||
|
||||
namespace Inforbank;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
@ -21,6 +21,20 @@ session_start();
|
||||
// Get the Slim framework settings
|
||||
$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
|
||||
/**
|
||||
* ==============
|
||||
@ -113,12 +127,29 @@ Inforbank\Application::set($app);
|
||||
*
|
||||
*/
|
||||
|
||||
new Inforbank\Application\Login($app);
|
||||
new Inforbank\Application\Daniel($app);
|
||||
new Inforbank\Application\Main($app);
|
||||
|
||||
// Added API handler
|
||||
/**
|
||||
* 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.
|
||||
@ -130,5 +161,8 @@ new Inforbank\Application\API\Handler($app);
|
||||
* - http://php.net/manual/en/language.oop5.basic.php (over de class)
|
||||
*/
|
||||
|
||||
// Add the asset Proxy
|
||||
$app->add(new Inforbank\Proxy());
|
||||
|
||||
// Run app
|
||||
$app->run();
|
||||
|
@ -1,2 +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>
|
||||
|
@ -3,6 +3,37 @@
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Inforbank</title>
|
||||
<link rel="stylesheet" href="assets/css/main.css">
|
||||
<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'; ?>
|
@ -1,59 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>InforBank - Inloggen</title>
|
||||
<link href='//fonts.googleapis.com/css?family=Lato:300' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||
<!--link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous" -->
|
||||
</head>
|
||||
<style>
|
||||
.form-signin {
|
||||
max-width: 330px;
|
||||
padding: 15px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: #ff6000;
|
||||
background-color: #2e652c;
|
||||
border-color: #2e6da4;
|
||||
margin-top: 5px;
|
||||
}
|
||||
.jumbotron{
|
||||
//text-align: center;
|
||||
}
|
||||
.form-control{
|
||||
margin: 5px 0;
|
||||
}
|
||||
body{
|
||||
color: #ff6000;
|
||||
}
|
||||
.footer{
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div class="jumbotron">
|
||||
<div class="container">
|
||||
<h1>InforBank</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<form class="form-signin" method="post">
|
||||
<h2 class="form-signin-heading">Inloggen</h2>
|
||||
<label for="inputUsername" class="sr-only">Rekeningnummer (alleen cijfers)</label>
|
||||
<input type="text" id="inputUsername" name="rekeningnr" class="form-control" placeholder="012456789"/>
|
||||
|
||||
<label for="inputPassword" class="sr-only">Pascode</label>
|
||||
<input type="password" id="inputPassword" name="pascode" class="form-control" placeholder="0000"/>
|
||||
<button class="btn btn-lg btn-primary btn-block" type="submit">Inloggen</button>
|
||||
</form>
|
||||
</div>
|
||||
<footer class="footer">
|
||||
© 2017 Alle rechten voorbehouden
|
||||
</footer>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
||||
</body>
|
||||
</html>
|
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,9 +1,24 @@
|
||||
<?php include '__header.phtml'; ?>
|
||||
|
||||
<p>Welkom klant <?= $_SESSION['userid'] ?></p>
|
||||
<a href="/logout">Uitloggen</a>
|
||||
<br/>
|
||||
<pre><?php echo json_encode($klant); ?></pre>
|
||||
<pre><?php echo json_encode($rekeningen); ?></pre>
|
||||
<h2 class="page-header">Mijn rekeningen<a class="btn btn-default pull-right" href="overboeking" role="button">Nieuwe overboeking</a></h2>
|
||||
|
||||
<?php
|
||||
foreach ($rekeningen as $rekening) {
|
||||
?>
|
||||
<a class="clickable" onclick="document.location.href = 'rekeningen/<?php echo $rekening['nr'] ?>'"><div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<h4><?php echo $rekening['naam']; ?><span class="pull-right big"><?php echo money_format('%(#1n', $rekening['saldo']); ?></span></h4>
|
||||
<p><?php echo $rekening['iban']; ?></p>
|
||||
</div>
|
||||
</div></a>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
if (count($rekeningen) === 0) {
|
||||
?>U heeft geen rekeningen.<?php
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
<?php include '__footer.phtml'; ?>
|
||||
|
@ -2,58 +2,39 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>InforBank - Inloggen</title>
|
||||
<link href='//fonts.googleapis.com/css?family=Lato:300' rel='stylesheet' type='text/css'>
|
||||
<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">
|
||||
<!--link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous" -->
|
||||
<base href="<?= $base ?>">
|
||||
</head>
|
||||
<style>
|
||||
.form-signin {
|
||||
max-width: 330px;
|
||||
padding: 15px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: #ff6000;
|
||||
background-color: #2e652c;
|
||||
border-color: #2e6da4;
|
||||
margin-top: 5px;
|
||||
}
|
||||
.jumbotron{
|
||||
//text-align: center;
|
||||
}
|
||||
.form-control{
|
||||
margin: 5px 0;
|
||||
}
|
||||
body{
|
||||
color: #ff6000;
|
||||
}
|
||||
.footer{
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div class="jumbotron">
|
||||
<div class="container">
|
||||
<h1>InforBank</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<form class="form-signin" method="post">
|
||||
<h2 class="form-signin-heading">Inloggen</h2>
|
||||
<label for="inputUsername" class="sr-only">Rekeningnummer (alleen cijfers)</label>
|
||||
<input type="text" id="inputUsername" name="rekeningnr" class="form-control" placeholder="012456789"/>
|
||||
<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
|
||||
|
||||
<label for="inputPassword" class="sr-only">Pascode</label>
|
||||
<input type="password" id="inputPassword" name="pascode" class="form-control" placeholder="0000"/>
|
||||
<button class="btn btn-lg btn-primary btn-block" type="submit">Inloggen</button>
|
||||
</form>
|
||||
} ?>
|
||||
<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>
|
||||
<footer class="footer">
|
||||
© 2017 Alle rechten voorbehouden
|
||||
</footer>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
||||
</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'; ?>
|