Skip to content

Commit b58f3a8

Browse files
authored
Merge pull request #20 from slogsdon/update-3ds-fields
Include mandatory/recommended 3DS 2.0 fields
2 parents 95437a2 + e99c080 commit b58f3a8

File tree

7 files changed

+922
-54
lines changed

7 files changed

+922
-54
lines changed

LICENSE.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2018 Pay and Shop Ltd t/a Global Payments
3+
Copyright (c) 2019 Global Payments
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the Software), to deal
77
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, andor sell
8+
to use, copy, modify, merge, publish, distribute, sublicense, and or sell
99
copies of the Software, and to permit persons to whom the Software is
1010
furnished to do so, subject to the following conditions
1111

@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
THE SOFTWARE.
21+
THE SOFTWARE.

README.md

+63-46
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1+
# Please use our new PHP SDK
2+
We've moved. We highly recommend you use the Global Payments PHP SDK
3+
which supports all the features of this SDK and will benefit from all future releases:
4+
https://github.com/globalpayments/php-sdk
5+
6+
With the latest update (1.1.3) this SDK supports the mandatory and recommended HPP fields for 3D Secure 2. Going forward it will only receive critical security updates, no further feature updates will be released beyond 3D Secure 2.
7+
18
# Realex Payments HPP PHP SDK
2-
You can sign up for a free Realex Payments sandbox account at https://developer.realexpayments.com
9+
You can sign up for a Global Payments (formerly Realex Payments) account at https://developer.globalpay.com
310

