Skip to content

Commit

Permalink
OctopusDeploy release: 12.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
securesubmit-buildmaster committed Jul 23, 2024
1 parent 5dcd2a0 commit ebd075e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

# Changelog

## Latest Version - v12.0.8 (07/23/24)
### Bug Fixes:
- [GP-API] Fix re-sign in after token expiration

## Latest Version - v12.0.7 (07/16/24)
### Enhancements:
- [GP-API] Adds avs data to "/transaction" request for digital wallet
Expand Down
2 changes: 1 addition & 1 deletion metadata.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<xml>
<releaseNumber>12.0.7</releaseNumber>
<releaseNumber>12.0.8</releaseNumber>
</xml>
7 changes: 5 additions & 2 deletions src/Gateways/GpApiConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,18 +315,21 @@ public function doTransaction(
);
} catch (GatewayException $exception) {
if (
in_array($exception->responseCode, ['NOT_AUTHENTICATED', '401']) &&
str_contains($exception->getMessage(), 'NOT_AUTHENTICATED') &&
!empty($this->gpApiConfig->appKey) &&
!empty($this->gpApiConfig->appKey)
) {
$this->gpApiConfig->accessTokenInfo = null;
$this->headers['Authorization'] = null;
$this->signIn();
return parent::doTransaction(
$response = parent::doTransaction(
$verb,
$endpoint,
$data,
$queryStringParams
);

return json_decode($response);
}

throw $exception;
Expand Down
22 changes: 22 additions & 0 deletions test/Integration/Gateways/GpApiConnector/AccessTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@ class AccessTokenTest extends TestCase
*/
private GpApiConfig $config;

private CreditCardData $card;

public function setUp(): void
{
$this->setUpConfig();
$this->card = new CreditCardData();
$this->card->number = "4263970000005262";
$this->card->expMonth = "05";
$this->card->expYear = "2025";
$this->card->cvn = "852";
}

public static function tearDownAfterClass(): void
Expand Down Expand Up @@ -221,6 +228,21 @@ public function testUseOnlyAccessToken()
$this->assertEquals('VERIFIED', $response->responseMessage);
}

public function testShouldReSignInAfterTokenExpiration()
{
$this->config->secondsToExpire = 60;
$accessTokenInfo = GpApiService::generateTransactionKey($this->config);
$this->assertAccessTokenResponse($accessTokenInfo);

$this->config->accessTokenInfo = $accessTokenInfo;
ServicesContainer::configureService($this->config);
sleep(61);
$response = $this->card->verify()->withCurrency('USD')->execute();
$this->assertNotNull($response);
$this->assertEquals('SUCCESS', $response->responseCode);
$this->assertEquals('VERIFIED', $response->responseMessage);
}

private function assertAccessTokenResponse(AccessTokenInfo $accessTokenInfo): void
{
$this->assertNotNull($accessTokenInfo);
Expand Down

0 comments on commit ebd075e

Please sign in to comment.