Skip to content

Commit

Permalink
OctopusDeploy release: 13.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
securesubmit-buildmaster committed Nov 14, 2024
1 parent 9f99d3f commit fcaa1f2
Show file tree
Hide file tree
Showing 30 changed files with 669 additions and 194 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@

# Changelog

## Latest Version - v13.0.4 (11/06/24)
## Latest Version - v13.0.5 (11/14/24)
### Enhancements:
- [GP-API] - Add new mapping fields on digital wallet transaction response: masked_number_last4, brand, brand_reference
- [MITC UPA] - Add new commands: getAppInfo, getParam, setTimeZone,clearDataLake, reset, returnToIdle, getDeviceConfig,
print, scan, getDebugInfo, setDebugLevel, getDebugLevel, getSignatureFile, communicationCheck, logon,
findBatches, getBatchDetails, getBatchReport, displayMessage

## v13.0.4 (11/07/24)
### Enhancements:
- [Portico] Added 'GatewayTxnId' value to GatewayException message when available

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>13.0.4</releaseNumber>
<releaseNumber>13.0.5</releaseNumber>
</xml>
2 changes: 1 addition & 1 deletion src/Gateways/GpApiConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public function processBoardingUser(PayFacBuilder $builder): User
}
$response = $this->executeProcess($builder);

return GpApiMapping::mapMerchantsEndpointResponse($response, $builder->userReference);
return GpApiMapping::mapMerchantsEndpointResponse($response);
}

public function processPayFac(PayFacBuilder $builder)
Expand Down
245 changes: 134 additions & 111 deletions src/Mapping/GpApiMapping.php

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/Terminals/Abstractions/IDeviceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use GlobalPayments\Api\Terminals\Entities\PromptMessages;
use GlobalPayments\Api\Terminals\Entities\ScanData;
use GlobalPayments\Api\Terminals\Entities\UDData;
use GlobalPayments\Api\Terminals\Enums\BatchReportType;
use GlobalPayments\Api\Terminals\Enums\DeviceConfigType;
use GlobalPayments\Api\Terminals\Enums\DisplayOption;
use GlobalPayments\Api\Terminals\Enums\PromptType;
Expand Down Expand Up @@ -255,7 +256,7 @@ public function getLastResponse();

public function getSAFReport() : TerminalReportBuilder;
public function getBatchReport() : TerminalReportBuilder;
public function getBatchDetails(?string $batchId = null, bool $printReport = false) : ITerminalReport;
public function getBatchDetails(?string $batchId = null, bool $printReport = false, string|BatchReportType $reportType = null) : ITerminalReport;
public function findBatches() : TerminalReportBuilder;
public function getOpenTabDetails() : TerminalReportBuilder;
}
1 change: 1 addition & 0 deletions src/Terminals/Builders/TerminalSearchBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class TerminalSearchBuilder

public string $ecrId;
public string $reportOutput;
public ?string $reportType;
public string $batch;

public function __construct($reportBuilder)
Expand Down
3 changes: 2 additions & 1 deletion src/Terminals/DeviceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use GlobalPayments\Api\Terminals\Entities\PromptMessages;
use GlobalPayments\Api\Terminals\Entities\ScanData;
use GlobalPayments\Api\Terminals\Entities\UDData;
use GlobalPayments\Api\Terminals\Enums\BatchReportType;
use GlobalPayments\Api\Terminals\Enums\CurrencyType;
use GlobalPayments\Api\Terminals\Abstractions\IDeviceInterface;
use GlobalPayments\Api\Terminals\Enums\DeviceConfigType;
Expand Down Expand Up @@ -436,7 +437,7 @@ public function getBatchReport(): TerminalReportBuilder
);
}

