Skip to content

Commit

Permalink
OctopusDeploy release: 6.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
securesubmit-buildmaster committed Feb 21, 2023
1 parent 7c8b781 commit 2df081f
Show file tree
Hide file tree
Showing 12 changed files with 427 additions and 21 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@

## Latest Version
#### Enhancements:
- GP-API: Add account_id on all requests

#### Bug Fixes:
- PAX A35: Fixed device-response handling

## v6.1.3 (02/16/2023)
#### Enhancements:
- GP-API: Create open banking transactions
- GPI Transactions: Reporting tests refacto

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>6.1.3</releaseNumber>
<releaseNumber>6.1.4</releaseNumber>
</xml>
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public function buildRequest(BaseBuilder $builder, $config)
$verb = 'POST';
$requestData = [];
$requestData['account_name'] = $config->accessTokenInfo->tokenizationAccountName;
$requestData['account_id'] = $config->accessTokenInfo->tokenizationAccountID;
$requestData['name'] = $builder->description ? $builder->description : "";
$requestData['reference'] = $builder->clientTransactionId ?
$builder->clientTransactionId : GenerationUtils::generateOrderId();
Expand All @@ -117,6 +118,7 @@ public function buildRequest(BaseBuilder $builder, $config)
$endpoint = GpApiRequest::DCC_ENDPOINT;
$verb = 'POST';
$requestData['account_name'] = $config->accessTokenInfo->transactionProcessingAccountName;
$requestData['account_id'] = $config->accessTokenInfo->transactionProcessingAccountID;
$requestData['channel'] = $config->channel;
$requestData['amount'] = StringUtils::toNumeric($builder->amount);
$requestData['currency'] = $builder->currency;
Expand All @@ -132,6 +134,7 @@ public function buildRequest(BaseBuilder $builder, $config)
$endpoint = GpApiRequest::PAYLINK_ENDPOINT;
$verb = 'POST';
$requestData['account_name'] = $config->accessTokenInfo->transactionProcessingAccountName;
$requestData['account_id'] = $config->accessTokenInfo->transactionProcessingAccountID;
$requestData['type'] = $payLink->type;
$requestData['usage_mode'] = $payLink->usageMode;
$requestData['usage_limit'] = (string) $payLink->usageLimit;
Expand Down Expand Up @@ -170,6 +173,7 @@ private function generateVerificationRequest(AuthorizationBuilder $builder, GpAp
{
$requestBody = [];
$requestBody['account_name'] = $config->accessTokenInfo->transactionProcessingAccountName;
$requestBody['account_id'] = $config->accessTokenInfo->transactionProcessingAccountID;
$requestBody['channel'] = $config->channel;
$requestBody['reference'] = !empty($builder->clientTransactionId) ?
$builder->clientTransactionId : GenerationUtils::getGuid();
Expand All @@ -187,6 +191,7 @@ private function createFromAuthorizationBuilder($builder, GpApiConfig $config)

$requestBody = [];
$requestBody['account_name'] = $config->accessTokenInfo->transactionProcessingAccountName;
$requestBody['account_id'] = $config->accessTokenInfo->transactionProcessingAccountID;
$requestBody['channel'] = $config->channel;
$requestBody['country'] = $config->country;
$requestBody['type'] = ($builder->transactionType == TransactionType::REFUND ?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function buildRequest(BaseBuilder $builder, $config)
$verb = 'GET';
$this->addBasicParams($queryParams, $builder);
$queryParams['account_name'] = $config->accessTokenInfo->dataAccountName;
$queryParams['account_id'] = $config->accessTokenInfo->dataAccountID;
$queryParams['order_by'] = $builder->depositOrderBy;
$queryParams['order'] = $builder->order;
$queryParams['amount'] = StringUtils::toNumeric($builder->searchBuilder->amount);
Expand Down Expand Up @@ -98,6 +99,7 @@ public function buildRequest(BaseBuilder $builder, $config)
$verb = 'GET';
$this->addBasicParams($queryParams, $builder);
$queryParams['account_name'] = $config->accessTokenInfo->dataAccountName;
$queryParams['account_id'] = $config->accessTokenInfo->dataAccountID;
$queryParams['deposit_status'] = $builder->searchBuilder->depositStatus;
$queryParams['arn'] = $builder->searchBuilder->aquirerReferenceNumber;
$queryParams['deposit_id'] = $builder->searchBuilder->depositId;
Expand Down Expand Up @@ -137,6 +139,7 @@ public function buildRequest(BaseBuilder $builder, $config)
$verb = 'GET';
$this->addBasicParams($queryParams, $builder);
$queryParams['account_name'] = $config->accessTokenInfo->dataAccountName;
$queryParams['account_id'] = $config->accessTokenInfo->dataAccountID;
$queryParams = array_merge($queryParams, $this->getDisputesParams($builder));
break;
case ReportType::FIND_STORED_PAYMENT_METHODS_PAGED:
Expand All @@ -151,6 +154,7 @@ public function buildRequest(BaseBuilder $builder, $config)
];
$payload = [
'account_name' => $config->accessTokenInfo->tokenizationAccountName,
'account_id' => $config->accessTokenInfo->tokenizationAccountID,
'reference' => $builder->searchBuilder->referenceNumber,
'card' => !empty($card) ? $card : null
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function buildRequest(BaseBuilder $builder, $config)
$verb = 'POST';
$endpoint = GpApiRequest::RISK_ASSESSMENTS;
$requestData['account_name'] = $config->accessTokenInfo->riskAssessmentAccountName;
$requestData['account_id'] = $config->accessTokenInfo->riskAssessmentAccountID;
$requestData['reference'] = !empty($builder->getReferenceNumber()) ?
$builder->getReferenceNumber() : GenerationUtils::getGuid();
$requestData['source'] = $builder->getAuthenticationSource();
Expand Down Expand Up @@ -102,6 +103,7 @@ private function verifyEnrolled(Secure3dBuilder $builder, GpApiConfig $config)
{
$threeDS = [];
$threeDS['account_name'] = $config->accessTokenInfo->transactionProcessingAccountName;
$threeDS['account_id'] = $config->accessTokenInfo->transactionProcessingAccountID;
$threeDS['channel'] = $config->channel;
$threeDS['country'] = $config->country;
$threeDS['reference'] = !empty($builder->getReferenceNumber()) ?
Expand Down
21 changes: 21 additions & 0 deletions src/Entities/GpApi/AccessTokenInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class AccessTokenInfo
* @var string
*/
public $accessToken;

/**
* @var string
*/
Expand All @@ -27,4 +28,24 @@ class AccessTokenInfo

/** @var string */
public $riskAssessmentAccountName;

/**
* @var string
*/
public $dataAccountID;
/**
* @var string
*/
public $disputeManagementAccountID;
/**
* @var string
*/
public $tokenizationAccountID;
/**
* @var string
*/
public $transactionProcessingAccountID;

/** @var string */
public $riskAssessmentAccountID;
}
44 changes: 44 additions & 0 deletions src/Entities/GpApi/GpApiTokenResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,75 @@ private function getAccountName($accountPrefix)
return null;
}

/**
* @param string $accountPrefix
*
* @return null|string
*/
private function getAccountID(string $accountPrefix)
{
/**
* @var GpApiAccount $account
*/
foreach ($this->accounts as $account) {
if (!empty($account->id) && substr($account->id, 0, 4) === $accountPrefix) {
return $account->id;
}
}

return null;
}

public function getDataAccountName()
{
return $this->getAccountName(self::DATA_ACCOUNT_NAME_PREFIX);
}

public function getDataAccountID()
{
return $this->getAccountID(self::DATA_ACCOUNT_NAME_PREFIX);
}

public function getDisputeManagementAccountName()
{
return $this->getAccountName(self::DISPUTE_MANAGEMENT_ACCOUNT_NAME_PREFIX);
}

public function getDisputeManagementAccountID()
{
return $this->getAccountID(self::DISPUTE_MANAGEMENT_ACCOUNT_NAME_PREFIX);
}

public function getTokenizationAccountName()
{
return $this->getAccountName(self::TOKENIZATION_ACCOUNT_NAME_PREFIX);
}

public function getTokenizationAccountID()
{
return $this->getAccountID(self::TOKENIZATION_ACCOUNT_NAME_PREFIX);
}

public function getTransactionProcessingAccountName()
{
return $this->getAccountName(self::TRANSACTION_PROCESSING_ACCOUNT_NAME_PREFIX);
}

public function getTransactionProcessingAccountID()
{
return $this->getAccountID(self::TRANSACTION_PROCESSING_ACCOUNT_NAME_PREFIX);
}

public function getRiskAssessmentAccountName()
{
return $this->getAccountName(self::RIKS_ASSESSMENT_ACCOUNT_NAME_PREFIX);
}

public function getRiskAssessmentAccountID()
{
return $this->getAccountID(self::RIKS_ASSESSMENT_ACCOUNT_NAME_PREFIX);
}

public function getToken()
{
return $this->token;
Expand Down
35 changes: 25 additions & 10 deletions src/Gateways/GpApiConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,21 +300,36 @@ public function signIn()
if (empty($accessTokenInfo->accessToken)) {
$accessTokenInfo->accessToken = $response->getToken();
}
if (empty($accessTokenInfo->dataAccountName)) {
$accessTokenInfo->dataAccountName = $response->getDataAccountName();

if (empty($accessTokenInfo->dataAccountID)) {
$accessTokenInfo->dataAccountID = $response->getDataAccountID();
}
if (empty($accessTokenInfo->tokenizationAccountName)) {
$accessTokenInfo->tokenizationAccountName = $response->getTokenizationAccountName();
if (
empty($accessTokenInfo->tokenizationAccountID) &&
empty($accessTokenInfo->tokenizationAccountName)
) {
$accessTokenInfo->tokenizationAccountID = $response->getTokenizationAccountID();
}
if (empty($accessTokenInfo->transactionProcessingAccountName)) {
$accessTokenInfo->transactionProcessingAccountName = $response->getTransactionProcessingAccountName();

if (
empty($accessTokenInfo->transactionProcessingAccountID) &&
empty($accessTokenInfo->transactionProcessingAccountName)
) {
$accessTokenInfo->transactionProcessingAccountID = $response->getTransactionProcessingAccountID();
}
if (empty($accessTokenInfo->disputeManagementAccountName)) {
$accessTokenInfo->disputeManagementAccountName = $response->getDisputeManagementAccountName();
if (
empty($accessTokenInfo->disputeManagementAccountID) &&
empty($accessTokenInfo->disputeManagementAccountName)
) {
$accessTokenInfo->disputeManagementAccountID = $response->getDisputeManagementAccountID();
}
if (empty($accessTokenInfo->riskAssessmentAccountName)) {
$accessTokenInfo->riskAssessmentAccountName = $response->getRiskAssessmentAccountName();
if (
empty($accessTokenInfo->riskAssessmentAccountID) &&
empty($accessTokenInfo->riskAssessmentAccountName)
) {
$accessTokenInfo->riskAssessmentAccountID = $response->getRiskAssessmentAccountID();
}

$this->gpApiConfig->accessTokenInfo = $accessTokenInfo;
}

Expand Down
5 changes: 5 additions & 0 deletions src/Services/GpApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public static function generateTransactionKey(GpApiConfig $config)
$accessTokenInfo->transactionProcessingAccountName = $data->getTransactionProcessingAccountName();
$accessTokenInfo->tokenizationAccountName = $data->getTokenizationAccountName();
$accessTokenInfo->riskAssessmentAccountName = $data->getRiskAssessmentAccountName();
$accessTokenInfo->dataAccountID = $data->getDataAccountID();
$accessTokenInfo->disputeManagementAccountID = $data->getDisputeManagementAccountID();
$accessTokenInfo->transactionProcessingAccountID = $data->getTransactionProcessingAccountID();
$accessTokenInfo->tokenizationAccountID = $data->getTokenizationAccountID();
$accessTokenInfo->riskAssessmentAccountID = $data->getRiskAssessmentAccountID();

return $accessTokenInfo;
}
Expand Down
12 changes: 6 additions & 6 deletions src/Terminals/PAX/Interfaces/PaxTcpInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

namespace GlobalPayments\Api\Terminals\PAX\Interfaces;

use GlobalPayments\Api\Terminals\Interfaces\IDeviceCommInterface;
use GlobalPayments\Api\Terminals\ConnectionConfig;
use GlobalPayments\Api\Entities\Exceptions\GatewayException;
use GlobalPayments\Api\Terminals\Enums\ControlCodes;
use GlobalPayments\Api\Terminals\PAX\Entities\Enums\PaxMessageId;
use GlobalPayments\Api\Terminals\TerminalUtils;
use GlobalPayments\Api\Terminals\Enums\ConnectionModes;
use GlobalPayments\Api\Terminals\{ConnectionConfig, TerminalUtils};
use GlobalPayments\Api\Terminals\Enums\{ControlCodes, ConnectionModes};
use GlobalPayments\Api\Terminals\Interfaces\IDeviceCommInterface;

/*
* TCP interface for the device connection and parse response
Expand Down Expand Up @@ -204,6 +201,9 @@ private function awaitResponse($readString = false)
do {
$part = ($readString === true) ? fgets($this->tcpConnection) : fgetc($this->tcpConnection);
if (!empty($part)) {
if ($readString) {
return substr($part, 0, strpos($part, chr(0x03)) + 2);
}
return $part;
}
$timeDiff = time() - $startTime;
Expand Down
4 changes: 2 additions & 2 deletions src/Terminals/TerminalUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ public static function buildMessage($message)

public static function calculateLRC($buffer)
{
if (! empty($buffer)) {
if (!empty($buffer)) {
$length = strlen($buffer);
if ($buffer[$length - 1] != ControlCodes::ETX) {
$length --;
$length--;
}

$lrc = 0;
Expand Down
Loading

0 comments on commit 2df081f

Please sign in to comment.