Skip to content

Commit

Permalink
OctopusDeploy release: 3.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
securesubmit-buildmaster committed May 17, 2022
1 parent bf778a7 commit a150c33
Show file tree
Hide file tree
Showing 29 changed files with 308 additions and 148 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@

## Latest version
#### Enhancements:
- GP-ECOM: Add HPP capture billing/shipping address
- Add intl and mbstring extensions on composer
- GP-API: Refacto reporting for disputes / search stored payment methods / LodgingData

## v3.1.0 (05/05/2022)
#### Enhancements:

- GP-ECOM: Add bank payment (open banking) service
- GP-API: Update usage mode, cardholder name and card number on a stored payment method
- Portico: Updated code for Secure3D and WalletData Element
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"ext-dom": "*",
"ext-openssl": "*",
"ext-json": "*",
"ext-zlib": "*"
"ext-zlib": "*",
"ext-intl": "*",
"ext-mbstring": "*"
},
"require-dev": {
"phpunit/phpunit": "~5.0",
Expand Down
30 changes: 24 additions & 6 deletions examples/hpp/example.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@

<fieldset style="width: 30%;">
<legend style="font-style: italic"> Capture Billing and Shipping Information</legend>
<div>
<input type="checkbox" id="capture_address" name="capture_address">
<label for="capture_address">Enable Capture billing and shipping capability</label>
</div>
<div>
<input type="checkbox" id="not_return_address" name="not_return_address">
<label for="not_return_address">Do not return address information in HPP response</label>
</div>
</fieldset>
<br>
<button id="payButtonId">Click here to pay</button>

<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
<script src="rxp-hpp.js"></script>
<script>
$(document).ready(function() {
$.getJSON("get-json.php", function(jsonFromRequestEndpoint) {
console.log(jsonFromRequestEndpoint);
RealexHpp.setHppUrl("https://pay.sandbox.realexpayments.com/pay");
/*
$("#payButtonId").click(function() {
const data = {
captureAddress: document.getElementById("capture_address").checked,
notReturnAddress: document.getElementById("not_return_address").checked
};
console.log(data);
$.getJSON("get-json.php", data, function (jsonFromRequestEndpoint) {
console.log(jsonFromRequestEndpoint);
RealexHpp.setHppUrl("https://pay.sandbox.realexpayments.com/pay");
/*
* if running this from localhost, for your response endpoint,
* you will need to expose your local server to the outside world
* you can use something like ngrok for it then access your local host via
* the ngrok link
*/
RealexHpp.lightbox.init("payButtonId", "response-endpoint.php", jsonFromRequestEndpoint);
RealexHpp.lightbox.init("autoload", "response-endpoint.php", jsonFromRequestEndpoint);
});
});
});
</script>
11 changes: 10 additions & 1 deletion examples/hpp/get-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use GlobalPayments\Api\Entities\Exceptions\ApiException;
use GlobalPayments\Api\Services\HostedService;


// configure client, request and HPP settings
$config = new GpEcomConfig();
$config->merchantId = "openbankingsandbox";
Expand All @@ -21,13 +22,20 @@
$config->enableBankPayment = true;
$config->hostedPaymentConfig = new HostedPaymentConfig();
$config->hostedPaymentConfig->version = HppVersion::VERSION_2;

$service = new HostedService($config);

// Add 3D Secure 2 Mandatory and Recommended Fields
$hostedPaymentData = new HostedPaymentData();
$hostedPaymentData->customerEmail = "[email protected]";
$hostedPaymentData->customerPhoneMobile = "44|07123456789";
$hostedPaymentData->addressesMatch = false;
if (isset($_REQUEST['captureAddress'])) {
$hostedPaymentData->addressCapture = filter_var($_REQUEST['captureAddress'], FILTER_VALIDATE_BOOLEAN);
}
if (isset($_REQUEST['notReturnAddress'])) {
$hostedPaymentData->notReturnAddress = filter_var($_REQUEST['notReturnAddress'], FILTER_VALIDATE_BOOLEAN);
}

$hostedPaymentData->customerCountry = 'GB';
$hostedPaymentData->customerFirstName = 'James';
Expand Down Expand Up @@ -58,13 +66,14 @@
$bankPayment->sortCode = '406650';
$bankPayment->accountName = 'AccountName';

$hostedPaymentData->bankPayment = $bankPayment;

