2017-08-04 15:56:14 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* BankController.php
|
|
|
|
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
|
|
|
* This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.
|
|
|
|
*
|
|
|
|
* See the LICENSE file for details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace FireflyIII\Http\Controllers\Import;
|
|
|
|
|
|
|
|
|
|
|
|
use FireflyIII\Http\Controllers\Controller;
|
2017-08-11 05:21:00 +02:00
|
|
|
use FireflyIII\Support\Import\Prerequisites\PrerequisitesInterface;
|
2017-08-04 15:56:14 +02:00
|
|
|
|
|
|
|
class BankController extends Controller
|
|
|
|
{
|
|
|
|
|
2017-08-12 07:47:42 +02:00
|
|
|
public function postPrerequisites()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-08-04 15:56:14 +02:00
|
|
|
/**
|
|
|
|
* @param string $bank
|
|
|
|
*/
|
|
|
|
public function prerequisites(string $bank)
|
|
|
|
{
|
2017-08-11 05:21:00 +02:00
|
|
|
$class = config(sprintf('firefly.import_pre.%s', $bank));
|
|
|
|
/** @var PrerequisitesInterface $object */
|
|
|
|
$object = app($class);
|
|
|
|
$object->setUser(auth()->user());
|
|
|
|
|
|
|
|
if ($object->hasPrerequisites()) {
|
|
|
|
$view = $object->getView();
|
|
|
|
$parameters = $object->getViewParameters();
|
2017-08-12 07:47:42 +02:00
|
|
|
|
2017-08-11 05:21:00 +02:00
|
|
|
return view($view, $parameters);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$object->hasPrerequisites()) {
|
|
|
|
echo 'redirect to import form.';
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-08-04 15:56:14 +02:00
|
|
|
}
|