Clean up for Yodlee authentication

This commit is contained in:
David Bomba 2022-08-10 19:49:27 +10:00
parent d80ec520f9
commit b471920155
3 changed files with 115 additions and 9 deletions

View File

@ -45,9 +45,10 @@ class YodleeController extends BaseController
$company->account->bank_integration_account_id = $token;
$company->push();
$yodlee = new Yodlee($token);
$yodlee->setTestMode();
}
$yodlee = new Yodlee($token);
$yodlee->setTestMode();
if(!is_string($token))
dd($token);
@ -57,6 +58,8 @@ class YodleeController extends BaseController
'fasttrack_url' => $yodlee->getFastTrackUrl(),
'config_name' => 'testninja',
'flow' => $flow,
'company' => $company,
'account' => $company->account,
];
return view('bank.yodlee.auth', $data);

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('licenses', function (Blueprint $table) {
$table->unsignedBigInteger('recurring_invoice_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
};

View File

@ -1,25 +1,93 @@
@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>
<style>
.loader {
border-top-color: #3498db;
-webkit-animation: spinner 1.5s linear infinite;
animation: spinner 1.5s linear infinite;
}
@-webkit-keyframes spinner {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
@keyframes spinner {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
<script type="text/javascript">
</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 class="flex flex-col justify-center items-center mt-10" id="container-fastlink">
<div class="mb-4">
@if($account && !$account->isPaid())
<div>
<img src="{{ asset('images/invoiceninja-black-logo-2.png') }}"
class="border-b border-gray-100 h-18 pb-4" alt="Invoice Ninja logo">
</div>
@elseif(isset($company) && !is_null($company))
<div>
<img src="{{ $company->present()->logo() }}"
class="mx-auto border-b border-gray-100 h-18 pb-4" alt="{{ $company->present()->name() }} logo">
</div>
@endif
</div>
<div id="cta" class="mb-4" x-data="{ open: false }">
<button @click="open = !open" x-show="!open" type="submit" class="button button-primary bg-blue-600 my-4" id="btn-fastlink">{{ ctrans('texts.add_bank_account') }}
</button>
<div x-show="open" class="fixed top-0 left-0 right-0 bottom-0 w-full h-screen z-50 overflow-hidden bg-gray-700 opacity-75 flex flex-col items-center justify-center">
<div class="loader ease-linear rounded-full border-4 border-t-4 border-gray-200 h-12 w-12 mb-4"></div>
<h2 class="text-center text-gray text-xl font-semibold">Loading...</h2>
<p class="w-1/3 text-center text-gray">This may take a few seconds, please don't close this page.</p>
</div>
</div>
<div id="completed" class="mb-4">
<a class="button button-primary bg-blue-600 my-4" href="https://invoicing.co">Return to admin portal.</a>
</div>
</div>
@endsection
@push('footer')
<script>
var completed = document.getElementById('completed');
completed.style.display = "none"; //block
(function (window) {
//Open FastLink
var fastlinkBtn = document.getElementById('btn-fastlink');
@ -48,11 +116,15 @@
// will be called called to close FastLink. For list of possible message, refer to onClose(data) Method.
console.log('onclose');
console.log(data);
var completed = document.getElementById('completed');
completed.style.display = "block"; //block
},
onEvent: function (data) {
// will be called on intermittent status update.
console.log('on event');
var hideme = document.getElementById('cta');
hideme.style.display = "none";
console.log(data);
}
},