mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
cleanups
This commit is contained in:
parent
e5fd758ca5
commit
cb311c52f8
@ -135,9 +135,9 @@ class NordigenController extends BaseController
|
||||
public function confirm(ConfirmNordigenBankIntegrationRequest $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
$context = $request->getTokenContent();
|
||||
$lang = $data['lang'] ?? 'en';
|
||||
|
||||
$context = Cache::get($data["ref"]);
|
||||
if (!$context || $context["context"] != "nordigen" || !array_key_exists("requisitionId", $context))
|
||||
return view('bank.nordigen.handler', [
|
||||
'lang' => $lang,
|
||||
@ -145,7 +145,7 @@ class NordigenController extends BaseController
|
||||
"redirectUrl" => ($context && array_key_exists("redirect", $context) ? $context["redirect"] : config('ninja.app_url')) . "?action=nordigen_connect&status=failed&reason=ref-invalid",
|
||||
]);
|
||||
|
||||
$company = Company::where('company_key', $context["company_key"])->firstOrFail();
|
||||
$company = $request->getCompany();
|
||||
$account = $company->account;
|
||||
|
||||
if (!(config('ninja.nordigen.secret_id') && config('ninja.nordigen.secret_key')))
|
||||
|
@ -12,6 +12,9 @@
|
||||
namespace App\Http\Requests\Nordigen;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Company;
|
||||
use Cache;
|
||||
|
||||
class ConfirmNordigenBankIntegrationRequest extends Request
|
||||
{
|
||||
@ -37,4 +40,21 @@ class ConfirmNordigenBankIntegrationRequest extends Request
|
||||
'lang' => 'string',
|
||||
];
|
||||
}
|
||||
public function getTokenContent()
|
||||
{
|
||||
if ($this->state) {
|
||||
$this->token = $this->state;
|
||||
}
|
||||
|
||||
$data = Cache::get($this->token);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getCompany()
|
||||
{
|
||||
MultiDB::findAndSetDbByCompanyKey($this->getTokenContent()['company_key']);
|
||||
|
||||
return Company::where('company_key', $this->getTokenContent()['company_key'])->firstOrFail();
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class ConnectNordigenBankIntegrationRequest extends Request
|
||||
return [
|
||||
'lang' => 'string',
|
||||
'institution_id' => 'string',
|
||||
'redirect' => 'string', // TODO: @turbo124 @todo validate, that this is a url without / at the end
|
||||
'redirect' => 'string',
|
||||
];
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ class ConnectNordigenBankIntegrationRequest extends Request
|
||||
if (!array_key_exists('redirect', $input)) {
|
||||
$context = $this->getTokenContent();
|
||||
|
||||
$input["redirect"] = isset($context['is_react']) && $context['is_react'] ? config('ninja.react_url') : config('ninja.app_url');
|
||||
$input["redirect"] = isset($context["is_react"]) && $context['is_react'] ? redirect(config('ninja.react_url') . "/#/settings/bank_accounts") : redirect(config('ninja.app_url'));
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
@ -68,13 +68,6 @@ class ConnectNordigenBankIntegrationRequest extends Request
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getContact()
|
||||
{
|
||||
MultiDB::findAndSetDbByCompanyKey($this->getTokenContent()['company_key']);
|
||||
|
||||
return User::findOrFail($this->getTokenContent()['user_id']);
|
||||
}
|
||||
|
||||
public function getCompany()
|
||||
{
|
||||
MultiDB::findAndSetDbByCompanyKey($this->getTokenContent()['company_key']);
|
||||
|
@ -18,8 +18,6 @@
|
||||
<script type='text/javascript' src='https://unpkg.com/nordigen-bank-ui@1.5.2/package/src/selector.min.js'></script>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
// Pass your redirect link after user has been authorized in institution
|
||||
const config = {
|
||||
// Redirect URL that is being used when modal is being closed.
|
||||
|
Loading…
Reference in New Issue
Block a user