diff --git a/Tests/Feature/Rule/IndexRulesTest.php b/Tests/Feature/Rule/IndexRulesTest.php index 0be2212..6398da3 100644 --- a/Tests/Feature/Rule/IndexRulesTest.php +++ b/Tests/Feature/Rule/IndexRulesTest.php @@ -102,6 +102,12 @@ public static function ruleFilterDataProvider(): array 'queryKey' => 'product_id', 'queryValue' => '1', ], + [ + 'method' => 'driver', + 'value' => 'huddle', + 'queryKey' => 'driver', + 'queryValue' => 'huddle', + ], [ 'method' => 'levelId', 'value' => 1, diff --git a/Tests/Unit/ClientTest.php b/Tests/Unit/ClientTest.php index b8f71c4..78aff3b 100644 --- a/Tests/Unit/ClientTest.php +++ b/Tests/Unit/ClientTest.php @@ -44,13 +44,14 @@ public function it_should_return_credentials(): void $codeVerifier = 'testVerifier'; $redirectUrl = 'https://example.com/callback'; $clientId = 123; + $testTenantId = 456; $mockResponse = new GuzzleResponse(200, [], json_encode(['access_token' => 'testAccessToken', 'refresh_token' => 'testRefreshToken'], JSON_THROW_ON_ERROR)); $mockGuzzleClient = $this->createMock(GuzzleClient::class); $mockGuzzleClient->method('request')->willReturn($mockResponse); $client = new Client(null, null, null, null, $mockGuzzleClient); - $response = $client->getCredentials($code, $codeVerifier, $redirectUrl, $clientId); + $response = $client->getCredentials($code, $codeVerifier, $redirectUrl, $clientId, $testTenantId); $this->assertEquals(200, $response->status()); $this->assertEquals('testAccessToken', $response->body()['access_token']); diff --git a/composer.json b/composer.json index a492817..a55eaae 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "plug-and-pay/sdk-php", - "version": "1.2.1", + "version": "1.2.2", "description": "This is a PHP SDK to make easier to communicate with the Plug&Pay API.", "keywords": [ "PlugAndPay", diff --git a/src/Filters/RuleFilter.php b/src/Filters/RuleFilter.php index bc1dbd9..4eeb34d 100644 --- a/src/Filters/RuleFilter.php +++ b/src/Filters/RuleFilter.php @@ -17,6 +17,13 @@ public function group(RuleGroupType $value): self return $this; } + public function driver(string $value): self + { + $this->parameters['driver'] = $value; + + return $this; + } + public function tenantId(int $value): self { $this->parameters['tenant_id'] = $value; diff --git a/src/Service/Client.php b/src/Service/Client.php index 33ca7d5..3a5083c 100644 --- a/src/Service/Client.php +++ b/src/Service/Client.php @@ -204,7 +204,7 @@ public function generateAuthorizationUrl(int $clientId, string $state, string $c * @throws NotFoundException * @throws ValidationException */ - public function getCredentials(string $code, string $codeVerifier, string $redirectUrl, int $clientId): Response + public function getCredentials(string $code, string $codeVerifier, string $redirectUrl, int $clientId, int $tenantId): Response { $response = $this->request(self::METHOD_POST, '/oauth/token', [ 'grant_type' => 'authorization_code', @@ -212,6 +212,7 @@ public function getCredentials(string $code, string $codeVerifier, string $redir 'redirect_uri' => $redirectUrl, 'code_verifier' => $codeVerifier, 'code' => $code, + 'tenant_id' => $tenantId, ]); return $this->fromGuzzleResponse($response);