diff --git a/lib/Payplug/Authentication.php b/lib/Payplug/Authentication.php index 8e45b80..8bbcf7e 100644 --- a/lib/Payplug/Authentication.php +++ b/lib/Payplug/Authentication.php @@ -166,7 +166,7 @@ public static function generateJWT($client_id = '', $client_secret = '') return array(); } - $response['httpResponse']['expires_date'] = time() + $response['httpResponse']['expires_in']; + $response['httpResponse']['expires_date'] = time() + $response['httpResponse']['expires_in'] - 30; return $response; } catch (Exception $e) { diff --git a/tests/unit_tests/AuthenticationTest.php b/tests/unit_tests/AuthenticationTest.php index 1c2c499..15fc5f7 100644 --- a/tests/unit_tests/AuthenticationTest.php +++ b/tests/unit_tests/AuthenticationTest.php @@ -43,8 +43,8 @@ public function testGetKeysByLogin() $password = 'passwordIsOverrated'; $response = array( 'secret_keys' => array( - 'test' => 'sk_test_everythingIsUnderControl', - 'live' => 'sk_live_allYourBasesAreBelongToUs', + 'test' => 'test_secret_test', + 'live' => 'test_secret_live', ), ); $this->_requestMock @@ -66,8 +66,8 @@ public function testGetKeysByLogin() $authentication = Authentication::getKeysByLogin($email, $password); $this->assertEquals(201, $authentication['httpStatus']); - $this->assertEquals('sk_test_everythingIsUnderControl', $authentication['httpResponse']['secret_keys']['test']); - $this->assertEquals('sk_live_allYourBasesAreBelongToUs', $authentication['httpResponse']['secret_keys']['live']); + $this->assertEquals('test_secret_test', $authentication['httpResponse']['secret_keys']['test']); + $this->assertEquals('test_secret_live', $authentication['httpResponse']['secret_keys']['live']); } public function testGetAccount() @@ -274,7 +274,7 @@ public function testGenerateJWTWhenErrorResponse() 'expires_in' => 300, 'scope' => 'sandbox', 'token_type' => 'bearer', - 'expires_date' => time() + 300 + 'expires_date' => time() + 270 ); $this->_requestMock @@ -305,7 +305,7 @@ public function testGenerateJWTOSWhenErrorResponse() 'expires_in' => 300, 'scope' => 'sandbox', 'token_type' => 'bearer', - 'expires_date' => time() + 300 + 'expires_date' => time() + 270 ); $this->_requestMock @@ -336,7 +336,7 @@ public function testGenerateJWTWhenSuccessResponse() 'expires_in' => 300, 'scope' => 'sandbox', 'token_type' => 'bearer', - 'expires_date' => time() + 300 + 'expires_date' => time() + 270 ); $this->_requestMock