diff --git a/SecureSubmit.php b/SecureSubmit.php index 15bff14..b003cea 100644 --- a/SecureSubmit.php +++ b/SecureSubmit.php @@ -11,6 +11,16 @@ global $wpdb; global $table_name; +use GlobalPayments\Api\Entities\EncryptionData; +use GlobalPayments\Api\PaymentMethods\CreditCardData; +use GlobalPayments\Api\PaymentMethods\CreditTrackData; +use GlobalPayments\Api\Services\CreditService; +use GlobalPayments\Api\ServicesConfig; +use GlobalPayments\Api\ServicesContainer; +use GlobalPayments\Api\Entities\Address; +use GlobalPayments\Api\Entities\Customer; +use GlobalPayments\Api\Entities\TransactionSummary; + $table_name = $wpdb->prefix . "securesubmit"; $jal_db_version = "1.2.0"; $secureSubmit = new SecureSubmit(); @@ -29,8 +39,8 @@ class SecureSubmit { function __construct() { $this->dir = (string) dirname(__FILE__); - if ( ! class_exists('HpsServicesConfig' ) ) { - require_once($this->dir . '/lib/Hps.php'); + if ( ! class_exists('ServicesConfig' ) ) { + require_once($this->dir . '/lib/vendor/autoload.php'); } $this->url = plugins_url('securesubmit'); @@ -2013,44 +2023,26 @@ function submit_payment() { } } - $config = new HpsServicesConfig(); - - $config->secretApiKey = esc_attr($skey); - $config->versionNumber = '1648'; - $config->developerId = '002914'; - - $chargeService = new HpsCreditService($config); - - $address = new HpsAddress(); - $address->address = $billing_address; + $config = $this->setConfig($skey); + $address = new Address(); + $address->streetAddress1 = $billing_address; $address->city = $billing_city; if ($requireState) $address->state = $billing_state; $address->zip = $billing_zip; - - $cardHolder = new HpsCardHolder(); - $cardHolder->firstName = $billing_firstname; - $cardHolder->lastName = $billing_lastname; - $cardHolder->email = $billing_email; - $cardHolder->address = $address; - - $cardOrToken = new HpsTokenData(); - $cardOrToken->tokenValue = $secureToken; - + + $cardOrToken = new CreditCardData(); + $cardOrToken->token = $secureToken; + $cardOrToken->cardHolderName = $billing_firstname. ' ' .$billing_lastname; + if (!empty($memo)) { - $details = new HpsTransactionDetails(); - $details->memo = $memo; + $details = $memo; } - - $response = $chargeService->charge( - $amount, - 'usd', - $cardOrToken, - $cardHolder, - false, - $details - ); - + $response = $cardOrToken->charge($amount) + ->withCurrency('usd') + ->withAddress($address) + ->withDescription($details) + ->execute(); $transaction_id = $response->transactionId; add_filter('wp_mail_content_type', create_function('', 'return "text/html"; ')); @@ -2208,4 +2200,13 @@ function jal_update_db_check(){ $this->jal_install(); } } + + public function setConfig($skey) + { + $config = new ServicesConfig(); + $config->secretApiKey = esc_attr($skey); + $config->serviceUrl = 'https://cert.api2.heartlandportico.com'; + $service = ServicesContainer::configure($config); + return $service; + } } diff --git a/lib/composer.json b/lib/composer.json new file mode 100644 index 0000000..be7fe54 --- /dev/null +++ b/lib/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "globalpayments/php-sdk": "^1.3" + } +} diff --git a/lib/composer.lock b/lib/composer.lock new file mode 100644 index 0000000..ef68e2f --- /dev/null +++ b/lib/composer.lock @@ -0,0 +1,63 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "54ffb0e9c4978df9f979e8d9285f5356", + "packages": [ + { + "name": "globalpayments/php-sdk", + "version": "1.3.3", + "source": { + "type": "git", + "url": "https://github.com/globalpayments/php-sdk.git", + "reference": "1fd0393b3fc231fcff2977a152b7a7b9e0c1d57f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/globalpayments/php-sdk/zipball/1fd0393b3fc231fcff2977a152b7a7b9e0c1d57f", + "reference": "1fd0393b3fc231fcff2977a152b7a7b9e0c1d57f", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-dom": "*", + "ext-openssl": "*", + "php": ">= 5.5.9" + }, + "require-dev": { + "brianium/paratest": "dev-master", + "phpstan/phpstan-shim": "^0.8.4", + "phpunit/phpunit": "~5.0", + "squizlabs/php_codesniffer": "2.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "GlobalPayments\\Api\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Heartland Payment Systems" + } + ], + "description": "PHP SDK for processing payments with Global Payments, including Heartland Payment Systems and Realex Payments", + "homepage": "https://developer.heartlandpaymentsystems.com/documentation", + "time": "2019-10-03T15:15:47+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/lib/vendor/autoload.php b/lib/vendor/autoload.php new file mode 100644 index 0000000..08b3b45 --- /dev/null +++ b/lib/vendor/autoload.php @@ -0,0 +1,7 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + // PSR-4 + private $prefixLengthsPsr4 = array(); + private $prefixDirsPsr4 = array(); + private $fallbackDirsPsr4 = array(); + + // PSR-0 + private $prefixesPsr0 = array(); + private $fallbackDirsPsr0 = array(); + + private $useIncludePath = false; + private $classMap = array(); + private $classMapAuthoritative = false; + private $missingClasses = array(); + private $apcuPrefix; + + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', $this->prefixesPsr0); + } + + return array(); + } + + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Unregisters this instance as an autoloader. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return bool|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + */ +function includeFile($file) +{ + include $file; +} diff --git a/lib/vendor/composer/LICENSE b/lib/vendor/composer/LICENSE new file mode 100644 index 0000000..f27399a --- /dev/null +++ b/lib/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/lib/vendor/composer/autoload_classmap.php b/lib/vendor/composer/autoload_classmap.php new file mode 100644 index 0000000..7a91153 --- /dev/null +++ b/lib/vendor/composer/autoload_classmap.php @@ -0,0 +1,9 @@ + array($vendorDir . '/globalpayments/php-sdk/src'), +); diff --git a/lib/vendor/composer/autoload_real.php b/lib/vendor/composer/autoload_real.php new file mode 100644 index 0000000..e5cb245 --- /dev/null +++ b/lib/vendor/composer/autoload_real.php @@ -0,0 +1,52 @@ += 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require_once __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInitf9480bef670eec5a1ff9c2cbff716477::getInitializer($loader)); + } else { + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } + + $loader->register(true); + + return $loader; + } +} diff --git a/lib/vendor/composer/autoload_static.php b/lib/vendor/composer/autoload_static.php new file mode 100644 index 0000000..21b78ff --- /dev/null +++ b/lib/vendor/composer/autoload_static.php @@ -0,0 +1,31 @@ + + array ( + 'GlobalPayments\\Api\\' => 19, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'GlobalPayments\\Api\\' => + array ( + 0 => __DIR__ . '/..' . '/globalpayments/php-sdk/src', + ), + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInitf9480bef670eec5a1ff9c2cbff716477::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitf9480bef670eec5a1ff9c2cbff716477::$prefixDirsPsr4; + + }, null, ClassLoader::class); + } +} diff --git a/lib/vendor/composer/installed.json b/lib/vendor/composer/installed.json new file mode 100644 index 0000000..dfb2237 --- /dev/null +++ b/lib/vendor/composer/installed.json @@ -0,0 +1,49 @@ +[ + { + "name": "globalpayments/php-sdk", + "version": "1.3.3", + "version_normalized": "1.3.3.0", + "source": { + "type": "git", + "url": "https://github.com/globalpayments/php-sdk.git", + "reference": "1fd0393b3fc231fcff2977a152b7a7b9e0c1d57f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/globalpayments/php-sdk/zipball/1fd0393b3fc231fcff2977a152b7a7b9e0c1d57f", + "reference": "1fd0393b3fc231fcff2977a152b7a7b9e0c1d57f", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-dom": "*", + "ext-openssl": "*", + "php": ">= 5.5.9" + }, + "require-dev": { + "brianium/paratest": "dev-master", + "phpstan/phpstan-shim": "^0.8.4", + "phpunit/phpunit": "~5.0", + "squizlabs/php_codesniffer": "2.*" + }, + "time": "2019-10-03T15:15:47+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "GlobalPayments\\Api\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Heartland Payment Systems" + } + ], + "description": "PHP SDK for processing payments with Global Payments, including Heartland Payment Systems and Realex Payments", + "homepage": "https://developer.heartlandpaymentsystems.com/documentation" + } +] diff --git a/lib/vendor/globalpayments/php-sdk/.gitignore b/lib/vendor/globalpayments/php-sdk/.gitignore new file mode 100644 index 0000000..caae86d --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/.gitignore @@ -0,0 +1,9 @@ +composer.phar +/vendor/ + +# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file +# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file +# composer.lock +composer +/docs/ +/docs-cache/ diff --git a/lib/vendor/globalpayments/php-sdk/.travis.yml b/lib/vendor/globalpayments/php-sdk/.travis.yml new file mode 100644 index 0000000..fc15400 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/.travis.yml @@ -0,0 +1,25 @@ +language: php + +sudo: false +branches: + only: + - master + +php: + - '7.0' + +install: + - composer install + +script: + # Build docs + - composer docs + +deploy: + local-dir: docs + provider: pages + skip-cleanup: true + github-token: $GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable + keep-history: true + on: + branch: master diff --git a/lib/vendor/globalpayments/php-sdk/LICENSE.md b/lib/vendor/globalpayments/php-sdk/LICENSE.md new file mode 100644 index 0000000..0671f06 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/LICENSE.md @@ -0,0 +1,264 @@ +The GNU General Public License, Version 2, June 1991 (GPLv2) +============================================================ + +> Copyright (C) 1989, 1991 Free Software Foundation, Inc. +> 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + + +Preamble +-------- + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public License is intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. This General Public License applies to most +of the Free Software Foundation's software and to any other program whose +authors commit to using it. (Some other Free Software Foundation software is +covered by the GNU Library General Public License instead.) You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom to +distribute copies of free software (and charge for this service if you wish), +that you receive source code or can get it if you want it, that you can change +the software or use pieces of it in new free programs; and that you know you can +do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny +you these rights or to ask you to surrender the rights. These restrictions +translate to certain responsibilities for you if you distribute copies of the +software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a +fee, you must give the recipients all the rights that you have. You must make +sure that they, too, receive or can get the source code. And you must show them +these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer +you this license which gives you legal permission to copy, distribute and/or +modify the software. + +Also, for each author's protection and ours, we want to make certain that +everyone understands that there is no warranty for this free software. If the +software is modified by someone else and passed on, we want its recipients to +know that what they have is not the original, so that any problems introduced by +others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish +to avoid the danger that redistributors of a free program will individually +obtain patent licenses, in effect making the program proprietary. To prevent +this, we have made it clear that any patent must be licensed for everyone's free +use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification +follow. + + +Terms And Conditions For Copying, Distribution And Modification +--------------------------------------------------------------- + +**0.** This License applies to any program or other work which contains a notice +placed by the copyright holder saying it may be distributed under the terms of +this General Public License. The "Program", below, refers to any such program or +work, and a "work based on the Program" means either the Program or any +derivative work under copyright law: that is to say, a work containing the +Program or a portion of it, either verbatim or with modifications and/or +translated into another language. (Hereinafter, translation is included without +limitation in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by +this License; they are outside its scope. The act of running the Program is not +restricted, and the output from the Program is covered only if its contents +constitute a work based on the Program (independent of having been made by +running the Program). Whether that is true depends on what the Program does. + +**1.** You may copy and distribute verbatim copies of the Program's source code +as you receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice and +disclaimer of warranty; keep intact all the notices that refer to this License +and to the absence of any warranty; and give any other recipients of the Program +a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at +your option offer warranty protection in exchange for a fee. + +**2.** You may modify your copy or copies of the Program or any portion of it, +thus forming a work based on the Program, and copy and distribute such +modifications or work under the terms of Section 1 above, provided that you also +meet all of these conditions: + +* **a)** You must cause the modified files to carry prominent notices stating + that you changed the files and the date of any change. + +* **b)** You must cause any work that you distribute or publish, that in whole + or in part contains or is derived from the Program or any part thereof, to + be licensed as a whole at no charge to all third parties under the terms of + this License. + +* **c)** If the modified program normally reads commands interactively when + run, you must cause it, when started running for such interactive use in the + most ordinary way, to print or display an announcement including an + appropriate copyright notice and a notice that there is no warranty (or + else, saying that you provide a warranty) and that users may redistribute + the program under these conditions, and telling the user how to view a copy + of this License. (Exception: if the Program itself is interactive but does + not normally print such an announcement, your work based on the Program is + not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Program, and can be reasonably +considered independent and separate works in themselves, then this License, and +its terms, do not apply to those sections when you distribute them as separate +works. But when you distribute the same sections as part of a whole which is a +work based on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the entire whole, +and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your +rights to work written entirely by you; rather, the intent is to exercise the +right to control the distribution of derivative or collective works based on the +Program. + +In addition, mere aggregation of another work not based on the Program with the +Program (or with a work based on the Program) on a volume of a storage or +distribution medium does not bring the other work under the scope of this +License. + +**3.** You may copy and distribute the Program (or a work based on it, under +Section 2) in object code or executable form under the terms of Sections 1 and 2 +above provided that you also do one of the following: + +* **a)** Accompany it with the complete corresponding machine-readable source + code, which must be distributed under the terms of Sections 1 and 2 above on + a medium customarily used for software interchange; or, + +* **b)** Accompany it with a written offer, valid for at least three years, to + give any third party, for a charge no more than your cost of physically + performing source distribution, a complete machine-readable copy of the + corresponding source code, to be distributed under the terms of Sections 1 + and 2 above on a medium customarily used for software interchange; or, + +* **c)** Accompany it with the information you received as to the offer to + distribute corresponding source code. (This alternative is allowed only for + noncommercial distribution and only if you received the program in object + code or executable form with such an offer, in accord with Subsection b + above.) + +The source code for a work means the preferred form of the work for making +modifications to it. For an executable work, complete source code means all the +source code for all modules it contains, plus any associated interface +definition files, plus the scripts used to control compilation and installation +of the executable. However, as a special exception, the source code distributed +need not include anything that is normally distributed (in either source or +binary form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component itself +accompanies the executable. + +If distribution of executable or object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the source code +from the same place counts as distribution of the source code, even though third +parties are not compelled to copy the source along with the object code. + +**4.** You may not copy, modify, sublicense, or distribute the Program except as +expressly provided under this License. Any attempt otherwise to copy, modify, +sublicense or distribute the Program is void, and will automatically terminate +your rights under this License. However, parties who have received copies, or +rights, from you under this License will not have their licenses terminated so +long as such parties remain in full compliance. + +**5.** You are not required to accept this License, since you have not signed +it. However, nothing else grants you permission to modify or distribute the +Program or its derivative works. These actions are prohibited by law if you do +not accept this License. Therefore, by modifying or distributing the Program (or +any work based on the Program), you indicate your acceptance of this License to +do so, and all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +**6.** Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the original +licensor to copy, distribute or modify the Program subject to these terms and +conditions. You may not impose any further restrictions on the recipients' +exercise of the rights granted herein. You are not responsible for enforcing +compliance by third parties to this License. + +**7.** If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), conditions +are imposed on you (whether by court order, agreement or otherwise) that +contradict the conditions of this License, they do not excuse you from the +conditions of this License. If you cannot distribute so as to satisfy +simultaneously your obligations under this License and any other pertinent +obligations, then as a consequence you may not distribute the Program at all. +For example, if a patent license would not permit royalty-free redistribution of +the Program by all those who receive copies directly or indirectly through you, +then the only way you could satisfy both it and this License would be to refrain +entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply and the +section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or +other property right claims or to contest validity of any such claims; this +section has the sole purpose of protecting the integrity of the free software +distribution system, which is implemented by public license practices. Many +people have made generous contributions to the wide range of software +distributed through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing to +distribute software through any other system and a licensee cannot impose that +choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + +**8.** If the distribution and/or use of the Program is restricted in certain +countries either by patents or by copyrighted interfaces, the original copyright +holder who places the Program under this License may add an explicit +geographical distribution limitation excluding those countries, so that +distribution is permitted only in or among countries not thus excluded. In such +case, this License incorporates the limitation as if written in the body of this +License. + +**9.** The Free Software Foundation may publish revised and/or new versions of +the General Public License from time to time. Such new versions will be similar +in spirit to the present version, but may differ in detail to address new +problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies +a version number of this License which applies to it and "any later version", +you have the option of following the terms and conditions either of that version +or of any later version published by the Free Software Foundation. If the +Program does not specify a version number of this License, you may choose any +version ever published by the Free Software Foundation. + +**10.** If you wish to incorporate parts of the Program into other free programs +whose distribution conditions are different, write to the author to ask for +permission. For software which is copyrighted by the Free Software Foundation, +write to the Free Software Foundation; we sometimes make exceptions for this. +Our decision will be guided by the two goals of preserving the free status of +all derivatives of our free software and of promoting the sharing and reuse of +software generally. + + +No Warranty +----------- + +**11.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR +THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE +STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM +"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +**12.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR +INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA +BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER +OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. diff --git a/lib/vendor/globalpayments/php-sdk/README.md b/lib/vendor/globalpayments/php-sdk/README.md new file mode 100644 index 0000000..3653399 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/README.md @@ -0,0 +1,136 @@ + + Global Payments logo + + +# Heartland & Global Payments PHP SDK + +This SDK makes it easy to integrate your PHP application with our Card Not Present and Card Present APIs. + +## Solutions + +### General / Omnichannel + +* API Payment Processing +* Apple Pay & Google Pay +* Secure Card Storage & Customer Management +* Subscriptions / Recurring Billing Solutions +* Credit, Debit, Gift & Loyalty, and eCheck/ACH + +### Card Not Present (Ecommerce & MOTO) Specific + +* Minimize PCI compliance requirements with Hosted Payment Solutions +* 140+ Authorization Currencies & 16 Settlement Currencies +* 150+ Local Payment Methods Worldwide +* Account Updater +* Inbuilt Fraud Prevention Rules +* 3D Secure, AVS and CVV Checks +* 260+ Global Enterprise Fraud Rules + +### Card Present (Terminal & POS) Specific + +* Secure End-To-End Encryption + +## Requirements + +- PHP 5.5.9+ +- OpenSSL 1.0.1+ +- PHP Curl extension +- PHP DOM extension +- PHP OpenSSL extension + +## Installation + +Installing the SDK into your solution is usually be done by either using Composer/Packagist, or by adding the project to your solution and referencing it directly. + +To install via [Composer/Packagist](https://packagist.org/packages/globalpayments/php-sdk): + +``` +composer require globalpayments/php-sdk +``` + +To install via a direct download: + +Download and unzip or, using Git, [clone the repository](https://github.com/globalpayments/php-sdk) from GitHub. See more on [how to clone repositories](https://help.github.com/articles/cloning-a-repository/). + +``` +git clone https://github.com/globalpayments/php-sdk +``` + +## Documentation and Examples + +You can find the latest SDK documentation along with code examples and test cards on the [Global Payments](https://developer.realexpayments.com) and [Heartland](https://developer.heartlandpaymentsystems.com/documentation) Developer Hubs. + +In addition you can find working examples in the our example code repository. + +*Quick Tip*: The included [test suite](https://github.com/globalpayments/php-sdk/tree/master/test) can be a great source of code samples for using the SDK! + +#### Process a Payment Example + +```csharp +$card = new CreditCardData(); +$card->number = "4111111111111111"; +$card->expMonth = "12"; +$card->expYear = "2025"; +$card->cvn = "123"; + +try { + $response = $card->charge(129.99) + ->withCurrency("EUR") + ->execute(); + + $result = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED +} catch (ApiException $e) { + // handle errors +} +``` + +#### Test Card Data + +Name | Number | Exp Month | Exp Year | CVN +----------- | ---------------- | --------- | -------- | ---- +Visa | 4263970000005262 | 12 | 2025 | 123 +MasterCard | 2223000010005780 | 12 | 2019 | 900 +MasterCard | 5425230000004415 | 12 | 2025 | 123 +Discover | 6011000000000087 | 12 | 2025 | 123 +Amex | 374101000000608 | 12 | 2025 | 1234 +JCB | 3566000000000000 | 12 | 2025 | 123 +Diners Club | 36256000000725 | 12 | 2025 | 123 + +#### Testing Exceptions + +During your integration you will want to test for specific issuer responses such as 'Card Declined'. Because our sandbox environments do not actually reach out to issuing banks for authorizations, there are specific transaction amounts and/or card numbers that will trigger gateway and issuing bank responses. Please contact your support representative for a complete listing of values used to simulate transaction AVS/CVV results, declines, errors, and other responses that can be caught in your code. Example error handling code: + +```php +try { + $response = $card->charge(129.99) + ->withCurrency("EUR") + ->execute(); +} catch (BuilderException $e) { + // handle builder errors +} catch (ConfigurationException $e) { + // handle errors related to your services configuration +} catch (GatewayException $e) { + // handle gateway errors/exceptions +} catch (UnsupportedTransactionException $e) { + // handle errors when the configured gateway doesn't support + // desired transaction +} catch (ApiException $e) { + // handle all other errors +} +``` + +## Contributing + +All our code is open sourced and we encourage fellow developers to contribute and help improve it! + +1. Fork it +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Ensure SDK tests are passing +4. Commit your changes (`git commit -am 'Add some feature'`) +5. Push to the branch (`git push origin my-new-feature`) +6. Create new Pull Request + +## License + +This project is licensed under the GNU General Public License v2.0. Please see [LICENSE.md](LICENSE.md) located at the project's root for more details. diff --git a/lib/vendor/globalpayments/php-sdk/composer.json b/lib/vendor/globalpayments/php-sdk/composer.json new file mode 100644 index 0000000..ae26fd4 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/composer.json @@ -0,0 +1,44 @@ +{ + "name": "globalpayments/php-sdk", + "description": "PHP SDK for processing payments with Global Payments, including Heartland Payment Systems and Realex Payments", + "keywords": [ + ], + "homepage": "https://developer.heartlandpaymentsystems.com/documentation", + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Heartland Payment Systems" + } + ], + "require": { + "php": ">= 5.5.9", + "ext-curl": "*", + "ext-dom": "*", + "ext-openssl": "*" + }, + "require-dev": { + "phpunit/phpunit": "~5.0", + "brianium/paratest": "dev-master", + "squizlabs/php_codesniffer": "2.*", + "phpstan/phpstan-shim": "^0.8.4" + }, + "autoload": { + "psr-4": { + "GlobalPayments\\Api\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "GlobalPayments\\Api\\Tests\\": "test/" + } + }, + "scripts": { + "docs": "@php sami.phar update docs-config.php", + "pretest": "@composer test:lint", + "test": "@composer pretest && paratest --coverage-html=coverage.html --colors -f --stop-on-failure", + "test:lint": "phpcs" + }, + "config": { + "process-timeout":0 + } +} diff --git a/lib/vendor/globalpayments/php-sdk/composer.lock b/lib/vendor/globalpayments/php-sdk/composer.lock new file mode 100644 index 0000000..0260065 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/composer.lock @@ -0,0 +1,4199 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "5400d26ad80e42feba9aa303ed2a3d0c", + "packages": [], + "packages-dev": [ + { + "name": "brianium/habitat", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/brianium/habitat.git", + "reference": "d0979e3bb379cbc78ecb42b3ac171bc2b7e06d96" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/brianium/habitat/zipball/d0979e3bb379cbc78ecb42b3ac171bc2b7e06d96", + "reference": "d0979e3bb379cbc78ecb42b3ac171bc2b7e06d96", + "shasum": "" + }, + "require-dev": { + "monolog/monolog": ">=1.5.0", + "phpunit/phpunit": ">=3.7.21" + }, + "type": "library", + "autoload": { + "psr-0": { + "Habitat": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian", + "email": "scaturrob@gmail.com", + "homepage": "http://brianscaturro.com", + "role": "Lead" + } + ], + "description": "A dependable php environment", + "time": "2013-06-08T04:42:29+00:00" + }, + { + "name": "brianium/paratest", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/brianium/paratest.git", + "reference": "b4c5be606a03af51c313c12018a5e80d0ab9b94b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/brianium/paratest/zipball/b4c5be606a03af51c313c12018a5e80d0ab9b94b", + "reference": "b4c5be606a03af51c313c12018a5e80d0ab9b94b", + "shasum": "" + }, + "require": { + "brianium/habitat": "1.0.0", + "composer/semver": "~1.2", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-simplexml": "*", + "php": ">=5.5.11", + "phpunit/php-timer": ">=1.0.4", + "phpunit/phpunit": "~5.0", + "symfony/console": "~2.3|~3.0", + "symfony/process": "~2.3|~3.0" + }, + "bin": [ + "bin/paratest" + ], + "type": "library", + "autoload": { + "psr-0": { + "ParaTest": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Scaturro", + "email": "scaturrob@gmail.com", + "homepage": "http://brianscaturro.com", + "role": "Lead" + } + ], + "description": "Parallel testing for PHP", + "homepage": "https://github.com/brianium/paratest", + "keywords": [ + "concurrent", + "parallel", + "phpunit", + "testing" + ], + "time": "2017-06-07T20:20:03+00:00" + }, + { + "name": "cilex/cilex", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/Cilex/Cilex.git", + "reference": "7acd965a609a56d0345e8b6071c261fbdb926cb5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Cilex/Cilex/zipball/7acd965a609a56d0345e8b6071c261fbdb926cb5", + "reference": "7acd965a609a56d0345e8b6071c261fbdb926cb5", + "shasum": "" + }, + "require": { + "cilex/console-service-provider": "1.*", + "php": ">=5.3.3", + "pimple/pimple": "~1.0", + "symfony/finder": "~2.1", + "symfony/process": "~2.1" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*", + "symfony/validator": "~2.1" + }, + "suggest": { + "monolog/monolog": ">=1.0.0", + "symfony/validator": ">=1.0.0", + "symfony/yaml": ">=1.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-0": { + "Cilex": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "mike.vanriel@naenius.com" + } + ], + "description": "The PHP micro-framework for Command line tools based on the Symfony2 Components", + "homepage": "http://cilex.github.com", + "keywords": [ + "cli", + "microframework" + ], + "time": "2014-03-29T14:03:13+00:00" + }, + { + "name": "cilex/console-service-provider", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/Cilex/console-service-provider.git", + "reference": "25ee3d1875243d38e1a3448ff94bdf944f70d24e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Cilex/console-service-provider/zipball/25ee3d1875243d38e1a3448ff94bdf944f70d24e", + "reference": "25ee3d1875243d38e1a3448ff94bdf944f70d24e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "pimple/pimple": "1.*@dev", + "symfony/console": "~2.1" + }, + "require-dev": { + "cilex/cilex": "1.*@dev", + "silex/silex": "1.*@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-0": { + "Cilex\\Provider\\Console": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Beau Simensen", + "email": "beau@dflydev.com", + "homepage": "http://beausimensen.com" + }, + { + "name": "Mike van Riel", + "email": "mike.vanriel@naenius.com" + } + ], + "description": "Console Service Provider", + "keywords": [ + "cilex", + "console", + "pimple", + "service-provider", + "silex" + ], + "time": "2012-12-19T10:50:58+00:00" + }, + { + "name": "composer/semver", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "time": "2016-08-30T16:08:34+00:00" + }, + { + "name": "container-interop/container-interop", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/container-interop/container-interop.git", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "shasum": "" + }, + "require": { + "psr/container": "^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Interop\\Container\\": "src/Interop/Container/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", + "homepage": "https://github.com/container-interop/container-interop", + "time": "2017-02-14T19:40:03+00:00" + }, + { + "name": "doctrine/annotations", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "54cacc9b81758b14e3ce750f205a393d52339e97" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97", + "reference": "54cacc9b81758b14e3ce750f205a393d52339e97", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2017-02-24T16:22:25+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14T21:17:01+00:00" + }, + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09T13:34:57+00:00" + }, + { + "name": "erusev/parsedown", + "version": "1.6.2", + "source": { + "type": "git", + "url": "https://github.com/erusev/parsedown.git", + "reference": "1bf24f7334fe16c88bf9d467863309ceaf285b01" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/1bf24f7334fe16c88bf9d467863309ceaf285b01", + "reference": "1bf24f7334fe16c88bf9d467863309ceaf285b01", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Parsedown": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Emanuil Rusev", + "email": "hello@erusev.com", + "homepage": "http://erusev.com" + } + ], + "description": "Parser for Markdown.", + "homepage": "http://parsedown.org", + "keywords": [ + "markdown", + "parser" + ], + "time": "2017-03-29T16:04:15+00:00" + }, + { + "name": "herrera-io/json", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/kherge-php/json.git", + "reference": "60c696c9370a1e5136816ca557c17f82a6fa83f1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kherge-php/json/zipball/60c696c9370a1e5136816ca557c17f82a6fa83f1", + "reference": "60c696c9370a1e5136816ca557c17f82a6fa83f1", + "shasum": "" + }, + "require": { + "ext-json": "*", + "justinrainbow/json-schema": ">=1.0,<2.0-dev", + "php": ">=5.3.3", + "seld/jsonlint": ">=1.0,<2.0-dev" + }, + "require-dev": { + "herrera-io/phpunit-test-case": "1.*", + "mikey179/vfsstream": "1.1.0", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "files": [ + "src/lib/json_version.php" + ], + "psr-0": { + "Herrera\\Json": "src/lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kevin Herrera", + "email": "kevin@herrera.io", + "homepage": "http://kevin.herrera.io" + } + ], + "description": "A library for simplifying JSON linting and validation.", + "homepage": "http://herrera-io.github.com/php-json", + "keywords": [ + "json", + "lint", + "schema", + "validate" + ], + "abandoned": "kherge/json", + "time": "2013-10-30T16:51:34+00:00" + }, + { + "name": "herrera-io/phar-update", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/kherge-abandoned/php-phar-update.git", + "reference": "00a79e1d5b8cf3c080a2e3becf1ddf7a7fea025b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kherge-abandoned/php-phar-update/zipball/00a79e1d5b8cf3c080a2e3becf1ddf7a7fea025b", + "reference": "00a79e1d5b8cf3c080a2e3becf1ddf7a7fea025b", + "shasum": "" + }, + "require": { + "herrera-io/json": "1.*", + "kherge/version": "1.*", + "php": ">=5.3.3" + }, + "require-dev": { + "herrera-io/phpunit-test-case": "1.*", + "mikey179/vfsstream": "1.1.0", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "files": [ + "src/lib/constants.php" + ], + "psr-0": { + "Herrera\\Phar\\Update": "src/lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kevin Herrera", + "email": "kevin@herrera.io", + "homepage": "http://kevin.herrera.io" + } + ], + "description": "A library for self-updating Phars.", + "homepage": "http://herrera-io.github.com/php-phar-update", + "keywords": [ + "phar", + "update" + ], + "abandoned": true, + "time": "2013-10-30T17:23:01+00:00" + }, + { + "name": "jms/metadata", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/metadata.git", + "reference": "6a06970a10e0a532fb52d3959547123b84a3b3ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/6a06970a10e0a532fb52d3959547123b84a3b3ab", + "reference": "6a06970a10e0a532fb52d3959547123b84a3b3ab", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "doctrine/cache": "~1.0", + "symfony/cache": "~3.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5.x-dev" + } + }, + "autoload": { + "psr-0": { + "Metadata\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Class/method/property metadata management in PHP", + "keywords": [ + "annotations", + "metadata", + "xml", + "yaml" + ], + "time": "2016-12-05T10:18:33+00:00" + }, + { + "name": "jms/parser-lib", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/parser-lib.git", + "reference": "c509473bc1b4866415627af0e1c6cc8ac97fa51d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/parser-lib/zipball/c509473bc1b4866415627af0e1c6cc8ac97fa51d", + "reference": "c509473bc1b4866415627af0e1c6cc8ac97fa51d", + "shasum": "" + }, + "require": { + "phpoption/phpoption": ">=0.9,<2.0-dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-0": { + "JMS\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache2" + ], + "description": "A library for easily creating recursive-descent parsers.", + "time": "2012-11-18T18:08:43+00:00" + }, + { + "name": "jms/serializer", + "version": "1.7.1", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/serializer.git", + "reference": "4fad8bbbe76e05de3b79ffa3db027058ed3813ff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/4fad8bbbe76e05de3b79ffa3db027058ed3813ff", + "reference": "4fad8bbbe76e05de3b79ffa3db027058ed3813ff", + "shasum": "" + }, + "require": { + "doctrine/annotations": "^1.0", + "doctrine/instantiator": "^1.0.3", + "jms/metadata": "~1.1", + "jms/parser-lib": "1.*", + "php": ">=5.5.0", + "phpcollection/phpcollection": "~0.1", + "phpoption/phpoption": "^1.1" + }, + "conflict": { + "jms/serializer-bundle": "<1.2.1", + "twig/twig": "<1.12" + }, + "require-dev": { + "doctrine/orm": "~2.1", + "doctrine/phpcr-odm": "^1.3|^2.0", + "ext-pdo_sqlite": "*", + "jackalope/jackalope-doctrine-dbal": "^1.1.5", + "phpunit/phpunit": "^4.8|^5.0", + "propel/propel1": "~1.7", + "symfony/expression-language": "^2.6|^3.0", + "symfony/filesystem": "^2.1", + "symfony/form": "~2.1|^3.0", + "symfony/translation": "^2.1|^3.0", + "symfony/validator": "^2.2|^3.0", + "symfony/yaml": "^2.1|^3.0", + "twig/twig": "~1.12|~2.0" + }, + "suggest": { + "doctrine/cache": "Required if you like to use cache functionality.", + "doctrine/collections": "Required if you like to use doctrine collection types as ArrayCollection.", + "symfony/yaml": "Required if you'd like to serialize data to YAML format." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + }, + "autoload": { + "psr-0": { + "JMS\\Serializer": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.", + "homepage": "http://jmsyst.com/libs/serializer", + "keywords": [ + "deserialization", + "jaxb", + "json", + "serialization", + "xml" + ], + "time": "2017-05-15T08:35:42+00:00" + }, + { + "name": "justinrainbow/json-schema", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/justinrainbow/json-schema.git", + "reference": "cc84765fb7317f6b07bd8ac78364747f95b86341" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/cc84765fb7317f6b07bd8ac78364747f95b86341", + "reference": "cc84765fb7317f6b07bd8ac78364747f95b86341", + "shasum": "" + }, + "require": { + "php": ">=5.3.29" + }, + "require-dev": { + "json-schema/json-schema-test-suite": "1.1.0", + "phpdocumentor/phpdocumentor": "~2", + "phpunit/phpunit": "~3.7" + }, + "bin": [ + "bin/validate-json" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "JsonSchema\\": "src/JsonSchema/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Bruno Prieto Reis", + "email": "bruno.p.reis@gmail.com" + }, + { + "name": "Justin Rainbow", + "email": "justin.rainbow@gmail.com" + }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + }, + { + "name": "Robert Schönthal", + "email": "seroscho@googlemail.com" + } + ], + "description": "A library to validate a json schema.", + "homepage": "https://github.com/justinrainbow/json-schema", + "keywords": [ + "json", + "schema" + ], + "time": "2016-01-25T15:43:01+00:00" + }, + { + "name": "kherge/version", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/kherge-abandoned/Version.git", + "reference": "f07cf83f8ce533be8f93d2893d96d674bbeb7e30" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kherge-abandoned/Version/zipball/f07cf83f8ce533be8f93d2893d96d674bbeb7e30", + "reference": "f07cf83f8ce533be8f93d2893d96d674bbeb7e30", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-0": { + "KevinGH\\Version": "src/lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kevin Herrera", + "email": "me@kevingh.com" + } + ], + "description": "A parsing and comparison library for semantic versioning.", + "homepage": "http://github.com/kherge/Version", + "abandoned": true, + "time": "2012-08-16T17:13:03+00:00" + }, + { + "name": "monolog/monolog", + "version": "1.22.1", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1e044bc4b34e91743943479f1be7a1d5eb93add0", + "reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "~5.3" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2017-03-13T07:08:03+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "doctrine/collections": "1.*", + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "homepage": "https://github.com/myclabs/DeepCopy", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2017-04-12T18:52:22+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v1.4.1", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "f78af2c9c86107aa1a34cd1dbb5bbe9eeb0d9f51" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f78af2c9c86107aa1a34cd1dbb5bbe9eeb0d9f51", + "reference": "f78af2c9c86107aa1a34cd1dbb5bbe9eeb0d9f51", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "files": [ + "lib/bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2015-09-19T14:15:08+00:00" + }, + { + "name": "phpcollection/phpcollection", + "version": "0.5.0", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-collection.git", + "reference": "f2bcff45c0da7c27991bbc1f90f47c4b7fb434a6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-collection/zipball/f2bcff45c0da7c27991bbc1f90f47c4b7fb434a6", + "reference": "f2bcff45c0da7c27991bbc1f90f47c4b7fb434a6", + "shasum": "" + }, + "require": { + "phpoption/phpoption": "1.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.4-dev" + } + }, + "autoload": { + "psr-0": { + "PhpCollection": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache2" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "General-Purpose Collection Library for PHP", + "keywords": [ + "collection", + "list", + "map", + "sequence", + "set" + ], + "time": "2015-05-17T12:39:23+00:00" + }, + { + "name": "phpdocumentor/fileset", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/Fileset.git", + "reference": "bfa78d8fa9763dfce6d0e5d3730c1d8ab25d34b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/Fileset/zipball/bfa78d8fa9763dfce6d0e5d3730c1d8ab25d34b0", + "reference": "bfa78d8fa9763dfce6d0e5d3730c1d8ab25d34b0", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/finder": "~2.1" + }, + "require-dev": { + "phpunit/phpunit": "~3.7" + }, + "type": "library", + "autoload": { + "psr-0": { + "phpDocumentor": [ + "src/", + "tests/unit/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Fileset component for collecting a set of files given directories and file paths", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "files", + "fileset", + "phpdoc" + ], + "time": "2013-08-06T21:07:42+00:00" + }, + { + "name": "phpdocumentor/graphviz", + "version": "1.0.4", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/GraphViz.git", + "reference": "a906a90a9f230535f25ea31caf81b2323956283f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/GraphViz/zipball/a906a90a9f230535f25ea31caf81b2323956283f", + "reference": "a906a90a9f230535f25ea31caf81b2323956283f", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "phpDocumentor": [ + "src/", + "tests/unit" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "mike.vanriel@naenius.com" + } + ], + "time": "2016-02-02T13:00:08+00:00" + }, + { + "name": "phpdocumentor/phpdocumentor", + "version": "v2.9.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/phpDocumentor2.git", + "reference": "be607da0eef9b9249c43c5b4820d25d631c73667" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/phpDocumentor2/zipball/be607da0eef9b9249c43c5b4820d25d631c73667", + "reference": "be607da0eef9b9249c43c5b4820d25d631c73667", + "shasum": "" + }, + "require": { + "cilex/cilex": "~1.0", + "erusev/parsedown": "~1.0", + "herrera-io/phar-update": "1.0.3", + "jms/serializer": ">=0.12", + "monolog/monolog": "~1.6", + "php": ">=5.3.3", + "phpdocumentor/fileset": "~1.0", + "phpdocumentor/graphviz": "~1.0", + "phpdocumentor/reflection": "^3.0", + "phpdocumentor/reflection-docblock": "~2.0", + "symfony/config": "~2.3", + "symfony/console": "~2.3", + "symfony/event-dispatcher": "~2.1", + "symfony/process": "~2.0", + "symfony/stopwatch": "~2.3", + "symfony/validator": "~2.2", + "twig/twig": "~1.3", + "zendframework/zend-cache": "~2.1", + "zendframework/zend-config": "~2.1", + "zendframework/zend-filter": "~2.1", + "zendframework/zend-i18n": "~2.1", + "zendframework/zend-serializer": "~2.1", + "zendframework/zend-servicemanager": "~2.1", + "zendframework/zend-stdlib": "~2.1", + "zetacomponents/document": ">=1.3.1" + }, + "require-dev": { + "behat/behat": "~3.0", + "mikey179/vfsstream": "~1.2", + "mockery/mockery": "~0.9@dev", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~1.4", + "symfony/expression-language": "~2.4" + }, + "suggest": { + "ext-twig": "Enabling the twig extension improves the generation of twig based templates.", + "ext-xslcache": "Enabling the XSLCache extension improves the generation of xml based templates." + }, + "bin": [ + "bin/phpdoc.php", + "bin/phpdoc" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "2.9-dev" + } + }, + "autoload": { + "psr-0": { + "phpDocumentor": [ + "src/", + "tests/unit/" + ], + "Cilex\\Provider": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Documentation Generator for PHP", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "api", + "application", + "dga", + "documentation", + "phpdoc" + ], + "time": "2016-05-22T09:50:56+00:00" + }, + { + "name": "phpdocumentor/reflection", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/Reflection.git", + "reference": "793bfd92d9a0fc96ae9608fb3e947c3f59fb3a0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/Reflection/zipball/793bfd92d9a0fc96ae9608fb3e947c3f59fb3a0d", + "reference": "793bfd92d9a0fc96ae9608fb3e947c3f59fb3a0d", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^1.0", + "php": ">=5.3.3", + "phpdocumentor/reflection-docblock": "~2.0", + "psr/log": "~1.0" + }, + "require-dev": { + "behat/behat": "~2.4", + "mockery/mockery": "~0.8", + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "phpDocumentor": [ + "src/", + "tests/unit/", + "tests/mocks/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Reflection library to do Static Analysis for PHP Projects", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2016-05-21T08:42:32+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e6a969a640b00d8daa3c66518b0405fb41ae0c4b", + "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "dflydev/markdown": "~1.0", + "erusev/parsedown": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "phpDocumentor": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "mike.vanriel@naenius.com" + } + ], + "time": "2016-01-25T08:17:30+00:00" + }, + { + "name": "phpoption/phpoption", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "94e644f7d2051a5f0fcf77d81605f152eecff0ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/94e644f7d2051a5f0fcf77d81605f152eecff0ed", + "reference": "94e644f7d2051a5f0fcf77d81605f152eecff0ed", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "4.7.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-0": { + "PhpOption\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache2" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Option Type for PHP", + "keywords": [ + "language", + "option", + "php", + "type" + ], + "time": "2015-07-25T16:39:46+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "v1.7.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "sebastian/comparator": "^1.1|^2.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8 || ^5.6.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2017-03-02T20:05:34+00:00" + }, + { + "name": "phpstan/phpstan-shim", + "version": "0.8.4", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-shim.git", + "reference": "0f18bcb91b7ee29571fab315d334752b123dc003" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-shim/zipball/0f18bcb91b7ee29571fab315d334752b123dc003", + "reference": "0f18bcb91b7ee29571fab315d334752b123dc003", + "shasum": "" + }, + "require": { + "php": "~7.0" + }, + "provide": { + "phpstan/phpstan": "0.8" + }, + "bin": [ + "phpstan.phar" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.8-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan Phar distribution", + "time": "2017-08-25T08:33:08+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "4.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^5.6 || ^7.0", + "phpunit/php-file-iterator": "^1.3", + "phpunit/php-text-template": "^1.2", + "phpunit/php-token-stream": "^1.4.2 || ^2.0", + "sebastian/code-unit-reverse-lookup": "^1.0", + "sebastian/environment": "^1.3.2 || ^2.0", + "sebastian/version": "^1.0 || ^2.0" + }, + "require-dev": { + "ext-xdebug": "^2.1.4", + "phpunit/phpunit": "^5.7" + }, + "suggest": { + "ext-xdebug": "^2.5.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2017-04-02T07:44:40+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2016-10-03T07:40:28+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2017-02-26T11:10:40+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.4.11", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2017-02-27T10:12:30+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "5.7.20", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "3cb94a5f8c07a03c8b7527ed7468a2926203f58b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3cb94a5f8c07a03c8b7527ed7468a2926203f58b", + "reference": "3cb94a5f8c07a03c8b7527ed7468a2926203f58b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "~1.3", + "php": "^5.6 || ^7.0", + "phpspec/prophecy": "^1.6.2", + "phpunit/php-code-coverage": "^4.0.4", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "^3.2", + "sebastian/comparator": "^1.2.4", + "sebastian/diff": "^1.4.3", + "sebastian/environment": "^1.3.4 || ^2.0", + "sebastian/exporter": "~2.0", + "sebastian/global-state": "^1.1", + "sebastian/object-enumerator": "~2.0", + "sebastian/resource-operations": "~1.0", + "sebastian/version": "~1.0.3|~2.0", + "symfony/yaml": "~2.1|~3.0" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "3.0.2" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-xdebug": "*", + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.7.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2017-05-22T07:42:55+00:00" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "3.4.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3ab72b65b39b491e0c011e2e09bb2206c2aa8e24", + "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.6 || ^7.0", + "phpunit/php-text-template": "^1.2", + "sebastian/exporter": "^1.2 || ^2.0" + }, + "conflict": { + "phpunit/phpunit": "<5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.4" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2016-12-08T20:27:08+00:00" + }, + { + "name": "pimple/pimple", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/2019c145fe393923f3441b23f29bbdfaa5c58c4d", + "reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-0": { + "Pimple": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Pimple is a simple Dependency Injection Container for PHP 5.3", + "homepage": "http://pimple.sensiolabs.org", + "keywords": [ + "container", + "dependency injection" + ], + "time": "2013-11-22T08:30:29+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "1.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2 || ~2.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2017-01-29T09:50:25+00:00" + }, + { + "name": "sebastian/diff", + "version": "1.4.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2017-05-22T07:24:03+00:00" + }, + { + "name": "sebastian/environment", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2016-11-26T07:53:53+00:00" + }, + { + "name": "sebastian/exporter", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~2.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2016-11-19T08:54:04+00:00" + }, + { + "name": "sebastian/global-state", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2015-10-12T03:26:01+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "sebastian/recursion-context": "~2.0" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-02-18T15:18:39+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2016-11-19T07:33:16+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28T20:34:47+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "seld/jsonlint", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/jsonlint.git", + "reference": "791f8c594f300d246cdf01c6b3e1e19611e301d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/791f8c594f300d246cdf01c6b3e1e19611e301d8", + "reference": "791f8c594f300d246cdf01c6b3e1e19611e301d8", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5" + }, + "bin": [ + "bin/jsonlint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Seld\\JsonLint\\": "src/Seld/JsonLint/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "JSON Linter", + "keywords": [ + "json", + "linter", + "parser", + "validator" + ], + "time": "2017-03-06T16:42:24+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "2.9.1", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62", + "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "bin": [ + "scripts/phpcs", + "scripts/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "classmap": [ + "CodeSniffer.php", + "CodeSniffer/CLI.php", + "CodeSniffer/Exception.php", + "CodeSniffer/File.php", + "CodeSniffer/Fixer.php", + "CodeSniffer/Report.php", + "CodeSniffer/Reporting.php", + "CodeSniffer/Sniff.php", + "CodeSniffer/Tokens.php", + "CodeSniffer/Reports/", + "CodeSniffer/Tokenizers/", + "CodeSniffer/DocGenerators/", + "CodeSniffer/Standards/AbstractPatternSniff.php", + "CodeSniffer/Standards/AbstractScopeSniff.php", + "CodeSniffer/Standards/AbstractVariableSniff.php", + "CodeSniffer/Standards/IncorrectPatternException.php", + "CodeSniffer/Standards/Generic/Sniffs/", + "CodeSniffer/Standards/MySource/Sniffs/", + "CodeSniffer/Standards/PEAR/Sniffs/", + "CodeSniffer/Standards/PSR1/Sniffs/", + "CodeSniffer/Standards/PSR2/Sniffs/", + "CodeSniffer/Standards/Squiz/Sniffs/", + "CodeSniffer/Standards/Zend/Sniffs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2017-05-22T02:43:20+00:00" + }, + { + "name": "symfony/config", + "version": "v2.8.22", + "source": { + "type": "git", + "url": "https://github.com/symfony/config.git", + "reference": "0b8541d18507d10204a08384640ff6df3c739ebe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/config/zipball/0b8541d18507d10204a08384640ff6df3c739ebe", + "reference": "0b8541d18507d10204a08384640ff6df3c739ebe", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/filesystem": "~2.3|~3.0.0" + }, + "require-dev": { + "symfony/yaml": "~2.7|~3.0.0" + }, + "suggest": { + "symfony/yaml": "To use the yaml reference dumper" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Config\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Config Component", + "homepage": "https://symfony.com", + "time": "2017-04-12T14:07:15+00:00" + }, + { + "name": "symfony/console", + "version": "v2.8.22", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "3ef6ef64abecd566d551d9e7f6393ac6e93b2462" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/3ef6ef64abecd566d551d9e7f6393ac6e93b2462", + "reference": "3ef6ef64abecd566d551d9e7f6393ac6e93b2462", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/debug": "^2.7.2|~3.0.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/event-dispatcher": "~2.1|~3.0.0", + "symfony/process": "~2.1|~3.0.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2017-06-02T14:36:56+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/697c527acd9ea1b2d3efac34d9806bf255278b0a", + "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/class-loader": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2016-07-30T07:22:48+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v2.8.22", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "1377400fd641d7d1935981546aaef780ecd5bf6d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/1377400fd641d7d1935981546aaef780ecd5bf6d", + "reference": "1377400fd641d7d1935981546aaef780ecd5bf6d", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "^2.0.5|~3.0.0", + "symfony/dependency-injection": "~2.6|~3.0.0", + "symfony/expression-language": "~2.6|~3.0.0", + "symfony/stopwatch": "~2.3|~3.0.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2017-06-02T07:47:27+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v3.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "b2da5009d9bacbd91d83486aa1f44c793a8c380d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/b2da5009d9bacbd91d83486aa1f44c793a8c380d", + "reference": "b2da5009d9bacbd91d83486aa1f44c793a8c380d", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "https://symfony.com", + "time": "2016-07-20T05:43:46+00:00" + }, + { + "name": "symfony/finder", + "version": "v2.8.22", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "4f4e84811004e065a3bb5ceeb1d9aa592630f9ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/4f4e84811004e065a3bb5ceeb1d9aa592630f9ad", + "reference": "4f4e84811004e065a3bb5ceeb1d9aa592630f9ad", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2017-06-01T20:52:29+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "f29dca382a6485c3cbe6379f0c61230167681937" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f29dca382a6485c3cbe6379f0c61230167681937", + "reference": "f29dca382a6485c3cbe6379f0c61230167681937", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2017-06-09T14:24:12+00:00" + }, + { + "name": "symfony/process", + "version": "v2.8.22", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "d54232f5682fda2f8bbebff7c81b864646867ab9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/d54232f5682fda2f8bbebff7c81b864646867ab9", + "reference": "d54232f5682fda2f8bbebff7c81b864646867ab9", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2017-05-08T01:19:21+00:00" + }, + { + "name": "symfony/stopwatch", + "version": "v2.8.22", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "e02577b841394a78306d7b547701bb7bb705bad5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/e02577b841394a78306d7b547701bb7bb705bad5", + "reference": "e02577b841394a78306d7b547701bb7bb705bad5", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Stopwatch Component", + "homepage": "https://symfony.com", + "time": "2017-04-12T14:07:15+00:00" + }, + { + "name": "symfony/translation", + "version": "v3.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation.git", + "reference": "eee6c664853fd0576f21ae25725cfffeafe83f26" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation/zipball/eee6c664853fd0576f21ae25725cfffeafe83f26", + "reference": "eee6c664853fd0576f21ae25725cfffeafe83f26", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/config": "<2.8" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0", + "symfony/intl": "~2.8|~3.0", + "symfony/yaml": "~2.8|~3.0" + }, + "suggest": { + "psr/log": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Translation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Translation Component", + "homepage": "https://symfony.com", + "time": "2016-07-30T07:22:48+00:00" + }, + { + "name": "symfony/validator", + "version": "v2.8.22", + "source": { + "type": "git", + "url": "https://github.com/symfony/validator.git", + "reference": "9f323f762ad21bfb9df7c1afacbdd8addf0f8c50" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/validator/zipball/9f323f762ad21bfb9df7c1afacbdd8addf0f8c50", + "reference": "9f323f762ad21bfb9df7c1afacbdd8addf0f8c50", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/polyfill-mbstring": "~1.0", + "symfony/translation": "~2.4|~3.0.0" + }, + "require-dev": { + "doctrine/annotations": "~1.0", + "doctrine/cache": "~1.0", + "egulias/email-validator": "^1.2.1", + "symfony/config": "~2.2|~3.0.0", + "symfony/expression-language": "~2.4|~3.0.0", + "symfony/http-foundation": "~2.3|~3.0.0", + "symfony/intl": "~2.7.25|^2.8.18|~3.2.5", + "symfony/property-access": "~2.3|~3.0.0", + "symfony/yaml": "^2.0.5|~3.0.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", + "doctrine/cache": "For using the default cached annotation reader and metadata cache.", + "egulias/email-validator": "Strict (RFC compliant) email validation", + "symfony/config": "", + "symfony/expression-language": "For using the 2.4 Expression validator", + "symfony/http-foundation": "", + "symfony/intl": "", + "symfony/property-access": "For using the 2.4 Validator API", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Validator\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Validator Component", + "homepage": "https://symfony.com", + "time": "2017-06-02T14:36:56+00:00" + }, + { + "name": "symfony/yaml", + "version": "v3.3.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "9752a30000a8ca9f4b34b5227d15d0101b96b063" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/9752a30000a8ca9f4b34b5227d15d0101b96b063", + "reference": "9752a30000a8ca9f4b34b5227d15d0101b96b063", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "require-dev": { + "symfony/console": "~2.8|~3.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2017-06-02T22:05:06+00:00" + }, + { + "name": "twig/twig", + "version": "v1.34.3", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "451c6f4197e113e24c1c85bc3fc8c2d77adeff2e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/451c6f4197e113e24c1c85bc3fc8c2d77adeff2e", + "reference": "451c6f4197e113e24c1c85bc3fc8c2d77adeff2e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "psr/container": "^1.0", + "symfony/debug": "~2.7", + "symfony/phpunit-bridge": "~3.3@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.34-dev" + } + }, + "autoload": { + "psr-0": { + "Twig_": "lib/" + }, + "psr-4": { + "Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + }, + { + "name": "Twig Team", + "homepage": "http://twig.sensiolabs.org/contributors", + "role": "Contributors" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "http://twig.sensiolabs.org", + "keywords": [ + "templating" + ], + "time": "2017-06-07T18:45:17+00:00" + }, + { + "name": "zendframework/zend-cache", + "version": "2.7.2", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-cache.git", + "reference": "c98331b96d3b9d9b24cf32d02660602edb34d039" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-cache/zipball/c98331b96d3b9d9b24cf32d02660602edb34d039", + "reference": "c98331b96d3b9d9b24cf32d02660602edb34d039", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "zendframework/zend-eventmanager": "^2.6.2 || ^3.0", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "require-dev": { + "phpbench/phpbench": "^0.10.0", + "phpunit/phpunit": "^4.8", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-serializer": "^2.6", + "zendframework/zend-session": "^2.6.2" + }, + "suggest": { + "ext-apc": "APC or compatible extension, to use the APC storage adapter", + "ext-apcu": "APCU >= 5.1.0, to use the APCu storage adapter", + "ext-dba": "DBA, to use the DBA storage adapter", + "ext-memcache": "Memcache >= 2.0.0 to use the Memcache storage adapter", + "ext-memcached": "Memcached >= 1.0.0 to use the Memcached storage adapter", + "ext-mongo": "Mongo, to use MongoDb storage adapter", + "ext-redis": "Redis, to use Redis storage adapter", + "ext-wincache": "WinCache, to use the WinCache storage adapter", + "ext-xcache": "XCache, to use the XCache storage adapter", + "mongofill/mongofill": "Alternative to ext-mongo - a pure PHP implementation designed as a drop in replacement", + "zendframework/zend-serializer": "Zend\\Serializer component", + "zendframework/zend-session": "Zend\\Session component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev", + "dev-develop": "2.8-dev" + }, + "zf": { + "component": "Zend\\Cache", + "config-provider": "Zend\\Cache\\ConfigProvider" + } + }, + "autoload": { + "psr-4": { + "Zend\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides a generic way to cache any data", + "homepage": "https://github.com/zendframework/zend-cache", + "keywords": [ + "cache", + "zf2" + ], + "time": "2016-12-16T11:35:47+00:00" + }, + { + "name": "zendframework/zend-config", + "version": "2.6.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-config.git", + "reference": "2920e877a9f6dca9fa8f6bd3b1ffc2e19bb1e30d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-config/zipball/2920e877a9f6dca9fa8f6bd3b1ffc2e19bb1e30d", + "reference": "2920e877a9f6dca9fa8f6bd3b1ffc2e19bb1e30d", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "zendframework/zend-filter": "^2.6", + "zendframework/zend-i18n": "^2.5", + "zendframework/zend-json": "^2.6.1", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3" + }, + "suggest": { + "zendframework/zend-filter": "Zend\\Filter component", + "zendframework/zend-i18n": "Zend\\I18n component", + "zendframework/zend-json": "Zend\\Json to use the Json reader or writer classes", + "zendframework/zend-servicemanager": "Zend\\ServiceManager for use with the Config Factory to retrieve reader and writer instances" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev", + "dev-develop": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Config\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides a nested object property based user interface for accessing this configuration data within application code", + "homepage": "https://github.com/zendframework/zend-config", + "keywords": [ + "config", + "zf2" + ], + "time": "2016-02-04T23:01:10+00:00" + }, + { + "name": "zendframework/zend-eventmanager", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-eventmanager.git", + "reference": "c3bce7b7d47c54040b9ae51bc55491c72513b75d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/c3bce7b7d47c54040b9ae51bc55491c72513b75d", + "reference": "c3bce7b7d47c54040b9ae51bc55491c72513b75d", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "athletic/athletic": "^0.1", + "container-interop/container-interop": "^1.1.0", + "phpunit/phpunit": "^5.6", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-stdlib": "^2.7.3 || ^3.0" + }, + "suggest": { + "container-interop/container-interop": "^1.1.0, to use the lazy listeners feature", + "zendframework/zend-stdlib": "^2.7.3 || ^3.0, to use the FilterChain feature" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev", + "dev-develop": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\EventManager\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Trigger and listen to events within a PHP application", + "homepage": "https://github.com/zendframework/zend-eventmanager", + "keywords": [ + "event", + "eventmanager", + "events", + "zf2" + ], + "time": "2016-12-19T21:47:12+00:00" + }, + { + "name": "zendframework/zend-filter", + "version": "2.7.2", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-filter.git", + "reference": "b8d0ff872f126631bf63a932e33aa2d22d467175" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-filter/zipball/b8d0ff872f126631bf63a932e33aa2d22d467175", + "reference": "b8d0ff872f126631bf63a932e33aa2d22d467175", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "require-dev": { + "pear/archive_tar": "^1.4", + "phpunit/phpunit": "^6.0.10 || ^5.7.17", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-crypt": "^2.6 || ^3.0", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", + "zendframework/zend-uri": "^2.5" + }, + "suggest": { + "zendframework/zend-crypt": "Zend\\Crypt component, for encryption filters", + "zendframework/zend-i18n": "Zend\\I18n component for filters depending on i18n functionality", + "zendframework/zend-servicemanager": "Zend\\ServiceManager component, for using the filter chain functionality", + "zendframework/zend-uri": "Zend\\Uri component, for the UriNormalize filter" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev", + "dev-develop": "2.8-dev" + }, + "zf": { + "component": "Zend\\Filter", + "config-provider": "Zend\\Filter\\ConfigProvider" + } + }, + "autoload": { + "psr-4": { + "Zend\\Filter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides a set of commonly needed data filters", + "homepage": "https://github.com/zendframework/zend-filter", + "keywords": [ + "filter", + "zf2" + ], + "time": "2017-05-17T20:56:17+00:00" + }, + { + "name": "zendframework/zend-hydrator", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-hydrator.git", + "reference": "22652e1661a5a10b3f564cf7824a2206cf5a4a65" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-hydrator/zipball/22652e1661a5a10b3f564cf7824a2206cf5a4a65", + "reference": "22652e1661a5a10b3f564cf7824a2206cf5a4a65", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "^2.0@dev", + "zendframework/zend-eventmanager": "^2.6.2 || ^3.0", + "zendframework/zend-filter": "^2.6", + "zendframework/zend-inputfilter": "^2.6", + "zendframework/zend-serializer": "^2.6.1", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3" + }, + "suggest": { + "zendframework/zend-eventmanager": "^2.6.2 || ^3.0, to support aggregate hydrator usage", + "zendframework/zend-filter": "^2.6, to support naming strategy hydrator usage", + "zendframework/zend-serializer": "^2.6.1, to use the SerializableStrategy", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3, to support hydrator plugin manager usage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-release-1.0": "1.0-dev", + "dev-release-1.1": "1.1-dev", + "dev-master": "2.0-dev", + "dev-develop": "2.1-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Hydrator\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-hydrator", + "keywords": [ + "hydrator", + "zf2" + ], + "time": "2016-02-18T22:38:26+00:00" + }, + { + "name": "zendframework/zend-i18n", + "version": "2.7.4", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-i18n.git", + "reference": "d3431e29cc00c2a1c6704e601d4371dbf24f6a31" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/d3431e29cc00c2a1c6704e601d4371dbf24f6a31", + "reference": "d3431e29cc00c2a1c6704e601d4371dbf24f6a31", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^5.6", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0.8 || ^5.7.15", + "zendframework/zend-cache": "^2.6.1", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-config": "^2.6", + "zendframework/zend-eventmanager": "^2.6.2 || ^3.0", + "zendframework/zend-filter": "^2.6.1", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", + "zendframework/zend-validator": "^2.6", + "zendframework/zend-view": "^2.6.3" + }, + "suggest": { + "ext-intl": "Required for most features of Zend\\I18n; included in default builds of PHP", + "zendframework/zend-cache": "Zend\\Cache component", + "zendframework/zend-config": "Zend\\Config component", + "zendframework/zend-eventmanager": "You should install this package to use the events in the translator", + "zendframework/zend-filter": "You should install this package to use the provided filters", + "zendframework/zend-i18n-resources": "Translation resources", + "zendframework/zend-servicemanager": "Zend\\ServiceManager component", + "zendframework/zend-validator": "You should install this package to use the provided validators", + "zendframework/zend-view": "You should install this package to use the provided view helpers" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev", + "dev-develop": "2.8-dev" + }, + "zf": { + "component": "Zend\\I18n", + "config-provider": "Zend\\I18n\\ConfigProvider" + } + }, + "autoload": { + "psr-4": { + "Zend\\I18n\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-i18n", + "keywords": [ + "i18n", + "zf2" + ], + "time": "2017-05-17T17:00:12+00:00" + }, + { + "name": "zendframework/zend-json", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-json.git", + "reference": "f42a1588e75c2a3e338cd94c37906231e616daab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-json/zipball/f42a1588e75c2a3e338cd94c37906231e616daab", + "reference": "f42a1588e75c2a3e338cd94c37906231e616daab", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "^2.3", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "suggest": { + "zendframework/zend-json-server": "For implementing JSON-RPC servers", + "zendframework/zend-xml2json": "For converting XML documents to JSON" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev", + "dev-develop": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Json\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides convenience methods for serializing native PHP to JSON and decoding JSON to native PHP", + "homepage": "https://github.com/zendframework/zend-json", + "keywords": [ + "json", + "zf2" + ], + "time": "2016-04-01T02:34:00+00:00" + }, + { + "name": "zendframework/zend-serializer", + "version": "2.8.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-serializer.git", + "reference": "ff74ea020f5f90866eb28365327e9bc765a61a6e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-serializer/zipball/ff74ea020f5f90866eb28365327e9bc765a61a6e", + "reference": "ff74ea020f5f90866eb28365327e9bc765a61a6e", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0", + "zendframework/zend-json": "^2.5 || ^3.0", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5", + "squizlabs/php_codesniffer": "^2.3.1", + "zendframework/zend-math": "^2.6", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3" + }, + "suggest": { + "zendframework/zend-math": "(^2.6 || ^3.0) To support Python Pickle serialization", + "zendframework/zend-servicemanager": "(^2.7.5 || ^3.0.3) To support plugin manager support" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev", + "dev-develop": "2.9-dev" + }, + "zf": { + "component": "Zend\\Serializer", + "config-provider": "Zend\\Serializer\\ConfigProvider" + } + }, + "autoload": { + "psr-4": { + "Zend\\Serializer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides an adapter based interface to simply generate storable representation of PHP types by different facilities, and recover", + "homepage": "https://github.com/zendframework/zend-serializer", + "keywords": [ + "serializer", + "zf2" + ], + "time": "2016-06-21T17:01:55+00:00" + }, + { + "name": "zendframework/zend-servicemanager", + "version": "2.7.8", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-servicemanager.git", + "reference": "2ae3b6e4978ec2e9ff52352e661946714ed989f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-servicemanager/zipball/2ae3b6e4978ec2e9ff52352e661946714ed989f9", + "reference": "2ae3b6e4978ec2e9ff52352e661946714ed989f9", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "~1.0", + "php": "^5.5 || ^7.0" + }, + "require-dev": { + "athletic/athletic": "dev-master", + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "zendframework/zend-di": "~2.5", + "zendframework/zend-mvc": "~2.5" + }, + "suggest": { + "ocramius/proxy-manager": "ProxyManager 0.5.* to handle lazy initialization of services", + "zendframework/zend-di": "Zend\\Di component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev", + "dev-develop": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\ServiceManager\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-servicemanager", + "keywords": [ + "servicemanager", + "zf2" + ], + "time": "2016-12-19T19:14:29+00:00" + }, + { + "name": "zendframework/zend-stdlib", + "version": "2.7.7", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-stdlib.git", + "reference": "0e44eb46788f65e09e077eb7f44d2659143bcc1f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/0e44eb46788f65e09e077eb7f44d2659143bcc1f", + "reference": "0e44eb46788f65e09e077eb7f44d2659143bcc1f", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "zendframework/zend-hydrator": "~1.1" + }, + "require-dev": { + "athletic/athletic": "~0.1", + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "zendframework/zend-config": "~2.5", + "zendframework/zend-eventmanager": "~2.5", + "zendframework/zend-filter": "~2.5", + "zendframework/zend-inputfilter": "~2.5", + "zendframework/zend-serializer": "~2.5", + "zendframework/zend-servicemanager": "~2.5" + }, + "suggest": { + "zendframework/zend-eventmanager": "To support aggregate hydrator usage", + "zendframework/zend-filter": "To support naming strategy hydrator usage", + "zendframework/zend-serializer": "Zend\\Serializer component", + "zendframework/zend-servicemanager": "To support hydrator plugin manager usage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-release-2.7": "2.7-dev", + "dev-master": "3.0-dev", + "dev-develop": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Stdlib\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-stdlib", + "keywords": [ + "stdlib", + "zf2" + ], + "time": "2016-04-12T21:17:31+00:00" + }, + { + "name": "zetacomponents/base", + "version": "1.9", + "source": { + "type": "git", + "url": "https://github.com/zetacomponents/Base.git", + "reference": "f20df24e8de3e48b6b69b2503f917e457281e687" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zetacomponents/Base/zipball/f20df24e8de3e48b6b69b2503f917e457281e687", + "reference": "f20df24e8de3e48b6b69b2503f917e457281e687", + "shasum": "" + }, + "require-dev": { + "zetacomponents/unit-test": "*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Sergey Alexeev" + }, + { + "name": "Sebastian Bergmann" + }, + { + "name": "Jan Borsodi" + }, + { + "name": "Raymond Bosman" + }, + { + "name": "Frederik Holljen" + }, + { + "name": "Kore Nordmann" + }, + { + "name": "Derick Rethans" + }, + { + "name": "Vadym Savchuk" + }, + { + "name": "Tobias Schlitt" + }, + { + "name": "Alexandru Stanoi" + } + ], + "description": "The Base package provides the basic infrastructure that all packages rely on. Therefore every component relies on this package.", + "homepage": "https://github.com/zetacomponents", + "time": "2014-09-19T03:28:34+00:00" + }, + { + "name": "zetacomponents/document", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/zetacomponents/Document.git", + "reference": "688abfde573cf3fe0730f82538fbd7aa9fc95bc8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zetacomponents/Document/zipball/688abfde573cf3fe0730f82538fbd7aa9fc95bc8", + "reference": "688abfde573cf3fe0730f82538fbd7aa9fc95bc8", + "shasum": "" + }, + "require": { + "zetacomponents/base": "*" + }, + "require-dev": { + "zetacomponents/unit-test": "dev-master" + }, + "type": "library", + "autoload": { + "classmap": [ + "src" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Sebastian Bergmann" + }, + { + "name": "Kore Nordmann" + }, + { + "name": "Derick Rethans" + }, + { + "name": "Tobias Schlitt" + }, + { + "name": "Alexandru Stanoi" + } + ], + "description": "The Document components provides a general conversion framework for different semantic document markup languages like XHTML, Docbook, RST and similar.", + "homepage": "https://github.com/zetacomponents", + "time": "2013-12-19T11:40:00+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "brianium/paratest": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">= 5.5.9", + "ext-curl": "*", + "ext-dom": "*", + "ext-openssl": "*" + }, + "platform-dev": [] +} \ No newline at end of file diff --git a/lib/vendor/globalpayments/php-sdk/docker-compose.yml b/lib/vendor/globalpayments/php-sdk/docker-compose.yml new file mode 100644 index 0000000..edb9600 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/docker-compose.yml @@ -0,0 +1,27 @@ +version: "2.1" +services: + php: + image: php:${PHP_VERSION}-alpine + volumes: + - .:/src + working_dir: /src + environment: + COMPOSER_ALLOW_SUPERUSER: 1 + + setup: + extends: + service: php + command: > + sh -c "php --version && + php -r \"copy('https://getcomposer.org/installer', 'composer-setup.php');\" && + php -r \"if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;\" && + php composer-setup.php --filename=composer && + php -r \"unlink('composer-setup.php');\" && + php composer install" + + test: + extends: + service: php + command: php composer test + + diff --git a/lib/vendor/globalpayments/php-sdk/docs-config.php b/lib/vendor/globalpayments/php-sdk/docs-config.php new file mode 100644 index 0000000..893d0ba --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/docs-config.php @@ -0,0 +1,17 @@ +files() + ->name('*.php') + ->in($dir = __DIR__ . '/src'); + +return new Sami($iterator, [ + 'title' => 'GlobalPayments\Api', + 'build_dir' => dirname($dir) . '/docs', + 'cache_dir' => dirname($dir) . '/docs-cache', + 'remote_repository' => new GitHubRemoteRepository('globalpayments/php-sdk', dirname($dir)), +]); diff --git a/lib/vendor/globalpayments/php-sdk/examples/consumer-authentication/JWT.php b/lib/vendor/globalpayments/php-sdk/examples/consumer-authentication/JWT.php new file mode 100644 index 0000000..16f16ff --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/consumer-authentication/JWT.php @@ -0,0 +1,64 @@ + + * @license Custom https://github.com/hps/heartland-php/blob/master/LICENSE.txt + * @link https://developer.heartlandpaymentsystems.com + */ + +class JWT +{ + /** + * Encodes a JWT with a `$key` and a `$payload` + * + * @param string $key key used to sign the JWT + * @param mixed $payload payload to be included + * + * @return string + */ + public static function encode($key = '', $payload = array()) + { + $header = array('typ' => 'JWT', 'alg' => 'HS256'); + + $parts = array( + self::urlsafeBase64Encode(json_encode($header)), + self::urlsafeBase64Encode(json_encode($payload)), + ); + $signingData = implode('.', $parts); + $signature = self::sign($key, $signingData); + $parts[] = self::urlsafeBase64Encode($signature); + + return implode('.', $parts); + } + + /** + * Creates a url-safe base64 encoded AnyValuesToken + * + * @param string $data data to be encoded + * + * @return string + */ + public static function urlsafeBase64Encode($data) + { + return str_replace('=', '', strtr(base64_encode($data), '+/', '-_')); + } + + /** + * Signs a set of `$signingData` with a given `$key` + * + * @param string $key key used to sign the JWT + * @param string $signingData data to be signed + * + * @return string + */ + public static function sign($key, $signingData) + { + return hash_hmac('sha256', $signingData, $key, true); + } +}; diff --git a/lib/vendor/globalpayments/php-sdk/examples/consumer-authentication/cruise.php b/lib/vendor/globalpayments/php-sdk/examples/consumer-authentication/cruise.php new file mode 100644 index 0000000..625ff58 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/consumer-authentication/cruise.php @@ -0,0 +1,341 @@ +'; + print_r($_GET); + print ''; + + $config = new ServicesConfig(); + $config->secretApiKey = 'skapi_cert_MT2PAQB-9VQA5Z1mOXQbzZcH6O5PpdhjWtFhMBoL4A'; + $config->serviceUrl = 'https://cert.api2.heartlandportico.com'; + + ServicesContainer::configure($config); + + $card = new CreditCardData(); + $card->token = $_GET['heartlandToken']; + + $secureEcommerce = new EcommerceInfo(); + $secureEcommerce->paymentDataSource = $_GET['cardType']; + $secureEcommerce->cavv = $_GET['cavv']; + $secureEcommerce->eci = substr($_GET['eciflag'], 1); + $secureEcommerce->xid = $_GET['xid']; + + $response = $card->charge(15) + ->withCurrency('USD') + ->withEcommerceInfo($secureEcommerce) + ->execute(); + + print '
';
+    print_r($response);
+    print '
'; +} else { + $orderNumber = str_shuffle('abcdefghijklmnopqrstuvwxyz'); + //$apiIdentifier = 'Merchant-uatmerchant-Key'; + //$orgUnitId = '55ef3e43f723aa431c9969ae'; + //$apiKey = 'ac848959-f878-4f62-a0a2-4b2a648446c3'; + $apiIdentifier = '579bc985da529378f0ec7d0e'; + $orgUnitId = '5799c3c433fadd4cf427d01a'; + $apiKey = 'a32ed153-3759-4302-a314-546811590b43'; + + $data = array( + 'jti' => str_shuffle('abcdefghijklmnopqrstuvwxyz'), + 'iat' => time(), + 'iss' => $apiIdentifier, + 'OrgUnitId' => $orgUnitId, + 'Payload' => array( + 'OrderDetails' => array( + 'OrderNumber' => $orderNumber, + 'Amount' => '1500', + 'CurrencyCode' => '840', + ), + ), + ); + $jwt = JWT::encode($apiKey, $data); + ?> +
+
+
+
+
+
+ + + + + + + + + +
+
+ +
+ + + + + + + + HPS e-check example + + + +

HPS e-check example

+
+

Billing Information

+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +

Payment Information

+
+ +
+ +
+
+ +

Check Information

+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ + +
+ + diff --git a/lib/vendor/globalpayments/php-sdk/examples/echeck/process.php b/lib/vendor/globalpayments/php-sdk/examples/echeck/process.php new file mode 100644 index 0000000..7e646ad --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/echeck/process.php @@ -0,0 +1,50 @@ +secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; +$config->serviceUrl = 'https://cert.api2.heartlandportico.com'; +$config->versionNumber = '0000'; +$config->developerId = '000000'; + +ServicesContainer::configure($config); + +$address = new Address(); +$address->address = $_POST['holder_address_address']; +$address->city = $_POST['holder_address_city']; +$address->state = $_POST['holder_address_state']; +$address->zip = $_POST['holder_address_zip']; + +$eCheck = new ECheck(); +$eCheck->accountNumber = $_POST['check_accountnumber']; +$eCheck->routingNumber = $_POST['check_routingnumber']; +$eCheck->checkType = $_POST['check_type']; +$eCheck->secCode = SecCode::WEB; +$eCheck->accountType = $_POST['account_type']; +$eCheck->entryMode = EntryMethod::MANUAL; +$eCheck->checkHolderName = 'John Doe'; + +try { + $response = $eCheck->charge($_POST['payment_amount']) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + + printf('Success! Transaction ID: %s', $response->transactionId); +} catch (Exception $e) { + printf('Error running check sale: %s', $e->getMessage()); + printf('
%s
', print_r($e, true)); +} diff --git a/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/heartland-styles.css b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/heartland-styles.css new file mode 100644 index 0000000..63bdcb4 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/heartland-styles.css @@ -0,0 +1,167 @@ +body { + font-family: sans-serif; +} + +iframe { + width:100%; + float: left; +} +.form-group { + height: 40px; +} +h2 { + margin: 7px 0; +} +#ss-card, +#ss-date, +#ss-cvv { + height: 85px; +} +#ss-card { + margin-bottom: 55px; + display: block; +} +#ss-date { + float: left; + display: block; +} +#ss-cvv.form-group { + float: right; +} +.iframeholder { + width:100%; +} +.ie8 form .iframeholder { + padding: 10px; +} +.iframeholder::after { + content: ''; + display: block; + width: 100%; + height: 0px; + clear: both; + position: relative; +} +.ie8 form .form-group { + margin-bottom: 5px; +} +textarea { + padding: 10px; + font-family: sans-serif; +} +label[for=iframesCardNumber], +label[for=iframesCardExpiration], +label[for=iframesCardCvv] { + text-transform: uppercase; + font-weight: 500; + font-size: 13px; + color: #555; + line-height: 1.5; +} +.ie8 form label { + padding-left: 10px; + margin: 0px; +} +#heartland-frame-cardExpiration, +#heartland-frame-cardCvv, +#heartland-frame-cardNumber, +.ie8 #heartland-frame-cardExpiration, +.ie8 #heartland-frame-cardCvv, +.ie8 #heartland-frame-cardNumber { + width: 100%; +} +iframe { + margin: 0; + padding: 0; + border: none; + width: value; + height: value; +} +#ss-banner { + background: transparent url(images/ss-shield@2x.png) no-repeat left center; + height: 40px; + background-size: 280px 34px; + margin-bottom: 7px; +} +.ie8 #ss-banner { + background: transparent url(images/ss-shield-ie.png) no-repeat left center; +} +.btn-primary { + display: block; + border-radius: 0px; + font-size: 18px; + float: right; + background-color: #36b46e; + border: 1px solid #2a8d56; + margin-bottom: 10px; + height: 50px; + color: #ffffff; + width: 100%; +} +.btn-primary:hover, +.btn-primary:focus { + color: #fff; + background-color: #2a8d56; +} +.ie8 .btn-primary { + width: 15%; +} +.red { + color: #ce2027; + margin-left: 2px; + font-size: 17px; +} +.container { + margin: 5px; +} +#ss-date.form-group, +#ss-cvv.form-group { + width: 100%; +} +@media screen and (min-width: 767px) { + #heartland-frame-cardNumber { + width: 100%; + } +} +@media screen and (min-width: 696px) { + #ss-date.form-group, + #ss-cvv.form-group { + width: 48%; + } +} +@media screen and (min-width: 636px) { + #ss-card { + margin-bottom: 40px; + } +} +@media screen and (min-width: 450px) { + .btn-primary, + .ie8 .btn-primary { + width: 10em; + } + .container { + margin: 20px; + } +} + +#ss-banner { + background: transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-shield@2x.png?raw=true) no-repeat left center; + height: 40px; + background-size: 280px 34px; + margin-bottom: 7px; +} + +user agent stylesheet +div { + display: block; +} + +.form-row { + margin-top: 10px; +} + +.form-wrapper { + display: block; + width: 300px; + margin: 10px auto; +} \ No newline at end of file diff --git a/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/cvv.png b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/cvv.png new file mode 100644 index 0000000..4d97b60 Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/cvv.png differ diff --git a/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/cvv1.png b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/cvv1.png new file mode 100644 index 0000000..1877174 Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/cvv1.png differ diff --git a/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/cvv2.png b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/cvv2.png new file mode 100644 index 0000000..445fbed Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/cvv2.png differ diff --git a/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-cvv@2x.png b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-cvv@2x.png new file mode 100644 index 0000000..7959068 Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-cvv@2x.png differ diff --git a/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-inputcard-blank@2x.png b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-inputcard-blank@2x.png new file mode 100644 index 0000000..4050c00 Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-inputcard-blank@2x.png differ diff --git a/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-saved-amex@2x.png b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-saved-amex@2x.png new file mode 100644 index 0000000..1b95fe9 Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-saved-amex@2x.png differ diff --git a/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-saved-discover@2x.png b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-saved-discover@2x.png new file mode 100644 index 0000000..30007be Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-saved-discover@2x.png differ diff --git a/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-saved-jcb@2x.png b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-saved-jcb@2x.png new file mode 100644 index 0000000..1aa107b Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-saved-jcb@2x.png differ diff --git a/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-saved-mastercard.png b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-saved-mastercard.png new file mode 100644 index 0000000..c6ef7fa Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-saved-mastercard.png differ diff --git a/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-saved-mastercard@2x.png b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-saved-mastercard@2x.png new file mode 100644 index 0000000..2795df6 Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-saved-mastercard@2x.png differ diff --git a/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-saved-visa@2x.png b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-saved-visa@2x.png new file mode 100644 index 0000000..2b5babd Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-saved-visa@2x.png differ diff --git a/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-savedcards-amex@2x.png b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-savedcards-amex@2x.png new file mode 100644 index 0000000..82c542b Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-savedcards-amex@2x.png differ diff --git a/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-shield-ie.png b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-shield-ie.png new file mode 100644 index 0000000..c4583f4 Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-shield-ie.png differ diff --git a/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-shield@1x.png b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-shield@1x.png new file mode 100644 index 0000000..900656c Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-shield@1x.png differ diff --git a/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-shield@2x.png b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-shield@2x.png new file mode 100644 index 0000000..e8a7fa5 Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/assets/images/ss-shield@2x.png differ diff --git a/lib/vendor/globalpayments/php-sdk/examples/end-to-end/charge.php b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/charge.php new file mode 100644 index 0000000..842dd5b --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/charge.php @@ -0,0 +1,64 @@ +secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; +$config->serviceUrl = 'https://cert.api2.heartlandportico.com'; + +ServicesContainer::configure($config); + +$card = new CreditCardData(); +$card->token = $_GET['token_value']; + +$address = new Address(); +$address->streetAddress1 = $_GET["Address"]; +$address->city = $_GET["City"]; +$address->state = $_GET["State"]; +$address->postalCode = preg_replace('/[^0-9]/', '', $_GET["Zip"]); +$address->country = "United States"; + +try { + $response = $card->charge(15) + ->withCurrency('USD') + ->withAddress($address) + ->withAllowDuplicates(true) + ->execute(); + + $body = '

Success!

'; + $body .= '

Thank you, ' . $_GET['FirstName'] . ', for your order of $15.

'; + + echo "Transaction Success your transaction Id is: " . $response->transactionId; + + // i'm running windows, so i had to update this: + //ini_set("SMTP", "my-mail-server"); + + sendEmail($_GET['EMAIL'], 'donotreply@e-hps.com', 'Successful Charge!', $body, true); +} catch (Exception $e) { + echo 'Failure: ' . $e->getMessage(); + exit; +} + +function sendEmail($to, $from, $subject, $body, $isHtml) { + $message = ''; + $message .= $body; + $message .= ''; + + $headers = "From: $from\r\n"; + $headers .= "Reply-To: $from\r\n"; + + if ($isHtml) { + $headers .= "MIME-Version: 1.0\r\n"; + $headers .= "Content-type: text/html; charset=ISO-8859-1\r\n"; + } + + mail($to, $subject, $message, $headers); +} diff --git a/lib/vendor/globalpayments/php-sdk/examples/end-to-end/index.html b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/index.html new file mode 100644 index 0000000..2ac5165 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/end-to-end/index.html @@ -0,0 +1,373 @@ + + + + + + + + + + + + + + Simple Payment Form Demo + + + + + + + +
+
+

PHP SecureSubmit Example

+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ + +

Card Information

+
+
+ +
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+ +
+ +
+ + + + +
+
+ + + + diff --git a/lib/vendor/globalpayments/php-sdk/examples/gift/charge.php b/lib/vendor/globalpayments/php-sdk/examples/gift/charge.php new file mode 100644 index 0000000..de9ed97 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/gift/charge.php @@ -0,0 +1,33 @@ +secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; +$config->serviceUrl = 'https://cert.api2.heartlandportico.com'; + +ServicesContainer::configure($config); + +try { + $card = new GiftCard(); + $card->number = $_GET["card-number"]; + + $response = $card->charge(1) + ->withCurrency('USD') + ->execute(); + + //echo $response->responseCode; + echo "Transaction success transaction Id: " . $response->transactionId; +} catch (Exception $e) { + echo $e->getMessage(); +} + + diff --git a/lib/vendor/globalpayments/php-sdk/examples/gift/index.php b/lib/vendor/globalpayments/php-sdk/examples/gift/index.php new file mode 100644 index 0000000..26d75e9 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/gift/index.php @@ -0,0 +1,18 @@ + + + + + GiftCard Example + + +
+ Card Number:
+ +

+ +
+ + \ No newline at end of file diff --git a/lib/vendor/globalpayments/php-sdk/examples/iframe-pay-invoice/assets/main.js b/lib/vendor/globalpayments/php-sdk/examples/iframe-pay-invoice/assets/main.js new file mode 100644 index 0000000..c3857aa --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/iframe-pay-invoice/assets/main.js @@ -0,0 +1,206 @@ +(function (document, Heartland) { + // Create a new `HPS` object with the necessary configuration + var hps = new Heartland.HPS({ + publicKey: 'pkapi_cert_P6dRqs1LzfWJ6HgGVZ', + type: 'iframe', + // Configure the iframe fields to tell the library where + // the iframe should be inserted into the DOM and some + // basic options + fields: { + cardNumber: { + target: 'iframesCardNumber', + placeholder: '•••• •••• •••• ••••' + }, + cardExpiration: { + target: 'iframesCardExpiration', + placeholder: 'MM / YYYY' + }, + cardCvv: { + target: 'iframesCardCvv', + placeholder: 'CVV' + }, + submit: { + target: 'iframesSubmit' + } + }, + // Collection of CSS to inject into the iframes. + // These properties can match the site's styles + // to create a seamless experience. + style: { + 'input': { + 'background': '#fff', + 'border': '1px solid', + 'border-color': '#bbb3b9 #c7c1c6 #c7c1c6', + 'box-sizing': 'border-box', + 'font-family': 'serif', + 'font-size': '16px', + 'line-height': '1', + 'margin': '0 .5em 0 0', + 'max-width': '100%', + 'outline': '0', + 'padding': '0.5278em', + 'vertical-align': 'baseline', + 'height': '50px', + 'width': '100% !important' + }, + '#heartland-field': { + 'font-family': 'sans-serif', + 'box-sizing': 'border-box', + 'display': 'block', + 'height': '50px', + 'padding': '6px 12px', + 'font-size': '14px', + 'line-height': '1.42857143', + 'color': '#555', + 'background-color': '#fff', + 'border': '1px solid #ccc', + 'border-radius': '0px', + '-webkit-box-shadow': 'inset 0 1px 1px rgba(0,0,0,.075)', + 'box-shadow': 'inset 0 1px 1px rgba(0,0,0,.075)', + '-webkit-transition': 'border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s', + '-o-transition': 'border-color ease-in-out .15s,box-shadow ease-in-out .15s', + 'transition': 'border-color ease-in-out .15s,box-shadow ease-in-out .15s', + 'width': '100%' + }, + '#heartland-field[name=submit]': { + 'background-color': '#36b46e', + 'font-family': 'sans-serif', + 'text-transform': 'uppercase', + 'color': '#ffffff', + 'border': '0px solid transparent' + }, + '#heartland-field[name=submit]:focus': { + 'color': '#ffffff', + 'background-color': '#258851', + 'outline': 'none' + }, + '#heartland-field[name=submit]:hover': { + 'background-color': '#258851' + }, + '#heartland-field-wrapper #heartland-field:focus': { + 'border': '1px solid #3989e3', + 'outline': 'none', + 'box-shadow': 'none', + 'height': '50px' + }, + 'heartland-field-wrapper #heartland-field': { + 'height': '50px' + }, + 'input[type=submit]': { + 'box-sizing': 'border-box', + 'display': 'inline-block', + 'padding': '6px 12px', + 'margin-bottom': '0', + 'font-size': '14px', + 'font-weight': '400', + 'line-height': '1.42857143', + 'text-align': 'center', + 'white-space': 'nowrap', + 'vertical-align': 'middle', + '-ms-touch-action': 'manipulation', + 'touch-action': 'manipulation', + 'cursor': 'pointer', + '-webkit-user-select': 'none', + '-moz-user-select': 'none', + '-ms-user-select': 'none', + 'user-select': 'none', + 'background-image': 'none', + 'border': '1px solid transparent', + 'border-radius': '4px', + 'color': '#fff', + 'background-color': '#337ab7', + 'border-color': '#2e6da4' + }, + '#heartland-field[placeholder]': { + 'letter-spacing': '3px' + }, + '#heartland-field[name=cardCvv]': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/cvv1.png?raw=true) no-repeat right', + 'background-size': '63px 40px', + }, + 'input#heartland-field[name=cardNumber]': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-inputcard-blank@2x.png?raw=true) no-repeat right', + 'background-size': '55px 35px'}, + '#heartland-field.invalid.card-type-visa': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-visa@2x.png?raw=true) no-repeat right', + 'background-size': '83px 88px', + 'background-position-y': '-44px' + }, + '#heartland-field.valid.card-type-visa': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-visa@2x.png?raw=true) no-repeat right top', + 'background-size': '82px 86px' + }, + '#heartland-field.invalid.card-type-discover': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-discover@2x.png?raw=true) no-repeat right', + 'background-size': '85px 90px', + 'background-position-y': '-44px' + }, + '#heartland-field.valid.card-type-discover': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-discover@2x.png?raw=true) no-repeat right', + 'background-size': '85px 90px', + 'background-position-y': '1px' + }, + '#heartland-field.invalid.card-type-amex': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-savedcards-amex@2x.png?raw=true) no-repeat right', + 'background-size': '50px 90px', + 'background-position-y': '-44px' + }, + '#heartland-field.valid.card-type-amex': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-savedcards-amex@2x.png?raw=true) no-repeat right top', + 'background-size': '50px 90px' + }, + '#heartland-field.invalid.card-type-mastercard': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-mastercard.png?raw=true) no-repeat right', + 'background-size': '62px 105px', + 'background-position-y': '-52px' + }, + '#heartland-field.valid.card-type-mastercard': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-mastercard.png?raw=true) no-repeat right', + 'background-size': '62px 105px', + 'background-position-y': '-1px' + }, + '#heartland-field.invalid.card-type-jcb': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-jcb@2x.png?raw=true) no-repeat right', + 'background-size': '55px 94px', + 'background-position-y': '-44px' + }, + '#heartland-field.valid.card-type-jcb': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-jcb@2x.png?raw=true) no-repeat right top', + 'background-size': '55px 94px', + 'background-position-y': '2px' + }, + 'input#heartland-field[name=cardNumber]::-ms-clear': { + 'display': 'none' + } + }, + // Callback when a token is received from the service + onTokenSuccess: function (resp) { + document.querySelector("input[name=token_value]").value = resp.token_value; + Heartland.Events.removeHandler(document.getElementById('payment_form'), 'submit'); + document.getElementById('payment_form').submit(); + }, + // Callback when an error is received from the service + onTokenError: function (resp) { + alert('There was an error: ' + resp.error.message); + }, + // Callback when an event is fired within an iFrame + onEvent: function (ev) { + console.log(ev); + } + }); + + // Attach a handler to interrupt the form submission + Heartland.Events.addHandler(document.getElementById('iframes'), 'submit', function (e) { + // Prevent the form from continuing to the `action` address + e.preventDefault(); + // Tell the iframes to tokenize the data + hps.Messages.post( + { + accumulateData: true, + action: 'tokenize', + message: 'pkapi_cert_jKc1FtuyAydZhZfbB3' + }, + 'cardNumber' + ); + }); +}(document, Heartland)); \ No newline at end of file diff --git a/lib/vendor/globalpayments/php-sdk/examples/iframe-pay-invoice/charge.php b/lib/vendor/globalpayments/php-sdk/examples/iframe-pay-invoice/charge.php new file mode 100644 index 0000000..a75b2a3 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/iframe-pay-invoice/charge.php @@ -0,0 +1,66 @@ +secretApiKey = 'skapi_cert_MYl2AQAowiQAbLp5JesGKh7QFkcizOP2jcX9BrEMqQ'; +$config->serviceUrl = 'https://cert.api2.heartlandportico.com'; + +ServicesContainer::configure($config); + +$card = new CreditCardData(); +$card->token = $_GET['token_value']; + +$address = new Address(); +$address->streetAddress1 = $_GET["Address"]; +$address->city = $_GET["City"]; +$address->state = $_GET["State"]; +$address->postalCode = preg_replace('/[^0-9]/', '', $_GET["Zip"]); +$address->country = "United States"; + + +try { + $response = $card->charge(15) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber($_GET["invoice_number"]) + ->execute(); + + $body = '

Success!

'; + $body .= '

Thank you, ' . $_GET['FirstName'] . ', for your order of $' . $_GET["payment_amount"] . '.

'; + + echo "Transaction Success!
Transaction Id: " . $response->transactionId; + echo "
Invoice Number: " . $_GET["invoice_number"]; + + // i'm running windows, so i had to update this: + //ini_set("SMTP", "my-mail-server"); + + sendEmail($_GET['EMAIL'], 'donotreply@e-hps.com', 'Successful Charge!', $body, true); +} catch (Exception $e) { + echo 'Failure: ' . $e->getMessage(); + exit; +} + +function sendEmail($to, $from, $subject, $body, $isHtml) { + $message = ''; + $message .= $body; + $message .= ''; + + $headers = "From: $from\r\n"; + $headers .= "Reply-To: $from\r\n"; + + if ($isHtml) { + $headers .= "MIME-Version: 1.0\r\n"; + $headers .= "Content-type: text/html; charset=ISO-8859-1\r\n"; + } + + mail($to, $subject, $message, $headers); +} diff --git a/lib/vendor/globalpayments/php-sdk/examples/iframe-pay-invoice/index.html b/lib/vendor/globalpayments/php-sdk/examples/iframe-pay-invoice/index.html new file mode 100644 index 0000000..21aaa8f --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/iframe-pay-invoice/index.html @@ -0,0 +1,168 @@ + + + + + + + + Simple Payment Form Demo + + + +
+

PHP SecureSubmit Example

+
+

Billing Information

+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +

Payment Information

+
+ +
+ +
+
+
+ +
+ +
+
+ +

Card Information

+
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+
+ + +
+ + +
+
+
+ + + + + + diff --git a/lib/vendor/globalpayments/php-sdk/examples/iframe-recurring-signup/assets/main.js b/lib/vendor/globalpayments/php-sdk/examples/iframe-recurring-signup/assets/main.js new file mode 100644 index 0000000..3930174 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/iframe-recurring-signup/assets/main.js @@ -0,0 +1,207 @@ +(function (document, Heartland) { + // Create a new `HPS` object with the necessary configuration + var hps = new Heartland.HPS({ + publicKey: 'pkapi_cert_jKc1FtuyAydZhZfbB3', + type: 'iframe', + // Configure the iframe fields to tell the library where + // the iframe should be inserted into the DOM and some + // basic options + fields: { + cardNumber: { + target: 'iframesCardNumber', + placeholder: '•••• •••• •••• ••••' + }, + cardExpiration: { + target: 'iframesCardExpiration', + placeholder: 'MM / YYYY' + }, + cardCvv: { + target: 'iframesCardCvv', + placeholder: 'CVV' + }, + submit: { + target: 'iframesSubmit' + } + }, + // Collection of CSS to inject into the iframes. + // These properties can match the site's styles + // to create a seamless experience. + style: { + 'input': { + 'background': '#fff', + 'border': '1px solid', + 'border-color': '#bbb3b9 #c7c1c6 #c7c1c6', + 'box-sizing': 'border-box', + 'font-family': 'serif', + 'font-size': '16px', + 'line-height': '1', + 'margin': '0 .5em 0 0', + 'max-width': '100%', + 'outline': '0', + 'padding': '0.5278em', + 'vertical-align': 'baseline', + 'height': '50px', + 'width': '100% !important' + }, + '#heartland-field': { + 'font-family': 'sans-serif', + 'box-sizing': 'border-box', + 'display': 'block', + 'height': '50px', + 'padding': '6px 12px', + 'font-size': '14px', + 'line-height': '1.42857143', + 'color': '#555', + 'background-color': '#fff', + 'border': '1px solid #ccc', + 'border-radius': '0px', + '-webkit-box-shadow': 'inset 0 1px 1px rgba(0,0,0,.075)', + 'box-shadow': 'inset 0 1px 1px rgba(0,0,0,.075)', + '-webkit-transition': 'border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s', + '-o-transition': 'border-color ease-in-out .15s,box-shadow ease-in-out .15s', + 'transition': 'border-color ease-in-out .15s,box-shadow ease-in-out .15s', + 'width': '100%' + }, + '#heartland-field[name=submit]': { + 'background-color': '#36b46e', + 'font-family': 'sans-serif', + 'text-transform': 'uppercase', + 'color': '#ffffff', + 'border': '0px solid transparent' + }, + '#heartland-field[name=submit]:focus': { + 'color': '#ffffff', + 'background-color': '#258851', + 'outline': 'none' + }, + '#heartland-field[name=submit]:hover': { + 'background-color': '#258851' + }, + '#heartland-field-wrapper #heartland-field:focus': { + 'border': '1px solid #3989e3', + 'outline': 'none', + 'box-shadow': 'none', + 'height': '50px' + }, + 'heartland-field-wrapper #heartland-field': { + 'height': '50px' + }, + 'input[type=submit]': { + 'box-sizing': 'border-box', + 'display': 'inline-block', + 'padding': '6px 12px', + 'margin-bottom': '0', + 'font-size': '14px', + 'font-weight': '400', + 'line-height': '1.42857143', + 'text-align': 'center', + 'white-space': 'nowrap', + 'vertical-align': 'middle', + '-ms-touch-action': 'manipulation', + 'touch-action': 'manipulation', + 'cursor': 'pointer', + '-webkit-user-select': 'none', + '-moz-user-select': 'none', + '-ms-user-select': 'none', + 'user-select': 'none', + 'background-image': 'none', + 'border': '1px solid transparent', + 'border-radius': '4px', + 'color': '#fff', + 'background-color': '#337ab7', + 'border-color': '#2e6da4' + }, + '#heartland-field[placeholder]': { + 'letter-spacing': '3px' + }, + '#heartland-field[name=cardCvv]': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/cvv1.png?raw=true) no-repeat right', + 'background-size': '63px 40px', + }, + 'input#heartland-field[name=cardNumber]': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-inputcard-blank@2x.png?raw=true) no-repeat right', + 'background-size': '55px 35px'}, + '#heartland-field.invalid.card-type-visa': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-visa@2x.png?raw=true) no-repeat right', + 'background-size': '83px 88px', + 'background-position-y': '-44px' + }, + '#heartland-field.valid.card-type-visa': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-visa@2x.png?raw=true) no-repeat right top', + 'background-size': '82px 86px' + }, + '#heartland-field.invalid.card-type-discover': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-discover@2x.png?raw=true) no-repeat right', + 'background-size': '85px 90px', + 'background-position-y': '-44px' + }, + '#heartland-field.valid.card-type-discover': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-discover@2x.png?raw=true) no-repeat right', + 'background-size': '85px 90px', + 'background-position-y': '1px' + }, + '#heartland-field.invalid.card-type-amex': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-savedcards-amex@2x.png?raw=true) no-repeat right', + 'background-size': '50px 90px', + 'background-position-y': '-44px' + }, + '#heartland-field.valid.card-type-amex': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-savedcards-amex@2x.png?raw=true) no-repeat right top', + 'background-size': '50px 90px' + }, + '#heartland-field.invalid.card-type-mastercard': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-mastercard.png?raw=true) no-repeat right', + 'background-size': '62px 105px', + 'background-position-y': '-52px' + }, + '#heartland-field.valid.card-type-mastercard': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-mastercard.png?raw=true) no-repeat right', + 'background-size': '62px 105px', + 'background-position-y': '-1px' + }, + '#heartland-field.invalid.card-type-jcb': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-jcb@2x.png?raw=true) no-repeat right', + 'background-size': '55px 94px', + 'background-position-y': '-44px' + }, + '#heartland-field.valid.card-type-jcb': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-jcb@2x.png?raw=true) no-repeat right top', + 'background-size': '55px 94px', + 'background-position-y': '2px' + }, + 'input#heartland-field[name=cardNumber]::-ms-clear': { + 'display': 'none' + } + }, + // Callback when a token is received from the service + onTokenSuccess: function (resp) { + document.querySelector("input[name=token_value]").value = resp.token_value; + document.querySelector("input[name=card_last_four]").value = resp.last_four; + Heartland.Events.removeHandler(document.getElementById('payment_form'), 'submit'); + document.getElementById('payment_form').submit(); + }, + // Callback when an error is received from the service + onTokenError: function (resp) { + alert('There was an error: ' + resp.error.message); + }, + // Callback when an event is fired within an iFrame + onEvent: function (ev) { + console.log(ev); + } + }); + + // Attach a handler to interrupt the form submission + Heartland.Events.addHandler(document.getElementById('iframes'), 'submit', function (e) { + // Prevent the form from continuing to the `action` address + e.preventDefault(); + // Tell the iframes to tokenize the data + hps.Messages.post( + { + accumulateData: true, + action: 'tokenize', + message: 'pkapi_cert_jKc1FtuyAydZhZfbB3' + }, + 'cardNumber' + ); + }); +}(document, Heartland)); \ No newline at end of file diff --git a/lib/vendor/globalpayments/php-sdk/examples/iframe-recurring-signup/charge.php b/lib/vendor/globalpayments/php-sdk/examples/iframe-recurring-signup/charge.php new file mode 100644 index 0000000..6c0ffe6 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/iframe-recurring-signup/charge.php @@ -0,0 +1,119 @@ +secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; +$config->serviceUrl = 'https://cert.api2.heartlandportico.com'; + +ServicesContainer::configure($config); + +$_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); +$_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING); + +function SendEmail($to, $from, $subject, $body, $isHtml) { + $message = ''; + $message .= $body; + $message .= ''; + + $headers = "From: $from\r\n"; + $headers .= "Reply-To: $from\r\n"; + + if ($isHtml) { + $headers .= "MIME-Version: 1.0\r\n"; + $headers .= "Content-type: text/html; charset=ISO-8859-1\r\n"; + } + + mail($to, $subject, $message, $headers); +} + +function getIdentifier($id) { + $identifierBase = '%s-%s' . substr(str_shuffle('abcdefghijklmnopqrstuvwxyz'), 0, 10); + return sprintf($identifierBase, date('Ymd'), $id); +} + +function createCustomer() { + $customer = new Customer(); + $customer->id = getIdentifier('Person'); + $customer->firstName = $_GET["FirstName"]; + $customer->lastName = $_GET["LastName"]; + $customer->status = 'Active'; + $customer->email = $_GET['Email']; + $customer->address = new Address(); + $customer->address->streetAddress1 = $_GET["Address"]; + $customer->address->city = $_GET["City"]; + $customer->address->province = $_GET["State"]; + $customer->address->postalCode = $_GET["Zip"]; + $customer->address->country = 'USA'; + $customer->workPhone = $_GET["PhoneNumber"]; + + $newCustomer = $customer->create(); + + return $newCustomer; +} + +function createPaymentMethod($customer) { + $card = new CreditCardData(); + $card->token = $_GET['token_value']; + + $paymentMethod = $customer->addPaymentMethod( + getIdentifier('CreditV'), $card + )->create(); + + return $paymentMethod; +} + +function createSchedule($customerKey, $paymentMethodKey, $amount) { + $schedule = new Schedule(); + + $schedule->id = getIdentifier('CreditV'); + $schedule->customerKey = $customerKey; + $schedule->paymentKey = $paymentMethodKey; + $schedule->amount = $amount; + $schedule->currency = 'USD'; + $schedule->startDate = date('mdY', strtotime("last day of next month")); + $schedule->paymentSchedule = PaymentSchedule::LAST_DAY_OF_THE_MONTH; //or PaymentSchedule::FIRST_DAY_OF_THE_MONTH + $schedule->frequency = ScheduleFrequency::MONTHLY; //'Monthly', 'Bi-Monthly', 'Quarterly', 'Semi-Annually' + //$schedule->duration = HpsPayPlanScheduleDuration::ONGOING; + $schedule->reprocessingCount = 1; + $schedule->emailReceipt = 'Never'; + $schedule->status = 'Active'; + $schedule->reprocessingCount = 1; + + $response = $schedule->create(); + + return $response; +} + +try { + $customer = createCustomer(); + $paymentMethod = createPaymentMethod($customer); + $schedule = createSchedule($customer->key, $paymentMethod->key, $_GET['payment_amount']); + + echo 'Your payment scheduled successfully
'; + printf('Customer Key: %s
', $customer->key); + printf('Payment Method Key: %s
', $paymentMethod->key); + printf('Schedule Key: %s
', $schedule->key); +} catch (Exception $e) { + die($e->getMessage()); +} + + +$body = '

Success!

'; +$body .= '

Thank you, ' . $_GET['FirstName'] . ', for your subscription.'; + + + +// i'm running windows, so i had to update this: +//ini_set("SMTP", "my-mail-server"); + +//SendEmail($_GET['Email'], 'donotreply@e-hps.com', 'Successful Charge!', $body, true); diff --git a/lib/vendor/globalpayments/php-sdk/examples/iframe-recurring-signup/index.html b/lib/vendor/globalpayments/php-sdk/examples/iframe-recurring-signup/index.html new file mode 100644 index 0000000..dbc41bb --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/iframe-recurring-signup/index.html @@ -0,0 +1,165 @@ + + + + + + + + Simple Recurring Payment Signup Form Demo + + + +

+

PHP SecureSubmit Example

+
+

Billing Information

+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +

Subscription Information

+
+ +
+ +
+
+ +

Card Information

+
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+
+ +
+ + +
+
+
+ + + + + + diff --git a/lib/vendor/globalpayments/php-sdk/examples/manual-tokenize/assets/main.js b/lib/vendor/globalpayments/php-sdk/examples/manual-tokenize/assets/main.js new file mode 100644 index 0000000..b5a5bda --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/manual-tokenize/assets/main.js @@ -0,0 +1,206 @@ +(function (document, Heartland) { + // Create a new `HPS` object with the necessary configuration + var hps = new Heartland.HPS({ + publicKey: 'pkapi_cert_jKc1FtuyAydZhZfbB3', + type: 'iframe', + // Configure the iframe fields to tell the library where + // the iframe should be inserted into the DOM and some + // basic options + fields: { + cardNumber: { + target: 'iframesCardNumber', + placeholder: '•••• •••• •••• ••••' + }, + cardExpiration: { + target: 'iframesCardExpiration', + placeholder: 'MM / YYYY' + }, + cardCvv: { + target: 'iframesCardCvv', + placeholder: 'CVV' + }, + submit: { + target: 'iframesSubmit' + } + }, + // Collection of CSS to inject into the iframes. + // These properties can match the site's styles + // to create a seamless experience. + style: { + 'input': { + 'background': '#fff', + 'border': '1px solid', + 'border-color': '#bbb3b9 #c7c1c6 #c7c1c6', + 'box-sizing': 'border-box', + 'font-family': 'serif', + 'font-size': '16px', + 'line-height': '1', + 'margin': '0 .5em 0 0', + 'max-width': '100%', + 'outline': '0', + 'padding': '0.5278em', + 'vertical-align': 'baseline', + 'height': '50px', + 'width': '100% !important' + }, + '#heartland-field': { + 'font-family': 'sans-serif', + 'box-sizing': 'border-box', + 'display': 'block', + 'height': '50px', + 'padding': '6px 12px', + 'font-size': '14px', + 'line-height': '1.42857143', + 'color': '#555', + 'background-color': '#fff', + 'border': '1px solid #ccc', + 'border-radius': '0px', + '-webkit-box-shadow': 'inset 0 1px 1px rgba(0,0,0,.075)', + 'box-shadow': 'inset 0 1px 1px rgba(0,0,0,.075)', + '-webkit-transition': 'border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s', + '-o-transition': 'border-color ease-in-out .15s,box-shadow ease-in-out .15s', + 'transition': 'border-color ease-in-out .15s,box-shadow ease-in-out .15s', + 'width': '100%' + }, + '#heartland-field[name=submit]': { + 'background-color': '#36b46e', + 'font-family': 'sans-serif', + 'text-transform': 'uppercase', + 'color': '#ffffff', + 'border': '0px solid transparent' + }, + '#heartland-field[name=submit]:focus': { + 'color': '#ffffff', + 'background-color': '#258851', + 'outline': 'none' + }, + '#heartland-field[name=submit]:hover': { + 'background-color': '#258851' + }, + '#heartland-field-wrapper #heartland-field:focus': { + 'border': '1px solid #3989e3', + 'outline': 'none', + 'box-shadow': 'none', + 'height': '50px' + }, + 'heartland-field-wrapper #heartland-field': { + 'height': '50px' + }, + 'input[type=submit]': { + 'box-sizing': 'border-box', + 'display': 'inline-block', + 'padding': '6px 12px', + 'margin-bottom': '0', + 'font-size': '14px', + 'font-weight': '400', + 'line-height': '1.42857143', + 'text-align': 'center', + 'white-space': 'nowrap', + 'vertical-align': 'middle', + '-ms-touch-action': 'manipulation', + 'touch-action': 'manipulation', + 'cursor': 'pointer', + '-webkit-user-select': 'none', + '-moz-user-select': 'none', + '-ms-user-select': 'none', + 'user-select': 'none', + 'background-image': 'none', + 'border': '1px solid transparent', + 'border-radius': '4px', + 'color': '#fff', + 'background-color': '#337ab7', + 'border-color': '#2e6da4' + }, + '#heartland-field[placeholder]': { + 'letter-spacing': '3px' + }, + '#heartland-field[name=cardCvv]': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/cvv1.png?raw=true) no-repeat right', + 'background-size': '63px 40px', + }, + 'input#heartland-field[name=cardNumber]': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-inputcard-blank@2x.png?raw=true) no-repeat right', + 'background-size': '55px 35px'}, + '#heartland-field.invalid.card-type-visa': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-visa@2x.png?raw=true) no-repeat right', + 'background-size': '83px 88px', + 'background-position-y': '-44px' + }, + '#heartland-field.valid.card-type-visa': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-visa@2x.png?raw=true) no-repeat right top', + 'background-size': '82px 86px' + }, + '#heartland-field.invalid.card-type-discover': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-discover@2x.png?raw=true) no-repeat right', + 'background-size': '85px 90px', + 'background-position-y': '-44px' + }, + '#heartland-field.valid.card-type-discover': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-discover@2x.png?raw=true) no-repeat right', + 'background-size': '85px 90px', + 'background-position-y': '1px' + }, + '#heartland-field.invalid.card-type-amex': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-savedcards-amex@2x.png?raw=true) no-repeat right', + 'background-size': '50px 90px', + 'background-position-y': '-44px' + }, + '#heartland-field.valid.card-type-amex': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-savedcards-amex@2x.png?raw=true) no-repeat right top', + 'background-size': '50px 90px' + }, + '#heartland-field.invalid.card-type-mastercard': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-mastercard.png?raw=true) no-repeat right', + 'background-size': '62px 105px', + 'background-position-y': '-52px' + }, + '#heartland-field.valid.card-type-mastercard': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-mastercard.png?raw=true) no-repeat right', + 'background-size': '62px 105px', + 'background-position-y': '-1px' + }, + '#heartland-field.invalid.card-type-jcb': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-jcb@2x.png?raw=true) no-repeat right', + 'background-size': '55px 94px', + 'background-position-y': '-44px' + }, + '#heartland-field.valid.card-type-jcb': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-jcb@2x.png?raw=true) no-repeat right top', + 'background-size': '55px 94px', + 'background-position-y': '2px' + }, + 'input#heartland-field[name=cardNumber]::-ms-clear': { + 'display': 'none' + } + }, + // Callback when a token is received from the service + onTokenSuccess: function (resp) { + document.querySelector("input[name=token_value]").value = resp.token_value; + Heartland.Events.removeHandler(document.getElementById('payment_form'), 'submit'); + document.getElementById('payment_form').submit(); + }, + // Callback when an error is received from the service + onTokenError: function (resp) { + alert('There was an error: ' + resp.error.message); + }, + // Callback when an event is fired within an iFrame + onEvent: function (ev) { + console.log(ev); + } + }); + + // Attach a handler to interrupt the form submission + Heartland.Events.addHandler(document.getElementById('iframes'), 'submit', function (e) { + // Prevent the form from continuing to the `action` address + e.preventDefault(); + // Tell the iframes to tokenize the data + hps.Messages.post( + { + accumulateData: true, + action: 'tokenize', + message: 'pkapi_cert_jKc1FtuyAydZhZfbB3' + }, + 'cardNumber' + ); + }); +}(document, Heartland)); \ No newline at end of file diff --git a/lib/vendor/globalpayments/php-sdk/examples/manual-tokenize/charge.php b/lib/vendor/globalpayments/php-sdk/examples/manual-tokenize/charge.php new file mode 100644 index 0000000..35e5e6d --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/manual-tokenize/charge.php @@ -0,0 +1,66 @@ +secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; +$config->serviceUrl = 'https://cert.api2.heartlandportico.com'; + +ServicesContainer::configure($config); + +$card = new CreditCardData(); +$card->token = $_GET['token_value']; + +$address = new Address(); +$address->streetAddress1 = $_GET["Address"]; +$address->city = $_GET["City"]; +$address->state = $_GET["State"]; +$address->postalCode = preg_replace('/[^0-9]/', '', $_GET["Zip"]); +$address->country = "United States"; + +try { + $response = $card->charge(15) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber($_GET["invoice_number"]) + ->withAllowDuplicates(true) + ->execute(); + + $body = '

Success!

'; + $body .= '

Thank you, ' . $_GET['FirstName'] . ', for your order of $' . $_GET["payment_amount"] . '.

'; + + echo "Transaction Id: " . $response->transactionId; + echo "
Invoice Number: " . $_GET["invoice_number"]; + + // i'm running windows, so i had to update this: + //ini_set("SMTP", "my-mail-server"); + + sendEmail($_GET['EMAIL'], 'donotreply@e-hps.com', 'Successful Charge!', $body, true); +} catch (Exception $e) { + echo 'Failure: ' . $e->getMessage(); + exit; +} + +function sendEmail($to, $from, $subject, $body, $isHtml) { + $message = ''; + $message .= $body; + $message .= ''; + + $headers = "From: $from\r\n"; + $headers .= "Reply-To: $from\r\n"; + + if ($isHtml) { + $headers .= "MIME-Version: 1.0\r\n"; + $headers .= "Content-type: text/html; charset=ISO-8859-1\r\n"; + } + + mail($to, $subject, $message, $headers); +} diff --git a/lib/vendor/globalpayments/php-sdk/examples/manual-tokenize/index.html b/lib/vendor/globalpayments/php-sdk/examples/manual-tokenize/index.html new file mode 100644 index 0000000..469bc62 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/manual-tokenize/index.html @@ -0,0 +1,166 @@ + + + + + + + + Simple Payment Form Demo + + + + + + +
+

PHP SecureSubmit Example

+
+

Billing Information

+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +

Payment Information

+
+ +
+ +
+
+
+ +
+ +
+
+ +

Card Information

+
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+
+ +
+ +
+
+ + + + diff --git a/lib/vendor/globalpayments/php-sdk/examples/pay-invoice/assets/main.js b/lib/vendor/globalpayments/php-sdk/examples/pay-invoice/assets/main.js new file mode 100644 index 0000000..c3857aa --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/pay-invoice/assets/main.js @@ -0,0 +1,206 @@ +(function (document, Heartland) { + // Create a new `HPS` object with the necessary configuration + var hps = new Heartland.HPS({ + publicKey: 'pkapi_cert_P6dRqs1LzfWJ6HgGVZ', + type: 'iframe', + // Configure the iframe fields to tell the library where + // the iframe should be inserted into the DOM and some + // basic options + fields: { + cardNumber: { + target: 'iframesCardNumber', + placeholder: '•••• •••• •••• ••••' + }, + cardExpiration: { + target: 'iframesCardExpiration', + placeholder: 'MM / YYYY' + }, + cardCvv: { + target: 'iframesCardCvv', + placeholder: 'CVV' + }, + submit: { + target: 'iframesSubmit' + } + }, + // Collection of CSS to inject into the iframes. + // These properties can match the site's styles + // to create a seamless experience. + style: { + 'input': { + 'background': '#fff', + 'border': '1px solid', + 'border-color': '#bbb3b9 #c7c1c6 #c7c1c6', + 'box-sizing': 'border-box', + 'font-family': 'serif', + 'font-size': '16px', + 'line-height': '1', + 'margin': '0 .5em 0 0', + 'max-width': '100%', + 'outline': '0', + 'padding': '0.5278em', + 'vertical-align': 'baseline', + 'height': '50px', + 'width': '100% !important' + }, + '#heartland-field': { + 'font-family': 'sans-serif', + 'box-sizing': 'border-box', + 'display': 'block', + 'height': '50px', + 'padding': '6px 12px', + 'font-size': '14px', + 'line-height': '1.42857143', + 'color': '#555', + 'background-color': '#fff', + 'border': '1px solid #ccc', + 'border-radius': '0px', + '-webkit-box-shadow': 'inset 0 1px 1px rgba(0,0,0,.075)', + 'box-shadow': 'inset 0 1px 1px rgba(0,0,0,.075)', + '-webkit-transition': 'border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s', + '-o-transition': 'border-color ease-in-out .15s,box-shadow ease-in-out .15s', + 'transition': 'border-color ease-in-out .15s,box-shadow ease-in-out .15s', + 'width': '100%' + }, + '#heartland-field[name=submit]': { + 'background-color': '#36b46e', + 'font-family': 'sans-serif', + 'text-transform': 'uppercase', + 'color': '#ffffff', + 'border': '0px solid transparent' + }, + '#heartland-field[name=submit]:focus': { + 'color': '#ffffff', + 'background-color': '#258851', + 'outline': 'none' + }, + '#heartland-field[name=submit]:hover': { + 'background-color': '#258851' + }, + '#heartland-field-wrapper #heartland-field:focus': { + 'border': '1px solid #3989e3', + 'outline': 'none', + 'box-shadow': 'none', + 'height': '50px' + }, + 'heartland-field-wrapper #heartland-field': { + 'height': '50px' + }, + 'input[type=submit]': { + 'box-sizing': 'border-box', + 'display': 'inline-block', + 'padding': '6px 12px', + 'margin-bottom': '0', + 'font-size': '14px', + 'font-weight': '400', + 'line-height': '1.42857143', + 'text-align': 'center', + 'white-space': 'nowrap', + 'vertical-align': 'middle', + '-ms-touch-action': 'manipulation', + 'touch-action': 'manipulation', + 'cursor': 'pointer', + '-webkit-user-select': 'none', + '-moz-user-select': 'none', + '-ms-user-select': 'none', + 'user-select': 'none', + 'background-image': 'none', + 'border': '1px solid transparent', + 'border-radius': '4px', + 'color': '#fff', + 'background-color': '#337ab7', + 'border-color': '#2e6da4' + }, + '#heartland-field[placeholder]': { + 'letter-spacing': '3px' + }, + '#heartland-field[name=cardCvv]': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/cvv1.png?raw=true) no-repeat right', + 'background-size': '63px 40px', + }, + 'input#heartland-field[name=cardNumber]': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-inputcard-blank@2x.png?raw=true) no-repeat right', + 'background-size': '55px 35px'}, + '#heartland-field.invalid.card-type-visa': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-visa@2x.png?raw=true) no-repeat right', + 'background-size': '83px 88px', + 'background-position-y': '-44px' + }, + '#heartland-field.valid.card-type-visa': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-visa@2x.png?raw=true) no-repeat right top', + 'background-size': '82px 86px' + }, + '#heartland-field.invalid.card-type-discover': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-discover@2x.png?raw=true) no-repeat right', + 'background-size': '85px 90px', + 'background-position-y': '-44px' + }, + '#heartland-field.valid.card-type-discover': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-discover@2x.png?raw=true) no-repeat right', + 'background-size': '85px 90px', + 'background-position-y': '1px' + }, + '#heartland-field.invalid.card-type-amex': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-savedcards-amex@2x.png?raw=true) no-repeat right', + 'background-size': '50px 90px', + 'background-position-y': '-44px' + }, + '#heartland-field.valid.card-type-amex': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-savedcards-amex@2x.png?raw=true) no-repeat right top', + 'background-size': '50px 90px' + }, + '#heartland-field.invalid.card-type-mastercard': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-mastercard.png?raw=true) no-repeat right', + 'background-size': '62px 105px', + 'background-position-y': '-52px' + }, + '#heartland-field.valid.card-type-mastercard': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-mastercard.png?raw=true) no-repeat right', + 'background-size': '62px 105px', + 'background-position-y': '-1px' + }, + '#heartland-field.invalid.card-type-jcb': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-jcb@2x.png?raw=true) no-repeat right', + 'background-size': '55px 94px', + 'background-position-y': '-44px' + }, + '#heartland-field.valid.card-type-jcb': { + 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-jcb@2x.png?raw=true) no-repeat right top', + 'background-size': '55px 94px', + 'background-position-y': '2px' + }, + 'input#heartland-field[name=cardNumber]::-ms-clear': { + 'display': 'none' + } + }, + // Callback when a token is received from the service + onTokenSuccess: function (resp) { + document.querySelector("input[name=token_value]").value = resp.token_value; + Heartland.Events.removeHandler(document.getElementById('payment_form'), 'submit'); + document.getElementById('payment_form').submit(); + }, + // Callback when an error is received from the service + onTokenError: function (resp) { + alert('There was an error: ' + resp.error.message); + }, + // Callback when an event is fired within an iFrame + onEvent: function (ev) { + console.log(ev); + } + }); + + // Attach a handler to interrupt the form submission + Heartland.Events.addHandler(document.getElementById('iframes'), 'submit', function (e) { + // Prevent the form from continuing to the `action` address + e.preventDefault(); + // Tell the iframes to tokenize the data + hps.Messages.post( + { + accumulateData: true, + action: 'tokenize', + message: 'pkapi_cert_jKc1FtuyAydZhZfbB3' + }, + 'cardNumber' + ); + }); +}(document, Heartland)); \ No newline at end of file diff --git a/lib/vendor/globalpayments/php-sdk/examples/pay-invoice/charge.php b/lib/vendor/globalpayments/php-sdk/examples/pay-invoice/charge.php new file mode 100644 index 0000000..add3c51 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/pay-invoice/charge.php @@ -0,0 +1,74 @@ +secretApiKey = 'skapi_cert_MYl2AQAowiQAbLp5JesGKh7QFkcizOP2jcX9BrEMqQ'; +$config->serviceUrl = 'https://cert.api2.heartlandportico.com'; + +ServicesContainer::configure($config); + +$card = new CreditCardData(); +$card->token = $_GET['token_value']; + +$address = new Address(); +$address->streetAddress1 = $_GET["Address"]; +$address->city = $_GET["City"]; +$address->state = $_GET["State"]; +$address->postalCode = preg_replace('/[^0-9]/', '', $_GET["Zip"]); +$address->country = "United States"; + +/* + $validCardHolder = new HpsCardHolder(); + $validCardHolder->firstName = $_GET["FirstName"]; + $validCardHolder->lastName = $_GET["LastName"]; + $validCardHolder->address = $address; + $validCardHolder->phoneNumber = preg_replace('/[^0-9]/', '', $_GET["PhoneNumber"]); + */ + +try { + $response = $card->charge(15) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber($_GET["invoice_number"]) + ->withAllowDuplicates(true) + ->execute(); + + $body = '

Success!

'; + $body .= '

Thank you, ' . $_GET['FirstName'] . ', for your order of $' . $_GET["payment_amount"] . '.

'; + + echo "Transaction Id: " . $response->transactionId; + echo "
Invoice Number: " . $_GET["invoice_number"]; + + // i'm running windows, so i had to update this: + //ini_set("SMTP", "my-mail-server"); + + sendEmail($_GET['EMAIL'], 'donotreply@e-hps.com', 'Successful Charge!', $body, true); +} catch (Exception $e) { + echo 'Failure: ' . $e->getMessage(); + exit; +} + +function sendEmail($to, $from, $subject, $body, $isHtml) { + $message = ''; + $message .= $body; + $message .= ''; + + $headers = "From: $from\r\n"; + $headers .= "Reply-To: $from\r\n"; + + if ($isHtml) { + $headers .= "MIME-Version: 1.0\r\n"; + $headers .= "Content-type: text/html; charset=ISO-8859-1\r\n"; + } + + mail($to, $subject, $message, $headers); +} diff --git a/lib/vendor/globalpayments/php-sdk/examples/pay-invoice/index.html b/lib/vendor/globalpayments/php-sdk/examples/pay-invoice/index.html new file mode 100644 index 0000000..4bfe929 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/pay-invoice/index.html @@ -0,0 +1,169 @@ + + + + + + + + Simple Payment Form Demo + + + + + +
+

PHP SecureSubmit Example

+
+

Billing Information

+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +

Payment Information

+
+ +
+ +
+
+
+ +
+ +
+
+ +

Card Information

+
+
+ +
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+
+ + + + + diff --git a/lib/vendor/globalpayments/php-sdk/examples/point-of-sale/e3-swipe/assets/apples.png b/lib/vendor/globalpayments/php-sdk/examples/point-of-sale/e3-swipe/assets/apples.png new file mode 100644 index 0000000..f0542ab Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/examples/point-of-sale/e3-swipe/assets/apples.png differ diff --git a/lib/vendor/globalpayments/php-sdk/examples/point-of-sale/e3-swipe/assets/bananas.png b/lib/vendor/globalpayments/php-sdk/examples/point-of-sale/e3-swipe/assets/bananas.png new file mode 100644 index 0000000..d1908f3 Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/examples/point-of-sale/e3-swipe/assets/bananas.png differ diff --git a/lib/vendor/globalpayments/php-sdk/examples/point-of-sale/e3-swipe/assets/oranges.png b/lib/vendor/globalpayments/php-sdk/examples/point-of-sale/e3-swipe/assets/oranges.png new file mode 100644 index 0000000..159f636 Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/examples/point-of-sale/e3-swipe/assets/oranges.png differ diff --git a/lib/vendor/globalpayments/php-sdk/examples/point-of-sale/e3-swipe/assets/secure.submit-1.1.0.js b/lib/vendor/globalpayments/php-sdk/examples/point-of-sale/e3-swipe/assets/secure.submit-1.1.0.js new file mode 100644 index 0000000..de741e2 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/point-of-sale/e3-swipe/assets/secure.submit-1.1.0.js @@ -0,0 +1,266 @@ +/*global $, jQuery*/ +var hps = (function ($) { + "use strict"; + + var HPS; + + HPS = { + + Tag: "SecureSubmit", + + Urls: { + CERT: "https://cert.api2.heartlandportico.com/Hps.Exchange.PosGateway.Hpf.v1/api/token", + PROD: "https://api2.heartlandportico.com/SecureSubmit.v1/api/token" + }, + + tokenize: function (options) { + var gateway_url, params, env; + + // add additional service parameters + params = $.param({ + "api_key": options.data.public_key, + "object": "token", + "token_type": "supt", + "_method": "post", + "card[number]": $.trim(options.data.number), + "card[cvc]": $.trim(options.data.cvc), + "card[exp_month]": $.trim(options.data.exp_month), + "card[exp_year]": $.trim(options.data.exp_year) + }); + + env = options.data.public_key.split("_")[1]; + + if (env === "cert") { + gateway_url = HPS.Urls.CERT; + } else { + gateway_url = HPS.Urls.PROD; + } + + // request token + $.ajax({ + cache: false, + url: gateway_url, + data: params, + dataType: "jsonp", + success: function (response) { + + // Request failed, handle error + if (typeof response.error === 'object') { + // call error handler if provided and valid + if (typeof options.error === 'function') { + options.error(response.error); + } else { + // handle exception + HPS.error(response.error.message); + } + } else if (typeof options.success === 'function') { + options.success(response); + } + } + }); + }, + + tokenize_swipe: function (options) { + var gateway_url, params, env; + + params = $.param({ + "api_key": options.data.public_key, + "object": "token", + "token_type": "supt", + "_method": "post", + "card[track_method]": "swipe", + "card[track]": $.trim(options.data.track) + }); + + env = options.data.public_key.split("_")[1]; + + if (env === "cert") { + gateway_url = HPS.Urls.CERT; + } else { + gateway_url = HPS.Urls.PROD; + } + + // request token + $.ajax({ + cache: false, + url: gateway_url, + data: params, + dataType: "jsonp", + success: function (response) { + + // Request failed, handle error + if (typeof response.error === 'object') { + // call error handler if provided and valid + if (typeof options.error === 'function') { + options.error(response.error); + } else { + // handle exception + HPS.error(response.error.message); + } + } else if (typeof options.success === 'function') { + options.success(response); + } + } + }); + }, + + trim: function (string) { + + if (string !== undefined && typeof string === "string") { + + string = string.toString().replace(/^\s\s*/, '').replace(/\s\s*$/, ''); + } + + return string; + }, + + empty: function (val) { + return val === undefined || val.length === 0; + }, + + error: function (message) { + $.error([HPS.Tag, ": ", message].join("")); + }, + + configureElement: function (options) { + + // set plugin data + $(this).data(HPS.Tag, { + public_key: options.public_key, + success: options.success, + error: options.error + }); + + // add event handler for form submission + $(this).submit(function (e) { + + var theForm, data, i, cardType; + + // stop form from submitting + e.preventDefault(); + + // remove name attributes from sensitive fields + $("#card_number").removeAttr("name"); + $("#card_cvc").removeAttr("name"); + $("#exp_month").removeAttr("name"); + $("#exp_year").removeAttr("name"); + + theForm = $(this); + + // get data from storage + data = theForm.data(HPS.Tag); + + // validate form - jQuery validate plugin + if (typeof theForm.validate === 'function') { + theForm.validate(); + // validation failed + if (!theForm.valid()) { + return; + } + } + + HPS.tokenize({ + data: { + public_key: data.public_key, + number: $.trim($("#card_number").val()), + cvc: $.trim($("#card_cvc").val()), + exp_month: $.trim($("#exp_month").val()), + exp_year: $.trim($("#exp_year").val()) + }, + success: function (response) { + // create field and append to form + $("").attr({ + type: "hidden", + id: "token_value", + name: "token_value", + value: jresponse.token_value + }).appendTo(theForm); + + var re = { + visa: /^4[0-9]{12}(?:[0-9]{3})?$/, + mastercard: /^5[1-5][0-9]{14}$/, + amex: /^3[47][0-9]{13}$/, + diners: /^3(?:0[0-5]|[68][0-9])[0-9]{11}$/, + discover: /^6(?:011|5[0-9]{2})[0-9]{12}$/, + jcb: /^(?:2131|1800|35\d{3})\d{11}$/ + }; + + if (re.visa.test($.trim($("#card_number").val()))) { + cardType = 'visa'; + } else if (re.mastercard.test($.trim($("#card_number").val()))) { + cardType = 'mastercard'; + } else if (re.amex.test($.trim($("#card_number").val()))) { + cardType = 'amex'; + } else if (re.diners.test($.trim($("#card_number").val()))) { + cardType = 'diners'; + } else if (re.discover.test($.trim($("#card_number").val()))) { + cardType = 'discover'; + } else if (re.jcb.test($.trim($("#card_number").val()))) { + cardType = 'jcb'; + } + + $("").attr({ + type: "hidden", + id: "card_type", + name: "card_type", + value: cardType + }).appendTo(theForm); + + $("").attr({ + type: "hidden", + id: "exp_month", + name: "exp_month", + value: $.trim($("#exp_month").val()) + }).appendTo(theForm); + + $("").attr({ + type: "hidden", + id: "exp_year", + name: "exp_year", + value: $.trim($("#exp_year").val()) + }).appendTo(theForm); + + $("").attr({ + type: "hidden", + id: "last_four", + name: "last_four", + value: $("#card_number").val().slice(-4) + }).appendTo(theForm); + + // success handler provided + if (typeof data.success === 'function') { + // call the handler with payload + if (data.success(response) === false) { + return; // stop processing + } + } + + theForm.unbind('submit'); // unbind event handler + theForm.submit(); // submit the form + }, + error: function (response) { + if (typeof data.error === 'function') { + data.error(response); + } + } + }); + + }); + } + }; + + $.fn.SecureSubmit = function (options) { + + return this.each(function () { + if (!$(this).is("form") || typeof options !== 'object' || HPS.hasData($(this))) { + + return; + } + + HPS.configureElement.apply(this, [options]); + }); + }; + + return HPS; +}(jQuery)); + diff --git a/lib/vendor/globalpayments/php-sdk/examples/point-of-sale/e3-swipe/charge.php b/lib/vendor/globalpayments/php-sdk/examples/point-of-sale/e3-swipe/charge.php new file mode 100644 index 0000000..3072fc9 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/point-of-sale/e3-swipe/charge.php @@ -0,0 +1,75 @@ +secretApiKey = 'skapi_cert_MYl2AQAowiQAbLp5JesGKh7QFkcizOP2jcX9BrEMqQ'; +$config->serviceUrl = 'https://cert.api2.heartlandportico.com'; + +ServicesContainer::configure($config); + +$card = new CreditCardData(); +$card->token = $_GET['securesubmit_token']; + +try { + $response = $card->charge(28.97) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + + $body = '

Success!

'; + $body .= '

Thank you, for your order of $15.

'; + + echo "Transaction Success your transaction Id is: " . $response->transactionId; +} catch (Exception $e) { + echo 'Failure: ' . $e->getMessage(); + exit; +} +?> + + + + + + + + + Simple Payment Form Demo + + + + + + + + +
+
+
+
+

 Thank you for your order.

+

Order Id: transactionId ?>

+

+ Your order has been processed and a reciept has been emailed to the account we have on file. +

+
+
+ +

What just happened?

+
    +
  •  The encrypted card data was collected from the reader.

  • +
  •  The encrypted data was sent directly to Heartland for tokenization.

  • +
  •  The corresponding token was added to the form as a hidden input.

  • +
  •  The form was submitted and the token was charged.

  • +
+

An encrypted card was sent over an SSL, encrypted connection where it was tokenized. This token was then submitted to the merchant and charged. Yes please.

+
+ + diff --git a/lib/vendor/globalpayments/php-sdk/examples/point-of-sale/e3-swipe/index.html b/lib/vendor/globalpayments/php-sdk/examples/point-of-sale/e3-swipe/index.html new file mode 100644 index 0000000..f501dc9 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/point-of-sale/e3-swipe/index.html @@ -0,0 +1,130 @@ + + + + + + + + Simple Payment Form Demo + + + + + + + + +
+

PHP POS SecureSubmit Example

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 SKUItemQuantityPrice
BA0001Very Tasty Banana Bundle + 2$4.99
OR1021High Vitamin C, Certified Organic, Sun-Grown Oranges + 5$12.99
AP1973Certified Organic Granny Smith Green Apples + 10$10.99
 Total:$28.97
 
+ + + +
+ + + diff --git a/lib/vendor/globalpayments/php-sdk/examples/recurring-signup-ach/charge.php b/lib/vendor/globalpayments/php-sdk/examples/recurring-signup-ach/charge.php new file mode 100644 index 0000000..e76855e --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/recurring-signup-ach/charge.php @@ -0,0 +1,125 @@ +'; + $message .= $body; + $message .= ''; + + $headers = "From: $from\r\n"; + $headers .= "Reply-To: $from\r\n"; + + if ($isHtml) { + $headers .= "MIME-Version: 1.0\r\n"; + $headers .= "Content-type: text/html; charset=ISO-8859-1\r\n"; + } + + mail($to, $subject, $message, $headers); +} + +function getIdentifier($id) { + $identifierBase = '%s-%s' . substr(str_shuffle('abcdefghijklmnopqrstuvwxyz'), 0, 10); + return sprintf($identifierBase, date('Ymd'), $id); +} + +function createCustomer() { + $customer = new Customer(); + $customer->id = getIdentifier('Person'); + $customer->firstName = $_GET["FirstName"]; + $customer->lastName = $_GET["LastName"]; + $customer->status = 'Active'; + $customer->email = $_GET['Email']; + $customer->address = new Address(); + $customer->address->streetAddress1 = $_GET["Address"]; + $customer->address->city = $_GET["City"]; + $customer->address->province = $_GET["State"]; + $customer->address->postalCode = $_GET["Zip"]; + $customer->address->country = 'USA'; + $customer->workPhone = $_GET["PhoneNumber"]; + $customer->key = $customer->id; + + $newCustomer = $customer->create(); + + return $newCustomer; +} + +function createPaymentMethod($customer) { + $check = new ECheck(); + $check->accountType = $_GET['account_type']; + $check->checkType = $_GET['check_type']; + $check->secCode = SecCode::WEB; + $check->routingNumber = $_GET['RoutingNumber']; + $check->accountNumber = $_GET['AccountNumber']; + + $paymentMethod = $customer->addPaymentMethod( + getIdentifier('CreditV'), $check + )->create(); + + return $paymentMethod; +} + +function createSchedule($customerKey, $paymentMethodKey, $amount) { + $schedule = new Schedule(); + + $schedule->id = getIdentifier('CreditV'); + $schedule->customerKey = $customerKey; + $schedule->paymentKey = $paymentMethodKey; + $schedule->amount = $amount; + $schedule->currency = 'USD'; + $schedule->startDate = date('mdY', strtotime("last day of next month")); + $schedule->paymentSchedule = PaymentSchedule::LAST_DAY_OF_THE_MONTH; //or PaymentSchedule::FIRST_DAY_OF_THE_MONTH + $schedule->frequency = ScheduleFrequency::MONTHLY; //'Monthly', 'Bi-Monthly', 'Quarterly', 'Semi-Annually' + //$schedule->duration = HpsPayPlanScheduleDuration::ONGOING; + $schedule->reprocessingCount = 1; + $schedule->emailReceipt = 'Never'; + $schedule->status = 'Active'; + + $response = $schedule->create(); + + return $response; +} + +$config = new ServicesConfig(); +$config->secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; +$config->serviceUrl = 'https://cert.api2.heartlandportico.com'; + +ServicesContainer::configure($config); + +$_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); +$_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING); + +try { + $customer = createCustomer(); + $paymentMethod = createPaymentMethod($customer); + $schedule = createSchedule($customer->key, $paymentMethod->key, $_GET['payment_amount']); + + echo 'Your ACH payment scheduled successfully
'; + printf('Customer Key: %s
', $customer->key); + printf('Payment Method Key: %s
', $paymentMethod->key); + printf('Schedule Key: %s
', $schedule->key); +} catch (Exception $e) { + die($e->getMessage()); +} + + +$body = '

Success!

'; +$body .= '

Thank you, ' . $_GET['FirstName'] . ', for your subscription.'; + + +// i'm running windows, so i had to update this: +//ini_set("SMTP", "my-mail-server"); + +//SendEmail($_GET['Email'], 'donotreply@e-hps.com', 'Successful Charge!', $body, true); diff --git a/lib/vendor/globalpayments/php-sdk/examples/recurring-signup-ach/index.html b/lib/vendor/globalpayments/php-sdk/examples/recurring-signup-ach/index.html new file mode 100644 index 0000000..6a5257b --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/examples/recurring-signup-ach/index.html @@ -0,0 +1,168 @@ + + + + + + + + Simple Recurring Payment Signup Form Demo + + + +

+

PHP SecureSubmit Example

+
+

Billing Information

+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +

Subscription Information

+
+ +
+ +
+
+ +

ACH Information

+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+
+
+ + diff --git a/lib/vendor/globalpayments/php-sdk/phpcs.xml b/lib/vendor/globalpayments/php-sdk/phpcs.xml new file mode 100644 index 0000000..b72a034 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/phpcs.xml @@ -0,0 +1,5 @@ + + + ./src + + diff --git a/lib/vendor/globalpayments/php-sdk/phpunit.xml.dist b/lib/vendor/globalpayments/php-sdk/phpunit.xml.dist new file mode 100644 index 0000000..1993192 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/phpunit.xml.dist @@ -0,0 +1,48 @@ + + + + + + + + + + + + ./test/ + + + ./test/Unit/ + + + ./test/Integration/ + + + ./test/Integration/Gateways/PorticoConnector/Certifications/ + ./test/Integration/Gateways/RealexConnector/Certifications/ + + + ./test/Integration/Gateways/PorticoConnector/ + + + ./test/Integration/Gateways/RealexConnector/ + + + + + + + ./src/ + + ./test/ + + + + + diff --git a/lib/vendor/globalpayments/php-sdk/sami.phar b/lib/vendor/globalpayments/php-sdk/sami.phar new file mode 100644 index 0000000..c341b04 Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/sami.phar differ diff --git a/lib/vendor/globalpayments/php-sdk/src/Builders/AuthorizationBuilder.php b/lib/vendor/globalpayments/php-sdk/src/Builders/AuthorizationBuilder.php new file mode 100644 index 0000000..bb891e4 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Builders/AuthorizationBuilder.php @@ -0,0 +1,1117 @@ + + */ + public $customData; + + /** + * Payment method CVN + * + * Only applicable for recurring payments + * + * @internal + * @var string + */ + public $cvn; + + /** + * Request description + * + * @internal + * @var string + */ + public $description; + + /** + * Request decisionManager + * + * @internal + * @var DecisionManager + */ + public $decisionManager; + + /** + * Request dynamic descriptor + * + * @internal + * @var string + */ + public $dynamicDescriptor; + + /** + * Request ecommerceInfo + * + * @internal + * @var EcommerceInfo + */ + public $ecommerceInfo; + + /** + * Request gratuity + * + * @internal + * @var string|amount + */ + public $gratuity; + + /** + * Request convenience amount + * + * @internal + * @var string|amount + */ + public $convenienceAmount; + + /** + * Request shipping amount + * + * @internal + * @var string|amount + */ + public $shippingAmount; + + /** + * @internal + * @var StoredCredential + */ + public $storedCredential; + + /** + * Request hosted payment data + * + * @internal + * @var HostedPaymentData + */ + public $hostedPaymentData; + + /** + * Request invoice number + * + * @internal + * @var string|float + */ + public $invoiceNumber; + + /** + * Request should request Level II + * + * @internal + * @var bool + */ + public $level2Request; + + /** + * Request offline authorization code + * + * @internal + * @var string + */ + public $offlineAuthCode; + + /** + * Request should be considered one-time + * + * Typically only applicable with recurring payment methods + * + * @internal + * @var bool + */ + public $oneTimePayment; + + /** + * Request order ID + * + * @internal + * @var string|float + */ + public $orderId; + + /** + * Request product Data + * + * @internal + * @var array + */ + public $productData; + + /** + * Request product ID + * + * @internal + * @var string|float + */ + public $productId; + + /** + * Request recurring sequence + * + * @internal + * @var RecurringSequence + */ + public $recurringSequence; + + /** + * Request recurring type + * + * @internal + * @var RecurringType + */ + public $recurringType; + + /** + * Request should request multi-use token + * + * @internal + * @var bool + */ + public $requestMultiUseToken; + + /** + * Request replacement gift card + * + * @internal + * @var GiftCard + */ + public $replacementCard; + + /** + * Request schedule ID + * + * Typically only applicable with recurring payment methods + * + * @internal + * @var string + */ + public $scheduleId; + + /** + * Request shipping address + * + * @internal + * @var Address + */ + public $shippingAddress; + + /** + * Request timestamp + * + * @internal + * @var string|float + */ + public $timestamp; + + /** + * DCC rate Data + * + * @internal + * @var dccRateData + */ + public $dccRateData; + + /** + * DCC processor + * + * @internal + * @var dccProcessor + */ + public $dccProcessor; + + /** + * DCC Rate Type + * + * @internal + * @var dccRateType + */ + public $dccRateType; + + /** + * DCC Type + * + * @internal + * @var dccType + */ + public $dccType; + + /** + * Fraud Filter + * + * Typically only applicable with recurring payment methods + * + * @internal + * @var string + */ + public $fraudFilter; + + /** + * For AVS (Address verification System) request + * + * @internal + * @var bool + */ + public $verifyAddress; + + /** + * {@inheritdoc} + * + * @param TransactionType $type Request transaction type + * @param IPaymentMethod $paymentMethod Request payment method + * + * @return + */ + public function __construct($type, IPaymentMethod $paymentMethod = null) + { + parent::__construct($type, $paymentMethod); + $this->withPaymentMethod($paymentMethod); + } + + /** + * {@inheritdoc} + * + * @return Transaction + */ + public function execute() + { + parent::execute(); + return ServicesContainer::instance() + ->getClient() + ->processAuthorization($this); + } + + /** + * {@inheritdoc} + * + * @return String + */ + public function serialize() + { + $this->transactionModifier = TransactionModifier::HOSTEDREQUEST; + parent::execute(); + + $client = ServicesContainer::instance()->getClient(); + + if ($client->supportsHostedPayments()) { + return $client->serializeRequest($this); + } + throw new UnsupportedTransactionException("Your current gateway does not support hosted payments."); + } + + /** + * {@inheritdoc} + * + * @return void + */ + protected function setupValidations() + { + $this->validations->of( + TransactionType::AUTH | + TransactionType::SALE | + TransactionType::REFUND | + TransactionType::ADD_VALUE + ) + ->with(TransactionModifier::NONE) + ->check('amount')->isNotNull() + ->check('currency')->isNotNull() + ->check('paymentMethod')->isNotNull(); + + $this->validations->of( + TransactionType::AUTH | + TransactionType::SALE + ) + ->with(TransactionModifier::HOSTEDREQUEST) + ->check('amount')->isNotNull() + ->check('currency')->isNotNull(); + + $this->validations->of( + TransactionType::AUTH | + TransactionType::SALE + ) + ->with(TransactionModifier::OFFLINE) + ->check('amount')->isNotNull() + ->check('currency')->isNotNull() + ->check('offlineAuthCode')->isNotNull(); + + $this->validations->of(TransactionType::BALANCE) + ->check('paymentMethod')->isNotNull(); + + $this->validations->of(TransactionType::ALIAS) + ->check('aliasAction')->isNotNull() + ->check('alias')->isNotNull(); + + $this->validations->of(TransactionType::REPLACE) + ->check('replacementCard')->isNotNull(); + + $this->validations->of( + TransactionType::AUTH | + TransactionType::SALE + ) + ->with(TransactionModifier::ENCRYPTED_MOBILE) + ->check('paymentMethod')->isNotNull() + ->check('token')->isNotNullInSubProperty('paymentMethod') + ->check('mobileType')->isNotNullInSubProperty('paymentMethod'); + + $this->validations->of( + TransactionType::VERIFY + ) + ->with(TransactionModifier::HOSTEDREQUEST) + ->check('currency')->isNotNull(); + + $this->validations->of( + TransactionType::AUTH | + TransactionType::SALE + ) + ->with(TransactionModifier::ALTERNATIVE_PAYMENT_METHOD) + ->check('amount')->isNotNull() + ->check('currency')->isNotNull() + ->check('paymentMethod')->isNotNull() + ->check('alternativePaymentMethodType')->isNotNullInSubProperty('paymentMethod') + ->check('returnUrl')->isNotNullInSubProperty('paymentMethod') + ->check('statusUpdateUrl')->isNotNullInSubProperty('paymentMethod') + ->check('country')->isNotNullInSubProperty('paymentMethod') + ->check('accountHolderName')->isNotNullInSubProperty('paymentMethod'); + } + + /** + * Set an address value; where applicable. + * + * Currently supports billing and shipping addresses. + * + * @param Address $address The desired address information + * @param AddressType|string $type The desired address type + * + * @return AuthorizationBuilder + */ + public function withAddress(Address $address, $type = AddressType::BILLING) + { + $address->type = $type; + if ($type === AddressType::BILLING) { + $this->billingAddress = $address; + } else { + $this->shippingAddress = $address; + } + return $this; + } + + /** + * Set the request alias + * + * @internal + * @param string $aliasAction Request alias action + * @param string $alias Request alias + * + * @return AuthorizationBuilder + */ + public function withAlias($aliasAction, $alias) + { + $this->aliasAction = $aliasAction; + $this->alias = $alias; + return $this; + } + + /** + * Set the request to allow duplicates + * + * @param bool $allowDuplicates Request to allow duplicates + * + * @return AuthorizationBuilder + */ + public function withAllowDuplicates($allowDuplicates) + { + $this->allowDuplicates = $allowDuplicates; + return $this; + } + + /** + * Set the request to allow a partial authorization + * + * @param bool $allowPartialAuth Request to allow a partial authorization + * + * @return AuthorizationBuilder + */ + public function withAllowPartialAuth($allowPartialAuth) + { + $this->allowPartialAuth = $allowPartialAuth; + return $this; + } + + /** + * Set the request amount + * + * @param string|float $amount Request amount + * + * @return AuthorizationBuilder + */ + public function withAmount($amount) + { + $this->amount = $amount; + return $this; + } + + /** @return AuthorizationBuilder */ + public function withAmountEstimated($value) + { + $this->amountEstimated = $value; + return $this; + } + + /** + * Set the request authorization amount + * + * @param string|float $authAmount Request authorization amount + * + * @return AuthorizationBuilder + */ + public function withAuthAmount($authAmount) + { + $this->authAmount = $authAmount; + return $this; + } + + /** + * Set the request's balance inquiry type + * + * @param string $balanceInquiryType Balance inquiry type + * + * @return AuthorizationBuilder + */ + public function withBalanceInquiryType($balanceInquiryType) + { + $this->balanceInquiryType = $balanceInquiryType; + return $this; + } + + /** + * Set the request cashback amount + * + * @param string|float $cashbackAmount Request cashback amount + * + * @return AuthorizationBuilder + */ + public function withCashBack($cashBackAmount) + { + $this->cashBackAmount = $cashBackAmount; + $this->transactionModifier = TransactionModifier::CASH_BACK; + return $this; + } + + public function withClientTransactionId($clientTransactionId) + { + if ($this->transactionType !== TransactionType::REVERSAL && $this->transactionType !== TransactionType::REFUND + ) { + $this->clientTransactionId = $clientTransactionId; + return $this; + } + + if (!$this->paymentMethod instanceof TransactionReference) { + $this->paymentMethod = new TransactionReference(); + } + + $this->paymentMethod->clientTransactionId = $clientTransactionId; + return $this; + } + + /** + * Set the request currency + * + * @param string $currency Request currency + * + * @return AuthorizationBuilder + */ + public function withCurrency($currency) + { + $this->currency = $currency; + return $this; + } + + /** + * Set the request customer ID + * + * @param string|float $customerId Request customer ID + * + * @return AuthorizationBuilder + */ + public function withCustomerId($customerId) + { + $this->customerId = $customerId; + return $this; + } + + /** + * Set the request customer IP address + * + * @param string|float $customerIpAddress Request customer IP address + * + * @return AuthorizationBuilder + */ + public function withCustomerIpAddress($customerIpAddress) + { + $this->customerIpAddress = $customerIpAddress; + return $this; + } + + /** + * Set the request customer Data + * + * @param Customer $customerData Request customer Data + * + * @return AuthorizationBuilder + */ + public function withCustomerData(Customer $customerData) + { + $this->customerData = $customerData; + return $this; + } + + /** + * Set the request customData + * + * @param string $customData Request customData + * + * @return AuthorizationBuilder + */ + public function withCustomData($customData) + { + $this->customData = $customData; + return $this; + } + + /** + * Set the request description + * + * @param string $description Request description + * + * @return AuthorizationBuilder + */ + public function withDescription($description) + { + $this->description = $description; + return $this; + } + + /** + * Set the request decisionManager + * + * @param DecisionManager $decisionManager Request decisionManager + * + * @return AuthorizationBuilder + */ + public function withDecisionManager(DecisionManager $decisionManager) + { + $this->decisionManager = $decisionManager; + return $this; + } + + /** + * Set the request dynamic descriptor + * + * @param string $dynamicDescriptor Request dynamic descriptor + * + * @return AuthorizationBuilder + */ + public function withDynamicDescriptor($dynamicDescriptor) + { + $this->dynamicDescriptor = $dynamicDescriptor; + return $this; + } + + /** + * Set the request gratuity + * + * @param string|amount $gratuity Request gratuity + * + * @return AuthorizationBuilder + */ + public function withGratuity($gratuity) + { + $this->gratuity = $gratuity; + return $this; + } + + /** + * Set the request invoice number + * + * @param string|float $invoiceNumber Request invoice number + * + * @return AuthorizationBuilder + */ + public function withInvoiceNumber($invoiceNumber) + { + $this->invoiceNumber = $invoiceNumber; + return $this; + } + + /** + * Set the request to request Level II + * + * @param bool $level2Request Request to request Level II + * + * @return AuthorizationBuilder + */ + public function withCommercialRequest($level2Request) + { + $this->level2Request = $level2Request; + return $this; + } + + /** + * Set the request offline authorization code + * + * @param string $offlineAuthCode Authorization code from offline authorization + * + * @return AuthorizationBuilder + */ + public function withOfflineAuthCode($offlineAuthCode) + { + $this->offlineAuthCode = $offlineAuthCode; + $this->transactionModifier = TransactionModifier::OFFLINE; + return $this; + } + + /** + * Sets the one-time payment flag; where applicable. + * + * This is only useful when using recurring payment profiles for + * one-time payments that are not a part of a recurring schedule. + * + * @param boolean $value The one-time flag + * + * @return AuthorizationBuilder + */ + public function withOneTimePayment($value) + { + $this->oneTimePayment = $value; + $this->transactionModifier = TransactionModifier::RECURRING; + return $this; + } + + /** + * Set the request order ID + * + * @param string|float $orderId Request order ID + * + * @return AuthorizationBuilder + */ + public function withOrderId($orderId) + { + $this->orderId = $orderId; + return $this; + } + + /** + * Set the request payment method + * + * @param IPaymentMethod $paymentMethod Request payment method + * + * @return AuthorizationBuilder + */ + public function withPaymentMethod($paymentMethod) + { + $this->paymentMethod = $paymentMethod; + if ($paymentMethod instanceof EBTCardData && $paymentMethod->serialNumber !== null) { + $this->transactionModifier = TransactionModifier::VOUCHER; + } + return $this; + } + + /** + * Set the request productData + * + * @param string $productData Request productData + * + * @return AuthorizationBuilder + */ + public function withProductData($productData) + { + $this->productData = $productData; + return $this; + } + + /** + * Set the request product ID + * + * @param string|float $productId Request product ID + * + * @return AuthorizationBuilder + */ + public function withProductId($productId) + { + $this->productId = $productId; + return $this; + } + + /** + * Set the request to request multi-use token + * + * @param bool $requestMultiUseToken Request to request multi-use token + * + * @return AuthorizationBuilder + */ + public function withRequestMultiUseToken($requestMultiUseToken) + { + $this->requestMultiUseToken = $requestMultiUseToken; + return $this; + } + + /** + * Previous request's transaction ID + * + * @param string $transactionId Transaction ID + * + * @return AuthorizationBuilder + */ + public function withTransactionId($transactionId) + { + $this->paymentMethod = new TransactionReference($transactionId); + return $this; + } + + /** + * Set the request's ecommerce info + * + * @param EcommerceInfo $ecommerceInfo Ecommerce info + * + * @return AuthorizationBuilder + */ + public function withEcommerceInfo(EcommerceInfo $ecommerceInfo) + { + $this->ecommerceInfo = $ecommerceInfo; + return $this; + } + + /** + * Set the request's replacement gift card + * + * @param GiftCard $replacementCard replacement gift card + * + * @return AuthorizationBuilder + */ + public function withReplacementCard(GiftCard $replacementCard) + { + $this->replacementCard = $replacementCard; + return $this; + } + + /** + * Set the request CVN + * + * @param string|float $cvn Request cvn + * + * @return AuthorizationBuilder + */ + public function withCvn($cvn) + { + $this->cvn = $cvn; + return $this; + } + + /** + * Set the request recurringType and recurringSequence + * + * @param RecurringType $recurringType & RecurringSequence $recurringSequence + * + * @return AuthorizationBuilder + */ + public function withRecurringInfo($recurringType, $recurringSequence) + { + $this->recurringType = $recurringType; + $this->recurringSequence = $recurringSequence; + return $this; + } + + /** + * Set the request dccRateData + * + * @param DccRateData dccRateData + * + * @return AuthorizationBuilder + */ + public function withDccRateData($value) + { + $this->dccRateData = $value; + return $this; + } + + /** + * Set the request dccProcessor + * + * @param DccProcessor dccProcessor + * + * @return AuthorizationBuilder + */ + public function withDccProcessor($value) + { + $this->dccProcessor = $value; + return $this; + } + + /** + * Set the request dccRateType + * + * @param DccRateType dccRateType + * + * @return AuthorizationBuilder + */ + public function withDccRateType($value) + { + $this->dccRateType = $value; + return $this; + } + + /** + * Set the request dccType + * + * @param string dccType + * + * @return AuthorizationBuilder + */ + public function withDccType($value) + { + $this->dccType = $value; + return $this; + } + + /** + * Set the request Convenience amount + * + * @param string|float $convenienceAmt Request Convenience amount + * + * @return AuthorizationBuilder + */ + public function withConvenienceAmount($convenienceAmount) + { + $this->convenienceAmount = $convenienceAmount ; + return $this; + } + + /** + * Set the request shippingAmount + * + * @param string|float $shippingAmount Request shippingAmount + * + * @return AuthorizationBuilder + */ + public function withShippingAmount($shippingAmount) + { + $this->shippingAmount = $shippingAmount; + return $this; + } + + /** + * @return AuthorizationBuilder + */ + public function withStoredCredential($storedCredential) + { + $this->storedCredential = $storedCredential; + return $this; + } + + /** + * Set the request customer IP address + * + * @param string|float $customerIpAddress Request customer IP address + * + * @return AuthorizationBuilder + */ + public function withFraudFilter($fraudFilter) + { + $this->fraudFilter = $fraudFilter; + return $this; + } + + /** + * Set whether AVS requested + * + * @param string|bool $verifyAddress + * + * @return AuthorizationBuilder + */ + public function withVerifyAddress($verifyAddress) + { + $this->verifyAddress = $verifyAddress; + return $this; + } + + /** + * Set the timestamp + * + * @param string $timestamp + * + * @return AuthorizationBuilder + */ + public function withTimeStamp($timestamp) + { + $this->timestamp = $timestamp; + return $this; + } + + /** + * Set the hostedPaymentData + * + * @param string $hostedPaymentData + * + * @return AuthorizationBuilder + */ + public function withHostedPaymentData($hostedPaymentData) + { + $this->hostedPaymentData = $hostedPaymentData; + return $this; + } + + /** + * Set the associated schedule ID + * + * @param string $scheduleId + * + * @return AuthorizationBuilder + */ + public function withScheduleId($scheduleId) + { + $this->scheduleId = $scheduleId; + return $this; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Builders/BaseBuilder.php b/lib/vendor/globalpayments/php-sdk/src/Builders/BaseBuilder.php new file mode 100644 index 0000000..3eb490d --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Builders/BaseBuilder.php @@ -0,0 +1,94 @@ +validations = new Validations(); + $this->setupValidations(); + } + + /** + * Executes the builder + * + * @return Transaction + */ + public function execute() + { + $this->validate(); + return new Transaction(); + } + + /** + * Used to setup validations for the builder. + * + * @return void + */ + abstract protected function setupValidations(); + + /** + * Validates the builder based on validations in `$validations` + * + * @return void + */ + protected function validate() + { + array_map( + [$this, 'maybeRunValidationKeyRules'], + array_keys($this->validations->rules) + ); + } + + /** + * Runs validations for `$key` + * + * @param mixed $key Validation rules key + * + * @throws BuilderException + * @return void + */ + protected function maybeRunValidationKeyRules($key) + { + if (($key & $this->transactionType) !== $this->transactionType) { + return; + } + + foreach ($this->validations->rules[$key] as $validation) { + if (null === $validation->clause) { + continue; + } + + if ($this->transactionModifier === $validation->modifier + && !call_user_func($validation->clause->callback, $this) + ) { + throw new BuilderException($validation->clause->message); + } + } + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Builders/BaseBuilder/ValidationClause.php b/lib/vendor/globalpayments/php-sdk/src/Builders/BaseBuilder/ValidationClause.php new file mode 100644 index 0000000..8c0343f --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Builders/BaseBuilder/ValidationClause.php @@ -0,0 +1,277 @@ +parent = $parent; + $this->target = $target; + $this->precondition = $precondition; + } + + /** + * Validates the target property is not null + * + * @param string $subProperty Parent of current property + * @param string $message Validation message to override the default + * + * @return ValidationTarget + */ + public function isNotNull($message = null, $subProperty = null) + { + $this->callback = function ($builder) use ($subProperty) { + $builder = ($subProperty !== null && !empty($builder->{$subProperty})) + ? $builder->{$subProperty} + : $builder; + if (!property_exists($builder, $this->target->property) + && !isset($builder->{$this->target->property}) + ) { + throw new BuilderException( + sprintf( + 'Property `%s` does not exist on `%s`', + $this->target->property, + get_class($builder) + ) + ); + } + $value = $builder->{$this->target->property}; + return null !== $value; + }; + $this->message = !empty($message) + ? $message + // TODO: implement a way to expose property name + : sprintf( + '%s cannot be null for this transaction type.', + $this->target->property + ); + + if ($this->precondition) { + return $this->target; + } + + return $this->parent->of($this->target->type, $this->target->modifier); + } + + /** + * Validates the target property is null + * + * @param string $subProperty Parent of current property + * @param string $message Validation message to override the default + * + * @return ValidationTarget + */ + public function isNull($message = null, $subProperty = null) + { + $this->callback = function ($builder) use ($subProperty) { + $builder = ($subProperty == null && empty($builder->{$subProperty})) + ? $builder->{$subProperty} + : $builder; + if (!property_exists($builder, $this->target->property) + && !isset($builder->{$this->target->property}) + ) { + throw new BuilderException( + sprintf( + 'Property `%s` does not exist on `%s`', + $this->target->property, + get_class($builder) + ) + ); + } + $value = $builder->{$this->target->property}; + return null == $value; + }; + $this->message = !empty($message) + ? $message + // TODO: implement a way to expose property name + : sprintf( + '%s cannot be set for this transaction type.', + $this->target->property + ); + + if ($this->precondition) { + return $this->target; + } + + return $this->parent->of($this->target->type, $this->target->modifier); + } + + /** + * + * @param class $clazz + * @param string $message + * + * @return ValidationTarget + */ + public function isInstanceOf($clazz, $message = null) + { + $this->callback = function ($builder) use ($clazz) { + if (!($builder->{$this->target->property} instanceof $clazz)) { + throw new BuilderException( + sprintf( + '%s must be an instance of the %s class.', + $this->target->property, + $clazz + ) + ); + return false; + } + return true; + }; + + $this->message = !empty($message) + ? $message + // TODO: implement a way to expose property name + : sprintf( + '%s must be an instance of the %s class.', + $this->target->property, + $clazz + ); + + if ($this->precondition) { + return $this->target; + } + + return $this->parent->of($this->target->type, $this->target->modifier); + } + + /** + * Validates the target property is equal to the expected value + * + * @param string $expected + * @param string $message Validation message to override the default + * + * @return ValidationTarget + */ + public function isEqualTo($expected, $message = null) + { + $this->callback = function ($builder) use ($expected) { + if ($builder->{$this->target->property} !== $expected) { + throw new BuilderException( + sprintf( + 'Property `%s` does not equal the expected value `%s`', + $this->target->property, + $expected + ) + ); + return false; + } + return true; + }; + $this->message = !empty($message) + ? $message + // TODO: implement a way to expose property name + : sprintf( + 'Property `%s` does not equal the expected value `%s`', + $this->target->property, + $expected + ); + + if ($this->precondition) { + return $this->target; + } + + return $this->parent->of($this->target->type, $this->target->modifier); + } + + /** + * Validates the target property is NOT equal to the expected value + * + * @param string $expected + * @param string $message Validation message to override the default + * + * @return ValidationTarget + */ + public function isNotEqualTo($expected, $message = null) + { + $this->callback = function ($builder) use ($expected) { + if ($builder->{$this->target->property} === $expected) { + throw new BuilderException( + sprintf( + 'Property `%s`is equal to the expected value `%s`', + $this->target->property, + $expected + ) + ); + return false; + } + return true; + }; + $this->message = !empty($message) + ? $message + // TODO: implement a way to expose property name + : sprintf( + 'Property `%s` is equal to the expected value `%s`', + $this->target->property, + $expected + ); + + if ($this->precondition) { + return $this->target; + } + + return $this->parent->of($this->target->type, $this->target->modifier); + } + + /** + * Validates the target property is not null in a sub class + * + * @param string $subProperty Parent of current property + * @param string $message Validation message to override the default + * + * @return ValidationTarget + */ + public function isNotNullInSubProperty($subProperty, $message = null) + { + return $this->isNotNull($message, $subProperty); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Builders/BaseBuilder/ValidationTarget.php b/lib/vendor/globalpayments/php-sdk/src/Builders/BaseBuilder/ValidationTarget.php new file mode 100644 index 0000000..4a5bdbf --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Builders/BaseBuilder/ValidationTarget.php @@ -0,0 +1,103 @@ +parent = $parent; + $this->type = $type; + $this->modifier = $modifier; + } + + /** + * Sets the validation's transaction modifier + * + * @param TransactionModifier|int $modifier Validation modifier + * + * @return ValidationTarget + */ + public function with($modifier) + { + $this->modifier = $modifier; + return $this; + } + + /** + * Creates a new `ValidationClause` to specify validations on the + * given property. + * + * @param string $targetProperty Property to validate + * + * @return ValidationClause + */ + public function check($targetProperty) + { + $this->property = $targetProperty; + $this->clause = new ValidationClause($this->parent, $this); + return $this->clause; + } + + /** + * Creates a new `ValidationClause` to specify conditions for future + * validations checked against the given property. + * + * @param string $targetProperty Property to validate + * + * @return ValidationClause + */ + public function when($targetProperty) + { + $this->property = $targetProperty; + $this->clause = new ValidationClause($this->parent, $this, true); + return $this->clause; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Builders/BaseBuilder/Validations.php b/lib/vendor/globalpayments/php-sdk/src/Builders/BaseBuilder/Validations.php new file mode 100644 index 0000000..a9773a0 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Builders/BaseBuilder/Validations.php @@ -0,0 +1,46 @@ +rules = []; + } + + /** + * Creates a new `ValidationTarget` for the given + * transaction type mask. + * + * @param TransactionType|int $type Mask of transaction types + * @param TransactionModifier|int $modifier Transaction modifier + * + * @return ValidationTarget + */ + public function of($type, $modifier = TransactionModifier::NONE) + { + if (!array_key_exists($type, $this->rules)) { + $this->rules[$type] = []; + } + + $target = new ValidationTarget($this, $type, $modifier); + $this->rules[$type][] = $target; + return $target; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Builders/ManagementBuilder.php b/lib/vendor/globalpayments/php-sdk/src/Builders/ManagementBuilder.php new file mode 100644 index 0000000..e61f5a7 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Builders/ManagementBuilder.php @@ -0,0 +1,383 @@ +paymentMethod instanceof TransactionReference) { + return $this->paymentMethod->transactionId; + } + return null; + case 'orderId': + if ($this->paymentMethod instanceof TransactionReference) { + return $this->paymentMethod->orderId; + } + return null; + case 'authorizationCode': + if ($this->paymentMethod instanceof TransactionReference) { + return $this->paymentMethod->authCode; + } + return null; + } + } + + public function __isset($name) + { + return in_array($name, [ + 'transactionId', + 'orderId', + 'authorizationId', + ]) || isset($this->{$name}); + } + + /** + * {@inheritdoc} + * + * @return Transaction + */ + public function execute() + { + parent::execute(); + return ServicesContainer::instance() + ->getClient() + ->manageTransaction($this); + } + + /** + * {@inheritdoc} + * + * @return void + */ + protected function setupValidations() + { + $this->validations->of( + TransactionType::CAPTURE | + TransactionType::EDIT | + TransactionType::HOLD | + TransactionType::RELEASE + ) + ->check('transactionId')->isNotNull(); + + $this->validations->of(TransactionType::EDIT) + ->with(TransactionModifier::LEVEL_II) + ->check('taxType')->isNotNull(); + + $this->validations->of(TransactionType::REFUND) + ->when('amount')->isNotNull() + ->check('currency')->isNotNull(); + + $this->validations->of(TransactionType::VERIFY_SIGNATURE) + ->check('payerAuthenticationResponse')->isNotNull() + ->check('amount')->isNotNull() + ->check('currency')->isNotNull() + ->check('orderId')->isNotNull(); + + $this->validations->of(TransactionType::TOKEN_DELETE | TransactionType::TOKEN_UPDATE) + ->check('paymentMethod')->isNotNull() + ->check('paymentMethod')->isInstanceOf(ITokenizable::class); + + $this->validations->of(TransactionType::TOKEN_UPDATE) + ->check('paymentMethod')->isInstanceOf(CreditCardData::class); + } + + /** + * Sets the current transaction's amount. + * + * @param string|float $amount The amount + * + * @return ManagementBuilder + */ + public function withAmount($amount) + { + $this->amount = $amount; + return $this; + } + + /** + * Sets the current transaction's authorized amount; where applicable. + * + * @param string|float $authAmount The authorized amount + * + * @return ManagementBuilder + */ + public function withAuthAmount($authAmount) + { + $this->authAmount = $authAmount; + return $this; + } + + /** + * Sets the currency. + * + * The formatting for the supplied value will currently depend on the + * configured gateway's requirements. + * + * @param string $currency The currency + * + * @return ManagementBuilder + */ + public function withCurrency($currency) + { + $this->currency = $currency; + return $this; + } + + /** + * Sets the transaction's description. + * + * This value is not guaranteed to be sent in the authorization + * or settlement process. + * + * @param string $value The description + * + * @return ManagementBuilder + */ + public function withDescription($value) + { + $this->description = $value; + return $this; + } + + /** + * Sets the gratuity amount; where applicable. + * + * This value is information only and does not affect the + * authorization amount. + * + * @param string|float $gratuity the gratuity + * + * @return ManagementBuilder + */ + public function withGratuity($gratuity) + { + $this->gratuity = $gratuity; + return $this; + } + + /** + * @return ManagementBuilder + */ + public function withIssuerData(CardIssuerEntryTag $tag, String $value) + { + if ($this->issuerData == null) { + $this->issuerData = []; + } + $this->issuerData[$tag] = $value; + return $this; + } + + /** + * Previous request's transaction reference + * + * @internal + * @param IPaymentMethod $paymentMethod Transaction reference + * + * @return ManagementBuilder + */ + public function withPaymentMethod(IPaymentMethod $paymentMethod) + { + $this->paymentMethod = $paymentMethod; + return $this; + } + + /** + * Sets the purchase order number; where applicable. + * + * @param string|float $poNumber The purchase order number + * + * @return ManagementBuilder + */ + public function withPoNumber($poNumber) + { + $this->poNumber = $poNumber; + return $this; + } + + /** + * Sets the reason code for the transaction. + * + * @param ReasonCode $value The reason code + * + * @return ManagementBuilder + */ + public function withReasonCode($value) + { + $this->reasonCode = $value; + return $this; + } + + /** + * Sets the tax amount. + * + * Useful for commercial purchase card requests. + * + * @param string|float $taxAmount The tax amount + * + * @return ManagementBuilder + */ + public function withTaxAmount($taxAmount) + { + $this->taxAmount = $taxAmount; + return $this; + } + + /** + * Sets the tax type. + * + * Useful for commercial purchase card requests. + * + * @param TaxType $taxType The tax type + * + * @return ManagementBuilder + */ + public function withTaxType($taxType) + { + $this->taxType = $taxType; + return $this; + } + + public function withAlternativePaymentType($alternativePaymentType) + { + $this->alternativePaymentType = $alternativePaymentType; + return $this; + } + + public function withPayerAuthenticationResponse($payerAuthenticationResponse) + { + $this->payerAuthenticationResponse = $payerAuthenticationResponse; + return $this; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Builders/RecurringBuilder.php b/lib/vendor/globalpayments/php-sdk/src/Builders/RecurringBuilder.php new file mode 100644 index 0000000..2c48de3 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Builders/RecurringBuilder.php @@ -0,0 +1,92 @@ + + */ + public $searchCriteria; + + /** + * @param TransactionType $type + * @param IRecurringEntity $entity + * + * @return + */ + public function __construct($type, IRecurringEntity $entity = null) + { + parent::__construct($type); + + $this->searchCriteria = []; + if ($entity !== null) { + $this->entity = $entity; + $this->key = $entity->key; + } + } + + /** + * @internal + * @param string $key + * @param string $value + * + * @return RecurringBuilder + */ + public function addSearchCriteria($key, $value) + { + $this->searchCriteria[$key] = $value; + return $this; + } + + /** + * Executes the builder against the gateway. + * + * @return mixed + */ + public function execute() + { + parent::execute(); + + $client = ServicesContainer::instance()->getRecurringClient(); + return $client->processRecurring($this); + } + + protected function setupValidations() + { + $this->validations->of( + TransactionType::EDIT | + TransactionType::DELETE | + TransactionType::FETCH + ) + ->check('key')->isNotNull(); + + $this->validations->of( + TransactionType::SEARCH + ) + ->check('searchCriteria')->isNotNull(); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Builders/ReportBuilder.php b/lib/vendor/globalpayments/php-sdk/src/Builders/ReportBuilder.php new file mode 100644 index 0000000..73138db --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Builders/ReportBuilder.php @@ -0,0 +1,44 @@ +reportType = $reportType; + } + + /** + * Executes the builder against the gateway. + * + * @return mixed + */ + public function execute() + { + parent::execute(); + + $client = ServicesContainer::instance()->getClient(); + return $client->processReport($this); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Builders/Secure3dBuilder.php b/lib/vendor/globalpayments/php-sdk/src/Builders/Secure3dBuilder.php new file mode 100644 index 0000000..a77fddc --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Builders/Secure3dBuilder.php @@ -0,0 +1,1228 @@ + */ + public $sdkUiTypes; + /** @var Address */ + public $shippingAddress; + /** @var DateTime */ + public $shippingAddressCreateDate; + /** @var AgeIndicator */ + public $shippingAddressUsageIndicator; + /** @var ShippingMethod */ + public $shippingMethod; + /** @var bool */ + public $shippingNameMatchesCardHolderName; + /** @var ThreeDSecure */ + public $threeDSecure; + /** @var TransactionType */ + public $transactionType; + /** @var TransactionModifier */ + public $transactionModifier = TransactionModifier::NONE; + // /** @var Secure3dVersion */ + // public $version; + /** @var string */ + public $workCountryCode; + /** @var string */ + public $workNumber; + + public function __construct($transactionType) + { + parent::__construct(); + $this->authenticationSource = AuthenticationSource::BROWSER; + $this->authenticationRequestType = AuthenticationRequestType::PAYMENT_TRANSACTION; + $this->messageCategory = MessageCategory::PAYMENT_AUTHENTICATION; + $this->transactionType = $transactionType; + } + + /** @return AgeIndicator */ + public function getAccountAgeIndicator() + { + return $this->accountAgeIndicator; + } + /** @return DateTime */ + public function getAccountChangeDate() + { + return $this->accountChangeDate; + } + /** @return DateTime */ + public function getAccountCreateDate() + { + return $this->accountCreateDate; + } + /** @return AgeIndicator */ + public function getAccountChangeIndicator() + { + return $this->accountChangeIndicator; + } + /** @return bool */ + public function isAddressMatchIndicator() + { + return $this->addressMatchIndicator; + } + /** @return string|float */ + public function getAmount() + { + return $this->amount; + } + /** @return string */ + public function getApplicationId() + { + return $this->applicationId; + } + /** @return AuthenticationSource */ + public function getAuthenticationSource() + { + return $this->authenticationSource; + } + /** @return AuthenticationRequestType */ + public function getAuthenticationRequestType() + { + return $this->authenticationRequestType; + } + /** @return address */ + public function getBillingAddress() + { + return $this->billingAddress; + } + /** @return BrowserData */ + public function getBrowserData() + { + return $this->browserData; + } + /** @return string */ + public function getCurrency() + { + return $this->currency; + } + /** @return string */ + public function getCustomerAccountId() + { + return $this->customerAccountId; + } + /** @return string */ + public function getCustomerAuthenticationData() + { + return $this->customerAuthenticationData; + } + /** @return CustomerAuthenticationMethod */ + public function getCustomerAuthenticationMethod() + { + return $this->customerAuthenticationMethod; + } + /** @return DateTime */ + public function getCustomerAuthenticationTimestamp() + { + return $this->customerAuthenticationTimestamp; + } + /** @return string */ + public function getCustomerEmail() + { + return $this->customerEmail; + } + /** @return string */ + public function getDeliveryEmail() + { + return $this->deliveryEmail; + } + /** @return DeliveryTimeFrame */ + public function getDeliveryTimeframe() + { + return $this->deliveryTimeframe; + } + /** @return string */ + public function getEncodedData() + { + return $this->encodedData; + } + /** @return string */ + public function getEphemeralPublicKey() + { + return $this->ephemeralPublicKey; + } + /** @return int */ + public function getGiftCardCount() + { + return $this->giftCardCount; + } + /** @return string */ + public function getGiftCardCurrency() + { + return $this->giftCardCurrency; + } + /** @return decimal */ + public function getGiftCardAmount() + { + return $this->giftCardAmount; + } + /** @return string */ + public function getHomeCountryCode() + { + return $this->homeCountryCode; + } + /** @return string */ + public function getHomeNumber() + { + return $this->homeNumber; + } + /** @return int */ + public function getMaxNumberOfInstallments() + { + return $this->maxNumberOfInstallments; + } + /** @return int */ + public function getMaximumTimeout() + { + return $this->maximumTimeout; + } + /** @return MerchantDataCollection */ + public function getMerchantData() + { + return $this->merchantData; + } + /** @return MessageCategory */ + public function getMessageCategory() + { + return $this->messageCategory; + } + /** @return AuthenticationRequestType */ + public function getMerchantInitiatedRequestType() + { + return $this->merchantInitiatedRequestType; + } + /** @return MessageVersion */ + public function getMessageVersion() + { + return $this->messageVersion; + } + /** @return MethodUrlCompletion */ + public function getMethodUrlCompletion() + { + return $this->methodUrlCompletion; + } + /** @return string */ + public function getMobileCountryCode() + { + return $this->mobileCountryCode; + } + /** @return string */ + public function getMobileNumber() + { + return $this->mobileNumber; + } + /** @return int */ + public function getNumberOfAddCardAttemptsInLast24Hours() + { + return $this->numberOfAddCardAttemptsInLast24Hours; + } + /** @return int */ + public function getNumberOfPurchasesInLastSixMonths() + { + return $this->numberOfPurchasesInLastSixMonths; + } + /** @return int */ + public function getNumberOfTransactionsInLast24Hours() + { + return $this->numberOfTransactionsInLast24Hours; + } + /** @return int */ + public function getNumberOfTransactionsInLastYear() + { + return $this->numberOfTransactionsInLastYear; + } + /** @return DateTime */ + public function getOrderCreateDate() + { + return $this->orderCreateDate; + } + /** @return string */ + public function getOrderId() + { + return $this->orderId; + } + /** @return OrderTransactionType */ + public function getOrderTransactionType() + { + return $this->orderTransactionType; + } + /** @return DateTime */ + public function getPasswordChangeDate() + { + return $this->passwordChangeDate; + } + /** @return AgeIndicator */ + public function getPasswordChangeIndicator() + { + return $this->passwordChangeIndicator; + } + /** @return DateTime */ + public function getPaymentAccountCreateDate() + { + return $this->paymentAccountCreateDate; + } + /** @return AgeIndicator */ + public function getPaymentAgeIndicator() + { + return $this->paymentAgeIndicator; + } + /** @return string */ + public function getPayerAuthenticationResponse() + { + return $this->payerAuthenticationResponse; + } + /** @return IPaymentMethod */ + public function getPaymentMethod() + { + return $this->paymentMethod; + } + /** @return DateTime */ + public function getPreOrderAvailabilityDate() + { + return $this->preOrderAvailabilityDate; + } + /** @return PreOrderIndicator */ + public function getPreOrderIndicator() + { + return $this->preOrderIndicator; + } + /** @return bool */ + public function getPreviousSuspiciousActivity() + { + return $this->previousSuspiciousActivity; + } + /** @return string */ + public function getPriorAuthenticationData() + { + return $this->priorAuthenticationData; + } + /** @return PriorAuthenticationMethod */ + public function getPriorAuthenticationMethod() + { + return $this->priorAuthenticationMethod; + } + /** @return string */ + public function getPriorAuthenticationTransactionId() + { + return $this->priorAuthenticationTransactionId; + } + /** @return DateTime */ + public function getPriorAuthenticationTimestamp() + { + return $this->priorAuthenticationTimestamp; + } + /** @return DateTime */ + public function getRecurringAuthorizationExpiryDate() + { + return $this->recurringAuthorizationExpiryDate; + } + /** @return int */ + public function getRecurringAuthorizationFrequency() + { + return $this->recurringAuthorizationFrequency; + } + /** @return string */ + public function getReferenceNumber() + { + return $this->referenceNumber; + } + /** @return ReorderIndicator */ + public function getReorderIndicator() + { + return $this->reorderIndicator; + } + /** @return SdkInterface */ + public function getSdkInterface() + { + return $this->sdkInterface; + } + /** @return string */ + public function getSdkTransactionId() + { + return $this->sdkTransactionId; + } + /** @return array */ + public function getSdkUiTypes() + { + return $this->sdkUiTypes; + } + /** @return string */ + public function getServerTransactionId() + { + if (!empty($this->threeDSecure)) { + return $this->threeDSecure->serverTransactionId; + } + return null; + } + /** @return Address */ + public function getShippingAddress() + { + return $this->shippingAddress; + } + /** @return DateTime */ + public function getShippingAddressCreateDate() + { + return $this->shippingAddressCreateDate; + } + /** @return AgeIndicator */ + public function getShippingAddressUsageIndicator() + { + return $this->shippingAddressUsageIndicator; + } + /** @return ShippingMethod */ + public function getShippingMethod() + { + return $this->shippingMethod; + } + /** @return bool */ + public function getShippingNameMatchesCardHolderName() + { + return $this->shippingNameMatchesCardHolderName; + } + /** @return ThreeDSecure */ + public function getThreeDSecure() + { + return $this->threeDSecure; + } + /** @return TransactionType */ + public function getTransactionType() + { + return $this->transactionType; + } + /** @return Secure3dVersion */ + public function getVersion() + { + if (!empty($this->threeDSecure)) { + return $this->threeDSecure->version; + } + return null; + } + /** @return string */ + public function getWorkCountryCode() + { + return $this->workCountryCode; + } + /** @return string */ + public function getWorkNumber() + { + return $this->workNumber; + } + + // HELPER METHOD FOR THE CONNECTOR + /** @return bool */ + public function hasMobileFields() + { + return( + !empty($this->applicationId) || + $this->ephemeralPublicKey != null || + $this->maximumTimeout != null || + $this->referenceNumber != null || + !empty($this->sdkTransactionId) || + !empty($this->encodedData) || + $this->sdkInterface != null || + $this->sdkUiTypes != null + ); + } + /** @return bool */ + public function hasPriorAuthenticationData() + { + return ( + $this->priorAuthenticationMethod != null || + !empty($this->priorAuthenticationTransactionId) || + $this->priorAuthenticationTimestamp != null || + !empty($this->priorAuthenticationData) + ); + } + /** @return bool */ + public function hasRecurringAuthData() + { + return ( + $this->maxNumberOfInstallments != null || + $this->recurringAuthorizationFrequency != null || + $this->recurringAuthorizationExpiryDate != null + ); + } + /** @return bool */ + public function hasPayerLoginData() + { + return ( + !empty($this->customerAuthenticationData) || + $this->customerAuthenticationTimestamp != null || + $this->customerAuthenticationMethod != null + ); + } + + /** @return Secure3dBuilder */ + public function withAddress(Address $address, $type = AddressType::BILLING) + { + if ($type === AddressType::BILLING) { + $this->billingAddress = $address; + } else { + $this->shippingAddress = $address; + } + return $this; + } + + /** @return Secure3dBuilder */ + public function withAccountAgeIndicator($ageIndicator) + { + $this->accountAgeIndicator = $ageIndicator; + return $this; + } + + /** @return Secure3dBuilder */ + public function withAccountChangeDate($accountChangeDate) + { + $this->accountChangeDate = $accountChangeDate; + return $this; + } + + /** @return Secure3dBuilder */ + public function withAccountCreateDate($accountCreateDate) + { + $this->accountCreateDate = $accountCreateDate; + return $this; + } + + /** @return Secure3dBuilder */ + public function withAccountChangeIndicator($accountChangeIndicator) + { + $this->accountChangeIndicator = $accountChangeIndicator; + return $this; + } + + /** @return Secure3dBuilder */ + public function withAddressMatchIndicator(bool $value) + { + $this->addressMatchIndicator = $value; + return $this; + } + + /** @return Secure3dBuilder */ + public function withAmount($value) + { + $this->amount = $value; + return $this; + } + + /** @return Secure3dBuilder */ + public function withApplicationId($applicationId) + { + $this->applicationId = $applicationId; + return $this; + } + + /** @return Secure3dBuilder */ + public function withAuthenticationSource($value) + { + $this->authenticationSource = $value; + return $this; + } + + /** @return Secure3dBuilder */ + public function withAuthenticationRequestType($value) + { + $this->authenticationRequestType = $value; + return $this; + } + + /** @return Secure3dBuilder */ + public function withBrowserData($value) + { + $this->browserData = $value; + return $this; + } + + /** @return Secure3dBuilder */ + public function withCustomerAccountId($customerAccountId) + { + $this->customerAccountId = $customerAccountId; + return $this; + } + + /** @return Secure3dBuilder */ + public function withCustomerAuthenticationData($customerAuthenticationData) + { + $this->customerAuthenticationData = $customerAuthenticationData; + return $this; + } + + /** @return Secure3dBuilder */ + public function withCustomerAuthenticationMethod($customerAuthenticationMethod) + { + $this->customerAuthenticationMethod = $customerAuthenticationMethod; + return $this; + } + + /** @return Secure3dBuilder */ + public function withCustomerAuthenticationTimestamp($customerAuthenticationTimestamp) + { + $this->customerAuthenticationTimestamp = $customerAuthenticationTimestamp; + return $this; + } + + /** @return Secure3dBuilder */ + public function withCurrency($value) + { + $this->currency = $value; + return $this; + } + + /** @return Secure3dBuilder */ + public function withCustomerEmail($value) + { + $this->customerEmail = $value; + return $this; + } + + /** @return Secure3dBuilder */ + public function withDeliveryEmail($deliveryEmail) + { + $this->deliveryEmail = $deliveryEmail; + return $this; + } + + /** @return Secure3dBuilder */ + public function withDeliveryTimeFrame($deliveryTimeframe) + { + $this->deliveryTimeframe = $deliveryTimeframe; + return $this; + } + + /** @return Secure3dBuilder */ + public function withEncodedData($encodedData) + { + $this->encodedData = $encodedData; + return $this; + } + + /** @return Secure3dBuilder */ + public function withEphemeralPublicKey($ephemeralPublicKey) + { + $this->ephemeralPublicKey = $ephemeralPublicKey; + return $this; + } + + /** @return Secure3dBuilder */ + public function withGiftCardCount($giftCardCount) + { + $this->giftCardCount = $giftCardCount; + return $this; + } + + /** @return Secure3dBuilder */ + public function withGiftCardCurrency($giftCardCurrency) + { + $this->giftCardCurrency = $giftCardCurrency; + return $this; + } + + /** @return Secure3dBuilder */ + public function withGiftCardAmount($giftCardAmount) + { + $this->giftCardAmount = $giftCardAmount; + return $this; + } + + /** @return Secure3dBuilder */ + public function withHomeNumber($countryCode, $number) + { + $this->homeCountryCode = $countryCode; + $this->homeNumber = $number; + return $this; + } + + /** @return Secure3dBuilder */ + public function withMaxNumberOfInstallments($maxNumberOfInstallments) + { + $this->maxNumberOfInstallments = $maxNumberOfInstallments; + return $this; + } + + /** @return Secure3dBuilder */ + public function withMaximumTimeout($maximumTimeout) + { + $this->maximumTimeout = $maximumTimeout; + return $this; + } + + /** @return Secure3dBuilder */ + public function withMerchantData(MerchantDataCollection $value) + { + $this->merchantData = $value; + if (!empty($this->merchantData)) { + if (empty($this->threeDSecure)) { + $this->threeDSecure = new ThreeDSecure(); + } + $this->threeDSecure->setMerchantData($value); + } + return $this; + } + + /** @return Secure3dBuilder */ + public function withMessageCategory($value) + { + $this->messageCategory = $value; + return $this; + } + + /** @return Secure3dBuilder */ + public function withMerchantInitiatedRequestType($merchantInitiatedRequestType) + { + $this->merchantInitiatedRequestType = $merchantInitiatedRequestType; + return $this; + } + + /** @return Secure3dBuilder */ + public function withMessageVersion($value) + { + $this->messageVersion = $value; + return $this; + } + + /** @return Secure3dBuilder */ + public function withMethodUrlCompletion($value) + { + $this->methodUrlCompletion = $value; + return $this; + } + + /** @return Secure3dBuilder */ + public function withMobileNumber($countryCode, $number) + { + $this->mobileCountryCode = $countryCode; + $this->mobileNumber = $number; + return $this; + } + + /** @return Secure3dBuilder */ + public function withNumberOfAddCardAttemptsInLast24Hours($numberOfAddCardAttemptsInLast24Hours) + { + $this->numberOfAddCardAttemptsInLast24Hours = $numberOfAddCardAttemptsInLast24Hours; + return $this; + } + + /** @return Secure3dBuilder */ + public function withNumberOfPurchasesInLastSixMonths($numberOfPurchasesInLastSixMonths) + { + $this->numberOfPurchasesInLastSixMonths = $numberOfPurchasesInLastSixMonths; + return $this; + } + + /** @return Secure3dBuilder */ + public function withNumberOfTransactionsInLast24Hours($numberOfTransactionsInLast24Hours) + { + $this->numberOfTransactionsInLast24Hours = $numberOfTransactionsInLast24Hours; + return $this; + } + + /** @return Secure3dBuilder */ + public function withNumberOfTransactionsInLastYear($numberOfTransactionsInLastYear) + { + $this->numberOfTransactionsInLastYear = $numberOfTransactionsInLastYear; + return $this; + } + + /** @return Secure3dBuilder */ + public function withOrderCreateDate($value) + { + $this->orderCreateDate = $value; + return $this; + } + + /** @return Secure3dBuilder */ + public function withOrderId($value) + { + $this->orderId = $value; + return $this; + } + + /** @return Secure3dBuilder */ + public function withOrderTransactionType($orderTransactionType) + { + $this->orderTransactionType = $orderTransactionType; + return $this; + } + + /** @return Secure3dBuilder */ + public function withPasswordChangeDate($passwordChangeDate) + { + $this->passwordChangeDate = $passwordChangeDate; + return $this; + } + + /** @return Secure3dBuilder */ + public function withPasswordChangeIndicator($passwordChangeIndicator) + { + $this->passwordChangeIndicator = $passwordChangeIndicator; + return $this; + } + + /** @return Secure3dBuilder */ + public function withPaymentAccountCreateDate($paymentAccountCreateDate) + { + $this->paymentAccountCreateDate = $paymentAccountCreateDate; + return $this; + } + + /** @return Secure3dBuilder */ + public function withPaymentAccountAgeIndicator($paymentAgeIndicator) + { + $this->paymentAgeIndicator = $paymentAgeIndicator; + return $this; + } + + /** @return Secure3dBuilder */ + public function withPayerAuthenticationResponse($value) + { + $this->payerAuthenticationResponse = $value; + return $this; + } + + /** @return Secure3dBuilder */ + public function withPaymentMethod($value) + { + $this->paymentMethod = $value; + if ($this->paymentMethod instanceof ISecure3d) { + $secureEcom = $this->paymentMethod->threeDSecure; + if (!empty($secureEcom)) { + $this->threeDSecure = $secureEcom; + } + } + return $this; + } + + /** @return Secure3dBuilder */ + public function withPreOrderAvailabilityDate($preOrderAvailabilityDate) + { + $this->preOrderAvailabilityDate = $preOrderAvailabilityDate; + return $this; + } + + /** @return Secure3dBuilder */ + public function withPreOrderIndicator($preOrderIndicator) + { + $this->preOrderIndicator = $preOrderIndicator; + return $this; + } + + /** @return Secure3dBuilder */ + public function withPreviousSuspiciousActivity(bool $previousSuspiciousActivity) + { + $this->previousSuspiciousActivity = $previousSuspiciousActivity; + return $this; + } + + /** @return Secure3dBuilder */ + public function withPriorAuthenticationData($priorAuthenticationData) + { + $this->priorAuthenticationData = $priorAuthenticationData; + return $this; + } + + /** @return Secure3dBuilder */ + public function withPriorAuthenticationMethod($priorAuthenticationMethod) + { + $this->priorAuthenticationMethod = $priorAuthenticationMethod; + return $this; + } + + /** @return Secure3dBuilder */ + public function withPriorAuthenticationTransactionId($priorAuthencitationTransactionId) + { + $this->priorAuthenticationTransactionId = $priorAuthencitationTransactionId; + return $this; + } + + /** @return Secure3dBuilder */ + public function withPriorAuthenticationTimestamp($priorAuthenticationTimestamp) + { + $this->priorAuthenticationTimestamp = $priorAuthenticationTimestamp; + return $this; + } + + /** @return Secure3dBuilder */ + public function withRecurringAuthorizationExpiryDate($recurringAuthorizationExpiryDate) + { + $this->recurringAuthorizationExpiryDate = $recurringAuthorizationExpiryDate; + return $this; + } + + /** @return Secure3dBuilder */ + public function withRecurringAuthorizationFrequency($recurringAuthorizationFrequency) + { + $this->recurringAuthorizationFrequency = $recurringAuthorizationFrequency; + return $this; + } + + /** @return Secure3dBuilder */ + public function withReferenceNumber($referenceNumber) + { + $this->referenceNumber = $referenceNumber; + return $this; + } + + /** @return Secure3dBuilder */ + public function withReorderIndicator($reorderIndicator) + { + $this->reorderIndicator = $reorderIndicator; + return $this; + } + + /** @return Secure3dBuilder */ + public function withSdkInterface($sdkInterface) + { + $this->sdkInterface = $sdkInterface; + return $this; + } + + /** @return Secure3dBuilder */ + public function withSdkTransactionId($sdkTransactionId) + { + $this->sdkTransactionId = $sdkTransactionId; + return $this; + } + + /** @return Secure3dBuilder */ + public function withSdkUiTypes($sdkUiTypes) + { + $this->sdkUiTypes = $sdkUiTypes; + return $this; + } + + /** @return Secure3dBuilder */ + public function withServerTransactionId($value) + { + if (empty($this->threeDSecure)) { + $this->threeDSecure = new ThreeDSecure(); + } + $this->threeDSecure->serverTransactionId = $value; + return $this; + } + + /** @return Secure3dBuilder */ + public function withShippingAddressCreateDate($shippingAddressCreateDate) + { + $this->shippingAddressCreateDate = $shippingAddressCreateDate; + return $this; + } + + /** @return Secure3dBuilder */ + public function withShippingAddressUsageIndicator($shippingAddressUsageIndicator) + { + $this->shippingAddressUsageIndicator = $shippingAddressUsageIndicator; + return $this; + } + + /** @return Secure3dBuilder */ + public function withShippingMethod($shippingMethod) + { + $this->shippingMethod = $shippingMethod; + return $this; + } + + /** @return Secure3dBuilder */ + public function withShippingNameMatchesCardHolderName($shippingNameMatchesCardHolderName) + { + $this->shippingNameMatchesCardHolderName = $shippingNameMatchesCardHolderName; + return $this; + } + + /** @return Secure3dBuilder */ + public function withThreeDSecure(ThreeDSecure $threeDSecure) + { + $this->threeDSecure = $threeDSecure; + return $this; + } + + /** @return Secure3dBuilder */ + public function withTransactionType($transactionType) + { + $this->transactionType = $transactionType; + return $this; + } + + /** @return Secure3dBuilder */ + public function withWorkNumber($countryCode, $number) + { + $this->workCountryCode = $countryCode; + $this->workNumber = $number; + return $this; + } + + /** + * @throws ApiException + * @return ThreeDSecure */ + public function execute($version = Secure3dVersion::ANY) + { + // TODO Get validations working + // parent::execute(); + + // setup return object + $rvalue = $this->threeDSecure; + if (empty($rvalue)) { + $rvalue = new ThreeDSecure(); + $rvalue->setVersion($version); + } + + // working version + if ($rvalue->getVersion() != null) { + $version = $rvalue->getVersion(); + } + + // get the provider + $provider = ServicesContainer::instance()->getSecure3d($version); + if (!empty($provider)) { + $canDowngrade = false; + if ($provider->getVersion() === Secure3dVersion::TWO && $version === Secure3dVersion::ANY) { + try { + $oneProvider = ServicesContainer::instance()->getSecure3d(Secure3dVersion::ONE); + $canDowngrade = (bool)(!empty($oneProvider)); + } catch (ConfigurationException $exc) { + // NOT CONFIGURED + } + } + + // process the request, capture any exceptions which might have been thrown + $response = null; + try { + $response = $provider->processSecure3d($this); + + if (empty($response) && (bool)$canDowngrade) { + return $this->execute(Secure3dVersion::ONE); + } + } catch (GatewayException $exc) { + // check for not enrolled + if ($exc->responseCode != null) { + if ($exc->responseCode == '110' && $provider->getVersion() === Secure3dVersion::ONE) { + return $rvalue; + } + } elseif ((bool)$canDowngrade && $this->transactionType === TransactionType::VERIFY_ENROLLED) { // check if we can downgrade + return $this->execute(Secure3dVersion::ONE); + } else { // throw exception + throw $exc; + } + } + + // check the response + if (!empty($response)) { + switch ($this->transactionType) { + case TransactionType::VERIFY_ENROLLED: + if (!empty($response->threeDSecure)) { + $rvalue = $response->threeDSecure; + if ((bool)$rvalue->enrolled) { + $rvalue->setAmount($this->amount); + $rvalue->setCurrency($this->currency); + $rvalue->setOrderId($response->orderId); + $rvalue->setVersion($provider->getVersion()); + } elseif ((bool)$canDowngrade) { + return $this->execute(Secure3dVersion::ONE); + } + } elseif ((bool)$canDowngrade) { + return $this->execute(Secure3dVersion::ONE); + } + break; + case TransactionType::INITIATE_AUTHENTICATION: + case TransactionType::VERIFY_SIGNATURE: { + $rvalue->merge($response->threeDSecure); + } break; + } + } + } + return $rvalue; + } + + /** @return void */ + public function setupValidations() + { + $this->validations->of(TransactionType::VERIFY_ENROLLED) + ->check('paymentMethod')->isNotNull(); + + $this->validations->of(TransactionType::VERIFY_ENROLLED) + ->when('paymentMethod')->isNotNull() + ->check('paymentMethod')->isInstanceOf(ISecure3d::class); + + $this->validations->of(TransactionType::VERIFY_SIGNATURE) + ->when('version')->isEqualTo(Secure3dVersion::ONE) + ->check('threeDSecure')->isNotNull() + ->when('version')->isEqualTo(Secure3dVersion::ONE) + ->check('payerAuthenticationResponse')->isNotNull(); + + $this->validations->of(TransactionType::VERIFY_SIGNATURE) + ->when('version')->isEqualTo(Secure3dVersion::TWO) + ->check('serverTransactionId')->isNotNull(); + + $this->validations->of(TransactionType::INITIATE_AUTHENTICATION) + ->check('threeDSecure')->isNotNull(); + + $this->validations->of(TransactionType::INITIATE_AUTHENTICATION) + ->when('paymentMethod')->isNotNull() + ->check('paymentMethod')->isInstanceOf(ISecure3d::class); + + $this->validations->of(TransactionType::INITIATE_AUTHENTICATION) + ->when('merchantInitiatedRequestType')->isNotNull() + ->check('merchantInitiatedRequestType')->isNotEqualTo(AuthenticationRequestType::PAYMENT_TRANSACTION); + + $this->validations->of(TransactionType::INITIATE_AUTHENTICATION) + ->when('accountAgeIndicator')->isNotNull() + ->check('accountAgeIndicator')->isNotEqualTo(AgeIndicator::NO_CHANGE); + + $this->validations->of(TransactionType::INITIATE_AUTHENTICATION) + ->when('passwordChangeIndicator')->isNotNull() + ->check('passwordChangeIndicator')->isNotEqualTo(AgeIndicator::NO_ACCOUNT); + + $this->validations->of(TransactionType::INITIATE_AUTHENTICATION) + ->when('shippingAddressUsageIndicator')->isNotNull() + ->check('shippingAddressUsageIndicator')->isNotEqualTo(AgeIndicator::NO_CHANGE) + ->when('shippingAddressUsageIndicator')->isNotNull() + ->check('shippingAddressUsageIndicator')->isNotEqualTo(AgeIndicator::NO_ACCOUNT); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Builders/TransactionBuilder.php b/lib/vendor/globalpayments/php-sdk/src/Builders/TransactionBuilder.php new file mode 100644 index 0000000..6b2a43a --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Builders/TransactionBuilder.php @@ -0,0 +1,99 @@ +transactionType = $type; + $this->paymentMethod = $paymentMethod; + } + + /** + * Set the request transaction type + * + * @internal + * @param TransactionType $transactionType Request transaction type + * + * @return AuthorizationBuilder + */ + public function withTransactionType($transactionType) + { + $this->transactionType = $transactionType; + return $this; + } + + /** + * Set the request transaction modifier + * + * @internal + * @param TransactionModifier $modifier Request transaction modifier + * + * @return AuthorizationBuilder + */ + public function withModifier($modifier) + { + $this->transactionModifier = $modifier; + return $this; + } + + /** + * Set the request to allow duplicates + * + * @param bool $allowDuplicates Request to allow duplicates + * + * @return AuthorizationBuilder + */ + public function withAllowDuplicates($allowDuplicates) + { + $this->allowDuplicates = $allowDuplicates; + return $this; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Builders/TransactionReportBuilder.php b/lib/vendor/globalpayments/php-sdk/src/Builders/TransactionReportBuilder.php new file mode 100644 index 0000000..6ccd5aa --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Builders/TransactionReportBuilder.php @@ -0,0 +1,148 @@ +searchBuilder = new SearchCriteriaBuilder($this); + } + + /** + * Sets the device ID as criteria for the report. + * + * @param string $value The device ID + * + * @return TransactionReportBuilder + */ + public function withDeviceId($value) + { + $this->searchBuilder->deviceId = $value; + return $this; + } + + /** + * Sets the end date as criteria for the report. + * + * @param DateTime $value The end date + * + * @return TransactionReportBuilder + */ + public function withEndDate($value) + { + $this->searchBuilder->endDate = $value; + return $this; + } + + /** + * Sets the start date as criteria for the report. + * + * @param DateTime $value The start date + * + * @return TransactionReportBuilder + */ + public function withStartDate($value) + { + $this->searchBuilder->startDate = $value; + return $this; + } + + /** + * Sets the timezone conversion method for the report. + * + * @param TimeZoneConversion $value The timezone conversion method + * + * @return TransactionReportBuilder + */ + public function withTimeZoneConversion($value) + { + $this->timeZoneConversion = $value; + return $this; + } + + /** + * Sets the transaction ID as criteria for the report. + * + * @param string $value The transaction ID + * + * @return TransactionReportBuilder + */ + public function withTransactionId($value) + { + $this->transactionId = $value; + return $this; + } + + /** + * @return SearchCriteriaBuilder + */ + public function where($criteria, $value) + { + return $this->searchBuilder->and($criteria, $value); + } + + protected function setupValidations() + { + $this->validations->of(ReportType::TRANSACTION_DETAIL) + ->check('transactionId')->isNotNull(); + + $this->validations->of(ReportType::ACTIVITY) + ->check('transactionId')->isNull(); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Entities/Address.php b/lib/vendor/globalpayments/php-sdk/src/Entities/Address.php new file mode 100644 index 0000000..2082da0 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Entities/Address.php @@ -0,0 +1,96 @@ +province) + ? $this->province + : $this->state; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Entities/AlternativePaymentResponse.php b/lib/vendor/globalpayments/php-sdk/src/Entities/AlternativePaymentResponse.php new file mode 100644 index 0000000..41193b8 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Entities/AlternativePaymentResponse.php @@ -0,0 +1,53 @@ +firstName, $this->lastName); + if (empty(str_replace(' ', '', $nameOnAccount))) { + $nameOnAccount = $this->company; + } + + $payment = new RecurringPaymentMethod($paymentMethod); + $payment->address = $this->address; + $payment->customerKey = $this->key; + $payment->id = $paymentId; + $payment->nameOnAccount = $nameOnAccount; + return $payment; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Entities/DccRateData.php b/lib/vendor/globalpayments/php-sdk/src/Entities/DccRateData.php new file mode 100644 index 0000000..d6b722e --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Entities/DccRateData.php @@ -0,0 +1,59 @@ +channel = EcommerceChannel::ECOM; + $this->shipDay = (new \DateTime()) + ->add(new \DateInterval('P1D')) + ->format('d'); + $this->shipMonth = (new \DateTime()) + ->add(new \DateInterval('P1D')) + ->format('m'); + $this->paymentDataType = '3DSecure'; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Entities/EncryptionData.php b/lib/vendor/globalpayments/php-sdk/src/Entities/EncryptionData.php new file mode 100644 index 0000000..ee1fb95 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Entities/EncryptionData.php @@ -0,0 +1,70 @@ +version = '01'; + return $data; + } + + /** + * Convenience method for creating version `02` encryption data. + * + * @param string $ktb + * @param string $trackNumber + * + * @return EncryptionData + */ + public static function version2($ktb, $trackNumber = null) + { + $data = new EncryptionData(); + $data->version = '02'; + $data->trackNumber = $trackNumber; + $data->ktb = $ktb; + return $data; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Entities/Enum.php b/lib/vendor/globalpayments/php-sdk/src/Entities/Enum.php new file mode 100644 index 0000000..3fccff6 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Entities/Enum.php @@ -0,0 +1,36 @@ +getConstants() as $allowedValue) { + if ($value === $allowedValue) { + return $allowedValue; + } + } + + throw new ArgumentException( + sprintf( + 'Invalid value `%s` on enum `%s`', + $value, + static::class + ) + ); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Entities/Enums/AccountType.php b/lib/vendor/globalpayments/php-sdk/src/Entities/Enums/AccountType.php new file mode 100644 index 0000000..e29b991 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Entities/Enums/AccountType.php @@ -0,0 +1,11 @@ + +/// Indicates a reason for the transaction. +/// +/// +/// This is typically used for returns/reversals. +/// +class ReasonCode extends Enum +{ + /// + /// Indicates fraud. + /// + const FRAUD = 'FRAUD'; + + /// + /// Indicates a false positive. + /// + const FALSE_POSITIVE = 'FALSEPOSITIVE'; + + /// + /// Indicates desired good is out of stock. + /// + const OUT_OF_STOCK = 'OUTOFSTOCK'; + + /// + /// Indicates desired good is in of stock. + /// + const IN_STOCK = 'INSTOCK'; + + /// + /// Indicates another reason. + /// + const OTHER = 'OTHER'; + + /// + /// Indicates reason was not given. + /// + const NOT_GIVEN = 'NOTGIVEN'; +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Entities/Enums/RecurringSequence.php b/lib/vendor/globalpayments/php-sdk/src/Entities/Enums/RecurringSequence.php new file mode 100644 index 0000000..83397af --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Entities/Enums/RecurringSequence.php @@ -0,0 +1,12 @@ +responseCode = $responseCode; + $this->responseMessage = $responseMessage; + + parent::__construct($message, $innerException); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Entities/Exceptions/NotImplementedException.php b/lib/vendor/globalpayments/php-sdk/src/Entities/Exceptions/NotImplementedException.php new file mode 100644 index 0000000..a0d673e --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Entities/Exceptions/NotImplementedException.php @@ -0,0 +1,16 @@ + + */ + public $supplementaryData; + + /** + * Instantiates a new `HostedPaymentData` object. + * + * @return + */ + public function __construct() + { + $this->supplementaryData = []; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Entities/IRecurringEntity.php b/lib/vendor/globalpayments/php-sdk/src/Entities/IRecurringEntity.php new file mode 100644 index 0000000..8f9cbd9 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Entities/IRecurringEntity.php @@ -0,0 +1,54 @@ + + */ + public static function findAll(); + + /** + * The current record should be updated. + * + * Any modified properties will be persisted with the gateway. + * + * @throws ApiException Thrown when the record cannot be updated. + * @return + */ + public function saveChanges(); +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Entities/MerchantDataCollection.php b/lib/vendor/globalpayments/php-sdk/src/Entities/MerchantDataCollection.php new file mode 100644 index 0000000..3f53e53 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Entities/MerchantDataCollection.php @@ -0,0 +1,190 @@ + + */ + private $collection; + + /** + * @return string + */ + public function get($key) + { + foreach ($this->collection as $kvp) { + if ($kvp->getKey() == $key && $kvp->isVisible()) { + return $kvp->getValue(); + } + } + return null; + } + + /** + * @return array + */ + public function getKeys() + { + $keys = []; + foreach ($this->collection as $kvp) { + if ($kvp->isVisible()) { + array_push($keys, $kvp->getKey()); + } + } + return $keys; + } + + /** + * @return int + */ + public function count() + { + $count = 0; + foreach ($this->collection as $kvp) { + if ($kvp->isVisible()) { + $count++; + } + } + return $count; + } + + /** + * @return int + */ + private function indexOf($key) + { + for ($i=0; $icollection); $i++) { + if ($this->collection[$i]->getKey() == $key) { + return $i; + } + } + return -1; + } + + /** + * @return array + */ + public function getHiddenValues() + { + $list = []; + foreach ($this->collection as $kvp) { + if (!$kvp->isVisible()) { + array_push($list, $kvp); + } + } + return $list; + } + + public function __construct() + { + $this->collection = []; + } + + /** + * @return void + */ + public function add($key, $value, $visible = true) + { + if ($this->hasKey($key)) { + if ($visible) { + throw new ApiException(sprintf('Key %s already exists in the collection.', $key)); + } else { + unset($this->collection[$this->indexOf($key)]); + $this->collection = array_values($this->collection); + } + } + + $kvp = new MerchantKVP(); + $kvp->setKey($key); + $kvp->setValue($value); + $kvp->setVisible($visible); + + array_push($this->collection, $kvp); + } + + /** + * @return string + */ + public function getValue($key, $converter = null) + { + foreach ($this->collection as $kvp) { + if ($kvp->getKey() == $key) { + if ($converter != null) { + return $converter($kvp->getValue()); + } else { + return $kvp->getValue(); + } + } + } + return null; + } + + /** + * @return bool + */ + public function hasKey($key) + { + return $this->getValue($key) != null; + } + + /** + * @return void + */ + public function mergeHidden($oldCollection) + { + foreach ($oldCollection->getHiddenValues() as $kvp) { + if (!$this->hasKey($kvp->getKey())) { + array_push($this->collection, $kvp); + } + } + } + + /** + * @return MerchantDataCollection + */ + public static function parse($kvpString, $decoder = null) + { + $collection = new MerchantDataCollection(); + + $decryptedKvp = (string)base64_decode($kvpString); + if ($decoder != null) { + $decryptedKvp = $decoder($decryptedKvp); + } + + $merchantData = explode('|', $decryptedKvp); + foreach ($merchantData as $kvp) { + $data = explode(':', $kvp); + $collection->add($data[0], $data[1], (bool)$data[2]); + } + + return $collection; + } + + /** + * @return string + */ + public function toString($encoder = null) + { + $sb = ''; + + foreach ($this->collection as $kvp) { + $sb .= sprintf('%s:%s:%s|', $kvp->getKey(), $kvp->getValue(), $kvp->isVisible()); + } + + $pos = strrpos($sb, '|'); + $sb = substr($sb, 0, $pos) . substr($sb, $pos+1); + + try { + $formatted = (string)$sb; + if ($encoder != null) { + $formatted = $encoder($formatted); + } + + return (string)base64_encode($formatted); + } catch (UnsupportedEncodingException $e) { + return null; + } + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Entities/MerchantKVP.php b/lib/vendor/globalpayments/php-sdk/src/Entities/MerchantKVP.php new file mode 100644 index 0000000..cf43e59 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Entities/MerchantKVP.php @@ -0,0 +1,69 @@ +key; + } + + /** + * @return void + */ + public function setKey($key) + { + $this->key = $key; + } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * @return void + */ + public function setValue($value) + { + $this->value = $value; + } + + /** + * @return bool + */ + public function isVisible() + { + return $this->visible; + } + + /** + * @return void + */ + public function setVisible($visible) + { + $this->visible = $visible; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Entities/RecurringEntity.php b/lib/vendor/globalpayments/php-sdk/src/Entities/RecurringEntity.php new file mode 100644 index 0000000..d11dd02 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Entities/RecurringEntity.php @@ -0,0 +1,110 @@ + + */ +abstract class RecurringEntity implements IRecurringEntity +{ + /** + * All resource should be supplied a merchant-/application-defined ID. + * + * @var string + */ + public $id; + + /** + * All resources should be supplied a gateway-defined ID. + * + * @var string + */ + public $key; + + /** + * {@inheritDoc} + */ + public function create() + { + return RecurringService::create($this); + } + + /** + * {@inheritDoc} + */ + public function delete($force = false) + { + try { + return RecurringService::delete($this, $force); + } catch (ApiException $exc) { + throw new ApiException('Failed to delete record, see inner exception for more details', $exc); + } + } + + /** + * {@inheritDoc} + */ + public static function find($id) + { + $client = ServicesContainer::instance()->getRecurringClient(); + if (!$client->supportsRetrieval) { + throw new UnsupportedTransactionException(); + } + + $identifier = static::getIdentifierName(); + $response = RecurringService::search(static::class) + ->addSearchCriteria($identifier, $id) + ->execute(); + $entity = isset($response[0]) ? $response[0] : null; + + if ($entity !== null) { + return RecurringService::get($entity); + } + + return null; + } + + /** + * {@inheritDoc} + */ + public static function findAll() + { + $client = ServicesContainer::instance()->getRecurringClient(); + if (!$client->supportsRetrieval) { + throw new UnsupportedTransactionException(); + } + + return RecurringService::search(static::class)->execute(); + } + + /** + * {@inheritDoc} + */ + public function saveChanges() + { + try { + return RecurringService::edit($this); + } catch (ApiException $exc) { + throw new ApiException('Update failed, see inner exception for more details', $exc); + } + } + + protected static function getIdentifierName() + { + if (static::class === Customer::class) { + return 'customerIdentifier'; + } elseif (static::class === RecurringPaymentMethod::class) { + return 'paymentMethodIdentifier'; + } elseif (static::class === Schedule::class) { + return 'scheduleIdentifier'; + } + return ''; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Entities/Reporting/AltPaymentData.php b/lib/vendor/globalpayments/php-sdk/src/Entities/Reporting/AltPaymentData.php new file mode 100644 index 0000000..1c7587e --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Entities/Reporting/AltPaymentData.php @@ -0,0 +1,38 @@ + + */ + public $cardTypes; + + /** + * @var string + */ + public $checkFirstName; + + /** + * @var string + */ + public $checkLastName; + + /** + * @var string + */ + public $checkName; + + /** + * @var string + */ + public $checkNumber; + + /** + * @var string + */ + public $clerkId; + + /** + * @var string + */ + public $clientTransactionId; + + /** + * @var string + */ + public $customerId; + + /** + * @var string + */ + public $displayName; + + /** + * @var DateTime + */ + public $endDate; + + /** + * @var string + */ + public $giftCurrency; + + /** + * @var string + */ + public $giftMaskedAlias; + + /** + * @var bool + */ + public $fullyCaptured; + + /** + * @var string + */ + public $invoiceNumber; + + /** + * @var string + */ + public $issuerResult; + + /** + * @var string + */ + public $issuerTransactionId; + + /** + * @var bool + */ + public $oneTime; + + /** + * @var string + */ + public $paymentMethodKey; + + /** + * @var IEnumerable + */ + public $paymentTypes; + + /** + * @var string + */ + public $referenceNumber; + + /** + * @var IEnumerable + */ + public $transactionType; + + /** + * @var decimal + */ + public $settlementAmount; + + /** + * @var string + */ + public $scheduleId; + + /** + * @var string + */ + public $siteTrace; + + /** + * @var DateTime + */ + public $startDate; + + /** + * @var string + */ + public $uniqueDeviceId; + + /** + * @var string + */ + public $username; + + public function __construct(TransactionReportBuilder $reportBuilder = null) + { + $this->reportBuilder = $reportBuilder; + } + + public function and($criteria, $value) + { + if (property_exists($this, $criteria)) { + $this->{$criteria} = $value; + } + return $this; + } + + public function execute($configName = "default") + { + if (($this->reportBuilder) === null) { + throw new ArgumentException( + sprintf( + 'ReportBuilder is null', + $this->reportBuilder, + static::class + ) + ); + } + return $this->reportBuilder->execute($configName); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Entities/Reporting/TransactionSummary.php b/lib/vendor/globalpayments/php-sdk/src/Entities/Reporting/TransactionSummary.php new file mode 100644 index 0000000..4b85dc9 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Entities/Reporting/TransactionSummary.php @@ -0,0 +1,386 @@ +customerKey = $customerKey; + $this->paymentKey = $paymentKey; + } + + /** + * The total amount for the schedule (`Schedule::$amount` + `Schedule::$taxAmount`). + * + * @return float|string|null + */ + public function getTotalAmount() + { + return $this->amount + $this->taxAmount; + } + + /** + * Sets the schedule's amount. + * + * @param float|string $value The amount + * + * @return Schedule + */ + public function withAmount($value) + { + $this->amount = $value; + return $this; + } + + /** + * Sets the schedule's currency. + * + * @param string $value The currency + * + * @return Schedule + */ + public function withCurrency($value) + { + $this->currency = $value; + return $this; + } + + /** + * Sets the schedule's customer. + * + * @param string $value The customer's key + * + * @return Schedule + */ + public function withCustomerKey($value) + { + $this->customerKey = $value; + return $this; + } + + /** + * Sets the schedule's description. + * + * @param string $value The description + * + * @return Schedule + */ + public function withDescription($value) + { + $this->description = $value; + return $this; + } + + /** + * Sets the schedule's device ID. + * + * @param integer $value The device ID + * + * @return Schedule + */ + public function withDeviceId($value) + { + $this->deviceId = $value; + return $this; + } + + /** + * Sets whether the schedule should send email notifications. + * + * @param boolean $value The email notification flag + * + * @return Schedule + */ + public function withEmailNotification($value) + { + $this->emailNotification = $value; + return $this; + } + + /** + * Sets when the schedule should email receipts. + * + * @param EmailReceipt $value When the schedule should email receipts + * + * @return Schedule + */ + public function withEmailReceipt($value) + { + $this->emailReceipt = $value; + return $this; + } + + /** + * Sets the schedule's end date. + * + * @param DateTime $value The end date + * + * @return Schedule + */ + public function withEndDate($value) + { + $this->endDate = $value; + return $this; + } + + /** + * Sets the schedule's frequency. + * + * @param string $value The frequency + * + * @return Schedule + */ + public function withFrequency($value) + { + $this->frequency = $value; + return $this; + } + + /** + * Sets the schedule's invoice number. + * + * @param string $value The invoice number + * + * @return Schedule + */ + public function withInvoiceNumber($value) + { + $this->invoiceNumber = $value; + return $this; + } + + /** + * Sets the schedule's name. + * + * @param string $value The name + * + * @return Schedule + */ + public function withName($value) + { + $this->name = $value; + return $this; + } + + /** + * Sets the schedule's number of payments. + * + * @param integer $value The number of payments + * + * @return Schedule + */ + public function withNumberOfPayments($value) + { + $this->numberOfPayments = $value; + return $this; + } + + /** + * Sets the schedule's purchase order (PO) number. + * + * @param string $value The purchase order (PO) number + * + * @return Schedule + */ + public function withPoNumber($value) + { + $this->poNumber = $value; + return $this; + } + + /** + * Sets the schedule's payment method. + * + * @param string $value The payment method's key + * + * @return Schedule + */ + public function withPaymentKey($value) + { + $this->paymentKey = $value; + return $this; + } + + /** + * Sets the schedule's recurring schedule. + * + * @param PaymentSchedule $value The recurring schedule + * + * @return Schedule + */ + public function withPaymentSchedule($value) + { + $this->paymentSchedule = $value; + return $this; + } + + /** + * Sets the schedule's reprocessing count. + * + * @param integer $value The reprocessing count + * + * @return Schedule + */ + public function withReprocessingCount($value) + { + $this->reprocessingCount = $value; + return $this; + } + + /** + * Sets the schedule's start date. + * + * @param DateTime $value The start date + * + * @return Schedule + */ + public function withStartDate($value) + { + $this->startDate = $value; + return $this; + } + + /** + * Sets the schedule's status. + * + * @param string $value The new status + * + * @return Schedule + */ + public function withStatus($value) + { + $this->status = $value; + return $this; + } + + /** + * Sets the schedule's tax amount. + * + * @param float|string $value The tax amount + * + * @return Schedule + */ + public function withTaxAmount($value) + { + $this->taxAmount = $value; + return $this; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Entities/StoredCredential.php b/lib/vendor/globalpayments/php-sdk/src/Entities/StoredCredential.php new file mode 100644 index 0000000..20133f0 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Entities/StoredCredential.php @@ -0,0 +1,19 @@ +amount; + } + + /** + * @return void + */ + public function setAmount($value) + { + $this->amount = $value; + $this->getMerchantData()->add('amount', $this->amount, false); + } + + /** + * Consumer authentication (3DSecure) verification value + * + * @var string + */ + public $cavv; + + /** + * @var bool + */ + public $challengeMandated; + + /** + * @var string + */ + public $criticalityIndicator; + + /** + * @var string + */ + private $currency; + + /** + * @return string + */ + public function getCurrency() + { + return $this->currency; + } + + /** + * @return string + */ + public function setCurrency($value) + { + $this->currency = $value; + $this->merchantData->add('currency', $this->currency, false); + } + + /** + * @var string + */ + public $directoryServerTransactionId; + + /** + * @var string + */ + public $directoryServerEndVersion; + + /** + * @var string + */ + public $directoryServerStartVersion; + + /** + * Consumer authentication (3DSecure) electronic commerce indicator + * + * @var int + */ + public $eci; + + /** + * The enrollment status + * + * @var string + */ + public $enrolled; + + /** + * The URL of the Issuing Bank's ACS + * + * @var string + */ + public $issuerAcsUrl; + + /** + * A KVP collection of merchant supplied data + * + * @var MerchantDataCollection + */ + private $merchantData; + + /** + * @return MerchantDataCollection + */ + public function getMerchantData() + { + if (empty($this->merchantData)) { + $this->merchantData = new MerchantDataCollection(); + } + return $this->merchantData; + } + + /** + * @return void + */ + public function setMerchantData($merchantData) + { + if (!empty($this->merchantData)) { + $merchantData->mergeHidden($this->merchantData); + } + + $this->merchantData = $merchantData; + if ($this->merchantData->hasKey('amount')) { + $this->amount = $this->merchantData->getValue('amount'); + } + if ($this->merchantData->hasKey('currency')) { + $this->currency = $this->merchantData->getValue('currency'); + } + if ($this->merchantData->hasKey('orderId')) { + $this->orderId = $this->merchantData->getValue('orderId'); + } + if ($this->merchantData->hasKey('version')) { + $this->version = $this->merchantData->getValue('version'); + } + } + + /** + * @var string + */ + public $messageCategory; + + /** + * @var string + */ + public $messageExtensionId; + + /** + * @var string + */ + public $messageExtensionName; + + /** + * @var string + */ + public $messageVersion; + + /** + * The order ID used for the initial transaction + * + * @var string + */ + private $orderId; + + /** + * @return string + */ + public function getOrderId() + { + return $this->orderId; + } + + /** + * @return void + */ + public function setOrderId($value) + { + $this->orderId = $value; + $this->merchantData->add('orderId', $this->orderId, false); + } + + /** + * The Payer Authentication Request returned by the Enrollment Server. + * Must be sent to the Issuing Bank's ACS (Access Control Server) URL. + * + * @var string + */ + public $payerAuthenticationRequest; + + /** + * Consumer authentication (3DSecure) source + * + * @var string + */ + public $paymentDataSource; + + /** + * Consumer authentication (3DSecure) type. + * Default value is "3DSecure" + * + * @var string + */ + public $paymentDataType; + + /** + * @var string + */ + public $sdkInterface; + + /** + * @var enum + */ + public $sdkUiType; + + /** + * @var string + */ + public $serverTransactionId; + + /** + * @var string + */ + public $status; + + /** + * @var string + */ + public $statusReason; + + /** @var Secure3dVersion */ + private $version; + + /** @return Secure3dVersion */ + public function getVersion() + { + return $this->version; + } + + /** @return void */ + public function setVersion($version) + { + $this->version = $version; + $this->merchantData->add('version', $version, false); + } + + /** + * Consumer authentication (3DSecure) transaction ID + * + * @var string + */ + public $xid; + + public function __construct() + { + $this->paymentDataType = '3DSecure'; + if (empty($this->merchantData)) { + $this->merchantData = new MerchantDataCollection(); + } + } + + /** + * @return void + */ + public function merge(ThreeDSecure $secureEcom) + { + if (!empty($secureEcom)) { + $this->acsTransactionId = $this->mergeValue($this->acsTransactionId, $secureEcom->acsTransactionId); + $this->acsEndVersion = $this->mergeValue($this->acsEndVersion, $secureEcom->acsEndVersion); + $this->acsStartVersion = $this->mergeValue($this->acsStartVersion, $secureEcom->acsStartVersion); + $this->algorithm = $this->mergeValue($this->algorithm, $secureEcom->algorithm); + $this->amount = $this->mergeValue($this->amount, $secureEcom->amount); + $this->authenticationSource = $this->mergeValue($this->authenticationSource, $secureEcom->authenticationSource); + $this->authenticationType = $this->mergeValue($this->authenticationType, $secureEcom->authenticationType); + $this->authenticationValue = $this->mergeValue($this->authenticationValue, $secureEcom->authenticationValue); + $this->cardHolderResponseInfo = $this->mergeValue($this->cardHolderResponseInfo, $secureEcom->cardHolderResponseInfo); + $this->cavv = $this->mergeValue($this->cavv, $secureEcom->cavv); + $this->challengeMandated = $this->mergeValue($this->challengeMandated, $secureEcom->challengeMandated); + $this->criticalityIndicator = $this->mergeValue($this->criticalityIndicator, $secureEcom->criticalityIndicator); + $this->currency = $this->mergeValue($this->currency, $secureEcom->currency); + $this->directoryServerTransactionId = $this->mergeValue($this->directoryServerTransactionId, $secureEcom->directoryServerTransactionId); + $this->directoryServerEndVersion = $this->mergeValue($this->directoryServerEndVersion, $secureEcom->directoryServerEndVersion); + $this->directoryServerStartVersion = $this->mergeValue($this->directoryServerStartVersion, $secureEcom->directoryServerStartVersion); + $this->eci = $this->mergeValue($this->eci, $secureEcom->eci); + $this->enrolled = $this->mergeValue($this->enrolled, $secureEcom->enrolled); + $this->issuerAcsUrl = $this->mergeValue($this->issuerAcsUrl, $secureEcom->issuerAcsUrl); + $this->messageCategory = $this->mergeValue($this->messageCategory, $secureEcom->messageCategory); + $this->messageExtensionId = $this->mergeValue($this->messageExtensionId, $secureEcom->messageExtensionId); + $this->messageExtensionName = $this->mergeValue($this->messageExtensionName, $secureEcom->messageExtensionName); + $this->messageVersion = $this->mergeValue($this->messageVersion, $secureEcom->messageVersion); + $this->orderId = $this->mergeValue($this->orderId, $secureEcom->orderId); + $this->payerAuthenticationRequest = $this->mergeValue($this->payerAuthenticationRequest, $secureEcom->payerAuthenticationRequest); + $this->paymentDataSource = $this->mergeValue($this->paymentDataSource, $secureEcom->paymentDataSource); + $this->paymentDataType = $this->mergeValue($this->paymentDataType, $secureEcom->paymentDataType); + $this->sdkInterface = $this->mergeValue($this->sdkInterface, $secureEcom->sdkInterface); + $this->sdkUiType = $this->mergeValue($this->sdkUiType, $secureEcom->sdkUiType); + $this->serverTransactionId = $this->mergeValue($this->serverTransactionId, $secureEcom->serverTransactionId); + $this->status = $this->mergeValue($this->status, $secureEcom->status); + $this->statusReason = $this->mergeValue($this->statusReason, $secureEcom->statusReason); + $this->version = $this->mergeValue($this->version, $secureEcom->version); + $this->xid = $this->mergeValue($this->xid, $secureEcom->xid); + } + } + + /** + * @return mixed + */ + public function mergeValue($currentValue, $mergeValue) + { + if ($mergeValue == null) { + return $currentValue; + } + return $mergeValue; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Entities/Transaction.php b/lib/vendor/globalpayments/php-sdk/src/Entities/Transaction.php new file mode 100644 index 0000000..ffae75b --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Entities/Transaction.php @@ -0,0 +1,461 @@ +transactionReference = new TransactionReference(); + $txn->transactionReference->transactionId = $transactionId; + $txn->transactionReference->paymentMethodType = $paymentMethodType; + $txn->transactionReference->orderId = $orderId; + return $txn; + } + + /** + * Creates an additional authorization against the original transaction. + * + * @param string|float $amount The additional amount to authorize + * + * @return AuthorizationBuilder + */ + public function additionalAuth($amount = null) + { + return (new AuthorizationBuilder(TransactionType::AUTH)) + ->withPaymentMethod($this->transactionReference) + ->withAmount($amount); + } + + /** + * Captures the original transaction. + * + * @param string|float $amount The amount to capture + * + * @return ManagementBuilder + */ + public function capture($amount = null) + { + return (new ManagementBuilder(TransactionType::CAPTURE)) + ->withPaymentMethod($this->transactionReference) + ->withAmount($amount); + } + + /** + * Edits the original transaction. + * + * @return ManagementBuilder + */ + public function edit() + { + $builder = (new ManagementBuilder(TransactionType::EDIT)) + ->withPaymentMethod($this->transactionReference); + + if ($this->commercialIndicator !== null) { + $builder = $builder->withModifier(TransactionModifier::LEVEL_II); + } + + return $builder; + } + + /** + * Places the original transaction on hold. + * + * @return ManagementBuilder + */ + public function hold() + { + return (new ManagementBuilder(TransactionType::HOLD)) + ->withPaymentMethod($this->transactionReference); + } + + /** + * Refunds/returns the original transaction. + * + * @param string|float $amount The amount to refund/return + * + * @return ManagementBuilder + */ + public function refund($amount = null) + { + return (new ManagementBuilder(TransactionType::REFUND)) + ->withPaymentMethod($this->transactionReference) + ->withAmount($amount); + } + + /** + * Releases the original transaction from a hold. + * + * @return ManagementBuilder + */ + public function release() + { + return (new ManagementBuilder(TransactionType::RELEASE)) + ->withPaymentMethod($this->transactionReference); + } + + /** + * Reverses the original transaction. + * + * @param string|float $amount The original authorization amount + * + * @return ManagementBuilder + */ + public function reverse($amount = null) + { + return (new ManagementBuilder(TransactionType::REVERSAL)) + ->withPaymentMethod($this->transactionReference) + ->withAmount($amount); + } + + /** + * Voids the original transaction. + * + * @return ManagementBuilder + */ + public function void() + { + return (new ManagementBuilder(TransactionType::VOID)) + ->withPaymentMethod($this->transactionReference); + } + + public function __get($name) + { + switch ($name) { + case 'authorizationCode': + if ($this->transactionReference !== null) { + return $this->transactionReference->authCode; + } + return null; + case 'clientTransactionId': + if ($this->transactionReference !== null) { + return $this->transactionReference->clientTransactionId; + } + return null; + case 'orderId': + if ($this->transactionReference !== null) { + return $this->transactionReference->orderId; + } + return null; + case 'paymentMethodType': + if ($this->transactionReference !== null) { + return $this->transactionReference->paymentMethodType; + } + return PaymentMethodType::CREDIT; + case 'transactionId': + if ($this->transactionReference !== null) { + return $this->transactionReference->transactionId; + } + return null; + default: + break; + } + + if (property_exists($this, $name)) { + return $this->{$name}; + } + + throw new ArgumentException(sprintf('Property `%s` does not exist on Transaction', $name)); + } + + public function __isset($name) + { + return in_array($name, [ + 'transactionId', + 'orderId', + 'authorizationId', + 'paymentMethodType', + 'clientTransactionId', + ]) || isset($this->{$name}); + } + + public function __set($name, $value) + { + switch ($name) { + case 'authorizationCode': + if (!$this->transactionReference instanceof TransactionReference) { + $this->transactionReference = new TransactionReference(); + } + $this->transactionReference->authCode = $value; + return; + case 'clientTransactionId': + if (!$this->transactionReference instanceof TransactionReference) { + $this->transactionReference = new TransactionReference(); + } + $this->transactionReference->clientTransactionId = $value; + return; + case 'orderId': + if (!$this->transactionReference instanceof TransactionReference) { + $this->transactionReference = new TransactionReference(); + } + $this->transactionReference->orderId = $value; + return; + case 'paymentMethodType': + if (!$this->transactionReference instanceof TransactionReference) { + $this->transactionReference = new TransactionReference(); + } + $this->transactionReference->paymentMethodType = $value; + return; + case 'transactionId': + if (!$this->transactionReference instanceof TransactionReference) { + $this->transactionReference = new TransactionReference(); + } + $this->transactionReference->transactionId = $value; + return; + default: + break; + } + + if (property_exists($this, $name)) { + return $this->{$name} = $value; + } + + throw new ArgumentException(sprintf('Property `%s` does not exist on Transaction', $name)); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Entities/TransactionSummary.php b/lib/vendor/globalpayments/php-sdk/src/Entities/TransactionSummary.php new file mode 100644 index 0000000..fca931c --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Entities/TransactionSummary.php @@ -0,0 +1,142 @@ + + */ + public $headers; + + /** + * @var integer|string + */ + public $timeout; + + /** + * @var string + */ + public $serviceUrl; + + /** + * @var array + */ + public $curlOptions; + + /** + * @param string $contentType + * + * @return + */ + public function __construct($contentType) + { + $this->headers = []; + $this->contentType = $contentType; + } + + /** + * @return array + */ + protected function getHttpOptions() + { + return []; + } + + /** + * Uses cURL to communicate with the gateway service + * + * @param string $verb + * @param string $endpoint + * @param string|null $data + * @param array|null $queryStringParams + * + * @throws \Exception + * @return GatewayResponse + */ + protected function sendRequest( + $verb, + $endpoint, + $data = null, + array $queryStringParams = null, + $headers = [] + ) { + try { + $queryString = $this->buildQueryString($queryStringParams); + $request = curl_init($this->serviceUrl . $endpoint . $queryString); + + $this->headers = array_merge($this->headers, $headers, [ + 'Content-Type' => sprintf('%s', $this->contentType), + 'Content-Length' => $data === null ? 0 : strlen($data), + ]); + + $headers = []; + foreach ($this->headers as $key => $value) { + $headers[] = $key . ': '. $value; + } + + curl_setopt($request, CURLOPT_CONNECTTIMEOUT, $this->timeout); + curl_setopt($request, CURLOPT_TIMEOUT, $this->timeout); + curl_setopt($request, CURLOPT_RETURNTRANSFER, true); + curl_setopt($request, CURLOPT_SSL_VERIFYPEER, false); //true,); + curl_setopt($request, CURLOPT_SSL_VERIFYHOST, false); //2,); + curl_setopt($request, CURLOPT_CUSTOMREQUEST, strtoupper($verb)); + curl_setopt($request, CURLOPT_POSTFIELDS, $data); + curl_setopt($request, CURLOPT_HTTPHEADER, $headers); + curl_setopt($request, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS); + curl_setopt($request, CURLOPT_VERBOSE, false); + curl_setopt($request, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2); + + if ($this->curlOptions != null && !empty($this->curlOptions)) { + curl_setopt_array($request, $this->curlOptions); + } + + $curlResponse = curl_exec($request); + $curlInfo = curl_getinfo($request); + $curlError = curl_errno($request); + + $response = new GatewayResponse(); + $response->statusCode = $curlInfo['http_code']; + $response->rawResponse = $curlResponse; + return $response; + } catch (\Exception $e) { + throw new \Exception( + "Error occurred while communicating with gateway.", + $e->getCode(), + $e + ); + } + } + + /** + * @param array|null $queryStringParams + * + * @return string + */ + private function buildQueryString(array $queryStringParams = null) + { + if ($queryStringParams === null) { + return ''; + } + + $query = []; + + foreach ($queryStringParams as $key => $value) { + $query[] = sprintf('%s=%s', $key, $value); + } + + return sprintf('?%s', implode('&', $query)); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Gateways/GatewayResponse.php b/lib/vendor/globalpayments/php-sdk/src/Gateways/GatewayResponse.php new file mode 100644 index 0000000..f573a66 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Gateways/GatewayResponse.php @@ -0,0 +1,16 @@ +version; + } + + /** @return void */ + public function setAccountId($accountId) + { + $this->accountId = $accountId; + } + /** @return void */ + public function setMerchantId($merchantId) + { + $this->merchantId = $merchantId; + } + /** @return void */ + public function setSharedSecret($sharedSecret) + { + $this->sharedSecret = $sharedSecret; + } + /** @return void */ + public function setChallengeNotificationUrl($challengeNotificationUrl) + { + $this->challengeNotificationUrl = $challengeNotificationUrl; + } + /** @return void */ + public function setMerchantContactUrl($merchantContactUrl) + { + $this->merchantContactUrl = $merchantContactUrl; + } + /** @return void */ + public function setMethodNotificationUrl($methodNotificationUrl) + { + $this->methodNotificationUrl = $methodNotificationUrl; + } + + protected function maybeSetKey(array $arr, $key, $value = null) + { + if (!is_null($value)) { + $arr[$key] = $value; + } + return $arr; + } + + /** + * @throws ApiException + * @return Transaction */ + public function processSecure3d(Secure3dBuilder $builder) + { + $transType = $builder->getTransactionType(); + $timestamp = date("Y-m-d\TH:i:s.u"); + $paymentMethod = $builder->getPaymentMethod(); + $secure3d = $paymentMethod; + + $request = []; + if ($transType === TransactionType::VERIFY_ENROLLED) { + $request = $this->maybeSetKey($request, 'request_timestamp', $timestamp); + $request = $this->maybeSetKey($request, 'merchant_id', $this->merchantId); + $request = $this->maybeSetKey($request, 'account_id', $this->accountId); + $request = $this->maybeSetKey($request, 'method_notification_url', $this->methodNotificationUrl); + + $hashValue = ''; + if ($paymentMethod instanceof CreditCardData) { + $cardData = $paymentMethod; + $request = $this->maybeSetKey($request, 'number', $cardData->number); + $request = $this->maybeSetKey($request, 'scheme', $this->mapCardScheme(strtoupper($cardData->getCardType()))); + $hashValue = $cardData->number; + } elseif ($paymentMethod instanceof RecurringPaymentMethod) { + $storedCard = $paymentMethod; + $request = $this->maybeSetKey($request, 'payer_reference', $storedCard->customerKey); + $request = $this->maybeSetKey($request, 'payment_method_reference', $storedCard->key); + $hashValue = $storedCard->customerKey; + } + + $hash = GenerationUtils::generateHash($this->sharedSecret, implode('.', [$timestamp, $this->merchantId, $hashValue])); + $headers['Authorization'] = sprintf('securehash %s', $hash); + + $rawResponse = $this->doTransaction('POST', 'protocol-versions', json_encode($request), null, $headers); + return $this->mapResponse($rawResponse); + } elseif ($transType === TransactionType::VERIFY_SIGNATURE) { + $hash = GenerationUtils::generateHash($this->sharedSecret, implode('.', [$timestamp, $this->merchantId, $builder->getServerTransactionId()])); + $headers['Authorization'] = sprintf('securehash %s', $hash); + + $queryValues = []; + $queryValues['merchant_id'] = $this->merchantId; + $queryValues['request_timestamp'] = $timestamp; + $rawResponse = $this->doTransaction('GET', sprintf('authentications/%s', $builder->getServerTransactionId()), null, $queryValues, $headers); + return $this->mapResponse($rawResponse); + } elseif ($transType === TransactionType::INITIATE_AUTHENTICATION) { + $orderId = $builder->getOrderId(); + if (empty($orderId)) { + $orderId = GenerationUtils::generateOrderId(); + } + + $secureEcom = $secure3d->threeDSecure; + + $request = $this->maybeSetKey($request, 'request_timestamp', $timestamp); + $request = $this->maybeSetKey($request, 'authentication_source', $builder->getAuthenticationSource()); + $request = $this->maybeSetKey($request, 'authentication_request_type', $builder->getAuthenticationRequestType()); + $request = $this->maybeSetKey($request, 'message_category', $builder->getMessageCategory()); + $request = $this->maybeSetKey($request, 'message_version', '2.1.0'); + $request = $this->maybeSetKey($request, 'server_trans_id', $secureEcom->serverTransactionId); + $request = $this->maybeSetKey($request, 'merchant_id', $this->merchantId); + $request = $this->maybeSetKey($request, 'account_id', $this->accountId); + $request = $this->maybeSetKey($request, 'challenge_notification_url', $this->challengeNotificationUrl); + $request = $this->maybeSetKey($request, 'method_url_completion', $builder->getMethodUrlCompletion()); + $request = $this->maybeSetKey($request, 'merchant_contact_url', $this->merchantContactUrl); + $request = $this->maybeSetKey($request, 'merchant_initiated_request_type', $builder->getMerchantInitiatedRequestType()); + + // card details + $hashValue = ''; + $request['card_detail'] = []; + if ($paymentMethod instanceof CreditCardData) { + $cardData = $paymentMethod; + $hashValue = $cardData->number; + + $request['card_detail'] = $this->maybeSetKey($request['card_detail'], 'number', $cardData->number); + $request['card_detail'] = $this->maybeSetKey($request['card_detail'], 'scheme', strtoupper($cardData->getCardType())); + $request['card_detail'] = $this->maybeSetKey($request['card_detail'], 'expiry_month', $cardData->expMonth); + $request['card_detail'] = $this->maybeSetKey($request['card_detail'], 'expiry_year', substr($cardData->expYear, 2)); + $request['card_detail'] = $this->maybeSetKey($request['card_detail'], 'full_name', $cardData->cardHolderName); + + if (!empty($cardData->cardHolderName)) { + $names = explode(' ', $cardData->cardHolderName); + if (count($names) >= 1) { + $request['card_detail'] = $this->maybeSetKey($request['card_detail'], 'first_name', $names[0]); + } + if (count($names) >= 2) { + $request['card_detail'] = $this->maybeSetKey($request['card_detail'], 'last_name', $names[1]); + } + } + } elseif ($paymentMethod instanceof RecurringPaymentMethod) { + $storedCard = $paymentMethod; + $hashValue = $storedCard->customerKey; + + $request['card_detail'] = $this->maybeSetKey($request['card_detail'], 'payer_reference', $storedCard->customerKey); + $request['card_detail'] = $this->maybeSetKey($request['card_detail'], 'payment_method_reference', $storedCard->key); + } + + // order details + $request['order'] = []; + $request['order'] = $this->maybeSetKey($request['order'], 'amount', preg_replace('/[^0-9]/', '', sprintf('%01.2f', $builder->getAmount()))); + $request['order'] = $this->maybeSetKey($request['order'], 'currency', $builder->getCurrency()); + $request['order'] = $this->maybeSetKey($request['order'], 'id', $orderId); + $request['order'] = $this->maybeSetKey($request['order'], 'address_match_indicator', ($builder->isAddressMatchIndicator() ? true : false)); + $request['order'] = $this->maybeSetKey($request['order'], 'date_time_created', (new \DateTime($builder->getOrderCreateDate()))->format(\DateTime::RFC3339_EXTENDED)); + $request['order'] = $this->maybeSetKey($request['order'], 'gift_card_count', $builder->getGiftCardCount()); + $request['order'] = $this->maybeSetKey($request['order'], 'gift_card_currency', $builder->getGiftCardCurrency()); + $request['order'] = $this->maybeSetKey($request['order'], 'gift_card_amount', preg_replace('/[^0-9]/', '', sprintf('%01.2f', $builder->getGiftCardAmount()))); + $request['order'] = $this->maybeSetKey($request['order'], 'delivery_email', $builder->getDeliveryEmail()); + $request['order'] = $this->maybeSetKey($request['order'], 'delivery_timeframe', $builder->getDeliveryTimeframe()); + $request['order'] = $this->maybeSetKey($request['order'], 'shipping_method', $builder->getShippingMethod()); + $request['order'] = $this->maybeSetKey($request['order'], 'shipping_name_matches_cardholder_name', $builder->getShippingNameMatchesCardHolderName()); + $request['order'] = $this->maybeSetKey($request['order'], 'preorder_indicator', $builder->getPreOrderIndicator()); + $request['order'] = $this->maybeSetKey($request['order'], 'reorder_indicator', $builder->getReorderIndicator()); + $request['order'] = $this->maybeSetKey($request['order'], 'transaction_type', $builder->getOrderTransactionType()); + $request['order'] = $this->maybeSetKey($request['order'], 'preorder_availability_date', null !== $builder->getPreOrderAvailabilityDate() ? date('Y-m-d', $builder->getPreOrderAvailabilityDate()) : null); + + // shipping address + $shippingAddress = $builder->getShippingAddress(); + if (!empty($shippingAddress)) { + $request['order']['shipping_address'] = []; + $request['order']['shipping_address'] = $this->maybeSetKey($request['order']['shipping_address'], 'line1', $shippingAddress->streetAddress1); + $request['order']['shipping_address'] = $this->maybeSetKey($request['order']['shipping_address'], 'line2', $shippingAddress->streetAddress2); + $request['order']['shipping_address'] = $this->maybeSetKey($request['order']['shipping_address'], 'line3', $shippingAddress->streetAddress3); + $request['order']['shipping_address'] = $this->maybeSetKey($request['order']['shipping_address'], 'city', $shippingAddress->city); + $request['order']['shipping_address'] = $this->maybeSetKey($request['order']['shipping_address'], 'postal_code', $shippingAddress->postalCode); + $request['order']['shipping_address'] = $this->maybeSetKey($request['order']['shipping_address'], 'state', $shippingAddress->state); + $request['order']['shipping_address'] = $this->maybeSetKey($request['order']['shipping_address'], 'country', $shippingAddress->countryCode); + } + + // payer + $request['payer'] = []; + $request['payer'] = $this->maybeSetKey($request['payer'], 'email', $builder->getCustomerEmail() ?? null); + $request['payer'] = $this->maybeSetKey($request['payer'], 'id', $builder->getCustomerAccountId()); + $request['payer'] = $this->maybeSetKey($request['payer'], 'account_age', $builder->getAccountAgeIndicator()); + $request['payer'] = $this->maybeSetKey($request['payer'], 'account_creation_date', null !== $builder->getAccountCreateDate() ? date('Y-m-d', strtotime($builder->getAccountCreateDate())) : null); + $request['payer'] = $this->maybeSetKey($request['payer'], 'account_change_indicator', $builder->getAccountChangeIndicator()); + $request['payer'] = $this->maybeSetKey($request['payer'], 'account_change_date', null !== $builder->getAccountChangeDate() ? date('Y-m-d', strtotime($builder->getAccountChangeDate())) : null); + $request['payer'] = $this->maybeSetKey($request['payer'], 'account_password_change_indicator', $builder->getPasswordChangeIndicator()); + $request['payer'] = $this->maybeSetKey($request['payer'], 'account_password_change_date', null !== $builder->getPasswordChangeDate() ? date('Y-m-d', strtotime($builder->getPasswordChangeDate())) : null); + $request['payer'] = $this->maybeSetKey($request['payer'], 'payment_account_age_indicator', $builder->getAccountAgeIndicator()); + $request['payer'] = $this->maybeSetKey($request['payer'], 'payment_account_creation_date', null !== $builder->getAccountCreateDate() ? date('Y-m-d', strtotime($builder->getAccountCreateDate())) : null); + $request['payer'] = $this->maybeSetKey($request['payer'], 'purchase_count_last_6months', $builder->getNumberOfPurchasesInLastSixMonths()); + $request['payer'] = $this->maybeSetKey($request['payer'], 'transaction_count_last_24hours', $builder->getNumberOfTransactionsInLast24Hours()); + $request['payer'] = $this->maybeSetKey($request['payer'], 'transaction_count_last_year', $builder->getNumberOfTransactionsInLastYear()); + $request['payer'] = $this->maybeSetKey($request['payer'], 'provision_attempt_count_last_24hours', $builder->getNumberOfAddCardAttemptsInLast24Hours()); + $request['payer'] = $this->maybeSetKey($request['payer'], 'shipping_address_creation_indicator', $builder->getShippingAddressUsageIndicator()); + $request['payer'] = $this->maybeSetKey($request['payer'], 'shipping_address_creation_date', null !== $builder->getShippingAddressCreateDate() ? date('Y-m-d', strtotime($builder->getShippingAddressCreateDate())) : null); + + // suspicious activity + if ($builder->getPreviousSuspiciousActivity() != null) { + $request['payer'] = $this->maybeSetKey($request['payer'], 'suspicious_account_activity', $builder->getPreviousSuspiciousActivity() ? 'SUSPICIOUS_ACTIVITY' : 'NO_SUSPICIOUS_ACTIVITY'); + } + + // home phone + if (!empty($builder->getHomeNumber())) { + $request['payer']['home_phone'] = []; + $request['payer']['home_phone'] = $this->maybeSetKey($request['payer']['home_phone'], 'country_code', $builder->getHomeCountryCode()); + $request['payer']['home_phone'] = $this->maybeSetKey($request['payer']['home_phone'], 'subscriber_number', $builder->getHomeNumber()); + } + + // work phone + if (!empty($builder->getWorkNumber())) { + $request['payer']['work_phone'] = []; + $request['payer']['work_phone'] = $this->maybeSetKey($request['payer']['work_phone'], 'country_code', $builder->getWorkCountryCode()); + $request['payer']['work_phone'] = $this->maybeSetKey($request['payer']['work_phone'], 'subscriber_number', $builder->getWorkNumber()); + } + + // payer login data + if ($builder->hasPayerLoginData()) { + $request['payer_login_data'] = []; + $request['payer_login_data'] = $this->maybeSetKey($request['payer_login_data'], 'authentication_data', $builder->getCustomerAuthenticationData()); + $request['payer_login_data'] = $this->maybeSetKey($request['payer_login_data'], 'authentication_timestamp', $builder->getCustomerAuthenticationTimestamp()); + $request['payer_login_data'] = $this->maybeSetKey($request['payer_login_data'], 'authentication_type', $builder->getCustomerAuthenticationMethod()); + } + + // prior authentication data + if ($builder->hasPriorAuthenticationData()) { + $request['payer_prior_three_ds_authentication_data'] = []; + $request['payer_prior_three_ds_authentication_data'] = $this->maybeSetKey($request['payer_prior_three_ds_authentication_data'], 'authentication_method', $builder->getPriorAuthenticationMethod()); + $request['payer_prior_three_ds_authentication_data'] = $this->maybeSetKey($request['payer_prior_three_ds_authentication_data'], 'acs_transaction_id', $builder->getPriorAuthenticationTransactionId()); + $request['payer_prior_three_ds_authentication_data'] = $this->maybeSetKey($request['payer_prior_three_ds_authentication_data'], 'authentication_timestamp', date('Y-m-d\TH:i:s.u\Z', strtotime($builder->getPriorAuthenticationTimestamp()))); + $request['payer_prior_three_ds_authentication_data'] = $this->maybeSetKey($request['payer_prior_three_ds_authentication_data'], 'authentication_data', $builder->getPriorAuthenticationData()); + } + + // recurring authorization data + if ($builder->hasRecurringAuthData()) { + $request['recurring_authorization_data'] = []; + $request['recurring_authorization_data'] = $this->maybeSetKey($request['recurring_authorization_data'], 'max_number_of_installments', $builder->getMaxNumberOfInstallments()); + $request['recurring_authorization_data'] = $this->maybeSetKey($request['recurring_authorization_data'], 'frequency', $builder->getRecurringAuthorizationFrequency()); + $request['recurring_authorization_data'] = $this->maybeSetKey($request['recurring_authorization_data'], 'expiry_date', date('Y-m-d\TH:i:s.u\Z', strtotime($builder->getRecurringAuthorizationExpiryDate()))); + } + + // billing details + $billingAddress = $builder->getBillingAddress(); + if (!empty($billingAddress)) { + $request['payer']['billing_address'] = []; + $request['payer']['billing_address'] = $this->maybeSetKey($request['payer']['billing_address'], 'line1', $billingAddress->streetAddress1); + $request['payer']['billing_address'] = $this->maybeSetKey($request['payer']['billing_address'], 'line2', $billingAddress->streetAddress2); + $request['payer']['billing_address'] = $this->maybeSetKey($request['payer']['billing_address'], 'line3', $billingAddress->streetAddress3); + $request['payer']['billing_address'] = $this->maybeSetKey($request['payer']['billing_address'], 'city', $billingAddress->city); + $request['payer']['billing_address'] = $this->maybeSetKey($request['payer']['billing_address'], 'postal_code', $billingAddress->postalCode); + $request['payer']['billing_address'] = $this->maybeSetKey($request['payer']['billing_address'], 'state', $billingAddress->state); + $request['payer']['billing_address'] = $this->maybeSetKey($request['payer']['billing_address'], 'country', $billingAddress->countryCode); + } + + // mobile phone + if (!empty($builder->getMobileNumber())) { + $request['payer']['mobile_phone'] = []; + $request['payer']['mobile_phone'] = $this->maybeSetKey($request['payer']['mobile_phone'], 'country_code', $builder->getMobileCountryCode()); + $request['payer']['mobile_phone'] = $this->maybeSetKey($request['payer']['mobile_phone'], 'subscriber_number', $builder->getMobileNumber()); + } + + // browser_data + $browserData = $builder->getBrowserData(); + if (!empty($browserData)) { + $request['browser_data'] = []; + $request['browser_data'] = $this->maybeSetKey($request['browser_data'], 'accept_header', $browserData->acceptHeader); + $request['browser_data'] = $this->maybeSetKey($request['browser_data'], 'color_depth', $browserData->colorDepth); + $request['browser_data'] = $this->maybeSetKey($request['browser_data'], 'ip', $browserData->ipAddress); + $request['browser_data'] = $this->maybeSetKey($request['browser_data'], 'java_enabled', $browserData->javaEnabled); + $request['browser_data'] = $this->maybeSetKey($request['browser_data'], 'javascript_enabled', $browserData->javaScriptEnabled); + $request['browser_data'] = $this->maybeSetKey($request['browser_data'], 'language', $browserData->language); + $request['browser_data'] = $this->maybeSetKey($request['browser_data'], 'screen_height', $browserData->screenHeight); + $request['browser_data'] = $this->maybeSetKey($request['browser_data'], 'screen_width', $browserData->screenWidth); + $request['browser_data'] = $this->maybeSetKey($request['browser_data'], 'challenge_window_size', $browserData->challengWindowSize); + $request['browser_data'] = $this->maybeSetKey($request['browser_data'], 'timezone', $browserData->timeZone); + $request['browser_data'] = $this->maybeSetKey($request['browser_data'], 'user_agent', $browserData->userAgent); + } + + // mobile fields + if ($builder->hasMobileFields()) { + $request['sdk_information'] = []; + $request['sdk_information'] = $this->maybeSetKey($request['sdk_information'], 'application_id', $builder->getApplicationId()); + $request['sdk_information'] = $this->maybeSetKey($request['sdk_information'], 'ephemeral_public_key', $builder->getEphemeralPublicKey()); + $request['sdk_information'] = $this->maybeSetKey($request['sdk_information'], 'maximum_timeout', $builder->getMaximumTimeout()); + $request['sdk_information'] = $this->maybeSetKey($request['sdk_information'], 'reference_number', $builder->getReferenceNumber()); + $request['sdk_information'] = $this->maybeSetKey($request['sdk_information'], 'sdk_trans_id', $builder->getSdkTransactionId()); + $request['sdk_information'] = $this->maybeSetKey($request['sdk_information'], 'encoded_data', $builder->getEncodedData()); + } + + // device render options + if ($builder->getSdkInterface() != null || $builder->getSdkUiTypes() != null) { + $request['sdk_information']['device_render_options'] = []; + $request['sdk_information']['device_render_options'] = $this->maybeSetKey($request['sdk_information']['device_render_options'], 'sdk_interface', $builder->getSdkInterface()); + $request['sdk_information']['device_render_options'] = $this->maybeSetKey($request['sdk_information']['device_render_options'], 'sdk_ui_type', $builder->getSdkUiTypes()); + } + + $hash = GenerationUtils::generateHash($this->sharedSecret, implode('.', [$timestamp, $this->merchantId, $hashValue, $secureEcom->serverTransactionId])); + $headers['Authorization'] = sprintf('securehash %s', $hash); + $rawResponse = $this->doTransaction('POST', 'authentications', json_encode($request, JSON_UNESCAPED_SLASHES), null, $headers); + return $this->mapResponse($rawResponse); + } + + throw new ApiException(sprintf('Unknown transaction type %s.', $transType)); + } + + /** @return Transaction */ + private function mapResponse($rawResponse) + { + $doc = json_decode($rawResponse, true); + $secureEcom = new ThreeDSecure(); + + // check enrolled + $secureEcom->serverTransactionId = $doc['server_trans_id'] ?? null; + if (array_key_exists('enrolled', $doc)) { + $secureEcom->enrolled = (bool)$doc['enrolled']; + } + $secureEcom->issuerAcsUrl = ($doc['method_url'] ?? null) . ($doc['challenge_request_url'] ?? null); + + // get authentication data + $secureEcom->acsTransactionId = $doc['acs_trans_id'] ?? null; + $secureEcom->directoryServerTransactionId = $doc['ds_trans_id'] ?? null; + $secureEcom->authenticationType = $doc['authentication_type'] ?? null; + $secureEcom->authenticationValue = $doc['authentication_value'] ?? null; + $secureEcom->eci = $doc['eci'] ?? null; + $secureEcom->status = $doc['status'] ?? null; + $secureEcom->statusReason = $doc['status_reason'] ?? null; + $secureEcom->authenticationSource = $doc['authentication_source'] ?? null; + $secureEcom->messageCategory = $doc['message_category'] ?? null; + $secureEcom->messageVersion = $doc['message_version'] ?? null; + + // challenge mandated + if (array_key_exists('challenge_mandated', $doc)) { + $secureEcom->challengeMandated = (bool)$doc['challenge_mandated']; + } + + // initiate authentication + $secureEcom->cardHolderResponseInfo = $doc['cardHolder_response_info'] ?? null; + + // device_render_options + if (array_key_exists('device_render_options', $doc)) { + $renderOptions = $doc['device_render_options']; + $secureEcom->sdkInterface = $renderOptions['sdk_interface'] ?? null; + $secureEcom->sdkUiType = $renderOptions['sdk_ui_type'] ?? null; + } + + // message_extension + if (array_key_exists('message_extension', $doc)) { + $secureEcom->criticalityIndicator = $doc['message_extension']['criticality_indicator'] ?? null; + $secureEcom->messageExtensionId = $doc['message_extension']['id'] ?? null; + $secureEcom->messageExtensionName = $doc['message_extension']['name'] ?? null; + } + + // versions + $secureEcom->directoryServerEndVersion = $doc['ds_protocol_version_end'] ?? null; + $secureEcom->directoryServerStartVersion = $doc['ds_protocol_version_start'] ?? null; + $secureEcom->acsEndVersion = $doc['acs_protocol_version_end'] ?? null; + $secureEcom->acsStartVersion = $doc['acs_protocol_version_start'] ?? null; + + // payer authentication request + if (array_key_exists('method_data', $doc)) { + $methodData = $doc['method_data']; + $secureEcom->payerAuthenticationRequest = $methodData['encoded_method_data'] ?? null; + } elseif (array_key_exists('encoded_creq', $doc)) { + $secureEcom->payerAuthenticationRequest = $doc['encoded_creq'] ?? null; + } + + $response = new Transaction(); + $response->threeDSecure = $secureEcom; + return $response; + } + + private function mapCardScheme($cardType) + { + if ($cardType == "MC") { + return "MASTERCARD"; + } elseif ($cardType == "DINERSCLUB") { + return "DINERS"; + } else { + return $cardType; + } + } + + /** + * @throws GatewayException + * @return string */ + private function handleResponse(GatewayResponse $response) + { + if ($response->statusCode != 200 && $response->statusCode != 204) { + $parsed = json_decode($response->rawResponse, true); + if (array_key_exists('error', $parsed)) { + $error = $parsed['error']; + throw new GatewayException(sprintf("Status code: %s - %s", $response->statusCode, $error)); + } + throw new GatewayException(sprintf("Status code: %s - %s", $response->statusCode, $error)); + } + return $response->rawResponse; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Gateways/IPaymentGateway.php b/lib/vendor/globalpayments/php-sdk/src/Gateways/IPaymentGateway.php new file mode 100644 index 0000000..e3a6a86 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Gateways/IPaymentGateway.php @@ -0,0 +1,32 @@ +apiKey; + default: + break; + } + + if (property_exists($this, $name)) { + return $this->{$name}; + } + + throw new ArgumentException(sprintf('Property `%s` does not exist on PayPlanConnector', $name)); + } + + public function __isset($name) + { + return in_array($name, [ + 'secretApiKey', + ]) || isset($this->{$name}); + } + + public function __set($name, $value) + { + switch ($name) { + case 'secretApiKey': + $this->apiKey = $value; + $auth = sprintf('Basic %s', base64_encode($value)); + $this->headers['Authorization'] = $auth; + return; + default: + break; + } + + if (property_exists($this, $name)) { + return $this->{$name} = $value; + } + + throw new ArgumentException(sprintf('Property `%s` does not exist on PayPlanConnector', $name)); + } + + public function processRecurring(RecurringBuilder $builder) + { + $request = []; + + if ($builder->transactionType === TransactionType::CREATE + || $builder->transactionType === TransactionType::EDIT + ) { + if ($builder->entity instanceof Customer) { + $request = $this->buildCustomer($request, $builder->entity); + } + + if ($builder->entity instanceof RecurringPaymentMethod) { + $request = $this->buildPaymentMethod($request, $builder->entity, $builder->transactionType); + } + + if ($builder->entity instanceof Schedule) { + $request = $this->buildSchedule($request, $builder->entity, $builder->transactionType); + } + } + + if ($builder->transactionType === TransactionType::SEARCH) { + foreach ($builder->searchCriteria as $key => $value) { + $request[$key] = $value; + } + } + + foreach ($request as $key => $value) { + if ($value !== 0 && empty($value)) { + unset($request[$key]); + } + } + + $response = $this->doTransaction( + $this->mapMethod($builder->transactionType), + $this->mapUrl($builder), + $request === [] ? '{}' : json_encode($request) + ); + return $this->mapResponse($builder, $response); + } + + #region Mappers + protected function mapResponse($builder, $rawResponse) + { + // this is for DELETE which returns nothing + if (empty($rawResponse)) { + return null; + } + + // else do the whole shebang + $response = json_decode($rawResponse); + + if ($builder->entity instanceof Customer + && $builder->transactionType === TransactionType::SEARCH + ) { + $customers = []; + foreach ($response->results as $customer) { + $customers[] = $this->hydrateCustomer($customer); + } + return $customers; + } + + if ($builder->entity instanceof Customer) { + return $this->hydrateCustomer($response); + } + + if ($builder->entity instanceof RecurringPaymentMethod + && $builder->transactionType === TransactionType::SEARCH + ) { + $methods = []; + foreach ($response->results as $method) { + $methods[] = $this->hydratePaymentMethod($method); + } + return $methods; + } + + if ($builder->entity instanceof RecurringPaymentMethod) { + return $this->hydratePaymentMethod($response); + } + + if ($builder->entity instanceof Schedule + && $builder->transactionType === TransactionType::SEARCH + ) { + $schedules = []; + foreach ($response->results as $schedule) { + $schedules[] = $this->hydrateSchedule($schedule); + } + return $schedules; + } + + if ($builder->entity instanceof Schedule) { + return $this->hydrateSchedule($response); + } + + return $response; + } + + protected function mapMethod($type) + { + switch ($type) { + case TransactionType::CREATE: + case TransactionType::SEARCH: + return 'POST'; + case TransactionType::EDIT: + return 'PUT'; + case TransactionType::DELETE: + return 'DELETE'; + default: + return 'GET'; + } + } + + protected function mapUrl(RecurringBuilder $builder) + { + $suffix = ''; + if ($builder->transactionType === TransactionType::FETCH + || $builder->transactionType === TransactionType::DELETE + || $builder->transactionType === TransactionType::EDIT + ) { + $suffix = '/' . $builder->entity->key; + } + + if ($builder->entity instanceof Customer) { + return sprintf( + '%s%s', + $builder->transactionType === TransactionType::SEARCH ? 'searchCustomers' : 'customers', + $suffix + ); + } + + if ($builder->entity instanceof RecurringPaymentMethod) { + $paymentMethod = ''; + if ($builder->transactionType === TransactionType::CREATE) { + $paymentMethod = $builder->entity->paymentMethod instanceof Credit ? 'CreditCard' : 'ACH'; + } elseif ($builder->transactionType === TransactionType::EDIT) { + $paymentMethod = str_replace($builder->entity->paymentType, ' ', ''); + } + return sprintf( + '%s%s%s', + $builder->transactionType === TransactionType::SEARCH ? 'searchPaymentMethods' : 'paymentMethods', + $paymentMethod, + $suffix + ); + } + + if ($builder->entity instanceof Schedule) { + return sprintf( + '%s%s', + $builder->transactionType === TransactionType::SEARCH ? 'searchSchedules' : 'schedules', + $suffix + ); + } + + throw new UnsupportedTransactionException(); + } + #endregion + + #region Build Entities + protected function buildCustomer($request, Customer $customer = null) + { + if ($customer === null) { + return $request; + } + + $request['customerIdentifier'] = $customer->id; + $request['firstName'] = $customer->firstName; + $request['lastName'] = $customer->lastName; + $request['company'] = $customer->company; + $request['customerStatus'] = $customer->status; + $request['primaryEmail'] = $customer->email; + $request['phoneDay'] = $customer->homePhone; + $request['phoneEvening'] = $customer->workPhone; + $request['phoneMobile'] = $customer->mobilePhone; + $request['fax'] = $customer->fax; + $request['title'] = $customer->title; + $request['department'] = $customer->department; + $request = $this->buildAddress($request, $customer->address); + + return $request; + } + + protected function buildPaymentMethod($request, RecurringPaymentMethod $payment, $type) + { + if ($payment === null) { + return $request; + } + + $request['preferredPayment'] = $payment->preferredPayment; + $request['paymentMethodIdentifier'] = $payment->id; + $request['customerKey'] = $payment->customerKey; + $request['nameOnAccount'] = $payment->nameOnAccount; + $request = $this->buildAddress($request, $payment->address); + + if ($type === TransactionType::CREATE) { + $tokenValue; + list($hasToken, $tokenValue) = $this->hasToken($payment->paymentMethod); + $paymentInfo = null; + $paymentInfoKey = null; + if ($payment->paymentMethod instanceof ICardData) { + $method = $payment->paymentMethod; + $paymentInfoKey = $hasToken ? 'alternateIdentity' : 'card'; + $paymentInfo = [ + $hasToken ? 'token' : 'number' => $hasToken ? $tokenValue : $method->number, + 'expMon' => $method->expMonth, + 'expYear' => $method->expYear, + ]; + + if ($hasToken) { + $paymentInfo['type'] = 'SINGLEUSETOKEN'; + } + + $request['cardVerificationValue'] = $method->cvn; + } elseif ($payment->paymentMethod instanceof ITrackData) { + $method = $payment->paymentMethod; + $paymentInfoKey = 'track'; + $paymentInfo = [ + 'data' => $method->value, + 'dataEntryMode' => strtoupper($method->entryMethod), + ]; + } + + if ($payment->paymentMethod instanceof ECheck) { + $check = $payment->paymentMethod; + $request['achType'] = $this->mapAccountType($check->accountType); + $request['accountType'] = $this->mapCheckType($check->checkType); + $request['telephoneIndicator'] = + $check->secCode === SecCode::CCD || $check->secCode == SecCode::PPD + ? false + : true; + $request['routingNumber'] = $check->routingNumber; + $request['accountNumber'] = $check->accountNumber; + $request['accountHolderYob'] = $check->birthYear; + $request['driversLicenseState'] = $check->driversLicenseState; + $request['driversLicenseNumber'] = $check->driversLicenseNumber; + $request['socialSecurityNumberLast4'] = $check->ssnLast4; + unset($request['country']); + } + + if ($payment->paymentMethod instanceof IEncryptable) { + $enc = $payment->paymentMethod->encryptionData; + if ($enc != null) { + $paymentInfo['trackNumber'] = $enc->trackNumber; + $paymentInfo['key'] = $enc->ktb; + $paymentInfo['encryptionType'] = 'E3'; + } + } + } else { // EDIT FIELDS + unset($request['customerKey']); + $request['paymentStatus'] = $payment->status; + $request['cpcTaxType'] = $payment->taxType; + $request['expirationDate'] = $payment->expirationDate; + } + + if ($paymentInfo !== null) { + $request[$paymentInfoKey] = $paymentInfo; + } + + return $request; + } + + protected function mapAccountType($type) + { + switch ($type) { + case AccountType::CHECKING: + return 'Checking'; + case AccountType::SAVINGS: + return 'Savings'; + } + } + + protected function mapCheckType($type) + { + switch ($type) { + case CheckType::PERSONAL: + return 'Personal'; + case CheckType::BUSINESS: + return 'Business'; + } + } + + protected function buildSchedule($request, Schedule $schedule, $type) + { + $mapDuration = function () use ($schedule) { + if ($schedule->numberOfPayments !== null) { + return 'Limited Number'; + } + + if ($schedule->endDate !== null) { + return 'End Date'; + } + + return 'Ongoing'; + }; + + $mapProcessingDate = function () use ($schedule) { + $frequencies = [ 'Monthly', 'Bi-Monthly', 'Quarterly', 'Semi-Annually' ]; + if (in_array($schedule->frequency, $frequencies)) { + switch ($schedule->paymentSchedule) { + case PaymentSchedule::FIRST_DAY_OF_THE_MONTH: + return 'First'; + case PaymentSchedule::LAST_DAY_OF_THE_MONTH: + return 'Last'; + default: + $day = $schedule->startDate->format('d'); + return $day > 28 ? 'Last' : $day; + } + } + + if ($schedule->frequency == 'Semi-Monthly') { + return $schedule->paymentSchedule === PaymentSchedule::LAST_DAY_OF_THE_MONTH + ? 'Last' + : 'First'; + } + + return null; + }; + + if ($schedule === null) { + return $request; + } + + $request['scheduleIdentifier'] = $schedule->id; + $request['scheduleName'] = $schedule->name; + $request['scheduleStatus'] = $schedule->status; + $request['paymentMethodKey'] = $schedule->paymentKey; + + $request = $this->buildAmount($request, 'subtotalAmount', $schedule->amount, $schedule->currency, $type); + $request = $this->buildAmount($request, 'taxAmount', $schedule->taxAmount, $schedule->currency, $type); + + $request['deviceId'] = $schedule->deviceId; + $request['processingDateInfo'] = $mapProcessingDate(); + $request = $this->buildDate($request, 'endDate', $schedule->endDate, ($type === TransactionType::EDIT)); + $request['reprocessingCount'] = $schedule->reprocessingCount ?: 3; + $request['emailReceipt'] = $schedule->emailReceipt; + $request['emailAdvanceNotice'] = $schedule->emailNotification ? 'Yes' : 'No'; + // debt repay ind + $request['invoiceNbr'] = $schedule->invoiceNumber; + $request['poNumber'] = $schedule->poNumber; + $request['description'] = $schedule->description; + $request['numberOfPayments'] = $schedule->numberOfPayments; + + if ($type === TransactionType::CREATE) { + $request['customerKey'] = $schedule->customerKey; + $request = $this->buildDate($request, 'startDate', $schedule->startDate); + $request['frequency'] = $schedule->frequency; + $request['duration'] = $mapDuration(); + } else { // Edit Fields + if (!$schedule->hasStarted) { + $request = $this->buildDate($request, 'startDate', $schedule->startDate); + $request['frequency'] = $schedule->frequency; + $request['duration'] = $mapDuration(); + } else { + $request = $this->buildDate($request, 'cancellationDate', $schedule->cancellationDate); + $request = $this->buildDate($request, 'nextProcressingDate', $schedule->nextProcessingDate); + } + } + + return $request; + } + + protected function buildDate($request, $name, \DateTime $date = null, $force = false) + { + if ($date !== null || $force) { + $value = $date !== null ? $date->format('mdY') : null; + $request[$name] = $value; + } + return $request; + } + + protected function buildAmount($request, $name, $amount, $currency, $type) + { + if ($amount !== null) { + $node = [ + 'value' => $amount * 100, + ]; + + if ($type === TransactionType::CREATE) { + $node['currency'] = $currency; + } + + $request[$name] = $node; + } + return $request; + } + + protected function buildAddress($request, Address $address) + { + if ($address !== null) { + $request['addressLine1'] = $address->streetAddress1; + $request['addressLine2'] = $address->streetAddress2; + $request['city'] = $address->city; + $request['country'] = $address->country; + $request['stateProvince'] = $address->province; + $request['zipPostalCode'] = $address->postalCode; + } + return $request; + } + #endregion + + #region Hydrate Entities + protected function hydrateCustomer($response) + { + $customer = new Customer(); + $customer->key = isset($response->customerKey) ? $response->customerKey : null; + $customer->id = isset($response->customerIdentifier) ? $response->customerIdentifier : null; + $customer->firstName = isset($response->firstName) ? $response->firstName : null; + $customer->lastName = isset($response->lastName) ? $response->lastName : null; + $customer->company = isset($response->company) ? $response->company : null; + $customer->status = isset($response->customerStatus) ? $response->customerStatus : null; + $customer->title = isset($response->title) ? $response->title : null; + $customer->department = isset($response->department) ? $response->department : null; + $customer->email = isset($response->primaryEmail) ? $response->primaryEmail : null; + $customer->homePhone = isset($response->phoneDay) ? $response->phoneDay : null; + $customer->workPhone = isset($response->phoneEvening) ? $response->phoneEvening : null; + $customer->mobilePhone = isset($response->phoneMobile) ? $response->phoneMobile : null; + $customer->fax = isset($response->fax) ? $response->fax : null; + $customer->address = new Address(); + $customer->address->streetAddress1 = isset($response->addressLine1) ? $response->addressLine1 : null; + $customer->address->streetAddress2 = isset($response->addressLine2) ? $response->addressLine2 : null; + $customer->address->city = isset($response->city) ? $response->city : null; + $customer->address->province = isset($response->stateProvince) ? $response->stateProvince : null; + $customer->address->postalCode = isset($response->zipPostalCode) ? $response->zipPostalCode : null; + $customer->address->country = isset($response->country) ? $response->country : null; + return $customer; + } + + protected function hydratePaymentMethod($response) + { + $paymentMethod = new RecurringPaymentMethod(); + $paymentMethod->key = isset($response->paymentMethodKey) ? $response->paymentMethodKey : null; + $paymentMethod->paymentType = isset($response->paymentMethodType) ? $response->paymentMethodType : null; + $paymentMethod->preferredPayment = isset($response->preferredPayment) ? $response->preferredPayment : null; + $paymentMethod->status = isset($response->paymentStatus) ? $response->paymentStatus : null; + $paymentMethod->id = isset($response->paymentMethodIdentifier) ? $response->paymentMethodIdentifier : null; + $paymentMethod->customerKey = isset($response->customerKey) ? $response->customerKey : null; + $paymentMethod->nameOnAccount = isset($response->nameOnAccount) ? $response->nameOnAccount : null; + $paymentMethod->commercialIndicator = isset($response->cpcInd) ? $response->cpcInd : null; + $paymentMethod->taxType = isset($response->cpcTaxType) ? $response->cpcTaxType : null; + $paymentMethod->expirationDate = isset($response->expirationDate) ? $response->expirationDate : null; + $paymentMethod->address = new Address(); + $paymentMethod->address->streetAddress1 = isset($response->addressLine1) ? $response->addressLine1 : null; + $paymentMethod->address->streetAddress2 = isset($response->addressLine2) ? $response->addressLine2 : null; + $paymentMethod->address->city = isset($response->city) ? $response->city : null; + $paymentMethod->address->state = isset($response->stateProvince) ? $response->stateProvince : null; + $paymentMethod->address->postalCode= isset($response->zipPostalCode) ? $response->zipPostalCode : null; + $paymentMethod->address->country = isset($response->country) ? $response->country : null; + return $paymentMethod; + } + + protected function hydrateSchedule($response) + { + $schedule = new Schedule(); + $schedule->key = isset($response->scheduleKey) ? $response->scheduleKey : null; + $schedule->id = isset($response->scheduleIdentifier) ? $response->scheduleIdentifier : null; + $schedule->customerKey = isset($response->customerKey) ? $response->customerKey : null; + $schedule->name = isset($response->scheduleName) ? $response->scheduleName : null; + $schedule->status = isset($response->scheduleStatus) ? $response->scheduleStatus : null; + $schedule->paymentKey = isset($response->paymentMethodKey) ? $response->paymentMethodKey : null; + if (isset($response->subtotalAmount)) { + $subtotal = $response->subtotalAmount; + $schedule->amount = $subtotal->value; + $schedule->currency = $subtotal->currency; + } + if (isset($response->taxAmount)) { + $taxAmount = $response->taxAmount; + $schedule->taxAmount = $taxAmount->value; + } + $schedule->deviceId = isset($response->deviceId) ? $response->deviceId : null; + $schedule->startDate = $response->startDate; + $schedule->paymentSchedule = isset($response->processingDateInfo) ? $response->processingDateInfo : null; + switch ($schedule->paymentSchedule) { + case 'Last': + $schedule->paymentSchedule = PaymentSchedule::LAST_DAY_OF_THE_MONTH; + break; + case 'First': + $schedule->paymentSchedule = PaymentSchedule::FIRST_DAY_OF_THE_MONTH; + break; + default: + $schedule->paymentSchedule = PaymentSchedule::DYNAMIC; + break; + } + $schedule->frequency = isset($response->frequency) ? $response->frequency : null; + $schedule->endDate = isset($response->endDate) ? $response->endDate : null; + $schedule->reprocessingCount = isset($response->reprocessingCount) ? $response->reprocessingCount : null; + $schedule->emailReceipt = isset($response->emailReceipt) ? $response->emailReceipt : null; + $schedule->emailNotification = isset($response->emailAdvanceNotice) ? $response->emailAdvanceNotice : null; + if ($schedule->emailNotification === null + || $schedule->emailNotification === 'No' + ) { + $schedule->emailNotification = false; + } else { + $schedule->emailNotification = true; + } + // dept repay indicator + $schedule->invoiceNumber = isset($response->invoiceNbr) ? $response->invoiceNbr : null; + $schedule->poNumber = isset($response->poNumber) ? $response->poNumber : null; + $schedule->description = isset($response->Description) ? $response->Description : null; + // statusSetDate + $schedule->nextProcessingDate = isset($response->nextProcessingDate) + ? \DateTime::createFromFormat('dmY', $response->nextProcessingDate) + : null; + // previousProcessingDate + // approvedTransactionCount + // failureCount + // totalApprovedAmountToDate + // numberOfPaymentsRemaining + $schedule->cancellationDate = isset($response->cancellationDate) ? $response->cancellationDate : null; + // creationDate + // lastChangeDate + $schedule->hasStarted = isset($response->scheduleStarted) ? $response->scheduleStarted : null; + return $schedule; + } + #endregion + + #region Validations + + /** + * Tests the payment method for a token value + * + * @param IPaymentMethod $paymentMethod The payment method + * + * @return [bool, string|null] + */ + protected function hasToken(IPaymentMethod $paymentMethod) + { + $tokenValue = null; + + if (!empty($paymentMethod->token)) { + $tokenValue = $paymentMethod->token; + return [true, $tokenValue]; + } + + return [false, $tokenValue]; + } + + #endregion +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Gateways/PorticoConnector.php b/lib/vendor/globalpayments/php-sdk/src/Gateways/PorticoConnector.php new file mode 100644 index 0000000..e075a22 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Gateways/PorticoConnector.php @@ -0,0 +1,1878 @@ +createElement($this->mapRequestType($builder)); + $block1 = $xml->createElement('Block1'); + + if ($builder->paymentMethod->paymentMethodType !== PaymentMethodType::GIFT + && $builder->paymentMethod->paymentMethodType !== PaymentMethodType::ACH + && ($builder->transactionType === TransactionType::AUTH + || $builder->transactionType === TransactionType::SALE) + ) { + if ($builder->paymentMethod->paymentMethodType !== PaymentMethodType::RECURRING + || $builder->paymentMethod->paymentType !== 'ACH' + ) { + $block1->appendChild( + $xml->createElement( + 'AllowDup', + ($builder->allowDuplicates ? 'Y' : 'N') + ) + ); + } + + if ($builder->transactionModifier === TransactionModifier::NONE + && $builder->paymentMethod->paymentMethodType !== PaymentMethodType::EBT + && $builder->paymentMethod->paymentMethodType !== PaymentMethodType::RECURRING + ) { + $block1->appendChild( + $xml->createElement( + 'AllowPartialAuth', + ($builder->allowPartialAuth ? 'Y' : 'N') + ) + ); + } + } + + if ($builder->amount !== null) { + $block1->appendChild($xml->createElement('Amt', $builder->amount)); + } + + if ($builder->gratuity !== null) { + $block1->appendChild( + $xml->createElement('GratuityAmtInfo', $builder->gratuity) + ); + } + + if ($builder->convenienceAmount !== null) { + $block1->appendChild($xml->createElement('ConvenienceAmtInfo', $builder->convenienceAmount)); + } + + if ($builder->shippingAmount !== null) { + $block1->appendChild($xml->createElement('ShippingAmtInfo', $builder->shippingAmount)); + } + + if ($builder->cashBackAmount !== null) { + $block1->appendChild( + $xml->createElement( + $builder->paymentMethod->paymentMethodType === PaymentMethodType::DEBIT + ? 'CashbackAmtInfo' + : 'CashBackAmount', + $builder->cashBackAmount + ) + ); + } + + if ($builder->offlineAuthCode !== null) { + $block1->appendChild( + $xml->createElement('OfflineAuthCode', $builder->offlineAuthCode) + ); + } + + if ($builder->transactionType === TransactionType::ALIAS) { + $block1->appendChild($xml->createElement('Action', AliasAction::validate($builder->aliasAction))); + $block1->appendChild($xml->createElement('Alias', $builder->alias)); + } + + $isCheck = ($builder->paymentMethod->paymentMethodType === PaymentMethodType::ACH) + || ($builder->paymentMethod instanceof RecurringPaymentMethod + && $builder->paymentMethod->paymentType === 'ACH'); + + $propertyName = $isCheck ? 'checkHolderName' : 'cardHolderName'; + if ($isCheck + || $builder->billingAddress !== null + || isset($builder->paymentMethod->{$propertyName}) + ) { + if ($builder->transactionType !== TransactionType::REVERSAL) { + $address = $this->hydrateHolder($xml, $builder, $isCheck); + } + if (!empty($address)) { + $block1->appendChild($address); + } + } + list($hasToken, $tokenValue) = $this->hasToken($builder->paymentMethod); + + $cardData = $xml->createElement( + $builder->transactionType === TransactionType::REPLACE ? 'OldCardData' : 'CardData' + ); + if ($builder->paymentMethod instanceof ICardData) { + $cardData->appendChild( + $this->hydrateManualEntry( + $xml, + $builder, + $hasToken, + $tokenValue + ) + ); + } elseif ($builder->paymentMethod instanceof ITrackData) { + $trackData = $this->hydrateTrackData( + $xml, + $builder, + $hasToken, + $tokenValue + ); + + if ($builder->paymentMethod->paymentMethodType === PaymentMethodType::DEBIT) { + $block1->appendChild($trackData); + } else { + $cardData->appendChild($trackData); + } + } elseif ($builder->paymentMethod instanceof GiftCard) { + if ($builder->currency !== null) { + $block1->appendChild($xml->createElement('Currency', strtoupper($builder->currency))); + } + + if ($builder->transactionType === TransactionType::REPLACE) { + $newCard = $xml->createElement('NewCardData'); + $newCard->appendChild( + $xml->createElement( + $builder->replacementCard->valueType, + $builder->replacementCard->value + ) + ); + + if ($builder->replacementCard->pin !== null) { + $newCard->appendChild( + $xml->createElement( + 'PIN', + $builder->replacementCard->pin + ) + ); + } + $block1->appendChild($newCard); + } + + if ($builder->paymentMethod->value !== null) { + $cardData->appendChild( + $xml->createElement( + $builder->paymentMethod->valueType, + $builder->paymentMethod->value + ) + ); + } + + if ($builder->paymentMethod->pin !== null) { + $cardData->appendChild( + $xml->createElement( + 'PIN', + $builder->paymentMethod->pin + ) + ); + } + } elseif ($builder->paymentMethod instanceof ECheck) { + $block1->appendChild($xml->createElement('CheckAction', 'SALE')); + + if (empty($builder->paymentMethod->token)) { + $accountInfo = $xml->createElement('AccountInfo'); + $accountInfo->appendChild($xml->createElement('RoutingNumber', $builder->paymentMethod->routingNumber)); + $accountInfo->appendChild($xml->createElement('AccountNumber', $builder->paymentMethod->accountNumber)); + $accountInfo->appendChild($xml->createElement('CheckNumber', $builder->paymentMethod->checkNumber)); + $accountInfo->appendChild($xml->createElement('MICRData', $builder->paymentMethod->micrNumber)); + $accountInfo->appendChild( + $xml->createElement( + 'AccountType', + $this->hydrateAccountType($builder->paymentMethod->accountType) + ) + ); + $block1->appendChild($accountInfo); + } else { + $block1->appendChild($xml->createElement('TokenValue', $builder->paymentMethod->token)); + } + + $block1->appendChild( + $xml->createElement( + 'DataEntryMode', + strtoupper($this->hydrateEntryMethod($builder->paymentMethod->entryMode)) + ) + ); + $block1->appendChild( + $xml->createElement( + 'CheckType', + $this->hydrateCheckType($builder->paymentMethod->checkType) + ) + ); + $block1->appendChild($xml->createElement('SECCode', $builder->paymentMethod->secCode)); + + $verify = $xml->createElement('VerifyInfo'); + $verify->appendChild( + $xml->createElement( + 'CheckVerify', + ($builder->paymentMethod->checkVerify ? 'Y' : 'N') + ) + ); + $verify->appendChild( + $xml->createElement( + 'ACHVerify', + ($builder->paymentMethod->achVerify ? 'Y' : 'N') + ) + ); + $block1->appendChild($verify); + } + + if ($builder->paymentMethod instanceof TransactionReference) { + $block1->appendChild($xml->createElement('GatewayTxnId', $builder->paymentMethod->transactionId)); + $block1->appendChild($xml->createElement('ClientTxnId', $builder->paymentMethod->clientTransactionId)); + } + + if ($builder->paymentMethod instanceof RecurringPaymentMethod) { + $method = $builder->paymentMethod; + + if ($method->paymentType === 'ACH') { + $block1->appendChild($xml->createElement('CheckAction', 'SALE')); + } + + $block1->appendChild($xml->createElement('PaymentMethodKey', $method->key)); + + if ($method->paymentMethod !== null && $method->paymentMethod instanceof CreditCardData) { + $data = $xml->createElement('PaymentMethodKeyData'); + + if ($method->paymentMethod->expMonth !== null) { + $data->appendChild($xml->createElement('ExpMonth', $method->paymentMethod->expMonth)); + } + + if ($method->paymentMethod->expYear !== null) { + $data->appendChild($xml->createElement('ExpYear', $method->paymentMethod->expYear)); + } + + if ($method->paymentMethod->cvn !== null) { + $data->appendChild($xml->createElement('CVV2', $method->paymentMethod->cvn)); + } + + $block1->appendChild($data); + } + + $data = $xml->createElement('RecurringData'); + if ($builder->scheduleId !== null) { + $data->appendChild($xml->createElement('ScheduleID', $builder->scheduleId)); + } + $data->appendChild($xml->createElement('OneTime', $builder->oneTimePayment ? 'Y' : 'N')); + $block1->appendChild($data); + } + + if ($builder->paymentMethod instanceof IPinProtected + && $builder->transactionType !== TransactionType::REVERSAL + ) { + $block1->appendChild($xml->createElement('PinBlock', $builder->paymentMethod->pinBlock)); + } + + if ($builder->paymentMethod instanceof IEncryptable + && isset($builder->paymentMethod->encryptionData) + && null !== $builder->paymentMethod->encryptionData + ) { + $enc = $this->hydrateEncryptionData($xml, $builder); + + if ($builder->paymentMethod->paymentMethodType === PaymentMethodType::DEBIT) { + $block1->appendChild($enc); + } else { + $cardData->appendChild($enc); + } + } + + if ($builder->paymentMethod instanceof ITokenizable) { + $cardData->appendChild( + $xml->createElement( + 'TokenRequest', + $builder->requestMultiUseToken ? 'Y' : 'N' + ) + ); + } + + if ($cardData->childNodes->length > 0 && $builder->aliasAction !== AliasAction::CREATE) { + $block1->appendChild($cardData); + } + + if ($builder->paymentMethod instanceof IBalanceable && $builder->balanceInquiryType !== null) { + $block1->appendChild($xml->createElement('BalanceInquiryType', $builder->balanceInquiryType)); + } + + if ($builder->level2Request === true) { + $block1->appendChild($xml->createElement('CPCReq', 'Y')); + } + + if ($builder->customerId !== null + || $builder->description !== null + || $builder->invoiceNumber !== null + ) { + $block1->appendChild($this->hydrateAdditionalTxnFields($xml, $builder)); + } + + if ($builder->ecommerceInfo !== null) { + $block1->appendChild($xml->createElement('Ecommerce', $builder->ecommerceInfo->channel)); + + if (!empty($builder->invoiceNumber) || !empty($builder->ecommerceInfo->shipMonth)) { + $direct = $xml->createElement('DirectMktData'); + if (!empty($builder->invoiceNumber)) { + $direct->appendChild($xml->createElement('DirectMktInvoiceNbr', $builder->invoiceNumber)); + } + if (!empty($builder->ecommerceInfo->shipDay)) { + $direct->appendChild($xml->createElement('DirectMktShipDay', $builder->ecommerceInfo->shipDay)); + } + if (!empty($builder->ecommerceInfo->shipMonth)) { + $direct->appendChild($xml->createElement('DirectMktShipMonth', $builder->ecommerceInfo->shipMonth)); + } + } + if (!empty($builder->paymentMethod->threeDSecure)) { + $secure = $xml->createElement('SecureECommerce'); + if (!empty($builder->paymentMethod->threeDSecure->paymentDataSource)) { + $direct->appendChild( + $xml->createElement( + 'PaymentDataSource', + $builder->paymentMethod->threeDSecure->paymentDataSource + ) + ); + } + if (!empty($builder->paymentMethod->threeDSecure->paymentDataType)) { + $direct->appendChild( + $xml->createElement( + 'TypeOfPaymentData', + $builder->paymentMethod->threeDSecure->paymentDataType + ) + ); + } + if (!empty($builder->paymentMethod->threeDSecure->cavv)) { + $direct->appendChild($xml->createElement('PaymentData', $builder->paymentMethod->threeDSecure->cavv)); + } + if (!empty($builder->paymentMethod->threeDSecure->eci)) { + $direct->appendChild($xml->createElement('ECommerceIndicator', $builder->paymentMethod->threeDSecure->eci)); + } + if (!empty($builder->paymentMethod->threeDSecure->xid)) { + $direct->appendChild($xml->createElement('XID', $builder->paymentMethod->threeDSecure->xid)); + } + } + } + + if ($builder->dynamicDescriptor !== null) { + $block1->appendChild( + $xml->createElement('TxnDescriptor', $builder->dynamicDescriptor) + ); + } + + $transaction->appendChild($block1); + + $response = $this->doTransaction($this->buildEnvelope($xml, $transaction)); + return $this->mapResponse($response, $builder, $this->buildEnvelope($xml, $transaction)); + } + + public function serializeRequest(AuthorizationBuilder $builder) + { + throw new UnsupportedTransactionException('Portico does not support hosted payments.'); + } + + /** + * {@inheritdoc} + * + * @param ManagementBuilder $builder The transaction's builder + * + * @return Transaction + */ + public function manageTransaction(ManagementBuilder $builder) + { + $xml = new DOMDocument('1.0', 'utf-8'); + + // build request + $transaction = $xml->createElement($this->mapRequestType($builder)); + + if ($builder->transactionType !== TransactionType::BATCH_CLOSE) { + $root = null; + if ($builder->transactionType === TransactionType::REVERSAL + || $builder->transactionType === TransactionType::REFUND + || $builder->paymentMethod->paymentMethodType === PaymentMethodType::GIFT + || $builder->paymentMethod->paymentMethodType === PaymentMethodType::ACH + ) { + $root = $xml->createElement('Block1'); + } else { + $root = $transaction; + } + + // Transaction ID + if ($builder->paymentMethod !== null && !empty($builder->paymentMethod->transactionId)) { + $root->appendChild( + $xml->createElement('GatewayTxnId', $builder->paymentMethod->transactionId) + ); + } + + // Level II Data + if ($builder->transactionType === TransactionType::EDIT + && $builder->transactionModifier === TransactionModifier::LEVEL_II + ) { + $cpc = $xml->createElement('CPCData'); + + if ($builder->poNumber !== null) { + $cpc->appendChild( + $xml->createElement('CardHolderPONbr', $builder->poNumber) + ); + } + + if ($builder->taxType !== null) { + $cpc->appendChild( + $xml->createElement( + 'TaxType', + TaxType::validate($builder->taxType) + ) + ); + } + + if ($builder->taxAmount !== null) { + $cpc->appendChild($xml->createElement('TaxAmt', $builder->taxAmount)); + } + + $root->appendChild($cpc); + } else { + // amount + if ($builder->amount !== null) { + $root->appendChild($xml->createElement('Amt', $builder->amount)); + } + + // auth amount + if ($builder->authAmount !== null) { + $root->appendChild($xml->createElement('AuthAmt', $builder->authAmount)); + } + + // gratuity + if ($builder->gratuity !== null) { + $root->appendChild( + $xml->createElement('GratuityAmtInfo', $builder->gratuity) + ); + } + } + + // Additional Txn Fields + // TODO + + // Token Management + if ($builder->transactionType === TransactionType::TOKEN_UPDATE + || $builder->transactionType === TransactionType::TOKEN_DELETE + ) { + $token = $builder->paymentMethod; + + // Set the token value + $root->appendChild($xml->createElement('TokenValue', $token->token)); + + $tokenActions = $root->appendChild($xml->createElement('TokenActions')); + if ($builder->transactionType === TransactionType::TOKEN_UPDATE) { + $setElement = $tokenActions->appendChild($xml->createElement('Set')); + + $expMonth = $setElement->appendChild($xml->createElement('Attribute')); + $expMonth->appendChild($xml->createElement('Name', 'expmonth')); + $expMonth->appendChild($xml->createElement('Value', $token->expMonth)); + + $expYear = $setElement->appendChild($xml->createElement('Attribute')); + $expYear->appendChild($xml->createElement('Name', 'expyear')); + $expYear->appendChild($xml->createElement('Value', $token->expYear)); + } else { + $tokenActions->appendChild($xml->createElement('Delete')); + } + } + + if ($builder->transactionType === TransactionType::REVERSAL + || $builder->transactionType === TransactionType::REFUND + || $builder->paymentMethod->paymentMethodType === PaymentMethodType::GIFT + || $builder->paymentMethod->paymentMethodType === PaymentMethodType::ACH + ) { + $transaction->appendChild($root); + } + } + + $response = $this->doTransaction($this->buildEnvelope($xml, $transaction)); + return $this->mapResponse($response, $builder, $this->buildEnvelope($xml, $transaction)); + } + + public function processReport(ReportBuilder $builder) + { + $xml = new DOMDocument('1.0', 'utf-8'); + + $transaction = $xml->createElement($this->mapReportType($builder)); + $transaction->appendChild($xml->createElement('TzConversion', $builder->timeZoneConversion)); + + if ($builder instanceof TransactionReportBuilder) { + /* if ($builder->deviceId !== null) { + $transaction->appendChild($xml->createElement('DeviceId', $builder->deviceId)); + } + + if ($builder->startDate !== null) { + $transaction->appendChild($xml->createElement('RptStartUtcDT', $builder->startDate->format())); + } + + if ($builder->endDate !== null) { + $transaction->appendChild($xml->createElement('RptEndUtcDT', $builder->endDate->format())); + } */ + + if ($builder->transactionId !== null) { + $transaction->appendChild($xml->createElement('TxnId', $builder->transactionId)); + } else { + $criteria = $transaction->appendChild($xml->createElement('Criteria')); + + if ($builder->searchBuilder->startDate !== null) { + $criteria->appendChild($xml->createElement( + 'StartUtcDT', + $builder->searchBuilder->startDate + )); + } + if ($builder->searchBuilder->endDate !== null) { + $criteria->appendChild($xml->createElement( + 'EndUtcDT', + $builder->searchBuilder->endDate + )); + } + if ($builder->searchBuilder->authCode !== null) { + $criteria->appendChild($xml->createElement( + 'AuthCode', + $builder->searchBuilder->authCode + )); + } + if ($builder->searchBuilder->cardHolderLastName !== null) { + $criteria->appendChild($xml->createElement( + 'CardHolderLastName', + $builder->searchBuilder->cardHolderLastName + )); + } + if ($builder->searchBuilder->cardHolderFirstName !== null) { + $criteria->appendChild($xml->createElement( + 'CardHolderFirstName', + $builder->searchBuilder->cardHolderFirstName + )); + } + if ($builder->searchBuilder->cardNumberFirstSix !== null) { + $criteria->appendChild($xml->createElement( + 'CardNbrFirstSix', + $builder->searchBuilder->cardNumberFirstSix + )); + } + if ($builder->searchBuilder->cardNumberLastFour !== null) { + $criteria->appendChild($xml->createElement( + 'CardNbrLastFour', + $builder->searchBuilder->cardNumberLastFour + )); + } + if ($builder->searchBuilder->invoiceNumber !== null) { + $criteria->appendChild($xml->createElement( + 'InvoiceNbr', + $builder->searchBuilder->invoiceNumber + )); + } + if ($builder->searchBuilder->cardHolderPoNumber !== null) { + $criteria->appendChild($xml->createElement( + 'CardHolderPONbr', + $builder->searchBuilder->cardHolderPoNumber + )); + } + if ($builder->searchBuilder->customerId !== null) { + $criteria->appendChild($xml->createElement( + 'CustomerID', + $builder->searchBuilder->customerId + )); + } + if ($builder->searchBuilder->issuerResult !== null) { + $criteria->appendChild($xml->createElement( + 'IssuerResult', + $builder->searchBuilder->issuerResult + )); + } + if ($builder->searchBuilder->settlementAmount !== null) { + $criteria->appendChild($xml->createElement( + 'SettlementAmt', + $builder->searchBuilder->settlementAmount + )); + } + if ($builder->searchBuilder->issuerTransactionId !== null) { + $criteria->appendChild($xml->createElement( + 'IssTxnId', + $builder->searchBuilder->issuerTransactionId + )); + } + if ($builder->searchBuilder->referenceNumber !== null) { + $criteria->appendChild($xml->createElement( + 'RefNbr', + $builder->searchBuilder->referenceNumber + )); + } + if ($builder->searchBuilder->username !== null) { + $criteria->appendChild($xml->createElement( + 'UserName', + $builder->searchBuilder->username + )); + } + if ($builder->searchBuilder->clerkId !== null) { + $criteria->appendChild($xml->createElement( + 'ClerkID', + $builder->searchBuilder->clerkId + )); + } + if ($builder->searchBuilder->batchSequenceNumber !== null) { + $criteria->appendChild($xml->createElement( + 'BatchSeqNbr', + $builder->searchBuilder->batchSequenceNumber + )); + } + if ($builder->searchBuilder->batchId !== null) { + $criteria->appendChild($xml->createElement( + 'BatchId', + $builder->searchBuilder->batchId + )); + } + if ($builder->searchBuilder->siteTrace !== null) { + $criteria->appendChild($xml->createElement( + 'SiteTrace', + $builder->searchBuilder->siteTrace + )); + } + if ($builder->searchBuilder->displayName !== null) { + $criteria->appendChild($xml->createElement( + 'DisplayName', + $builder->searchBuilder->displayName + )); + } + if ($builder->searchBuilder->clientTransactionId !== null) { + $criteria->appendChild($xml->createElement( + 'ClientTxnId', + $builder->searchBuilder->clientTransactionId + )); + } + if ($builder->searchBuilder->uniqueDeviceId !== null) { + $criteria->appendChild($xml->createElement( + 'UniqueDeviceId', + $builder->searchBuilder->uniqueDeviceId + )); + } + if ($builder->searchBuilder->accountNumberLastFour !== null) { + $criteria->appendChild($xml->createElement( + 'AcctNbrLastFour', + $builder->searchBuilder->accountNumberLastFour + )); + } + if ($builder->searchBuilder->bankRoutingNumber !== null) { + $criteria->appendChild($xml->createElement( + 'BankRountingNbr', + $builder->searchBuilder->bankRoutingNumber + )); + } + if ($builder->searchBuilder->checkNumber !== null) { + $criteria->appendChild($xml->createElement( + 'CheckNbr', + $builder->searchBuilder->checkNumber + )); + } + if ($builder->searchBuilder->checkFirstName !== null) { + $criteria->appendChild($xml->createElement( + 'CheckFirstName', + $builder->searchBuilder->checkFirstName + )); + } + if ($builder->searchBuilder->checkLastName !== null) { + $criteria->appendChild($xml->createElement( + 'CheckLastName', + $builder->searchBuilder->checkLastName + )); + } + if ($builder->searchBuilder->checkName !== null) { + $criteria->appendChild($xml->createElement( + 'CheckName', + $builder->searchBuilder->checkName + )); + } + if ($builder->searchBuilder->giftCurrency !== null) { + $criteria->appendChild($xml->createElement( + 'GiftCurrency', + $builder->searchBuilder->giftCurrency + )); + } + if ($builder->searchBuilder->giftMaskedAlias !== null) { + $criteria->appendChild($xml->createElement( + 'GiftMaskedAlias', + $builder->searchBuilder->giftMaskedAlias + )); + } + if ($builder->searchBuilder->oneTime !== null) { + $criteria->appendChild($xml->createElement( + 'OneTime', + $builder->searchBuilder->oneTime + )); + } + if ($builder->searchBuilder->paymentMethodKey !== null) { + $criteria->appendChild($xml->createElement( + 'PaymentMethodKey', + $builder->searchBuilder->paymentMethodKey + )); + } + if ($builder->searchBuilder->scheduleId !== null) { + $criteria->appendChild($xml->createElement( + 'ScheduleID', + $builder->searchBuilder->scheduleId + )); + } + if ($builder->searchBuilder->buyerEmailAddress !== null) { + $criteria->appendChild($xml->createElement( + 'BuyerEmailAddress', + $builder->searchBuilder->buyerEmailAddress + )); + } + if ($builder->searchBuilder->altPaymentStatus !== null) { + $criteria->appendChild($xml->createElement( + 'AltPaymentStatus', + $builder->searchBuilder->altPaymentStatus + )); + } + if ($builder->searchBuilder->fullyCaptured !== null) { + $criteria->appendChild($xml->createElement( + 'FullyCapturedInd', + $builder->searchBuilder->fullyCaptured + )); + } + } + } + $response = $this->doTransaction($this->buildEnvelope($xml, $transaction)); + return $this->mapReportResponse($response, $builder); + } + + /** + * Wraps a transaction with a SOAP envelope + * + * @param DOMDocument $xml The current DOMDocument object + * @param DOMElement $transaction The current transaction to wrap + * + * @return DOMElement + */ + protected function buildEnvelope(DOMDocument $xml, DOMElement $transaction) + { + $soapEnvelope = $xml->createElement('soapenv:Envelope'); + $soapEnvelope->setAttribute( + 'xmlns:soapenv', + 'http://schemas.xmlsoap.org/soap/envelope/' + ); + $soapEnvelope->setAttribute('xmlns', static::XML_NAMESPACE); + + $soapBody = $xml->createElement('soapenv:Body'); + $request = $xml->createElement('PosRequest'); + + $version = $xml->createElement('Ver1.0'); + $header = $xml->createElement('Header'); + + if (!empty($this->secretApiKey)) { + $header->appendChild( + $xml->createElement('SecretAPIKey', trim($this->secretApiKey)) + ); + } + if (!empty($this->siteId)) { + $header->appendChild( + $xml->createElement('SiteId', $this->siteId) + ); + } + if (!empty($this->deviceId)) { + $header->appendChild( + $xml->createElement('DeviceId', $this->deviceId) + ); + } + if (!empty($this->licenseId)) { + $header->appendChild( + $xml->createElement('LicenseId', $this->licenseId) + ); + } + if (!empty($this->username)) { + $header->appendChild( + $xml->createElement('UserName', $this->username) + ); + } + if (!empty($this->password)) { + $header->appendChild( + $xml->createElement('Password', $this->password) + ); + } + if (!empty($this->developerId)) { + $header->appendChild( + $xml->createElement('DeveloperID', $this->developerId) + ); + } + if (!empty($this->versionNumber)) { + $header->appendChild( + $xml->createElement('VersionNbr', $this->versionNumber) + ); + } + + $version->appendChild($header); + $transactionElement = $xml->createElement('Transaction'); + $transactionElement->appendChild($xml->importNode($transaction, true)); + $version->appendChild($transactionElement); + + $request->appendChild($version); + $soapBody->appendChild($request); + $soapEnvelope->appendChild($soapBody); + $xml->appendChild($soapEnvelope); + + return $xml->saveXML(); + } + + /** + * Deserializes the gateway's XML response + * + * @param string $rawResponse The XML response + * @param BaseBuilder $builder The original transaction builder + * + * @throws Exception + * @return Transaction + */ + protected function mapResponse($rawResponse, BaseBuilder $builder, $request) + { + $result = new Transaction(); + + // TODO: handle non-200 responses + + $root = $this->xml2object($rawResponse)->{'Ver1.0'}; + $acceptedCodes = ['00', '0', '85', '10']; + + $gatewayRspCode = $this->normalizeResponse((string)$root->Header->GatewayRspCode); + $gatewayRspText = (string)$root->Header->GatewayRspMsg; + + if (!in_array($gatewayRspCode, $acceptedCodes)) { + throw new GatewayException( + sprintf( + 'Unexpected Gateway Response: %s - %s. ', + $gatewayRspCode, + $gatewayRspText + ), + $gatewayRspCode, + $gatewayRspText + ); + } + + $item = $root->Transaction->{$this->mapRequestType($builder)}; + + $result->responseCode = isset($item) && isset($item->RspCode) + ? $this->normalizeResponse((string)$item->RspCode) + : $gatewayRspCode; + $result->responseMessage = isset($item) && isset($item->RspText) + ? (string)$item->RspText + : $gatewayRspText; + + if (isset($item) && isset($item->AuthAmt)) { + $result->authorizedAmount = (string)$item->AuthAmt; + } + + if (isset($item) && isset($item->AvailableBalance)) { + $result->availableBalance = (string)$item->AvailableBalance; + } + + if (isset($item) && isset($item->AVSRsltCode)) { + $result->avsResponseCode = (string)$item->AVSRsltCode; + } + + if (isset($item) && isset($item->AVSRsltText)) { + $result->avsResponseMessage = (string)$item->AVSRsltText; + } + + if (isset($item) && isset($item->BalanceAmt)) { + $result->balanceAmount = (string)$item->BalanceAmt; + } + + if (isset($item) && isset($item->CardType)) { + $result->cardType = (string)$item->CardType; + } + + if (isset($item) && isset($item->CardLast4)) { + $result->cardLast4 = (string)$item->TokenPANLast4; + } + + if (isset($item) && isset($item->CAVVResultCode)) { + $result->cavvResponseCode = (string)$item->CAVVResultCode; + } + + if (isset($item) && isset($item->CPCInd)) { + $result->commercialIndicator = (string)$item->CPCInd; + } + + if (isset($item) && isset($item->CVVRsltCode)) { + $result->cvnResponseCode = (string)$item->CVVRsltCode; + } + + if (isset($item) && isset($item->CVVRsltText)) { + $result->cvnResponseMessage = (string)$item->CVVRsltText; + } + + if (isset($item) && isset($item->EMVIssuerResp)) { + $result->emvIssuerResponse = (string)$item->EMVIssuerResp; + } + + if (isset($item) && isset($item->PointsBalanceAmt)) { + $result->pointsBalanceAmount = (string)$item->PointsBalanceAmt; + } + + if (isset($item) && isset($item->RecurringDataCode)) { + $result->recurringDataCode = (string)$item->RecurringDataCode; + } + + if (isset($item) && isset($item->RefNbr)) { + $result->referenceNumber = (string)$item->RefNbr; + } + + if (isset($item) && isset($item->TxnDescriptor)) { + $result->transactionDescriptor = (string)$item->TxnDescriptor; + } + + if ($builder->paymentMethod !== null) { + $result->transactionReference = new TransactionReference(); + $result->transactionReference->transactionId = (string)$root->Header->GatewayTxnId; + $result->transactionReference->paymentMethodType = $builder->paymentMethod->paymentMethodType; + + if (isset($item) && isset($item->AuthCode)) { + $result->transactionReference->authCode = (string)$item->AuthCode; + } + } + + if (isset($item) && isset($item->CardData)) { + $result->giftCard = new GiftCard(); + $result->giftCard->number = (string)$item->CardData->CardNbr; + $result->giftCard->alias = (string)$item->CardData->Alias; + $result->giftCard->pin = (string)$item->CardData->PIN; + } + + if (isset($root->Header->TokenData) && isset($root->Header->TokenData->TokenValue)) { + $result->token = (string)$root->Header->TokenData->TokenValue; + } + + if (isset($item) && isset($item->BatchId)) { + $result->batchSummary = new BatchSummary(); + $result->batchSummary->id = (string)$item->BatchId; + $result->batchSummary->transactionCount = (string)$item->TxnCnt; + $result->batchSummary->totalAmount = (string)$item->TotalAmt; + $result->batchSummary->sequenceNumber = (string)$item->BatchSeqNbr; + } + + return $result; + } + + protected function mapReportResponse($rawResponse, ReportBuilder $builder) + { + $root = $this->xml2object($rawResponse)->{'Ver1.0'}; + $doc = $root->Transaction->{$this->mapReportType($builder)}; + + if ((($builder->reportType === ReportType::ACTIVITY) + || ($builder->reportType === ReportType::FIND_TRANSACTIONS)) + && isset($doc->Transactions)) { + $response = []; + foreach ($doc->Transactions as $item) { + $response[] = $this->hydrateTransactionSummary($item); + } + return $response; + } + + if ($builder->reportType === ReportType::TRANSACTION_DETAIL) { + return $this->hydrateTransactionSummary($doc->Transactions); + } + + return null; + } + + protected function hydrateTransactionSummary($item) + { + $summary = new TransactionSummary(); + + if (isset($item) && isset($item->AcctDataSrc)) { + $summary->accountDataSource = (string)$item->AcctDataSrc; + } + + if (isset($item) && isset($item->Amt)) { + $summary->amount = (string)$item->Amt; + } + + if (isset($item) && isset($item->AuthAmt)) { + $summary->authorizatedAmount = (string)$item->AuthAmt; + } + + if (isset($item) && isset($item->AuthCode)) { + $summary->authCode = (string)$item->AuthCode; + } + + if (isset($item) && isset($item->BatchCloseDT)) { + $summary->batchCloseDate = (string)$item->BatchCloseDT; + } + + if (isset($item) && isset($item->BatchSeqNbr)) { + $summary->batchSequenceNumber = (string)$item->BatchSeqNbr; + } + + if (isset($item) && isset($item->CardHolderData)) { + if (isset($item->CardHolderData->CardHolderFirstName)) { + $summary->cardHolderFirstName = $item->CardHolderData->CardHolderFirstName; + } + if (isset($item->CardHolderData->CardHolderLastName)) { + $summary->cardHolderLastName = $item->CardHolderData->CardHolderLastName; + } + } + + if (isset($item) && isset($item->CardSwiped)) { + $summary->cardSwiped = (string)$item->CardSwiped; + } + + if (isset($item) && isset($item->CardType)) { + $summary->cardType = (string)$item->CardType; + } + + if (isset($item) && isset($item->ClerkId)) { + $summary->clerkId = (string)$item->ClerkId; + } + + if (isset($item) && isset($item->ClientTxnId)) { + $summary->clientTransactionId = (string)$item->ClientTxnId; + } + + if (isset($item) && isset($item->ConvenienceAmtInfo)) { + $summary->convenienceAmount = (string)$item->ConvenienceAmtInfo; + } + + if (isset($item) && isset($item->DeviceId)) { + $summary->deviceId = (string)$item->DeviceId; + } + + if (isset($item) && isset($item->GratuityAmtInfo)) { + $summary->gratuityAmount = (string)$item->GratuityAmtInfo; + } + + if (isset($item) && (isset($item->RspCode) || isset($item->IssuerRspCode))) { + $summary->issuerResponseCode = + isset($item->RspCode) + ? (string)$item->RspCode + : (string)$item->IssuerRspCode; + } + + if (isset($item) && (isset($item->RspText) || isset($item->IssuerRspText))) { + $summary->issuerResponseMessage = + isset($item->RspText) + ? (string)$item->RspText + : (string)$item->IssuerRspText; + } + + if (isset($item) && isset($item->IssTxnId)) { + $summary->issuerTransactionId = (string)$item->IssTxnId; + } + + if (isset($item) && isset($item->MaskedCardNbr)) { + $summary->maskedCardNumber = (string)$item->MaskedCardNbr; + } + + if (isset($item) && isset($item->OriginalGatewayTxnId)) { + $summary->originalTransactionId = (string)$item->OriginalGatewayTxnId; + } + + if (isset($item) && isset($item->GatewayRspCode)) { + $summary->gatewayResponseCode = $this->normalizeResponse((string)$item->GatewayRspCode); + } + + if (isset($item) && isset($item->GatewayResponseMsg)) { + $summary->gatewayResponseMessage = (string)$item->GatewayResponseMsg; + } + + if (isset($item) && isset($item->PaymentType)) { + $summary->paymentType = (string)$item->PaymentType; + } + + if (isset($item) && isset($item->CardHolderPONbr)) { + $summary->poNumber = (string)$item->CardHolderPONbr; + } + + if (isset($item) && isset($item->RefNbr)) { + $summary->referenceNumber = (string)$item->RefNbr; + } + + if (isset($item) && isset($item->RspDT)) { + $summary->responseDate = (string)$item->RspDT; + } + + if (isset($item) && isset($item->ServiceName)) { + $summary->serviceName = (string)$item->ServiceName; + } + + if (isset($item) && isset($item->SettlementAmt)) { + $summary->settlementAmount = (string)$item->SettlementAmt; + } + + if (isset($item) && isset($item->ShippingAmtInfo)) { + $summary->shippingAmount = (string)$item->ShippingAmtInfo; + } + + if (isset($item) && isset($item->SiteTrace)) { + $summary->siteTrace = (string)$item->SiteTrace; + } + + if (isset($item) && (isset($item->TxnStatus) || isset($item->Status))) { + $summary->status = isset($item->TxnStatus) ? (string)$item->TxnStatus : (string)$item->Status; + } + + if (isset($item) && (isset($item->TaxAmtInfo) || isset($item->TaxAmt))) { + $summary->taxAmount = isset($item->TaxAmtInfo) ? (string)$item->TaxAmtInfo : (string)$item->TaxAmt; + } + + if (isset($item) && isset($item->TaxType)) { + $summary->taxType = (string)$item->TaxType; + } + + if (isset($item) && (isset($item->TxnUtcDT) || isset($item->ReqUtcDT))) { + $summary->transactionDate = isset($item->TxnUtcDT) ? (string)$item->TxnUtcDT : (string)$item->ReqUtcDT; + } + + if (isset($item) && isset($item->GatewayTxnId)) { + $summary->transactionId = (string)$item->GatewayTxnId; + } + + if (isset($item) && isset($item->TxnStatus)) { + $summary->transactionStatus = (string)$item->TxnStatus; + } + + if (isset($item) && isset($item->UserName)) { + $summary->userName = (string)$item->UserName; + } + + if (isset($item) && isset($item->AdditionalTxnFields)) { + if (isset($item->AdditionalTxnFields->Description)) { + $summary->description = (string)$item->AdditionalTxnFields->Description; + } + + if (isset($item->AdditionalTxnFields->InvoiceNbr)) { + $summary->invoiceNumber = (string)$item->AdditionalTxnFields->InvoiceNbr; + } + + if (isset($item->AdditionalTxnFields->CustomerID)) { + $summary->customerId = (string)$item->AdditionalTxnFields->CustomerID; + } + } + + if (isset($item) && isset($item->UniqueDeviceId)) { + $summary->uniqueDeviceId = (string)$item->UniqueDeviceId; + } + + if (isset($item) && isset($item->AdditionalTxnFields->TxnDescriptor)) { + $summary->transactionDescriptor = (string)$item->AdditionalTxnFields->TxnDescriptor; + } + + if (isset($item) && isset($item->GiftCurrency)) { + $summary->giftCurrency = (string)$item->GiftCurrency; + } + + if (isset($item) && isset($item->GiftMaskedAlias)) { + $summary->maskedAlias = (string)$item->GiftMaskedAlias; + } + + if (isset($item) && isset($item->PaymentMethodKey)) { + $summary->paymentMethodKey = (string)$item->PaymentMethodKey; + } + + if (isset($item) && isset($item->ScheduleID)) { + $summary->scheduleId = (string)$item->ScheduleID; + } + + if (isset($item) && isset($item->OneTime)) { + $summary->oneTimePayment = (string)$item->OneTime; + } + + if (isset($item) && isset($item->RecurringDataCode)) { + $summary->recurringDataCode = (string)$item->RecurringDataCode; + } + + if (isset($item) && isset($item->SurchargeAmtInfo)) { + $summary->surchargeAmount = (string)$item->SurchargeAmtInfo; + } + + if (isset($item) && isset($item->FraudInfoRule)) { + $summary->fraudRuleInfo = (string)$item->UserNFraudInfoRuleame; + } + + if (isset($item) && isset($item->RepeatCount)) { + $summary->repeatCount = (string)$item->RepeatCount; + } + + if (isset($item) && isset($item->EMVChipCondition)) { + $summary->emvChipCondition = (string)$item->EMVChipCondition; + } + + if (isset($item) && isset($item->HasEMVTag)) { + $summary->hasEmvTags = (string)$item->HasEMVTag; + } + + if (isset($item) && isset($item->HasEcomPaymentData)) { + $summary->hasEcomPaymentData = (string)$item->HasEcomPaymentData; + } + + if (isset($item) && isset($item->CAVVResultCode)) { + $summary->cavvResponseCode = (string)$item->CAVVResultCode; + } + + if (isset($item) && isset($item->TokenPANLast4)) { + $summary->tokenPanLastFour = (string)$item->TokenPANLast4; + } + + if (isset($item) && isset($item->Company)) { + $summary->companyName = (string)$item->Company; + } + + if (isset($item) && isset($item->CustomerFirstname)) { + $summary->customerFirstName = (string)$item->CustomerFirstname; + } + + if (isset($item) && isset($item->CustomerLastName)) { + $summary->customerLastName = (string)$item->CustomerLastName; + } + + if (isset($item) && isset($item->DebtRepaymentIndicator)) { + $summary->debtRepaymentIndicator = (string)$item->DebtRepaymentIndicator; + } + + if (isset($item) && isset($item->CaptureAmtInfo)) { + $summary->captureAmount = (string)$item->CaptureAmtInfo; + } + + if (isset($item) && isset($item->FullyCapturedInd)) { + $summary->fullyCaptured = (string)$item->FullyCapturedInd; + } + + // lodging data + if (isset($item) && isset($item->LodgingData)) { + $summary->lodgingData = new LodgingData(); + $summary->lodgingData->prestigiousPropertyLimit = (string)$item->LodgingData->PrestigiousPropertyLimit; + $summary->lodgingData->noShow = (string)$item->LodgingData->NoShow; + $summary->lodgingData->advancedDepositType = (string)$item->LodgingData->AdvancedDepositType; + $summary->lodgingData->lodgingDataEdit = (string)$item->LodgingData->LodgingDataEdit; + $summary->lodgingData->preferredCustomer = (string)$item->LodgingData->PreferredCustomer; + } + + // check data + if (isset($item) && isset($item->CheckData)) { + $summary->checkData = new CheckData(); + $summary->checkData->accountInfo = $item->CheckData->AccountInfo; + $summary->checkData->consumerInfo = $item->CheckData->ConsumerInfo; + $summary->checkData->dataEntryMode = (string)$item->CheckData->DataEntryMode; + $summary->checkData->checkType = (string)$item->CheckData->CheckType; + $summary->checkData->secCode = (string)$item->CheckData->SECCode; + $summary->checkData->checkAction = (string)$item->CheckData->CheckAction; + } + + // alt payment data + if (isset($item) && isset($item->AltPaymentData)) { + $summary->altPaymentData = new AltPaymentData(); + $summary->altPaymentData->buyerEmailAddress = (string)$item->AltPaymentData->BuyerEmailAddress; + $summary->altPaymentData->stateDate = (string)$item->AltPaymentData->StatusDT; + $summary->altPaymentData->status = (string)$item->AltPaymentData->Status; + $summary->altPaymentData->statusMessage = (string)$item->AltPaymentData->StatusMsg; + + $summary->altPaymentData->processorResponseInfo = new AltPaymentProcessorInfo(); + foreach ($summary->altPaymentData->processorResponseInfo as $info) { + $pri = new AltPaymentProcessorInfo(); + $pri->code = (string)$info->Code; + $pri->message = (string)$info->Message; + $pri->type = (string)$info->Type; + $summary->altPaymentData->processorResponseInfo->add($pri); + } + } + + return $summary; + } + + /** + * Maps a transaction builder to a Portico request type + * + * @param BaseBuilder $builder Transaction builder + * + * @return string + */ + protected function mapRequestType(BaseBuilder $builder) + { + switch ($builder->transactionType) { + case TransactionType::BATCH_CLOSE: + return 'BatchClose'; + case TransactionType::DECLINE: + if ($builder->paymentMethod->paymentMethodType === PaymentMethodType::GIFT) { + return 'GiftCardDeactivate'; + } elseif ($builder->transactionModifier === TransactionModifier::CHIP_DECLINE) { + return 'ChipCardDecline'; + } elseif ($builder->transactionModifier === TransactionModifier::FRAUD_DECLINE) { + return 'OverrideFraudDecline'; + } + throw new NotImplementedException(); + case TransactionType::VERIFY: + if ($builder->transactionModifier === TransactionModifier::ENCRYPTED_MOBILE) { + throw new UnsupportedTransactionException('Transaction not supported for this payment method.'); + } + return 'CreditAccountVerify'; + case TransactionType::CAPTURE: + return 'CreditAddToBatch'; + case TransactionType::AUTH: + if ($builder->paymentMethod->paymentMethodType === PaymentMethodType::CREDIT) { + if ($builder->transactionModifier === TransactionModifier::ADDITIONAL) { + return 'CreditAdditionalAuth'; + } elseif ($builder->transactionModifier === TransactionModifier::INCREMENTAL) { + return 'CreditIncrementalAuth'; + } elseif ($builder->transactionModifier === TransactionModifier::OFFLINE) { + return 'CreditOfflineAuth'; + } elseif ($builder->transactionModifier == TransactionModifier::RECURRING) { + return 'RecurringBillingAuth'; + } elseif ($builder->transactionModifier === TransactionModifier::ENCRYPTED_MOBILE) { + throw new UnsupportedTransactionException('Transaction not supported for this payment method.'); + } + + return 'CreditAuth'; + } elseif ($builder->paymentMethod->paymentMethodType === PaymentMethodType::RECURRING) { + return 'RecurringBillingAuth'; + } + throw new UnsupportedTransactionException('Transaction not supported for this payment method.'); + case TransactionType::SALE: + if ($builder->paymentMethod->paymentMethodType === PaymentMethodType::CREDIT) { + if ($builder->transactionModifier === TransactionModifier::OFFLINE) { + return 'CreditOfflineSale'; + } elseif ($builder->transactionModifier === TransactionModifier::ENCRYPTED_MOBILE) { + throw new UnsupportedTransactionException('Transaction not supported for this payment method.'); + } elseif ($builder->transactionModifier == TransactionModifier::RECURRING) { + return 'RecurringBilling'; + } else { + return 'CreditSale'; + } + } elseif ($builder->paymentMethod->paymentMethodType == PaymentMethodType::RECURRING) { + if ($builder->paymentMethod->paymentType == 'ACH') { + return 'CheckSale'; + } + return 'RecurringBilling'; + } elseif ($builder->paymentMethod->paymentMethodType === PaymentMethodType::DEBIT) { + return 'DebitSale'; + } elseif ($builder->paymentMethod->paymentMethodType === PaymentMethodType::CASH) { + return 'CashSale'; + } elseif ($builder->paymentMethod->paymentMethodType === PaymentMethodType::ACH) { + return 'CheckSale'; + } elseif ($builder->paymentMethod->paymentMethodType === PaymentMethodType::EBT) { + if ($builder->transactionModifier === TransactionModifier::CASH_BACK) { + return 'EBTCashBackPurchase'; + } elseif ($builder->transactionModifier === TransactionModifier::VOUCHER) { + return 'EBTVoucherPurchase'; + } else { + return 'EBTFSPurchase'; + } + } elseif ($builder->paymentMethod->paymentMethodType === PaymentMethodType::GIFT) { + return 'GiftCardSale'; + } + throw new UnsupportedTransactionException('Transaction not supported for this payment method.'); + case TransactionType::REFUND: + if ($builder->paymentMethod->paymentMethodType === PaymentMethodType::CREDIT) { + return 'CreditReturn'; + } elseif ($builder->paymentMethod->paymentMethodType === PaymentMethodType::DEBIT) { + return 'DebitReturn'; + } elseif ($builder->paymentMethod->paymentMethodType === PaymentMethodType::CASH) { + return 'CashReturn'; + } elseif ($builder->paymentMethod->paymentMethodType === PaymentMethodType::EBT) { + return 'EBTFSReturn'; + } + throw new UnsupportedTransactionException('Transaction not supported for this payment method.'); + case TransactionType::REVERSAL: + if ($builder->paymentMethod->paymentMethodType === PaymentMethodType::CREDIT) { + return 'CreditReversal'; + } elseif ($builder->paymentMethod->paymentMethodType === PaymentMethodType::DEBIT) { + return 'DebitReversal'; + } elseif ($builder->paymentMethod->paymentMethodType === PaymentMethodType::GIFT) { + return 'GiftCardReversal'; + } + throw new UnsupportedTransactionException('Transaction not supported for this payment method.'); + case TransactionType::EDIT: + if ($builder->transactionModifier === TransactionModifier::LEVEL_II) { + return 'CreditCPCEdit'; + } else { + return 'CreditTxnEdit'; + } + break; + case TransactionType::VOID: + if ($builder->paymentMethod->paymentMethodType === PaymentMethodType::CREDIT) { + return 'CreditVoid'; + } elseif ($builder->paymentMethod->paymentMethodType === PaymentMethodType::ACH) { + return 'CheckVoid'; + } elseif ($builder->paymentMethod->paymentMethodType === PaymentMethodType::GIFT) { + return 'GiftCardVoid'; + } + throw new UnsupportedTransactionException('Transaction not supported for this payment method.'); + case TransactionType::ADD_VALUE: + if ($builder->paymentMethod->paymentMethodType === PaymentMethodType::CREDIT) { + return 'PrePaidAddValue'; + } elseif ($builder->paymentMethod->paymentMethodType === PaymentMethodType::DEBIT) { + return 'DebitAddValue'; + } elseif ($builder->paymentMethod->paymentMethodType === PaymentMethodType::GIFT) { + return 'GiftCardAddValue'; + } + throw new UnsupportedTransactionException('Transaction not supported for this payment method.'); + case TransactionType::BALANCE: + if ($builder->paymentMethod->paymentMethodType === PaymentMethodType::CREDIT) { + return 'PrePaidBalanceInquiry'; + } elseif ($builder->paymentMethod->paymentMethodType === PaymentMethodType::EBT) { + return 'EBTBalanceInquiry'; + } elseif ($builder->paymentMethod->paymentMethodType === PaymentMethodType::GIFT) { + return 'GiftCardBalance'; + } + throw new UnsupportedTransactionException('Transaction not supported for this payment method.'); + case TransactionType::ACTIVATE: + return 'GiftCardActivate'; + case TransactionType::ALIAS: + return 'GiftCardAlias'; + case TransactionType::REPLACE: + return 'GiftCardReplace'; + case TransactionType::REWARD: + return 'GiftCardReward'; + case TransactionType::TOKEN_DELETE: + case TransactionType::TOKEN_UPDATE: + return 'ManageTokens'; + default: + break; + } + + throw new UnsupportedTransactionException('Unknown transaction'); + } + + protected function mapReportType(ReportBuilder $builder) + { + switch ($builder->reportType) { + case ReportType::ACTIVITY: + case ReportType::TRANSACTION_DETAIL: + case ReportType::FIND_TRANSACTIONS: + return 'FindTransactions'; + default: + throw new UnsupportedTransactionException(); + } + } + + /** + * Converts a XML string to a simple object for use, + * removing extra nodes that are not necessary for + * handling the response + * + * @param string $xml Response XML from the gateway + * + * @return \SimpleXMLElement + */ + protected function xml2object($xml) + { + $envelope = simplexml_load_string( + $xml, + 'SimpleXMLElement', + 0, + 'http://schemas.xmlsoap.org/soap/envelope/' + ); + + foreach ($envelope->Body as $response) { + $children = $response->children(static::XML_NAMESPACE); + foreach ($children as $item) { + return $item; + } + } + + throw new Exception('XML from gateway could not be parsed'); + } + + /** + * Tests the payment method for a token value + * + * @param IPaymentMethod $paymentMethod The payment method + * + * @return [bool, string|null] + */ + protected function hasToken(IPaymentMethod $paymentMethod) + { + $tokenValue = null; + + if ($paymentMethod instanceof ITokenizable && !empty($paymentMethod->token)) { + $tokenValue = $paymentMethod->token; + return [true, $tokenValue]; + } + + return [false, $tokenValue]; + } + + /** + * Normalizes response code for success responses + * + * @param string $input Original response code + * + * @return string + */ + protected function normalizeResponse($input) + { + if (in_array($input, ['0', '85'])) { + $input = '00'; + } + + return $input; + } + + /** + * Serializes builder information into XML + * + * @param DOMDocument $xml XML instance + * @param BaseBuilder $builder Request builder + * @param bool $isCheck If payment method is ACH + * + * @return DOMElement + */ + protected function hydrateHolder(DOMDocument $xml, BaseBuilder $builder, $isCheck = false) + { + $holder = $xml->createElement($isCheck ? 'ConsumerInfo' : 'CardHolderData'); + + if ($isCheck && $builder->paymentMethod instanceof RecurringPaymentMethod) { + return null; + } + + if ($builder->billingAddress !== null) { + $holder->appendChild( + $xml->createElement($isCheck ? 'Address1' : 'CardHolderAddr', $builder->billingAddress->streetAddress1) + ); + $holder->appendChild( + $xml->createElement($isCheck ? 'City' : 'CardHolderCity', $builder->billingAddress->city) + ); + $holder->appendChild( + $xml->createElement($isCheck ? 'State' : 'CardHolderState', $builder->billingAddress->getProvince()) + ); + $holder->appendChild( + $xml->createElement($isCheck ? 'Zip' : 'CardHolderZip', $builder->billingAddress->postalCode) + ); + } + + $propertyName = $isCheck ? 'checkHolderName' : 'cardHolderName'; + if (!empty($builder->paymentMethod->{$propertyName})) { + $names = explode(' ', $builder->paymentMethod->{$propertyName}, 2); + $holder->appendChild( + $xml->createElement($isCheck ? 'FirstName' : 'CardHolderFirstName', $names[0]) + ); + + if (isset($names[1])) { + $holder->appendChild( + $xml->createElement($isCheck ? 'LastName' : 'CardHolderLastName', $names[1]) + ); + } + } + + if ($isCheck) { + if ($builder->paymentMethod->checkHolderName !== null) { + $holder->appendChild($xml->createElement('CheckName', $builder->paymentMethod->checkHolderName)); + } + + if ($builder->paymentMethod->phoneNumber !== null) { + $holder->appendChild($xml->createElement('PhoneNumber', $builder->paymentMethod->phoneNumber)); + } + + if ($builder->paymentMethod->driversLicenseNumber !== null) { + $holder->appendChild($xml->createElement('DLNumber', $builder->paymentMethod->driversLicenseNumber)); + } + + if ($builder->paymentMethod->driversLicenseState !== null) { + $holder->appendChild($xml->createElement('DLState', $builder->paymentMethod->driversLicenseState)); + } + + if ($builder->paymentMethod->ssnLast4 !== null + || $builder->paymentMethod->birthYear !== null + ) { + $identity = $xml->createElement('IdentityInfo'); + $identity->appendChild($xml->createElement('SSNL4', $builder->paymentMethod->ssnLast4)); + $identity->appendChild($xml->createElement('DOBYear', $builder->paymentMethod->birthYear)); + $holder->appendChild($identity); + } + } + + return $holder; + } + + protected function hydrateAccountType($type) + { + switch ($type) { + case AccountType::CHECKING: + return 'CHECKING'; + case AccountType::SAVINGS: + return 'SAVINGS'; + } + } + + /** + * Serializes builder information into XML + * + * @param DOMDocument $xml XML instance + * @param BaseBuilder $builder Request builder + * + * @return DOMElement + */ + protected function hydrateAdditionalTxnFields(DOMDocument $xml, BaseBuilder $builder) + { + $additionalTxnFields = $xml->createElement('AdditionalTxnFields'); + + if ($builder->description !== null && $builder->description !== '') { + $additionalTxnFields->appendChild( + $xml->createElement('Description', $builder->description) + ); + } + + if ($builder->invoiceNumber !== null && $builder->invoiceNumber !== '') { + $additionalTxnFields->appendChild( + $xml->createElement('InvoiceNbr', $builder->invoiceNumber) + ); + } + + if ($builder->customerId !== null && $builder->customerId !== '') { + $additionalTxnFields->appendChild( + $xml->createElement('CustomerID', $builder->customerId) + ); + } + + return $additionalTxnFields; + } + + protected function hydrateCheckType($type) + { + switch ($type) { + case CheckType::PERSONAL: + return 'PERSONAL'; + case CheckType::BUSINESS: + return 'BUSINESS'; + case CheckType::PAYROLL: + return 'PAYROLL'; + } + } + + /** + * Serializes builder information into XML + * + * @param DOMDocument $xml XML instance + * @param BaseBuilder $builder Request builder + * + * @return DOMElement + */ + protected function hydrateEncryptionData(DOMDocument $xml, BaseBuilder $builder) + { + $enc = $xml->createElement('EncryptionData'); + + if ($builder->paymentMethod->encryptionData->version !== null) { + $enc->appendChild($xml->createElement('Version', $builder->paymentMethod->encryptionData->version)); + } + + if ($builder->paymentMethod->encryptionData->trackNumber !== null) { + $enc->appendChild($xml->createElement('TrackNumber', $builder->paymentMethod->encryptionData->trackNumber)); + } + + if ($builder->paymentMethod->encryptionData->ktb !== null) { + $enc->appendChild($xml->createElement('KTB', $builder->paymentMethod->encryptionData->ktb)); + } + + if ($builder->paymentMethod->encryptionData->ksn !== null) { + $enc->appendChild($xml->createElement('KSN', $builder->paymentMethod->encryptionData->ksn)); + } + + return $enc; + } + + protected function hydrateEntryMethod($method) + { + switch ($method) { + case EntryMethod::MANUAL: + return 'Manual'; + case EntryMethod::SWIPE: + return 'Swipe'; + case EntryMethod::PROXIMITY: + return 'Proximity'; + } + } + + /** + * Serializes builder information into XML + * + * @param DOMDocument $xml XML instance + * @param BaseBuilder $builder Request builder + * @param bool $hasToken If request builder is using token data + * @param string $tokenValue Token if `$hasToken` is `true` + * + * @return DOMElement + */ + protected function hydrateManualEntry(DOMDocument $xml, BaseBuilder $builder, $hasToken = false, $tokenValue = null) + { + if ($hasToken) { + $me = $xml->createElement('TokenData'); + } else { + $me = $xml->createElement('ManualEntry'); + } + + if ($hasToken || isset($builder->paymentMethod->number)) { + $me->appendChild( + $xml->createElement( + $hasToken ? 'TokenValue' : 'CardNbr', + $hasToken ? $tokenValue : $builder->paymentMethod->number + ) + ); + } + + if (isset($builder->paymentMethod->expMonth)) { + $me->appendChild($xml->createElement('ExpMonth', $builder->paymentMethod->expMonth)); + } + + if (isset($builder->paymentMethod->expYear)) { + $me->appendChild($xml->createElement('ExpYear', $builder->paymentMethod->expYear)); + } + + if (isset($builder->paymentMethod->cvn)) { + $me->appendChild($xml->createElement('CVV2', $builder->paymentMethod->cvn)); + } + + $me->appendChild( + $xml->createElement('CardPresent', ($builder->paymentMethod->cardPresent ? 'Y' : 'N')) + ); + + $me->appendChild( + $xml->createElement('ReaderPresent', ($builder->paymentMethod->readerPresent ? 'Y' : 'N')) + ); + + return $me; + } + + /** + * Serializes builder information into XML + * + * @param DOMDocument $xml XML instance + * @param BaseBuilder $builder Request builder + * @param bool $hasToken If request builder is using token data + * @param string $tokenValue Token if `$hasToken` is `true` + * + * @return DOMElement + */ + protected function hydrateTrackData(DOMDocument $xml, BaseBuilder $builder, $hasToken = false, $tokenValue = null) + { + $trackData = $xml->createElement($hasToken ? 'TokenValue' : 'TrackData'); + + if ($hasToken) { + $trackData->appendChild($xml->createElement('TokenValue', $tokenValue)); + return $trackData; + } + + $trackData->appendChild($xml->createTextNode($builder->paymentMethod->value)); + if ($builder->paymentMethod->paymentMethodType !== PaymentMethodType::DEBIT) { + $trackData->setAttribute( + 'method', + $builder->paymentMethod->entryMethod === EntryMethod::SWIPE + ? 'swipe' + : 'proximity' + ); + } + + return $trackData; + } + + public function supportsHostedPayments() + { + return $this->supportsHostedPayments; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Gateways/RealexConnector.php b/lib/vendor/globalpayments/php-sdk/src/Gateways/RealexConnector.php new file mode 100644 index 0000000..47b30f4 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Gateways/RealexConnector.php @@ -0,0 +1,1413 @@ +transactionModifier) && + $builder->transactionModifier === TransactionModifier::ENCRYPTED_MOBILE && + $builder->paymentMethod->mobileType === EncyptedMobileType::GOOGLE_PAY && + (empty($builder->amount) || empty($builder->currency)) + ) { + throw new BuilderException("Amount and Currency cannot be null for google payment"); + } + + $xml = new DOMDocument(); + $timestamp = isset($builder->timestamp) ? $builder->timestamp : GenerationUtils::generateTimestamp(); + $orderId = isset($builder->orderId) ? $builder->orderId : GenerationUtils::generateOrderId(); + $transactionType = $this->mapAuthRequestType($builder); + + // Build Request + $request = $xml->createElement("request"); + $request->setAttribute("timestamp", $timestamp); + $request->setAttribute("type", $transactionType); + + $request->appendChild($xml->createElement("merchantid", $this->merchantId)); + + if ($this->accountId !== null) { + $request->appendChild($xml->createElement("account", $this->accountId)); + } + if ($this->channel !== null) { + $request->appendChild($xml->createElement("channel", $this->channel)); + } + + $request->appendChild($xml->createElement("orderid", $orderId)); + + if (isset($builder->amount)) { + $amount = $xml->createElement("amount", preg_replace('/[^0-9]/', '', sprintf('%01.2f', $builder->amount))); + $amount->setAttribute("currency", $builder->currency); + $request->appendChild($amount); + } + + // This needs to be figured out based on txn type and set to 0, 1 or MULTI + if ($builder->transactionType === TransactionType::SALE || $builder->transactionType == TransactionType::AUTH) { + $autoSettle = $builder->transactionType === TransactionType::SALE ? "1" : "0"; + $element = $xml->createElement("autosettle"); + $element->setAttribute("flag", $autoSettle); + $request->appendChild($element); + } + + // For Fraud Decision Manager + if (!empty($builder->customerData)) { + $customerValue = $builder->customerData; + $customer = $xml->createElement("customer"); + $customer->appendChild($xml->createElement("customerid", $customerValue->id)); + $customer->appendChild($xml->createElement("firstname", $customerValue->firstName)); + $customer->appendChild($xml->createElement("lastname", $customerValue->lastName)); + $customer->appendChild($xml->createElement("dateofbirth", $customerValue->dateOfBirth)); + $customer->appendChild($xml->createElement("customerpassword", $customerValue->customerPassword)); + $customer->appendChild($xml->createElement("email", $customerValue->email)); + $customer->appendChild($xml->createElement("domainname", $customerValue->domainName)); + $customer->appendChild($xml->createElement("devicefingerprint", $customerValue->deviceFingerPrint)); + $customer->appendChild($xml->createElement("phonenumber", $customerValue->homePhone)); + $request->appendChild($customer); + } + + if (!empty($builder->productData)) { + $prod = []; + $productValues = $builder->productData; + $products = $xml->createElement("products"); + + foreach ($productValues as $prod) { + $product = $xml->createElement("product"); + $product->appendChild($xml->createElement('product_id', $prod['product_id'])); + $product->appendChild($xml->createElement('productname', $prod['productname'])); + $product->appendChild($xml->createElement('quantity', $prod['quantity'])); + $product->appendChild($xml->createElement('unitprice', $prod['unitprice'])); + $product->appendChild($xml->createElement('gift', $prod['gift'])); + $product->appendChild($xml->createElement('type', $prod['type'])); + $product->appendChild($xml->createElement('risk', $prod['risk'])); + $product->appendChild($products); + $request->appendChild($product); + } + } + + if ($builder->decisionManager !== null) { + $dmValues = $builder->decisionManager; + $fraud = $xml->createElement("fraud"); + $dm = $fraud->appendChild($xml->createElement('dm')); + $dm->appendChild($xml->createElement('billtohostname', $dmValues->billToHostName)); + $dm->appendChild($xml->createElement( + 'billtohttpbrowsercookiesaccepted', + ($dmValues->billToHttpBrowserCookiesAccepted) != true ? 'false' : 'true' + )); + $dm->appendChild($xml->createElement('billtohttpbrowseremail', $dmValues->billToHttpBrowserEmail)); + $dm->appendChild($xml->createElement('billtohttpbrowsertype', $dmValues->billToHttpBrowserType)); + $dm->appendChild($xml->createElement('billtoipnetworkaddress', $dmValues->billToIpNetworkAddress)); + $dm->appendChild($xml->createElement( + 'businessrulesscorethreshold', + $dmValues->businessRulessCoreThresHold + )); + $dm->appendChild($xml->createElement('billtopersonalid', $dmValues->billToPersonalId)); + $dm->appendChild($xml->createElement('invoiceheadertendertype', $dmValues->invoiceHeaderTenderType)); + $dm->appendChild($xml->createElement( + 'invoiceheaderisgift', + ($dmValues->invoiceHeaderIsGift) != true ? 'false' : 'true' + )); + $dm->appendChild($xml->createElement('decisionmanagerprofile', $dmValues->decisionManagerProfile)); + $dm->appendChild($xml->createElement( + 'invoiceheaderreturnsaccepted', + ($dmValues->invoiceHeaderReturnsAccepted) != true ? 'false' : 'true' + )); + $dm->appendChild($xml->createElement('itemhosthedge', $dmValues->itemHostHedge)); + $dm->appendChild($xml->createElement('itemnonsensicalhedge', $dmValues->itemNonsensicalHedge)); + $dm->appendChild($xml->createElement('itemobscenitieshedge', $dmValues->itemObscenitiesHedge)); + $dm->appendChild($xml->createElement('itemphonehedge', $dmValues->itemPhoneHedge)); + $dm->appendChild($xml->createElement('itemtimehedge', $dmValues->itemTimeHedge)); + $dm->appendChild($xml->createElement('itemvelocityhedge', $dmValues->itemVelocityHedge)); + $request->appendChild($dm); + } + + if (!empty($builder->customData)) { + $cust = []; + $customValues = $builder->customData; + $custom = $xml->createElement("custom"); + + foreach ($customValues as $cust) { + $custom->appendChild($xml->createElement('field01', $cust['field01'])); + $custom->appendChild($xml->createElement('field02', $cust['field02'])); + $custom->appendChild($xml->createElement('field03', $cust['field03'])); + $custom->appendChild($xml->createElement('field04', $cust['field04'])); + $request->appendChild($custom); + } + } + + // For DCC rate lookup + if ($builder->transactionType === TransactionType::DCC_RATE_LOOKUP) { + $dccinfo = $xml->createElement("dccinfo"); + $dccinfo->appendChild($xml->createElement("ccp", $builder->dccProcessor)); + $dccinfo->appendChild($xml->createElement("type", $builder->dccType)); + $dccinfo->appendChild($xml->createElement("ratetype", $builder->dccRateType)); + $request->appendChild($dccinfo); + } + + // For DCC charge/auth + if (!empty($builder->dccRateData)) { + $dccinfo = $xml->createElement("dccinfo"); + + $amount = $xml->createElement("amount", preg_replace('/[^0-9]/', '', $builder->dccRateData->amount)); + $amount->setAttribute("currency", $builder->dccRateData->currency); + + $dccinfo->appendChild($amount); + $dccinfo->appendChild($xml->createElement("ccp", $builder->dccRateData->dccProcessor)); + $dccinfo->appendChild($xml->createElement("type", $builder->dccRateData->dccType)); + $dccinfo->appendChild($xml->createElement("rate", $builder->dccRateData->dccRate)); + $dccinfo->appendChild($xml->createElement("ratetype", $builder->dccRateData->dccRateType)); + $request->appendChild($dccinfo); + } + + // Hydrate the payment data fields + if ($builder->paymentMethod instanceof CreditCardData) { + $card = $builder->paymentMethod; + + if ($builder->transactionModifier === TransactionModifier::ENCRYPTED_MOBILE) { + $request->appendChild($xml->createElement("token", $card->token)); + $request->appendChild($xml->createElement("mobile", $card->mobileType)); + } else { + $cardElement = $xml->createElement("card"); + $cardElement->appendChild($xml->createElement("number", $card->number)); + $cardElement->appendChild($xml->createElement("expdate", $card->getShortExpiry())); + $cardElement->appendChild($xml->createElement("chname", $card->cardHolderName)); + $cardElement->appendChild($xml->createElement("type", strtoupper($card->getCardType()))); + + if ($card->cvn !== null) { + //if cvn number is not empty indicator should be PRESENT + $cvnPresenceIndicator = (!empty($card->cvn)) ? + CvnPresenceIndicator::PRESENT: + $card->cvnPresenceIndicator; + + $cvnElement = $xml->createElement("cvn"); + $cvnElement->appendChild($xml->createElement("number", $card->cvn)); + $cvnElement->appendChild($xml->createElement("presind", $cvnPresenceIndicator)); + $cardElement->appendChild($cvnElement); + } + $request->appendChild($cardElement); + } + // issueno + $hash = ''; + if ($builder->transactionType === TransactionType::VERIFY) { + $hash = GenerationUtils::generateHash( + $this->sharedSecret, + implode('.', [ + $timestamp, + $this->merchantId, + $orderId, + $card->number + ]) + ); + } else { + $requestValues = $this->getShal1RequestValues($timestamp, $orderId, $builder, $card); + + $hash = GenerationUtils::generateHash( + $this->sharedSecret, + implode('.', $requestValues) + ); + } + + $request->appendChild($xml->createElement("sha1hash", $hash)); + } + if ($builder->paymentMethod instanceof RecurringPaymentMethod) { + $recurring = $builder->paymentMethod; + $request->appendChild($xml->createElement("payerref", $recurring->customerKey)); + $request->appendChild($xml->createElement( + "paymentmethod", + isset($recurring->key) ? $recurring->key : $recurring->id + )); + + if ($builder->cvn !== null && $builder->cvn !== '') { + $paymentData = $xml->createElement("paymentdata"); + $cvn = $xml->createElement("cvn"); + $cvn->appendChild($xml->createElement("number", $builder->cvn)); + $paymentData->appendChild($cvn); + $request->appendChild($paymentData); + } + + $hash = ''; + if ($builder->transactionType === TransactionType::VERIFY) { + if (!empty($builder->transactionModifier) && + $builder->transactionModifier === TransactionModifier::SECURE3D) { + $hash = GenerationUtils::generateHash( + $this->sharedSecret, + implode('.', [ + $timestamp, + $this->merchantId, + $orderId, + preg_replace('/[^0-9]/', '', sprintf('%01.2f', $builder->amount)), + $builder->currency, + $recurring->customerKey, + ]) + ); + } else { + $hash = GenerationUtils::generateHash( + $this->sharedSecret, + implode('.', [ + $timestamp, + $this->merchantId, + $orderId, + $recurring->customerKey, + ]) + ); + } + } else { + $hash = GenerationUtils::generateHash( + $this->sharedSecret, + implode('.', [ + $timestamp, + $this->merchantId, + $orderId, + preg_replace('/[^0-9]/', '', sprintf('%01.2f', $builder->amount)), + $builder->currency, + $recurring->customerKey, + ]) + ); + } + $request->appendChild($xml->createElement("sha1hash", $hash)); + } else { + // TODO: Token Processing + //$request->appendChild($xml->createElement("sha1hash", GenerateHash(order, token)); + } + + // refund hash + if ($builder->transactionType === TransactionType::REFUND) { + $request->appendChild($xml->createElement( + "refundhash", + GenerationUtils::generateHash($this->refundPassword) ?: '' + )); + } + + + + if ($builder->paymentMethod instanceof AlternativePaymentMethod) { + $this->buildAlternativePaymentMethod($builder, $request, $xml); + } + + // comment ...TODO: needs to be multiple + if ($builder->description != null) { + $comments = $xml->createElement("comments"); + $comment = $xml->createElement("comment", $builder->description); + $comment->setAttribute("id", "1"); + $comments->appendChild($comment); + + $request->appendChild($comments); + } + + if ($builder->paymentMethod instanceof AlternativePaymentMethod) { + $hash = GenerationUtils::generateHash( + $this->sharedSecret, + implode('.', [ + $timestamp, + $this->merchantId, + $orderId, + preg_replace('/[^0-9]/', '', sprintf('%01.2f', $builder->amount)), + $builder->currency, + $builder->paymentMethod->alternativePaymentMethodType, + ]) + ); + $request->appendChild($xml->createElement("sha1hash", $hash)); + } + + if ($builder->recurringType !== null || $builder->recurringSequence !== null) { + $recurring = $xml->createElement("recurring"); + $recurring->setAttribute("type", strtolower($builder->recurringType)); + $recurring->setAttribute("sequence", strtolower($builder->recurringSequence)); + $request->appendChild($recurring); + } + + // fraud filter + $this->buildFraudFilter($builder, $xml, $request); + + // tssinfo + + // stored credential + if ($builder->storedCredential != null) { + $storedCredential = $xml->createElement("storedcredential"); + $storedCredential->appendChild($xml->createElement("type", $builder->storedCredential->type)); + $storedCredential->appendChild($xml->createElement("initiator", $builder->storedCredential->initiator)); + $storedCredential->appendChild($xml->createElement("sequence", $builder->storedCredential->sequence)); + $storedCredential->appendChild($xml->createElement("srd", $builder->storedCredential->schemeId)); + $request->appendChild($storedCredential); + } + + // mpi + $secureEcom = $builder->paymentMethod->threeDSecure; + if (!empty($secureEcom)) { + $mpi = $xml->createElement("mpi"); + $mpi->appendChild($xml->createElement("eci", $secureEcom->eci)); + $mpi->appendChild($xml->createElement("cavv", $secureEcom->cavv)); + $mpi->appendChild($xml->createElement("xid", $secureEcom->xid)); + + if ($secureEcom->directoryServerTransactionId != null || $secureEcom->authenticationValue != null || $secureEcom->messageVersion != null) { + $mpi->appendChild($xml->createElement("ds_trans_id", $secureEcom->directoryServerTransactionId)); + $mpi->appendChild($xml->createElement("authentication_value", $secureEcom->authenticationValue)); + $mpi->appendChild($xml->createElement("message_version", $secureEcom->messageVersion)); + } + $request->appendChild($mpi); + } + + $acceptedResponseCodes = $this->mapAcceptedCodes($transactionType); + $response = $this->doTransaction($xml->saveXML($request)); + return $this->mapResponse($response, $acceptedResponseCodes); + } + + /** + * @return Transaction + */ + public function processSecure3d(Secure3dBuilder $builder) + { + $transType = $builder->getTransactionType(); + + if ($transType === TransactionType::VERIFY_ENROLLED) { + $authBuilder = (new AuthorizationBuilder($transType, $builder->getPaymentMethod())) + ->withAmount($builder->getAmount()) + ->withCurrency($builder->getCurrency()) + ->withOrderId($builder->getOrderId()); + + return $this->processAuthorization($authBuilder); + } elseif ($transType === TransactionType::VERIFY_SIGNATURE) { + // Get our three d secure object + $secureEcom = $builder->getThreeDSecure(); + + // Create our transaction reference + $reference = new TransactionReference(); + $reference->orderId = $secureEcom->getOrderId(); + + $managementBuilder = (new ManagementBuilder($transType)) + ->withAmount($secureEcom->getAmount()) + ->withCurrency($secureEcom->getCurrency()) + ->withPayerAuthenticationResponse($builder->getPayerAuthenticationResponse()) + ->withPaymentMethod($reference); + return $this->manageTransaction($managementBuilder); + } + throw new UnsupportedTransactionException(sprintf("Unknown transaction type %s", $transType)); + } + + public function serializeRequest(AuthorizationBuilder $builder) + { + // check for hpp config + if ($this->hostedPaymentConfig === null) { + throw new ApiException("Hosted configuration missing, Please check you configuration."); + } + + // check for right transaction types + if ($builder->transactionType !== TransactionType::SALE + && $builder->transactionType !== TransactionType::AUTH + && $builder->transactionType !== TransactionType::VERIFY + ) { + throw new UnsupportedTransactionException("Only Charge and Authorize are supported through HPP."); + } + + $orderId = isset($builder->orderId) ? $builder->orderId : GenerationUtils::generateOrderId(); + $timestamp = isset($builder->timestamp) ? $builder->timestamp : GenerationUtils::generateTimestamp(); + + $this->setSerializeData('MERCHANT_ID', $this->merchantId); + $this->setSerializeData('ACCOUNT', $this->accountId); + $this->setSerializeData('CHANNEL', $this->channel); + $this->setSerializeData('ORDER_ID', $orderId); + if ($builder->amount !== null) { + $this->setSerializeData('AMOUNT', preg_replace('/[^0-9]/', '', sprintf('%01.2f', $builder->amount))); + } + $this->setSerializeData('CURRENCY', $builder->currency); + $this->setSerializeData('TIMESTAMP', $timestamp); + $this->setSerializeData( + 'AUTO_SETTLE_FLAG', + ($builder->transactionType == TransactionType::SALE) ? "1" : "0" + ); + $this->setSerializeData('COMMENT1', $builder->description); + + if (isset($this->hostedPaymentConfig->requestTransactionStabilityScore)) { + $this->serializeData["RETURN_TSS"] = + $this->hostedPaymentConfig->requestTransactionStabilityScore ? "1" : "0"; + } + if (isset($this->hostedPaymentConfig->directCurrencyConversionEnabled)) { + $this->serializeData["DCC_ENABLE"] = + $this->hostedPaymentConfig->directCurrencyConversionEnabled ? "1" : "0"; + } + if (!empty($builder->hostedPaymentData)) { + $this->setSerializeData('CUST_NUM', $builder->hostedPaymentData->customerNumber); + + if (!empty($this->hostedPaymentConfig->displaySavedCards) && + !empty($builder->hostedPaymentData->customerKey)) { + $this->setSerializeData('HPP_SELECT_STORED_CARD', $builder->hostedPaymentData->customerKey); + } + + if (isset($builder->hostedPaymentData->offerToSaveCard)) { + $this->setSerializeData( + 'OFFER_SAVE_CARD', + $builder->hostedPaymentData->offerToSaveCard ? "1" : "0" + ); + } + if (isset($builder->hostedPaymentData->customerExists)) { + $this->setSerializeData( + 'PAYER_EXIST', + $builder->hostedPaymentData->customerExists ? "1" : "0" + ); + } + if (isset($builder->hostedPaymentData->customerKey)) { + $this->setSerializeData('PAYER_REF', $builder->hostedPaymentData->customerKey); + } + if (isset($builder->hostedPaymentData->paymentKey)) { + $this->setSerializeData('PMT_REF', $builder->hostedPaymentData->paymentKey); + } + if (isset($builder->hostedPaymentData->productId)) { + $this->setSerializeData('PROD_ID', $builder->hostedPaymentData->productId); + } + } elseif (isset($builder->customerId)) { + $this->setSerializeData('CUST_NUM', $builder->customerId); + } + if (!empty($builder->shippingAddress)) { + // Fraud values + $this->setSerializeData('SHIPPING_CODE', $builder->shippingAddress->postalCode); + $this->setSerializeData('SHIPPING_CO', $builder->shippingAddress->country); + + // 3DS 2.0 values + $this->setSerializeData('HPP_SHIPPING_STREET1', $builder->shippingAddress->streetAddress1); + $this->setSerializeData('HPP_SHIPPING_STREET2', $builder->shippingAddress->streetAddress2); + $this->setSerializeData('HPP_SHIPPING_STREET3', $builder->shippingAddress->streetAddress3); + $this->setSerializeData('HPP_SHIPPING_CITY', $builder->shippingAddress->city); + $this->setSerializeData('HPP_SHIPPING_STATE', $builder->shippingAddress->state); + $this->setSerializeData('HPP_SHIPPING_POSTALCODE', $builder->shippingAddress->postalCode); + $this->setSerializeData('HPP_SHIPPING_COUNTRY', $builder->shippingAddress->country); + } + if (!empty($builder->billingAddress)) { + // Fraud values + $this->setSerializeData('BILLING_CODE', $builder->billingAddress->postalCode); + $this->setSerializeData('BILLING_CO', $builder->billingAddress->country); + + // 3DS 2.0 values + $this->setSerializeData('HPP_BILLING_STREET1', $builder->billingAddress->streetAddress1); + $this->setSerializeData('HPP_BILLING_STREET2', $builder->billingAddress->streetAddress2); + $this->setSerializeData('HPP_BILLING_STREET3', $builder->billingAddress->streetAddress3); + $this->setSerializeData('HPP_BILLING_CITY', $builder->billingAddress->city); + $this->setSerializeData('HPP_BILLING_STATE', $builder->billingAddress->state); + $this->setSerializeData('HPP_BILLING_POSTALCODE', $builder->billingAddress->postalCode); + $this->setSerializeData('HPP_BILLING_COUNTRY', $builder->billingAddress->country); + } + + $this->setSerializeData('VAR_REF', $builder->clientTransactionId); + $this->setSerializeData('HPP_LANG', $this->hostedPaymentConfig->language); + $this->setSerializeData('MERCHANT_RESPONSE_URL', $this->hostedPaymentConfig->responseUrl); + $this->setSerializeData('CARD_PAYMENT_BUTTON', $this->hostedPaymentConfig->paymentButtonText); + if (!empty($builder->hostedPaymentData)) { + $this->setSerializeData('HPP_CUSTOMER_EMAIL', $builder->hostedPaymentData->customerEmail); + $this->setSerializeData('HPP_CUSTOMER_PHONENUMBER_MOBILE', $builder->hostedPaymentData->customerPhoneMobile); + $this->setSerializeData('HPP_CHALLENGE_REQUEST_INDICATOR', $builder->hostedPaymentData->challengeRequest); + if (isset($builder->hostedPaymentData->addressesMatch)) { + $this->setSerializeData('HPP_ADDRESS_MATCH_INDICATOR', $builder->hostedPaymentData->addressesMatch ? 'TRUE' : 'FALSE'); + } + } + if (isset($this->hostedPaymentConfig->cardStorageEnabled)) { + $this->setSerializeData('CARD_STORAGE_ENABLE', $this->hostedPaymentConfig->cardStorageEnabled ? '1' : '0'); + } + if ($builder->transactionType === TransactionType::VERIFY) { + $this->setSerializeData( + 'VALIDATE_CARD_ONLY', + $builder->transactionType === TransactionType::VERIFY ? '1' : '0' + ); + } + if (!empty($this->hostedPaymentConfig->FraudFilterMode)) { + $this->setSerializeData('HPP_FRAUD_FILTER_MODE', $this->hostedPaymentConfig->FraudFilterMode); + } + + if ($builder->recurringType !== null || $builder->recurringSequence !== null) { + $this->setSerializeData('RECURRING_TYPE', strtolower($builder->recurringType)); + $this->setSerializeData('RECURRING_SEQUENCE', strtolower($builder->recurringSequence)); + } + if (isset($this->hostedPaymentConfig->version)) { + $this->setSerializeData('HPP_VERSION', $this->hostedPaymentConfig->version); + } + + $toHash = [ + $timestamp, + $this->merchantId, + $orderId, + ($builder->amount !== null) ? preg_replace('/[^0-9]/', '', sprintf('%01.2f', $builder->amount)) : null, + $builder->currency, + ]; + + if ($this->hostedPaymentConfig->cardStorageEnabled + || ($builder->hostedPaymentData != null + && $builder->hostedPaymentData->offerToSaveCard) + || $this->hostedPaymentConfig->displaySavedCards + ) { + $toHash[] = ($builder->hostedPaymentData->customerKey !== null) ? + $builder->hostedPaymentData->customerKey : + null; + $toHash[] = ($builder->hostedPaymentData->paymentKey !== null) ? + $builder->hostedPaymentData->paymentKey : + null; + } + + if ($this->hostedPaymentConfig->fraudFilterMode !== FraudFilterMode::NONE) { + $toHash[] = $this->hostedPaymentConfig->fraudFilterMode; + } + + $this->serializeData["SHA1HASH"] = GenerationUtils::generateHash($this->sharedSecret, implode('.', $toHash)); + return GenerationUtils::convertArrayToJson($this->serializeData, $this->hostedPaymentConfig->version); + } + + /** + * {@inheritdoc} + * + * @param ManagementBuilder $builder The transaction's builder + * + * @return Transaction + */ + public function manageTransaction(ManagementBuilder $builder) + { + $xml = new DOMDocument(); + $timestamp = GenerationUtils::generateTimestamp(); + $orderId = $builder->orderId ?: GenerationUtils::generateOrderId(); + $transactionType = $this->mapManageRequestType($builder); + // Build Request + $request = $xml->createElement("request"); + $request->setAttribute("timestamp", $timestamp); + $request->setAttribute("type", $transactionType); + + $request->appendChild($xml->createElement("merchantid", $this->merchantId)); + + if ($this->accountId !== null) { + $request->appendChild($xml->createElement("account", $this->accountId)); + } + if (is_null($builder->alternativePaymentType)) { + $request->appendChild($xml->createElement("channel", $this->channel)); + } + + if ($builder->amount !== null) { + $amount = $xml->createElement("amount", preg_replace('/[^0-9]/', '', sprintf('%01.2f', $builder->amount))); + $amount->setAttribute("currency", $builder->currency); + $request->appendChild($amount); + } elseif ($builder->transactionType === TransactionType::CAPTURE) { + throw new BuilderException("Amount cannot be null for capture."); + } + + $request->appendChild($xml->createElement("orderid", $orderId)); + $request->appendChild($xml->createElement("pasref", $builder->transactionId)); + + // rebate hash + if ($builder->transactionType === TransactionType::REFUND && + is_null($builder->alternativePaymentType)) { + $request->appendChild($xml->createElement("authcode", $builder->paymentMethod->authCode)); + } + + // reason code + if ($builder->reasonCode !== null) { + $request->appendChild($xml->createElement("reasoncode", $builder->reasonCode)); + } + + if ($builder->alternativePaymentType !== null) { + $request->appendChild($xml->createElement("paymentmethod", $builder->alternativePaymentType)); + } + + if ($builder->transactionType === TransactionType::VERIFY_SIGNATURE) { + $request->appendChild($xml->createElement("pares", $builder->payerAuthenticationResponse)); + } + + // comments needs to be multiple + if ($builder->description !== null) { + $comments = $xml->createElement("comments"); + $comment = $xml->createElement("comment", $builder->description); + $comment->setAttribute("id", "1"); + $comments->appendChild($comment); + $request->appendChild($comments); + } + + $toHash = [ + $timestamp, + $this->merchantId, + $orderId, + ($builder->amount !== null ? preg_replace('/[^0-9]/', '', sprintf('%01.2f', $builder->amount)) : ''), + ($builder->currency !== null ? $builder->currency : ''), + ($builder->alternativePaymentType !== null ? $builder->alternativePaymentType : '') + ]; + + $request->appendChild( + $xml->createElement( + "sha1hash", + GenerationUtils::generateHash($this->sharedSecret, implode('.', $toHash)) + ) + ); + + // rebate hash + if ($builder->transactionType === TransactionType::REFUND) { + $request->appendChild( + $xml->createElement( + "refundhash", + GenerationUtils::generateHash(isset($this->rebatePassword) ? $this->rebatePassword : '') + ) + ); + } + + $response = $this->doTransaction($xml->saveXML($request)); + return $this->mapResponse($response, $this->mapAcceptedCodes($transactionType)); + } + + public function processReport(ReportBuilder $builder) + { + throw new UnsupportedTransactionException( + 'Reporting functionality is not supported through this gateway.' + ); + } + + public function processRecurring(RecurringBuilder $builder) + { + $xml = new DOMDocument(); + $timestamp = GenerationUtils::generateTimestamp(); + $orderId = $builder->orderId ? $builder->orderId : GenerationUtils::generateOrderId(); + + // Build Request + $request = $xml->createElement("request"); + $request->setAttribute("timestamp", $timestamp); + $request->setAttribute("type", $this->mapRecurringRequestType($builder)); + + $request->appendChild($xml->createElement("merchantid", $this->merchantId)); + + if ($this->accountId !== null) { + $request->appendChild($xml->createElement("account", $this->accountId)); + } + $request->appendChild($xml->createElement("channel", $this->channel)); + $request->appendChild($xml->createElement("orderid", $orderId)); + + if ($builder->transactionType == TransactionType::CREATE || + $builder->transactionType == TransactionType::EDIT) { + if ($builder->entity instanceof Customer) { + $hash = GenerationUtils::generateHash( + $this->sharedSecret, + implode('.', [ + $timestamp, + $this->merchantId, + $orderId, + '', + '', + $builder->entity->key + ]) + ); + + $request->appendChild($this->buildCustomer($xml, $builder)); + } elseif ($builder->entity instanceof RecurringPaymentMethod) { + $payment = $builder->entity; + $paymentKey = (!empty($payment->key)) ? $payment->key : $payment->id; + + if ($builder->transactionType == TransactionType::CREATE) { + $hash = GenerationUtils::generateHash( + $this->sharedSecret, + implode('.', [ + $timestamp, + $this->merchantId, + $orderId, + '', + '', + $payment->customerKey, + $payment->paymentMethod->cardHolderName, + $payment->paymentMethod->number + ]) + ); + } else { + $hash = GenerationUtils::generateHash( + $this->sharedSecret, + implode('.', [ + $timestamp, + $this->merchantId, + $payment->customerKey, + $paymentKey, + $payment->paymentMethod->getShortExpiry(), + $payment->paymentMethod->number + ]) + ); + } + $request->appendChild($this->buildCardElement($xml, $payment, $paymentKey)); + $request->appendChild($xml->createElement("defaultcard", 1)); + } + + //set hash value + $request->appendChild($xml->createElement("sha1hash", $hash)); + } elseif ($builder->transactionType == TransactionType::DELETE) { + if ($builder->entity instanceof RecurringPaymentMethod) { + $payment = $builder->entity; + $paymentKey = (!empty($payment->key)) ? $payment->key : $payment->id; + $cardElement = $xml->createElement("card"); + $cardElement->appendChild($xml->createElement("ref", $paymentKey)); + $cardElement->appendChild($xml->createElement("payerref", $payment->customerKey)); + $request->appendChild($cardElement); + + $hash = GenerationUtils::generateHash( + $this->sharedSecret, + implode('.', [ + $timestamp, + $this->merchantId, + $payment->customerKey, + $paymentKey + ]) + ); + $request->appendChild($xml->createElement("sha1hash", $hash)); + } + } + + $response = $this->doTransaction($xml->saveXML($request)); + return $this->mapResponse($response); + } + + private function buildCustomer($xml, $builder) + { + $customer = $builder->entity; + $type = 'Retail'; + if ($builder->transactionType === TransactionType::EDIT) { + $type = 'Subscriber'; + } + $payer = $xml->createElement("payer"); + $payer->setAttribute("ref", (!empty($customer->key)) ? $customer->key : + GenerationUtils::generateRecurringKey()); + $payer->setAttribute("type", $type); + + $payer->appendChild($xml->createElement("title", $customer->title)); + $payer->appendChild($xml->createElement("firstname", $customer->firstName)); + $payer->appendChild($xml->createElement("surname", $customer->lastName)); + $payer->appendChild($xml->createElement("company", $customer->company)); + + + if ($customer->address != null) { + $address = $xml->createElement("address"); + $address->appendChild($xml->createElement("line1", $customer->address->streetAddress1)); + $address->appendChild($xml->createElement("line2", $customer->address->streetAddress2)); + $address->appendChild($xml->createElement("line3", $customer->address->streetAddress3)); + $address->appendChild($xml->createElement("city", $customer->address->city)); + $address->appendChild($xml->createElement("county", $customer->address->getProvince())); + $address->appendChild($xml->createElement("postcode", $customer->address->postalCode)); + + $country = $xml->createElement("country", $customer->address->country); + if (!empty($customer->address->countryCode)) { + $country->setAttribute("code", $customer->address->countryCode); + } + $address->appendChild($country); + + $payer->appendChild($address); + } + + $phonenumbers = $xml->createElement("phonenumbers"); + $phonenumbers->appendChild($xml->createElement("home", $customer->homePhone)); + $phonenumbers->appendChild($xml->createElement("work", $customer->workPhone)); + $phonenumbers->appendChild($xml->createElement("fax", $customer->fax)); + $phonenumbers->appendChild($xml->createElement("mobile", $customer->mobilePhone)); + + $payer->appendChild($phonenumbers); + $payer->appendChild($xml->createElement("email", $customer->email)); + + return $payer; + } + + private function buildCardElement($xml, $payment, $paymentKey = '') + { + $card = $payment->paymentMethod; + $cardElement = $xml->createElement("card"); + $cardElement->appendChild($xml->createElement("ref", $paymentKey)); + $cardElement->appendChild($xml->createElement("payerref", $payment->customerKey)); + $cardElement->appendChild($xml->createElement("number", $card->number)); + $cardElement->appendChild($xml->createElement("expdate", $card->getShortExpiry())); + $cardElement->appendChild($xml->createElement("chname", $card->cardHolderName)); + $cardElement->appendChild($xml->createElement("type", strtoupper($card->getCardType()))); + + return $cardElement; + } + + /** + * Deserializes the gateway's XML response + * + * @param string $rawResponse The XML response + * + * @return Transaction + */ + protected function mapResponse($rawResponse, array $acceptedCodes = null) + { + $result = new Transaction(); + + $root = $this->xml2object($rawResponse); + + $this->checkResponse($root, $acceptedCodes); + + $result->responseCode = (string)$root->result; + $result->responseMessage = (string)$root->message; + $result->cvnResponseCode = (string)$root->cvnresult; + $result->avsResponseCode = (string)$root->avspostcoderesponse; + $result->avsAddressResponse = (string)$root->avsaddressresponse; + $result->transactionReference = new TransactionReference(); + $result->transactionReference->paymentMethodType = PaymentMethodType::CREDIT; + $result->transactionReference->transactionId = (string)$root->pasref; + $result->transactionReference->authCode = (string)$root->authcode; + $result->transactionReference->orderId = (string)$root->orderid; + $result->timestamp = (!empty($root->attributes()->timestamp)) ? + (string) $root->attributes()->timestamp : + ''; + + // 3d secure enrolled + if (!empty($root->enrolled)) { + $result->threeDSecure = new ThreeDSecure(); + $result->threeDSecure->enrolled = (string)$root->enrolled; + $result->threeDSecure->xid = (string)$root->xid; + $result->threeDSecure->issuerAcsUrl = (string)$root->url; + $result->threeDSecure->payerAuthenticationRequest = (string)$root->pareq; + } + + // 3d secure signature + if (!empty($root->threedsecure)) { + $secureEcom = new ThreeDSecure(); + $secureEcom->status = (string)$root->threedsecure->status; + $secureEcom->eci = (string)$root->threedsecure->eci; + $secureEcom->cavv = (string)$root->threedsecure->cavv; + $secureEcom->xid = (string)$root->threedsecure->xid; + $secureEcom->algorithm = (int)$root->threedsecure->algorithm; + $result->threeDSecure = $secureEcom; + } + + // stored credential + $result->schemeId = (string)$root->srd; + + // dccinfo + if (!empty($root->dccinfo)) { + $result->dccResponseResult = new DccResponseResult(); + + $result->dccResponseResult->cardHolderCurrency = (string)$root->dccinfo->cardholdercurrency; + $result->dccResponseResult->cardHolderAmount = (string)$root->dccinfo->cardholderamount; + $result->dccResponseResult->cardHolderRate = (string)$root->dccinfo->cardholderrate; + $result->dccResponseResult->merchantCurrency = (string)$root->dccinfo->merchantcurrency; + $result->dccResponseResult->merchantAmount = (string)$root->dccinfo->merchantamount; + $result->dccResponseResult->marginRatePercentage = (string)$root->dccinfo->marginratepercentage; + $result->dccResponseResult->exchangeRateSourceName = (string)$root->dccinfo->exchangeratesourcename; + $result->dccResponseResult->commissionPercentage = (string)$root->dccinfo->commissionpercentage; + $result->dccResponseResult->exchangeRateSourceTimestamp = (string) + $root->dccinfo->exchangeratesourcetimestamp; + } + + // fraud filter + if (!empty($root->fraudresponse)) { + $fraudResponse = $root->fraudresponse; + $result->fraudFilterResponse = new FraudManagementResponse(); + + foreach ($fraudResponse->attributes() as $attrName => $attrValue) { + $result->fraudFilterResponse->fraudResponseMode = (!empty($attrValue)) ? (string) $attrValue : ''; + } + + $result->fraudFilterResponse->fraudResponseResult = (!empty($fraudResponse->result)) ? + (string) $fraudResponse->result : ''; + + if (!empty($fraudResponse->rules)) { + foreach ($fraudResponse->rules->rule as $rule) { + $ruleDetails = [ + 'id' => (string) $rule->attributes()->id, + 'name' => (string) $rule->attributes()->name, + 'action' => (string) $rule->action + ]; + $result->fraudFilterResponse->fraudResponseRules[] = $ruleDetails; + } + } + } + + // alternativePaymentResponse + if (!empty($root->paymentmethoddetails)) { + $result->alternativePaymentResponse = new AlternativePaymentResponse(); + + $result->alternativePaymentResponse->paymentMethod = (string) + $root->paymentmethoddetails->paymentmethod; + $result->alternativePaymentResponse->bankAccount = (string) + $root->paymentmethoddetails->bankaccount; + $result->alternativePaymentResponse->accountHolderName = (string) + $root->paymentmethoddetails->accountholdername; + $result->alternativePaymentResponse->country = (string) + $root->paymentmethoddetails->country; + $result->alternativePaymentResponse->redirectUrl = (string) + $root->paymentmethoddetails->redirecturl; + $result->alternativePaymentResponse->paymentPurpose = (string) + $root->paymentmethoddetails->paymentpurpose; + } + + return $result; + } + + protected function checkResponse($root, array $acceptedCodes = null) + { + if ($acceptedCodes === null) { + $acceptedCodes = [ "00" ]; + } + + $responseCode = (string)$root->result; + $responseMessage = (string)$root->message; + + if (!in_array($responseCode, $acceptedCodes)) { + throw new GatewayException( + sprintf('Unexpected Gateway Response: %s - %s', $responseCode, $responseMessage), + $responseCode, + $responseMessage + ); + } + } + + /** + * Generates a request hash from the request data + * + * @param string $timestamp Request timestamp + * @param string $orderId Request order ID + * @param string $amount Request amount + * @param string $currency Request currency + * @param string $paymentData Request payment data + * @param bool $verify Is request a verify transaction + * + * @return string + */ + protected function generateHash( + $timestamp, + $orderId, + $amount, + $currency, + $paymentData = null, + $verify = false + ) { + $data = [ + $timestamp, + $this->merchantId, + $orderId, + ]; + + if (false === $verify) { + $data[] = $amount; + $data[] = $currency; + } + + $data[] = $paymentData; + + return GenerationUtils::generateHash( + $this->sharedSecret, + implode('.', $data) + ); + } + + /** + * Maps a transaction builder to a Realex request type + * + * @param AuthorizationBuilder $builder Transaction builder + * + * @return string + */ + protected function mapAuthRequestType(AuthorizationBuilder $builder) + { + switch ($builder->transactionType) { + case TransactionType::SALE: + case TransactionType::AUTH: + if ($builder->paymentMethod->paymentMethodType == PaymentMethodType::CREDIT) { + if ($builder->transactionModifier === TransactionModifier::OFFLINE) { + return 'offline'; + } elseif ($builder->transactionModifier === TransactionModifier::ENCRYPTED_MOBILE) { + return 'auth-mobile'; + } + } elseif ($builder->paymentMethod->paymentMethodType == PaymentMethodType::RECURRING) { + return (!empty($builder->recurringSequence) && + $builder->recurringSequence == RecurringSequence::FIRST) ? + 'auth' : + 'receipt-in'; + } elseif ($builder->paymentMethod->paymentMethodType == PaymentMethodType::APM) { + return "payment-set"; + } + return 'auth'; + case TransactionType::CAPTURE: + return 'settle'; + case TransactionType::VERIFY: + if ($builder->paymentMethod->paymentMethodType == PaymentMethodType::RECURRING) { + if (!empty($builder->transactionModifier) && + $builder->transactionModifier === TransactionModifier::SECURE3D) { + return 'realvault-3ds-verifyenrolled'; + } + return 'receipt-in-otb'; + } + return 'otb'; + case TransactionType::REFUND: + if ($builder->paymentMethod->paymentMethodType == PaymentMethodType::CREDIT) { + return 'credit'; + } + return 'payment-out'; + case TransactionType::DCC_RATE_LOOKUP: + if ($builder->paymentMethod->paymentMethodType == PaymentMethodType::CREDIT) { + return "dccrate"; + } + return "realvault-dccrate"; + + case TransactionType::REVERSAL: + // TODO: should be customer type + throw new UnsupportedTransactionException( + 'The selected gateway does not support this transaction type.' + ); + case TransactionType::VERIFY_ENROLLED: + return '3ds-verifyenrolled'; + default: + return 'unknown'; + } + } + + /** + * Maps a transaction builder to a Realex request type + * + * @param ManagementBuilder $builder Transaction builder + * + * @return string + */ + protected function mapManageRequestType(ManagementBuilder $builder) + { + switch ($builder->transactionType) { + case TransactionType::CAPTURE: + return 'settle'; + case TransactionType::HOLD: + return 'hold'; + case TransactionType::REFUND: + if ($builder->alternativePaymentType !== null) { + return 'payment-credit'; + } + return 'rebate'; + case TransactionType::RELEASE: + return 'release'; + case TransactionType::VOID: + case TransactionType::REVERSAL: + return 'void'; + case TransactionType::VERIFY_SIGNATURE: + return '3ds-verifysig'; + default: + return 'unknown'; + } + } + + /** + * Maps a transaction builder to a Realex request type + * + * @param RecurringBuilder $builder Transaction builder + * + * @return string + */ + private function mapRecurringRequestType(RecurringBuilder $builder) + { + $entity = $builder->entity; + + switch ($builder->transactionType) { + case TransactionType::CREATE: + if ($entity instanceof Customer) { + return "payer-new"; + } elseif ($entity instanceof RecurringPaymentMethod) { + return "card-new"; + } + throw new UnsupportedTransactionException( + 'The selected gateway does not support this transaction type.' + ); + case TransactionType::EDIT: + if ($entity instanceof Customer) { + return "payer-edit"; + } elseif ($entity instanceof RecurringPaymentMethod) { + return "card-update-card"; + } + throw new UnsupportedTransactionException(); + case TransactionType::DELETE: + if ($entity instanceof RecurringPaymentMethod) { + return "card-cancel-card"; + } + throw new UnsupportedTransactionException( + 'The selected gateway does not support this transaction type.' + ); + default: + throw new UnsupportedTransactionException( + 'The selected gateway does not support this transaction type.' + ); + } + } + + /** + * Converts a XML string to a simple object for use, + * removing extra nodes that are not necessary for + * handling the response + * + * @param string $xml Response XML from the gateway + * + * @return SimpleXMLElement + */ + protected function xml2object($xml) + { + $envelope = simplexml_load_string( + $xml, + 'SimpleXMLElement' + ); + + return $envelope; + } + + /** + * Return the request values for Shal hash generation based on transaction type + * EncyptedMobileType::GOOGLE_PAY requires amount and currency with token + * EncyptedMobileType::APPLE_PAY doesn't requires amount and currency. token contains those values + * + * @param string $timestamp current timestamp + * @param int $orderId current order id + * @param object $builder auth builder object + * @param object $card + * + * @return array + */ + private function getShal1RequestValues($timestamp, $orderId, $builder, $card) + { + $requestValues = [ + $timestamp, + $this->merchantId, + $orderId, + preg_replace('/[^0-9]/', '', sprintf('%01.2f', $builder->amount)), + $builder->currency, + $card->number + ]; + + if (($builder->transactionModifier === TransactionModifier::ENCRYPTED_MOBILE)) { + switch ($card->mobileType) { + case EncyptedMobileType::GOOGLE_PAY: + $requestValues = [ + $timestamp, + $this->merchantId, + $orderId, + preg_replace('/[^0-9]/', '', sprintf('%01.2f', $builder->amount)), + $builder->currency, + $card->token + ]; + break; + + case EncyptedMobileType::APPLE_PAY: + $requestValues = [ + $timestamp, + $this->merchantId, + $orderId, + '', + '', + $card->token + ]; + break; + } + } + return $requestValues; + } + + public function buildFraudFilter($builder, $xml, $request) + { + // tssinfo fraudfilter + // fraudfilter + if (!empty($builder->fraudFilter)) { + $fraudFilter = $xml->createElement("fraudfilter"); + $fraudFilter->setAttribute("mode", $builder->fraudFilter); + $request->appendChild($fraudFilter); + } + if ($builder->customerId !== null || $builder->productId !== null || + $builder->clientTransactionId !== null || $builder->verifyAddress !== false + ) { + $tssInfo = $xml->createElement("tssinfo"); + + if (!empty($builder->customerId)) { + $tssInfo->appendChild($xml->createElement("custnum", $builder->customerId)); + } + + if (!empty($builder->productId)) { + $tssInfo->appendChild($xml->createElement("prodid", $builder->productId)); + } + + if (!empty($builder->clientTransactionId)) { + $tssInfo->appendChild($xml->createElement("varref", $builder->clientTransactionId)); + } + + if (!empty($builder->customerIpAddress)) { + $tssInfo->appendChild($xml->createElement("custipaddress", $builder->customerIpAddress)); + } + + if (!empty($builder->billingAddress)) { + $billingAddress = $xml->createElement("address"); + $billingAddress->setAttribute("type", 'billing'); + $billingAddress->appendChild($xml->createElement("code", $builder->billingAddress->postalCode)); + $billingAddress->appendChild($xml->createElement("country", $builder->billingAddress->country)); + $tssInfo->appendChild($billingAddress); + } + + if (!empty($builder->shippingAddress)) { + $shippingAddress = $xml->createElement("address"); + $shippingAddress->setAttribute("type", 'shipping'); + $shippingAddress->appendChild($xml->createElement("code", $builder->shippingAddress->postalCode)); + $shippingAddress->appendChild($xml->createElement("country", $builder->shippingAddress->country)); + $tssInfo->appendChild($shippingAddress); + } + if (!empty($tssInfo->childNodes->length)) { + $request->appendChild($tssInfo); + } + } + return; + } + + public function supportsHostedPayments() + { + return $this->supportsHostedPayments; + } + + + public function buildAlternativePaymentMethod($builder, $request, $xml) + { + $request->appendChild($xml->createElement( + "paymentmethod", + $builder->paymentMethod->alternativePaymentMethodType + )); + + $paymentMethodDetails = $xml->createElement("paymentmethoddetails"); + $paymentMethodDetails->appendChild( + $xml->createElement("returnurl", $builder->paymentMethod->returnUrl) + ); + $paymentMethodDetails->appendChild( + $xml->createElement("statusupdateurl", $builder->paymentMethod->statusUpdateUrl) + ); + + if (!empty($builder->paymentMethod->descriptor)) { + $paymentMethodDetails->appendChild( + $xml->createElement("descriptor", $builder->paymentMethod->descriptor) + ); + } + + $paymentMethodDetails->appendChild($xml->createElement("country", $builder->paymentMethod->country)); + $paymentMethodDetails->appendChild($xml->createElement( + "accountholdername", + $builder->paymentMethod->accountHolderName + )); + + $request->appendChild($paymentMethodDetails); + + return; + } + + private function mapAcceptedCodes($paymentMethodType) + { + switch ($paymentMethodType) { + case "3ds-verifysig": + case "3ds-verifyenrolled": + return ["00", "110"]; + case PaymentMethodType::APM: + return ["01"]; + default: + return ["00"]; + } + } + + private function setSerializeData($key, $value = null) + { + if ($value !== null) { + $this->serializeData[$key] = $value; + } + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Gateways/RestGateway.php b/lib/vendor/globalpayments/php-sdk/src/Gateways/RestGateway.php new file mode 100644 index 0000000..58852cc --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Gateways/RestGateway.php @@ -0,0 +1,46 @@ +|null $queryStringParams + * + * @throws GatewayException + * @return string + */ + protected function doTransaction( + $verb, + $endpoint, + $data = null, + array $queryStringParams = null, + $headers = [] + ) { + $response = $this->sendRequest($verb, $endpoint, $data, $queryStringParams, $headers); + + if (!in_array($response->statusCode, [200, 204])) { + $parsed = json_decode($response->rawResponse); + $error = isset($parsed->error) ? $parsed->error : $parsed; + throw new GatewayException( + sprintf( + 'Status Code: %s - %s', + $response->statusCode, + isset($error->error_description) ? $error->error_description : (isset($error->message) ? $error->message : (string) $error) + ) + ); + } + + return $response->rawResponse; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Gateways/XmlGateway.php b/lib/vendor/globalpayments/php-sdk/src/Gateways/XmlGateway.php new file mode 100644 index 0000000..ceffdd2 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Gateways/XmlGateway.php @@ -0,0 +1,35 @@ +sendRequest('POST', '', $request); + + if (200 !== $response->statusCode) { + throw new GatewayException( + sprintf( + 'Unexpected HTTP status code [%s]', + $response->statusCode + ) + ); + } + + return $response->rawResponse; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/HostedPaymentConfig.php b/lib/vendor/globalpayments/php-sdk/src/HostedPaymentConfig.php new file mode 100644 index 0000000..4a939af --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/HostedPaymentConfig.php @@ -0,0 +1,149 @@ +cardStorageEnabled = $cardStorageEnabled; + } + + public function isDynamicCurrencyConversionEnabled() + { + return $dynamicCurrencyConversionEnabled; + } + + public function setDynamicCurrencyConversionEnabled($directCurrencyConversionEnabled) + { + $this->dynamicCurrencyConversionEnabled = $directCurrencyConversionEnabled; + } + + public function isDisplaySavedCards() + { + return $displaySavedCards; + } + + public function setDisplaySavedCards($displaySavedCards) + { + $this->displaySavedCards = $displaySavedCards; + } + + public function getFraudFilterMode() + { + return $fraudFilterMode; + } + + public function setFraudFilterMode($fraudFilterMode) + { + $this->fraudFilterMode = $fraudFilterMode; + } + + public function getLanguage() + { + return $language; + } + + public function setLanguage($language) + { + $this->language = $language; + } + + public function getPaymentButtonText() + { + return $paymentButtonText; + } + + public function setPaymentButtonText($paymentButtonText) + { + $this->paymentButtonText = $paymentButtonText; + } + + public function getPostDimensions() + { + return $postDimensions; + } + + public function setPostDimensions($postDimensions) + { + $this->postDimensions = $postDimensions; + } + + public function getPostResponse() + { + return $postResponse; + } + + public function setPostResponse($postResponse) + { + $this->postResponse = $postResponse; + } + + public function getResponseUrl() + { + return $responseUrl; + } + + public function setResponseUrl($responseUrl) + { + $this->responseUrl = $responseUrl; + } + + public function isRequestTransactionStabilityScore() + { + return $requestTransactionStabilityScore; + } + + public function setRequestTransactionStabilityScore($requestTransactionStabilityScore) + { + $this->requestTransactionStabilityScore = $requestTransactionStabilityScore; + } + + public function getVersion() + { + return $version; + } + + public function setVersion($version) + { + $this->version = $version; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/AlternativePaymentMethod.php b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/AlternativePaymentMethod.php new file mode 100644 index 0000000..be67ccb --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/AlternativePaymentMethod.php @@ -0,0 +1,109 @@ +alternativePaymentMethodType = $alternativePaymentMethodType; + } + + /** + * This is a mandatory request used to initiate an APM transaction, + * the payment-set is used to advise the payment scheme of the details of a new transaction and + * to retrieve the necessary information required to facilitate authentication + * + * @param string|float $amount Amount to authorize + * + * @return AuthorizationBuilder + */ + public function charge($amount = null) + { + return (new AuthorizationBuilder(TransactionType::SALE, $this)) + ->withModifier(TransactionModifier::ALTERNATIVE_PAYMENT_METHOD) + ->withAmount($amount); + } + + public function addValue($amount = null) + { + throw new NotImplementedException(); + } + + public function refund($amount = null) + { + throw new NotImplementedException(); + } + + public function reverse($amount = null) + { + throw new NotImplementedException(); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/Cash.php b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/Cash.php new file mode 100644 index 0000000..da21145 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/Cash.php @@ -0,0 +1,25 @@ +withAmount($amount != null ? $amount : ($this->threeDSecure != null ? $this->threeDSecure->getAmount() : null)) + ->withCurrency($this->threeDSecure != null ? $this->threeDSecure->getCurrency() : null) + ->withOrderId($this->threeDSecure != null ? $this->threeDSecure->getOrderId() : null) + ->withAmountEstimated($isEstimated); + } + + /** + * Authorizes the payment method and captures the entire authorized amount + * + * @param string|float $amount Amount to authorize + * + * @return AuthorizationBuilder + */ + public function charge($amount = null) + { + return (new AuthorizationBuilder(TransactionType::SALE, $this)) + ->withAmount($amount != null ? $amount : ($this->threeDSecure != null ? $this->threeDSecure->getAmount() : null)) + ->withCurrency($this->threeDSecure != null ? $this->threeDSecure->getCurrency() : null) + ->withOrderId($this->threeDSecure != null ? $this->threeDSecure->getOrderId() : null); + } + + /** + * Adds value to the payment method + * + * @param string|float $amount Amount to add + * + * @return AuthorizationBuilder + */ + public function addValue($amount = null) + { + return (new AuthorizationBuilder(TransactionType::ADD_VALUE, $this)) + ->withAmount($amount); + } + + /** + * Inquires the balance of the payment method + * + * @param InquiryType $inquiry Type of inquiry + * + * @return AuthorizationBuilder + */ + public function balanceInquiry($inquiry = null) + { + return (new AuthorizationBuilder(TransactionType::BALANCE, $this)) + ->withBalanceInquiryType($inquiry); + } + + /** + * Refunds the payment method + * + * @param string|float $amount Amount to refund + * + * @return AuthorizationBuilder + */ + public function refund($amount = null) + { + return (new AuthorizationBuilder(TransactionType::REFUND, $this)) + ->withAmount($amount); + } + + /** + * Reverses the payment method + * + * @param string|float $amount Amount to reverse + * + * @return AuthorizationBuilder + */ + public function reverse($amount = null) + { + return (new AuthorizationBuilder(TransactionType::REVERSAL, $this)) + ->withAmount($amount); + } + + /** + * Verifies the payment method + * + * @return AuthorizationBuilder + */ + public function verify() + { + return new AuthorizationBuilder(TransactionType::VERIFY, $this); + } + + /** + * Tokenizes the payment method + * + * @return AuthorizationBuilder + */ + public function tokenize() + { + return $this->verify() + ->withRequestMultiUseToken(true); + } + + /** + * Updates the token expiry date with the values proced to the card object + * + * @return bool value indicating success/failure + */ + public function updateTokenExpiry() + { + if (empty($this->token)) { + throw new BuilderException('Token cannot be null'); + } + + try { + (new ManagementBuilder(TransactionType::TOKEN_UPDATE)) + ->withPaymentMethod($this) + ->execute(); + return true; + } catch (ApiException $exc) { + return false; + } + } + + /** + * Deletes the token associated with the current card object + * + * @return bool value indicating success/failure + */ + public function deleteToken() { + if (empty($this->token)) { + throw new BuilderException('Token cannot be null'); + } + + try { + (new ManagementBuilder(TransactionType::TOKEN_DELETE)) + ->withPaymentMethod($this) + ->execute(); + return true; + } catch (ApiException $exc) { + return false; + } + } + + public function getDccRate($dccRateType, $amount, $currency, $ccp, $orderId) + { + return (new AuthorizationBuilder(TransactionType::DCC_RATE_LOOKUP, $this)) + ->withAmount($amount) + ->withCurrency($currency) + ->withDccRateType($dccRateType) + ->withDccProcessor($ccp) + ->withDccType("1") + ->withOrderId($orderId) + ->execute(); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/CreditCardData.php b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/CreditCardData.php new file mode 100644 index 0000000..5d709a1 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/CreditCardData.php @@ -0,0 +1,219 @@ + '/^4/', + 'MC' => '/^(5[1-5]|2[2-7])/', + 'Amex' => '/^3[47]/', + 'DinersClub' => '/^3[0689]/', + 'EnRoute' => '/^2(014|149)/', + 'Discover' => '/^6([045]|22)/', + 'Jcb' => '/^35/', + ]; + + /** + * Instantiates a new credit card + * + * @return + */ + public function __construct() + { + $this->cardPresent = false; + $this->readerPresent = false; + $this->cvnPresenceIndicator = CvnPresenceIndicator::NOT_REQUESTED; + } + + /** + * @return string + */ + public function getShortExpiry() + { + if ($this->expMonth != null && $this->expYear != null) { + return sprintf( + '%s%s', + str_pad($this->expMonth, 2, '0', STR_PAD_LEFT), + substr(str_pad($this->expYear, 4, '0', STR_PAD_LEFT), 2, 2) + ); + } + return null; + } + + /** + * Gets a card's type based on the BIN + * + * @return string + */ + public function getCardType() + { + $number = str_replace( + [' ', '-'], + '', + $this->number + ); + + foreach (static::$cardTypes as $type => $regex) { + if (1 === preg_match($regex, $this->number)) { + return $type; + } + } + + return 'Unknown'; + } + + /** + * Verify whether the cardholder is enrolled in 3DS + * + * @return bool + */ + public function verifyEnrolled($amount, $currency, $orderId = null) + { + $response = (new AuthorizationBuilder(TransactionType::VERIFY_ENROLLED, $this)) + ->withAmount($amount) + ->withCurrency($currency) + ->withOrderId($orderId) + ->execute(); + + if (!empty($response->threeDSecure)) { + $secureEcom = $response->threeDSecure; + $secureEcom->setAmount($amount); + $secureEcom->setCurrency($currency); + $secureEcom->setOrderId($response->orderId); + $this->threeDSecure = $secureEcom; + + if (in_array($this->threeDSecure->enrolled, array('N', 'U'))) { + $this->threeDSecure->xid = null; + if ($this->threeDSecure->enrolled == 'N') { + $this->threeDSecure->eci = $this->cardType == 'MC' ? 1 : 6; + } elseif ($this->threeDSecure->enrolled == 'U') { + $this->threeDSecure->eci = $this->cardType == 'MC' ? 0 : 7; + } + } + + return $this->threeDSecure->enrolled == 'Y'; + } + return false; + } + + /** + * @return bool + */ + public function verifySignature($authorizationResponse, $merchantData = null, $amount = null, $currency = null, $orderId = null) + { + if (empty($this->threeDSecure)) { + $this->threeDSecure = new ThreeDSecure(); + } + + if ($merchantData != null) { + $this->threeDSecure->setMerchantData($merchantData); + } + + if ($amount != null) { + $this->threeDSecure->setAmount($amount); + } + + if ($currency != null) { + $this->threeDSecure->setCurrency($currency); + } + + if ($orderId != null) { + $this->threeDSecure->setOrderId($orderId); + } + + $txnReference = new TransactionReference(); + $txnReference->orderId = $this->threeDSecure->getOrderId(); + + $response = (new ManagementBuilder(TransactionType::VERIFY_SIGNATURE)) + ->withAmount($this->threeDSecure->getAmount()) + ->withCurrency($this->threeDSecure->getCurrency()) + ->withPayerAuthenticationResponse($authorizationResponse) + ->withPaymentMethod($txnReference) + ->execute(); + + $this->threeDSecure->status = $response->threeDSecure->status; + $this->threeDSecure->cavv = $response->threeDSecure->cavv; + $this->threeDSecure->algorithm = $response->threeDSecure->algorithm; + $this->threeDSecure->xid = $response->threeDSecure->xid; + + if (in_array($this->threeDSecure->status, array('A', 'Y')) && $response->responseCode == '00') { + $this->threeDSecure->eci = $response->threeDSecure->eci; + return true; + } else { + $this->threeDSecure->eci = $this->cardType == 'MC' ? 0 : 7; + return false; + } + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/CreditTrackData.php b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/CreditTrackData.php new file mode 100644 index 0000000..f15eb35 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/CreditTrackData.php @@ -0,0 +1,11 @@ +withAmount($amount); + } + + /** + * Authorizes the payment method and captures the entire authorized amount + * + * @param string|float $amount Amount to authorize + * + * @return AuthorizationBuilder + */ + public function charge($amount = null) + { + return (new AuthorizationBuilder(TransactionType::SALE, $this)) + ->withAmount($amount); + } + + /** + * Refunds the payment method + * + * @param string|float $amount Amount to refund + * + * @return AuthorizationBuilder + */ + public function refund($amount = null) + { + return (new AuthorizationBuilder(TransactionType::REFUND, $this)) + ->withAmount($amount); + } + + /** + * Reverses the payment method + * + * @param string|float $amount Amount to reverse + * + * @return AuthorizationBuilder + */ + public function reverse($amount = null) + { + return (new AuthorizationBuilder(TransactionType::REVERSAL, $this)) + ->withAmount($amount); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/DebitTrackData.php b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/DebitTrackData.php new file mode 100644 index 0000000..553a705 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/DebitTrackData.php @@ -0,0 +1,11 @@ +withBalanceInquiryType($inquiry) + ->withAmount(0); + } + + /** + * Authorizes the payment method and captures the entire authorized amount + * + * @param string|float $amount Amount to authorize + * + * @return AuthorizationBuilder + */ + public function charge($amount = null) + { + return (new AuthorizationBuilder(TransactionType::SALE, $this)) + ->withAmount($amount); + } + + /** + * Refunds the payment method + * + * @param string|float $amount Amount to refund + * + * @return AuthorizationBuilder + */ + public function refund($amount = null) + { + return (new AuthorizationBuilder(TransactionType::REFUND, $this)) + ->withAmount($amount); + } + + /** + * Reverses the payment method + * + * @param string|float $amount Amount to reverse + * + * @return AuthorizationBuilder + */ + public function reverse($amount = null) + { + throw new NotImplementedException(); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/EBTCardData.php b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/EBTCardData.php new file mode 100644 index 0000000..3d486ac --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/EBTCardData.php @@ -0,0 +1,91 @@ +cardPresent = false; + $this->readerPresent = false; + $this->cvnPresenceIndicator = CvnPresenceIndicator::NOT_REQUESTED; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/EBTTrackData.php b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/EBTTrackData.php new file mode 100644 index 0000000..266c753 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/EBTTrackData.php @@ -0,0 +1,13 @@ +withAmount($amount); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/GiftCard.php b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/GiftCard.php new file mode 100644 index 0000000..9ac78f2 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/GiftCard.php @@ -0,0 +1,256 @@ +withAlias(AliasAction::ADD, $alias); + } + + /** + * Activates the payment method with the given amount + * + * @param string|float $amount Amount to add + * + * @return AuthorizationBuilder + */ + public function activate($amount = null) + { + return (new AuthorizationBuilder(TransactionType::ACTIVATE, $this)) + ->withAmount($amount); + } + + /** + * Adds value to the payment method + * + * @param string|float $amount Amount to add + * + * @return AuthorizationBuilder + */ + public function addValue($amount = null) + { + return (new AuthorizationBuilder(TransactionType::ADD_VALUE, $this)) + ->withAmount($amount); + } + + /** + * Inquires the balance of the payment method + * + * @param InquiryType $inquiry Type of inquiry + * + * @return AuthorizationBuilder + */ + public function balanceInquiry($inquiry = null) + { + return (new AuthorizationBuilder(TransactionType::BALANCE, $this)) + ->withBalanceInquiryType($inquiry); + } + + /** + * Authorizes the payment method and captures the entire authorized amount + * + * @param string|float $amount Amount to authorize + * + * @return AuthorizationBuilder + */ + public function charge($amount = null) + { + return (new AuthorizationBuilder(TransactionType::SALE, $this)) + ->withAmount($amount); + } + + /** + * Deactivates the payment method + * + * @return AuthorizationBuilder + */ + public function deactivate() + { + return new AuthorizationBuilder(TransactionType::DECLINE, $this); + } + + /** + * Removes an alias to the payment method + * + * @param string $alias Alias to remove + * + * @return AuthorizationBuilder + */ + public function removeAlias($alias = null) + { + return (new AuthorizationBuilder(TransactionType::ALIAS, $this)) + ->withAlias(AliasAction::DELETE, $alias); + } + + /** + * Replaces the payment method with the given one + * + * @param GiftCard $newCard Replacement gift card + * + * @return AuthorizationBuilder + */ + public function replaceWith($newCard = null) + { + return (new AuthorizationBuilder(TransactionType::REPLACE, $this)) + ->withReplacementCard($newCard); + } + + /** + * Reverses the payment method + * + * @param string|float $amount Amount to reverse + * + * @return AuthorizationBuilder + */ + public function reverse($amount = null) + { + return (new AuthorizationBuilder(TransactionType::REVERSAL, $this)) + ->withAmount($amount); + } + + /** + * Rewards the payment method + * + * @param string|float $amount Amount to reward + * + * @return AuthorizationBuilder + */ + public function rewards($amount = null) + { + return (new AuthorizationBuilder(TransactionType::REWARD, $this)) + ->withAmount($amount); + } + + /** + * Creates a new payment method + * + * @param string $alias Alias to use + * + * @return GiftCard + */ + public static function create($alias = null) + { + $card = new static(); + + $response = (new AuthorizationBuilder(TransactionType::ALIAS, $card)) + ->withAlias(AliasAction::CREATE, $alias) + ->execute(); + + if ($response->responseCode === '00') { + return $response->giftCard; + } + + throw new ApiException($response->responseMessage); + } + + public function __get($name) + { + if (!in_array($name, static::$valueTypes)) { + throw new ArgumentException(sprintf('Property `%s` does not exist on GiftCard', $name)); + } + + return $this->value; + } + + public function __isset($name) + { + return in_array($name, static::$valueTypes) || isset($this->{$name}); + } + + public function __set($name, $value) + { + if (!in_array($name, static::$valueTypes)) { + throw new ArgumentException(sprintf('Property `%s` does not exist on GiftCard', $name)); + } + + $this->value = $value; + switch ($name) { + case 'alias': + $this->valueType = 'Alias'; + return; + case 'number': + $this->valueType = 'CardNbr'; + return; + case 'token': + $this->valueType = 'TokenValue'; + return; + case 'trackData': + $this->valueType = 'TrackData'; + return; + } + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/Interfaces/IAuthable.php b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/Interfaces/IAuthable.php new file mode 100644 index 0000000..e6dfb46 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/Interfaces/IAuthable.php @@ -0,0 +1,8 @@ +paymentMethod = $customerIdOrPaymentMethod; + return; + } + + $this->customerKey = $customerIdOrPaymentMethod; + $this->key = $paymentId; + $this->paymentType = "Credit Card"; // set default + } + + /** + * Creates an authorization against the payment method. + * + * @param float|string|null $amount The amount of the transaction + * + * @return AuthorizationBuilder + */ + public function authorize($amount = null) + { + return (new AuthorizationBuilder(TransactionType::AUTH, $this)) + ->withAmount($amount) + ->withOneTimePayment(true); + } + + /** + * Creates a charge (sale) against the payment method. + * + * @param float|string|null $amount The amount of the transaction + * + * @return AuthorizationBuilder + */ + public function charge($amount = null) + { + return (new AuthorizationBuilder(TransactionType::SALE, $this)) + ->withAmount($amount) + ->withOneTimePayment(true); + } + + /** + * Refunds the payment method. + * + * @param float|string|null $amount The amount of the transaction + * + * @return AuthorizationBuilder + */ + public function refund($amount = null) + { + return (new AuthorizationBuilder(TransactionType::REFUND, $this)) + ->withAmount($amount); + } + + /** + * Verifies the payment method with the issuer. + * + * @return AuthorizationBuilder + */ + public function verify() + { + return new AuthorizationBuilder(TransactionType::VERIFY, $this); + } + + /** + * Creates a recurring schedule using the payment method. + * + * @param string $scheduleId The schedule's identifier + * + * @return Schedule + */ + public function addSchedule($scheduleId) + { + $schedule = new Schedule($this->customerKey, $this->key); + $schedule->id = $scheduleId; + return $schedule; + } + + public function __get($name) + { + switch ($name) { + case 'paymentMethod': + return $this->paymentMethod; + case 'cardHolderName': + return $this->nameOnAccount; + case 'checkHolderName': + return $this->nameOnAccount; + default: + break; + } + + if (property_exists($this, $name)) { + return $this->{$name}; + } + + if ($this->paymentMethod && property_exists($this->paymentMethod, $name)) { + return $this->paymentMethod->{$name}; + } + + throw new ArgumentException(sprintf('Property `%s` does not exist on RecurringPaymentMethod', $name)); + } + + public function __isset($name) + { + return in_array($name, [ + 'paymentMethod', + 'cardHolderName', + 'checkHolderName', + ]) + || isset($this->{$name}) + || ($this->paymentMethod && isset($this->paymentMethod->{$name})); + } + + public function __set($name, $value) + { + switch ($name) { + case 'paymentMethod': + $client = ServicesContainer::instance()->getRecurringClient(); + if (!$client->supportsUpdatePaymentDetails) { + throw new UnsupportedTransactionException(); + } + + $this->paymentMethod = $value; + return; + default: + break; + } + + if (property_exists($this, $name)) { + return $this->{$name} = $value; + } + + throw new ArgumentException(sprintf('Property `%s` does not exist on Transaction', $name)); + } + + public function getDccRate($dccRateType, $amount, $currency, $ccp, $orderId) + { + return (new AuthorizationBuilder(TransactionType::DCC_RATE_LOOKUP, $this)) + ->withAmount($amount) + ->withCurrency($currency) + ->withDccRateType($dccRateType) + ->withDccProcessor($ccp) + ->withDccType("1") + ->withOrderId($orderId) + ->execute(); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/TransactionReference.php b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/TransactionReference.php new file mode 100644 index 0000000..8160201 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/PaymentMethods/TransactionReference.php @@ -0,0 +1,33 @@ +execute(); + return new BatchSummary(); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Services/CreditService.php b/lib/vendor/globalpayments/php-sdk/src/Services/CreditService.php new file mode 100644 index 0000000..a3fcf1a --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Services/CreditService.php @@ -0,0 +1,149 @@ +withAmount($amount); + } + + /** + * Creates a manage transaction builder with type `TransactionType::CAPTURE` + * + * @param string|float|TransactionReference $transaction Transaction reference of an authorization + * + * @return ManagementBuilder + */ + public function capture($transaction = null) + { + if (!($transaction instanceof TransactionReference)) { + $transactionReference = new TransactionReference(); + $transactionReference->transactionId = $transaction; + $transactionReference->paymentMethodType = PaymentMethodType::CREDIT; + $transaction = $transactionReference; + } + + return (new ManagementBuilder(TransactionType::CAPTURE)) + ->withPaymentMethod($transaction); + } + + /** + * Authorizes the payment method and captures the entire authorized amount + * + * @param string|float $amount Amount to authorize + * + * @return AuthorizationBuilder + */ + public function charge($amount = null) + { + return (new AuthorizationBuilder(TransactionType::SALE, $this)) + ->withAmount($amount); + } + + public function edit($transaction = null) + { + if (!($transaction instanceof TransactionReference)) { + $transactionReference = new TransactionReference(); + $transactionReference->transactionId = $transaction; + $transactionReference->paymentMethodType = PaymentMethodType::CREDIT; + $transaction = $transactionReference; + } + + return (new ManagementBuilder(TransactionType::EDIT)) + ->withPaymentMethod($transaction); + } + + public function editLevelII($transaction = null) + { + if (!($transaction instanceof TransactionReference)) { + $transactionReference = new TransactionReference(); + $transactionReference->transactionId = $transaction; + $transactionReference->paymentMethodType = PaymentMethodType::CREDIT; + $transaction = $transactionReference; + } + + return (new ManagementBuilder(TransactionType::EDIT)) + ->withModifier(TransactionModifier::LEVEL_II) + ->withPaymentMethod($transaction); + } + + /** + * Refunds the payment method + * + * @param string|float $amount Amount to refund + * + * @return AuthorizationBuilder + */ + public function refund($amount = null) + { + return (new AuthorizationBuilder(TransactionType::REFUND, $this)) + ->withAmount($amount); + } + + /** + * Reverses the payment method + * + * @param string|float $amount Amount to reverse + * + * @return AuthorizationBuilder + */ + public function reverse($amount = null) + { + return (new AuthorizationBuilder(TransactionType::REVERSAL, $this)) + ->withAmount($amount); + } + + /** + * Verifies the payment method + * + * @return AuthorizationBuilder + */ + public function verify() + { + return new AuthorizationBuilder(TransactionType::VERIFY, $this); + } + + public function void($transaction = null) + { + if (!($transaction instanceof TransactionReference)) { + $transactionReference = new TransactionReference(); + $transactionReference->transactionId = $transaction; + $transactionReference->paymentMethodType = PaymentMethodType::CREDIT; + $transaction = $transactionReference; + } + + return (new ManagementBuilder(TransactionType::VOID)) + ->withPaymentMethod($transaction); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Services/DeviceService.php b/lib/vendor/globalpayments/php-sdk/src/Services/DeviceService.php new file mode 100644 index 0000000..a675e58 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Services/DeviceService.php @@ -0,0 +1,23 @@ +device; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Services/HostedService.php b/lib/vendor/globalpayments/php-sdk/src/Services/HostedService.php new file mode 100644 index 0000000..d3210d3 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Services/HostedService.php @@ -0,0 +1,143 @@ +sharedSecret = $config->sharedSecret; + } + + /** + * Creates an authorization builder with type + * `TransactionType::CREDIT_AUTH` + * + * @param string|float $amount Amount to authorize + * + * @return AuthorizationBuilder + */ + public function authorize($amount = null) + { + return (new AuthorizationBuilder(TransactionType::AUTH)) + ->withAmount($amount); + } + + /** + * Authorizes the payment method and captures the entire authorized amount + * + * @param string|float $amount Amount to authorize + * + * @return AuthorizationBuilder + */ + public function charge($amount = null) + { + return (new AuthorizationBuilder(TransactionType::SALE)) + ->withAmount($amount); + } + + /** + * Verifies the payment method + * + * @return AuthorizationBuilder + */ + public function verify($amount = null) + { + return (new AuthorizationBuilder(TransactionType::VERIFY)) + ->withAmount($amount); + } + + public function void($transaction = null) + { + if (!($transaction instanceof TransactionReference)) { + $transactionReference = new TransactionReference(); + $transactionReference->transactionId = $transaction; + $transactionReference->paymentMethodType = PaymentMethodType::CREDIT; + $transaction = $transactionReference; + } + + return (new ManagementBuilder(TransactionType::VOID)) + ->withPaymentMethod($transaction); + } + + public function parseResponse($response, $encoded = false) + { + $response = json_decode($response, true); + + if ($encoded) { + $iterator = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($response)); + foreach ($iterator as $key => $value) { + $iterator->getInnerIterator()->offsetSet($key, base64_decode($value)); + } + + $response = $iterator->getArrayCopy(); + } + + $timestamp = $response["TIMESTAMP"]; + $merchantId = $response["MERCHANT_ID"]; + $orderId = $response["ORDER_ID"]; + $result = $response["RESULT"]; + $message = $response["MESSAGE"]; + $transactionId = $response["PASREF"]; + $authCode = $response["AUTHCODE"]; + $sha1Hash = $response["SHA1HASH"]; + $hash = GenerationUtils::generateHash($this->sharedSecret, implode('.', [ + $timestamp, + $merchantId, + $orderId, + $result, + $message, + $transactionId, + $authCode + ])); + + if ($hash != $sha1Hash) { + throw new ApiException("Incorrect hash. Please check your code and the Developers Documentation."); + } + + $ref = new TransactionReference(); + $ref->authCode = $authCode; + $ref->orderId = $orderId; + $ref->paymentMethodType = PaymentMethodType::CREDIT; + $ref->transactionId = $transactionId; + + $trans = new Transaction(); + $trans->authorizedAmount = $response["AMOUNT"]; + $trans->cvnResponseCode = $response["CVNRESULT"]; + $trans->responseCode = $result; + $trans->responseMessage = $message; + $trans->avsResponseCode = $response["AVSPOSTCODERESULT"]; + $trans->transactionReference = $ref; + + $trans->responseValues = $response; + + return $trans; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Services/RecurringService.php b/lib/vendor/globalpayments/php-sdk/src/Services/RecurringService.php new file mode 100644 index 0000000..f28d281 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Services/RecurringService.php @@ -0,0 +1,43 @@ +execute(); + return $response; + } + + public static function delete(RecurringEntity $entity, $force = false) + { + $response = (new RecurringBuilder(TransactionType::DELETE, $entity)) + ->execute(); + return $response; + } + + public static function edit(RecurringEntity $entity) + { + $response = (new RecurringBuilder(TransactionType::EDIT, $entity)) + ->execute(); + return $response; + } + + public static function get($entity) + { + $response = (new RecurringBuilder(TransactionType::FETCH, $entity)) + ->execute(); + return $response; + } + + public static function search($entityType) + { + return new RecurringBuilder(TransactionType::SEARCH, new $entityType()); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Services/ReportingService.php b/lib/vendor/globalpayments/php-sdk/src/Services/ReportingService.php new file mode 100644 index 0000000..eea10a7 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Services/ReportingService.php @@ -0,0 +1,31 @@ +withTransactionId($transactionId); + return $response; + } + + public static function activity() + { + $response = (new TransactionReportBuilder(ReportType::ACTIVITY)); + return $response; + } + + public static function transactionDetail($transactionId) + { + $response = (new TransactionReportBuilder(ReportType::TRANSACTION_DETAIL)) + ->withTransactionId($transactionId); + return $response; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Services/Secure3dService.php b/lib/vendor/globalpayments/php-sdk/src/Services/Secure3dService.php new file mode 100644 index 0000000..8f08848 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Services/Secure3dService.php @@ -0,0 +1,35 @@ +withPaymentMethod($paymentMethod); + } + + /** @return Secure3dBuilder */ + public static function initiateAuthentication(IPaymentMethod $paymentMethod, ThreeDSecure $secureEcom) + { + $paymentMethod->threeDSecure = $secureEcom; + + return (new Secure3dBuilder(TransactionType::INITIATE_AUTHENTICATION)) + ->withPaymentMethod($paymentMethod); + } + + /** @return Secure3dBuilder */ + public static function getAuthenticationData() + { + return new Secure3dBuilder(TransactionType::VERIFY_SIGNATURE); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/ServicesConfig.php b/lib/vendor/globalpayments/php-sdk/src/ServicesConfig.php new file mode 100644 index 0000000..32248ae --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/ServicesConfig.php @@ -0,0 +1,141 @@ +timeout = 65000; + $this->environment = Environment::TEST; + } + + public function validate() + { + // Portico API key + if (!empty($this->secretApiKey) + && ( + !empty($this->siteId) + || !empty($this->licenseId) + || !empty($this->deviceId) + || !empty($this->username) + || !empty($this->password) + ) + ) { + throw new ConfigurationException( + "Configuration contains both secret API key and legacy credentials. These are mutually exclusive." + ); + } + + // Portico legacy + if (( + !empty($this->siteId) + || !empty($this->licenseId) + || !empty($this->deviceId) + || !empty($this->username) + || !empty($this->password) + ) + && ( + empty($this->siteId) + || empty($this->licenseId) + || empty($this->deviceId) + || empty($this->username) + || empty($this->password) + ) + ) { + throw new ConfigurationException( + "Site, License, Device, Username, and Password should all have values for this configuration." + ); + } + + // Realex + if ((empty($this->secretApiKey) + && ( + empty($this->siteId) + && empty($this->licenseId) + && empty($this->deviceId) + && empty($this->username) + && empty($this->password) + )) + && empty($this->merchantId) + ) { + throw new ConfigurationException( + "MerchantId should not be empty for this configuration." + ); + } + + // Service URL + if (empty($this->serviceUrl) && $this->secure3dVersion == null) { + throw new ConfigurationException( + "Service URL could not be determined from the credentials provided. Please specify an endpoint." + ); + } + + // secure 3d + if ($this->secure3dVersion != null) { + if ($this->secure3dVersion === Secure3dVersion::TWO || $this->secure3dVersion === Secure3dVersion::ANY) { + if (empty($this->challengeNotificationUrl)) { + throw new ConfigurationException("The challenge notification URL is required for 3DS v2 processing."); + } + + if (empty($this->methodNotificationUrl)) { + throw new ConfigurationException("The method notification URL is required for 3DS v2 processing."); + } + } + } + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/ServicesContainer.php b/lib/vendor/globalpayments/php-sdk/src/ServicesContainer.php new file mode 100644 index 0000000..c36c702 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/ServicesContainer.php @@ -0,0 +1,207 @@ +secure3dProviders[$version])) { + return $this->secure3dProviders[$version]; + } elseif ($version == Secure3dVersion::ANY) { + $provider = $this->secure3dProviders[Secure3dVersion::TWO]; + if ($provider == null) { + $provider = $this->secure3dProviders[Secure3dVersion::ONE]; + } + return $provider; + } + return null; + } + + /** @return void */ + private function setSecure3dProvider($version, ISecure3dProvider $provider) + { + $this->secure3dProviders[$version] = $provider; + } + + /** + * ServicesContainer constructor. + * + * @param IGateway $gateway + * + * @return + */ + public function __construct(IPaymentGateway $gateway, IRecurringService $recurring = null) + { + $this->gateway = $gateway; + $this->recurring = $recurring; + } + + /** + * Gets the current `ServicesContainer` instance + * + * @return ServicesContainer + */ + public static function instance() + { + if (static::$instance == null) { + static::$instance = new static(null); + } + return static::$instance; + } + + /** + * Configures the `ServicesContainer` singleton + * + * @param ServicesConfig $config + * + * @return void + */ + public static function configure(ServicesConfig $config) + { + $config->validate(); + + $gateway = null; + if (!empty($config->merchantId)) { + if (empty($config->serviceUrl)) { + if ($config->environment === Environment::TEST) { + $config->serviceUrl = ServiceEndpoints::GLOBAL_ECOM_TEST; + } else { + $config->serviceUrl = ServiceEndpoints::GLOBAL_ECOM_PRODUCTION; + } + } + + $gateway = new RealexConnector(); + $gateway->accountId = $config->accountId; + $gateway->channel = $config->channel; + $gateway->merchantId = $config->merchantId; + $gateway->rebatePassword = $config->rebatePassword; + $gateway->refundPassword = $config->refundPassword; + $gateway->sharedSecret = $config->sharedSecret; + $gateway->timeout = $config->timeout; + $gateway->serviceUrl = $config->serviceUrl; + $gateway->hostedPaymentConfig = $config->hostedPaymentConfig; + $gateway->curlOptions = $config->curlOptions; + static::$instance = new static($gateway, $gateway); + // set default + if ($config->secure3dVersion == null) { + $config->secure3dVersion = Secure3dVersion::ONE; + } + + // secure 3d v1 + if ($config->secure3dVersion === Secure3dVersion::ONE || $config->secure3dVersion === Secure3dVersion::ANY) { + static::$instance->setSecure3dProvider(Secure3dVersion::ONE, $gateway); + } + + // secure 3d v2 + if ($config->secure3dVersion === Secure3dVersion::TWO || $config->secure3dVersion === Secure3dVersion::ANY) { + $secure3d2 = new Gp3DSProvider(); + $secure3d2->setMerchantId($config->merchantId); + $secure3d2->setAccountId($config->accountId); + $secure3d2->setSharedSecret($config->sharedSecret); + $secure3d2->serviceUrl = $config->environment == Environment::TEST ? ServiceEndpoints::THREE_DS_AUTH_TEST : ServiceEndpoints::THREE_DS_AUTH_PRODUCTION; + $secure3d2->setMerchantContactUrl($config->merchantContactUrl); + $secure3d2->setMethodNotificationUrl($config->methodNotificationUrl); + $secure3d2->setChallengeNotificationUrl($config->challengeNotificationUrl); + $secure3d2->timeout = $config->timeout; + + static::$instance->setSecure3dProvider(Secure3dVersion::TWO, $secure3d2); + } + } else { + if (empty($config->serviceUrl) && !empty($config->secretApiKey)) { + $env = explode('_', $config->secretApiKey)[1]; + if ($env == "prod") { + $config->serviceUrl = ServiceEndpoints::PORTICO_PRODUCTION; + } else { + $config->serviceUrl = ServiceEndpoints::PORTICO_TEST; + } + } + + $gateway = new PorticoConnector(); + $gateway->siteId = $config->siteId; + $gateway->licenseId = $config->licenseId; + $gateway->deviceId = $config->deviceId; + $gateway->username = $config->username; + $gateway->password = $config->password; + $gateway->secretApiKey = $config->secretApiKey; + $gateway->developerId = $config->developerId; + $gateway->versionNumber = $config->versionNumber; + $gateway->timeout = $config->timeout; + $gateway->serviceUrl = $config->serviceUrl . '/Hps.Exchange.PosGateway/PosGatewayService.asmx'; + $gateway->curlOptions = $config->curlOptions; + + $payplanEndPoint = (strpos(strtolower($config->serviceUrl), 'cert.') > 0) ? + '/Portico.PayPlan.v2/': + '/PayPlan.v2/'; + + $recurring = new PayPlanConnector(); + $recurring->siteId = $config->siteId; + $recurring->licenseId = $config->licenseId; + $recurring->deviceId = $config->deviceId; + $recurring->username = $config->username; + $recurring->password = $config->password; + $recurring->secretApiKey = $config->secretApiKey; + $recurring->developerId = $config->developerId; + $recurring->versionNumber = $config->versionNumber; + $recurring->timeout = $config->timeout; + $recurring->serviceUrl = $config->serviceUrl . $payplanEndPoint; + $recurring->curlOptions = $config->curlOptions; + + static::$instance = new static($gateway, $recurring); + } + } + + /** + * Gets the configured gateway connector + * + * @return IPaymentGateway + */ + public function getClient() + { + return $this->gateway; + } + + /** + * Gets the configured recurring gateway connector + * + * @return IRecurringService + */ + public function getRecurringClient() + { + return $this->recurring; + } + + /** + * @return ISecure3dProvider + */ + public function getSecure3d($version) + { + $provider = $this->getSecure3dProvider($version); + if ($provider != null) { + return $provider; + } + throw new ConfigurationException(sprintf("Secure 3d is not configured for version %s", $version)); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Terminals/Builders/TerminalAuthBuilder.php b/lib/vendor/globalpayments/php-sdk/src/Terminals/Builders/TerminalAuthBuilder.php new file mode 100644 index 0000000..3f537bd --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Terminals/Builders/TerminalAuthBuilder.php @@ -0,0 +1,184 @@ +transactionType = $transactionType; + $this->paymentMethodType = $paymentMethodType; + } + + /** + * {@inheritdoc} + * + * @return Transaction + */ + public function execute() + { + parent::execute(); + return ConnectionContainer::instance() + ->processTransaction($this); + } + + public function withAddress($address) + { + $this->address = $address; + return $this; + } + + public function withAllowDuplicates($allowDuplicates) + { + $this->allowDuplicates = $allowDuplicates; + return $this; + } + + public function withAmount($amount) + { + $this->amount = $amount; + return $this; + } + + public function withCashBack($amount) + { + $this->cashBackAmount = $amount; + return $this; + } + + public function withCurrency($value) + { + $this->currency = $value; + return $this; + } + + public function withCustomerCode($customerCode) + { + $this->customerCode = $customerCode; + return $this; + } + + public function withGratuity($gratuity) + { + $this->gratuity = $gratuity; + return $this; + } + + public function withInvoiceNumber($invoiceNumber) + { + $this->invoiceNumber = $invoiceNumber; + return $this; + } + + public function withPaymentMethod($method) + { + $this->paymentMethod = $method; + return $this; + } + + public function withPoNumber($poNumber) + { + $this->poNumber = $poNumber; + return $this; + } + + public function withRequestMultiUseToken($requestMultiUseToken) + { + $this->requestMultiUseToken = $requestMultiUseToken; + return $this; + } + + public function withSignatureCapture($signatureCapture) + { + $this->signatureCapture = $signatureCapture; + return $this; + } + + public function withTaxAmount($taxAmount) + { + $this->taxAmount = $taxAmount; + return $this; + } + + public function withToken($value) + { + if ($this->paymentMethod == null || !($this->paymentMethod instanceof CreditCardData)) { + $this->paymentMethod = new CreditCardData(); + $this->paymentMethod->token = value; + } + return $this; + } + + /** + * Previous request's transaction ID + * + * @param string $transactionId Transaction ID + * + * @return AuthorizationBuilder + */ + public function withTransactionId($transactionId) + { + $this->transactionId = $transactionId; + return $this; + } + + protected function setupValidations() + { + $this->validations->of( + TransactionType::AUTH | + TransactionType::SALE | TransactionType::REFUND + ) + ->with(TransactionModifier::NONE) + ->check('amount')->isNotNull(); + + $this->validations->of( + TransactionType::REFUND + ) + ->check('amount')->isNotNull(); + + $this->validations->of( + TransactionType::REFUND + ) + ->with(PaymentMethodType::CREDIT) + ->check('transactionId')->isNotNull() + ->check('authCode')->isNotNull(); + + $this->validations->of( + TransactionType::ADD_VALUE + ) + ->check('amount')->isNotNull(); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Terminals/Builders/TerminalBuilder.php b/lib/vendor/globalpayments/php-sdk/src/Terminals/Builders/TerminalBuilder.php new file mode 100644 index 0000000..d17d8c4 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Terminals/Builders/TerminalBuilder.php @@ -0,0 +1,38 @@ +paymentMethodType = $paymentMethodType; + parent::__construct($type); + } + + public function withRequestId($requestId) + { + $this->requestId = $requestId; + return $this; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Terminals/Builders/TerminalManageBuilder.php b/lib/vendor/globalpayments/php-sdk/src/Terminals/Builders/TerminalManageBuilder.php new file mode 100644 index 0000000..55bfdc0 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Terminals/Builders/TerminalManageBuilder.php @@ -0,0 +1,96 @@ +transactionType = $transactionType; + $this->paymentMethodType = $paymentMethodType; + } + + /** + * {@inheritdoc} + * + * @return Transaction + */ + public function execute() + { + parent::execute(); + return ConnectionContainer::instance() + ->manageTransaction($this); + } + + public function withAmount($amount) + { + $this->amount = $amount; + return $this; + } + + public function withCurrency($value) + { + $this->currency = $value; + return $this; + } + + public function withGratuity($gratuity) + { + $this->gratuity = $gratuity; + return $this; + } + + public function withPaymentMethod($method) + { + $this->paymentMethod = $method; + return $this; + } + + /** + * Previous request's transaction ID + * + * @param string $transactionId Transaction ID + * + * @return AuthorizationBuilder + */ + public function withTransactionId($transactionId) + { + $this->transactionId = $transactionId; + return $this; + } + + protected function setupValidations() + { + $this->validations->of( + TransactionType::CAPTURE + ) + ->with(TransactionModifier::NONE) + ->check('amount')->isNotNull() + ->check('transactionId')->isNotNull(); + + $this->validations->of( + TransactionType::VOID + ) + ->with(TransactionModifier::NONE) + ->check('transactionId')->isNotNull(); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Terminals/ConnectionConfig.php b/lib/vendor/globalpayments/php-sdk/src/Terminals/ConnectionConfig.php new file mode 100644 index 0000000..02c9aa0 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Terminals/ConnectionConfig.php @@ -0,0 +1,52 @@ +connectionMode == ConnectionModes::HTTP || + $this->connectionMode == ConnectionModes::TCP_IP) { + if (empty($this->ipAddress)) { + throw new ConfigurationException( + "IpAddress is required for TCP or HTTP communication modes." + ); + } + } + + if (empty($this->port)) { + throw new ConfigurationException( + "Port is required for TCP or HTTP communication modes." + ); + } + + if ($this->deviceType == DeviceType::HPA_ISC250 && + empty($this->requestIdProvider) + ) { + throw new ConfigurationException( + "Request id is mandatory for this transaction. IRequestIdProvider is not implemented" + ); + } + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Terminals/ConnectionContainer.php b/lib/vendor/globalpayments/php-sdk/src/Terminals/ConnectionContainer.php new file mode 100644 index 0000000..d608d57 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Terminals/ConnectionContainer.php @@ -0,0 +1,62 @@ +deviceController = $deviceController; + } + + /** + * Gets the current `ConnectionContainer` instance + * + * @return ConnectionContainer + */ + public static function instance() + { + if (static::$instance == null) { + static::$instance = new static(null); + } + return static::$instance; + } + + /** + * Configures the `ConnectionContainer` singleton + * + * @param ServicesConfig $config + * + * @return void + */ + public static function configure(ConnectionConfig $config) + { + $config->validate(); + + $deviceController = null; + + switch ($config->deviceType) { + case DeviceType::HPA_ISC250: + static::$instance = new HpaController($config); + break; + } + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Terminals/DeviceController.php b/lib/vendor/globalpayments/php-sdk/src/Terminals/DeviceController.php new file mode 100644 index 0000000..c38c275 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Terminals/DeviceController.php @@ -0,0 +1,17 @@ +device = new HpaInterface($this); + $this->requestIdProvider = $config->requestIdProvider; + $this->deviceConfig = $config; + + switch ($config->connectionMode) { + case ConnectionModes::TCP_IP: + $this->deviceInterface = new HpaTcpInterface($config); + break; + } + } + + public function manageTransaction($builder) + { + $this->builderData = $builder; + $xml = new \DOMDocument(); + $transactionType = $this->manageTransactionType($builder->transactionType); + // Build Request + $request = $xml->createElement("SIP"); + $request->appendChild($xml->createElement("Version", '1.0')); + $request->appendChild($xml->createElement("ECRId", '1004')); + $request->appendChild($xml->createElement("Request", $transactionType)); + $request->appendChild($xml->createElement("RequestId", "%s")); + $request->appendChild($xml->createElement("TransactionId", $builder->transactionId)); + + $totalAmount = TerminalUtils::formatAmount($builder->amount); + $gratuity = TerminalUtils::formatAmount($builder->gratuity); + if ($builder->gratuity !== null) { + $request->appendChild($xml->createElement("TipAmount", $gratuity)); + $totalAmount += $gratuity; + } else { + $request->appendChild($xml->createElement("TipAmount", 0)); + } + + $request->appendChild($xml->createElement("TotalAmount", $totalAmount)); + + $response = $this->send($xml->saveXML($request)); + return $response; + } + + public function processTransaction($builder) + { + $this->builderData = $builder; + $xml = new \DOMDocument('1.0', 'utf-8'); + $transactionType = $this->manageTransactionType($builder->transactionType); + $cardGroup = $this->manageCardGroup($builder->paymentMethodType); + + $amount = TerminalUtils::formatAmount($builder->amount); + $gratuity = TerminalUtils::formatAmount($builder->gratuity); + $taxAmount = TerminalUtils::formatAmount($builder->taxAmount); + + // Build Request + $request = $xml->createElement("SIP"); + $request->appendChild($xml->createElement("Version", '1.0')); + $request->appendChild($xml->createElement("ECRId", '1004')); + $request->appendChild($xml->createElement("Request", $transactionType)); + $request->appendChild($xml->createElement("RequestId", "%s")); + $request->appendChild($xml->createElement("CardGroup", $cardGroup)); + $request->appendChild($xml->createElement("ConfirmAmount", '0')); + $request->appendChild($xml->createElement("BaseAmount", $amount)); + + if ($builder->gratuity !== null) { + $request->appendChild($xml->createElement("TipAmount", $gratuity)); + } else { + $request->appendChild($xml->createElement("TipAmount", 0)); + } + + if ($builder->taxAmount !== null) { + $request->appendChild($xml->createElement("TaxAmount", $taxAmount)); + } else { + $request->appendChild($xml->createElement("TaxAmount", 0)); + } + + if ($builder->paymentMethodType == PaymentMethodType::EBT) { + $request->appendChild($xml->createElement("EBTAmount", $amount)); + } + + $request->appendChild($xml->createElement("TotalAmount", $amount)); + + $response = $this->send($xml->saveXML($request)); + return $response; + } + + /* + * Send control message to device + * + * @param string $message control message to device + * + * @return HpaResponse parsed device response + */ + + public function send($message, $requestType = null) + { + if (strpos($message, "%s") !== false) { + $requestId = (!empty($this->builderData->requestId)) ? + $this->builderData->requestId : + $this->requestIdProvider->getRequestId(); + $message = sprintf($message, $requestId); + } + //send messaege to gateway + $this->deviceInterface->send(trim($message), $requestType); + + //check response code + $acceptedCodes = ["0"]; + $this->checkResponse($this->deviceInterface->deviceResponse, $acceptedCodes); + return $this->deviceInterface->deviceResponse; + } + + /* + * Check the device response code + * + * @param HpaResponse $gatewayResponse parsed response from device + * @param array $acceptedCodes list of success response codes + * + * @return raise GatewayException incase of different unexpected code + */ + + public function checkResponse($gatewayResponse, $acceptedCodes) + { + if ($acceptedCodes === null) { + $acceptedCodes = ["00"]; + } + + if (!empty($gatewayResponse->resultText) || !empty($gatewayResponse->gatewayResponseMessage)) { + $responseCode = (string) $gatewayResponse->resultCode; + $responseMessage = (string) $gatewayResponse->resultText; + $responseText = (string) $gatewayResponse->gatewayResponseMessage; + + if (!in_array($responseCode, $acceptedCodes)) { + throw new GatewayException( + sprintf( + 'Unexpected Gateway Response: %s - %s : %s', + $responseCode, + $responseMessage, + $responseText + ), + $responseCode, + $responseMessage + ); + } + } else { + throw new GatewayException('Invalid Gateway Response'); + } + } + + /* + * Return message id based on the transaction type + * + * @param $transactionType|TransactionType + * $return HPA message id or UnsupportedTransactionException incase of unknown transaction type + */ + + private function manageTransactionType($transactionType) + { + switch ($transactionType) { + case TransactionType::SALE: + return HpaMessageId::CREDIT_SALE; + case TransactionType::AUTH: + return HpaMessageId::CREDIT_AUTH; + case TransactionType::CAPTURE: + return HpaMessageId::CAPTURE; + case TransactionType::VERIFY: + return HpaMessageId::CARD_VERIFY; + case TransactionType::VOID: + return HpaMessageId::CREDIT_VOID; + case TransactionType::REFUND: + return HpaMessageId::CREDIT_REFUND; + case TransactionType::BALANCE: + return HpaMessageId::BALANCE; + case TransactionType::ADD_VALUE: + return HpaMessageId::ADD_VALUE; + default: + throw new UnsupportedTransactionException( + 'The selected gateway does not support this transaction type.' + ); + } + } + + public function manageCardGroup($paymentMethodType) + { + $cardGroup = $paymentMethodType; + if ($paymentMethodType == PaymentMethodType::CREDIT) { + $cardGroup = 'Credit'; + } elseif ($paymentMethodType == PaymentMethodType::DEBIT) { + $cardGroup = 'Debit'; + } elseif ($paymentMethodType == PaymentMethodType::EBT) { + $cardGroup = 'EBT'; + } elseif ($paymentMethodType == PaymentMethodType::GIFT) { + $cardGroup = 'GIFT'; + } + return $cardGroup; + } + + public function sendFile($sendFileData) + { + $sendFile = new HpaSendFileRequest($this->deviceConfig); + $sendFile->validate($sendFileData); + + $fileInfo = $sendFile->getFileInformation($sendFileData); + + $initialMessage = "" + . "1.0" + . "1004" + . "SendFile" + . "%s" + . "".$sendFileData->imageType."" + . "".$fileInfo['fileSize']."" + . "1" + . ""; + + $initialFileResponse = $this->send($initialMessage, HpaMessageId::SEND_FILE); + + if (!empty($initialFileResponse) && $initialFileResponse->resultCode == 0) { + $splitedImageData = str_split($fileInfo['fileData'], $initialFileResponse->maxDataSize); + $totalMessages = sizeof($splitedImageData); + + for ($i = 0; $i < $totalMessages; $i++) { + $isMultiple = ( ($i+1) != $totalMessages) ? 1 : 0; + $subsequentMessage = "" + . "1.0" + . "1004" + . "SendFile" + . "%s" + . "" . $splitedImageData[$i] . "" + . "" . $isMultiple . "" + . ""; + + $fileResponse = $this->send($subsequentMessage, HpaMessageId::SEND_FILE); + } + return $fileResponse; + } + } + + public function __destruct() + { + $this->device->reset(); + $this->device->closeLane(); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Terminals/HPA/HpaInterface.php b/lib/vendor/globalpayments/php-sdk/src/Terminals/HPA/HpaInterface.php new file mode 100644 index 0000000..ed2dfaa --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Terminals/HPA/HpaInterface.php @@ -0,0 +1,428 @@ +hpaController = $deviceController; + } + + #region Admin Messages + + /* + * GetAppInfoReport - Admin mode message - Get HeartSIP Application Information Report + */ + + public function initialize() + { + return $this->hpaController->send( + "" + . "1.0" + . "1004" + . "GetAppInfoReport" + . "%s" + . "", + HpaMessageId::GET_INFO_REPORT + ); + } + + /* + * LaneOpen - Admin mode message - Go to Lane Open State + */ + + public function openLane() + { + return $this->hpaController->send( + "" + . "1.0" + . "1004" + . "LaneOpen" + . "%s" + . "" + ); + } + + /* + * LaneClose - Admin mode message - Go to Lane Close State + */ + + public function closeLane() + { + return $this->hpaController->send( + "" + . "1.0" + . "1004" + . "LaneClose" + . "%s" + . "" + ); + } + + /* + * Reset - Admin mode message - Transition SIP to idle state + */ + + public function cancel() + { + return $this->reset(); + } + + /* + * Reboot - Admin mode message - Reboot the SIP device + */ + + public function reboot() + { + return $this->hpaController->send( + "" + . "1.0" + . "1004" + . "Reboot" + . "%s" + . "" + ); + } + + /* + * Reset - Admin mode message - Transition SIP to idle state + */ + + public function reset() + { + return $this->hpaController->send( + "" + . "1.0" + . "1004" + . "Reset" + . "%s" + . "" + ); + } + + public function lineItem($lineItemDetails) + { + if (empty($lineItemDetails->leftText)) { + throw new BuilderException("Line item left text cannot be null"); + } + $message = "" + . "1.0" + . "1004" + . "LineItem" + . "%s" + ."{$lineItemDetails->leftText}"; + + if (!empty($lineItemDetails->rightText)) { + $message .= sprintf("%s", $lineItemDetails->rightText); + } + if (!empty($lineItemDetails->runningLeftText)) { + $message .= sprintf( + "%s", + $lineItemDetails->runningLeftText + ); + } + if (!empty($lineItemDetails->runningRightText)) { + $message .= sprintf( + "%s", + $lineItemDetails->runningRightText + ); + } + + $message .= ""; + return $this->hpaController->send($message); + } + + /* + * StartCard - Admin mode message - Initiate card acquisition prior to a financial transaction. + * The intent is to perform card acquisition while the clerk is ringing up the items + */ + + public function startCard($paymentMethodType = null) + { + $message = "" + . "1.0" + . "1004" + . "StartCard" + . "%s"; + + if ($paymentMethodType !== null) { + $cardGroup = $this->hpaController->manageCardGroup($paymentMethodType); + $message .= "$cardGroup"; + } + + $message .= ""; + + return $this->hpaController->send($message); + } + + #endregion + + #credit + + public function batchClose() + { + return $this->hpaController->send( + "" + . "1.0" + . "1004" + . "EOD" + . "%s" + . "", + HpaMessageId::EOD + ); + } + + public function eod() + { + return $this->batchClose(); + } + + public function creditAuth($amount = null) + { + return (new TerminalAuthBuilder(TransactionType::AUTH, PaymentMethodType::CREDIT)) + ->withAmount($amount); + } + + public function creditCapture($amount = null) + { + return (new TerminalManageBuilder(TransactionType::CAPTURE, PaymentMethodType::CREDIT)) + ->withAmount($amount); + } + + public function creditRefund($amount = null) + { + return (new TerminalAuthBuilder(TransactionType::REFUND, PaymentMethodType::CREDIT)) + ->withAmount($amount); + } + + public function creditSale($amount = null) + { + return (new TerminalAuthBuilder(TransactionType::SALE, PaymentMethodType::CREDIT)) + ->withAmount($amount); + } + + public function creditVerify() + { + return (new TerminalAuthBuilder(TransactionType::VERIFY, PaymentMethodType::CREDIT)); + } + + public function creditVoid() + { + return (new TerminalManageBuilder(TransactionType::VOID, PaymentMethodType::CREDIT)); + } + + #end credit + + public function debitSale($amount = null) + { + return (new TerminalAuthBuilder(TransactionType::SALE, PaymentMethodType::DEBIT)) + ->withAmount($amount); + } + + public function debitRefund($amount = null) + { + return (new TerminalAuthBuilder(TransactionType::REFUND, PaymentMethodType::DEBIT)) + ->withAmount($amount); + } + + public function debitVoid() + { + throw new UnsupportedTransactionException( + 'The selected gateway does not support this transaction type.' + ); + } + + public function disableHostResponseBeep() + { + } + + public function getSignatureFile() + { + } + + public function ebtBalance() + { + return (new TerminalAuthBuilder(TransactionType::BALANCE, PaymentMethodType::EBT)); + } + + public function ebtPurchase($amount = null) + { + return (new TerminalAuthBuilder(TransactionType::SALE, PaymentMethodType::EBT)) + ->withAmount($amount); + } + + public function ebtRefund($amount = null) + { + return (new TerminalAuthBuilder(TransactionType::REFUND, PaymentMethodType::EBT)) + ->withAmount($amount); + } + + public function ebtWithdrawl($amount = null) + { + throw new UnsupportedTransactionException( + 'The selected gateway does not support this transaction type.' + ); + } + + public function startDownload($deviceSettings) + { + $startDownloadRequest = sprintf( + "" + . "1.0" + . "1004" + . "Download" + . "%s" + . "%s" + . "%s" + . "%s" + . "%s" + . "%s" + . "%s", + "%s", + $deviceSettings->hudsUrl, + $deviceSettings->hudsPort, + $deviceSettings->terminalId, + $deviceSettings->applicationId, + $deviceSettings->downloadType, + $deviceSettings->downloadTime + ); + + $startDownloadRequest .= ""; + return $this->hpaController->send($startDownloadRequest); + } + + #Gift Region + public function giftAddValue($amount = null) + { + return (new TerminalAuthBuilder(TransactionType::ADD_VALUE, PaymentMethodType::GIFT)) + ->withAmount($amount) + ->withCurrency(CurrencyType::CURRENCY); + } + + public function giftBalance() + { + return (new TerminalAuthBuilder(TransactionType::BALANCE, PaymentMethodType::GIFT)) + ->withCurrency(CurrencyType::CURRENCY); + } + + public function giftSale($amount = null) + { + return (new TerminalAuthBuilder(TransactionType::SALE, PaymentMethodType::GIFT)) + ->withAmount($amount) + ->withCurrency(CurrencyType::CURRENCY); + } + + public function giftVoid() + { + return (new TerminalManageBuilder(TransactionType::VOID, PaymentMethodType::GIFT)); + } + + public function setSafMode($parameterValue) + { + return $this->hpaController->send( + sprintf( + "" + . "1.0" + . "1004" + . "SetParameter" + . "%s" + . "1" + . "STORMD" + . "%s" + . "", + '%s', + $parameterValue + ) + ); + } + + public function sendSaf() + { + return $this->hpaController->send( + "" + . "1.0" + . "1004" + . "SendSAF" + . "%s" + . "", + HpaMessageId::SENDSAF + ); + } + + public function sendFile($sendFileData) + { + return $this->hpaController->sendFile($sendFileData); + } + + public function getDiagnosticReport($totalFields) + { + return $this->hpaController->send( + sprintf( + "" + . "1.0" + . "1004" + . "GetDiagnosticReport" + . "%s" + . "%s" + . "", + '%s', + $totalFields + ), + HpaMessageId::GET_DIAGNOSTIC_REPORT + ); + } + + public function promptForSignature() + { + return $this->hpaController->send( + sprintf( + "" + . "1.0" + . "1004" + . "SignatureForm" + . "%s" + . "PLEASE SIGN BELOW" + . "", + '%s' + ), + HpaMessageId::SIGNATURE_FORM + ); + } + + public function getLastResponse() + { + return $this->hpaController->send( + sprintf( + "" + . "1.0" + . "1004" + . "GetLastResponse" + . "%s" + . "", + '%s' + ), + HpaMessageId::GET_LAST_RESPONSE + ); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Terminals/HPA/HpaTcpInterface.php b/lib/vendor/globalpayments/php-sdk/src/Terminals/HPA/HpaTcpInterface.php new file mode 100644 index 0000000..8a033af --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Terminals/HPA/HpaTcpInterface.php @@ -0,0 +1,367 @@ +deviceDetails = $config; + ob_implicit_flush(true); + } + + /* + * Create socket connection with device + * Throws GatewayException incase of connection error + */ + public function connect() + { + if ($this->tcpConnection !== null) { + return; + } + + $errno = ''; + $errstr = ''; + + // open socket + try { + $this->tcpConnection = pfsockopen( + 'tcp://' . $this->deviceDetails->ipAddress, + $this->deviceDetails->port, + $errno, + $errstr, + $this->deviceDetails->timeout + ); + } catch (\Exception $e) { + throw new GatewayException( + sprintf('Device connection error: %s - %s', $errno, $errstr), + $errno, + $errstr + ); + } + } + + /* + * Close TCP socket connection with device + */ + public function disconnect() + { + // close socket + if ($this->tcpConnection !== null) { + fclose($this->tcpConnection); + } + } + + /* + * Send request message to device using socket connection + * @param string $message XML request string + */ + public function send($message, $requestType = null) + { + $this->connect(); + $this->requestType = $requestType; + $out = ''; + + if ($this->tcpConnection !== null) { + try { + $length = TerminalUtils::findLength($message); + + if (false === ($bytes_written = fwrite($this->tcpConnection, $length.$message))) { + throw new GatewayException('Device error: failed to write to socket'); + } else { + //set time out for read and write + stream_set_timeout($this->tcpConnection, $this->deviceDetails->timeout); + + $multipleMessage = true; + do { + // read from socket + $part = fgets($this->tcpConnection); + $out .= $part; + + //break the loop when there is no multiple message + if ($part == "0\n") { + $multipleMessage = false; + } elseif ($part == "\n" && $multipleMessage === false) { + break; + } + } while ($part !== false && !feof($this->tcpConnection)); + } + if (!empty($out)) { + $this->filterResponseMessage($out); + } + } catch (\Exception $e) { + throw new GatewayException( + 'Device error: ' . $e->getMessage(), + null, + $e->getMessage() + ); + } + } + return; + } + + /* + * Filter the device response. remove control characters + * Convert multiple string message as array using keyword + * + * @param XML|String $gatewayResponse XML response from device + */ + private function filterResponseMessage($gatewayResponse) + { + //remove non printable characters + $gatewayResponse = preg_replace('/[\x00-\x09\x0B\x0C\x0E-\x1F\x7F\;]/', '', trim($gatewayResponse)); + + if ($this->requestType == HpaMessageId::EOD) { + //process eod reponse by HpaEodResponse handler + $responseHandler = new HpaEodResponse(); + $this->deviceResponse = $responseHandler->mapResponse($gatewayResponse); + } elseif ($this->requestType == HpaMessageId::SENDSAF) { + //process eod reponse by HpaSendSafResponse handler + $responseHandler = new HpaSendSafResponse(); + $this->deviceResponse = $responseHandler->mapResponse($gatewayResponse); + } elseif ($this->requestType == HpaMessageId::GET_DIAGNOSTIC_REPORT) { + //process Diagnostic Report Response + $responseHandler = new HpaDiagnosticReportResponse(); + $this->deviceResponse = $responseHandler->mapResponse($gatewayResponse); + } elseif ($this->requestType == HpaMessageId::GET_LAST_RESPONSE) { + //process get last response report + $this->deviceResponse = new HpaResponse(); + $this->parseResponse($gatewayResponse); + } elseif ($this->requestType == HpaMessageId::GET_INFO_REPORT) { + $messageList = explode('', $gatewayResponse); + $this->deviceResponse = new HpaResponse(); + + if (!empty($messageList)) { + foreach ($messageList as $message) { + if (!empty($message)) { + //process individual response + if (strpos($message, '') !== false && !strpos($message, '')) { + $message .= ''; + $this->parseResponse($message); + } + } + } + } + } else { + $this->deviceResponse = new HpaResponse(); + $this->parseResponse($gatewayResponse); + } + return; + } + + /* + * Parse device response + * + * @param XML|String $gatewayResponse XML response from device + */ + + public function parseResponse($gatewayResponse) + { + $responseData = TerminalUtils::xmlParse($gatewayResponse); + + if (!empty($responseData)) { + $this->setBasicResponse($responseData); + + //process the records + if (!empty($responseData['Record'])) { + if ($this->deviceResponse->response == 'GetAppInfoReport') { + $this->parseResponseRecord($responseData['Record'], 'initializeResponse'); + } + } + } + return; + } + + /* + * Parse request specific responses + * + * @param XML $gatewayRecord + * @param string $recordType array key to identify the record type + */ + + private function parseResponseRecord($gatewayRecord, $recordType) + { + if (!empty($gatewayRecord['Field'])) { + if (isset($gatewayRecord['Field']['Key']) && isset($gatewayRecord['Field']['Value'])) { + $field = $gatewayRecord['Field']; + $key = $this->convertRecordKey($field['Key']); + $this->deviceResponse->responseData[$recordType]["$key"] = $field['Value']; + } else { + //incase of multi dimensional array + foreach ($gatewayRecord['Field'] as $field) { + if (isset($field['Key']) && isset($field['Value'])) { + $key = $this->convertRecordKey($field['Key']); + $this->deviceResponse->responseData[$recordType]["$key"] = $field['Value']; + } + } + } + } + } + + /* + * Set transaction based response in $deviceResponse + * + * @param array $response + */ + private function parseTransactionResponse($response) + { + $this->setValueInResponse('referenceNumber', $response, 'ReferenceNumber'); + $this->setValueInResponse('cardHolderName', $response, 'CardholderName'); + $this->setValueInResponse('entryMethod', $response, 'CardAcquisition'); + $this->setValueInResponse('approvalCode', $response, 'ApprovalCode'); + $this->setValueInResponse('transactionTime', $response, 'TransactionTime'); + $this->setValueInResponse('maskedCardNumber', $response, 'MaskedPAN'); + $this->setValueInResponse('cardType', $response, 'CardType'); + $this->setValueInResponse('signatureStatus', $response, 'SignatureLine'); + + if (isset($response['TipAdjustAllowed']) && !empty($response['TipAmount'])) { + $this->deviceResponse->tipAmount = TerminalUtils::reformatAmount( + $response['TipAmount'] + ); + } + + if (isset($response['AuthorizedAmount'])) { + $this->deviceResponse->transactionAmount = TerminalUtils::reformatAmount( + $response['AuthorizedAmount'] + ); + } + + //EBT response + $this->setValueInResponse('ebtType', $response, 'EBTType'); + $this->setValueInResponse('pinVerified', $response, 'PinVerified'); + } + + /* + * Set transaction based response in $deviceResponse + * + * @param string $propertyName $deviceResponse object property name + * @param array $response + * @param string $responseKey response key received from device + */ + private function setValueInResponse($propertyName, $response, $responseKey) + { + if (isset($response[$responseKey])) { + $this->deviceResponse->{$propertyName} = $response[$responseKey]; + } + } + + private function setBasicResponse($responseData) + { + $this->setValueInResponse('versionNumber', $responseData, 'Version'); + $this->setValueInResponse('ecrId', $responseData, 'ECRId'); + $this->setValueInResponse('sipId', $responseData, 'SIPId'); + $this->setValueInResponse('deviceId', $responseData, 'DeviceId'); + $this->setValueInResponse('response', $responseData, 'Response'); + $this->setValueInResponse('multipleMessage', $responseData, 'MultipleMessage'); + $this->setValueInResponse('resultCode', $responseData, 'Result'); + $this->setValueInResponse('transactionId', $responseData, 'ResponseId'); + $this->setValueInResponse('responseCode', $responseData, 'ResponseCode'); + $this->setValueInResponse('resultText', $responseData, 'ResultText'); + $this->setValueInResponse('requestId', $responseData, 'RequestId'); + $this->setValueInResponse('responseText', $responseData, 'ResponseText'); + $this->setValueInResponse('gatewayResponseMessage', $responseData, 'GatewayRspMsg'); + $this->setValueInResponse('isStoredResponse', $responseData, 'StoredResponse'); + $this->setValueInResponse('partialApproval', $responseData, 'PartialApproval'); + $this->setValueInResponse('avsResponseText', $responseData, 'AVSResultText'); + $this->setValueInResponse('avsResponseCode', $responseData, 'AVS'); + $this->setValueInResponse('cvvResponseCode', $responseData, 'CVV'); + $this->setValueInResponse('cvvResponseText', $responseData, 'CVVResultText'); + $this->setValueInResponse('signatureData', $responseData, 'AttachmentData'); + + if (isset($responseData['BalanceDueAmount'])) { + $this->deviceResponse->balanceAmountDue = TerminalUtils::reformatAmount( + $responseData['BalanceDueAmount'] + ); + } + + if (isset($responseData['AvailableBalance'])) { + $this->deviceResponse->availableBalance = TerminalUtils::reformatAmount( + $responseData['AvailableBalance'] + ); + } + + //set EMV tags + $this->setValueInResponse('emvApplicationId', $responseData, 'EMV_AID'); + $this->setValueInResponse('emvApplicationName', $responseData, 'EMV_ApplicationName'); + $this->setValueInResponse('emvTerminalVerificationResults', $responseData, 'EMV_TVR'); + $this->setValueInResponse('emvCardHolderVerificationMethod', $responseData, 'EMV_TSI'); + $this->setValueInResponse('emvCryptogramType', $responseData, 'EMV_CryptogramType'); + $this->setValueInResponse('emvCryptogram', $responseData, 'EMV_Cryptogram'); + + //send file response + $this->setValueInResponse('maxDataSize', $responseData, 'MaxDataSize'); + + //process transaction based response + $transactionRequests = [ + HpaMessageId::CREDIT_SALE, + HpaMessageId::CREDIT_REFUND, + HpaMessageId::CREDIT_VOID, + HpaMessageId::CARD_VERIFY, + HpaMessageId::CREDIT_AUTH, + HpaMessageId::CAPTURE + ]; + if (in_array($this->deviceResponse->response, $transactionRequests)) { + $this->parseTransactionResponse($responseData); + } + + if ($this->requestType == HpaMessageId::GET_LAST_RESPONSE && + !empty($responseData['LastResponse'])) { + foreach ($responseData['LastResponse'] as $responseKey => $responseValue) { + $key = ($responseKey == 'SIPId' || $responseKey == 'ECRId') ? + strtolower($responseKey) : lcfirst($responseKey); + $this->deviceResponse->lastResponse[$key] = $responseValue; + } + } + } + + private function convertRecordKey($key) + { + //convert "APPLICATION MODE" key as "applicationMode" + $key = strtolower($key); + $key = lcfirst(ucwords($key)); + $key = str_replace(' ', '', $key); + return $key; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Terminals/HPA/Requests/HpaSendFileRequest.php b/lib/vendor/globalpayments/php-sdk/src/Terminals/HPA/Requests/HpaSendFileRequest.php new file mode 100644 index 0000000..f92d8c2 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Terminals/HPA/Requests/HpaSendFileRequest.php @@ -0,0 +1,65 @@ +deviceConfig = $deviceConfig; + } + + public function validate($sendFileInfo) + { + if (empty($sendFileInfo) || empty($sendFileInfo->imageLocation) || + empty($sendFileInfo->imageType)) { + throw new BuilderException("Input error: Image location / type missing"); + } + + //validate file height and width + list($width, $height) = getimagesize($sendFileInfo->imageLocation); + + //validate image size + if ($sendFileInfo->imageType == HpaSendFileType::BANNER) { + if ($this->deviceConfig->deviceType == DeviceType::HPA_ISC250 && + ($height > 60 || $width > 480)) { + throw new BuilderException("Incorrect file height and width"); + } elseif ($this->deviceConfig->deviceType == DeviceType::HPA_IPP350 && + ($height > 40 || $width > 320)) { + throw new BuilderException("Incorrect file height and width"); + } + } elseif ($sendFileInfo->imageType == HpaSendFileType::IDLELOGO) { + if ($this->deviceConfig->deviceType == DeviceType::HPA_ISC250 && + ($height > 272 || $width > 480)) { + throw new BuilderException("Incorrect file height and width"); + } elseif ($this->deviceConfig->deviceType == DeviceType::HPA_IPP350 && + ($height > 240 || $width > 320)) { + throw new BuilderException("Incorrect file height and width"); + } + } + } + + public function getFileInformation($sendFileInfo) + { + try { + //convert image to hexa decimal ASCII format + $hex = unpack("H*", file_get_contents($sendFileInfo->imageLocation)); + $hex = current($hex); + + $fileInfo['fileSize'] = filesize($sendFileInfo->imageLocation); + $fileInfo['fileData'] = $hex; + $fileInfo['fileDataSize'] = strlen($hex); + + return $fileInfo; + } catch (Exception $e) { + throw new BuilderException("Input error: " . $e->getMessage); + } + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Terminals/HPA/Responses/HpaDiagnosticReportResponse.php b/lib/vendor/globalpayments/php-sdk/src/Terminals/HPA/Responses/HpaDiagnosticReportResponse.php new file mode 100644 index 0000000..3be25c9 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Terminals/HPA/Responses/HpaDiagnosticReportResponse.php @@ -0,0 +1,135 @@ +deviceResponse = new HpaResponse(); + + //incase of muliple message needs to be splitted + //convert the response as array using keyword + $messageList = explode('', $gatewayMultipleResponse); + + if (!empty($messageList)) { + foreach ($messageList as $message) { + if (!empty($message)) { + //process individual response + if (strpos($message, '') !== false && !strpos($message, '')) { + $message .= ''; + $this->parseReportResponse($message); + } + } + } + } + + return $this->deviceResponse; + } + + private function parseReportResponse($gatewayResponse) + { + $responseData = TerminalUtils::xmlParse($gatewayResponse); + + if (!empty($responseData)) { + $responseType = lcfirst($responseData['Response']); + + $this->setValue('versionNumber', $responseData, 'Version'); + $this->setValue('ecrId', $responseData, 'ECRId'); + $this->setValue('sipId', $responseData, 'SIPId'); + $this->setValue('deviceId', $responseData, 'DeviceId'); + $this->setValue('response', $responseData, 'Response'); + $this->setValue('multipleMessage', $responseData, 'MultipleMessage'); + $this->setValue('resultCode', $responseData, 'Result'); + $this->setValue('responseCode', $responseData, 'ResponseCode'); + $this->setValue('resultText', $responseData, 'ResultText'); + $this->setValue('requestId', $responseData, 'RequestId'); + + if (!empty($responseData['Record'])) { + //for GetDiagnosticReport + $this->parseResponseRecord($responseData['Record'], $responseType); + } + } + } + + private function parseResponseRecord($gatewayRecord, $recordType) + { + if (!empty($gatewayRecord['Field'])) { + $data = []; + if (isset($gatewayRecord['Field']['Key']) && isset($gatewayRecord['Field']['Value'])) { + $field = $gatewayRecord['Field']; + $key = $this->formatKey($field['Key']); + $data["$key"] = $field['Value']; + } else { + //incase of multi dimensional array + foreach ($gatewayRecord['Field'] as $field) { + if (isset($field['Key']) && isset($field['Value'])) { + $key = $this->formatKey($field['Key']); + + //convert the string as array when same key value pair repeated + if (isset($data[$key])) { + if (is_array($data[$key]) === false) { + //convert string to array and assign last string as first element of array + $prevValue = $data[$key]; + $data[$key] = [$prevValue]; + } + + $data[$key][] = $field['Value']; + } else { + $data[$key] = $field['Value']; + } + } + } + } + if ($recordType == 'getdiagnosticreport') { + $tableCategory = $this->formatTableCategory($gatewayRecord); + + $this->deviceResponse->responseData[$recordType] + [$tableCategory] [] = $data; + } elseif (!empty($this->deviceResponse->responseData[$recordType])) { + $this->deviceResponse->responseData[$recordType][] = $data; + } else { + $this->deviceResponse->responseData[$recordType] = $data; + } + } + } + + /* + * Set transaction based response in $deviceResponse + * + * @param string $propertyName $deviceResponse object property name + * @param array $response + * @param string $responseKey response key received from device + */ + + private function setValue($propertyName, $response, $responseKey) + { + if (isset($response[$responseKey])) { + $this->deviceResponse->{$propertyName} = $response[$responseKey]; + } + } + + private function formatKey($key) + { + //convert "APPLICATION MODE" key as "applicationMode" + $key = ucwords(strtolower($key)); + $key = str_replace(' ', '', $key); + return $key; + } + + private function formatTableCategory($gatewayRecord) + { + $tableCategory = (!empty($gatewayRecord['TableCategory'])) ? + lcfirst(ucwords(strtolower($gatewayRecord['TableCategory']))) : 'batchReport'; + + $tableCategory = str_replace(' ', '', $tableCategory); + + return $tableCategory; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Terminals/HPA/Responses/HpaEodResponse.php b/lib/vendor/globalpayments/php-sdk/src/Terminals/HPA/Responses/HpaEodResponse.php new file mode 100644 index 0000000..eedc9ad --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Terminals/HPA/Responses/HpaEodResponse.php @@ -0,0 +1,174 @@ +deviceResponse = new HpaResponse(); + $this->deviceResponse->responseData = [ + 'getBatchReport' => [ + 'batchSummary' => [], + 'batchReport' => [], + 'visaCardSummary' => [], + 'mastercardCardSummary' => [], + 'americanExpressCardSummary' => [], + 'discoverCardSummary' => [], + 'paypalCardSummary' => [], + 'batchDetail' => [], + 'transactionDetails' => [] + ] + ]; + + //incase of muliple message needs to be splitted + //convert the response as array using keyword + $messageList = explode('', $gatewayMultipleResponse); + + if (!empty($messageList)) { + foreach ($messageList as $message) { + if (!empty($message)) { + //process individual response + if (strpos($message, '') !== false && !strpos($message, '')) { + $message .= ''; + $this->parseEODResponse($message); + } + } + } + } + + return $this->deviceResponse; + } + + private function parseEODResponse($gatewayResponse) + { + $responseData = TerminalUtils::xmlParse($gatewayResponse); + + if (!empty($responseData)) { + $responseType = lcfirst($responseData['Response']); + + if (!empty($responseData['Record'])) { + //for GetBatchReport + $this->parseResponseRecord($responseData['Record'], $responseType); + } elseif ($responseData['Response'] == 'EOD') { + //process main EOD response + $this->setValue('versionNumber', $responseData, 'Version'); + $this->setValue('ecrId', $responseData, 'ECRId'); + $this->setValue('sipId', $responseData, 'SIPId'); + $this->setValue('deviceId', $responseData, 'DeviceId'); + $this->setValue('response', $responseData, 'Response'); + $this->setValue('multipleMessage', $responseData, 'MultipleMessage'); + $this->setValue('resultCode', $responseData, 'Result'); + $this->setValue('transactionId', $responseData, 'ResponseId'); + $this->setValue('responseCode', $responseData, 'ResponseCode'); + $this->setValue('resultText', $responseData, 'ResultText'); + $this->setValue('requestId', $responseData, 'RequestId'); + + //EOD specific + $this->setValue('reversal', $responseData, 'Reversal'); + $this->setValue('emvOfflineDecline', $responseData, 'EMVOfflineDecline'); + $this->setValue('transactionCertificate', $responseData, 'TransactionCertificate'); + $this->setValue('attachment', $responseData, 'Attachment'); + $this->setValue('sendSAF', $responseData, 'SendSAF'); + $this->setValue('batchClose', $responseData, 'BatchClose'); + $this->setValue('heartBeat', $responseData, 'HeartBeat'); + $this->setValue('eMVPDL', $responseData, 'EMVPDL'); + } + } + } + + private function parseResponseRecord($gatewayRecord, $recordType) + { + if (!empty($gatewayRecord['Field'])) { + $data = []; + if (isset($gatewayRecord['Field']['Key']) && isset($gatewayRecord['Field']['Value'])) { + $field = $gatewayRecord['Field']; + $key = $this->formatKey($field['Key']); + $data["$key"] = $this->formatValue($key, $field['Value']); + } else { + //incase of multi dimensional array + foreach ($gatewayRecord['Field'] as $field) { + if (isset($field['Key']) && isset($field['Value'])) { + $key = $this->formatKey($field['Key']); + + //convert the string as array when same key value pair repeated + if (isset($data[$key])) { + if (is_array($data[$key]) === false) { + //convert string to array and assign last string as first element of array + $prevValue = $data[$key]; + $data[$key] = [$prevValue]; + } + + $data[$key][] = $this->formatValue($key, $field['Value']); + } else { + $data[$key] = $this->formatValue($key, $field['Value']); + } + } + } + } + if ($recordType == 'getBatchReport' || $recordType == 'sendSAF') { + $tableCategory = $this->formatTableCategory($gatewayRecord); + + $this->deviceResponse->responseData[$recordType] + [$tableCategory] [] = $data; + } elseif (!empty($this->deviceResponse->responseData[$recordType])) { + $this->deviceResponse->responseData[$recordType][] = $data; + } else { + $this->deviceResponse->responseData[$recordType] = $data; + } + } + } + + /* + * Set transaction based response in $deviceResponse + * + * @param string $propertyName $deviceResponse object property name + * @param array $response + * @param string $responseKey response key received from device + */ + + private function setValue($propertyName, $response, $responseKey) + { + if (isset($response[$responseKey])) { + $this->deviceResponse->{$propertyName} = $response[$responseKey]; + } + } + + private function formatKey($key) + { + //convert "APPLICATION MODE" key as "applicationMode" + $key = lcfirst(ucwords($key)); + $key = str_replace(' ', '', $key); + return $key; + } + + private function formatValue($key, $value) + { + if (!empty($value) && (stripos($key, 'amt') !== false || stripos($key, 'amount') !== false)) { + return TerminalUtils::reformatAmount($value); + } + return $value; + } + + private function formatTableCategory($gatewayRecord) + { + $tableCategory = (!empty($gatewayRecord['TableCategory'])) ? + lcfirst(ucwords(strtolower($gatewayRecord['TableCategory']))) : 'batchReport'; + $tableCategory = str_replace(' ', '', $tableCategory); + + $tableCategory = preg_match("/transaction[0-9]+Detail/", $tableCategory) ? + 'transactionDetails' : $tableCategory; + + //convert approvedSaf#1Record into approvedSafRecords + $tableCategory = preg_match("/\#[0-9]+Record/", $tableCategory) ? + preg_replace("/\#[0-9]+Record/", '', $tableCategory) . 'Records' : $tableCategory; + + return $tableCategory; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Terminals/HPA/Responses/HpaSendSafResponse.php b/lib/vendor/globalpayments/php-sdk/src/Terminals/HPA/Responses/HpaSendSafResponse.php new file mode 100644 index 0000000..4711d92 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Terminals/HPA/Responses/HpaSendSafResponse.php @@ -0,0 +1,160 @@ +deviceResponse = new HpaResponse(); + $this->deviceResponse->responseData = [ + 'sendSAF' => [ + 'approvedSafSummary' => [], + 'pendingSafSummary' => [], + 'declinedSafSummary' => [], + 'offlineApprovedSafSummary' => [], + 'partiallyApprovedSafSummary' => [], + 'approvedSafVoidSummary' => [], + 'pendingSafVoidSummary' => [], + 'declinedSafVoidSummary' => [] + ] + ]; + + //incase of muliple message needs to be splitted + //convert the response as array using keyword + $messageList = explode('', $gatewayMultipleResponse); + + if (!empty($messageList)) { + foreach ($messageList as $message) { + if (!empty($message)) { + //process individual response + if (strpos($message, '') !== false && !strpos($message, '')) { + $message .= ''; + $this->parseSAFResponse($message); + } + } + } + } + + return $this->deviceResponse; + } + + private function parseSAFResponse($gatewayResponse) + { + $responseData = TerminalUtils::xmlParse($gatewayResponse); + + if (!empty($responseData)) { + $responseType = lcfirst($responseData['Response']); + + if (!empty($responseData['Record'])) { + //other than SendSAF + $this->parseResponseRecord($responseData['Record'], $responseType); + } + if ($responseData['Response'] == 'SendSAF') { + //process main SendSAF response + $this->setValue('versionNumber', $responseData, 'Version'); + $this->setValue('ecrId', $responseData, 'ECRId'); + $this->setValue('sipId', $responseData, 'SIPId'); + $this->setValue('deviceId', $responseData, 'DeviceId'); + $this->setValue('response', $responseData, 'Response'); + $this->setValue('multipleMessage', $responseData, 'MultipleMessage'); + $this->setValue('resultCode', $responseData, 'Result'); + $this->setValue('transactionId', $responseData, 'ResponseId'); + $this->setValue('responseCode', $responseData, 'ResponseCode'); + $this->setValue('resultText', $responseData, 'ResultText'); + } + } + } + + private function parseResponseRecord($gatewayRecord, $recordType) + { + if (!empty($gatewayRecord['Field'])) { + $data = []; + if (isset($gatewayRecord['Field']['Key']) && isset($gatewayRecord['Field']['Value'])) { + $field = $gatewayRecord['Field']; + $key = $this->formatKey($field['Key']); + $data["$key"] = $this->formatValue($key, $field['Value']); + } else { + //incase of multi dimensional array + foreach ($gatewayRecord['Field'] as $field) { + if (isset($field['Key']) && isset($field['Value'])) { + $key = $this->formatKey($field['Key']); + + //convert the string as array when same key value pair repeated + if (isset($data[$key])) { + if (is_array($data[$key]) === false) { + //convert string to array and assign last string as first element of array + $prevValue = $data[$key]; + $data[$key] = [$prevValue]; + } + + $data[$key][] = $this->formatValue($key, $field['Value']); + } else { + $data[$key] = $this->formatValue($key, $field['Value']); + } + } + } + } + if ($recordType == 'sendSAF') { + $tableCategory = $this->formatTableCategory($gatewayRecord); + + $this->deviceResponse->responseData[$recordType] + [$tableCategory] [] = $data; + } elseif (!empty($this->deviceResponse->responseData[$recordType])) { + $this->deviceResponse->responseData[$recordType][] = $data; + } else { + $this->deviceResponse->responseData[$recordType] = $data; + } + } + } + + /* + * Set transaction based response in $deviceResponse + * + * @param string $propertyName $deviceResponse object property name + * @param array $response + * @param string $responseKey response key received from device + */ + + private function setValue($propertyName, $response, $responseKey) + { + if (isset($response[$responseKey])) { + $this->deviceResponse->{$propertyName} = $response[$responseKey]; + } + } + + private function formatKey($key) + { + //convert "APPLICATION MODE" key as "applicationMode" + $key = lcfirst(ucwords($key)); + $key = str_replace(' ', '', $key); + return $key; + } + + private function formatValue($key, $value) + { + if (!empty($value) && (stripos($key, 'amt') !== false || stripos($key, 'amount') !== false)) { + return TerminalUtils::reformatAmount($value); + } + return $value; + } + + private function formatTableCategory($gatewayRecord) + { + $tableCategory = (!empty($gatewayRecord['TableCategory'])) ? + lcfirst(ucwords(strtolower($gatewayRecord['TableCategory']))) : 'overallReport'; + $tableCategory = str_replace(' ', '', $tableCategory); + + //convert approvedSaf#1Record into approvedSafRecords + $tableCategory = preg_match("/\#[0-9]+Record/", $tableCategory) ? + preg_replace("/\#[0-9]+Record/", '', $tableCategory) . 'Records' : $tableCategory; + + return $tableCategory; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Terminals/Interfaces/IDeviceCommInterface.php b/lib/vendor/globalpayments/php-sdk/src/Terminals/Interfaces/IDeviceCommInterface.php new file mode 100644 index 0000000..0367698 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Terminals/Interfaces/IDeviceCommInterface.php @@ -0,0 +1,14 @@ +')); + $gatewayResponse = str_replace(['&', '''], ['&', "'"], $gatewayResponse); + + //convert xml to PHP array + $responseXml = simplexml_load_string($gatewayResponse); + $responseJson = json_encode($responseXml); + $responseData = json_decode($responseJson, true); + + return $responseData; + } + + public static function formatAmount($amount) + { + return preg_replace('/[^0-9]/', '', sprintf('%01.2f', $amount)); + } + + public static function reformatAmount($amount) + { + return $amount / 100; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/src/Utils/GenerationUtils.php b/lib/vendor/globalpayments/php-sdk/src/Utils/GenerationUtils.php new file mode 100644 index 0000000..29e19cc --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/src/Utils/GenerationUtils.php @@ -0,0 +1,159 @@ +format('YmdHis'); + } + + /** + * Order Id for a initial request should be unique per client ID. This method + * generates a unique order ID using the PHP GUID function and then converts + * it to base64 to shorten the length to 22 characters. Order Id for a subsequent + * request (void, rebate, settle etc.) should use the order Id of the initial + * request. + * + * The order ID uses the PHP GUID (globally unique identifier), so in theory, + * it may not be unique but the odds of this are extremely remote (see + * https://en.wikipedia.org/wiki/Globally_unique_identifier) + * + * @return string + */ + public static function generateOrderId() + { + $uuid = self::getGuid(); + $mostSignificantBits = substr($uuid, 0, 8); + $leastSignificantBits = substr($uuid, 23, 8); + + return substr( + base64_encode($mostSignificantBits . $leastSignificantBits), + 0, + 22 + ); + } + + public static function generateRecurringKey($key = null) + { + if ($key !== null) { + return $key; + } + + $uuid = self::getGuid(); + return strtolower($uuid); + } + + public static function getGuid() + { + if (function_exists('com_create_guid')) { + return trim(com_create_guid(), '{}'); + } + + $data = openssl_random_pseudo_bytes(16); + $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100 + $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 + return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); + } + + public static function convertArrayToJson($request, $hppVersion = '') + { + if ($hppVersion != HppVersion::VERSION_2) { + $request = array_map('base64_encode', $request); + } + return json_encode($request); + } + + public static function decodeJson($json, $returnArray = true, $hppVersion = '') + { + if ($hppVersion != HppVersion::VERSION_2) { + return array_map('base64_decode', json_decode($json, true)); + } + return json_decode($json, $returnArray); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Data/TestCards.php b/lib/vendor/globalpayments/php-sdk/test/Data/TestCards.php new file mode 100644 index 0000000..b132d9a --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Data/TestCards.php @@ -0,0 +1,271 @@ +value = $card->value; + $data->encryptionData = $card->encryptionData; + $data->pinBlock = $pinBlock; + return $data; + } + + public static function asEBTTrack($card, $pinBlock) + { + $data = new EBTTrackData(); + $data->value = $card->value; + $data->entryMethod = $card->entryMethod; + $data->encryptionData = $card->encryptionData; + $data->pinBlock = $pinBlock; + return $data; + } + + public static function asEBTManual($card, $pinBlock) + { + $data = new EBTCardData(); + $data->number = $card->number; + $data->expMonth = $card->expMonth; + $data->expYear = $card->expYear; + $data->pinBlock = $pinBlock; + return $data; + } + + public static function visaManual($cardPresent = false, $readerPresent = false) + { + $data = new CreditCardData(); + $data->number = '4012002000060016'; + $data->expMonth = 12; + $data->expYear = 2025; + $data->cvn = '123'; + $data->cardPresent = $cardPresent; + $data->readerPresent = $readerPresent; + return $data; + } + + public static function visaSwipe($entryMethod = null) + { + if ($entryMethod === null) { + $entryMethod = EntryMethod::SWIPE; + } + + $data = new CreditTrackData(); + $data->value = '%B4012002000060016^VI TEST CREDIT^251210118039000000000396?;4012002000060016=25121011803939600000?'; + $data->entryMethod = $entryMethod; + return $data; + } + + public static function visaSwipeEncrypted($entryMethod = null) + { + if ($entryMethod === null) { + $entryMethod = EntryMethod::SWIPE; + } + + $encryptionData = new EncryptionData(); + $encryptionData->version = '01'; + + $data = new CreditTrackData(); + $data->value = ';'; + $data->entryMethod = $entryMethod; + $data->encryptionData = $encryptionData; + return $data; + } + + public static function masterCardManual($cardPresent = false, $readerPresent = false) + { + $data = new CreditCardData(); + $data->number = '5473500000000014'; + $data->expMonth = 12; + $data->expYear = 2025; + $data->cvn = '123'; + $data->cardPresent = $cardPresent; + $data->readerPresent = $readerPresent; + return $data; + } + + public static function masterCardSeries2Manual($cardPresent = false, $readerPresent = false) + { + $data = new CreditCardData(); + $data->number = '2223000010005780'; + $data->expMonth = 12; + $data->expYear = 2019; + $data->cvn = '123'; + $data->cardPresent = $cardPresent; + $data->readerPresent = $readerPresent; + return $data; + } + + public static function masterCardSwipe($entryMethod = null) + { + if ($entryMethod === null) { + $entryMethod = EntryMethod::SWIPE; + } + + $data = new CreditTrackData(); + $data->value = '%B5473500000000014^MC TEST CARD^251210199998888777766665555444433332?;5473500000000014=25121019999888877776?'; + $data->entryMethod = $entryMethod; + return $data; + } + + public static function masterCard24Swipe($entryMethod = null) + { + if ($entryMethod === null) { + $entryMethod = EntryMethod::SWIPE; + } + + $data = new CreditTrackData(); + $data->value = '%B2223000010005780^TEST CARD/EMV BIN-2^19121010000000009210?;2223000010005780=19121010000000009210?'; + $data->entryMethod = $entryMethod; + return $data; + } + + public static function masterCard25Swipe($entryMethod = null) + { + if ($entryMethod === null) { + $entryMethod = EntryMethod::SWIPE; + } + + $data = new CreditTrackData(); + $data->value = '%B2223000010005798^TEST CARD/EMV BIN-2^19121010000000003840?;2223000010005798=19121010000000003840?'; + $data->entryMethod = $entryMethod; + return $data; + } + + public static function masterCardSwipeEncrypted($entryMethod = null) + { + if ($entryMethod === null) { + $entryMethod = EntryMethod::SWIPE; + } + + $encryptionData = new EncryptionData(); + $encryptionData->version = '01'; + + $data = new CreditTrackData(); + $data->value = ''; + $data->entryMethod = $entryMethod; + $data->encryptionData = $encryptionData; + return $data; + } + + public static function discoverManual($cardPresent = false, $readerPresent = false) + { + $data = new CreditCardData(); + $data->number = '6011000990156527'; + $data->expMonth = 12; + $data->expYear = 2025; + $data->cvn = '123'; + $data->cardPresent = $cardPresent; + $data->readerPresent = $readerPresent; + return $data; + } + + public static function discoverSwipe($entryMethod = null) + { + if ($entryMethod === null) { + $entryMethod = EntryMethod::SWIPE; + } + + $data = new CreditTrackData(); + $data->value = '%B6011000990156527^DIS TEST CARD^25121011000062111401?;6011000990156527=25121011000062111401?'; + $data->entryMethod = $entryMethod; + return $data; + } + + public static function discoverSwipeEncrypted($entryMethod = null) + { + if ($entryMethod === null) { + $entryMethod = EntryMethod::SWIPE; + } + + $encryptionData = new EncryptionData(); + $encryptionData->version = '01'; + + $data = new CreditTrackData(); + $data->value = ''; + $data->entryMethod = $entryMethod; + $data->encryptionData = $encryptionData; + return $data; + } + + public static function amexManual($cardPresent = false, $readerPresent = false) + { + $data = new CreditCardData(); + $data->number = '372700699251018'; + $data->expMonth = 12; + $data->expYear = 2025; + $data->cvn = '1234'; + $data->cardPresent = $cardPresent; + $data->readerPresent = $readerPresent; + return $data; + } + + public static function amexSwipe($entryMethod = null) + { + if ($entryMethod === null) { + $entryMethod = EntryMethod::SWIPE; + } + + $data = new CreditTrackData(); + $data->value = '%B3727 006992 51018^AMEX TEST CARD^2512990502700?;372700699251018=2512990502700?'; + $data->entryMethod = $entryMethod; + return $data; + } + + public static function jcbManual($cardPresent = false, $readerPresent = false) + { + $data = new CreditCardData(); + $data->number = '3566007770007321'; + $data->expMonth = 12; + $data->expYear = 2025; + $data->cvn = '123'; + $data->cardPresent = $cardPresent; + $data->readerPresent = $readerPresent; + return $data; + } + + public static function jcbSwipe($entryMethod = null) + { + if ($entryMethod === null) { + $entryMethod = EntryMethod::SWIPE; + } + + $data = new CreditTrackData(); + $data->value = '%B3566007770007321^JCB TEST CARD^2512101100000000000000000064300000?;3566007770007321=25121011000000076435?'; + $data->entryMethod = $entryMethod; + return $data; + } + + public static function giftCard1Swipe() + { + $data = new GiftCard(); + $data->trackData = '%B5022440000000000098^^391200081613?;5022440000000000098=391200081613?'; + return $data; + } + + public static function giftCard2Manual() + { + $data = new GiftCard(); + $data->number = '5022440000000000007'; + return $data; + } + + public static function gsbManual() + { + $data = new CreditCardData(); + $data->number = '6277220572999800'; + $data->expMonth = '12'; + $data->expYear = '2049'; + return $data; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Data/TestChecks.php b/lib/vendor/globalpayments/php-sdk/test/Data/TestChecks.php new file mode 100644 index 0000000..70eadae --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Data/TestChecks.php @@ -0,0 +1,37 @@ +accountNumber = '24413815'; + $check->routingNumber = '490000018'; + $check->checkType = $checkType; + $check->accountType = $accountType; + $check->secCode = $secCode; + $check->entryMode = EntryMethod::MANUAL; + $check->checkHolderName = 'John Doe'; + $check->driversLicenseNumber = '09876543210'; + $check->driversLicenseState = 'TX'; + $check->phoneNumber = '8003214567'; + $check->birthYear = '1997'; + $check->ssnLast4 = '4321'; + if (!empty($checkHolderName)) { + $check->checkHolderName = $checkHolderName; + } + return $check; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/AchTest.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/AchTest.php new file mode 100644 index 0000000..61e4a85 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/AchTest.php @@ -0,0 +1,65 @@ +eCheck = new ECheck(); + $this->eCheck->accountNumber = '24413815'; + $this->eCheck->routingNumber = '490000018'; + $this->eCheck->checkType = CheckType::PERSONAL; + $this->eCheck->secCode = SecCode::PPD; + $this->eCheck->accountType = AccountType::CHECKING; + $this->eCheck->entryMode = EntryMethod::MANUAL; + $this->eCheck->checkHolderName = 'John Doe'; + $this->eCheck->driversLicenseNumber = '09876543210'; + $this->eCheck->driversLicenseState = 'TX'; + $this->eCheck->phoneNumber = '8003214567'; + $this->eCheck->birthYear = '1997'; + $this->eCheck->ssnLast4 = '4321'; + + $this->address = new Address(); + $this->address->streetAddress1 = '123 Main St.'; + $this->address->city = 'Downtown'; + $this->address->state = 'NJ'; + $this->address->postalCode = '12345'; + + ServicesContainer::configure($this->getConfig()); + } + + public function testCheckSale() + { + $response = $this->eCheck->charge(11) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + protected function getConfig() + { + $config = new ServicesConfig(); + $config->secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; + $config->serviceUrl = ($this->enableCryptoUrl) ? + 'https://cert.api2-c.heartlandportico.com/': + 'https://cert.api2.heartlandportico.com'; + return $config; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.php new file mode 100644 index 0000000..3077c4e --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.php @@ -0,0 +1,481 @@ +secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; + $config->serviceUrl = ($this->enableCryptoUrl) ? + 'https://cert.api2-c.heartlandportico.com/': + 'https://cert.api2.heartlandportico.com'; + return $config; + } + + protected function setup() + { + ServicesContainer::configure($this->config()); + + $this->address = new Address(); + $this->address->streetAddress1 = '123 Main St.'; + $this->address->city = 'Downtown'; + $this->address->province = 'NJ'; + $this->address->postalCode = '12345'; + } + + /// ACH Debit - Consumer + + public function test001ConsumerPersonalChecking() + { + $check = TestChecks::certification( + SecCode::PPD, + CheckType::PERSONAL, + AccountType::CHECKING + ); + + $response = $check->charge(11.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // test case 25 + $voidResponse = $response->void()->execute(); + $this->assertNotNull($voidResponse); + $this->assertEquals('00', $voidResponse->responseCode); + } + + public function test002ConsumerBusinessChecking() + { + $check = TestChecks::certification( + SecCode::PPD, + CheckType::BUSINESS, + AccountType::CHECKING + ); + + $response = $check->charge(12.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test003ConsumerPersonalSavings() + { + $check = TestChecks::certification( + SecCode::PPD, + CheckType::PERSONAL, + AccountType::SAVINGS + ); + + $response = $check->charge(13.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test004ConsumerBusinessSavings() + { + $check = TestChecks::certification( + SecCode::PPD, + CheckType::BUSINESS, + AccountType::SAVINGS + ); + + $response = $check->charge(14.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test005CorporatePersonalChecking() + { + $check = TestChecks::certification( + SecCode::CCD, + CheckType::PERSONAL, + AccountType::CHECKING, + "Heartland Pays" + ); + + $response = $check->charge(15.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // test case 26 + $voidResponse = $response->void()->execute(); + $this->assertNotNull($voidResponse); + $this->assertEquals('00', $voidResponse->responseCode); + } + + public function test006CorporateBusinessChecking() + { + $check = TestChecks::certification( + SecCode::CCD, + CheckType::BUSINESS, + AccountType::CHECKING, + "Heartland Pays" + ); + + $response = $check->charge(16.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test007CorporatePersonalSavings() + { + $check = TestChecks::certification( + SecCode::CCD, + CheckType::PERSONAL, + AccountType::SAVINGS, + "Heartland Pays" + ); + + $response = $check->charge(17.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test008CorporateBusinessSavings() + { + $check = TestChecks::certification( + SecCode::CCD, + CheckType::BUSINESS, + AccountType::SAVINGS, + "Heartland Pays" + ); + + $response = $check->charge(18.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test009EgoldPersonalChecking() + { + $check = TestChecks::certification( + SecCode::POP, + CheckType::PERSONAL, + AccountType::CHECKING + ); + + $response = $check->charge(11.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test010EgoldBusinessChecking() + { + $check = TestChecks::certification( + SecCode::CCD, + CheckType::BUSINESS, + AccountType::CHECKING + ); + + $response = $check->charge(12.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test011EgoldPersonalSavings() + { + $check = TestChecks::certification( + SecCode::POP, + CheckType::PERSONAL, + AccountType::SAVINGS + ); + + $response = $check->charge(13.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test012EgoldBusinessSavings() + { + $check = TestChecks::certification( + SecCode::POP, + CheckType::BUSINESS, + AccountType::SAVINGS + ); + + $response = $check->charge(14.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test013EsilverPersonalChecking() + { + $check = TestChecks::certification( + SecCode::POP, + CheckType::PERSONAL, + AccountType::CHECKING + ); + + $response = $check->charge(15.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test014EsilverBusinessChecking() + { + $check = TestChecks::certification( + SecCode::CCD, + CheckType::BUSINESS, + AccountType::CHECKING + ); + + $response = $check->charge(16.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test015EsilverPersonalSavings() + { + $check = TestChecks::certification( + SecCode::POP, + CheckType::PERSONAL, + AccountType::SAVINGS + ); + + $response = $check->charge(17.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test016EsilverBusinessSavings() + { + $check = TestChecks::certification( + SecCode::POP, + CheckType::BUSINESS, + AccountType::SAVINGS + ); + + $response = $check->charge(18.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + * @expectedExceptionMessage Processor Configuration error + */ + public function test017EbronzePersonalChecking() + { + $check = TestChecks::certification( + SecCode::EBRONZE, + CheckType::PERSONAL, + AccountType::CHECKING + ); + + $response = $check->charge(19.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + * @expectedExceptionMessage Processor Configuration error + */ + public function test018EbronzeBusinessChecking() + { + $check = TestChecks::certification( + SecCode::EBRONZE, + CheckType::BUSINESS, + AccountType::CHECKING + ); + + $response = $check->charge(20.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + * @expectedExceptionMessage Processor Configuration error + */ + public function test019EbronzePersonalSavings() + { + $check = TestChecks::certification( + SecCode::EBRONZE, + CheckType::PERSONAL, + AccountType::SAVINGS + ); + + $response = $check->charge(21.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + * @expectedExceptionMessage Processor Configuration error + */ + public function test020EbronzeBusinessSavings() + { + $check = TestChecks::certification( + SecCode::EBRONZE, + CheckType::BUSINESS, + AccountType::SAVINGS + ); + + $response = $check->charge(22.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test021WebPersonalChecking() + { + $check = TestChecks::certification( + SecCode::WEB, + CheckType::PERSONAL, + AccountType::CHECKING + ); + + $response = $check->charge(23.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test022WebBusinessChecking() + { + $check = TestChecks::certification( + SecCode::WEB, + CheckType::BUSINESS, + AccountType::CHECKING + ); + + $response = $check->charge(24.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test023WebPersonalSavings() + { + $check = TestChecks::certification( + SecCode::WEB, + CheckType::PERSONAL, + AccountType::SAVINGS + ); + + $response = $check->charge(25.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test024WebBusinessSavings() + { + $check = TestChecks::certification( + SecCode::WEB, + CheckType::BUSINESS, + AccountType::SAVINGS + ); + + $response = $check->charge(5.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.php new file mode 100644 index 0000000..19e5d5a --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.php @@ -0,0 +1,108 @@ +secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; + $config->serviceUrl = ($this->enableCryptoUrl) ? + 'https://cert.api2-c.heartlandportico.com/': + 'https://cert.api2.heartlandportico.com'; + return $config; + } + + protected function setup() + { + ServicesContainer::configure($this->config()); + + $this->address = new Address(); + $this->address->streetAddress1 = '123 Main St.'; + $this->address->city = 'Downtown'; + $this->address->province = 'NJ'; + $this->address->postalCode = '12345'; + } + + public function test001ConsumerPersonalChecking() + { + $check = TestChecks::certification( + SecCode::WEB, + CheckType::PERSONAL, + AccountType::CHECKING + ); + + $response = $check->charge(19.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test002ConsumerBusinessChecking() + { + $check = TestChecks::certification( + SecCode::WEB, + CheckType::BUSINESS, + AccountType::CHECKING + ); + + $response = $check->charge(20.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test003ConsumerPersonalSavings() + { + $check = TestChecks::certification( + SecCode::WEB, + CheckType::PERSONAL, + AccountType::SAVINGS + ); + + $response = $check->charge(21.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test004ConsumerBusinessSavings() + { + $check = TestChecks::certification( + SecCode::WEB, + CheckType::BUSINESS, + AccountType::SAVINGS + ); + + $response = $check->charge(22.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.php new file mode 100644 index 0000000..ec0d09a --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.php @@ -0,0 +1,1668 @@ +secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; + $config->serviceUrl = ($this->enableCryptoUrl) ? + 'https://cert.api2-c.heartlandportico.com/': + 'https://cert.api2.heartlandportico.com'; + return $config; + } + + protected function setup() + { + ServicesContainer::configure($this->config()); + $this->publicKey = 'pkapi_cert_jKc1FtuyAydZhZfbB3'; + + $this->ecommerceInfo = new EcommerceInfo(); + $this->ecommerceInfo->channel = EcommerceChannel::ECOM; + } + + public function test000CloseBatch() + { + try { + $response = BatchService::closeBatch(); + $this->assertNotNull($response); + } catch (ApiException $e) { + if (false === strpos($e->getMessage(), static::BATCH_NOT_OPEN) + && false === strpos($e->getMessage(), static::NO_TRANS_IN_BATCH) + ) { + $this->fail($e->getMessage()); + } + } + } + + /// CARD VERIFY + + /// Account Verification + + public function test001VerifyVisa() + { + $card = TestCards::visaManual(); + + $response = $card->verify() + ->withRequestMultiUseToken($this->useTokens) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test002VerifyMasterCard() + { + $card = TestCards::masterCardManual(); + $response = $card->verify() + ->withRequestMultiUseToken($this->useTokens) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test003VerifyDiscover() + { + $address = new Address(); + $address->postalCode = '75024'; + + $card = TestCards::discoverManual(); + + $response = $card->verify() + ->withAddress($address) + ->withRequestMultiUseToken($this->useTokens) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// Address Verification + + public function test004VerifyAmex() + { + $address = new Address(); + $address->postalCode = '75024'; + + $card = TestCards::amexManual(); + + $response = $card->verify() + ->withAddress($address) + ->withRequestMultiUseToken($this->useTokens) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// Balance Inquiry (for Prepaid Card) + + public function test005BalanceInquiryVisa() + { + if (false === $this->usePrepaid) { + $this->markTestSkipped('GSB not configured'); + } + + $card = TestCards::visaManual(); + + $response = $card->balanceInquiry() + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// CREDIT SALE (For Multi-Use Token Only) + + public function test006ChargeVisaToken() + { + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '75024'; + + $card = TestCards::visaManual(); + + $response = $card->charge() + ->withCurrency('USD') + ->withAmount(13.01) + ->withAddress($address) + ->withRequestMultiUseToken(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals(true, $response->token != null); + self::$visaToken = $response->token; + } + + public function test007ChargeMasterCardToken() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::masterCardManual(); + + $response = $card->charge() + ->withCurrency('USD') + ->withAmount(13.02) + ->withAddress($address) + ->withRequestMultiUseToken(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals(true, $response->token != null); + self::$mastercardToken = $response->token; + } + + public function test008ChargeDiscoverToken() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '750241234'; + + $card = TestCards::discoverManual(); + + $response = $card->charge() + ->withCurrency('USD') + ->withAmount(13.03) + ->withAddress($address) + ->withRequestMultiUseToken(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals(true, $response->token != null); + self::$discoverToken = $response->token; + } + + public function test009ChargeAmexToken() + { + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '75024'; + + $card = TestCards::visaManual(); + + $response = $card->charge() + ->withCurrency('USD') + ->withAmount(13.04) + ->withAddress($address) + ->withRequestMultiUseToken(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals(true, $response->token != null); + self::$amexToken = $response->token; + } + + /// CREDIT SALE + + public function test010ChargeVisa() + { + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '75024'; + + $card = TestCards::visaManual(); + if ($this->useTokens) { + $card = new CreditCardData(); + $card->token = self::$visaToken; + } + + $response = $card->charge() + ->withCurrency('USD') + ->withAmount(17.01) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + + $voidResponse = $response->void() + ->execute(); + $this->assertEquals(true, $voidResponse != null); + $this->assertEquals('00', $voidResponse->responseCode); + } + + public function test011ChargeMastercard() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::masterCardManual(); + if ($this->useTokens) { + $card = new CreditCardData(); + $card->token = self::$mastercardToken; + } + + $response = $card->charge() + ->withCurrency('USD') + ->withAmount(17.02) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test012ChargeDiscover() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '750241234'; + + $card = TestCards::discoverManual(); + if ($this->useTokens) { + $card = new CreditCardData(); + $card->token = self::$discoverToken; + } + + $response = $card->charge() + ->withCurrency('USD') + ->withAmount(17.03) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test013ChargeAmex() + { + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '75024'; + + $card = TestCards::amexManual(); + if ($this->useTokens) { + $card = new CreditCardData(); + $card->token = self::$amexToken; + } + + $response = $card->charge() + ->withCurrency('USD') + ->withAmount(17.04) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test014ChargeJcb() + { + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '75024'; + + $card = TestCards::jcbManual(); + + $response = $card->charge() + ->withCurrency('USD') + ->withAmount(17.04) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test011bChargeMasterCard() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::masterCardSeries2Manual(); + + $response = $card->charge() + ->withCurrency('USD') + ->withAmount(17.02) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// AUTHORIZATION + + public function test015AuthorizationVisa() + { + # Test 015a Authorization + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '75024'; + + + $card = TestCards::visaManual(); + + $response = $card->authorize(17.06) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + + # test 015b Capture/AddToBatch + $capture = $response->capture() + ->execute(); + $this->assertEquals(true, $capture != null); + $this->assertEquals('00', $capture->responseCode); + } + + public function test016AuthorizationMastercard() + { + # Test 016a Authorization + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '750241234'; + + $card = TestCards::masterCardManual(); + + $response = $card->authorize(17.07) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + + # test 016b Capture/AddToBatch + $capture = $response->capture() + ->execute(); + $this->assertEquals(true, $capture != null); + $this->assertEquals('00', $capture->responseCode); + } + + public function test017AuthorizationDiscover() + { + # Test 017a Authorization + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::discoverManual(); + + $response = $card->authorize(17.08) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + + # test 017b Capture/AddToBatch + # do not capture + } + + /// PARTIALLY - APPROVED SALE + + public function test018PartialApprovalVisa() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::visaManual(); + + $response = $card->charge(130) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withAllowPartialAuth(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('10', $response->responseCode); + $this->assertEquals(true, $response->authorizedAmount != null); + $this->assertEquals('110.00', $response->authorizedAmount); + } + + public function test019PartialApprovalDiscover() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::discoverManual(); + + $response = $card->charge(145) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withAllowPartialAuth(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('10', $response->responseCode); + $this->assertEquals(true, $response->authorizedAmount != null); + $this->assertEquals('65.00', $response->authorizedAmount); + } + + public function test020PartialApprovalMastercard() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::discoverManual(); + + $response = $card->charge(155) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withAllowPartialAuth(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('10', $response->responseCode); + $this->assertEquals(true, $response->authorizedAmount != null); + $this->assertEquals('100.00', $response->authorizedAmount); + + $voidResponse = $response->void() + ->execute(); + $this->assertEquals(true, $voidResponse != null); + $this->assertEquals('00', $voidResponse->responseCode); + } + + /// LEVEL II CORPORATE PURCHASE CARD + + public function test021LevelIIResponseB() + { + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '750241234'; + + $card = TestCards::visaManual(); + + $response = $card->charge(112.34) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('B', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withPoNumber('9876543210') + ->withTaxType(TaxType::NOT_USED) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test022LevelIIResponseB() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '750241234'; + + $card = TestCards::visaManual(); + + $response = $card->charge(112.34) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('B', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withTaxType(TaxType::SALES_TAX) + ->withTaxAmount(1.00) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test023LevelIIResponseR() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::visaManual(); + + $response = $card->charge(123.45) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('R', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withTaxType(TaxType::TAX_EXEMPT) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test024LevelIIResponseS() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::visaManual(); + + $response = $card->charge(134.56) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('S', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withPoNumber('9876543210') + ->withTaxType(TaxType::SALES_TAX) + ->withTaxAmount(1.00) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test025LevelIIResponseS() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::masterCardManual(); + + $response = $card->charge(111.06) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('S', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withPoNumber('9876543210') + ->withTaxType(TaxType::NOT_USED) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test026LevelIIResponseS() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::masterCardManual(); + + $response = $card->charge(111.07) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('S', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withTaxType(TaxType::SALES_TAX) + ->withTaxAmount(1.00) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test027LevelIIResponseS() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::masterCardManual(); + + $response = $card->charge(111.08) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('S', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withPoNumber('9876543210') + ->withTaxType(TaxType::SALES_TAX) + ->withTaxAmount(1.00) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test028LevelIIResponseS() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::masterCardManual(); + + $response = $card->charge(111.09) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('S', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withPoNumber('9876543210') + ->withTaxType(TaxType::TAX_EXEMPT) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test029LevelIINoResponse() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::amexManual(); + + $response = $card->charge(111.10) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('0', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withPoNumber('9876543210') + ->withTaxType(TaxType::NOT_USED) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test030LevelIINoResponse() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '750241234'; + + $card = TestCards::amexManual(); + + $response = $card->charge(111.11) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('0', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withTaxType(TaxType::SALES_TAX) + ->withTaxAmount(1.00) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test031LevelIINoResponse() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::amexManual(); + + $response = $card->charge(111.12) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('0', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withPoNumber('9876543210') + ->withTaxType(TaxType::SALES_TAX) + ->withTaxAmount(1.00) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test032LevelIINoResponse() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::amexManual(); + + $response = $card->charge(111.13) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('0', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withPoNumber('9876543210') + ->withTaxType(TaxType::TAX_EXEMPT) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + /// PRIOR / VOICE AUTHORIZATION + + public function test033OfflineSale() + { + $card = TestCards::visaManual(); + + $response = $card->charge(17.10) + ->withCurrency('USD') + ->withModifier(TransactionModifier::OFFLINE) + ->withOfflineAuthCode('654321') + ->withInvoiceNumber('123456') + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test033OfflineAuthorization() + { + $card = TestCards::visaManual(); + + $response = $card->authorize(17.10) + ->withCurrency('USD') + ->withModifier(TransactionModifier::OFFLINE) + ->withOfflineAuthCode('654321') + ->withInvoiceNumber('123456') + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// RETURN + + public function test034OfflineCreditReturn() + { + $card = TestCards::masterCardManual(); + + $response = $card->refund(15.15) + ->withCurrency('USD') + ->withInvoiceNumber('123456') + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test034bOfflineCreditReturn() + { + $card = TestCards::masterCardManual(); + + $response = $card->refund(15.16) + ->withCurrency('USD') + ->withInvoiceNumber('123456') + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// ONLINE VOID / REVERSAL + + public function test035VoidTest10() + { + // see test 010 + } + + public function test036VoidTest20() + { + // see test 020 + } + + /// Time Out Reversal + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\UnsupportedTransactionException + */ + public function test036bTimeoutReversal() + { + $sale = TestCards::visaManual()->charge(911) + ->withCurrency('USD') + ->withClientTransactionId('987321654') + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $sale != null); + $this->assertEquals('91', $sale->responseCode); + + $response = Transaction::fromId(null, PaymentMethodType::CREDIT); + $response->clientTransactionId = '987321654'; + + $response->reverse(911)->execute(); + } + + /// One time bill payment + + public function test010ChargeVisaOneTime() + { + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '75024'; + + $card = null; + if ($this->useTokens) { + $card = new CreditCardData(); + $card->token = static::$visaToken; + } else { + $card = TestCards::visaManual(); + } + + $response = $card->charge(13.11) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withOneTimePayment(true) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + + $void = $response->void()->execute(); + + $this->assertEquals(true, $void != null); + $this->assertEquals('00', $void->responseCode); + } + + public function test011ChargeMasterCardOneTime() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '750241234'; + + $card = null; + if ($this->useTokens) { + $card = new CreditCardData(); + $card->token = static::$mastercardToken; + } else { + $card = TestCards::masterCardManual(); + } + + $response = $card->charge(13.12) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withOneTimePayment(true) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test012ChargeDiscoverOneTime() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = null; + if ($this->useTokens) { + $card = new CreditCardData(); + $card->token = static::$discoverToken; + } else { + $card = TestCards::discoverManual(); + } + + $response = $card->charge(13.13) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withOneTimePayment(true) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test013ChargeAmexOneTime() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = null; + if ($this->useTokens) { + $card = new CreditCardData(); + $card->token = static::$amexToken; + } else { + $card = TestCards::amexManual(); + } + + $response = $card->charge(13.14) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withOneTimePayment(true) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test014ChargeJcbOneTime() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = new CreditCardData(); + $card->number = '3566007770007321'; + $card->expMonth = '12'; + $card->expYear = '2025'; + $card->cvn = '123'; + + $response = $card->charge(13.15) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withOneTimePayment(true) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// ADVANCED FRAUD SCREENING + + /** + * TODO: Change code assertions when AFS is enabled on account + */ + public function test037FraudPreventionSale() + { + $card = TestCards::visaManual(); + + $response = $card->charge(15000) + ->withCurrency('USD') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + // $this->assertEquals('FR', $response->responseCode); + } + + /** + * TODO: Change code assertions when AFS is enabled on account + */ + public function test038FraudPreventionReturn() + { + $card = TestCards::visaManual(); + + $response = $card->refund(15000) + ->withCurrency('USD') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + // $this->assertEquals('41', $response->responseCode); + } + + /// ONE CARD - GSB CARD FUNCTIONS + + /// BALANCE INQUIRY + + public function test037BalanceInquiryGsb() + { + if (false === $this->usePrepaid) { + $this->markTestSkipped('GSB not configured'); + } + + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::gsbManual(); + + $response = $card->balanceInquiry() + ->withAddress($address) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// ADD VALUE + + public function test038AddValueGsb() + { + if (false === $this->usePrepaid) { + $this->markTestSkipped('GSB not configured'); + } + + $card = new CreditTrackData(); + $card->value = '%B6277220572999800^ / ^49121010557010000016000000?F;6277220572999800=49121010557010000016?'; + + $response = $card->addValue(15.00) + ->withCurrency('USD') + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// SALE + + public function test039ChargeGsb() + { + if (false === $this->usePrepaid) { + $this->markTestSkipped('GSB not configured'); + } + + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::gsbManual(); + + $response = $card->charge(2.05) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + + $voidResponse = $response->void() + ->execute(); + $this->assertEquals(true, $voidResponse != null); + $this->assertEquals('00', $voidResponse->responseCode); + } + + public function test040ChargeGsb() + { + if (false === $this->usePrepaid) { + $this->markTestSkipped('GSB not configured'); + } + + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::gsbManual(); + + $response = $card->charge(2.10) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// ONLINE VOID / REVERSAL + + public function test041VoidGsb() + { + // see test 039 + } + + /// HMS GIFT - REWARDS + + /// ACTIVATE + + public function test042ActivateGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->activate(6.00) + ->withCurrency('USD') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test043ActivateGift2() + { + + $card = TestCards::giftCard2Manual(); + + $response = $card->activate(7.00) + ->withCurrency('USD') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// LOAD / ADD VALUE + + public function test044AddValueGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->addValue(8.00) + ->withCurrency('USD') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test045AddValueGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->addValue(9.00) + ->withCurrency('USD') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// BALANCE INQUIRY + + public function test046BalanceInquiryGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->balanceInquiry() + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('10.00', $response->balanceAmount); + } + + public function test047BalanceInquiryGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->balanceInquiry() + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('10.00', $response->balanceAmount); + } + + /// REPLACE / TRANSFER + + public function test048ReplaceGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->replaceWith(TestCards::giftCard2Manual()) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('10.00', $response->balanceAmount); + } + + public function test049ReplaceGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->replaceWith(TestCards::giftCard1Swipe()) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('10.00', $response->balanceAmount); + } + + /// SALE / REDEEM + + public function test050SaleGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->charge(1.00) + ->withCurrency('USD') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test051SaleGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->charge(2.00) + ->withCurrency('USD') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test052SaleGift1Void() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->charge(3.00) + ->withCurrency('USD') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + + $voidResponse = $response->void() + ->execute(); + $this->assertEquals(true, $voidResponse != null); + $this->assertEquals('00', $voidResponse->responseCode); + } + + public function test053SaleGift2Reversal() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->charge(4.00) + ->withCurrency('USD') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + + $reversalResponse = $response->reverse(4.00) + ->execute(); + $this->assertEquals(true, $reversalResponse != null); + $this->assertEquals('00', $reversalResponse->responseCode); + } + + /// VOID + + public function test054VoidGift() + { + // see test 052 + } + + /// REVERSAL + + public function test055ReversalGift() + { + // see test 053 + } + + public function test056ReversalGift2() + { + $card = TestCards::giftCard2Manual(); + + $reversalResponse = $card->reverse(2.00) + ->execute(); + $this->assertEquals(true, $reversalResponse != null); + $this->assertEquals('00', $reversalResponse->responseCode); + } + + /// DEACTIVATE + + public function test057DeactivateGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->deactivate() + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// RECEIPTS MESSAGING + + public function test058ReceiptsMessaging() + { + return; # print and scan receipt for test 51 + } + + /// REWARD + + /// BALANCE INQUIRY + + public function test059BalanceInquiryRewards1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->balanceInquiry() + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('0', $response->pointsBalanceAmount); + } + + public function test060BalanceInquiryRewards2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->balanceInquiry() + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('0', $response->pointsBalanceAmount); + } + + /// ALIAS + + public function test061CreateAliasGift1() + { + $response = GiftCard::create('9725550100'); + + $this->assertEquals(true, $response != null); + } + + public function test062CreateAliasGift2() + { + $response = GiftCard::create('9725550100'); + + $this->assertEquals(true, $response != null); + } + + public function test063AddAliasGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->addAlias('2145550199') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test064AddAliasGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->addAlias('2145550199') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test065DeleteAliasGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->removeAlias('2145550199') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// SALE / REDEEM + + public function test066RedeemPointsGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->charge(100) + ->withCurrency('POINTS') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test067RedeemPointsGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->charge(200) + ->withCurrency('POINTS') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test068RedeemPointsGift2() + { + $card = new GiftCard(); + $card->alias = '9725550100'; + + $response = $card->charge(300) + ->withCurrency('POINTS') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// REWARDS + + public function test069RewardsGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->rewards(10) + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test070RewardsGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->rewards(11) + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// REPLACE / TRANSFER + + public function test071ReplaceGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->replaceWith(TestCards::giftCard2Manual()) + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test072ReplaceGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->replaceWith(TestCards::giftCard1Swipe()) + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// DEACTIVATE + + public function test073DeactivateGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->deactivate() + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test074DeactivateGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->deactivate() + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// RECEIPTS MESSAGING + + public function test075ReceiptsMessaging() + { + return; # print and scan receipt for test 51 + } + + /// CLOSE BATCH + + public function test999CloseBatch() + { + try { + $response = BatchService::closeBatch(); + $this->assertNotNull($response); + // printf('batch id: %s', $response->id); + // printf('sequence number: %s', $response->sequenceNumber); + } catch (ApiException $e) { + if (false === strpos($e->getMessage(), static::BATCH_NOT_OPEN) + && false === strpos($e->getMessage(), static::NO_TRANS_IN_BATCH) + ) { + $this->fail($e->getMessage()); + } + } + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.php new file mode 100644 index 0000000..6400b5c --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.php @@ -0,0 +1,108 @@ +secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; + $config->serviceUrl = ($this->enableCryptoUrl) ? + 'https://cert.api2-c.heartlandportico.com/': + 'https://cert.api2.heartlandportico.com'; + return $config; + } + + protected function setup() + { + ServicesContainer::configure($this->config()); + + $this->address = new Address(); + $this->address->streetAddress1 = '123 Main St.'; + $this->address->city = 'Downtown'; + $this->address->province = 'NJ'; + $this->address->postalCode = '12345'; + } + + public function test001ConsumerPersonalChecking() + { + $check = TestChecks::certification( + SecCode::WEB, + CheckType::PERSONAL, + AccountType::CHECKING + ); + + $response = $check->charge(19.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test002ConsumerBusinessChecking() + { + $check = TestChecks::certification( + SecCode::WEB, + CheckType::BUSINESS, + AccountType::CHECKING + ); + + $response = $check->charge(20.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test003ConsumerPersonalSavings() + { + $check = TestChecks::certification( + SecCode::WEB, + CheckType::PERSONAL, + AccountType::SAVINGS + ); + + $response = $check->charge(21.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test004ConsumerBusinessSavings() + { + $check = TestChecks::certification( + SecCode::WEB, + CheckType::BUSINESS, + AccountType::SAVINGS + ); + + $response = $check->charge(22.00) + ->withCurrency('USD') + ->withAddress($this->address) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.php new file mode 100644 index 0000000..7c2d29e --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.php @@ -0,0 +1,1697 @@ +secretApiKey = 'skapi_cert_MRCQAQBC_VQACBE0rFaZlbDDPieMGP06JDAtjyS7NQ'; + $config->serviceUrl = ($this->enableCryptoUrl) ? + 'https://cert.api2-c.heartlandportico.com/': + 'https://cert.api2.heartlandportico.com'; + return $config; + } + + protected function setup() + { + ServicesContainer::configure($this->config()); + + $this->ecommerceInfo = new EcommerceInfo(); + $this->ecommerceInfo->channel = EcommerceChannel::MOTO; + } + + public function test000CloseBatch() + { + try { + $response = BatchService::closeBatch(); + $this->assertNotNull($response); + // print 'batch id: ' . $response->id . "\n"; + // print 'sequence number: ' . $response->sequenceNumber . "\n"; + } catch (ApiException $e) { + if (false === strpos($e->getMessage(), static::BATCH_NOT_OPEN) + && false === strpos($e->getMessage(), static::NO_TRANS_IN_BATCH) + ) { + $this->fail($e->getMessage()); + } + } + } + + public function test001VerifyVisa() + { + $card = new CreditCardData(); + $card->number = '4484958240202792'; + $card->expMonth = '12'; + $card->expYear = '2025'; + + $response = $card->verify() + ->withRequestMultiUseToken($this->useTokens) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test002VerifyMasterCard() + { + $card = new CreditCardData(); + $card->number = '5356083898949891'; + $card->expMonth = '12'; + $card->expYear = '2025'; + + $response = $card->verify() + ->withRequestMultiUseToken($this->useTokens) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test003VerifyDiscover() + { + $address = new Address(); + $address->postalCode = '75024'; + + $card = new CreditCardData(); + $card->number = '6223971100014620'; + $card->expMonth = '12'; + $card->expYear = '2025'; + + $response = $card->verify() + ->withAddress($address) + ->withRequestMultiUseToken($this->useTokens) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // StreetAddress verification + + public function test004VerifyAmex() + { + $address = new Address(); + $address->postalCode = '75024'; + + $card = new CreditCardData(); + $card->number = '345039962663847'; + $card->expMonth = '12'; + $card->expYear = '2025'; + + $response = $card->verify() + ->withAddress($address) + ->withRequestMultiUseToken($this->useTokens) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // Balance Inquiry (for prepaid card) + + public function test005BalanceInquiryVisa() + { + $card = new CreditCardData(); + $card->number = '4664383951958601'; + $card->expMonth = '12'; + $card->expYear = '2025'; + + $response = $card->balanceInquiry()->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode, $response->responseMessage); + } + + // CREDIT SALE (for multi-use token only) + + public function test006ChargeVisaToken() + { + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '75024'; + + $card = new CreditCardData(); + $card->number = '4012002000060016'; + $card->expMonth = '12'; + $card->expYear = '2025'; + + $response = $card->charge(13.01) + ->withCurrency('USD') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAddress($address) + ->withRequestMultiUseToken(true) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + static::$visaToken = $response->token; + } + + public function test007ChargeMasterCardToken() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = new CreditCardData(); + $card->number = '5473500000000014'; + $card->expMonth = '12'; + $card->expYear = '2025'; + $card->cvn = '123'; + + $response = $card->charge(13.02) + ->withCurrency('USD') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAddress($address) + ->withRequestMultiUseToken(true) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + static::$mastercardToken = $response->token; + } + + public function test008ChargeDiscoverToken() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '750241234'; + + $card = new CreditCardData(); + $card->number = '6011000990156527'; + $card->expMonth = '12'; + $card->expYear = '2025'; + $card->cvn = '123'; + + $response = $card->charge(13.03) + ->withCurrency('USD') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAddress($address) + ->withRequestMultiUseToken(true) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + static::$discoverToken = $response->token; + } + + public function test009ChargeAmexToken() + { + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '75024'; + + $card = new CreditCardData(); + $card->number = '372700699251018'; + $card->expMonth = '12'; + $card->expYear = '2025'; + $card->cvn = '1234'; + + $response = $card->charge(13.04) + ->withCurrency('USD') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAddress($address) + ->withRequestMultiUseToken(true) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + static::$amexToken = $response->token; + } + + // CREDIT SALE + + public function test010ChargeVisa() + { + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '75024'; + + $card = null; + if ($this->useTokens) { + $card = new CreditCardData(); + $card->token = static::$visaToken; + } else { + $card = TestCards::visaManual(); + } + + $response = $card->charge(17.01) + ->withCurrency('USD') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // test case 35 + $void = $response->void()->execute(); + + $this->assertNotNull($void); + $this->assertEquals('00', $void->responseCode); + } + + public function test011ChargeMasterCard() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = null; + if ($this->useTokens) { + $card = new CreditCardData(); + $card->token = static::$mastercardToken; + } else { + $card = TestCards::masterCardManual(); + } + + $response = $card->charge(17.02) + ->withCurrency('USD') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test012ChargeDiscover() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '750241234'; + + $card = null; + if ($this->useTokens) { + $card = new CreditCardData(); + $card->token = static::$discoverToken; + } else { + $card = TestCards::discoverManual(); + } + + $response = $card->charge(17.03) + ->withCurrency('USD') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test013ChargeAmex() + { + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '75024'; + + $card = null; + if ($this->useTokens) { + $card = new CreditCardData(); + $card->token = static::$amexToken; + } else { + $card = TestCards::amexManual(); + } + + $response = $card->charge(17.04) + ->withCurrency('USD') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test014ChargeJcb() + { + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '750241234'; + + $card = new CreditCardData(); + $card->number = '3566007770007321'; + $card->expMonth = '12'; + $card->expYear = '2025'; + $card->cvn = '123'; + + $response = $card->charge(17.05) + ->withCurrency('USD') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test011bChargeMasterCard() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::masterCardSeries2Manual(); + + $response = $card->charge(17.02) + ->withCurrency('USD') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // AUTHORIZATION + + + public function test015AuthorizationVisa() + { + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '75024'; + + $card = TestCards::visaManual(); + + $response = $card->authorize(17.06) + ->withCurrency('USD') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // test case 15b + $capture = $response->capture()->execute(); + + $this->assertNotNull($capture); + $this->assertEquals('00', $capture->responseCode); + } + + public function test016AuthorizationMasterCard() + { + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '750241234'; + + $card = TestCards::masterCardManual(); + + $response = $card->authorize(17.07) + ->withCurrency('USD') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // test case 16b + $capture = $response->capture()->execute(); + + $this->assertNotNull($capture); + $this->assertEquals('00', $capture->responseCode); + } + + public function test017AuthorizationDiscover() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::discoverManual(); + + $response = $card->authorize(17.08) + ->withCurrency('USD') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test016bAuthorizationMasterCard() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::masterCardSeries2Manual(); + + $response = $card->authorize(17.02) + ->withCurrency('USD') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // PARTIALLY APPROVED SALE + + public function test018PartialApprovalVisa() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::visaManual(); + + $response = $card->charge(130) + ->withCurrency('USD') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withAllowPartialAuth(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('10', $response->responseCode); + $this->assertEquals('110.00', $response->authorizedAmount); + } + + public function test019PartialApprovalDiscover() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::discoverManual(); + + $response = $card->charge(145) + ->withCurrency('USD') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withAllowPartialAuth(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('10', $response->responseCode); + $this->assertEquals('65.00', $response->authorizedAmount); + } + + public function test020PartialApprovalMasterCard() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::visaManual(); + + $response = $card->charge(155) + ->withCurrency('USD') + ->withEcommerceInfo($this->ecommerceInfo) + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withAllowPartialAuth(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('10', $response->responseCode); + $this->assertEquals('100.00', $response->authorizedAmount); + + // test case 36 + $void = $response->void()->execute(); + + $this->assertNotNull($void); + $this->assertEquals('00', $void->responseCode); + } + /// LEVEL II CORPORATE PURCHASE CARD + + public function test021LevelIIResponseB() + { + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '750241234'; + + $card = TestCards::visaManual(); + + $response = $card->charge(112.34) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('B', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withPoNumber('9876543210') + ->withTaxType(TaxType::NOT_USED) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test022LevelIIResponseB() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '750241234'; + + $card = TestCards::visaManual(); + + $response = $card->charge(112.34) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('B', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withTaxType(TaxType::SALES_TAX) + ->withTaxAmount(1.00) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test023LevelIIResponseR() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::visaManual(); + + $response = $card->charge(123.45) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('R', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withTaxType(TaxType::TAX_EXEMPT) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test024LevelIIResponseS() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::visaManual(); + + $response = $card->charge(134.56) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('S', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withPoNumber('9876543210') + ->withTaxType(TaxType::SALES_TAX) + ->withTaxAmount(1.00) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test025LevelIIResponseS() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::masterCardManual(); + + $response = $card->charge(111.06) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('S', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withPoNumber('9876543210') + ->withTaxType(TaxType::NOT_USED) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test026LevelIIResponseS() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::masterCardManual(); + + $response = $card->charge(111.07) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('S', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withTaxType(TaxType::SALES_TAX) + ->withTaxAmount(1.00) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test027LevelIIResponseS() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::masterCardManual(); + + $response = $card->charge(111.08) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('S', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withPoNumber('9876543210') + ->withTaxType(TaxType::SALES_TAX) + ->withTaxAmount(1.00) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test028LevelIIResponseS() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::masterCardManual(); + + $response = $card->charge(111.09) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('S', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withPoNumber('9876543210') + ->withTaxType(TaxType::TAX_EXEMPT) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test029LevelIINoResponse() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::amexManual(); + + $response = $card->charge(111.10) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('0', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withPoNumber('9876543210') + ->withTaxType(TaxType::NOT_USED) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test030LevelIINoResponse() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '750241234'; + + $card = TestCards::amexManual(); + + $response = $card->charge(111.11) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('0', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withTaxType(TaxType::SALES_TAX) + ->withTaxAmount(1.00) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test031LevelIINoResponse() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::amexManual(); + + $response = $card->charge(111.12) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('0', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withPoNumber('9876543210') + ->withTaxType(TaxType::SALES_TAX) + ->withTaxAmount(1.00) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function test032LevelIINoResponse() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::amexManual(); + + $response = $card->charge(111.13) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('0', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withPoNumber('9876543210') + ->withTaxType(TaxType::TAX_EXEMPT) + ->execute(); + + $this->assertEquals(true, $cpcResponse != null); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + /// PRIOR / VOICE AUTHORIZATION + + public function test033OfflineSale() + { + $card = TestCards::visaManual(); + + $response = $card->charge(17.10) + ->withCurrency('USD') + ->withModifier(TransactionModifier::OFFLINE) + ->withOfflineAuthCode('654321') + ->withInvoiceNumber('123456') + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test033OfflineAuthorization() + { + $card = TestCards::visaManual(); + + $response = $card->authorize(17.10) + ->withCurrency('USD') + ->withModifier(TransactionModifier::OFFLINE) + ->withOfflineAuthCode('654321') + ->withInvoiceNumber('123456') + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// RETURN + + public function test034OfflineCreditReturn() + { + $card = TestCards::masterCardManual(); + + $response = $card->refund(15.15) + ->withCurrency('USD') + ->withInvoiceNumber('123456') + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test034bOfflineCreditReturn() + { + $card = TestCards::masterCardManual(); + + $response = $card->refund(15.16) + ->withCurrency('USD') + ->withInvoiceNumber('123456') + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// ONLINE VOID / REVERSAL + + public function test035VoidTest10() + { + // see test 010 + } + + public function test036VoidTest20() + { + // see test 020 + } + + /// Time Out Reversal + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\UnsupportedTransactionException + */ + public function test036bTimeoutReversal() + { + $sale = TestCards::visaManual()->charge(911) + ->withCurrency('USD') + ->withClientTransactionId('987321654') + ->withEcommerceInfo($this->ecommerceInfo) + ->execute(); + + $this->assertEquals(true, $sale != null); + $this->assertEquals('91', $sale->responseCode); + + $response = Transaction::fromId(null, PaymentMethodType::CREDIT); + $response->clientTransactionId = '987321654'; + + $response->reverse(911)->execute(); + } + + /// One time bill payment + + public function test010ChargeVisaOneTime() + { + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '75024'; + + $card = null; + if ($this->useTokens) { + $card = new CreditCardData(); + $card->token = static::$visaToken; + } else { + $card = TestCards::visaManual(); + } + + $response = $card->charge(13.11) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withOneTimePayment(true) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + + $void = $response->void()->execute(); + + $this->assertEquals(true, $void != null); + $this->assertEquals('00', $void->responseCode); + } + + public function test011ChargeMasterCardOneTime() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '750241234'; + + $card = null; + if ($this->useTokens) { + $card = new CreditCardData(); + $card->token = static::$mastercardToken; + } else { + $card = TestCards::masterCardManual(); + } + + $response = $card->charge(13.12) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withOneTimePayment(true) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test012ChargeDiscoverOneTime() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = null; + if ($this->useTokens) { + $card = new CreditCardData(); + $card->token = static::$discoverToken; + } else { + $card = TestCards::discoverManual(); + } + + $response = $card->charge(13.13) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withOneTimePayment(true) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test013ChargeAmexOneTime() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = null; + if ($this->useTokens) { + $card = new CreditCardData(); + $card->token = static::$amexToken; + } else { + $card = TestCards::amexManual(); + } + + $response = $card->charge(13.14) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withOneTimePayment(true) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test014ChargeJcbOneTime() + { + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = new CreditCardData(); + $card->number = '3566007770007321'; + $card->expMonth = '12'; + $card->expYear = '2025'; + $card->cvn = '123'; + + $response = $card->charge(13.15) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withOneTimePayment(true) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// ADVANCED FRAUD SCREENING + + /** + * TODO: Change code assertions when AFS is enabled on account + */ + public function test037FraudPreventionSale() + { + $card = TestCards::visaManual(); + + $response = $card->charge(15000) + ->withCurrency('USD') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + // $this->assertEquals('FR', $response->responseCode); + } + + /** + * TODO: Change code assertions when AFS is enabled on account + */ + public function test038FraudPreventionReturn() + { + $card = TestCards::visaManual(); + + $response = $card->refund(15000) + ->withCurrency('USD') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + // $this->assertEquals('41', $response->responseCode); + } + + /// ONE CARD - GSB CARD FUNCTIONS + + /// BALANCE INQUIRY + + public function test037BalanceInquiryGsb() + { + if (false === $this->usePrepaid) { + $this->markTestSkipped('GSB not configured'); + } + + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::gsbManual(); + + $response = $card->balanceInquiry() + ->withAddress($address) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// ADD VALUE + + public function test038AddValueGsb() + { + if (false === $this->usePrepaid) { + $this->markTestSkipped('GSB not configured'); + } + + $card = new CreditTrackData(); + $card->value = '%B6277220572999800^ / ^49121010557010000016000000?F;6277220572999800=49121010557010000016?'; + + $response = $card->addValue(15.00) + ->withCurrency('USD') + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// SALE + + public function test039ChargeGsb() + { + if (false === $this->usePrepaid) { + $this->markTestSkipped('GSB not configured'); + } + + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::gsbManual(); + + $response = $card->charge(2.05) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + + $voidResponse = $response->void() + ->execute(); + $this->assertEquals(true, $voidResponse != null); + $this->assertEquals('00', $voidResponse->responseCode); + } + + public function test040ChargeGsb() + { + if (false === $this->usePrepaid) { + $this->markTestSkipped('GSB not configured'); + } + + $address = new Address(); + $address->streetAddress1 = '6860'; + $address->postalCode = '75024'; + + $card = TestCards::gsbManual(); + + $response = $card->charge(2.10) + ->withCurrency('USD') + ->withAddress($address) + ->withInvoiceNumber('123456') + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// ONLINE VOID / REVERSAL + + public function test041VoidGsb() + { + // see test 039 + } + + /// HMS GIFT - REWARDS + + /// ACTIVATE + + public function test042ActivateGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->activate(6.00) + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test043ActivateGift2() + { + + $card = TestCards::giftCard2Manual(); + + $response = $card->activate(7.00) + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// LOAD / ADD VALUE + + public function test044AddValueGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->addValue(8.00) + ->withCurrency('USD') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test045AddValueGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->addValue(9.00) + ->withCurrency('USD') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// BALANCE INQUIRY + + public function test046BalanceInquiryGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->balanceInquiry() + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('10.00', $response->balanceAmount); + } + + public function test047BalanceInquiryGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->balanceInquiry() + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('10.00', $response->balanceAmount); + } + + /// REPLACE / TRANSFER + + public function test048ReplaceGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->replaceWith(TestCards::giftCard2Manual()) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('10.00', $response->balanceAmount); + } + + public function test049ReplaceGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->replaceWith(TestCards::giftCard1Swipe()) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('10.00', $response->balanceAmount); + } + + /// SALE / REDEEM + + public function test050SaleGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->charge(1.00) + ->withCurrency('USD') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test051SaleGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->charge(2.00) + ->withCurrency('USD') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test052SaleGift1Void() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->charge(3.00) + ->withCurrency('USD') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + + $voidResponse = $response->void() + ->execute(); + $this->assertEquals(true, $voidResponse != null); + $this->assertEquals('00', $voidResponse->responseCode); + } + + public function test053SaleGift2Reversal() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->charge(4.00) + ->withCurrency('USD') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + + $reversalResponse = $response->reverse(4.00) + ->execute(); + $this->assertEquals(true, $reversalResponse != null); + $this->assertEquals('00', $reversalResponse->responseCode); + } + + /// VOID + + public function test054VoidGift() + { + // see test 052 + } + + /// REVERSAL + + public function test055ReversalGift() + { + // see test 053 + } + + public function test056ReversalGift2() + { + $card = TestCards::giftCard2Manual(); + + $reversalResponse = $card->reverse(2.00) + ->execute(); + $this->assertEquals(true, $reversalResponse != null); + $this->assertEquals('00', $reversalResponse->responseCode); + } + + /// DEACTIVATE + + public function test057DeactivateGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->deactivate() + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// RECEIPTS MESSAGING + + public function test058ReceiptsMessaging() + { + return; # print and scan receipt for test 51 + } + + /// REWARD + + /// BALANCE INQUIRY + + public function test059BalanceInquiryRewards1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->balanceInquiry() + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('0', $response->pointsBalanceAmount); + } + + public function test060BalanceInquiryRewards2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->balanceInquiry() + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('0', $response->pointsBalanceAmount); + } + + /// ALIAS + + public function test061CreateAliasGift1() + { + $response = GiftCard::create('9725550100'); + + $this->assertEquals(true, $response != null); + } + + public function test062CreateAliasGift2() + { + $response = GiftCard::create('9725550100'); + + $this->assertEquals(true, $response != null); + } + + public function test063AddAliasGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->addAlias('2145550199') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test064AddAliasGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->addAlias('2145550199') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test065DeleteAliasGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->removeAlias('2145550199') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// SALE / REDEEM + + public function test066RedeemPointsGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->charge(100) + ->withCurrency('POINTS') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test067RedeemPointsGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->charge(200) + ->withCurrency('POINTS') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test068RedeemPointsGift2() + { + $card = new GiftCard(); + $card->alias = '9725550100'; + + $response = $card->charge(300) + ->withCurrency('POINTS') + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// REWARDS + + public function test069RewardsGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->rewards(10) + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test070RewardsGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->rewards(11) + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// REPLACE / TRANSFER + + public function test071ReplaceGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->replaceWith(TestCards::giftCard2Manual()) + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test072ReplaceGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->replaceWith(TestCards::giftCard1Swipe()) + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// DEACTIVATE + + public function test073DeactivateGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->deactivate() + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + public function test074DeactivateGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->deactivate() + ->execute(); + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } + + /// RECEIPTS MESSAGING + + public function test075ReceiptsMessaging() + { + return; # print and scan receipt for test 51 + } + + /// CLOSE BATCH + + public function test999CloseBatch() + { + try { + $response = BatchService::closeBatch(); + $this->assertNotNull($response); + // printf('batch id: %s', $response->id); + // printf('sequence number: %s', $response->sequenceNumber); + } catch (ApiException $e) { + if (false === strpos($e->getMessage(), static::BATCH_NOT_OPEN) + || false === strpos($e->getMessage(), static::NO_TRANS_IN_BATCH) + ) { + $this->fail($e->getMessage()); + } + } + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.php new file mode 100644 index 0000000..c09bd45 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.php @@ -0,0 +1,560 @@ +identifierBase, $this->todayDate, $identifier); + } + + /** + * @return ServicesConfig + */ + private function config() + { + $config = new ServicesConfig(); + $config->secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; + $config->serviceUrl = ($this->enableCryptoUrl) ? + 'https://cert.api2-c.heartlandportico.com/': + 'https://cert.api2.heartlandportico.com'; + return $config; + } + + protected function setup() + { + ServicesContainer::configure($this->config()); + + $this->todayDate = date('Ymd'); + $this->identifierBase = substr( + sprintf('%s-%%s', GenerationUtils::getGuid()), + 0, + 10 + ); + } + + public function test000CleanUp() + { + try { + $results = Schedule::findAll(); + foreach ($results as $schedule) { + $schedule->delete(true); + } + } catch (\Exception $e) { + } + + try { + $results = RecurringPaymentMethod::findAll(); + foreach ($results as $paymentMethod) { + $paymentMethod->delete(true); + } + } catch (\Exception $e) { + } + + try { + $results = Customer::findAll(); + foreach ($results as $customer) { + $customer->delete(true); + } + } catch (\Exception $e) { + } + } + + // CUSTOMER SETUP + + public function test001AddCustomerPerson() + { + $customer = new Customer(); + $customer->id = $this->getIdentifier('Person'); + $customer->firstName = 'John'; + $customer->lastName = 'Doe'; + $customer->status = 'Active'; + $customer->email = 'john.doe@example.com'; + $customer->address = new Address(); + $customer->address->streetAddress1 = '123 Main St.'; + $customer->address->city = 'Dallas'; + $customer->address->province = 'TX'; + $customer->address->postalCode = '75024'; + $customer->address->country = 'USA'; + $customer->workPhone = '5551112222'; + + $customer = $customer->create(); + + $this->assertNotNull($customer); + $this->assertNotNull($customer->key); + static::$customerPerson = $customer; + + $found = Customer::find($customer->id); + $this->assertNotNull($found); + } + + public function test002AddCustomerBusiness() + { + $customer = new Customer(); + $customer->id = $this->getIdentifier('Business'); + $customer->company = 'AcmeCo'; + $customer->status = 'Active'; + $customer->email = 'john.doe@example.com'; + $customer->address = new Address(); + $customer->address->streetAddress1 = '987 Elm St.'; + $customer->address->city = 'Princeton'; + $customer->address->province = 'NJ'; + $customer->address->postalCode = '12345'; + $customer->address->country = 'USA'; + $customer->workPhone = '5551112222'; + + $customer = $customer->create(); + + $this->assertNotNull($customer); + $this->assertNotNull($customer->key); + static::$customerBusiness = $customer; + } + + // PAYMENT METHOD SETUP + + public function test003AddPaymentCreditVisa() + { + if (static::$customerPerson === null) { + $this->markTestIncomplete(); + } + + $card = new CreditCardData(); + $card->number = '4012002000060016'; + $card->expMonth = '12'; + $card->expYear = '2025'; + + $paymentMethod = static::$customerPerson->addPaymentMethod( + $this->getIdentifier('CreditV'), + $card + )->create(); + + $this->assertNotNull($paymentMethod); + $this->assertNotNull($paymentMethod->key); + static::$paymentMethodVisa = $paymentMethod; + } + + public function test004AddPaymentCreditMasterCard() + { + if (static::$customerPerson === null) { + $this->markTestIncomplete(); + } + + $card = new CreditCardData(); + $card->number = '5473500000000014'; + $card->expMonth = '12'; + $card->expYear = '2025'; + + $paymentMethod = static::$customerPerson->addPaymentMethod( + $this->getIdentifier('CreditMC'), + $card + )->create(); + + $this->assertNotNull($paymentMethod); + $this->assertNotNull($paymentMethod->key); + static::$paymentMethodMasterCard = $paymentMethod; + } + + public function test005AddPaymentCheckPpd() + { + if (static::$customerPerson === null) { + $this->markTestIncomplete(); + } + + $check = new ECheck(); + $check->accountType = AccountType::CHECKING; + $check->checkType = CheckType::PERSONAL; + $check->secCode = SecCode::PPD; + $check->routingNumber = '122000030'; + $check->driversLicenseNumber = '7418529630'; + $check->driversLicenseState = 'TX'; + $check->accountNumber = '1357902468'; + $check->birthYear = 1989; + + $paymentMethod = static::$customerPerson->addPaymentMethod( + $this->getIdentifier('CheckPpd'), + $check + )->create(); + + $this->assertNotNull($paymentMethod); + $this->assertNotNull($paymentMethod->key); + static::$paymentMethodCheckPpd = $paymentMethod; + } + + public function test006AddPaymentCheckCcd() + { + if (static::$customerBusiness === null) { + $this->markTestIncomplete(); + } + + $check = new eCheck(); + $check->accountType = AccountType::CHECKING; + $check->checkType = CheckType::BUSINESS; + $check->secCode = SecCode::CCD; + $check->routingNumber = '122000030'; + $check->driversLicenseNumber = '7418529630'; + $check->driversLicenseState = 'TX'; + $check->accountNumber = '1357902468'; + $check->birthYear = 1989; + + $paymentMethod = static::$customerBusiness->addPaymentMethod( + $this->getIdentifier('CheckCcd'), + $check + )->create(); + + $this->assertNotNull($paymentMethod); + $this->assertNotNull($paymentMethod->key); + static::$paymentMethodCheckCcd = $paymentMethod; + } + + // PAYMENT SETUP - DECLINED + + /** + * expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function test007AddPaymentCheckPpd() + { + if (static::$customerPerson === null) { + $this->markTestIncomplete(); + } + + $check = new eCheck(); + $check->accountType = AccountType::CHECKING; + $check->checkType = CheckType::PERSONAL; + $check->secCode = SecCode::PPD; + $check->routingNumber = '122000030'; + $check->driversLicenseNumber = '7418529630'; + $check->driversLicenseState = 'TX'; + $check->accountNumber = '1357902468'; + $check->birthYear = 1989; + + static::$customerPerson->addPaymentMethod( + $this->getIdentifier('CheckPpd'), + $check + )->create(); + } + + // Recurring Billing using PayPlan - Managed Schedule + + public function test008AddScheduleCreditVisa() + { + if (static::$paymentMethodVisa === null) { + $this->markTestIncomplete(); + } + + $schedule = static::$paymentMethodVisa->addSchedule( + $this->getIdentifier('CreditV') + ) + ->withStatus('Active') + ->withAmount(30.02) + ->withCurrency('USD') + ->withStartDate(\DateTime::createFromFormat('Y-m-d', '2027-02-01')) + ->withFrequency(ScheduleFrequency::WEEKLY) + ->withEndDate(\DateTime::createFromFormat('Y-m-d', '2027-04-01')) + ->withReprocessingCount(2) + ->create(); + + $this->assertNotNull($schedule); + $this->assertNotNull($schedule->key); + static::$scheduleVisa = $schedule; + } + + public function test009AddScheduleCreditMasterCard() { + if (static::$paymentMethodMasterCard == null) { + $this->markTestIncomplete(); + } + + $schedule = static::$paymentMethodMasterCard->addSchedule( + $this->getIdentifier('CreditMC') + ) + ->withStatus('Active') + ->withAmount(30.02) + ->withCurrency('USD') + ->withStartDate(\DateTime::createFromFormat('Y-m-d', '2027-02-01')) + ->withFrequency(ScheduleFrequency::WEEKLY) + ->withEndDate(\DateTime::createFromFormat('Y-m-d', '2027-04-01')) + ->withReprocessingCount(2) + ->create(); + $this->assertNotNull($schedule); + $this->assertNotNull($schedule->key); + static::$scheduleMasterCard = $schedule; + } + + public function test010AddScheduleCheckPPD() { + if (static::$paymentMethodCheckPpd == null) { + $this->markTestIncomplete(); + } + + $schedule = static::$paymentMethodCheckPpd->addSchedule( + $this->getIdentifier('CheckPPD') + ) + ->withStatus('Active') + ->withAmount(30.03) + ->withCurrency('USD') + ->withStartDate(\DateTime::createFromFormat('Y-m-d', '2027-02-01')) + ->withFrequency(ScheduleFrequency::MONTHLY) + ->withReprocessingCount(1) + ->withNumberOfPayments(2) + ->create(); + $this->assertNotNull($schedule); + $this->assertNotNull($schedule->key); + static::$scheduleCheckPpd = $schedule; + } + + public function test011AddScheduleCheckCCD() { + if (static::$paymentMethodCheckCcd == null) { + $this->markTestIncomplete(); + } + + $schedule = static::$paymentMethodCheckCcd->addSchedule( + $this->getIdentifier('CheckCCD') + ) + ->withStatus('Active') + ->withAmount(30.04) + ->withCurrency('USD') + ->withStartDate(\DateTime::createFromFormat('Y-m-d', '2027-02-01')) + ->withFrequency(ScheduleFrequency::BI_WEEKLY) + ->withReprocessingCount(1) + ->create(); + $this->assertNotNull($schedule); + $this->assertNotNull($schedule->key); + static::$scheduleCheckCcd = $schedule; + } + + /** + * expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function test012AddScheduleCreditVisa() { + if (static::$paymentMethodVisa == null) { + $this->markTestIncomplete(); + } + + $schedule = static::$paymentMethodVisa->addSchedule( + $this->getIdentifier('CreditV') + ) + ->withStartDate(\DateTime::createFromFormat('Y-m-d', '2027-02-01')) + ->withAmount(30.01) + ->withCurrency('USD') + ->withFrequency(ScheduleFrequency::WEEKLY) + ->withReprocessingCount(1) + ->withStatus('Active') + ->create(); + } + + /** + * expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function test013AddScheduleCCheckPPD() { + if (static::$paymentMethodCheckPpd == null) { + $this->markTestIncomplete(); + } + + $schedule = static::$paymentMethodCheckPpd->addSchedule( + $this->getIdentifier('CheckPPD') + ) + ->withStatus('Active') + ->withAmount(30.03) + ->withCurrency('USD') + ->withStartDate(\DateTime::createFromFormat('Y-m-d', '2027-02-01')) + ->withFrequency(ScheduleFrequency::MONTHLY) + ->withReprocessingCount(1) + ->withNumberOfPayments(2) + ->create(); + } + + // Recurring Billing using PayPlan - Managed Schedule + + public function test014RecurringBillingVisa() { + if (static::$paymentMethodVisa == null || static::$scheduleVisa == null) { + $this->markTestIncomplete(); + } + + $response = static::$paymentMethodVisa->charge(20.01) + ->withCurrency('USD') + ->withScheduleId(static::$scheduleVisa->key) + ->withOneTimePayment(false) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test015RecurringBillingMasterCard() { + if (true || static::$paymentMethodMasterCard == null || static::$scheduleMasterCard == null) { + $this->markTestIncomplete(); + } + + $response = static::$paymentMethodMasterCard->charge(20.02) + ->withCurrency('USD') + ->withScheduleId(static::$scheduleVisa->key) + ->withOneTimePayment(false) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test016RecurringBillingCheckPPD() { + if (static::$paymentMethodCheckPpd == null || static::$scheduleCheckPpd == null) { + $this->markTestIncomplete(); + } + + $response = static::$paymentMethodCheckPpd->charge(20.03) + ->withCurrency('USD') + ->withScheduleId(static::$scheduleVisa->key) + ->withOneTimePayment(false) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test017RecurringBillingCheckCCD() { + if (static::$paymentMethodCheckCcd == null || static::$scheduleCheckCcd == null) { + $this->markTestIncomplete(); + } + + $response = static::$paymentMethodCheckCcd->charge(20.04) + ->withCurrency('USD') + ->withScheduleId(static::$scheduleVisa->key) + ->withOneTimePayment(false) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // One time bill payment + + public function test018RecurringBillingVisa() { + if (static::$paymentMethodVisa == null) { + $this->markTestIncomplete(); + } + + $response = static::$paymentMethodVisa->charge(20.06) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test019RecurringBillingMasterCard() { + if (static::$paymentMethodMasterCard == null) { + $this->markTestIncomplete(); + } + + $response = static::$paymentMethodMasterCard->charge(20.07) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test020RecurringBillingCheckPPD() { + if (static::$paymentMethodCheckPpd == null) { + $this->markTestIncomplete(); + } + + $response = static::$paymentMethodCheckPpd->charge(20.08) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function test021RecurringBillingCheckCCD() { + if (static::$paymentMethodCheckCcd == null) { + $this->markTestIncomplete(); + } + + $response = static::$paymentMethodCheckCcd->charge(20.09) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // Onetime bill payment - declined + + public function test022RecurringBillingVisa_Decline() { + if (static::$paymentMethodVisa == null) { + $this->markTestIncomplete(); + } + + $response = static::$paymentMethodVisa->charge(10.08) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('51', $response->responseCode); + } + + public function test023RecurringBillingCheckPPD_Decline() { + if (true || static::$paymentMethodCheckPpd == null) { + $this->markTestIncomplete(); + } + + $response = static::$paymentMethodCheckPpd->charge(25.02) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('1', $response->responseCode); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.php new file mode 100644 index 0000000..bf52611 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.php @@ -0,0 +1,1982 @@ +secretApiKey = 'skapi_cert_MaePAQBr-1QAqjfckFC8FTbRTT120bVQUlfVOjgCBw'; + $config->serviceUrl = ($this->enableCryptoUrl) ? + 'https://cert.api2-c.heartlandportico.com/': + 'https://cert.api2.heartlandportico.com'; + ServicesContainer::Configure($config); + } + + public function testRetail000CloseBatch() + { + try { + $response = BatchService::closeBatch(); + $this->assertNotNull($response); + // error_log(sprintf('Batch ID: %s', $response->Id)); + // error_log(sprintf('Sequence Number: %s', $response->sequenceNumber)); + } catch (ApiException $e) { + if (false === strpos($e->getMessage(), static::BATCH_NOT_OPEN) + && false === strpos($e->getMessage(), static::NO_TRANS_IN_BATCH) + ) { + $this->fail($e->getMessage()); + } + } + } + + /* + CREDIT CARD FUNCTIONS + CARD VERIFY + ACCOUNT VERIFICATION + */ + + public function testRetail001CardVerifyVisa() + { + $visaenc = TestCards::visaSwipeEncrypted(); + + $response = $visaenc->verify() + ->withAllowDuplicates(true) + ->withRequestMultiUseToken(static::$useTokens) + ->execute(); + $this->assertNotNull($response, '$response is null'); + $this->assertEquals('00', $response->responseCode, $response->responseMessage); + + if (static::$useTokens) { + $this->assertNotNull($response->token, 'token is null'); + + $token = new CreditCardData(); + $token->token = $response->token; + + $saleResponse = $token->charge(15.01) + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals('00', $saleResponse->responseCode); + } + } + + public function testRetail002CardVerifyMastercardSwipe() + { + $cardenc = TestCards::masterCardSwipeEncrypted(); + + $response = $cardenc->verify() + ->withAllowDuplicates(true) + ->withRequestMultiUseToken(static::$useTokens) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + if (static::$useTokens) { + $this->assertNotNull($response->token); + + $token = new CreditCardData(); + $token->token = $response->token; + + $saleResponse = $token->charge(15.02) + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals('00', $saleResponse->responseCode); + } + } + + public function testRetail003CardVerifyDiscover() + { + $discoverenc = TestCards::discoverSwipeEncrypted(); + + $response = $discoverenc->verify() + ->withAllowDuplicates(true) + ->withRequestMultiUseToken(static::$useTokens) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + if (static::$useTokens) { + $this->assertNotNull($response->token); + + $token = new CreditCardData(); + $token->token = $response->token; + + $saleResponse = $token->charge(15.03) + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals('00', $saleResponse->responseCode); + } + } + + // Address Verification + + public function testRetail004CardVerifyAmex() + { + $address = new Address(); + $address->postalCode = '75024'; + + $manualamex = TestCards::amexManual(false, true); + + $response = $manualamex->verify() + ->withAllowDuplicates(true) + ->withAddress($address) + ->withRequestMultiUseToken(static::$useTokens) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + if (static::$useTokens) { + $this->assertNotNull($response->token); + + $token = new CreditCardData(); + $token->token = $response->token; + + $saleResponse = $token->charge(15.04) + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals('00', $saleResponse->responseCode); + } + } + + // Balance Inquiry (for Prepaid) + + public function testRetail005BalanceInquiryVisa() + { + $visaenc = TestCards::visaSwipeEncrypted(); + + $response = $visaenc->balanceInquiry()->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // CREDIT SALE (For multi-use token only) + + public function testRetail006ChargeVisaSwipeToken() + { + $card = TestCards::visaSwipe(); + $response = $card->charge(15.01) + ->withCurrency('USD') + ->withRequestMultiUseToken(true) + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + static::$visatoken = $response->token; + } + + public function testRetail007ChargeMastercardSwipeToken() + { + $card = TestCards::masterCardSwipe(); + $response = $card->charge(15.02) + ->withCurrency('USD') + ->withRequestMultiUseToken(true) + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + static::$mastercardtoken = $response->token; + } + + public function testRetail008ChargeDiscoverSwipeToken() + { + $card = TestCards::discoverSwipe(); + $response = $card->charge(15.03) + ->withCurrency('USD') + ->withRequestMultiUseToken(true) + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + static::$discovertoken = $response->token; + } + + public function testRetail009ChargeAmexSwipeToken() + { + $card = TestCards::amexSwipe(); + $response = $card->charge(15.04) + ->withCurrency('USD') + ->withRequestMultiUseToken(true) + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + static::$amextoken = $response->token; + } + + /* + CREDIT SALE + SWIPED + */ + + public function testRetail010ChargeVisaSwipe() + { + $card = TestCards::visaSwipe(); + $response = $card->charge(15.01) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // test 59 + $reverse = $response->reverse(15.01) + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($reverse); + $this->assertEquals('00', $reverse->responseCode); + } + + public function testRetail011ChargeMastercardSwipe() + { + $card = TestCards::masterCardSwipe(); + $response = $card->charge(15.02) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail012ChargeDiscoverSwipe() + { + $card = TestCards::discoverSwipe(); + $response = $card->charge(15.03) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail013ChargeAmexSwipe() + { + $card = TestCards::amexSwipe(); + $response = $card->charge(15.04) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail014ChargeJcbSwipe() + { + $card = TestCards::JcbSwipe(); + $response = $card->charge(15.05) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // test case 58 + $refund = $response->refund(15.05) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($refund); + $this->assertEquals('00', $refund->responseCode); + } + + public function testRetail014aChargeRetailMastercard24() + { + $card = TestCards::masterCard24Swipe(); + $response = $card->charge(15.34) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail014bChargeRetailMastercard25() + { + $card = TestCards::masterCard25Swipe(); + $response = $card->charge(15.34) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail015ChargeVisaSwipe() + { + $card = TestCards::visaSwipe(); + $response = $card->charge(15.06) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // test case 63 + $reversal = $response->reverse(15.06) + ->withAllowDuplicates(true) + ->withAuthAmount(5.06) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // Manually Entered - Card Present + + public function testRetail016ChargeVisaManualCardPresent() + { + $address = new Address(); + $address->postalCode = '750241234'; + $address->streetAddress1 = '6860 Dallas Pkwy'; + + $manualcard = TestCards::visaManual(true, true); + $response = $manualcard->charge(16.01) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail017ChargeMasterCardManualCardPresent() + { + $address = new Address(); + $address->postalCode = '75024'; + $address->streetAddress1 = '6860 Dallas Pkwy'; + + $manualcard = TestCards::masterCardManual(true, true); + $response = $manualcard->charge(16.02) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // test case 60 + $reverse = $response->reverse(16.02) + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($reverse); + $this->assertEquals('00', $reverse->responseCode); + } + + public function testRetail018ChargeDiscoverManualCardPresent() + { + $address = new Address(); + $address->postalCode = '750241234'; + + $manualcard = TestCards::discoverManual(true, true); + $response = $manualcard->charge(16.03) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail019ChargeAmexManualCardPresent() + { + $address = new Address(); + $address->postalCode = '75024'; + $address->streetAddress1 = '6860'; + + $manualcard = TestCards::amexManual(true, true); + $response = $manualcard->charge(16.04) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail020ChargeJcbManualCardPresent() + { + $address = new Address(); + $address->postalCode = '75024'; + + $manualcard = TestCards::JcbManual(true, true); + $response = $manualcard->charge(16.05) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail021ChargeDiscoverManualCardPresent() + { + $address = new Address(); + $address->postalCode = '750241234'; + $address->streetAddress1 = '6860 Dallas Pkwy'; + + $manualcard = TestCards::discoverManual(true, true); + $response = $manualcard->charge(16.07) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // test case 64 + $reversal = $response->reverse(16.07) + ->withAllowDuplicates(true) + ->withAuthAmount(6.07) + ->execute(); + $this->assertNotNull($reversal); + $this->assertEquals('00', $reversal->responseCode); + } + + // Manually Entered - Card Not Present + + public function testRetail022ChargeVisaManualCardNotPresent() + { + $address = new Address(); + $address->postalCode = '750241234'; + $address->streetAddress1 = '6860 Dallas Pkwy'; + + $manualcard = null; + if (static::$useTokens) { + $manualcard = new CreditCardData(); + $manualcard->token = static::$visatoken; + } else { + $manualcard = TestCards::visaManual(false, true); + } + + $response = $manualcard->charge(17.01) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail023ChargeMasterCardManualCardNotPresent() + { + $address = new Address(); + $address->postalCode = '75024'; + $address->streetAddress1 = '6860 Dallas Pkwy'; + + $manualcard = null; + if (static::$useTokens) { + $manualcard = new CreditCardData(); + $manualcard->token = static::$mastercardtoken; + } else { + $manualcard = TestCards::masterCardManual(false, true); + } + + $response = $manualcard->charge(17.02) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // test case 61 + $reversal = $response->reverse(17.02) + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($reversal); + $this->assertEquals('00', $reversal->responseCode); + } + + public function testRetail024ChargeDiscoverManualCardNotPresent() + { + $address = new Address(); + $address->postalCode = '750241234'; + + $manualcard = null; + if (static::$useTokens) { + $manualcard = new CreditCardData(); + $manualcard->token = static::$discovertoken; + } else { + $manualcard = TestCards::discoverManual(false, true); + } + + $response = $manualcard->charge(17.03) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail025ChargeAmexManualCardNotPresent() + { + $address = new Address(); + $address->postalCode = '75024'; + $address->streetAddress1 = '6860'; + + $manualcard = null; + if (static::$useTokens) { + $manualcard = new CreditCardData(); + $manualcard->token = static::$amextoken; + } else { + $manualcard = TestCards::amexManual(false, true); + } + + $response = $manualcard->charge(17.04) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail026ChargeJcbManualCardNotPresent() + { + $address = new Address(); + $address->postalCode = '75024'; + + $manualcard = TestCards::JcbManual(false, true); + $response = $manualcard->charge(17.05) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // Contactless + + public function testRetail027ChargeVisaContactless() + { + $card = TestCards::visaSwipe(EntryMethod::PROXIMITY); + $response = $card->charge(18.01) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail028ChargeMastercardContactless() + { + $card = TestCards::masterCardSwipe(EntryMethod::PROXIMITY); + + $response = $card->charge(18.02) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail029ChargeDiscoverContactless() + { + $card = TestCards::discoverSwipe(EntryMethod::PROXIMITY); + + $response = $card->charge(18.03) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail030ChargeAmexContactless() + { + $card = TestCards::amexSwipe(EntryMethod::PROXIMITY); + + $response = $card->charge(18.04) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // AUTHORIZATION + + public function testRetail031AuthorizeVisaSwipe() + { + $card = TestCards::visaSwipe(); + + // 031a authorize + $response = $card->authorize(15.08) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // 031b capture + $captureResponse = $response->capture()->execute(); + $this->assertNotNull($captureResponse); + $this->assertEquals('00', $captureResponse->responseCode); + } + + public function testRetail032AuthorizeVisaSwipeAdditionalAuth() + { + $card = TestCards::visaSwipe(); + + // 032a authorize + $response = $card->authorize(15.09) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // 032b Additional Auth (restaurant only) + + // 032c Add to batch + $captureResponse = $response->capture()->execute(); + $this->assertNotNull($captureResponse); + $this->assertEquals('00', $captureResponse->responseCode); + } + + public function testRetail033AuthorizeMasterCardSwipe() + { + $card = TestCards::masterCardSwipe(); + + // 033a authorize + $response = $card->authorize(15.10) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // 033b capture + $captureResponse = $response->capture()->execute(); + $this->assertNotNull($captureResponse); + $this->assertEquals('00', $captureResponse->responseCode); + } + + public function testRetail033aAuthorizeDiscoverSwipe() + { + $card = TestCards::discoverSwipe(); + + $response = $card->authorize(15.10) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // AUTHORIZATION - Manually Entered, Card Present + + public function testRetail034AuthorizeVisaManualCardPresent() + { + $address = new Address(); + $address->postalCode = '75024'; + $address->streetAddress1 = '6860 Dallas Pkwy'; + + $card = TestCards::visaManual(true, true); + + // 034a authorize + $response = $card->authorize(16.08) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // 034b capture + $captureResponse = $response->capture()->execute(); + $this->assertNotNull($captureResponse); + $this->assertEquals('00', $captureResponse->responseCode); + } + + public function testRetail035AuthorizeVisaManualCardPresentAdditionalAuth() + { + $address = new Address(); + $address->postalCode = '75024'; + $address->streetAddress1 = '6860 Dallas Pkwy'; + + $card = TestCards::visaManual(true, true); + + // 035a authorize + $response = $card->authorize(16.09) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // 035b Additional Auth (restaurant only) + + // 035c Add to batch + $captureResponse = $response->capture()->execute(); + $this->assertNotNull($captureResponse); + $this->assertEquals('00', $captureResponse->responseCode); + } + + public function testRetail036AuthorizeMasterCardManualCardPresent() + { + $address = new Address(); + $address->postalCode = '75024'; + $address->streetAddress1 = '6860 Dallas Pkwy'; + + $card = TestCards::masterCardManual(true, true); + + // 036a authorize + $response = $card->authorize(16.10) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // 036b capture + $captureResponse = $response->capture()->execute(); + $this->assertNotNull($captureResponse); + $this->assertEquals('00', $captureResponse->responseCode); + } + + public function testRetail036aAuthorizeDiscoverManualCardPresent() + { + $address = new Address(); + $address->postalCode = '750241234'; + + $card = TestCards::discoverManual(true, true); + $response = $card->authorize(16.10) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // AUTHORIZATION - Manually Entered, Card Not Present + + public function testRetail037AuthorizeVisaManual() + { + $address = new Address(); + $address->postalCode = '750241234'; + $address->streetAddress1 = '6860 Dallas Pkwy'; + + $card = TestCards::visaManual(false, true); + + // 034a authorize + $response = $card->authorize(17.08) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // 034b capture + $captureResponse = $response->capture()->execute(); + $this->assertNotNull($captureResponse); + $this->assertEquals('00', $captureResponse->responseCode); + } + + public function testRetail038AuthorizeMasterCardManual() + { + $address = new Address(); + $address->postalCode = '750241234'; + $address->streetAddress1 = '6860'; + + $card = TestCards::masterCardManual(false, true); + + // 036a authorize + $response = $card->authorize(17.09) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // 036b capture + $captureResponse = $response->capture()->execute(); + $this->assertNotNull($captureResponse); + $this->assertEquals('00', $captureResponse->responseCode); + } + + public function testRetail038aAuthorizeDiscoverManual() + { + $address = new Address(); + $address->postalCode = '750241234'; + + $card = TestCards::discoverManual(false, true); + + $response = $card->authorize(17.10) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // PARTIALLY APPROVED SALE (Required) + + public function testRetail039ChargeDiscoverSwipePartialApproval() + { + $card = TestCards::discoverSwipe(); + + $response = $card->charge(40.00) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAllowPartialAuth(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('10', $response->responseCode); + $this->assertEquals(40.00, $response->authorizedAmount); + } + + public function testRetail040ChargeVisaSwipePartialApproval() + { + $card = TestCards::visaSwipe(); + $response = $card->charge(130.00) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAllowPartialAuth(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('10', $response->responseCode); + $this->assertEquals(110.00, $response->authorizedAmount); + } + + public function testRetail041ChargeDiscoverManualPartialApproval() + { + $address = new Address(); + $address->postalCode = '75024'; + $card = TestCards::discoverManual(true, true); + + $response = $card->charge(145.00) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAllowPartialAuth(true) + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('10', $response->responseCode); + $this->assertEquals(65.00, $response->authorizedAmount); + } + + public function testRetail042ChargeMasterCardSwipePartialApproval() + { + $card = TestCards::masterCardSwipe(); + $response = $card->charge(155.00) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAllowPartialAuth(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('10', $response->responseCode); + $this->assertEquals(100.00, $response->authorizedAmount); + + // test case 62 + $reversal = $response->reverse(100.00) + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($reversal); + $this->assertEquals('00', $reversal->responseCode); + } + + /* + SALE WITH GRATUITY + Tip Edit (Tip at Settlement) + */ + + public function testRetail043ChargeVisaSwipeEditGratuity() + { + $card = TestCards::visaSwipe(); + $response = $card->charge(15.12) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + $editResponse = $response->edit() + ->withAllowDuplicates(true) + ->withAmount(18.12) + ->withGratuity(3.00) + ->execute(); + $this->assertNotNull($editResponse); + $this->assertEquals('00', $editResponse->responseCode); + } + + public function testRetail044ChargeMasterCardManualEditGratuity() + { + $address = new Address(); + $address->postalCode = '75024'; + + $card = TestCards::masterCardManual(true, true); + $response = $card->charge(15.13) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + $editResponse = $response->edit() + ->withAllowDuplicates(true) + ->withAmount(18.13) + ->withGratuity(3.00) + ->execute(); + $this->assertNotNull($editResponse); + $this->assertEquals('00', $editResponse->responseCode); + } + + // Tip on Purchase + + public function testRetail045ChargeVisaManualGratuity() + { + $address = new Address(); + $address->postalCode = '75024'; + + $card = TestCards::visaManual(true, true); + + $response = $card->charge(18.61) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->withGratuity(3.50) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail046ChargeMasterCardSwipeGratuity() + { + $card = TestCards::masterCardSwipe(); + + $response = $card->charge(18.62) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withGratuity(3.50) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + $editResponse = $response->edit() + ->withAllowDuplicates(true) + ->withAmount(18.12) + ->withGratuity(3.00) + ->execute(); + $this->assertNotNull($editResponse); + $this->assertEquals('00', $editResponse->responseCode); + } + + // LEVEL II CORPORATE PURCHASE CARD + + public function testRetail047LevelIIVisaSwipeResponseB() + { + $card = TestCards::visaSwipe(); + + $response = $card->charge(112.34) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withCommercialRequest(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('B', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withAllowDuplicates(true) + ->withTaxType(TaxType::SALES_TAX) + ->withTaxAmount(1) + ->execute(); + $this->assertNotNull($cpcResponse); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function testRetail047aLevelIIVisaSwipeResponseB() + { + $card = TestCards::visaSwipe(); + + $response = $card->charge(112.34) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withCommercialRequest(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('B', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withAllowDuplicates(true) + ->withTaxType(TaxType::NOT_USED) + ->execute(); + $this->assertNotNull($cpcResponse); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function testRetail048LevelIIVisaSwipeResponseR() + { + $card = TestCards::visaSwipe(); + + $response = $card->charge(123.45) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withCommercialRequest(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('R', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withAllowDuplicates(true) + ->withTaxType(TaxType::TAX_EXEMPT) + ->execute(); + $this->assertNotNull($cpcResponse); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function testRetail049LevelIIVisaManualResponseS() + { + $address = new Address(); + $address->postalCode = '75024'; + + $card = TestCards::visaManual(true, true); + + $response = $card->charge(134.56) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('S', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withAllowDuplicates(true) + ->withPoNumber('9876543210') + ->withTaxType(TaxType::SALES_TAX) + ->withTaxAmount(1) + ->execute(); + $this->assertNotNull($cpcResponse); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function testRetail050LevelIIMasterCardSwipeResponseS() + { + $card = TestCards::masterCardSwipe(); + + $response = $card->charge(111.06) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withCommercialRequest(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('S', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withAllowDuplicates(true) + ->withPoNumber('9876543210') + ->withTaxType(TaxType::NOT_USED) + ->execute(); + $this->assertNotNull($cpcResponse); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function testRetail051LevelIIMasterCardManualResponseS() + { + $address = new Address(); + $address->postalCode = '75024'; + + $card = TestCards::masterCardManual(true, true); + + $response = $card->charge(111.07) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('S', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withAllowDuplicates(true) + ->withPoNumber('9876543210') + ->withTaxType(TaxType::SALES_TAX) + ->withTaxAmount(1) + ->execute(); + $this->assertNotNull($cpcResponse); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function testRetail051aLevelIIMasterCardManualResponseS() + { + $address = new Address(); + $address->postalCode = '75024'; + + $card = TestCards::masterCardManual(true, true); + $response = $card->charge(111.08) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('S', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withAllowDuplicates(true) + ->withPoNumber('9876543210') + ->withTaxType(TaxType::SALES_TAX) + ->withTaxAmount(1) + ->execute(); + $this->assertNotNull($cpcResponse); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function testRetail052LevelIIMasterCardManualResponseS() + { + $address = new Address(); + $address->postalCode = '75024'; + + $card = TestCards::masterCardManual(true, true); + $response = $card->charge(111.09) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('S', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withAllowDuplicates(true) + ->withPoNumber('9876543210') + ->withTaxType(TaxType::TAX_EXEMPT) + ->execute(); + $this->assertNotNull($cpcResponse); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function testRetail053LevelIIAmexSwipeNoResponse() + { + $card = TestCards::amexSwipe(); + $response = $card->charge(111.10) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withCommercialRequest(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('0', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withAllowDuplicates(true) + ->withTaxType(TaxType::SALES_TAX) + ->withTaxAmount(1) + ->execute(); + $this->assertNotNull($cpcResponse); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function testRetail054LevelIIAmexManualNoResponse() + { + $address = new Address(); + $address->postalCode = '75024'; + + $card = TestCards::amexManual(true, true); + + $response = $card->charge(111.11) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('0', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withAllowDuplicates(true) + ->withPoNumber('9876543210') + ->withTaxType(TaxType::NOT_USED) + ->execute(); + $this->assertNotNull($cpcResponse); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function testRetail055LevelIIAmexManualNoResponse() + { + $address = new Address(); + $address->postalCode = '75024'; + + $card = TestCards::amexManual(true, true); + $response = $card->charge(111.12) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('0', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withAllowDuplicates(true) + ->withPoNumber('9876543210') + ->withTaxType(TaxType::NOT_USED) + ->execute(); + $this->assertNotNull($cpcResponse); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + public function testRetail055aLevelIIAmexManualNoResponse() + { + $address = new Address(); + $address->postalCode = '75024'; + + $card = TestCards::amexManual(true, true); + $response = $card->charge(111.13) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAddress($address) + ->withCommercialRequest(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals('0', $response->commercialIndicator); + + $cpcResponse = $response->edit() + ->withAllowDuplicates(true) + ->withPoNumber('9876543210') + ->withTaxType(TaxType::TAX_EXEMPT) + ->execute(); + $this->assertNotNull($cpcResponse); + $this->assertEquals('00', $cpcResponse->responseCode); + } + + // OFFLINE SALE / AUTHORIZATION + + public function testRetail056OfflineChargeVisaManual() + { + $card = TestCards::visaManual(false, true); + + $response = $card->charge(15.12) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withOfflineAuthCode('654321') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail056OfflineAuthVisaManual() + { + $card = TestCards::visaManual(false, true); + + $response = $card->authorize(15.11) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withOfflineAuthCode('654321') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // RETURN + + public function testRetail057ReturnMasterCard() + { + $card = TestCards::masterCardManual(false, true); + + $response = $card->refund(15.11) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail057aReturnMasterCardSwipe() + { + $card = TestCards::masterCardSwipe(); + $response = $card->refund(15.15) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail058ReturnJcbTransactionId() + { + // See test 14 + } + + // ONLINE VOID / REVERSAL (Required) + + public function testRetail059ReversalVisa() + { + // see test 10 + } + + public function testRetail060ReversalMasterCard() + { + // see test case 17 + } + + public function testRetail061ReversalMasterCard() + { + // see test case 23 + } + + public function testRetail062ReversalMasterCard() + { + // see test case 42 + } + + public function testRetail063ReversalVisaPartial() + { + // see test case 15 + } + + public function testRetail064ReversalDiscoverPartial() + { + // see test 21 + } + + // PIN DEBIT CARD FUNCTIONS + + public function testRetail065DebitSaleVisaSwipe() + { + $card = TestCards::asDebit(TestCards::visaSwipe(), '32539F50C245A6A93D123412324000AA'); + + $response = $card->charge(14.01) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail066DebitSaleMasterCardSwipe() + { + $card = TestCards::asDebit(TestCards::masterCardSwipe(), 'F505AD81659AA42A3D123412324000AB'); + + $response = $card->charge(14.02) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + // test case 71 + $reversal = $response->reverse(14.02) + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($reversal); + $this->assertEquals('00', $reversal->responseCode); + } + + public function testRetail067DebitSaleVisaSwipeCashBack() + { + $card = TestCards::asDebit(TestCards::visaSwipe(), '32539F50C245A6A93D123412324000AA'); + + $response = $card->charge(14.03) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withCashBack(5.00) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail067aDebitSaleMasterCard() + { + $card = TestCards::asDebit(TestCards::masterCardSwipe(), 'F505AD81659AA42A3D123412324000AB'); + + $response = $card->charge(14.04) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // PARTIALLY APPROVED PURCHASE + + public function testRetail068DebitSaleMasterCardPartialApproval() + { + $card = TestCards::asDebit(TestCards::masterCardSwipe(), 'F505AD81659AA42A3D123412324000AB'); + + $response = $card->charge(33.00) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAllowPartialAuth(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('10', $response->responseCode); + $this->assertEquals(22.00, $response->authorizedAmount); + } + + public function testRetail069DebitSaleVisaPartialApproval() + { + $this->markTestSkipped(); + + $card = TestCards::asDebit(TestCards::visaSwipe(), '32539F50C245A6A93D123412324000AA'); + + $response = $card->charge(44.00) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withAllowPartialAuth(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals(33.00, $response->authorizedAmount); + + // test case 72 + $reversal = $response->reverse(33.00) + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($reversal); + $this->assertEquals('00', $reversal->responseCode); + } + + // RETURN + + public function testRetail070DebitReturnVisaSwipe() + { + $card = TestCards::asDebit(TestCards::visaSwipe(), '32539F50C245A6A93D123412324000AA'); + + $response = $card->refund(14.07) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail070aDebitReturnVisaSwipe() + { + $card = TestCards::asDebit(TestCards::visaSwipe(), '32539F50C245A6A93D123412324000AA'); + + $response = $card->refund(14.08) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + $reversalResponse = $response->reverse(14.08) + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($reversalResponse); + $this->assertEquals('00', $reversalResponse->responseCode); + } + + // REVERSAL + + public function testRetail071DebitReversalMasterCard() + { + // see test case 66 + } + + public function testRetail072DebitReversalVisa() + { + // see test case 96 + } + + /* + EBT FUNCTIONS + Food Stamp Purchase + */ + + public function testRetail080EbtfsPurchaseVisaSwipe() + { + $card = TestCards::asEBTTrack(TestCards::visaSwipe(), '32539F50C245A6A93D123412324000AA'); + + $response = $card->charge(101.01) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail081EbtfsPurchaseVisaManual() + { + $card = TestCards::asEBTManual(TestCards::visaManual(false, true), '32539F50C245A6A93D123412324000AA'); + + $response = $card->charge(102.01) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // Food Stamp Electronic Voucher (Manual Entry Only) + + public function testRetail082EbtVoucherPurchaseVisa() + { + $card = TestCards::asEBTManual(TestCards::visaManual(false, true), '32539F50C245A6A93D123412324000AA'); + $card->SerialNumber = '123456789012345'; + $card->approvalCode = '123456'; + + $response = $card->charge(103.01) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // Food Stamp Balance Inquiry + + public function testRetail083EbtfsReturnVisaSwipe() + { + $card = TestCards::asEBTTrack(TestCards::visaSwipeEncrypted(), '32539F50C245A6A93D123412324000AA'); + + $response = $card->refund(104.01) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail084EbtfsReturnVisaManual() + { + $card = TestCards::asEBTManual(TestCards::visaManual(false, true), '32539F50C245A6A93D123412324000AA'); + + $response = $card->refund(105.01) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // Food Stamp Balance Inquiry + + public function testRetail085EbtBalanceInquiryVisaSwipe() + { + $card = TestCards::asEBTTrack(TestCards::visaSwipeEncrypted(), '32539F50C245A6A93D123412324000AA'); + + $response = $card->balanceInquiry()->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail086EbtBalanceInquiryVisaManual() + { + $card = TestCards::asEBTManual(TestCards::visaManual(true, true), '32539F50C245A6A93D123412324000AA'); + + $response = $card->balanceInquiry()->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + /* + $this->assertEquals('00', $response->responseCode); + EBT CASH BENEFITS + Cash Back Purchase + */ + + public function testRetail087EbtCashBackPurchaseVisaSwipe() + { + $card = TestCards::asEBTTrack(TestCards::visaSwipeEncrypted(), '32539F50C245A6A93D123412324000AA'); + + $response = $card->charge(106.01) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withCashBack(5.00) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail088EbtCashBackPurchaseVisaManual() + { + $card = TestCards::asEBTManual(TestCards::visaManual(false, true), '32539F50C245A6A93D123412324000AA'); + + $response = $card->charge(107.01) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withCashBack(5.00) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // No Cash Back Purchase + + public function testRetail089EbtCashBackPurchaseVisaSwipeNoCashBack() + { + $card = TestCards::asEBTTrack(TestCards::visaSwipeEncrypted(), '32539F50C245A6A93D123412324000AA'); + + $response = $card->charge(108.01) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withCashBack(0) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail090EbtCashBackPurchaseVisaManualNoCashBack() + { + $card = TestCards::asEBTManual(TestCards::visaManual(false, true), '32539F50C245A6A93D123412324000AA'); + + $response = $card->charge(109.01) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withCashBack(0) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // Cash Back Balance Inquiry + + public function testRetail091EbtBalanceInquiryVisaSwipeCash() + { + $card = TestCards::asEBTTrack(TestCards::visaSwipeEncrypted(), '32539F50C245A6A93D123412324000AA'); + + $response = $card->balanceInquiry(InquiryType::CASH)->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail092EbtBalanceInquiryVisaManualCash() + { + $card = TestCards::asEBTManual(TestCards::visaManual(true, true), '32539F50C245A6A93D123412324000AA'); + + $response = $card->balanceInquiry(InquiryType::CASH)->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + // Cash Benefits Withdrawal + + public function testRetail093EbtBenefitWithDrawalVisaSwipe() + { + $card = TestCards::asEBTTrack(TestCards::visaSwipeEncrypted(), '32539F50C245A6A93D123412324000AA'); + + $response = $card->charge(110.01) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testRetail094EbtBenefitWithDrawalVisaManual() + { + $card = TestCards::asEBTManual(TestCards::visaManual(false, true), '32539F50C245A6A93D123412324000AA'); + + $response = $card->charge(111.01) + ->withAllowDuplicates(true) + ->withCurrency('USD') + ->withCashBack(0) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + /* + HMS GIFT - REWARDS + GIFT + ACTIVATE + */ + + public function testRetail095ActivateGift1Swipe() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->activate(6.00)->execute(); + $this->assertNotNull($response); + $this->assertEquals('0', $response->responseCode); + } + + public function testRetail096ActivateGift2Manual() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->activate(7.00)->execute(); + $this->assertNotNull($response); + $this->assertEquals('0', $response->responseCode); + } + + // ADD VALUE + + public function testRetail097AddValueGift1Swipe() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->addValue(8.00) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('0', $response->responseCode); + } + + public function testRetail098AddValueGift2Manual() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->activate(9.00)->execute(); + $this->assertNotNull($response); + $this->assertEquals('0', $response->responseCode); + } + + // BALANCE INQUIRY + + public function testRetail099BalanceInquiryGift1Swipe() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->balanceInquiry()->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + $this->assertEquals(10.00, $response->balanceAmount); + } + + public function testRetail100BalanceInquiryGift2Manual() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->balanceInquiry()->execute(); + $this->assertNotNull($response); + $this->assertEquals('0', $response->responseCode); + $this->assertEquals(10.00, $response->balanceAmount); + } + + // REPLACE / TRANSFER + + public function testRetail101ReplaceGift1Swipe() + { + $oldCard = TestCards::giftCard1Swipe(); + $newCard = TestCards::giftCard2Manual(); + + $response = $oldCard->replaceWith($newCard)->execute(); + $this->assertNotNull($response); + $this->assertEquals('0', $response->responseCode); + } + + public function testRetail102ReplaceGift2Manual() + { + $newCard = TestCards::giftCard1Swipe(); + $oldCard = TestCards::giftCard2Manual(); + + $response = $oldCard->replaceWith($newCard)->execute(); + $this->assertNotNull($response); + $this->assertEquals('0', $response->responseCode); + } + + // SALE / REDEEM + + public function testRetail103SaleGift1Swipe() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->charge(1.00) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('0', $response->responseCode); + } + + public function testRetail104SaleGift2Manual() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->charge(2.00) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('0', $response->responseCode); + } + + public function testRetail105SaleGift1VoidSwipe() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->charge(3.00) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('0', $response->responseCode); + + // test case 107 + $voidResponse = $response->void()->execute(); + $this->assertNotNull($voidResponse); + $this->assertEquals('0', $voidResponse->responseCode); + } + + public function testRetail106SaleGift2ReversalManual() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->charge(4.00) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('0', $response->responseCode); + + //test case 108 + $voidResponse = $response->reverse(4.00)->execute(); + $this->assertNotNull($voidResponse); + $this->assertEquals('0', $voidResponse->responseCode); + } + + // VOID + + public function testRetail107VoidGift() + { + // see test case 105 + } + + // REVERSAL + + public function testRetail108ReversalGift() + { + // see test case 106 + } + + // DEACTIVATE + + public function testRetail109DeactivateGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->deactivate()->execute(); + $this->assertNotNull($response); + $this->assertEquals('0', $response->responseCode); + } + + // RECEIPTS MESSAGING + + public function testRetail110ReceiptsMessaging() + { + // PRINT AND SCAN RECEIPT FOR TEST 107 + } + + /* + REWARDS + BALANCE INQUIRY + */ + + public function testRetail111BalanceInquiryRewards1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->balanceInquiry()->execute(); + $this->assertNotNull($response); + $this->assertEquals('0', $response->responseCode); + $this->assertEquals(0, $response->pointsBalanceAmount); + } + + public function testRetail112BalanceInquiryRewards2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->balanceInquiry()->execute(); + $this->assertNotNull($response); + $this->assertEquals('0', $response->responseCode); + $this->assertEquals(0, $response->pointsBalanceAmount); + } + + // ALIAS + + public function testRetail113CreateAliasGift1() + { + $card = GiftCard::create('9725550100'); + $this->assertNotNull($card); + } + + public function testRetail114CreateAliasGift2() + { + $card = GiftCard::create('9725550100'); + $this->assertNotNull($card); + } + + public function testRetail115AddAliasGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->addAlias('2145550199')->execute(); + $this->assertNotNull($response); + $this->assertEquals('0', $response->responseCode); + } + + public function testRetail116AddAliasGift2() + { + $card = TestCards::giftCard2Manual(); + + $response = $card->addAlias('2145550199')->execute(); + $this->assertNotNull($response); + $this->assertEquals('0', $response->responseCode); + } + + public function testRetail117DeleteAliasGift1() + { + $card = TestCards::giftCard1Swipe(); + + $response = $card->removeAlias('2145550199')->execute(); + $this->assertNotNull($response); + $this->assertEquals('0', $response->responseCode); + } + + public function testRetail999CloseBatch() + { + try { + $response = BatchService::closeBatch(); + $this->assertNotNull($response); + // error_log(sprintf('Batch ID: %s', $response->Id)); + // error_log(sprintf('Sequence Number: %s', $response->SequenceNumber)); + } catch (Exception $exec) { + if (false === strpos($e->getMessage(), static::BATCH_NOT_OPEN) + && false === strpos($e->getMessage(), static::NO_TRANS_IN_BATCH) + ) { + $this->fail($e->getMessage()); + } + } + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/CreditTest.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/CreditTest.php new file mode 100644 index 0000000..01539b1 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/CreditTest.php @@ -0,0 +1,270 @@ +card = new CreditCardData(); + $this->card->number = '4111111111111111'; + $this->card->expMonth = 12; + $this->card->expYear = 2025; + $this->card->cvn = '123'; + $this->card->cardHolderName = 'Joe Smith'; + + + $this->track = new CreditTrackData(); + $this->track->value = ';'; + $this->track->encryptionData = new EncryptionData(); + $this->track->encryptionData->version = '01'; + + ServicesContainer::configure($this->getConfig()); + } + + public function testCreditAuthorization() + { + $authorization = $this->card->authorize(14) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($authorization); + $this->assertEquals('00', $authorization->responseCode); + + $capture = $authorization->capture(16) + ->withGratuity(2) + ->execute(); + $this->assertNotNull($capture); + $this->assertEquals('00', $capture->responseCode); + } + + public function testCreditServiceAuth() + { + $service = new CreditService( + $this->getConfig() + ); + + $authorization = $service->authorize(15) + ->withCurrency('USD') + ->withPaymentMethod($this->card) + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($authorization); + $this->assertEquals('00', $authorization->responseCode); + + $capture = $service->capture($authorization->transactionReference->transactionId) + ->withAmount(17) + ->withGratuity(2) + ->execute(); + $this->assertNotNull($capture); + $this->assertEquals('00', $capture->responseCode); + } + + public function testCreditSale() + { + $response = $this->card->charge(15) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCreditOfflineAuth() + { + $response = $this->card->authorize(16) + ->withCurrency('USD') + ->withOfflineAuthCode('12345') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCreditOfflineSale() + { + $response = $this->card->charge(16) + ->withCurrency('USD') + ->withOfflineAuthCode('12345') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCreditRefund() + { + $response = $this->card->refund(16) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCreditReverse() + { + $response = $this->card->reverse(15) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCreditVerify() + { + $response = $this->card->verify() + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCreditSwipeAuthorization() + { + $authorization = $this->track->authorize(14) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($authorization); + $this->assertEquals('00', $authorization->responseCode); + + $capture = $authorization->capture(16) + ->withGratuity(2) + ->execute(); + $this->assertNotNull($capture); + $this->assertEquals('00', $capture->responseCode); + } + + public function testCreditServiceSwipeAuth() + { + $service = new CreditService( + $this->getConfig() + ); + + $authorization = $service->authorize(15) + ->withCurrency('USD') + ->withPaymentMethod($this->track) + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($authorization); + $this->assertEquals('00', $authorization->responseCode); + + $capture = $service->capture($authorization->transactionReference->transactionId) + ->withAmount(17) + ->withGratuity(2) + ->execute(); + $this->assertNotNull($capture); + $this->assertEquals('00', $capture->responseCode); + } + + public function testCreditSwipeSale() + { + $response = $this->track->charge(15) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCreditSwipeOfflineAuth() + { + $response = $this->track->authorize(16) + ->withCurrency('USD') + ->withOfflineAuthCode('12345') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCreditSwipeOfflineSale() + { + $response = $this->track->charge(16) + ->withCurrency('USD') + ->withOfflineAuthCode('12345') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCreditSwipeAddValue() + { + $this->markTestSkipped('GSB not configured'); + + $response = $this->track->addValue(16) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCreditSwipeBalanceInquiry() + { + $response = $this->track->balanceInquiry() + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCreditSwipeRefund() + { + $response = $this->track->refund(16) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCreditSwipeReverse() + { + $response = $this->track->reverse(15) + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCreditSwipeVerify() + { + $response = $this->track->verify() + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + protected function getConfig() + { + $config = new ServicesConfig(); + $config->secretApiKey = 'skapi_cert_MTeSAQAfG1UA9qQDrzl-kz4toXvARyieptFwSKP24w'; + $config->serviceUrl = ($this->enableCryptoUrl) ? + 'https://cert.api2-c.heartlandportico.com/': + 'https://cert.api2.heartlandportico.com'; + return $config; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/DebitTest.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/DebitTest.php new file mode 100644 index 0000000..21e57e4 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/DebitTest.php @@ -0,0 +1,73 @@ +track = TestCards::asDebit(TestCards::visaSwipeEncrypted(), '32539F50C245A6A93D123412324000AA'); + + ServicesContainer::configure($this->getConfig()); + } + + public function testDebitSale() + { + $response = $this->track->charge(17.01) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testDebitAddValue() + { + $this->markTestSkipped('GSB not configured'); + + $response = $this->track->addValue(15.01) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testDebitRefund() + { + $response = $this->track->refund(16.01) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testDebitReverse() + { + $response = $this->track->reverse(17.01) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + protected function getConfig() + { + $config = new ServicesConfig(); + $config->secretApiKey = 'skapi_cert_MaePAQBr-1QAqjfckFC8FTbRTT120bVQUlfVOjgCBw'; + $config->serviceUrl = ($this->enableCryptoUrl) ? + 'https://cert.api2-c.heartlandportico.com/': + 'https://cert.api2.heartlandportico.com'; + return $config; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/EbtTest.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/EbtTest.php new file mode 100644 index 0000000..902e79c --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/EbtTest.php @@ -0,0 +1,90 @@ +card = TestCards::asEBTManual(TestCards::visaManual(), '32539F50C245A6A93D123412324000AA'); + $this->track = TestCards::asEBTTrack(TestCards::visaSwipeEncrypted(), '32539F50C245A6A93D123412324000AA'); + + ServicesContainer::configure($this->getConfig()); + } + + public function testEbtBalanceInquiry() + { + $response = $this->card->balanceInquiry() + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testEbtSale() + { + $response = $this->card->charge(10) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testEbtRefund() + { + $response = $this->card->refund(10) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testEbtSwipeBalanceInquiry() + { + $response = $this->track->balanceInquiry() + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testEbtSwipeSale() + { + $response = $this->track->charge(10) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testEbtSwipeRefund() + { + $response = $this->track->refund(10) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + protected function getConfig() + { + $config = new ServicesConfig(); + $config->secretApiKey = 'skapi_cert_MaePAQBr-1QAqjfckFC8FTbRTT120bVQUlfVOjgCBw'; + $config->serviceUrl = ($this->enableCryptoUrl) ? + 'https://cert.api2-c.heartlandportico.com/': + 'https://cert.api2.heartlandportico.com'; + return $config; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/GiftTest.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/GiftTest.php new file mode 100644 index 0000000..715f04e --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/GiftTest.php @@ -0,0 +1,119 @@ +card = new GiftCard(); + $this->card->number = '5022440000000000007'; + + $this->track = new GiftCard(); + $this->track->trackData = '%B5022440000000000098^^391200081613?;5022440000000000098=391200081613?'; + + ServicesContainer::configure($this->getConfig()); + } + + public function testGiftCreate() + { + $newCard = GiftCard::create('2145550199'); + $this->assertNotNull($newCard); + $this->assertNotNull($newCard->number); + $this->assertNotNull($newCard->alias); + $this->assertNotNull($newCard->pin); + } + + public function testGiftAddAlias() + { + $response = $this->card->addAlias('2145550199') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testGiftAddValue() + { + $response = $this->card->addValue(10) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testGiftBalanceInquiry() + { + $response = $this->card->balanceInquiry() + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testGiftSale() + { + $response = $this->card->charge(10) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testGiftDeactivate() + { + $response = $this->card->deactivate() + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testGiftRemoveAlias() + { + $response = $this->card->removeAlias('2145550199') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testGiftReplace() + { + $response = $this->card->replaceWith($this->track) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testGiftReverse() + { + $response = $this->card->reverse(10) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testGiftRewards() + { + $response = $this->card->rewards(10) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + protected function getConfig() + { + $config = new ServicesConfig(); + $config->secretApiKey = 'skapi_cert_MaePAQBr-1QAqjfckFC8FTbRTT120bVQUlfVOjgCBw'; + $config->serviceUrl = ($this->enableCryptoUrl) ? + 'https://cert.api2-c.heartlandportico.com/': + 'https://cert.api2.heartlandportico.com'; + return $config; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/PorticoReportingTests.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/PorticoReportingTests.php new file mode 100644 index 0000000..b83adf7 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/PorticoReportingTests.php @@ -0,0 +1,296 @@ +card = new CreditCardData(); + $this->card->number = '4111111111111111'; + $this->card->expMonth = 12; + $this->card->expYear = 2025; + $this->card->cvn = '123'; + $this->card->cardHolderName = 'Joe Smith'; + + + $this->reportingService = new ReportingService(); + $this->searchCriteria = new SearchCriteriaBuilder(); + + ServicesContainer::configure($this->getConfig()); + } + + protected function getConfig() + { + $config = new ServicesConfig(); + $config->secretApiKey = 'skapi_cert_MaePAQBr-1QAqjfckFC8FTbRTT120bVQUlfVOjgCBw'; + $config->serviceUrl = ($this->enableCryptoUrl) ? + 'https://cert.api2-c.heartlandportico.com/': + 'https://cert.api2.heartlandportico.com'; + return $config; + } + + public function testReportActivity() + { + date_default_timezone_set("UTC"); + $dateFormat = 'Y-m-d\TH:i:s.00\Z'; + $dateMinus15days = new DateTime(); + $dateMinus15days->sub(new DateInterval('P15D')); + $dateMinus10Utc = gmdate($dateFormat, $dateMinus15days->Format('U')); + $nowUtc = gmdate($dateFormat); + + $response = $this->reportingService->activity() + ->withStartDate($dateMinus10Utc) + ->withEndDate($nowUtc) + ->execute(); + $this->assertNotNull($response); + $this->assertTrue(count($response) > 0); + } + + public function testReportActivityByDays() + { + date_default_timezone_set("UTC"); + $dateFormat = 'Y-m-d\TH:i:s.00\Z'; + $dateMinus5days = new DateTime(); + $dateMinus5days->sub(new DateInterval('P5D')); + $dateMinus10Utc = gmdate($dateFormat, $dateMinus5days->Format('U')); + $nowUtc = gmdate($dateFormat); + + $response = $this->reportingService->activity() + ->withStartDate($dateMinus10Utc) + ->withEndDate($nowUtc) + ->execute(); + $this->assertNotNull($response); + $this->assertTrue(count($response) > 0); + } + + public function testReportTransactionDetail() + { + $response = $this->reportingService->transactionDetail("1088532284")->execute(); + $this->assertNotNull($response); + } + + public function testInvoiceNumber() + { + $address = new Address(); + $address->postalCode = "12345"; + + $authResponse = $this->card->charge(10) + ->withCurrency("USD") + ->withAddress($address) + ->withInvoiceNumber('123456') + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($authResponse); + $this->assertEquals('00', $authResponse->responseCode); + $this->assertNotNull($authResponse->transactionId); + + $report = ReportingService::transactionDetail($authResponse->transactionId) + ->execute(); + + $this->assertNotNull($report); + $this->assertEquals('123456', $report->invoiceNumber); + } + + public function testReportCardHolderName() + { + $gateway_response = $this->card->charge(10) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + + $response = $this->reportingService->transactionDetail($gateway_response->transactionId)->execute(); + + $this->assertEquals('Joe', $response->cardHolderFirstName); + $this->assertEquals('Smith', $response->cardHolderLastName); + } + + public function testReportFindTransactionWithTransactionId() + { + $gateway_response = $this->card->charge(10) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + + $response = $this->reportingService->findTransactions($gateway_response->transactionId)->execute(); + $this->assertNotNull($response); + } + + public function testReportFindTransactionNoCriteria() + { + $response = $this->reportingService->findTransactions()->execute(); + $this->assertNotNull($response); + } + + public function testReportFindTransactionWithCriteria() + { + date_default_timezone_set("UTC"); + $dateFormat = 'Y-m-d\TH:i:s.00\Z'; + $dateMinus10days = new DateTime(); + $dateMinus10days->sub(new DateInterval('P5D')); + $dateMinus5Utc = gmdate($dateFormat, $dateMinus10days->Format('U')); + $nowUtc = gmdate($dateFormat); + + $response = $this->reportingService->findTransactions() + ->withTimeZoneConversion(TimeZoneConversion::MERCHANT) + ->where('startDate', $dateMinus5Utc) + ->and('endDate', $nowUtc) + ->execute(); + + $this->assertNotNull($response); + $this->assertTrue(count($response) > 0); + } + + public function testCreditAuthWithConvenienceAmount() + { + $authorization = $this->card->authorize(14) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->withConvenienceAmount(2) + ->execute(); + + $this->assertNotNull($authorization); + $this->assertEquals('00', $authorization->responseCode); + + $report = $this->reportingService->transactionDetail($authorization->transactionId)->execute(); + $this->assertNotNull($report); + $this->assertEquals('2', $report->convenienceAmount); + } + + public function testCreditAuthWithShippingAmount() + { + $authorization = $this->card->authorize(14) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->withShippingAmount(2) + ->execute(); + + $this->assertNotNull($authorization); + $this->assertEquals('00', $authorization->responseCode); + + $report = $this->reportingService->transactionDetail($authorization->transactionId)->execute(); + $this->assertNotNull($report); + $this->assertEquals('2', $report->shippingAmount); + } + + public function testCreditSaleWithConvenienceAmount() + { + $response = $this->card->charge(15) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->withConvenienceAmount(2) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + $report = $this->reportingService->transactionDetail($response->transactionId)->execute(); + $this->assertNotNull($report); + $this->assertEquals('2', $report->convenienceAmount); + } + + public function testCreditSaleWithShippingAmount() + { + $response = $this->card->charge(15) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->withShippingAmount(2) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + $report = $this->reportingService->transactionDetail($response->transactionId)->execute(); + $this->assertNotNull($report); + $this->assertEquals('2', $report->shippingAmount); + } + + public function testCreditOfflineAuthWithConvenienceAmount() + { + $response = $this->card->authorize(16) + ->withCurrency('USD') + ->withOfflineAuthCode('12345') + ->withAllowDuplicates(true) + ->withConvenienceAmount(2) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + $report = $this->reportingService->transactionDetail($response->transactionId)->execute(); + $this->assertNotNull($report); + $this->assertEquals('2', $report->convenienceAmount); + } + + public function testCreditOfflineAuthWithShippingAmount() + { + $response = $this->card->authorize(16) + ->withCurrency('USD') + ->withOfflineAuthCode('12345') + ->withAllowDuplicates(true) + ->withShippingAmount(2) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + $report = $this->reportingService->transactionDetail($response->transactionId)->execute(); + $this->assertNotNull($report); + $this->assertEquals('2', $report->shippingAmount); + } + + public function testCreditOfflineSaleWithConvenienceAmount() + { + $response = $this->card->charge(17) + ->withCurrency('USD') + ->withOfflineAuthCode('12345') + ->withAllowDuplicates(true) + ->WithConvenienceAmount(2) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + $report = $this->reportingService->transactionDetail($response->transactionId)->execute(); + $this->assertNotNull($report); + $this->assertEquals('2', $report->convenienceAmount); + } + + public function testCreditOfflineSaleWithShippingAmount() + { + $response = $this->card->charge(17) + ->withCurrency('USD') + ->withOfflineAuthCode('12345') + ->withAllowDuplicates(true) + ->withShippingAmount(2) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + + $report = $this->reportingService->transactionDetail($response->transactionId)->execute(); + $this->assertNotNull($report); + $this->assertEquals('2', $report->shippingAmount); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/PorticoTokenManagementTest.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/PorticoTokenManagementTest.php new file mode 100644 index 0000000..4ccfc30 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/PorticoConnector/PorticoTokenManagementTest.php @@ -0,0 +1,72 @@ +getConfig()); + + try { + $card = new CreditCardData(); + $card->number = '4111111111111111'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '123'; + + $this->token = $card->tokenize()->execute()->token; + $this->assertTrue(!empty($this->token), 'TOKEN COULD NOT BE GENERATED.'); + } catch (ApiException $exc) { + $this->fail($exc->message); + } + + } + + protected function getConfig() + { + $config = new ServicesConfig(); + $config->secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; + $config->serviceUrl = 'https://cert.api2.heartlandportico.com'; + return $config; + } + + public function testUpdateToken() + { + $token = new CreditCardData(); + $token->token = $this->token; + $token->expMonth = 12; + $token->expYear = 2025; + + $this->assertTrue($token->updateTokenExpiry()); + + // should succeed + $response = $token->verify()->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testDeleteToken() + { + $token = new CreditCardData(); + $token->token = $this->token; + + $this->assertTrue($token->deleteToken()); + + // should fail + try { + $response = $token->verify()->execute(); + } catch (GatewayException $exc) { + $this->assertEquals('27', $exc->responseCode); + } + } +} \ No newline at end of file diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/AcsResponse.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/AcsResponse.php new file mode 100644 index 0000000..131078e --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/AcsResponse.php @@ -0,0 +1,44 @@ +authResponse; + } + + /** + * @return void + */ + public function setAuthResponse($authResponse){ + $this->authResponse = $authResponse; + } + + /** + * @return string + */ + public function getMerchantData(){ + return $this->merchantData; + } + + /** + * @return void + */ + public function setMerchantData($merchantData){ + $this->merchantData = $merchantData; + } +} \ No newline at end of file diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/ApiTestCase.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/ApiTestCase.php new file mode 100644 index 0000000..a1f6a04 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/ApiTestCase.php @@ -0,0 +1,999 @@ +merchantId = 'heartlandgpsandbox'; + $config->accountId = 'api'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->number = '4263970000005262'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '131'; + $card->cardHolderName = 'James Mason'; + + try { + // process an auto-settle authorization + $response = $card->charge(15) + ->withCurrency("EUR") + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + // get the details to save to the DB for future Transaction Management requests + $orderId = $response->orderId; + $authCode = $response->authorizationCode; + $paymentsReference = $response->transactionId; + // TODO: update your application and display transaction outcome to the customer + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + } catch (ApiException $e) { + // TODO: add your error handling here + } + } + + /* 02. Process Payment Refund */ + + public function testprocessPaymentRefund() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'api'; + $config->sharedSecret = 'secret'; + $config->refundPassword = 'refund'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->number = '4263970000005262'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '131'; + $card->cardHolderName = 'James Mason'; + + // process a refund to the card + $response = $card->refund(16) + ->withCurrency("EUR") + ->execute(); + + // get the response details to update the DB + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + } + + /* 03. Process Payment OTB */ + + public function testprocessPaymentOtb() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'api'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->number = '4263970000005262'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '131'; + $card->cardHolderName = 'James Mason'; + + try { + // check that a card is valid and active without charging an amount + $response = $card->verify() + ->execute(); + + // get the response details to update the DB + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + // TODO: save the card to Card Stroage + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + } catch (ApiException $e) { + // TODO: Add your error handling here + } + } + + /* 04. ThreeD Secure Verify Enrolled */ + + public function testthreeDSecureVerifyEnrolled() + { + // will update later + } + + /* 05. ThreeD Secure Verify Sig */ + + public function testthreeDSecureVerifySig() + { + // will update later + } + + /* 06.ThreeD Secure Auth */ + + public function testthreeDSecureAuth() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'api'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->number = '4263970000005262'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '131'; + $card->cardHolderName = 'James Mason'; + + // supply the details from the 3D Secure verify-signature response + $threeDSecureInfo = new EcommerceInfo(); + $threeDSecureInfo->cavv = "AAACBllleHchZTBWIGV4AAAAAAA="; + $threeDSecureInfo->xid = "crqAeMwkEL9r4POdxpByWJ1/wYg="; + $threeDSecureInfo->eci = "5"; + + try { + // create the authorization with 3D Secure information + $response = $card->charge(15) + ->withEcommerceInfo($threeDSecureInfo) + ->withCurrency("EUR") + ->execute(); + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $response->responseCode); + } catch (ApiException $e) { + // TODO: Add your error handling here + } + } + + /* 07. Process Payment Apple Pay */ + + public function testprocessPaymentApplePay() + { + // will update later + } + + /* 19. Transaction Management Delayed Auth */ + + public function testtransactionManagementDelayedAuth() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'api'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->number = '4263970000005262'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '131'; + $card->cardHolderName = 'James Mason'; + + try { + // create the delayed settle authorization + $response = $card->authorize(19.99) + ->withCurrency("EUR") + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + // get the reponse details to save to the DB for future transaction management requests + $orderId = $response->orderId; + $authCode = $response->authorizationCode; + $paymentsReference = $response->transactionId; // pasref + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + } catch (ApiException $e) { + // TODO: Add your error handling here + } + } + + /* 20. Transaction Management Settle */ + + public function testtransactionManagementSettle() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'api'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // a settle request requires the original order id + $orderId = "QAhN4YFrJEWP6Vc-N68u-w"; + // and the payments reference (pasref) from the authorization response + $paymentsReference = "15113583374071921"; + // create the settle transaction object + $settle = Transaction::fromId($paymentsReference, $orderId); + + try { + // send the settle request, we must specify the amount and currency + $response = $settle->capture(1) + ->withCurrency("EUR") + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + } catch (ApiException $e) { + // TODO: Add your error handling here + } + } + + /* 21. Transaction Management Rebate */ + + public function testTransactionManagementRebate() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'api'; + $config->sharedSecret = 'secret'; + $config->rebatePassword = 'rebate'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->number = '4263970000005262'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '131'; + $card->cardHolderName = 'James Mason'; + + $response = $card->charge(19.99) + ->withCurrency("EUR") + ->execute(); + + $this->assertNotNull($response); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + // get the reponse details to save to the DB for future transaction management requests + $orderId = $response->orderId; + $authCode = $response->authorizationCode; + $paymentsReference = $response->transactionId; // pasref + + // create the rebate transaction object + $transaction = Transaction::fromId($paymentsReference, $orderId); + $transaction->authorizationCode = $authCode; + + // send the settle request, we must specify the amount and currency + $response = $transaction->refund(19.99) + ->withCurrency("EUR") + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + } + + /* 22. Transaction Management Void */ + + public function testtransactionManagementVoid() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'api'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // a void request requires the original order id + $orderId = "xd4JTHE0ZEqudur_q1pB1w"; + // and the payments reference (pasref) from the transaction response + $paymentsReference = "15113573969816936"; + // create the void transaction object + $transaction = Transaction::fromId($paymentsReference, $orderId); + + try { + // send the void request + $response = $transaction->void() + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + } catch (ApiException $e) { + // TODO: Add your error handling here + } + } + + /* 23. Fraud Management Data Submission */ + + public function testfraudManagementDataSubmission() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'api'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->number = '4263970000005262'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '131'; + $card->cardHolderName = 'James Mason'; + + // supply the customer's billing country and post code for avs checks + $billingAddress = new Address(); + $billingAddress->postalCode = "50001|Flat 123"; + $billingAddress->country = "US"; + + // supply the customer's shipping country and post code + $shippingAddress = new Address(); + $shippingAddress->postalCode = "654|123"; + $shippingAddress->country = "GB"; + + // create the delayed settle authorization + $response = $card->charge(10) + ->withCurrency("EUR") + ->withAddress($billingAddress, AddressType::BILLING) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withProductId("SID9838383") // prodid + ->withClientTransactionId("Car Part HV") // varref + ->withCustomerId("E8953893489") // custnum + ->withCustomerIpAddress("123.123.123.123") + ->withFraudFilter(FraudFilterMode::PASSIVE) + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + // get the reponse details to save to the DB for future transaction management requests + $orderId = $response->orderId; + $authCode = $response->authorizationCode; + $paymentsReference = $response->transactionId; // pasref + + $this->assertNotNull($response); + $this->assertEquals("00", $responseCode); + $this->assertNotNull($response->fraudFilterResponse); + } + + /* 24. Fraud Management Hold */ + + public function testfraudManagementHold() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'api'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // a hold request requires the original order id + $card = new CreditCardData(); + $card->number = '4263970000005262'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '131'; + $card->cardHolderName = 'James Mason'; + + $response = $card->authorize(19.99) + ->withCurrency("EUR") + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + // get the reponse details to save to the DB for future transaction management requests + $orderId = $response->orderId; + $authCode = $response->authorizationCode; + $paymentsReference = $response->transactionId; // pasref + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + + // create the hold transaction object + $transaction = Transaction::fromId($paymentsReference, $orderId); + + // send the hold request, we can choose to specify a reason why we're holding it + $response = $transaction->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + } + + /* 25. Fraud Management Release */ + + public function testfraudManagementRelease() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'api'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // a hold request requires the original order id + $card = new CreditCardData(); + $card->number = '4263970000005262'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '131'; + $card->cardHolderName = 'James Mason'; + + $response = $card->authorize(19.99) + ->withCurrency("EUR") + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + // get the reponse details to save to the DB for future transaction management requests + $orderId = $response->orderId; + $authCode = $response->authorizationCode; + $paymentsReference = $response->transactionId; // pasref + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + + // create the hold transaction object + $transaction = Transaction::fromId($paymentsReference, $orderId); + + // send the hold request, we can choose to specify a reason why we're holding it + $response = $transaction->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + + // send the release request, we can choose to specify a reason why we're releasing it + $response = $transaction->release() + ->withReasonCode(ReasonCode::FALSE_POSITIVE) + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + } + + /* 26. Dcc Rate Lookup */ + + public function testdccRateLookup() + { + // will update later + } + + /* 27. Dcc Present Choice */ + + public function testdccPresentChoice() + { + // will update later + } + + /* 28. Dcc Auth Data Submission */ + + public function testdccAuthDataSubmission() + { + // will update later + } + + /* 29. Google pay */ + + public function testauthMobileGooglePay() + { + try { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'apitest'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->token = '{"signature":"MEUCIQDapDDJyf9lH3ztEWksgAjNe...AXjW+ZM+Ut2BWoTExppDDPc1a9Z7U\u003d","protocolVersion":"ECv1","signedMessage":"{\"encryptedMessage\":\"VkqwkFuMdXp...TZQxVMnkTeJjwyc4\\u003d\",\"ephemeralPublicKey\":\"BMglUoKZWxgB...YCiBNkLaMTD9G4sec\\u003d\",\"tag\":\"4VYypqW2Q5FN7UP87QNDGsLgc48vAe5+AcjR+BxQ2Zo\\u003d\"}"}'; + $card->mobileType = EncyptedMobileType::GOOGLE_PAY; + + // process an auto-settle authorization + $response = $card->charge(15) + ->withCurrency("EUR") + ->withModifier(TransactionModifier::ENCRYPTED_MOBILE) + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + // get the details to save to the DB for future Transaction Management requests + $orderId = $response->orderId; + $authCode = $response->authorizationCode; + $paymentsReference = $response->transactionId; + // TODO: update your application and display transaction outcome to the customer + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + } catch (GatewayException $exc) { + if ($exc->responseCode != '509') { + throw $exc; + } + } + } + + /* 30. Apple pay */ + + public function testauthMobileApplePay() + { + try { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'apitest'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->token = '{"version":"EC_v1","data":"dvMNzlcy6WNB","header":{"ephemeralPublicKey":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWdNhNAHy9kO2Kol33kIh7k6wh6E","transactionId":"fd88874954acdb299c285f95a3202ad1f330d3fd4ebc22a864398684198644c3","publicKeyHash":"h7WnNVz2gmpTSkHqETOWsskFPLSj31e3sPTS2cBxgrk"}}'; + $card->mobileType = EncyptedMobileType::APPLE_PAY; + + // process an auto-settle authorization + $response = $card->charge() + ->withModifier(TransactionModifier::ENCRYPTED_MOBILE) + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + // get the details to save to the DB for future Transaction Management requests + $orderId = $response->orderId; + $authCode = $response->authorizationCode; + $paymentsReference = $response->transactionId; + // TODO: update your application and display transaction outcome to the customer + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + } catch (GatewayException $exc) { + if ($exc->responseCode != '509' && $exc->responseCode != '515') { + throw $exc; + } + } + } + + /* 31. Mobile payment without Token value */ + + /** + * @expectedException \GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage token cannot be null for this transaction type + */ + public function testauthMobileWithoutToken() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'apitest'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->mobileType = EncyptedMobileType::GOOGLE_PAY; + + $response = $card->charge(15) + ->withCurrency("EUR") + ->withModifier(TransactionModifier::ENCRYPTED_MOBILE) + ->execute(); + } + + /* 32. Mobile payment without Mobile Type */ + + /** + * @expectedException \GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage mobileType cannot be null for this transaction type + */ + public function testauthMobileWithoutType() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'apitest'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->token = '{"version":"EC_v1","data":"dvMNzlcy6WNB","header":{"ephemeralPublicKey":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWdNhNAHy9kO2Kol33kIh7k6wh6E","transactionId":"fd88874954acdb299c285f95a3202ad1f330d3fd4ebc22a864398684198644c3","publicKeyHash":"h7WnNVz2gmpTSkHqETOWsskFPLSj31e3sPTS2cBxgrk"}}'; + + $response = $card->charge(15) + ->withCurrency("EUR") + ->withModifier(TransactionModifier::ENCRYPTED_MOBILE) + ->execute(); + } + + /* 33. Google payment without amount */ + + /** + * @expectedException \GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage Amount and Currency cannot be null for google payment + */ + public function testauthMobileWithoutAmount() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'apitest'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->token = '{"version":"EC_v1","data":"dvMNzlcy6WNB","header":{"ephemeralPublicKey":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWdNhNAHy9kO2Kol33kIh7k6wh6E","transactionId":"fd88874954acdb299c285f95a3202ad1f330d3fd4ebc22a864398684198644c3","publicKeyHash":"h7WnNVz2gmpTSkHqETOWsskFPLSj31e3sPTS2cBxgrk"}}'; + $card->mobileType = EncyptedMobileType::GOOGLE_PAY; + + $response = $card->charge() + ->withCurrency("EUR") + ->withModifier(TransactionModifier::ENCRYPTED_MOBILE) + ->execute(); + } + + /* 34. Google payment without Currency */ + + /** + * @expectedException \GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage Amount and Currency cannot be null for google payment + */ + public function testauthMobileWithoutCurrency() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'apitest'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->token = '{"version":"EC_v1","data":"dvMNzlcy6WNB","header":{"ephemeralPublicKey":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWdNhNAHy9kO2Kol33kIh7k6wh6E","transactionId":"fd88874954acdb299c285f95a3202ad1f330d3fd4ebc22a864398684198644c3","publicKeyHash":"h7WnNVz2gmpTSkHqETOWsskFPLSj31e3sPTS2cBxgrk"}}'; + $card->mobileType = EncyptedMobileType::GOOGLE_PAY; + + $response = $card->charge(12) + ->withModifier(TransactionModifier::ENCRYPTED_MOBILE) + ->execute(); + } + + public function testfraudManagementAVSMatch() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'api'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->number = '4263970000005262'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '131'; + $card->cardHolderName = 'James Mason'; + + // supply the customer's billing country and post code for avs checks + $billingAddress = new Address(); + $billingAddress->postalCode = "50001|Flat 123"; + $billingAddress->country = "US"; + + // create the delayed settle authorization + $response = $card->charge(10) + ->withCurrency("EUR") + ->withAddress($billingAddress, AddressType::BILLING) + ->withVerifyAddress(true) + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + // get the reponse details to save to the DB for future transaction management requests + $orderId = $response->orderId; + $authCode = $response->authorizationCode; + $paymentsReference = $response->transactionId; // pasref + + $this->assertNotNull($response); + $this->assertEquals("00", $responseCode); + $this->assertEquals("M", $response->avsResponseCode); + $this->assertEquals("M", $response->avsAddressResponse); + } + + public function testfraudManagementOffMode() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'api'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->number = '4263970000005262'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '131'; + $card->cardHolderName = 'James Mason'; + + // supply the customer's billing country and post code for avs checks + $billingAddress = new Address(); + $billingAddress->postalCode = "50001|Flat 123"; + $billingAddress->country = "US"; + + // supply the customer's shipping country and post code + $shippingAddress = new Address(); + $shippingAddress->postalCode = "654|123"; + $shippingAddress->country = "GB"; + + // create the delayed settle authorization + $response = $card->charge(10) + ->withCurrency("EUR") + ->withAddress($billingAddress, AddressType::BILLING) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withProductId("SID9838383") // prodid + ->withClientTransactionId("Car Part HV") // varref + ->withCustomerId("E8953893489") // custnum + ->withCustomerIpAddress("123.123.123.123") + ->withFraudFilter(FraudFilterMode::OFF) + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + // get the reponse details to save to the DB for future transaction management requests + $orderId = $response->orderId; + $authCode = $response->authorizationCode; + $paymentsReference = $response->transactionId; // pasref + + $this->assertNotNull($response); + $this->assertEquals("00", $responseCode); + $this->assertNull($response->fraudFilterResponse); + } + + /* 35. Fraud Management Decision Manager */ + + public function testfraudManagementDecisionManager() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'api'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->number = '4263970000005262'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '131'; + $card->cardHolderName = 'James Mason'; + + // supply the customer's billing data for avs checks + $billingAddress = new Address(); + $billingAddress->streetAddress1 = "Flat 123"; + $billingAddress->streetAddress2 = "House 456"; + $billingAddress->streetAddress3 = "Cul-De-Sac"; + $billingAddress->city = "Halifax"; + $billingAddress->province = "West Yorkshire"; + $billingAddress->state = "Yorkshire and the Humber"; + $billingAddress->postalCode = "E77 4QJ"; + $billingAddress->country = "GB"; + + // supply the customer's shipping data + $shippingAddress = new Address(); + $shippingAddress->streetAddress1 = "House 456"; + $shippingAddress->streetAddress2 = "987 The Street"; + $shippingAddress->streetAddress3 = "Basement Flat"; + $shippingAddress->city = "Chicago"; + $shippingAddress->province = "Illinois"; + $shippingAddress->state = "Mid West"; + $shippingAddress->postalCode = "50001"; + $shippingAddress->country = "US"; + + // supply the customer's data + $customer = new Customer(); + $customer->id = "e193c21a-ce64-4820-b5b6-8f46715de931"; + $customer->firstName = "James"; + $customer->lastName = "Mason"; + $customer->dateOfBirth = "01011980"; + $customer->customerPassword = "VerySecurePassword"; + $customer->email = "text@example.com"; + $customer->domainName = "example.com"; + $customer->homePhone = "+35312345678"; + $customer->deviceFingerPrint = "devicefingerprint"; + + // supply the decisionManager data + $decisionManager = new DecisionManager(); + $decisionManager->billToHostName = "example.com"; + $decisionManager->billToHttpBrowserCookiesAccepted = true; + $decisionManager->billToHttpBrowserEmail = "jamesmason@example.com"; + $decisionManager->billToHttpBrowserType = "Mozilla"; + $decisionManager->billToIpNetworkAddress = "123.123.123.123"; + $decisionManager->businessRulessCoreThresHold = "40"; + $decisionManager->billToPersonalId = "741258963"; + $decisionManager->decisionManagerProfile = "DemoProfile"; + $decisionManager->invoiceHeaderTenderType = "consumer"; + $decisionManager->itemHostHedge = Risk::HIGH; + $decisionManager->itemNonsensicalHedge = Risk::HIGH; + $decisionManager->itemObscenitiesHedge = Risk::HIGH; + $decisionManager->itemPhoneHedge = Risk::HIGH; + $decisionManager->itemTimeHedge = Risk::HIGH; + $decisionManager->itemVelocityHedge = Risk::HIGH; + $decisionManager->invoiceHeaderIsGift = true; + $decisionManager->invoiceHeaderReturnsAccepted = true; + + $products = []; + $products[] = array( + 'product_id' => 'SKU251584', + 'productname' => 'Magazine Subscription', + 'quantity' => '12', + 'unitprice' => '1200', + 'gift' => 'true', + 'type' => 'subscription', + 'risk' => 'Low' + ); + $products[] = array( + 'product_id' => 'SKU8884784', + 'productname' => 'Charger', + 'quantity' => '10', + 'unitprice' => '1200', + 'gift' => 'false', + 'type' => 'subscription', + 'risk' => 'High' + ); + + $custom = []; + $custom[] = array( + 'field01' => 'fieldValue01', + 'field02' => 'fieldValue02', + 'field03' => 'fieldValue03', + 'field04' => 'fieldValue04' + ); + + $response = $card->charge(199.99) + ->withCurrency("EUR") + ->withAddress($billingAddress, AddressType::BILLING) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDecisionManager($decisionManager) + ->withCustomerData($customer) + ->withProductData($products) + ->withCustomData($custom) + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + + $this->assertNotNull($response); + $this->assertEquals("00", $responseCode); + } + + public function testAuthorisationWithoutAccountId() { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->number = '4263970000005262'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '131'; + $card->cardHolderName = 'James Mason'; + + // process an auto-settle authorization + $response = $card->charge(15) + ->withCurrency("EUR") + ->execute(); + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRefundWithoutAccountId() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->sharedSecret = 'secret'; + $config->refundPassword = 'refund'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->number = '4263970000005262'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '131'; + $card->cardHolderName = 'James Mason'; + + // process a refund to the card + $response = $card->refund(16) + ->withCurrency("EUR") + ->execute(); + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $response->responseCode); + } + +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/Certifications/SdkTest.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/Certifications/SdkTest.php new file mode 100644 index 0000000..4fe5a53 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/Certifications/SdkTest.php @@ -0,0 +1,18930 @@ +merchantId = "heartlandgpsandbox"; + $config->accountId = "api"; + $config->sharedSecret = "secret"; + $config->refundPassword = "refund"; + $config->rebatePassword = "rebate"; + $config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"; + $config->timeout = 20000; + return $config; + } + + public function getBaseCardData() + { + $card = new CreditCardData(); + $card->number = "4263970000005262"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + $card->cardHolderName = "James Mason"; + return $card; + } + + public function testAuth006a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-006a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth006b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-006b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth006c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-006c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth006d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-006d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth006e() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-006e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth006f() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-006f") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth006g() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-006g") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth006h() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-006h") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth006i() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-006i") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth006j() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-006j") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth006k() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-006k") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth007a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-007a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth007b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-007b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth007c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-007c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth007d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-007d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth007e() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-007e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth008a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-008a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth008b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-008b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth008c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-008c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth008d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-008d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth008e() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-008e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth009a() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-009a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth009b() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "E"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-009b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth009c() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOMMERCE"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-009c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth009d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-009d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth010a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-010a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth010b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-010b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth010c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-010c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth010d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-010d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth010e() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-010e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth011a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-011a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth011b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-011b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth011c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-011c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testAuth011d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge() + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-011d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth012a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-012a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth012b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EURO") + ->withDescription("JAVA-Auth-012b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth012c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("�UR") + ->withDescription("JAVA-Auth-012c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testAuth012d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withDescription("JAVA-Auth-012d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth013a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-013a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth013b1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "424242000000000000000"; + $card->expMonth = 12; + $card->expYear = 2020; + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-013b1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth013b2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "42424242424"; + $card->expMonth = 12; + $card->expYear = 2020; + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-013b2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth013c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4263970000005262#"; + $card->expMonth = 12; + $card->expYear = 2020; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-013c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth014a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-014a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth014b() + { + $this->markTestSkipped('Exception not thrown'); + + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-014b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth014c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cardHolderName = "3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-014c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth014d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cardHolderName = "James~Mason"; + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-014d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth015a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-015a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth015b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-015b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth015c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 20; + $card->expYear = 2012; + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-015c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth015d() + { + $this->markTestSkipped('Exception not thrown'); + + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-015d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth016a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-016a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth016b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-016b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth016c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-016c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth017a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-017a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth018a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-018a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth019a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-019a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth019b1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "1234"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-019b1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth019b2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-019b2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth019c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "12345"; + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-019c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth019d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "374101000000608"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "1234"; + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-019d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth020a1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-020a1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth020a2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = ""; + $card->cvnPresenceIndicator = CvnPresenceIndicator::ILLEGIBLE; + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-020a2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth020a3() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = ""; + $card->cvnPresenceIndicator = CvnPresenceIndicator::NOT_ON_CARD; + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-020a3") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth020a4() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = ""; + $card->cvnPresenceIndicator = CvnPresenceIndicator::NOT_REQUESTED; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-020a4") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth020b() + { + $this->markTestSkipped('Exception not thrown'); + + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvnPresenceIndicator = 5; + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-020b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth020c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvnPresenceIndicator = 0; + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-020c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth021a1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-021a1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth021a2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->authorize(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-021a2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth021a3() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->authorize(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-021a3") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth021b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->authorize(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-021b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth021c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->authorize(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-021c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth022a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-022a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth022b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-022b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth022c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-022c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth022d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-022d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth022e() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-022e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth023a1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-023a1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth023a2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-023a2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth023b1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-023b1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth023c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-023c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth024a1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-024a1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth024a2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-024a2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth024a3() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-024a3") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth024b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-024b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth024c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-024c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth025() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-025") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth026a1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-026a1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth026a2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth026b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth026c1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIep3uviSnW9XEB3a4wpIW9XEB3a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth026c2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-026c2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth027a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withCustomerId("123456") + ->withDescription("JAVA-Auth-027a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth028a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("123456") + ->withDescription("JAVA-Auth-028a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth028b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-028b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth028c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withCustomerId("3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep33a4wpQQQQQQQQQ1") + ->withDescription("JAVA-Auth-028c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth028d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("123456~") + ->withDescription("JAVA-Auth-028d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth029a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withProductId("123456") + ->withDescription("JAVA-Auth-029a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth029b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Auth-029b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth029c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withProductId("3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep33a4wpQQQQQQQQQ1") + ->withDescription("JAVA-Auth-029c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth029d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withProductId("123456~") + ->withDescription("JAVA-Auth-029d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth030a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withClientTransactionId("123456") + ->withDescription("JAVA-Auth-030a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth030b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-030b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth030c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withClientTransactionId("3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep33a4wpQQQQQQQQQ1") + ->withDescription("JAVA-Auth-030c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth030d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withClientTransactionId("123456~") + ->withDescription("JAVA-Auth-030d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth031a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerIpAddress("123.123.123.123") + ->withDescription("JAVA-Auth-031a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth031b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-031b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth031c1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withCustomerIpAddress("1234.123.123.123") + ->withDescription("JAVA-Auth-031c1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth031c2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerIpAddress("123~.123.123.123") + ->withDescription("JAVA-Auth-031c2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth032a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "E77 4QJ"; + $billingAddress->country = "United Kingdom"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "Z76 PO9"; + $shippingAddress->country = "France"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Auth-032a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth033a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "774|10"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "769|52"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Auth-033a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth033b1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "774|10"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withAddress($billingAddress) + ->withDescription("JAVA-Auth-033b1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth033b2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "769|52"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Auth-033b2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth033c1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwep4wpIwep3u111"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withAddress($billingAddress) + ->withDescription("JAVA-Auth-033c1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth033c2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwep4wpIwep3u111"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Auth-033c2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth034a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Auth-034a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth034b1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "GB"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Auth-034b1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth034b2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->country = "GB"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withAddress($billingAddress) + ->withDescription("JAVA-Auth-034b2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth034c1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->country = "3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwep4wpIwep3u111"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withAddress($billingAddress) + ->withDescription("JAVA-Auth-034c1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAuth034c2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwep4wpIwep3u111"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Auth-034c2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth035a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Auth-035a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth035b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Auth-035b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testAuth055a() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "774|10"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "769|52"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withCustomerId("12345") + ->withProductId("654321") + ->withClientTransactionId("987654") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Auth-055a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation002a() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-002a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation002b() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-002b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation002c1() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-002c1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation002c2() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-002c2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation002d() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->number = "V002625938386848"; + $card->expMonth = 12; + $card->expYear = 2020; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-002d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation002e() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-002e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation002f() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->number = " 4002 6259 3838 6848"; + $card->expMonth = 12; + $card->expYear = 2020; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-002f") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation002g() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-002g") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation002h() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->number = ""; + $card->expMonth = 12; + $card->expYear = 2020; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-002h") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation003a() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-003a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation003b() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-003b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation003c() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 20; + $card->expYear = 2012; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-003c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation003d() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2015; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-003d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation003e() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 11; + $card->expYear = 5; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-003e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation003f() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-003f") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation003g() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 20; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-003g") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation003h() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-003h") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation003i() + { + $this->markTestSkipped('Exception not thrown'); + + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-003i") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation004a() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-004a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation004b() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "1234"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-004b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation004c() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "12345"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-004c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation004d() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->number = "374101000000608"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "1234"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-004d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation004e() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->number = "374101000000608"; + $card->expMonth = 12; + $card->expYear = 2020; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-004e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation004f() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvnPresenceIndicator = 0; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-004f") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation004g() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvnPresenceIndicator = CvnPresenceIndicator::ILLEGIBLE; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-004g") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation004h() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvnPresenceIndicator = CvnPresenceIndicator::NOT_ON_CARD; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-004h") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation004i() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvnPresenceIndicator = CvnPresenceIndicator::NOT_REQUESTED; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-004i") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation005a() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2015; + $card->cvn = "1234"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-005a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation005b() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-005b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation005c() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "1234"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-005c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation005d() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2015; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-005d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation005e() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2015; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-005e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation005f() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2015; + $card->cvn = "1234"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-005f") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation005g() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2015; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-005g") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation005h() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "1234"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-005h") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation006a() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-006a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation006b() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-006b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation006c() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 11; + $card->expYear = 2015; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-006c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation006d() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 11; + $card->expYear = 5; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-006d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation006e() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "1234"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-006e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation007a() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->number = "5425230000004415"; + $card->expMonth = 12; + $card->expYear = 2020; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-007a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation007b() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->number = "5425230000004415"; + $card->expMonth = 12; + $card->expYear = 2020; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-007b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation007d() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->number = "5425230000004415"; + $card->expMonth = 11; + $card->expYear = 2015; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-007d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation007e() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->number = "5425230000004415"; + $card->expMonth = 11; + $card->expYear = 5; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-007e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation007f() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->number = "5425230000004415"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "1234"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-007f") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testValidation008b() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->number = "374101000000608"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "1234"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-008b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation008c() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->number = "374101000000608"; + $card->expMonth = 11; + $card->expYear = 2015; + $card->cvn = "1234"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-008c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation008d() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->number = "374101000000608"; + $card->expMonth = 11; + $card->expYear = 5; + $card->cvn = "1234"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-008d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation009b() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->number = "30384800000000"; + $card->expMonth = 12; + $card->expYear = 2020; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-009b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation009c() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->number = "30450100000000"; + $card->expMonth = 11; + $card->expYear = 2015; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-009c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testValidation009d() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "779|102"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "658|325"; + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->number = "30450100000000"; + $card->expMonth = 11; + $card->expYear = 5; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Validation-009d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAVS001a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->StreetAddress1 = "Flat 123 House 456"; + $billingAddress->postalCode = "E77 4QJ"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "1"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-AVS-001a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAVS001b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->StreetAddress1 = "Flat #123 House No. 456"; + $billingAddress->postalCode = "E77 #4QJ"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "2"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-AVS-001b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAVS001c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->StreetAddress1 = "# Flat #123 House No. #456"; + $billingAddress->postalCode = "# E77 @~4 Q # J"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "3"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-AVS-001c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAVS001d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "4"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-AVS-001d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAVS001e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->StreetAddress1 = "Lorem ipsum dolor sit 1amet; consectetur adipiscing elit. Aenean ali2quam tellus in elit hendrerit; non 3porttE77 4QJitor lorem venenatis. Pellentesque dictum eu nunc ac fringilla. In vitae quam eu odio sollicitudin rhoncus. Praesent ullamcorper eros vitae consequat tempus. In gravida viverra iaculis. Morbi dignissim orci et ipsum accumsan"; + $billingAddress->postalCode = "Lorem ipsum dolo1r sit amet; consectetur adipiscing elit. Aenean aliquam tellus in elit hendrerit; non porttE77 4QJitor lorem venenatis. Pellentesque dictum eu2 nunc ac fringilla. In vitae quam eu 3odio sollicitudin rhoncus. Praesent ullamcorper eros vitae consequat tempus. In gravida viverra iaculis. Morbi dignissim orci et ipsum accumsan"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "5"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-AVS-001e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAVS001f() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->StreetAddress1 = "ABCDEFGHIJ"; + $billingAddress->postalCode = "ABCDEFGHIJ"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "6"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-AVS-001f") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAVS001g() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->StreetAddress1 = "Lorem ipsum dolor sit amet; consectetur adipiscing elit. Aenean aliquam tellus in elit hendrerit; non porttE77 4QJitor lorem venenatis. Pellentesque dictum eu nunc ac fringilla. In vitae quam eu odio sollicitudin rhoncus. Praesent ullamcorper eros vitae consequat tempus. In gravida viverra iaculis. Morbi dignissim orci et ipsum accumsan"; + $billingAddress->postalCode = "Lorem ipsum dolor sit amet; consectetur adipiscing elit. Aenean aliquam tellus in elit hendrerit; non porttE77 4QJitor lorem venenatis. Pellentesque dictum eu nunc ac fringilla. In vitae quam eu odio sollicitudin rhoncus. Praesent ullamcorper eros vitae consequat tempus. In gravida viverra iaculis. Morbi dignissim orci et ipsum accumsan"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "7"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-AVS-001g") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAVS003a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->StreetAddress1 = "Flat 123 House 456"; + $billingAddress->postalCode = "E77 4QJ"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "8"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-AVS-003a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAVS003b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->StreetAddress1 = "Flat 123 House 456"; + $billingAddress->postalCode = "E77 4QJ"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "9"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-AVS-003b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAVS003c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->StreetAddress1 = "Flat 123 House 456"; + $billingAddress->postalCode = "E77 4QJ"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "10"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-AVS-003c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAVS003d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->StreetAddress1 = "Flat 123 House 456"; + $billingAddress->postalCode = "E77 4QJ"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "11"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-AVS-003d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAVS003e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->StreetAddress1 = "Flat 123 House 456"; + $billingAddress->postalCode = "E77 4QJ"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "12"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-AVS-003e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAVS003f() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->StreetAddress1 = "Flat 123 House 456"; + $billingAddress->postalCode = "E77 4QJ"; + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "13"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-AVS-003f") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAVS003g() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "14"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-AVS-003e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testAVS003h() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "15"; + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("100") + ->withProductId("999") + ->withClientTransactionId("test") + ->withCustomerIpAddress("123.123.123.123") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-AVS-003f") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettleSample() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle006a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle006b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle006c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle006d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle006e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle006f() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle006g() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle006h() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle006i() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle006k() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle007a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle007b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle007c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle007d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle007e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle008a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle008b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle008c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle008d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle008e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle009a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle009b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testSettle009c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOm"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testSettle009d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECO#"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle010c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle010d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle010e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle011a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle011b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle011c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle011d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle012a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle012b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1.005) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1.005) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testSettle012c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture() + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testSettle012d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture() + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle012e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1000) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1000) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testSettle012f() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture() + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle013a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testSettle013b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EURO") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EURO") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testSettle013c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EU#") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EU#") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle013d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle015a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle014a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle014b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle014c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle014d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle016a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle016b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle016c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-SettleAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle016d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle###") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testSettle017a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Settle") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testSettle017b() + { + $config = $this->getBaseConfig(); + $config->sharedSecret = 'secreto'; + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->authorize(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->capture(1) + ->withCurrency("EUR") + ->withDescription("SDK-JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoidSample() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid006a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid006b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid006c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid006d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid006e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid006f() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid006g() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid006h() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid006i() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid006k() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid007a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid007b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid007c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid007d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid007e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid008a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid008b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid008c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid008d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testVoid009e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "EC"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid009a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid009b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testVoid009c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOm"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testVoid009d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECO#"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid010c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid010d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid010e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid011a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid011b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid011c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid011d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid012a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid012b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid012c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid012d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid013a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid014a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid014b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid014c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("akshdfgakjdshfgjdshgfkjdsahgfjshagdfjshdagfkjdshgfjshdgfjdshgfkjhdsagfjdsgfdskjgfdsjkhgfdsjhgfkdsjgfkjdshgfkjdsahgfjdskhgfjhdsgfjkhsdgfjkhsdgfjhsdgfjhsdgfkjhgsadjfhgsakjdhgfsajdhgfkjsadgfjhsadgfjkhdsgafjhdsgfjhdsgfjhdsgfkjhdgsafjkhgsfjhsdagfkjsgdafjhsgdfjhgdskjfgdsjfhgjdskhgfjhdsgfjhdsgfkjhgdsfkjhgsdkjfgsdkjhgfkjsahgdfkjgdsajfhgdsjkgfjdshgfjkdsagfjkhdsgfjsdhgfjkdshgfkjhgdsfkjhgdskjfgdskjgfkjdsahgfjhgdsakjfgdsafjhgdsjkhgfkjdshgfakjadshgfjhdsagfjhgdsfjhgsdakjfgdsakjhgfjsdhgfjhdsgfjhdsgfkjgdsajkfhgjdshgfjdsahgfjkhdsagfjhdsgfjkgdsfjhdsgfjhgdsjfhgdsjhfgjdshgfkjdsgfkjsadgfjkgdsfkjhgdsajfkhgdsjkgfkjdsagfkjgdsakjfhgdsfjkhgdsafkjgsadkjgfdkjsahgfkjsagfkjdshgfkjshdgfjgdsfkjgsadkjhgfdsjhgfkjdsagfjhdsgfjhgdsakjfgdsakjhgfjsdahgfjkgdsfjhgdsajkhfgjhdsagfkjhsgdakjf") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid014d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("SDK#####") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid015a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testVoid015b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->void() + ->withDescription("JAVA-Void") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebateSample() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate006a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate006b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate006c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate006d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate006e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate006f() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate006g() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate006h() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate007a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate007b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate007c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate007d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate007e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate008a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate008b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate008c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate008d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate008e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate009a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testRebate009b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "EC"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testRebate009c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOm"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testRebate009d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECO#"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate010c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate010d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate010e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate011a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testRebate011b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EURO") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EURO") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testRebate011c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EU##") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EU##") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testRebate011d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate012a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate012b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1.005) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1.005) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testRebate012c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund() + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testRebate012d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund() + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate012e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100000) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(100000) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testRebate012f() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund() + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate013a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate013b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate013c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate013d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate014a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate014b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate014c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate014d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate015a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate016a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate016b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate016c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("akshdfgakjdshfgjdshgfkjdsahgfjshagdfjshdagfkjdshgfjshdgfjdshgfkjhdsagfjdsgfdskjgfdsjkhgfdsjhgfkdsjgfkjdshgfkjdsahgfjdskhgfjhdsgfjkhsdgfjkhsdgfjhsdgfjhsdgfkjhgsadjfhgsakjdhgfsajdhgfkjsadgfjhsadgfjkhdsgafjhdsgfjhdsgfjhdsgfkjhdgsafjkhgsfjhsdagfkjsgdafjhsgdfjhgdskjfgdsjfhgjdskhgfjhdsgfjhdsgfkjhgdsfkjhgsdkjfgsdkjhgfkjsahgdfkjgdsajfhgdsjkgfjdshgfjkdsagfjkhdsgfjsdhgfjkdshgfkjhgdsfkjhgdskjfgdskjgfkjdsahgfjhgdsakjfgdsafjhgdsjkhgfkjdshgfakjadshgfjhdsagfjhgdsfjhgsdakjfgdsakjhgfjsdhgfjhdsgfjhdsgfkjgdsajkfhgjdshgfjdsahgfjkhdsagfjhdsgfjkgdsfjhdsgfjhgdsjfhgdsjhfgjdshgfkjdsgfkjsadgfjkgdsfkjhgdsajfkhgdsjkgfkjdsagfkjgdsakjfhgdsfjkhgdsafkjgsadkjgfdkjsahgfkjsagfkjdshgfkjshdgfjgdsfkjgsadkjhgfdsjhgfkjdsagfjhdsgfjhgdsakjfgdsakjhgfjsdahgfjkgdsfjhgdsajkhfgjhdsagfkjhsgdakjf") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate016d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("SDK#####") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRebate017a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testRebate017b() + { + $config = $this->getBaseConfig(); + $config->sharedSecret = 'secreto'; + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(1) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Rebate") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTBSample() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB006a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB006b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB006c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB006d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB006e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB006f() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB006g() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB006h() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB006i() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB006k() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->charge(1) + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB006l() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB007a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB007b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB007c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB007d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB007e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB008a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB008b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB008c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB008d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB008e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB009a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB009b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "EC"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB009c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB009d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB010c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB010d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB010e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB012a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB012b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB012c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB012d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB012e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB013a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB013b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testOTB013c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermeloooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB013d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB014a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB014b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testOTB014c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 18; + $card->expYear = 2012; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testOTB014d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = null; + $card->expYear = null; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB015a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB015b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB015c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB016a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB017a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testOTB017b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cvn = "1234"; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testOTB017c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cvn = "1.23457E+18"; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB017d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "374101000000608"; + $card->expMonth = 12; + $card->expYear = 2019; + $card->cvn = "1234"; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testOTB017f() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cvn = "7"; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testOTB017g() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cvn = "7"; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testOTB018a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testOTB018b() + { + $config = $this->getBaseConfig(); + $config->sharedSecret = 'secreto'; + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-OTB") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCreditSample() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit006a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit006b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit006c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit006d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit006e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit006f() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit006g() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit006h() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit007a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit007b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit007c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit007d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit007e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit008a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit008b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit008c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit008d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit008e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit009a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit009b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "EC"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit009c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit009d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit010c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit010d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit010e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit011a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit012a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit012b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit012c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit013a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit013b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testCredit013c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit014a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit014b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 1813; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit014c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 18; + $card->expYear = 2012; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit014d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = null; + $card->expYear = null; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit015a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit015b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit015c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit016a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit017a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit017b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testCredit017c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cvn = "123456789"; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit017d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "374101000000608"; + $card->expMonth = 12; + $card->expYear = 2018; + $card->cvn = "1234"; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testCredit017f() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4242424242424240"; + $card->expMonth = 12; + $card->expYear = 2018; + $card->cvn = "7"; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testCredit017g() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cvn = "12#"; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit018a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit018b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit018c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit018d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit019a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit019b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit019c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit020a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testCredit020b() + { + $config = $this->getBaseConfig(); + $config->sharedSecret = 'secreto'; + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit021a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit021b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1.005) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testCredit021c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund() + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testCredit021d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund() + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit021e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(100000) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testCredit021f() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund() + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testCredit022a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EUR") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testCredit022b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EURO") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testCredit022c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withCurrency("EU#") + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testCredit022d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2018; + $card->cardHolderName = "Peter Watermelon"; + + // request + $response = $card->refund(1) + ->withDescription("JAVA-Credit") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHoldSample() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold006a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold006b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold006c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold006d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold006e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold006f() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold006g() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold006h() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold006i() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold006k() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold006l() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold007a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold007b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold007c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testHold007d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + ServicesContainer::configure($config); + + $saleResponse = Transaction::fromId(null); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testHold007e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + ServicesContainer::configure($config); + + $saleResponse = Transaction::fromId(null); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold008a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold008b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testHold008c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + ServicesContainer::configure($config); + + $saleResponse = Transaction::fromId(null); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testHold008d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + ServicesContainer::configure($config); + + $saleResponse = Transaction::fromId(null); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testHold008e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + ServicesContainer::configure($config); + + $saleResponse = Transaction::fromId(null); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold009c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testHold009d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + $saleResponse = Transaction::fromId(null); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("SDK-JAVA-Query") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testHold009e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + $saleResponse = Transaction::fromId(null); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("SDK-JAVA-Query") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold010a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold010b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testHold010c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + $saleResponse = Transaction::fromId(null); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold010d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold011a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold011b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(null) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold011c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold011d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(null) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold012a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testHold012b() + { + $config = $this->getBaseConfig(); + $config->sharedSecret = 'secreto'; + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("SDK-JAVA-Query") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testHold013a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testHold013b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "EC"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("SDK-JAVA-Query") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testHold013c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOOOOOOOOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("SDK-JAVA-Query") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testReleaseSample() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // hold it first + $holdResponse = $saleResponse->hold() + ->withReasonCode(ReasonCode::OUT_OF_STOCK) + ->execute(); + $this->assertNotNull($holdResponse); + $this->assertEquals("00", $holdResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease006a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // hold it first + $holdResponse = $saleResponse->hold() + ->withReasonCode(ReasonCode::OUT_OF_STOCK) + ->execute(); + $this->assertNotNull($holdResponse); + $this->assertEquals("00", $holdResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease006b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // hold it first + $holdResponse = $saleResponse->hold() + ->withReasonCode(ReasonCode::OUT_OF_STOCK) + ->execute(); + $this->assertNotNull($holdResponse); + $this->assertEquals("00", $holdResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease006c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // hold it first + $holdResponse = $saleResponse->hold() + ->withReasonCode(ReasonCode::OUT_OF_STOCK) + ->execute(); + $this->assertNotNull($holdResponse); + $this->assertEquals("00", $holdResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease006d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // hold it first + $holdResponse = $saleResponse->hold() + ->withReasonCode(ReasonCode::OUT_OF_STOCK) + ->execute(); + $this->assertNotNull($holdResponse); + $this->assertEquals("00", $holdResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease006e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // hold it first + $holdResponse = $saleResponse->hold() + ->withReasonCode(ReasonCode::OUT_OF_STOCK) + ->execute(); + $this->assertNotNull($holdResponse); + $this->assertEquals("00", $holdResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease006f() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // hold it first + $holdResponse = $saleResponse->hold() + ->withReasonCode(ReasonCode::OUT_OF_STOCK) + ->execute(); + $this->assertNotNull($holdResponse); + $this->assertEquals("00", $holdResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease006g() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // hold it first + $holdResponse = $saleResponse->hold() + ->withReasonCode(ReasonCode::OUT_OF_STOCK) + ->execute(); + $this->assertNotNull($holdResponse); + $this->assertEquals("00", $holdResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease006h() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // hold it first + $holdResponse = $saleResponse->hold() + ->withReasonCode(ReasonCode::OUT_OF_STOCK) + ->execute(); + $this->assertNotNull($holdResponse); + $this->assertEquals("00", $holdResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease006i() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // hold it first + $holdResponse = $saleResponse->hold() + ->withReasonCode(ReasonCode::OUT_OF_STOCK) + ->execute(); + $this->assertNotNull($holdResponse); + $this->assertEquals("00", $holdResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease006k() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // hold it first + $holdResponse = $saleResponse->hold() + ->withReasonCode(ReasonCode::OUT_OF_STOCK) + ->execute(); + $this->assertNotNull($holdResponse); + $this->assertEquals("00", $holdResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease006l() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // hold it first + $holdResponse = $saleResponse->hold() + ->withReasonCode(ReasonCode::OUT_OF_STOCK) + ->execute(); + $this->assertNotNull($holdResponse); + $this->assertEquals("00", $holdResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease007a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // hold it first + $holdResponse = $saleResponse->hold() + ->withReasonCode(ReasonCode::OUT_OF_STOCK) + ->execute(); + $this->assertNotNull($holdResponse); + $this->assertEquals("00", $holdResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease007b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // hold it first + $holdResponse = $saleResponse->hold() + ->withReasonCode(ReasonCode::OUT_OF_STOCK) + ->execute(); + $this->assertNotNull($holdResponse); + $this->assertEquals("00", $holdResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease007c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // hold it first + $holdResponse = $saleResponse->hold() + ->withReasonCode(ReasonCode::OUT_OF_STOCK) + ->execute(); + $this->assertNotNull($holdResponse); + $this->assertEquals("00", $holdResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testRelease007d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + ServicesContainer::configure($config); + + $saleResponse = Transaction::fromId(null); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testRelease007e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + ServicesContainer::configure($config); + + $saleResponse = Transaction::fromId(null); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testRelease008c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + ServicesContainer::configure($config); + + $saleResponse = Transaction::fromId(null); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testRelease008d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + ServicesContainer::configure($config); + + $saleResponse = Transaction::fromId(null); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testRelease008e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + ServicesContainer::configure($config); + + $saleResponse = Transaction::fromId(null); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testRelease009d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + $saleResponse = Transaction::fromId(null); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->withDescription("JAVA-Query") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testRelease009e() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + $saleResponse = Transaction::fromId(null); + + // request + $response = $saleResponse->release() + ->withReasonCode(ReasonCode::IN_STOCK) + ->withDescription("JAVA-Query") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease010a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::OTHER) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease010b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testRelease010c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + $saleResponse = Transaction::fromId(null); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::FRAUD) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease010d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::OTHER) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease011a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::OTHER) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease011b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(null) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease011c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease011d() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(null) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease012a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::OTHER) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testRelease012b() + { + $config = $this->getBaseConfig(); + $config->sharedSecret = 'secreto'; + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::OTHER) + ->withDescription("JAVA-Query") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testRelease013a() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::OTHER) + ->withDescription("JAVA-Hold") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testRelease013b() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "EC"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::OTHER) + ->withDescription("JAVA-Query") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testRelease013c() + { + $config = $this->getBaseConfig(); + $config->timeout = 5000; + $config->channel = "ECOOOOOOOOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $saleResponse->hold() + ->withReasonCode(ReasonCode::OTHER) + ->withDescription("JAVA-Query") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual006a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-006a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual006b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-006b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual006c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-006c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual006d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-006d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual006e() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-006e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual006f() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-006f") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual006g() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-006g") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual006h() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-006h") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual006i() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-006i") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual006j() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-006j") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual006k() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-006k") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual007a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-007a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual007b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-007b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual007c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-007c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual007d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-007d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual007e() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-007e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual008a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-008a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual008b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-008b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual008c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-008c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual008d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-008d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual008e() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-008e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual009a() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOM"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-009a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testManual009b() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "E"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-009b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testManual009c() + { + $config = $this->getBaseConfig(); + $config->timeout = 20000; + $config->channel = "ECOMMERCE"; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-009c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual009d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-009d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual010a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-010a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual010b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-010b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual010c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-010c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual010d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-010d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual010e() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-010e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual011a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-011a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual011b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-011b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual011c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-011c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testManual011d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(10) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge() + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-011d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual012a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-012a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testManual012b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EURO") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EURO") + ->withDescription("JAVA-Manual-012b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testManual012c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("�UR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("�UR") + ->withDescription("JAVA-Manual-012c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testManual012d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // request + $response = $card->charge(100.01) + ->withDescription("JAVA-Manual-012d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual013a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-013a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual013b1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-013b1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual013b2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-013b2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual013c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-013c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual014a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-014a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual014b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-014b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testManual014c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cardHolderName = "3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep"; + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-014c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual014d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cardHolderName = "James~Mason"; + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-014d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual015a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-015a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual015b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-015b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testManual015c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 20; + $card->expYear = 2012; + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-015c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testManual015d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = null; + $card->expYear = null; + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-015d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual016a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-016a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual016b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-016b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual016c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-016c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual017a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-017a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual018a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-018a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual019a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-019a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testManual019b1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "1234"; + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->ResponseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-019b1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->ResponseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testManual019b2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "374101000000608"; + $card->expMonth = 12; + $card->expYear = 2020; + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->ResponseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-019b2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->ResponseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testManual019c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "12345"; + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->ResponseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-019c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->ResponseCode); + } + + public function testManual019d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "374101000000608"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "1234"; + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-019d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual020a1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-020a1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual020a2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = ""; + $card->cvnPresenceIndicator = CvnPresenceIndicator::ILLEGIBLE; + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-020a2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual020a3() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = ""; + $card->cvnPresenceIndicator = CvnPresenceIndicator::NOT_ON_CARD; + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-020a3") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual020a4() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = ""; + $card->cvnPresenceIndicator = CvnPresenceIndicator::NOT_REQUESTED; + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-020a4") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual020b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvnPresenceIndicator = 5; + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-020b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual020c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = 0; + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-020c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual021a1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-021a1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual021a2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->Authorize(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-021a2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual021a3() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->Authorize(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-021a3") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual021b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->Authorize(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-021b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual021c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->Authorize(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-021c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual022a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-022a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual022b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-022b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual022c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-022c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual022d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-022d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual022e() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-022e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual023a1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-023a1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual023a2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-023a2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual023b1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-023b1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual023c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-023c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual024a1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-024a1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual024a2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-024a2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual024a3() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-024a3") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual024b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-024b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual024c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-024c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual025() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-025") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual026a1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-026a1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual026a2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual026b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual026c1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIep3uviSnW9XEB3a4wpIW9XEB3a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual026c2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-026c2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual027a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withCustomerId("123456") + ->withDescription("JAVA-Manual-027a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual028a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("123456") + ->withDescription("JAVA-Manual-028a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual028b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-028b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testManual028c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withCustomerId("3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep33a4wpQQQQQQQQQ1") + ->withDescription("JAVA-Manual-028c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testManual028d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerId("123456~") + ->withDescription("JAVA-Manual-028d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual029a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withProductId("123456") + ->withDescription("JAVA-Manual-029a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual029b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withDescription("JAVA-Manual-029b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testManual029c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withProductId("3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep33a4wpQQQQQQQQQ1") + ->withDescription("JAVA-Manual-029c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testManual029d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withProductId("123456~") + ->withDescription("JAVA-Manual-029d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual030a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withClientTransactionId("123456") + ->withDescription("JAVA-Manual-030a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual030b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-030b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testManual030c() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withClientTransactionId("3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep33a4wpQQQQQQQQQ1") + ->withDescription("JAVA-Manual-030c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testManual030d() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withClientTransactionId("123456~") + ->withDescription("JAVA-Manual-030d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual031a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerIpAddress("123.123.123.123") + ->withDescription("JAVA-Manual-031a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual031b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-031b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual031c1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withCustomerIpAddress("1234.123.123.123") + ->withDescription("JAVA-Manual-031c1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual031c2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withCustomerIpAddress("123~.123.123.123") + ->withDescription("JAVA-Manual-031c2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual032a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "E77 4QJ"; + $billingAddress->country = "United Kingdom"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "Z76 PO9"; + $shippingAddress->country = "France"; + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Manual-032a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual033a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "774|10"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "769|52"; + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Manual-033a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual033b1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "774|10"; + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withAddress($billingAddress) + ->withDescription("JAVA-Manual-033b1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual033b2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "769|52"; + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Manual-033b2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual033c1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwep4wpIwep3u111"; + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withAddress($billingAddress) + ->withDescription("JAVA-Manual-033c1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual033c2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwep4wpIwep3u111"; + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Manual-033c2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual034a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->country = "GB"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "FR"; + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withAddress($billingAddress) + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Manual-034a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual034b1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "GB"; + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Manual-034b1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual034b2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->country = "GB"; + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withAddress($billingAddress) + ->withDescription("JAVA-Manual-034b2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual034c1() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // billing address + $billingAddress = new Address(); + $billingAddress->country = "3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwep4wpIwep3u111"; + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withAddress($billingAddress) + ->withDescription("JAVA-Manual-034c1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual034c2() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->country = "3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwep4wpIwep3u111"; + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("USD") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("USD") + ->withAddress($shippingAddress, AddressType::SHIPPING) + ->withDescription("JAVA-Manual-034c2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual035a() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("GBP") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("GBP") + ->withDescription("JAVA-Manual-035a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testManual035b() + { + $config = $this->getBaseConfig(); + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + + // build transaction + $saleResponse = $card->charge(100.01) + ->withCurrency("EUR") + ->execute(); + $this->assertNotNull($saleResponse); + $this->assertEquals("00", $saleResponse->responseCode); + $this->tearDown(); + + // request + $response = $card->charge(100.01) + ->withCurrency("EUR") + ->withDescription("JAVA-Manual-035a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled014a() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001038443335"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-014a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled014b() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001038488884"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-014b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled014c() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001036298889"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-014c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled014d() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001036853337"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-014d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled014e() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-014e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled014f() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037167778"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-014f") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled014g() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-014g") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled014h() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037484447"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-014h") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled014i() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037490006"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-014i") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testverifyenrolled015a() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "5100000000000198�"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-015a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled015b() + { + $this->markTestSkipped(); + + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "5100000000000149"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-015b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled015c() + { + $this->markTestSkipped(); + + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "5100000000000172"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-015c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled015d() + { + $this->markTestSkipped(); + + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "5100000000000297"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-015d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled015e() + { + $this->markTestSkipped(); + + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "5100000000000131"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-015e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled015f() + { + $this->markTestSkipped(); + + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "5100000000000206"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-015f") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled015g() + { + $this->markTestSkipped(); + + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "5100000000000131"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-015g") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled015h() + { + $this->markTestSkipped(); + + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "5100000000000214"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-015h") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled015i() + { + $this->markTestSkipped(); + + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "5100000000000164"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-015i") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testverifyenrolled016a() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "370537726695896�"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "1234"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-016a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled016b() + { + $this->markTestSkipped(); + + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "344598846104303"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "1234"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-016b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled016c() + { + $this->markTestSkipped(); + + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "342911579886552"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "1234"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-016c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled016d() + { + $this->markTestSkipped(); + + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "377775599797356"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "1234"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-016d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled016e() + { + $this->markTestSkipped(); + + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "371810438025523"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "1234"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-016e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled016f() + { + $this->markTestSkipped(); + + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "374973180958759"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "1234"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-016f") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled016g() + { + $this->markTestSkipped(); + + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "371810438025523"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "1234"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-016g") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled016h() + { + $this->markTestSkipped(); + + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "376515222233960"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "1234"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-016h") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled016i() + { + $this->markTestSkipped(); + + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "372749236937027"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = "1234"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-016i") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled017a() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-017a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled017b() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-017b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled017c() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("USD") + ->withDescription("JAVA-verifyenrolled-017c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled017d() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-017d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled017e() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-017e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled017f() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("USD") + ->withDescription("JAVA-verifyenrolled-017f") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled017g() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-017g") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled017h() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-017h") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled017i() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("USD") + ->withDescription("JAVA-verifyenrolled-017i") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled017j() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-017j") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled017k() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-017k") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled018a() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-018a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled018b() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-018b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled018c() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("USD") + ->withDescription("JAVA-verifyenrolled-018c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled018d() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-018d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled018e() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-018e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled019a() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("USD") + ->withDescription("JAVA-verifyenrolled-019a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled019b() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-019b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled019c() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-019c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled019d() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("USD") + ->withDescription("JAVA-verifyenrolled-019d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled019e() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-019e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled020b() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-020b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled020c() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-020c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled020d() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("USD") + ->withDescription("JAVA-verifyenrolled-020d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled020e() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-020e") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled021a() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-021a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled021b() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("USD") + ->withDescription("JAVA-verifyenrolled-021b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled021c() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-021c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled021d() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-021d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled022a() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("USD") + ->withDescription("JAVA-verifyenrolled-022a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled022b() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EURO") + ->withDescription("JAVA-verifyenrolled-022b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled022c() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("�UR") + ->withDescription("JAVA-verifyenrolled-022c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled022d() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withDescription("JAVA-verifyenrolled-022d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled023a() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-023a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled023b1() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-023b1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testverifyenrolled023b2() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "42424242424"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("USD") + ->withDescription("JAVA-verifyenrolled-023b2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testverifyenrolled023c() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4263970000005262#"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-023c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled024a() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->CvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-024a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testverifyenrolled024b() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("USD") + ->withDescription("JAVA-verifyenrolled-024b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testverifyenrolled024c() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + $card->cardHolderName = "3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep3a4wpIwep3uviSnW9XEB3a4wpIwep3uviSnW9XEB3a4wpIwepeep"; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-024c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled024d() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + $card->cardHolderName = "James~Mason"; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-024d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled025a() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("USD") + ->withDescription("JAVA-verifyenrolled-025a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled025b() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-025b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testverifyenrolled025c() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 20; + $card->expYear = 2012; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-025c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testverifyenrolled025d() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("USD") + ->withDescription("JAVA-verifyenrolled-025d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled026a() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-026a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled026b() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-026b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled026c() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("USD") + ->withDescription("JAVA-verifyenrolled-026c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled027a() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-027a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled028a() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-028a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled029a() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("USD") + ->withDescription("JAVA-verifyenrolled-029a") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testverifyenrolled029b1() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "1234"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-029b1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testverifyenrolled029b2() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "371810438025523"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-029b2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testverifyenrolled029c() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "12345"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-029c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled029d() + { + $this->markTestSkipped(); + + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "371810438025523"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "1234"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("USD") + ->withDescription("JAVA-verifyenrolled-029d") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled030a1() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = CvnPresenceIndicator::PRESENT; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-030a1") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled030a2() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = ""; + $card->cvnPresenceIndicator = CvnPresenceIndicator::ILLEGIBLE; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-030a2") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled030a3() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = ""; + $card->cvnPresenceIndicator = CvnPresenceIndicator::NOT_ON_CARD; + + // request + $response = $card->verify() + ->withCurrency("USD") + ->withDescription("JAVA-verifyenrolled-030a3") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled030a4() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = ""; + $card->cvnPresenceIndicator = CvnPresenceIndicator::NOT_REQUESTED; + + // request + $response = $card->verify() + ->withCurrency("GBP") + ->withDescription("JAVA-verifyenrolled-030a4") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testverifyenrolled030b() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = 5; + + // request + $response = $card->verify() + ->withCurrency("EUR") + ->withDescription("JAVA-verifyenrolled-030b") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + public function testverifyenrolled030c() + { + $config = $this->getBaseConfig(); + $config->timeout = 60000; + ServicesContainer::configure($config); + + // create card + $card = $this->getBaseCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 12; + $card->expYear = 2020; + $card->cvn = "123"; + $card->cvnPresenceIndicator = 0; + + // request + $response = $card->verify() + ->withCurrency("USD") + ->withDescription("JAVA-verifyenrolled-030c") + ->execute(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/CreditTest.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/CreditTest.php new file mode 100644 index 0000000..4102ced --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/CreditTest.php @@ -0,0 +1,285 @@ +number = '4111111111111111'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '123'; + $card->cardHolderName = 'Joe Smith'; + $this->card = $card; + + ServicesContainer::configure($this->getConfig()); + } + + public function testCreditAuthorization() + { + $authorization = $this->card->authorize(14) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($authorization); + $this->assertEquals('00', $authorization->responseCode); + + $capture = $authorization->capture(16) + ->withGratuity(2) + ->execute(); + $this->assertNotNull($capture); + $this->assertEquals('00', $capture->responseCode); + } + + public function testCreditServiceAuth() + { + $service = new CreditService( + $this->getConfig() + ); + + $authorization = $service->authorize(15) + ->withCurrency('USD') + ->withPaymentMethod($this->card) + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($authorization); + $this->assertEquals('00', $authorization->responseCode); + + $capture = $service->capture($authorization->transactionReference) + ->withAmount(17) + ->withGratuity(2) + ->execute(); + $this->assertNotNull($capture); + $this->assertEquals('00', $capture->responseCode); + } + + public function testCreditSale() + { + $response = $this->card->charge(15) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCreditRefund() + { + $response = $this->card->refund(16) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCreditRebate() + { + $response = $this->card->charge(17) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode, $response->responseMessage); + + $rebate = $response->refund(17) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($rebate); + $this->assertEquals('00', $rebate->responseCode, $rebate->responseMessage); + } + + public function testCreditVoid() + { + $response = $this->card->charge(15) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode, $response->responseMessage); + + $voidResponse = $response->void()->execute(); + $this->assertNotNull($voidResponse); + $this->assertEquals('00', $voidResponse->responseCode, $voidResponse->responseMessage); + } + + public function testCreditVerify() + { + $response = $this->card->verify() + ->withAllowDuplicates(true) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + protected function getConfig() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'api'; + $config->sharedSecret = 'secret'; + $config->rebatePassword = 'rebate'; + $config->refundPassword = 'refund'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + return $config; + } + + protected function dccSetup() + { + $config = new ServicesConfig(); + $config->merchantId = "heartlandgpsandbox"; + $config->accountId = "apidcc"; + $config->refundPassword = "refund"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"; + + ServicesContainer::configure($config); + } + + public function testCreditGetDccInfo() + { + $this->dccSetup(); + + $this->card->number = '4002933640008365'; + $orderId = GenerationUtils::generateOrderId(); + + $dccDetails = $this->card->getDccRate(DccRateType::SALE, 10, 'USD', DccProcessor::FEXCO, $orderId); + + $this->assertNotNull($dccDetails); + $this->assertEquals('00', $dccDetails->responseCode, $dccDetails->responseMessage); + $this->assertNotNull($dccDetails->dccResponseResult); + } + + public function testCreditDccRateAuthorize() + { + $this->dccSetup(); + + $this->card->number = '4006097467207025'; + $orderId = GenerationUtils::generateOrderId(); + + $dccDetails = $this->card->getDccRate(DccRateType::SALE, 1001, 'EUR', DccProcessor::FEXCO, $orderId); + + $this->assertNotNull($dccDetails); + $this->assertEquals('00', $dccDetails->responseCode, $dccDetails->responseMessage); + $this->assertNotNull($dccDetails->dccResponseResult); + + //set Currency conversion rates + $dccValues = new DccRateData(); + $dccValues->orderId = $dccDetails->transactionReference->orderId; + $dccValues->dccProcessor = DccProcessor::FEXCO; + $dccValues->dccType = 1; + $dccValues->dccRateType = DccRateType::SALE; + $dccValues->currency = $dccDetails->dccResponseResult->cardHolderCurrency; + $dccValues->dccRate = $dccDetails->dccResponseResult->cardHolderRate; + $dccValues->amount = $dccDetails->dccResponseResult->cardHolderAmount; + + $response = $this->card->authorize(1001) + ->withCurrency('EUR') + ->withAllowDuplicates(true) + ->withDccRateData($dccValues) + ->withOrderId($orderId) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode, $response->responseMessage); + } + + public function testCreditDccRateCharge() + { + $this->dccSetup(); + + $this->card->number = '4006097467207025'; + $orderId = GenerationUtils::generateOrderId(); + + $dccDetails = $this->card->getDccRate(DccRateType::SALE, 1001, 'EUR', DccProcessor::FEXCO, $orderId); + + $this->assertNotNull($dccDetails); + $this->assertEquals('00', $dccDetails->responseCode, $dccDetails->responseMessage); + $this->assertNotNull($dccDetails->dccResponseResult); + + //set Currency conversion rates + $dccValues = new DccRateData(); + $dccValues->orderId = $dccDetails->transactionReference->orderId; + $dccValues->dccProcessor = DccProcessor::FEXCO; + $dccValues->dccType = 1; + $dccValues->dccRateType = DccRateType::SALE; + $dccValues->currency = $dccDetails->dccResponseResult->cardHolderCurrency; + $dccValues->dccRate = $dccDetails->dccResponseResult->cardHolderRate; + $dccValues->amount = $dccDetails->dccResponseResult->cardHolderAmount; + + $response = $this->card->charge(1001) + ->withCurrency('EUR') + ->withAllowDuplicates(true) + ->withDccRateData($dccValues) + ->withOrderId($orderId) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode, $response->responseMessage); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + * @expectedExceptionMessage Unexpected Gateway Response: 105 - Cannot find DCC information for that card + */ + public function testCreditDccInfoNotFound() + { + $this->dccSetup(); + + $this->card->number = '4002933640008365'; + $orderId = GenerationUtils::generateOrderId(); + + $dccDetails = $this->card->getDccRate(DccRateType::SALE, 10, 'EUR', DccProcessor::FEXCO, $orderId); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + * @expectedExceptionMessage Unexpected Gateway Response: 508 - Incorrect DCC information - doesn't correspond to dccrate request + */ + public function testCreditDccInfoMismatch() + { + $this->dccSetup(); + + $this->card->number = '4006097467207025'; + $orderId = GenerationUtils::generateOrderId(); + + $dccDetails = $this->card->getDccRate(DccRateType::SALE, 1001, 'EUR', DccProcessor::FEXCO, $orderId); + + $this->assertNotNull($dccDetails); + $this->assertEquals('00', $dccDetails->responseCode, $dccDetails->responseMessage); + $this->assertNotNull($dccDetails->dccResponseResult); + + $dccValues = new DccRateData(); + $dccValues->orderId = $dccDetails->transactionReference->orderId; + $dccValues->dccProcessor = DccProcessor::FEXCO; + $dccValues->dccType = 1; + $dccValues->dccRateType = DccRateType::SALE; + $dccValues->currency = $dccDetails->dccResponseResult->cardHolderCurrency; + $dccValues->dccRate = $dccDetails->dccResponseResult->cardHolderRate; + $dccValues->amount = $dccDetails->dccResponseResult->cardHolderAmount; + + $response = $this->card->authorize(100) + ->withCurrency('EUR') + ->withAllowDuplicates(true) + ->withDccRateData($dccValues) + ->withOrderId($orderId) + ->execute(); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/Hpp/RealexHppClient.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/Hpp/RealexHppClient.php new file mode 100644 index 0000000..dc7bfd1 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/Hpp/RealexHppClient.php @@ -0,0 +1,249 @@ +sharedSecret = $sharedSecret; + } + + public function sendRequest($jsonData, $hppVersion = '') + { + $this->paymentData = GenerationUtils::decodeJson($jsonData, true, $hppVersion); + + $timestamp = $this->getValue('TIMESTAMP'); + $merchantId = $this->getValue('MERCHANT_ID'); + $account = $this->getValue('ACCOUNT'); + $orderId = $this->getValue('ORDER_ID'); + $amount = $this->getValue('AMOUNT'); + $currency = $this->getValue('CURRENCY'); + $autoSettle = $this->getValue('AUTO_SETTLE_FLAG'); + $requestHash = $this->getValue('SHA1HASH'); + $shippingCode = $this->getValue('SHIPPING_CODE'); + $shippingCountry = $this->getValue('SHIPPING_CO'); + $billingCode = $this->getValue('BILLING_CODE'); + $billingCountry = $this->getValue('BILLING_CO'); + + $config = new ServicesConfig(); + $config->merchantId = $merchantId; + $config->accountId = $account; + $config->sharedSecret = $this->sharedSecret; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + $config->hostedPaymentConfig = new HostedPaymentConfig(); + $config->hostedPaymentConfig->language = "GB"; + $config->hostedPaymentConfig->responseUrl = "http://requestb.in/10q2bjb1"; + $config->hostedPaymentConfig->version = $hppVersion; + + ServicesContainer::configure($config); + + // create the card object + $card = new CreditCardData(); + $card->number = '4006097467207025'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '131'; + $card->cardHolderName = 'James Mason'; + + // // check hash + $hashParam = [ + $timestamp, + $merchantId, + $orderId, + $amount, + $currency + ]; + + //for stored card + + if (!empty($this->paymentData['OFFER_SAVE_CARD'])) { + $hashParam[] = (!empty($this->paymentData['PAYER_REF'])) ? + $this->paymentData['PAYER_REF'] : null; + $hashParam[] = (!empty($this->paymentData['PMT_REF'])) ? + $this->paymentData['PMT_REF'] : null; + } + + $newHash = GenerationUtils::generateHash( + $this->sharedSecret, + implode('.', $hashParam) + ); + if ($newHash != $requestHash) { + throw new ApiException("Incorrect hash. Please check your code and the Developers Documentation."); + } + + // build request + if ($amount == null) { + $validate = $this->getValue("VALIDATE_CARD_ONLY"); + if ($validate) { + $gatewayRequest = $card->verify(); + } else { + $gatewayRequest = $card->verify()->WithRequestMultiUseToken(true); + } + } else { + $amount = $amount / 100; + if ($autoSettle) { + $gatewayRequest = $card->charge($amount); + } else { + $gatewayRequest = $card->authorize($amount); + } + } + + try { + $gatewayRequest + ->WithCurrency($currency) + ->WithOrderId($orderId) + ->withTimeStamp($timestamp); + + $this->addAddressDetails($gatewayRequest, $billingCode, $billingCountry, AddressType::BILLING); + $this->addAddressDetails($gatewayRequest, $shippingCode, $shippingCountry, AddressType::SHIPPING); + + //handle DCC + $this->addDCCInfo($gatewayRequest, $orderId); + + //handle fraud management + $this->addFraudManagementInfo($gatewayRequest, $orderId); + + $gatewayResponse = $gatewayRequest->execute(); + + if ($gatewayResponse->responseCode === '00') { + return $this->convertResponse($gatewayResponse); + } + } catch (ApiException $exc) { + throw $exc; + } + return null; + } + + public function getValue($value) + { + if (isset($this->paymentData[$value])) { + return $this->paymentData[$value]; + } + return null; + } + + public function addDCCInfo($gatewayRequest, $orderId) + { + if (!empty($this->paymentData['DCC_ENABLE'])) { + $dccInfo = $this->getValue('DCC_INFO'); + + $dccValues = new DccRateData(); + $dccValues->orderId = $orderId; + $dccValues->dccProcessor = $dccInfo['CCP']; + $dccValues->dccType = $dccInfo['TYPE']; + $dccValues->dccRateType = $dccInfo['RATE_TYPE']; + $dccValues->currency = $dccInfo['CURRENCY']; + $dccValues->dccRate = $dccInfo['RATE']; + $dccValues->amount = $dccInfo['AMOUNT']; + + $gatewayRequest + ->withDccRateData($dccValues); + } + } + + public function addFraudManagementInfo($gatewayRequest, $orderId) + { + if (!empty($this->paymentData['HPP_FRAUD_FILTER_MODE'])) { + $tssInfo = $this->getValue('TSS_INFO'); + + $this->addAddressDetails( + $gatewayRequest, + $tssInfo['BILLING_ADDRESS']['CODE'], + $tssInfo['BILLING_ADDRESS']['COUNTRY'], + AddressType::BILLING + ); + + $this->addAddressDetails( + $gatewayRequest, + $tssInfo['SHIPPING_ADDRESS']['CODE'], + $tssInfo['SHIPPING_ADDRESS']['COUNTRY'], + AddressType::SHIPPING + ); + + $gatewayRequest + ->withProductId($tssInfo['PRODID']) // prodid + ->withClientTransactionId($tssInfo['VARREF']) // varref + ->withCustomerId($tssInfo['CUSTNUM']) // custnum + ->withCustomerIpAddress($tssInfo['CUSTIPADDRESS']) + ->withFraudFilter($this->paymentData['HPP_FRAUD_FILTER_MODE']); + } + } + + public function addAddressDetails($gatewayRequest, $code, $country, $addressType = AddressType::BILLING) + { + if ($code != null || $country != null) { + $address = new Address(); + $address->postalCode = $code; + $address->country = $country; + + $gatewayRequest + ->WithAddress($address, $addressType); + } + } + + public function convertResponse($gatewayResponse) + { + $merchantId = $this->paymentData['MERCHANT_ID']; + $account = $this->paymentData['ACCOUNT']; + + $newHash = GenerationUtils::generateHash( + $this->sharedSecret, + implode('.', [ + $gatewayResponse->timestamp, + $merchantId, + $gatewayResponse->transactionReference->orderId, + $gatewayResponse->responseCode, + $gatewayResponse->responseMessage, + $gatewayResponse->transactionReference->transactionId, + $gatewayResponse->transactionReference->authCode + ]) + ); + + // begin building response + $response = [ + 'MERCHANT_ID' => $merchantId, + 'ACCOUNT' => $this->getValue('ACCOUNT'), + 'ORDER_ID' => $gatewayResponse->transactionReference->orderId, + 'TIMESTAMP' => $gatewayResponse->timestamp, + 'RESULT' => $gatewayResponse->responseCode, + 'PASREF' => $gatewayResponse->transactionReference->transactionId, + 'AUTHCODE' => $gatewayResponse->transactionReference->authCode, + 'AVSPOSTCODERESULT' => $gatewayResponse->avsResponseCode, + 'CVNRESULT' => $gatewayResponse->cvnResponseCode, + 'HPP_LANG' => $this->getValue('HPP_LANG'), + 'SHIPPING_CODE' => $this->getValue('SHIPPING_CODE'), + 'SHIPPING_CO' => $this->getValue('SHIPPING_CO'), + 'BILLING_CODE' => $this->getValue('BILLING_CODE'), + 'BILLING_CO' => $this->getValue('BILLING_CO'), + 'ECI' => $this->getValue('ECI'), + 'CAVV' => $this->getValue('CAVV'), + 'XID' => $this->getValue('XID'), + 'MERCHANT_RESPONSE_URL' => $this->getValue('MERCHANT_RESPONSE_URL'), + 'CARD_PAYMENT_BUTTON' => $this->getValue('CARD_PAYMENT_BUTTON'), + 'MESSAGE' => $gatewayResponse->responseMessage, + 'AMOUNT' => $this->getValue('AMOUNT'), + 'SHA1HASH' => $newHash, + 'DCC_INFO_REQUST' => $this->getValue('DCC_INFO'), + 'DCC_INFO_RESPONSE' => $gatewayResponse->dccResponseResult, + 'HPP_FRAUD_FILTER_MODE' => $this->getValue('HPP_FRAUD_FILTER_MODE'), + 'TSS_INFO' => $this->getValue('TSS_INFO') + ]; + + return json_encode($response); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/HppTest.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/HppTest.php new file mode 100644 index 0000000..66dace3 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/HppTest.php @@ -0,0 +1,654 @@ +merchantId = "heartlandgpsandbox"; + $config->accountId = "hpp"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"; + $config->hostedPaymentConfig = new HostedPaymentConfig(); + $config->hostedPaymentConfig->language = "GB"; + $config->hostedPaymentConfig->responseUrl = "http://requestb.in/10q2bjb1"; + + return new HostedService($config); + } + + public function testCreditAuth() + { + $config = new ServicesConfig(); + $config->merchantId = "heartlandgpsandbox"; + $config->accountId = "hpp"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"; + $config->hostedPaymentConfig = new HostedPaymentConfig(); + $config->hostedPaymentConfig->language = "GB"; + $config->hostedPaymentConfig->responseUrl = "http://requestb.in/10q2bjb1"; + + $client = new RealexHppClient("secret"); + + $address = new Address(); + $address->postalCode = "123|56"; + $address->country = "IRELAND"; + + //run test cases for different version + foreach ($this->hppVersionList as $hppVersion) { + $config->hostedPaymentConfig->version = $hppVersion; + $service = new HostedService($config); + + $json = $service->authorize(1) + ->withCurrency("EUR") + ->withCustomerId("123456") + ->withAddress($address) + ->serialize(); + + $this->assertNotNull($json); + + $response = $client->sendRequest($json, $hppVersion); + $this->assertNotNull($response); + + $parsedResponse = $service->parseResponse($response); + $this->assertEquals("00", $parsedResponse->responseCode); + } + } + + public function testCreditSale() + { + $config = new ServicesConfig(); + $config->merchantId = "heartlandgpsandbox"; + $config->accountId = "hpp"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"; + $config->hostedPaymentConfig = new HostedPaymentConfig(); + $config->hostedPaymentConfig->language = "GB"; + $config->hostedPaymentConfig->responseUrl = "http://requestb.in/10q2bjb1"; + + $client = new RealexHppClient("secret"); + + $address = new Address(); + $address->postalCode = "123|56"; + $address->country = "IRELAND"; + + //run test cases for different version + foreach ($this->hppVersionList as $hppVersion) { + $config->hostedPaymentConfig->version = $hppVersion; + $service = new HostedService($config); + + $json = $service->charge(1) + ->withCurrency("EUR") + ->withCustomerId("123456") + ->withAddress($address) + ->serialize(); + $this->assertNotNull($json); + + $response = $client->sendRequest($json, $hppVersion); + $this->assertNotNull($response); + + $parsedResponse = $service->parseResponse($response); + + $this->assertNotNull($parsedResponse); + $this->assertEquals("00", $parsedResponse->responseCode); + } + } + + /* 03. ProcessPaymentOtbRequest */ + + public function testCreditVerify() + { + $config = new ServicesConfig(); + $config->merchantId = "heartlandgpsandbox"; + $config->accountId = "hpp"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"; + $config->hostedPaymentConfig = new HostedPaymentConfig(); + $config->hostedPaymentConfig->language = "GB"; + $config->hostedPaymentConfig->responseUrl = "http://requestb.in/10q2bjb1"; + + $client = new RealexHppClient("secret"); + + $address = new Address(); + $address->postalCode = "123|56"; + $address->country = "IRELAND"; + + //run test cases for different version + foreach ($this->hppVersionList as $hppVersion) { + $config->hostedPaymentConfig->version = $hppVersion; + $service = new HostedService($config); + + $json = $service->verify() + ->withCurrency("EUR") + ->withCustomerId("123456") + ->withAddress($address) + ->serialize(); + $this->assertNotNull($json); + + $response = $client->sendRequest($json, $hppVersion); + $this->assertNotNull($response); + + $parsedResponse = $service->parseResponse($response); + $this->assertNotNull($parsedResponse); + $this->assertEquals("00", $parsedResponse->responseCode); + } + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testAuthNoAmount() + { + $service = $this->basicSetup(); + $service->authorize(null)->withCurrency("USD")->serialize(); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testAuthNoCurrency() + { + $service = $this->basicSetup(); + $service->authorize(10)->serialize(); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testSaleNoAmount() + { + $service = $this->basicSetup(); + $service->charge(null)->withCurrency("USD")->serialize(); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testSaleNoCurrency() + { + $service = $this->basicSetup(); + $service->charge(10)->serialize(); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testVerifyNoCurrency() + { + $service = $this->basicSetup(); + $service->verify()->serialize(); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testVerifyWithAmount() + { + $service = $this->basicSetup(); + $service->verify()->withAmount(10)->serialize(); + } + + /* 05. CardStorageCreatePayerStoreCardRequest */ + + public function testCardStorageCreatePayer() + { + $config = new ServicesConfig(); + $config->merchantId = "heartlandgpsandbox"; + $config->accountId = "3dsecure"; + $config->refundPassword = "refund"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"; + $config->hostedPaymentConfig = new HostedPaymentConfig(); + $config->hostedPaymentConfig->language = "GB"; + $config->hostedPaymentConfig->responseUrl = "http://requestb.in/10q2bjb1"; + + $client = new RealexHppClient("secret"); + + // data to be passed to the HPP along with transaction level settings + $hostedPaymentData = new HostedPaymentData(); + $hostedPaymentData->offerToSaveCard = "1"; // display the save card tick box + $hostedPaymentData->customerExists = "0"; // new customer + //run test cases for different version + foreach ($this->hppVersionList as $hppVersion) { + $config->hostedPaymentConfig->version = $hppVersion; + $service = new HostedService($config); + + $json = $service->charge(15) + ->withCurrency("EUR") + ->withHostedPaymentData($hostedPaymentData) + ->serialize(); + + $this->assertNotNull($json); + + $response = $client->sendRequest($json, $hppVersion); + $this->assertNotNull($response); + + $parsedResponse = $service->parseResponse($response); + $this->assertNotNull($parsedResponse); + $this->assertEquals("00", $parsedResponse->responseCode); + } + } + + /* 07. CardStorageDisplayStoredCardsRequest */ + + public function testCardStorageDisplayStoredCard() + { + $config = new ServicesConfig(); + $config->merchantId = "heartlandgpsandbox"; + $config->accountId = "3dsecure"; + $config->refundPassword = "refund"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"; + $config->hostedPaymentConfig = new HostedPaymentConfig(); + $config->hostedPaymentConfig->language = "GB"; + $config->hostedPaymentConfig->responseUrl = "http://requestb.in/10q2bjb1"; + + $client = new RealexHppClient("secret"); + + // data to be passed to the HPP along with transaction level settings + $hostedPaymentData = new HostedPaymentData(); + $hostedPaymentData->offerToSaveCard = "1"; + $hostedPaymentData->customerExists = "1"; + $hostedPaymentData->customerKey = "5e7e9152-2d53-466d-91bc-6d12ebc56b79"; + + //run test cases for different version + foreach ($this->hppVersionList as $hppVersion) { + $config->hostedPaymentConfig->version = $hppVersion; + $service = new HostedService($config); + + $json = $service->charge(15) + ->withCurrency("EUR") + ->withHostedPaymentData($hostedPaymentData) + ->serialize(); + + $this->assertNotNull($json); + + $response = $client->sendRequest($json, $hppVersion); + $this->assertNotNull($response); + + $parsedResponse = $service->parseResponse($response); + $this->assertNotNull($parsedResponse); + $this->assertEquals("00", $parsedResponse->responseCode); + } + } + + /* 09. ContinuousAuthorityRequest */ + + public function testContinuousAuthorityRequest() + { + $config = new ServicesConfig(); + $config->merchantId = "heartlandgpsandbox"; + $config->accountId = "3dsecure"; + $config->refundPassword = "refund"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"; + $config->hostedPaymentConfig = new HostedPaymentConfig(); + $config->hostedPaymentConfig->language = "GB"; + $config->hostedPaymentConfig->responseUrl = "http://requestb.in/10q2bjb1"; + + $client = new RealexHppClient("secret"); + + //run test cases for different version + foreach ($this->hppVersionList as $hppVersion) { + $config->hostedPaymentConfig->version = $hppVersion; + $service = new HostedService($config); + + $json = $service->charge(15) + ->withCurrency("EUR") + ->withRecurringInfo(RecurringType::FIXED, RecurringSequence::FIRST) + ->serialize(); + + $this->assertNotNull($json); + + $response = $client->sendRequest($json, $hppVersion); + $this->assertNotNull($response); + + $parsedResponse = $service->parseResponse($response); + $this->assertNotNull($parsedResponse); + $this->assertEquals("00", $parsedResponse->responseCode); + } + } + + /* 13. DynamicCurrencyConversionRequest */ + + public function testEnableDynamicCurrencyConversionRequest() + { + //set config for DCC + $config = new ServicesConfig(); + $config->merchantId = "MerchantId"; + $config->accountId = "internet"; + $config->refundPassword = "refund"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"; + + $config->hostedPaymentConfig = new HostedPaymentConfig(); + $config->hostedPaymentConfig->language = "GB"; + $config->hostedPaymentConfig->responseUrl = "http://requestb.in/10q2bjb1"; + $config->hostedPaymentConfig->version = HppVersion::VERSION_2; + $config->hostedPaymentConfig->directCurrencyConversionEnabled = "1"; + + $service = new HostedService($config); + $client = new RealexHppClient("secret"); + + //serialize the request + $json = $service->Charge(19) + ->withCurrency("EUR") + ->withTimestamp("20170725154824") + ->withOrderId('GTI5Yxb0SumL_TkDMCAxQA') + ->serialize(); + + $this->assertNotNull($json); + $this->assertEquals($json, '{"MERCHANT_ID":"MerchantId","ACCOUNT":"internet","ORDER_ID":"GTI5Yxb0SumL_TkDMCAxQA","AMOUNT":"1900","CURRENCY":"EUR","TIMESTAMP":"20170725154824","AUTO_SETTLE_FLAG":"1","DCC_ENABLE":"1","HPP_LANG":"GB","MERCHANT_RESPONSE_URL":"http:\/\/requestb.in\/10q2bjb1","HPP_VERSION":"2","SHA1HASH":"448d742db89b05ce97152beb55157c904f3839cc"}'); + } + + public function testDisableDynamicCurrencyConversionRequest() + { + //set config for DCC + $config = new ServicesConfig(); + $config->merchantId = "MerchantId"; + $config->accountId = "internet"; + $config->refundPassword = "refund"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"; + + $config->hostedPaymentConfig = new HostedPaymentConfig(); + $config->hostedPaymentConfig->language = "GB"; + $config->hostedPaymentConfig->responseUrl = "http://requestb.in/10q2bjb1"; + $config->hostedPaymentConfig->version = HppVersion::VERSION_2; + $config->hostedPaymentConfig->directCurrencyConversionEnabled = "0"; + + $service = new HostedService($config); + $client = new RealexHppClient("secret"); + + //serialize the request + $json = $service->Charge(19) + ->withCurrency("EUR") + ->withTimestamp("20170725154824") + ->withOrderId('GTI5Yxb0SumL_TkDMCAxQA') + ->serialize(); + + $this->assertNotNull($json); + $this->assertEquals($json, '{"MERCHANT_ID":"MerchantId","ACCOUNT":"internet","ORDER_ID":"GTI5Yxb0SumL_TkDMCAxQA","AMOUNT":"1900","CURRENCY":"EUR","TIMESTAMP":"20170725154824","AUTO_SETTLE_FLAG":"1","DCC_ENABLE":"0","HPP_LANG":"GB","MERCHANT_RESPONSE_URL":"http:\/\/requestb.in\/10q2bjb1","HPP_VERSION":"2","SHA1HASH":"448d742db89b05ce97152beb55157c904f3839cc"}'); + } + + /* 11. FraudManagementRequest */ + + public function testFraudManagementRequest() + { + $config = new ServicesConfig(); + $config->merchantId = "heartlandgpsandbox"; + $config->accountId = "3dsecure"; + $config->refundPassword = "refund"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"; + $config->hostedPaymentConfig = new HostedPaymentConfig(); + $config->hostedPaymentConfig->language = "GB"; + $config->hostedPaymentConfig->responseUrl = "http://requestb.in/10q2bjb1"; + $config->hostedPaymentConfig->version = 2; + $config->hostedPaymentConfig->FraudFilterMode = FraudFilterMode::PASSIVE; + + $service = new HostedService($config); + $client = new RealexHppClient("secret"); + + // billing address + $billingAddress = new Address(); + $billingAddress->postalCode = "50001|Flat 123"; + $billingAddress->country = "US"; + + // shipping address + $shippingAddress = new Address(); + $shippingAddress->postalCode = "654|123"; + $shippingAddress->country = "GB"; + + // data to be passed to the HPP along with transaction level settings + $hostedPaymentData = new HostedPaymentData(); + $hostedPaymentData->customerNumber = "E8953893489"; // display the save card tick box + $hostedPaymentData->productId = "SID9838383"; // new customer + + //serialize the request + $json = $service->charge(19) + ->withCurrency("EUR") + ->withAddress($billingAddress, AddressType::BILLING) + ->withAddress($shippingAddress, AddressType::SHIPPING) + //->withProductId("SID9838383") // prodid + ->withClientTransactionId("Car Part HV") // varref + //->withCustomerId("E8953893489") // custnum + ->withCustomerIpAddress("123.123.123.123") + //->withFraudFilter(FraudFilterMode::PASSIVE) + ->withHostedPaymentData($hostedPaymentData) + ->serialize(); + + $this->assertNotNull($json); + + //make API call + $response = $client->sendRequest($json, $config->hostedPaymentConfig->version); + $this->assertNotNull($response); + + $parsedResponse = $service->parseResponse($response); + $this->assertNotNull($parsedResponse); + $this->assertEquals("00", $parsedResponse->responseCode); + } + + /* Serialize methods Test case */ + + public function testBasicAuthHppVersion1() + { + $config = new ServicesConfig(); + $config->merchantId = "MerchantId"; + $config->accountId = "internet"; + $config->refundPassword = "refund"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://pay.sandbox.realexpayments.com/pay"; + $config->hostedPaymentConfig = new HostedPaymentConfig(); + $config->hostedPaymentConfig->language = "GB"; + $config->hostedPaymentConfig->responseUrl = "https://www.example.com/response"; + $config->hostedPaymentConfig->version = HppVersion::VERSION_1; + + $service = new HostedService($config); + $client = new RealexHppClient("secret"); + + $json = $service->authorize(19.99) + ->withCurrency("EUR") + ->withTimeStamp("20170725154824") + ->WithOrderId("GTI5Yxb0SumL_TkDMCAxQA") + ->serialize(); + + $expectedJson = '{"MERCHANT_ID":"TWVyY2hhbnRJZA==","ACCOUNT":"aW50ZXJuZXQ=","ORDER_ID":"R1RJNVl4YjBTdW1MX1RrRE1DQXhRQQ==","AMOUNT":"MTk5OQ==","CURRENCY":"RVVS","TIMESTAMP":"MjAxNzA3MjUxNTQ4MjQ=","AUTO_SETTLE_FLAG":"MA==","HPP_LANG":"R0I=","MERCHANT_RESPONSE_URL":"aHR0cHM6Ly93d3cuZXhhbXBsZS5jb20vcmVzcG9uc2U=","HPP_VERSION":"MQ==","SHA1HASH":"MDYxNjA5Zjg1YThlMDE5MWRjN2Y0ODdmODI3OGU3MTg5OGEyZWUyZA=="}'; + $this->assertEquals($json, $expectedJson); + } + + public function testBasicAuthHppVersion2() + { + $config = new ServicesConfig(); + $config->merchantId = "MerchantId"; + $config->accountId = "internet"; + $config->refundPassword = "refund"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://pay.sandbox.realexpayments.com/pay"; + $config->hostedPaymentConfig = new HostedPaymentConfig(); + $config->hostedPaymentConfig->language = "GB"; + $config->hostedPaymentConfig->responseUrl = "https://www.example.com/response"; + $config->hostedPaymentConfig->version = HppVersion::VERSION_2; + + $service = new HostedService($config); + $client = new RealexHppClient("secret"); + + $json = $service->authorize(19.99) + ->withCurrency("EUR") + ->withTimeStamp("20170725154824") + ->WithOrderId("GTI5Yxb0SumL_TkDMCAxQA") + ->serialize(); + + $expectedJson = '{"MERCHANT_ID":"MerchantId","ACCOUNT":"internet","ORDER_ID":"GTI5Yxb0SumL_TkDMCAxQA","AMOUNT":"1999","CURRENCY":"EUR","TIMESTAMP":"20170725154824","AUTO_SETTLE_FLAG":"0","HPP_LANG":"GB","MERCHANT_RESPONSE_URL":"https:\/\/www.example.com\/response","HPP_VERSION":"2","SHA1HASH":"061609f85a8e0191dc7f487f8278e71898a2ee2d"}'; + $this->assertEquals($json, $expectedJson); + } + + public function testBasicSale() + { + $config = new ServicesConfig(); + $config->merchantId = "MerchantId"; + $config->accountId = "internet"; + $config->refundPassword = "refund"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://pay.sandbox.realexpayments.com/pay"; + $config->hostedPaymentConfig = new HostedPaymentConfig(); + $config->hostedPaymentConfig->language = "GB"; + $config->hostedPaymentConfig->responseUrl = "https://www.example.com/response"; + $config->hostedPaymentConfig->version = HppVersion::VERSION_2; + + $service = new HostedService($config); + $client = new RealexHppClient("secret"); + + $json = $service->charge(19.99) + ->withCurrency("EUR") + ->withTimeStamp("20170725154824") + ->WithOrderId("GTI5Yxb0SumL_TkDMCAxQA") + ->serialize(); + + $expectedJson = '{"MERCHANT_ID":"MerchantId","ACCOUNT":"internet","ORDER_ID":"GTI5Yxb0SumL_TkDMCAxQA","AMOUNT":"1999","CURRENCY":"EUR","TIMESTAMP":"20170725154824","AUTO_SETTLE_FLAG":"1","HPP_LANG":"GB","MERCHANT_RESPONSE_URL":"https:\/\/www.example.com\/response","HPP_VERSION":"2","SHA1HASH":"061609f85a8e0191dc7f487f8278e71898a2ee2d"}'; + $this->assertEquals($json, $expectedJson); + } + + public function testBasicHostedPaymentDataHppVersion1() + { + $config = new ServicesConfig(); + $config->merchantId = "MerchantId"; + $config->accountId = "internet"; + $config->refundPassword = "refund"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://pay.sandbox.realexpayments.com/pay"; + $config->hostedPaymentConfig = new HostedPaymentConfig(); + $config->hostedPaymentConfig->language = "GB"; + $config->hostedPaymentConfig->responseUrl = "https://www.example.com/response"; + $config->hostedPaymentConfig->version = HppVersion::VERSION_1; + + $service = new HostedService($config); + $client = new RealexHppClient("secret"); + + $hostedPaymentData = new HostedPaymentData(); + $hostedPaymentData->offerToSaveCard = "1"; // display the save card tick box + $hostedPaymentData->customerExists = "0"; // new customer + $hostedPaymentData->customerNumber = 'a028774f-beff-47bc-bd6e-ed7e04f5d758a028774f-btefa'; + $hostedPaymentData->productId = 'a0b38df5-b23c-4d82-88fe-2e9c47438972-b23c-4d82-88f'; + + $json = $service->charge(19.99) + ->withCurrency("EUR") + ->withTimeStamp("20170725154824") + ->WithOrderId("GTI5Yxb0SumL_TkDMCAxQA") + ->WithHostedPaymentData($hostedPaymentData) + ->WithDescription("Mobile Channel") + ->WithClientTransactionId("My Legal Entity") + ->serialize(); + + $expectedJson = '{"MERCHANT_ID":"TWVyY2hhbnRJZA==","ACCOUNT":"aW50ZXJuZXQ=","ORDER_ID":"R1RJNVl4YjBTdW1MX1RrRE1DQXhRQQ==","AMOUNT":"MTk5OQ==","CURRENCY":"RVVS","TIMESTAMP":"MjAxNzA3MjUxNTQ4MjQ=","AUTO_SETTLE_FLAG":"MQ==","COMMENT1":"TW9iaWxlIENoYW5uZWw=","CUST_NUM":"YTAyODc3NGYtYmVmZi00N2JjLWJkNmUtZWQ3ZTA0ZjVkNzU4YTAyODc3NGYtYnRlZmE=","OFFER_SAVE_CARD":"MQ==","PAYER_EXIST":"MA==","PROD_ID":"YTBiMzhkZjUtYjIzYy00ZDgyLTg4ZmUtMmU5YzQ3NDM4OTcyLWIyM2MtNGQ4Mi04OGY=","VAR_REF":"TXkgTGVnYWwgRW50aXR5","HPP_LANG":"R0I=","MERCHANT_RESPONSE_URL":"aHR0cHM6Ly93d3cuZXhhbXBsZS5jb20vcmVzcG9uc2U=","HPP_VERSION":"MQ==","SHA1HASH":"NzExNmM0OTgyNjM2N2M2NTEzZWZkYzBjYzgxZTI0M2I4MDk1ZDc4Zg=="}'; + $this->assertEquals($json, $expectedJson); + } + + public function testBasicHostedPaymentDataHppVersion2() + { + $config = new ServicesConfig(); + $config->merchantId = "MerchantId"; + $config->accountId = "internet"; + $config->refundPassword = "refund"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://pay.sandbox.realexpayments.com/pay"; + $config->hostedPaymentConfig = new HostedPaymentConfig(); + $config->hostedPaymentConfig->language = "GB"; + $config->hostedPaymentConfig->responseUrl = "https://www.example.com/response"; + $config->hostedPaymentConfig->version = HppVersion::VERSION_2; + + $service = new HostedService($config); + $client = new RealexHppClient("secret"); + + $hostedPaymentData = new HostedPaymentData(); + $hostedPaymentData->offerToSaveCard = "1"; // display the save card tick box + $hostedPaymentData->customerExists = "0"; // new customer + $hostedPaymentData->customerNumber = 'a028774f-beff-47bc-bd6e-ed7e04f5d758a028774f-btefa'; + $hostedPaymentData->productId = 'a0b38df5-b23c-4d82-88fe-2e9c47438972-b23c-4d82-88f'; + + $json = $service->charge(19.99) + ->withCurrency("EUR") + ->withTimeStamp("20170725154824") + ->WithOrderId("GTI5Yxb0SumL_TkDMCAxQA") + ->WithHostedPaymentData($hostedPaymentData) + ->WithDescription("Mobile Channel") + ->WithClientTransactionId("My Legal Entity") + ->serialize(); + + $expectedJson = '{"MERCHANT_ID":"MerchantId","ACCOUNT":"internet","ORDER_ID":"GTI5Yxb0SumL_TkDMCAxQA","AMOUNT":"1999","CURRENCY":"EUR","TIMESTAMP":"20170725154824","AUTO_SETTLE_FLAG":"1","COMMENT1":"Mobile Channel","CUST_NUM":"a028774f-beff-47bc-bd6e-ed7e04f5d758a028774f-btefa","OFFER_SAVE_CARD":"1","PAYER_EXIST":"0","PROD_ID":"a0b38df5-b23c-4d82-88fe-2e9c47438972-b23c-4d82-88f","VAR_REF":"My Legal Entity","HPP_LANG":"GB","MERCHANT_RESPONSE_URL":"https:\/\/www.example.com\/response","HPP_VERSION":"2","SHA1HASH":"7116c49826367c6513efdc0cc81e243b8095d78f"}'; + $this->assertEquals($json, $expectedJson); + } + + public function testParseResponse() + { + $config = new ServicesConfig(); + $config->merchantId = "heartlandgpsandbox"; + $config->accountId = "hpp"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"; + $config->hostedPaymentConfig = new HostedPaymentConfig(); + $config->hostedPaymentConfig->language = "GB"; + $config->hostedPaymentConfig->responseUrl = "http://requestb.in/10q2bjb1"; + + $client = new RealexHppClient("secret"); + + $address = new Address(); + $address->postalCode = "123|56"; + $address->country = "IRELAND"; + + //run test cases for different version + foreach ($this->hppVersionList as $hppVersion) { + $config->hostedPaymentConfig->version = $hppVersion; + $service = new HostedService($config); + + $json = $service->authorize(1) + ->withCurrency("EUR") + ->withCustomerId("123456") + ->withAddress($address) + ->serialize(); + + $this->assertNotNull($json); + + $response = $client->sendRequest($json, $hppVersion); + $this->assertNotNull($response); + + // Base64 encode values + $iterator = new \RecursiveIteratorIterator(new \RecursiveArrayIterator(json_decode($response, true))); + foreach ($iterator as $key => $value) { + $iterator->getInnerIterator()->offsetSet($key, base64_encode($value)); + } + + $response = json_encode($iterator->getArrayCopy()); + + $parsedResponse = $service->parseResponse($response, true); + $this->assertEquals("00", $parsedResponse->responseCode); + } + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/HppTestCase.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/HppTestCase.php new file mode 100644 index 0000000..936d6e5 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/HppTestCase.php @@ -0,0 +1,247 @@ +merchantId = "heartlandgpsandbox"; + $config->accountId = "hpp"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"; + + $config->hostedPaymentConfig = new HostedPaymentConfig(); + $config->hostedPaymentConfig->language = "GB"; + $config->hostedPaymentConfig->responseUrl = "http://requestb.in/10q2bjb1"; + return $config; + } + + public function setup() + { + $this->service = new HostedService($this->config()); + } + + /* 10. ThreedSecureResponse */ + + public function testThreedSecureResponse() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'hpp'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://pay.sandbox.realexpayments.com/pay'; + + $service = new HostedService( + $config + ); + + //response + // TODO: grab the response JSON from the client-side for example: + $responseJson = '{"MERCHANT_ID":"heartlandgpsandbox","ACCOUNT":"hpp","ORDER_ID":"OTA4NUEzOEEtMkE3RjU2RQ","TIMESTAMP":"20180724124150","RESULT":"00","PASREF":"15324325098818233","AUTHCODE":"12345","AVSPOSTCODERESULT":"U","CVNRESULT":"U","HPP_LANG":"GB","SHIPPING_CODE":null,"SHIPPING_CO":null,"BILLING_CODE":"123|56","BILLING_CO":"IRELAND","ECI":null,"CAVV":null,"XID":null,"MERCHANT_RESPONSE_URL":"http:\/\/requestb.in\/10q2bjb1","CARD_PAYMENT_BUTTON":null,"MESSAGE":"[ test system ] Authorised","AMOUNT":null,"SHA1HASH":"d1ff806b449b86375dbda74e2611760c348fcdeb","DCC_INFO_REQUST":null,"DCC_INFO_RESPONSE":null,"HPP_FRAUD_FILTER_MODE":null,"TSS_INFO":null}'; + + $parsedResponse = $service->parseResponse($responseJson); + $responseCode = $parsedResponse->responseCode; // 00 + $responseMessage = $parsedResponse->responseMessage; // [ test system ] Authorised + $responseValues = $parsedResponse->responseValues; // get values accessible by key + + $eci = $responseValues["ECI"]; // 5 - fully authenticated + $cavv = $responseValues["CAVV"]; // AAACBUGDZYYYIgGFGYNlAAAAAAA= + $xid = $responseValues["XID"]; // vJ9NXpFueXsAqeb4iAbJJbe+66s= + // TODO: update your application and display transaction outcome to the customer + + $this->assertNotEquals(null, $parsedResponse); + $this->assertEquals("00", $responseCode); + } + + /* 02. ProcessPaymentConsumeHppResponse */ + + public function testprocessPaymentConsumeResponse() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'hpp'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://pay.sandbox.realexpayments.com/pay'; + + $service = new HostedService($config); + + $responseJson = '{"MERCHANT_ID":"heartlandgpsandbox","ACCOUNT":"hpp","ORDER_ID":"NjMwNkMxMTAtMTA5RUNDRQ","TIMESTAMP":"20180720104340","RESULT":"00","PASREF":"15320798200414985","AUTHCODE":"12345","AVSPOSTCODERESULT":"U","CVNRESULT":"U","HPP_LANG":"GB","SHIPPING_CODE":null,"SHIPPING_CO":null,"BILLING_CODE":"123|56","BILLING_CO":"IRELAND","ECI":null,"CAVV":null,"XID":null,"MERCHANT_RESPONSE_URL":"http:\/\/requestb.in\/10q2bjb1","CARD_PAYMENT_BUTTON":null,"MESSAGE":"[ test system ] Authorised","AMOUNT":"100","SHA1HASH":"32628cf3f887ab9f4f1c547a10ac365c2168f0e2","DCC_INFO":null,"HPP_FRAUD_FILTER_MODE":null,"TSS_INFO":null}'; + + // create the response object from the response JSON + $parsedResponse = $service->parseResponse($responseJson); + + $orderId = $parsedResponse->orderId; // GTI5Yxb0SumL_TkDMCAxQA + $responseCode = $parsedResponse->responseCode; // 00 + $responseMessage = $parsedResponse->responseMessage; // [ test system ] Authorised + $responseValues = $parsedResponse->responseValues; // get values accessible by key + //$fraudFilterResult = $responseValues["HPP_FRAUDFILTER_RESULT"]; // PASS + + $this->assertNotEquals(null, $parsedResponse); + $this->assertEquals("00", $responseCode); + } + + /* 06. CardStorageCreatePayerStoreCardResponse */ + + public function testCardStorageCreatePayerStoreCardResponse() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'hpp'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://pay.sandbox.realexpayments.com/pay'; + + $service = new HostedService( + $config + ); + + // TODO: grab the response JSON from the client-side for example: + //sample response JSON: + $responseJson = '{"MERCHANT_ID":"heartlandgpsandbox","ACCOUNT":"3dsecure","ORDER_ID":"NTgxMkMzODUtNTEwMkNCMw","TIMESTAMP":"20180723110112","RESULT":"00","PASREF":"15323400720177562","AUTHCODE":"12345","AVSPOSTCODERESULT":"U","CVNRESULT":"U","HPP_LANG":"GB","SHIPPING_CODE":null,"SHIPPING_CO":null,"BILLING_CODE":null,"BILLING_CO":null,"ECI":null,"CAVV":null,"XID":null,"MERCHANT_RESPONSE_URL":"http:\/\/requestb.in\/10q2bjb1","CARD_PAYMENT_BUTTON":null,"MESSAGE":"[ test system ] Authorised","AMOUNT":"1500","SHA1HASH":"4c7a635401c57371a0931bb3a21a849181cc963d","DCC_INFO":null,"HPP_FRAUD_FILTER_MODE":null,"TSS_INFO":null}'; + + $parsedResponse = $service->parseResponse($responseJson); + $responseCode = $parsedResponse->responseCode; // 00 + $responseMessage = $parsedResponse->responseMessage; // [ test system ] Authorised + $responseValues = $parsedResponse->responseValues; // get values accessible by key + /* + // Payer Setup Details + $payerSetupResult = $responseValues["PAYER_SETUP"]; // 00 + $payerSetupMessage = $responseValues["PAYER_SETUP_MSG"]; // Successful + $payerReference = $responseValues["SAVED_PAYER_REF"]; // 5e7e9152-2d53-466d-91bc-6d12ebc56b79 + // Card Setup Details + $cardSetupResult = $responseValues["PMT_SETUP"]; // 00 + $cardSetupMessage = $responseValues["PMT_SETUP_MSG"]; // Successful + $cardReference = $responseValues["SAVED_PMT_REF"]; // ca68dcac-9af2-4d65-b06c-eb54667dcd4a + // Card Details Stored + $cardType = $responseValues["SAVED_PMT_TYPE"]; // MC + $cardDigits = $responseValues["SAVED_PMT_DIGITS"]; // 542523xxxx4415 + $cardExpiry = $responseValues["SAVED_PMT_EXPDATE"]; // 1025 + $cardName = $responseValues["SAVED_PMT_NAME"]; // James Mason + */ + // TODO: update your application and display transaction outcome to the customer + + $this->assertNotEquals(null, $parsedResponse); + $this->assertEquals("00", $responseCode); + } + + /* 08. CardStorageDisplayStoredCardsResponse */ + + public function testCardStorageDisplayStoredCardsResponse() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'hpp'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://pay.sandbox.realexpayments.com/pay'; + + $service = new HostedService( + $config + ); + + // TODO: grab the response JSON from the client-side for example: + //sample response JSON: + $responseJson = array("MERCHANT_ID" => "MerchantId", "ACCOUNT" => "internet", "ORDER_ID" => "GTI5Yxb0SumL_TkDMCAxQA", "AMOUNT" => "1999", "TIMESTAMP" => "20170725154824", "SHA1HASH" => "843680654f377bfa845387fdbace35acc9d95778", "RESULT" => "00", "AUTHCODE" => "12345", "CARD_PAYMENT_BUTTON" => "Place Order", "AVSADDRESSRESULT" => "M", "AVSPOSTCODERESULT" => "M", "BATCHID" => "445196", "MESSAGE" => "[ test system ] Authorised", "PASREF" => "15011597872195765", "CVNRESULT" => "M", "HPP_FRAUDFILTER_RESULT" => "PASS", "HPP_CHOSEN_PMT_REF" => "099efeb4-eda2-4fd7-a04d-29647bb6c51d", "HPP_EDITED_PMT_REF" => "037bd26a-c76b-4ee4-8063-376d8858f23d", "HPP_DELETED_PMT_REF" => "3db4c72c-cd95-4743-8070-f17e2b56b642"); + + $parsedResponse = $service->parseResponse(json_encode($responseJson)); + $responseCode = $parsedResponse->responseCode; // 00 + $responseMessage = $parsedResponse->responseMessage; // [ test system ] Authorised + $responseValues = $parsedResponse->responseValues; // get values accessible by key + // card used to complete payment, edited or deleted + $chosenCard = $responseValues["HPP_CHOSEN_PMT_REF"]; // 099efeb4-eda2-4fd7-a04d-29647bb6c51d + $editedCard = $responseValues["HPP_EDITED_PMT_REF"]; // 037bd26a-c76b-4ee4-8063-376d8858f23d + $deletedCard = $responseValues["HPP_DELETED_PMT_REF"]; // 3db4c72c-cd95-4743-8070-f17e2b56b642 + // TODO: update your application and display transaction outcome to the customer + + $this->assertNotEquals(null, $parsedResponse); + $this->assertEquals("00", $responseCode); + } + + /* 12. FraudManagementResponse */ + + public function testFraudManagementResponse() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'hpp'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://pay.sandbox.realexpayments.com/pay'; + + $service = new HostedService( + $config + ); + + // TODO: grab the response JSON from the client-side for example: + //sample response JSON: + $responseJson = array("MERCHANT_ID" => "MerchantId", "ACCOUNT" => "internet", "ORDER_ID" => "GTI5Yxb0SumL_TkDMCAxQA", "AMOUNT" => "1999", "TIMESTAMP" => "20170725154824", "SHA1HASH" => "843680654f377bfa845387fdbace35acc9d95778", "RESULT" => "00", "AUTHCODE" => "12345", "CARD_PAYMENT_BUTTON" => "Place Order", "AVSADDRESSRESULT" => "M", "AVSPOSTCODERESULT" => "M", "BATCHID" => "445196", "MESSAGE" => "[ test system ] Authorised", "PASREF" => "15011597872195765", "CVNRESULT" => "M", "HPP_FRAUDFILTER_RESULT" => "HOLD", "HPP_FRAUDFILTER_RULE_56257838-4590-4227-b946-11e061fb15fe" => "HOLD", "HPP_FRAUDFILTER_RULE_cf609cf9-9e5a-4700-ac69-8aa09c119305" => "PASS"); + ; + + $parsedResponse = $service->parseResponse(json_encode($responseJson)); + $responseCode = $parsedResponse->responseCode; // 00 + $responseValues = $parsedResponse->responseValues; // get values accessible by key + + $fraudFilterResult = $responseValues["HPP_FRAUDFILTER_RESULT"]; // HOLD + $cardRuleResult = $responseValues["HPP_FRAUDFILTER_RULE_56257838-4590-4227-b946-11e061fb15fe"]; // HOLD + $ipRuleResult = $responseValues["HPP_FRAUDFILTER_RULE_cf609cf9-9e5a-4700-ac69-8aa09c119305"]; // PASS + // TODO: update your application and display transaction outcome to the customer + + $this->assertNotEquals(null, $parsedResponse); + $this->assertEquals("00", $responseCode); + } + + /* 14. DynamicCurrencyConversionResponse */ + + public function testDynamicCurrencyConversionResponse() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = 'hpp'; + $config->sharedSecret = 'secret'; + $config->serviceUrl = 'https://pay.sandbox.realexpayments.com/pay'; + + $service = new HostedService( + $config + ); + + // TODO: grab the response JSON from the client-side for example: + //sample response JSON: + $responseJson = '{"MERCHANT_ID":"heartlandgpsandbox","ACCOUNT":"apidcc","ORDER_ID":"NTQyQzgxREMtMzVFQzlDNw","TIMESTAMP":"20180724095953","RESULT":"00","PASREF":"15324227932436743","AUTHCODE":"12345","AVSPOSTCODERESULT":"U","CVNRESULT":"U","HPP_LANG":"GB","SHIPPING_CODE":null,"SHIPPING_CO":null,"BILLING_CODE":null,"BILLING_CO":null,"ECI":null,"CAVV":null,"XID":null,"MERCHANT_RESPONSE_URL":"http:\/\/requestb.in\/10q2bjb1","CARD_PAYMENT_BUTTON":null,"MESSAGE":"[ test system ] Authorised","AMOUNT":"100100","SHA1HASH":"320c7ddc49d292f5900c676168d5cc1f2a55306c","DCC_INFO_REQUST":{"CCP":"Fexco","TYPE":1,"RATE":"1.7203","RATE_TYPE":"S","AMOUNT":"172202","CURRENCY":"AUD"},"DCC_INFO_RESPONSE":{"cardHolderCurrency":"AUD","cardHolderAmount":"172202","cardHolderRate":"1.7203","merchantCurrency":"EUR","merchantAmount":"100100","marginRatePercentage":"","exchangeRateSourceName":"","commissionPercentage":"","exchangeRateSourceTimestamp":""},"HPP_FRAUD_FILTER_MODE":null,"TSS_INFO":null}'; + $parsedResponse = $service->parseResponse($responseJson); + + $responseCode = $parsedResponse->responseCode; // 00 + $responseValues = $parsedResponse->responseValues; // get values accessible by key + + $conversionProcessor = $responseValues['DCC_INFO_REQUST']["CCP"]; // fexco + $conversionRate = $responseValues['DCC_INFO_REQUST']["RATE"]; // 1.7203 + $merchantAmount = $responseValues['DCC_INFO_RESPONSE']["merchantAmount"]; // 1999 + $cardholderAmount = $responseValues['DCC_INFO_RESPONSE']["cardHolderAmount"]; // 3439 + $merchantCurrency = $responseValues['DCC_INFO_RESPONSE']["merchantCurrency"]; // EUR + $cardholderCurrency = $responseValues['DCC_INFO_RESPONSE']["cardHolderCurrency"]; // AUD + $marginPercentage = $responseValues['DCC_INFO_RESPONSE']["marginRatePercentage"]; // 3.75 + $exchangeSource = $responseValues['DCC_INFO_RESPONSE']["exchangeRateSourceName"]; // REUTERS WHOLESALE INTERBANK + $commissionPercentage = $responseValues['DCC_INFO_RESPONSE']["commissionPercentage"]; // 0 + $exchangeTimestamp = $responseValues['DCC_INFO_RESPONSE']["exchangeRateSourceTimestamp"]; // 20170518162700 + // TODO: update your application and display transaction outcome to the customer + $this->assertNotEquals(null, $parsedResponse); + $this->assertEquals("00", $responseCode); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/Realex3dSecureTests.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/Realex3dSecureTests.php new file mode 100644 index 0000000..104641d --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/Realex3dSecureTests.php @@ -0,0 +1,500 @@ +getConfig()); + } + + protected function getConfig() + { + $config = new ServicesConfig(); + $config->merchantId = 'heartlandgpsandbox'; + $config->accountId = '3dsecure'; + $config->sharedSecret = 'secret'; + $config->rebatePassword = 'rebate'; + $config->refundPassword = 'refund'; + $config->serviceUrl = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'; + return $config; + } + + public function testAcsClient() + { + $authClient = new ThreeDSecureAcsClient('https://pit.3dsecure.net/VbVTestSuiteService/pit1/acsService/paReq?summary=MTNmMzI4NzgtNTdmZi00OWEzLWJhZTAtYzFhNzAxMDJkMGNi'); + $this->assertNotNull($authClient->authenticate('eJxlUsFSwjAQvfsVTO82TSm0MNs4FVBwRkUF8ZomK1Rpimkr6NebYBEdc8jsy27evrwNnO3ydesddZkVKnao6zktVKKQmVrGznx2cRo5Z+wEZiuNOHxAUWtkcI1lyZfYymTs+KIjZYRt30tl0H2WPRpFIuQyDULsdTvoMJgm9/jGoOnCTBPXB3KAhk2LFVcVAy7ezic3LAgD2ouANBBy1JMh6zULyDcGxXNkK+S6WnMll5vS7GmxA7JPgChqVekPFgUekAOAWq/Zqqo2ZZ+Q7Xbr/r/visKtX4HYSiBHcdPaRqVh3mWSJcM7Nb7t0O1iGs6n7cXnI025N7hSk1EMxFaA5BUy36MhpX7Y8r1+J+hTI39/Djy3kqwZRl4DYGN7JE3GJn4fgDFfm+EcnnRAgLtNodBUGFd/YiBHwYOx9VZUxrVxdjEb1aPXy5f5k27Tmzo/v75N4ti6vS+wbJlxikb0m84CIJaCNIMkzfxN9OdffAF4VML9')); + } + + public function testMerchantDataEnumerator() + { + $keys = ['Key1', 'Key2', 'Key3']; + $values = ['Value1', 'Value2', 'Value3']; + + $merchantData = new MerchantDataCollection(); + for ($i=0; $i<3; $i++) { + $merchantData->add($keys[$i], $values[$i]); + } + + $this->assertEquals(3, $merchantData->count()); + + foreach ($merchantData->getKeys() as $key) { + $this->assertTrue(in_array($key, $keys)); + $this->assertTrue(in_array($merchantData->get($key), $values)); + } + } + + public function testMerchantDataWithHiddenValues() + { + $card = new CreditCardData(); + $card->number = 4012001037141112; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cardHolderName = 'James Mason'; + + $enrolled = $card->verifyEnrolled(100, 'USD'); + $this->assertNotNull($enrolled); + if ($enrolled) { + $merchantData = $card->threeDSecure->getMerchantData(); + + $this->assertNotNull($merchantData); + $this->assertEquals(0, $merchantData->count()); + + $this->assertNull($merchantData->get('amount')); + $this->assertNull($merchantData->get('currency')); + $this->assertNull($merchantData->get('orderId')); + + for ($i=0; $i<3; $i++) { + $merchantData->add('Key'.$i, 'Value'.$i); + + $this->assertNotNull($merchantData->get('Key'.$i)); + $this->assertEquals('Value'.$i, $merchantData->get('Key'.$i)); + } + + $this->assertEquals(3, $merchantData->count()); + } + } + + public function testMerchantDataEncryptAndDecrypt() + { + $merchantData = new MerchantDataCollection(); + $merchantData->add('customerId', '12345'); + $merchantData->add('invoiceNumber', '54321'); + + $encoder = function ($input) { + $encoded = sprintf('%s.%s', $input, 'secret'); + return base64_encode($encoded); + }; + + $encrypted = $merchantData->toString($encoder); + + $decoder = function ($input) { + $decoded = explode('.', (string)base64_decode($input)); + $this->assertEquals('secret', $decoded[1]); + return $decoded[0]; + }; + + $decrypted = $merchantData->parse($encrypted, $decoder); + + $this->assertNotNull($decrypted); + $this->assertNotNull($decrypted->get('customerId')); + $this->assertEquals('12345', $decrypted->get('customerId')); + $this->assertNotNull($decrypted->get('invoiceNumber')); + $this->assertEquals('54321', $decrypted->get('invoiceNumber')); + } + + public function testMerchantDataMultiKey() + { + $this->expectExceptionMessage('Cannot access private property GlobalPayments\Api\Entities\MerchantDataCollection::$collection'); + + $mcd = new MerchantDataCollection(); + array_push($mcd->collection, array('amount'=>'10')); + array_push($mcd->collection, array('amount'=>'10')); + } + + public function testFullCycleWithMerchantData() + { + $card = new CreditCardData(); + $card->number = 4012001037141112; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cardHolderName = 'John Smith'; + + $enrolled = $card->verifyEnrolled(1, 'USD'); + if ($enrolled) { + $secureEcom = $card->threeDSecure; + if (!empty($secureEcom)) { + $merchantData = new MerchantDataCollection(); + $merchantData->add('client_txn_id', '123456'); + + $authClient = new ThreeDSecureAcsClient($secureEcom->issuerAcsUrl); + $authResponse = $authClient->authenticate($secureEcom->payerAuthenticationRequest, (string)$secureEcom->getMerchantData()->toString()); + + $payerAuthenticationResponse = $authResponse->getAuthResponse(); + $md = MerchantDataCollection::parse($authResponse->getMerchantData()); + + if ($card->verifySignature($payerAuthenticationResponse, $md)) { + $response = $card->charge(1) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } else { + $this->fail('Signature verification failed.'); + } + } else { + $this->fail('Secure3Data was null.'); + } + } else { + $this->fail('Card not enrolled.'); + } + } + + public function testFullCycleWithNoMerchantData() + { + $card = new CreditCardData(); + $card->number = 4012001037141112; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cardHolderName = 'James Mason'; + + $amount = 100; + $currency = 'USD'; + $orderId = GenerationUtils::generateOrderId(); + + $enrolled = $card->verifyEnrolled($amount, $currency, $orderId); + + if ($enrolled) { + $secureEcom = $card->threeDSecure; + + if ($secureEcom != null) { + $authClient = new ThreeDSecureAcsClient($secureEcom->issuerAcsUrl); + $authResponse = $authClient->authenticate($secureEcom->payerAuthenticationRequest, (string)$secureEcom->getMerchantData()->toString()); + + $payerAuthenticationResponse = $authResponse->getAuthResponse(); + + if ($card->verifySignature($payerAuthenticationResponse, null, $amount, $currency, $orderId)) { + $response = $card->charge($amount) + ->withCurrency($currency) + ->withOrderId($orderId) + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } else { + $this->fail('Signature verification failed.'); + } + } else { + $this->fail('Secure3Data was null.'); + } + } else { + $this->fail('Card not enrolled.'); + } + } + + public function testVerifyEnrolledTrue() + { + $card = new CreditCardData(); + $card->number = 4012001037141112; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cardHolderName = 'John Smith'; + + $enrolled = $card->verifyEnrolled(1, 'USD'); + $this->assertTrue($enrolled); + $this->assertNotNull($card->threeDSecure); + $this->assertNotNull($card->threeDSecure->payerAuthenticationRequest); + $this->assertNotNull($card->threeDSecure->issuerAcsUrl); + $this->assertNotNull($card->threeDSecure->xid); + } + + public function testVerifyEnrolledFalse() + { + $card = new CreditCardData(); + $card->number = 4012001038443335; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cardHolderName = 'John Smith'; + + $enrolled = $card->verifyEnrolled(1, 'USD'); + $this->assertFalse($enrolled); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testVerifySignatureBadOrderId() + { + $card = new CreditCardData(); + $card->verifySignature('eNrVWNmyozqy/ZWK6kfHOcwYOly7Q8yDwWYe3jBgRjPbYL7+4r1r16muWx3RfZ/68oKUSKlU5sqVQod/LLf6yyMdxqJtvn1F/oS/fvnH28HOhzTlrDS+D+nbQUvHMcrSL0Xy7SuNIjEMX1L8iiX4FUcudEQjURzhOEHHaHL9+nY4AzMd3wcTCEbS2Cb6vsDbpv9P9AB9djfNQ5xHzfR2iOKekfU3fI8jNHWAvncPt3SQuTf6+3OAPvoH6K+J5/urNW5mLkXyVvi9feR6zi2AGBCUZax3S3EeCI1T3w7Qa8Qhiab0DYWRPYKg1BcU/jtM/h3DD9C7/NC91IFbe990IzB8gH4WHDZ/DGkTP98ofPv0o3dIl65t0m3Etrkf7QP0l21d1LzBPz3Itvime5MebP/tMBW339r0Lj+MUzTdx7fgAH1vHeLo8XgDALAM5nAuq6OAk/mToTv8DF7Pttf3IYc0Lt5gYjNqe7/PAnXWDsWU316m/rPgAL1Mgd7D93awiqzZFhvSLxtCmvHb13yaur9D0DzPf87Yn+2QQei2EQimoW1AMhbZ375+zEoTubm2/9E0NmrapoijulijaUOGlk55m3z5Ydvv1NjmSxMCmTz7x6bqjxjBmz9eEhhDiE0n9HulP+3s31nlV2OHMfpjzCPktcAvit4OZnpNX4hIvzim/O3r337gnyuydJz+L+t9rvWzhk99blTf07e0Cz2ekj38LKW5mBLXiiFuoZWxN/7b57yPkQfoh4Hfrf8I1U8u+RgYUzvuaUx4FwaJURWc56HH/Yq5TX6sxTUIH7Kxm3TLLCiuVcwIo9nqtl8jNXLXCCmXR6CecFdoVjhC4P0ss+gsd6d67xE6QiD56kCcejLFztTiiAvNZfLHeL1h887PuAlrHBgMsnZf9YZfoTItL9UYe9J5ARby8CUM707lwz+x+lUzLCrHSh492mJNPOddfW8pUpq5py89JfPspIjDqTKDUiiAz3qwq0CU5UKVeyQU3KNmSHust3NjQcmezBAvOSV5ztJ9m1H3heSvdSYxDya+QNxMqTNrQS52c1RdURkVO6pPBdtrqrYwNuqT5nWOWX7p67lbMl1rply2U6rhNPQWdh3/OCdC9u3bT5D5HhE1fX5EwCdgmoum6KPFpsNUXDfsbpSkyTIX2iwLKjQDs8yATHbBSZIUbSr2QSqRbBeaZo3T64pHXJVpABZZqxct+YJxBs+wswM0MVu4FehMprsM0GymZhRXoDnD5l2N0USAODy7aJpbKZ4rumsi6Ejkm7VmwDM7B5xrGCo/m57l6oxmUDNnvMskfg750CPQ0JcX3gbnD/2ZzfL64yLSz8AzH5oxzuzHeJGfFddZQSrM8KKX/KyVYNFKftU4IXrJTtw/yzQJLMIK3O92a9yNeFxu7jVG6+ZS02XoK7BmOjP/YeORA4tn1KET+jrsYG6XiM7C2eD4Mb/VGCFUHJj/yRexxlRmfWnCOi55UwPUhy82RxsoPV4wJQ9FamFXoHyMD2xQu/YWE0YuXzqqPq8KkZ5hBhi8AMCJBQYFXt/ZTN3aPChKJ7Rv9KCfnfwsk6PchIR1U8M48i5zEp0LledpSOG5tbi7ir4Hec0jitt7GL460igVzY4wc1uYey7SfdW1S5k/L3dU4wpyycNsiloIRW6sGtmr7z5Hx9Af7NgB04GanE0umIPQqSxX4ERiWA0/aPKiaiEGY8I9FxktVagm0Mie6yCHw0zfjq3LxbaOKSaxK38DNGlCZ93jqskK9hBDOHkn7oQtMXYZlOPpNT6Fij4n4qmushGzm77B7cezjM+7ihNvqLg/kVe85x2a7vlHGISCrRot3YaKedX2I3dUC0bCgTyeI0BwxaTsl5AQ+diwMtO3XMqWYsNjS3a98hg4ZtE09VLoE4bMAQMwv8M6wLccMYDT+2ITZSu+gxf3dO010B4bFRodi5D7MyPkHMTR/R4ttIZrBm+cqGZ25ztSHsnlKktetpZ+kZQQEWiwaIrHliUSnofTEtu7nrwGbTBZZ4PjvAc7AEdr54WOWa9iNY0M66TH97tThmDoxh3skCgCz9Rk3lQMBJMeWyyqBS+RzUNkzN5dLC6eOtOi7JTRftNTUB92CUEw+ykOUpg44rf5stc78xgaa+pvEUSlNnpk5vV5PnYpSybdIg0R2en6rBaDDldX/o6wyLnMhqeHb4nBqWo3BpBYXMM6ijGrTNR85tNZvndnZfSMUJ661BokqlB8wgn5dKKQnWW70fRgm+xcuPpj5z32i3yAfmWn39EVL77oahY/6coExyCmt6DtJ2uxyULc8bfi5jovGlHUNpTzR6xvqXJkDDBvXjlqoHpPQybXWNfVfk5he0vhLkb55biC6UM22kr9Lsssj4A3SrgHvtldUCK/sIy99dHI02uZF9YYpcvIE+DIo++a2c4ieKcNjl8EL/L1XBbd8oIi0zanDC3GNOxPqgKEZldPjdNWnUteVPXU142mbH7WOQ1/yf67KHbzvyX/6l9m8y+XZfwZcNt3o2W3NgPUIQkhwylnnFurfSUQjR3uT0F/q5A9luGXR4abO1XCkXVa49m562eyHcZdOMYoZAlb4UO1qzYjp/mMboUvz+mWSpjc3SttyjtuTM+lDnsSye2mHkiXErai/pT3OUPdoTqqLXqRLt3jWUE8sYqlaJ/mdisAst9VKXW3SNS+E5KqMuLyyENIscH9mjCPI1bsHK2/Vrq9+AGvAjWBpYKUpOFxqup+5rcDzCh3+BoOXcBB5j3h8MGQxNm3DDiiGH0x1uet9cq2OI2aKwdqhjxqQw5nGh902m0uk9nCCTLUY9wBviX16pwwaCDeOE8O9/N8IUeB2xtCKyqJTflFxUjxxJHnMKWSBuumccM/D0B0Yh4cy9xtYL3iJpkaA64Uz3JABIYEgYwHmmS8sJHIwJw0cZwjIxBCnN/o7VXUQMlk2cBkvMAYMQvMwI8kE465dnNBgiVPAn3h9njbsGDRc4RW88kIZHUOtlg70pZ789EGgZALVugzY/DKA8FsI1/LNgziCQe4zQZG/NffT+92G9S73RuuN9wEs/TCmgmfGCbgBa3N0gqUocDEcgae1dWyIGXbqsIM/5qe2WHkCoDGO2+4IfaOtwlYT0Qa5baiUVQqUoxrz86GhAfpg0jKGXaZx55mE+s5DZqT5VAMp1CwIreOQ9aTrJ/Twm0Jq6kRpnzeK80g+RatfRPLhI0s2fUcjK2Otv5kzWJMFRpwpko25QwJUeqIybfWlfbxObYLz8yHgQLtXXa286SQdeOz3ThRkjpYs28rzt99Uh/ZbvcEnKIE2DASLCjtZ60FhokpIwm4wd5nz9MsXdHpURzVZkJYS5KeO4IlnzgVnfir0t72NjhleF3WVWUKJ5XzHCeuEYWppCldnGML+SHiyrhvHlMVjdUwInN/7ypLpTPwkXEG6ITjxf6xE0MvszWxo9SSX/5NehbKLf0f5Cc9G+l0Ryxt6RpeB01zWpHz7jzZv55uHAFwTPe/qYbXNTB+0Fuu8e6tXgObf2gs/El5t3eZxSiXxqzjG5EnYr2d4oRRFvQ6bsIuQJ3M8PX1gurdB3Xji1iC4JNKefeD3kNvg7mHbDpeMBUYjcF9zn6dFPntxAhWbY3hk9tuMu1X2X9ZWfkP6FmvnGut3rqGQKdAxsKJ0c/eOcBHXFUaSHK9WOB2lltEJ4fxckpMn8n9okMtO4vyVF3V5WEVnGnerCvryArTw17NG9g9BscLxOzk02DORlaMPXbRYTk8ghheJbl7ev79FrXVuB8j88GNEToPlxXiJ6SvNLiEWgl6nIat7KkSrdBEX7E9vpWNkY+fRKPOV67qBPTaVuEEO6oqTIsrxRZ/tnhk1XVkQ/Fi6d3+0fnP5XG0Rhbyk4ES9zaboRfkufieUA5nGLlvMOUbRbWbUMZZ1EnzeSk3NmWv1mhDQHwsXH71zsPAT4C02Zijh1NHc93s64WliOe1ih3Hu0rbb4Cf0WmQFTbf0ige/6Dnu80yU/lRVj/pmbE3Wtzo+f89NTMLJT2jxABejTP3113Rsv0lCnolr79S82bTJzWniIjm5xGAndnqLRy7DbKz05iygsRggLDv2eZIC2ke3fF9ipFXV9SL9VQ9ZZsGktgOpIkc5ShX/R1P3nrDDsa1USwi9xVKpGL4DN+W0rXiy/5ZzQYxM0Hvexp68dWuONpp4HpXBAyC13fIkxZJEwanqDmWt1k3GTBkzwdZI0Z42Tsaxlxpi6jh+yBoR3gDCsXs6bpOCR9D5QddXu/xnYwjeWCO1dlayKDf9VvxHXFKN62TvoPO/Y2WlhmRMOi5ov1RxFdb3i+Ky/FWKPJ+lBxnVvE58mSmPipAzOQkVI9iSemHFzco5CtPp5cBzzCEQJnaZaUQFZ/npMzl+zGVUMS92FDy5CUJ/Iaaob/++aEf9wB/3RC833K+X7y+buZ+vpD9HwzDHH8=', null, 1, 'USD', 'orderId'); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testVerifySignatureNoPaymentResponse() + { + $card = new CreditCardData(); + $card->verifySignature(null); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testVerifySignatureNoAmount() + { + $card = new CreditCardData(); + $card->verifySignature('paymentResponse', null, null, 'USD', 'orderId'); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testVerifySignatureNoCurrency() + { + $card = new CreditCardData(); + $card->verifySignature('paymentResponse', null, 10, null, 'orderId'); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + */ + public function testVerifySignatureNoOrderId() + { + $card = new CreditCardData(); + $card->verifySignature('paymentResponse', null, 10, 'USD', null); + } + + public function testAuthorize3dSecure() + { + $secureEcom = new ThreeDSecure(); + $secureEcom->cavv = 'AAACBllleHchZTBWIGV4AAAAAAA='; + $secureEcom->xid = 'crqAeMwkEL9r4POdxpByWJ1/wYg='; + $secureEcom->eci = '5'; + + $card = new CreditCardData(); + $card->number = 4012001037141112; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cardHolderName = 'Philip Marlowe'; + $card->threeDSecure = $secureEcom; + + $response = $card->charge(10) + ->withCurrency('EUR') + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCardHolderNotEnrolled() + { + $card = new CreditCardData(); + $card->number = 4012001038443335; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cardHolderName = 'John Smith'; + + $enrolled = $card->verifyEnrolled(10, 'USD'); + $this->assertFalse($enrolled); + $this->assertNotNull($card->threeDSecure); + $this->assertEquals('6', $card->threeDSecure->eci); + + // .net test does not have amount or currency but validation would not allow this + $response = $card->charge(10) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testUnableToVerifyEnrollment() + { + $card = new CreditCardData(); + $card->number = 4012001038488884; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cardHolderName = 'John Smith'; + + $enrolled = $card->verifyEnrolled(10, 'USD'); + $this->assertFalse($enrolled); + $this->assertNotNull($card->threeDSecure); + $this->assertEquals('7', $card->threeDSecure->eci); + + $response = $card->charge(10) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testInvalidResponseFromEnrollmentServer() + { + $card = new CreditCardData(); + $card->number = 4012001036298889; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cardHolderName = 'John Smith'; + + $card->verifyEnrolled(10, 'USD'); + } + + public function testCardHolderIsEnrolledACSAuthFailed() + { + $card = new CreditCardData(); + $card->number = 4012001036853337; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cardHolderName = 'John Smith'; + + $enrolled = $card->verifyEnrolled(10, 'USD'); + $this->assertTrue($enrolled); + + $secureEcom = $card->threeDSecure; + $authClient = new ThreeDSecureAcsClient($secureEcom->issuerAcsUrl); + $authResponse = $authClient->authenticate($secureEcom->payerAuthenticationRequest, $secureEcom->getMerchantData()->toString()); + + // $payerAuthenticationResponse = $authResponse->parse(); + $payerAuthenticationResponse = $authResponse->getAuthResponse(); + $md = MerchantDataCollection::parse($authResponse->getMerchantData()); + + $verified = $card->verifySignature($payerAuthenticationResponse, $md); + $this->assertFalse($verified); + $this->assertNotNull($card->threeDSecure); + $this->assertEquals(7, $card->threeDSecure->eci); + + $response = $card->charge(10) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCardHolderIsEnrolledACSAcknowledged() + { + $card = new CreditCardData(); + $card->number = 4012001037167778; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cardHolderName = 'John Smith'; + + $enrolled = $card->verifyEnrolled(10, 'USD'); + $this->assertTrue($enrolled); + + $secureEcom = $card->threeDSecure; + $authClient = new ThreeDSecureAcsClient($secureEcom->issuerAcsUrl); + $authResponse = $authClient->authenticate($secureEcom->payerAuthenticationRequest, $secureEcom->getMerchantData()->toString()); + + // $payerAuthenticationResponse = $authResponse->parse(); + $payerAuthenticationResponse = $authResponse->getAuthResponse(); + $md = MerchantDataCollection::parse($authResponse->getMerchantData()); + + $verified = $card->verifySignature($payerAuthenticationResponse, $md); + $this->assertTrue($verified); + $this->assertEquals('A', $card->threeDSecure->status); + + $response = $card->charge(10) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCardHolderIsEnrolledACSFailed() + { + $card = new CreditCardData(); + $card->number = 4012001037461114; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cardHolderName = 'John Smith'; + + $enrolled = $card->verifyEnrolled(10, 'USD'); + $this->assertTrue($enrolled); + + $secureEcom = $card->threeDSecure; + $authClient = new ThreeDSecureAcsClient($secureEcom->issuerAcsUrl); + $authResponse = $authClient->authenticate($secureEcom->payerAuthenticationRequest, $secureEcom->getMerchantData()->toString()); + + // $payerAuthenticationResponse = $authResponse->parse(); + $payerAuthenticationResponse = $authResponse->getAuthResponse(); + $md = MerchantDataCollection::parse($authResponse->getMerchantData()); + + $verified = $card->verifySignature($payerAuthenticationResponse, $md); + $this->assertFalse($verified); + $this->assertEquals('N', $card->threeDSecure->status); + $this->assertEquals(7, $card->threeDSecure->eci); + + $response = $card->charge(10) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + public function testCardHolderIsEnrolledACSUnavailable() + { + $card = new CreditCardData(); + $card->number = 4012001037484447; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cardHolderName = 'John Smith'; + + $enrolled = $card->verifyEnrolled(10, 'USD'); + $this->assertTrue($enrolled); + + $secureEcom = $card->threeDSecure; + $authClient = new ThreeDSecureAcsClient($secureEcom->issuerAcsUrl); + $authResponse = $authClient->authenticate($secureEcom->payerAuthenticationRequest, $secureEcom->getMerchantData()->toString()); + + $payerAuthenticationResponse = $authResponse->getAuthResponse(); + $md = MerchantDataCollection::parse($authResponse->getMerchantData()); + + $verified = $card->verifySignature($payerAuthenticationResponse, $md); + $this->assertFalse($verified); + $this->assertEquals('U', $card->threeDSecure->status); + $this->assertEquals(7, $card->threeDSecure->eci); + + $response = $card->charge(10) + ->withCurrency('USD') + ->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + public function testCardHolderIsEnrolledACSInvalid() + { + $card = new CreditCardData(); + $card->number = 4012001037490006; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cardHolderName = 'John Smith'; + + $enrolled = $card->verifyEnrolled(10, 'USD'); + $this->assertTrue($enrolled); + + $secureEcom = $card->threeDSecure; + $authClient = new ThreeDSecureAcsClient($secureEcom->issuerAcsUrl); + $authResponse = $authClient->authenticate($secureEcom->payerAuthenticationRequest, $secureEcom->getMerchantData()->toString()); + + $payerAuthenticationResponse = $authResponse->getAuthResponse(); + $md = MerchantDataCollection::parse($authResponse->getMerchantData()); + + $card->verifySignature($payerAuthenticationResponse, $md); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/RealexApmTest.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/RealexApmTest.php new file mode 100644 index 0000000..f696c6b --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/RealexApmTest.php @@ -0,0 +1,185 @@ +merchantId = "heartlandgpsandbox"; + $config->accountId = "hpp"; + $config->rebatePassword = 'refund'; + $config->refundPassword = 'refund'; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"; + return $config; + } + + public function setup() { + ServicesContainer::configure($this->config()); + } + + public function testApmForCharge() { + $paymentMethod = new AlternativePaymentMethod(AlternativePaymentType::SOFORTUBERWEISUNG); + + $paymentMethod->returnUrl = 'https://www.example.com/returnUrl'; + $paymentMethod->statusUpdateUrl = 'https://www.example.com/statusUrl'; + $paymentMethod->descriptor = 'Test Transaction'; + $paymentMethod->country = 'DE'; + $paymentMethod->accountHolderName = 'James Mason'; + + $response = $paymentMethod->charge(10) + ->withCurrency("EUR") + ->withDescription('New APM') + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + // get the reponse details to save to the DB for future transaction management requests + $orderId = $response->orderId; + $authCode = $response->authorizationCode; + $paymentsReference = $response->transactionId; // pasref + $apmResponse = $response->alternativePaymentResponse; + + $this->assertNotNull($response); + $this->assertEquals("01", $response->responseCode); + $this->assertNotNull($response->alternativePaymentResponse); + } + + /** + * @expectedException \GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage amount cannot be null for this transaction type + */ + public function testApmWithoutAmount() { + $paymentMethod = new AlternativePaymentMethod(AlternativePaymentType::SOFORTUBERWEISUNG); + + $paymentMethod->returnUrl = 'https://www.example.com/returnUrl'; + $paymentMethod->statusUpdateUrl = 'https://www.example.com/statusUrl'; + $paymentMethod->descriptor = 'Test Transaction'; + $paymentMethod->country = 'DE'; + $paymentMethod->accountHolderName = 'James Mason'; + + $response = $paymentMethod->charge() + ->withCurrency("EUR") + ->withDescription('New APM') + ->execute(); + } + + /** + * @expectedException \GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage currency cannot be null for this transaction type + */ + public function testApmWithoutCurrency() { + $paymentMethod = new AlternativePaymentMethod(AlternativePaymentType::SOFORTUBERWEISUNG); + + $paymentMethod->returnUrl = 'https://www.example.com/returnUrl'; + $paymentMethod->statusUpdateUrl = 'https://www.example.com/statusUrl'; + $paymentMethod->descriptor = 'Test Transaction'; + $paymentMethod->country = 'DE'; + $paymentMethod->accountHolderName = 'James Mason'; + + $response = $paymentMethod->charge(10) + ->withDescription('New APM') + ->execute(); + } + + /** + * @expectedException \GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage returnUrl cannot be null for this transaction type + */ + public function testApmWithoutReturnUrl() { + $paymentMethod = new AlternativePaymentMethod(AlternativePaymentType::SOFORTUBERWEISUNG); + + $paymentMethod->statusUpdateUrl = 'https://www.example.com/statusUrl'; + $paymentMethod->descriptor = 'Test Transaction'; + $paymentMethod->country = 'DE'; + $paymentMethod->accountHolderName = 'James Mason'; + + $response = $paymentMethod->charge(1001) + ->withCurrency("EUR") + ->withDescription('New APM') + ->execute(); + } + + /** + * @expectedException \GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage statusUpdateUrl cannot be null for this transaction type + */ + public function testApmWithoutstatusUpdateUrl() { + $paymentMethod = new AlternativePaymentMethod(AlternativePaymentType::SOFORTUBERWEISUNG); + + $paymentMethod->returnUrl = 'https://www.example.com/returnUrl'; + $paymentMethod->descriptor = 'Test Transaction'; + $paymentMethod->country = 'DE'; + $paymentMethod->accountHolderName = 'James Mason'; + + $response = $paymentMethod->charge(1001) + ->withCurrency("EUR") + ->withDescription('New APM') + ->execute(); + } + + /** + * @expectedException \GlobalPayments\Api\Entities\Exceptions\GatewayException + * @expectedExceptionMessage FAILED + */ + public function testAPMRefundPendingTransaction() { + $paymentMethod = new AlternativePaymentMethod(AlternativePaymentType::TEST_PAY); + + $paymentMethod->returnUrl = 'https://www.example.com/returnUrl'; + $paymentMethod->statusUpdateUrl = 'https://www.example.com/statusUrl'; + $paymentMethod->descriptor = 'Test Transaction'; + $paymentMethod->country = 'DE'; + $paymentMethod->accountHolderName = 'James Mason'; + + $response = $paymentMethod->charge(10) + ->withCurrency("EUR") + ->withDescription('New APM') + ->execute(); + + $this->assertNotEquals(null, $response); + $this->assertEquals("01", $response->responseCode); + + // send the settle request, we must specify the amount and currency + $response = $response->refund(10) + ->withCurrency("EUR") + ->withAlternativePaymentType(AlternativePaymentType::TEST_PAY) + ->execute(); + } + + public function testApmForRefund() { + // a settle request requires the original order id + $orderId = "20180912050207-5b989dcfc9433"; + // and the payments reference (pasref) from the authorization response + $paymentsReference = "15367285279651634"; + // and the auth code transaction response + $authCode = "12345"; + + // create the rebate transaction object + $transaction = Transaction::fromId($paymentsReference, $orderId); + $transaction->authorizationCode = $authCode; + + // send the settle request, we must specify the amount and currency + $response = $transaction->refund(10) + ->withCurrency("EUR") + ->withAlternativePaymentType(AlternativePaymentType::TEST_PAY) + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + } + +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/RecurringTest.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/RecurringTest.php new file mode 100644 index 0000000..52e06fc --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/RecurringTest.php @@ -0,0 +1,390 @@ +format("Ymd")); + } + + public function getPaymentId($type) + { + return sprintf("%s-Realex-%s", (new \DateTime())->format("Ymd"), $type); + } + + protected function config() + { + $config = new ServicesConfig(); + $config->merchantId = "heartlandgpsandbox"; + $config->accountId = "3dsecure"; + $config->refundPassword = "refund"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"; + return $config; + } + + protected function dccSetup() + { + $config = new ServicesConfig(); + $config->merchantId = "heartlandgpsandbox"; + $config->accountId = "apidcc"; + $config->refundPassword = "refund"; + $config->sharedSecret = "secret"; + $config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"; + + ServicesContainer::configure($config); + } + + public function setup() + { + ServicesContainer::configure($this->config()); + + $this->newCustomer = new Customer(); + $this->newCustomer->key = $this->getCustomerId(); + $this->newCustomer->title = "Mr."; + $this->newCustomer->firstName = "James"; + $this->newCustomer->lastName = "Mason"; + $this->newCustomer->company = "Realex Payments"; + $this->newCustomer->address = new Address(); + $this->newCustomer->address->streetAddress1 = "Flat 123"; + $this->newCustomer->address->streetAddress2 = "House 456"; + $this->newCustomer->address->streetAddress3 = "The Cul-De-Sac"; + $this->newCustomer->address->city = "Halifax"; + $this->newCustomer->address->province = "West Yorkshire"; + $this->newCustomer->address->pstalCode = "W6 9HR"; + $this->newCustomer->address->country = "United Kingdom"; + $this->newCustomer->homePhone = "+35312345678"; + $this->newCustomer->workPhone = "+3531987654321"; + $this->newCustomer->fax = "+124546871258"; + $this->newCustomer->mobilePhone = "+25544778544"; + $this->newCustomer->email = "text@example.com"; + $this->newCustomer->comments = "Campaign Ref E7373G"; + } + + /* 08. Card Storage Create Payer */ + /* Request Type: payer-new */ + + public function testcardStorageCreatePayer() + { + try { + $response = $this->newCustomer->Create(); + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } catch (GatewayException $exc) { + if ($exc->responseCode != '501' && $exc->responseCode != '520') { + throw $exc; + } + } + } + + /* 09. Card Storage Store Card */ + /* Request Type: card-new */ + + public function testcardStorageStoreCard() + { + $card = new CreditCardData(); + $card->number = "4012001037141112"; + $card->expMonth = 10; + $card->expYear = 2025; + $card->cvn = '123'; + $card->cardHolderName = 'James Mason'; + + try { + $paymentMethod = $this->newCustomer + ->addPaymentMethod($this->getPaymentId("Credit"), $card) + ->create(); + $this->assertNotNull($paymentMethod); + } catch (GatewayException $exc) { + if ($exc->responseCode != '501' && $exc->responseCode != '520') { + throw $exc; + } + } + } + + /* 10. Card Storage Charge Card */ + /* Request Type: receipt-in */ + + public function testcardStorageChargeCard() + { + $paymentMethod = new RecurringPaymentMethod($this->getCustomerId(), $this->getPaymentId("Credit")); + $response = $paymentMethod->charge(10) + ->withCurrency("EUR") + ->withCvn("123") + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + // get the reponse details to save to the DB for future transaction management requests + $orderId = $response->orderId; + $authCode = $response->authorizationCode; + $paymentsReference = $response->transactionId; // pasref + + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /* 11. CardStorage ThreeDSecure Verify Enrolled */ + /* Request Type: realvault-3ds-verifyenrolled */ + + public function testcardStorageThreeDSecureVerifyEnrolled() + { + $paymentMethod = new RecurringPaymentMethod($this->getCustomerId(), $this->getPaymentId("Credit")); + + $response = $paymentMethod->verify() + ->withAmount(10) + ->withCurrency('USD') + ->withModifier(TransactionModifier::SECURE3D) + ->execute(); + + // get the response details to update the DB + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /* 12. CardStorage Dcc Rate Lookup */ + /* Request Type: realvault-dccrate */ + + public function testcardStorageDccRateLookup() + { + $this->dccSetup(); + + $orderId = GenerationUtils::generateOrderId(); + $paymentMethod = new RecurringPaymentMethod($this->getCustomerId(), $this->getPaymentId("Credit")); + $dccDetails = $paymentMethod->getDccRate(DccRateType::SALE, 1001, 'EUR', DccProcessor::FEXCO, $orderId); + + $this->assertNotNull($dccDetails); + $this->assertEquals('00', $dccDetails->responseCode, $dccDetails->responseMessage); + $this->assertNotNull($dccDetails->dccResponseResult); + } + + /* 14. CardStorage UpdatePayer */ + /* Request Type: payer-edit */ + + public function testcardStorageUpdatePayer() + { + $customer = new Customer(); + $customer->key = $this->getCustomerId(); + $customer->firstName = "Perry"; + + $response = $customer->saveChanges(); + + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /* 15. CardStorage Continuous Authority First */ + /* Request Type: auth */ + + public function testContinuousAuthorityFirst() + { + // create the card object + $card = new CreditCardData(); + $card->number = '5425230000004415'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '131'; + $card->cardHolderName = 'James Mason'; + + + // process an auto-settle authorization + $response = $card->charge(15) + ->withCurrency("EUR") + ->withRecurringInfo(RecurringType::VARIABLE, RecurringSequence::FIRST) + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + // get the details to save to the DB for future Transaction Management requests + $orderId = $response->orderId; + $authCode = $response->authorizationCode; + $paymentsReference = $response->transactionId; + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + } + + /* 15. CardStorage Continuous Authority Subsequent */ + /* Request Type: receipt-in */ + + public function testContinuousAuthoritySubsequent() + { + // create the payment method object + $paymentMethod = new RecurringPaymentMethod($this->getCustomerId(), $this->getPaymentId("Credit")); + + // charge the stored card/payment method + $response = $paymentMethod->charge(15) + ->withCurrency("EUR") + ->withCvn("123") + ->withRecurringInfo(RecurringType::VARIABLE, RecurringSequence::SUBSEQUENT) + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + } + + /* 15. CardStorage Continuous Authority Last */ + /* Request Type: receipt-in */ + + public function testContinuousAuthorityLast() + { + // create the payment method object + $paymentMethod = new RecurringPaymentMethod($this->getCustomerId(), $this->getPaymentId("Credit")); + + // charge the stored card/payment method + $response = $paymentMethod->charge(15) + ->withCurrency("EUR") + ->withCvn("123") + ->withRecurringInfo(RecurringType::VARIABLE, RecurringSequence::LAST) + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + } + + /* 16. Card Storage Refund */ + /* Request Type: payment-out */ + + public function testcardStorageRefund() + { + // create the payment method object + $paymentMethod = new RecurringPaymentMethod($this->getCustomerId(), $this->getPaymentId("Credit")); + + // charge the stored card/payment method + $response = $paymentMethod->refund(10) + ->withCurrency("EUR") + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + } + + /* 17. Card Storage UpdateCard */ + /* Request Type: card-update-card */ + + public function testcardStorageUpdateCard() + { + $paymentMethod = new RecurringPaymentMethod($this->getCustomerId(), $this->getPaymentId("Credit")); + + $paymentMethod->paymentMethod = new CreditCardData(); + $paymentMethod->paymentMethod->number = "5425230000004415"; + $paymentMethod->paymentMethod->expMonth = 10; + $paymentMethod->paymentMethod->expYear = 2020; + $paymentMethod->paymentMethod->cardHolderName = "Philip Marlowe"; + + $response = $paymentMethod->SaveChanges(); + + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /* 18. Card Storage Verify Card */ + /* Request Type: receipt-in-otb */ + + public function testcardStorageVerifyCard() + { + $paymentMethod = new RecurringPaymentMethod($this->getCustomerId(), $this->getPaymentId("Credit")); + + // verify the stored card/payment method is valid and active + $response = $paymentMethod->verify() + ->withCvn("123") + ->execute(); + + // get the response details to update the DB + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + + $this->assertNotEquals(null, $response); + $this->assertEquals("00", $responseCode); + } + + /* 13. CardStorage DeleteCard */ + /* Request Type: card-cancel-card */ + + public function testcardStorageDeleteCard() + { + $paymentMethod = new RecurringPaymentMethod($this->getCustomerId(), $this->getPaymentId("Credit")); + + // delete the stored card/payment method + // WARNING! This can't be undone + $response = $paymentMethod->Delete(); + + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } + + /* Request Type: receipt-in */ + + public function testcardStorageChargeCardDCC() + { + $this->dccSetup(); + $this->testcardStorageCreatePayer(); + $this->testcardStorageStoreCard(); + + $paymentMethod = new RecurringPaymentMethod($this->getCustomerId(), $this->getPaymentId("Credit")); + + $orderId = GenerationUtils::generateOrderId(); + $dccDetails = $paymentMethod->getDccRate(DccRateType::SALE, 1001, 'EUR', DccProcessor::FEXCO, $orderId); + + $this->assertNotNull($dccDetails); + $this->assertEquals('00', $dccDetails->responseCode, $dccDetails->responseMessage); + $this->assertNotNull($dccDetails->dccResponseResult); + + $dccValues = new DccRateData(); + $dccValues->orderId = $dccDetails->transactionReference->orderId; + $dccValues->dccProcessor = DccProcessor::FEXCO; + $dccValues->dccType = 1; + $dccValues->dccRateType = DccRateType::SALE; + $dccValues->currency = $dccDetails->dccResponseResult->cardHolderCurrency; + $dccValues->dccRate = $dccDetails->dccResponseResult->cardHolderRate; + $dccValues->amount = $dccDetails->dccResponseResult->cardHolderAmount; + + $response = $paymentMethod->charge(1001) + ->withCurrency("EUR") + ->withCvn("123") + ->withDccRateData($dccValues) + ->withOrderId($orderId) + ->execute(); + + $responseCode = $response->responseCode; // 00 == Success + $message = $response->responseMessage; // [ test system ] AUTHORISED + // get the reponse details to save to the DB for future transaction management requests + $orderId = $response->orderId; + $authCode = $response->authorizationCode; + $paymentsReference = $response->transactionId; // pasref + + $this->assertNotNull($response); + $this->assertEquals("00", $response->responseCode); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/Secure3dServiceTests.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/Secure3dServiceTests.php new file mode 100644 index 0000000..421a27c --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/Secure3dServiceTests.php @@ -0,0 +1,772 @@ +getConfig()); + + // create card data + $this->card = new CreditCardData(); + $this->card->number = 4263970000005262; + $this->card->expMonth = 12; + $this->card->expYear = 2025; + $this->card->cardHolderName = 'John Smith'; + + // stored card + $this->stored = new RecurringPaymentMethod('20190809-Realex', '20190809-Realex-Credit'); + + // shipping address + $this->shippingAddress = new Address(); + $this->shippingAddress->streetAddress1 = 'Apartment 852'; + $this->shippingAddress->streetAddress2 = 'Complex 741'; + $this->shippingAddress->streetAddress3 = 'no'; + $this->shippingAddress->city = 'Chicago'; + $this->shippingAddress->postalCode = '5001'; + $this->shippingAddress->state = 'IL'; + $this->shippingAddress->countryCode = '840'; + + // billing address + $this->billingAddress = new Address(); + $this->billingAddress->streetAddress1 = 'Flat 456'; + $this->billingAddress->streetAddress2 = 'House 789'; + $this->billingAddress->streetAddress3 = 'no'; + $this->billingAddress->city = 'Halifax'; + $this->billingAddress->postalCode = 'W5 9HR'; + $this->billingAddress->countryCode = '826'; + + // browser data + $this->browserData = new BrowserData(); + $this->browserData->acceptHeader = 'text/html,application/xhtml+xml,application/xml;q=9,image/webp,img/apng,*/*;q=0.8'; + $this->browserData->colorDepth = ColorDepth::TWENTY_FOUR_BITS; + $this->browserData->ipAddress = '123.123.123.123'; + $this->browserData->javaEnabled = true; + $this->browserData->language = 'en'; + $this->browserData->screenHeight = 1080; + $this->browserData->screenWidth = 1920; + $this->browserData->challengWindowSize = ChallengeWindowSize::WINDOWED_600X400; + $this->browserData->timeZone = '0'; + $this->browserData->userAgent = 'Mozilla/5.0 (Windows NT 6.1; Win64, x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36'; + + } + + protected function getConfig() + { + $config = new ServicesConfig(); + $config->merchantId = 'myMerchantId'; + $config->accountId = 'ecom3ds'; + $config->sharedSecret = 'secret'; + $config->methodNotificationUrl = 'https://www.example.com/methodNotificationUrl'; + $config->challengeNotificationUrl = 'https://www.example.com/challengeNotificationUrl'; + $config->secure3dVersion = Secure3dVersion::ANY; + $config->merchantContactUrl = 'https://www.example.com'; + return $config; + } + + public function testFullCycle_v1() + { + $card = new CreditCardData(); + $card->number = 4012001037141112; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cardHolderName = 'John Smith'; + + $secureEcom = Secure3dService::checkEnrollment($card) + ->withAmount(10.01) + ->withCurrency('USD') + ->execute(Secure3dVersion::ONE); + $this->assertEquals(Secure3dVersion::ONE, $secureEcom->getVersion()); + + if ($secureEcom->enrolled) { + // authenticate + $authClient = new ThreeDSecureAcsClient($secureEcom->issuerAcsUrl); + $authResponse = $authClient->authenticate($secureEcom->payerAuthenticationRequest, $secureEcom->getMerchantData()->toString()); + + $payerAuthenticationResponse = $authResponse->getAuthResponse(); + $md = MerchantDataCollection::parse($authResponse->getMerchantData()); + + $secureEcom = Secure3dService::getAuthenticationData() + ->withPayerAuthenticationResponse($payerAuthenticationResponse) + ->withMerchantData($md) + ->execute(); + $card->threeDSecure = $secureEcom; + + if ($secureEcom->status == 'Y') { + $response = $card->charge()->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } else { + $this->fail('Signature verification failed.'); + } + } else { + $this->fail('Card not enrolled.'); + } + } + + public function testFullCycle_v2() + { + $secureEcom = Secure3dService::checkEnrollment($this->card) + ->execute(Secure3dVersion::TWO); + $this->assertNotNull($secureEcom); + $this->assertNotNull($secureEcom->serverTransactionId); + + if ($secureEcom->enrolled) { + $this->assertEquals(Secure3dVersion::TWO, $secureEcom->getVersion()); + + // initiate authentication + $initAuth = Secure3dService::initiateAuthentication($this->card, $secureEcom) + ->withAmount(10.01) + ->withCurrency('USD') + ->withOrderCreateDate(date('Y-m-d H:i:s')) + ->withAddress($this->billingAddress, AddressType::BILLING) + ->withAddress($this->shippingAddress, AddressType::SHIPPING) + ->withBrowserData($this->browserData) + ->withMethodUrlCompletion(MethodUrlCompletion::NO) + ->execute(); + $this->assertNotNull($initAuth); + + // get authentication data + $secureEcom = Secure3dService::getAuthenticationData() + ->withServerTransactionId($initAuth->serverTransactionId) + ->execute(); + $this->card->threeDSecure = $secureEcom; + + if ($secureEcom->status == 'AUTHENTICATION_SUCCESSFUL') { + $response = $this->card->charge(10.01) + ->withCurrency('USD') + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } else { + $this->fail('Signature verification failed.'); + } + } else { + $this->fail('Card not enrolled'); + } + } + + public function testFullCycle_Any() + { + $secureEcom = Secure3dService::checkEnrollment($this->card) + ->withAmount(1.00) + ->withCurrency('USD') + ->execute(Secure3dVersion::ANY); + $this->assertNotNull($secureEcom); + + if ($secureEcom->enrolled) { + if ($secureEcom->getVersion() === Secure3dVersion::TWO) { + $this->assertEquals(Secure3dVersion::TWO, $secureEcom->getVersion()); + + // initiate authentication + $initAuth = Secure3dService::initiateAuthentication($this->card, $secureEcom) + ->withAmount(10.01) + ->withCurrency('USD') + ->withOrderCreateDate(date('Y-m-d H:i:s')) + ->withAddress($this->billingAddress, AddressType::BILLING) + ->withAddress($this->shippingAddress, AddressType::SHIPPING) + ->withBrowserData($this->browserData) + ->withMethodUrlCompletion(MethodUrlCompletion::NO) + ->execute(); + $this->assertNotNull($initAuth); + + // get authentication data + $secureEcom = Secure3dService::getAuthenticationData() + ->withServerTransactionId($initAuth->serverTransactionId) + ->execute(); + $this->card->threeDSecure = $secureEcom; + + if ($secureEcom->status == 'AUTHENTICATION_SUCCESSFUL') { + $response = $this->card->charge(10.01) + ->withCurrency('USD') + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } else { + $this->fail('Signature verification failed.'); + } + } else { + // authenticate + $authClient = new ThreeDSecureAcsClient($secureEcom->issuerAcsUrl); + $authResponse = $authClient->authenticate($secureEcom->payerAuthenticationRequest, $secureEcom->getMerchantData()->toString()); + + $payerAuthenticationResponse = $authResponse->getAuthResponse(); + $md = MerchantDataCollection::parse($authResponse->getMerchantData()); + + $secureEcom = Secure3dService::getAuthenticationData() + ->withPayerAuthenticationResponse($payerAuthenticationResponse) + ->withMerchantData($md) + ->execute(); + $this->card->threeDSecure = $secureEcom; + + if ($secureEcom->status == 'Y') { + $response = $this->card->charge()->execute(); + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } else { + $this->fail('Signature verification failed.'); + } + } + } else { + $this->fail('Card not enrolled'); + } + + } + + public function testFullCycle_v2_StoredCard() + { + $secureEcom = Secure3dService::checkEnrollment($this->stored) + ->execute(Secure3dVersion::TWO); + $this->assertNotNull($secureEcom); + $this->assertNotNull($secureEcom->serverTransactionId); + + if ($secureEcom->enrolled) { + $this->assertEquals(Secure3dVersion::TWO, $secureEcom->getVersion()); + + // initiate authentication + $initAuth = Secure3dService::initiateAuthentication($this->stored, $secureEcom) + ->withAmount(10.01) + ->withCurrency('USD') + ->withOrderCreateDate(date('Y-m-d H:i:s')) + ->withAddress($this->billingAddress, AddressType::BILLING) + ->withAddress($this->shippingAddress, AddressType::SHIPPING) + ->withBrowserData($this->browserData) + ->withMethodUrlCompletion(MethodUrlCompletion::NO) + ->execute(); + $this->assertNotNull($initAuth); + + // get authentication data + $secureEcom = Secure3dService::getAuthenticationData() + ->withServerTransactionId($initAuth->serverTransactionId) + ->execute(); + $this->stored->threeDSecure = $secureEcom; + + if ($secureEcom->status == 'AUTHENTICATION_SUCCESSFUL') { + $response = $this->stored->charge(10.01) + ->withCurrency('USD') + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } else { + $this->fail('Signature verification failed.'); + } + + } else { + $this->fail('Card not enrolled'); + } + } + + public function testFullCycle_v2_OTB() + { + $secureEcom = Secure3dService::checkEnrollment($this->card) + ->execute(Secure3dVersion::TWO); + $this->assertNotNull($secureEcom); + $this->assertNotNull($secureEcom->serverTransactionId); + + if ($secureEcom->enrolled) { + $this->assertEquals(Secure3dVersion::TWO, $secureEcom->getVersion()); + + // initiate authentication + $initAuth = Secure3dService::initiateAuthentication($this->card, $secureEcom) + ->withAmount(10.01) + ->withCurrency('USD') + ->withOrderCreateDate(date('Y-m-d H:i:s')) + ->withAddress($this->billingAddress, AddressType::BILLING) + ->withAddress($this->shippingAddress, AddressType::SHIPPING) + ->withBrowserData($this->browserData) + ->withMethodUrlCompletion(MethodUrlCompletion::NO) + ->execute(); + $this->assertNotNull($initAuth); + + // get authentication data + $secureEcom = Secure3dService::getAuthenticationData() + ->withServerTransactionId($initAuth->serverTransactionId) + ->execute(); + $this->card->threeDSecure = $secureEcom; + + if ($secureEcom->status == 'AUTHENTICATION_SUCCESSFUL') { + $response = $this->card->verify() + ->withCurrency('USD') + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } else { + $this->fail('Signature verification failed.'); + } + + } else { + $this->fail('Card not enrolled'); + } + } + + public function testFullCycle_v2_OTB_StoredCard() + { + $secureEcom = Secure3dService::checkEnrollment($this->stored) + ->execute(Secure3dVersion::TWO); + $this->assertNotNull($secureEcom); + $this->assertNotNull($secureEcom->serverTransactionId); + + if ($secureEcom->enrolled) { + $this->assertEquals(Secure3dVersion::TWO, $secureEcom->getVersion()); + + // initiate authentication + $initAuth = Secure3dService::initiateAuthentication($this->stored, $secureEcom) + ->withAmount(10.01) + ->withCurrency('USD') + ->withOrderCreateDate(date('Y-m-d H:i:s')) + ->withAddress($this->billingAddress, AddressType::BILLING) + ->withAddress($this->shippingAddress, AddressType::SHIPPING) + ->withBrowserData($this->browserData) + ->withMethodUrlCompletion(MethodUrlCompletion::NO) + ->execute(); + $this->assertNotNull($initAuth); + + // get authentication data + $secureEcom = Secure3dService::getAuthenticationData() + ->withServerTransactionId($initAuth->serverTransactionId) + ->execute(); + $this->stored->threeDSecure = $secureEcom; + + if ($secureEcom->status == 'AUTHENTICATION_SUCCESSFUL') { + $response = $this->stored->verify() + ->withCurrency('USD') + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } else { + $this->fail('Signature verification failed.'); + } + + } else { + $this->fail('Card not enrolled'); + } + } + + public function testOptionalRequestLevelFields() + { + $secureEcom = Secure3dService::checkEnrollment($this->card) + ->execute(Secure3dVersion::TWO); + $this->assertNotNull($secureEcom); + + if ($secureEcom->enrolled) { + $this->assertEquals(Secure3dVersion::TWO, $secureEcom->getVersion()); + + // initiate authentication + $initAuth = Secure3dService::initiateAuthentication($this->card, $secureEcom) + ->withAmount(10.01) + ->withCurrency('USD') + ->withOrderCreateDate(date('Y-m-d H:i:s')) + ->withAddress($this->billingAddress, AddressType::BILLING) + ->withAddress($this->shippingAddress, AddressType::SHIPPING) + ->withBrowserData($this->browserData) + ->withMethodUrlCompletion(MethodUrlCompletion::NO) + + // optionals + ->withMerchantInitiatedRequestType(AuthenticationRequestType::RECURRING_TRANSACTION) + + ->execute(); + $this->assertNotNull($initAuth); + + // get authentication data + $secureEcom = Secure3dService::getAuthenticationData() + ->withServerTransactionId($initAuth->serverTransactionId) + ->execute(); + $this->card->threeDSecure = $secureEcom; + + if ($secureEcom->status == 'AUTHENTICATION_SUCCESSFUL') { + $response = $this->card->charge(10.01) + ->withCurrency('USD') + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } else { + $this->fail('Signature verification failed.'); + } + } else { + $this->fail('Card not enrolled'); + } + } + + public function testOptionalOrderLevelFields() + { + $secureEcom = Secure3dService::checkEnrollment($this->card) + ->execute(Secure3dVersion::TWO); + $this->assertNotNull($secureEcom); + + if ($secureEcom->enrolled) { + $this->assertEquals(Secure3dVersion::TWO, $secureEcom->getVersion()); + + // initiate authentication + $initAuth = Secure3dService::initiateAuthentication($this->card, $secureEcom) + ->withAmount(250.00) + ->withCurrency('USD') + ->withOrderCreateDate(date('Y-m-d H:i:s')) + ->withAddress($this->billingAddress, AddressType::BILLING) + ->withAddress($this->shippingAddress, AddressType::SHIPPING) + ->withBrowserData($this->browserData) + ->withMethodUrlCompletion(MethodUrlCompletion::NO) + + // optionals + ->withGiftCardCurrency('USD') + ->withGiftCardAmount(250.00) + ->withDeliveryEmail('james.mason@example.com') + ->withDeliveryTimeFrame(DeliveryTimeFrame::ELECTRONIC_DELIVERY) + ->withShippingMethod(ShippingMethod::VERIFIED_ADDRESS) + ->withShippingNameMatchesCardHolderName(true) + ->withPreOrderIndicator(PreOrderIndicator::FUTURE_AVAILABILITY) + // TODO + // This value passed for date, but doesn't seem right + // This line bugged in Java SDK + ->withPreOrderAvailabilityDate('20190418') + ->withReorderIndicator(ReorderIndicator::REORDER) + ->withOrderTransactionType(OrderTransactionType::GOODS_SERVICE_PURCHASE) + + ->execute(); + $this->assertNotNull($initAuth); + + // get authentication data + $secureEcom = Secure3dService::getAuthenticationData() + ->withServerTransactionId($initAuth->serverTransactionId) + ->execute(); + $this->card->threeDSecure = $secureEcom; + + if ($secureEcom->status == 'AUTHENTICATION_SUCCESSFUL') { + $response = $this->card->charge(10.01) + ->withCurrency('USD') + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } else { + $this->fail('Signature verification failed.'); + } + } else { + $this->fail('Card not enrolled'); + } + } + + public function testOptionalPayerLevelFields() + { + $secureEcom = Secure3dService::checkEnrollment($this->card) + ->execute(Secure3dVersion::TWO); + $this->assertNotNull($secureEcom); + + if ($secureEcom->enrolled) { + $this->assertEquals(Secure3dVersion::TWO, $secureEcom->getVersion()); + + // initiate authentication + $initAuth = Secure3dService::initiateAuthentication($this->card, $secureEcom) + ->withAmount(250.00) + ->withCurrency('USD') + ->withOrderCreateDate(date('Y-m-d H:i:s')) + ->withAddress($this->billingAddress, AddressType::BILLING) + ->withAddress($this->shippingAddress, AddressType::SHIPPING) + ->withBrowserData($this->browserData) + ->withMethodUrlCompletion(MethodUrlCompletion::NO) + + // optionals + ->withCustomerAccountId('6dcb24f5-74a0-4da3-98da-4f0aa0e88db3') + ->withAccountAgeIndicator(AgeIndicator::LESS_THAN_THIRTY_DAYS) + ->withAccountCreateDate('20190110') + ->withAccountChangeDate('20190128') + ->withAccountChangeIndicator(AgeIndicator::THIS_TRANSACTION) + ->withPasswordChangeDate('20190115') + ->withPasswordChangeIndicator(AgeIndicator::LESS_THAN_THIRTY_DAYS) + ->withHomeNumber('44', '123456798') + ->withWorkNumber('44', '1801555888') + ->withPaymentAccountCreateDate('20190101') + ->withPaymentAccountAgeIndicator(AgeIndicator::LESS_THAN_THIRTY_DAYS) + ->withPreviousSuspiciousActivity(false) + ->withNumberOfPurchasesInLastSixMonths(3) + ->withNumberOfTransactionsInLast24Hours(1) + ->withNumberOfTransactionsInLastYear(5) + ->withNumberOfAddCardAttemptsInLast24Hours(1) + ->withShippingAddressCreateDate('20190128') + ->withShippingAddressUsageIndicator(AgeIndicator::THIS_TRANSACTION) + + ->execute(); + $this->assertNotNull($initAuth); + + // get authentication data + $secureEcom = Secure3dService::getAuthenticationData() + ->withServerTransactionId($initAuth->serverTransactionId) + ->execute(); + $this->card->threeDSecure = $secureEcom; + + if ($secureEcom->status == 'AUTHENTICATION_SUCCESSFUL') { + $response = $this->card->charge(10.01) + ->withCurrency('USD') + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } else { + $this->fail('Signature verification failed.'); + } + } else { + $this->fail('Card not enrolled'); + } + } + + public function testOptionalPriorAuthenticationData() + { + $secureEcom = Secure3dService::checkEnrollment($this->card) + ->execute(Secure3dVersion::TWO); + $this->assertNotNull($secureEcom); + + if ($secureEcom->enrolled) { + $this->assertEquals(Secure3dVersion::TWO, $secureEcom->getVersion()); + + // initiate authentication + $initAuth = Secure3dService::initiateAuthentication($this->card, $secureEcom) + ->withAmount(250.00) + ->withCurrency('USD') + ->withOrderCreateDate(date('Y-m-d H:i:s')) + ->withAddress($this->billingAddress, AddressType::BILLING) + ->withAddress($this->shippingAddress, AddressType::SHIPPING) + ->withBrowserData($this->browserData) + ->withMethodUrlCompletion(MethodUrlCompletion::NO) + + // optionals + ->withPriorAuthenticationMethod(PriorAuthenticationMethod::FRICTIONLESS_AUTHENTICATION) + ->withPriorAuthenticationTransactionId('26c3f619-39a4-4040-bf1f-6fd433e6d615') + ->withPriorAuthenticationTimestamp((new \DateTime('2019-01-10T12:57:33.333Z'))->format(\DateTime::RFC3339_EXTENDED)) + + ->execute(); + $this->assertNotNull($initAuth); + + // get authentication data + $secureEcom = Secure3dService::getAuthenticationData() + ->withServerTransactionId($initAuth->serverTransactionId) + ->execute(); + $this->card->threeDSecure = $secureEcom; + + if ($secureEcom->status == 'AUTHENTICATION_SUCCESSFUL') { + $response = $this->card->charge(10.01) + ->withCurrency('USD') + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } else { + $this->fail('Signature verification failed.'); + } + } else { + $this->fail('Card not enrolled'); + } + } + + public function testOptionalRecurringData() + { + $secureEcom = Secure3dService::checkEnrollment($this->card) + ->execute(Secure3dVersion::TWO); + $this->assertNotNull($secureEcom); + + if ($secureEcom->enrolled) { + $this->assertEquals(Secure3dVersion::TWO, $secureEcom->getVersion()); + + // initiate authentication + $initAuth = Secure3dService::initiateAuthentication($this->card, $secureEcom) + ->withAmount(250.00) + ->withCurrency('USD') + ->withOrderCreateDate(date('Y-m-d H:i:s')) + ->withAddress($this->billingAddress, AddressType::BILLING) + ->withAddress($this->shippingAddress, AddressType::SHIPPING) + ->withBrowserData($this->browserData) + ->withMethodUrlCompletion(MethodUrlCompletion::NO) + + // optionals + ->withMaxNumberOfInstallments(5) + ->withRecurringAuthorizationFrequency(25) + ->withRecurringAuthorizationExpiryDate('20190825') + + ->execute(); + $this->assertNotNull($initAuth); + + // get authentication data + $secureEcom = Secure3dService::getAuthenticationData() + ->withServerTransactionId($initAuth->serverTransactionId) + ->execute(); + $this->card->threeDSecure = $secureEcom; + + if ($secureEcom->status == 'AUTHENTICATION_SUCCESSFUL') { + $response = $this->card->charge(10.01) + ->withCurrency('USD') + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } else { + $this->fail('Signature verification failed.'); + } + } else { + $this->fail('Card not enrolled'); + } + } + + public function testOptionalPayerLoginData() + { + $secureEcom = Secure3dService::checkEnrollment($this->card) + ->execute(Secure3dVersion::TWO); + $this->assertNotNull($secureEcom); + + if ($secureEcom->enrolled) { + $this->assertEquals(Secure3dVersion::TWO, $secureEcom->getVersion()); + + // initiate authentication + $initAuth = Secure3dService::initiateAuthentication($this->card, $secureEcom) + ->withAmount(250.00) + ->withCurrency('USD') + ->withOrderCreateDate(date('Y-m-d H:i:s')) + ->withAddress($this->billingAddress, AddressType::BILLING) + ->withAddress($this->shippingAddress, AddressType::SHIPPING) + ->withBrowserData($this->browserData) + ->withMethodUrlCompletion(MethodUrlCompletion::NO) + + // optionals + ->withCustomerAuthenticationData('string') + ->withCustomerAuthenticationTimestamp((new \DateTime('2019-01-10T12:57:33.333Z'))->format(\DateTime::RFC3339_EXTENDED)) + ->withCustomerAuthenticationMethod(CustomerAuthenticationMethod::MERCHANT_SYSTEM) + + ->execute(); + $this->assertNotNull($initAuth); + + // get authentication data + $secureEcom = Secure3dService::getAuthenticationData() + ->withServerTransactionId($initAuth->serverTransactionId) + ->execute(); + $this->card->threeDSecure = $secureEcom; + + if ($secureEcom->status == 'AUTHENTICATION_SUCCESSFUL') { + $response = $this->card->charge(10.01) + ->withCurrency('USD') + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } else { + $this->fail('Signature verification failed.'); + } + } else { + $this->fail('Card not enrolled'); + } + } + + public function testOptionalMobileFields() + { + $secureEcom = Secure3dService::checkEnrollment($this->card) + ->execute(Secure3dVersion::TWO); + $this->assertNotNull($secureEcom); + + if ($secureEcom->enrolled) { + $this->assertEquals(Secure3dVersion::TWO, $secureEcom->getVersion()); + + // initiate authentication + $initAuth = Secure3dService::initiateAuthentication($this->card, $secureEcom) + ->withAmount(250.00) + ->withCurrency('USD') + ->withOrderCreateDate(date('Y-m-d H:i:s')) + ->withAddress($this->billingAddress, AddressType::BILLING) + ->withAddress($this->shippingAddress, AddressType::SHIPPING) + ->withBrowserData($this->browserData) + ->withMethodUrlCompletion(MethodUrlCompletion::NO) + + // optionals + ->withApplicationId('f283b3ec-27da-42a1-acea-f3f70e75bbdc') + ->withSdkInterface(SdkInterface::BOTH) + ->withSdkUiTypes([SdkUiType::TEXT, SdkUiType::SINGLE_SELECT, SdkUiType::MULTI_SELECT, SdkUiType::OOB, SdkUiType::HTML_OTHER]) + ->withReferenceNumber('3DS_LOA_SDK_PPFU_020100_00007') + ->withSdkTransactionId('b2385523-a66c-4907-ac3c-91848e8c0067') + ->withEncodedData('ew0KCSJEViI6ICIxLjAiLA0KCSJERCI6IHsNCgkJIkMwMDEiOiAiQW5kcm9pZCIsDQoJCSJDMDAyIjogIkhUQyBPbmVfTTgiLA0KCQkiQzAwNCI6ICI1LjAuMSIsDQoJCSJDMDA1IjogImVuX1VTIiwNCgkJIkMwMDYiOiAiRWFzdGVybiBTdGFuZGFyZCBUaW1lIiwNCgkJIkMwMDciOiAiMDY3OTc5MDMtZmI2MS00MWVkLTk0YzItNGQyYjc0ZTI3ZDE4IiwNCgkJIkMwMDkiOiAiSm9obidzIEFuZHJvaWQgRGV2aWNlIg0KCX0sDQoJIkRQTkEiOiB7DQoJCSJDMDEwIjogIlJFMDEiLA0KCQkiQzAxMSI6ICJSRTAzIg0KCX0sDQoJIlNXIjogWyJTVzAxIiwgIlNXMDQiXQ0KfQ0K') + + ->execute(); + $this->assertNotNull($initAuth); + + // get authentication data + $secureEcom = Secure3dService::getAuthenticationData() + ->withServerTransactionId($initAuth->serverTransactionId) + ->execute(); + $this->card->threeDSecure = $secureEcom; + + if ($secureEcom->status == 'AUTHENTICATION_SUCCESSFUL') { + $response = $this->card->charge(10.01) + ->withCurrency('USD') + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + } else { + $this->fail('Signature verification failed.'); + } + } else { + $this->fail('Card not enrolled'); + } + } + + public function testCheckVersion_Not_Enrolled() + { + $card = new CreditCardData(); + $card->number = 4012001037141112; + $card->expMonth = 12; + $card->expYear = 2025; + $secureEcom = Secure3dService::checkEnrollment($card) + ->execute(Secure3dVersion::ANY); + $this->assertNotNull($secureEcom); + $this->assertFalse((bool)$secureEcom->enrolled); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + */ + // public function testCheckVersion_Not_ISecure3d() + // { + // $secureEcom = Secure3dService::checkEnrollment(new DebitTrackData) + // ->execute(Secure3dVersion::ANY); + // $this->assertNotNull($secureEcom); + // } +} \ No newline at end of file diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/ThreeDSecureAcsClient.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/ThreeDSecureAcsClient.php new file mode 100644 index 0000000..543dc23 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/RealexConnector/ThreeDSecureAcsClient.php @@ -0,0 +1,116 @@ +serviceUrl = $url; + } + + /** + * @return AcsResponse + */ + public function authenticate($payerAuthRequest, $merchantData = '') + { + $kvps = []; + array_push($kvps, array('key'=>'PaReq', 'value'=>$payerAuthRequest)); + array_push($kvps, array('key'=>'TermUrl', 'value'=>'https://www.mywebsite.com/process3dSecure')); + array_push($kvps, array('key'=>'MD', 'value'=>$merchantData)); + + $rawResponse = ''; + try { + $postData = $this->buildData($kvps); + + $request = curl_init(); + + curl_setopt_array($request, array( + CURLOPT_URL => $this->serviceUrl, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "POST", + CURLOPT_POSTFIELDS => $postData, + CURLOPT_HTTPHEADER => array( + "Content-Type: application/x-www-form-urlencoded; charset=UTF-8", + "cache-control: no-cache" + ), + )); + + $rawResponse = curl_exec($request); + $curlInfo = curl_getinfo($request); + $err = curl_error($request); + + curl_close($request); + + if ($curlInfo['http_code'] != 200) { + throw new ApiException(sprintf('Acs request failed with response code: %s', $curlInfo['http_code'])); + } + } catch (Exception $exc) { + throw new ApiException($exc); + } + + $rValue = new AcsResponse(); + $rValue->setAuthResponse($this->getInputValue($rawResponse, 'PaRes')); + $rValue->setMerchantData($this->getInputValue($rawResponse, 'MD')); + + return $rValue; + } + + /** + * @return string + */ + private function buildData($kvps) + { + $result = ''; + $first = true; + foreach ($kvps as $kvp) { + if ($first) { + $first = false; + } else { + $result .= '&'; + } + + $result .= urlencode($kvp['key']); + $result .= '='; + $result .= urlencode($kvp['value']); + } + + return $result; + } + + /** + * @return string + */ + private function getInputValue($raw, $inputValue) + { + if ($raw == null) { + return null; + } + + $searchString = sprintf('NAME="%s" VALUE="', $inputValue); + + $index = strpos($raw, $searchString); + + if ($index > -1) { + $index = $index + strlen($searchString); + + $length = strpos(substr($raw, $index), '"'); + + return substr($raw, $index, $length); + } + return null; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/HpaAdminTests.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/HpaAdminTests.php new file mode 100644 index 0000000..8e67c8a --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/HpaAdminTests.php @@ -0,0 +1,361 @@ +device = DeviceService::create($this->getConfig()); + } + + public function tearDown() + { + sleep(3); + $this->device->reset(); + } + + protected function getConfig() + { + $config = new ConnectionConfig(); + $config->ipAddress = '10.138.141.5'; + $config->port = '12345'; + $config->deviceType = DeviceType::HPA_ISC250; + $config->connectionMode = ConnectionModes::TCP_IP; + $config->timeout = 300; + $config->requestIdProvider = new RequestIdProvider(); + + return $config; + } + + public function testCancel() + { + $response = $this->device->cancel(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + $this->assertEquals('Reset', $response->response); + } + + public function testIntialize() + { + $this->device->closeLane(); + $response = $this->device->initialize(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + $this->assertNotNull($response->responseData['initializeResponse']); + + $deviceInformation = $response->responseData['initializeResponse']; + $this->assertEquals('HeartSIP', $deviceInformation['application']); + } + + public function testOpenLane() + { + $response = $this->device->openLane(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testCloseLane() + { + $response = $this->device->closeLane(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testReset() + { + $response = $this->device->reset(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + $this->assertEquals('Reset', $response->response); + } + + public function testReboot() + { + $this->markTestSkipped('Reboot skipped'); + + $response = $this->device->reboot(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + $this->assertEquals('Reboot', $response->response); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException + * @expectedExceptionMessage Unexpected Gateway Response: 1502 - CANNOT PROCESS IN LANE OPEN STATE + */ + public function testLaneOpenIntialize() + { + //open the lane + $response = $this->device->openLane(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + $response = $this->device->initialize(); + } + + public function testEod() + { + $this->device->reset(); + $this->device->closeLane(); + + $response = $this->device->eod(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + $this->assertNotNull($response->reversal); + $this->assertNotNull($response->emvOfflineDecline); + $this->assertNotNull($response->transactionCertificate); + $this->assertNotNull($response->attachment); + $this->assertNotNull($response->sendSAF); + $this->assertNotNull($response->batchClose); + $this->assertNotNull($response->heartBeat); + $this->assertNotNull($response->eMVPDL); + + $this->assertNotNull($response->responseData); + $this->assertNotNull($response->responseData['getBatchReport']['batchSummary']); + $this->assertNotNull($response->responseData['getBatchReport']['batchReport']); + $this->assertNotNull($response->responseData['getBatchReport']['batchDetail']); + } + + public function testStartDownload() + { + $this->markTestSkipped('StartDownload skipped'); + + $deviceSettings = new DeviceSettings(); + $deviceSettings->terminalId = 'EB25033M'; + $deviceSettings->applicationId = 'PI8HD33M'; + $deviceSettings->downloadType = DownloadType::FULL; + $deviceSettings->downloadTime = DownloadTime::NOW; + $deviceSettings->hudsUrl = DownloadEnvironment::DEVELOPMENT; + $deviceSettings->hudsPort = 8001; + + $response = $this->device->startDownload($deviceSettings); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testPartialStartDownload() + { + $this->markTestSkipped('StartDownload skipped'); + + $deviceSettings = new DeviceSettings(); + $deviceSettings->terminalId = 'EB25033M'; + $deviceSettings->applicationId = 'PI8HD33M'; + $deviceSettings->downloadType = DownloadType::PARTIAL; + $deviceSettings->downloadTime = DownloadTime::NOW; + $deviceSettings->hudsUrl = DownloadEnvironment::DEVELOPMENT; + $deviceSettings->hudsPort = 8001; + + $response = $this->device->startDownload($deviceSettings); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testEndOfDayStartDownload() + { + $this->markTestSkipped('StartDownload skipped'); + + $deviceSettings = new DeviceSettings(); + $deviceSettings->terminalId = 'EB25033M'; + $deviceSettings->applicationId = 'PI8HD33M'; + $deviceSettings->downloadType = DownloadType::FULL; + $deviceSettings->downloadTime = DownloadTime::EOD; + $deviceSettings->hudsUrl = DownloadEnvironment::DEVELOPMENT; + $deviceSettings->hudsPort = 8001; + + $response = $this->device->startDownload($deviceSettings); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testCustomStartDownload() + { + $this->markTestSkipped('StartDownload skipped'); + + $deviceSettings = new DeviceSettings(); + $deviceSettings->terminalId = 'EB25033M'; + $deviceSettings->applicationId = 'PI8HD33M'; + $deviceSettings->downloadType = DownloadType::FULL; + $deviceSettings->downloadTime = date('YmdHis'); + $deviceSettings->hudsUrl = DownloadEnvironment::DEVELOPMENT; + $deviceSettings->hudsPort = 8001; + + $response = $this->device->startDownload($deviceSettings); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testLineItem() + { + $lineItemDetails = new LineItem(); + $lineItemDetails->leftText = 'Green Beans, canned'; + $lineItemDetails->rightText = '$0.59'; + $lineItemDetails->runningLeftText = 'TOTAL'; + $lineItemDetails->runningRightText = '$1.19'; + + $this->device->openLane(); + $response = $this->device->lineItem($lineItemDetails); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage Line item left text cannot be null + */ + public function testLineItemLeftext() + { + $lineItemDetails = new LineItem(); + $response = $this->device->lineItem($lineItemDetails); + } + + public function testEnableSafMode() + { + $response = $this->device->setSafMode(1); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testDisableSafMode() + { + $response = $this->device->setSafMode(3); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testSendSaf() + { + $response = $this->device->sendSaf(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + $this->assertNotNull($response->responseData); + $this->assertNotNull($response->responseData['sendSAF']); + $this->assertNotNull($response->responseData['sendSAF']['approvedSafSummary']); + $this->assertNotNull($response->responseData['sendSAF']['pendingSafSummary']); + $this->assertNotNull($response->responseData['sendSAF']['declinedSafSummary']); + $this->assertNotNull($response->responseData['sendSAF']['offlineApprovedSafSummary']); + $this->assertNotNull($response->responseData['sendSAF']['partiallyApprovedSafSummary']); + $this->assertNotNull($response->responseData['sendSAF']['approvedSafVoidSummary']); + } + + /* + * Note: This sample banner will take 25 minutes to upload. + * Timeout should be handled accordingly + */ + public function testSendFileBanner() + { + $sendFileInfo = new SendFileData(); + $sendFileInfo->imageLocation = dirname(__FILE__) . '/sampleimages/hpa_banner_iSC250_60_480.jpg'; + $sendFileInfo->imageType = HpaSendFileType::BANNER; + + $response = $this->device->sendFile($sendFileInfo); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + /* + * Note: This sample logo will take 20 minutes to upload. + * Timeout should be handled accordingly + */ + public function testSendFileIdleLogo() + { + $sendFileInfo = new SendFileData(); + $sendFileInfo->imageLocation = dirname(__FILE__) . '/sampleimages/hpa_logo_iSC250_272_480.jpg'; + $sendFileInfo->imageType = HpaSendFileType::IDLELOGO; + + $response = $this->device->sendFile($sendFileInfo); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage Input error: Image location / type missing + */ + public function testFileInputError() + { + $sendFileInfo = new SendFileData(); + $this->device->sendFile($sendFileInfo); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage Incorrect file height and width + */ + public function testIncorrectFileSize() + { + $sendFileInfo = new SendFileData(); + $sendFileInfo->imageLocation = dirname(__FILE__) . '/sampleimages/image_500_500.jpg'; + $sendFileInfo->imageType = HpaSendFileType::BANNER; + + $this->device->sendFile($sendFileInfo); + } + + public function testGetDiagnosticReport() + { + $response = $this->device->getDiagnosticReport(30); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + $this->assertNotNull($response->responseData); + $this->assertNotNull($response->responseData['getDiagnosticReport']); + } + + public function testPromptForSignature() + { + $this->device->openLane(); + $response = $this->device->promptForSignature(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + $this->assertNotNull($response->signatureData); + } + + public function testGetLastResponse() + { + $this->device->openLane(); + $response = $this->device->getLastResponse(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + $this->assertNotNull($response->lastResponse); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/HpaCreditTests.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/HpaCreditTests.php new file mode 100644 index 0000000..4c83cee --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/HpaCreditTests.php @@ -0,0 +1,225 @@ +device = DeviceService::create($this->getConfig()); + + //open lane for credit transactions + $this->device->openLane(); + } + + public function tearDown() + { + $this->waitAndReset(); + } + + protected function getConfig() + { + $config = new ConnectionConfig(); + $config->ipAddress = '10.138.141.20'; + $config->port = '12345'; + $config->deviceType = DeviceType::HPA_ISC250; + $config->connectionMode = ConnectionModes::TCP_IP; + $config->timeout = 180; + $config->requestIdProvider = new RequestIdProvider(); + + return $config; + } + + public function waitAndReset() + { + sleep(3); + $this->device->reset(); + } + + public function testCreditSale() + { + $response = $this->device->creditSale(10) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + $this->assertNotNull($response->transactionId); + } + + public function testCreditAuth() + { + $response = $this->device->creditAuth(10) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + $this->assertNotNull($response->transactionId); + } + + public function testCreditCapture() + { + $authResponse = $this->device->creditAuth(15) + ->execute(); + + $this->assertNotNull($authResponse); + $this->assertEquals('0', $authResponse->resultCode); + $this->assertNotNull($authResponse->transactionId); + + $this->waitAndReset(); + + $response = $this->device->creditCapture(15) + ->withTransactionId($authResponse->transactionId) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testCreditVoid() + { + $saleResponse = $this->device->creditSale(10) + ->execute(); + + $this->assertNotNull($saleResponse); + $this->assertEquals('0', $saleResponse->resultCode); + $this->assertNotNull($saleResponse->transactionId); + + $this->waitAndReset(); + + $response = $this->device->creditVoid() + ->withTransactionId($saleResponse->transactionId) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testCreditRefundByCard() + { + $response = $this->device->creditRefund(15) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testCreditVerify() + { + $response = $this->device->creditVerify() + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage amount cannot be null for this transaction type + */ + public function testSaleWithoutAmount() + { + $response = $this->device->creditSale() + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage amount cannot be null for this transaction type + */ + public function testAuthWithoutAmount() + { + $response = $this->device->creditAuth() + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage amount cannot be null for this transaction type + */ + public function testCaptureWithoutAmount() + { + $response = $this->device->creditCapture() + ->withTransactionId(1234) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage amount cannot be null for this transaction type + */ + public function testRefundWithoutAmount() + { + $response = $this->device->creditRefund() + ->withTransactionId(1234) + ->execute(); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage transactionId cannot be null for this transaction type + */ + public function testCaptureWithoutTransactionId() + { + $response = $this->device->creditCapture(10) + ->execute(); + } + + public function testSaleStartCard() + { + $response = $this->device->startCard(PaymentMethodType::CREDIT); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + $response = $this->device->creditSale(15) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + $this->assertNotNull($response->transactionId); + } + + public function testLostTransaction() + { + $requestIdProvider = new RequestIdProvider(); + $requestId = $requestIdProvider->getRequestId(); + + $response = $this->device->creditSale(10) + ->withRequestId($requestId) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + $this->waitAndReset(); + + $lostResponse = $this->device->creditSale(10) + ->withRequestId($requestId) + ->execute(); + + $this->assertNotNull($lostResponse); + $this->assertEquals('0', $lostResponse->resultCode); + $this->assertEquals($requestId, $lostResponse->requestId); + $this->assertEquals('1', $lostResponse->isStoredResponse); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/HpaDebitTests.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/HpaDebitTests.php new file mode 100644 index 0000000..f76dffb --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/HpaDebitTests.php @@ -0,0 +1,119 @@ +device = DeviceService::create($this->getConfig()); + + //open lane for Debit transactions + $this->device->openLane(); + } + + public function tearDown() + { + $this->waitAndReset(); + } + + protected function getConfig() + { + $config = new ConnectionConfig(); + $config->ipAddress = '10.138.141.7'; + $config->port = '12345'; + $config->deviceType = DeviceType::HPA_ISC250; + $config->connectionMode = ConnectionModes::TCP_IP; + $config->timeout = 60; + $config->requestIdProvider = new RequestIdProvider(); + + return $config; + } + + public function waitAndReset() + { + sleep(3); + $this->device->reset(); + } + + public function testDebitSale() + { + $response = $this->device->debitSale(10) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + $this->assertNotNull($response->transactionId); + } + + public function testDebitRefund() + { + $saleResponse = $this->device->debitSale(15) + ->execute(); + + $this->assertNotNull($saleResponse); + $this->assertEquals('0', $saleResponse->resultCode); + $this->assertNotNull($saleResponse->transactionId); + + $this->waitAndReset(); + + $response = $this->device->debitRefund(15) + ->withTransactionId($saleResponse->transactionId) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage amount cannot be null for this transaction type + */ + public function testSaleWithoutAmount() + { + $response = $this->device->debitSale() + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage amount cannot be null for this transaction type + */ + public function testRefundWithoutAmount() + { + $response = $this->device->debitRefund() + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testSaleStartCard() + { + $response = $this->device->startCard(PaymentMethodType::DEBIT); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + $response = $this->device->debitSale(15) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + $this->assertNotNull($response->transactionId); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/HpaEbtTests.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/HpaEbtTests.php new file mode 100644 index 0000000..e850538 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/HpaEbtTests.php @@ -0,0 +1,102 @@ +device = DeviceService::create($this->getConfig()); + + //open lane for EBT transactions + $this->device->openLane(); + } + + public function tearDown() + { + $this->waitAndReset(); + } + + protected function getConfig() + { + $config = new ConnectionConfig(); + $config->ipAddress = '10.138.141.7'; + $config->port = '12345'; + $config->deviceType = DeviceType::HPA_ISC250; + $config->connectionMode = ConnectionModes::TCP_IP; + $config->timeout = 180; + $config->requestIdProvider = new RequestIdProvider(); + + return $config; + } + + public function waitAndReset() + { + sleep(3); + $this->device->reset(); + } + + public function testEbtBalance() + { + $response = $this->device->ebtBalance() + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testEbtPurchase() + { + $saleResponse = $this->device->ebtPurchase(10) + ->execute(); + + $this->assertNotNull($saleResponse); + $this->assertEquals('0', $saleResponse->resultCode); + $this->assertNotNull($saleResponse->transactionId); + } + + public function testEbtRefund() + { + $saleResponse = $this->device->ebtPurchase(15) + ->execute(); + + $this->assertNotNull($saleResponse); + $this->assertEquals('0', $saleResponse->resultCode); + $this->assertNotNull($saleResponse->transactionId); + + $this->waitAndReset(); + + $response = $this->device->ebtRefund(15) + ->withTransactionId($saleResponse->transactionId) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testSaleStartCard() + { + $response = $this->device->startCard(PaymentMethodType::EBT); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + $response = $this->device->ebtPurchase(15) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + $this->assertNotNull($response->transactionId); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/HpaGiftTests.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/HpaGiftTests.php new file mode 100644 index 0000000..ea81039 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/HpaGiftTests.php @@ -0,0 +1,150 @@ +device = DeviceService::create($this->getConfig()); + + //open lane for EBT transactions + $this->device->openLane(); + } + + public function tearDown() + { + $this->waitAndReset(); + } + + protected function getConfig() + { + $config = new ConnectionConfig(); + $config->ipAddress = '10.138.141.7'; + $config->port = '12345'; + $config->deviceType = DeviceType::HPA_ISC250; + $config->connectionMode = ConnectionModes::TCP_IP; + $config->timeout = 180; + $config->requestIdProvider = new RequestIdProvider(); + + return $config; + } + + public function waitAndReset() + { + sleep(3); + $this->device->reset(); + } + + public function testGiftSale() + { + $response = $this->device->giftSale(100) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testLoyaltySale() + { + $response = $this->device->giftSale(100) + ->withCurrency(CurrencyType::POINTS) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testGiftAddValue() + { + $response = $this->device->giftAddValue(100) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testLoyaltyAddValue() + { + $response = $this->device->giftAddValue(100) + ->withCurrency(CurrencyType::POINTS) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testGiftVoid() + { + $responseSale = $this->device->giftSale(100) + ->execute(); + + $this->assertNotNull($responseSale); + $this->assertEquals('0', $responseSale->resultCode); + + $this->waitAndReset(); + + $response = $this->device->giftVoid() + ->withTransactionId($responseSale->transactionId) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testGiftBalance() + { + $response = $this->device->giftBalance() + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + public function testLoyaltyBalance() + { + $response = $this->device->giftBalance() + ->withCurrency(CurrencyType::POINTS) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage amount cannot be null for this transaction type + */ + public function testAddValueWithoutAmount() + { + $this->device->giftAddValue() + ->execute(); + } + + public function testSaleStartCard() + { + $response = $this->device->startCard(PaymentMethodType::GIFT); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + $response = $this->device->giftSale(100) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + $this->assertNotNull($response->transactionId); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/sampleimages/hpa_banner_iSC250_60_480.jpg b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/sampleimages/hpa_banner_iSC250_60_480.jpg new file mode 100644 index 0000000..2e87b19 Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/sampleimages/hpa_banner_iSC250_60_480.jpg differ diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/sampleimages/hpa_logo_iSC250_272_480.jpg b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/sampleimages/hpa_logo_iSC250_272_480.jpg new file mode 100644 index 0000000..339091a Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/sampleimages/hpa_logo_iSC250_272_480.jpg differ diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/sampleimages/image_500_500.jpg b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/sampleimages/image_500_500.jpg new file mode 100644 index 0000000..db5f5a3 Binary files /dev/null and b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/sampleimages/image_500_500.jpg differ diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/vrf/HpaVerificationTests.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/vrf/HpaVerificationTests.php new file mode 100644 index 0000000..b046648 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/HPA/vrf/HpaVerificationTests.php @@ -0,0 +1,456 @@ +device = DeviceService::create($this->getConfig()); + + //open lane for credit transactions + $this->device->openLane(); + } + + protected function getConfig() + { + $config = new ConnectionConfig(); + $config->ipAddress = '10.138.141.5'; + $config->port = '12345'; + $config->deviceType = DeviceType::HPA_ISC250; + $config->connectionMode = ConnectionModes::TCP_IP; + $config->timeout = 300; + $config->requestIdProvider = new RequestIdProvider(); + + return $config; + } + + public function tearDown() + { + sleep(3); + $this->device->reset(); + } + + private function printReceipt($response) + { + $receipt = "x_trans_type=" . $response->response; + $receipt .= "&x_application_label=" . $response->emvApplicationName; + $receipt .= "&x_masked_card=" . $response->maskedCardNumber; + $receipt .= "&x_application_id=" . $response->emvApplicationId; + $receipt .= "&x_cryptogram_type=" . $response->emvCryptogramType; + $receipt .= "&x_application_cryptogram=" . $response->emvCryptogram; + $receipt .= "&x_expiration_date=" . $response->expirationDate; + $receipt .= "&x_entry_method=" . $response->entryMethod; + $receipt .= "&x_approval=" . $response->approvalCode; + $receipt .= "&x_transaction_amount=" . $response->transactionAmount; + $receipt .= "&x_amount_due=" . $response->balanceAmountDue; + $receipt .= "&x_customer_verification_method=" . $response->emvCardHolderVerificationMethod; + $receipt .= "&x_response_text=" . $response->responseText; + $receipt .= "&x_signature_status=" . $response->signatureStatus; + print($receipt); + } + + /* + TEST CASE #1 – Contact Chip and Signature – Offline + Objective Process a contact transaction where the CVM’s supported are offline chip and signature + Test Card Card #1 - MasterCard EMV + Procedure Perform a complete transaction without error.. + Enter transaction amount $23.00. + */ + + public function testCase01() + { + $response = $this->device->creditSale(23) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + print("Response: " . print_r($response, true)); + print("Gateway Txn ID: " . $response->transactionId); + + $this->printReceipt($response); + } + + /* + TEST CASE #2 - EMV Receipts + Objective 1. Verify receipt image conforms to EMV Receipt Requirements. + 2. Verify that signature capture functionality works. + Test Card Any card brand – Visa, MC, Discover, AMEX. + Procedure Run an EMV insert sale using any card brand. + The device should get an Approval. + Cardholder is prompted to sign on the device. + */ + + public function testCase02() + { + // print receipt for TestCase01 + $this->testCase01(); + } + + /* + TEST CASE #3 - Approved Sale with Offline PIN + Objective Process an EMV contact sale with offline PIN. + Test Card Card #1 - MasterCard EMV + Procedure Insert the card in the chip reader and follow the instructions on the device. + Enter transaction amount $25.00. + When prompted for PIN, enter 4315. + If no PIN prompt, device could be in QPS mode with limit above transaction amount. + */ + + public function testCase03() + { + $response = $this->device->creditSale(25) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + print("Response: " . print_r($response, true)); + print("Gateway Txn ID: " . $response->transactionId); + + $this->printReceipt($response); + } + + /* + TEST CASE #4 - Manually Entered Sale with AVS & CVV2/CID (If AVS is supported) + Objective Process a keyed sale, with PAN & exp date, along with Address Verification + and Card Security Code to confirm the application can support any or all of these. + Test Card Card #5 – MSD only MasterCard + Procedure 1. Select sale function and manually key Test Card #5 for the amount of $90.08. + a. Enter PAN & expiration date. + b. Enter 321 for Card Security Code (CVV2, CID), if supporting this feature. + Enter 76321 for AVS, if supporting this feature. + */ + + public function testCase04() + { + $response = $this->device->creditSale(90.08) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + $this->assertEquals("Zip and address match.", $response->avsResponseText); + $this->assertEquals("Not Processed.", $response->cvvResponseText); + + print("Response: " . print_r($response, true)); + print("Gateway Txn ID: " . $response->transactionId); + + $this->printReceipt($response); + } + + /* + TEST CASE #5 - Partial Approval + Objective 1. Ensure application can handle non-EMV swiped transactions. + 2. Validate partial approval support. + Test Card Card #4 – MSD only Visa + Procedure Run a credit sale and follow the instructions on the device to complete the transaction. + Enter transaction amount $155.00 to receive a partial approval. + Transaction is partially approved online with an amount due remaining. + */ + + public function testCase05() + { + $response = $this->device->creditSale(155) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals("10", $response->responseCode); + $this->assertEquals(55, $response->balanceAmountDue); + + print("Response: " . print_r($response, true)); + print("Gateway Txn ID: " . $response->transactionId); + + $this->printReceipt($response); + } + + /* + TEST CASE #6 - Online Void + Objective Process an online void. + Test Card Card #3 – EMV Visa w/ Signature CVM + Procedure Enter the Transaction ID to void. + Pass Criteria Transaction has been voided. + */ + + public function testCase06() + { + $response = $this->device->creditSale(10) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + $this->device->reset(); + + $voidResponse = $this->device->creditVoid() + ->withTransactionId($response->transactionId) + ->execute(); + + $this->assertNotNull($voidResponse); + $this->assertEquals("00", $voidResponse->responseCode); + + print("Response: " . print_r($voidResponse, true)); + print("Gateway Txn ID: " . $voidResponse->transactionId); + } + + /* + TEST CASE #7 - Debit Sale (with Cash Back) & Debit Void + Objective Confirm support of PIN debit sale, cash back, and debit void. + Test Card Confirm support of PIN debit sale, cash back, and debit void. + Procedure Debit Sale with Cash Back: + Run a debit sale for $10.00 and follow the instructions on the device to complete the transaction. + When prompted for Cash Back, enter $5.00 for the cash back amount. + When prompted for PIN, enter 1234. + Transaction is approved online. + + Void: + Enter the Transaction ID to void. + Transaction has been voided. + + Pass Criteria The transaction is approved online. + The transaction has been voided. + */ + + /** + * @expectedException GlobalPayments\Api\Entities\Exceptions\UnsupportedTransactionException + */ + public function testCase07() + { + $response = $this->device->debitSale(10) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + print("Response: " . print_r($response, true)); + print("Gateway Txn ID: " . $response->transactionId); + + $voidResponse = $this->device->debitVoid() + ->withTransactionId($response->transactionId) + ->execute(); + } + + /* + TEST CASE #8 – Process Lane Open on SIP + Objective Display line items on the SIP. + Test Card NA + Procedure Start the process to open a lane on the POS. + */ + + public function testCase08() + { + $response = $this->device->openLane(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + } + + /* + TEST CASE #9 – Credit Return + Objective Confirm support of a Return transaction for credit. + Test Card Card #4 – MSD only Visa + Procedure 1. Select return function for the amount of $9.00 + 2. Swipe or Key Test card #4 through the MSR + 3. Select credit on the device + */ + + public function testCase09() + { + $response = $this->device->creditRefund(9) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + print("Response: " . print_r($response, true)); + print("Gateway Txn ID: " . $response->transactionId); + } + + /* + TEST CASE #10 – HMS Gift + Objective Transactions: Gift Balance Inquiry, Gift Load, Gift Sale/Redeem, Gift Replace + Test Card Gift Card (Card Present/Card Swipe) + Procedure Test System is a Stateless Environment, the responses are Static. + 1. Gift Balance Inquiry (GiftCardBalance): + a. Should respond with a BalanceAmt of $10 + 2. Gift Load (GiftCardAddValue): + a. Initiate a Sale and swipe + b. Enter $8.00 as the amount + 3. Gift Sale/Redeem (GiftCardSale): + a. Initiate a Sale and swipe + b. Enter $1.00 as the amount + 4. Gift Card Replace (GiftCardReplace) + a. Initiate a Gift Card Replace + b. Swipe Card #1 – (Acct #: 5022440000000000098) + c. Manually enter Card #2 – (Acct #: “5022440000000000007”) + */ + public function testCase10a() + { + $response = $this->device->giftBalance() + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + $this->assertEquals('10', $response->availableBalance); + + print("Response: " . print_r($response, true)); + print("Gateway Txn ID: " . $response->transactionId); + } + + public function testCase10b() + { + $response = $this->device->giftAddValue(8) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + print("Response: " . print_r($response, true)); + print("Gateway Txn ID: " . $response->transactionId); + } + + public function testCase10c() + { + $response = $this->device->giftSale(1) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + print("Response: " . print_r($response, true)); + print("Gateway Txn ID: " . $response->transactionId); + } + + /* + TEST CASE #11 – EBT Food Stamp + Objective Transactions: Food Stamp Purchase, Food Stamp Return and Food Stamp Balance Inquiry + Test Card Card #4 – MSD only Visa + Procedure Test System is a Stateless Environment, the responses are Static. + 5. Food Stamp Purchase (EBTFSPurchase): + c. Initiate an EBT sale transaction and swipe Test Card #4 + d. Select EBT Food Stamp if prompted. + e. Enter $101.01 as the amount + 6. Food Stamp Return (EBTFSReturn): + b. Intitiate an EBT return and manually enter Test Card #4 + c. Select EBT Food Stamp if prompted + d. Enter $104.01 as the amount + 7. Food Stamp Balance Inquiry (EBTBalanceInquiry): + c. Initiate an EBT blance inquiry transaction and swipe Test Card #4 Settle all transactions. + */ + + public function testCase11a() + { + $response = $this->device->ebtPurchase(101.01) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + print("Response: " . print_r($response, true)); + print("Gateway Txn ID: " . $response->transactionId); + } + + public function testCase11b() + { + $response = $this->device->ebtRefund(104.01) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + print("Response: " . print_r($response, true)); + print("Gateway Txn ID: " . $response->transactionId); + } + + public function testCase11c() + { + $response = $this->device->ebtBalance() + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + print("Response: " . print_r($response, true)); + print("Gateway Txn ID: " . $response->transactionId); + } + + /* + TEST CASE #12 – EBT Cash Benefits + Objective Transactions: EBT Cash Benefits with Cash Back, EBT Cash Benefits Balance Inquiry +and EBT Cash Benefits Withdraw + Test Card Card #4 – MSD only Visa + Procedure + 1. EBT Cash Benefits w Cash Back (EBTCashBackPurchase): + a. Initiate an EBT sale transaction and swipe Test Card #4 + b. Select EBT Cash Benefits if prompted + c. Enter $101.01 as the amount + d. Enter $5.00 as the cash back amount + e. The settlement amount is $106.01 + 2. EBT Cash Benefits Balance Inquiry (EBTBalanceInquiry): + a. Initiate an EBT cash benefit balance inquiry transaction and swipe Test Card #4 + 3. EBT Cash Benefits Withdraw (EBTCashBenefitWithdrawal): + a. Initiate an EBT cash benefits withdraw transaction and manually +enter Test Card #4. + b. Select EBT Cash Benefits Withdraw if prompted + c. Enter $111.01 as the amount + d. The settlement amount is $111.01 + e. Settle all transactions + */ + + public function testCase12a() + { + $response = $this->device->ebtPurchase(101.01) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + print("Response: " . print_r($response, true)); + print("Gateway Txn ID: " . $response->transactionId); + } + + public function testCase12b() + { + $response = $this->device->ebtBalance() + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('0', $response->resultCode); + + print("Response: " . print_r($response, true)); + print("Gateway Txn ID: " . $response->transactionId); + } + + /* + TEST CASE #13 – Batch Close + (Mandatory if Conditional Test Cases are ran) + Objective Close the batch, ensuring all approved transactions (offline or online) are settled. + Integrators are automatically provided accounts with auto-close enabled, so if manual batch transmission + will not be performed in the production environment then it does not need to be tested. + Test Card N/A + Procedure Initiate a Batch Close command + Pass Criteria Batch submission must be successful. + Batch Sequence #: + References  HPA Specifications. + */ + public function testCase13() + { + $this->device->closeLane(); + $this->device->reset(); + + $response = $this->device->batchClose(); + $this->assertNotNull($response); + + $this->assertEquals('0', $response->resultCode); + + print("Response: " . print_r($response, true)); + print("Gateway Txn ID: " . $response->transactionId); + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/RequestIdProvider.php b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/RequestIdProvider.php new file mode 100644 index 0000000..552b8ed --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Integration/Gateways/Terminals/RequestIdProvider.php @@ -0,0 +1,14 @@ +number = '4111111111111111'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '123'; + $card->cardHolderName = 'Joe Smith'; + $this->card = $card; + + ServicesContainer::configure($this->getConfig()); + } + + /** + * @expectedException \GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage amount cannot be null for this transaction type. + */ + public function testCreditAuthNoAmount() + { + $this->card->authorize() + ->execute(); + } + + /** + * @expectedException \GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage currency cannot be null + */ + public function testCreditAuthNoCurrency() + { + $this->card->authorize(14) + ->execute(); + } + + /** + * @expectedException \GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage paymentMethod cannot be null + */ + public function testCreditAuthNoPaymentMethod() + { + $this->card->authorize(14) + ->withCurrency('USD') + ->withPaymentMethod(null) + ->execute(); + } + + /** + * @expectedException \GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage amount cannot be null + */ + public function testCreditSaleNoAmount() + { + $this->card->charge() + ->execute(); + } + + /** + * @expectedException \GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage currency cannot be null + */ + public function testCreditSaleNoCurrency() + { + $this->card->charge(14) + ->execute(); + } + + /** + * @expectedException \GlobalPayments\Api\Entities\Exceptions\BuilderException + * @expectedExceptionMessage paymentMethod cannot be null + */ + public function testCreditSaleNoPaymentMethod() + { + $this->card->charge(14) + ->withCurrency('USD') + ->withPaymentMethod(null) + ->execute(); + } + + protected function getConfig() + { + $config = new ServicesConfig(); + $config->secretApiKey = 'skapi_cert_MTeSAQAfG1UA9qQDrzl-kz4toXvARyieptFwSKP24w'; + $config->serviceUrl = ($this->enableCryptoUrl) ? + 'https://cert.api2-c.heartlandportico.com/': + 'https://cert.api2.heartlandportico.com'; + return $config; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/Unit/Gateways/RealexConnector/CreditTest.php b/lib/vendor/globalpayments/php-sdk/test/Unit/Gateways/RealexConnector/CreditTest.php new file mode 100644 index 0000000..3530166 --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/Unit/Gateways/RealexConnector/CreditTest.php @@ -0,0 +1,47 @@ +number = '4111111111111111'; + $card->expMonth = 12; + $card->expYear = 2025; + $card->cvn = '123'; + $card->cardHolderName = 'Joe Smith'; + $this->card = $card; + + ServicesContainer::configure($this->getConfig()); + } + + /** + * @expectedException \GlobalPayments\Api\Entities\Exceptions\UnsupportedTransactionException + * @expectedExceptionMessage selected gateway does not support this transaction type + */ + public function testCreditReverse() + { + $this->card->reverse(15) + ->withAllowDuplicates(true) + ->execute(); + } + + protected function getConfig() + { + $config = new ServicesConfig(); + $config->merchantId = 'realexsandbox'; + $config->accountId = 'internet'; + $config->sharedSecret = 'Po8lRRT67a'; + $config->serviceUrl = 'https://test.realexpayments.com/epage-remote.cgi'; + return $config; + } +} diff --git a/lib/vendor/globalpayments/php-sdk/test/setup.php b/lib/vendor/globalpayments/php-sdk/test/setup.php new file mode 100644 index 0000000..fd349ea --- /dev/null +++ b/lib/vendor/globalpayments/php-sdk/test/setup.php @@ -0,0 +1,3 @@ +