cluttr-eng / fuse-php
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
1.0.3
2023-09-12 16:11 UTC
Requires
- php: ^7.4 || ^8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^1.7 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- phpunit/phpunit: ^8.0 || ^9.0
This package is not auto-updated.
Last update: 2025-01-15 20:39:32 UTC
README
Quick start
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
Install
composer require cluttr-eng/fuse-php:VERSION
<?php
namespace Fuse\Tests;
use FuseClient\Configuration;
use FuseClient\HeaderSelector;
use FuseClient\Api\FuseApi;
use FuseClient\Model\CreateSessionRequest;
use FuseClient\Model\Aggregator;
use FuseClient\Model\Product;
use FuseClient\Model\CountryCode;
use FuseClient\Model\Entity;
use FuseClient\Model\CreateLinkTokenRequest;
use GuzzleHttp\Client;
use PHPUnit\Framework\TestCase;
class CustomHeaderSelector extends HeaderSelector
{
/**
* @param string[] $accept
* @param string $contentType
* @param bool $isMultipart
* @return string[]
*/
public function selectHeaders(array $accept, string $contentType, bool $isMultipart): array
{
$headers = parent::selectHeaders($accept, $contentType, $isMultipart);
// Add the custom headers
$headers['Plaid-Client-Id'] = "my-plaid-client-id"; // get value from environment or your logic
$headers['Plaid-Secret'] = "my-plaid-secret"; // get value from environment or your logic
return $headers;
}
}
class FuseTest extends TestCase {
public function testAddition() {
$config = Configuration::getDefaultConfiguration()->setHost(getenv('BASE_URL'));
$config = Configuration::getDefaultConfiguration()->setApiKey('Fuse-Api-Key', 'my-fuse-api-key');
$config = Configuration::getDefaultConfiguration()->setApiKey('Fuse-Client-Id', 'my-fuse-client-id');
$customHeaderSelector = new CustomHeaderSelector();
$apiInstance = new FuseApi(
new Client(),
$config,
$customHeaderSelector
);
$createSessionRequest = new CreateSessionRequest();
$createSessionRequest['supported_financial_institution_aggregators'] = [
Aggregator::PLAID
];
$createSessionRequest['products'] = [
Product::ACCOUNT_DETAILS,
Product::BALANCE
];
$createSessionRequest['country_codes'] = [
CountryCode::US,
];
$entity = new Entity();
$entity['id'] = "entity-id";
$createSessionRequest['entity'] = $entity;
$create_session_response = $apiInstance->createSession($createSessionRequest);
$createLinkTokenRequest = new CreateLinkTokenRequest();
$createLinkTokenRequest['institution_id'] = "a504e026-7cec-4dc0-9449-29e0997f6a62"; //First independent bank
$createLinkTokenRequest['session_client_secret'] = $create_session_response['client_secret'];
$createLinkTokenRequest['entity'] = $entity;
$createLinkTokenRequest['client_name'] = 'Fuse';
$create_link_token_response = $apiInstance->createLinkToken($createLinkTokenRequest);
}
}