Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

PlaidController.php 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Services\PlaidService;
  4. use Illuminate\Http\Request;
  5. use Illuminate\Routing\Controller;
  6. class PlaidController extends Controller
  7. {
  8. /**
  9. * Handle the incoming request.
  10. */
  11. public function __invoke(Request $request, PlaidService $plaidService)
  12. {
  13. $publicTokenResponse = $plaidService->createSandboxPublicToken();
  14. $publicToken = $publicTokenResponse->public_token;
  15. $accessTokenResponse = $plaidService->exchangePublicToken($publicToken);
  16. $accessToken = $accessTokenResponse->access_token;
  17. $authResponse = $plaidService->getAuth($accessToken);
  18. $account = $authResponse;
  19. $institutionId = $account->item->institution_id;
  20. $institutionResponse = $plaidService->getInstitution($institutionId);
  21. return response()->json([
  22. 'public_token' => $publicToken,
  23. 'public_token_response' => $publicTokenResponse,
  24. 'access_token_response' => $accessTokenResponse,
  25. 'access_token' => $accessToken,
  26. 'account' => $account,
  27. 'institution' => $institutionResponse,
  28. ]);
  29. }
  30. }