public function getBatchDetails(?string $batchId = null,bool $printReport = false): ITerminalReport
public function getBatchDetails(?string $batchId = null,bool $printReport = false, string|BatchReportType $reportType = null): ITerminalReport
{
throw new UnsupportedTransactionException(
"This method is not supported by the currently configured device."
Expand Down
3 changes: 1 addition & 2 deletions src/Terminals/DeviceResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ abstract class DeviceResponse implements IDeviceResponse, IBatchCloseResponse, I
public $deviceResponseCode;
/** @var string */
public $deviceResponseText;
/** @var string */
public $referenceNumber;
public ?string $referenceNumber;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use GlobalPayments\Api\Entities\Enum;

class TransactionType extends Enum
class TransactionTypeResponse extends Enum
{
const UNKNOWN = '0';
const SALE = '1';
Expand Down
4 changes: 2 additions & 2 deletions src/Terminals/Diamond/Responses/DiamondCloudResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use GlobalPayments\Api\Terminals\Diamond\Entities\Enums\AuthorizationType;
use GlobalPayments\Api\Terminals\Diamond\Entities\Enums\CardSource;
use GlobalPayments\Api\Terminals\Diamond\Entities\Enums\TransactionResult;
use GlobalPayments\Api\Terminals\Diamond\Entities\Enums\TransactionType;
use GlobalPayments\Api\Terminals\Diamond\Entities\Enums\TransactionTypeResponse;
use GlobalPayments\Api\Terminals\TerminalResponse;
use GlobalPayments\Api\Utils\StringUtils;

Expand Down Expand Up @@ -196,7 +196,7 @@ public function __construct($rawResponse)
$this->transactionCurrency = $paymentDetails->transactionCurrency ?? null;
$this->transactionTitle = $paymentDetails->transactionTitle ?? null;
$this->transactionType = isset($paymentDetails->type) ?
TransactionType::getKey($paymentDetails->type) : null;
TransactionTypeResponse::getKey($paymentDetails->type) : null;
$this->emvCardTransactionCounter = $paymentDetails->ATC ?? null;
$this->emvCryptogram = $paymentDetails->AC ?? null;
$this->emvApplicationId = $paymentDetails->AID ?? null;
Expand Down
4 changes: 2 additions & 2 deletions src/Terminals/Entities/UDData.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class UDData
/** @var UDFileTypes Contains the parameters for the file to be loaded */
public string $fileType;

/** @var string Slot number of the data file */
public string $slotNum;
/** @var int Slot number of the data file */
public int $slotNum;

/** @var string Filename of the file to be stored in the device. Must include the file extension.
* Must not contain a file path.
Expand Down
11 changes: 11 additions & 0 deletions src/Terminals/Enums/BatchReportType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace GlobalPayments\Api\Terminals\Enums;

use GlobalPayments\Api\Entities\Enum;

class BatchReportType extends Enum
{
const DETAIL = "detail";
const SUMMARY = "summary";
}
4 changes: 2 additions & 2 deletions src/Terminals/Enums/DisplayOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

class DisplayOption extends Enum
{
const NO_SCREEN_CHANGE = '0';
const RETURN_TO_IDLE_SCREEN = '1';
const NO_SCREEN_CHANGE = 0;
const RETURN_TO_IDLE_SCREEN = 1;
}
1 change: 1 addition & 0 deletions src/Terminals/UPA/Entities/Enums/UpaSearchCriteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ class UpaSearchCriteria extends Enum
const ECR_ID = 'ecrId';
const BATCH = 'batch';
const REPORT_OUTPUT = 'reportOutput';
const REPORT_TYPE = 'reportType';
}
30 changes: 17 additions & 13 deletions src/Terminals/UPA/Responses/BatchList.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
namespace GlobalPayments\Api\Terminals\UPA\Responses;

use GlobalPayments\Api\Entities\Exceptions\GatewayException;
use GlobalPayments\Api\Entities\Exceptions\MessageException;
use GlobalPayments\Api\Terminals\Abstractions\IBatchCloseResponse;
use GlobalPayments\Api\Terminals\DeviceResponse;
use GlobalPayments\Api\Utils\ArrayUtils;

class BatchList extends DeviceResponse implements IBatchCloseResponse
class BatchList extends UpaResponseHandler implements IBatchCloseResponse
{
const INVALID_RESPONSE_FORMAT = "The response received is not in the proper format.";

public ?string $ecrId;

public array $batchIds = [];

/**
Expand All @@ -24,22 +23,27 @@ public function __construct($jsonResponse)
$this->parseResponse($jsonResponse);
}

protected function parseResponse($jsonResponse)
/**
* @throws GatewayException
* @throws MessageException
*/
protected function parseResponse($jsonResponse): void
{
if (empty($jsonResponse->data) || empty($jsonResponse->data->cmdResult)) {
parent::parseResponse(ArrayUtils::jsonToArray($jsonResponse));
$firstDataNode = $this->isGpApiResponse($jsonResponse) ? $jsonResponse->response : ($jsonResponse->data ?? null);
if (empty($firstDataNode) || empty($firstDataNode->cmdResult)) {
throw new GatewayException(self::INVALID_RESPONSE_FORMAT);
}
$firstDataNode = $jsonResponse->data;
$secondNode = $firstDataNode->data;
$cmdResult = $firstDataNode->cmdResult;

$this->status = $cmdResult->result ?? null;
$this->command = $firstDataNode->response;
$this->ecrId = $firstDataNode->ecrId ?? null;
if (empty($this->status) || $this->status !== 'Success') {
$this->deviceResponseText = sprintf("Error: %s - %s", $cmdResult->errorCode, $cmdResult->errorMessage);
return;
}
$batches = $firstDataNode->data->batchesAvail ?? null;
$this->ecrId = $firstDataNode->EcrId ?? null;
$this->referenceNumber = $jsonResponse->id ?? null;
$this->requestId = $firstDataNode->requestId ?? null;
$this->deviceResponseCode = in_array($this->status, ['Success', 'COMPLETE']) ? '00' : null;
$batches = $secondNode->batchesAvail ?? null;
foreach ($batches as $batch) {
$this->batchIds[] = $batch->batchId;
}
Expand Down
9 changes: 7 additions & 2 deletions src/Terminals/UPA/Responses/BatchReportResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace GlobalPayments\Api\Terminals\UPA\Responses;

use GlobalPayments\Api\Entities\Card;
use GlobalPayments\Api\Entities\Exceptions\GatewayException;
use GlobalPayments\Api\Entities\Reporting\TransactionList;
use GlobalPayments\Api\Entities\Reporting\TransactionSummary;
Expand All @@ -28,7 +29,7 @@ protected function parseJsonResponse($jsonResponse): void
{
parent::parseJsonResponse($jsonResponse);
$firstDataNode = $this->isGpApiResponse($jsonResponse) ? $jsonResponse->response : $jsonResponse->data;
$this->ecrId = $firstDataNode->ecrId ?? null;
$this->ecrId = $firstDataNode->EcrId ?? null;
$secondDataNode = $firstDataNode->data ?? null;
$this->merchantName = $secondDataNode->merchantName ?? null;
$this->multipleMessage = $secondDataNode->multipleMessage ?? null;
Expand Down Expand Up @@ -69,7 +70,10 @@ private function mapTransactionDetails(BatchRecordResponse &$batchRecordResponse
$transactionSummary->authorizedAmount = $transaction->authorizedAmount;
$transactionSummary->cardEntryMethod = $transaction->cardAcquisition ?? null;
$transactionSummary->cardType = $transaction->cardType;
$transactionSummary->maskedCardNumber = $transaction->maskedPAN ?? null;
$transactionSummary->maskedCardNumber = $transaction->maskedPan ?? null;
$transactionSummary->cardDetails = new Card();
$transactionSummary->cardDetails->brand = $transaction->cardType ?? null;
$transactionSummary->cardDetails->maskedCardNumber = $transaction->maskedPan ?? null;
$transactionSummary->referenceNumber = $transaction->referenceNumber;
$transactionSummary->issuerTransactionId = $transaction->gatewayTxnId;
$transactionSummary->clerkId = $transaction->clerkId ?? null;
Expand All @@ -81,6 +85,7 @@ private function mapTransactionDetails(BatchRecordResponse &$batchRecordResponse
$transactionSummary->gratuityAmount = $transaction->tipAmount ?? null;
$transactionSummary->settlementAmount = $transaction->settleAmount ?? null;
$transactionSummary->taxAmount = $transaction->taxAmount ?? null;
$transactionSummary->cardSwiped = $transaction->cardSwiped ?? null;
$batchRecordResponse->transactionDetails->add($transactionSummary);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Terminals/UPA/Responses/SignatureResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public function __construct($jsonResponse)
public function parseResponse($jsonResponse): void
{
parent::parseResponse($jsonResponse);

if (empty($jsonResponse['data']['data'])) {
$firstDataNode = $this->isGpApiResponse($jsonResponse) ? $jsonResponse['response'] : $jsonResponse['data'];
if (empty($firstDataNode['data'])) {
throw new MessageException(self::INVALID_RESPONSE_FORMAT);
}
switch ($this->command) {
case UpaMessageId::GET_SIGNATURE:
$this->signatureData = $jsonResponse['data']['data']['signatureData'] ?? null;
$this->signatureData = $firstDataNode['data']['signatureData'] ?? null;
break;
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/Terminals/UPA/Responses/TerminalSetupResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ public function __construct($jsonResponse)
public function parseResponse($jsonResponse): void
{
parent::parseResponse($jsonResponse);
if (empty($jsonResponse['data']['data'])) {
$firstDataNode = $this->isGpApiResponse($jsonResponse) ? $jsonResponse['response'] : $jsonResponse['data'];
if (empty($firstDataNode['data'])) {
return;
}
$secondNode = $jsonResponse['data']['data'];
$secondNode = $firstDataNode['data'];
switch ($this->command) {
case UpaMessageId::GET_CONFIG_CONTENTS:
$this->configType = $secondNode['configType'] ?? '';
Expand Down
1 change: 0 additions & 1 deletion src/Terminals/UPA/Responses/TransactionResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace GlobalPayments\Api\Terminals\UPA\Responses;

use GlobalPayments\Api\Entities\Enums\GatewayProvider;
use GlobalPayments\Api\Entities\Exceptions\MessageException;
use GlobalPayments\Api\Terminals\Abstractions\IBatchCloseResponse;
use GlobalPayments\Api\Terminals\Entities\{PANDetails, ThreeDesDukpt,TrackData};
Expand Down
2 changes: 0 additions & 2 deletions src/Terminals/UPA/Responses/UpaBatchReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
class UpaBatchReport extends UpaResponseHandler
{

public $deviceResponseCode;

public $merchantName;

public $batchSummary;
Expand Down
18 changes: 7 additions & 11 deletions src/Terminals/UPA/Responses/UpaResponseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use GlobalPayments\Api\Entities\Exceptions\GatewayException;
use GlobalPayments\Api\Entities\Exceptions\MessageException;
use GlobalPayments\Api\Terminals\TerminalResponse;
use GlobalPayments\Api\Utils\ArrayUtils;

class UpaResponseHandler extends TerminalResponse
{
Expand Down Expand Up @@ -47,25 +48,20 @@ protected function parseResponse(array $response): void
$this->ecrId = $firstNodeData['EcrId'] ?? '';
}

protected function isGpApiResponse($jsonResponse) : bool
{
if (is_object($jsonResponse)) {
$jsonResponse = $this->jsonToArray($jsonResponse);
}
return !empty($jsonResponse['provider']) && $jsonResponse['provider'] === GatewayProvider::GP_API;
}

/**
* @throws MessageException
*/
protected function parseJsonResponse($response): void
{
$response = $this->jsonToArray($response);
$response = ArrayUtils::jsonToArray($response);
$this->parseResponse($response);
}

private function jsonToArray(object $response) : array
protected function isGpApiResponse($jsonResponse) : bool
{
return json_decode(json_encode($response), true);
if (is_object($jsonResponse)) {
$jsonResponse = ArrayUtils::jsonToArray($jsonResponse);
}
return !empty($jsonResponse['provider']) && $jsonResponse['provider'] === GatewayProvider::GP_API;
}
}
27 changes: 20 additions & 7 deletions src/Terminals/UPA/SubGroups/RequestParamFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

namespace GlobalPayments\Api\Terminals\UPA\SubGroups;

use GlobalPayments\Api\Entities\Enums\TransactionModifier;
use GlobalPayments\Api\Entities\Enums\TransactionType;
use GlobalPayments\Api\PaymentMethods\CreditCardData;
use GlobalPayments\Api\Terminals\Abstractions\IRequestSubGroup;
use GlobalPayments\Api\Entities\Enums\StoredCredentialInitiator;
use GlobalPayments\Api\Terminals\Builders\TerminalBuilder;
use GlobalPayments\Api\Terminals\Diamond\Entities\Enums\TransactionType;

class RequestParamFields implements IRequestSubGroup
{
Expand Down Expand Up @@ -65,10 +66,21 @@ public function setParams(TerminalBuilder $builder)
case TransactionType::VOID:
$this->clerkId = $builder->clerkId ?? null;
return;
case TransactionType::SALE:
case TransactionType::REFUND:
case TransactionType::VERIFY:
case TransactionType::AUTH:
case TransactionType::CAPTURE:
$this->clerkId = $builder->clerkId;
break;
case TransactionType::EDIT:
if ($builder->transactionModifier !== TransactionModifier::UPDATE_LODGING_DETAILS) {
$this->clerkId = $builder->clerkId;
}
break;
default:
break;
}
$this->clerkId = $builder->clerkId ?? null;

if (!empty($builder->cardOnFileIndicator)) {
$this->cardOnFileIndicator = ($builder->cardOnFileIndicator === StoredCredentialInitiator::CARDHOLDER)
Expand All @@ -80,15 +92,16 @@ public function setParams(TerminalBuilder $builder)
}

if (!empty($builder->requestMultiUseToken)) {
$this->tokenRequest = $builder->requestMultiUseToken;
$this->tokenRequest = $builder->requestMultiUseToken === true ? 1 : 0;
}

if ($builder->paymentMethod != null &&
$builder->paymentMethod instanceof CreditCardData &&
!empty($builder->paymentMethod->token)
) {
if (
$builder->paymentMethod instanceof CreditCardData &&
!empty($builder->paymentMethod->token)
) {
$this->tokenValue = $builder->paymentMethod->token;
}

if (isset($builder->shippingDate) && !empty($builder->invoiceNumber)) {
$this->directMktInvoiceNbr = $builder->invoiceNumber;
$this->directMktShipMonth = $builder->shippingDate->format('m');
Expand Down
Loading

0 comments on commit fcaa1f2

Please sign in to comment.