-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf778a7
commit a150c33
Showing
29 changed files
with
308 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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"; | ||
|
@@ -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'; | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
Oops, something went wrong.