From 718894014175766fdea0cc72472ac899693d0ab5 Mon Sep 17 00:00:00 2001 From: JelmerHinssen Date: Wed, 29 Mar 2017 16:47:24 +0200 Subject: [PATCH] Transactiepagina --- src/Application/Overboeking.php | 39 ++++++++++++++++++++ src/Application/Transacties.php | 64 +++++++++++++++++++++++++++++++++ src/bootstrap.php | 2 ++ templates/overboeking.phtml | 14 ++++++++ templates/transacties.phtml | 23 ++++++++++++ 5 files changed, 142 insertions(+) create mode 100644 src/Application/Overboeking.php create mode 100644 src/Application/Transacties.php create mode 100644 templates/overboeking.phtml create mode 100644 templates/transacties.phtml diff --git a/src/Application/Overboeking.php b/src/Application/Overboeking.php new file mode 100644 index 0000000..275db21 --- /dev/null +++ b/src/Application/Overboeking.php @@ -0,0 +1,39 @@ +get('/overboeking', function ($request, $response, $args) { + $klant = Klant::getCurrentUser(); + $rekeningen = Rekeningen::getCurrentUserRekeningen(); + + + + return $this->renderer->render($response, 'overboeking.phtml', [ + 'klant' => $klant, + 'rekeningen' => $rekeningen + ]); + }); + } +} diff --git a/src/Application/Transacties.php b/src/Application/Transacties.php new file mode 100644 index 0000000..cbc5f7a --- /dev/null +++ b/src/Application/Transacties.php @@ -0,0 +1,64 @@ +get('/rekeningen/{rekeningnummer}', function ($request, $response, $args) { + $klant = Klant::getCurrentUser(); + $rekeningen = Rekeningen::getCurrentUserRekeningen(); + + $ibanhelper = new IBAN; + $rekening = false; + $rekeningnr = $args['rekeningnummer']; + + foreach($rekeningen as $rek){ + if($rek['nr'] === $rekeningnr){ + $rekening = $rek; + break; + } + } + + $container = Application::getContainer(); + $db = $container->db; + $transacties = $db->transacties->where('van', '12345678')->or('naar', $rekeningnr); + + $returnArray = array(); + + foreach ($transacties as $transactie) { + $returnArray[] = array( + "van" => $ibanhelper->getIBAN($transactie['van']), + "naar" => $ibanhelper->getIBAN($transactie['naar']), + "bedrag" => $transactie['bedrag'], + "type" => $transactie['type'] + ); + } + + return $this->renderer->render($response, 'transacties.phtml', [ + 'klant' => $klant, + 'rekening' => $rekening, + 'transacties' => $returnArray + ]); + }); + } +} diff --git a/src/bootstrap.php b/src/bootstrap.php index fee2e5a..dd4c75a 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -116,6 +116,8 @@ Inforbank\Application::set($app); new Inforbank\Application\Login($app); new Inforbank\Application\Daniel($app); new Inforbank\Application\Main($app); +new Inforbank\Application\Transacties($app); +new Inforbank\Application\Overboeking($app); // Added API handler new Inforbank\Application\API\Handler($app); diff --git a/templates/overboeking.phtml b/templates/overboeking.phtml new file mode 100644 index 0000000..6fc185a --- /dev/null +++ b/templates/overboeking.phtml @@ -0,0 +1,14 @@ + + +
+
+
+ + + diff --git a/templates/transacties.phtml b/templates/transacties.phtml new file mode 100644 index 0000000..d40d203 --- /dev/null +++ b/templates/transacties.phtml @@ -0,0 +1,23 @@ + + + +Fout: niet jouw eigen rekening. + + +Saldo:
+"; + echo json_encode($transactie); + echo "
"; +} +?> + + +