mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Yodlee init
This commit is contained in:
parent
717a34aa99
commit
f6821e9fcc
17
app/Helpers/Bank/BankExpenseInterface.php
Normal file
17
app/Helpers/Bank/BankExpenseInterface.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace App\Helpers\Bank;
|
||||
|
||||
interface BankExpenseInterface
|
||||
{
|
||||
|
||||
}
|
17
app/Helpers/Bank/BankRevenueInterface.php
Normal file
17
app/Helpers/Bank/BankRevenueInterface.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace App\Helpers\Bank;
|
||||
|
||||
interface BankRevenueInterface
|
||||
{
|
||||
|
||||
}
|
22
app/Helpers/Bank/Yodlee/Yodlee.php
Normal file
22
app/Helpers/Bank/Yodlee/Yodlee.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace App\Helpers\Yodlee;
|
||||
|
||||
class Yodlee
|
||||
{
|
||||
|
||||
public function getAccessToken()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
33
app/Http/Controllers/Bank/YodleeController.php
Normal file
33
app/Http/Controllers/Bank/YodleeController.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\Bank;
|
||||
|
||||
use App\Http\Controllers\BaseController;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class YodleeController extends BaseController
|
||||
{
|
||||
|
||||
public function auth(Request $request)
|
||||
{
|
||||
|
||||
$yodlee = new Yodlee();
|
||||
|
||||
$data = [
|
||||
'access_token' => $yodlee->getAccessToken()
|
||||
];
|
||||
|
||||
return view('bank.yodlee.auth', $data);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -105,7 +105,7 @@ class ImportController extends Controller
|
||||
public function import(ImportRequest $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
nlog($data);
|
||||
|
||||
if (empty($data['hash'])) {
|
||||
// Create a reference
|
||||
$data['hash'] = $hash = Str::random(32);
|
||||
|
@ -35,9 +35,9 @@ class QueryLogging
|
||||
{
|
||||
|
||||
// Enable query logging for development
|
||||
if (! Ninja::isHosted() || ! config('beacon.enabled')) {
|
||||
return $next($request);
|
||||
}
|
||||
// if (! Ninja::isHosted() || ! config('beacon.enabled')) {
|
||||
// return $next($request);
|
||||
// }
|
||||
|
||||
$timeStart = microtime(true);
|
||||
DB::enableQueryLog();
|
||||
@ -52,6 +52,7 @@ class QueryLogging
|
||||
|
||||
nlog("Query count = {$count}");
|
||||
nlog($queries);
|
||||
nlog($request->url());
|
||||
|
||||
if ($count > 175) {
|
||||
nlog("Query count = {$count}");
|
||||
|
70
app/Http/Requests/Yodlee/YodleeAuthRequest.php
Normal file
70
app/Http/Requests/Yodlee/YodleeAuthRequest.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace App\Http\Requests\Yodlee;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Company;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class YodleeAuthRequest extends Request
|
||||
{
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getTokenContent()
|
||||
{
|
||||
if ($this->state) {
|
||||
$this->token = $this->state;
|
||||
}
|
||||
|
||||
$data = Cache::get($this->token);
|
||||
|
||||
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']);
|
||||
|
||||
return Company::where('company_key', $this->getTokenContent()['company_key'])->firstOrFail();
|
||||
|
||||
}
|
||||
}
|
@ -142,7 +142,7 @@ class BaseRepository
|
||||
|
||||
$invitation_class = sprintf('App\\Models\\%sInvitation', $resource);
|
||||
|
||||
$invitation = $invitation_class::where('key', $invitation['key'])->first();
|
||||
$invitation = $invitation_class::with('company')->where('key', $invitation['key'])->first();
|
||||
|
||||
return $invitation;
|
||||
}
|
||||
@ -176,7 +176,7 @@ class BaseRepository
|
||||
if(array_key_exists('client_id', $data))
|
||||
$model->client_id = $data['client_id'];
|
||||
|
||||
$client = Client::where('id', $model->client_id)->withTrashed()->firstOrFail();
|
||||
$client = Client::with('group_settings')->where('id', $model->client_id)->withTrashed()->firstOrFail();
|
||||
|
||||
$state = [];
|
||||
|
||||
|
58
resources/views/bank/yodlee/auth.blade.php
Normal file
58
resources/views/bank/yodlee/auth.blade.php
Normal file
@ -0,0 +1,58 @@
|
||||
@extends('layouts.ninja')
|
||||
@section('meta_title', ctrans('texts.new_bank_account'))
|
||||
|
||||
|
||||
@push('head')
|
||||
<script type='text/javascript' src='https://cdn.yodlee.com/fastlink/v4/initialize.js'></script>
|
||||
@endpush
|
||||
|
||||
@section('body')
|
||||
|
||||
<div id="container-fastlink">
|
||||
<div style="text-align: center;">
|
||||
<input type="submit" id="btn-fastlink" value="Link an Account">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
|
||||
@push('footer')
|
||||
|
||||
<script>
|
||||
(function (window) {
|
||||
//Open FastLink
|
||||
var fastlinkBtn = document.getElementById('btn-fastlink');
|
||||
fastlinkBtn.addEventListener(
|
||||
'click',
|
||||
function() {
|
||||
window.fastlink.open({
|
||||
fastLinkURL: 'https://fl4.sandbox.yodlee.com/authenticate/restserver/fastlink',
|
||||
accessToken: 'Bearer {{ $access_token }}',
|
||||
params: {
|
||||
configName : '<config-name-from-config-tool>'
|
||||
},
|
||||
onSuccess: function (data) {
|
||||
// will be called on success. For list of possible message, refer to onSuccess(data) Method.
|
||||
console.log(data);
|
||||
},
|
||||
onError: function (data) {
|
||||
// will be called on error. For list of possible message, refer to onError(data) Method.
|
||||
console.log(data);
|
||||
},
|
||||
onClose: function (data) {
|
||||
// will be called called to close FastLink. For list of possible message, refer to onClose(data) Method.
|
||||
console.log(data);
|
||||
},
|
||||
onEvent: function (data) {
|
||||
// will be called on intermittent status update.
|
||||
console.log(data);
|
||||
}
|
||||
},
|
||||
'container-fastlink');
|
||||
},
|
||||
false);
|
||||
}(window));
|
||||
</script>
|
||||
|
||||
@endpush
|
@ -3,6 +3,7 @@
|
||||
use App\Http\Controllers\Auth\ForgotPasswordController;
|
||||
use App\Http\Controllers\Auth\LoginController;
|
||||
use App\Http\Controllers\Auth\ResetPasswordController;
|
||||
use App\Http\Controllers\Bank\YodleeController;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Http\Controllers\ClientPortal\ApplePayDomainController;
|
||||
use App\Http\Controllers\Gateways\Checkout3dsController;
|
||||
@ -52,6 +53,8 @@ Route::middleware('url_db')->group(function () {
|
||||
Route::get('stripe/signup/{token}', [StripeConnectController::class, 'initialize'])->name('stripe_connect.initialization');
|
||||
Route::get('stripe/completed', [StripeConnectController::class, 'completed'])->name('stripe_connect.return');
|
||||
|
||||
Route::get('yodlee/onboard/{token}', [YodleeController::class, 'auth'])->name('yodlee.auth');
|
||||
|
||||
Route::get('checkout/3ds_redirect/{company_key}/{company_gateway_id}/{hash}', [Checkout3dsController::class, 'index'])->middleware('domain_db')->name('checkout.3ds_redirect');
|
||||
Route::get('mollie/3ds_redirect/{company_key}/{company_gateway_id}/{hash}', [Mollie3dsController::class, 'index'])->middleware('domain_db')->name('mollie.3ds_redirect');
|
||||
Route::get('gocardless/ibp_redirect/{company_key}/{company_gateway_id}/{hash}', [GoCardlessController::class, 'ibpRedirect'])->middleware('domain_db')->name('gocardless.ibp_redirect');
|
||||
|
Loading…
x
Reference in New Issue
Block a user