Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added support for auth param in link token create, resolves #72 #73

Merged
merged 1 commit into from Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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