Skip to content

Commit

Permalink
OctopusDeploy release: 11.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
securesubmit-buildmaster committed Oct 24, 2023
1 parent fe167e5 commit 9599204
Show file tree
Hide file tree
Showing 21 changed files with 503 additions and 565 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@

# Changelog

## Latest Version - v11.0.0 (10/19/2023)
## Latest Version - v11.0.1 (10/24/2023)
### Enhancements:
- [GP-API] Add stored credentials to verify request
- [GP-API & GP-ECOM] Enhancements on unit tests
- [MEET-IN-THE-CLOUD][GP-API] Remove QA endpoint

#### Bug Fixes:
-[GP-API]: Fix 3DS example

## v11.0.0 (10/19/2023)
### Enhancements:
- [DiamondCloud] Add support for Diamond Cloud provider payment terminals.
- [Breaking] Terminals: Architecture update
Expand Down
6 changes: 3 additions & 3 deletions examples/gp-api/end-to-end/authorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
console_log($serverTransactionId);
function console_log($data)
{
$data = htmlspecialchars($data);
$data = htmlspecialchars($data, ENT_NOQUOTES);
echo '<script>';
echo 'if(' . $data . ') {';
echo 'console.log(' . json_encode($data) . ')';
Expand Down Expand Up @@ -81,15 +81,15 @@ function console_log($data)
echo "<p><strong>Oh Dear! Your trasaction was not authenticated successfully!</strong></p>";
}
?>
<p>Server Trans ID: <?= !empty($serverTransactionId) ? htmlspecialchars($serverTransactionId) : "" ?></p>
<p>Server Trans ID: <?= !empty($serverTransactionId) ? htmlspecialchars($serverTransactionId, ENT_NOQUOTES) : "" ?></p>
<p>Authentication Value: <?= !empty($authenticationValue) ? $authenticationValue : "" ?></p>
<p>DS Trans ID: <?= $dsTransId ?></p>
<p>Message Version: <?= $messageVersion ?></p>
<p>ECI: <?= $eci ?></p>

