From 222e6269327e9de759e0ecf7443dd1e3e17f3337 Mon Sep 17 00:00:00 2001 From: Mikolaj Kaminski Date: Mon, 5 Sep 2022 10:15:25 +0200 Subject: [PATCH 1/3] Add support for immediate redirect + improve documentation --- src/API/NordigenClient.php | 43 +++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/src/API/NordigenClient.php b/src/API/NordigenClient.php index 88d9ef7..8d371df 100644 --- a/src/API/NordigenClient.php +++ b/src/API/NordigenClient.php @@ -39,28 +39,34 @@ public function account(string $accountId): Account /** - * Perform all the necessary steps in order to retrieve the URL for user authentication.
- * A new End-User agreement and requisition will be created. - * - * The result will be an array containing the URL for user authentication and the IDs of the - * newly created requisition and End-user agreement. - * @param string $institutionIdentifier ID of the Institution. - * @param int $maxHistoricalDays Maximum number of days of transaction data to retrieve. - * @param string $endUserId The ID of the End-user in the client's system. - * @param string $reference - * @param string $redirect - * @param AccessScope[] $accessScope - * @param string|null $userLanguage - * - * @return array - */ + * Perform all the necessary steps in order to retrieve the URL for user authentication.
+ * A new End-User agreement and requisition will be created. + * + * The result will be an array containing the URL for user authentication and the IDs of the + * newly created requisition and End-user agreement. + * @param string $institutionIdentifier ID of the Institution. + * @param int $maxHistoricalDays Maximum number of days of transaction data to retrieve. + * @param string $endUserId The ID of the End-user in the client's system. + * @param string $reference Additional ID to identify the End-user. This value will be appended to the redirect. + * @param string $redirect The URI where the End-user will be redirected to after authentication. + * @param AccessScope[] $accessScope The requested access scope. All by default. See Enums\AccessScope for possible values. + * @param string|null $userLanguage Language to use in views. Two-letter country code (ISO 639-1). + * @param string|null $ssn SSN (social security number) field to verify ownership of the account. + * @param bool|null $accountSelection Option to enable account selection view for the end user. + * @param bool|null $redirectImmediate Option to enable redirect back to the client after account list received + * + * @return array + */ public function initSession( string $institutionIdentifier, string $redirect, int $maxHistoricalDays = 90, ?string $reference = null, ?array $accessScopes = ['details', 'balances', 'transactions'], - ?string $userLanguage = null + ?string $userLanguage = null, + ?string $ssn = null, + ?bool $accountSelection = null, + ?bool $redirectImmediate = false ): array { $endUserAgreement = $this->endUserAgreement->createEndUserAgreement( @@ -73,7 +79,10 @@ public function initSession( $institutionIdentifier, $endUserAgreement["id"], $reference, - $userLanguage + $userLanguage, + $ssn, + $accountSelection, + $redirectImmediate ); $result = [ 'link' => $requisition["link"], From db22fb4c65ec19ceba5ab77a8bcbd397e6fcfd61 Mon Sep 17 00:00:00 2001 From: Mikolaj Kaminski Date: Mon, 5 Sep 2022 10:18:25 +0200 Subject: [PATCH 2/3] default redirect to null, aligned with other parameters --- src/API/NordigenClient.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/API/NordigenClient.php b/src/API/NordigenClient.php index 8d371df..e64b51f 100644 --- a/src/API/NordigenClient.php +++ b/src/API/NordigenClient.php @@ -66,7 +66,7 @@ public function initSession( ?string $userLanguage = null, ?string $ssn = null, ?bool $accountSelection = null, - ?bool $redirectImmediate = false + ?bool $redirectImmediate = null ): array { $endUserAgreement = $this->endUserAgreement->createEndUserAgreement( From 8bc093261c450a2dc7c411ba9f487302db48a53a Mon Sep 17 00:00:00 2001 From: Mikolaj Kaminski Date: Mon, 5 Sep 2022 10:21:21 +0200 Subject: [PATCH 3/3] Add access valid for days parameter --- src/API/NordigenClient.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/API/NordigenClient.php b/src/API/NordigenClient.php index e64b51f..dd11a61 100644 --- a/src/API/NordigenClient.php +++ b/src/API/NordigenClient.php @@ -45,7 +45,8 @@ public function account(string $accountId): Account * The result will be an array containing the URL for user authentication and the IDs of the * newly created requisition and End-user agreement. * @param string $institutionIdentifier ID of the Institution. - * @param int $maxHistoricalDays Maximum number of days of transaction data to retrieve. + * @param int $maxHistoricalDays Maximum number of days of transaction data to retrieve. 90 by default. + * @param int $accessValidForDays How long access to the end-user's account will be available. 90 days by default. * @param string $endUserId The ID of the End-user in the client's system. * @param string $reference Additional ID to identify the End-user. This value will be appended to the redirect. * @param string $redirect The URI where the End-user will be redirected to after authentication. @@ -61,6 +62,7 @@ public function initSession( string $institutionIdentifier, string $redirect, int $maxHistoricalDays = 90, + int $accessValidForDays = 90, ?string $reference = null, ?array $accessScopes = ['details', 'balances', 'transactions'], ?string $userLanguage = null, @@ -72,7 +74,8 @@ public function initSession( $endUserAgreement = $this->endUserAgreement->createEndUserAgreement( $institutionIdentifier, $accessScopes, - $maxHistoricalDays + $maxHistoricalDays, + $accessValidForDays ); $requisition = $this->requisition->createRequisition( $redirect,