Skip to content

Commit

Permalink
Require $ProfileID to be not null rather than not empty
Browse files Browse the repository at this point in the history
So it is possible to send an empty string when using the fake gateway
  • Loading branch information
elnurvl committed Sep 6, 2021
1 parent d61a052 commit 135510b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Service/GlobalAuthenticationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class GlobalAuthenticationService extends ID3BaseService
private GlobalAuthenticationGateway $gateway;

/**
* @var string The Profile ID to be used when verifying identities via->verifyIdentity().
* @var ?string The Profile ID to be used when verifying identities via->verifyIdentity().
*
* @see self::setProfileId()
*/
private string $profileId = '';
private ?string $profileId = null;

/**
* @var int The version of the Profile ID to be used when verifying identities via->verifyIdentity().
Expand Down Expand Up @@ -99,7 +99,7 @@ public function verifyIdentity(Identity $identity, ?string $customerReference =

$gateway = $this->getGateway();

if (!$this->profileId) {
if ($this->profileId === null) {
$error = 'An ID3global Profile ID must be set by calling setProfileId() before calling verifyIdentity().';

throw new LogicException($error);
Expand Down
2 changes: 1 addition & 1 deletion tests/Service/GlobalAuthenticationServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function fakeResponses(): array
{
return [
['profile-id', 1, 'customer-1', GlobalAuthenticationGatewayFake::IDENTITY_BAND_ALERT, 20000],
['profile-id-2', 0, 'customer-2', GlobalAuthenticationGatewayFake::IDENTITY_BAND_REFER, 500],
['', 0, '', GlobalAuthenticationGatewayFake::IDENTITY_BAND_REFER, 500],
];
}
}

0 comments on commit 135510b

Please sign in to comment.