Skip to content

Commit

Permalink
OctopusDeploy release: 6.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
securesubmit-buildmaster committed Dec 6, 2022
1 parent 73983e3 commit 5a8f97a
Show file tree
Hide file tree
Showing 11 changed files with 288 additions and 224 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

## Latest version
#### Enhancements:
- PAX: Adding tip after the Sale
- Portico: APPLE PAY / GOOGLE PAY fix for token format

## v6.0.2 (11/17/2022)
#### Enhancements:
- GP-API: Onboard merchants feature
- GP-API: Decoupled Authentication

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.0.2</releaseNumber>
<releaseNumber>6.0.3</releaseNumber>
</xml>
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

namespace GlobalPayments\Api\Entities\Enums;

use GlobalPayments\Api\Entities\Enum;

class Secure3dPaymentDataSource extends Enum
class PaymentDataSourceType extends Enum
{
const AMEX_3DSECURE = 'AMEX 3DSecure';
const APPLEPAY = 'ApplePay';
Expand Down
4 changes: 2 additions & 2 deletions src/Gateways/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected function sendRequest(

$headers = [];
foreach ($this->headers as $key => $value) {
$headers[] = $key . ': '. $value;
$headers[] = $key . ': ' . $value;
}

if (isset($this->requestLogger)) {
Expand All @@ -118,7 +118,7 @@ protected function sendRequest(
if (!empty($this->webProxy)) {
curl_setopt($request, CURLOPT_PROXY, $this->webProxy->uri);
if (!empty($this->webProxy->username) && !empty($this->webProxy->password)) {
curl_setopt($request, CURLOPT_PROXYUSERPWD, $this->webProxy->username . ':' , $this->webProxy->password);
curl_setopt($request, CURLOPT_PROXYUSERPWD, $this->webProxy->username . ':', $this->webProxy->password);
}
}

Expand Down
122 changes: 72 additions & 50 deletions src/Gateways/PorticoConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,52 @@

use DOMDocument;
use DOMElement;
use GlobalPayments\Api\Builders\AuthorizationBuilder;
use GlobalPayments\Api\Builders\BaseBuilder;
use GlobalPayments\Api\Builders\ManagementBuilder;
use GlobalPayments\Api\Builders\ReportBuilder;
use GlobalPayments\Api\Builders\TransactionReportBuilder;
use GlobalPayments\Api\Entities\BatchSummary;
use GlobalPayments\Api\Entities\Transaction;
use GlobalPayments\Api\Entities\Enums\AccountType;
use GlobalPayments\Api\Entities\Address;
use GlobalPayments\Api\Entities\Enums\AliasAction;
use GlobalPayments\Api\Entities\Enums\CheckType;
use GlobalPayments\Api\Entities\Enums\EntryMethod;
use GlobalPayments\Api\Entities\Enums\MobilePaymentMethodType;
use GlobalPayments\Api\Entities\Enums\PaymentMethodType;
use GlobalPayments\Api\Entities\Enums\Secure3dPaymentDataSource;
use GlobalPayments\Api\Entities\Enums\TaxType;
use GlobalPayments\Api\Entities\Enums\TransactionModifier;
use GlobalPayments\Api\Entities\Enums\TransactionType;
use GlobalPayments\Api\Entities\Exceptions\GatewayException;
use GlobalPayments\Api\Entities\Exceptions\UnsupportedTransactionException;
use GlobalPayments\Api\Entities\Reporting\CheckData;
use GlobalPayments\Api\PaymentMethods\ECheck;
use GlobalPayments\Api\PaymentMethods\GiftCard;
use GlobalPayments\Api\PaymentMethods\Interfaces\IBalanceable;
use GlobalPayments\Api\PaymentMethods\Interfaces\ICardData;
use GlobalPayments\Api\PaymentMethods\Interfaces\IEncryptable;
use GlobalPayments\Api\PaymentMethods\Interfaces\IPaymentMethod;
use GlobalPayments\Api\PaymentMethods\Interfaces\IPinProtected;
use GlobalPayments\Api\PaymentMethods\Interfaces\ITokenizable;
use GlobalPayments\Api\PaymentMethods\Interfaces\ITrackData;
use GlobalPayments\Api\PaymentMethods\RecurringPaymentMethod;
use GlobalPayments\Api\PaymentMethods\TransactionReference;
use GlobalPayments\Api\Entities\Enums\ReportType;
use GlobalPayments\Api\Entities\Reporting\TransactionSummary;
use GlobalPayments\Api\Entities\Enums\StoredCredentialInitiator;
use GlobalPayments\Api\Entities\Exceptions\BuilderException;
use GlobalPayments\Api\Builders\{
AuthorizationBuilder,
BaseBuilder,
ManagementBuilder,
ReportBuilder,
TransactionReportBuilder
};
use GlobalPayments\Api\Entities\{BatchSummary, Transaction, Address, LodgingData};
use GlobalPayments\Api\Entities\Enums\{
AccountType,
AliasAction,
CheckType,
EntryMethod,
MobilePaymentMethodType,
PaymentMethodType,
PaymentDataSourceType,
ReportType,
StoredCredentialInitiator,
TaxType,
TransactionModifier,
TransactionType
};
use GlobalPayments\Api\Entities\Exceptions\{
BuilderException,
GatewayException,
NotImplementedException,
UnsupportedTransactionException
};
use GlobalPayments\Api\Entities\Reporting\{
AltPaymentData,
AltPaymentProcessorInfo,
CheckData,
TransactionSummary
};
use GlobalPayments\Api\PaymentMethods\{CreditCardData, ECheck, GiftCard};
use GlobalPayments\Api\PaymentMethods\Interfaces\{
IBalanceable,
ICardData,
IEncryptable,
IPaymentMethod,
IPinProtected,
ITokenizable,
ITrackData
};
use GlobalPayments\Api\PaymentMethods\{RecurringPaymentMethod, TransactionReference};
use GlobalPayments\Api\Entities\PayFac\PayFacResponseData;
use GlobalPayments\Api\Entities\LodgingData;
use GlobalPayments\Api\Entities\Reporting\AltPaymentData;
use GlobalPayments\Api\Entities\Reporting\AltPaymentProcessorInfo;
use GlobalPayments\Api\Entities\Exceptions\NotImplementedException;
use GlobalPayments\Api\PaymentMethods\CreditCardData;

class PorticoConnector extends XmlGateway implements IPaymentGateway
{
Expand Down Expand Up @@ -2323,8 +2327,7 @@ private function hydrateWalletData(DOMDocument $xml, BaseBuilder $builder, $bloc
if (
$builder->paymentMethod->mobileType == MobilePaymentMethodType::APPLEPAY
|| $builder->paymentMethod->mobileType == MobilePaymentMethodType::GOOGLEPAY
&& !empty($builder->paymentMethod->threeDSecure->paymentDataSource)
&& $this->isAppleOrGooglePay($builder->paymentMethod->threeDSecure->paymentDataSource)
&& $this->isAppleOrGooglePay($builder->paymentMethod->paymentSource)
) {
$walletData = $xml->createElement('WalletData');

Expand All @@ -2339,15 +2342,34 @@ private function hydrateWalletData(DOMDocument $xml, BaseBuilder $builder, $bloc
}

if ($builder->paymentMethod->mobileType) {
$digitalToken = $walletData->appendChild($xml->createElement('DigitalPaymentToken'));
$digitalToken->appendChild($xml->createCDATASection($builder->paymentMethod->token));
$token = $this->toFormatToken($builder->paymentMethod->token);
$walletData->appendChild($xml->createElement('DigitalPaymentToken', $token));
$block1->removeChild($cardData);
}

$block1->appendChild($walletData);
}
}

/**
* To format token
*
* @param string $token
*
* @return string
*/
private function toFormatToken(string $token)
{
$decodedToken = json_decode(preg_replace('/(\\\)(\w)/', '${1}${1}${2}', $token));
foreach ($decodedToken as $key => $value) {
if ($key == 'signedMessage')
$decodedToken->$key = str_replace('u003d', '\u003d', $value);
}

$result = json_encode($decodedToken, JSON_UNESCAPED_SLASHES);
return str_replace('\\\\', '\\', $result);
}

/**
* To check ApplePay or GooglePay
*
Expand All @@ -2357,11 +2379,11 @@ private function hydrateWalletData(DOMDocument $xml, BaseBuilder $builder, $bloc
private function isAppleOrGooglePay($paymentDataSource)
{
if (
$paymentDataSource == Secure3dPaymentDataSource::APPLEPAY
|| $paymentDataSource == Secure3dPaymentDataSource::APPLEPAYAPP
|| $paymentDataSource == Secure3dPaymentDataSource::APPLEPAYWEB
|| $paymentDataSource == Secure3dPaymentDataSource::GOOGLEPAYAPP
|| $paymentDataSource == Secure3dPaymentDataSource::GOOGLEPAYWEB
$paymentDataSource == PaymentDataSourceType::APPLEPAY
|| $paymentDataSource == PaymentDataSourceType::APPLEPAYAPP
|| $paymentDataSource == PaymentDataSourceType::APPLEPAYWEB
|| $paymentDataSource == PaymentDataSourceType::GOOGLEPAYAPP
|| $paymentDataSource == PaymentDataSourceType::GOOGLEPAYWEB
) {
return true;
}
Expand Down
11 changes: 4 additions & 7 deletions src/Terminals/ConnectionContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@

class ConnectionContainer
{

/** @var IPaymentGateway */
private $deviceController;

/** @var ConnectionContainer */
private static $instance;

Expand Down Expand Up @@ -45,26 +41,27 @@ public static function instance()
/**
* Configures the `ConnectionContainer` singleton
*
* @param ServicesConfig $config
* @param ConnectionConfig $config
*
* @return void
*/
public static function configure(ConnectionConfig $config)
public static function configure(ConnectionConfig $config) : void
{
$config->validate();

$deviceController = null;
switch ($config->deviceType) {
case DeviceType::HPA_ISC250:
static::$instance = new HpaController($config);
break;
case DeviceType::PAX_DEVICE:
case DeviceType::PAX_S300:
case DeviceType::PAX_D200:
case DeviceType::PAX_D210:
case DeviceType::PAX_PX5:
case DeviceType::PAX_PX7:
static::$instance = new PaxController($config);
break;
case DeviceType::UPA_DEVICE:
case DeviceType::UPA_SATURN_1000:
case DeviceType::UPA_VERIFONE_T650P:
static::$instance = new UpaController($config);
Expand Down
4 changes: 3 additions & 1 deletion src/Terminals/Enums/DeviceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@

class DeviceType extends Enum
{
const PAX_S300 = 'PAX_S300';
const HPA_ISC250 = 'HPA_ISC250';
const HPA_IPP350 = 'HPA_IPP350';
const PAX_DEVICE = 'PAX_DEVICE';
const PAX_D200 = 'PAX_D200';
const PAX_D210 = 'PAX_D210';
const PAX_PX5 = 'PAX_PX5';
const PAX_PX7 = 'PAX_PX7';
const PAX_S300 = 'PAX_S300';
const UPA_DEVICE = 'UPA_DEVICE';
const UPA_SATURN_1000 = 'UPA_SATURN_1000';
const UPA_VERIFONE_T650P = 'UPA_VERIFONE_T650P';
}
18 changes: 16 additions & 2 deletions src/Terminals/PAX/PaxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,18 @@ public function manageTransaction($builder)
$trace = new TraceRequest();
$trace->referenceNumber = $requestId;

$amount->transactionAmount = TerminalUtils::formatAmount($builder->amount);
//Tip Adjust
if($builder->transactionType === TransactionType::EDIT && !empty($builder->gratuity)){
/*
* Transaction Type 06 : ADJUST: Used for additional charges or gratuity.
* Typically used for tip adjustment.
* Set the amount to Transaction Amount, not the Tip Amount
*/
$amount->transactionAmount = TerminalUtils::formatAmount($builder->gratuity);
$extData->details[PaxExtData::TIP_REQUEST] = 1;
} else {
$amount->transactionAmount = TerminalUtils::formatAmount($builder->amount);
}

if ($builder->paymentMethod != null) {
if ($builder->paymentMethod instanceof TransactionReference) {
Expand All @@ -107,7 +118,8 @@ public function manageTransaction($builder)
$card = $builder->paymentMethod;
$account->accountNumber = $card->number;
}
}
}

$transactionType = $this->mapTransactionType($builder->transactionType);
switch ($builder->paymentMethodType) {
case PaymentMethodType::CREDIT:
Expand Down Expand Up @@ -271,6 +283,8 @@ private function mapTransactionType($type, $requestToken = null)
return PaxTxnType::WITHDRAWAL;
case TransactionType::REVERSAL:
return PaxTxnType::REVERSAL;
case TransactionType::EDIT:
return PaxTxnType::ADJUST;
default:
throw new UnsupportedTransactionException(
'The selected gateway does not support this transaction type.'
Expand Down
3 changes: 2 additions & 1 deletion src/Terminals/PAX/PaxInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ public function safSummaryReport($safIndicator = null)

public function creditTipAdjust($tipAmount = null)
{
throw new UnsupportedTransactionException('');
return (new TerminalManageBuilder(TransactionType::EDIT, PaymentMethodType::CREDIT))
->withGratuity($tipAmount);
}

#endregion
Expand Down
Loading

0 comments on commit 5a8f97a

Please sign in to comment.