<pre>
<?php
print_r(htmlspecialchars($secureEcom));
print_r(htmlspecialchars(json_encode($secureEcom), ENT_NOQUOTES));
?>
</pre>
<h2>Transaction details:</h2>
Expand Down
15 changes: 7 additions & 8 deletions examples/gp-api/end-to-end/challengeNotificationUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
try {
$decodedString = base64_decode($cres);
if (!empty($decodedString)) {
$convertedObject = json_decode(htmlspecialchars($decodedString), true);
$convertedObject = json_decode(htmlspecialchars($decodedString, ENT_NOQUOTES), true);
}

date_default_timezone_set('Europe/Dublin');
Expand All @@ -27,11 +27,10 @@
fwrite($file, "\n**************************\n\n");
fclose($file);

$serverTransID = htmlspecialchars($convertedObject['threeDSServerTransID']);
$acsTransID = $convertedObject['acsTransID'];
$messageType = $convertedObject['messageType'];
$messageVersion = $convertedObject['messageVersion'];
$challengeCompletionInd = $convertedObject['challengeCompletionInd'];
$serverTransID = htmlspecialchars($convertedObject['threeDSServerTransID'], ENT_NOQUOTES);
$acsTransID = $convertedObject['acsTransID'] ?? null;
$messageType = $convertedObject['messageType'] ?? null;
$messageVersion = $convertedObject['messageVersion'] ?? null;
$transStatus = $convertedObject['transStatus'];

// TODO: notify client-side that the Challenge step is complete, see below
Expand All @@ -42,6 +41,6 @@
<script src="globalpayments-3ds.js"></script>
<script>
GlobalPayments.ThreeDSecure.handleChallengeNotification({
"threeDSServerTransID": <?php echo '"' . isset($serverTransID) ? htmlspecialchars($serverTransID) : "" . '"'; ?>,
"transStatus": <?php echo '"' . $transStatus ? htmlspecialchars($transStatus) : "" . '"}'; ?>);
"threeDSServerTransID": <?php echo '"' . (isset($serverTransID) ? htmlspecialchars($serverTransID, ENT_NOQUOTES) : "") . '"'; ?>,
"transStatus": <?php echo '"' . ($transStatus ? htmlspecialchars($transStatus, ENT_NOQUOTES) : "") . '"}'; ?>);
</script>
4 changes: 2 additions & 2 deletions examples/gp-api/end-to-end/methodNotificationUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
try {
$decodedThreeDSMethodData = base64_decode($threeDSMethodData);
if (!empty($decodedThreeDSMethodData)) {
$convertedThreeDSMethodData = json_decode(htmlspecialchars($decodedThreeDSMethodData), true);
$serverTransID = htmlspecialchars($convertedThreeDSMethodData['threeDSServerTransID']);
$convertedThreeDSMethodData = json_decode(htmlspecialchars($decodedThreeDSMethodData, ENT_NOQUOTES), true);
$serverTransID = htmlspecialchars($convertedThreeDSMethodData['threeDSServerTransID'], ENT_NOQUOTES);
}

// TODO: notify client-side that the Method URL step is complete
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>11.0.0</releaseNumber>
<releaseNumber>11.0.1</releaseNumber>
</xml>
5 changes: 4 additions & 1 deletion src/Builders/PayFacBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,10 @@ public function withUploadDocumentData($uploadDocumentData)
{
//file validations
if (empty($uploadDocumentData->b64_content)) {
if (!file_exists($uploadDocumentData->documentLocation)) {
if (
empty($uploadDocumentData->documentLocation) ||
!file_exists($uploadDocumentData->documentLocation)
) {
throw new BuilderException('File not found!');
} elseif (filesize($uploadDocumentData->documentLocation) > 5000000) {
throw new BuilderException('Max file size 5MB exceeded');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use GlobalPayments\Api\Entities\PayByLinkData;
use GlobalPayments\Api\Entities\PhoneNumber;
use GlobalPayments\Api\Entities\Product;
use GlobalPayments\Api\Entities\StoredCredential;
use GlobalPayments\Api\Gateways\OpenBankingProvider;
use GlobalPayments\Api\Mapping\EnumMapping;
use GlobalPayments\Api\PaymentMethods\BankPayment;
Expand Down Expand Up @@ -216,7 +217,9 @@ private function generateVerificationRequest(AuthorizationBuilder $builder, GpAp
$requestBody['currency'] = $builder->currency;
$requestBody['country'] = $config->country;
$requestBody['payment_method'] = $this->createPaymentMethodParam($builder, $config);

if (!empty($builder->storedCredential)) {
$this->setRequestStoredCredentials($builder->storedCredential, $requestBody);
}
return $requestBody;
}

Expand Down Expand Up @@ -277,13 +280,7 @@ private function createFromAuthorizationBuilder($builder, GpApiConfig $config)
$this->setNotificationUrls($requestBody);
}
if (!empty($builder->storedCredential)) {
$initiator = EnumMapping::mapStoredCredentialInitiator(GatewayProvider::GP_API, $builder->storedCredential->initiator);
$requestBody['initiator'] = !empty($initiator) ? $initiator : null;
$requestBody['stored_credential'] = [
'model' => strtoupper($builder->storedCredential->type),
'reason' => strtoupper($builder->storedCredential->reason),
'sequence' => strtoupper($builder->storedCredential->sequence)
];
$this->setRequestStoredCredentials($builder->storedCredential, $requestBody);
}

if (!empty($builder->dccRateData)) {
Expand All @@ -295,6 +292,17 @@ private function createFromAuthorizationBuilder($builder, GpApiConfig $config)
return $requestBody;
}

private function setRequestStoredCredentials(StoredCredential $storedCredential, &$request)
{
$request['initiator'] = !empty($storedCredential->initiator) ?
EnumMapping::mapStoredCredentialInitiator(GatewayProvider::GP_API, $storedCredential->initiator) : null;
$request['stored_credential'] = [
'model' => !empty($storedCredential->type) ? strtoupper($storedCredential->type) : null,
'reason' => !empty($storedCredential->reason) ? strtoupper($storedCredential->reason) : null,
'sequence' => !empty($storedCredential->sequence) ? strtoupper($storedCredential->sequence) : null
];
}

/**
* Sets the information related to the payer
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public function buildRequest(BaseBuilder $builder, $config)
$this->mapAddress($this->builder->addresses->get(AddressType::BILLING), 'alpha2') : null
];
}
break;
case TransactionType::ADD_FUNDS:
$verb = 'POST';
$endpoint = GpApiRequest::MERCHANT_MANAGEMENT_ENDPOINT . '/' . $builder->userReference->userId . '/settlement/funds';
Expand Down
1 change: 0 additions & 1 deletion src/Entities/Enums/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ class Environment extends Enum
{
const TEST = "TEST";
const PRODUCTION = "PRODUCTION";
const QA = 'QA';
}
1 change: 0 additions & 1 deletion src/Entities/Enums/ServiceEndpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class ServiceEndpoints extends Enum
const PROPAY_PRODUCTION_CANADIAN = "https://www.propaycanada.ca/API/PropayAPI.aspx";
const GP_API_TEST = "https://apis.sandbox.globalpay.com/ucp";
const GP_API_PRODUCTION = "https://apis.globalpay.com/ucp";
const GP_API_QA = "https://apis-uat.globalpay.com/ucp";
const OPEN_BANKING_TEST = 'https://api.sandbox.globalpay-ecommerce.com/openbanking';
const OPEN_BANKING_PRODUCTION = 'https://api.globalpay-ecommerce.com/openbanking';
const TRANSACTION_API_TEST = "https://api.pit.paygateway.com/transactions/";
Expand Down
6 changes: 1 addition & 5 deletions src/ServiceConfigs/Gateways/GpApiConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,7 @@ public function configureContainer(ConfiguredServices $services)
{
if (empty($this->serviceUrl)) {
$this->serviceUrl = ($this->environment == Environment::PRODUCTION) ?
ServiceEndpoints::GP_API_PRODUCTION :
(
$this->environment == Environment::QA ?
ServiceEndpoints::GP_API_QA :ServiceEndpoints::GP_API_TEST
);
ServiceEndpoints::GP_API_PRODUCTION : ServiceEndpoints::GP_API_TEST;
}
$gateway = new GpApiConnector($this);
$gateway->serviceUrl = $this->serviceUrl;
Expand Down
2 changes: 1 addition & 1 deletion src/Terminals/UPA/Interfaces/UpaMicInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(ITerminalConfiguration $config)
public function connect()
{
$this->connector = ServicesContainer::instance()->getClient($this->config->getConfigName());
if (empty($this->gatewayConfig->accessTokenInfo)) {
if (empty($this->gatewayConfig->accessTokenInfo->accessToken)) {
$this->connector->signIn();
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/Data/BaseGpApiTestConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use GlobalPayments\Api\Entities\CustomWebProxy;
use GlobalPayments\Api\Entities\Enums\Environment;
use GlobalPayments\Api\Entities\GpApi\AccessTokenInfo;
use GlobalPayments\Api\ServiceConfigs\Gateways\GpApiConfig;
use GlobalPayments\Api\ServicesContainer;
use GlobalPayments\Api\Utils\Logging\Logger;
Expand All @@ -20,9 +21,6 @@ class BaseGpApiTestConfig
public static string $appId = self::APP_ID;
public static string $appKey = self::APP_KEY; #gitleaks:allow

const UPA_MIC_DEVICE_APP_ID = '83cdNQ0YBmzxzkLpFHpDGn2ir0WKTW0N';
const UPA_MIC_DEVICE_APP_KEY = '1ASrcQZb0AEqR6ZT';

private static bool $logEnabled = true;
private static bool $dynamicHeaderEnabled = false;
private static bool $permissionsEnabled = false;
Expand All @@ -36,6 +34,8 @@ public static function gpApiSetupConfig($channel): GpApiConfig
$config->environment = Environment::TEST;
$config->channel = $channel;
$config->country = 'US';
$config->accessTokenInfo = new AccessTokenInfo();
$config->accessTokenInfo->transactionProcessingAccountName = 'transaction_processing';

$config->challengeNotificationUrl = "https://ensi808o85za.x.pipedream.net/";
$config->methodNotificationUrl = "https://ensi808o85za.x.pipedream.net/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,24 @@ public function testCreditVerification()
$this->assertEquals("VERIFIED", $response->responseMessage);
}

public function testCreditVerificationWithStoredCredentials()
{
$storeCredentials = new StoredCredential();
$storeCredentials->initiator = StoredCredentialInitiator::MERCHANT;
$storeCredentials->type = StoredCredentialType::INSTALLMENT;
$storeCredentials->sequence = StoredCredentialSequence::SUBSEQUENT;
$storeCredentials->reason = StoredCredentialReason::INCREMENTAL;

$response = $this->card->verify()
->withCurrency($this->currency)
->withStoredCredential($storeCredentials)
->execute();

$this->assertNotNull($response);
$this->assertEquals('SUCCESS', $response->responseCode);
$this->assertEquals("VERIFIED", $response->responseMessage);
}

public function testCreditVerification_withIdempotencyKey()
{
$idempotencyKey = GenerationUtils::getGuid();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ public function testAddFunds_WithoutUserRef()
private function getAccountByType($merchantId, $type)
{
$response = ReportingService::findAccounts(1, 10)
->orderBy(MerchantAccountsSortProperty::TIME_CREATED, SortDirection::ASC)
->orderBy(MerchantAccountsSortProperty::TIME_CREATED, SortDirection::DESC)
->where(DataServiceCriteria::MERCHANT_ID, $merchantId)
->andWith(SearchCriteria::START_DATE, $this->startDate)
->andWith(SearchCriteria::END_DATE, $this->endDate)
Expand All @@ -1221,7 +1221,7 @@ private function getAccountByType($merchantId, $type)
private function getMerchants()
{
return ReportingService::findMerchants(1, 10)
->orderBy(MerchantAccountsSortProperty::TIME_CREATED, SortDirection::ASC)
->orderBy(MerchantAccountsSortProperty::TIME_CREATED, SortDirection::DESC)
->where(SearchCriteria::ACCOUNT_STATUS, MerchantAccountStatus::ACTIVE)
->execute();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public function testFindActions_FilterBy_ResourceStatus()

public function testFindActions_FilterBy_ResourceId()
{
$resourceId = $this->actionSummary->resourceId ?? 'TRN_cf4e1008-c921-4096-bec9-2372cb9476d8';
$resourceId = $this->actionSummary->resourceId ?? 'TRN_xrMGGiLzU8hmuj55ZfnnxVBetKS2EX';
$response = ReportingService::findActionsPaged(1, 10)
->where(SearchCriteria::RESOURCE_ID, $resourceId)
->execute();
Expand Down
Loading

0 comments on commit 9599204

Please sign in to comment.