diff --git a/.gitignore b/.gitignore
index 945398d..a28c30e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,8 @@
.idea/
vendor/
.vagrant/
+composer.phar
+Vagrantfile
+vm-config/
+phpunit.phar
+composer.lock
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..7b508a8
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,12 @@
+# Change Log
+All notable changes to the SDK will be documented in this file.
+
+
+## [1.1]
+- Added mobile payment type (auth-mobile) and relevant fields (mobile, token) to payment request.
+
+## [1.0.1]
+- Minor Fixes
+
+## [1.0]
+- Initial Release
diff --git a/README.md b/README.md
index 6334cd7..d47c32e 100644
--- a/README.md
+++ b/README.md
@@ -85,6 +85,9 @@ $response = $client->send( $request );
// do something with the response
echo $response->toXML();
+
+$resultCode = $response->getResult();
+$message = $response->getMessage();
```
diff --git a/src/main/php/com-realexpayments-remote-sdk/domain/payment/PaymentRequest.php b/src/main/php/com-realexpayments-remote-sdk/domain/payment/PaymentRequest.php
index 67d4bb3..2fd7f47 100644
--- a/src/main/php/com-realexpayments-remote-sdk/domain/payment/PaymentRequest.php
+++ b/src/main/php/com-realexpayments-remote-sdk/domain/payment/PaymentRequest.php
@@ -11,7 +11,6 @@
use com\realexpayments\remote\sdk\utils\XmlUtils;
-
/**
* Class PaymentRequest
*
@@ -26,21 +25,21 @@
*
*
* $card = (new Card())
- * ->addType(CardType::VISA)
- * ->addNumber("4242424242424242")
- * ->addExpiryDate("0525")
+ * ->addType(CardType::VISA)
+ * ->addNumber("4242424242424242")
+ * ->addExpiryDate("0525")
* ->addCvn("123")
* ->addCvnPresenceIndicator(PresenceIndicator::CVN_PRESENT);
* ->addCardHolderName("Joe Bloggs");
*
* $request = (new PaymentRequest())
- * ->addMerchantId("yourMerchantId")
- * ->addAccount("yourAccount")
- * ->addType(PaymentType::AUTH)
- * ->addAmount(10001)
- * ->addCurrency("EUR")
- * ->addCard($card)
- * ->addAutoSettle((new AutoSettle())->addFlag(AutoSettleFlag::TRUE));
+ * ->addMerchantId("yourMerchantId")
+ * ->addAccount("yourAccount")
+ * ->addType(PaymentType::AUTH)
+ * ->addAmount(10001)
+ * ->addCurrency("EUR")
+ * ->addCard($card)
+ * ->addAutoSettle((new AutoSettle())->addFlag(AutoSettleFlag::TRUE));
*
*
*
@@ -48,25 +47,38 @@
*
*
* $card = (new Card())
- * ->addType(CardType::VISA)
- * ->addNumber("4242424242424242")
- * ->addExpiryDate("0525")
+ * ->addType(CardType::VISA)
+ * ->addNumber("4242424242424242")
+ * ->addExpiryDate("0525")
* ->addCvn("123")
* ->addCvnPresenceIndicator(PresenceIndicator::CVN_PRESENT)
* ->addCardHolderName("Joe Bloggs");
-
*
* $request = (new PaymentRequest())
- * ->addMerchantId("yourMerchantId")
- * ->addAccount("yourAccount")
- * ->addType(PaymentType::AUTH)
- * ->addAmount(10001)
- * ->addCurrency("EUR")
- * ->addCard($card)
- * ->addAutoSettle((new AutoSettle())->addFlag(AutoSettleFlag::TRUE));
+ * ->addMerchantId("yourMerchantId")
+ * ->addAccount("yourAccount")
+ * ->addType(PaymentType::AUTH)
+ * ->addAmount(10001)
+ * ->addCurrency("EUR")
+ * ->addCard($card)
+ * ->addAutoSettle((new AutoSettle())->addFlag(AutoSettleFlag::TRUE));
* ->addAddressVerificationServiceDetails("382 The Road", "WB1 A42", "GB");
*
*
+ *
+ * Example AUTH MOBILE
+ *
+ *
+ * $request = (new PaymentRequest())
+ * ->addMerchantId("yourMerchantId")
+ * ->addAccount("yourAccount")
+ * ->addType(PaymentType::AUTH_MOBILE)
+ * ->addAutoSettle((new AutoSettle())->addFlag(AutoSettleFlag::TRUE));
+ * ->addMobile("apple-pay")
+ * ->addToken("{auth mobile payment token}");
+ *
+ *
+ *
* @author vicpada
* @package com\realexpayments\remote\sdk\domain\payment
*/
@@ -180,7 +192,7 @@ class PaymentRequest implements iRequest {
private $refundHash;
/**
- * @var string wellTODO - info on this
+ * @var string Fraud filter flag
*
*/
private $fraudFilter;
@@ -205,6 +217,19 @@ class PaymentRequest implements iRequest {
*/
private $mpi;
+ /**
+ * @var string The mobile auth payment type e.g. apple-pay.
+ *
+ */
+ private $mobile;
+
+ /**
+ * @var string The mobile auth payment token to be sent in place of payment data.
+ *
+ */
+ private $token;
+
+
/**
* Constructor for Payment Request
*/
@@ -543,6 +568,42 @@ public function setMpi( $mpi ) {
$this->mpi = $mpi;
}
+ /**
+ * Getter for mobile
+ *
+ * @return string
+ */
+ public function getMobile() {
+ return $this->mobile;
+ }
+
+ /**
+ * Setter for mobile
+ *
+ * @param string $mobile
+ */
+ public function setMobile( $mobile ) {
+ $this->mobile = $mobile;
+ }
+
+ /**
+ * Getter for token
+ *
+ * @return string
+ */
+ public function getToken() {
+ return $this->token;
+ }
+
+ /**
+ * Setter for token
+ *
+ * @param string $token
+ */
+ public function setToken( $token ) {
+ $this->token = $token;
+ }
+
/**
* Helper method for adding TSS info
@@ -821,6 +882,32 @@ public function addMpi( Mpi $mpi ) {
return $this;
}
+ /**
+ * Helper method for adding a mobile
+ *
+ * @param string $mobile
+ *
+ * @return PaymentRequest
+ */
+ public function addMobile( $mobile ) {
+ $this->mobile = $mobile;
+
+ return $this;
+ }
+
+ /**
+ * Helper method for adding a token
+ *
+ * @param string $token
+ *
+ * @return PaymentRequest
+ */
+ public function addToken( $token ) {
+ $this->token = $token;
+
+ return $this;
+ }
+
/**
* {@inheritdoc}
*/
@@ -884,6 +971,7 @@ public function hash( $secret ) {
$orderId = null == $this->orderId ? "" : $this->orderId;
$amount = "";
$currency = "";
+ $token = null == $this->token ? "" : $this->token;
if ( $this->amount != null ) {
$amount = null == $this->amount->getAmount() ? "" : $this->amount->getAmount();
@@ -897,17 +985,27 @@ public function hash( $secret ) {
}
//create String to hash
- $toHash = $timeStamp
- . "."
- . $merchantId
- . "."
- . $orderId
- . "."
- . $amount
- . "."
- . $currency
- . "."
- . $cardNumber;
+ if ( $this->type == PaymentType::AUTH_MOBILE ) {
+ $toHash = $timeStamp
+ . "."
+ . $merchantId
+ . "."
+ . $orderId
+ . "..."
+ . $token;
+ } else {
+ $toHash = $timeStamp
+ . "."
+ . $merchantId
+ . "."
+ . $orderId
+ . "."
+ . $amount
+ . "."
+ . $currency
+ . "."
+ . $cardNumber;
+ }
$this->hash = GenerationUtils::generateHash( $toHash, $secret );
@@ -951,4 +1049,6 @@ public function addAddressVerificationServiceDetails( $addressLine, $postcode, $
return $this;
}
+
+
}
\ No newline at end of file
diff --git a/src/main/php/com-realexpayments-remote-sdk/domain/payment/PaymentType.php b/src/main/php/com-realexpayments-remote-sdk/domain/payment/PaymentType.php
index 3ac490a..f34fe01 100644
--- a/src/main/php/com-realexpayments-remote-sdk/domain/payment/PaymentType.php
+++ b/src/main/php/com-realexpayments-remote-sdk/domain/payment/PaymentType.php
@@ -14,6 +14,7 @@ class PaymentType extends EnumBase {
const __default = self::AUTH;
const AUTH = "auth";
+ const AUTH_MOBILE = "auth-mobile";
/**
* @var string The payment type String value
diff --git a/src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/CustomStringXmlEncoder.php b/src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/CustomStringXmlEncoder.php
index 6f78ae5..b93badf 100644
--- a/src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/CustomStringXmlEncoder.php
+++ b/src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/CustomStringXmlEncoder.php
@@ -345,7 +345,11 @@ private function parseXmlValue( \DOMNode $node ) {
foreach ( $value as $key => $val ) {
if ( is_array( $val ) && 1 === count( $val ) ) {
- $value[ $key ] = current( $val );
+ $val = current( $val );
+ if ( is_string( $val ) ) {
+ $val = trim( $val );
+ }
+ $value[ $key ] = $val;
}
}
diff --git a/src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/PaymentRequestNormalizer.php b/src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/PaymentRequestNormalizer.php
index d5cecc7..0b412a4 100644
--- a/src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/PaymentRequestNormalizer.php
+++ b/src/main/php/com-realexpayments-remote-sdk/domain/payment/normaliser/PaymentRequestNormalizer.php
@@ -41,16 +41,38 @@ public function denormalize( $data, $class, $format = null, array $context = arr
->addAccount( $array['account'] )
->addChannel( $array['channel'] )
->addOrderId( $array['orderid'] )
- ->addCard( $this->denormaliseCard( $array ) )
- ->addAutoSettle( $this->denormaliseAutoSettle( $array ) )
->addHash( $array['sha1hash'] )
->addPaymentsReference( $array['pasref'] )
->addAuthCode( $array['authcode'] )
->addRefundHash( $array['refundhash'] )
->addFraudFilter( $array['fraudfilter'] )
- ->addRecurring( $this->denormaliseRecurring( $array ) )
- ->addTssInfo( $this->denormaliseTssInfo( $array ) )
- ->addMpi( $this->denormaliseMpi( $array ) );
+ ->addMobile( $array['mobile'] )
+ ->addToken( $array['token'] );
+
+ $autoSettle = $this->denormaliseAutoSettle( $array );
+ if ( $autoSettle != null ) {
+ $request->addAutoSettle( $autoSettle );
+ }
+
+ $card = $this->denormaliseCard( $array );
+ if ( $card != null ) {
+ $request->addCard( $card );
+ }
+
+ $recurring = $this->denormaliseRecurring( $array );
+ if ( $recurring != null ) {
+ $request->addRecurring( $recurring );
+ }
+
+ $tssInfo = $this->denormaliseTssInfo( $array );
+ if ( $tssInfo != null ) {
+ $request->addTssInfo( $tssInfo );
+ }
+
+ $mpi = $this->denormaliseMpi( $array );
+ if ( $mpi != null ) {
+ $request->addMpi( $mpi );
+ }
$request->setAmount( $this->denormaliseAmount( $array ) );
$request->setComments( $this->denormaliseComments( $array ) );
@@ -299,6 +321,8 @@ public function normalize( $object, $format = null, array $context = array() ) {
'recurring' => $this->normaliseRecurring( $object ),
'tssinfo' => $this->normaliseTssInfo( $object ),
'mpi' => $this->normaliseMpi( $object ),
+ 'mobile' => $object->getMobile(),
+ 'token' => $object->getToken(),
) );
}
diff --git a/src/main/php/com-realexpayments-remote-sdk/http/HttpUtils.php b/src/main/php/com-realexpayments-remote-sdk/http/HttpUtils.php
index ddc54af..7481b6b 100644
--- a/src/main/php/com-realexpayments-remote-sdk/http/HttpUtils.php
+++ b/src/main/php/com-realexpayments-remote-sdk/http/HttpUtils.php
@@ -36,7 +36,7 @@ class HttpUtils {
*
* @return HttpClient httpclient
*/
- public static function getDefaultClient( HttpConfiguration $httpConfiguration ) {
+ public static function getDefaultClient( HttpConfiguration $httpConfiguration ) {
self::getLogger();
@@ -123,7 +123,7 @@ public static function sendMessage( $xml, HttpClient $httpClient, HttpConfigurat
} catch ( Exception $e ) {
- self::$logger->error( "Exception communicating with Realex.", $e->getMessage() );
+ self::$logger->error( "Exception communicating with Realex." . $e->getMessage() );
throw new RealexException( "Exception communicating with Realex", $e );
}
}
diff --git a/src/main/php/com-realexpayments-remote-sdk/utils/XmlUtils.php b/src/main/php/com-realexpayments-remote-sdk/utils/XmlUtils.php
index 10af8ca..1f0dd77 100644
--- a/src/main/php/com-realexpayments-remote-sdk/utils/XmlUtils.php
+++ b/src/main/php/com-realexpayments-remote-sdk/utils/XmlUtils.php
@@ -73,7 +73,7 @@ public static function toXml( $object, MessageType $messageType ) {
} catch ( Exception $e ) {
- self::$logger->error( "Error unmarshalling to XML", $e );
+ self::$logger->error( "Error unmarshalling to XML. " . $e );
throw new RealexException( "Error unmarshalling to XML", $e );
}
@@ -88,7 +88,7 @@ public static function toXml( $object, MessageType $messageType ) {
*
* @return object
*/
- public static function fromXml( $xml, MessageType $messageType ) {
+ public static function fromXml( $xml, MessageType $messageType ) {
self::Initialise();
self::$logger->debug( "Unmarshalling XML to domain object" );
@@ -101,8 +101,8 @@ public static function fromXml( $xml, MessageType $messageType ) {
->deserialize( $xml, self::getClassName( $xml, $messageType ), 'xml' );
} catch ( Exception $e ) {
- self::$logger->error( "Error unmarshalling from XML", $e );
- throw new RealexException( "Error unmarshalling from XML", $e );
+ self::$logger->error( "Error unmarshalling from XML. " . $e );
+ throw new RealexException( "Error unmarshalling from XML.", $e );
}
return $object;
diff --git a/test/main/php/com-realexpayments-remote-sdk/domain-payment/CardTest.php b/test/main/php/com-realexpayments-remote-sdk/domain/payment/CardTest.php
similarity index 100%
rename from test/main/php/com-realexpayments-remote-sdk/domain-payment/CardTest.php
rename to test/main/php/com-realexpayments-remote-sdk/domain/payment/CardTest.php
diff --git a/test/main/php/com-realexpayments-remote-sdk/domain-payment/PaymentRequestTest.php b/test/main/php/com-realexpayments-remote-sdk/domain/payment/PaymentRequestTest.php
similarity index 69%
rename from test/main/php/com-realexpayments-remote-sdk/domain-payment/PaymentRequestTest.php
rename to test/main/php/com-realexpayments-remote-sdk/domain/payment/PaymentRequestTest.php
index 61b0e84..a2ce6e0 100644
--- a/test/main/php/com-realexpayments-remote-sdk/domain-payment/PaymentRequestTest.php
+++ b/test/main/php/com-realexpayments-remote-sdk/domain/payment/PaymentRequestTest.php
@@ -3,6 +3,9 @@
namespace com\realexpayments\remote\sdk\domain\payment;
+use com\realexpayments\remote\sdk\domain\Card;
+use com\realexpayments\remote\sdk\utils\SampleXmlValidationUtils;
+
/**
* Unit test class for PaymentRequest utility methods.
@@ -15,7 +18,7 @@ class PaymentRequestTest extends \PHPUnit_Framework_TestCase {
/**
* Tests the population of a billing address for the Address Verification Service.
*/
- public function testAddAddressVerificationServiceDetails1() {
+ public function testAddAddressVerificationServiceDetails1() {
//test variations of address and postcode with TSS Info field null
$addressLine = "123 Fake St";
$postcode = "WB1 A42";
@@ -34,7 +37,7 @@ public function testAddAddressVerificationServiceDetails1() {
/**
* Tests the population of a billing address for the Address Verification Service.
*/
- public function testAddAddressVerificationServiceDetails2() {
+ public function testAddAddressVerificationServiceDetails2() {
$addressLine = "123 5 Fake St";
$postcode = "1WB 5A2";
$country = "GB";
@@ -51,7 +54,7 @@ public function testAddAddressVerificationServiceDetails2() {
/**
* Tests the population of a billing address for the Address Verification Service.
*/
- public function testAddAddressVerificationServiceDetails3() {
+ public function testAddAddressVerificationServiceDetails3() {
$addressLine = "Apt 15, 123 Fake St";
$postcode = "ABC 5A2";
$country = "GB";
@@ -68,7 +71,7 @@ public function testAddAddressVerificationServiceDetails3() {
/**
* Tests the population of a billing address for the Address Verification Service.
*/
- public function testAddAddressVerificationServiceDetails4() {
+ public function testAddAddressVerificationServiceDetails4() {
$addressLine = "Fake St";
$postcode = "AI10 9AB";
$country = "GB";
@@ -86,7 +89,7 @@ public function testAddAddressVerificationServiceDetails4() {
/**
* Tests the population of a billing address for the Address Verification Service.
*/
- public function testAddAddressVerificationServiceDetails5() {
+ public function testAddAddressVerificationServiceDetails5() {
$addressLine = "30 Fake St";
$postcode = "";
$country = "GB";
@@ -104,7 +107,7 @@ public function testAddAddressVerificationServiceDetails5() {
/**
* Tests the population of a billing address for the Address Verification Service.
*/
- public function testAddAddressVerificationServiceDetailsWithTssInfo() {
+ public function testAddAddressVerificationServiceDetailsWithTssInfo() {
$addressLine = "123 Fake St";
$postcode = "WB1 A42";
$country = "";
@@ -119,7 +122,43 @@ public function testAddAddressVerificationServiceDetailsWithTssInfo() {
$this->assertEquals( $country, $addresses[0]->getCountry() );
}
+ /**
+ * Tests the hash calculation for an auth payment.
+ */
+ public function testAuthHashGeneration() {
+
+ $card = new Card();
+
+ $request = new PaymentRequest();
+ $request->addType( PaymentType::AUTH )
+ ->addTimeStamp( SampleXmlValidationUtils::TIMESTAMP )
+ ->addMerchantId( SampleXmlValidationUtils::MERCHANT_ID )
+ ->addOrderId( SampleXmlValidationUtils::ORDER_ID )
+ ->addAmount( SampleXmlValidationUtils::AMOUNT )
+ ->addCurrency( SampleXmlValidationUtils::CURRENCY )
+ ->addCard( $card->addNumber( SampleXmlValidationUtils::CARD_NUMBER ) );
+
+ $request->hash( SampleXmlValidationUtils::SECRET );
+
+ $this->assertEquals( SampleXmlValidationUtils::REQUEST_HASH, $request->getHash() );
+ }
+
+ /**
+ * Tests the hash calculation for an auth payment.
+ */
+ public function testAuthMobileHashGeneration() {
+ $request = new PaymentRequest();
+ $request->addType( PaymentType::AUTH_MOBILE )
+ ->addTimeStamp( SampleXmlValidationUtils::AUTH_MOBILE_TIMESTAMP )
+ ->addMerchantId( SampleXmlValidationUtils::AUTH_MOBILE_MERCHANT_ID )
+ ->addOrderId( SampleXmlValidationUtils::AUTH_MOBILE_ORDER_ID )
+ ->addToken( SampleXmlValidationUtils::AUTH_MOBILE_TOKEN );
+
+ $request->hash( SampleXmlValidationUtils::SECRET );
+
+ $this->assertEquals( SampleXmlValidationUtils::AUTH_MOBILE_REQUEST_HASH, $request->getHash() );
+ }
}
diff --git a/test/main/php/com-realexpayments-remote-sdk/domain/threeDSecure/ThreeDSecureRequestTest.php b/test/main/php/com-realexpayments-remote-sdk/domain/threeDSecure/ThreeDSecureRequestTest.php
new file mode 100644
index 0000000..0e3bede
--- /dev/null
+++ b/test/main/php/com-realexpayments-remote-sdk/domain/threeDSecure/ThreeDSecureRequestTest.php
@@ -0,0 +1,59 @@
+addType( ThreeDSecureType::VERIFY_ENROLLED )
+ ->addTimeStamp( SampleXmlValidationUtils::TIMESTAMP )
+ ->addMerchantId( SampleXmlValidationUtils::MERCHANT_ID )
+ ->addOrderId( SampleXmlValidationUtils::ORDER_ID )
+ ->addAmount( SampleXmlValidationUtils::AMOUNT )
+ ->addCurrency( SampleXmlValidationUtils::CURRENCY )
+ ->addCard( $card->addNumber( SampleXmlValidationUtils::CARD_NUMBER ) );
+
+ $request->hash( SampleXmlValidationUtils::SECRET );
+
+ $this->assertEquals( SampleXmlValidationUtils::REQUEST_HASH, $request->getHash() );
+ }
+
+ /**
+ * Tests the hash calculation for an auth payment.
+ */
+ public function testVerifySigHashGeneration() {
+
+ $card = new Card();
+
+ $request = new ThreeDSecureRequest();
+ $request->addType( ThreeDSecureType::VERIFY_SIG )
+ ->addTimeStamp( SampleXmlValidationUtils::TIMESTAMP )
+ ->addMerchantId( SampleXmlValidationUtils::MERCHANT_ID )
+ ->addOrderId( SampleXmlValidationUtils::ORDER_ID )
+ ->addAmount( SampleXmlValidationUtils::AMOUNT )
+ ->addCurrency( SampleXmlValidationUtils::CURRENCY )
+ ->addCard( $card->addNumber( SampleXmlValidationUtils::CARD_NUMBER ) );
+
+ $request->hash( SampleXmlValidationUtils::SECRET );
+
+ $this->assertEquals( SampleXmlValidationUtils::REQUEST_HASH, $request->getHash() );
+ }
+
+}
\ No newline at end of file
diff --git a/test/main/php/com-realexpayments-remote-sdk/utils/CardValidationUtils_ExpiryDateTest.php b/test/main/php/com-realexpayments-remote-sdk/utils/CardValidationUtils_ExpiryDateTest.php
index ecdd6b3..6b7ba55 100644
--- a/test/main/php/com-realexpayments-remote-sdk/utils/CardValidationUtils_ExpiryDateTest.php
+++ b/test/main/php/com-realexpayments-remote-sdk/utils/CardValidationUtils_ExpiryDateTest.php
@@ -29,7 +29,7 @@ public function CardValidationUtils_ExpiryDateTestDataProvider() {
array( "Incorrect date MMYY", "1212", false ),
array( "Incorrect date MMYY", "0015", false ),
array( "Incorrect date MMYY", "0415", false ),
- array( "Correct date MMYY", "1215", true ),
+ array( "Correct date MMYY", "1216", true ),
array( "Incorrect date MMYY", "0021", false )
);
diff --git a/test/main/php/com-realexpayments-remote-sdk/utils/SampleXmlValidationUtils.php b/test/main/php/com-realexpayments-remote-sdk/utils/SampleXmlValidationUtils.php
index 7b14431..d052988 100644
--- a/test/main/php/com-realexpayments-remote-sdk/utils/SampleXmlValidationUtils.php
+++ b/test/main/php/com-realexpayments-remote-sdk/utils/SampleXmlValidationUtils.php
@@ -38,6 +38,10 @@ class SampleXmlValidationUtils {
const THREE_D_SECURE_VERIFY_SIG_REQUEST_XML_PATH = "/sample-xml/3ds-verify-sig-request-sample.xml";
const THREE_D_SECURE_VERIFY_SIG_RESPONSE_XML_PATH = "/sample-xml/3ds-verify-sig-response-sample.xml";
+ //mobile auth payment sample XML
+ const MOBILE_AUTH_PAYMENT_REQUEST_XML_PATH = "/sample-xml/auth-mobile-payment-request-sample.xml";
+
+
//Card
const CARD_NUMBER = "420000000000000000";
/**
@@ -63,10 +67,10 @@ class SampleXmlValidationUtils {
* @var AutoSettleFlag
*/
static $AUTO_SETTLE_FLAG;
- const TIMESTAMP = "20120926112654";
+ const TIMESTAMP = "20151201094345";
const CHANNEL = "yourChannel";
const ORDER_ID = "ORD453-11";
- const REQUEST_HASH = "581b84c1dbfd0a6c9c7d4e2d0a620157e879dac5";
+ const REQUEST_HASH = "085f09727da50c2392b64894f962e7eb5050f762";
const COMMENT1 = "comment 1";
const COMMENT2 = "comment 2";
const COMMENT1_WITH_SYMBOLS = "a-z A-Z 0-9 ' \", + “” ._ - & \\ / @ ! ? % ( )* : £ $ & € # [ ] | = ;ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷ø¤ùúûüýþÿŒŽšœžŸ¥";
@@ -111,6 +115,11 @@ class SampleXmlValidationUtils {
const ADDRESS_CODE_SHIPPING = "77|9876";
const ADDRESS_COUNTRY_SHIPPING = "GB";
+ /**
+ * @var AutoSettleFlag
+ */
+ static $AUTH_MOBILE_AUTO_SETTLE_FLAG;
+
//response fields
const ACQUIRER_RESPONSE = "test acquirer response";
const AUTH_TIME_TAKEN = 1001;
@@ -133,6 +142,8 @@ class SampleXmlValidationUtils {
const AUTH_CODE = "79347";
const AVS_POSTCODE = "M";
const AVS_ADDRESS = "P";
+ const MOBILE = "apple-pay";
+ const TIMESTAMP_RESPONSE = "20120926112654";
//basic response error fields
const MESSAGE_BASIC_ERROR = "error message returned from system";
@@ -146,8 +157,8 @@ class SampleXmlValidationUtils {
const RESPONSE_FULL_ERROR_HASH = "0ad8a9f121c4041b4b832ae8069e80674269e22f";
//3DS request fields
- const THREE_D_SECURE_VERIFY_ENROLLED_REQUEST_HASH = "1f6db5dc1a72c35b4c07cc9405a9674e272d57e7";
- const THREE_D_SECURE_VERIFY_SIG_REQUEST_HASH = "1f6db5dc1a72c35b4c07cc9405a9674e272d57e7";
+ const THREE_D_SECURE_VERIFY_ENROLLED_REQUEST_HASH = "085f09727da50c2392b64894f962e7eb5050f762";
+ const THREE_D_SECURE_VERIFY_SIG_REQUEST_HASH = "085f09727da50c2392b64894f962e7eb5050f762";
//3DS response fields
const THREE_D_SECURE_ENROLLED_RESULT = "00";
@@ -170,15 +181,26 @@ class SampleXmlValidationUtils {
const THREE_D_SECURE_ENROLLED_RESPONSE_HASH = "728cdbef90ff535ed818748f329ed8b1df6b8f5a";
const THREE_D_SECURE_SIG_RESPONSE_HASH = "e5a7745da5dc32d234c3f52860132c482107e9ac";
+ // auth-mobile fields
+ const AUTH_MOBILE_TIMESTAMP = "20150820154047";
+ const AUTH_MOBILE_TYPE = "AUTH_MOBILE";
+ const AUTH_MOBILE_MERCHANT_ID = "thestore";
+ const AUTH_MOBILE_ACCOUNT = "internet";
+ const AUTH_MOBILE_ORDER_ID = "8cdbf036-73e2-44ff-bf11-eba8cab33a14";
+ const AUTH_MOBILE_MOBILE = "apple-pay";
+ const AUTH_MOBILE_TOKEN = "{\"version\":\"EC_v1\",\"data\":\"Ft+dvmdfgnsdfnbg+zerKtkh/RWWjdfgdjhHGFHGFlkjdfgkljlkfs78678hEPnsbXZnMDy3o7qDg+iDHB0JVEjDHxjQIAPcNN1Cqdtq63nX4+VRU3eXzdo1QGqSptH6D5KW5SxZLAdnMEmCxG9vkVEdHTTlhVPddxiovAkFTBWBFTJ2uf5f2grXC/VnK0X/efAowXrhJIX1ngsGfAk3/EVRzADGHJFGHJKH78hjkhdfgih80UU05zSluzATidvvBoHBz/WpytSYyrUx1QI9nyH/Nbv8f8lOUjPzBFb+EFOzJaIf+fr0swKU6EB2/2Sm0Y20mD0IvyomtKQ7Tf3VHKA7zhFrDvZUdtX808oHnrqDFRAQZHWAppGUVstqkOyibA0C4suxnOQlsQNZT0r70Tz84=\",\"signature\":\"MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCAMIID4jCCA4igAwIBAgIIJEPyqAad9XcwCgYIKoZIzj0EAwIwejEuMCwGA1UE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QCMDrPcoNRFpmxhvs1w1bKYr/0F+3ZD3VNoo6+8ZyBXkK3ifiY95tZn5jVQQ2PnenC/gIwMi3VRCGwowV3bF3zODuQZ/0XfCwhbZZPxnJpghJvVPh6fRuZy5sJiSFhBpkPCZIdAAAxggFgMIIBXAIBATCBhjB6MS4wLAYDVQQDDCVBcHBsZSBBcHBsaWNhdGlvbiBJbnRlZ3JhdGlvbiBDQSAtIEczMSYwJAYDVQQLDB1BcHBsZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTETMBEGA1UECgwKQXBwbGUgSW5jLjELMAkGA1UEBhMCVVMCCCRD8qgGnfV3MA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTUxMDAzMTI1NjE0WjAvBgkqhkiG9w0BCQQxIgQgX2PuBLPWoqZa8uDvFenDTHTwXkeF3/XINbPpoQfbFe8wCgYIKoZIzj0EAwIESDBGAiEAkF4y5/FgTRquNdpi23Cqat7YV2kdYEC6Z+OJGB8JCgYCIQChUiQiTHgjzB7oTo7xfJWEzir2sDyzDkjIUJ0TFCQd/QAAAAAAAA==\",\"header\":{\"ephemeralPublicKey\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWdNhNAHy9kO2Kol33kIh7k6wh6E/lxriM46MR1FUrn7SHugprkaeFmWKZPgGpWgZ+telY/G1+YSoaCbR57bdGA==\",\"transactionId\":\"fd88874954acdb29976gfnjd784ng8ern8BDF8gT7G3fd4ebc22a864398684198644c3\",\"publicKeyHash\":\"h7njghUJVz2gmpTSkHqETOWsskhsdfjj4mgf3sPTS2cBxgrk=\"}}";
+ const AUTH_MOBILE_REQUEST_HASH = "b13f183cd3ea2a0b63033fb53bdeb4894c684643";
+
static function Init() {
- self::$CARD_CVN_PRESENCE = new PresenceIndicator( PresenceIndicator::CVN_PRESENT );
- self::$ADDRESS_TYPE_BUSINESS = new AddressType( AddressType::BILLING );
- self::$ADDRESS_TYPE_SHIPPING = new AddressType( AddressType::SHIPPING );
- self::$AUTO_SETTLE_FLAG = new AutoSettleFlag( AutoSettleFlag::MULTI );
- self::$CARD_TYPE = new CardType( CardType::VISA );
- self::$RECURRING_TYPE = new RecurringType( RecurringType::FIXED );
- self::$RECURRING_FLAG = new RecurringFlag( RecurringFlag::ONE );
- self::$RECURRING_SEQUENCE = new RecurringSequence( RecurringSequence::FIRST );
+ self::$CARD_CVN_PRESENCE = new PresenceIndicator( PresenceIndicator::CVN_PRESENT );
+ self::$ADDRESS_TYPE_BUSINESS = new AddressType( AddressType::BILLING );
+ self::$ADDRESS_TYPE_SHIPPING = new AddressType( AddressType::SHIPPING );
+ self::$AUTO_SETTLE_FLAG = new AutoSettleFlag( AutoSettleFlag::MULTI );
+ self::$CARD_TYPE = new CardType( CardType::VISA );
+ self::$RECURRING_TYPE = new RecurringType( RecurringType::FIXED );
+ self::$RECURRING_FLAG = new RecurringFlag( RecurringFlag::ONE );
+ self::$RECURRING_SEQUENCE = new RecurringSequence( RecurringSequence::FIRST );
+ self::$AUTH_MOBILE_AUTO_SETTLE_FLAG = new AutoSettleFlag( AutoSettleFlag::TRUE );
}
/**
@@ -205,7 +227,7 @@ public static function checkUnmarshalledPaymentResponse( PaymentResponse $fromXm
$testCase->assertEquals( self::PASREF, $fromXmlResponse->getPaymentsReference() );
$testCase->assertEquals( self::RESULT_SUCCESS, $fromXmlResponse->getResult() );
$testCase->assertEquals( self::RESPONSE_HASH, $fromXmlResponse->getHash() );
- $testCase->assertEquals( self::TIMESTAMP, $fromXmlResponse->getTimeStamp() );
+ $testCase->assertEquals( self::TIMESTAMP_RESPONSE, $fromXmlResponse->getTimeStamp() );
$testCase->assertEquals( self::TIME_TAKEN, $fromXmlResponse->getTimeTaken() );
$testCase->assertEquals( self::TSS_RESULT, $fromXmlResponse->getTssResult()->getResult() );
@@ -231,53 +253,69 @@ public static function checkUnmarshalledPaymentResponse( PaymentResponse $fromXm
public static function checkUnmarshalledPaymentRequest( PaymentRequest $fromXmlRequest, PHPUnit_Framework_TestCase $testCase ) {
$testCase->assertNotNull( $fromXmlRequest );
- $testCase->assertEquals( self::CARD_NUMBER, $fromXmlRequest->getCard()->getNumber() );
-
- $testCase->assertEquals( self::$CARD_TYPE->getType(), $fromXmlRequest->getCard()->getType() );
- $testCase->assertEquals( self::CARD_HOLDER_NAME, $fromXmlRequest->getCard()->getCardHolderName() );
- $testCase->assertEquals( self::CARD_CVN_NUMBER, $fromXmlRequest->getCard()->getCvn()->getNumber() );
- $testCase->assertEquals( self::$CARD_CVN_PRESENCE->getIndicator(), $fromXmlRequest->getCard()->getCvn()->getPresenceIndicator() );
- $testCase->assertEquals( self::CARD_ISSUE_NUMBER, $fromXmlRequest->getCard()->getIssueNumber() );
- $testCase->assertEquals( self::CARD_EXPIRY_DATE, $fromXmlRequest->getCard()->getExpiryDate() );
-
- $testCase->assertEquals( self::ACCOUNT, $fromXmlRequest->getAccount() );
- $testCase->assertEquals( self::MERCHANT_ID, $fromXmlRequest->getMerchantId() );
- $testCase->assertEquals( PaymentType::AUTH, $fromXmlRequest->getType() );
- $testCase->assertEquals( self:: AMOUNT, $fromXmlRequest->getAmount()->getAmount() );
- $testCase->assertEquals( self::CURRENCY, $fromXmlRequest->getAmount()->getCurrency() );
- $testCase->assertEquals( self::$AUTO_SETTLE_FLAG->getFlag(), $fromXmlRequest->getAutoSettle()->getFlag() );
- $testCase->assertEquals( self::TIMESTAMP, $fromXmlRequest->getTimeStamp() );
- $testCase->assertEquals( self::CHANNEL, $fromXmlRequest->getChannel() );
- $testCase->assertEquals( self::ORDER_ID, $fromXmlRequest->getOrderId() );
- $testCase->assertEquals( self::REQUEST_HASH, $fromXmlRequest->getHash() );
- $testCase->assertEquals( self::COMMENT1, $fromXmlRequest->getComments()->get( 0 )->getComment() );
- $testCase->assertEquals( "1", $fromXmlRequest->getComments()->get( 0 )->getId() );
- $testCase->assertEquals( self::COMMENT2, $fromXmlRequest->getComments()->get( 1 )->getComment() );
- $testCase->assertEquals( "2", $fromXmlRequest->getComments()->get( 1 )->getId() );
- $testCase->assertEquals( self::PASREF, $fromXmlRequest->getPaymentsReference() );
- $testCase->assertEquals( self::AUTH_CODE, $fromXmlRequest->getAuthCode() );
- $testCase->assertEquals( self::REFUND_HASH, $fromXmlRequest->getRefundHash() );
- $testCase->assertEquals( self::FRAUD_FILTER, $fromXmlRequest->getFraudFilter() );
- $testCase->assertEquals( self::$RECURRING_FLAG->getRecurringFlag(), $fromXmlRequest->getRecurring()->getFlag() );
- $testCase->assertEquals( self::$RECURRING_TYPE->getType(), $fromXmlRequest->getRecurring()->getType() );
- $testCase->assertEquals( self::$RECURRING_SEQUENCE->getSequence(), $fromXmlRequest->getRecurring()->getSequence() );
-
- $testCase->assertEquals( self::CUSTOMER_NUMBER, $fromXmlRequest->getTssInfo()->getCustomerNumber() );
- $testCase->assertEquals( self::PRODUCT_ID, $fromXmlRequest->getTssInfo()->getProductId() );
- $testCase->assertEquals( self::VARIABLE_REFERENCE, $fromXmlRequest->getTssInfo()->getVariableReference() );
- $testCase->assertEquals( self::CUSTOMER_IP, $fromXmlRequest->getTssInfo()->getCustomerIpAddress() );
- $addresses = $fromXmlRequest->getTssInfo()->getAddresses();
- $testCase->assertEquals( self::$ADDRESS_TYPE_BUSINESS->getAddressType(), $addresses[0]->getType() );
- $testCase->assertEquals( self::ADDRESS_CODE_BUSINESS, $addresses[0]->getCode() );
- $testCase->assertEquals( self::ADDRESS_COUNTRY_BUSINESS, $addresses[0]->getCountry() );
- $testCase->assertEquals( self::$ADDRESS_TYPE_SHIPPING->getAddressType(), $addresses[1]->getType() );
- $testCase->assertEquals( self::ADDRESS_CODE_SHIPPING, $addresses[1]->getCode() );
- $testCase->assertEquals( self::ADDRESS_COUNTRY_SHIPPING, $addresses[1]->getCountry() );
-
- $testCase->assertEquals( self::THREE_D_SECURE_CAVV, $fromXmlRequest->getMpi()->getCavv() );
- $testCase->assertEquals( self::THREE_D_SECURE_XID, $fromXmlRequest->getMpi()->getXid() );
- $testCase->assertEquals( self::THREE_D_SECURE_ECI, $fromXmlRequest->getMpi()->getEci() );
+ if ( PaymentType::AUTH == $fromXmlRequest->getType() ) {
+
+ $testCase->assertEquals( self::CARD_NUMBER, $fromXmlRequest->getCard()->getNumber() );
+
+ $testCase->assertEquals( self::$CARD_TYPE->getType(), $fromXmlRequest->getCard()->getType() );
+ $testCase->assertEquals( self::CARD_HOLDER_NAME, $fromXmlRequest->getCard()->getCardHolderName() );
+ $testCase->assertEquals( self::CARD_CVN_NUMBER, $fromXmlRequest->getCard()->getCvn()->getNumber() );
+ $testCase->assertEquals( self::$CARD_CVN_PRESENCE->getIndicator(), $fromXmlRequest->getCard()->getCvn()->getPresenceIndicator() );
+ $testCase->assertEquals( self::CARD_ISSUE_NUMBER, $fromXmlRequest->getCard()->getIssueNumber() );
+ $testCase->assertEquals( self::CARD_EXPIRY_DATE, $fromXmlRequest->getCard()->getExpiryDate() );
+
+ $testCase->assertEquals( self::ACCOUNT, $fromXmlRequest->getAccount() );
+ $testCase->assertEquals( self::MERCHANT_ID, $fromXmlRequest->getMerchantId() );
+ $testCase->assertEquals( PaymentType::AUTH, $fromXmlRequest->getType() );
+ $testCase->assertEquals( self:: AMOUNT, $fromXmlRequest->getAmount()->getAmount() );
+ $testCase->assertEquals( self::CURRENCY, $fromXmlRequest->getAmount()->getCurrency() );
+ $testCase->assertEquals( self::$AUTO_SETTLE_FLAG->getFlag(), $fromXmlRequest->getAutoSettle()->getFlag() );
+ $testCase->assertEquals( self::TIMESTAMP, $fromXmlRequest->getTimeStamp() );
+ $testCase->assertEquals( self::CHANNEL, $fromXmlRequest->getChannel() );
+ $testCase->assertEquals( self::ORDER_ID, $fromXmlRequest->getOrderId() );
+ $testCase->assertEquals( self::REQUEST_HASH, $fromXmlRequest->getHash() );
+ $testCase->assertEquals( self::COMMENT1, $fromXmlRequest->getComments()->get( 0 )->getComment() );
+ $testCase->assertEquals( "1", $fromXmlRequest->getComments()->get( 0 )->getId() );
+ $testCase->assertEquals( self::COMMENT2, $fromXmlRequest->getComments()->get( 1 )->getComment() );
+ $testCase->assertEquals( "2", $fromXmlRequest->getComments()->get( 1 )->getId() );
+ $testCase->assertEquals( self::PASREF, $fromXmlRequest->getPaymentsReference() );
+ $testCase->assertEquals( self::AUTH_CODE, $fromXmlRequest->getAuthCode() );
+ $testCase->assertEquals( self::REFUND_HASH, $fromXmlRequest->getRefundHash() );
+ $testCase->assertEquals( self::FRAUD_FILTER, $fromXmlRequest->getFraudFilter() );
+
+ $testCase->assertEquals( self::$RECURRING_FLAG->getRecurringFlag(), $fromXmlRequest->getRecurring()->getFlag() );
+ $testCase->assertEquals( self::$RECURRING_TYPE->getType(), $fromXmlRequest->getRecurring()->getType() );
+ $testCase->assertEquals( self::$RECURRING_SEQUENCE->getSequence(), $fromXmlRequest->getRecurring()->getSequence() );
+
+ $testCase->assertEquals( self::CUSTOMER_NUMBER, $fromXmlRequest->getTssInfo()->getCustomerNumber() );
+ $testCase->assertEquals( self::PRODUCT_ID, $fromXmlRequest->getTssInfo()->getProductId() );
+ $testCase->assertEquals( self::VARIABLE_REFERENCE, $fromXmlRequest->getTssInfo()->getVariableReference() );
+ $testCase->assertEquals( self::CUSTOMER_IP, $fromXmlRequest->getTssInfo()->getCustomerIpAddress() );
+ $addresses = $fromXmlRequest->getTssInfo()->getAddresses();
+ $testCase->assertEquals( self::$ADDRESS_TYPE_BUSINESS->getAddressType(), $addresses[0]->getType() );
+ $testCase->assertEquals( self::ADDRESS_CODE_BUSINESS, $addresses[0]->getCode() );
+ $testCase->assertEquals( self::ADDRESS_COUNTRY_BUSINESS, $addresses[0]->getCountry() );
+ $testCase->assertEquals( self::$ADDRESS_TYPE_SHIPPING->getAddressType(), $addresses[1]->getType() );
+ $testCase->assertEquals( self::ADDRESS_CODE_SHIPPING, $addresses[1]->getCode() );
+ $testCase->assertEquals( self::ADDRESS_COUNTRY_SHIPPING, $addresses[1]->getCountry() );
+
+ $testCase->assertEquals( self::THREE_D_SECURE_CAVV, $fromXmlRequest->getMpi()->getCavv() );
+ $testCase->assertEquals( self::THREE_D_SECURE_XID, $fromXmlRequest->getMpi()->getXid() );
+ $testCase->assertEquals( self::THREE_D_SECURE_ECI, $fromXmlRequest->getMpi()->getEci() );
+
+ } elseif ( PaymentType::AUTH_MOBILE == $fromXmlRequest->getType() ) {
+ $testCase->assertEquals( self::AUTH_MOBILE_ACCOUNT, $fromXmlRequest->getAccount() );
+ $testCase->assertEquals( self::AUTH_MOBILE_MERCHANT_ID, $fromXmlRequest->getMerchantId() );
+ $testCase->assertEquals( self::$AUTH_MOBILE_AUTO_SETTLE_FLAG->getFlag(), $fromXmlRequest->getAutoSettle()->getFlag() );
+ $testCase->assertEquals( self::AUTH_MOBILE_TIMESTAMP, $fromXmlRequest->getTimeStamp() );
+ $testCase->assertEquals( self::AUTH_MOBILE_ORDER_ID, $fromXmlRequest->getOrderId() );
+ $testCase->assertEquals( self::AUTH_MOBILE_MOBILE, $fromXmlRequest->getMobile() );
+ $testCase->assertEquals( self::AUTH_MOBILE_TOKEN, $fromXmlRequest->getToken() );
+ $testCase->assertEquals( self::AUTH_MOBILE_REQUEST_HASH, $fromXmlRequest->getHash() );
+ } else {
+ $testCase->fail( "Invalid payment type." );
+ }
}
/**
@@ -378,7 +416,7 @@ public static function checkFullResponseError( PaymentResponse $response, PHPUni
$testCase->assertEquals( self::PASREF, $response->getPaymentsReference() );
$testCase->assertEquals( self::RESULT_FULL_ERROR, $response->getResult() );
$testCase->assertEquals( self::RESPONSE_FULL_ERROR_HASH, $response->getHash() );
- $testCase->assertEquals( self::TIMESTAMP, $response->getTimeStamp() );
+ $testCase->assertEquals( self::TIMESTAMP_RESPONSE, $response->getTimeStamp() );
$testCase->assertEquals( self::TIME_TAKEN, $response->getTimeTaken() );
$testCase->assertEquals( self::TSS_RESULT, $response->getTssResult()->getResult() );
$checks = $response->getTssResult()->getChecks();
@@ -459,7 +497,7 @@ public static function checkUnmarshalledThreeDSecureEnrolledResponse( ThreeDSecu
$testCase->assertEquals( self::PASREF, $fromXmlResponse->getPaymentsReference() );
$testCase->assertEquals( self::THREE_D_SECURE_ENROLLED_RESULT, $fromXmlResponse->getResult() );
$testCase->assertEquals( self::THREE_D_SECURE_ENROLLED_RESPONSE_HASH, $fromXmlResponse->getHash() );
- $testCase->assertEquals( self::TIMESTAMP, $fromXmlResponse->getTimeStamp() );
+ $testCase->assertEquals( self::TIMESTAMP_RESPONSE, $fromXmlResponse->getTimeStamp() );
$testCase->assertEquals( self::TIME_TAKEN, $fromXmlResponse->getTimeTaken() );
$testCase->assertEquals( self::THREE_D_SECURE_URL, $fromXmlResponse->getUrl() );
$testCase->assertEquals( self::THREE_D_SECURE_PAREQ, $fromXmlResponse->getPareq() );
@@ -482,7 +520,7 @@ public static function checkUnmarshalledThreeDSecureSigResponse( ThreeDSecureRes
$testCase->assertEquals( self::ORDER_ID, $fromXmlResponse->getOrderId() );
$testCase->assertEquals( self::THREE_D_SECURE_SIG_RESULT, $fromXmlResponse->getResult() );
$testCase->assertEquals( self::THREE_D_SECURE_SIG_RESPONSE_HASH, $fromXmlResponse->getHash() );
- $testCase->assertEquals( self::TIMESTAMP, $fromXmlResponse->getTimeStamp() );
+ $testCase->assertEquals( self::TIMESTAMP_RESPONSE, $fromXmlResponse->getTimeStamp() );
$testCase->assertEquals( self::THREE_D_SECURE_STATUS, $fromXmlResponse->getThreeDSecure()->getStatus() );
$testCase->assertEquals( self::THREE_D_SECURE_ECI, $fromXmlResponse->getThreeDSecure()->getEci() );
$testCase->assertEquals( self::THREE_D_SECURE_XID, $fromXmlResponse->getThreeDSecure()->getXid() );
diff --git a/test/main/php/com-realexpayments-remote-sdk/utils/XmlUtilsTest.php b/test/main/php/com-realexpayments-remote-sdk/utils/XmlUtilsTest.php
index 613c829..f818abc 100644
--- a/test/main/php/com-realexpayments-remote-sdk/utils/XmlUtilsTest.php
+++ b/test/main/php/com-realexpayments-remote-sdk/utils/XmlUtilsTest.php
@@ -125,7 +125,7 @@ public function testPaymentRequestXmlHelpers() {
/**
* Tests conversion of {@link PaymentRequest} to and from XML using the helper methods with no enums.
*/
- public function testPaymentRequestXmlHelpersNoEnums() {
+ public function testPaymentRequestXmlHelpersNoEnums() {
$card = new Card();
$card->addExpiryDate( SampleXmlValidationUtils::CARD_EXPIRY_DATE )
->addNumber( SampleXmlValidationUtils::CARD_NUMBER )
@@ -327,7 +327,7 @@ public function testPaymentResponseXml() {
$response->setPaymentsReference( SampleXmlValidationUtils::PASREF );
$response->setResult( SampleXmlValidationUtils::RESULT_SUCCESS );
$response->setHash( SampleXmlValidationUtils::RESPONSE_HASH );
- $response->setTimeStamp( SampleXmlValidationUtils::TIMESTAMP );
+ $response->setTimeStamp( SampleXmlValidationUtils::TIMESTAMP_RESPONSE );
$response->setTimeTaken( SampleXmlValidationUtils::TIME_TAKEN );
$tssResult = new TssResult();
@@ -394,7 +394,7 @@ public function testPaymentRequestXmlFromFile() {
/**
* Tests conversion of {@link PaymentResponse} from XML file with unknown element.
*/
- public function testPaymentResponseXmlFromFileUnknownElement() {
+ public function testPaymentResponseXmlFromFileUnknownElement() {
$path = SampleXmlValidationUtils::PAYMENT_RESPONSE_XML_PATH_UNKNOWN_ELEMENT;
$prefix = __DIR__ . '/../../../resources';
$xml = file_get_contents( $prefix . $path );
@@ -660,10 +660,27 @@ public function testThreeDSecureFromXmlError() {
XmlUtils::fromXml( "testxml>", new MessageType( MessageType::THREE_D_SECURE ) );
}
+ /**
+ * Tests conversion of {@link PaymentRequest} from XML file for mobile-auth payment types.
+ *
+ */
+ public function testPaymentRequestXmlFromFileMobileAuth() {
+
+ $path = SampleXmlValidationUtils::MOBILE_AUTH_PAYMENT_REQUEST_XML_PATH;
+ $prefix = __DIR__ . '/../../../resources';
+ $xml = file_get_contents( $prefix . $path );
+
+ //unmarshal back to response
+ /* @var ThreeDSecureRequest $fromXmlResponse */
+ $fromXmlRequest = new PaymentRequest();
+ $fromXmlRequest = $fromXmlRequest->fromXml( $xml );
+ SampleXmlValidationUtils::checkUnmarshalledPaymentRequest( $fromXmlRequest, $this );
+ }
+
/**
* Tests that press indicator is sent correctly even when it is out of range
*/
- public function testPressIndicator() {
+ public function testPressIndicator() {
$expectedCVN = "5";
$card = new Card();
@@ -749,7 +766,7 @@ public function testPressIndicator() {
/**
* Tests and invalid recurring flag value
*/
- public function testInvalidRecurringFlag() {
+ public function testInvalidRecurringFlag() {
$card = new Card();
@@ -838,7 +855,7 @@ public function testInvalidRecurringFlag() {
/**
* Tests and invalid recurring type value
*/
- public function testInvalidRecurringType() {
+ public function testInvalidRecurringType() {
$card = new Card();
@@ -1030,7 +1047,7 @@ public function testSymbolsOnCommentsAndTSSFromFile() {
/**
* Tests and invalid currency value (null)
*/
- public function testNullValueOnCurrency() {
+ public function testNullValueOnCurrency() {
$card = new Card();
@@ -1142,7 +1159,7 @@ public function testPaymentResponseXmlAndDeserialize() {
$response->setPaymentsReference( SampleXmlValidationUtils::PASREF );
$response->setResult( SampleXmlValidationUtils::RESULT_SUCCESS );
$response->setHash( SampleXmlValidationUtils::RESPONSE_HASH );
- $response->setTimeStamp( SampleXmlValidationUtils::TIMESTAMP );
+ $response->setTimeStamp( SampleXmlValidationUtils::TIMESTAMP_RESPONSE );
$response->setTimeTaken( SampleXmlValidationUtils::TIME_TAKEN );
$tssResult = new TssResult();
@@ -1207,7 +1224,7 @@ public function testPaymentResponseXmlAndDeserializeOverallResults() {
$response->setPaymentsReference( SampleXmlValidationUtils::PASREF );
$response->setResult( SampleXmlValidationUtils::RESULT_SUCCESS );
$response->setHash( SampleXmlValidationUtils::RESPONSE_HASH );
- $response->setTimeStamp( SampleXmlValidationUtils::TIMESTAMP );
+ $response->setTimeStamp( SampleXmlValidationUtils::TIMESTAMP_RESPONSE );
$response->setTimeTaken( SampleXmlValidationUtils::TIME_TAKEN );
$tssResult = new TssResult();
diff --git a/test/main/resources/sample-xml/3ds-verify-enrolled-request-sample.xml b/test/main/resources/sample-xml/3ds-verify-enrolled-request-sample.xml
index 249b81c..673188e 100644
--- a/test/main/resources/sample-xml/3ds-verify-enrolled-request-sample.xml
+++ b/test/main/resources/sample-xml/3ds-verify-enrolled-request-sample.xml
@@ -1,4 +1,4 @@
-
+
thestore
internet
ORD453-11
@@ -9,5 +9,5 @@
VISA
Joe Smith
- 1f6db5dc1a72c35b4c07cc9405a9674e272d57e7
+ 085f09727da50c2392b64894f962e7eb5050f762
\ No newline at end of file
diff --git a/test/main/resources/sample-xml/3ds-verify-sig-request-sample.xml b/test/main/resources/sample-xml/3ds-verify-sig-request-sample.xml
index df5f3a6..7893fac 100644
--- a/test/main/resources/sample-xml/3ds-verify-sig-request-sample.xml
+++ b/test/main/resources/sample-xml/3ds-verify-sig-request-sample.xml
@@ -1,4 +1,4 @@
-
+
thestore
internet
ORD453-11
@@ -10,5 +10,5 @@
Joe Smith
eJxVUttygkAM/ZUdnitZFlBw4na02tE6bR0vD+0bLlHpFFDASv++u6i1
- 1f6db5dc1a72c35b4c07cc9405a9674e272d57e7
+ 085f09727da50c2392b64894f962e7eb5050f762
\ No newline at end of file
diff --git a/test/main/resources/sample-xml/auth-mobile-payment-request-sample.xml b/test/main/resources/sample-xml/auth-mobile-payment-request-sample.xml
new file mode 100644
index 0000000..16b45c8
--- /dev/null
+++ b/test/main/resources/sample-xml/auth-mobile-payment-request-sample.xml
@@ -0,0 +1,12 @@
+
+
+ thestore
+ internet
+ 8cdbf036-73e2-44ff-bf11-eba8cab33a14
+ apple-pay
+
+ {"version":"EC_v1","data":"Ft+dvmdfgnsdfnbg+zerKtkh/RWWjdfgdjhHGFHGFlkjdfgkljlkfs78678hEPnsbXZnMDy3o7qDg+iDHB0JVEjDHxjQIAPcNN1Cqdtq63nX4+VRU3eXzdo1QGqSptH6D5KW5SxZLAdnMEmCxG9vkVEdHTTlhVPddxiovAkFTBWBFTJ2uf5f2grXC/VnK0X/efAowXrhJIX1ngsGfAk3/EVRzADGHJFGHJKH78hjkhdfgih80UU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==","transactionId":"fd88874954acdb29976gfnjd784ng8ern8BDF8gT7G3fd4ebc22a864398684198644c3","publicKeyHash":"h7njghUJVz2gmpTSkHqETOWsskhsdfjj4mgf3sPTS2cBxgrk="}}
+
+
+ b13f183cd3ea2a0b63033fb53bdeb4894c684643
+
\ No newline at end of file
diff --git a/test/main/resources/sample-xml/payment-request-sample-with-symbols.xml b/test/main/resources/sample-xml/payment-request-sample-with-symbols.xml
index 08e0cfd..3880ebe 100644
--- a/test/main/resources/sample-xml/payment-request-sample-with-symbols.xml
+++ b/test/main/resources/sample-xml/payment-request-sample-with-symbols.xml
@@ -1,5 +1,5 @@
-
+
thestore
internet
ORD453-11
@@ -17,7 +17,7 @@
- 581b84c1dbfd0a6c9c7d4e2d0a620157e879dac5
+ 085f09727da50c2392b64894f962e7eb5050f762
a-z A-Z 0-9 ' ", + “” ._ - & \ / @ ! ? % ( )* : £ $ & € # [ ] | = ;ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷ø¤ùúûüýþÿŒŽšœžŸ¥
comment 2 £
diff --git a/test/main/resources/sample-xml/payment-request-sample.xml b/test/main/resources/sample-xml/payment-request-sample.xml
index 8065b32..70e57fc 100644
--- a/test/main/resources/sample-xml/payment-request-sample.xml
+++ b/test/main/resources/sample-xml/payment-request-sample.xml
@@ -1,5 +1,5 @@
-
+
thestore
internet
ORD453-11
@@ -17,7 +17,7 @@
- 581b84c1dbfd0a6c9c7d4e2d0a620157e879dac5
+ 085f09727da50c2392b64894f962e7eb5050f762
comment 1
comment 2