setTestMode(); $company = $request->getCompany(); if($company->account->bank_integration_account_id){ $flow = 'edit'; $token = $company->account->bank_integration_account_id; } else{ $flow = 'add'; $response = $yodlee->createUser($company); $token = $response->user->loginName; $company->account->bank_integration_account_id = $token; $company->push(); } $yodlee = new Yodlee($token); $yodlee->setTestMode(); if(!is_string($token)) dd($token); $data = [ 'access_token' => $yodlee->getAccessToken(), 'fasttrack_url' => $yodlee->getFastTrackUrl(), 'config_name' => 'testninja', 'flow' => $flow, 'company' => $company, 'account' => $company->account, ]; return view('bank.yodlee.auth', $data); } public function refreshAccounts(YodleeAdminRequest $request) { $token = auth()->user()->account->bank_integration_account_id; if(!$token) return response()->json(['message' => 'No bank integrations are present. Please add a bank account. '],400); $yodlee = new Yodlee($token); $yodlee->setTestMode(); $yodlee->getAccounts(); } }