├── .gitignore ├── CHANGELOG.md ├── LICENSE.txt ├── README.md ├── composer.json ├── config.xml ├── src └── main │ └── php │ └── com-realexpayments-remote-sdk │ ├── EnumBase.php │ ├── RXPLogger.php │ ├── RealexClient.php │ ├── RealexException.php │ ├── RealexServerException.php │ ├── SafeArrayAccess.php │ ├── config.xml │ ├── domain │ ├── Amount.php │ ├── CVN.php │ ├── Card.php │ ├── CardType.php │ ├── Country.php │ ├── CvnNumber.php │ ├── DccInfo.php │ ├── DccInfoResult.php │ ├── Payer.php │ ├── PayerAddress.php │ ├── PaymentData.php │ ├── PhoneNumbers.php │ ├── PresenceIndicator.php │ ├── iRequest.php │ ├── iResponse.php │ ├── payment │ │ ├── Address.php │ │ ├── AddressType.php │ │ ├── AutoSettle.php │ │ ├── AutoSettleFlag.php │ │ ├── CardIssuer.php │ │ ├── Comment.php │ │ ├── CommentCollection.php │ │ ├── FraudFilter.php │ │ ├── FraudFilterMode.php │ │ ├── FraudFilterResult.php │ │ ├── FraudFilterRule.php │ │ ├── FraudFilterRuleCollection.php │ │ ├── Mpi.php │ │ ├── PaymentRequest.php │ │ ├── PaymentResponse.php │ │ ├── PaymentType.php │ │ ├── ReasonCode.php │ │ ├── Recurring.php │ │ ├── RecurringFlag.php │ │ ├── RecurringSequence.php │ │ ├── RecurringType.php │ │ ├── TssInfo.php │ │ ├── TssResult.php │ │ ├── TssResultCheck.php │ │ └── normaliser │ │ │ ├── AddressNormaliser.php │ │ │ ├── AmountNormalizer.php │ │ │ ├── AutoSettleNormalizer.php │ │ │ ├── CardNormaliser.php │ │ │ ├── CommentsNormalizer.php │ │ │ ├── CountryNormalizer.php │ │ │ ├── CustomStringXmlEncoder.php │ │ │ ├── CvnNormaliser.php │ │ │ ├── CvnNumberNormaliser.php │ │ │ ├── DccInfoNormalizer.php │ │ │ ├── DccInfoResultNormalizer.php │ │ │ ├── FraudFilterNormalizer.php │ │ │ ├── FraudFilterRuleCollectionNormalizer.php │ │ │ ├── FraudFilterRuleNormalizer.php │ │ │ ├── PayerAddressNormalizer.php │ │ │ ├── PayerNormalizer.php │ │ │ ├── PaymentDataNormalizer.php │ │ │ ├── PaymentRequestNormalizer.php │ │ │ ├── PaymentResponseNormalizer.php │ │ │ ├── PhoneNumbersNormalizer.php │ │ │ └── TssCheckNormaliser.php │ └── threeDSecure │ │ ├── ThreeDSecure.php │ │ ├── ThreeDSecureRequest.php │ │ ├── ThreeDSecureResponse.php │ │ ├── ThreeDSecureType.php │ │ └── normaliser │ │ ├── ThreeDSecureRequestNormalizer.php │ │ └── ThreeDSecureResponseNormalizer.php │ ├── http │ ├── HttpClient.php │ ├── HttpConfiguration.php │ ├── HttpRequest.php │ ├── HttpResponse.php │ └── HttpUtils.php │ └── utils │ ├── CardValidationUtils.php │ ├── GenerationUtils.php │ ├── MessageType.php │ ├── NormaliserHelper.php │ ├── ResponseUtils.php │ └── XmlUtils.php └── test └── main ├── php └── com-realexpayments-remote-sdk │ ├── RealexClientTest.php │ ├── domain │ ├── payment │ │ ├── CardTest.php │ │ └── PaymentRequestTest.php │ └── threeDSecure │ │ └── ThreeDSecureRequestTest.php │ ├── http │ └── HttpUtilsTest.php │ └── utils │ ├── CardValidationUtilsTest.php │ ├── CardValidationUtils_ExpiryDateTest.php │ ├── GenerationUtilsTest.php │ ├── ResponseUtilsTest.php │ ├── SampleXmlValidationUtils.php │ └── XmlUtilsTest.php └── resources └── sample-xml ├── 3ds-verify-enrolled-request-sample.xml ├── 3ds-verify-enrolled-response-sample-not-enrolled.xml ├── 3ds-verify-enrolled-response-sample.xml ├── 3ds-verify-sig-request-sample.xml ├── 3ds-verify-sig-response-sample.xml ├── auth-mobile-payment-request-sample.xml ├── card-delete-payment-request-sample.xml ├── card-edit-replace-card-payment-request-sample.xml ├── card-edit-update-ch-name-payment-request-sample.xml ├── card-edit-update-issue-no-payment-request-sample.xml ├── card-new-payment-request-sample.xml ├── card-verify-enrolled-payment-request-sample.xml ├── credit-payment-request-sample.xml ├── dcc-rate-auth-payment-request-sample.xml ├── dcc-rate-lookup-payment-request-sample.xml ├── hold-payment-reason-falsepositive-request.xml ├── hold-payment-reason-hold-request.xml ├── hold-payment-reason-release-request.xml ├── hold-payment-request-sample.xml ├── otb-payment-request-sample.xml ├── payer-edit-payment-request-sample.xml ├── payer-new-payment-request-sample.xml ├── payment-out-payment-request-sample.xml ├── payment-request-sample-with-symbols.xml ├── payment-request-sample.xml ├── payment-response-basic-error-sample.xml ├── payment-response-dcc-info.xml ├── payment-response-fraud-no-rules.xml ├── payment-response-fraud.xml ├── payment-response-full-error-sample.xml ├── payment-response-sample-unknown-element.xml ├── payment-response-sample.xml ├── rebate-payment-request-sample.xml ├── receipt-in-otb-payment-request-sample.xml ├── receipt-in-payment-request-sample.xml ├── release-payment-request-sample.xml ├── settle-payment-request-sample.xml ├── storedcard-dccrate-request.xml └── void-payment-request-sample.xml /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | vendor/ 3 | .vagrant/ 4 | composer.phar 5 | Vagrantfile 6 | vm-config/ 7 | phpunit.phar 8 | composer.lock 9 | adhoc/ 10 | .project 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to the SDK will be documented in this file. 3 | 4 | ## [1.2.2] 5 | - Updated hash for Mobile-Auth to support Google Pay. 6 | 7 | ## [1.2.1] 8 | - Updated requirements. 9 | 10 | ## [1.2] 11 | - Added Card Storage: Receipt-in, Payment-out, Payer-New, Payer-Edit, Card-new, Card-update, Card-delete, Verify Enrolled Card, DCC Rate Lookup, DCC + Auth, Receipt in OTB, Updated default endpoint. 12 | 13 | ## [1.1] 14 | - Added mobile payment type (auth-mobile) and relevant fields (mobile, token) to payment request. 15 | - Added settle, void, rebate, OTB, credit, hold and release payment types. 16 | 17 | ## [1.0.1] 18 | - Minor Fixes 19 | 20 | ## [1.0] 21 | - Initial Release 22 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Pay and Shop Ltd t/a Realex Payments 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "realexpayments/rxp-remote-php", 3 | "type": "library", 4 | "description": "SDK to send requests and parse responses from Realex Payments using Remote", 5 | "keywords": [ 6 | "realex", 7 | "payments", 8 | "remote" 9 | ], 10 | "authors": [ 11 | { 12 | "name": "Realex Payments", 13 | "homepage": "https://www.realexpayments.com/" 14 | }, 15 | { 16 | "name": "Victor Palomares", 17 | "homepage": "http://www.softwaredesign.ie", 18 | "role": "Developer" 19 | } 20 | ], 21 | "license": "MIT", 22 | "require": { 23 | "php": ">=5.3.9", 24 | "hafriedlander/phockito": "1.0.*", 25 | "apache/log4php": "2.3.*", 26 | "symfony/serializer": "2.7.*", 27 | "symfony/property-access": "2.7.*" 28 | }, 29 | "autoload": { 30 | "psr-4": { 31 | "com\\realexpayments\\remote\\sdk\\": [ 32 | "src/main/php/com-realexpayments-remote-sdk", 33 | "test/main/php/com-realexpayments-remote-sdk" 34 | ] 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/EnumBase.php: -------------------------------------------------------------------------------- 1 | isValidValue( $value ) ) { 31 | throw new \InvalidArgumentException(); 32 | }*/ 33 | $this->value = $value; 34 | } 35 | 36 | /** 37 | * @return string 38 | */ 39 | final public function __toString() { 40 | return $this->value; 41 | } 42 | 43 | /** 44 | * @param string $value 45 | * 46 | * @return bool 47 | */ 48 | public static function isValidValue( $value ) { 49 | $c = new ReflectionClass( get_called_class() ); 50 | if ( in_array( $value, $c->getConstants() ) ) { 51 | return true; 52 | } 53 | 54 | return false; 55 | } 56 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/RXPLogger.php: -------------------------------------------------------------------------------- 1 | errorCode = $errorCode; 45 | $this->orderId = $orderId; 46 | $this->timeStamp = $timeStamp; 47 | } 48 | 49 | /** 50 | * Getter for error code. 51 | * 52 | * @return string error code 53 | */ 54 | public function getErrorCode() { 55 | return $this->errorCode; 56 | } 57 | 58 | /** 59 | * Get the order Id of the request which generated this exception. 60 | * 61 | * @return string order id 62 | */ 63 | public function getOrderId() { 64 | return $this->orderId; 65 | } 66 | 67 | /** 68 | * Get the timestamp of the request which generated this exception. 69 | * 70 | * @return string timeStamp 71 | */ 72 | public function getTimeStamp() { 73 | return $this->timeStamp; 74 | } 75 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/SafeArrayAccess.php: -------------------------------------------------------------------------------- 1 | array = $array; 15 | $this->default = $default; 16 | } 17 | 18 | public function offsetExists( $offset ) { 19 | return isset( $this->array[ $offset ] ); 20 | } 21 | 22 | public function offsetGet( $offset ) { 23 | return isset( $this->array[ $offset ] ) 24 | ? $this->array[ $offset ] 25 | : $this->default; 26 | } 27 | 28 | public function offsetSet( $offset, $value ) { 29 | $this->array[ $offset ] = $value; 30 | } 31 | 32 | public function offsetUnset( $offset ) { 33 | unset( $this->array[ $offset ] ); 34 | } 35 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/Amount.php: -------------------------------------------------------------------------------- 1 | 12 | * Class representing the Amount in a Realex request. 13 | *

14 | *

15 | * Helper methods are provided (prefixed with 'add') for object creation. 16 | *

17 | *

18 | * Example creation: 19 | *

20 | *

 21 |  * $amount = (new Amount())->addAmount(1001)->addCurrency("EUR");
 22 |  * 

