processYodlee(); $this->processNordigen(); } } else { $this->processYodlee(); $this->processNordigen(); } nlog("syncing transactions - done"); } private function processYodlee() { if (Ninja::isHosted()) { nlog("syncing transactions - yodlee"); Account::with('bank_integrations')->whereNotNull('bank_integration_account_id')->cursor()->each(function ($account) { if ($account->isEnterprisePaidClient()) { $account->bank_integrations()->where('integration_type', BankIntegration::INTEGRATION_TYPE_YODLEE)->where('auto_sync', true)->where('disabled_upstream', 0)->cursor()->each(function ($bank_integration) use ($account) { (new ProcessBankTransactionsYodlee($account->bank_integration_account_id, $bank_integration))->handle(); }); } }); } } private function processNordigen() { if (config("ninja.nordigen.secret_id") && config("ninja.nordigen.secret_key")) { nlog("syncing transactions - nordigen"); Account::with('bank_integrations')->cursor()->each(function ($account) { if ((Ninja::isSelfHost() || (Ninja::isHosted() && $account->isEnterprisePaidClient()))) { $account->bank_integrations()->where('integration_type', BankIntegration::INTEGRATION_TYPE_NORDIGEN)->where('auto_sync', true)->where('disabled_upstream', 0)->cursor()->each(function ($bank_integration) { try { (new ProcessBankTransactionsNordigen($bank_integration))->handle(); } catch(\Exception $e) { nlog("Exception:: BankTransactioSync::" . $e->getMessage()); sleep(20); } sleep(5); }); } }); } } }