Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Payplug/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
14 changes: 7 additions & 7 deletions tests/unit_tests/AuthenticationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading