Skip to content

Commit

Permalink
OctopusDeploy release: 11.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
securesubmit-buildmaster committed Nov 2, 2023
1 parent 9599204 commit 456db2f
Show file tree
Hide file tree
Showing 12 changed files with 194 additions and 97 deletions.
156 changes: 81 additions & 75 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion metadata.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<xml>
<releaseNumber>11.0.1</releaseNumber>
<releaseNumber>11.0.2</releaseNumber>
</xml>
2 changes: 2 additions & 0 deletions src/Entities/Enums/Region.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ class Region extends Enum
const NZ = 'NZ';
const UK = 'UK';
const EU = 'EU';
const MX = 'MX';
const CL = 'CL';
}
3 changes: 2 additions & 1 deletion src/Entities/Enums/ServiceEndpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class ServiceEndpoints extends Enum
const TRANSACTION_API_TEST = "https://api.pit.paygateway.com/transactions/";
const TRANSACTION_API_PROD = "https://api.paygateway.com/transactions";
const DIAMOND_CLOUD_TEST = "https://qr-cert.simpletabcloud.com/tomcat/command";
const DIAMOND_CLOUD_PROD = "";
const DIAMOND_CLOUD_PROD = "https://qr.simpletabcloud.com/tomcat/command";
const DIAMOND_CLOUD_PROD_EU = "https://qreu.simpletabcloud.com/tomcat/command";
const MEET_IN_THE_CLOUD_PROD = "https://api.paygateway.com";
const MEET_IN_THE_CLOUD_TEST = "https://api.pit.paygateway.com";
}
10 changes: 2 additions & 8 deletions src/Terminals/ConnectionConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ public function configureContainer(ConfiguredServices $services)
public function validate()
{
if ($this->connectionMode === ConnectionModes::MEET_IN_THE_CLOUD) {
if (empty($this->meetInTheCloudConfig)) {
if (empty($this->meetInTheCloudConfig) && empty($this->gatewayConfig)) {
throw new ConfigurationException(
"meetInTheCloudConfig object is required for this connection method"
"meetInTheCloudConfig or gatewayConfig object is required for this connection method"
);
}

Expand Down Expand Up @@ -152,12 +152,6 @@ public function validate()
);
}

if ($this->connectionMode == ConnectionModes::MIC) {
if (empty($this->gatewayConfig)) {
throw new ConfigurationException('Gateway config is required for the Meet In the Cloud Service');
}
}

if ($this->connectionMode == ConnectionModes::DIAMOND_CLOUD) {
if (empty($this->isvID) || empty($this->secretKey)) {
throw new ConfigurationException('ISV ID and secretKey is required for ' . ConnectionModes::DIAMOND_CLOUD);
Expand Down
10 changes: 4 additions & 6 deletions src/Terminals/Diamond/DiamondController.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,11 @@ public function configureInterface() : IDeviceInterface

public function configureConnector(): IDeviceCommInterface
{
switch ($this->settings->getConnectionMode())
{
case ConnectionModes::DIAMOND_CLOUD:
return new DiamondHttpInterface($this->settings);
default:
throw new NotImplementedException();
if ($this->settings->getConnectionMode() !== ConnectionModes::DIAMOND_CLOUD) {
throw new NotImplementedException();
}

return new DiamondHttpInterface($this->settings);
}

private function doTransaction(IDeviceMessage $request)
Expand Down
23 changes: 22 additions & 1 deletion src/Terminals/DiamondCloudConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
use GlobalPayments\Api\Entities\Enums\Environment;
use GlobalPayments\Api\Entities\Enums\Region;
use GlobalPayments\Api\Entities\Enums\ServiceEndpoints;
use GlobalPayments\Api\Entities\Exceptions\ConfigurationException;
use GlobalPayments\Api\Terminals\Enums\ConnectionModes;

class DiamondCloudConfig extends ConnectionConfig
{
Expand All @@ -15,13 +17,32 @@ class DiamondCloudConfig extends ConnectionConfig
/** @var Region $country */
public string $region = Region::US;
public string $posID;
private array $supportedRegions = [
Region::EU,
Region::US,
Region::MX,
Region::CL
];

public function configureContainer(ConfiguredServices $services)
{
if (empty($this->serviceUrl)) {
$this->serviceUrl = (($this->environment === Environment::PRODUCTION) ?
ServiceEndpoints::DIAMOND_CLOUD_PROD : ServiceEndpoints::DIAMOND_CLOUD_TEST);
($this->region == Region::EU ?
ServiceEndpoints::DIAMOND_CLOUD_PROD_EU : ServiceEndpoints::DIAMOND_CLOUD_PROD
) : ServiceEndpoints::DIAMOND_CLOUD_TEST);
}
parent::configureContainer($services);
}

public function validate()
{
parent::validate();
if (empty($this->isvID) || empty($this->secretKey)) {
throw new ConfigurationException('ISV ID and secretKey is required for ' . ConnectionModes::DIAMOND_CLOUD);
}
if (!in_array($this->region, $this->supportedRegions)) {
throw new ConfigurationException(sprintf('Region %s is not supported!'), $this->region);
}
}
}
1 change: 0 additions & 1 deletion src/Terminals/Enums/ConnectionModes.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ class ConnectionModes extends Enum
const HTTP = 'HTTP';
const HTTPS = 'HTTPS';
const MEET_IN_THE_CLOUD = 'MEET_IN_THE_CLOUD';
const MIC = 'MIC';
const DIAMOND_CLOUD = 'DIAMOND_CLOUD';
}
2 changes: 1 addition & 1 deletion src/Terminals/PAX/Responses/PaxBaseResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function parseResponse($messageReader)
public function checkResponse($acceptedCodes = null)
{
if ($acceptedCodes === null) {
$acceptedCodes = ["000000"];
$acceptedCodes = ["000000", "000100"];
}

if (!empty($this->deviceResponseText)) {
Expand Down
7 changes: 5 additions & 2 deletions src/Terminals/UPA/UpaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use GlobalPayments\Api\Entities\Exceptions\ConfigurationException;
use GlobalPayments\Api\Entities\Exceptions\GatewayException;
use GlobalPayments\Api\Entities\Exceptions\NotImplementedException;
use GlobalPayments\Api\ServiceConfigs\Gateways\GpApiConfig;
use GlobalPayments\Api\Terminals\Abstractions\IDeviceCommInterface;
use GlobalPayments\Api\Terminals\Abstractions\IDeviceMessage;
use GlobalPayments\Api\Terminals\Abstractions\ITerminalReport;
Expand Down Expand Up @@ -190,8 +191,10 @@ public function configureConnector(): IDeviceCommInterface
case ConnectionModes::HTTP:
case ConnectionModes::SERIAL:
case ConnectionModes::SSL_TCP:
case ConnectionModes::MIC:
return new UpaMicInterface($this->settings);
case ConnectionModes::MEET_IN_THE_CLOUD:
if ($this->settings->getGatewayConfig() instanceof GpApiConfig) {
return new UpaMicInterface($this->settings);
}
default:
throw new NotImplementedException();
}
Expand Down
64 changes: 64 additions & 0 deletions test/Integration/Gateways/Terminals/PAX/PaxExceptionTests.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

namespace GlobalPayments\Api\Tests\Integration\Gateways\Terminals\PAX;

use GlobalPayments\Api\Services\DeviceService;
use GlobalPayments\Api\Terminals\ConnectionConfig;
use GlobalPayments\Api\Entities\Enums\PaymentMethodType;
use GlobalPayments\Api\Terminals\Enums\{ConnectionModes, DeviceType};
use GlobalPayments\Api\Tests\Integration\Gateways\Terminals\RequestIdProvider;
use GlobalPayments\Api\Tests\Integration\Gateways\Terminals\LogManagement;
use GlobalPayments\Api\Terminals\Enums\CurrencyType;
use PHPUnit\Framework\ExpectationFailedException;
use PHPUnit\Framework\TestCase;
use SebastianBergmann\RecursionContext\InvalidArgumentException;

class PaxExceptionTests extends TestCase {
private $device;

public function setup(): void
{
$this->device = DeviceService::create($this->getConfig());
}

public function tearDown(): void
{
sleep(3);
}

protected function getConfig()
{
$config = new ConnectionConfig();
$config->ipAddress = '192.168.1.10';
$config->port = '10009';
$config->deviceType = DeviceType::PAX_S300;
$config->connectionMode = ConnectionModes::TCP_IP;
$config->timeout = 10;
$config->requestIdProvider = new RequestIdProvider();
$config->logManagementProvider = new LogManagement();

return $config;
}

public function testCreditSaleExpiredCard()
{
$response = $this->device->sale(10.32)
->withAllowDuplicates(1)
->execute();

$this->assertNotNull($response);
$this->assertEquals('54', $response->responseCode);
}

public function testDebitSaleExpiredCard()
{
$response = $this->device->sale(10.32)
->withPaymentMethodType(PaymentMethodType::DEBIT)
->withAllowDuplicates(1)
->execute();

$this->assertNotNull($response);
$this->assertEquals('54', $response->responseCode);
}

}
11 changes: 10 additions & 1 deletion test/Integration/Gateways/Terminals/UPA/UpaMicTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function getConfig(): ConnectionConfig
{
$config = new ConnectionConfig();
$config->deviceType = DeviceType::UPA_DEVICE;
$config->connectionMode = ConnectionModes::MIC;
$config->connectionMode = ConnectionModes::MEET_IN_THE_CLOUD;
BaseGpApiTestConfig::$appId = BaseGpApiTestConfig::APP_ID; #gitleaks:allow
BaseGpApiTestConfig::$appKey = BaseGpApiTestConfig::APP_KEY; #gitleaks:allow
$gpApiConfig = BaseGpApiTestConfig::gpApiSetupConfig(Channel::CardPresent);
Expand Down Expand Up @@ -149,7 +149,16 @@ public function testCreditVerify()

public function testCreditVoid()
{
$response = $this->device->sale(10)
->execute();

$this->assertNotNull($response);
$this->assertEquals('00', $response->deviceResponseCode);
$this->assertEquals('INITIATED', $response->deviceResponseText);
$this->assertNotNull($response->transactionId);

$response = $this->device->void()
->withTransactionId($response->transactionId)
->execute();

$this->assertNotNull($response);
Expand Down

0 comments on commit 456db2f

Please sign in to comment.