23 | * 24 | * @author vicpada 25 | * 26 | * @package com\realexpayments\remote\sdk\domain 27 | * 28 | */ 29 | class Amount { 30 | 31 | /** 32 | * @var int The amount should be in the smallest unit of the required currency (For example: 2000=20 euro, dollar or pounds). 33 | * 34 | */ 35 | private $amount; 36 | 37 | /** 38 | * @var string The type of curency, e.g. GBP (Sterling) or EUR (Euro) 39 | * 40 | */ 41 | private $currency; 42 | 43 | 44 | /** 45 | * Amount constructor 46 | */ 47 | public function __construct() 48 | { 49 | 50 | } 51 | 52 | /** 53 | * Getter for amount 54 | * 55 | * @return int 56 | */ 57 | public function getAmount() { 58 | return $this->amount; 59 | } 60 | 61 | /** 62 | * Setter for amount 63 | * 64 | * @param int $amount 65 | */ 66 | public function setAmount( $amount ) { 67 | $this->amount = $amount; 68 | } 69 | 70 | /** 71 | * Getter for currency 72 | * 73 | * @return string 74 | */ 75 | public function getCurrency() { 76 | return $this->currency; 77 | } 78 | 79 | /** 80 | * Setter for currency 81 | * 82 | * @param string $currency 83 | */ 84 | public function setCurrency( $currency ) { 85 | $this->currency = $currency; 86 | } 87 | 88 | /** 89 | * Helper method for adding a currency 90 | * 91 | * @param string $currency 92 | * @return Amount 93 | */ 94 | public function addCurrency( $currency ) { 95 | $this->currency = $currency; 96 | 97 | return $this; 98 | } 99 | 100 | /** 101 | * Helper method for adding an amount 102 | * 103 | * @param int $amount 104 | * 105 | * @return Amount 106 | */ 107 | public function addAmount( $amount ) { 108 | $this->amount = $amount; 109 | 110 | return $this; 111 | } 112 | 113 | public static function GetClassName() { 114 | return __CLASS__; 115 | } 116 | 117 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/CVN.php: -------------------------------------------------------------------------------- 1 | 11 | * Class representing the card verification details. 12 | *

13 | *

14 | * Helper methods are provided (prefixed with 'add') for object creation. 15 | *

16 | *

17 | * Example creation: 18 | *

19 | *

 20 |  * $cvn = (new CVN())->addNumber("123")->addPresenceIndicator(PresenceIndicator::CVN_PRESENT);
 21 |  * 

22 | * 23 | * @author vicpada 24 | * 25 | */ 26 | class CVN { 27 | 28 | 29 | /** 30 | * A three-digit number on the reverse of the card. It is called the CVC for VISA and the CVV2 for MasterCard. 31 | * For an AMEX card, it is a four digit number. 32 | * 33 | * @var string The number 34 | * 35 | */ 36 | private $number; 37 | 38 | 39 | /** 40 | *

41 | * Presence indicator. 4 values are permitted: 42 | *

    43 | *
  1. cvn present
  2. 44 | *
  3. cvn illegible
  4. 45 | *
  5. cvn not on card
  6. 46 | *
  7. cvn not requested
  8. 47 | *
48 | *

49 | * 50 | * @var string Presence Indicator 51 | * 52 | */ 53 | private $presenceIndicator; 54 | 55 | 56 | /** 57 | * CVN constructor. 58 | */ 59 | public function __construct() { 60 | } 61 | 62 | public static function GetClassName() { 63 | return __CLASS__; 64 | } 65 | 66 | 67 | /** 68 | * Getter for the verification number. 69 | * 70 | * @return string 71 | */ 72 | public function getNumber() { 73 | return $this->number; 74 | } 75 | 76 | /** 77 | * Setter for the verification number 78 | * 79 | * @param string $number 80 | */ 81 | public function setNumber( $number ) { 82 | $this->number = $number; 83 | } 84 | 85 | /** 86 | * Getter for the presence indicator 87 | * 88 | * @return string 89 | */ 90 | public function getPresenceIndicator() { 91 | return $this->presenceIndicator; 92 | } 93 | 94 | /** 95 | * Setter for the presence indicator 96 | * 97 | * @param string $presenceIndicator 98 | */ 99 | public function setPresenceIndicator( $presenceIndicator ) { 100 | $this->presenceIndicator = $presenceIndicator; 101 | } 102 | 103 | /** 104 | * Helper method to add a verification number. 105 | * 106 | * @param string $number 107 | * 108 | * @return $this 109 | */ 110 | public function addNumber( $number ) { 111 | $this->number = $number; 112 | 113 | return $this; 114 | } 115 | 116 | /** 117 | * Helper method to add a presence indicator. 118 | * 119 | * @param PresenceIndicator|string $presenceIndicator 120 | * 121 | * @return $this 122 | */ 123 | public function addPresenceIndicator( $presenceIndicator ) { 124 | if ( $presenceIndicator instanceof PresenceIndicator ) { 125 | $this->presenceIndicator = $presenceIndicator->getIndicator(); 126 | } else { 127 | $this->presenceIndicator = $presenceIndicator; 128 | } 129 | return $this; 130 | } 131 | 132 | 133 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/CardType.php: -------------------------------------------------------------------------------- 1 | type = $type; 36 | } 37 | 38 | /** 39 | * Getter for the card type 40 | * 41 | * @return string 42 | */ 43 | public function getType() { 44 | return $this->type; 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/Country.php: -------------------------------------------------------------------------------- 1 | 12 | * Domain object representing Country information to be passed to Realex. 13 | *

14 | * 15 | *

16 |  *
17 |  * $country = new Country();
18 |  * country->setCode("IE");
19 |  * country->setName("Ireland");
20 |  *
21 |  * 

22 | * 23 | * @author vicpada 24 | */ 25 | class Country { 26 | 27 | 28 | /** 29 | * @var string The country code. The list of country codes is available 30 | * in the realauth developers guide. 31 | */ 32 | private $code; 33 | 34 | /** 35 | * @var string The country name. 36 | */ 37 | private $name; 38 | 39 | /** 40 | * Country constructor. 41 | */ 42 | public function __construct() { 43 | } 44 | 45 | public static function GetClassName() { 46 | return __CLASS__; 47 | } 48 | 49 | /** 50 | * Getter for code 51 | * 52 | * @return string 53 | */ 54 | public function getCode() { 55 | return $this->code; 56 | } 57 | 58 | /** 59 | * Setter for code 60 | * 61 | * @param string $code 62 | */ 63 | public function setCode( $code ) { 64 | $this->code = $code; 65 | } 66 | 67 | /** 68 | * Getter for name 69 | * 70 | * @return string 71 | */ 72 | public function getName() { 73 | return $this->name; 74 | } 75 | 76 | 77 | /** 78 | * Setter for name 79 | * 80 | * @param string $name 81 | */ 82 | public function setName( $name ) { 83 | $this->name = $name; 84 | } 85 | 86 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/CvnNumber.php: -------------------------------------------------------------------------------- 1 | 12 | * Domain object representing PaymentData CVN number information to be passed to 13 | * Realex Card Storage for Receipt-in transactions. 14 | * Contains the CVN number for the stored card 15 | *

16 | * 17 | *

18 |  *
19 |  * $cvnNumber = new (CvnNumber())
20 |  *      ->addNumber("123");
21 |  *
22 |  * 

23 | * 24 | * @author vicpada 25 | */ 26 | class CvnNumber { 27 | 28 | /** 29 | * @var string A three-digit number on the reverse of the card. It is called the 30 | * CVC for VISA and the CVV2 for MasterCard. For an AMEX card, it is a four digit number. 31 | */ 32 | private $number; 33 | 34 | /** 35 | * CvnNumber constructor. 36 | */ 37 | public function __construct() { 38 | } 39 | 40 | public static function GetClassName() { 41 | return __CLASS__; 42 | } 43 | 44 | /** 45 | * Getter for number 46 | * 47 | * @return string 48 | */ 49 | public function getNumber() { 50 | return $this->number; 51 | } 52 | 53 | /** 54 | * Setter for number 55 | * 56 | * @param string $number 57 | */ 58 | public function setNumber( $number ) { 59 | $this->number = $number; 60 | } 61 | 62 | /** 63 | * Helper method for adding a number 64 | * 65 | * @param string $number 66 | * 67 | * @return CvnNumber 68 | */ 69 | public function addNumber( $number ) { 70 | $this->number = $number; 71 | 72 | return $this; 73 | } 74 | 75 | 76 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/DccInfo.php: -------------------------------------------------------------------------------- 1 | 11 | * Domain object representing DCC information to be passed to Realex. 12 | *

13 | *

14 | *

15 | * Example dcc rate lookup: 16 | *

17 | * 18 | *

 19 |  * $dccInfo = ( new DccInfo() )
 20 |  *  ->addDccProcessor("fexco");
 21 |  * 

22 | *

23 | *

24 | *

25 | * Example auth with dcc information: 26 | *

27 | *

 28 |  *
 29 |  * $dccInfo = ( new DccInfo() )
 30 |  * ->addDccProcessor("fexco")
 31 |  * ->addRate(0.6868)
 32 |  * ->addAmount(13049)
 33 |  * ->addCurrency("GBP");
 34 |  * $request = ( new PaymentRequest() )
 35 |  * ->addMerchantId( "Merchant ID" )
 36 |  * ->addAccount( "internet" )
 37 |  * ->addType( PaymentType::DCC_RATE_LOOKUP )
 38 |  * ->addAmount(100)
 39 |  * ->addCurrency( "EUR" )        
 40 |  * ->addCard( $card )
 41 |  * ->addDccInfo( $dccInfo );
 42 |  *
 43 |  * 

44 | *

45 | */ 46 | class DccInfo { 47 | 48 | /** 49 | * @var string The DCC processor (Currency Conversion Processor) 50 | */ 51 | private $dccProcessor; 52 | 53 | /** 54 | * @var string The type - always "1" 55 | */ 56 | private $type; 57 | 58 | /** 59 | * @var float The rate returned by DCC Info rate lookup request 60 | */ 61 | private $rate; 62 | 63 | /** 64 | * @var string The rate type. Defaulted to S 65 | */ 66 | private $rateType; 67 | 68 | /** 69 | * @var Amount The amount. As returned by DCC Info rate lookup request 70 | */ 71 | private $amount; 72 | 73 | /** 74 | * DccInfo constructor. 75 | */ 76 | public function __construct() { 77 | 78 | // default type to 1 and rate type to "S" 79 | $this->type = "1"; 80 | $this->rateType = "S"; 81 | } 82 | 83 | public static function GetClassName() { 84 | return __CLASS__; 85 | } 86 | 87 | /** 88 | * Getter for dccProcessor 89 | * 90 | * @return string 91 | */ 92 | public function getDccProcessor() { 93 | return $this->dccProcessor; 94 | } 95 | 96 | /** 97 | * Setter for dccProcessor 98 | * 99 | * @param string $dccProcessor 100 | */ 101 | public function setDccProcessor( $dccProcessor ) { 102 | $this->dccProcessor = $dccProcessor; 103 | } 104 | 105 | /** 106 | * Getter for type 107 | * 108 | * @return string 109 | */ 110 | public function getType() { 111 | return $this->type; 112 | } 113 | 114 | /** 115 | * Setter for type 116 | * 117 | * @param string $type 118 | */ 119 | public function setType( $type ) { 120 | $this->type = $type; 121 | } 122 | 123 | /** 124 | * Getter for rate 125 | * 126 | * @return float 127 | */ 128 | public function getRate() { 129 | return $this->rate; 130 | } 131 | 132 | /** 133 | * Setter for rate 134 | * 135 | * @param float $rate 136 | */ 137 | public function setRate( $rate ) { 138 | $this->rate = $rate; 139 | } 140 | 141 | /** 142 | * Getter for rateType 143 | * 144 | * @return string 145 | */ 146 | public function getRateType() { 147 | return $this->rateType; 148 | } 149 | 150 | /** 151 | * Setter for rateType 152 | * 153 | * @param string $rateType 154 | */ 155 | public function setRateType( $rateType ) { 156 | $this->rateType = $rateType; 157 | } 158 | 159 | /** 160 | * Getter for amount 161 | * 162 | * @return Amount 163 | */ 164 | public function getAmount() { 165 | return $this->amount; 166 | } 167 | 168 | /** 169 | * Setter for amount 170 | * 171 | * @param Amount $amount 172 | */ 173 | public function setAmount( $amount ) { 174 | $this->amount = $amount; 175 | } 176 | 177 | 178 | /** 179 | * Helper method for adding a dccProcessor 180 | * 181 | * @param string $dccProcessor 182 | * 183 | * @return DccInfo 184 | */ 185 | public function addDccProcessor( $dccProcessor ) { 186 | $this->dccProcessor = $dccProcessor; 187 | 188 | return $this; 189 | } 190 | 191 | /** 192 | * Helper method for adding a type 193 | * 194 | * @param string $type 195 | * 196 | * @return DccInfo 197 | */ 198 | public function addType( $type ) { 199 | $this->type = $type; 200 | 201 | return $this; 202 | } 203 | 204 | /** 205 | * Helper method for adding a rate 206 | * 207 | * @param float $rate 208 | * 209 | * @return DccInfo 210 | */ 211 | public function addRate( $rate ) { 212 | $this->rate = $rate; 213 | 214 | return $this; 215 | } 216 | 217 | /** 218 | * Helper method for adding a rateType 219 | * 220 | * @param string $rateType 221 | * 222 | * @return DccInfo 223 | */ 224 | public function addRateType( $rateType ) { 225 | $this->rateType = $rateType; 226 | 227 | return $this; 228 | } 229 | 230 | /** 231 | * Helper method for adding a amount 232 | * 233 | * @param integer $amount 234 | * 235 | * @return DccInfo 236 | */ 237 | public function addAmount( $amount ) { 238 | 239 | if ( is_null( $this->amount ) ) { 240 | $this->amount = new Amount(); 241 | $this->amount->addAmount( $amount ); 242 | } else { 243 | $this->amount->addAmount( $amount ); 244 | } 245 | 246 | return $this; 247 | } 248 | 249 | /** 250 | * Helper method for adding a currency 251 | * 252 | * @param string $currency 253 | * 254 | * @return DccInfo 255 | */ 256 | public function addCurrency( $currency ) { 257 | if ( is_null( $this->amount ) ) { 258 | $this->amount = new Amount(); 259 | $this->amount->addCurrency( $currency ); 260 | } else { 261 | $this->amount->addCurrency( $currency ); 262 | } 263 | 264 | return $this; 265 | } 266 | 267 | 268 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/PaymentData.php: -------------------------------------------------------------------------------- 1 | 12 | * Domain object representing PaymentData information to be passed to Realex Card Storage 13 | * for Receipt-in transactions. 14 | * Payment data contains the CVN number for the stored card 15 | *

16 | *

17 | *

18 |  * $paymentData = ( new PaymentData() )
19 |  *    ->addCvnNumber("123") ;
20 |  * 

21 | * 22 | * @author vicpada 23 | */ 24 | class PaymentData { 25 | 26 | /** 27 | * @var CvnNumber A container for the CVN Number 28 | */ 29 | private $cvnNumber; 30 | 31 | /** 32 | * PaymentData constructor. 33 | */ 34 | public function __construct() { 35 | } 36 | 37 | /** 38 | * Getter for cvnNumber 39 | * 40 | * @return CvnNumber 41 | */ 42 | public function getCvnNumber() { 43 | return $this->cvnNumber; 44 | } 45 | 46 | /** 47 | * Setter for cvnNumber 48 | * 49 | * @param CvnNumber $cvnNumber 50 | */ 51 | public function setCvnNumber( $cvnNumber ) { 52 | $this->cvnNumber = $cvnNumber; 53 | } 54 | 55 | /** 56 | * Helper method for adding a cvnNumber 57 | * 58 | * @param CvnNumber|string $cvnNumber 59 | * 60 | * @return PaymentData 61 | */ 62 | public function addCvnNumber( $cvnNumber ) { 63 | 64 | if ( $cvnNumber instanceof CvnNumber ) { 65 | $this->cvnNumber = $cvnNumber; 66 | } else { 67 | if ( is_null( $this->cvnNumber ) ) { 68 | $this->cvnNumber = new CvnNumber(); 69 | } 70 | $this->cvnNumber->addNumber( $cvnNumber ); 71 | } 72 | 73 | return $this; 74 | } 75 | 76 | public static function GetClassName() { 77 | return __CLASS__; 78 | } 79 | 80 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/PhoneNumbers.php: -------------------------------------------------------------------------------- 1 | 11 | * Domain object representing Payer phone numbers information to be passed to Realex. 12 | *

13 | * 14 | *

 15 |  * $phoneNumbers = new PhoneNumbers();
 16 |  * $phoneNumbers->setHomePhoneNumber("+35317285355");
 17 |  * $phoneNumbers->setWorkPhoneNumber("+35317433923");
 18 |  * $phoneNumbers->setFaxPhoneNumber("+35317893248");
 19 |  * $phoneNumbers->setMobilePhoneNumber("+353873748392")
 20 |  *
 21 |  * 

22 | * 23 | * @author vicpada 24 | */ 25 | class PhoneNumbers { 26 | 27 | /** 28 | * @var string home phone number 29 | */ 30 | private $homePhoneNumber; 31 | 32 | /** 33 | * @var string work phone number 34 | */ 35 | private $workPhoneNumber; 36 | 37 | /** 38 | * @var string fax phone number 39 | */ 40 | private $faxPhoneNumber; 41 | 42 | /** 43 | * @var string mobile phone number 44 | */ 45 | private $mobilePhoneNumber; 46 | 47 | /** 48 | * PhoneNumbers constructor. 49 | */ 50 | public function __construct( ) { 51 | } 52 | 53 | public static function GetClassName() { 54 | return __CLASS__; 55 | } 56 | 57 | /** 58 | * Getter for homePhoneNumber 59 | * 60 | * @return string 61 | */ 62 | public function getHomePhoneNumber() { 63 | return $this->homePhoneNumber; 64 | } 65 | 66 | /** 67 | * Setter for homePhoneNumber 68 | * 69 | * @param string $homePhoneNumber 70 | */ 71 | public function setHomePhoneNumber( $homePhoneNumber ) { 72 | $this->homePhoneNumber = $homePhoneNumber; 73 | } 74 | 75 | /** 76 | * Getter for workPhoneNumber 77 | * 78 | * @return string 79 | */ 80 | public function getWorkPhoneNumber() { 81 | return $this->workPhoneNumber; 82 | } 83 | 84 | /** 85 | * Setter for workPhoneNumber 86 | * 87 | * @param string $workPhoneNumber 88 | */ 89 | public function setWorkPhoneNumber( $workPhoneNumber ) { 90 | $this->workPhoneNumber = $workPhoneNumber; 91 | } 92 | 93 | /** 94 | * Getter for faxPhoneNumber 95 | * 96 | * @return string 97 | */ 98 | public function getFaxPhoneNumber() { 99 | return $this->faxPhoneNumber; 100 | } 101 | 102 | /** 103 | * Setter for faxPhoneNumber 104 | * 105 | * @param string $faxPhoneNumber 106 | */ 107 | public function setFaxPhoneNumber( $faxPhoneNumber ) { 108 | $this->faxPhoneNumber = $faxPhoneNumber; 109 | } 110 | 111 | /** 112 | * Getter for mobilePhoneNumber 113 | * 114 | * @return string 115 | */ 116 | public function getMobilePhoneNumber() { 117 | return $this->mobilePhoneNumber; 118 | } 119 | 120 | /** 121 | * Setter for mobilePhoneNumber 122 | * 123 | * @param string $mobilePhoneNumber 124 | */ 125 | public function setMobilePhoneNumber( $mobilePhoneNumber ) { 126 | $this->mobilePhoneNumber = $mobilePhoneNumber; 127 | } 128 | 129 | 130 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/PresenceIndicator.php: -------------------------------------------------------------------------------- 1 | 11 | * Enumeration of the possible presence indicator values. 4 values are permitted: 12 | *
    13 | *
  1. cvn present
  2. 14 | *
  3. cvn illegible
  4. 15 | *
  5. cvn not on card
  6. 16 | *
  7. cvn not requested
  8. 17 | *
18 | *

19 | */ 20 | class PresenceIndicator extends EnumBase{ 21 | 22 | const __default = self::CVN_PRESENT; 23 | 24 | const CVN_PRESENT = "1"; 25 | const CVN_ILLEGIBLE = "2"; 26 | const CVN_NOT_ON_CARD = "3"; 27 | const CVN_NOT_REQUESTED = "4"; 28 | 29 | /** 30 | * @var string The indicator 31 | */ 32 | private $indicator; 33 | 34 | 35 | /** 36 | * Constructor for the enum 37 | * 38 | * @param string $indicator 39 | */ 40 | public function __construct($indicator) 41 | { 42 | parent::__construct($indicator); 43 | $this->indicator = $indicator; 44 | } 45 | 46 | /** 47 | * Getter for the indicator 48 | * 49 | * @return string 50 | */ 51 | public function getIndicator() { 52 | return $this->indicator; 53 | } 54 | 55 | 56 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/iRequest.php: -------------------------------------------------------------------------------- 1 | 17 | * Method returns an XML representation of the interface implementation. 18 | *

19 | * 20 | * @return string 21 | */ 22 | public function toXml(); 23 | 24 | /** 25 | * @param string $xml 26 | * 27 | * @return iRequest 28 | */ 29 | public function fromXml($xml); 30 | 31 | /** 32 | *

33 | * Generates default values for fields such as hash, timestamp and order ID. 34 | *

35 | 36 | * @param string $secret 37 | * 38 | * @return iRequest 39 | */ 40 | public function generateDefaults($secret); 41 | 42 | 43 | /** 44 | *

45 | * Method returns a concrete implementation of the response class from an XML source. 46 | *

47 | * 48 | * @param string $xml 49 | * 50 | * @return iResponse 51 | */ 52 | public function responseFromXml($xml); 53 | 54 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/iResponse.php: -------------------------------------------------------------------------------- 1 | 32 | * Method returns a concrete implementation of the response class from an XML source. 33 | *

34 | * 35 | * @param string $resource 36 | * 37 | * @return iResponse 38 | */ 39 | public function fromXML( $resource ); 40 | 41 | 42 | /** 43 | *

44 | * Method returns an XML representation of the interface's implementing class. 45 | *

46 | * 47 | * @return string 48 | */ 49 | public function toXML(); 50 | 51 | 52 | /** 53 | *

54 | * Validates the hash in the response is correct. Returns true if valid, 55 | * false if not. 56 | *

57 | * 58 | * @param string $secret 59 | * 60 | * @return bool 61 | */ 62 | public function isHashValid($secret); 63 | 64 | 65 | /** 66 | * Returns the result from the response. 67 | * 68 | * @return string 69 | */ 70 | public function getResult(); 71 | 72 | /** 73 | * Returns the message from the response. 74 | * 75 | * @return string 76 | */ 77 | public function getMessage(); 78 | 79 | /** 80 | * Returns the orderId from the response. 81 | * 82 | * @return string 83 | */ 84 | public function getOrderId(); 85 | 86 | /** 87 | * Returns the timestamp from the response. 88 | * 89 | * @return string 90 | */ 91 | public function getTimeStamp(); 92 | 93 | /** 94 | * Returns true if response message has processed successfully. 95 | * 96 | * @return bool 97 | */ 98 | public function isSuccess(); 99 | 100 | 101 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/Address.php: -------------------------------------------------------------------------------- 1 | 9 | * The Address of the customer 10 | *

11 | * 12 | *

13 | * Helper methods are provided (prefixed with 'add') for object creation. 14 | *

15 | *

16 | * $address = (new Address())->addCode("774|123")->addCountry("GB")->addType(new AddressType(AddressType::SHIPPING)); 17 | *

18 | * * 19 | * @package com\realexpayments\remote\sdk\domain\payment 20 | * @author vicpada 21 | */ 22 | class Address { 23 | 24 | 25 | /** 26 | * @var string The address type. Can be shipping or billing. 27 | * 28 | */ 29 | private $type; 30 | 31 | /** 32 | * @var string The ZIP|Postal code of the address. This can be checked (in conjunction with the country) 33 | * against a table of high-risk area codes. This field is used address verification with certain acquirers. 34 | * 35 | */ 36 | private $code; 37 | 38 | /** 39 | * @var string The country of the address. This can be checked against a table of high-risk countries. 40 | * 41 | */ 42 | private $country; 43 | 44 | /** 45 | * Address constructor. 46 | */ 47 | public function __construct() { 48 | } 49 | 50 | public static function GetClassName() { 51 | return __CLASS__; 52 | } 53 | 54 | /** 55 | * @return string Getter for the type 56 | */ 57 | public function getType() { 58 | return $this->type; 59 | } 60 | 61 | /** 62 | * @param string $type 63 | * Setter for the type 64 | */ 65 | public function setType( $type ) { 66 | $this->type = $type; 67 | } 68 | 69 | /** 70 | * @return string Getter for the code. 71 | */ 72 | public function getCode() { 73 | return $this->code; 74 | } 75 | 76 | /** 77 | * @param mixed $code 78 | * Setter for the code 79 | */ 80 | public function setCode( $code ) { 81 | $this->code = $code; 82 | } 83 | 84 | /** 85 | * @return string Getter for the country 86 | */ 87 | public function getCountry() { 88 | return $this->country; 89 | } 90 | 91 | /** 92 | * Setter for the country 93 | * 94 | * @param string $country 95 | */ 96 | public function setCountry( $country ) { 97 | $this->country = $country; 98 | } 99 | 100 | 101 | /** 102 | * Helper method for setting the code 103 | * 104 | * @param string $code 105 | * 106 | * @return $this 107 | */ 108 | public function addCode( $code ) { 109 | $this->code = $code; 110 | 111 | return $this; 112 | } 113 | 114 | 115 | /** 116 | * Helper method for setting the country 117 | * 118 | * @param string $country 119 | * 120 | * @return $this 121 | */ 122 | public function addCountry( $country ) { 123 | $this->country = $country; 124 | 125 | return $this; 126 | } 127 | 128 | 129 | /** 130 | * Helper method for setting the type 131 | * 132 | * @param AddressType|string $type 133 | * 134 | * @return $this 135 | */ 136 | public function addType( $type ) { 137 | if ( $type instanceof AddressType ) { 138 | $this->type = $type->getAddressType(); 139 | } else { 140 | $this->type = $type; 141 | } 142 | 143 | return $this; 144 | } 145 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/AddressType.php: -------------------------------------------------------------------------------- 1 | addressType = $addressType; 35 | } 36 | 37 | /** 38 | * Returns string value for the type 39 | * 40 | * @return string 41 | */ 42 | public function getAddressType() { 43 | return $this->addressType; 44 | } 45 | 46 | 47 | 48 | 49 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/AutoSettle.php: -------------------------------------------------------------------------------- 1 | 10 | * Class representing the AutoSettle flag in a Realex request. If set to TRUE (1), 11 | * then the transaction will be included in today's settlement file. If set to FALSE (0), then the 12 | * transaction will be authorised but not settled. Merchants must manually settle delayed 13 | * transactions within 28 days of authorisation. 14 | *

15 | *

16 | * Helper methods are provided (prefixed with 'add') for object creation. 17 | *

18 | *

19 | * Example creation: 20 | *

21 | *

22 |  * $autoSettle = (new AutoSettle())->addFlag(AutoSettleFlag::TRUE);
23 |  * 

24 | * 25 | * @author vicpada 26 | * 27 | * @package com\realexpayments\remote\sdk\domain\payment 28 | * 29 | */ 30 | class AutoSettle { 31 | 32 | /** 33 | * @var string The AutoSettle flag value. 34 | * 35 | */ 36 | private $flag; 37 | 38 | /** 39 | * AutoSettle constructor. 40 | */ 41 | public function __construct() { 42 | } 43 | 44 | public static function GetClassName() { 45 | return __CLASS__; 46 | } 47 | 48 | /** 49 | * Getter for flag 50 | * 51 | * @return string 52 | */ 53 | public function getFlag() { 54 | return $this->flag; 55 | } 56 | 57 | /** 58 | * Setter for flag 59 | * 60 | * @param string $flag 61 | */ 62 | public function setFlag( $flag ) { 63 | $this->flag = $flag; 64 | } 65 | 66 | /** 67 | * Helper method for adding the flag value 68 | * 69 | * @param string|AutoSettleFlag $flag 70 | * 71 | * @return AutoSettle 72 | */ 73 | public function addFlag( $flag ) { 74 | if ( $flag instanceof AutoSettleFlag ) { 75 | $this->flag = $flag->getFlag(); 76 | } else { 77 | $this->flag = $flag; 78 | } 79 | 80 | return $this; 81 | } 82 | } 83 | 84 | -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/AutoSettleFlag.php: -------------------------------------------------------------------------------- 1 | flag = $flag; 27 | } 28 | 29 | 30 | /** 31 | * Getter for flag 32 | * 33 | * @return string 34 | */ 35 | public function getFlag() { 36 | return $this->flag; 37 | } 38 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/CardIssuer.php: -------------------------------------------------------------------------------- 1 | 10 | * Class representing details of the card holder's bank (if available). 11 | *

12 | * 13 | * @package com\realexpayments\remote\sdk\domain\payment 14 | * @author vicpada 15 | * 16 | */ 17 | class CardIssuer { 18 | 19 | /** 20 | * @var string The Bank Name (e.g. First Data Bank). 21 | * 22 | */ 23 | private $bank; 24 | 25 | /** 26 | * @var string The Bank Country in English (e.g. UNITED STATES). 27 | * 28 | */ 29 | private $country; 30 | 31 | /** 32 | * @var string The country code of the issuing bank (e.g. US). 33 | * 34 | */ 35 | private $countryCode; 36 | 37 | /** 38 | * @var string The region the card was issued (e.g. US) Can be MEA (Middle East/Asia), LAT (Latin America), US (United States), 39 | * EUR (Europe), CAN (Canada), A/P (Asia/Pacific). 40 | * 41 | */ 42 | private $region; 43 | 44 | /** 45 | * Getter for bank 46 | * 47 | * @return string 48 | */ 49 | public function getBank() { 50 | return $this->bank; 51 | } 52 | 53 | /** 54 | * Setter for bank 55 | * 56 | * @param string $bank 57 | */ 58 | public function setBank( $bank ) { 59 | $this->bank = $bank; 60 | } 61 | 62 | /** 63 | * Getter for country 64 | * 65 | * @return string 66 | */ 67 | public function getCountry() { 68 | return $this->country; 69 | } 70 | 71 | /** 72 | * Setter for country 73 | * 74 | * @param string $country 75 | */ 76 | public function setCountry( $country ) { 77 | $this->country = $country; 78 | } 79 | 80 | /** 81 | * Getter for countryCode 82 | * 83 | * @return string 84 | */ 85 | public function getCountryCode() { 86 | return $this->countryCode; 87 | } 88 | 89 | /** 90 | * Setter for countryCode 91 | * 92 | * @param string $countryCode 93 | */ 94 | public function setCountryCode( $countryCode ) { 95 | $this->countryCode = $countryCode; 96 | } 97 | 98 | /** 99 | * Getter for region 100 | * 101 | * @return string 102 | */ 103 | public function getRegion() { 104 | return $this->region; 105 | } 106 | 107 | /** 108 | * Setter for region 109 | * 110 | * @param string $region 111 | */ 112 | public function setRegion( $region ) { 113 | $this->region = $region; 114 | } 115 | 116 | 117 | 118 | 119 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/Comment.php: -------------------------------------------------------------------------------- 1 | 10 | * Class representing a Comment in a Realex request. 11 | *

12 | *

13 | * Helper methods are provided (prefixed with 'add') for object creation. 14 | *

15 | *

16 | * Example creation: 17 | *

18 | *

 19 |  * $comment = (new Comment())->addId(1)->addComment("My Comment");
 20 |  * 

21 | * 22 | * @author vicpada 23 | * 24 | */ 25 | class Comment { 26 | 27 | /** 28 | * @var string A free text comment 29 | * 30 | */ 31 | private $comment; 32 | 33 | /** 34 | * @var int The comment ID (1 or 2) 35 | * 36 | */ 37 | private $id; 38 | 39 | /** 40 | * Comment constructor. 41 | */ 42 | public function __construct() { 43 | } 44 | 45 | 46 | /** 47 | * Helper method for adding a id 48 | * 49 | * @param mixed $id 50 | * 51 | * @return Comment 52 | */ 53 | public function addId( $id ) { 54 | $this->id = $id; 55 | 56 | return $this; 57 | } 58 | 59 | /** 60 | * Helper method for adding a comment 61 | * 62 | * @param mixed $comment 63 | * 64 | * @return Comment 65 | */ 66 | public function addComment( $comment ) { 67 | $this->comment = $comment; 68 | 69 | return $this; 70 | } 71 | 72 | /** 73 | * Getter for comment 74 | * 75 | * @return mixed 76 | */ 77 | public function getComment() { 78 | return $this->comment; 79 | } 80 | 81 | /** 82 | * Setter for comment 83 | * 84 | * @param mixed $comment 85 | */ 86 | public function setComment( $comment ) { 87 | $this->comment = $comment; 88 | } 89 | 90 | /** 91 | * Getter for id 92 | * 93 | * @return mixed 94 | */ 95 | public function getId() { 96 | return $this->id; 97 | } 98 | 99 | /** 100 | * Setter for id 101 | * 102 | * @param mixed $id 103 | */ 104 | public function setId( $id ) { 105 | $this->id = $id; 106 | } 107 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/CommentCollection.php: -------------------------------------------------------------------------------- 1 | comments = array(); 30 | } 31 | 32 | /** 33 | * Getter for comments 34 | * 35 | * @return Comment[] 36 | */ 37 | public function getComments() { 38 | return $this->comments; 39 | } 40 | 41 | /** 42 | * Setter for comments 43 | * 44 | * @param Comment[] $comments 45 | */ 46 | public function setComments( $comments ) { 47 | $this->comments = $comments; 48 | } 49 | 50 | /** 51 | * Get Comment at index 52 | * 53 | * @param $index 54 | * 55 | * @return Comment 56 | */ 57 | public function get( $index ) { 58 | return $this->comments[ $index ]; 59 | } 60 | 61 | 62 | /** 63 | * Set Comment at index 64 | * 65 | * @param $index 66 | * @param Comment $value 67 | */ 68 | public function set( $index, Comment $value ) { 69 | $this->comments[ $index ] = $value; 70 | } 71 | 72 | /** 73 | * Add a new Comment 74 | * 75 | * @param Comment $value 76 | */ 77 | public function add( Comment $value ) { 78 | $this->comments[] = $value; 79 | } 80 | 81 | public function getSize() { 82 | return count( $this->comments ); 83 | } 84 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/FraudFilter.php: -------------------------------------------------------------------------------- 1 | 10 | * Class representing the FraudFilter mode in a Realex request. This optional XML element is used to 11 | * determine to what degree Fraud Filter executes. If the field is not present, Fraud Filter 12 | * will behave in accordance with the RealControl mode configuration. Please note values are case sensitive. 13 | *

14 | *

15 | * Helper methods are provided (prefixed with 'add') for object creation. 16 | *

17 | *

18 | 19 | * 20 | * @author alessandro 21 | * 22 | * @package com\realexpayments\remote\sdk\domain\payment 23 | * 24 | */ 25 | class FraudFilter { 26 | 27 | /** 28 | * @var string The FraudFilter mode value. 29 | * 30 | */ 31 | private $mode; 32 | 33 | /** 34 | * @var string The result of the fraud filter request 35 | * 36 | */ 37 | private $result; 38 | 39 | /** 40 | * @var FraudFilterRuleCollection The list of fraud filter rules. 41 | * 42 | */ 43 | private $rules; 44 | 45 | /** 46 | * Getter for result 47 | * 48 | * @return string 49 | */ 50 | 51 | /** 52 | * FraudFilter constructor. 53 | */ 54 | public function __construct() { 55 | } 56 | 57 | public static function GetClassName() { 58 | return __CLASS__; 59 | } 60 | 61 | /** 62 | * Getter for mode 63 | * 64 | * @return string 65 | */ 66 | public function getMode() { 67 | return $this->mode; 68 | } 69 | 70 | /** 71 | * Setter for mode 72 | * 73 | * @param string $mode 74 | */ 75 | public function setMode( $mode ) { 76 | $this->mode = $mode; 77 | } 78 | 79 | /** 80 | * Helper method for adding the mode value 81 | * 82 | * @param string|FraudFilterMode $mode 83 | * 84 | * @return FraudFilter 85 | */ 86 | public function addMode( $mode ) { 87 | if ( $mode instanceof FraudFilterMode ) { 88 | $this->mode = $mode->getMode(); 89 | } else { 90 | $this->mode = $mode; 91 | } 92 | 93 | return $this; 94 | } 95 | 96 | public function getResult() { 97 | return $this->result; 98 | } 99 | 100 | /** 101 | * Setter for result 102 | * 103 | * @param string $result 104 | * @return FraudFilter 105 | */ 106 | public function addResult( $result ) { 107 | $this->result = $result; 108 | 109 | return $this; 110 | } 111 | 112 | /** 113 | * Setter for result 114 | * 115 | * @param string $result 116 | */ 117 | public function setResult( $result ) { 118 | $this->result = $result; 119 | } 120 | 121 | /** 122 | * Getter for checks 123 | * 124 | * @return FraudFilterRuleCollection 125 | */ 126 | public function getRules() { 127 | return $this->rules; 128 | } 129 | 130 | /** 131 | * Setter for checks 132 | * 133 | * @param FraudFilterRuleCollection $rules 134 | */ 135 | public function setRules( $rules ) { 136 | $this->rules = $rules; 137 | } 138 | 139 | /** 140 | * Setter for checks 141 | * 142 | * @param FraudFilterRuleCollection $rules 143 | * @return FraudFilter 144 | */ 145 | public function addRules( $rules ) { 146 | $this->rules = $rules; 147 | 148 | return $this; 149 | } 150 | 151 | 152 | /** 153 | * The __toString method allows a class to decide how it will react when it is converted to a string. 154 | * 155 | * @return string representation in format of :--;--;... 156 | * @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring 157 | */ 158 | function __toString() { 159 | $result = $this->getResult(); 160 | $result .= ":"; 161 | 162 | $rules = $this->getRules(); 163 | if(is_array($rules)){ 164 | foreach($this->getRules() as $rule) 165 | { 166 | /** 167 | * @var FraudFilterRule $rule 168 | */ 169 | $result .= $rule->getId(); 170 | $result .= "-"; 171 | $result .= $rule->getName(); 172 | $result .= "-"; 173 | $result .= $rule->getAction(); 174 | $result .= ";"; 175 | } 176 | } 177 | 178 | return $result; 179 | } 180 | } 181 | 182 | -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/FraudFilterMode.php: -------------------------------------------------------------------------------- 1 | mode = $mode; 34 | } 35 | 36 | /** 37 | * Get the string value of the Fraud Filter mode 38 | * 39 | * @return string 40 | */ 41 | public function getMode() { 42 | return $this->mode; 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/FraudFilterResult.php: -------------------------------------------------------------------------------- 1 | result = $result; 35 | } 36 | 37 | /** 38 | * Get the string value of the Fraud Filter Result 39 | * 40 | * @return string 41 | */ 42 | public function getMode() { 43 | return $this->result; 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/FraudFilterRule.php: -------------------------------------------------------------------------------- 1 | id; 41 | } 42 | 43 | /** 44 | * Setter for id 45 | * 46 | * @param string $id 47 | */ 48 | public function setId( $id ) { 49 | $this->id = $id; 50 | } 51 | 52 | /** 53 | * Getter for value 54 | * 55 | * @return string 56 | */ 57 | public function getAction() { 58 | return $this->action; 59 | } 60 | 61 | /** 62 | * Setter for value 63 | * 64 | * @param string $action 65 | */ 66 | public function setAction($action ) { 67 | $this->action = $action; 68 | } 69 | 70 | /** 71 | * Setter for name 72 | * 73 | * @param string $name 74 | */ 75 | public function setName( $name ) { 76 | $this->name = $name; 77 | } 78 | 79 | /** 80 | * Getter for name 81 | * 82 | * @return string 83 | */ 84 | public function getName() { 85 | return $this->name; 86 | } 87 | 88 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/FraudFilterRuleCollection.php: -------------------------------------------------------------------------------- 1 | rules = array(); 30 | } 31 | 32 | /** 33 | * Getter for rules 34 | * 35 | * @return FraudFilterRule[] 36 | */ 37 | public function getRules() { 38 | return $this->rules; 39 | } 40 | 41 | /** 42 | * Setter for rules 43 | * 44 | * @param FraudFilterRule[] $rules 45 | */ 46 | public function setRules( $rules ) { 47 | $this->rules = $rules; 48 | } 49 | 50 | /** 51 | * Get FraudFilterRule at index 52 | * 53 | * @param $index 54 | * 55 | * @return FraudFilterRule 56 | */ 57 | public function get( $index ) { 58 | return $this->rules[ $index ]; 59 | } 60 | 61 | 62 | /** 63 | * Set FraudFilterRule at index 64 | * 65 | * @param $index 66 | * @param FraudFilterRule $action 67 | */ 68 | public function set( $index, FraudFilterRule $action ) { 69 | $this->rules[ $index ] = $action; 70 | } 71 | 72 | /** 73 | * Add a new FraudFilterRule 74 | * 75 | * @param FraudFilterRule $value 76 | */ 77 | public function add( FraudFilterRule $value ) { 78 | $this->rules[] = $value; 79 | } 80 | 81 | public function getSize() { 82 | return count( $this->rules ); 83 | } 84 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/Mpi.php: -------------------------------------------------------------------------------- 1 | 9 | * Domain object representing MPI (realmpi) information to be passed to Realex. 10 | * Realmpi is Realex's product to implement card scheme-certified payer authentication via the bank 11 | * and the 3D Secure system (Verified by Visa for Visa, Secure Code for Mastercard and SafeKey for Amex). 12 | *

13 | * 14 | *

 15 |  * $mpi = (new Mpi())
 16 |  * 	->addCavv("cavv")
 17 |  * 	->addXid("xid")
 18 |  * 	->addEci("eci");
 19 |  * 

20 | * 21 | * @author vicpada 22 | * @package com\realexpayments\remote\sdk\domain\payment 23 | * 24 | */ 25 | class Mpi { 26 | 27 | /** 28 | * @var string The CAVV(Visa)/UCAF(Mastercard) if present. 29 | * 30 | */ 31 | private $cavv; 32 | 33 | /** 34 | * @var string The XID. 35 | * 36 | */ 37 | private $xid; 38 | 39 | /** 40 | * The e-commerce indicator. 41 | * 42 | * VisaMCECI 43 | * 44 | * 45 | * 52Fully secure, card holder enrolled 46 | * 47 | * 48 | * 61Merchant secure, card holder not enrolled or attempt ACS server was used 49 | * 50 | * 51 | * 70Transaction not secure 52 | * 53 | *
  • 54 | * 55 | * @var string The e-commerce indicator. 56 | * 57 | */ 58 | private $eci; 59 | 60 | /** 61 | * Mpi constructor. 62 | */ 63 | public function __construct() { 64 | } 65 | 66 | /** 67 | * Getter for cavv 68 | * 69 | * @return string 70 | */ 71 | public function getCavv() { 72 | return $this->cavv; 73 | } 74 | 75 | /** 76 | * Setter for cavv 77 | * 78 | * @param string $cavv 79 | */ 80 | public function setCavv( $cavv ) { 81 | $this->cavv = $cavv; 82 | } 83 | 84 | /** 85 | * Getter for xid 86 | * 87 | * @return string 88 | */ 89 | public function getXid() { 90 | return $this->xid; 91 | } 92 | 93 | /** 94 | * Setter for xid 95 | * 96 | * @param string $xid 97 | */ 98 | public function setXid( $xid ) { 99 | $this->xid = $xid; 100 | } 101 | 102 | /** 103 | * Getter for eci 104 | * 105 | * @return string 106 | */ 107 | public function getEci() { 108 | return $this->eci; 109 | } 110 | 111 | /** 112 | * Setter for eci 113 | * 114 | * @param string $eci 115 | */ 116 | public function setEci( $eci ) { 117 | $this->eci = $eci; 118 | } 119 | 120 | 121 | 122 | /** 123 | * Helper method for adding a cavv 124 | * 125 | * @param string $cavv 126 | * 127 | * @return Mpi 128 | */ 129 | public function addCavv( $cavv ) { 130 | $this->cavv = $cavv; 131 | 132 | return $this; 133 | } 134 | 135 | /** 136 | * Helper method for adding a xid 137 | * 138 | * @param string $xid 139 | * 140 | * @return Mpi 141 | */ 142 | public function addXid( $xid ) { 143 | $this->xid = $xid; 144 | 145 | return $this; 146 | } 147 | 148 | /** 149 | * Helper method for adding a eci 150 | * 151 | * @param string $eci 152 | * 153 | * @return Mpi 154 | */ 155 | public function addEci( $eci ) { 156 | $this->eci = $eci; 157 | 158 | return $this; 159 | } 160 | 161 | 162 | 163 | 164 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/PaymentType.php: -------------------------------------------------------------------------------- 1 | type = $type; 48 | } 49 | 50 | /** 51 | * Get the string value of the payment type 52 | * 53 | * @return string 54 | */ 55 | public function getType() { 56 | return $this->type; 57 | } 58 | 59 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/ReasonCode.php: -------------------------------------------------------------------------------- 1 | type = $type; 35 | } 36 | 37 | /** 38 | * Get the string value of the payment type 39 | * 40 | * @return string 41 | */ 42 | public function getType() { 43 | return $this->type; 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/Recurring.php: -------------------------------------------------------------------------------- 1 | 11 | * If you are configured for recurring/continuous authority transactions, you must set the recurring values. 12 | *

    13 | * 14 | *

    15 | * Helper methods are provided (prefixed with 'add') for object creation. 16 | *

    17 | *

    18 | * $recurring = (new Recurring()) 19 | * ->addFlag(RecurringFlag::ONE); 20 | * 21 | * $recurring = (new Recurring()) 22 | * ->addSequence(RecurringSequence::FIRST) 23 | * ->addType(RecurringType::FIXED); 24 | * 25 | * @author vicpada 26 | * @package com\realexpayments\remote\sdk\domain\payment 27 | * 28 | */ 29 | class Recurring { 30 | 31 | /** 32 | * @var string Type can be either fixed or variable depending on whether you will be changing the amounts or not. 33 | * 34 | */ 35 | private $type; 36 | 37 | /** 38 | * @var string The recurring sequence. Must be first for the first transaction for this card, 39 | * subsequent for transactions after that, and last for the final transaction of the set. 40 | * Only supported by some acquirers. 41 | * 42 | */ 43 | private $sequence; 44 | 45 | /** 46 | * @var string The recurring flag. Optional field taking values 0, 1 or 2. 47 | * 48 | */ 49 | private $flag; 50 | 51 | /** 52 | * Recurring constructor. 53 | */ 54 | public function __construct() { 55 | } 56 | 57 | /** 58 | * Getter for type 59 | * 60 | * @return string 61 | */ 62 | public function getType() { 63 | return $this->type; 64 | } 65 | 66 | /** 67 | * Setter for type 68 | * 69 | * @param string $type 70 | */ 71 | public function setType( $type ) { 72 | $this->type = $type; 73 | } 74 | 75 | /** 76 | * Getter for sequence 77 | * 78 | * @return string 79 | */ 80 | public function getSequence() { 81 | return $this->sequence; 82 | } 83 | 84 | /** 85 | * Setter for sequence 86 | * 87 | * @param string $sequence 88 | */ 89 | public function setSequence( $sequence ) { 90 | $this->sequence = $sequence; 91 | } 92 | 93 | /** 94 | * Getter for flag 95 | * 96 | * @return string 97 | */ 98 | public function getFlag() { 99 | return $this->flag; 100 | } 101 | 102 | /** 103 | * Setter for flag 104 | * 105 | * @param string $flag 106 | */ 107 | public function setFlag( $flag ) { 108 | $this->flag = $flag; 109 | } 110 | 111 | 112 | /** 113 | * Helper method for adding a type 114 | * 115 | * @param RecurringType|string $type 116 | * 117 | * @return Recurring 118 | */ 119 | public function addType( $type ) { 120 | if ( $type instanceof RecurringType ) { 121 | $this->type = $type->getType(); 122 | } else { 123 | $this->type = $type; 124 | } 125 | 126 | return $this; 127 | } 128 | 129 | 130 | /** 131 | * Helper method for adding a sequence 132 | * 133 | * @param RecurringSequence|string $sequence 134 | * 135 | * @return Recurring 136 | */ 137 | public function addSequence( $sequence ) { 138 | if ( $sequence instanceof RecurringSequence ) { 139 | $this->sequence = $sequence->getSequence(); 140 | } else { 141 | $this->sequence = $sequence; 142 | } 143 | 144 | return $this; 145 | } 146 | 147 | /** 148 | * Helper method for adding a flag 149 | * 150 | * @param RecurringFlag|string $flag 151 | * 152 | * @return Recurring 153 | */ 154 | public function addFlag( $flag ) { 155 | if ( $flag instanceof RecurringFlag ) { 156 | $this->flag = $flag->getRecurringFlag(); 157 | } else { 158 | $this->flag = $flag; 159 | } 160 | 161 | return $this; 162 | } 163 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/RecurringFlag.php: -------------------------------------------------------------------------------- 1 | recurringFlag = $recurringFlag; 35 | } 36 | 37 | /** 38 | * Get the string value for the flag 39 | * 40 | * @return string 41 | */ 42 | public function getRecurringFlag() { 43 | return $this->recurringFlag; 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/RecurringSequence.php: -------------------------------------------------------------------------------- 1 | sequence= $sequence; 39 | } 40 | 41 | /** 42 | * Get the string value for the sequence 43 | * 44 | * @return string 45 | */ 46 | public function getSequence() { 47 | return $this->sequence; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/RecurringType.php: -------------------------------------------------------------------------------- 1 | type = $type; 38 | } 39 | 40 | /** 41 | * Get the string value for the type 42 | * 43 | * @return string 44 | */ 45 | public function getType() { 46 | return $this->type; 47 | } 48 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/TssInfo.php: -------------------------------------------------------------------------------- 1 | 10 | * Domain object representing TSS (realscore) information to be passed to Realex. 11 | * Realscore is a real time transaction screening and data checking system to assist a merchant 12 | * with the identification of potentially high-risk transactions. 13 | *

    14 | * 15 | *

     16 |  * $tssInfo = (new TssInfo())
     17 |  *     ->addCustomerNumber("customer number")
     18 |  *     ->addProductId("product ID")
     19 |  *     ->addVariableReference("variable ref")
     20 |  *     ->addCustomerIpAddress("127.0.0.1")
     21 |  *     ->addAddress((new Address())
     22 |  *           ->addType(AddressType::BILLING)
     23 |  *           ->addCode("digitsFromPostcode|digitsFromAddressLineOne")
     24 |  *           ->addCountry("countryCode"))
     25 |  *    ->addAddress((new Address())
     26 |  *           ->addType(AddressType::SHIPPING)
     27 |  *           ->addCode("digitsFromPostcode|digitsFromAddressLineOne")
     28 |  *           ->addCountry("countryCode"));
     29 |  * 

    30 | * 31 | * @author vicpada 32 | * 33 | */ 34 | class TssInfo { 35 | 36 | /** 37 | * @var string The number you assign to the customer. This can allow checking of previous transactions 38 | * by this customer. 39 | * 40 | */ 41 | private $customerNumber; 42 | 43 | /** 44 | * @var string The product code you assign to the product. 45 | * 46 | */ 47 | private $productId; 48 | 49 | /** 50 | * @var string Any reference you also would like to assign to the customer. This can allow checking, 51 | * using realscore, of previous transactions by this customer. 52 | * 53 | */ 54 | private $variableReference; 55 | 56 | /** 57 | * @var string The IP address of the customer. 58 | * 59 | */ 60 | private $customerIpAddress; 61 | 62 | /** 63 | * @var Address[] The address of the customer. 64 | * 65 | */ 66 | private $addresses; 67 | 68 | /** 69 | * Getter for the customer number 70 | * 71 | * @return string 72 | */ 73 | public function getCustomerNumber() { 74 | return $this->customerNumber; 75 | } 76 | 77 | /** 78 | * Getter for the customer number 79 | * 80 | * @param string $customerNumber 81 | */ 82 | public function setCustomerNumber( $customerNumber ) { 83 | $this->customerNumber = $customerNumber; 84 | } 85 | 86 | /** 87 | * Getter for the product id 88 | * 89 | * @return string 90 | */ 91 | public function getProductId() { 92 | return $this->productId; 93 | } 94 | 95 | /** 96 | * Setter for the product id 97 | * 98 | * @param string $productId 99 | */ 100 | public function setProductId( $productId ) { 101 | $this->productId = $productId; 102 | } 103 | 104 | /** 105 | * Getter for the variable reference 106 | * 107 | * @return string 108 | */ 109 | public function getVariableReference() { 110 | return $this->variableReference; 111 | } 112 | 113 | /** 114 | * Setter for the variable refernce 115 | * 116 | * @param string $variableReference 117 | */ 118 | public function setVariableReference( $variableReference ) { 119 | $this->variableReference = $variableReference; 120 | } 121 | 122 | /** 123 | * Getter for the customer ip address 124 | * 125 | * @return string 126 | */ 127 | public function getCustomerIpAddress() { 128 | return $this->customerIpAddress; 129 | } 130 | 131 | /** 132 | * Setter for the customer ip address 133 | * 134 | * @param string $customerIpAddress 135 | */ 136 | public function setCustomerIpAddress( $customerIpAddress ) { 137 | $this->customerIpAddress = $customerIpAddress; 138 | } 139 | 140 | /** 141 | * Getter for addresses 142 | * 143 | * @return Address[] 144 | */ 145 | public function getAddresses() { 146 | return $this->addresses; 147 | } 148 | 149 | /** 150 | * Setter for address list. 151 | * 152 | * @param Address[] $addresses 153 | */ 154 | public function setAddresses( array $addresses ) { 155 | $this->addresses = $addresses; 156 | } 157 | 158 | 159 | /** 160 | * Helper method for adding a customer number. 161 | * 162 | * @param string $customerNumber 163 | * @return $this 164 | */ 165 | public function addCustomerNumber( $customerNumber ) { 166 | $this->customerNumber = $customerNumber; 167 | 168 | return $this; 169 | } 170 | 171 | /** 172 | * Helper method for adding a product ID. 173 | * 174 | * @param string $productId 175 | * @return $this 176 | * 177 | */ 178 | public function addProductId( $productId ) { 179 | $this->productId = $productId; 180 | 181 | return $this; 182 | } 183 | 184 | /** 185 | * Helper method for adding a variable reference. 186 | * 187 | * @param string $variableReference 188 | * @return $this 189 | */ 190 | public function addVariableReference( $variableReference ) { 191 | $this->variableReference = $variableReference; 192 | 193 | return $this; 194 | } 195 | 196 | /** 197 | * Helper method for adding a customer IP address. 198 | * 199 | * @param string $customerIpAddress 200 | * @return $this 201 | */ 202 | public function addCustomerIpAddress( $customerIpAddress ) { 203 | $this->customerIpAddress = $customerIpAddress; 204 | 205 | return $this; 206 | } 207 | 208 | /** 209 | * Helper method for adding an address. 210 | * 211 | * @param Address $address 212 | * @return $this 213 | * 214 | */ 215 | public function addAddress( Address $address ) { 216 | 217 | if ( is_null( $this->addresses ) ) { 218 | $this->addresses = array(); 219 | } 220 | 221 | $this->addresses[] = $address; 222 | 223 | return $this; 224 | } 225 | 226 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/TssResult.php: -------------------------------------------------------------------------------- 1 | result; 36 | } 37 | 38 | /** 39 | * Setter for result 40 | * 41 | * @param string $result 42 | */ 43 | public function setResult( $result ) { 44 | $this->result = $result; 45 | } 46 | 47 | /** 48 | * Getter for checks 49 | * 50 | * @return TssResultCheck[] 51 | */ 52 | public function getChecks() { 53 | return $this->checks; 54 | } 55 | 56 | /** 57 | * Setter for checks 58 | * 59 | * @param TssResultCheck[] $checks 60 | */ 61 | public function setChecks( $checks ) { 62 | $this->checks = $checks; 63 | } 64 | 65 | /** 66 | * The __toString method allows a class to decide how it will react when it is converted to a string. 67 | * 68 | * @return string representation in format of :-;-;... 69 | * @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring 70 | */ 71 | function __toString() { 72 | $result = $this->getResult(); 73 | $result .= ":"; 74 | 75 | 76 | foreach($this->getChecks() as $check) 77 | { 78 | $result .= $check->getId(); 79 | $result .= "-"; 80 | $result .= $check->getValue(); 81 | $result .= ";"; 82 | } 83 | 84 | return $result; 85 | } 86 | 87 | 88 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/TssResultCheck.php: -------------------------------------------------------------------------------- 1 | id; 35 | } 36 | 37 | /** 38 | * Setter for id 39 | * 40 | * @param string $id 41 | */ 42 | public function setId( $id ) { 43 | $this->id = $id; 44 | } 45 | 46 | /** 47 | * Getter for value 48 | * 49 | * @return string 50 | */ 51 | public function getValue() { 52 | return $this->value; 53 | } 54 | 55 | /** 56 | * Setter for value 57 | * 58 | * @param string $value 59 | */ 60 | public function setValue( $value ) { 61 | $this->value = $value; 62 | } 63 | 64 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/AddressNormaliser.php: -------------------------------------------------------------------------------- 1 | $object->getType(), 27 | 'code' => $object->getCode(), 28 | 'country' => $object->getCountry() 29 | ), array( NormaliserHelper::GetClassName(), "filter_data" ) ); 30 | } 31 | 32 | /** 33 | * Checks whether the given class is supported for normalization by this normalizer. 34 | * 35 | * @param mixed $data Data to normalize. 36 | * @param string $format The format being (de-)serialized from or into. 37 | * 38 | * @return bool 39 | */ 40 | public function supportsNormalization( $data, $format = null ) { 41 | if ( $format == "xml" && $data instanceof Address ) { 42 | return true; 43 | } 44 | 45 | return false; 46 | } 47 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/AmountNormalizer.php: -------------------------------------------------------------------------------- 1 | $object->getCurrency() == null ? "" : $object->getCurrency(), 32 | '#' => $object->getAmount() 33 | ); 34 | } 35 | 36 | /** 37 | * Checks whether the given class is supported for normalization by this normalizer. 38 | * 39 | * @param mixed $data Data to normalize. 40 | * @param string $format The format being (de-)serialized from or into. 41 | * 42 | * @return bool 43 | */ 44 | public function supportsNormalization( $data, $format = null ) { 45 | if ( $format == "xml" && $data instanceof Amount ) { 46 | return true; 47 | } 48 | return false; 49 | } 50 | 51 | /** 52 | * Denormalizes data back into an object of the given class. 53 | * 54 | * @param mixed $data data to restore 55 | * @param string $class the expected class to instantiate 56 | * @param string $format format the given data was extracted from 57 | * @param array $context options available to the denormalizer 58 | * 59 | * @return object 60 | */ 61 | public function denormalize( $data, $class, $format = null, array $context = array() ) { 62 | 63 | if ( is_null( $data ) ) { 64 | return null; 65 | } 66 | 67 | $data = new SafeArrayAccess( $data ); 68 | 69 | $amount = new Amount(); 70 | $amount->addAmount( $data['#'] ); 71 | $amount->addCurrency( $data['@currency'] ); 72 | 73 | return $amount; 74 | } 75 | 76 | /** 77 | * Checks whether the given class is supported for denormalization by this normalizer. 78 | * 79 | * @param mixed $data Data to denormalize from. 80 | * @param string $type The class to which the data should be denormalized. 81 | * @param string $format The format being deserialized from. 82 | * 83 | * @return bool 84 | */ 85 | public function supportsDenormalization( $data, $type, $format = null ) { 86 | if ( $format == "xml" && $type == Amount::GetClassName()) { 87 | return true; 88 | } 89 | return false; 90 | } 91 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/AutoSettleNormalizer.php: -------------------------------------------------------------------------------- 1 | getFlag() ) ) { 27 | return array(); 28 | } 29 | 30 | return array( 31 | '@flag' => $object->getFlag() 32 | ); 33 | } 34 | 35 | /** 36 | * Checks whether the given class is supported for normalization by this normalizer. 37 | * 38 | * @param mixed $data Data to normalize. 39 | * @param string $format The format being (de-)serialized from or into. 40 | * 41 | * @return bool 42 | */ 43 | public function supportsNormalization( $data, $format = null ) { 44 | if ( $format == "xml" && $data instanceof AutoSettle ) { 45 | return true; 46 | } 47 | return false; 48 | } 49 | 50 | /** 51 | * Denormalizes data back into an object of the given class. 52 | * 53 | * @param mixed $data data to restore 54 | * @param string $class the expected class to instantiate 55 | * @param string $format format the given data was extracted from 56 | * @param array $context options available to the denormalizer 57 | * 58 | * @return object 59 | */ 60 | public function denormalize( $data, $class, $format = null, array $context = array() ) { 61 | if ( is_null( $data ) ) { 62 | return null; 63 | } 64 | 65 | $data = new SafeArrayAccess( $data ); 66 | 67 | $autoSettle = new AutoSettle(); 68 | 69 | $autoSettle->setFlag($data['@flag']); 70 | 71 | return $autoSettle; 72 | } 73 | 74 | /** 75 | * Checks whether the given class is supported for denormalization by this normalizer. 76 | * 77 | * @param mixed $data Data to denormalize from. 78 | * @param string $type The class to which the data should be denormalized. 79 | * @param string $format The format being deserialized from. 80 | * 81 | * @return bool 82 | */ 83 | public function supportsDenormalization( $data, $type, $format = null ) { 84 | if ( $format == "xml" && $type == AutoSettle::GetClassName()) { 85 | return true; 86 | } 87 | return false; 88 | } 89 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/CardNormaliser.php: -------------------------------------------------------------------------------- 1 | $object->getNumber(), 36 | 'expdate' => $object->getExpiryDate(), 37 | 'chname' => $object->getCardHolderName(), 38 | 'type' => $object->getType(), 39 | 'issueno' => $object->getIssueNumber(), 40 | 'ref' => $object->getReference(), 41 | 'payerref' => $object->getPayerReference(), 42 | 'cvn' => $object->getCvn(), 43 | ), array( NormaliserHelper::GetClassName(), "filter_data" ) ); 44 | } 45 | 46 | /** 47 | * Checks whether the given class is supported for normalization by this normalizer. 48 | * 49 | * @param mixed $data Data to normalize. 50 | * @param string $format The format being (de-)serialized from or into. 51 | * 52 | * @return bool 53 | */ 54 | public function supportsNormalization( $data, $format = null ) { 55 | if ( $format == "xml" && $data instanceof Card ) { 56 | return true; 57 | } 58 | 59 | return false; 60 | } 61 | 62 | /** 63 | * Denormalizes data back into an object of the given class. 64 | * 65 | * @param mixed $data data to restore 66 | * @param string $class the expected class to instantiate 67 | * @param string $format format the given data was extracted from 68 | * @param array $context options available to the denormalizer 69 | * 70 | * @return object 71 | */ 72 | public function denormalize( $data, $class, $format = null, array $context = array() ) { 73 | if ( is_null( $data ) ) { 74 | return null; 75 | } 76 | 77 | $this->format = $format; 78 | $this->context = $context; 79 | 80 | $data = new SafeArrayAccess( $data ); 81 | 82 | $card = new Card(); 83 | 84 | $card->addNumber( $data['number'] ) 85 | ->addExpiryDate( $data['expdate'] ) 86 | ->addCardHolderName( $data['chname'] ) 87 | ->addType( $data['type'] ) 88 | ->addIssueNumber( $data['issueno'] ) 89 | ->addReference($data['ref'] ) 90 | ->addPayerReference($data['payerref']); 91 | 92 | $cvn = $this->denormaliseCVN( $data ); 93 | $card->setCvn( $cvn ); 94 | 95 | return $card; 96 | } 97 | 98 | /** 99 | * Checks whether the given class is supported for denormalization by this normalizer. 100 | * 101 | * @param mixed $data Data to denormalize from. 102 | * @param string $type The class to which the data should be denormalized. 103 | * @param string $format The format being deserialized from. 104 | * 105 | * @return bool 106 | */ 107 | public function supportsDenormalization( $data, $type, $format = null ) { 108 | if ( $format == "xml" && $type == Card::GetClassName() ) { 109 | return true; 110 | } 111 | 112 | return false; 113 | } 114 | 115 | private function denormaliseCVN( $data ) { 116 | return $this->serializer->denormalize( $data['cvn'], Cvn::GetClassName(), $this->format, $this->context ); 117 | } 118 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/CommentsNormalizer.php: -------------------------------------------------------------------------------- 1 | $object->getId(), 27 | '#' => $object->getComment() 28 | ); 29 | } 30 | 31 | /** 32 | * Checks whether the given class is supported for normalization by this normalizer. 33 | * 34 | * @param mixed $data Data to normalize. 35 | * @param string $format The format being (de-)serialized from or into. 36 | * 37 | * @return bool 38 | */ 39 | public function supportsNormalization( $data, $format = null ) { 40 | if ( $format == "xml" && $data instanceof Comment ) { 41 | return true; 42 | } 43 | 44 | return false; 45 | } 46 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/CountryNormalizer.php: -------------------------------------------------------------------------------- 1 | $object->getCode(), 29 | '#' => $object->getName() 30 | ), array( NormaliserHelper::GetClassName(), "filter_data" ) ); 31 | } 32 | 33 | /** 34 | * Checks whether the given class is supported for normalization by this normalizer. 35 | * 36 | * @param mixed $data Data to normalize. 37 | * @param string $format The format being (de-)serialized from or into. 38 | * 39 | * @return bool 40 | */ 41 | public function supportsNormalization( $data, $format = null ) { 42 | if ( $format == "xml" && $data instanceof Country ) { 43 | return true; 44 | } 45 | 46 | return false; 47 | } 48 | 49 | /** 50 | * Denormalizes data back into an object of the given class. 51 | * 52 | * @param mixed $data data to restore 53 | * @param string $class the expected class to instantiate 54 | * @param string $format format the given data was extracted from 55 | * @param array $context options available to the denormalizer 56 | * 57 | * @return object 58 | */ 59 | public function denormalize( $data, $class, $format = null, array $context = array() ) { 60 | if ( is_null( $data ) ) { 61 | return null; 62 | } 63 | 64 | $data = new SafeArrayAccess( $data ); 65 | 66 | $country = new Country(); 67 | $country->setCode($data['@code']); 68 | $country->setName($data['#']); 69 | 70 | return $country; 71 | } 72 | 73 | /** 74 | * Checks whether the given class is supported for denormalization by this normalizer. 75 | * 76 | * @param mixed $data Data to denormalize from. 77 | * @param string $type The class to which the data should be denormalized. 78 | * @param string $format The format being deserialized from. 79 | * 80 | * @return bool 81 | */ 82 | public function supportsDenormalization( $data, $type, $format = null ) { 83 | if ( $format == "xml" && $type == Country::GetClassName() ) { 84 | return true; 85 | } 86 | 87 | return false; 88 | } 89 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/CvnNormaliser.php: -------------------------------------------------------------------------------- 1 | $object->getNumber(), 30 | 'presind' => $object->getPresenceIndicator() 31 | 32 | ), array( NormaliserHelper::GetClassName(), "filter_data" ) ); 33 | } 34 | 35 | /** 36 | * Checks whether the given class is supported for normalization by this normalizer. 37 | * 38 | * @param mixed $data Data to normalize. 39 | * @param string $format The format being (de-)serialized from or into. 40 | * 41 | * @return bool 42 | */ 43 | public function supportsNormalization( $data, $format = null ) { 44 | if ( $format == "xml" && $data instanceof Cvn ) { 45 | return true; 46 | } 47 | return false; 48 | } 49 | 50 | /** 51 | * Denormalizes data back into an object of the given class. 52 | * 53 | * @param mixed $data data to restore 54 | * @param string $class the expected class to instantiate 55 | * @param string $format format the given data was extracted from 56 | * @param array $context options available to the denormalizer 57 | * 58 | * @return object 59 | */ 60 | public function denormalize( $data, $class, $format = null, array $context = array() ) { 61 | if ( is_null( $data ) ) { 62 | return null; 63 | } 64 | 65 | $data = new SafeArrayAccess( $data ); 66 | 67 | $cvn = new Cvn(); 68 | 69 | $cvn->addNumber( $data['number'] ) 70 | ->addPresenceIndicator( $data['presind'] ); 71 | 72 | return $cvn; 73 | 74 | } 75 | 76 | /** 77 | * Checks whether the given class is supported for denormalization by this normalizer. 78 | * 79 | * @param mixed $data Data to denormalize from. 80 | * @param string $type The class to which the data should be denormalized. 81 | * @param string $format The format being deserialized from. 82 | * 83 | * @return bool 84 | */ 85 | public function supportsDenormalization( $data, $type, $format = null ) { 86 | if ( $format == "xml" && $type == Cvn::GetClassName()) { 87 | return true; 88 | } 89 | return false; 90 | } 91 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/CvnNumberNormaliser.php: -------------------------------------------------------------------------------- 1 | $object->getNumber(), 29 | ), array( NormaliserHelper::GetClassName(), "filter_data" ) ); 30 | 31 | } 32 | 33 | /** 34 | * Checks whether the given class is supported for normalization by this normalizer. 35 | * 36 | * @param mixed $data Data to normalize. 37 | * @param string $format The format being (de-)serialized from or into. 38 | * 39 | * @return bool 40 | */ 41 | public function supportsNormalization( $data, $format = null ) { 42 | if ( $format == "xml" && $data instanceof CvnNumber ) { 43 | return true; 44 | } 45 | return false; 46 | } 47 | 48 | /** 49 | * Denormalizes data back into an object of the given class. 50 | * 51 | * @param mixed $data data to restore 52 | * @param string $class the expected class to instantiate 53 | * @param string $format format the given data was extracted from 54 | * @param array $context options available to the denormalizer 55 | * 56 | * @return object 57 | */ 58 | public function denormalize( $data, $class, $format = null, array $context = array() ) { 59 | if ( is_null( $data ) ) { 60 | return null; 61 | } 62 | 63 | $data = new SafeArrayAccess( $data ); 64 | 65 | $cvn = new CvnNumber(); 66 | 67 | $cvn->addNumber( $data['number'] ); 68 | 69 | return $cvn; 70 | } 71 | 72 | /** 73 | * Checks whether the given class is supported for denormalization by this normalizer. 74 | * 75 | * @param mixed $data Data to denormalize from. 76 | * @param string $type The class to which the data should be denormalized. 77 | * @param string $format The format being deserialized from. 78 | * 79 | * @return bool 80 | */ 81 | public function supportsDenormalization( $data, $type, $format = null ) { 82 | if ( $format == "xml" && $type == CvnNumber::GetClassName()) { 83 | return true; 84 | } 85 | return false; 86 | } 87 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/DccInfoNormalizer.php: -------------------------------------------------------------------------------- 1 | $object->getDccProcessor(), 31 | 'type' => $object->getType(), 32 | 'rate' => $object->getRate(), 33 | 'ratetype' => $object->getRateType(), 34 | 'amount' => $object->getAmount() 35 | ), array( NormaliserHelper::GetClassName(), "filter_data" ) ); 36 | } 37 | 38 | /** 39 | * Checks whether the given class is supported for normalization by this normalizer. 40 | * 41 | * @param mixed $data Data to normalize. 42 | * @param string $format The format being (de-)serialized from or into. 43 | * 44 | * @return bool 45 | */ 46 | public function supportsNormalization( $data, $format = null ) { 47 | if ( $format == "xml" && $data instanceof DccInfo ) { 48 | return true; 49 | } 50 | 51 | return false; 52 | } 53 | 54 | /** 55 | * Denormalizes data back into an object of the given class. 56 | * 57 | * @param mixed $data data to restore 58 | * @param string $class the expected class to instantiate 59 | * @param string $format format the given data was extracted from 60 | * @param array $context options available to the denormalizer 61 | * 62 | * @return object 63 | */ 64 | public function denormalize( $data, $class, $format = null, array $context = array() ) { 65 | 66 | if ( is_null( $data ) ) { 67 | return null; 68 | } 69 | 70 | $data = new SafeArrayAccess( $data ); 71 | 72 | 73 | $dccInfo = new DccInfo(); 74 | $dccInfo->addDccProcessor( $data['ccp'] ) 75 | ->addType( $data['type'] ) 76 | ->addRate( $data['rate'] ) 77 | ->addRateType( $data['ratetype'] ); 78 | 79 | $amount = $this->serializer->denormalize( $data['amount'], Amount::GetClassName(), $format, $context ); 80 | if ( $amount != null ) { 81 | $dccInfo->setAmount( $amount ); 82 | } 83 | 84 | return $dccInfo; 85 | 86 | } 87 | 88 | /** 89 | * Checks whether the given class is supported for denormalization by this normalizer. 90 | * 91 | * @param mixed $data Data to denormalize from. 92 | * @param string $type The class to which the data should be denormalized. 93 | * @param string $format The format being deserialized from. 94 | * 95 | * @return bool 96 | */ 97 | public function supportsDenormalization( $data, $type, $format = null ) { 98 | if ( $format == "xml" && $type == DccInfo::GetClassName() ) { 99 | return true; 100 | } 101 | 102 | return false; 103 | } 104 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/DccInfoResultNormalizer.php: -------------------------------------------------------------------------------- 1 | $object->getCardHolderCurrency(), 29 | 'cardholderamount' => $object->getCardHolderAmount(), 30 | 'cardholderrate' => $object->getCardHolderRate(), 31 | 'merchantcurrency' => $object->getMerchantCurrency(), 32 | 'merchantamount' => $object->getMerchantAmount(), 33 | 'marginratepercentage' => $object->getMarginRatePercentage(), 34 | 'exchangeratesourcename' => $object->getExchangeRateSourceName(), 35 | 'commissionpercentage' => $object->getCommissionPercentage(), 36 | 'exchangeratesourcetimestamp' => $object->getExchangeRateSourceTimestamp() 37 | ), array( NormaliserHelper::GetClassName(), "filter_data" ) ); 38 | 39 | } 40 | 41 | /** 42 | * Checks whether the given class is supported for normalization by this normalizer. 43 | * 44 | * @param mixed $data Data to normalize. 45 | * @param string $format The format being (de-)serialized from or into. 46 | * 47 | * @return bool 48 | */ 49 | public function supportsNormalization( $data, $format = null ) { 50 | if ( $format == "xml" && $data instanceof DccInfoResult ) { 51 | return true; 52 | } 53 | 54 | return false; 55 | } 56 | 57 | /** 58 | * Denormalizes data back into an object of the given class. 59 | * 60 | * @param mixed $data data to restore 61 | * @param string $class the expected class to instantiate 62 | * @param string $format format the given data was extracted from 63 | * @param array $context options available to the denormalizer 64 | * 65 | * @return object 66 | */ 67 | public function denormalize( $data, $class, $format = null, array $context = array() ) { 68 | if ( is_null( $data ) ) { 69 | return null; 70 | } 71 | 72 | $data = new SafeArrayAccess( $data ); 73 | 74 | $dccInfoResult = new DccInfoResult(); 75 | $dccInfoResult->addCardHolderCurrency( $data['cardholdercurrency'] ) 76 | ->addCardHolderAmount( $data['cardholderamount'] ) 77 | ->addCardHolderRate( $data['cardholderrate'] ) 78 | ->addMerchantCurrency( $data['merchantcurrency'] ) 79 | ->addMerchantAmount( $data['merchantamount'] ) 80 | ->addMarginRatePercentage( $data['marginratepercentage'] ) 81 | ->addExchangeRateSourceName( $data['exchangeratesourcename'] ) 82 | ->addCommissionPercentage( $data['commissionpercentage'] ) 83 | ->addExchangeRateSourceTimestamp( $data['exchangeratesourcetimestamp'] ); 84 | 85 | return $dccInfoResult; 86 | } 87 | 88 | /** 89 | * Checks whether the given class is supported for denormalization by this normalizer. 90 | * 91 | * @param mixed $data Data to denormalize from. 92 | * @param string $type The class to which the data should be denormalized. 93 | * @param string $format The format being deserialized from. 94 | * 95 | * @return bool 96 | */ 97 | public function supportsDenormalization( $data, $type, $format = null ) { 98 | if ( $format == "xml" && $type == DccInfoResult::GetClassName() ) { 99 | return true; 100 | } 101 | 102 | return false; 103 | } 104 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/FraudFilterNormalizer.php: -------------------------------------------------------------------------------- 1 | getMode() ) ) { 30 | return array(); 31 | } 32 | 33 | 34 | return array_filter( array( 35 | '@mode' => $object->getMode(), 36 | ), array( NormaliserHelper::GetClassName(), "filter_data" ) ); 37 | } 38 | 39 | /** 40 | * Checks whether the given class is supported for normalization by this normalizer. 41 | * 42 | * @param mixed $data Data to normalize. 43 | * @param string $format The format being (de-)serialized from or into. 44 | * 45 | * @return bool 46 | */ 47 | public function supportsNormalization( $data, $format = null ) { 48 | if ( $format == "xml" && $data instanceof FraudFilter ) { 49 | return true; 50 | } 51 | return false; 52 | } 53 | 54 | /** 55 | * Denormalizes data back into an object of the given class. 56 | * 57 | * @param mixed $data data to restore 58 | * @param string $class the expected class to instantiate 59 | * @param string $format format the given data was extracted from 60 | * @param array $context options available to the denormalizer 61 | * 62 | * @return object 63 | */ 64 | public function denormalize( $data, $class, $format = null, array $context = array() ) { 65 | if ( is_null( $data ) ) { 66 | return null; 67 | } 68 | 69 | $data = new SafeArrayAccess( $data ); 70 | 71 | $fraudFilter = new FraudFilter(); 72 | 73 | $fraudFilter->addMode($data['@mode']); 74 | 75 | return $fraudFilter; 76 | } 77 | 78 | /** 79 | * Checks whether the given class is supported for denormalization by this normalizer. 80 | * 81 | * @param mixed $data Data to denormalize from. 82 | * @param string $type The class to which the data should be denormalized. 83 | * @param string $format The format being deserialized from. 84 | * 85 | * @return bool 86 | */ 87 | public function supportsDenormalization( $data, $type, $format = null ) { 88 | if ( $format == "xml" && $type == FraudFilter::GetClassName()) { 89 | return true; 90 | } 91 | return false; 92 | } 93 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/FraudFilterRuleCollectionNormalizer.php: -------------------------------------------------------------------------------- 1 | $object->getRules(), 36 | ), array( NormaliserHelper::GetClassName(), "filter_data" ) ); 37 | } 38 | 39 | /** 40 | * Checks whether the given class is supported for normalization by this normalizer. 41 | * 42 | * @param mixed $data Data to normalize. 43 | * @param string $format The format being (de-)serialized from or into. 44 | * 45 | * @return bool 46 | */ 47 | public function supportsNormalization( $data, $format = null ) { 48 | if ( $format == "xml" && $data instanceof FraudFilterRuleCollection ) { 49 | return true; 50 | } 51 | return false; 52 | } 53 | 54 | /** 55 | * Denormalizes data back into an object of the given class. 56 | * 57 | * @param mixed $data data to restore 58 | * @param string $class the expected class to instantiate 59 | * @param string $format format the given data was extracted from 60 | * @param array $context options available to the denormalizer 61 | * 62 | * @return object 63 | */ 64 | public function denormalize( $data, $class, $format = null, array $context = array() ) { 65 | if ( is_null( $data ) ) { 66 | return null; 67 | } 68 | 69 | $data = new SafeArrayAccess( $data ); 70 | 71 | $fraudFilterRuleCollection = new FraudFilterRuleCollection(); 72 | 73 | $fraudFilterRuleCollection->setRules($data['rules']); 74 | 75 | return $fraudFilterRuleCollection; 76 | } 77 | 78 | /** 79 | * Checks whether the given class is supported for denormalization by this normalizer. 80 | * 81 | * @param mixed $data Data to denormalize from. 82 | * @param string $type The class to which the data should be denormalized. 83 | * @param string $format The format being deserialized from. 84 | * 85 | * @return bool 86 | */ 87 | public function supportsDenormalization( $data, $type, $format = null ) { 88 | if ( $format == "xml" && $type == FraudFilterRuleCollection::GetClassName()) { 89 | return true; 90 | } 91 | return false; 92 | } 93 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/FraudFilterRuleNormalizer.php: -------------------------------------------------------------------------------- 1 | $object->getName(), 35 | '@id' => $object->getId(), 36 | 'action' => $object->getAction() 37 | ), array( NormaliserHelper::GetClassName(), "filter_data" ) ); 38 | } 39 | 40 | /** 41 | * Checks whether the given class is supported for normalization by this normalizer. 42 | * 43 | * @param mixed $data Data to normalize. 44 | * @param string $format The format being (de-)serialized from or into. 45 | * 46 | * @return bool 47 | */ 48 | public function supportsNormalization( $data, $format = null ) { 49 | if ( $format == "xml" && $data instanceof FraudFilterRule ) { 50 | return true; 51 | } 52 | return false; 53 | } 54 | 55 | /** 56 | * Denormalizes data back into an object of the given class. 57 | * 58 | * @param mixed $data data to restore 59 | * @param string $class the expected class to instantiate 60 | * @param string $format format the given data was extracted from 61 | * @param array $context options available to the denormalizer 62 | * 63 | * @return object 64 | */ 65 | public function denormalize( $data, $class, $format = null, array $context = array() ) { 66 | if ( is_null( $data ) ) { 67 | return null; 68 | } 69 | 70 | $data = new SafeArrayAccess( $data ); 71 | 72 | $fraudFilterRule = new FraudFilterRule(); 73 | 74 | $fraudFilterRule->setId($data['@id']); 75 | $fraudFilterRule->setName($data['@name']); 76 | $fraudFilterRule->setAction($data['action']); 77 | 78 | return $fraudFilterRule; 79 | } 80 | 81 | /** 82 | * Checks whether the given class is supported for denormalization by this normalizer. 83 | * 84 | * @param mixed $data Data to denormalize from. 85 | * @param string $type The class to which the data should be denormalized. 86 | * @param string $format The format being deserialized from. 87 | * 88 | * @return bool 89 | */ 90 | public function supportsDenormalization( $data, $type, $format = null ) { 91 | if ( $format == "xml" && $type == FraudFilterNormalizer::GetClassName()) { 92 | return true; 93 | } 94 | return false; 95 | } 96 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/PayerAddressNormalizer.php: -------------------------------------------------------------------------------- 1 | $object->getLine1(), 33 | 'line2' => $object->getLine2(), 34 | 'line3' => $object->getLine3(), 35 | 'city' => $object->getCity(), 36 | 'county' => $object->getCounty(), 37 | 'postcode' => $object->getPostcode(), 38 | 'country' => $object->getCountry() 39 | 40 | ), array( NormaliserHelper::GetClassName(), "filter_data" ) ); 41 | } 42 | 43 | /** 44 | * Checks whether the given class is supported for normalization by this normalizer. 45 | * 46 | * @param mixed $data Data to normalize. 47 | * @param string $format The format being (de-)serialized from or into. 48 | * 49 | * @return bool 50 | */ 51 | public function supportsNormalization( $data, $format = null ) { 52 | if ( $format == "xml" && $data instanceof PayerAddress ) { 53 | return true; 54 | } 55 | 56 | return false; 57 | } 58 | 59 | /** 60 | * Denormalizes data back into an object of the given class. 61 | * 62 | * @param mixed $data data to restore 63 | * @param string $class the expected class to instantiate 64 | * @param string $format format the given data was extracted from 65 | * @param array $context options available to the denormalizer 66 | * 67 | * @return object 68 | */ 69 | public function denormalize( $data, $class, $format = null, array $context = array() ) { 70 | if ( is_null( $data ) ) { 71 | return null; 72 | } 73 | 74 | $this->format = $format; 75 | $this->context = $context; 76 | 77 | $data = new SafeArrayAccess( $data ); 78 | 79 | $address = new PayerAddress(); 80 | $address->addLine1($data['line1']) 81 | ->addLine2($data['line2']) 82 | ->addLine3($data['line3']) 83 | ->addCity($data['city']) 84 | ->addCounty($data['county']) 85 | ->addPostcode($data['postcode']); 86 | $address->setCountry( $this->denormalizeCountry($data)); 87 | 88 | return $address; 89 | } 90 | 91 | private function denormalizeCountry( $data ) { 92 | return $this->serializer->denormalize( $data['country'], Country::GetClassName(), $this->format, $this->context ); 93 | } 94 | 95 | /** 96 | * Checks whether the given class is supported for denormalization by this normalizer. 97 | * 98 | * @param mixed $data Data to denormalize from. 99 | * @param string $type The class to which the data should be denormalized. 100 | * @param string $format The format being deserialized from. 101 | * 102 | * @return bool 103 | */ 104 | public function supportsDenormalization( $data, $type, $format = null ) { 105 | if ( $format == "xml" && $type == PayerAddress::GetClassName() ) { 106 | return true; 107 | } 108 | 109 | return false; 110 | } 111 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/PayerNormalizer.php: -------------------------------------------------------------------------------- 1 | getComments(); 36 | if ( is_null( $comments ) || $comments->getSize() == 0 ) { 37 | $hasComments = false; 38 | } else { 39 | $comments = $comments->getComments(); 40 | } 41 | 42 | return array_filter( array( 43 | '@type' => $object->getType(), 44 | '@ref' => $object->getRef(), 45 | 'title' => $object->getTitle(), 46 | 'firstname' => $object->getFirstName(), 47 | 'surname' => $object->getSurname(), 48 | 'company' => $object->getCompany(), 49 | 'address' => $object->getAddress(), 50 | 'phonenumbers' => $object->getPhoneNumbers(), 51 | 'email' => $object->getEmail(), 52 | 'comments' => $hasComments ? array( 'comment' => $comments ) : array(), 53 | 54 | ), array( NormaliserHelper::GetClassName(), "filter_data" ) ); 55 | } 56 | 57 | /** 58 | * Checks whether the given class is supported for normalization by this normalizer. 59 | * 60 | * @param mixed $data Data to normalize. 61 | * @param string $format The format being (de-)serialized from or into. 62 | * 63 | * @return bool 64 | */ 65 | public function supportsNormalization( $data, $format = null ) { 66 | if ( $format == "xml" && $data instanceof Payer ) { 67 | return true; 68 | } 69 | 70 | return false; 71 | } 72 | 73 | /** 74 | * Denormalizes data back into an object of the given class. 75 | * 76 | * @param mixed $data data to restore 77 | * @param string $class the expected class to instantiate 78 | * @param string $format format the given data was extracted from 79 | * @param array $context options available to the denormalizer 80 | * 81 | * @return object 82 | */ 83 | public function denormalize( $data, $class, $format = null, array $context = array() ) { 84 | if ( is_null( $data ) ) { 85 | return null; 86 | } 87 | 88 | $this->format = $format; 89 | $this->context = $context; 90 | 91 | $data = new SafeArrayAccess( $data ); 92 | 93 | $payer = new Payer(); 94 | $payer->addType( $data['@type'] ) 95 | ->addRef( $data['@ref'] ) 96 | ->addTitle( $data['title'] ) 97 | ->addFirstName( $data['firstname'] ) 98 | ->addSurname( $data['surname'] ) 99 | ->addCompany( $data['company'] ) 100 | ->addAddress( $this->denormaliseAddress( $data ) ) 101 | ->addEmail( $data['email'] ); 102 | 103 | $payer->setPhoneNumbers( $this->denormalisePhoneNumbers( $data ) ); 104 | $payer->setComments( $this->denormaliseComments( $data ) ); 105 | 106 | return $payer; 107 | } 108 | 109 | private function denormaliseAddress( $data ) { 110 | return $this->serializer->denormalize( $data['address'], PayerAddress::GetClassName(), $this->format, $this->context ); 111 | } 112 | 113 | private function denormalisePhoneNumbers( $data ) { 114 | return $this->serializer->denormalize( $data['phonenumbers'], PhoneNumbers::GetClassName(), $this->format, $this->context ); 115 | } 116 | 117 | private function denormaliseComments( \ArrayAccess $array ) { 118 | $comments = $array['comments']; 119 | 120 | if ( ! isset( $comments ) ) { 121 | return null; 122 | } 123 | 124 | $comments = new SafeArrayAccess( $comments ); 125 | 126 | $comments = $comments['comment']; 127 | 128 | if ( ! isset( $comments ) ) { 129 | return null; 130 | } 131 | 132 | $commentCollection = new CommentCollection(); 133 | foreach ( $comments as $comment ) { 134 | $commentObject = new Comment(); 135 | $commentObject->addId( $comment["@id"] ) 136 | ->addComment( $comment["#"] ); 137 | 138 | $commentCollection->add( $commentObject ); 139 | } 140 | 141 | return $commentCollection; 142 | } 143 | 144 | /** 145 | * Checks whether the given class is supported for denormalization by this normalizer. 146 | * 147 | * @param mixed $data Data to denormalize from. 148 | * @param string $type The class to which the data should be denormalized. 149 | * @param string $format The format being deserialized from. 150 | * 151 | * @return bool 152 | */ 153 | public function supportsDenormalization( $data, $type, $format = null ) { 154 | if ( $format == "xml" && $type == Payer::GetClassName() ) { 155 | return true; 156 | } 157 | 158 | return false; 159 | } 160 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/PaymentDataNormalizer.php: -------------------------------------------------------------------------------- 1 | $object->getCvnNumber() 32 | ), array( NormaliserHelper::GetClassName(), "filter_data" ) ); 33 | } 34 | 35 | /** 36 | * Checks whether the given class is supported for normalization by this normalizer. 37 | * 38 | * @param mixed $data Data to normalize. 39 | * @param string $format The format being (de-)serialized from or into. 40 | * 41 | * @return bool 42 | */ 43 | public function supportsNormalization( $data, $format = null ) { 44 | if ( $format == "xml" && $data instanceof PaymentData ) { 45 | return true; 46 | } 47 | 48 | return false; 49 | } 50 | 51 | /** 52 | * Denormalizes data back into an object of the given class. 53 | * 54 | * @param mixed $data data to restore 55 | * @param string $class the expected class to instantiate 56 | * @param string $format format the given data was extracted from 57 | * @param array $context options available to the denormalizer 58 | * 59 | * @return object 60 | */ 61 | public function denormalize( $data, $class, $format = null, array $context = array() ) { 62 | if ( is_null( $data ) ) { 63 | return null; 64 | } 65 | 66 | $this->format = $format; 67 | $this->context = $context; 68 | 69 | $data = new SafeArrayAccess( $data ); 70 | 71 | $paymentData = new PaymentData(); 72 | $paymentData->addCvnNumber( $this->denormalizeCvn( $data)); 73 | 74 | return $paymentData; 75 | 76 | } 77 | 78 | private function denormalizeCvn( $data ) { 79 | return $this->serializer->denormalize( $data['cvn'], CvnNumber::GetClassName(), $this->format, $this->context ); 80 | } 81 | 82 | /** 83 | * Checks whether the given class is supported for denormalization by this normalizer. 84 | * 85 | * @param mixed $data Data to denormalize from. 86 | * @param string $type The class to which the data should be denormalized. 87 | * @param string $format The format being deserialized from. 88 | * 89 | * @return bool 90 | */ 91 | public function supportsDenormalization( $data, $type, $format = null ) { 92 | if ( $format == "xml" && $type == PaymentData::GetClassName()) { 93 | return true; 94 | } 95 | return false; 96 | } 97 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/PhoneNumbersNormalizer.php: -------------------------------------------------------------------------------- 1 | $object->getHomePhoneNumber(), 29 | 'work' => $object->getWorkPhoneNumber(), 30 | 'fax' => $object->getFaxPhoneNumber(), 31 | 'mobile' => $object->getMobilePhoneNumber() 32 | ), array( NormaliserHelper::GetClassName(), "filter_data" ) ); 33 | } 34 | 35 | /** 36 | * Checks whether the given class is supported for normalization by this normalizer. 37 | * 38 | * @param mixed $data Data to normalize. 39 | * @param string $format The format being (de-)serialized from or into. 40 | * 41 | * @return bool 42 | */ 43 | public function supportsNormalization( $data, $format = null ) { 44 | if ( $format == "xml" && $data instanceof PhoneNumbers ) { 45 | return true; 46 | } 47 | 48 | return false; 49 | } 50 | 51 | /** 52 | * Denormalizes data back into an object of the given class. 53 | * 54 | * @param mixed $data data to restore 55 | * @param string $class the expected class to instantiate 56 | * @param string $format format the given data was extracted from 57 | * @param array $context options available to the denormalizer 58 | * 59 | * @return object 60 | */ 61 | public function denormalize( $data, $class, $format = null, array $context = array() ) { 62 | if ( is_null( $data ) ) { 63 | return null; 64 | } 65 | 66 | $data = new SafeArrayAccess( $data ); 67 | 68 | $phoneNumbers = new PhoneNumbers(); 69 | $phoneNumbers->setHomePhoneNumber($data['home']); 70 | $phoneNumbers->setWorkPhoneNumber($data['work']); 71 | $phoneNumbers->setFaxPhoneNumber($data['fax']); 72 | $phoneNumbers->setMobilePhoneNumber($data['mobile']); 73 | 74 | return $phoneNumbers; 75 | } 76 | 77 | /** 78 | * Checks whether the given class is supported for denormalization by this normalizer. 79 | * 80 | * @param mixed $data Data to denormalize from. 81 | * @param string $type The class to which the data should be denormalized. 82 | * @param string $format The format being deserialized from. 83 | * 84 | * @return bool 85 | */ 86 | public function supportsDenormalization( $data, $type, $format = null ) { 87 | if ( $format == "xml" && $type == PhoneNumbers::GetClassName() ) { 88 | return true; 89 | } 90 | 91 | return false; 92 | } 93 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/TssCheckNormaliser.php: -------------------------------------------------------------------------------- 1 | $object->getId(), 26 | '#' => $object->getValue() 27 | ); 28 | } 29 | 30 | /** 31 | * Checks whether the given class is supported for normalization by this normalizer. 32 | * 33 | * @param mixed $data Data to normalize. 34 | * @param string $format The format being (de-)serialized from or into. 35 | * 36 | * @return bool 37 | */ 38 | public function supportsNormalization( $data, $format = null ) { 39 | if ( $format == "xml" && $data instanceof TssResultCheck ) { 40 | return true; 41 | } 42 | 43 | return false; 44 | } 45 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/threeDSecure/ThreeDSecure.php: -------------------------------------------------------------------------------- 1 | 10 | * Domain object representing 3D Secure (realmpi) information passed back from Realex. 11 | * Realmpi is a real time card holder verification system to assist a merchant with the 12 | * identification of potentially fraudulent transactions. 13 | *

    14 | * 15 | * @author vicpada 16 | * @package com\realexpayments\remote\sdk\domain\threeDSecure 17 | * 18 | */ 19 | class ThreeDSecure { 20 | 21 | /** 22 | * @var string The outcome of the authentication, required for the authorisation request. 23 | * 24 | */ 25 | private $status; 26 | 27 | /** 28 | * @var string The e-commerce indicator, required for the authorisation request. 29 | * 30 | */ 31 | private $eci; 32 | 33 | /** 34 | * @var string The XID field, required for the authorisation request. 35 | * 36 | */ 37 | private $xid; 38 | 39 | /** 40 | * @var string The CAVV or UCAF, required for the authorisation request. 41 | * 42 | */ 43 | private $cavv; 44 | 45 | /** 46 | * @var string The address of the customer. 47 | * 48 | */ 49 | private $algorithm; 50 | 51 | /** 52 | * ThreeDSecure constructor. 53 | */ 54 | public function __construct() { 55 | } 56 | 57 | /** 58 | * Getter for status 59 | * 60 | * @return string 61 | */ 62 | public function getStatus() { 63 | return $this->status; 64 | } 65 | 66 | /** 67 | * Setter for status 68 | * 69 | * @param string $status 70 | */ 71 | public function setStatus( $status ) { 72 | $this->status = $status; 73 | } 74 | 75 | /** 76 | * Getter for eci 77 | * 78 | * @return string 79 | */ 80 | public function getEci() { 81 | return $this->eci; 82 | } 83 | 84 | /** 85 | * Setter for eci 86 | * 87 | * @param string $eci 88 | */ 89 | public function setEci( $eci ) { 90 | $this->eci = $eci; 91 | } 92 | 93 | /** 94 | * Getter for xid 95 | * 96 | * @return string 97 | */ 98 | public function getXid() { 99 | return $this->xid; 100 | } 101 | 102 | /** 103 | * Setter for xid 104 | * 105 | * @param string $xid 106 | */ 107 | public function setXid( $xid ) { 108 | $this->xid = $xid; 109 | } 110 | 111 | /** 112 | * Getter for cavv 113 | * 114 | * @return string 115 | */ 116 | public function getCavv() { 117 | return $this->cavv; 118 | } 119 | 120 | /** 121 | * Setter for cavv 122 | * 123 | * @param string $cavv 124 | */ 125 | public function setCavv( $cavv ) { 126 | $this->cavv = $cavv; 127 | } 128 | 129 | /** 130 | * Getter for algorithm 131 | * 132 | * @return string 133 | */ 134 | public function getAlgorithm() { 135 | return $this->algorithm; 136 | } 137 | 138 | /** 139 | * Setter for algorithm 140 | * 141 | * @param string $algorithm 142 | */ 143 | public function setAlgorithm( $algorithm ) { 144 | $this->algorithm = $algorithm; 145 | } 146 | 147 | 148 | /** 149 | * Helper method for adding a status 150 | * 151 | * @param string $status 152 | * 153 | * @return ThreeDSecure 154 | */ 155 | public function addStatus( $status ) { 156 | $this->status = $status; 157 | 158 | return $this; 159 | } 160 | 161 | /** 162 | * Helper method for adding a eci 163 | * 164 | * @param string $eci 165 | * 166 | * @return ThreeDSecure 167 | */ 168 | public function addEci( $eci ) { 169 | $this->eci = $eci; 170 | 171 | return $this; 172 | } 173 | 174 | /** 175 | * Helper method for adding a xid 176 | * 177 | * @param string $xid 178 | * 179 | * @return ThreeDSecure 180 | */ 181 | public function addXid( $xid ) { 182 | $this->xid = $xid; 183 | 184 | return $this; 185 | } 186 | 187 | /** 188 | * Helper method for adding a cavv 189 | * 190 | * @param string $cavv 191 | * 192 | * @return ThreeDSecure 193 | */ 194 | public function addCavv( $cavv ) { 195 | $this->cavv = $cavv; 196 | 197 | return $this; 198 | } 199 | 200 | /** 201 | * Helper method for adding a algorithm 202 | * 203 | * @param string $algorithm 204 | * 205 | * @return ThreeDSecure 206 | */ 207 | public function addAlgorithm( $algorithm ) { 208 | $this->algorithm = $algorithm; 209 | 210 | return $this; 211 | } 212 | 213 | 214 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/threeDSecure/ThreeDSecureType.php: -------------------------------------------------------------------------------- 1 | type = $type; 39 | } 40 | 41 | /** 42 | * Get the string value of the ThreeDSecure type 43 | * 44 | * @return string 45 | */ 46 | public function getType() { 47 | return $this->type; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/domain/threeDSecure/normaliser/ThreeDSecureResponseNormalizer.php: -------------------------------------------------------------------------------- 1 | setTimeStamp( $array['@timestamp'] ); 30 | $response->setMerchantId( $array['merchantid'] ); 31 | $response->setAccount( $array['account'] ); 32 | $response->setOrderId( $array['orderid'] ); 33 | $response->setResult( $array['result'] ); 34 | $response->setAuthCode( $array['authcode'] ); 35 | $response->setMessage( $array['message'] ); 36 | $response->setPaymentsReference( $array['pasref'] ); 37 | $response->setTimeTaken( $array['timetaken'] ); 38 | $response->setAuthTimeTaken( $array['authtimetaken'] ); 39 | $response->setPareq( $array['pareq'] ); 40 | $response->setUrl( $array['url'] ); 41 | $response->setEnrolled( $array['enrolled'] ); 42 | $response->setXid( $array['xid'] ); 43 | $response->setThreeDSecure( $this->denormaliseThreeDSecure( $array ) ); 44 | $response->setHash( $array['sha1hash'] ); 45 | 46 | 47 | return $response; 48 | } 49 | 50 | private function denormaliseThreeDSecure( $array ) { 51 | $threedsecureData = $array['threedsecure']; 52 | 53 | 54 | if ( ! isset( $threedsecureData ) || ! is_array( $threedsecureData ) ) { 55 | return null; 56 | } 57 | 58 | $data = new SafeArrayAccess( $threedsecureData ); 59 | 60 | $threeDSecure = new ThreeDSecure(); 61 | 62 | $threeDSecure->addStatus( $data['status'] ) 63 | ->addEci( $data['eci'] ) 64 | ->addXid( $data['xid'] ) 65 | ->addCavv( $data['cavv'] ) 66 | ->addAlgorithm( $data['algorithm'] ); 67 | 68 | return $threeDSecure; 69 | } 70 | 71 | /** 72 | * Checks whether the given class is supported for denormalization by this normalizer. 73 | * 74 | * @param mixed $data Data to denormalize from. 75 | * @param string $type The class to which the data should be denormalized. 76 | * @param string $format The format being deserialized from. 77 | * 78 | * @return bool 79 | */ 80 | public function supportsDenormalization( $data, $type, $format = null ) { 81 | if ( $format == "xml" && $type == ThreeDSecureResponse::GetClassName() ) { 82 | return true; 83 | } 84 | 85 | return false; 86 | } 87 | 88 | /** 89 | * Normalizes an object into a set of arrays/scalars. 90 | * 91 | * @param object $object object to normalize 92 | * @param string $format format the normalization result will be encoded as 93 | * @param array $context Context options for the normalizer 94 | * 95 | * @return array|string|bool|int|float|null 96 | */ 97 | public function normalize( $object, $format = null, array $context = array() ) { 98 | /** @var ThreeDSecureResponse $object */ 99 | 100 | return array_filter( 101 | array( 102 | '@timestamp' => $object->getTimestamp(), 103 | 'merchantid' => $object->getMerchantId(), 104 | 'account' => $object->getAccount(), 105 | 'orderid' => $object->getOrderId(), 106 | 'result' => $object->getResult(), 107 | 'authcode' => $object->getAuthCode(), 108 | 'message' => $object->getMessage(), 109 | 'pasref' => $object->getPaymentsReference(), 110 | 'timetaken' => $object->getTimeTaken(), 111 | 'authtimetaken' => $object->getAuthTimeTaken(), 112 | 'pareq' => $object->getPareq(), 113 | 'url' => $object->getUrl(), 114 | 'enrolled' => $object->getEnrolled(), 115 | 'xid' => $object->getXid(), 116 | 'threedsecure' => $this->normaliseThreedsecure( $object ), 117 | 'sha1hash' => $object->getHash() 118 | ) ); 119 | } 120 | 121 | private function normaliseThreedsecure( ThreeDSecureResponse $response ) { 122 | $threeDSecure = $response->getThreeDSecure(); 123 | if ( is_null( $threeDSecure ) ) { 124 | return array(); 125 | } 126 | 127 | return array_filter( array( 128 | 'status' => $threeDSecure->getStatus(), 129 | 'eci' => $threeDSecure->getEci(), 130 | 'xid' => $threeDSecure->getXid(), 131 | 'cavv' => $threeDSecure->getCavv(), 132 | 'algorithm' => $threeDSecure->getAlgorithm() 133 | ), array( NormaliserHelper::GetClassName(), "filter_data" ) ); 134 | } 135 | 136 | /** 137 | * Checks whether the given class is supported for normalization by this normalizer. 138 | * 139 | * @param mixed $data Data to normalize. 140 | * @param string $format The format being (de-)serialized from or into. 141 | * 142 | * @return bool 143 | */ 144 | public function supportsNormalization( $data, $format = null ) { 145 | if ( $format == "xml" && $data instanceof ThreeDSecureResponse ) { 146 | return true; 147 | } 148 | 149 | return false; 150 | } 151 | 152 | 153 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/http/HttpClient.php: -------------------------------------------------------------------------------- 1 | logger = RXPLogger::getLogger( __CLASS__ ); 37 | } 38 | 39 | /** 40 | * @param HttpRequest $httpRequest 41 | * @param boolean $onlyAllowHttps 42 | * 43 | * @return HttpResponse 44 | */ 45 | public function execute( $httpRequest, $onlyAllowHttps = true ) { 46 | 47 | $url = $httpRequest->getUrl(); 48 | $post = $httpRequest->getMethod() == HttpRequest::METH_POST ? 1 : 0; 49 | $xml = $httpRequest->getBody(); 50 | 51 | $ch = curl_init(); 52 | curl_setopt( $ch, CURLOPT_URL, $url ); 53 | curl_setopt( $ch, CURLOPT_POST, $post ); 54 | curl_setopt( $ch, CURLOPT_USERAGENT, "realex sdk version 0.1" ); 55 | curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); 56 | curl_setopt( $ch, CURLOPT_POSTFIELDS, $xml ); 57 | curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/xml' ) ); 58 | curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT_MS, $this->connectTimeout ); 59 | curl_setopt( $ch, CURLOPT_TIMEOUT_MS, $this->socketTimeout ); 60 | 61 | if ( $onlyAllowHttps === false ) { 62 | curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); 63 | } 64 | 65 | $responseXml = curl_exec( $ch ); 66 | $statusCode = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); 67 | 68 | 69 | $errorNumber = curl_errno( $ch ); 70 | if ( $errorNumber ) { 71 | $this->logger->error( "Exception communicating with Realex. Error number: " . $errorNumber . ". Description: " . curl_error( $ch ) ); 72 | curl_close( $ch ); 73 | throw new RealexException( "Exception communicating with Realex" ); 74 | } 75 | 76 | curl_close( $ch ); 77 | 78 | $response = new HttpResponse(); 79 | $response->setResponseCode( $statusCode ); 80 | $response->setBody( $responseXml ); 81 | 82 | return $response; 83 | } 84 | 85 | /** 86 | * Getter for connectTimeout 87 | * 88 | * @return int 89 | */ 90 | public function getConnectTimeout() { 91 | return $this->connectTimeout; 92 | } 93 | 94 | /** 95 | * Setter for connectTimeout 96 | * 97 | * @param int $connectTimeout 98 | */ 99 | public function setConnectTimeout( $connectTimeout ) { 100 | $this->connectTimeout = $connectTimeout; 101 | } 102 | 103 | /** 104 | * Getter for socketTimeout 105 | * 106 | * @return int 107 | */ 108 | public function getSocketTimeout() { 109 | return $this->socketTimeout; 110 | } 111 | 112 | /** 113 | * Setter for socketTimeout 114 | * 115 | * @param int $socketTimeout 116 | */ 117 | public function setSocketTimeout( $socketTimeout ) { 118 | $this->socketTimeout = $socketTimeout; 119 | } 120 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/http/HttpConfiguration.php: -------------------------------------------------------------------------------- 1 | endpoint = $this::DEFAULT_ENDPOINT; 44 | $this->timeout = $this::DEFAULT_TIMEOUT; 45 | } 46 | 47 | /** 48 | * Get the endpoint/destination for the request. 49 | * 50 | * @return string the end point 51 | */ 52 | public function getEndpoint() { 53 | return $this->endpoint; 54 | } 55 | 56 | /** 57 | * Set the endpoint/destination for the request. 58 | * 59 | * @param string $endpoint 60 | */ 61 | public function setEndpoint( $endpoint ) { 62 | $this->endpoint = $endpoint; 63 | } 64 | 65 | /** 66 | * The timeout for a request to Realex. 67 | * 68 | * @return int timeout 69 | */ 70 | public function getTimeout() { 71 | return $this->timeout; 72 | } 73 | 74 | /** 75 | * Set the timeout, in milli-seconds, for sending a request to Realex. 76 | * 77 | * @param int $timeout 78 | */ 79 | public function setTimeout( $timeout ) { 80 | $this->timeout = $timeout; 81 | } 82 | 83 | /** 84 | * Check is HTTPS the only allowed scheme (protocol) to the endpoint. 85 | * 86 | * @return bool onlyAllowHttps 87 | */ 88 | public function isOnlyAllowHttps() { 89 | return $this->onlyAllowHttps; 90 | } 91 | 92 | /** 93 | * Set whether (true) or not (false) HTTPS is the only allowed scheme (protocol) to the endpoint. 94 | * 95 | * @param bool $onlyAllowHttps the onlyAllowHttps to set 96 | */ 97 | public function setOnlyAllowHttps( $onlyAllowHttps ) { 98 | $this->onlyAllowHttps = $onlyAllowHttps; 99 | } 100 | 101 | /** 102 | * Helper method for adding a endpoint 103 | * 104 | * @param string $endpoint 105 | * 106 | * @return HttpConfiguration 107 | */ 108 | public function addEndpoint( $endpoint ) { 109 | $this->endpoint = $endpoint; 110 | 111 | return $this; 112 | } 113 | 114 | /** 115 | * Helper method for adding a timeout 116 | * 117 | * @param int $timeout 118 | * 119 | * @return HttpConfiguration 120 | */ 121 | public function addTimeout( $timeout ) { 122 | $this->timeout = $timeout; 123 | 124 | return $this; 125 | } 126 | 127 | /** 128 | * Helper method for adding a onlyAllowHttps 129 | * 130 | * @param bool $onlyAllowHttps 131 | * 132 | * @return HttpConfiguration 133 | */ 134 | public function addOnlyAllowHttps( $onlyAllowHttps ) { 135 | $this->onlyAllowHttps = $onlyAllowHttps; 136 | 137 | return $this; 138 | } 139 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/http/HttpRequest.php: -------------------------------------------------------------------------------- 1 | url = $url; 50 | $this->method = $method; 51 | } 52 | 53 | /** 54 | * Getter for url 55 | * 56 | * @return string 57 | */ 58 | public function getUrl() { 59 | return $this->url; 60 | } 61 | 62 | /** 63 | * Setter for url 64 | * 65 | * @param string $url 66 | */ 67 | public function setUrl( $url ) { 68 | $this->url = $url; 69 | } 70 | 71 | /** 72 | * Getter for method 73 | * 74 | * @return string 75 | */ 76 | public function getMethod() { 77 | return $this->method; 78 | } 79 | 80 | /** 81 | * Setter for method 82 | * 83 | * @param string $method 84 | */ 85 | public function setMethod( $method ) { 86 | $this->method = $method; 87 | } 88 | 89 | /** 90 | * Getter for body 91 | * 92 | * @return string 93 | */ 94 | public function getBody() { 95 | return $this->body; 96 | } 97 | 98 | /** 99 | * Setter for body 100 | * 101 | * @param string $body 102 | */ 103 | public function setBody( $body ) { 104 | $this->body = $body; 105 | } 106 | 107 | 108 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/http/HttpResponse.php: -------------------------------------------------------------------------------- 1 | responseCode; 38 | } 39 | 40 | /** 41 | * Setter for responseCode 42 | * 43 | * @param int $responseCode 44 | */ 45 | public function setResponseCode( $responseCode ) { 46 | $this->responseCode = $responseCode; 47 | } 48 | 49 | /** 50 | * Getter for body 51 | * 52 | * @return string 53 | */ 54 | public function getBody() { 55 | return $this->body; 56 | } 57 | 58 | /** 59 | * Setter for body 60 | * 61 | * @param string $body 62 | */ 63 | public function setBody( $body ) { 64 | $this->body = $body; 65 | } 66 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/http/HttpUtils.php: -------------------------------------------------------------------------------- 1 | debug( "Creating HttpClient with simple no pooling/no connection reuse default settings." ); 44 | 45 | $httpClient = new HttpClient(); 46 | $httpClient->setConnectTimeout( $httpConfiguration->getTimeout() ); 47 | $httpClient->setSocketTimeout( $httpConfiguration->getTimeout() ); 48 | 49 | return $httpClient; 50 | } 51 | 52 | /** 53 | * 54 | * Initialises logger if not initialised already 55 | * 56 | */ 57 | private static function getLogger() { 58 | if ( ! self::$logger ) { 59 | self::$logger = RXPLogger::getLogger( __CLASS__ ); 60 | } 61 | } 62 | 63 | /** 64 | * 65 | * Perform the actual send of the message, according to the HttpConfiguration, and get the response. 66 | * This will also check if only HTTPS is allowed, based on the {@link HttpConfiguration}, and will 67 | * throw a {@link RealexException} if HTTP is used when only HTTPS is allowed. A {@link RealexException} 68 | * is also thrown if the response from Realex is not success (ie. if it's not 200 status code). 69 | * 70 | * @param string $xml 71 | * @param HttpClient $httpClient 72 | * @param HttpConfiguration $httpConfiguration * 73 | * 74 | * @return string 75 | */ 76 | public static function sendMessage( $xml, HttpClient $httpClient, HttpConfiguration $httpConfiguration ) { 77 | 78 | self::getLogger(); 79 | 80 | self::$logger->debug( "Setting endpoint of: " . $httpConfiguration->getEndpoint() ); 81 | $httpPost = new HttpRequest( $httpConfiguration->getEndpoint(), HttpRequest::METH_POST ); 82 | $response = null; 83 | 84 | // Confirm protocol is HTTPS (ie. secure) if such is configured 85 | if ( $httpConfiguration->isOnlyAllowHttps() ) { 86 | $scheme = parse_url( $httpPost->getUrl(), PHP_URL_SCHEME ); 87 | if ( ! $scheme || strtolower( $scheme ) != strtolower( self::HTTPS_PROTOCOL ) ) { 88 | self::$logger->error( "Protocol must be " . self::HTTPS_PROTOCOL ); 89 | throw new RealexException( "Protocol must be " . self::HTTPS_PROTOCOL ); 90 | } 91 | 92 | } else { 93 | self::$logger->warn( "Allowed send message over HTTP. This should NEVER be allowed in a production environment." ); 94 | } 95 | 96 | try { 97 | 98 | self::$logger->debug( "Setting entity in POST message." ); 99 | $httpPost->setBody( $xml ); 100 | 101 | self::$logger->debug( "Executing HTTP Post message to: " . $httpPost->getUrl() ); 102 | $response = $httpClient->execute( $httpPost, $httpConfiguration->isOnlyAllowHttps() ); 103 | 104 | self::$logger->debug( "Checking the HTTP response status code." ); 105 | $statusCode = $response->getResponseCode(); 106 | 107 | 108 | if ( $statusCode != 200 ) { 109 | if ( $statusCode == 404 ) { 110 | throw new RealexException( "Exception communicating with Realex" ); 111 | } else { 112 | throw new RealexException( "Unexpected http status code [" . $statusCode . "]" ); 113 | } 114 | } 115 | 116 | self::$logger->debug( "Converting HTTP entity (the xml response) back into a string." ); 117 | $xmlResponse = $response->getBody(); 118 | 119 | return $xmlResponse; 120 | 121 | } catch ( RealexException $e ) { 122 | throw $e; 123 | 124 | } catch ( Exception $e ) { 125 | 126 | self::$logger->error( "Exception communicating with Realex." . $e->getMessage() ); 127 | throw new RealexException( "Exception communicating with Realex", $e ); 128 | } 129 | } 130 | 131 | 132 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/utils/CardValidationUtils.php: -------------------------------------------------------------------------------- 1 | 19 ) { 40 | return false; 41 | } 42 | 43 | /** Perform luhn check **/ 44 | $sum = 0; 45 | $digit = 0; 46 | $addend = 0; 47 | $timesTwo = false; 48 | 49 | for ( $i = $length - 1; $i >= 0; $i -- ) { 50 | $digit = intval( substr( $cardNumber, $i, 1 ) ); 51 | if ( $timesTwo ) { 52 | $addend = $digit * 2; 53 | if ( $addend > 9 ) { 54 | $addend -= 9; 55 | } 56 | } else { 57 | $addend = $digit; 58 | } 59 | $sum += $addend; 60 | $timesTwo = ! $timesTwo; 61 | } 62 | 63 | $modulus = $sum % 10; 64 | 65 | return $modulus == 0; 66 | } 67 | 68 | 69 | /** 70 | * Method to perform a CVV number check. The CVV must be 4 digits for AMEX and 3 digits for 71 | * all other cards. 72 | * 73 | * @param string $cvvNumber 74 | * @param string $cardType 75 | * 76 | * @return bool 77 | */ 78 | public static function performCvvCheck( $cvvNumber, $cardType ) { 79 | 80 | /* If string has alpha characters it is not a CVV number */ 81 | if ( preg_match( "/^\\d+$/", $cvvNumber ) == 0 ) { 82 | return false; 83 | } 84 | 85 | /* Length should be four digits long for AMEX */ 86 | if ( strtolower( $cardType ) == strtolower( CardType::AMEX ) ) { 87 | if ( strlen( $cvvNumber ) != 4 ) { 88 | return false; 89 | } 90 | } /* Otherwise the length should be three digits */ 91 | elseif ( strlen( $cvvNumber ) != 3 ) { 92 | return false; 93 | } 94 | 95 | return true; 96 | } 97 | 98 | /** 99 | * Method to perform an expiry date check. This allows the SDK user to perform basic validation 100 | * on the card number. Should be two digits for the month followed by two digits for the year and 101 | * may not be in the past. Any whitespaces or '-' should be stripped out before validation. 102 | * 103 | * @param string $expiryDate 104 | * 105 | * @return bool 106 | */ 107 | public static function performExpiryDateCheck( $expiryDate ) { 108 | 109 | /* Length should be four digits long */ 110 | if ( strlen( $expiryDate ) != 4 ) { 111 | return false; 112 | } 113 | 114 | $mm = substr( $expiryDate, 0, 2 ); 115 | $yy = substr( $expiryDate, 2, 2 ); 116 | 117 | if ( ! is_numeric( $mm ) || ! is_numeric( $yy ) ) { 118 | return false; 119 | } 120 | 121 | $month = intval( $mm ); 122 | $year = intval( $yy ); 123 | 124 | 125 | // Month range is 1-12 126 | if ( $month < 1 || $month > 12 ) { 127 | return false; 128 | } 129 | 130 | // Date is not in the past 131 | $currentYear = intval( date( "y" ) ); 132 | $currentMonth = intval( date( "m" ) ); 133 | 134 | 135 | if ( $year < ( $currentYear % 100 ) ) { 136 | return false; 137 | } elseif ( $year == ( $currentYear % 100 ) && $month < $currentMonth ) { 138 | return false; 139 | } 140 | 141 | return true; 142 | } 143 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/utils/GenerationUtils.php: -------------------------------------------------------------------------------- 1 | 24 | * Hashing takes a string as input and produces a fixed size number (160 bits for SHA-1 which 25 | * this implementation uses). This number is a hash of the input, and a small change in the 26 | * input results in a substantial change in the output. The functions are thought to be secure 27 | * in the sense that it requires an enormous amount of computing power and time to find a string 28 | * that hashes to the same value. In others words, there's no way to decrypt a secure hash. 29 | * Given the larger key size, this implementation uses SHA-1 which we prefer that you use, but Realex 30 | * has retained compatibilty with MD5 hashing for compatibility with older systems. 31 | *

    32 | *

    33 | * To construct the hash for the remote interface follow this procedure: 34 | * 35 | * Form a string by concatenating the above fields with a period ('.') in the following order 36 | *

    37 | * (TIMESTAMP.MERCHANT_ID.ORDER_ID.AMOUNT.CURRENCY) 38 | *

    39 | * Like so (where a field is empty an empty string "" is used): 40 | *

    41 | * (20120926112654.thestore.ORD453-11.29900.EUR) 42 | *

    43 | * Get the hash of this string (SHA-1 shown below). 44 | *

    45 | * (b3d51ca21db725f9c7f13f8aca9e0e2ec2f32502) 46 | *

    47 | * Create a new string by concatenating this string and your shared secret using a period. 48 | *

    49 | * (b3d51ca21db725f9c7f13f8aca9e0e2ec2f32502.mysecret ) 50 | *

    51 | * Get the hash of this value. This is the value that you send to Realex Payments. 52 | *

    53 | * (3c3cac74f2b783598b99af6e43246529346d95d1) 54 | * 55 | * This method takes the pre-built string of concatenated fields and the secret and returns the 56 | * SHA-1 hash to be placed in the request sent to Realex. 57 | * 58 | * @param string $toHash 59 | * @param string $secret 60 | * 61 | * @return string The hash as a hex string 62 | */ 63 | public static function generateHash( $toHash, $secret ) { 64 | 65 | //first pass hashes the String of required fields 66 | $toHashFirstPass = sha1( $toHash ); 67 | 68 | //second pass takes the first hash, adds the secret and hashes again 69 | $toHashSecondPass = $toHashFirstPass . "." . $secret; 70 | 71 | return sha1( $toHashSecondPass ); 72 | 73 | } 74 | 75 | /** 76 | * Generate the current datetimestamp in the string formaat (YYYYMMDDHHSS) required in a 77 | * request to Realex. 78 | * 79 | * @return string current timestamp in YYYYMMDDHHSS format 80 | */ 81 | public static function generateTimestamp() { 82 | 83 | $date = new DateTime(); 84 | 85 | return $date->format( "YmdHis" ); 86 | 87 | } 88 | 89 | /** 90 | * Order Id for a initial request should be unique per client ID. This method generates a unique 91 | * order Id using the PHP GUID function and then converts it to base64 to shorten the length to 22 92 | * characters. Order Id for a subsequent request (void, rebate, settle etc.) should use the 93 | * order Id of the initial request. 94 | * 95 | * * the order ID uses the PHP GUID (globally unique identifier) so in theory it may not 96 | * be unique but the odds of this are extremely remote (see 97 | * 98 | * https://en.wikipedia.org/wiki/Globally_unique_identifier) 99 | * 100 | */ 101 | public static function generateOrderId() { 102 | 103 | $uuid = self::getGuid(); 104 | $mostSignificantBits = substr( $uuid, 0, 8 ); 105 | $leastSignificantBits = substr( $uuid, 23, 8 ); 106 | 107 | 108 | return substr( base64_encode( $mostSignificantBits . $leastSignificantBits ), 0, 22 ); 109 | } 110 | 111 | 112 | private static function getGuid() { 113 | 114 | self::pauseExecution(); 115 | 116 | if ( function_exists( 'com_create_guid' ) ) { 117 | return trim( com_create_guid(), '{}' ); 118 | } else { 119 | 120 | mt_srand( (double) microtime() * 10000 );//optional for php 4.2.0 and up. 121 | $charId = strtoupper( md5( uniqid( rand(), true ) ) ); 122 | $hyphen = chr( 45 );// "-" 123 | $uuid = chr( 123 )// "{" 124 | . substr( $charId, 0, 8 ) . $hyphen 125 | . substr( $charId, 8, 4 ) . $hyphen 126 | . substr( $charId, 12, 4 ) . $hyphen 127 | . substr( $charId, 16, 4 ) . $hyphen 128 | . substr( $charId, 20, 12 ) 129 | . chr( 125 );// "}" 130 | return $uuid; 131 | } 132 | 133 | } 134 | 135 | private static function pauseExecution() { 136 | // pause the execution for 100 milliseconds to avoid name collission 137 | // in case many ids are generated in one go 138 | usleep( 100000 ); 139 | } 140 | 141 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/utils/MessageType.php: -------------------------------------------------------------------------------- 1 | type; 27 | } 28 | 29 | /** 30 | * MessageType constructor. 31 | * 32 | * @param string $type 33 | */ 34 | public function __construct( $type ) { 35 | parent::__construct($type); 36 | $this->type = $type; 37 | } 38 | 39 | 40 | } -------------------------------------------------------------------------------- /src/main/php/com-realexpayments-remote-sdk/utils/NormaliserHelper.php: -------------------------------------------------------------------------------- 1 | true if the response contains a result code representing success. 29 | * 30 | * @param iResponse $response 31 | * 32 | * @return bool 33 | */ 34 | public static function isSuccess( iResponse $response ) { 35 | 36 | return iResponse::RESULT_CODE_SUCCESS == $response->getResult(); 37 | } 38 | 39 | 40 | /** 41 | *

    42 | * Realex responses can be basic or full. A basic response indicates the request could not 43 | * be processed. In this case a {@link RealexServerException} will be thrown by the SDK containing the 44 | * result code and message from the response. 45 | *

    46 | * 47 | *

    48 | * A full response indicates the request could be processed and the response object will return fully populated. 49 | *

    50 | * 51 | *

    52 | * Please note, full responses may still contain errors e.g. Bank errors (1xx). The result code should be 53 | * checked for success. For example a full response with a result code of 101 will not throw an exception and will return 54 | * a fully populated response object. 55 | *

    56 | * 57 | * @param string $result 58 | * 59 | * @return bool 60 | */ 61 | public static function isBasicResponse( $result ) { 62 | self::Initialise(); 63 | 64 | $inErrorRange = false; 65 | 66 | try { 67 | $initialNumber = intval( substr( $result, 0, 1 ) ); 68 | $inErrorRange = $initialNumber >= iResponse::RESULT_CODE_PREFIX_ERROR_RESPONSE_START; 69 | } catch ( \Exception $e ) { 70 | self::$logger->error( "Error parsing result " . $result, $e ); 71 | throw new RealexException("Error parsing result.", $e); 72 | } 73 | 74 | return $inErrorRange; 75 | } 76 | 77 | private static function Initialise() { 78 | if ( self::$initialised ) { 79 | return; 80 | } 81 | 82 | self::$logger = RXPLogger::getLogger( __CLASS__ ); 83 | 84 | self::$initialised = true; 85 | } 86 | } -------------------------------------------------------------------------------- /test/main/php/com-realexpayments-remote-sdk/domain/payment/CardTest.php: -------------------------------------------------------------------------------- 1 | setNumber("1234567890ABCDEF"); 14 | 15 | $expectedResult = "123456******CDEF"; 16 | $result= $card->displayFirstSixLastFour(); 17 | 18 | $this->assertTrue($expectedResult === $result,"Results are not as expected"); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/main/php/com-realexpayments-remote-sdk/domain/threeDSecure/ThreeDSecureRequestTest.php: -------------------------------------------------------------------------------- 1 | addType( ThreeDSecureType::VERIFY_ENROLLED ) 26 | ->addTimeStamp( SampleXmlValidationUtils::TIMESTAMP ) 27 | ->addMerchantId( SampleXmlValidationUtils::MERCHANT_ID ) 28 | ->addOrderId( SampleXmlValidationUtils::ORDER_ID ) 29 | ->addAmount( SampleXmlValidationUtils::AMOUNT ) 30 | ->addCurrency( SampleXmlValidationUtils::CURRENCY ) 31 | ->addCard( $card->addNumber( SampleXmlValidationUtils::CARD_NUMBER ) ); 32 | 33 | $request->hash( SampleXmlValidationUtils::SECRET ); 34 | 35 | $this->assertEquals( SampleXmlValidationUtils::REQUEST_HASH, $request->getHash() ); 36 | } 37 | 38 | /** 39 | * Tests the hash calculation for an auth payment. 40 | */ 41 | public function testVerifySigHashGeneration() { 42 | 43 | $card = new Card(); 44 | 45 | $request = new ThreeDSecureRequest(); 46 | $request->addType( ThreeDSecureType::VERIFY_SIG ) 47 | ->addTimeStamp( SampleXmlValidationUtils::TIMESTAMP ) 48 | ->addMerchantId( SampleXmlValidationUtils::MERCHANT_ID ) 49 | ->addOrderId( SampleXmlValidationUtils::ORDER_ID ) 50 | ->addAmount( SampleXmlValidationUtils::AMOUNT ) 51 | ->addCurrency( SampleXmlValidationUtils::CURRENCY ) 52 | ->addCard( $card->addNumber( SampleXmlValidationUtils::CARD_NUMBER ) ); 53 | 54 | $request->hash( SampleXmlValidationUtils::SECRET ); 55 | 56 | $this->assertEquals( SampleXmlValidationUtils::REQUEST_HASH, $request->getHash() ); 57 | } 58 | 59 | /** 60 | * Tests the hash calculation for a verify card transaction. 61 | */ 62 | public function testVerifyCardEnrolledHashGeneration() { 63 | 64 | $request = new ThreeDSecureRequest(); 65 | $request->addType( ThreeDSecureType::VERIFY_STORED_CARD_ENROLLED ) 66 | ->addTimeStamp( SampleXmlValidationUtils::CARD_VERIFY_TIMESTAMP ) 67 | ->addMerchantId( SampleXmlValidationUtils::CARD_VERIFY_MERCHANT_ID ) 68 | ->addOrderId( SampleXmlValidationUtils::CARD_VERIFY_ORDER_ID ) 69 | ->addAmount( SampleXmlValidationUtils::CARD_VERIFY_AMOUNT ) 70 | ->addCurrency( SampleXmlValidationUtils::CARD_VERIFY_CURRENCY ) 71 | ->addPayerReference( SampleXmlValidationUtils::CARD_VERIFY_PAYER_REF ); 72 | 73 | $request->hash( SampleXmlValidationUtils::SECRET ); 74 | 75 | $this->assertEquals( SampleXmlValidationUtils::CARD_VERIFY_REQUEST_HASH, $request->getHash() ); 76 | } 77 | 78 | } -------------------------------------------------------------------------------- /test/main/php/com-realexpayments-remote-sdk/utils/CardValidationUtils_ExpiryDateTest.php: -------------------------------------------------------------------------------- 1 | assertEquals( $expectedResult, $result, $message . ":" . $expiryDate ); 52 | 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /test/main/php/com-realexpayments-remote-sdk/utils/GenerationUtilsTest.php: -------------------------------------------------------------------------------- 1 | assertTrue( $expectedResult == $result, "Expected and resultant Hash do not match. expected: " . $expectedResult . " result: " . $result ); 24 | } 25 | 26 | public function testGenerateTimestamp() { 27 | 28 | 29 | $result = GenerationUtils::generateTimestamp(); 30 | 31 | $count = preg_match( "/[0-9]{14}/", $result, $matches ); 32 | 33 | $this->assertTrue( $count == 1, "Timestamp should be 14 digits: " . $result ); 34 | } 35 | 36 | public function testGenerateOrderId() { 37 | $result = GenerationUtils::generateOrderId(); 38 | 39 | $this->assertEquals( 22, 40 | strlen( $result ), "OrderId " . $result . " should be 22 characters, is " . strlen( $result ) . " characters: " . $result ); 41 | 42 | $this->assertTrue( preg_match( "/[A-Za-z0-9-_]{22}/", $result ) == 1, "OrderId " . $result . " - Regexp doesn't match [A-Za-z0-9-_]{22}" ); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /test/main/php/com-realexpayments-remote-sdk/utils/ResponseUtilsTest.php: -------------------------------------------------------------------------------- 1 | assertFalse(ResponseUtils::isBasicResponse(iResponse::RESULT_CODE_SUCCESS)); 25 | 26 | //test 1xx code 27 | $this->assertFalse(ResponseUtils::isBasicResponse("100")); 28 | 29 | //test 2xx code 30 | $this->assertFalse(ResponseUtils::isBasicResponse("200")); 31 | 32 | //test 3xx code 33 | $this->assertTrue(ResponseUtils::isBasicResponse("300")); 34 | 35 | //test 5xx code 36 | $this->assertTrue(ResponseUtils::isBasicResponse("500")); 37 | } 38 | 39 | /** 40 | * Test if the full response is successful. 41 | */ 42 | public function testIsSuccess(){ 43 | $response = new PaymentResponse(); 44 | 45 | // test success 46 | $response->setResult(iResponse::RESULT_CODE_SUCCESS); 47 | $this->assertTrue(ResponseUtils::isSuccess($response)); 48 | 49 | // test failure 50 | $response->setResult("101"); 51 | $this->assertFalse(ResponseUtils::isSuccess($response)); 52 | 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/3ds-verify-enrolled-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | thestore 3 | internet 4 | ORD453-11 5 | 29900 6 | 7 | 420000000000000000 8 | 0119 9 | VISA 10 | Joe Smith 11 | 12 | 085f09727da50c2392b64894f962e7eb5050f762 13 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/3ds-verify-enrolled-response-sample-not-enrolled.xml: -------------------------------------------------------------------------------- 1 | 2 | thestore 3 | internet 4 | ORD453-11 5 | 79347 6 | 110 7 | Not Enrolled 8 | 3737468273643 9 | 54564 10 | 1001 11 | eJxVUttygkAM/ZUdnitZFlBw4na02tE6bR0vD+0bLlHpFFDASv++u6i1 12 | http://myurl.com 13 | N 14 | e9dafe706f7142469c45d4877aaf5984 15 | e553ff2510dec9bfee79bb0303af337d871c02ad 16 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/3ds-verify-enrolled-response-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | thestore 3 | internet 4 | ORD453-11 5 | 79347 6 | 00 7 | Enrolled 8 | 3737468273643 9 | 54564 10 | 1001 11 | eJxVUttygkAM/ZUdnitZFlBw4na02tE6bR0vD+0bLlHpFFDASv++u6i1 12 | http://myurl.com 13 | Y 14 | e9dafe706f7142469c45d4877aaf5984 15 | 728cdbef90ff535ed818748f329ed8b1df6b8f5a 16 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/3ds-verify-sig-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | thestore 3 | internet 4 | ORD453-11 5 | 29900 6 | 7 | 420000000000000000 8 | 0119 9 | VISA 10 | Joe Smith 11 | 12 | eJxVUttygkAM/ZUdnitZFlBw4na02tE6bR0vD+0bLlHpFFDASv++u6i1 13 | 085f09727da50c2392b64894f962e7eb5050f762 14 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/3ds-verify-sig-response-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | thestore 3 | internet 4 | ORD453-11 5 | 79347 6 | 00 7 | Authentication Successful 8 | 9 | Y 10 | 5 11 | e9dafe706f7142469c45d4877aaf5984 12 | AAABASY3QHgwUVdEBTdAAAAAAAA= 13 | 1 14 | 15 | e5a7745da5dc32d234c3f52860132c482107e9ac 16 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/auth-mobile-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | 8cdbf036-73e2-44ff-bf11-eba8cab33a14 6 | apple-pay 7 | {"version":"EC_v1","data":"Ft+dvmdfgnsdfnbg+zerKtkh/RWWjdfgdjhHGFHGFlkjdfgkljlkfs78678hEPnsbXZnMDy3o7qDg+iDHB0JVEjDHxjQIAPcNN1Cqdtq63nX4+VRU3eXzdo1QGqSptH6D5KW5SxZLAdnMEmCxG9vkVEdHTTlhVPddxiovAkFTBWBFTJ2uf5f2grXC/VnK0X/efAowXrhJIX1ngsGfAk3/EVRzADGHJFGHJKH78hjkhdfgih80UU05zSluzATidvvBoHBz/WpytSYyrUx1QI9nyH/Nbv8f8lOUjPzBFb+EFOzJaIf+fr0swKU6EB2/2Sm0Y20mD0IvyomtKQ7Tf3VHKA7zhFrDvZUdtX808oHnrqDFRAQZHWAppGUVstqkOyibA0C4suxnOQlsQNZT0r70Tz84=","signature":"MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCAMIID4jCCA4igAwIBAgIIJEPyqAad9XcwCgYIKoZIzj0EAwIwejEuMCwGA1UEAwwlQXBwbGUgQXBwbGljYXRpb24gSW50ZWdyYXRpb24gQ0EgLSBHMzEmMCQGA1UECwwdQXBwbGUgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMB4XDTE0MDkyNTIyMDYxMVoXDTE5MDkyNDIyMDYxMVowXzElMCMGA1UEAwwcZWNjLXNtcC1icm9rZXItc2lnbl9VQzQtUFJPRDEUMBIGA1UECwwLaU9TIFN5c3RlbXMxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEwhV37evWx7Ihj2jdcJChIY3HsL1vLCg9hGCV2Ur0pUEbg0IO2BHzQH6DMx8cVMP36zIg1rrV1O/0komJPnwPE6OCAhEwggINMEUGCCsGAQUFBwEBBDkwNzA1BggrBgEFBQcwAYYpaHR0cDovL29jc3AuYXBwbGUuY29tL29jc3AwNC1hcHBsZWFpY2EzMDEwHQYDVR0OBBYEFJRX22/VdIGGiYl2L35XhQfnm1gkMAwGA1UdEwEB/wQCMAAwHwYDVR0jBBgwFoAUI/JJxE+T5O8n5sT2KGw/orv9LkswggEdBgNVHSAEggEUMIIBEDCCAQwGCSqGSIb3Y2QFATCB/jCBwwYIKwYBBQUHAgIwgbYMgbNSZWxpYW5jZSBvbiB0aGlzIGNlcnRpZmljYXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJsZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRlIHBvbGljeSBhbmQgY2VydGlmaWNhdGlvbiBwcmFjdGljZSBzdGF0ZW1lbnRzLjA2BggrBgEFBQcCARYqaHR0cDovL3d3dy5hcHBsZS5jb20vY2VydGlmaWNhdGVhdXRob3JpdHkvMDQGA1UdHwQtMCswKaAnoCWGI2h0dHA6Ly9jcmwuYXBwbGUuY29tL2FwcGxlYWljYTMuY3JsMA4GA1UdDwEB/wQEAwIHgDAPBgkqhkiG92NkBh0EAgUAMAoGCCqGSM49BAMCA0gAMEUCIHKKnw+Soyq5mXQr1V62c0BXKpaHodYu9TWXEPUWPpbpAiEAkTecfW6+W5l0r0ADfzTCPq2YtbS39w01XIayqBNy8bEwggLuMIICdaADAgECAghJbS+/OpjalzAKBggqhkjOPQQDAjBnMRswGQYDVQQDDBJBcHBsZSBSb290IENBIC0gRzMxJjAkBgNVBAsMHUFwcGxlIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRMwEQYDVQQKDApBcHBsZSBJbmMuMQswCQYDVQQGEwJVUzAeFw0xNDA1MDYyMzQ2MzBaFw0yOTA1MDYyMzQ2MzBaMHoxLjAsBgNVBAMMJUFwcGxlIEFwcGxpY2F0aW9uIEludGVncmF0aW9uIENBIC0gRzMxJjAkBgNVBAsMHUFwcGxlIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRMwEQYDVQQKDApBcHBsZSBJbmMuMQswCQYDVQQGEwJVUzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABPAXEYQZ12SF1RpeJYEHduiAou/ee65N4I38S5PhM1bVZls1riLQl3YNIk57ugj9dhfOiMt2u2ZwvsjoKYT/VEWjgfcwgfQwRgYIKwYBBQUHAQEEOjA4MDYGCCsGAQUFBzABhipodHRwOi8vb2NzcC5hcHBsZS5jb20vb2NzcDA0LWFwcGxlcm9vdGNhZzMwHQYDVR0OBBYEFCPyScRPk+TvJ+bE9ihsP6K7/S5LMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUu7DeoVgziJqkipnevr3rr9rLJKswNwYDVR0fBDAwLjAsoCqgKIYmaHR0cDovL2NybC5hcHBsZS5jb20vYXBwbGVyb290Y2FnMy5jcmwwDgYDVR0PAQH/BAQDAgEGMBAGCiqGSIb3Y2QGAg4EAgUAMAoGCCqGSM49BAMCA2cAMGQCMDrPcoNRFpmxhvs1w1bKYr/0F+3ZD3VNoo6+8ZyBXkK3ifiY95tZn5jVQQ2PnenC/gIwMi3VRCGwowV3bF3zODuQZ/0XfCwhbZZPxnJpghJvVPh6fRuZy5sJiSFhBpkPCZIdAAAxggFgMIIBXAIBATCBhjB6MS4wLAYDVQQDDCVBcHBsZSBBcHBsaWNhdGlvbiBJbnRlZ3JhdGlvbiBDQSAtIEczMSYwJAYDVQQLDB1BcHBsZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTETMBEGA1UECgwKQXBwbGUgSW5jLjELMAkGA1UEBhMCVVMCCCRD8qgGnfV3MA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTUxMDAzMTI1NjE0WjAvBgkqhkiG9w0BCQQxIgQgX2PuBLPWoqZa8uDvFenDTHTwXkeF3/XINbPpoQfbFe8wCgYIKoZIzj0EAwIESDBGAiEAkF4y5/FgTRquNdpi23Cqat7YV2kdYEC6Z+OJGB8JCgYCIQChUiQiTHgjzB7oTo7xfJWEzir2sDyzDkjIUJ0TFCQd/QAAAAAAAA==","header":{"ephemeralPublicKey":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWdNhNAHy9kO2Kol33kIh7k6wh6E/lxriM46MR1FUrn7SHugprkaeFmWKZPgGpWgZ+telY/G1+YSoaCbR57bdGA==","transactionId":"fd88874954acdb29976gfnjd784ng8ern8BDF8gT7G3fd4ebc22a864398684198644c3","publicKeyHash":"h7njghUJVz2gmpTSkHqETOWsskhsdfjj4mgf3sPTS2cBxgrk="}} 8 | 9 | b13f183cd3ea2a0b63033fb53bdeb4894c684643 10 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/card-delete-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | 6 | visa01 7 | smithj01 8 | 9 | 02ea36d7c32ad272aa275be2f4cae5dd4af18280 10 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/card-edit-replace-card-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | 6 | visa01 7 | smithj01 8 | 4988433008499991 9 | 0104 10 | John Smith 11 | visa 12 | 1 13 | 14 | 18eae35c4d680e945375a223ce026f1a74bc63f3 15 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/card-edit-update-ch-name-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | 6 | visa01 7 | smithj01 8 | 0104 9 | John Smith 10 | visa 11 | 12 | 73ab20318d1977131eb41d7054c5549bce95228a 13 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/card-edit-update-issue-no-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | 6 | visa01 7 | smithj01 8 | 0104 9 | John Smith 10 | visa 11 | 2 12 | 13 | 73ab20318d1977131eb41d7054c5549bce95228a 14 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/card-new-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | 292af5fa-6cbc-43d5-b2f0-7fd134d78A99 6 | 7 | visa01 8 | smithj01 9 | 4988433008499991 10 | 0104 11 | John Smith 12 | visa 13 | 1 14 | 15 | fb85da792353786fda1bf4ddeb665fedb728af20 16 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/card-verify-enrolled-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | thestore 3 | internet 4 | 292af5fa-6cbc-43d5-b2f0-7fd134d78A18 5 | 3000 6 | smithj01 7 | visa01 8 | 9 | 10 | 11 | 123 12 | 13 | 14 | 85cae325d558aad444341b69c1350c929738ce60 15 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/credit-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | 6df026a7-15d6-4b92-86e1-9f7b2b1d97c5 6 | 13276780809852 7 | AP12346 8 | 3000 9 | 52ed08590ab0bb6c2e5e4c9584aca0f6e9635a3a 10 | c1319b2999608fcfa3e71d583627affaeb25d961 11 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/dcc-rate-auth-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | yourmerchantid 3 | 4 | 201232-205 5 | 19000 6 | 7 | 4111111111111111 8 | 0415 9 | Peter Johnson 10 | VISA 11 | 12 | 13 | 14 | fexco 15 | 1 16 | 0.6868 17 | S 18 | 13049 19 | 20 | 116d9e19144cd6cec05a809c6d945582c7f10133 21 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/dcc-rate-lookup-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | thestore 3 | internet 4 | 292af5fa-6cbc-43d5-b2f0-7fd134d78A80 5 | 3000 6 | 7 | 420000000000000000 8 | 0417 9 | Joe Smith 10 | VISA 11 | 12 | 13 | 14 | fexco 15 | 1 16 | 17 | dbe26dd81f6b39c0ad682bae1b882c9bdb696819 18 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/hold-payment-reason-falsepositive-request.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | 292af5fa-6cbc-43d5-b2f0-7fd134d78d95 6 | ABC123456 7 | FALSE POSITIVE 8 | eec6d1f5dcc51a6a2d2b59af5d2cdb965806d96c 9 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/hold-payment-reason-hold-request.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | 292af5fa-6cbc-43d5-b2f0-7fd134d78d95 6 | ABC123456 7 | HOLD 8 | eec6d1f5dcc51a6a2d2b59af5d2cdb965806d96c 9 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/hold-payment-reason-release-request.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | 292af5fa-6cbc-43d5-b2f0-7fd134d78d95 6 | ABC123456 7 | eec6d1f5dcc51a6a2d2b59af5d2cdb965806d96c 8 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/hold-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | 292af5fa-6cbc-43d5-b2f0-7fd134d78d95 6 | ABC123456 7 | FRAUD 8 | eec6d1f5dcc51a6a2d2b59af5d2cdb965806d96c 9 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/otb-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | 3be87fe9-db95-470f-ab04-b82f965f5b17 6 | 7 | 420000000000000000 8 | 0119 9 | Joe Smith 10 | VISA 11 | 1 12 | 13 | 123 14 | 1 15 | 16 | 17 | 18 | c05460fa3d195c1ee6ac97d3594e8cace4449cb2 19 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/payer-edit-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | 292af5fa-6cbc-43d5-b2f0-7fd134d78A77 5 | internet 6 | 7 | Mr 8 | John 9 | Smith 10 | Acme Inc 11 |
    12 | 123 Fake St. 13 | 14 | 15 | Hytown 16 | Dunham 17 | 3 18 | Ireland 19 |
    20 | 21 | 22 | +35317433923 23 | +35317893248 24 | +353873748392 25 | 26 | jsmith@acme.com 27 | 28 | comment 1 29 | 30 | 31 |
    32 | 9ac73a4c8e5d4904c1e6814f48aaeb9bcb4e2615 33 | 34 | 35 | 36 | 37 |
    -------------------------------------------------------------------------------- /test/main/resources/sample-xml/payer-new-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | 292af5fa-6cbc-43d5-b2f0-7fd134d78A77 5 | internet 6 | 7 | Mr 8 | John 9 | Smith 10 | Acme Inc 11 |
    12 | Apt 167 Block 10 13 | The Hills 14 | 15 | Hytown 16 | Dunham 17 | 3 18 | Ireland 19 |
    20 | 21 | 22 | +35317433923 23 | +35317893248 24 | +353873748392 25 | 26 | jsmith@acme.com 27 | 28 | comment 1 29 | 30 | 31 |
    32 | fa007978fb6b897c56f25e9dd50f4f4ddeae822a 33 | 34 | 35 | 36 | 37 |
    -------------------------------------------------------------------------------- /test/main/resources/sample-xml/payment-out-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | 292af5fa-6cbc-43d5-b2f0-7fd134d78A13 6 | 3000 7 | bloggsj01 8 | visa01 9 | 10 | 57b592b6a3a3e550b319dcc336b0a79faa976b86 11 | 52ed08590ab0bb6c2e5e4c9584aca0f6e9635a3a 12 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/payment-request-sample-with-symbols.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | ORD453-11 6 | yourChannel 7 | 29900 8 | 9 | 420000000000000000 10 | 0119 11 | Joe Smith 12 | VISA 13 | 1 14 | 15 | 123 16 | 1 17 | 18 | 19 | 20 | 085f09727da50c2392b64894f962e7eb5050f762 21 | 22 | a-z A-Z 0-9 ' ", + “” ._ - & \ / @ ! ? % ( )* : £ $ & € # [ ] | = ;ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷ø¤ùúûüýþÿŒŽšœžŸ¥ 23 | comment 2 £ 24 | 25 | 3737468273643 26 | 79347 27 | hjfdg78h34tyvklasjr89t 28 | 29 | 30 | 31 | cust num $ £ 32 | prod ID 33 | variable ref 1234 $ ££ 34 | 127.0.0.1 35 |
    36 | 21|578 37 | IE 38 |
    39 |
    40 | 77|9876 41 | GB 42 |
    43 |
    44 | 45 | AAABASY3QHgwUVdEBTdAAAAAAAA= 46 | e9dafe706f7142469c45d4877aaf5984 47 | 5 48 | 49 |
    -------------------------------------------------------------------------------- /test/main/resources/sample-xml/payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | ORD453-11 6 | yourChannel 7 | 29900 8 | 9 | 420000000000000000 10 | 0119 11 | Joe Smith 12 | VISA 13 | 1 14 | 15 | 123 16 | 1 17 | 18 | 19 | 20 | 085f09727da50c2392b64894f962e7eb5050f762 21 | 22 | comment 1 23 | comment 2 24 | 25 | 3737468273643 26 | 79347 27 | hjfdg78h34tyvklasjr89t 28 | 29 | 30 | 31 | cust num 32 | prod ID 33 | variable ref 1234 34 | 127.0.0.1 35 |
    36 | 21|578 37 | IE 38 |
    39 |
    40 | 77|9876 41 | GB 42 |
    43 |
    44 | 45 | AAABASY3QHgwUVdEBTdAAAAAAAA= 46 | e9dafe706f7142469c45d4877aaf5984 47 | 5 48 | 49 |
    -------------------------------------------------------------------------------- /test/main/resources/sample-xml/payment-response-basic-error-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ORD453-11 4 | 508 5 | error message returned from system 6 | 7 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/payment-response-dcc-info.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | yourmerchantid 4 | internet 5 | 201232-205 6 | 7 | 00 8 | U 9 | 10 | 11 | 10782411922720 12 | 13 | GBP 14 | 13049 15 | 0.6868 16 | EUR 17 | 19000 18 | 19 | 9cbaaf034254315ceefa8c680ff8a773c83db140 20 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/payment-response-fraud-no-rules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | testMerchant 4 | internet 5 | OrderOne 6 | 071757 7 | 00 8 | M 9 | U 10 | U 11 | 3452232 12 | (00)AUTH CODE 071757 13 | 14247938905185175 14 | 2 15 | 2 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | NOT_EXECUTED 24 | 25 | 26 | bd5550299e4508873a2cf6e435ad74a5455ad648 27 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/payment-response-fraud.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | testMerchant 4 | internet 5 | OrderOne 6 | 071757 7 | 00 8 | M 9 | U 10 | U 11 | 3452232 12 | (00)AUTH CODE 071757 13 | 14247938905185175 14 | 2 15 | 2 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | PASS 24 | 25 | 26 | PASS 27 | 28 | 29 | PASS 30 | 31 | 32 | 33 | bd5550299e4508873a2cf6e435ad74a5455ad648 34 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/payment-response-full-error-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | ORD453-11 6 | 101 7 | 79347 8 | Bank Error 9 | 3737468273643 10 | M 11 | 54564 12 | 1001 13 | test acquirer response]]> 14 | -1 15 | 16 | bank 17 | Ireland 18 | IE 19 | Dublin 20 | 21 | 0ad8a9f121c4041b4b832ae8069e80674269e22f 22 | 23 | 67 24 | 99 25 | 199 26 | 27 | 28 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/payment-response-sample-unknown-element.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | ORD453-11 6 | 00 7 | 79347 8 | Successful 9 | 3737468273643 10 | M 11 | 54564 12 | 1001 13 | test acquirer response]]> 14 | -1 15 | 16 | bank 17 | Ireland 18 | IE 19 | Dublin 20 | 21 | 368df010076481d47a21e777871012b62b976339 22 | 23 | 67 24 | 99 25 | 199 26 | 27 | M 28 | P 29 | dklgj786hjbg487yeui9f8g7 30 | 31 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/payment-response-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | ORD453-11 6 | 00 7 | 79347 8 | Successful 9 | 3737468273643 10 | M 11 | 54564 12 | 1001 13 | test acquirer response]]> 14 | -1 15 | 16 | bank 17 | Ireland 18 | IE 19 | Dublin 20 | 21 | 368df010076481d47a21e777871012b62b976339 22 | 23 | 67 24 | 99 25 | 199 26 | 27 | M 28 | P 29 | 30 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/rebate-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | 6df026a7-15d6-4b92-86e1-9f7b2b1d97c5 6 | 13276780809852 7 | AP12346 8 | 3000 9 | 52ed08590ab0bb6c2e5e4c9584aca0f6e9635a3a 10 | c1319b2999608fcfa3e71d583627affaeb25d961 11 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/receipt-in-otb-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | thestore 3 | internet 4 | 292af5fa-6cbc-43d5-b2f0-7fd134d78d95 5 | 6 | 7 | 123 8 | 9 | 10 | 3000 11 | bloggsj01 12 | visa01 13 | 14 | ceeeb16edfeda0dc919db1be1b0e9db7b01b24cf 15 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/receipt-in-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | thestore 3 | internet 4 | 292af5fa-6cbc-43d5-b2f0-7fd134d78d95 5 | 6 | 7 | 123 8 | 9 | 10 | 3000 11 | bloggsj01 12 | visa01 13 | 14 | 373a4a7ce0c2cf7613dee027112e66faf0233b6c 15 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/release-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | 292af5fa-6cbc-43d5-b2f0-7fd134d78d95 6 | ABC123456 7 | OUTOFSTOCK 8 | eec6d1f5dcc51a6a2d2b59af5d2cdb965806d96c 9 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/settle-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | e3cf94c6-f674-4f99-b4db-7541254a8767 6 | 1000 7 | 13276780809850 8 | AP1234 9 | b2e110f78803ccb377e8f3f12730e41d0cb0ed66 10 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/storedcard-dccrate-request.xml: -------------------------------------------------------------------------------- 1 | 2 | yourmerchantid 3 | internet 4 | transaction01 5 | 9999 6 | smith01 7 | visa01 8 | 9 | fexco 10 | 1 11 | 12 | 13 | 500a6c67d7ec3e196b60efdfb4cdc5ab8366416a 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/main/resources/sample-xml/void-payment-request-sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | thestore 4 | internet 5 | 012bf34b-3ec9-4c9b-b3a5-700f2f28e67f 6 | 1000 7 | 13276780809851 8 | AP12345 9 | 9f61456cce6c90dcc13281e6b95734f5b91e628f 10 | --------------------------------------------------------------------------------