411
## Requirements ##
512
- PHP >= 5.3.9
13+
- For security and support we highly recommend you use PHP 7
614
- Composer (https://getcomposer.org/)
715

816
## Instructions ##
@@ -12,7 +20,7 @@ You can sign up for a free Realex Payments sandbox account at https://developer.
1220
```
1321
{
1422
"require": {
15-
"realexpayments/rxp-hpp-php": "1.1.2"
23+
"realexpayments/rxp-hpp-php": "1.1.3"
1624
}
1725
}
1826
```
@@ -32,71 +40,80 @@ You can sign up for a free Realex Payments sandbox account at https://developer.
3240
3. Add a reference to the autoloader class anywhere you need to use the sdk
3341
3442
```php
35-
require_once ( 'vendor/autoload.php' );
43+
require_once ('vendor/autoload.php');
3644
```
3745
3846
4. Use the sdk <br/>
3947
4048
```php
41-
$hppRequest = ( new HppRequest() )
42-
->addMerchantId( "myMerchantId" )
43-
->addAccount( "mySubAccount" )
44-
....
49+
$hppRequest = new HppRequest();
50+
$hppRequest->addMerchantId("MerchantId");
51+
$hppRequest->addAccount("internet");
52+
....
4553
```
4654
47-
##SDK Example##
55+
## Usage
4856
49-
### Creating Request JSON for Realex JS SDK
57+
### Creating HPP Request JSON for Realex Payments JS Library
5058
5159
```php
52-
require_once ( 'vendor/autoload.php' );
60+
<?php
61+
require_once ('vendor/autoload.php');
5362
5463
use com\realexpayments\hpp\sdk\domain\HppRequest;
5564
use com\realexpayments\hpp\sdk\RealexHpp;
56-
57-
$hppRequest = ( new HppRequest() )
58-
->addMerchantId( "myMerchantId" )
59-
->addAccount( "mySubAccount" )
60-
->addAmount( "1001" )
61-
->addCurrency( "EUR" )
62-
->addAutoSettleFlag( "1" );
63-
64-
$supplementaryData = array();
65-
$supplementaryData['key1'] = 'value1';
66-
$supplementaryData['key2'] = 'value2';
67-
68-
$hppRequest->addSupplementaryData( $supplementaryData );
69-
70-
$realexHpp = new RealexHpp( "mySecret" );
71-
$requestJson = $realexHpp->requestToJson( $hppRequest );
65+
use com\realexpayments\hpp\sdk\RealexValidationException;
66+
use com\realexpayments\hpp\sdk\RealexException;
67+
68+
$hppRequest = new HppRequest();
69+
$hppRequest->addMerchantId("MerchantId");
70+
$hppRequest->addAccount("internet");
71+
$hppRequest->addAmount("1001");
72+
$hppRequest->addCurrency("EUR");
73+
$hppRequest->addAutoSettleFlag(TRUE);
74+
$hppRequest->addHppVersion("2");
75+
// 3D Secure 2 Mandatory and Recommended Fields
76+
$hppRequest->addCustomerEmailAddress("[email protected]");
77+
$hppRequest->addCustomerMobilePhoneNumber("44|07123456789");
78+
$hppRequest->addBillingAddressLine1("Flat 123");
79+
$hppRequest->addBillingAddressLine2("House 456");
80+
$hppRequest->addBillingAddressLine3("Unit 4");
81+
$hppRequest->addBillingCity("Halifax");
82+
$hppRequest->addBillingPostalCode("W5 9HR");
83+
$hppRequest->addBillingCountryCode("826");
84+
$hppRequest->addShippingAddressLine1("Apartment 825");
85+
$hppRequest->addShippingAddressLine2("Complex 741");
86+
$hppRequest->addShippingAddressLine3("House 963");
87+
$hppRequest->addShippingCity("Chicago");
88+
$hppRequest->addShippingState("IL");
89+
$hppRequest->addShippingPostalCode("50001");
90+
$hppRequest->addShippingCountryCode("840");
91+
92+
$realexHpp = new RealexHpp("Shared Secret");
93+
94+
try {
95+
$requestJson = $realexHpp->requestToJson($hppRequest, false);
96+
// TODO: pass the HPP request JSON to the JavaScript, iOS or Android Library
97+
}
98+
catch (RealexValidationException $e) {
99+
// TODO: Add your error handling here
100+
}
101+
catch (RealexException $e) {
102+
// TODO: Add your error handling here
103+
}
72104
```
73105

74-
### Consuming Response JSON from Realex Payments JS SDK
106+
### Consuming Response JSON from Realex Payments JS Library
75107

76108
```php
77-
require_once ( 'vendor/autoload.php' );
109+
<?php
110+
require_once ('vendor/autoload.php');
78111

79112
use com\realexpayments\hpp\sdk\domain\HppResponse;
80113
use com\realexpayments\hpp\sdk\RealexHpp;
81114

82-
$realexHpp = new RealexHpp( "mySecret" );
83-
$hppResponse = $realexHpp->responseFromJson( responseJson );
84-
```
85-
### HPP Select Stored Card
86-
```php
87-
$hppRequest = new HppRequest();
88-
$hppRequest
89-
->addAmount("1001")
90-
->addCurrency("EUR")
91-
->addAccount("accountId")
92-
->addMerchantId("merchantId")
93-
->addAutoSettleFlag("1")
94-
->addHppSelectStoredCard("payerRef")
95-
->addPayerExists("1")
96-
->addOfferSaveCard("1");
97-
98-
$realexHpp = new RealexHpp("secret");
99-
$requestJson = $realexHpp->requestToJson($hppRequest);
115+
$realexHpp = new RealexHpp("mySecret");
116+
$hppResponse = $realexHpp->responseFromJson(responseJson);
100117
```
101118
## License
102119

composer.json

+10
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,17 @@
2626
"doctrine/annotations":"1.2.*",
2727
"doctrine/cache":"1.4.*"
2828
},
29+
"require-dev": {
30+
"phpunit/phpunit": "^5.7"
31+
},
2932
"autoload": {
33+
"psr-4": {
34+
"com\\realexpayments\\hpp\\sdk\\": [
35+
"src/main/php/com-realexpayments-hpp-sdk"
36+
]
37+
}
38+
},
39+
"autoload-dev": {
3040
"psr-4": {
3141
"com\\realexpayments\\hpp\\sdk\\": [
3242
"src/main/php/com-realexpayments-hpp-sdk",

phpunit.xml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/5.7/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
executionOrder="depends,defects"
6+
forceCoversAnnotation="true"
7+
beStrictAboutCoversAnnotation="true"
8+
beStrictAboutOutputDuringTests="true"
9+
beStrictAboutTodoAnnotatedTests="true"
10+
verbose="true">
11+
<testsuites>
12+
<testsuite name="default">
13+
<directory suffix="Test.php">test</directory>
14+
</testsuite>
15+
</testsuites>
16+
17+
<filter>
18+
<whitelist processUncoveredFilesFromWhitelist="true">
19+
<directory suffix=".php">src</directory>
20+
</whitelist>
21+
</filter>
22+
</phpunit>

0 commit comments

Comments
 (0)