mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Minor fixes for Bank Transactions / Integratiosn
This commit is contained in:
parent
ce5dfa2717
commit
0fc0ff25bd
@ -174,6 +174,20 @@ class Yodlee
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getAccount($account_id)
|
||||||
|
{
|
||||||
|
|
||||||
|
$token = $this->getAccessToken();
|
||||||
|
|
||||||
|
$response = Http::withHeaders($this->getHeaders(["Authorization" => "Bearer {$token}"]))->get($this->getEndpoint(). "/accounts/{$account_id}", []);
|
||||||
|
|
||||||
|
if($response->successful())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if($response->failed())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public function deleteAccount($account_id)
|
public function deleteAccount($account_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -33,6 +33,8 @@ class YodleeController extends BaseController
|
|||||||
$company = $request->getCompany();
|
$company = $request->getCompany();
|
||||||
|
|
||||||
|
|
||||||
|
//ensure user is enterprise!!
|
||||||
|
|
||||||
if($company->account->bank_integration_account_id){
|
if($company->account->bank_integration_account_id){
|
||||||
|
|
||||||
$flow = 'edit';
|
$flow = 'edit';
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
* @OA\Property(property="tax_name3", type="string", example="", description="The tax name"),
|
* @OA\Property(property="tax_name3", type="string", example="", description="The tax name"),
|
||||||
* @OA\Property(property="tax_rate3", type="number", format="float", example="10.00", description="The tax rate"),
|
* @OA\Property(property="tax_rate3", type="number", format="float", example="10.00", description="The tax rate"),
|
||||||
* @OA\Property(property="total_taxes", type="number", format="float", example="10.00", description="The total taxes for the quote"),
|
* @OA\Property(property="total_taxes", type="number", format="float", example="10.00", description="The total taxes for the quote"),
|
||||||
* @OA\Property(property="line_items", type="object", example="[{"product_key":"test", "unit_cost":10},{"product_key":"test", "unit_cost":10}]", description="An array of line items of the quote"),
|
* @OA\Property(property="line_items", type="object", example="", description="An array of line items of the quote"),
|
||||||
* @OA\Property(property="amount", type="number", format="float", example="10.00", description="The total amount of the quote"),
|
* @OA\Property(property="amount", type="number", format="float", example="10.00", description="The total amount of the quote"),
|
||||||
* @OA\Property(property="balance", type="number", format="float", example="10.00", description="The balance due of the quote"),
|
* @OA\Property(property="balance", type="number", format="float", example="10.00", description="The balance due of the quote"),
|
||||||
* @OA\Property(property="paid_to_date", type="number", format="float", example="10.00", description="The amount that has been paid to date on the quote"),
|
* @OA\Property(property="paid_to_date", type="number", format="float", example="10.00", description="The amount that has been paid to date on the quote"),
|
||||||
|
@ -68,7 +68,13 @@ class ProcessBankTransactions implements ShouldQueue
|
|||||||
|
|
||||||
do{
|
do{
|
||||||
|
|
||||||
$this->processTransactions();
|
try {
|
||||||
|
$this->processTransactions();
|
||||||
|
}
|
||||||
|
catch(\Exception $e) {
|
||||||
|
nlog("{$this->bank_integration_account_id} - exited abnormally => ". $e->getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
while($this->stop_loop);
|
while($this->stop_loop);
|
||||||
@ -83,6 +89,14 @@ class ProcessBankTransactions implements ShouldQueue
|
|||||||
|
|
||||||
$yodlee = new Yodlee($this->bank_integration_account_id);
|
$yodlee = new Yodlee($this->bank_integration_account_id);
|
||||||
|
|
||||||
|
if(!$yodlee->getAccount($this->bank_integration->bank_account_id))
|
||||||
|
{
|
||||||
|
$this->bank_integration->disabled_upstream = true;
|
||||||
|
$this->bank_integration->save();
|
||||||
|
$this->stop_loop = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'top' => 500,
|
'top' => 500,
|
||||||
'fromDate' => $this->from_date,
|
'fromDate' => $this->from_date,
|
||||||
@ -102,7 +116,8 @@ class ProcessBankTransactions implements ShouldQueue
|
|||||||
//if no transactions, update the from_date and move on
|
//if no transactions, update the from_date and move on
|
||||||
if(count($transactions) == 0){
|
if(count($transactions) == 0){
|
||||||
|
|
||||||
$this->bank_integration->from_date = now();
|
$this->bank_integration->from_date = now()->subDays(2);
|
||||||
|
$this->bank_integration->disabled_upstream = false;
|
||||||
$this->bank_integration->save();
|
$this->bank_integration->save();
|
||||||
$this->stop_loop = false;
|
$this->stop_loop = false;
|
||||||
return;
|
return;
|
||||||
@ -144,8 +159,7 @@ class ProcessBankTransactions implements ShouldQueue
|
|||||||
|
|
||||||
if($count < 500){
|
if($count < 500){
|
||||||
$this->stop_loop = false;
|
$this->stop_loop = false;
|
||||||
|
$this->bank_integration->from_date = now()->subDays(2);
|
||||||
$this->bank_integration->from_date = now();
|
|
||||||
$this->bank_integration->save();
|
$this->bank_integration->save();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -64,8 +64,8 @@ class BankTransactionSync implements ShouldQueue
|
|||||||
|
|
||||||
// $queue = Ninja::isHosted() ? 'bank' : 'default';
|
// $queue = Ninja::isHosted() ? 'bank' : 'default';
|
||||||
|
|
||||||
// if($account->isPaid())
|
if($account->isPaid() && $account->plan == 'enterprise')
|
||||||
// {
|
{
|
||||||
|
|
||||||
$account->bank_integrations->each(function ($bank_integration) use ($account){
|
$account->bank_integrations->each(function ($bank_integration) use ($account){
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ class BankTransactionSync implements ShouldQueue
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// }
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,7 @@ class BankIntegrationTransformer extends EntityTransformer
|
|||||||
'nickname' => (string)$bank_integration->nickname ?: '',
|
'nickname' => (string)$bank_integration->nickname ?: '',
|
||||||
'from_date' => (string)$bank_integration->from_date ?: '',
|
'from_date' => (string)$bank_integration->from_date ?: '',
|
||||||
'is_deleted' => (bool) $bank_integration->is_deleted,
|
'is_deleted' => (bool) $bank_integration->is_deleted,
|
||||||
|
'disabled_upstream' => (bool) $bank_integration->disabled_upstream,
|
||||||
'created_at' => (int) $bank_integration->created_at,
|
'created_at' => (int) $bank_integration->created_at,
|
||||||
'updated_at' => (int) $bank_integration->updated_at,
|
'updated_at' => (int) $bank_integration->updated_at,
|
||||||
'archived_at' => (int) $bank_integration->deleted_at,
|
'archived_at' => (int) $bank_integration->deleted_at,
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
<?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('bank_integrations', function (Blueprint $table) {
|
||||||
|
$table->boolean('disabled_upstream')->default(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
};
|
@ -43,14 +43,14 @@
|
|||||||
<div class="flex flex-col justify-center items-center mt-10" id="container-fastlink">
|
<div class="flex flex-col justify-center items-center mt-10" id="container-fastlink">
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
@if($account && !$account->isPaid())
|
@if($account && !$account->isPaid())
|
||||||
<div>
|
<div class="max-h-28">
|
||||||
<img src="{{ asset('images/invoiceninja-black-logo-2.png') }}"
|
<img src="{{ asset('images/invoiceninja-black-logo-2.png') }}"
|
||||||
class="border-b border-gray-100 h-18 pb-4" alt="Invoice Ninja logo">
|
class="border-b border-gray-100 h-18 pb-4" alt="Invoice Ninja logo">
|
||||||
</div>
|
</div>
|
||||||
@elseif(isset($company) && !is_null($company))
|
@elseif(isset($company) && !is_null($company))
|
||||||
<div>
|
<div class="max-h-28">
|
||||||
<img src="{{ $company->present()->logo() }}"
|
<img src="{{ $company->present()->logo() }}"
|
||||||
class="mx-auto border-b border-gray-100 h-18 pb-4" alt="{{ $company->present()->name() }} logo">
|
class="mx-auto border-b border-gray-100 h-18 pb-4" style="max-width: 400px;" alt="{{ $company->present()->name() }} logo">
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user