From 45cb51aaba0eebb4f7708a35ed3ff938dd46ffb8 Mon Sep 17 00:00:00 2001 From: Rob Desilets Date: Tue, 9 Aug 2022 08:29:34 -0500 Subject: [PATCH 1/2] Add auth to Link token creation --- src/Resources/Tokens.php | 51 +++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/src/Resources/Tokens.php b/src/Resources/Tokens.php index f1c8ce0..0b57cd3 100644 --- a/src/Resources/Tokens.php +++ b/src/Resources/Tokens.php @@ -24,23 +24,26 @@ class Tokens extends AbstractResource * @param string|null $android_package_name * @param string|null $payment_id * @param string|null $institution_id - * @throws PlaidRequestException + * @param array $auth * @return object + * @throws PlaidRequestException */ public function create( - string $client_name, - string $language, - array $country_codes, - User $user, - array $products = [], - ?string $webhook = null, - ?string $link_customization_name = null, + string $client_name, + string $language, + array $country_codes, + User $user, + array $products = [], + ?string $webhook = null, + ?string $link_customization_name = null, ?AccountFilters $account_filters = null, - ?string $access_token = null, - ?string $redirect_uri = null, - ?string $android_package_name = null, - ?string $payment_id = null, - ?string $institution_id = null): object { + ?string $access_token = null, + ?string $redirect_uri = null, + ?string $android_package_name = null, + ?string $payment_id = null, + ?string $institution_id = null, + ?array $auth = null): object + { $params = [ "client_name" => $client_name, @@ -50,40 +53,44 @@ public function create( "products" => $products ]; - if( $webhook ){ + if ($webhook) { $params["webhook"] = $webhook; } - if( $link_customization_name ){ + if ($link_customization_name) { $params["link_customization_name"] = $link_customization_name; } - if( $account_filters ){ + if ($account_filters) { $params["account_filters"] = $account_filters->toArray(); } - if( $access_token ){ + if ($access_token) { $params["access_token"] = $access_token; } - if( $redirect_uri ){ + if ($redirect_uri) { $params["redirect_uri"] = $redirect_uri; } - if( $android_package_name ){ + if ($android_package_name) { $params["android_package_name"] = $android_package_name; } - if( $payment_id ){ + if ($payment_id) { $params["payment_initiation"] = [ "payment_id" => $payment_id ]; } - if( $institution_id ){ + if ($institution_id) { $params["institution_id"] = $institution_id; } + if ($auth) { + $params["auth"] = $auth; + } + return $this->sendRequest( "post", "link/token/create", @@ -95,8 +102,8 @@ public function create( * Get information about a previously created Link token. * * @param string $link_token - * @throws PlaidRequestException * @return object + * @throws PlaidRequestException */ public function get(string $link_token): object { From 650e0177510e0b96e55d630e7381f4fabd389546 Mon Sep 17 00:00:00 2001 From: Rob Desilets Date: Tue, 9 Aug 2022 08:31:12 -0500 Subject: [PATCH 2/2] Add auth to Link token creation --- src/Resources/Tokens.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resources/Tokens.php b/src/Resources/Tokens.php index 0b57cd3..eac2674 100644 --- a/src/Resources/Tokens.php +++ b/src/Resources/Tokens.php @@ -24,7 +24,7 @@ class Tokens extends AbstractResource * @param string|null $android_package_name * @param string|null $payment_id * @param string|null $institution_id - * @param array $auth + * @param array|null $auth * @return object * @throws PlaidRequestException */