Skip to content

Commit

Permalink
feat: added support for auth param in link token create, resolves #72
Browse files Browse the repository at this point in the history
  • Loading branch information
harisrahman committed May 2, 2023
1 parent 6aa0476 commit 966325e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Resources/Tokens.php
Expand Up @@ -24,6 +24,7 @@ class Tokens extends AbstractResource
* @param string|null $android_package_name
* @param string|null $payment_id
* @param string|null $institution_id
* @param array|null $auth
* @throws PlaidRequestException
* @return object
*/
Expand All @@ -40,7 +41,8 @@ public function create(
?string $redirect_uri = null,
?string $android_package_name = null,
?string $payment_id = null,
?string $institution_id = null): object {
?string $institution_id = null,
?array $auth = null): object {

$params = [
"client_name" => $client_name,
Expand Down Expand Up @@ -84,6 +86,10 @@ public function create(
$params["institution_id"] = $institution_id;
}

if ($auth) {
$params["auth"] = $auth;
}

return $this->sendRequest(
"post",
"link/token/create",
Expand Down
34 changes: 34 additions & 0 deletions tests/TokensTest.php
Expand Up @@ -196,6 +196,40 @@ public function test_institution_id(): void
$this->assertEquals("institution_id", $response->params->institution_id);
}


public function test_auth(): void
{
$response = $this->getPlaidClient()->tokens->create(
"client_name",
"en",
["US"],
new User("usr_12345"),
[],
null,
null,
null,
null,
null,
null,
null,
null,
[
"auth_type_select_enabled" => true,
"automated_microdeposits_enabled" => true,
]
);

$this->assertEquals(
\json_decode(
\json_encode([
"auth_type_select_enabled" => true,
"automated_microdeposits_enabled" => true,
])
),
$response->params->auth
);
}

public function test_get_token(): void
{
$response = $this->getPlaidClient()->tokens->get("link_token");
Expand Down

0 comments on commit 966325e

Please sign in to comment.