try {
$hppJson = $service->charge(19.99)
->withCurrency("GBP")
->withHostedPaymentData($hostedPaymentData)
->withAddress($billingAddress, AddressType::BILLING)
->withAddress($shippingAddress, AddressType::SHIPPING)
->withPaymentMethod($bankPayment)
->withRemittanceReference(RemittanceReferenceType::TEXT, 'Nike Bounce Shoes')
->serialize();
//with this, we can pass our json to the client side
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>3.1.0</releaseNumber>
<releaseNumber>3.1.1</releaseNumber>
</xml>
12 changes: 6 additions & 6 deletions src/Builders/ManagementBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use GlobalPayments\Api\Entities\Enums\TaxType;
use GlobalPayments\Api\Entities\Enums\TransactionModifier;
use GlobalPayments\Api\Entities\Enums\TransactionType;
use GlobalPayments\Api\Entities\Lodging;
use GlobalPayments\Api\Entities\LodgingData;
use GlobalPayments\Api\Entities\Transaction;
use GlobalPayments\Api\PaymentMethods\CreditCardData;
use GlobalPayments\Api\PaymentMethods\ECheck;
Expand Down Expand Up @@ -187,8 +187,8 @@ class ManagementBuilder extends TransactionBuilder
/** @var DccRateData */
public $dccRateData;

/** @var Lodging */
public $lodging;
/** @var LodgingData */
public $lodgingData;

/** @var string */
public $tagData;
Expand Down Expand Up @@ -617,13 +617,13 @@ public function withPaymentMethodUsageMode($value)
/**
* Set the lodging details
*
* @param Lodging $lodging
* @param LodgingData $lodging
*
* @return $this
*/
public function withLodging($lodging)
public function withLodgingData($lodgingData)
{
$this->lodging = $lodging;
$this->lodgingData = $lodgingData;

return $this;
}
Expand Down
7 changes: 7 additions & 0 deletions src/Builders/TransactionReportBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use GlobalPayments\Api\Entities\Enums\DisputeSortProperty;
use GlobalPayments\Api\Entities\Enums\SortDirection;
use GlobalPayments\Api\Entities\Enums\StoredPaymentMethodSortProperty;
use GlobalPayments\Api\Entities\Enums\TransactionModifier;
use GlobalPayments\Api\Entities\Enums\TransactionSortProperty;
use GlobalPayments\Api\Entities\Enums\ReportType;
use GlobalPayments\Api\Entities\Enums\TimeZoneConversion;
Expand Down Expand Up @@ -96,6 +97,8 @@ class TransactionReportBuilder extends ReportBuilder
*/
public $reportType;

public $transactionModifier = TransactionModifier::NONE;

/**
* @internal
* @var TimeZoneConversion
Expand All @@ -106,6 +109,7 @@ public function __construct($activity)
{
parent::__construct($activity);

$this->transactionType = $activity;
$this->searchBuilder = new SearchCriteriaBuilder($this);
}

Expand Down Expand Up @@ -311,5 +315,8 @@ protected function setupValidations()

$this->validations->of(ReportType::ACTIVITY)
->check('transactionId')->isNull();

$this->validations->of(ReportType::DOCUMENT_DISPUTE_DETAIL)
->check('disputeDocumentId')->isNotNullInSubProperty('searchBuilder');
}
}
3 changes: 2 additions & 1 deletion src/Entities/Enums/ReportType.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class ReportType extends Enum
{
const FIND_TRANSACTIONS = 1;
const ACTIVITY = 2; // 1 << 1;
const FIND_BANK_PAYMENT = 4; // 1 << 2
const DOCUMENT_DISPUTE_DETAIL = 8; // 1 << 3
const TRANSACTION_DETAIL = 128; // 1 << 7;
const FIND_DEPOSITS = 256; //1 << 8
const FIND_DISPUTES = 512; // 1 << 9
Expand All @@ -25,5 +27,4 @@ class ReportType extends Enum
const STORED_PAYMENT_METHOD_DETAIL = 2097152; // 1 << 21
const FIND_ACTIONS_PAGED = 4194304; // 1 << 22
const ACTION_DETAIL = 8388608; // 1 << 23
const FIND_BANK_PAYMENT = 4; // 1 << 2
}
2 changes: 1 addition & 1 deletion src/Entities/Enums/ServiceEndpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ class ServiceEndpoints extends Enum
const GP_API_TEST = "https://apis.sandbox.globalpay.com/ucp";
const GP_API_PRODUCTION = "https://apis.globalpay.com/ucp";
const OPEN_BANKING_TEST = 'https://beta.sandbox.globalpay-ecommerce.com/openbanking';
const OPEN_BANKING_PRODUCTION = '';
const OPEN_BANKING_PRODUCTION = 'https://beta.globalpay-ecommerce.com/openbanking';
}
16 changes: 8 additions & 8 deletions src/Entities/GpApi/GpApiManagementRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use GlobalPayments\Api\Entities\Enums\TransactionType;
use GlobalPayments\Api\Entities\GpApi\DTO\Card;
use GlobalPayments\Api\Entities\IRequestBuilder;
use GlobalPayments\Api\Entities\Lodging;
use GlobalPayments\Api\Entities\LodgingData;
use GlobalPayments\Api\Entities\LodgingItems;
use GlobalPayments\Api\Mapping\EnumMapping;
use GlobalPayments\Api\PaymentMethods\CreditCardData;
Expand Down Expand Up @@ -148,9 +148,9 @@ public function buildRequest(BaseBuilder $builder, $config)
$endpoint = GpApiRequest::TRANSACTION_ENDPOINT . '/' . $builder->paymentMethod->transactionId . '/incremental';
$verb = 'POST';
$payload['amount'] = StringUtils::toNumeric($builder->amount);
if (!empty($builder->lodging)) {
/** @var Lodging $lodging */
$lodging = $builder->lodging;
if (!empty($builder->lodgingData)) {
/** @var LodgingData $lodging */
$lodging = $builder->lodgingData;
if (!empty($lodging->items)) {
$lodgingItems = [];
/** @var LodgingItems $item */
Expand All @@ -167,10 +167,10 @@ public function buildRequest(BaseBuilder $builder, $config)
$payload['lodging'] = [
'booking_reference' => $lodging->bookingReference,
'duration_days' => $lodging->durationDays,
'date_checked_in' => !empty($lodging->dateCheckedIn) ?
(new \DateTime($lodging->dateCheckedIn))->format('Y-m-d') : null,
'date_checked_out' => !empty($lodging->dateCheckedOut) ?
(new \DateTime($lodging->dateCheckedOut))->format('Y-m-d') : null,
'date_checked_in' => !empty($lodging->checkedInDate) ?
(new \DateTime($lodging->checkedInDate))->format('Y-m-d') : null,
'date_checked_out' => !empty($lodging->checkedOutDate) ?
(new \DateTime($lodging->checkedOutDate))->format('Y-m-d') : null,
'daily_rate_amount' => !empty($lodging->dailyRateAmount) ?
StringUtils::toNumeric($lodging->dailyRateAmount) : null,
'lodging.charge_items' => !empty($lodgingItems) ? $lodgingItems : null
Expand Down
10 changes: 6 additions & 4 deletions src/Entities/GpApi/GpApiReportRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function buildRequest(BaseBuilder $builder, $config)
$queryParams['batch_id'] = $builder->searchBuilder->batchId;
$queryParams['entry_mode'] = $builder->searchBuilder->paymentEntryMode;
$queryParams['name'] = $builder->searchBuilder->name;
$queryParams['payment_method'] = $builder->searchBuilder->paymentMethod;
$queryParams['payment_method'] = $builder->searchBuilder->paymentMethodName;
$queryParams = array_merge($queryParams, $this->getTransactionParams($builder));
break;
case ReportType::FIND_SETTLEMENT_TRANSACTIONS_PAGED:
Expand All @@ -103,9 +103,11 @@ public function buildRequest(BaseBuilder $builder, $config)
case ReportType::DISPUTE_DETAIL:
$endpoint = GpApiRequest::DISPUTES_ENDPOINT . '/' . $builder->searchBuilder->disputeId;
$verb = 'GET';
if ($builder->searchBuilder->disputeDocumentId) {
$endpoint .= '/documents/' . $builder->searchBuilder->disputeDocumentId;
}
break;
case ReportType::DOCUMENT_DISPUTE_DETAIL:
$endpoint = GpApiRequest::DISPUTES_ENDPOINT . '/' . $builder->searchBuilder->disputeId . '/documents/' .
$builder->searchBuilder->disputeDocumentId;
$verb = 'GET';
break;
case ReportType::FIND_DISPUTES_PAGED:
$endpoint = GpApiRequest::DISPUTES_ENDPOINT;
Expand Down
18 changes: 18 additions & 0 deletions src/Entities/HostedPaymentData.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace GlobalPayments\Api\Entities;

use GlobalPayments\Api\Entities\Enums\AlternativePaymentType;
use GlobalPayments\Api\PaymentMethods\BankPayment;

/**
* Data collection to supplement a hosted payment page.
Expand All @@ -18,6 +19,20 @@ class HostedPaymentData
*/
public $addressesMatch;

/**
* Determines whether the address forms will be displayed on the HPP
*
* @var boolean
*/
public $addressCapture;

/**
* Determines whether or not the HPP response will contain the address and contact information.
*
* @var boolean
*/
public $notReturnAddress;

/**
* Determines the challenge request preference for 3DS 2.0.
*
Expand Down Expand Up @@ -107,6 +122,9 @@ class HostedPaymentData
/** @var array<AlternativePaymentType> */
public $presetPaymentMethods = [];

/** @var BankPayment */
public $bankPayment;

/**
* Instantiates a new `HostedPaymentData` object.
*
Expand Down
24 changes: 0 additions & 24 deletions src/Entities/Lodging.php

This file was deleted.

48 changes: 48 additions & 0 deletions src/Entities/LodgingData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
namespace GlobalPayments\Api\Entities;

class LodgingData
{
/**
* @var string
*/
public $prestigiousPropertyLimit;

/**
* @var bool
*/
public $noShow;

/**
* @var string
*/
public $advancedDepositType;

/**
* @var string
*/
public $lodgingDataEdit;

/**
* @var bool
*/
public $preferredCustomer;

/** @var string */
public $bookingReference;

/** @var integer */
public $durationDays;

/** @var string */
public $checkedInDate;

/** @var string */
public $checkedOutDate;

/** @var string */
public $dailyRateAmount;

/** @var array<LodgingItems> */
public $items;
}
Loading

0 comments on commit a150c33

Please sign in to comment.