Skip to content

Commit 937e5a1

Browse files
committed
Configure scopes correctly within the client, remove rogue die statement
1 parent 376b3df commit 937e5a1

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

src/Client/APIResource.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ public function addAuth(RequestInterface $request): RequestInterface
7575
$request = $handler($request, $credentials);
7676
break;
7777
} catch (\RuntimeException $e) {
78-
die($e->getMessage());
7978
continue; // We are OK if multiple are sent but only one match
8079
}
8180
throw new \RuntimeException(

src/SimSwap/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public function checkSimSwap(string $number, ?int $maxAge = null)
2323
{
2424
/** @var SimSwapGnpHandler $handler */
2525
$handler = $this->getAPIResource()->getAuthHandlers()[0];
26+
$handler->setScope('dpv:FraudPreventionAndDetection#check-sim-swap');
2627

2728
if (!$handler instanceof SimSwapGnpHandler) {
2829
throw new \RuntimeException('SimSwap Client has been misconfigured. Only a GNP Handler can be used');
@@ -45,13 +46,12 @@ public function checkSimSwapDate(string $number): string
4546
{
4647
/** @var SimSwapGnpHandler $handler */
4748
$handler = $this->getAPIResource()->getAuthHandlers()[0];
49+
$handler->setScope('dpv:FraudPreventionAndDetection#retrieve-sim-swap-date');
4850

4951
if (!$handler instanceof SimSwapGnpHandler) {
5052
throw new \RuntimeException('SimSwap Client has been misconfigured. Only a GNP Handler can be used');
5153
}
5254

53-
$handler->setScope('dpv:FraudPreventionAndDetection#retrieve-sim-swap-date');
54-
5555
$response = $this->getAPIResource()->create(['phoneNumber' => $number], 'retrieve-date');
5656

5757
return $response['latestSimChange'];

test/SimSwap/ClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function setUp(): void
4343
$handler = new Client\Credentials\Handler\SimSwapGnpHandler();
4444
$handler->setBaseUrl('https://api-eu.vonage.com/oauth2/bc-authorize');
4545
$handler->setTokenUrl('https://api-eu.vonage.com/oauth2/token');
46-
$handler->setScope('dpv:FraudPreventionAndDetection#check-sim-swap');
46+
// $handler->setScope('dpv:FraudPreventionAndDetection#check-sim-swap');
4747
$handler->setClient($revealedClient);
4848

4949
$this->api = (new APIResource())

0 commit comments

Comments
 (0)