Fixes for yodlee reauth flow
This commit is contained in:
parent
52db82bb12
commit
700a0eb6c6
|
|
@ -14,6 +14,8 @@ namespace App\Filters;
|
||||||
|
|
||||||
use App\Models\Quote;
|
use App\Models\Quote;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* QuoteFilters.
|
* QuoteFilters.
|
||||||
|
|
@ -151,17 +153,25 @@ class QuoteFilters extends QueryFilters
|
||||||
{
|
{
|
||||||
$sort_col = explode('|', $sort);
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
if (!is_array($sort_col) || count($sort_col) != 2 || !in_array($sort_col[0], \Illuminate\Support\Facades\Schema::getColumnListing($this->builder->getModel()->getTable()))) {
|
if (!is_array($sort_col) || count($sort_col) != 2) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dir = ($sort_col[1] == 'asc') ? 'asc' : 'desc';
|
$dir = ($sort_col[1] == 'asc') ? 'asc' : 'desc';
|
||||||
|
|
||||||
if ($sort_col[0] == 'client_id') {
|
// Handle relationship-based sorting
|
||||||
|
if ($sort_col[0] == 'documents') {
|
||||||
|
return $this->builder->withCount('documents')->orderBy('documents_count', $dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate column exists in database schema
|
||||||
|
if (!in_array($sort_col[0], Schema::getColumnListing($this->builder->getModel()->getTable()))) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sort_col[0] == 'client_id') {
|
||||||
return $this->builder->orderBy(\App\Models\Client::select('name')
|
return $this->builder->orderBy(\App\Models\Client::select('name')
|
||||||
->whereColumn('clients.id', 'quotes.client_id'), $dir);
|
->whereColumn('clients.id', 'quotes.client_id'), $dir);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sort_col[0] == 'number') {
|
if ($sort_col[0] == 'number') {
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,8 @@ class YodleeController extends BaseController
|
||||||
|
|
||||||
$redirect_url = isset($request->getTokenContent()['is_react']) && $request->getTokenContent()['is_react'] ? config('ninja.react_url') : config('ninja.app_url');
|
$redirect_url = isset($request->getTokenContent()['is_react']) && $request->getTokenContent()['is_react'] ? config('ninja.react_url') : config('ninja.app_url');
|
||||||
|
|
||||||
|
$provider_id = isset($request->getTokenContent()['provider_id']) ? $request->getTokenContent()['provider_id'] : false;
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'access_token' => $yodlee->getAccessToken(),
|
'access_token' => $yodlee->getAccessToken(),
|
||||||
'fasttrack_url' => $yodlee->getFastTrackUrl(),
|
'fasttrack_url' => $yodlee->getFastTrackUrl(),
|
||||||
|
|
@ -62,6 +64,7 @@ class YodleeController extends BaseController
|
||||||
'account' => $company->account,
|
'account' => $company->account,
|
||||||
'completed' => $request->has('window_closed') ? true : false,
|
'completed' => $request->has('window_closed') ? true : false,
|
||||||
'redirect_url' => $redirect_url,
|
'redirect_url' => $redirect_url,
|
||||||
|
'provider_id' => $provider_id,
|
||||||
];
|
];
|
||||||
|
|
||||||
return view('bank.yodlee.auth', $data);
|
return view('bank.yodlee.auth', $data);
|
||||||
|
|
@ -84,7 +87,7 @@ class YodleeController extends BaseController
|
||||||
$bank_integration->bank_account_name = $account['account_name'];
|
$bank_integration->bank_account_name = $account['account_name'];
|
||||||
$bank_integration->bank_account_status = $account['account_status'];
|
$bank_integration->bank_account_status = $account['account_status'];
|
||||||
$bank_integration->bank_account_number = $account['account_number'];
|
$bank_integration->bank_account_number = $account['account_number'];
|
||||||
$bank_integration->provider_id = $account['provider_id'];
|
$bank_integration->provider_id = $account['provider_account_id'] ?? $account['provider_id'];
|
||||||
$bank_integration->provider_name = $account['provider_name'];
|
$bank_integration->provider_name = $account['provider_name'];
|
||||||
$bank_integration->nickname = $account['nickname'];
|
$bank_integration->nickname = $account['nickname'];
|
||||||
$bank_integration->balance = $account['current_balance'];
|
$bank_integration->balance = $account['current_balance'];
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,10 @@ class OneTimeTokenController extends BaseController
|
||||||
$data['institution_id'] = $request->institution_id;
|
$data['institution_id'] = $request->institution_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($request->provider_id) {
|
||||||
|
$data['provider_id'] = $request->provider_id;
|
||||||
|
}
|
||||||
|
|
||||||
Cache::put($hash, $data, 3600);
|
Cache::put($hash, $data, 3600);
|
||||||
|
|
||||||
return response()->json(['hash' => $hash], 200);
|
return response()->json(['hash' => $hash], 200);
|
||||||
|
|
|
||||||
|
|
@ -675,7 +675,7 @@ class HtmlEngine
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$signature_invite = $this->invitation->signature_base64 ? $this->invitation : $this->enZtity->invitations()->whereNotNull('signature_base64')->orderBy('updated_at','desc')->first();
|
$signature_invite = $this->invitation->signature_base64 ? $this->invitation : $this->entity->invitations()->whereNotNull('signature_base64')->orderBy('updated_at','desc')->first();
|
||||||
|
|
||||||
if ($this->settings->signature_on_pdf) {
|
if ($this->settings->signature_on_pdf) {
|
||||||
$data['$contact.signature'] = ['value' => $signature_invite?->signature_base64 ?? '', 'label' => ctrans('texts.signature')];
|
$data['$contact.signature'] = ['value' => $signature_invite?->signature_base64 ?? '', 'label' => ctrans('texts.signature')];
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,11 @@
|
||||||
fastLinkURL: '{{ $fasttrack_url }}',
|
fastLinkURL: '{{ $fasttrack_url }}',
|
||||||
accessToken: 'Bearer {{ $access_token }}',
|
accessToken: 'Bearer {{ $access_token }}',
|
||||||
params: {
|
params: {
|
||||||
|
@if($provider_id)
|
||||||
|
flow: '{{ $flow }}',
|
||||||
|
providerAccountId: {{ $provider_id }},
|
||||||
|
reauthenticate: true,
|
||||||
|
@endif
|
||||||
configName : '{{ $config_name }}'
|
configName : '{{ $config_name }}'
|
||||||
},
|
},
|
||||||
onSuccess: function (data) {
|
onSuccess: function (data) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue