Skip to content

Commit

Permalink
OctopusDeploy release: 12.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
securesubmit-buildmaster committed Aug 15, 2024
1 parent ebd075e commit 9240077
Show file tree
Hide file tree
Showing 9 changed files with 291 additions and 103 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@

# Changelog

## Latest Version - v12.0.8 (07/23/24)
## Latest Version - v12.0.9 (08/14/24)
### Enhancements:
- [PAX] Portico - Added support for HSA/FSA
- [MEET-IN-THE-CLOUD][UPA] - Add new mapping response fields for "/devices" endpoint

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

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.8</releaseNumber>
<releaseNumber>12.0.9</releaseNumber>
</xml>
4 changes: 4 additions & 0 deletions src/Terminals/Builders/TerminalAuthBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class TerminalAuthBuilder extends TerminalBuilder

public $tokenValue;

/**
*
* @var AutoSubstantiation
*/
public $autoSubstantiation;

public ?string $terminalRefNumber;
Expand Down
5 changes: 5 additions & 0 deletions src/Terminals/PAX/PaxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ public function processTransaction(TerminalAuthBuilder $builder) : TerminalRespo

$trace->referenceNumber = $requestId;
$trace->invoiceNumber = $builder->invoiceNumber;

if (!empty($builder->clientTransactionId)) {
$trace->clientTransactionId = $builder->clientTransactionId;
}
Expand Down Expand Up @@ -214,6 +215,7 @@ public function processTransaction(TerminalAuthBuilder $builder) : TerminalRespo
$avs->address = $builder->address->streetAddress1;
$avs->zipCode = $builder->address->postalCode;
}

$commercial->customerCode = $builder->customerCode;
$commercial->poNumber = $builder->poNumber;
$commercial->taxExempt = $builder->taxExempt;
Expand All @@ -230,6 +232,9 @@ public function processTransaction(TerminalAuthBuilder $builder) : TerminalRespo
if (empty($builder->gratuity)) {
$extData->details[PaxExtData::TIP_REQUEST] = 1;
}

if (!empty($builder->autoSubstantiation))
$extData->details[PaxExtData::PASS_THROUGH_DATA] = $builder->autoSubstantiation;

$transactionType = $this->mapTransactionType($builder->transactionType, $builder->requestMultiUseToken);
switch ($builder->paymentMethodType) {
Expand Down
85 changes: 82 additions & 3 deletions src/Terminals/PAX/SubGroups/ExtDataSubGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,101 @@

namespace GlobalPayments\Api\Terminals\PAX\SubGroups;

use GlobalPayments\Api\Entities\AutoSubstantiation;
use GlobalPayments\Api\Terminals\Abstractions\IRequestSubGroup;
use GlobalPayments\Api\Terminals\Enums\ControlCodes;

class ExtDataSubGroup implements IRequestSubGroup
{
/**
*
* @var array
*/
public array $details;

public $details;

public function getElementString()
/**
*
* @return string
*/
public function getElementString(): string
{
$message = '';
if (!empty($this->details)) {
foreach ($this->details as $key => $val) {
if (is_a($val, 'GlobalPayments\Api\Entities\AutoSubstantiation')) {
$message .= sprintf(
"%s=%s",
$key,
$this->autoSubHelper($val)
);
continue;
}
$message .= sprintf("%s=%s%s", $key, $val, chr(ControlCodes::US));
}
}
return rtrim($message, chr(ControlCodes::US));
}

/**
*
* @param AutoSubstantiation $info
* @return string
*/
private function autoSubHelper(AutoSubstantiation $info): string
{
$string = sprintf("%s%s", 'FSA', chr(ControlCodes::COLON));
$string .= sprintf(
"%s%s%s|",
'HealthCare',
chr(ControlCodes::COMMA),
$info->amounts["TOTAL_HEALTHCARE_AMT"] * 100
);

if ($info->amounts["SUBTOTAL_PRESCRIPTION_AMT"] > 0) {
$string .= sprintf(
"%s%s%s|",
'Rx',
chr(ControlCodes::COMMA),
$info->amounts["SUBTOTAL_PRESCRIPTION_AMT"] * 100
);
}

if ($info->amounts["SUBTOTAL_VISION__OPTICAL_AMT"] > 0) {
$string .= sprintf(
"%s%s%s|",
'Vision',
chr(ControlCodes::COMMA),
$info->amounts["SUBTOTAL_VISION__OPTICAL_AMT"] * 100
);
}

if ($info->amounts["SUBTOTAL_DENTAL_AMT"] > 0) {
$string .= sprintf(
"%s%s%s|",
'Dental',
chr(ControlCodes::COMMA),
$info->amounts["SUBTOTAL_DENTAL_AMT"] * 100
);
}

if ($info->amounts["SUBTOTAL_CLINIC_OR_OTHER_AMT"] > 0) {
$string .= sprintf(
"%s%s%s|",
'Clinical',
chr(ControlCodes::COMMA),
$info->amounts["SUBTOTAL_CLINIC_OR_OTHER_AMT"] * 100
);
}

if ($info->amounts["SUBTOTAL_COPAY_AMT"] > 0) {
$string .= sprintf(
"%s%s%s|",
'CoPay',
chr(ControlCodes::COMMA),
$info->amounts["SUBTOTAL_COPAY_AMT"] * 100
);
}

return $string;
}
}
84 changes: 64 additions & 20 deletions src/Terminals/UPA/Responses/TransactionResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,52 @@

class TransactionResponse extends UpaResponseHandler implements IBatchCloseResponse
{
public string $responseId;

public string $responseDateTime;

public string $gatewayResponseCode;

public string $gatewayResponseMessage;

public string $avsResultCode;

public string $avsResultText;
public float $totalAmount;
public float $authorizedAmount;
public string $CpcInd;

public string $cardType;
public string $cardGroup;
public string $fallback;

public string $qpsQualified;
public string $storeAndForward;

public string $invoiceNumber;
public string $merchantId;
public string $cardBrandTransId;
public string $batchId;
public string $batchSeqNbr;
public string $pinVerified;
public string $applicationPAN;
public string $transactionSequenceCounter;
public string $additionalTerminalCapabilities;
public string $unpredictableNumber;
public string $applicationTransactionCounter;
public string $terminalType;
public string $terminalCapabilities;
public string $terminalCountryCode;
public string $issuerApplicationData;
public string $otherAmount;
public string $amountAuthorized;
public string $transactionTSI;
public string $transactionDate;
public string $transactionCurrencyCode;
public string $dedicatedDF;
public string $applicationAIP;
public string $applicationIdentifier;

public function __construct($jsonResponse)
{
$this->parseResponse($jsonResponse);
Expand All @@ -15,31 +61,27 @@ public function __construct($jsonResponse)
public function parseResponse($jsonResponse)
{
if ($this->isGpApiResponse($jsonResponse)) {
if (
!empty($jsonResponse['action']['result_code']) &&
$jsonResponse['action']['result_code'] === 'SUCCESS'
) {
$this->deviceResponseCode = '00';
}

$this->status = $jsonResponse['status'] ?? null;
$this->transactionId = $jsonResponse['id'] ?? null;
$this->deviceResponseText = $jsonResponse['status'] ?? null;
$secondDataNode = $jsonResponse['response']['data'] ?? null;
$cmdResult = $jsonResponse['response']['cmdResult'] ?? null;
} else {
if (!empty($jsonResponse['data']['cmdResult'])) {
$this->checkResponse($jsonResponse['data']['cmdResult']);

if ($jsonResponse['data']['cmdResult']['result'] === 'Success') {
$this->deviceResponseCode = '00';
}
}
$cmdResult = $jsonResponse['data']['cmdResult'] ?? null;
$secondDataNode = $jsonResponse['data']['data'] ?? null;
}

if (!empty($jsonResponse['data']['data'])) {
$responseMapping = $this->getResponseMapping();
foreach ($jsonResponse['data']['data'] as $responseData) {
if (is_array($responseData)) {
foreach ($responseData as $key => $value) {
$propertyName = !empty($responseMapping[$key]) ? $responseMapping[$key] : $key;
if (!empty($cmdResult)) {
$this->checkResponse($cmdResult);
$this->deviceResponseCode = ($cmdResult['result'] === 'Success' ? '00' : null);
}
if (!empty($secondDataNode)) {
$responseMapping = $this->getResponseMapping();
foreach ($secondDataNode as $responseData) {
if (is_array($responseData)) {
foreach ($responseData as $key => $value) {
$propertyName = !empty($responseMapping[$key]) ? $responseMapping[$key] : $key;
if (property_exists($this, $propertyName)) {
$this->{$propertyName} = $value;
}
}
Expand Down Expand Up @@ -94,6 +136,7 @@ public function getResponseMapping()
'taxDue' => 'taxDue',
'tipDue' => 'tipDue',
'cardBrandTransId' => 'cardBrandTransId',
'batchSeqNbr' => 'batchSeqNbr',

//payment
'cardHolderName' => 'cardHolderName',
Expand All @@ -108,6 +151,7 @@ public function getResponseMapping()
'storeAndForward' => 'storeAndForward',
'clerkId' => 'clerkId',
'invoiceNbr' => 'invoiceNumber',
'expiryDate' => 'expirationDate',

//EMV
'4F' => 'applicationIdentifier',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1475,6 +1475,8 @@ public function test038FraudPreventionReturn()

/// BALANCE INQUIRY



public function test037BalanceInquiryGsb()
{
if (false === $this->usePrepaid) {
Expand Down
41 changes: 37 additions & 4 deletions test/Integration/Gateways/Terminals/PAX/PaxCreditTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace GlobalPayments\Api\Tests\Integration\Gateways\Terminals\PAX;

use GlobalPayments\Api\Entities\Address;
use GlobalPayments\Api\Entities\AutoSubstantiation;
use GlobalPayments\Api\PaymentMethods\CreditCardData;
use GlobalPayments\Api\Services\DeviceService;
use GlobalPayments\Api\Terminals\ConnectionConfig;
Expand All @@ -15,10 +16,6 @@

class PaxCreditTests extends TestCase
{
/**
*
* @var PaxInterface
*/
private $device;
protected $card;
protected $address;
Expand Down Expand Up @@ -470,4 +467,40 @@ public function testTipNoPropmpt() : void
$this->assertNotNull($response);
$this->assertEquals("00", $response->responseCode);
}

/**
*
* @return void
* @throws InvalidArgumentException
* @throws ExpectationFailedException
*/
public function testAutoSubstantiation(): void
{
// Test card: 4393-4212-3456-1236
// Exp Date: 12-29

$address = new Address();
$address->streetAddress1 = '123 Main St.';
$address->postalCode = '12345';

$card = new CreditCardData();
$card->number = "4393421234561236";
$card->expMonth = "12";
$card->expYear = "29";
$card->cvn = 123;

$autosubstantiation = new AutoSubstantiation();
$autosubstantiation->setDentalSubTotal(50);
$autosubstantiation->setVisionSubTotal(10.75);

$response = $this->device->sale(60.75)
->withPaymentMethod($card)
->withAddress($address)
->withAutoSubstantiation($autosubstantiation)
->withAllowDuplicates(true)
->execute();

$this->assertNotNull($response);
$this->assertEquals("60.75", $response->transactionAmount);
}
}
Loading

0 comments on commit 9240077

Please sign in to comment.