From f14e9c9948adc673cc6728878c18f90cfe4227dd Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 21 Sep 2022 21:03:04 +1000 Subject: [PATCH] Auto pull transactions when linking accounts --- app/Http/Controllers/Bank/YodleeController.php | 10 ++++++++++ app/Jobs/Bank/ProcessBankTransactions.php | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Bank/YodleeController.php b/app/Http/Controllers/Bank/YodleeController.php index fa9d7889dd..d20ccfa195 100644 --- a/app/Http/Controllers/Bank/YodleeController.php +++ b/app/Http/Controllers/Bank/YodleeController.php @@ -14,6 +14,7 @@ namespace App\Http\Controllers\Bank; use App\Helpers\Bank\Yodlee\Yodlee; use App\Http\Controllers\BaseController; use App\Http\Requests\Yodlee\YodleeAuthRequest; +use App\Jobs\Bank\ProcessBankTransactions; use App\Models\BankIntegration; use Illuminate\Http\Request; @@ -102,6 +103,15 @@ class YodleeController extends BaseController } } + + + $company->account->bank_integrations->each(function ($bank_integration) use ($company){ + + ProcessBankTransactions::dispatch($company->account->bank_integration_account_id, $bank_integration); + + }); + + } } diff --git a/app/Jobs/Bank/ProcessBankTransactions.php b/app/Jobs/Bank/ProcessBankTransactions.php index ddbeee233d..7e7c85083e 100644 --- a/app/Jobs/Bank/ProcessBankTransactions.php +++ b/app/Jobs/Bank/ProcessBankTransactions.php @@ -64,7 +64,7 @@ class ProcessBankTransactions implements ShouldQueue set_time_limit(0); //Loop through everything until we are up to date - $this->from_date = $this->from_date ?: '2020-01-01'; + $this->from_date = $this->from_date ?: '2021-01-01'; do{