Version Notes
This plugin enables Hosted Payment Page for WorldNet Payment Gateway.
Download this release
Release Info
| Developer | Worldnet |
| Extension | worldnet_payment |
| Version | 1.2.0 |
| Comparing to | |
| See all releases | |
Version 1.2.0
- app/code/community/Mage/Worldnet/Block/Standard/Failure.php +62 -0
- app/code/community/Mage/Worldnet/Block/Standard/Form.php +43 -0
- app/code/community/Mage/Worldnet/Block/Standard/Redirect.php +58 -0
- app/code/community/Mage/Worldnet/Helper/Data.php +38 -0
- app/code/community/Mage/Worldnet/Model/Api/Debug.php +41 -0
- app/code/community/Mage/Worldnet/Model/Api/worldnet_tps_xml.php +5032 -0
- app/code/community/Mage/Worldnet/Model/Api/worldnet_tps_xml.php~ +4381 -0
- app/code/community/Mage/Worldnet/Model/Config.php +288 -0
- app/code/community/Mage/Worldnet/Model/Config.php~ +288 -0
- app/code/community/Mage/Worldnet/Model/Mysql4/Api/Debug.php +42 -0
- app/code/community/Mage/Worldnet/Model/Mysql4/Api/Debug/Collection.php +41 -0
- app/code/community/Mage/Worldnet/Model/Mysql4/Setup.php +39 -0
- app/code/community/Mage/Worldnet/Model/Session.php +42 -0
- app/code/community/Mage/Worldnet/Model/Source/CheckoutCurrencyAction.php +48 -0
- app/code/community/Mage/Worldnet/Model/Source/CurrencyAction.php +54 -0
- app/code/community/Mage/Worldnet/Model/Source/CurrencyAction.php~ +53 -0
- app/code/community/Mage/Worldnet/Model/Source/GatewayAction.php +55 -0
- app/code/community/Mage/Worldnet/Model/Source/GatewayAction.php~ +55 -0
- app/code/community/Mage/Worldnet/Model/Source/ModeAction.php +48 -0
- app/code/community/Mage/Worldnet/Model/Source/ModeAction.php~ +48 -0
- app/code/community/Mage/Worldnet/Model/Source/PaymentAction.php +44 -0
- app/code/community/Mage/Worldnet/Model/Standard.php +554 -0
- app/code/community/Mage/Worldnet/Model/Standard.php~ +554 -0
- app/code/community/Mage/Worldnet/controllers/StandardController.php +275 -0
- app/code/community/Mage/Worldnet/etc/config.xml +123 -0
- app/code/community/Mage/Worldnet/etc/system.xml +250 -0
- app/code/community/Mage/Worldnet/nbproject/private/private.properties +5 -0
- app/code/community/Mage/Worldnet/nbproject/private/private.xml +4 -0
- app/code/community/Mage/Worldnet/nbproject/project.properties +6 -0
- app/code/community/Mage/Worldnet/nbproject/project.xml +9 -0
- app/code/community/Mage/Worldnet/sql/worldnet_setup/mysql4-install-0.1.0.php +46 -0
- app/etc/modules/Mage_Worldnet.xml +38 -0
- package.xml +19 -0
app/code/community/Mage/Worldnet/Block/Standard/Failure.php
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
/**
|
| 27 |
+
* Failure Response from Worldnet
|
| 28 |
+
*
|
| 29 |
+
* @category Mage
|
| 30 |
+
* @package Mage_Worldnet
|
| 31 |
+
* @name Mage_Worldnet_Block_Standard_Failure
|
| 32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
+
*/
|
| 34 |
+
|
| 35 |
+
class Mage_Worldnet_Block_Standard_Failure extends Mage_Core_Block_Template
|
| 36 |
+
{
|
| 37 |
+
|
| 38 |
+
public function _construct()
|
| 39 |
+
{
|
| 40 |
+
$this->setTemplate('worldnet/standard/failure.phtml');
|
| 41 |
+
parent::_construct();
|
| 42 |
+
}
|
| 43 |
+
/**
|
| 44 |
+
* Return StatusDetail field value from Response
|
| 45 |
+
*
|
| 46 |
+
* @return string
|
| 47 |
+
*/
|
| 48 |
+
public function getErrorMessage ()
|
| 49 |
+
{
|
| 50 |
+
$error = Mage::getSingleton('checkout/session')->getErrorMessage();
|
| 51 |
+
Mage::getSingleton('checkout/session')->unsErrorMessage();
|
| 52 |
+
return $error;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
/**
|
| 56 |
+
* Get continue shopping url
|
| 57 |
+
*/
|
| 58 |
+
public function getContinueShoppingUrl()
|
| 59 |
+
{
|
| 60 |
+
return Mage::getUrl('checkout/cart');
|
| 61 |
+
}
|
| 62 |
+
}
|
app/code/community/Mage/Worldnet/Block/Standard/Form.php
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Form Block
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_Block_Standard_Form
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
|
| 36 |
+
class Mage_Worldnet_Block_Standard_Form extends Mage_Payment_Block_Form
|
| 37 |
+
{
|
| 38 |
+
protected function _construct()
|
| 39 |
+
{
|
| 40 |
+
$this->setTemplate('worldnet/standard/form.phtml');
|
| 41 |
+
parent::_construct();
|
| 42 |
+
}
|
| 43 |
+
}
|
app/code/community/Mage/Worldnet/Block/Standard/Redirect.php
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Redirect to Worldnet
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_Block_Standard_Redirect
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
|
| 36 |
+
class Mage_Worldnet_Block_Standard_Redirect extends Mage_Core_Block_Abstract
|
| 37 |
+
{
|
| 38 |
+
protected function _toHtml()
|
| 39 |
+
{
|
| 40 |
+
$standard = Mage::getModel('worldnet/standard');
|
| 41 |
+
$form = new Varien_Data_Form();
|
| 42 |
+
$form->setAction($standard->getWorldnetUrl())
|
| 43 |
+
->setId('worldnettps_checkout')
|
| 44 |
+
->setName('worldnettps_checkout')
|
| 45 |
+
->setMethod('POST')
|
| 46 |
+
->setUseContainer(true);
|
| 47 |
+
foreach ($standard->setOrder($this->getOrder())->getStandardCheckoutFormFields() as $field => $value) {
|
| 48 |
+
$form->addField($field, 'hidden', array('name' => $field, 'value' => $value));
|
| 49 |
+
}
|
| 50 |
+
$html = '<html><body>';
|
| 51 |
+
$html.= $this->__('You will be redirected to WorldnetTPS in a few seconds.');
|
| 52 |
+
$html.= $form->toHtml();
|
| 53 |
+
$html.= '<script type="text/javascript">document.getElementById("worldnettps_checkout").submit();</script>';
|
| 54 |
+
$html.= '</body></html>';
|
| 55 |
+
|
| 56 |
+
return $html;
|
| 57 |
+
}
|
| 58 |
+
}
|
app/code/community/Mage/Worldnet/Helper/Data.php
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Data Helper
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_Helper_Data
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
class Mage_Worldnet_Helper_Data extends Mage_Core_Helper_Abstract
|
| 36 |
+
{
|
| 37 |
+
|
| 38 |
+
}
|
app/code/community/Mage/Worldnet/Model/Api/Debug.php
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Api Debug
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_Model_Api_Debug
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
class Mage_Worldnet_Model_Api_Debug extends Mage_Core_Model_Abstract
|
| 36 |
+
{
|
| 37 |
+
protected function _construct()
|
| 38 |
+
{
|
| 39 |
+
$this->_init('worldnet/api_debug');
|
| 40 |
+
}
|
| 41 |
+
}
|
app/code/community/Mage/Worldnet/Model/Api/worldnet_tps_xml.php
ADDED
|
@@ -0,0 +1,5032 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
Copyright 2006-2014 WorldNet TPS Ltd.
|
| 4 |
+
|
| 5 |
+
This program is free software: you can redistribute it and/or modify
|
| 6 |
+
it under the terms of the GNU General Public License as published by
|
| 7 |
+
the Free Software Foundation, either version 3 of the License, or
|
| 8 |
+
(at your option) any later version.
|
| 9 |
+
|
| 10 |
+
This program is distributed in the hope that it will be useful,
|
| 11 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
GNU General Public License for more details.
|
| 14 |
+
|
| 15 |
+
You should have received a copy of the GNU General Public License
|
| 16 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 17 |
+
*/
|
| 18 |
+
|
| 19 |
+
if(basename(__FILE__) == basename($_SERVER["REQUEST_URI"])) die("<b>ERROR: You cannot display this file directly.</b>");
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Base Request Class holding common functionality for Request Types.
|
| 23 |
+
*/
|
| 24 |
+
class Request
|
| 25 |
+
{
|
| 26 |
+
protected static function GetRequestHash($plainString)
|
| 27 |
+
{
|
| 28 |
+
return md5($plainString);
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
protected static function GetFormattedDate()
|
| 32 |
+
{
|
| 33 |
+
return date('d-m-Y:H:i:s:000');
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
protected static function SendRequestToGateway($requestString, $testAccount, $gateway)
|
| 37 |
+
{
|
| 38 |
+
$serverUrl = 'https://';
|
| 39 |
+
if($testAccount) $serverUrl .= 'test';
|
| 40 |
+
switch (strtolower($gateway)) {
|
| 41 |
+
default :
|
| 42 |
+
case 'worldnet' : $serverUrl .= 'payments.worldnettps.com'; break;
|
| 43 |
+
case 'cashflows' : $serverUrl .= 'cashflows.worldnettps.com'; break;
|
| 44 |
+
case 'payius' : $serverUrl .= 'payments.payius.com' ; break;
|
| 45 |
+
case 'pagotechnology' : $serverUrl .= 'payments.pagotechnology.com' ; break;
|
| 46 |
+
case 'globalone' : $serverUrl .= 'payments.globalone.me' ; break;
|
| 47 |
+
case 'anywherecommerce' : $serverUrl .= 'payments.anywherecommerce.com' ; break;
|
| 48 |
+
case 'ctpayment' : $serverUrl .= 'payments.ct-payment.com' ; break;
|
| 49 |
+
case 'payzone' : $serverUrl .= 'payment.payzone.ie' ; break;
|
| 50 |
+
case 'payconex' : $serverUrl .= 'gateway.payconex.net' ; break;
|
| 51 |
+
}
|
| 52 |
+
$XMLSchemaFile = $serverUrl . '/merchant/gateway.xsd';
|
| 53 |
+
$serverUrl .= '/merchant/xmlpayment';
|
| 54 |
+
|
| 55 |
+
$requestXML = new DOMDocument("1.0");
|
| 56 |
+
$requestXML->formatOutput = true;
|
| 57 |
+
$requestXML->loadXML($requestString);
|
| 58 |
+
if(!$requestXML->schemaValidate($XMLSchemaFile)) die('<b>XML VALIDATION FAILED AGAINST SCHEMA:</b>' . $XMLSchemaFile . libxml_display_errors());
|
| 59 |
+
unset($requestXML);
|
| 60 |
+
|
| 61 |
+
// Initialisation
|
| 62 |
+
$ch=curl_init();
|
| 63 |
+
// Set parameters
|
| 64 |
+
curl_setopt($ch, CURLOPT_URL, $serverUrl);
|
| 65 |
+
// Return a variable instead of posting it directly
|
| 66 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
| 67 |
+
//curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
|
| 68 |
+
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
| 69 |
+
// Activate the POST method
|
| 70 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
| 71 |
+
// Request
|
| 72 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $requestString);
|
| 73 |
+
// execute the connection
|
| 74 |
+
$result = curl_exec($ch);
|
| 75 |
+
// Close it
|
| 76 |
+
curl_close($ch);
|
| 77 |
+
return $result;
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
/**
|
| 82 |
+
* Used for processing XML Authorisations through the WorldNet TPS XML Gateway.
|
| 83 |
+
*
|
| 84 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 85 |
+
*/
|
| 86 |
+
class XmlAuthRequest extends Request
|
| 87 |
+
{
|
| 88 |
+
private $terminalId;
|
| 89 |
+
private $orderId;
|
| 90 |
+
private $currency;
|
| 91 |
+
private $amount;
|
| 92 |
+
public function Amount()
|
| 93 |
+
{
|
| 94 |
+
return $this->amount;
|
| 95 |
+
}
|
| 96 |
+
private $dateTime;
|
| 97 |
+
private $hash;
|
| 98 |
+
private $autoReady;
|
| 99 |
+
private $description;
|
| 100 |
+
private $email;
|
| 101 |
+
private $cardNumber;
|
| 102 |
+
private $trackData;
|
| 103 |
+
private $cardType;
|
| 104 |
+
private $cardExpiry;
|
| 105 |
+
private $cardHolderName;
|
| 106 |
+
private $cvv;
|
| 107 |
+
private $issueNo;
|
| 108 |
+
private $address1;
|
| 109 |
+
private $address2;
|
| 110 |
+
private $postCode;
|
| 111 |
+
private $cardCurrency;
|
| 112 |
+
private $cardAmount;
|
| 113 |
+
private $conversionRate;
|
| 114 |
+
private $terminalType = "2";
|
| 115 |
+
private $transactionType = "7";
|
| 116 |
+
private $avsOnly;
|
| 117 |
+
private $mpiRef;
|
| 118 |
+
private $mobileNumber;
|
| 119 |
+
private $deviceId;
|
| 120 |
+
private $phone;
|
| 121 |
+
private $country;
|
| 122 |
+
private $ipAddress;
|
| 123 |
+
|
| 124 |
+
private $multicur = false;
|
| 125 |
+
private $foreignCurInfoSet = false;
|
| 126 |
+
|
| 127 |
+
/**
|
| 128 |
+
* Creates the standard request less optional parameters for processing an XML Transaction
|
| 129 |
+
* through the WorldNetTPS XML Gateway
|
| 130 |
+
*
|
| 131 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 132 |
+
* @param orderId A unique merchant identifier. Alpha numeric and max size 12 chars.
|
| 133 |
+
* @param currency ISO 4217 3 Digit Currency Code, e.g. EUR / USD / GBP
|
| 134 |
+
* @param amount Transaction Amount, Double formatted to 2 decimal places.
|
| 135 |
+
* @param description Transaction Description
|
| 136 |
+
* @param email Cardholder e-mail
|
| 137 |
+
* @param cardNumber A valid Card Number that passes the Luhn Check.
|
| 138 |
+
* @param cardType
|
| 139 |
+
* Card Type (Accepted Card Types must be configured in the Merchant Selfcare System.)
|
| 140 |
+
*
|
| 141 |
+
* Accepted Values :
|
| 142 |
+
*
|
| 143 |
+
* VISA
|
| 144 |
+
* MASTERCARD
|
| 145 |
+
* LASER
|
| 146 |
+
* SWITCH
|
| 147 |
+
* SOLO
|
| 148 |
+
* AMEX
|
| 149 |
+
* DINERS
|
| 150 |
+
* MAESTRO
|
| 151 |
+
* DELTA
|
| 152 |
+
* ELECTRON
|
| 153 |
+
*
|
| 154 |
+
*/
|
| 155 |
+
public function XmlAuthRequest($terminalId,
|
| 156 |
+
$orderId,
|
| 157 |
+
$currency,
|
| 158 |
+
$amount,
|
| 159 |
+
$cardNumber,
|
| 160 |
+
$cardType)
|
| 161 |
+
{
|
| 162 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 163 |
+
|
| 164 |
+
$this->terminalId = $terminalId;
|
| 165 |
+
$this->orderId = $orderId;
|
| 166 |
+
$this->currency = $currency;
|
| 167 |
+
$this->amount = $amount;
|
| 168 |
+
$this->cardNumber = $cardNumber;
|
| 169 |
+
$this->cardType = $cardType;
|
| 170 |
+
}
|
| 171 |
+
/**
|
| 172 |
+
* Setter for Auto Ready Value
|
| 173 |
+
*
|
| 174 |
+
* @param autoReady
|
| 175 |
+
* Auto Ready is an optional parameter and defines if the transaction should be settled automatically.
|
| 176 |
+
*
|
| 177 |
+
* Accepted Values :
|
| 178 |
+
*
|
| 179 |
+
* Y - Transaction will be settled in next batch
|
| 180 |
+
* N - Transaction will not be settled until user changes state in Merchant Selfcare Section
|
| 181 |
+
*/
|
| 182 |
+
public function SetAutoReady($autoReady)
|
| 183 |
+
{
|
| 184 |
+
$this->autoReady = $autoReady;
|
| 185 |
+
}
|
| 186 |
+
/**
|
| 187 |
+
* Setter for Email Address Value
|
| 188 |
+
*
|
| 189 |
+
* @param email Alpha-numeric field.
|
| 190 |
+
*/
|
| 191 |
+
public function SetEmail($email)
|
| 192 |
+
{
|
| 193 |
+
$this->email = $email;
|
| 194 |
+
}
|
| 195 |
+
/**
|
| 196 |
+
* Setter for Email Address Value
|
| 197 |
+
*
|
| 198 |
+
* @param email Alpha-numeric field.
|
| 199 |
+
*/
|
| 200 |
+
public function SetDescription($description)
|
| 201 |
+
{
|
| 202 |
+
$this->description = $description;
|
| 203 |
+
}
|
| 204 |
+
/**
|
| 205 |
+
* Setter for Card Expiry and Card Holder Name values
|
| 206 |
+
* These are mandatory for non-SecureCard transactions
|
| 207 |
+
*
|
| 208 |
+
* @param cardExpiry Card Expiry formatted MMYY
|
| 209 |
+
* @param cardHolderName Card Holder Name
|
| 210 |
+
*/
|
| 211 |
+
public function SetNonSecureCardCardInfo($cardExpiry, $cardHolderName)
|
| 212 |
+
{
|
| 213 |
+
$this->cardExpiry = $cardExpiry;
|
| 214 |
+
$this->cardHolderName = $cardHolderName;
|
| 215 |
+
}
|
| 216 |
+
/**
|
| 217 |
+
* Setter for Card Verification Value
|
| 218 |
+
*
|
| 219 |
+
* @param cvv Numeric field with a max of 4 characters.
|
| 220 |
+
*/
|
| 221 |
+
public function SetCvv($cvv)
|
| 222 |
+
{
|
| 223 |
+
$this->cvv = $cvv;
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
/**
|
| 227 |
+
* Setter for Issue No
|
| 228 |
+
*
|
| 229 |
+
* @param issueNo Numeric field with a max of 3 characters.
|
| 230 |
+
*/
|
| 231 |
+
public function SetIssueNo($issueNo)
|
| 232 |
+
{
|
| 233 |
+
$this->issueNo = $issueNo;
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
/**
|
| 237 |
+
* Setter for Address Verification Values
|
| 238 |
+
*
|
| 239 |
+
* @param address1 First Line of address - Max size 20
|
| 240 |
+
* @param address2 Second Line of address - Max size 20
|
| 241 |
+
* @param postCode Postcode - Max size 9
|
| 242 |
+
*/
|
| 243 |
+
public function SetAvs($address1, $address2, $postCode)
|
| 244 |
+
{
|
| 245 |
+
$this->address1 = $address1;
|
| 246 |
+
$this->address2 = $address2;
|
| 247 |
+
$this->postCode = $postCode;
|
| 248 |
+
}
|
| 249 |
+
/**
|
| 250 |
+
* Setter for Foreign Currency Information
|
| 251 |
+
*
|
| 252 |
+
* @param cardCurrency ISO 4217 3 Digit Currency Code, e.g. EUR / USD / GBP
|
| 253 |
+
* @param cardAmount (Amount X Conversion rate) Formatted to two decimal places
|
| 254 |
+
* @param conversionRate Converstion rate supplied in rate response
|
| 255 |
+
*/
|
| 256 |
+
public function SetForeignCurrencyInformation($cardCurrency, $cardAmount, $conversionRate)
|
| 257 |
+
{
|
| 258 |
+
$this->cardCurrency = $cardCurrency;
|
| 259 |
+
$this->cardAmount = $cardAmount;
|
| 260 |
+
$this->conversionRate = $conversionRate;
|
| 261 |
+
|
| 262 |
+
$this->foreignCurInfoSet = true;
|
| 263 |
+
}
|
| 264 |
+
/**
|
| 265 |
+
* Setter for AVS only flag
|
| 266 |
+
*
|
| 267 |
+
* @param avsOnly Only perform an AVS check, do not store as a transaction. Possible values: "Y", "N"
|
| 268 |
+
*/
|
| 269 |
+
public function SetAvsOnly($avsOnly)
|
| 270 |
+
{
|
| 271 |
+
$this->avsOnly = $avsOnly;
|
| 272 |
+
}
|
| 273 |
+
/**
|
| 274 |
+
|
| 275 |
+
* Setter forPO_SCHEMA_FILE MPI Reference code
|
| 276 |
+
*
|
| 277 |
+
* @param mpiRef MPI Reference code supplied by WorldNet TPS MPI redirect
|
| 278 |
+
*/
|
| 279 |
+
public function SetMpiRef($mpiRef)
|
| 280 |
+
{
|
| 281 |
+
$this->mpiRef = $mpiRef;
|
| 282 |
+
}
|
| 283 |
+
/**
|
| 284 |
+
* Setter for Mobile Number
|
| 285 |
+
*
|
| 286 |
+
* @param mobileNumber Mobile Number of cardholder. If sent an SMS receipt will be sent to them
|
| 287 |
+
*/
|
| 288 |
+
public function SetMobileNumber($mobileNumber)
|
| 289 |
+
{
|
| 290 |
+
$this->mobileNumber = $mobileNumber;
|
| 291 |
+
}
|
| 292 |
+
/**
|
| 293 |
+
* Setter for Device ID
|
| 294 |
+
*
|
| 295 |
+
* @param deviceId Device ID to identify this source to the XML gateway
|
| 296 |
+
*/
|
| 297 |
+
public function SetDeviceId($deviceId)
|
| 298 |
+
{
|
| 299 |
+
$this->deviceId = $deviceId;
|
| 300 |
+
}
|
| 301 |
+
/**
|
| 302 |
+
* Setter for Phone number
|
| 303 |
+
*
|
| 304 |
+
* @param phone Phone number of cardholder
|
| 305 |
+
*/
|
| 306 |
+
public function SetPhone($phone)
|
| 307 |
+
{
|
| 308 |
+
$this->phone = $phone;
|
| 309 |
+
}
|
| 310 |
+
/**
|
| 311 |
+
* Setter for the cardholders IP address
|
| 312 |
+
*
|
| 313 |
+
* @param ipAddress IP Address of the cardholder
|
| 314 |
+
*/
|
| 315 |
+
public function SetIPAddress($ipAddress)
|
| 316 |
+
{
|
| 317 |
+
$this->ipAddress = $ipAddress;
|
| 318 |
+
}
|
| 319 |
+
/**
|
| 320 |
+
* Setter for Country
|
| 321 |
+
*
|
| 322 |
+
* @param country Cardholders Country
|
| 323 |
+
*/
|
| 324 |
+
public function SetCountry($country)
|
| 325 |
+
{
|
| 326 |
+
$this->country = $country;
|
| 327 |
+
}
|
| 328 |
+
/**
|
| 329 |
+
* Setter for multi-currency value
|
| 330 |
+
* This is required to be set for multi-currency terminals because the Hash is calculated differently.
|
| 331 |
+
*/
|
| 332 |
+
public function SetMultiCur()
|
| 333 |
+
{
|
| 334 |
+
$this->multicur = true;
|
| 335 |
+
}
|
| 336 |
+
/**
|
| 337 |
+
* Setter to flag transaction as a Mail Order. If not set the transaction defaults to eCommerce
|
| 338 |
+
*/
|
| 339 |
+
public function SetMotoTrans()
|
| 340 |
+
{
|
| 341 |
+
$this->terminalType = "1";
|
| 342 |
+
$this->transactionType = "4";
|
| 343 |
+
}
|
| 344 |
+
/**
|
| 345 |
+
* Setter to flag transaction as a Mail Order. If not set the transaction defaults to eCommerce
|
| 346 |
+
*/
|
| 347 |
+
public function SetTrackData($trackData)
|
| 348 |
+
{
|
| 349 |
+
$this->terminalType = "3";
|
| 350 |
+
$this->transactionType = "0";
|
| 351 |
+
$this->cardNumber = "";
|
| 352 |
+
$this->trackData = $trackData;
|
| 353 |
+
}
|
| 354 |
+
/**
|
| 355 |
+
* Setter for hash value
|
| 356 |
+
*
|
| 357 |
+
* @param sharedSecret
|
| 358 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 359 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 360 |
+
*/
|
| 361 |
+
public function SetHash($sharedSecret)
|
| 362 |
+
{
|
| 363 |
+
if(isset($this->multicur) && $this->multicur == true) $this->hash = $this->GetRequestHash($this->terminalId . $this->orderId . $this->currency . $this->amount . $this->dateTime . $sharedSecret);
|
| 364 |
+
else $this->hash = $this->GetRequestHash($this->terminalId . $this->orderId . $this->amount . $this->dateTime . $sharedSecret);
|
| 365 |
+
}
|
| 366 |
+
/**
|
| 367 |
+
* (Old) Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 368 |
+
*
|
| 369 |
+
* @param sharedSecret
|
| 370 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 371 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 372 |
+
*
|
| 373 |
+
* @param testAccount
|
| 374 |
+
* Boolean value defining Mode
|
| 375 |
+
* true - This is a test account
|
| 376 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 377 |
+
*
|
| 378 |
+
* @return XmlAuthResponse containing an error or the parsed payment response.
|
| 379 |
+
*/
|
| 380 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 381 |
+
{
|
| 382 |
+
return $this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 386 |
+
{
|
| 387 |
+
$this->SetHash($sharedSecret);
|
| 388 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 389 |
+
$response = new XmlAuthResponse($responseString);
|
| 390 |
+
returnPO_SCHEMA_FILE $response;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
public function GenerateXml()
|
| 394 |
+
{
|
| 395 |
+
$requestXML = new DOMDocument("1.0");
|
| 396 |
+
$requestXML->formatOutput = true;
|
| 397 |
+
|
| 398 |
+
$requestString = $requestXML->createElement("PAYMENT");
|
| 399 |
+
$requestXML->appendChild($requestString);
|
| 400 |
+
|
| 401 |
+
$node = $requestXML->createElement("ORDERID");
|
| 402 |
+
$node->appendChild($requestXML->createTextNode($this->orderId));
|
| 403 |
+
$requestString->appendChild($node);
|
| 404 |
+
|
| 405 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 406 |
+
$requestString->appendChild($node);
|
| 407 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 408 |
+
|
| 409 |
+
$node = $requestXML->createElement("AMOUNT");
|
| 410 |
+
$requestString->appendChild($node);
|
| 411 |
+
$node->appendChild($requestXML->createTextNode($this->amount));
|
| 412 |
+
|
| 413 |
+
$node = $requestXML->createElement("DATETIME");
|
| 414 |
+
$requestString->appendChild($node);
|
| 415 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 416 |
+
|
| 417 |
+
if($this->trackData !== NULL)
|
| 418 |
+
{
|
| 419 |
+
$node = $requestXML->createElement("TRACKDATA");
|
| 420 |
+
$requestString->appendChild($node);
|
| 421 |
+
$node->appendChild($requestXML->createTextNode($this->trackData));
|
| 422 |
+
} else {
|
| 423 |
+
$node = $requestXML->createElement("CARDNUMBER");
|
| 424 |
+
$requestString->appendChild($node);
|
| 425 |
+
$node->appendChild($requestXML->createTextNode($this->cardNumber));
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
$node = $requestXML->createElement("CARDTYPE");
|
| 429 |
+
$requestString->appendChild($node);
|
| 430 |
+
$node->appendChild($requestXML->createTextNode($this->cardType));
|
| 431 |
+
|
| 432 |
+
if($this->cardExpiry !== NULL && $this->cardHolderName !== NULL && $this->trackData == NULL)
|
| 433 |
+
{
|
| 434 |
+
$node = $requestXML->createElement("CARDEXPIRY");
|
| 435 |
+
$requestString->appendChild($node);
|
| 436 |
+
$node->appendChild($requestXML->createTextNode($this->cardExpiry));
|
| 437 |
+
|
| 438 |
+
$node = $requestXML->createElement("CARDHOLDERNAME");
|
| 439 |
+
$requestString->appendChild($node);
|
| 440 |
+
$node->appendChild($requestXML->createTextNode($this->cardHolderName));
|
| 441 |
+
}
|
| 442 |
+
|
| 443 |
+
$node = $requestXML->createElement("HASH");
|
| 444 |
+
$requestString->appendChild($node);
|
| 445 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 446 |
+
|
| 447 |
+
$node = $requestXML->createElement("CURRENCY");
|
| 448 |
+
$requestString->appendChild($node);
|
| 449 |
+
$node->appendChild($requestXML->createTextNode($this->currency));
|
| 450 |
+
|
| 451 |
+
if($this->foreignCurInfoSet)
|
| 452 |
+
{
|
| 453 |
+
$dcNode = $requestXML->createElement("FOREIGNCURRENCYINFORMATION");
|
| 454 |
+
$requestString->appendChild($dcNode );
|
| 455 |
+
|
| 456 |
+
$dcSubNode = $requestXML->createElement("CARDCURRENCY");
|
| 457 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->cardCurrency));
|
| 458 |
+
$dcNode->appendChild($dcSubNode);
|
| 459 |
+
|
| 460 |
+
$dcSubNode = $requestXML->createElement("CARDAMOUNT");
|
| 461 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->cardAmount));
|
| 462 |
+
$dcNode->appendChild($dcSubNode);
|
| 463 |
+
|
| 464 |
+
$dcSubNode = $requestXML->createElement("CONVERSIONRATE");
|
| 465 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->conversionRate));
|
| 466 |
+
$dcNode->appendChild($dcSubNode);
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
+
$node = $requestXML->createElement("TERMINALTYPE");
|
| 470 |
+
$requestString->appendChild($node);
|
| 471 |
+
$nodeText = $requestXML->createTextNode($this->terminalType);
|
| 472 |
+
$node->appendChild($nodeText);
|
| 473 |
+
|
| 474 |
+
$node = $requestXML->createElement("TRANSACTIONTYPE");
|
| 475 |
+
$requestString->appendChild($node);
|
| 476 |
+
$nodeText = $requestXML->createTextNode($this->transactionType);
|
| 477 |
+
$node->appendChild($nodeText);
|
| 478 |
+
|
| 479 |
+
if($this->autoReady !== NULL)
|
| 480 |
+
{
|
| 481 |
+
$node = $requestXML->createElement("AUTOREADY");
|
| 482 |
+
$requestString->appendChild($node);
|
| 483 |
+
$node->appendChild($requestXML->createTextNode($this->autoReady));
|
| 484 |
+
}
|
| 485 |
+
|
| 486 |
+
if($this->email !== NULL)
|
| 487 |
+
{
|
| 488 |
+
$node = $requestXML->createElement("EMAIL");
|
| 489 |
+
$requestString->appendChild($node);
|
| 490 |
+
$node->appendChild($requestXML->createTextNode($this->email));
|
| 491 |
+
}
|
| 492 |
+
|
| 493 |
+
if($this->cvv !== NULL)
|
| 494 |
+
{
|
| 495 |
+
$node = $requestXML->createElement("CVV");
|
| 496 |
+
$requestString->appendChild($node);
|
| 497 |
+
$node->appendChild($requestXML->createTextNode($this->cvv));
|
| 498 |
+
}
|
| 499 |
+
|
| 500 |
+
if($this->issueNo !== NULL)
|
| 501 |
+
{
|
| 502 |
+
$node = $requestXML->createElement("ISSUENO");
|
| 503 |
+
$requestString->appendChild($node);
|
| 504 |
+
$node->appendChild($requestXML->createTextNode($this->issueNo));
|
| 505 |
+
}
|
| 506 |
+
|
| 507 |
+
if($this->postCode !== NULL)
|
| 508 |
+
{
|
| 509 |
+
if($this->address1 !== NULL)
|
| 510 |
+
{
|
| 511 |
+
$node = $requestXML->createElement("ADDRESS1");
|
| 512 |
+
$requestString->appendChild($node);
|
| 513 |
+
$node->appendChild($requestXML->createTextNode($this->address1));
|
| 514 |
+
}
|
| 515 |
+
if($this->address2 !== NULL)
|
| 516 |
+
{
|
| 517 |
+
$node = $requestXML->createElement("ADDRESS2");
|
| 518 |
+
$requestString->appendChild($node);
|
| 519 |
+
$node->appendChild($requestXML->createTextNode($this->address2));
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
$node = $requestXML->createElement("POSTCODE");
|
| 523 |
+
$requestString->appendChild($node);
|
| 524 |
+
$node->appendChild($requestXML->createTextNode($this->postCode));
|
| 525 |
+
}
|
| 526 |
+
|
| 527 |
+
if($this->avsOnly !== NULL)
|
| 528 |
+
{
|
| 529 |
+
$node = $requestXML->createElement("AVSONLY");
|
| 530 |
+
$requestString->appendChild($node);
|
| 531 |
+
$node->appendChild($requestXML->createTextNode($this->avsOnly));
|
| 532 |
+
}
|
| 533 |
+
|
| 534 |
+
if($this->description !== NULL)
|
| 535 |
+
{
|
| 536 |
+
$node = $requestXML->createElement("DESCRIPTION");
|
| 537 |
+
$requestString->appendChild($node);
|
| 538 |
+
$node->appendChild($requestXML->createTextNode($this->description));
|
| 539 |
+
}
|
| 540 |
+
|
| 541 |
+
if($this->mpiRef !== NULL)
|
| 542 |
+
{
|
| 543 |
+
$node = $requestXML->createElement("MPIREF");
|
| 544 |
+
$requestString->appendChild($node);
|
| 545 |
+
$node->appendChild($requestXML->createTextNode($this->mpiRef));
|
| 546 |
+
}
|
| 547 |
+
|
| 548 |
+
if($this->mobileNumber !== NULL)
|
| 549 |
+
{
|
| 550 |
+
$node = $requestXML->createElement("MOBILENUMBER");
|
| 551 |
+
$requestString->appendChild($node);
|
| 552 |
+
$node->appendChild($requestXML->createTextNode($this->mobileNumber));
|
| 553 |
+
}
|
| 554 |
+
|
| 555 |
+
if($this->deviceId !== NULL)
|
| 556 |
+
{
|
| 557 |
+
$node = $requestXML->createElement("DEVICEID");
|
| 558 |
+
$requestString->appendChild($node);
|
| 559 |
+
$node->appendChild($requestXML->createTextNode($this->deviceId));
|
| 560 |
+
}
|
| 561 |
+
|
| 562 |
+
if($this->phone !== NULL)
|
| 563 |
+
{
|
| 564 |
+
$node = $requestXML->createElement("PHONE");
|
| 565 |
+
$requestString->appendChild($node);
|
| 566 |
+
$node->appendChild($requestXML->createTextNode($this->phone));
|
| 567 |
+
}
|
| 568 |
+
|
| 569 |
+
if($this->country !== NULL)
|
| 570 |
+
{
|
| 571 |
+
$node = $requestXML->createElement("COUNTRY");
|
| 572 |
+
$requestString->appendChild($node);
|
| 573 |
+
$node->appendChild($requestXML->createTextNode($this->country));
|
| 574 |
+
}
|
| 575 |
+
|
| 576 |
+
if($this->ipAddress !== NULL)
|
| 577 |
+
{
|
| 578 |
+
$node = $requestXML->createElement("IPADDRESS");
|
| 579 |
+
$requestString->appendChild($node);
|
| 580 |
+
$node->appendChild($requestXML->createTextNode($this->ipAddress));
|
| 581 |
+
}
|
| 582 |
+
|
| 583 |
+
return $requestXML->saveXML();
|
| 584 |
+
}
|
| 585 |
+
}
|
| 586 |
+
|
| 587 |
+
/**
|
| 588 |
+
* Used for processing XML Refund Authorisations through the WorldNet TPS XML Gateway.
|
| 589 |
+
*
|
| 590 |
+
* Basic request is configured on initialisation. There are no coptional fields.
|
| 591 |
+
*/
|
| 592 |
+
class XmlRefundRequest extends Request
|
| 593 |
+
{
|
| 594 |
+
private $terminalId;
|
| 595 |
+
private $orderId;
|
| 596 |
+
private $uniqueRef;
|
| 597 |
+
private $amount;
|
| 598 |
+
public function Amount()
|
| 599 |
+
{
|
| 600 |
+
return $this->amount;
|
| 601 |
+
}
|
| 602 |
+
private $dateTime;
|
| 603 |
+
private $hash;
|
| 604 |
+
private $operator;
|
| 605 |
+
private $reason;
|
| 606 |
+
private $autoReady;
|
| 607 |
+
|
| 608 |
+
/**
|
| 609 |
+
* Creates the refund request for processing an XML Transaction
|
| 610 |
+
* through the WorldNetTPS XML Gateway
|
| 611 |
+
*
|
| 612 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 613 |
+
* @param orderId A unique merchant identifier. Alpha numeric and max size 12 chars.
|
| 614 |
+
* @param currency ISO 4217 3 Digit Currency Code, e.g. EUR / USD / GBP
|
| 615 |
+
* @param amount Transaction Amount, Double formatted to 2 decimal places.
|
| 616 |
+
* @param operator An identifier for who executed this transaction
|
| 617 |
+
* @param reason The reason for the refund
|
| 618 |
+
*/
|
| 619 |
+
public function XmlRefundRequest($terminalId,
|
| 620 |
+
$orderId,
|
| 621 |
+
$amount,
|
| 622 |
+
$operator,
|
| 623 |
+
$reason)
|
| 624 |
+
{
|
| 625 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 626 |
+
$this->amount = $amount;
|
| 627 |
+
$this->terminalId = $terminalId;
|
| 628 |
+
$this->orderId = $orderId;
|
| 629 |
+
$this->operator = $operator;
|
| 630 |
+
$this->reason = $reason;
|
| 631 |
+
}
|
| 632 |
+
/**
|
| 633 |
+
* Setter for UniqueRef
|
| 634 |
+
|
| 635 |
+
*
|
| 636 |
+
* @param uniqueRef
|
| 637 |
+
* Unique Reference of transaction returned from gateway in authorisation response
|
| 638 |
+
*/
|
| 639 |
+
public function SetUniqueRef($uniqueRef)
|
| 640 |
+
{
|
| 641 |
+
$this->uniqueRef = $uniqueRef;
|
| 642 |
+
$this->orderId = "";
|
| 643 |
+
}
|
| 644 |
+
/**
|
| 645 |
+
* Setter for Auto Ready Value
|
| 646 |
+
|
| 647 |
+
*
|
| 648 |
+
* @param autoReady
|
| 649 |
+
* Auto Ready is an optional parameter and defines if the transaction should be settled automatically.
|
| 650 |
+
*
|
| 651 |
+
* Accepted Values :
|
| 652 |
+
|
| 653 |
+
*
|
| 654 |
+
* Y - Transaction will be settled in next batch
|
| 655 |
+
* N - Transaction will not be settled until user changes state in Merchant Selfcare Section
|
| 656 |
+
*/
|
| 657 |
+
public function SetAutoReady($autoReady)
|
| 658 |
+
{
|
| 659 |
+
$this->autoReady = $autoReady;
|
| 660 |
+
}
|
| 661 |
+
/**
|
| 662 |
+
* Setter for hash value
|
| 663 |
+
*
|
| 664 |
+
* @param sharedSecret
|
| 665 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 666 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 667 |
+
*/
|
| 668 |
+
public function SetHash($sharedSecret)
|
| 669 |
+
{
|
| 670 |
+
if($this->uniqueRef !== NULL)
|
| 671 |
+
{
|
| 672 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->uniqueRef . $this->amount . $this->dateTime . $sharedSecret);
|
| 673 |
+
} else {
|
| 674 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->orderId . $this->amount . $this->dateTime . $sharedSecret);
|
| 675 |
+
}
|
| 676 |
+
}
|
| 677 |
+
/**
|
| 678 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 679 |
+
*
|
| 680 |
+
* @param sharedSecret
|
| 681 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 682 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 683 |
+
*
|
| 684 |
+
* @param testAccount
|
| 685 |
+
* Boolean value defining Mode
|
| 686 |
+
* true - This is a test account
|
| 687 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 688 |
+
*
|
| 689 |
+
* @return XmlRefundResponse containing an error or the parsed refund response.
|
| 690 |
+
*/
|
| 691 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 692 |
+
{
|
| 693 |
+
return $this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 694 |
+
}
|
| 695 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 696 |
+
{
|
| 697 |
+
$this->SetHash($sharedSecret);
|
| 698 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 699 |
+
$response = new XmlRefundResponse($responseString);
|
| 700 |
+
return $response;
|
| 701 |
+
}
|
| 702 |
+
public function GenerateXml()
|
| 703 |
+
{
|
| 704 |
+
$requestXML = new DOMDocument("1.0");
|
| 705 |
+
$requestXML->formatOutput = true;
|
| 706 |
+
|
| 707 |
+
$requestString = $requestXML->createElement("REFUND");
|
| 708 |
+
$requestXML->appendChild($requestString);
|
| 709 |
+
|
| 710 |
+
if($this->uniqueRef !== NULL)
|
| 711 |
+
{
|
| 712 |
+
$node = $requestXML->createElement("UNIQUEREF");
|
| 713 |
+
$node->appendChild($requestXML->createTextNode($this->uniqueRef));
|
| 714 |
+
$requestString->appendChild($node);
|
| 715 |
+
} else {
|
| 716 |
+
$node = $requestXML->createElement("ORDERID");
|
| 717 |
+
$node->appendChild($requestXML->createTextNode($this->orderId));
|
| 718 |
+
$requestString->appendChild($node);
|
| 719 |
+
}
|
| 720 |
+
|
| 721 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 722 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 723 |
+
$requestString->appendChild($node);
|
| 724 |
+
|
| 725 |
+
$node = $requestXML->createElement("AMOUNT");
|
| 726 |
+
$node->appendChild($requestXML->createTextNode($this->amount));
|
| 727 |
+
$requestString->appendChild($node);
|
| 728 |
+
|
| 729 |
+
$node = $requestXML->createElement("DATETIME");
|
| 730 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 731 |
+
$requestString->appendChild($node);
|
| 732 |
+
|
| 733 |
+
$node = $requestXML->createElement("HASH");
|
| 734 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 735 |
+
$requestString->appendChild($node);
|
| 736 |
+
|
| 737 |
+
$node = $requestXML->createElement("OPERATOR");
|
| 738 |
+
$node->appendChild($requestXML->createTextNode($this->operator));
|
| 739 |
+
$requestString->appendChild($node);
|
| 740 |
+
|
| 741 |
+
$node = $requestXML->createElement("REASON");
|
| 742 |
+
$node->appendChild($requestXML->createTextNode($this->reason));
|
| 743 |
+
$requestString->appendChild($node);
|
| 744 |
+
|
| 745 |
+
if($this->autoReady !== NULL)
|
| 746 |
+
{
|
| 747 |
+
$node = $requestXML->createElement("AUTOREADY");
|
| 748 |
+
$requestString->appendChild($node);
|
| 749 |
+
$node->appendChild($requestXML->createTextNode($this->autoReady));
|
| 750 |
+
}
|
| 751 |
+
|
| 752 |
+
return $requestXML->saveXML();
|
| 753 |
+
|
| 754 |
+
}
|
| 755 |
+
}
|
| 756 |
+
|
| 757 |
+
/**
|
| 758 |
+
* Used for processing XML Pre-Authorisations through the WorldNet TPS XML Gateway.
|
| 759 |
+
*
|
| 760 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 761 |
+
*/
|
| 762 |
+
class XmlPreAuthRequest extends Request
|
| 763 |
+
{
|
| 764 |
+
private $terminalId;
|
| 765 |
+
private $orderId;
|
| 766 |
+
private $currency;
|
| 767 |
+
private $amount;
|
| 768 |
+
public function Amount()
|
| 769 |
+
{
|
| 770 |
+
return $this->amount;
|
| 771 |
+
}
|
| 772 |
+
private $dateTime;
|
| 773 |
+
private $hash;
|
| 774 |
+
private $description;
|
| 775 |
+
private $email;
|
| 776 |
+
private $cardNumber;
|
| 777 |
+
private $cardType;
|
| 778 |
+
private $cardExpiry;
|
| 779 |
+
private $cardHolderName;
|
| 780 |
+
private $cvv;
|
| 781 |
+
private $issueNo;
|
| 782 |
+
private $address1;
|
| 783 |
+
private $address2;
|
| 784 |
+
private $postCode;
|
| 785 |
+
private $cardCurrency;
|
| 786 |
+
private $cardAmount;
|
| 787 |
+
private $conversionRate;
|
| 788 |
+
private $terminalType = "2";
|
| 789 |
+
private $transactionType = "7";
|
| 790 |
+
private $multicur = false;
|
| 791 |
+
private $foreignCurInfoSet = false;
|
| 792 |
+
private $ipAddress;
|
| 793 |
+
|
| 794 |
+
/**
|
| 795 |
+
* Creates the pre-auth request less optional parameters for processing an XML Transaction
|
| 796 |
+
* through the WorldNetTPS XML Gateway
|
| 797 |
+
*
|
| 798 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 799 |
+
* @param orderId A unique merchant identifier. Alpha numeric and max size 12 chars.
|
| 800 |
+
* @param currency ISO 4217 3 Digit Currency Code, e.g. EUR / USD / GBP
|
| 801 |
+
* @param amount Transaction Amount, Double formatted to 2 decimal places.
|
| 802 |
+
* @param description Transaction Description
|
| 803 |
+
* @param email Cardholder e-mail
|
| 804 |
+
* @param cardNumber A valid Card Number that passes the Luhn Check.
|
| 805 |
+
* @param cardType
|
| 806 |
+
* Card Type (Accepted Card Types must be configured in the Merchant Selfcare System.)
|
| 807 |
+
*
|
| 808 |
+
* Accepted Values :
|
| 809 |
+
*
|
| 810 |
+
* VISA
|
| 811 |
+
* MASTERCARD
|
| 812 |
+
* LASER
|
| 813 |
+
* SWITCH
|
| 814 |
+
* SOLO
|
| 815 |
+
* AMEX
|
| 816 |
+
* DINERS
|
| 817 |
+
* MAESTRO
|
| 818 |
+
* DELTA
|
| 819 |
+
* ELECTRON
|
| 820 |
+
*
|
| 821 |
+
* @param cardExpiry Card Expiry formatted MMYY
|
| 822 |
+
* @param cardHolderName Card Holder Name
|
| 823 |
+
*/
|
| 824 |
+
public function XmlPreAuthRequest($terminalId,
|
| 825 |
+
$orderId,
|
| 826 |
+
$currency,
|
| 827 |
+
$amount,
|
| 828 |
+
$cardNumber,
|
| 829 |
+
$cardType)
|
| 830 |
+
{
|
| 831 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 832 |
+
|
| 833 |
+
$this->terminalId = $terminalId;
|
| 834 |
+
$this->orderId = $orderId;
|
| 835 |
+
$this->currency = $currency;
|
| 836 |
+
$this->amount = $amount;
|
| 837 |
+
$this->cardNumber = $cardNumber;
|
| 838 |
+
$this->cardType = $cardType;
|
| 839 |
+
}
|
| 840 |
+
/**
|
| 841 |
+
* Setter for Card Verification Value
|
| 842 |
+
*
|
| 843 |
+
* @param cvv Numeric field with a max of 4 characters.
|
| 844 |
+
*/
|
| 845 |
+
public function SetCvv($cvv)
|
| 846 |
+
{
|
| 847 |
+
$this->cvv = $cvv;
|
| 848 |
+
}
|
| 849 |
+
|
| 850 |
+
/**
|
| 851 |
+
* Setter for Email Address Value
|
| 852 |
+
*
|
| 853 |
+
* @param email Alpha-numeric field.
|
| 854 |
+
*/
|
| 855 |
+
public function SetEmail($email)
|
| 856 |
+
{
|
| 857 |
+
$this->email = $email;
|
| 858 |
+
}
|
| 859 |
+
/**
|
| 860 |
+
* Setter for Email Address Value
|
| 861 |
+
*
|
| 862 |
+
* @param email Alpha-numeric field.
|
| 863 |
+
*/
|
| 864 |
+
public function SetDescription($description)
|
| 865 |
+
{
|
| 866 |
+
$this->description = $description;
|
| 867 |
+
}
|
| 868 |
+
/**
|
| 869 |
+
* Setter for Card Expiry and Card Holder Name values
|
| 870 |
+
* These are mandatory for non-SecureCard transactions
|
| 871 |
+
*
|
| 872 |
+
* @param email Alpha-numeric field.
|
| 873 |
+
*/
|
| 874 |
+
public function SetNonSecureCardCardInfo($cardExpiry, $cardHolderName)
|
| 875 |
+
{
|
| 876 |
+
$this->cardExpiry = $cardExpiry;
|
| 877 |
+
$this->cardHolderName = $cardHolderName;
|
| 878 |
+
}
|
| 879 |
+
/**
|
| 880 |
+
* Setter for Issue No
|
| 881 |
+
*
|
| 882 |
+
* @param issueNo Numeric field with a max of 3 characters.
|
| 883 |
+
*/
|
| 884 |
+
public function SetIssueNo($issueNo)
|
| 885 |
+
{
|
| 886 |
+
$this->issueNo = $issueNo;
|
| 887 |
+
}
|
| 888 |
+
|
| 889 |
+
/**
|
| 890 |
+
* Setter for Address Verification Values
|
| 891 |
+
*
|
| 892 |
+
* @param address1 First Line of address - Max size 20
|
| 893 |
+
* @param address2 Second Line of address - Max size 20
|
| 894 |
+
* @param postCode Postcode - Max size 9
|
| 895 |
+
*/
|
| 896 |
+
public function SetAvs($address1, $address2, $postCode)
|
| 897 |
+
{
|
| 898 |
+
$this->address1 = $address1;
|
| 899 |
+
$this->address2 = $address2;
|
| 900 |
+
$this->postCode = $postCode;
|
| 901 |
+
}
|
| 902 |
+
/**
|
| 903 |
+
* Setter for Foreign Currency Information
|
| 904 |
+
*
|
| 905 |
+
* @param cardCurrency ISO 4217 3 Digit Currency Code, e.g. EUR / USD / GBP
|
| 906 |
+
* @param cardAmount (Amount X Conversion rate) Formatted to two decimal places
|
| 907 |
+
* @param conversionRate Converstion rate supplied in rate response
|
| 908 |
+
*/
|
| 909 |
+
public function SetForeignCurrencyInformation($cardCurrency, $cardAmount, $conversionRate)
|
| 910 |
+
{
|
| 911 |
+
$this->cardCurrency = $cardCurrency;
|
| 912 |
+
$this->cardAmount = $cardAmount;
|
| 913 |
+
$this->conversionRate = $conversionRate;
|
| 914 |
+
|
| 915 |
+
$this->foreignCurInfoSet = true;
|
| 916 |
+
}
|
| 917 |
+
/**
|
| 918 |
+
* Setter for the cardholders IP address
|
| 919 |
+
*
|
| 920 |
+
* @param ipAddress IP Address of the cardholder
|
| 921 |
+
*/
|
| 922 |
+
public function SetIPAddress($ipAddress)
|
| 923 |
+
{
|
| 924 |
+
$this->ipAddress = $ipAddress;
|
| 925 |
+
}
|
| 926 |
+
/**
|
| 927 |
+
* Setter for Multicurrency value
|
| 928 |
+
*/
|
| 929 |
+
public function SetMultiCur()
|
| 930 |
+
{
|
| 931 |
+
$this->multicur = true;
|
| 932 |
+
}
|
| 933 |
+
/**
|
| 934 |
+
* Setter to flag transaction as a Mail Order. If not set the transaction defaults to eCommerce
|
| 935 |
+
*/
|
| 936 |
+
public function SetMotoTrans()
|
| 937 |
+
{
|
| 938 |
+
$this->terminalType = "1";
|
| 939 |
+
$this->transactionType = "4";
|
| 940 |
+
}
|
| 941 |
+
/**
|
| 942 |
+
* Setter for hash value
|
| 943 |
+
*
|
| 944 |
+
* @param sharedSecret
|
| 945 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 946 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 947 |
+
*/
|
| 948 |
+
public function SetHash($sharedSecret)
|
| 949 |
+
{
|
| 950 |
+
if(isset($this->multicur) && $this->multicur == true) $this->hash = $this->GetRequestHash($this->terminalId . $this->orderId . $this->currency . $this->amount . $this->dateTime . $sharedSecret);
|
| 951 |
+
else $this->hash = $this->GetRequestHash($this->terminalId . $this->orderId . $this->amount . $this->dateTime . $sharedSecret);
|
| 952 |
+
}
|
| 953 |
+
/**
|
| 954 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 955 |
+
*
|
| 956 |
+
* @param sharedSecret
|
| 957 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 958 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 959 |
+
*
|
| 960 |
+
* @param testAccount
|
| 961 |
+
* Boolean value defining Mode
|
| 962 |
+
* true - This is a test account
|
| 963 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 964 |
+
*
|
| 965 |
+
* @return XmlPreAuthResponse containing an error or the parsed payment response.
|
| 966 |
+
*/
|
| 967 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 968 |
+
{
|
| 969 |
+
return $this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 970 |
+
}
|
| 971 |
+
|
| 972 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 973 |
+
{
|
| 974 |
+
$this->SetHash($sharedSecret);
|
| 975 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 976 |
+
$response = new XmlPreAuthResponse($responseString);
|
| 977 |
+
return $response;
|
| 978 |
+
}
|
| 979 |
+
|
| 980 |
+
public function GenerateXml()
|
| 981 |
+
{
|
| 982 |
+
$requestXML = new DOMDocument("1.0");
|
| 983 |
+
$requestXML->formatOutput = true;
|
| 984 |
+
|
| 985 |
+
$requestString = $requestXML->createElement("PREAUTH");
|
| 986 |
+
$requestXML->appendChild($requestString);
|
| 987 |
+
|
| 988 |
+
$node = $requestXML->createElement("ORDERID");
|
| 989 |
+
$node->appendChild($requestXML->createTextNode($this->orderId));
|
| 990 |
+
$requestString->appendChild($node);
|
| 991 |
+
|
| 992 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 993 |
+
$requestString->appendChild($node);
|
| 994 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 995 |
+
|
| 996 |
+
$node = $requestXML->createElement("AMOUNT");
|
| 997 |
+
$requestString->appendChild($node);
|
| 998 |
+
$node->appendChild($requestXML->createTextNode($this->amount));
|
| 999 |
+
|
| 1000 |
+
$node = $requestXML->createElement("DATETIME");
|
| 1001 |
+
$requestString->appendChild($node);
|
| 1002 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 1003 |
+
|
| 1004 |
+
$node = $requestXML->createElement("CARDNUMBER");
|
| 1005 |
+
$requestString->appendChild($node);
|
| 1006 |
+
$node->appendChild($requestXML->createTextNode($this->cardNumber));
|
| 1007 |
+
|
| 1008 |
+
$node = $requestXML->createElement("CARDTYPE");
|
| 1009 |
+
$requestString->appendChild($node);
|
| 1010 |
+
$node->appendChild($requestXML->createTextNode($this->cardType));
|
| 1011 |
+
|
| 1012 |
+
if($this->cardExpiry !== NULL && $this->cardHolderName !== NULL) {
|
| 1013 |
+
$node = $requestXML->createElement("CARDEXPIRY");
|
| 1014 |
+
$requestString->appendChild($node);
|
| 1015 |
+
$node->appendChild($requestXML->createTextNode($this->cardExpiry));
|
| 1016 |
+
|
| 1017 |
+
$node = $requestXML->createElement("CARDHOLDERNAME");
|
| 1018 |
+
$requestString->appendChild($node);
|
| 1019 |
+
$node->appendChild($requestXML->createTextNode($this->cardHolderName));
|
| 1020 |
+
}
|
| 1021 |
+
|
| 1022 |
+
$node = $requestXML->createElement("HASH");
|
| 1023 |
+
$requestString->appendChild($node);
|
| 1024 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 1025 |
+
|
| 1026 |
+
$node = $requestXML->createElement("CURRENCY");
|
| 1027 |
+
$requestString->appendChild($node);
|
| 1028 |
+
$node->appendChild($requestXML->createTextNode($this->currency));
|
| 1029 |
+
|
| 1030 |
+
if($this->foreignCurInfoSet)
|
| 1031 |
+
{
|
| 1032 |
+
$dcNode = $requestXML->createElement("FOREIGNCURRENCYINFORMATION");
|
| 1033 |
+
$requestString->appendChild($dcNode );
|
| 1034 |
+
|
| 1035 |
+
$dcSubNode = $requestXML->createElement("CARDCURRENCY");
|
| 1036 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->cardCurrency));
|
| 1037 |
+
$dcNode->appendChild($dcSubNode);
|
| 1038 |
+
|
| 1039 |
+
$dcSubNode = $requestXML->createElement("CARDAMOUNT");
|
| 1040 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->cardAmount));
|
| 1041 |
+
$dcNode->appendChild($dcSubNode);
|
| 1042 |
+
|
| 1043 |
+
$dcSubNode = $requestXML->createElement("CONVERSIONRATE");
|
| 1044 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->conversionRate));
|
| 1045 |
+
$dcNode->appendChild($dcSubNode);
|
| 1046 |
+
}
|
| 1047 |
+
|
| 1048 |
+
$node = $requestXML->createElement("TERMINALTYPE");
|
| 1049 |
+
$requestString->appendChild($node);
|
| 1050 |
+
$nodeText = $requestXML->createTextNode($this->terminalType);
|
| 1051 |
+
$node->appendChild($nodeText);
|
| 1052 |
+
|
| 1053 |
+
$node = $requestXML->createElement("TRANSACTIONTYPE");
|
| 1054 |
+
$requestString->appendChild($node);
|
| 1055 |
+
$nodeText = $requestXML->createTextNode($this->transactionType);
|
| 1056 |
+
$node->appendChild($nodeText);
|
| 1057 |
+
|
| 1058 |
+
if($this->email !== NULL)
|
| 1059 |
+
{
|
| 1060 |
+
$node = $requestXML->createElement("EMAIL");
|
| 1061 |
+
$requestString->appendChild($node);
|
| 1062 |
+
$node->appendChild($requestXML->createTextNode($this->email));
|
| 1063 |
+
}
|
| 1064 |
+
|
| 1065 |
+
if($this->cvv !== NULL)
|
| 1066 |
+
{
|
| 1067 |
+
$node = $requestXML->createElement("CVV");
|
| 1068 |
+
$requestString->appendChild($node);
|
| 1069 |
+
$node->appendChild($requestXML->createTextNode($this->cvv));
|
| 1070 |
+
}
|
| 1071 |
+
|
| 1072 |
+
if($this->issueNo !== NULL)
|
| 1073 |
+
{
|
| 1074 |
+
$node = $requestXML->createElement("ISSUENO");
|
| 1075 |
+
$requestString->appendChild($node);
|
| 1076 |
+
$node->appendChild($requestXML->createTextNode($this->issueNo));
|
| 1077 |
+
}
|
| 1078 |
+
|
| 1079 |
+
if($this->postCode !== NULL)
|
| 1080 |
+
{
|
| 1081 |
+
if($this->address1 !== NULL)
|
| 1082 |
+
{
|
| 1083 |
+
$node = $requestXML->createElement("ADDRESS1");
|
| 1084 |
+
$requestString->appendChild($node);
|
| 1085 |
+
$node->appendChild($requestXML->createTextNode($this->address1));
|
| 1086 |
+
}
|
| 1087 |
+
if($this->address2 !== NULL)
|
| 1088 |
+
{
|
| 1089 |
+
$node = $requestXML->createElement("ADDRESS2");
|
| 1090 |
+
$requestString->appendChild($node);
|
| 1091 |
+
$node->appendChild($requestXML->createTextNode($this->address2));
|
| 1092 |
+
}
|
| 1093 |
+
|
| 1094 |
+
$node = $requestXML->createElement("POSTCODE");
|
| 1095 |
+
$requestString->appendChild($node);
|
| 1096 |
+
$node->appendChild($requestXML->createTextNode($this->postCode));
|
| 1097 |
+
}
|
| 1098 |
+
|
| 1099 |
+
if($this->description !== NULL)
|
| 1100 |
+
{
|
| 1101 |
+
$node = $requestXML->createElement("DESCRIPTION");
|
| 1102 |
+
$requestString->appendChild($node);
|
| 1103 |
+
$node->appendChild($requestXML->createTextNode($this->description));
|
| 1104 |
+
}
|
| 1105 |
+
|
| 1106 |
+
if($this->ipAddress !== NULL)
|
| 1107 |
+
{
|
| 1108 |
+
$node = $requestXML->createElement("IPADDRESS");
|
| 1109 |
+
$requestString->appendChild($node);
|
| 1110 |
+
$node->appendChild($requestXML->createTextNode($this->ipAddress));
|
| 1111 |
+
}
|
| 1112 |
+
|
| 1113 |
+
return $requestXML->saveXML();
|
| 1114 |
+
|
| 1115 |
+
}
|
| 1116 |
+
}
|
| 1117 |
+
|
| 1118 |
+
/**
|
| 1119 |
+
* Used for processing XML PreAuthorisation Completions through the WorldNet TPS XML Gateway.
|
| 1120 |
+
*
|
| 1121 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 1122 |
+
*/
|
| 1123 |
+
class XmlPreAuthCompletionRequest extends Request
|
| 1124 |
+
{
|
| 1125 |
+
private $terminalId;
|
| 1126 |
+
private $orderId;
|
| 1127 |
+
private $uniqueRef;
|
| 1128 |
+
private $amount;
|
| 1129 |
+
public function Amount()
|
| 1130 |
+
{
|
| 1131 |
+
return $this->amount;
|
| 1132 |
+
}
|
| 1133 |
+
private $dateTime;
|
| 1134 |
+
private $hash;
|
| 1135 |
+
private $description;
|
| 1136 |
+
private $cvv;
|
| 1137 |
+
private $cardCurrency;
|
| 1138 |
+
private $cardAmount;
|
| 1139 |
+
private $conversionRate;
|
| 1140 |
+
private $multicur = false;
|
| 1141 |
+
|
| 1142 |
+
private $foreignCurInfoSet = false;
|
| 1143 |
+
|
| 1144 |
+
/**
|
| 1145 |
+
* Creates the standard request less optional parameters for processing an XML Transaction
|
| 1146 |
+
* through the WorldNetTPS XML Gateway
|
| 1147 |
+
*
|
| 1148 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 1149 |
+
* @param orderId A unique merchant identifier. Alpha numeric and max size 12 chars.
|
| 1150 |
+
* @param currency ISO 4217 3 Digit Currency Code, e.g. EUR / USD / GBP
|
| 1151 |
+
* @param amount Transaction Amount, Double formatted to 2 decimal places.
|
| 1152 |
+
* @param description Transaction Description
|
| 1153 |
+
* @param email Cardholder e-mail
|
| 1154 |
+
* @param cardNumber A valid Card Number that passes the Luhn Check.
|
| 1155 |
+
* @param cardType
|
| 1156 |
+
* Card Type (Accepted Card Types must be configured in the Merchant Selfcare System.)
|
| 1157 |
+
*
|
| 1158 |
+
* Accepted Values :
|
| 1159 |
+
*
|
| 1160 |
+
* VISA
|
| 1161 |
+
* MASTERCARD
|
| 1162 |
+
* LASER
|
| 1163 |
+
* SWITCH
|
| 1164 |
+
* SOLO
|
| 1165 |
+
* AMEX
|
| 1166 |
+
* DINERS
|
| 1167 |
+
* MAESTRO
|
| 1168 |
+
* DELTA
|
| 1169 |
+
* ELECTRON
|
| 1170 |
+
*
|
| 1171 |
+
* @param cardExpiry Card Expiry formatted MMYY
|
| 1172 |
+
* @param cardHolderName Card Holder Name
|
| 1173 |
+
*/
|
| 1174 |
+
public function XmlPreAuthCompletionRequest($terminalId,
|
| 1175 |
+
$orderId,
|
| 1176 |
+
$amount)
|
| 1177 |
+
{
|
| 1178 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 1179 |
+
|
| 1180 |
+
$this->terminalId = $terminalId;
|
| 1181 |
+
$this->orderId = $orderId;
|
| 1182 |
+
$this->amount = $amount;
|
| 1183 |
+
}
|
| 1184 |
+
/**
|
| 1185 |
+
* Setter for UniqueRef
|
| 1186 |
+
|
| 1187 |
+
*
|
| 1188 |
+
* @param uniqueRef
|
| 1189 |
+
* Unique Reference of transaction returned from gateway in authorisation response
|
| 1190 |
+
*/
|
| 1191 |
+
public function SetUniqueRef($uniqueRef)
|
| 1192 |
+
{
|
| 1193 |
+
$this->uniqueRef = $uniqueRef;
|
| 1194 |
+
$this->orderId = "";
|
| 1195 |
+
}
|
| 1196 |
+
/**
|
| 1197 |
+
* Setter for Card Verification Value
|
| 1198 |
+
*
|
| 1199 |
+
* @param cvv Numeric field with a max of 4 characters.
|
| 1200 |
+
*/
|
| 1201 |
+
public function SetCvv($cvv)
|
| 1202 |
+
{
|
| 1203 |
+
$this->cvv = $cvv;
|
| 1204 |
+
}
|
| 1205 |
+
/**
|
| 1206 |
+
* Setter for transaction description
|
| 1207 |
+
*
|
| 1208 |
+
* @param cvv Discretionary text value
|
| 1209 |
+
*/
|
| 1210 |
+
public function SetDescription($description)
|
| 1211 |
+
{
|
| 1212 |
+
$this->description = $description;
|
| 1213 |
+
}
|
| 1214 |
+
/**
|
| 1215 |
+
* Setter for Foreign Currency Information
|
| 1216 |
+
*
|
| 1217 |
+
* @param cardCurrency ISO 4217 3 Digit Currency Code, e.g. EUR / USD / GBP
|
| 1218 |
+
* @param cardAmount (Amount X Conversion rate) Formatted to two decimal places
|
| 1219 |
+
* @param conversionRate Converstion rate supplied in rate response
|
| 1220 |
+
*/
|
| 1221 |
+
public function SetForeignCurrencyInformation($cardCurrency, $cardAmount, $conversionRate)
|
| 1222 |
+
{
|
| 1223 |
+
$this->cardCurrency = $cardCurrency;
|
| 1224 |
+
$this->cardAmount = $cardAmount;
|
| 1225 |
+
$this->conversionRate = $conversionRate;
|
| 1226 |
+
|
| 1227 |
+
$this->foreignCurInfoSet = true;
|
| 1228 |
+
}
|
| 1229 |
+
/**
|
| 1230 |
+
|
| 1231 |
+
|
| 1232 |
+
* Setter for hash value
|
| 1233 |
+
*
|
| 1234 |
+
* @param sharedSecret
|
| 1235 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1236 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1237 |
+
*/
|
| 1238 |
+
public function SetHash($sharedSecret)
|
| 1239 |
+
{
|
| 1240 |
+
if($this->uniqueRef !== NULL)
|
| 1241 |
+
{
|
| 1242 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->uniqueRef. $this->amount . $this->dateTime . $sharedSecret);
|
| 1243 |
+
} else {
|
| 1244 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->orderId . $this->amount . $this->dateTime . $sharedSecret);
|
| 1245 |
+
}
|
| 1246 |
+
}
|
| 1247 |
+
/**
|
| 1248 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 1249 |
+
*
|
| 1250 |
+
* @param sharedSecret
|
| 1251 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1252 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1253 |
+
*
|
| 1254 |
+
* @param testAccount
|
| 1255 |
+
* Boolean value defining Mode
|
| 1256 |
+
* true - This is a test account
|
| 1257 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 1258 |
+
*
|
| 1259 |
+
* @return XmlPreAuthCompletionResponse containing an error or the parsed payment response.
|
| 1260 |
+
*/
|
| 1261 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 1262 |
+
{
|
| 1263 |
+
return $this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 1264 |
+
}
|
| 1265 |
+
|
| 1266 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 1267 |
+
{
|
| 1268 |
+
$this->SetHash($sharedSecret);
|
| 1269 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 1270 |
+
$response = new XmlPreAuthCompletionResponse($responseString);
|
| 1271 |
+
return $response;
|
| 1272 |
+
}
|
| 1273 |
+
|
| 1274 |
+
public function GenerateXml()
|
| 1275 |
+
{
|
| 1276 |
+
$requestXML = new DOMDocument("1.0");
|
| 1277 |
+
$requestXML->formatOutput = true;
|
| 1278 |
+
|
| 1279 |
+
$requestString = $requestXML->createElement("PREAUTHCOMPLETION");
|
| 1280 |
+
$requestXML->appendChild($requestString);
|
| 1281 |
+
|
| 1282 |
+
if($this->uniqueRef !== NULL)
|
| 1283 |
+
{
|
| 1284 |
+
$node = $requestXML->createElement("UNIQUEREF");
|
| 1285 |
+
$node->appendChild($requestXML->createTextNode($this->uniqueRef));
|
| 1286 |
+
$requestString->appendChild($node);
|
| 1287 |
+
} else {
|
| 1288 |
+
$node = $requestXML->createElement("ORDERID");
|
| 1289 |
+
$node->appendChild($requestXML->createTextNode($this->orderId));
|
| 1290 |
+
$requestString->appendChild($node);
|
| 1291 |
+
}
|
| 1292 |
+
|
| 1293 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 1294 |
+
$requestString->appendChild($node);
|
| 1295 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 1296 |
+
|
| 1297 |
+
$node = $requestXML->createElement("AMOUNT");
|
| 1298 |
+
$requestString->appendChild($node);
|
| 1299 |
+
$node->appendChild($requestXML->createTextNode($this->amount));
|
| 1300 |
+
|
| 1301 |
+
if($this->foreignCurInfoSet)
|
| 1302 |
+
{
|
| 1303 |
+
$dcNode = $requestXML->createElement("FOREIGNCURRENCYINFORMATION");
|
| 1304 |
+
$requestString->appendChild($dcNode );
|
| 1305 |
+
|
| 1306 |
+
$dcSubNode = $requestXML->createElement("CARDCURRENCY");
|
| 1307 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->cardCurrency));
|
| 1308 |
+
$dcNode->appendChild($dcSubNode);
|
| 1309 |
+
|
| 1310 |
+
$dcSubNode = $requestXML->createElement("CARDAMOUNT");
|
| 1311 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->cardAmount));
|
| 1312 |
+
$dcNode->appendChild($dcSubNode);
|
| 1313 |
+
|
| 1314 |
+
$dcSubNode = $requestXML->createElement("CONVERSIONRATE");
|
| 1315 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->conversionRate));
|
| 1316 |
+
$dcNode->appendChild($dcSubNode);
|
| 1317 |
+
}
|
| 1318 |
+
|
| 1319 |
+
if($this->description !== NULL)
|
| 1320 |
+
{
|
| 1321 |
+
$node = $requestXML->createElement("DESCRIPTION");
|
| 1322 |
+
$requestString->appendChild($node);
|
| 1323 |
+
$nodeText = $requestXML->createTextNode($this->description);
|
| 1324 |
+
$node->appendChild($nodeText);
|
| 1325 |
+
}
|
| 1326 |
+
|
| 1327 |
+
$node = $requestXML->createElement("DATETIME");
|
| 1328 |
+
$requestString->appendChild($node);
|
| 1329 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 1330 |
+
|
| 1331 |
+
if($this->cvv !== NULL)
|
| 1332 |
+
{
|
| 1333 |
+
$node = $requestXML->createElement("CVV");
|
| 1334 |
+
$requestString->appendChild($node);
|
| 1335 |
+
$node->appendChild($requestXML->createTextNode($this->cvv));
|
| 1336 |
+
}
|
| 1337 |
+
|
| 1338 |
+
$node = $requestXML->createElement("HASH");
|
| 1339 |
+
$requestString->appendChild($node);
|
| 1340 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 1341 |
+
|
| 1342 |
+
return $requestXML->saveXML();
|
| 1343 |
+
|
| 1344 |
+
}
|
| 1345 |
+
}
|
| 1346 |
+
|
| 1347 |
+
/**
|
| 1348 |
+
* Used for processing XML PreAuthorisation Completions through the WorldNet TPS XML Gateway.
|
| 1349 |
+
*
|
| 1350 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 1351 |
+
*/
|
| 1352 |
+
class XmlRateRequest extends Request
|
| 1353 |
+
{
|
| 1354 |
+
private $terminalId;
|
| 1355 |
+
private $cardBin;
|
| 1356 |
+
private $baseAmount;
|
| 1357 |
+
|
| 1358 |
+
/**
|
| 1359 |
+
* Creates the rate request for processing an XML Transaction
|
| 1360 |
+
* through the WorldNetTPS XML Gateway
|
| 1361 |
+
*
|
| 1362 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 1363 |
+
* @param cardBin First 6 digits of the card number
|
| 1364 |
+
*/
|
| 1365 |
+
public function XmlRateRequest($terminalId,
|
| 1366 |
+
$cardBin)
|
| 1367 |
+
{
|
| 1368 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 1369 |
+
|
| 1370 |
+
$this->terminalId = $terminalId;
|
| 1371 |
+
$this->cardBin = $cardBin;
|
| 1372 |
+
}
|
| 1373 |
+
/**
|
| 1374 |
+
* Setter for Card Verification Value
|
| 1375 |
+
*
|
| 1376 |
+
* @param cvv Numeric field with a max of 4 characters.
|
| 1377 |
+
*/
|
| 1378 |
+
public function SetBaseAmount($baseAmount)
|
| 1379 |
+
{
|
| 1380 |
+
$this->baseAmount = $baseAmount;
|
| 1381 |
+
}
|
| 1382 |
+
/**
|
| 1383 |
+
* Setter for hash value
|
| 1384 |
+
*
|
| 1385 |
+
* @param sharedSecret
|
| 1386 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1387 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1388 |
+
*/
|
| 1389 |
+
public function SetHash($sharedSecret)
|
| 1390 |
+
{
|
| 1391 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->cardBin . $this->dateTime . $sharedSecret);
|
| 1392 |
+
}
|
| 1393 |
+
/**
|
| 1394 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 1395 |
+
*
|
| 1396 |
+
* @param sharedSecret
|
| 1397 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1398 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1399 |
+
*
|
| 1400 |
+
* @param testAccount
|
| 1401 |
+
* Boolean value defining Mode
|
| 1402 |
+
* true - This is a test account
|
| 1403 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 1404 |
+
*
|
| 1405 |
+
* @return XmlRateResponse containing an error or the parsed response.
|
| 1406 |
+
*/
|
| 1407 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 1408 |
+
{
|
| 1409 |
+
return $this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 1410 |
+
}
|
| 1411 |
+
|
| 1412 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 1413 |
+
{
|
| 1414 |
+
$this->SetHash($sharedSecret);
|
| 1415 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 1416 |
+
$response = new XmlRateResponse($responseString);
|
| 1417 |
+
return $response;
|
| 1418 |
+
}
|
| 1419 |
+
|
| 1420 |
+
public function GenerateXml()
|
| 1421 |
+
{
|
| 1422 |
+
$requestXML = new DOMDocument("1.0");
|
| 1423 |
+
$requestXML->formatOutput = true;
|
| 1424 |
+
|
| 1425 |
+
$requestString = $requestXML->createElement("GETCARDCURRENCYRATE");
|
| 1426 |
+
$requestXML->appendChild($requestString);
|
| 1427 |
+
|
| 1428 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 1429 |
+
$requestString->appendChild($node);
|
| 1430 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 1431 |
+
|
| 1432 |
+
$node = $requestXML->createElement("CARDBIN");
|
| 1433 |
+
$requestString->appendChild($node);
|
| 1434 |
+
$node->appendChild($requestXML->createTextNode($this->cardBin));
|
| 1435 |
+
|
| 1436 |
+
$node = $requestXML->createElement("DATETIME");
|
| 1437 |
+
$requestString->appendChild($node);
|
| 1438 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 1439 |
+
|
| 1440 |
+
if($this->baseAmount != NULL )
|
| 1441 |
+
{
|
| 1442 |
+
$node = $requestXML->createElement("BASEAMOUNT");
|
| 1443 |
+
$requestString->appendChild($node);
|
| 1444 |
+
$node->appendChild($requestXML->createTextNode($this->baseAmount));
|
| 1445 |
+
}
|
| 1446 |
+
|
| 1447 |
+
$node = $requestXML->createElement("HASH");
|
| 1448 |
+
$requestString->appendChild($node);
|
| 1449 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 1450 |
+
|
| 1451 |
+
return $requestXML->saveXML();
|
| 1452 |
+
}
|
| 1453 |
+
}
|
| 1454 |
+
|
| 1455 |
+
/**
|
| 1456 |
+
* Used for processing XML SecureCard Registrations through the WorldNet TPS XML Gateway.
|
| 1457 |
+
*
|
| 1458 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 1459 |
+
*/
|
| 1460 |
+
class XmlSecureCardRegRequest extends Request
|
| 1461 |
+
{
|
| 1462 |
+
private $merchantRef;
|
| 1463 |
+
private $terminalId;
|
| 1464 |
+
private $cardNumber;
|
| 1465 |
+
private $cardExpiry;
|
| 1466 |
+
private $cardHolderName;
|
| 1467 |
+
private $dateTime;
|
| 1468 |
+
private $hash;
|
| 1469 |
+
private $dontCheckSecurity;
|
| 1470 |
+
private $cvv;
|
| 1471 |
+
private $issueNo;
|
| 1472 |
+
|
| 1473 |
+
/**
|
| 1474 |
+
* Creates the SecureCard Registration/Update request for processing
|
| 1475 |
+
* through the WorldNetTPS XML Gateway
|
| 1476 |
+
*
|
| 1477 |
+
* @param merchantRef A unique card identifier. Alpha numeric and max size 48 chars.
|
| 1478 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 1479 |
+
* @param cardNumber A valid Card Number that passes the Luhn Check.
|
| 1480 |
+
* @param cardType
|
| 1481 |
+
* Card Type (Accepted Card Types must be configured in the Merchant Selfcare System.)
|
| 1482 |
+
*
|
| 1483 |
+
* Accepted Values :
|
| 1484 |
+
|
| 1485 |
+
*
|
| 1486 |
+
* VISA
|
| 1487 |
+
* MASTERCARD
|
| 1488 |
+
* LASER
|
| 1489 |
+
* SWITCH
|
| 1490 |
+
* SOLO
|
| 1491 |
+
* AMEX
|
| 1492 |
+
* DINERS
|
| 1493 |
+
|
| 1494 |
+
|
| 1495 |
+
|
| 1496 |
+
* MAESTRO
|
| 1497 |
+
* DELTA
|
| 1498 |
+
* ELECTRON
|
| 1499 |
+
*
|
| 1500 |
+
* @param cardExpiry Card Expiry formatted MMYY
|
| 1501 |
+
* @param cardHolderName Card Holder Name
|
| 1502 |
+
*/
|
| 1503 |
+
public function XmlSecureCardRegRequest($merchantRef,
|
| 1504 |
+
$terminalId,
|
| 1505 |
+
$cardNumber,
|
| 1506 |
+
$cardExpiry,
|
| 1507 |
+
$cardType,
|
| 1508 |
+
$cardHolderName)
|
| 1509 |
+
{
|
| 1510 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 1511 |
+
|
| 1512 |
+
$this->merchantRef = $merchantRef;
|
| 1513 |
+
$this->terminalId = $terminalId;
|
| 1514 |
+
$this->cardNumber = $cardNumber;
|
| 1515 |
+
$this->cardExpiry = $cardExpiry;
|
| 1516 |
+
$this->cardType = $cardType;
|
| 1517 |
+
$this->cardHolderName = $cardHolderName;
|
| 1518 |
+
}
|
| 1519 |
+
/**
|
| 1520 |
+
* Setter for dontCheckSecurity setting
|
| 1521 |
+
*
|
| 1522 |
+
* @param dontCheckSecurity can be either "Y" or "N".
|
| 1523 |
+
*/
|
| 1524 |
+
public function SetDontCheckSecurity($dontCheckSecurity)
|
| 1525 |
+
{
|
| 1526 |
+
$this->dontCheckSecurity = $dontCheckSecurity;
|
| 1527 |
+
}
|
| 1528 |
+
|
| 1529 |
+
/**
|
| 1530 |
+
* Setter for Card Verification Value
|
| 1531 |
+
*
|
| 1532 |
+
* @param cvv Numeric field with a max of 4 characters.
|
| 1533 |
+
*/
|
| 1534 |
+
public function SetCvv($cvv)
|
| 1535 |
+
{
|
| 1536 |
+
$this->cvv = $cvv;
|
| 1537 |
+
}
|
| 1538 |
+
|
| 1539 |
+
/**
|
| 1540 |
+
* Setter for Issue No
|
| 1541 |
+
*
|
| 1542 |
+
* @param issueNo Numeric field with a max of 3 characters.
|
| 1543 |
+
*/
|
| 1544 |
+
public function SetIssueNo($issueNo)
|
| 1545 |
+
{
|
| 1546 |
+
$this->issueNo = $issueNo;
|
| 1547 |
+
}
|
| 1548 |
+
|
| 1549 |
+
/**
|
| 1550 |
+
* Setter for hash value
|
| 1551 |
+
*
|
| 1552 |
+
* @param sharedSecret
|
| 1553 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1554 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1555 |
+
*/
|
| 1556 |
+
public function SetHash($sharedSecret)
|
| 1557 |
+
{
|
| 1558 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->dateTime . $this->cardNumber . $this->cardExpiry . $this->cardType . $this->cardHolderName . $sharedSecret);
|
| 1559 |
+
}
|
| 1560 |
+
/**
|
| 1561 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 1562 |
+
*
|
| 1563 |
+
* @param sharedSecret
|
| 1564 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1565 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1566 |
+
*
|
| 1567 |
+
* @param testAccount
|
| 1568 |
+
* Boolean value defining Mode
|
| 1569 |
+
* true - This is a test account
|
| 1570 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 1571 |
+
*
|
| 1572 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 1573 |
+
*/
|
| 1574 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 1575 |
+
{
|
| 1576 |
+
return $this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 1577 |
+
}
|
| 1578 |
+
|
| 1579 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 1580 |
+
{
|
| 1581 |
+
$this->SetHash($sharedSecret);
|
| 1582 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 1583 |
+
$response = new XmlSecureCardRegResponse($responseString);
|
| 1584 |
+
return $response;
|
| 1585 |
+
}
|
| 1586 |
+
|
| 1587 |
+
public function GenerateXml()
|
| 1588 |
+
{
|
| 1589 |
+
$requestXML = new DOMDocument("1.0");
|
| 1590 |
+
$requestXML->formatOutput = true;
|
| 1591 |
+
|
| 1592 |
+
$requestString = $requestXML->createElement("SECURECARDREGISTRATION");
|
| 1593 |
+
$requestXML->appendChild($requestString);
|
| 1594 |
+
|
| 1595 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 1596 |
+
$requestString->appendChild($node);
|
| 1597 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 1598 |
+
|
| 1599 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 1600 |
+
$requestString->appendChild($node);
|
| 1601 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 1602 |
+
|
| 1603 |
+
$node = $requestXML->createElement("DATETIME");
|
| 1604 |
+
$requestString->appendChild($node);
|
| 1605 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 1606 |
+
|
| 1607 |
+
$node = $requestXML->createElement("CARDNUMBER");
|
| 1608 |
+
$requestString->appendChild($node);
|
| 1609 |
+
$node->appendChild($requestXML->createTextNode($this->cardNumber));
|
| 1610 |
+
|
| 1611 |
+
$node = $requestXML->createElement("CARDEXPIRY");
|
| 1612 |
+
$requestString->appendChild($node);
|
| 1613 |
+
$node->appendChild($requestXML->createTextNode($this->cardExpiry));
|
| 1614 |
+
|
| 1615 |
+
$node = $requestXML->createElement("CARDTYPE");
|
| 1616 |
+
$requestString->appendChild($node);
|
| 1617 |
+
$node->appendChild($requestXML->createTextNode($this->cardType));
|
| 1618 |
+
|
| 1619 |
+
$node = $requestXML->createElement("CARDHOLDERNAME");
|
| 1620 |
+
$requestString->appendChild($node);
|
| 1621 |
+
$node->appendChild($requestXML->createTextNode($this->cardHolderName));
|
| 1622 |
+
|
| 1623 |
+
$node = $requestXML->createElement("HASH");
|
| 1624 |
+
$requestString->appendChild($node);
|
| 1625 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 1626 |
+
|
| 1627 |
+
if($this->dontCheckSecurity !== NULL)
|
| 1628 |
+
{
|
| 1629 |
+
$node = $requestXML->createElement("DONTCHECKSECURITY");
|
| 1630 |
+
$requestString->appendChild($node);
|
| 1631 |
+
$node->appendChild($requestXML->createTextNode($this->dontCheckSecurity));
|
| 1632 |
+
}
|
| 1633 |
+
|
| 1634 |
+
if($this->cvv !== NULL)
|
| 1635 |
+
{
|
| 1636 |
+
$node = $requestXML->createElement("CVV");
|
| 1637 |
+
$requestString->appendChild($node);
|
| 1638 |
+
$node->appendChild($requestXML->createTextNode($this->cvv));
|
| 1639 |
+
}
|
| 1640 |
+
|
| 1641 |
+
if($this->issueNo !== NULL)
|
| 1642 |
+
{
|
| 1643 |
+
$node = $requestXML->createElement("ISSUENO");
|
| 1644 |
+
$requestString->appendChild($node);
|
| 1645 |
+
$node->appendChild($requestXML->createTextNode($this->issueNo));
|
| 1646 |
+
}
|
| 1647 |
+
|
| 1648 |
+
return $requestXML->saveXML();
|
| 1649 |
+
}
|
| 1650 |
+
}
|
| 1651 |
+
|
| 1652 |
+
/**
|
| 1653 |
+
* Used for processing XML SecureCard Registrations through the WorldNet TPS XML Gateway.
|
| 1654 |
+
*
|
| 1655 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 1656 |
+
*/
|
| 1657 |
+
class XmlSecureCardUpdRequest extends Request
|
| 1658 |
+
{
|
| 1659 |
+
private $merchantRef;
|
| 1660 |
+
private $terminalId;
|
| 1661 |
+
private $cardNumber;
|
| 1662 |
+
private $cardExpiry;
|
| 1663 |
+
private $cardHolderName;
|
| 1664 |
+
private $dateTime;
|
| 1665 |
+
private $hash;
|
| 1666 |
+
private $dontCheckSecurity;
|
| 1667 |
+
private $cvv;
|
| 1668 |
+
private $issueNo;
|
| 1669 |
+
|
| 1670 |
+
/**
|
| 1671 |
+
* Creates the SecureCard Registration/Update request for processing
|
| 1672 |
+
* through the WorldNetTPS XML Gateway
|
| 1673 |
+
*
|
| 1674 |
+
* @param merchantRef A unique card identifier. Alpha numeric and max size 48 chars.
|
| 1675 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 1676 |
+
* @param cardNumber A valid Card Number that passes the Luhn Check.
|
| 1677 |
+
* @param cardType
|
| 1678 |
+
* Card Type (Accepted Card Types must be configured in the Merchant Selfcare System.)
|
| 1679 |
+
*
|
| 1680 |
+
* Accepted Values :
|
| 1681 |
+
*
|
| 1682 |
+
* VISA
|
| 1683 |
+
* MASTERCARD
|
| 1684 |
+
* LASER
|
| 1685 |
+
* SWITCH
|
| 1686 |
+
* SOLO
|
| 1687 |
+
* AMEX
|
| 1688 |
+
* DINERS
|
| 1689 |
+
* MAESTRO
|
| 1690 |
+
* DELTA
|
| 1691 |
+
* ELECTRON
|
| 1692 |
+
*
|
| 1693 |
+
* @param cardExpiry Card Expiry formatted MMYY
|
| 1694 |
+
* @param cardHolderName Card Holder Name
|
| 1695 |
+
*/
|
| 1696 |
+
public function XmlSecureCardUpdRequest($merchantRef,
|
| 1697 |
+
$terminalId,
|
| 1698 |
+
$cardNumber,
|
| 1699 |
+
$cardExpiry,
|
| 1700 |
+
$cardType,
|
| 1701 |
+
$cardHolderName)
|
| 1702 |
+
{
|
| 1703 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 1704 |
+
|
| 1705 |
+
$this->merchantRef = $merchantRef;
|
| 1706 |
+
$this->terminalId = $terminalId;
|
| 1707 |
+
$this->cardNumber = $cardNumber;
|
| 1708 |
+
$this->cardExpiry = $cardExpiry;
|
| 1709 |
+
$this->cardType = $cardType;
|
| 1710 |
+
$this->cardHolderName = $cardHolderName;
|
| 1711 |
+
}
|
| 1712 |
+
/**
|
| 1713 |
+
* Setter for dontCheckSecurity setting
|
| 1714 |
+
*
|
| 1715 |
+
* @param dontCheckSecurity can be either "Y" or "N".
|
| 1716 |
+
*/
|
| 1717 |
+
public function SetDontCheckSecurity($dontCheckSecurity)
|
| 1718 |
+
{
|
| 1719 |
+
$this->dontCheckSecurity = $dontCheckSecurity;
|
| 1720 |
+
}
|
| 1721 |
+
|
| 1722 |
+
/**
|
| 1723 |
+
* Setter for Card Verification Value
|
| 1724 |
+
*
|
| 1725 |
+
* @param cvv Numeric field with a max of 4 characters.
|
| 1726 |
+
*/
|
| 1727 |
+
public function SetCvv($cvv)
|
| 1728 |
+
{
|
| 1729 |
+
$this->cvv = $cvv;
|
| 1730 |
+
}
|
| 1731 |
+
|
| 1732 |
+
/**
|
| 1733 |
+
* Setter for Issue No
|
| 1734 |
+
*
|
| 1735 |
+
* @param issueNo Numeric field with a max of 3 characters.
|
| 1736 |
+
*/
|
| 1737 |
+
public function SetIssueNo($issueNo)
|
| 1738 |
+
{
|
| 1739 |
+
$this->issueNo = $issueNo;
|
| 1740 |
+
}
|
| 1741 |
+
|
| 1742 |
+
/**
|
| 1743 |
+
* Setter for hash value
|
| 1744 |
+
*
|
| 1745 |
+
* @param sharedSecret
|
| 1746 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1747 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1748 |
+
*/
|
| 1749 |
+
public function SetHash($sharedSecret)
|
| 1750 |
+
{
|
| 1751 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->dateTime . $this->cardNumber . $this->cardExpiry . $this->cardType . $this->cardHolderName . $sharedSecret);
|
| 1752 |
+
}
|
| 1753 |
+
/**
|
| 1754 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 1755 |
+
*
|
| 1756 |
+
* @param sharedSecret
|
| 1757 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1758 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1759 |
+
*
|
| 1760 |
+
* @param testAccount
|
| 1761 |
+
* Boolean value defining Mode
|
| 1762 |
+
* true - This is a test account
|
| 1763 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 1764 |
+
*
|
| 1765 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 1766 |
+
*/
|
| 1767 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 1768 |
+
{
|
| 1769 |
+
return $this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 1770 |
+
}
|
| 1771 |
+
|
| 1772 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 1773 |
+
{
|
| 1774 |
+
$this->SetHash($sharedSecret);
|
| 1775 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 1776 |
+
$response = new XmlSecureCardUpdResponse($responseString);
|
| 1777 |
+
return $response;
|
| 1778 |
+
}
|
| 1779 |
+
|
| 1780 |
+
public function GenerateXml()
|
| 1781 |
+
{
|
| 1782 |
+
$requestXML = new DOMDocument("1.0");
|
| 1783 |
+
$requestXML->formatOutput = true;
|
| 1784 |
+
|
| 1785 |
+
$requestString = $requestXML->createElement("SECURECARDUPDATE");
|
| 1786 |
+
$requestXML->appendChild($requestString);
|
| 1787 |
+
|
| 1788 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 1789 |
+
$requestString->appendChild($node);
|
| 1790 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 1791 |
+
|
| 1792 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 1793 |
+
$requestString->appendChild($node);
|
| 1794 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 1795 |
+
|
| 1796 |
+
$node = $requestXML->createElement("DATETIME");
|
| 1797 |
+
$requestString->appendChild($node);
|
| 1798 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 1799 |
+
|
| 1800 |
+
$node = $requestXML->createElement("CARDNUMBER");
|
| 1801 |
+
$requestString->appendChild($node);
|
| 1802 |
+
$node->appendChild($requestXML->createTextNode($this->cardNumber));
|
| 1803 |
+
|
| 1804 |
+
$node = $requestXML->createElement("CARDEXPIRY");
|
| 1805 |
+
$requestString->appendChild($node);
|
| 1806 |
+
$node->appendChild($requestXML->createTextNode($this->cardExpiry));
|
| 1807 |
+
|
| 1808 |
+
$node = $requestXML->createElement("CARDTYPE");
|
| 1809 |
+
$requestString->appendChild($node);
|
| 1810 |
+
$node->appendChild($requestXML->createTextNode($this->cardType));
|
| 1811 |
+
|
| 1812 |
+
$node = $requestXML->createElement("CARDHOLDERNAME");
|
| 1813 |
+
$requestString->appendChild($node);
|
| 1814 |
+
$node->appendChild($requestXML->createTextNode($this->cardHolderName));
|
| 1815 |
+
|
| 1816 |
+
$node = $requestXML->createElement("HASH");
|
| 1817 |
+
$requestString->appendChild($node);
|
| 1818 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 1819 |
+
|
| 1820 |
+
if($this->dontCheckSecurity !== NULL)
|
| 1821 |
+
{
|
| 1822 |
+
$node = $requestXML->createElement("DONTCHECKSECURITY");
|
| 1823 |
+
$requestString->appendChild($node);
|
| 1824 |
+
$node->appendChild($requestXML->createTextNode($this->dontCheckSecurity));
|
| 1825 |
+
}
|
| 1826 |
+
|
| 1827 |
+
if($this->cvv !== NULL)
|
| 1828 |
+
{
|
| 1829 |
+
$node = $requestXML->createElement("CVV");
|
| 1830 |
+
$requestString->appendChild($node);
|
| 1831 |
+
$node->appendChild($requestXML->createTextNode($this->cvv));
|
| 1832 |
+
}
|
| 1833 |
+
|
| 1834 |
+
if($this->issueNo !== NULL)
|
| 1835 |
+
{
|
| 1836 |
+
$node = $requestXML->createElement("ISSUENO");
|
| 1837 |
+
$requestString->appendChild($node);
|
| 1838 |
+
$node->appendChild($requestXML->createTextNode($this->issueNo));
|
| 1839 |
+
}
|
| 1840 |
+
|
| 1841 |
+
return $requestXML->saveXML();
|
| 1842 |
+
}
|
| 1843 |
+
}
|
| 1844 |
+
|
| 1845 |
+
/**
|
| 1846 |
+
* Used for processing XML SecureCard deletion through the WorldNet TPS XML Gateway.
|
| 1847 |
+
*
|
| 1848 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 1849 |
+
*/
|
| 1850 |
+
class XmlSecureCardDelRequest extends Request
|
| 1851 |
+
{
|
| 1852 |
+
private $merchantRef;
|
| 1853 |
+
private $terminalId;
|
| 1854 |
+
private $secureCardCardRef;
|
| 1855 |
+
private $dateTime;
|
| 1856 |
+
private $hash;
|
| 1857 |
+
|
| 1858 |
+
/**
|
| 1859 |
+
* Creates the SecureCard searche request for processing
|
| 1860 |
+
* through the WorldNetTPS XML Gateway
|
| 1861 |
+
*
|
| 1862 |
+
* @param merchantRef A unique card identifier. Alpha numeric and max size 48 chars.
|
| 1863 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 1864 |
+
*/
|
| 1865 |
+
public function XmlSecureCardDelRequest($merchantRef,
|
| 1866 |
+
$terminalId,
|
| 1867 |
+
$secureCardCardRef)
|
| 1868 |
+
{
|
| 1869 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 1870 |
+
|
| 1871 |
+
$this->merchantRef = $merchantRef;
|
| 1872 |
+
$this->terminalId = $terminalId;
|
| 1873 |
+
$this->secureCardCardRef = $secureCardCardRef;
|
| 1874 |
+
}
|
| 1875 |
+
/**
|
| 1876 |
+
* Setter for hash value
|
| 1877 |
+
*
|
| 1878 |
+
* @param sharedSecret
|
| 1879 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1880 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1881 |
+
|
| 1882 |
+
*/
|
| 1883 |
+
public function SetHash($sharedSecret)
|
| 1884 |
+
{
|
| 1885 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->dateTime . $this->secureCardCardRef . $sharedSecret);
|
| 1886 |
+
}
|
| 1887 |
+
/**
|
| 1888 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 1889 |
+
*
|
| 1890 |
+
* @param sharedSecret
|
| 1891 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1892 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1893 |
+
*
|
| 1894 |
+
* @param testAccount
|
| 1895 |
+
* Boolean value defining Mode
|
| 1896 |
+
* true - This is a test account
|
| 1897 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 1898 |
+
*
|
| 1899 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 1900 |
+
*/
|
| 1901 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 1902 |
+
{
|
| 1903 |
+
return $this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 1904 |
+
}
|
| 1905 |
+
|
| 1906 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 1907 |
+
{
|
| 1908 |
+
$this->SetHash($sharedSecret);
|
| 1909 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 1910 |
+
$response = new XmlSecureCardDelResponse($responseString);
|
| 1911 |
+
return $response;
|
| 1912 |
+
}
|
| 1913 |
+
|
| 1914 |
+
public function GenerateXml()
|
| 1915 |
+
{
|
| 1916 |
+
$requestXML = new DOMDocument("1.0");
|
| 1917 |
+
$requestXML->formatOutput = true;
|
| 1918 |
+
|
| 1919 |
+
$requestString = $requestXML->createElement("SECURECARDREMOVAL");
|
| 1920 |
+
$requestXML->appendChild($requestString);
|
| 1921 |
+
|
| 1922 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 1923 |
+
$requestString->appendChild($node);
|
| 1924 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 1925 |
+
|
| 1926 |
+
$node = $requestXML->createElement("CARDREFERENCE");
|
| 1927 |
+
$requestString->appendChild($node);
|
| 1928 |
+
$node->appendChild($requestXML->createTextNode($this->secureCardCardRef));
|
| 1929 |
+
|
| 1930 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 1931 |
+
$requestString->appendChild($node);
|
| 1932 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 1933 |
+
|
| 1934 |
+
$node = $requestXML->createElement("DATETIME");
|
| 1935 |
+
$requestString->appendChild($node);
|
| 1936 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 1937 |
+
|
| 1938 |
+
$node = $requestXML->createElement("HASH");
|
| 1939 |
+
$requestString->appendChild($node);
|
| 1940 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 1941 |
+
|
| 1942 |
+
return $requestXML->saveXML();
|
| 1943 |
+
}
|
| 1944 |
+
}
|
| 1945 |
+
|
| 1946 |
+
/**
|
| 1947 |
+
* Used for processing XML SecureCard searching through the WorldNet TPS XML Gateway.
|
| 1948 |
+
*
|
| 1949 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 1950 |
+
*/
|
| 1951 |
+
class XmlSecureCardSearchRequest extends Request
|
| 1952 |
+
{
|
| 1953 |
+
private $merchantRef;
|
| 1954 |
+
private $terminalId;
|
| 1955 |
+
private $dateTime;
|
| 1956 |
+
private $hash;
|
| 1957 |
+
|
| 1958 |
+
/**
|
| 1959 |
+
* Creates the SecureCard searche request for processing
|
| 1960 |
+
* through the WorldNetTPS XML Gateway
|
| 1961 |
+
*
|
| 1962 |
+
* @param merchantRef A unique card identifier. Alpha numeric and max size 48 chars.
|
| 1963 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 1964 |
+
*/
|
| 1965 |
+
public function XmlSecureCardSearchRequest($merchantRef,
|
| 1966 |
+
$terminalId)
|
| 1967 |
+
{
|
| 1968 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 1969 |
+
|
| 1970 |
+
$this->merchantRef = $merchantRef;
|
| 1971 |
+
$this->terminalId = $terminalId;
|
| 1972 |
+
}
|
| 1973 |
+
/**
|
| 1974 |
+
* Setter for hash value
|
| 1975 |
+
*
|
| 1976 |
+
* @param sharedSecret
|
| 1977 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1978 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1979 |
+
*/
|
| 1980 |
+
public function SetHash($sharedSecret)
|
| 1981 |
+
{
|
| 1982 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->dateTime . $sharedSecret);
|
| 1983 |
+
}
|
| 1984 |
+
/**
|
| 1985 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 1986 |
+
*
|
| 1987 |
+
* @param sharedSecret
|
| 1988 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1989 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1990 |
+
*
|
| 1991 |
+
* @param testAccount
|
| 1992 |
+
* Boolean value defining Mode
|
| 1993 |
+
* true - This is a test account
|
| 1994 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 1995 |
+
*
|
| 1996 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 1997 |
+
*/
|
| 1998 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 1999 |
+
{
|
| 2000 |
+
return $this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 2001 |
+
}
|
| 2002 |
+
|
| 2003 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 2004 |
+
{
|
| 2005 |
+
$this->SetHash($sharedSecret);
|
| 2006 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 2007 |
+
$response = new XmlSecureCardSearchResponse($responseString);
|
| 2008 |
+
return $response;
|
| 2009 |
+
}
|
| 2010 |
+
|
| 2011 |
+
public function GenerateXml()
|
| 2012 |
+
{
|
| 2013 |
+
$requestXML = new DOMDocument("1.0");
|
| 2014 |
+
$requestXML->formatOutput = true;
|
| 2015 |
+
|
| 2016 |
+
$requestString = $requestXML->createElement("SECURECARDSEARCH");
|
| 2017 |
+
$requestXML->appendChild($requestString);
|
| 2018 |
+
|
| 2019 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 2020 |
+
$requestString->appendChild($node);
|
| 2021 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 2022 |
+
|
| 2023 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 2024 |
+
$requestString->appendChild($node);
|
| 2025 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 2026 |
+
|
| 2027 |
+
$node = $requestXML->createElement("DATETIME");
|
| 2028 |
+
$requestString->appendChild($node);
|
| 2029 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 2030 |
+
|
| 2031 |
+
$node = $requestXML->createElement("HASH");
|
| 2032 |
+
$requestString->appendChild($node);
|
| 2033 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 2034 |
+
|
| 2035 |
+
return $requestXML->saveXML();
|
| 2036 |
+
}
|
| 2037 |
+
}
|
| 2038 |
+
|
| 2039 |
+
/**
|
| 2040 |
+
* Used for processing XML Stored Subscription Registrations through the WorldNet TPS XML Gateway.
|
| 2041 |
+
*
|
| 2042 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 2043 |
+
*/
|
| 2044 |
+
class XmlStoredSubscriptionRegRequest extends Request
|
| 2045 |
+
{
|
| 2046 |
+
private $merchantRef;
|
| 2047 |
+
private $terminalId;
|
| 2048 |
+
private $name;
|
| 2049 |
+
private $description;
|
| 2050 |
+
private $periodType;
|
| 2051 |
+
private $length;
|
| 2052 |
+
private $recurringAmount;
|
| 2053 |
+
private $initialAmount;
|
| 2054 |
+
private $type;
|
| 2055 |
+
private $onUpdate;
|
| 2056 |
+
private $onDelete;
|
| 2057 |
+
private $dateTime;
|
| 2058 |
+
private $hash;
|
| 2059 |
+
|
| 2060 |
+
/**
|
| 2061 |
+
* Creates the SecureCard Registration/Update request for processing
|
| 2062 |
+
* through the WorldNetTPS XML Gateway
|
| 2063 |
+
*
|
| 2064 |
+
* @param merchantRef A unique subscription identifier. Alpha numeric and max size 48 chars.
|
| 2065 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 2066 |
+
* @param secureCardMerchantRef A valid, registered SecureCard Merchant Reference.
|
| 2067 |
+
* @param name Name of the subscription
|
| 2068 |
+
* @param description Card Holder Name
|
| 2069 |
+
*/
|
| 2070 |
+
public function XmlStoredSubscriptionRegRequest($merchantRef,
|
| 2071 |
+
$terminalId,
|
| 2072 |
+
$name,
|
| 2073 |
+
$description,
|
| 2074 |
+
|
| 2075 |
+
$periodType,
|
| 2076 |
+
$length,
|
| 2077 |
+
$currency,
|
| 2078 |
+
$recurringAmount,
|
| 2079 |
+
$initialAmount,
|
| 2080 |
+
$type,
|
| 2081 |
+
$onUpdate,
|
| 2082 |
+
$onDelete)
|
| 2083 |
+
{
|
| 2084 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 2085 |
+
|
| 2086 |
+
|
| 2087 |
+
$this->merchantRef = $merchantRef;
|
| 2088 |
+
$this->terminalId = $terminalId;
|
| 2089 |
+
|
| 2090 |
+
$this->name = $name;
|
| 2091 |
+
$this->description = $description;
|
| 2092 |
+
$this->periodType = $periodType;
|
| 2093 |
+
$this->length = $length;
|
| 2094 |
+
$this->currency = $currency;
|
| 2095 |
+
$this->recurringAmount = $recurringAmount;
|
| 2096 |
+
$this->initialAmount = $initialAmount;
|
| 2097 |
+
$this->type = $type;
|
| 2098 |
+
$this->onUpdate = $onUpdate;
|
| 2099 |
+
$this->onDelete = $onDelete;
|
| 2100 |
+
}
|
| 2101 |
+
/**
|
| 2102 |
+
* Setter for hash value
|
| 2103 |
+
*
|
| 2104 |
+
* @param sharedSecret
|
| 2105 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2106 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2107 |
+
*/
|
| 2108 |
+
public function SetHash($sharedSecret)
|
| 2109 |
+
{
|
| 2110 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->dateTime . $this->type . $this->name . $this->periodType . $this->currency . $this->recurringAmount . $this->initialAmount . $this->length . $sharedSecret);
|
| 2111 |
+
}
|
| 2112 |
+
/**
|
| 2113 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 2114 |
+
*
|
| 2115 |
+
* @param sharedSecret
|
| 2116 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2117 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2118 |
+
*
|
| 2119 |
+
* @param testAccount
|
| 2120 |
+
* Boolean value defining Mode
|
| 2121 |
+
* true - This is a test account
|
| 2122 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 2123 |
+
*
|
| 2124 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 2125 |
+
*/
|
| 2126 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 2127 |
+
{
|
| 2128 |
+
return $this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 2129 |
+
}
|
| 2130 |
+
|
| 2131 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 2132 |
+
{
|
| 2133 |
+
$this->SetHash($sharedSecret);
|
| 2134 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 2135 |
+
$response = new XmlStoredSubscriptionRegResponse($responseString);
|
| 2136 |
+
return $response;
|
| 2137 |
+
}
|
| 2138 |
+
|
| 2139 |
+
public function GenerateXml()
|
| 2140 |
+
{
|
| 2141 |
+
$requestXML = new DOMDocument("1.0");
|
| 2142 |
+
$requestXML->formatOutput = true;
|
| 2143 |
+
|
| 2144 |
+
$requestString = $requestXML->createElement("ADDSTOREDSUBSCRIPTION");
|
| 2145 |
+
$requestXML->appendChild($requestString);
|
| 2146 |
+
|
| 2147 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 2148 |
+
$requestString->appendChild($node);
|
| 2149 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 2150 |
+
|
| 2151 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 2152 |
+
$requestString->appendChild($node);
|
| 2153 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 2154 |
+
|
| 2155 |
+
$node = $requestXML->createElement("DATETIME");
|
| 2156 |
+
$requestString->appendChild($node);
|
| 2157 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 2158 |
+
|
| 2159 |
+
$node = $requestXML->createElement("NAME");
|
| 2160 |
+
$requestString->appendChild($node);
|
| 2161 |
+
$node->appendChild($requestXML->createTextNode($this->name));
|
| 2162 |
+
|
| 2163 |
+
$node = $requestXML->createElement("DESCRIPTION");
|
| 2164 |
+
$requestString->appendChild($node);
|
| 2165 |
+
$node->appendChild($requestXML->createTextNode($this->description));
|
| 2166 |
+
|
| 2167 |
+
$node = $requestXML->createElement("PERIODTYPE");
|
| 2168 |
+
$requestString->appendChild($node);
|
| 2169 |
+
$node->appendChild($requestXML->createTextNode($this->periodType));
|
| 2170 |
+
|
| 2171 |
+
$node = $requestXML->createElement("LENGTH");
|
| 2172 |
+
$requestString->appendChild($node);
|
| 2173 |
+
$node->appendChild($requestXML->createTextNode($this->length));
|
| 2174 |
+
|
| 2175 |
+
$node = $requestXML->createElement("CURRENCY");
|
| 2176 |
+
$requestString->appendChild($node);
|
| 2177 |
+
$node->appendChild($requestXML->createTextNode($this->currency));
|
| 2178 |
+
|
| 2179 |
+
if($this->type != "AUTOMATIC (WITHOUT AMOUNTS)")
|
| 2180 |
+
{
|
| 2181 |
+
$node = $requestXML->createElement("RECURRINGAMOUNT");
|
| 2182 |
+
$requestString->appendChild($node);
|
| 2183 |
+
$node->appendChild($requestXML->createTextNode($this->recurringAmount));
|
| 2184 |
+
|
| 2185 |
+
$node = $requestXML->createElement("INITIALAMOUNT");
|
| 2186 |
+
$requestString->appendChild($node);
|
| 2187 |
+
$node->appendChild($requestXML->createTextNode($this->initialAmount));
|
| 2188 |
+
}
|
| 2189 |
+
|
| 2190 |
+
$node = $requestXML->createElement("TYPE");
|
| 2191 |
+
$requestString->appendChild($node);
|
| 2192 |
+
$node->appendChild($requestXML->createTextNode($this->type));
|
| 2193 |
+
|
| 2194 |
+
$node = $requestXML->createElement("ONUPDATE");
|
| 2195 |
+
$requestString->appendChild($node);
|
| 2196 |
+
$node->appendChild($requestXML->createTextNode($this->onUpdate));
|
| 2197 |
+
|
| 2198 |
+
$node = $requestXML->createElement("ONDELETE");
|
| 2199 |
+
$requestString->appendChild($node);
|
| 2200 |
+
$node->appendChild($requestXML->createTextNode($this->onDelete));
|
| 2201 |
+
|
| 2202 |
+
$node = $requestXML->createElement("HASH");
|
| 2203 |
+
$requestString->appendChild($node);
|
| 2204 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 2205 |
+
|
| 2206 |
+
return $requestXML->saveXML();
|
| 2207 |
+
}
|
| 2208 |
+
}
|
| 2209 |
+
|
| 2210 |
+
/**
|
| 2211 |
+
* Used for processing XML Stored Subscription Registrations through the WorldNet TPS XML Gateway.
|
| 2212 |
+
*
|
| 2213 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 2214 |
+
*/
|
| 2215 |
+
class XmlStoredSubscriptionUpdRequest extends Request
|
| 2216 |
+
{
|
| 2217 |
+
private $merchantRef;
|
| 2218 |
+
private $terminalId;
|
| 2219 |
+
private $name;
|
| 2220 |
+
private $description;
|
| 2221 |
+
private $periodType;
|
| 2222 |
+
private $length;
|
| 2223 |
+
private $currency;
|
| 2224 |
+
private $recurringAmount;
|
| 2225 |
+
private $initialAmount;
|
| 2226 |
+
private $type;
|
| 2227 |
+
private $onUpdate;
|
| 2228 |
+
private $onDelete;
|
| 2229 |
+
private $dateTime;
|
| 2230 |
+
private $hash;
|
| 2231 |
+
|
| 2232 |
+
/**
|
| 2233 |
+
* Creates the SecureCard Registration/Update request for processing
|
| 2234 |
+
* through the WorldNetTPS XML Gateway
|
| 2235 |
+
*
|
| 2236 |
+
* @param merchantRef A unique subscription identifier. Alpha numeric and max size 48 chars.
|
| 2237 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 2238 |
+
* @param secureCardMerchantRef A valid, registered SecureCard Merchant Reference.
|
| 2239 |
+
* @param name Name of the subscription
|
| 2240 |
+
* @param description Card Holder Name
|
| 2241 |
+
*/
|
| 2242 |
+
public function XmlStoredSubscriptionUpdRequest($merchantRef,
|
| 2243 |
+
$terminalId,
|
| 2244 |
+
$name,
|
| 2245 |
+
$description,
|
| 2246 |
+
$periodType,
|
| 2247 |
+
$length,
|
| 2248 |
+
$currency,
|
| 2249 |
+
$recurringAmount,
|
| 2250 |
+
$initialAmount,
|
| 2251 |
+
$type,
|
| 2252 |
+
$onUpdate,
|
| 2253 |
+
$onDelete)
|
| 2254 |
+
{
|
| 2255 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 2256 |
+
|
| 2257 |
+
$this->merchantRef = $merchantRef;
|
| 2258 |
+
$this->terminalId = $terminalId;
|
| 2259 |
+
|
| 2260 |
+
$this->name = $name;
|
| 2261 |
+
$this->description = $description;
|
| 2262 |
+
$this->periodType = $periodType;
|
| 2263 |
+
$this->length = $length;
|
| 2264 |
+
$this->currency = $currency;
|
| 2265 |
+
$this->recurringAmount = $recurringAmount;
|
| 2266 |
+
$this->initialAmount = $initialAmount;
|
| 2267 |
+
$this->type = $type;
|
| 2268 |
+
$this->onUpdate = $onUpdate;
|
| 2269 |
+
$this->onDelete = $onDelete;
|
| 2270 |
+
}
|
| 2271 |
+
/**
|
| 2272 |
+
* Setter for hash value
|
| 2273 |
+
*
|
| 2274 |
+
* @param sharedSecret
|
| 2275 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2276 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2277 |
+
*/
|
| 2278 |
+
public function SetHash($sharedSecret)
|
| 2279 |
+
{
|
| 2280 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->dateTime . $this->type . $this->name . $this->periodType . $this->currency . $this->recurringAmount . $this->initialAmount . $this->length . $sharedSecret);
|
| 2281 |
+
}
|
| 2282 |
+
/**
|
| 2283 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 2284 |
+
*
|
| 2285 |
+
* @param sharedSecret
|
| 2286 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2287 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2288 |
+
*
|
| 2289 |
+
* @param testAccount
|
| 2290 |
+
* Boolean value defining Mode
|
| 2291 |
+
* true - This is a test account
|
| 2292 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 2293 |
+
*
|
| 2294 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 2295 |
+
*/
|
| 2296 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 2297 |
+
{
|
| 2298 |
+
return $this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 2299 |
+
}
|
| 2300 |
+
|
| 2301 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 2302 |
+
{
|
| 2303 |
+
$this->SetHash($sharedSecret);
|
| 2304 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 2305 |
+
$response = new XmlStoredSubscriptionUpdResponse($responseString);
|
| 2306 |
+
return $response;
|
| 2307 |
+
}
|
| 2308 |
+
|
| 2309 |
+
public function GenerateXml()
|
| 2310 |
+
{
|
| 2311 |
+
$requestXML = new DOMDocument("1.0");
|
| 2312 |
+
$requestXML->formatOutput = true;
|
| 2313 |
+
|
| 2314 |
+
$requestString = $requestXML->createElement("UPDATESTOREDSUBSCRIPTION");
|
| 2315 |
+
$requestXML->appendChild($requestString);
|
| 2316 |
+
|
| 2317 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 2318 |
+
$requestString->appendChild($node);
|
| 2319 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 2320 |
+
|
| 2321 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 2322 |
+
$requestString->appendChild($node);
|
| 2323 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 2324 |
+
|
| 2325 |
+
$node = $requestXML->createElement("DATETIME");
|
| 2326 |
+
$requestString->appendChild($node);
|
| 2327 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 2328 |
+
|
| 2329 |
+
$node = $requestXML->createElement("NAME");
|
| 2330 |
+
$requestString->appendChild($node);
|
| 2331 |
+
$node->appendChild($requestXML->createTextNode($this->name));
|
| 2332 |
+
|
| 2333 |
+
$node = $requestXML->createElement("DESCRIPTION");
|
| 2334 |
+
$requestString->appendChild($node);
|
| 2335 |
+
$node->appendChild($requestXML->createTextNode($this->description));
|
| 2336 |
+
|
| 2337 |
+
$node = $requestXML->createElement("PERIODTYPE");
|
| 2338 |
+
$requestString->appendChild($node);
|
| 2339 |
+
$node->appendChild($requestXML->createTextNode($this->periodType));
|
| 2340 |
+
|
| 2341 |
+
$node = $requestXML->createElement("LENGTH");
|
| 2342 |
+
$requestString->appendChild($node);
|
| 2343 |
+
$node->appendChild($requestXML->createTextNode($this->length));
|
| 2344 |
+
|
| 2345 |
+
$node = $requestXML->createElement("CURRENCY");
|
| 2346 |
+
$requestString->appendChild($node);
|
| 2347 |
+
$node->appendChild($requestXML->createTextNode($this->currency));
|
| 2348 |
+
|
| 2349 |
+
if($this->type != "AUTOMATIC (WITHOUT AMOUNTS)")
|
| 2350 |
+
{
|
| 2351 |
+
$node = $requestXML->createElement("RECURRINGAMOUNT");
|
| 2352 |
+
$requestString->appendChild($node);
|
| 2353 |
+
$node->appendChild($requestXML->createTextNode($this->recurringAmount));
|
| 2354 |
+
|
| 2355 |
+
$node = $requestXML->createElement("INITIALAMOUNT");
|
| 2356 |
+
$requestString->appendChild($node);
|
| 2357 |
+
$node->appendChild($requestXML->createTextNode($this->initialAmount));
|
| 2358 |
+
}
|
| 2359 |
+
|
| 2360 |
+
$node = $requestXML->createElement("TYPE");
|
| 2361 |
+
$requestString->appendChild($node);
|
| 2362 |
+
$node->appendChild($requestXML->createTextNode($this->type));
|
| 2363 |
+
|
| 2364 |
+
$node = $requestXML->createElement("ONUPDATE");
|
| 2365 |
+
$requestString->appendChild($node);
|
| 2366 |
+
$node->appendChild($requestXML->createTextNode($this->onUpdate));
|
| 2367 |
+
|
| 2368 |
+
$node = $requestXML->createElement("ONDELETE");
|
| 2369 |
+
$requestString->appendChild($node);
|
| 2370 |
+
$node->appendChild($requestXML->createTextNode($this->onDelete));
|
| 2371 |
+
|
| 2372 |
+
$node = $requestXML->createElement("HASH");
|
| 2373 |
+
$requestString->appendChild($node);
|
| 2374 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 2375 |
+
|
| 2376 |
+
return $requestXML->saveXML();
|
| 2377 |
+
}
|
| 2378 |
+
}
|
| 2379 |
+
|
| 2380 |
+
/**
|
| 2381 |
+
* Used for processing XML SecureCard Registrations through the WorldNet TPS XML Gateway.
|
| 2382 |
+
*
|
| 2383 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 2384 |
+
*/
|
| 2385 |
+
class XmlStoredSubscriptionDelRequest extends Request
|
| 2386 |
+
{
|
| 2387 |
+
private $merchantRef;
|
| 2388 |
+
private $terminalId;
|
| 2389 |
+
private $dateTime;
|
| 2390 |
+
private $hash;
|
| 2391 |
+
|
| 2392 |
+
/**
|
| 2393 |
+
* Creates the SecureCard Registration/Update request for processing
|
| 2394 |
+
* through the WorldNetTPS XML Gateway
|
| 2395 |
+
*
|
| 2396 |
+
* @param merchantRef A unique subscription identifier. Alpha numeric and max size 48 chars.
|
| 2397 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 2398 |
+
*/
|
| 2399 |
+
public function XmlStoredSubscriptionDelRequest($merchantRef,
|
| 2400 |
+
$terminalId)
|
| 2401 |
+
{
|
| 2402 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 2403 |
+
|
| 2404 |
+
$this->merchantRef = $merchantRef;
|
| 2405 |
+
$this->terminalId = $terminalId;
|
| 2406 |
+
}
|
| 2407 |
+
/**
|
| 2408 |
+
* Setter for hash value
|
| 2409 |
+
*
|
| 2410 |
+
* @param sharedSecret
|
| 2411 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2412 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2413 |
+
*/
|
| 2414 |
+
public function SetHash($sharedSecret)
|
| 2415 |
+
{
|
| 2416 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->dateTime . $sharedSecret);
|
| 2417 |
+
}
|
| 2418 |
+
/**
|
| 2419 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 2420 |
+
*
|
| 2421 |
+
* @param sharedSecret
|
| 2422 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2423 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2424 |
+
*
|
| 2425 |
+
* @param testAccount
|
| 2426 |
+
* Boolean value defining Mode
|
| 2427 |
+
* true - This is a test account
|
| 2428 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 2429 |
+
*
|
| 2430 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 2431 |
+
*/
|
| 2432 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 2433 |
+
{
|
| 2434 |
+
return $this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 2435 |
+
}
|
| 2436 |
+
|
| 2437 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 2438 |
+
{
|
| 2439 |
+
$this->SetHash($sharedSecret);
|
| 2440 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 2441 |
+
$response = new XmlStoredSubscriptionDelResponse($responseString);
|
| 2442 |
+
return $response;
|
| 2443 |
+
}
|
| 2444 |
+
|
| 2445 |
+
public function GenerateXml()
|
| 2446 |
+
{
|
| 2447 |
+
$requestXML = new DOMDocument("1.0");
|
| 2448 |
+
$requestXML->formatOutput = true;
|
| 2449 |
+
|
| 2450 |
+
$requestString = $requestXML->createElement("DELETESTOREDSUBSCRIPTION");
|
| 2451 |
+
$requestXML->appendChild($requestString);
|
| 2452 |
+
|
| 2453 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 2454 |
+
$requestString->appendChild($node);
|
| 2455 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 2456 |
+
|
| 2457 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 2458 |
+
$requestString->appendChild($node);
|
| 2459 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 2460 |
+
|
| 2461 |
+
$node = $requestXML->createElement("DATETIME");
|
| 2462 |
+
$requestString->appendChild($node);
|
| 2463 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 2464 |
+
|
| 2465 |
+
$node = $requestXML->createElement("HASH");
|
| 2466 |
+
$requestString->appendChild($node);
|
| 2467 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 2468 |
+
|
| 2469 |
+
return $requestXML->saveXML();
|
| 2470 |
+
}
|
| 2471 |
+
}
|
| 2472 |
+
|
| 2473 |
+
class XmlSubscriptionRegRequest extends Request
|
| 2474 |
+
{
|
| 2475 |
+
private $merchantRef;
|
| 2476 |
+
private $terminalId;
|
| 2477 |
+
private $storedSubscriptionRef;
|
| 2478 |
+
private $secureCardMerchantRef;
|
| 2479 |
+
private $name;
|
| 2480 |
+
private $description;
|
| 2481 |
+
private $periodType;
|
| 2482 |
+
private $length;
|
| 2483 |
+
private $currency;
|
| 2484 |
+
private $recurringAmount;
|
| 2485 |
+
private $initialAmount;
|
| 2486 |
+
private $type;
|
| 2487 |
+
private $startDate;
|
| 2488 |
+
private $endDate;
|
| 2489 |
+
private $onUpdate;
|
| 2490 |
+
private $onDelete;
|
| 2491 |
+
private $dateTime;
|
| 2492 |
+
private $hash;
|
| 2493 |
+
private $eDCCDecision;
|
| 2494 |
+
|
| 2495 |
+
private $newStoredSubscription = false;
|
| 2496 |
+
|
| 2497 |
+
public function SetNewStoredSubscriptionValues($name,
|
| 2498 |
+
$description,
|
| 2499 |
+
$periodType,
|
| 2500 |
+
$length,
|
| 2501 |
+
$currency,
|
| 2502 |
+
$recurringAmount,
|
| 2503 |
+
$initialAmount,
|
| 2504 |
+
$type,
|
| 2505 |
+
$onUpdate,
|
| 2506 |
+
$onDelete)
|
| 2507 |
+
{
|
| 2508 |
+
$this->name = $name;
|
| 2509 |
+
$this->description = $description;
|
| 2510 |
+
$this->periodType = $periodType;
|
| 2511 |
+
$this->length = $length;
|
| 2512 |
+
$this->currency = $currency;
|
| 2513 |
+
$this->recurringAmount = $recurringAmount;
|
| 2514 |
+
$this->initialAmount = $initialAmount;
|
| 2515 |
+
$this->type = $type;
|
| 2516 |
+
$this->onUpdate = $onUpdate;
|
| 2517 |
+
$this->onDelete = $onDelete;
|
| 2518 |
+
|
| 2519 |
+
$this->newStoredSubscription = true;
|
| 2520 |
+
}
|
| 2521 |
+
public function SetSubscriptionAmounts($recurringAmount,
|
| 2522 |
+
$initialAmount)
|
| 2523 |
+
{
|
| 2524 |
+
$this->recurringAmount = $recurringAmount;
|
| 2525 |
+
$this->initialAmount = $initialAmount;
|
| 2526 |
+
}
|
| 2527 |
+
/**
|
| 2528 |
+
* Setter for end date
|
| 2529 |
+
*
|
| 2530 |
+
* @param endDate End Date of subscription
|
| 2531 |
+
*/
|
| 2532 |
+
public function SetEndDate($endDate)
|
| 2533 |
+
{
|
| 2534 |
+
$this->endDate = $endDate;
|
| 2535 |
+
}
|
| 2536 |
+
/**
|
| 2537 |
+
* Setter for when the cardholder has accepted the eDCC offering
|
| 2538 |
+
*
|
| 2539 |
+
* @param eDCCDecision eDCC decision ("Y" or "N")
|
| 2540 |
+
*/
|
| 2541 |
+
public function EDCCDecision($eDCCDecision)
|
| 2542 |
+
{
|
| 2543 |
+
$this->eDCCDecision = $eDCCDecision;
|
| 2544 |
+
}
|
| 2545 |
+
/**
|
| 2546 |
+
* Creates the SecureCard Registration/Update request for processing
|
| 2547 |
+
* through the WorldNetTPS XML Gateway
|
| 2548 |
+
*
|
| 2549 |
+
* @param merchantRef A unique subscription identifier. Alpha numeric and max size 48 chars.
|
| 2550 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 2551 |
+
|
| 2552 |
+
* @param storedSubscriptionRef Name of the Stored subscription under which this subscription should run
|
| 2553 |
+
* @param secureCardMerchantRef A valid, registered SecureCard Merchant Reference.
|
| 2554 |
+
* @param startDate Card Holder Name
|
| 2555 |
+
*/
|
| 2556 |
+
public function XmlSubscriptionRegRequest($merchantRef,
|
| 2557 |
+
$terminalId,
|
| 2558 |
+
$storedSubscriptionRef,
|
| 2559 |
+
$secureCardMerchantRef,
|
| 2560 |
+
$startDate)
|
| 2561 |
+
{
|
| 2562 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 2563 |
+
|
| 2564 |
+
$this->storedSubscriptionRef = $storedSubscriptionRef;
|
| 2565 |
+
$this->secureCardMerchantRef = $secureCardMerchantRef;
|
| 2566 |
+
$this->merchantRef = $merchantRef;
|
| 2567 |
+
$this->terminalId = $terminalId;
|
| 2568 |
+
$this->startDate = $startDate;
|
| 2569 |
+
}
|
| 2570 |
+
/**
|
| 2571 |
+
* Setter for hash value
|
| 2572 |
+
*
|
| 2573 |
+
* @param sharedSecret
|
| 2574 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2575 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2576 |
+
*/
|
| 2577 |
+
public function SetHash($sharedSecret)
|
| 2578 |
+
{
|
| 2579 |
+
if($this->newStoredSubscription) $this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->secureCardMerchantRef . $this->dateTime . $this->startDate . $sharedSecret);
|
| 2580 |
+
else $this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->storedSubscriptionRef . $this->secureCardMerchantRef . $this->dateTime . $this->startDate . $sharedSecret);
|
| 2581 |
+
|
| 2582 |
+
}
|
| 2583 |
+
/**
|
| 2584 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 2585 |
+
*
|
| 2586 |
+
* @param sharedSecret
|
| 2587 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2588 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2589 |
+
*
|
| 2590 |
+
* @param testAccount
|
| 2591 |
+
* Boolean value defining Mode
|
| 2592 |
+
* true - This is a test account
|
| 2593 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 2594 |
+
*
|
| 2595 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 2596 |
+
*/
|
| 2597 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 2598 |
+
{
|
| 2599 |
+
return $this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 2600 |
+
}
|
| 2601 |
+
|
| 2602 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 2603 |
+
{
|
| 2604 |
+
$this->SetHash($sharedSecret);
|
| 2605 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 2606 |
+
$response = new XmlSubscriptionRegResponse($responseString);
|
| 2607 |
+
return $response;
|
| 2608 |
+
}
|
| 2609 |
+
|
| 2610 |
+
public function GenerateXml()
|
| 2611 |
+
{
|
| 2612 |
+
$requestXML = new DOMDocument("1.0");
|
| 2613 |
+
$requestXML->formatOutput = true;
|
| 2614 |
+
|
| 2615 |
+
$requestString = $requestXML->createElement("ADDSUBSCRIPTION");
|
| 2616 |
+
$requestXML->appendChild($requestString);
|
| 2617 |
+
|
| 2618 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 2619 |
+
$requestString->appendChild($node);
|
| 2620 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 2621 |
+
|
| 2622 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 2623 |
+
$requestString->appendChild($node);
|
| 2624 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 2625 |
+
|
| 2626 |
+
if(!$this->newStoredSubscription)
|
| 2627 |
+
{
|
| 2628 |
+
$node = $requestXML->createElement("STOREDSUBSCRIPTIONREF");
|
| 2629 |
+
$requestString->appendChild($node);
|
| 2630 |
+
$node->appendChild($requestXML->createTextNode($this->storedSubscriptionRef));
|
| 2631 |
+
}
|
| 2632 |
+
|
| 2633 |
+
$node = $requestXML->createElement("SECURECARDMERCHANTREF");
|
| 2634 |
+
$requestString->appendChild($node);
|
| 2635 |
+
$node->appendChild($requestXML->createTextNode($this->secureCardMerchantRef));
|
| 2636 |
+
|
| 2637 |
+
$node = $requestXML->createElement("DATETIME");
|
| 2638 |
+
$requestString->appendChild($node);
|
| 2639 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 2640 |
+
|
| 2641 |
+
if($this->recurringAmount != null && $this->recurringAmount != null && !$this->newStoredSubscription)
|
| 2642 |
+
{
|
| 2643 |
+
$node = $requestXML->createElement("RECURRINGAMOUNT");
|
| 2644 |
+
$requestString->appendChild($node);
|
| 2645 |
+
$node->appendChild($requestXML->createTextNode($this->recurringAmount));
|
| 2646 |
+
|
| 2647 |
+
$node = $requestXML->createElement("INITIALAMOUNT");
|
| 2648 |
+
$requestString->appendChild($node);
|
| 2649 |
+
$node->appendChild($requestXML->createTextNode($this->initialAmount));
|
| 2650 |
+
}
|
| 2651 |
+
|
| 2652 |
+
$node = $requestXML->createElement("STARTDATE");
|
| 2653 |
+
$requestString->appendChild($node);
|
| 2654 |
+
$node->appendChild($requestXML->createTextNode($this->startDate));
|
| 2655 |
+
|
| 2656 |
+
|
| 2657 |
+
if($this->endDate != null)
|
| 2658 |
+
{
|
| 2659 |
+
$node = $requestXML->createElement("ENDDATE");
|
| 2660 |
+
$requestString->appendChild($node);
|
| 2661 |
+
$node->appendChild($requestXML->createTextNode($this->endDate));
|
| 2662 |
+
}
|
| 2663 |
+
|
| 2664 |
+
if($this->eDCCDecision !== NULL)
|
| 2665 |
+
{
|
| 2666 |
+
$node = $requestXML->createElement("EDCCDECISION");
|
| 2667 |
+
$requestString->appendChild($node);
|
| 2668 |
+
$node->appendChild($requestXML->createTextNode($this->eDCCDecision));
|
| 2669 |
+
}
|
| 2670 |
+
|
| 2671 |
+
if($this->newStoredSubscription)
|
| 2672 |
+
{
|
| 2673 |
+
$ssNode = $requestXML->createElement("NEWSTOREDSUBSCRIPTIONINFO");
|
| 2674 |
+
$requestString->appendChild($ssNode );
|
| 2675 |
+
|
| 2676 |
+
$ssSubNode = $requestXML->createElement("MERCHANTREF");
|
| 2677 |
+
$ssNode->appendChild($ssSubNode);
|
| 2678 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->storedSubscriptionRef));
|
| 2679 |
+
|
| 2680 |
+
$ssSubNode = $requestXML->createElement("NAME");
|
| 2681 |
+
$ssNode->appendChild($ssSubNode);
|
| 2682 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->name));
|
| 2683 |
+
|
| 2684 |
+
$ssSubNode = $requestXML->createElement("DESCRIPTION");
|
| 2685 |
+
$ssNode->appendChild($ssSubNode);
|
| 2686 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->description));
|
| 2687 |
+
|
| 2688 |
+
$ssSubNode = $requestXML->createElement("PERIODTYPE");
|
| 2689 |
+
$ssNode->appendChild($ssSubNode);
|
| 2690 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->periodType));
|
| 2691 |
+
|
| 2692 |
+
$ssSubNode = $requestXML->createElement("LENGTH");
|
| 2693 |
+
$ssNode->appendChild($ssSubNode);
|
| 2694 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->length));
|
| 2695 |
+
|
| 2696 |
+
$ssSubNode = $requestXML->createElement("CURRENCY");
|
| 2697 |
+
$ssNode->appendChild($ssSubNode);
|
| 2698 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->currency));
|
| 2699 |
+
|
| 2700 |
+
if($this->type != "AUTOMATIC (WITHOUT AMOUNTS)")
|
| 2701 |
+
{
|
| 2702 |
+
$ssSubNode = $requestXML->createElement("RECURRINGAMOUNT");
|
| 2703 |
+
$ssNode->appendChild($ssSubNode);
|
| 2704 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->recurringAmount));
|
| 2705 |
+
|
| 2706 |
+
$ssSubNode = $requestXML->createElement("INITIALAMOUNT");
|
| 2707 |
+
$ssNode->appendChild($ssSubNode);
|
| 2708 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->initialAmount));
|
| 2709 |
+
}
|
| 2710 |
+
|
| 2711 |
+
$ssSubNode = $requestXML->createElement("TYPE");
|
| 2712 |
+
$ssNode->appendChild($ssSubNode);
|
| 2713 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->type));
|
| 2714 |
+
|
| 2715 |
+
$ssSubNode = $requestXML->createElement("ONUPDATE");
|
| 2716 |
+
$ssNode->appendChild($ssSubNode);
|
| 2717 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->onUpdate));
|
| 2718 |
+
|
| 2719 |
+
$ssSubNode = $requestXML->createElement("ONDELETE");
|
| 2720 |
+
$ssNode->appendChild($ssSubNode);
|
| 2721 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->onDelete));
|
| 2722 |
+
}
|
| 2723 |
+
|
| 2724 |
+
$node = $requestXML->createElement("HASH");
|
| 2725 |
+
$requestString->appendChild($node);
|
| 2726 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 2727 |
+
|
| 2728 |
+
return $requestXML->saveXML();
|
| 2729 |
+
}
|
| 2730 |
+
}
|
| 2731 |
+
|
| 2732 |
+
/**
|
| 2733 |
+
* Used for processing XML SecureCard Registrations through the WorldNet TPS XML Gateway.
|
| 2734 |
+
*
|
| 2735 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 2736 |
+
*/
|
| 2737 |
+
class XmlSubscriptionUpdRequest extends Request
|
| 2738 |
+
{
|
| 2739 |
+
private $merchantRef;
|
| 2740 |
+
private $terminalId;
|
| 2741 |
+
private $secureCardMerchantRef;
|
| 2742 |
+
private $name;
|
| 2743 |
+
private $description;
|
| 2744 |
+
private $periodType;
|
| 2745 |
+
private $length;
|
| 2746 |
+
private $recurringAmount;
|
| 2747 |
+
private $type;
|
| 2748 |
+
private $startDate;
|
| 2749 |
+
private $endDate;
|
| 2750 |
+
private $dateTime;
|
| 2751 |
+
private $hash;
|
| 2752 |
+
private $eDCCDecision;
|
| 2753 |
+
|
| 2754 |
+
/**
|
| 2755 |
+
* Setter for subscription name
|
| 2756 |
+
*
|
| 2757 |
+
* @param name Subscription name
|
| 2758 |
+
*/
|
| 2759 |
+
public function SetSubName($name)
|
| 2760 |
+
{
|
| 2761 |
+
$this->name = $name;
|
| 2762 |
+
}
|
| 2763 |
+
/**
|
| 2764 |
+
* Setter for subscription description
|
| 2765 |
+
*
|
| 2766 |
+
* @param description Subscription description
|
| 2767 |
+
*/
|
| 2768 |
+
public function SetDescription($description)
|
| 2769 |
+
{
|
| 2770 |
+
$this->description = $description;
|
| 2771 |
+
}
|
| 2772 |
+
/**
|
| 2773 |
+
* Setter for subscription period type
|
| 2774 |
+
*
|
| 2775 |
+
* @param periodType Subscription period type
|
| 2776 |
+
*/
|
| 2777 |
+
public function SetPeriodType($periodType)
|
| 2778 |
+
{
|
| 2779 |
+
$this->periodType = $periodType;
|
| 2780 |
+
}
|
| 2781 |
+
/**
|
| 2782 |
+
* Setter for subscription length
|
| 2783 |
+
*
|
| 2784 |
+
* @param length Subscription length
|
| 2785 |
+
*/
|
| 2786 |
+
public function SetLength($length)
|
| 2787 |
+
{
|
| 2788 |
+
$this->length = $length;
|
| 2789 |
+
}
|
| 2790 |
+
/**
|
| 2791 |
+
* Setter for subscription recurring amount
|
| 2792 |
+
*
|
| 2793 |
+
* @param recurringAmount Subscription recurring amount
|
| 2794 |
+
*/
|
| 2795 |
+
public function SetRecurringAmount($recurringAmount)
|
| 2796 |
+
{
|
| 2797 |
+
$this->recurringAmount = $recurringAmount;
|
| 2798 |
+
}
|
| 2799 |
+
/**
|
| 2800 |
+
* Setter for stored subscription type
|
| 2801 |
+
*
|
| 2802 |
+
* @param endDate Stored subscription type
|
| 2803 |
+
*/
|
| 2804 |
+
public function SetSubType($type)
|
| 2805 |
+
{
|
| 2806 |
+
$this->type = $type;
|
| 2807 |
+
}
|
| 2808 |
+
/**
|
| 2809 |
+
* Setter for stored subscription start date
|
| 2810 |
+
*
|
| 2811 |
+
* @param startDate Stored subscription start date
|
| 2812 |
+
*/
|
| 2813 |
+
public function SetStartDate($startDate)
|
| 2814 |
+
{
|
| 2815 |
+
$this->startDate = $startDate;
|
| 2816 |
+
}
|
| 2817 |
+
/**
|
| 2818 |
+
* Setter for stored subscription end date
|
| 2819 |
+
*
|
| 2820 |
+
* @param endDate Stored subscription end date
|
| 2821 |
+
*/
|
| 2822 |
+
public function SetEndDate($endDate)
|
| 2823 |
+
{
|
| 2824 |
+
$this->endDate = $endDate;
|
| 2825 |
+
}
|
| 2826 |
+
/**
|
| 2827 |
+
* Setter for when the cardholder has accepted the eDCC offering
|
| 2828 |
+
*
|
| 2829 |
+
* @param eDCCDecision eDCC decision ("Y" or "N")
|
| 2830 |
+
*/
|
| 2831 |
+
public function EDCCDecision($eDCCDecision)
|
| 2832 |
+
{
|
| 2833 |
+
$this->eDCCDecision = $eDCCDecision;
|
| 2834 |
+
}
|
| 2835 |
+
/**
|
| 2836 |
+
* Creates the SecureCard Update request for processing
|
| 2837 |
+
* through the WorldNetTPS XML Gateway
|
| 2838 |
+
*
|
| 2839 |
+
* @param merchantRef A unique subscription identifier. Alpha numeric and max size 48 chars.
|
| 2840 |
+
* @param terminalId Terminal ID provided by WorldNet TPS.
|
| 2841 |
+
* @param secureCardMerchantRef Reference to the existing or new SecureCard for the subscription.
|
| 2842 |
+
*/
|
| 2843 |
+
public function XmlSubscriptionUpdRequest($merchantRef,
|
| 2844 |
+
$terminalId,
|
| 2845 |
+
$secureCardMerchantRef)
|
| 2846 |
+
{
|
| 2847 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 2848 |
+
|
| 2849 |
+
$this->merchantRef = $merchantRef;
|
| 2850 |
+
$this->terminalId = $terminalId;
|
| 2851 |
+
$this->secureCardMerchantRef = $secureCardMerchantRef;
|
| 2852 |
+
}
|
| 2853 |
+
/**
|
| 2854 |
+
* Setter for hash value
|
| 2855 |
+
*
|
| 2856 |
+
* @param sharedSecret
|
| 2857 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2858 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2859 |
+
*/
|
| 2860 |
+
public function SetHash($sharedSecret)
|
| 2861 |
+
{
|
| 2862 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->secureCardMerchantRef . $this->dateTime . $this->startDate . $sharedSecret);
|
| 2863 |
+
}
|
| 2864 |
+
/**
|
| 2865 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 2866 |
+
*
|
| 2867 |
+
* @param sharedSecret
|
| 2868 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2869 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2870 |
+
*
|
| 2871 |
+
* @param testAccount
|
| 2872 |
+
* Boolean value defining Mode
|
| 2873 |
+
* true - This is a test account
|
| 2874 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 2875 |
+
*
|
| 2876 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 2877 |
+
*/
|
| 2878 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 2879 |
+
{
|
| 2880 |
+
return $this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 2881 |
+
}
|
| 2882 |
+
|
| 2883 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 2884 |
+
{
|
| 2885 |
+
$this->SetHash($sharedSecret);
|
| 2886 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 2887 |
+
$response = new XmlSubscriptionUpdResponse($responseString);
|
| 2888 |
+
return $response;
|
| 2889 |
+
}
|
| 2890 |
+
|
| 2891 |
+
public function GenerateXml()
|
| 2892 |
+
{
|
| 2893 |
+
$requestXML = new DOMDocument("1.0");
|
| 2894 |
+
$requestXML->formatOutput = true;
|
| 2895 |
+
|
| 2896 |
+
$requestString = $requestXML->createElement("UPDATESUBSCRIPTION");
|
| 2897 |
+
$requestXML->appendChild($requestString);
|
| 2898 |
+
|
| 2899 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 2900 |
+
$requestString->appendChild($node);
|
| 2901 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 2902 |
+
|
| 2903 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 2904 |
+
$requestString->appendChild($node);
|
| 2905 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 2906 |
+
|
| 2907 |
+
$node = $requestXML->createElement("SECURECARDMERCHANTREF");
|
| 2908 |
+
$requestString->appendChild($node);
|
| 2909 |
+
$node->appendChild($requestXML->createTextNode($this->secureCardMerchantRef));
|
| 2910 |
+
|
| 2911 |
+
$node = $requestXML->createElement("DATETIME");
|
| 2912 |
+
$requestString->appendChild($node);
|
| 2913 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 2914 |
+
|
| 2915 |
+
if($this->name !== NULL)
|
| 2916 |
+
{
|
| 2917 |
+
$node = $requestXML->createElement("NAME");
|
| 2918 |
+
$requestString->appendChild($node);
|
| 2919 |
+
$node->appendChild($requestXML->createTextNode($this->name));
|
| 2920 |
+
}
|
| 2921 |
+
|
| 2922 |
+
if($this->description !== NULL)
|
| 2923 |
+
{
|
| 2924 |
+
$node = $requestXML->createElement("DESCRIPTION");
|
| 2925 |
+
$requestString->appendChild($node);
|
| 2926 |
+
$node->appendChild($requestXML->createTextNode($this->description));
|
| 2927 |
+
}
|
| 2928 |
+
|
| 2929 |
+
if($this->periodType !== NULL)
|
| 2930 |
+
{
|
| 2931 |
+
$node = $requestXML->createElement("PERIODTYPE");
|
| 2932 |
+
$requestString->appendChild($node);
|
| 2933 |
+
$node->appendChild($requestXML->createTextNode($this->periodType));
|
| 2934 |
+
}
|
| 2935 |
+
|
| 2936 |
+
if($this->length != null)
|
| 2937 |
+
{
|
| 2938 |
+
$node = $requestXML->createElement("LENGTH");
|
| 2939 |
+
$requestString->appendChild($node);
|
| 2940 |
+
$node->appendChild($requestXML->createTextNode($this->length));
|
| 2941 |
+
}
|
| 2942 |
+
|
| 2943 |
+
if($this->recurringAmount !== NULL)
|
| 2944 |
+
{
|
| 2945 |
+
$node = $requestXML->createElement("RECURRINGAMOUNT");
|
| 2946 |
+
$requestString->appendChild($node);
|
| 2947 |
+
$node->appendChild($requestXML->createTextNode($this->recurringAmount));
|
| 2948 |
+
}
|
| 2949 |
+
|
| 2950 |
+
if($this->type !== NULL)
|
| 2951 |
+
{
|
| 2952 |
+
$node = $requestXML->createElement("TYPE");
|
| 2953 |
+
$requestString->appendChild($node);
|
| 2954 |
+
$node->appendChild($requestXML->createTextNode($this->type));
|
| 2955 |
+
}
|
| 2956 |
+
|
| 2957 |
+
if($this->startDate !== NULL)
|
| 2958 |
+
{
|
| 2959 |
+
$node = $requestXML->createElement("STARTDATE");
|
| 2960 |
+
$requestString->appendChild($node);
|
| 2961 |
+
$node->appendChild($requestXML->createTextNode($this->startDate));
|
| 2962 |
+
}
|
| 2963 |
+
|
| 2964 |
+
if($this->endDate != null)
|
| 2965 |
+
{
|
| 2966 |
+
$node = $requestXML->createElement("ENDDATE");
|
| 2967 |
+
$requestString->appendChild($node);
|
| 2968 |
+
$node->appendChild($requestXML->createTextNode($this->endDate));
|
| 2969 |
+
}
|
| 2970 |
+
|
| 2971 |
+
if($this->eDCCDecision !== NULL)
|
| 2972 |
+
{
|
| 2973 |
+
$node = $requestXML->createElement("EDCCDECISION");
|
| 2974 |
+
$requestString->appendChild($node);
|
| 2975 |
+
$node->appendChild($requestXML->createTextNode($this->eDCCDecision));
|
| 2976 |
+
}
|
| 2977 |
+
|
| 2978 |
+
$node = $requestXML->createElement("HASH");
|
| 2979 |
+
$requestString->appendChild($node);
|
| 2980 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 2981 |
+
|
| 2982 |
+
return $requestXML->saveXML();
|
| 2983 |
+
}
|
| 2984 |
+
}
|
| 2985 |
+
|
| 2986 |
+
/**
|
| 2987 |
+
* Used for processing XML SecureCard Registrations through the WorldNet TPS XML Gateway.
|
| 2988 |
+
*
|
| 2989 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 2990 |
+
*/
|
| 2991 |
+
class XmlSubscriptionDelRequest extends Request
|
| 2992 |
+
{
|
| 2993 |
+
private $merchantRef;
|
| 2994 |
+
private $terminalId;
|
| 2995 |
+
private $dateTime;
|
| 2996 |
+
private $hash;
|
| 2997 |
+
|
| 2998 |
+
/**
|
| 2999 |
+
* Creates the SecureCard Registration/Update request for processing
|
| 3000 |
+
* through the WorldNetTPS XML Gateway
|
| 3001 |
+
*
|
| 3002 |
+
* @param merchantRef A unique subscription identifier. Alpha numeric and max size 48 chars.
|
| 3003 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 3004 |
+
*/
|
| 3005 |
+
public function XmlSubscriptionDelRequest($merchantRef,
|
| 3006 |
+
$terminalId)
|
| 3007 |
+
{
|
| 3008 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 3009 |
+
|
| 3010 |
+
$this->merchantRef = $merchantRef;
|
| 3011 |
+
$this->terminalId = $terminalId;
|
| 3012 |
+
}
|
| 3013 |
+
/**
|
| 3014 |
+
* Setter for hash value
|
| 3015 |
+
*
|
| 3016 |
+
* @param sharedSecret
|
| 3017 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 3018 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 3019 |
+
*/
|
| 3020 |
+
public function SetHash($sharedSecret)
|
| 3021 |
+
{
|
| 3022 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->dateTime . $sharedSecret);
|
| 3023 |
+
}
|
| 3024 |
+
/**
|
| 3025 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 3026 |
+
*
|
| 3027 |
+
* @param sharedSecret
|
| 3028 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 3029 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 3030 |
+
*
|
| 3031 |
+
* @param testAccount
|
| 3032 |
+
* Boolean value defining Mode
|
| 3033 |
+
* true - This is a test account
|
| 3034 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 3035 |
+
*
|
| 3036 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 3037 |
+
*/
|
| 3038 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 3039 |
+
{
|
| 3040 |
+
return $this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 3041 |
+
}
|
| 3042 |
+
|
| 3043 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 3044 |
+
{
|
| 3045 |
+
$this->SetHash($sharedSecret);
|
| 3046 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 3047 |
+
$response = new XmlSubscriptionDelResponse($responseString);
|
| 3048 |
+
return $response;
|
| 3049 |
+
}
|
| 3050 |
+
|
| 3051 |
+
public function GenerateXml()
|
| 3052 |
+
{
|
| 3053 |
+
$requestXML = new DOMDocument("1.0");
|
| 3054 |
+
$requestXML->formatOutput = true;
|
| 3055 |
+
|
| 3056 |
+
$requestString = $requestXML->createElement("DELETESUBSCRIPTION");
|
| 3057 |
+
$requestXML->appendChild($requestString);
|
| 3058 |
+
|
| 3059 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 3060 |
+
$requestString->appendChild($node);
|
| 3061 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 3062 |
+
|
| 3063 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 3064 |
+
$requestString->appendChild($node);
|
| 3065 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 3066 |
+
|
| 3067 |
+
$node = $requestXML->createElement("DATETIME");
|
| 3068 |
+
$requestString->appendChild($node);
|
| 3069 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 3070 |
+
|
| 3071 |
+
$node = $requestXML->createElement("HASH");
|
| 3072 |
+
$requestString->appendChild($node);
|
| 3073 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 3074 |
+
|
| 3075 |
+
return $requestXML->saveXML();
|
| 3076 |
+
}
|
| 3077 |
+
}
|
| 3078 |
+
|
| 3079 |
+
/**
|
| 3080 |
+
* Used for processing XML SecureCard Registrations through the WorldNet TPS XML Gateway.
|
| 3081 |
+
*
|
| 3082 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 3083 |
+
*/
|
| 3084 |
+
class XmlSubscriptionPaymentRequest extends Request
|
| 3085 |
+
{
|
| 3086 |
+
private $terminalId;
|
| 3087 |
+
private $orderId;
|
| 3088 |
+
private $amount;
|
| 3089 |
+
private $subscriptionRef;
|
| 3090 |
+
private $cardCurrency;
|
| 3091 |
+
private $cardAmount;
|
| 3092 |
+
private $conversionRate;
|
| 3093 |
+
private $email;
|
| 3094 |
+
private $dateTime;
|
| 3095 |
+
private $hash;
|
| 3096 |
+
|
| 3097 |
+
private $foreignCurInfoSet = false;
|
| 3098 |
+
|
| 3099 |
+
/**
|
| 3100 |
+
* Setter for Email Address Value
|
| 3101 |
+
*
|
| 3102 |
+
* @param email Alpha-numeric field.
|
| 3103 |
+
*/
|
| 3104 |
+
public function SetEmail($email)
|
| 3105 |
+
{
|
| 3106 |
+
$this->email = $email;
|
| 3107 |
+
}
|
| 3108 |
+
/**
|
| 3109 |
+
* Setter for Foreign Currency Information
|
| 3110 |
+
*
|
| 3111 |
+
* @param cardCurrency ISO 4217 3 Digit Currency Code, e.g. EUR / USD / GBP
|
| 3112 |
+
* @param cardAmount (Amount X Conversion rate) Formatted to two decimal places
|
| 3113 |
+
* @param conversionRate Converstion rate supplied in rate response
|
| 3114 |
+
*/
|
| 3115 |
+
public function SetForeignCurrencyInformation($cardCurrency, $cardAmount, $conversionRate)
|
| 3116 |
+
{
|
| 3117 |
+
$this->cardCurrency = $cardCurrency;
|
| 3118 |
+
$this->cardAmount = $cardAmount;
|
| 3119 |
+
$this->conversionRate = $conversionRate;
|
| 3120 |
+
|
| 3121 |
+
$this->foreignCurInfoSet = true;
|
| 3122 |
+
}
|
| 3123 |
+
|
| 3124 |
+
public function XmlSubscriptionPaymentRequest($terminalId,
|
| 3125 |
+
$orderId,
|
| 3126 |
+
$amount,
|
| 3127 |
+
$subscriptionRef)
|
| 3128 |
+
{
|
| 3129 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 3130 |
+
|
| 3131 |
+
$this->terminalId = $terminalId;
|
| 3132 |
+
$this->orderId = $orderId;
|
| 3133 |
+
$this->amount = $amount;
|
| 3134 |
+
$this->subscriptionRef = $subscriptionRef;
|
| 3135 |
+
}
|
| 3136 |
+
/**
|
| 3137 |
+
* Setter for hash value
|
| 3138 |
+
*
|
| 3139 |
+
* @param sharedSecret
|
| 3140 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 3141 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 3142 |
+
*/
|
| 3143 |
+
public function SetHash($sharedSecret)
|
| 3144 |
+
{
|
| 3145 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->orderId . $this->subscriptionRef . $this->amount . $this->dateTime . $sharedSecret);
|
| 3146 |
+
}
|
| 3147 |
+
/**
|
| 3148 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 3149 |
+
*
|
| 3150 |
+
* @param sharedSecret
|
| 3151 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 3152 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 3153 |
+
*
|
| 3154 |
+
* @param testAccount
|
| 3155 |
+
* Boolean value defining Mode
|
| 3156 |
+
* true - This is a test account
|
| 3157 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 3158 |
+
*
|
| 3159 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 3160 |
+
*/
|
| 3161 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 3162 |
+
{
|
| 3163 |
+
return $this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 3164 |
+
}
|
| 3165 |
+
|
| 3166 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 3167 |
+
{
|
| 3168 |
+
$this->SetHash($sharedSecret);
|
| 3169 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 3170 |
+
$response = new XmlSubscriptionPaymentResponse($responseString);
|
| 3171 |
+
return $response;
|
| 3172 |
+
}
|
| 3173 |
+
|
| 3174 |
+
public function GenerateXml()
|
| 3175 |
+
{
|
| 3176 |
+
$requestXML = new DOMDocument("1.0");
|
| 3177 |
+
$requestXML->formatOutput = true;
|
| 3178 |
+
|
| 3179 |
+
$requestString = $requestXML->createElement("SUBSCRIPTIONPAYMENT");
|
| 3180 |
+
$requestXML->appendChild($requestString);
|
| 3181 |
+
|
| 3182 |
+
$node = $requestXML->createElement("ORDERID");
|
| 3183 |
+
$requestString->appendChild($node);
|
| 3184 |
+
$node->appendChild($requestXML->createTextNode($this->orderId));
|
| 3185 |
+
|
| 3186 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 3187 |
+
$requestString->appendChild($node);
|
| 3188 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 3189 |
+
|
| 3190 |
+
$node = $requestXML->createElement("AMOUNT");
|
| 3191 |
+
$requestString->appendChild($node);
|
| 3192 |
+
$node->appendChild($requestXML->createTextNode($this->amount));
|
| 3193 |
+
|
| 3194 |
+
$node = $requestXML->createElement("SUBSCRIPTIONREF");
|
| 3195 |
+
$requestString->appendChild($node);
|
| 3196 |
+
$node->appendChild($requestXML->createTextNode($this->subscriptionRef));
|
| 3197 |
+
|
| 3198 |
+
if($this->foreignCurInfoSet)
|
| 3199 |
+
{
|
| 3200 |
+
$dcNode = $requestXML->createElement("FOREIGNCURRENCYINFORMATION");
|
| 3201 |
+
$requestString->appendChild($dcNode );
|
| 3202 |
+
|
| 3203 |
+
$dcSubNode = $requestXML->createElement("CARDCURRENCY");
|
| 3204 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->cardCurrency));
|
| 3205 |
+
$dcNode->appendChild($dcSubNode);
|
| 3206 |
+
|
| 3207 |
+
$dcSubNode = $requestXML->createElement("CARDAMOUNT");
|
| 3208 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->cardAmount));
|
| 3209 |
+
$dcNode->appendChild($dcSubNode);
|
| 3210 |
+
|
| 3211 |
+
$dcSubNode = $requestXML->createElement("CONVERSIONRATE");
|
| 3212 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->conversionRate));
|
| 3213 |
+
$dcNode->appendChild($dcSubNode);
|
| 3214 |
+
}
|
| 3215 |
+
|
| 3216 |
+
if($this->email !== NULL)
|
| 3217 |
+
{
|
| 3218 |
+
$node = $requestXML->createElement("EMAIL");
|
| 3219 |
+
$requestString->appendChild($node);
|
| 3220 |
+
$node->appendChild($requestXML->createTextNode($this->email));
|
| 3221 |
+
}
|
| 3222 |
+
|
| 3223 |
+
$node = $requestXML->createElement("DATETIME");
|
| 3224 |
+
$requestString->appendChild($node);
|
| 3225 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 3226 |
+
|
| 3227 |
+
$node = $requestXML->createElement("HASH");
|
| 3228 |
+
$requestString->appendChild($node);
|
| 3229 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 3230 |
+
|
| 3231 |
+
return $requestXML->saveXML();
|
| 3232 |
+
}
|
| 3233 |
+
}
|
| 3234 |
+
|
| 3235 |
+
/**
|
| 3236 |
+
|
| 3237 |
+
* Used for processing XML Unreferenced Refund through the WorldNet TPS XML Gateway.
|
| 3238 |
+
*
|
| 3239 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 3240 |
+
*/
|
| 3241 |
+
class XmlUnreferencedRefundRequest extends Request
|
| 3242 |
+
{
|
| 3243 |
+
private $orderId;
|
| 3244 |
+
private $terminalId;
|
| 3245 |
+
private $secureCardMerchantRef;
|
| 3246 |
+
private $amount;
|
| 3247 |
+
private $email;
|
| 3248 |
+
private $autoReady;
|
| 3249 |
+
private $dateTime;
|
| 3250 |
+
private $hash;
|
| 3251 |
+
private $operator;
|
| 3252 |
+
private $description;
|
| 3253 |
+
|
| 3254 |
+
/**
|
| 3255 |
+
* Creates the SecureCard Registration/Update request for processing
|
| 3256 |
+
* through the WorldNetTPS XML Gateway
|
| 3257 |
+
*
|
| 3258 |
+
* @param merchantRef A unique subscription identifier. Alpha numeric and max size 48 chars.
|
| 3259 |
+
|
| 3260 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 3261 |
+
*/
|
| 3262 |
+
public function XmlUnreferencedRefundRequest($orderId,
|
| 3263 |
+
$terminalId,
|
| 3264 |
+
$secureCardMerchantRef,
|
| 3265 |
+
$amount,
|
| 3266 |
+
$operator)
|
| 3267 |
+
{
|
| 3268 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 3269 |
+
|
| 3270 |
+
$this->orderId = $orderId;
|
| 3271 |
+
$this->terminalId = $terminalId;
|
| 3272 |
+
$this->secureCardMerchantRef = $secureCardMerchantRef;
|
| 3273 |
+
$this->amount = $amount;
|
| 3274 |
+
$this->operator = $operator;
|
| 3275 |
+
}
|
| 3276 |
+
/**
|
| 3277 |
+
|
| 3278 |
+
* Setter for Transaction Description
|
| 3279 |
+
*
|
| 3280 |
+
* @param email Alpha-numeric field.
|
| 3281 |
+
*/
|
| 3282 |
+
public function SetDescription($description)
|
| 3283 |
+
{
|
| 3284 |
+
$this->description = $description;
|
| 3285 |
+
}
|
| 3286 |
+
/**
|
| 3287 |
+
* Setter for Email Address Value
|
| 3288 |
+
|
| 3289 |
+
*
|
| 3290 |
+
* @param email Alpha-numeric field.
|
| 3291 |
+
*/
|
| 3292 |
+
public function SetEmail($email)
|
| 3293 |
+
{
|
| 3294 |
+
$this->email = $email;
|
| 3295 |
+
}
|
| 3296 |
+
/**
|
| 3297 |
+
* Setter for Auto Ready Value
|
| 3298 |
+
*
|
| 3299 |
+
* @param autoReady
|
| 3300 |
+
|
| 3301 |
+
* Auto Ready is an optional parameter and defines if the transaction should be settled automatically.
|
| 3302 |
+
*
|
| 3303 |
+
* Accepted Values :
|
| 3304 |
+
*
|
| 3305 |
+
* Y - Transaction will be settled in next batch
|
| 3306 |
+
* N - Transaction will not be settled until user changes state in Merchant Selfcare Section
|
| 3307 |
+
|
| 3308 |
+
*/
|
| 3309 |
+
public function SetAutoReady($autoReady)
|
| 3310 |
+
{
|
| 3311 |
+
$this->autoReady = $autoReady;
|
| 3312 |
+
}
|
| 3313 |
+
/**
|
| 3314 |
+
* Setter for hash value
|
| 3315 |
+
*
|
| 3316 |
+
* @param sharedSecret
|
| 3317 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 3318 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 3319 |
+
|
| 3320 |
+
*/
|
| 3321 |
+
public function SetHash($sharedSecret)
|
| 3322 |
+
{
|
| 3323 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->orderId . $this->amount . $this->dateTime . $sharedSecret);
|
| 3324 |
+
}
|
| 3325 |
+
/**
|
| 3326 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 3327 |
+
*
|
| 3328 |
+
* @param sharedSecret
|
| 3329 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 3330 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 3331 |
+
|
| 3332 |
+
*
|
| 3333 |
+
* @param testAccount
|
| 3334 |
+
* Boolean value defining Mode
|
| 3335 |
+
* true - This is a test account
|
| 3336 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 3337 |
+
|
| 3338 |
+
*
|
| 3339 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 3340 |
+
*/
|
| 3341 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 3342 |
+
{
|
| 3343 |
+
return $this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 3344 |
+
}
|
| 3345 |
+
|
| 3346 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 3347 |
+
{
|
| 3348 |
+
$this->SetHash($sharedSecret);
|
| 3349 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 3350 |
+
$response = new XmlUnreferencedRefundResponse($responseString);
|
| 3351 |
+
return $response;
|
| 3352 |
+
}
|
| 3353 |
+
|
| 3354 |
+
public function GenerateXml()
|
| 3355 |
+
{
|
| 3356 |
+
$requestXML = new DOMDocument("1.0");
|
| 3357 |
+
$requestXML->formatOutput = true;
|
| 3358 |
+
|
| 3359 |
+
$requestString = $requestXML->createElement("UNREFERENCEDREFUND");
|
| 3360 |
+
$requestXML->appendChild($requestString);
|
| 3361 |
+
|
| 3362 |
+
$node = $requestXML->createElement("ORDERID");
|
| 3363 |
+
$requestString->appendChild($node);
|
| 3364 |
+
$node->appendChild($requestXML->createTextNode($this->orderId));
|
| 3365 |
+
|
| 3366 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 3367 |
+
$requestString->appendChild($node);
|
| 3368 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 3369 |
+
|
| 3370 |
+
$node = $requestXML->createElement("CARDREFERENCE");
|
| 3371 |
+
$requestString->appendChild($node);
|
| 3372 |
+
$node->appendChild($requestXML->createTextNode($this->secureCardMerchantRef));
|
| 3373 |
+
|
| 3374 |
+
$node = $requestXML->createElement("AMOUNT");
|
| 3375 |
+
$requestString->appendChild($node);
|
| 3376 |
+
$node->appendChild($requestXML->createTextNode($this->amount));
|
| 3377 |
+
|
| 3378 |
+
if($this->email !== NULL)
|
| 3379 |
+
{
|
| 3380 |
+
$node = $requestXML->createElement("EMAIL");
|
| 3381 |
+
$requestString->appendChild($node);
|
| 3382 |
+
$node->appendChild($requestXML->createTextNode($this->email));
|
| 3383 |
+
}
|
| 3384 |
+
|
| 3385 |
+
if($this->autoReady !== NULL)
|
| 3386 |
+
{
|
| 3387 |
+
$node = $requestXML->createElement("AUTOREADY");
|
| 3388 |
+
$requestString->appendChild($node);
|
| 3389 |
+
$node->appendChild($requestXML->createTextNode($this->autoReady));
|
| 3390 |
+
|
| 3391 |
+
}
|
| 3392 |
+
|
| 3393 |
+
$node = $requestXML->createElement("DATETIME");
|
| 3394 |
+
$requestString->appendChild($node);
|
| 3395 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 3396 |
+
|
| 3397 |
+
$node = $requestXML->createElement("HASH");
|
| 3398 |
+
$requestString->appendChild($node);
|
| 3399 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 3400 |
+
|
| 3401 |
+
$node = $requestXML->createElement("OPERATOR");
|
| 3402 |
+
$requestString->appendChild($node);
|
| 3403 |
+
$node->appendChild($requestXML->createTextNode($this->operator));
|
| 3404 |
+
|
| 3405 |
+
if($this->description !== NULL)
|
| 3406 |
+
{
|
| 3407 |
+
$node = $requestXML->createElement("DESCRIPTION");
|
| 3408 |
+
$requestString->appendChild($node);
|
| 3409 |
+
$node->appendChild($requestXML->createTextNode($this->description));
|
| 3410 |
+
}
|
| 3411 |
+
|
| 3412 |
+
return $requestXML->saveXML();
|
| 3413 |
+
}
|
| 3414 |
+
}
|
| 3415 |
+
|
| 3416 |
+
/**
|
| 3417 |
+
|
| 3418 |
+
* Used for processing XML Unreferenced Refund through the WorldNet TPS XML Gateway.
|
| 3419 |
+
*
|
| 3420 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 3421 |
+
*/
|
| 3422 |
+
class XmlVoiceIDRequest extends Request
|
| 3423 |
+
{
|
| 3424 |
+
private $orderId;
|
| 3425 |
+
private $terminalId;
|
| 3426 |
+
private $dateTime;
|
| 3427 |
+
private $mobileNumber;
|
| 3428 |
+
private $email;
|
| 3429 |
+
private $amount = "";
|
| 3430 |
+
private $currency = "";
|
| 3431 |
+
private $hash;
|
| 3432 |
+
private $description;
|
| 3433 |
+
|
| 3434 |
+
/**
|
| 3435 |
+
* Creates the SecureCard Registration/Update request for processing
|
| 3436 |
+
* through the WorldNetTPS XML Gateway
|
| 3437 |
+
*
|
| 3438 |
+
* @param merchantRef A unique subscription identifier. Alpha numeric and max size 48 chars.
|
| 3439 |
+
|
| 3440 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 3441 |
+
*/
|
| 3442 |
+
public function XmlVoiceIDRequest($orderId,
|
| 3443 |
+
$terminalId,
|
| 3444 |
+
$mobileNumber,
|
| 3445 |
+
$email)
|
| 3446 |
+
{
|
| 3447 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 3448 |
+
|
| 3449 |
+
$this->orderId = $orderId;
|
| 3450 |
+
$this->terminalId = $terminalId;
|
| 3451 |
+
$this->mobileNumber = $mobileNumber;
|
| 3452 |
+
$this->email = $email;
|
| 3453 |
+
}
|
| 3454 |
+
/**
|
| 3455 |
+
|
| 3456 |
+
* Setter for Transaction Description
|
| 3457 |
+
*
|
| 3458 |
+
* @param email Alpha-numeric field.
|
| 3459 |
+
*/
|
| 3460 |
+
public function SetVoicePayInformation($amount, $currency)
|
| 3461 |
+
{
|
| 3462 |
+
$this->amount = $amount;
|
| 3463 |
+
$this->currency = $currency;
|
| 3464 |
+
}
|
| 3465 |
+
/**
|
| 3466 |
+
* Setter for Email Address Value
|
| 3467 |
+
*
|
| 3468 |
+
* @param email Alpha-numeric field.
|
| 3469 |
+
*/
|
| 3470 |
+
public function SetDescription($description)
|
| 3471 |
+
{
|
| 3472 |
+
$this->description = $description;
|
| 3473 |
+
}
|
| 3474 |
+
/**
|
| 3475 |
+
* Setter for hash value
|
| 3476 |
+
*
|
| 3477 |
+
* @param sharedSecret
|
| 3478 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 3479 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 3480 |
+
|
| 3481 |
+
*/
|
| 3482 |
+
public function SetHash($sharedSecret)
|
| 3483 |
+
{
|
| 3484 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->orderId . $this->dateTime . $this->mobileNumber . $this->email . $this->currency . $this->amount . $sharedSecret);
|
| 3485 |
+
}
|
| 3486 |
+
/**
|
| 3487 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 3488 |
+
*
|
| 3489 |
+
* @param sharedSecret
|
| 3490 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 3491 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 3492 |
+
|
| 3493 |
+
*
|
| 3494 |
+
* @param testAccount
|
| 3495 |
+
* Boolean value defining Mode
|
| 3496 |
+
* true - This is a test account
|
| 3497 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 3498 |
+
|
| 3499 |
+
*
|
| 3500 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 3501 |
+
*/
|
| 3502 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 3503 |
+
{
|
| 3504 |
+
return $this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 3505 |
+
}
|
| 3506 |
+
|
| 3507 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 3508 |
+
{
|
| 3509 |
+
$this->SetHash($sharedSecret);
|
| 3510 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 3511 |
+
$response = new XmlVoiceIDResponse($responseString);
|
| 3512 |
+
return $response;
|
| 3513 |
+
}
|
| 3514 |
+
|
| 3515 |
+
public function GenerateXml()
|
| 3516 |
+
{
|
| 3517 |
+
$requestXML = new DOMDocument("1.0");
|
| 3518 |
+
$requestXML->formatOutput = true;
|
| 3519 |
+
|
| 3520 |
+
$requestString = $requestXML->createElement("VOICEIDREQUEST");
|
| 3521 |
+
$requestXML->appendChild($requestString);
|
| 3522 |
+
|
| 3523 |
+
$node = $requestXML->createElement("ORDERID");
|
| 3524 |
+
$requestString->appendChild($node);
|
| 3525 |
+
$node->appendChild($requestXML->createTextNode($this->orderId));
|
| 3526 |
+
|
| 3527 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 3528 |
+
$requestString->appendChild($node);
|
| 3529 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 3530 |
+
|
| 3531 |
+
$node = $requestXML->createElement("DATETIME");
|
| 3532 |
+
$requestString->appendChild($node);
|
| 3533 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 3534 |
+
|
| 3535 |
+
$node = $requestXML->createElement("MOBILENUMBER");
|
| 3536 |
+
$requestString->appendChild($node);
|
| 3537 |
+
$node->appendChild($requestXML->createTextNode($this->mobileNumber));
|
| 3538 |
+
|
| 3539 |
+
$node = $requestXML->createElement("EMAIL");
|
| 3540 |
+
$requestString->appendChild($node);
|
| 3541 |
+
$node->appendChild($requestXML->createTextNode($this->email));
|
| 3542 |
+
|
| 3543 |
+
if($this->amount != "" && $this->currency != "")
|
| 3544 |
+
{
|
| 3545 |
+
$dcNode = $requestXML->createElement("VOICEIDPAYMENT");
|
| 3546 |
+
$requestString->appendChild($dcNode );
|
| 3547 |
+
|
| 3548 |
+
$dcSubNode = $requestXML->createElement("AMOUNT");
|
| 3549 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->amount));
|
| 3550 |
+
$dcNode->appendChild($dcSubNode);
|
| 3551 |
+
|
| 3552 |
+
$dcSubNode = $requestXML->createElement("CURRENCY");
|
| 3553 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->currency));
|
| 3554 |
+
$dcNode->appendChild($dcSubNode);
|
| 3555 |
+
}
|
| 3556 |
+
|
| 3557 |
+
$node = $requestXML->createElement("HASH");
|
| 3558 |
+
$requestString->appendChild($node);
|
| 3559 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 3560 |
+
|
| 3561 |
+
if($this->description !== NULL)
|
| 3562 |
+
{
|
| 3563 |
+
$node = $requestXML->createElement("DESCRIPTION");
|
| 3564 |
+
$requestString->appendChild($node);
|
| 3565 |
+
$node->appendChild($requestXML->createTextNode($this->description));
|
| 3566 |
+
}
|
| 3567 |
+
|
| 3568 |
+
return $requestXML->saveXML();
|
| 3569 |
+
}
|
| 3570 |
+
}
|
| 3571 |
+
|
| 3572 |
+
/**
|
| 3573 |
+
* Holder class for parsed response. If there was an error there will be an error string
|
| 3574 |
+
* otherwise all values will be populated with the parsed payment response values.
|
| 3575 |
+
*
|
| 3576 |
+
* IsError should be checked before accessing any fields.
|
| 3577 |
+
*
|
| 3578 |
+
* ErrorString will contain the error if one occurred.
|
| 3579 |
+
*/
|
| 3580 |
+
class XmlAuthResponse
|
| 3581 |
+
{
|
| 3582 |
+
private $isError = false;
|
| 3583 |
+
public function IsError()
|
| 3584 |
+
{
|
| 3585 |
+
return $this->isError;
|
| 3586 |
+
}
|
| 3587 |
+
|
| 3588 |
+
private $errorString;
|
| 3589 |
+
public function ErrorString()
|
| 3590 |
+
{
|
| 3591 |
+
return $this->errorString;
|
| 3592 |
+
}
|
| 3593 |
+
|
| 3594 |
+
private $responseCode;
|
| 3595 |
+
public function ResponseCode()
|
| 3596 |
+
{
|
| 3597 |
+
return $this->responseCode;
|
| 3598 |
+
}
|
| 3599 |
+
|
| 3600 |
+
private $responseText;
|
| 3601 |
+
public function ResponseText()
|
| 3602 |
+
{
|
| 3603 |
+
return $this->responseText;
|
| 3604 |
+
}
|
| 3605 |
+
|
| 3606 |
+
private $approvalCode;
|
| 3607 |
+
public function ApprovalCode()
|
| 3608 |
+
{
|
| 3609 |
+
return $this->approvalCode;
|
| 3610 |
+
}
|
| 3611 |
+
|
| 3612 |
+
private $authorizedAmount;
|
| 3613 |
+
public function AuthorizedAmount()
|
| 3614 |
+
{
|
| 3615 |
+
return $this->authorizedAmount;
|
| 3616 |
+
}
|
| 3617 |
+
|
| 3618 |
+
private $dateTime;
|
| 3619 |
+
public function DateTime()
|
| 3620 |
+
{
|
| 3621 |
+
return $this->dateTime;
|
| 3622 |
+
}
|
| 3623 |
+
|
| 3624 |
+
private $avsResponse;
|
| 3625 |
+
public function AvsResponse()
|
| 3626 |
+
{
|
| 3627 |
+
return $this->avsResponse;
|
| 3628 |
+
}
|
| 3629 |
+
|
| 3630 |
+
private $cvvResponse;
|
| 3631 |
+
public function CvvResponse()
|
| 3632 |
+
{
|
| 3633 |
+
return $this->cvvResponse;
|
| 3634 |
+
}
|
| 3635 |
+
|
| 3636 |
+
private $uniqueRef;
|
| 3637 |
+
public function UniqueRef()
|
| 3638 |
+
{
|
| 3639 |
+
return $this->uniqueRef;
|
| 3640 |
+
}
|
| 3641 |
+
|
| 3642 |
+
private $hash;
|
| 3643 |
+
public function Hash()
|
| 3644 |
+
{
|
| 3645 |
+
return $this->hash;
|
| 3646 |
+
}
|
| 3647 |
+
|
| 3648 |
+
public function XmlAuthResponse($responseXml)
|
| 3649 |
+
{
|
| 3650 |
+
$doc = new DOMDocument();
|
| 3651 |
+
$doc->loadXML($responseXml);
|
| 3652 |
+
try
|
| 3653 |
+
{
|
| 3654 |
+
if (strpos($responseXml, "ERROR"))
|
| 3655 |
+
{
|
| 3656 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 3657 |
+
foreach( $responseNodes as $node )
|
| 3658 |
+
{
|
| 3659 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 3660 |
+
}
|
| 3661 |
+
$this->isError = true;
|
| 3662 |
+
}
|
| 3663 |
+
else if (strpos($responseXml, "PAYMENTRESPONSE"))
|
| 3664 |
+
{
|
| 3665 |
+
$responseNodes = $doc->getElementsByTagName("PAYMENTRESPONSE");
|
| 3666 |
+
|
| 3667 |
+
foreach( $responseNodes as $node )
|
| 3668 |
+
{
|
| 3669 |
+
$this->uniqueRef = $node->getElementsByTagName('UNIQUEREF')->item(0)->nodeValue;
|
| 3670 |
+
$this->responseCode = $node->getElementsByTagName('RESPONSECODE')->item(0)->nodeValue;
|
| 3671 |
+
$this->responseText = $node->getElementsByTagName('RESPONSETEXT')->item(0)->nodeValue;
|
| 3672 |
+
$this->approvalCode = $node->getElementsByTagName('APPROVALCODE')->item(0)->nodeValue;
|
| 3673 |
+
$this->authorizedAmount = $node->getElementsByTagName('AUTHORIZEDAMOUNT')->item(0)->nodeValue;
|
| 3674 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 3675 |
+
$this->avsResponse = $node->getElementsByTagName('AVSRESPONSE')->item(0)->nodeValue;
|
| 3676 |
+
$this->cvvResponse = $node->getElementsByTagName('CVVRESPONSE')->item(0)->nodeValue;
|
| 3677 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 3678 |
+
}
|
| 3679 |
+
}
|
| 3680 |
+
else
|
| 3681 |
+
{
|
| 3682 |
+
throw new Exception("Invalid Response");
|
| 3683 |
+
}
|
| 3684 |
+
}
|
| 3685 |
+
catch (Exception $e)
|
| 3686 |
+
{
|
| 3687 |
+
$this->isError = true;
|
| 3688 |
+
$this->errorString = $e->getMessage();
|
| 3689 |
+
}
|
| 3690 |
+
}
|
| 3691 |
+
}
|
| 3692 |
+
|
| 3693 |
+
/**
|
| 3694 |
+
* Holder class for parsed response. If there was an error there will be an error string
|
| 3695 |
+
* otherwise all values will be populated with the parsed payment response values.
|
| 3696 |
+
*
|
| 3697 |
+
* IsError should be checked before accessing any fields.
|
| 3698 |
+
*
|
| 3699 |
+
* ErrorString will contain the error if one occurred.
|
| 3700 |
+
*/
|
| 3701 |
+
class XmlRefundResponse
|
| 3702 |
+
{
|
| 3703 |
+
private $isError = false;
|
| 3704 |
+
public function IsError()
|
| 3705 |
+
{
|
| 3706 |
+
return $this->isError;
|
| 3707 |
+
}
|
| 3708 |
+
|
| 3709 |
+
private $errorString;
|
| 3710 |
+
public function ErrorString()
|
| 3711 |
+
{
|
| 3712 |
+
return $this->errorString;
|
| 3713 |
+
}
|
| 3714 |
+
|
| 3715 |
+
private $responseCode;
|
| 3716 |
+
public function ResponseCode()
|
| 3717 |
+
{
|
| 3718 |
+
return $this->responseCode;
|
| 3719 |
+
}
|
| 3720 |
+
|
| 3721 |
+
private $responseText;
|
| 3722 |
+
public function ResponseText()
|
| 3723 |
+
{
|
| 3724 |
+
return $this->responseText;
|
| 3725 |
+
}
|
| 3726 |
+
|
| 3727 |
+
private $approvalCode;
|
| 3728 |
+
public function OrderId()
|
| 3729 |
+
{
|
| 3730 |
+
return $this->orderId;
|
| 3731 |
+
}
|
| 3732 |
+
|
| 3733 |
+
private $dateTime;
|
| 3734 |
+
public function DateTime()
|
| 3735 |
+
{
|
| 3736 |
+
return $this->dateTime;
|
| 3737 |
+
}
|
| 3738 |
+
|
| 3739 |
+
private $uniqueRef;
|
| 3740 |
+
public function UniqueRef()
|
| 3741 |
+
{
|
| 3742 |
+
return $this->uniqueRef;
|
| 3743 |
+
}
|
| 3744 |
+
|
| 3745 |
+
private $hash;
|
| 3746 |
+
public function Hash()
|
| 3747 |
+
{
|
| 3748 |
+
return $this->hash;
|
| 3749 |
+
}
|
| 3750 |
+
|
| 3751 |
+
public function XmlRefundResponse($responseXml)
|
| 3752 |
+
{
|
| 3753 |
+
$doc = new DOMDocument();
|
| 3754 |
+
$doc->loadXML($responseXml);
|
| 3755 |
+
try
|
| 3756 |
+
{
|
| 3757 |
+
if (strpos($responseXml, "ERROR"))
|
| 3758 |
+
{
|
| 3759 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 3760 |
+
foreach( $responseNodes as $node )
|
| 3761 |
+
{
|
| 3762 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 3763 |
+
}
|
| 3764 |
+
$this->isError = true;
|
| 3765 |
+
}
|
| 3766 |
+
else if (strpos($responseXml, "REFUNDRESPONSE"))
|
| 3767 |
+
{
|
| 3768 |
+
$responseNodes = $doc->getElementsByTagName("REFUNDRESPONSE");
|
| 3769 |
+
|
| 3770 |
+
foreach( $responseNodes as $node )
|
| 3771 |
+
{
|
| 3772 |
+
$this->responseCode = $node->getElementsByTagName('RESPONSECODE')->item(0)->nodeValue;
|
| 3773 |
+
$this->responseText = $node->getElementsByTagName('RESPONSETEXT')->item(0)->nodeValue;
|
| 3774 |
+
$this->uniqueRef = $node->getElementsByTagName('UNIQUEREF')->item(0)->nodeValue;
|
| 3775 |
+
$this->orderId = $node->getElementsByTagName('ORDERID')->item(0)->nodeValue;
|
| 3776 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 3777 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 3778 |
+
}
|
| 3779 |
+
}
|
| 3780 |
+
else
|
| 3781 |
+
{
|
| 3782 |
+
throw new Exception("Invalid Response");
|
| 3783 |
+
}
|
| 3784 |
+
}
|
| 3785 |
+
catch (Exception $e)
|
| 3786 |
+
{
|
| 3787 |
+
$this->isError = true;
|
| 3788 |
+
$this->errorString = $e->getMessage();
|
| 3789 |
+
}
|
| 3790 |
+
}
|
| 3791 |
+
}
|
| 3792 |
+
|
| 3793 |
+
/**
|
| 3794 |
+
* Holder class for parsed response. If there was an error there will be an error string
|
| 3795 |
+
* otherwise all values will be populated with the parsed payment response values.
|
| 3796 |
+
*
|
| 3797 |
+
* IsError should be checked before accessing any fields.
|
| 3798 |
+
*
|
| 3799 |
+
* ErrorString will contain the error if one occurred.
|
| 3800 |
+
*/
|
| 3801 |
+
class XmlPreAuthResponse
|
| 3802 |
+
{
|
| 3803 |
+
private $isError = false;
|
| 3804 |
+
public function IsError()
|
| 3805 |
+
{
|
| 3806 |
+
return $this->isError;
|
| 3807 |
+
}
|
| 3808 |
+
|
| 3809 |
+
private $errorString;
|
| 3810 |
+
public function ErrorString()
|
| 3811 |
+
{
|
| 3812 |
+
return $this->errorString;
|
| 3813 |
+
}
|
| 3814 |
+
|
| 3815 |
+
private $responseCode;
|
| 3816 |
+
public function ResponseCode()
|
| 3817 |
+
{
|
| 3818 |
+
return $this->responseCode;
|
| 3819 |
+
}
|
| 3820 |
+
|
| 3821 |
+
private $responseText;
|
| 3822 |
+
public function ResponseText()
|
| 3823 |
+
{
|
| 3824 |
+
return $this->responseText;
|
| 3825 |
+
}
|
| 3826 |
+
|
| 3827 |
+
private $approvalCode;
|
| 3828 |
+
public function ApprovalCode()
|
| 3829 |
+
{
|
| 3830 |
+
return $this->approvalCode;
|
| 3831 |
+
}
|
| 3832 |
+
|
| 3833 |
+
private $dateTime;
|
| 3834 |
+
public function DateTime()
|
| 3835 |
+
{
|
| 3836 |
+
return $this->dateTime;
|
| 3837 |
+
}
|
| 3838 |
+
|
| 3839 |
+
private $avsResponse;
|
| 3840 |
+
public function AvsResponse()
|
| 3841 |
+
{
|
| 3842 |
+
return $this->avsResponse;
|
| 3843 |
+
}
|
| 3844 |
+
|
| 3845 |
+
private $cvvResponse;
|
| 3846 |
+
public function CvvResponse()
|
| 3847 |
+
{
|
| 3848 |
+
return $this->cvvResponse;
|
| 3849 |
+
}
|
| 3850 |
+
|
| 3851 |
+
private $uniqueRef;
|
| 3852 |
+
public function UniqueRef()
|
| 3853 |
+
{
|
| 3854 |
+
return $this->uniqueRef;
|
| 3855 |
+
}
|
| 3856 |
+
|
| 3857 |
+
private $hash;
|
| 3858 |
+
public function Hash()
|
| 3859 |
+
{
|
| 3860 |
+
return $this->hash;
|
| 3861 |
+
}
|
| 3862 |
+
|
| 3863 |
+
public function XmlPreAuthResponse($responseXml)
|
| 3864 |
+
{
|
| 3865 |
+
$doc = new DOMDocument();
|
| 3866 |
+
$doc->loadXML($responseXml);
|
| 3867 |
+
try
|
| 3868 |
+
{
|
| 3869 |
+
if (strpos($responseXml, "ERROR"))
|
| 3870 |
+
{
|
| 3871 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 3872 |
+
foreach( $responseNodes as $node )
|
| 3873 |
+
{
|
| 3874 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 3875 |
+
}
|
| 3876 |
+
$this->isError = true;
|
| 3877 |
+
}
|
| 3878 |
+
else if (strpos($responseXml, "PREAUTHRESPONSE"))
|
| 3879 |
+
{
|
| 3880 |
+
$responseNodes = $doc->getElementsByTagName("PREAUTHRESPONSE");
|
| 3881 |
+
|
| 3882 |
+
foreach( $responseNodes as $node )
|
| 3883 |
+
{
|
| 3884 |
+
$this->uniqueRef = $node->getElementsByTagName('UNIQUEREF')->item(0)->nodeValue;
|
| 3885 |
+
$this->responseCode = $node->getElementsByTagName('RESPONSECODE')->item(0)->nodeValue;
|
| 3886 |
+
$this->responseText = $node->getElementsByTagName('RESPONSETEXT')->item(0)->nodeValue;
|
| 3887 |
+
$this->approvalCode = $node->getElementsByTagName('APPROVALCODE')->item(0)->nodeValue;
|
| 3888 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 3889 |
+
$this->avsResponse = $node->getElementsByTagName('AVSRESPONSE')->item(0)->nodeValue;
|
| 3890 |
+
$this->cvvResponse = $node->getElementsByTagName('CVVRESPONSE')->item(0)->nodeValue;
|
| 3891 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 3892 |
+
}
|
| 3893 |
+
}
|
| 3894 |
+
else
|
| 3895 |
+
{
|
| 3896 |
+
throw new Exception("Invalid Response");
|
| 3897 |
+
}
|
| 3898 |
+
}
|
| 3899 |
+
catch (Exception $e)
|
| 3900 |
+
{
|
| 3901 |
+
$this->isError = true;
|
| 3902 |
+
$this->errorString = $e->getMessage();
|
| 3903 |
+
}
|
| 3904 |
+
}
|
| 3905 |
+
}
|
| 3906 |
+
|
| 3907 |
+
/**
|
| 3908 |
+
* Holder class for parsed response. If there was an error there will be an error string
|
| 3909 |
+
* otherwise all values will be populated with the parsed payment response values.
|
| 3910 |
+
*
|
| 3911 |
+
* IsError should be checked before accessing any fields.
|
| 3912 |
+
*
|
| 3913 |
+
* ErrorString will contain the error if one occurred.
|
| 3914 |
+
*/
|
| 3915 |
+
class XmlPreAuthCompletionResponse
|
| 3916 |
+
{
|
| 3917 |
+
private $isError = false;
|
| 3918 |
+
public function IsError()
|
| 3919 |
+
{
|
| 3920 |
+
return $this->isError;
|
| 3921 |
+
}
|
| 3922 |
+
|
| 3923 |
+
private $errorString;
|
| 3924 |
+
public function ErrorString()
|
| 3925 |
+
{
|
| 3926 |
+
return $this->errorString;
|
| 3927 |
+
}
|
| 3928 |
+
|
| 3929 |
+
private $responseCode;
|
| 3930 |
+
public function ResponseCode()
|
| 3931 |
+
{
|
| 3932 |
+
return $this->responseCode;
|
| 3933 |
+
}
|
| 3934 |
+
|
| 3935 |
+
private $responseText;
|
| 3936 |
+
public function ResponseText()
|
| 3937 |
+
{
|
| 3938 |
+
return $this->responseText;
|
| 3939 |
+
}
|
| 3940 |
+
|
| 3941 |
+
private $approvalCode;
|
| 3942 |
+
public function ApprovalCode()
|
| 3943 |
+
{
|
| 3944 |
+
return $this->approvalCode;
|
| 3945 |
+
}
|
| 3946 |
+
|
| 3947 |
+
private $dateTime;
|
| 3948 |
+
public function DateTime()
|
| 3949 |
+
{
|
| 3950 |
+
return $this->dateTime;
|
| 3951 |
+
}
|
| 3952 |
+
|
| 3953 |
+
private $avsResponse;
|
| 3954 |
+
public function AvsResponse()
|
| 3955 |
+
{
|
| 3956 |
+
return $this->avsResponse;
|
| 3957 |
+
}
|
| 3958 |
+
|
| 3959 |
+
private $cvvResponse;
|
| 3960 |
+
public function CvvResponse()
|
| 3961 |
+
{
|
| 3962 |
+
return $this->cvvResponse;
|
| 3963 |
+
}
|
| 3964 |
+
|
| 3965 |
+
private $uniqueRef;
|
| 3966 |
+
public function UniqueRef()
|
| 3967 |
+
{
|
| 3968 |
+
return $this->uniqueRef;
|
| 3969 |
+
}
|
| 3970 |
+
|
| 3971 |
+
private $hash;
|
| 3972 |
+
public function Hash()
|
| 3973 |
+
{
|
| 3974 |
+
return $this->hash;
|
| 3975 |
+
}
|
| 3976 |
+
|
| 3977 |
+
public function XmlPreAuthCompletionResponse($responseXml)
|
| 3978 |
+
{
|
| 3979 |
+
$doc = new DOMDocument();
|
| 3980 |
+
$doc->loadXML($responseXml);
|
| 3981 |
+
try
|
| 3982 |
+
{
|
| 3983 |
+
if (strpos($responseXml, "ERROR"))
|
| 3984 |
+
{
|
| 3985 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 3986 |
+
foreach( $responseNodes as $node )
|
| 3987 |
+
{
|
| 3988 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 3989 |
+
}
|
| 3990 |
+
$this->isError = true;
|
| 3991 |
+
}
|
| 3992 |
+
else if (strpos($responseXml, "PREAUTHCOMPLETIONRESPONSE"))
|
| 3993 |
+
{
|
| 3994 |
+
$responseNodes = $doc->getElementsByTagName("PREAUTHCOMPLETIONRESPONSE");
|
| 3995 |
+
|
| 3996 |
+
foreach( $responseNodes as $node )
|
| 3997 |
+
{
|
| 3998 |
+
$this->uniqueRef = $node->getElementsByTagName('UNIQUEREF')->item(0)->nodeValue;
|
| 3999 |
+
$this->responseCode = $node->getElementsByTagName('RESPONSECODE')->item(0)->nodeValue;
|
| 4000 |
+
$this->responseText = $node->getElementsByTagName('RESPONSETEXT')->item(0)->nodeValue;
|
| 4001 |
+
$this->approvalCode = $node->getElementsByTagName('APPROVALCODE')->item(0)->nodeValue;
|
| 4002 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4003 |
+
$this->avsResponse = $node->getElementsByTagName('AVSRESPONSE')->item(0)->nodeValue;
|
| 4004 |
+
$this->cvvResponse = $node->getElementsByTagName('CVVRESPONSE')->item(0)->nodeValue;
|
| 4005 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4006 |
+
}
|
| 4007 |
+
}
|
| 4008 |
+
else
|
| 4009 |
+
{
|
| 4010 |
+
throw new Exception("Invalid Response");
|
| 4011 |
+
}
|
| 4012 |
+
}
|
| 4013 |
+
catch (Exception $e)
|
| 4014 |
+
{
|
| 4015 |
+
$this->isError = true;
|
| 4016 |
+
$this->errorString = $e->getMessage();
|
| 4017 |
+
}
|
| 4018 |
+
}
|
| 4019 |
+
}
|
| 4020 |
+
|
| 4021 |
+
/**
|
| 4022 |
+
* Holder class for parsed response. If there was an error there will be an error string
|
| 4023 |
+
* otherwise all values will be populated with the parsed payment response values.
|
| 4024 |
+
*
|
| 4025 |
+
* IsError should be checked before accessing any fields.
|
| 4026 |
+
*
|
| 4027 |
+
* ErrorString will contain the error if one occurred.
|
| 4028 |
+
*/
|
| 4029 |
+
class XmlRateResponse
|
| 4030 |
+
{
|
| 4031 |
+
private $isError = false;
|
| 4032 |
+
public function IsError()
|
| 4033 |
+
{
|
| 4034 |
+
return $this->isError;
|
| 4035 |
+
}
|
| 4036 |
+
|
| 4037 |
+
private $errorString;
|
| 4038 |
+
public function ErrorString()
|
| 4039 |
+
{
|
| 4040 |
+
return $this->errorString;
|
| 4041 |
+
}
|
| 4042 |
+
|
| 4043 |
+
private $terminalCurrency;
|
| 4044 |
+
public function TerminalCurrency()
|
| 4045 |
+
{
|
| 4046 |
+
return $this->terminalCurrency;
|
| 4047 |
+
}
|
| 4048 |
+
|
| 4049 |
+
private $cardCurrency;
|
| 4050 |
+
public function CardCurrency()
|
| 4051 |
+
{
|
| 4052 |
+
return $this->cardCurrency;
|
| 4053 |
+
}
|
| 4054 |
+
|
| 4055 |
+
private $conversionRate;
|
| 4056 |
+
public function ConversionRate()
|
| 4057 |
+
{
|
| 4058 |
+
return $this->conversionRate;
|
| 4059 |
+
}
|
| 4060 |
+
private $foreignAmount;
|
| 4061 |
+
public function ForeignAmount()
|
| 4062 |
+
{
|
| 4063 |
+
return $this->foreignAmount;
|
| 4064 |
+
}
|
| 4065 |
+
|
| 4066 |
+
private $dateTime;
|
| 4067 |
+
public function DateTime()
|
| 4068 |
+
{
|
| 4069 |
+
return $this->dateTime;
|
| 4070 |
+
}
|
| 4071 |
+
|
| 4072 |
+
private $hash;
|
| 4073 |
+
public function Hash()
|
| 4074 |
+
{
|
| 4075 |
+
return $this->hash;
|
| 4076 |
+
}
|
| 4077 |
+
|
| 4078 |
+
public function XmlRateResponse($responseXml)
|
| 4079 |
+
{
|
| 4080 |
+
$doc = new DOMDocument();
|
| 4081 |
+
$doc->loadXML($responseXml);
|
| 4082 |
+
try
|
| 4083 |
+
{
|
| 4084 |
+
|
| 4085 |
+
if (strpos($responseXml, "ERROR"))
|
| 4086 |
+
{
|
| 4087 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4088 |
+
foreach( $responseNodes as $node )
|
| 4089 |
+
{
|
| 4090 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4091 |
+
}
|
| 4092 |
+
$this->isError = true;
|
| 4093 |
+
}
|
| 4094 |
+
else if (strpos($responseXml, "CARDCURRENCYRATERESPONSE"))
|
| 4095 |
+
{
|
| 4096 |
+
$responseNodes = $doc->getElementsByTagName("CARDCURRENCYRATERESPONSE");
|
| 4097 |
+
|
| 4098 |
+
foreach( $responseNodes as $node )
|
| 4099 |
+
{
|
| 4100 |
+
$this->terminalCurrency = $node->getElementsByTagName('TERMINALCURRENCY')->item(0)->nodeValue;
|
| 4101 |
+
$this->cardCurrency = $node->getElementsByTagName('CARDCURRENCY')->item(0)->nodeValue;
|
| 4102 |
+
$this->conversionRate = $node->getElementsByTagName('CONVERSIONRATE')->item(0)->nodeValue;
|
| 4103 |
+
$this->foreignAmount = $node->getElementsByTagName('FOREIGNAMOUNT')->item(0)->nodeValue;
|
| 4104 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4105 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4106 |
+
}
|
| 4107 |
+
}
|
| 4108 |
+
else
|
| 4109 |
+
{
|
| 4110 |
+
throw new Exception("Invalid Response");
|
| 4111 |
+
|
| 4112 |
+
|
| 4113 |
+
}
|
| 4114 |
+
}
|
| 4115 |
+
catch (Exception $e)
|
| 4116 |
+
{
|
| 4117 |
+
$this->isError = true;
|
| 4118 |
+
$this->errorString = $e->getMessage();
|
| 4119 |
+
}
|
| 4120 |
+
}
|
| 4121 |
+
}
|
| 4122 |
+
|
| 4123 |
+
/**
|
| 4124 |
+
* Base holder class for parsed SecureCard response. If there was an error there will be an error string
|
| 4125 |
+
* otherwise all values will be populated with the parsed payment response values.
|
| 4126 |
+
*/
|
| 4127 |
+
class XmlSecureCardResponse
|
| 4128 |
+
{
|
| 4129 |
+
protected $isError = false;
|
| 4130 |
+
public function IsError()
|
| 4131 |
+
{
|
| 4132 |
+
return $this->isError;
|
| 4133 |
+
}
|
| 4134 |
+
|
| 4135 |
+
protected $errorString;
|
| 4136 |
+
public function ErrorString()
|
| 4137 |
+
{
|
| 4138 |
+
return $this->errorString;
|
| 4139 |
+
}
|
| 4140 |
+
|
| 4141 |
+
protected $errorCode;
|
| 4142 |
+
public function ErrorCode()
|
| 4143 |
+
{
|
| 4144 |
+
return $this->errorCode;
|
| 4145 |
+
}
|
| 4146 |
+
|
| 4147 |
+
protected $merchantRef;
|
| 4148 |
+
public function MerchantReference()
|
| 4149 |
+
{
|
| 4150 |
+
return $this->merchantRef;
|
| 4151 |
+
}
|
| 4152 |
+
|
| 4153 |
+
protected $cardRef;
|
| 4154 |
+
public function CardReference()
|
| 4155 |
+
{
|
| 4156 |
+
return $this->cardRef;
|
| 4157 |
+
}
|
| 4158 |
+
|
| 4159 |
+
protected $dateTime;
|
| 4160 |
+
public function DateTime()
|
| 4161 |
+
{
|
| 4162 |
+
return $this->dateTime;
|
| 4163 |
+
}
|
| 4164 |
+
|
| 4165 |
+
protected $hash;
|
| 4166 |
+
public function Hash()
|
| 4167 |
+
{
|
| 4168 |
+
return $this->hash;
|
| 4169 |
+
}
|
| 4170 |
+
}
|
| 4171 |
+
|
| 4172 |
+
/**
|
| 4173 |
+
* Holder class for parsed SecureCard registration response.
|
| 4174 |
+
*/
|
| 4175 |
+
class XmlSecureCardRegResponse extends XmlSecureCardResponse
|
| 4176 |
+
{
|
| 4177 |
+
public function XmlSecureCardRegResponse($responseXml)
|
| 4178 |
+
{
|
| 4179 |
+
$doc = new DOMDocument();
|
| 4180 |
+
$doc->loadXML($responseXml);
|
| 4181 |
+
try
|
| 4182 |
+
{
|
| 4183 |
+
if (strpos($responseXml, "ERROR"))
|
| 4184 |
+
{
|
| 4185 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4186 |
+
foreach( $responseNodes as $node )
|
| 4187 |
+
{
|
| 4188 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 4189 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4190 |
+
}
|
| 4191 |
+
$this->isError = true;
|
| 4192 |
+
}
|
| 4193 |
+
else if (strpos($responseXml, "SECURECARDREGISTRATIONRESPONSE"))
|
| 4194 |
+
{
|
| 4195 |
+
$responseNodes = $doc->getElementsByTagName("SECURECARDREGISTRATIONRESPONSE");
|
| 4196 |
+
|
| 4197 |
+
foreach( $responseNodes as $node )
|
| 4198 |
+
{
|
| 4199 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 4200 |
+
$this->cardRef = $node->getElementsByTagName('CARDREFERENCE')->item(0)->nodeValue;
|
| 4201 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4202 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4203 |
+
}
|
| 4204 |
+
}
|
| 4205 |
+
else
|
| 4206 |
+
{
|
| 4207 |
+
throw new Exception("Invalid Response");
|
| 4208 |
+
}
|
| 4209 |
+
}
|
| 4210 |
+
catch (Exception $e)
|
| 4211 |
+
{
|
| 4212 |
+
$this->isError = true;
|
| 4213 |
+
$this->errorString = $e->getMessage();
|
| 4214 |
+
}
|
| 4215 |
+
}
|
| 4216 |
+
}
|
| 4217 |
+
|
| 4218 |
+
/**
|
| 4219 |
+
* Holder class for parsed SecureCard update response.
|
| 4220 |
+
*/
|
| 4221 |
+
class XmlSecureCardUpdResponse extends XmlSecureCardResponse
|
| 4222 |
+
{
|
| 4223 |
+
public function XmlSecureCardUpdResponse($responseXml)
|
| 4224 |
+
{
|
| 4225 |
+
$doc = new DOMDocument();
|
| 4226 |
+
$doc->loadXML($responseXml);
|
| 4227 |
+
try
|
| 4228 |
+
{
|
| 4229 |
+
if (strpos($responseXml, "ERROR"))
|
| 4230 |
+
{
|
| 4231 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4232 |
+
foreach( $responseNodes as $node )
|
| 4233 |
+
{
|
| 4234 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 4235 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4236 |
+
}
|
| 4237 |
+
$this->isError = true;
|
| 4238 |
+
}
|
| 4239 |
+
else if (strpos($responseXml, "SECURECARDUPDATERESPONSE"))
|
| 4240 |
+
{
|
| 4241 |
+
$responseNodes = $doc->getElementsByTagName("SECURECARDUPDATERESPONSE");
|
| 4242 |
+
|
| 4243 |
+
foreach( $responseNodes as $node )
|
| 4244 |
+
{
|
| 4245 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 4246 |
+
$this->cardRef = $node->getElementsByTagName('CARDREFERENCE')->item(0)->nodeValue;
|
| 4247 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4248 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4249 |
+
}
|
| 4250 |
+
}
|
| 4251 |
+
else
|
| 4252 |
+
{
|
| 4253 |
+
throw new Exception("Invalid Response");
|
| 4254 |
+
}
|
| 4255 |
+
}
|
| 4256 |
+
catch (Exception $e)
|
| 4257 |
+
{
|
| 4258 |
+
$this->isError = true;
|
| 4259 |
+
$this->errorString = $e->getMessage();
|
| 4260 |
+
}
|
| 4261 |
+
}
|
| 4262 |
+
}
|
| 4263 |
+
|
| 4264 |
+
/**
|
| 4265 |
+
* Holder class for parsed SecureCard search response.
|
| 4266 |
+
*/
|
| 4267 |
+
class XmlSecureCardDelResponse extends XmlSecureCardResponse
|
| 4268 |
+
{
|
| 4269 |
+
public function XmlSecureCardDelResponse($responseXml)
|
| 4270 |
+
{
|
| 4271 |
+
$doc = new DOMDocument();
|
| 4272 |
+
$doc->loadXML($responseXml);
|
| 4273 |
+
try
|
| 4274 |
+
{
|
| 4275 |
+
if (strpos($responseXml, "ERROR"))
|
| 4276 |
+
{
|
| 4277 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4278 |
+
foreach( $responseNodes as $node )
|
| 4279 |
+
{
|
| 4280 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 4281 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4282 |
+
}
|
| 4283 |
+
$this->isError = true;
|
| 4284 |
+
}
|
| 4285 |
+
else if (strpos($responseXml, "SECURECARDREMOVALRESPONSE"))
|
| 4286 |
+
{
|
| 4287 |
+
$responseNodes = $doc->getElementsByTagName("SECURECARDREMOVALRESPONSE");
|
| 4288 |
+
|
| 4289 |
+
foreach( $responseNodes as $node )
|
| 4290 |
+
{
|
| 4291 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 4292 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4293 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4294 |
+
}
|
| 4295 |
+
}
|
| 4296 |
+
else
|
| 4297 |
+
{
|
| 4298 |
+
throw new Exception("Invalid Response");
|
| 4299 |
+
}
|
| 4300 |
+
}
|
| 4301 |
+
catch (Exception $e)
|
| 4302 |
+
{
|
| 4303 |
+
$this->isError = true;
|
| 4304 |
+
$this->errorString = $e->getMessage();
|
| 4305 |
+
}
|
| 4306 |
+
}
|
| 4307 |
+
}
|
| 4308 |
+
|
| 4309 |
+
/**
|
| 4310 |
+
* Holder class for parsed SecureCard search response.
|
| 4311 |
+
*/
|
| 4312 |
+
class XmlSecureCardSearchResponse extends XmlSecureCardResponse
|
| 4313 |
+
{
|
| 4314 |
+
protected $merchantRef;
|
| 4315 |
+
public function MerchantReference()
|
| 4316 |
+
{
|
| 4317 |
+
return $this->merchantRef;
|
| 4318 |
+
}
|
| 4319 |
+
|
| 4320 |
+
protected $cardRef;
|
| 4321 |
+
public function CardReference()
|
| 4322 |
+
{
|
| 4323 |
+
return $this->cardRef;
|
| 4324 |
+
}
|
| 4325 |
+
|
| 4326 |
+
private $cardType;
|
| 4327 |
+
public function CardType()
|
| 4328 |
+
{
|
| 4329 |
+
return $this->cardType;
|
| 4330 |
+
}
|
| 4331 |
+
|
| 4332 |
+
private $expiry;
|
| 4333 |
+
public function CardExpiry()
|
| 4334 |
+
{
|
| 4335 |
+
return $this->expiry;
|
| 4336 |
+
}
|
| 4337 |
+
|
| 4338 |
+
private $cardHolderName;
|
| 4339 |
+
public function CardHolderName()
|
| 4340 |
+
{
|
| 4341 |
+
return $this->cardHolderName;
|
| 4342 |
+
}
|
| 4343 |
+
|
| 4344 |
+
protected $hash;
|
| 4345 |
+
public function Hash()
|
| 4346 |
+
{
|
| 4347 |
+
return $this->hash;
|
| 4348 |
+
}
|
| 4349 |
+
|
| 4350 |
+
public function XmlSecureCardSearchResponse($responseXml)
|
| 4351 |
+
{
|
| 4352 |
+
$doc = new DOMDocument();
|
| 4353 |
+
$doc->loadXML($responseXml);
|
| 4354 |
+
try
|
| 4355 |
+
{
|
| 4356 |
+
if (strpos($responseXml, "ERROR"))
|
| 4357 |
+
{
|
| 4358 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4359 |
+
foreach( $responseNodes as $node )
|
| 4360 |
+
{
|
| 4361 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 4362 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4363 |
+
}
|
| 4364 |
+
$this->isError = true;
|
| 4365 |
+
}
|
| 4366 |
+
else if (strpos($responseXml, "SECURECARDSEARCHRESPONSE"))
|
| 4367 |
+
{
|
| 4368 |
+
$responseNodes = $doc->getElementsByTagName("SECURECARDSEARCHRESPONSE");
|
| 4369 |
+
|
| 4370 |
+
foreach( $responseNodes as $node )
|
| 4371 |
+
{
|
| 4372 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 4373 |
+
$this->cardRef = $node->getElementsByTagName('CARDREFERENCE')->item(0)->nodeValue;
|
| 4374 |
+
$this->cardType = $node->getElementsByTagName('CARDTYPE')->item(0)->nodeValue;
|
| 4375 |
+
$this->expiry = $node->getElementsByTagName('CARDEXPIRY')->item(0)->nodeValue;
|
| 4376 |
+
$this->cardHolderName = $node->getElementsByTagName('CARDHOLDERNAME')->item(0)->nodeValue;
|
| 4377 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4378 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4379 |
+
}
|
| 4380 |
+
}
|
| 4381 |
+
else
|
| 4382 |
+
{
|
| 4383 |
+
throw new Exception("Invalid Response");
|
| 4384 |
+
}
|
| 4385 |
+
}
|
| 4386 |
+
catch (Exception $e)
|
| 4387 |
+
{
|
| 4388 |
+
$this->isError = true;
|
| 4389 |
+
$this->errorString = $e->getMessage();
|
| 4390 |
+
}
|
| 4391 |
+
}
|
| 4392 |
+
}
|
| 4393 |
+
|
| 4394 |
+
/**
|
| 4395 |
+
* Base holder class for parsed Subscription response. If there was an error there will be an error string
|
| 4396 |
+
* otherwise all values will be populated with the parsed payment response values.
|
| 4397 |
+
*/
|
| 4398 |
+
class XmlSubscriptionResponse
|
| 4399 |
+
{
|
| 4400 |
+
protected $isError = false;
|
| 4401 |
+
public function IsError()
|
| 4402 |
+
{
|
| 4403 |
+
return $this->isError;
|
| 4404 |
+
}
|
| 4405 |
+
|
| 4406 |
+
protected $errorString;
|
| 4407 |
+
public function ErrorString()
|
| 4408 |
+
{
|
| 4409 |
+
return $this->errorString;
|
| 4410 |
+
}
|
| 4411 |
+
|
| 4412 |
+
protected $errorCode;
|
| 4413 |
+
public function ErrorCode()
|
| 4414 |
+
{
|
| 4415 |
+
return $this->errorCode;
|
| 4416 |
+
}
|
| 4417 |
+
|
| 4418 |
+
protected $merchantRef;
|
| 4419 |
+
public function MerchantReference()
|
| 4420 |
+
{
|
| 4421 |
+
return $this->merchantRef;
|
| 4422 |
+
}
|
| 4423 |
+
|
| 4424 |
+
protected $dateTime;
|
| 4425 |
+
public function DateTime()
|
| 4426 |
+
{
|
| 4427 |
+
return $this->dateTime;
|
| 4428 |
+
}
|
| 4429 |
+
|
| 4430 |
+
protected $hash;
|
| 4431 |
+
public function Hash()
|
| 4432 |
+
{
|
| 4433 |
+
return $this->hash;
|
| 4434 |
+
}
|
| 4435 |
+
}
|
| 4436 |
+
|
| 4437 |
+
/**
|
| 4438 |
+
* Holder class for parsed Stored Subscription registration response.
|
| 4439 |
+
*/
|
| 4440 |
+
class XmlStoredSubscriptionRegResponse extends XmlSubscriptionResponse
|
| 4441 |
+
{
|
| 4442 |
+
public function XmlStoredSubscriptionRegResponse($responseXml)
|
| 4443 |
+
{
|
| 4444 |
+
$doc = new DOMDocument();
|
| 4445 |
+
$doc->loadXML($responseXml);
|
| 4446 |
+
try
|
| 4447 |
+
{
|
| 4448 |
+
if (strpos($responseXml, "ERROR"))
|
| 4449 |
+
{
|
| 4450 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4451 |
+
foreach( $responseNodes as $node )
|
| 4452 |
+
{
|
| 4453 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 4454 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4455 |
+
}
|
| 4456 |
+
$this->isError = true;
|
| 4457 |
+
}
|
| 4458 |
+
else if (strpos($responseXml, "ADDSTOREDSUBSCRIPTIONRESPONSE"))
|
| 4459 |
+
{
|
| 4460 |
+
$responseNodes = $doc->getElementsByTagName("ADDSTOREDSUBSCRIPTIONRESPONSE");
|
| 4461 |
+
|
| 4462 |
+
foreach( $responseNodes as $node )
|
| 4463 |
+
{
|
| 4464 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 4465 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4466 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4467 |
+
}
|
| 4468 |
+
}
|
| 4469 |
+
else
|
| 4470 |
+
{
|
| 4471 |
+
throw new Exception("Invalid Response");
|
| 4472 |
+
}
|
| 4473 |
+
}
|
| 4474 |
+
catch (Exception $e)
|
| 4475 |
+
{
|
| 4476 |
+
$this->isError = true;
|
| 4477 |
+
$this->errorString = $e->getMessage();
|
| 4478 |
+
}
|
| 4479 |
+
}
|
| 4480 |
+
}
|
| 4481 |
+
|
| 4482 |
+
/**
|
| 4483 |
+
* Holder class for parsed Stored Subscription update response.
|
| 4484 |
+
*/
|
| 4485 |
+
class XmlStoredSubscriptionUpdResponse extends XmlSubscriptionResponse
|
| 4486 |
+
{
|
| 4487 |
+
public function XmlStoredSubscriptionUpdResponse($responseXml)
|
| 4488 |
+
{
|
| 4489 |
+
$doc = new DOMDocument();
|
| 4490 |
+
$doc->loadXML($responseXml);
|
| 4491 |
+
try
|
| 4492 |
+
{
|
| 4493 |
+
if (strpos($responseXml, "ERROR"))
|
| 4494 |
+
{
|
| 4495 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4496 |
+
foreach( $responseNodes as $node )
|
| 4497 |
+
{
|
| 4498 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 4499 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4500 |
+
}
|
| 4501 |
+
$this->isError = true;
|
| 4502 |
+
}
|
| 4503 |
+
else if (strpos($responseXml, "UPDATESTOREDSUBSCRIPTIONRESPONSE"))
|
| 4504 |
+
{
|
| 4505 |
+
$responseNodes = $doc->getElementsByTagName("UPDATESTOREDSUBSCRIPTIONRESPONSE");
|
| 4506 |
+
|
| 4507 |
+
foreach( $responseNodes as $node )
|
| 4508 |
+
{
|
| 4509 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 4510 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4511 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4512 |
+
}
|
| 4513 |
+
}
|
| 4514 |
+
else
|
| 4515 |
+
{
|
| 4516 |
+
throw new Exception("Invalid Response");
|
| 4517 |
+
}
|
| 4518 |
+
}
|
| 4519 |
+
catch (Exception $e)
|
| 4520 |
+
{
|
| 4521 |
+
$this->isError = true;
|
| 4522 |
+
$this->errorString = $e->getMessage();
|
| 4523 |
+
}
|
| 4524 |
+
}
|
| 4525 |
+
}
|
| 4526 |
+
|
| 4527 |
+
/**
|
| 4528 |
+
* Holder class for parsed Stored Subscription deletion response.
|
| 4529 |
+
*/
|
| 4530 |
+
class XmlStoredSubscriptionDelResponse extends XmlSubscriptionResponse
|
| 4531 |
+
{
|
| 4532 |
+
public function XmlStoredSubscriptionDelResponse($responseXml)
|
| 4533 |
+
{
|
| 4534 |
+
$doc = new DOMDocument();
|
| 4535 |
+
$doc->loadXML($responseXml);
|
| 4536 |
+
try
|
| 4537 |
+
{
|
| 4538 |
+
if (strpos($responseXml, "ERROR"))
|
| 4539 |
+
{
|
| 4540 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4541 |
+
foreach( $responseNodes as $node )
|
| 4542 |
+
{
|
| 4543 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 4544 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4545 |
+
}
|
| 4546 |
+
$this->isError = true;
|
| 4547 |
+
}
|
| 4548 |
+
else if (strpos($responseXml, "DELETESTOREDSUBSCRIPTIONRESPONSE"))
|
| 4549 |
+
{
|
| 4550 |
+
$responseNodes = $doc->getElementsByTagName("DELETESTOREDSUBSCRIPTIONRESPONSE");
|
| 4551 |
+
|
| 4552 |
+
foreach( $responseNodes as $node )
|
| 4553 |
+
{
|
| 4554 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 4555 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4556 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4557 |
+
}
|
| 4558 |
+
}
|
| 4559 |
+
else
|
| 4560 |
+
{
|
| 4561 |
+
throw new Exception("Invalid Response");
|
| 4562 |
+
}
|
| 4563 |
+
}
|
| 4564 |
+
catch (Exception $e)
|
| 4565 |
+
{
|
| 4566 |
+
$this->isError = true;
|
| 4567 |
+
$this->errorString = $e->getMessage();
|
| 4568 |
+
}
|
| 4569 |
+
}
|
| 4570 |
+
}
|
| 4571 |
+
|
| 4572 |
+
/**
|
| 4573 |
+
* Holder class for parsed Subscription registration response.
|
| 4574 |
+
*/
|
| 4575 |
+
class XmlSubscriptionRegResponse extends XmlSubscriptionResponse
|
| 4576 |
+
{
|
| 4577 |
+
public function XmlSubscriptionRegResponse($responseXml)
|
| 4578 |
+
{
|
| 4579 |
+
$doc = new DOMDocument();
|
| 4580 |
+
$doc->loadXML($responseXml);
|
| 4581 |
+
try
|
| 4582 |
+
{
|
| 4583 |
+
if (strpos($responseXml, "ERROR"))
|
| 4584 |
+
{
|
| 4585 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4586 |
+
foreach( $responseNodes as $node )
|
| 4587 |
+
{
|
| 4588 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 4589 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4590 |
+
}
|
| 4591 |
+
$this->isError = true;
|
| 4592 |
+
}
|
| 4593 |
+
else if (strpos($responseXml, "ADDSUBSCRIPTIONRESPONSE"))
|
| 4594 |
+
{
|
| 4595 |
+
$responseNodes = $doc->getElementsByTagName("ADDSUBSCRIPTIONRESPONSE");
|
| 4596 |
+
|
| 4597 |
+
foreach( $responseNodes as $node )
|
| 4598 |
+
{
|
| 4599 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 4600 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4601 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4602 |
+
}
|
| 4603 |
+
}
|
| 4604 |
+
else
|
| 4605 |
+
{
|
| 4606 |
+
throw new Exception("Invalid Response");
|
| 4607 |
+
}
|
| 4608 |
+
}
|
| 4609 |
+
catch (Exception $e)
|
| 4610 |
+
{
|
| 4611 |
+
$this->isError = true;
|
| 4612 |
+
$this->errorString = $e->getMessage();
|
| 4613 |
+
}
|
| 4614 |
+
}
|
| 4615 |
+
}
|
| 4616 |
+
|
| 4617 |
+
/**
|
| 4618 |
+
* Holder class for parsed Subscription update response.
|
| 4619 |
+
*/
|
| 4620 |
+
class XmlSubscriptionUpdResponse extends XmlSubscriptionResponse
|
| 4621 |
+
{
|
| 4622 |
+
public function XmlSubscriptionUpdResponse($responseXml)
|
| 4623 |
+
{
|
| 4624 |
+
$doc = new DOMDocument();
|
| 4625 |
+
$doc->loadXML($responseXml);
|
| 4626 |
+
try
|
| 4627 |
+
{
|
| 4628 |
+
if (strpos($responseXml, "ERROR"))
|
| 4629 |
+
{
|
| 4630 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4631 |
+
foreach( $responseNodes as $node )
|
| 4632 |
+
{
|
| 4633 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 4634 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4635 |
+
}
|
| 4636 |
+
$this->isError = true;
|
| 4637 |
+
}
|
| 4638 |
+
else if (strpos($responseXml, "UPDATESUBSCRIPTIONRESPONSE"))
|
| 4639 |
+
{
|
| 4640 |
+
$responseNodes = $doc->getElementsByTagName("UPDATESUBSCRIPTIONRESPONSE");
|
| 4641 |
+
|
| 4642 |
+
foreach( $responseNodes as $node )
|
| 4643 |
+
{
|
| 4644 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 4645 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4646 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4647 |
+
}
|
| 4648 |
+
}
|
| 4649 |
+
else
|
| 4650 |
+
{
|
| 4651 |
+
throw new Exception("Invalid Response");
|
| 4652 |
+
}
|
| 4653 |
+
}
|
| 4654 |
+
catch (Exception $e)
|
| 4655 |
+
{
|
| 4656 |
+
$this->isError = true;
|
| 4657 |
+
$this->errorString = $e->getMessage();
|
| 4658 |
+
}
|
| 4659 |
+
}
|
| 4660 |
+
}
|
| 4661 |
+
|
| 4662 |
+
/**
|
| 4663 |
+
* Holder class for parsed Subscription deletion response.
|
| 4664 |
+
*/
|
| 4665 |
+
class XmlSubscriptionDelResponse extends XmlSubscriptionResponse
|
| 4666 |
+
{
|
| 4667 |
+
public function XmlSubscriptionDelResponse($responseXml)
|
| 4668 |
+
{
|
| 4669 |
+
$doc = new DOMDocument();
|
| 4670 |
+
$doc->loadXML($responseXml);
|
| 4671 |
+
try
|
| 4672 |
+
{
|
| 4673 |
+
if (strpos($responseXml, "ERROR"))
|
| 4674 |
+
{
|
| 4675 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4676 |
+
foreach( $responseNodes as $node )
|
| 4677 |
+
{
|
| 4678 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 4679 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4680 |
+
}
|
| 4681 |
+
$this->isError = true;
|
| 4682 |
+
}
|
| 4683 |
+
else if (strpos($responseXml, "DELETESUBSCRIPTIONRESPONSE"))
|
| 4684 |
+
{
|
| 4685 |
+
$responseNodes = $doc->getElementsByTagName("DELETESUBSCRIPTIONRESPONSE");
|
| 4686 |
+
|
| 4687 |
+
foreach( $responseNodes as $node )
|
| 4688 |
+
{
|
| 4689 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 4690 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4691 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4692 |
+
}
|
| 4693 |
+
}
|
| 4694 |
+
else
|
| 4695 |
+
{
|
| 4696 |
+
throw new Exception("Invalid Response");
|
| 4697 |
+
}
|
| 4698 |
+
}
|
| 4699 |
+
catch (Exception $e)
|
| 4700 |
+
{
|
| 4701 |
+
$this->isError = true;
|
| 4702 |
+
$this->errorString = $e->getMessage();
|
| 4703 |
+
}
|
| 4704 |
+
}
|
| 4705 |
+
}
|
| 4706 |
+
|
| 4707 |
+
/**
|
| 4708 |
+
* Holder class for parsed Subscription Payment response.
|
| 4709 |
+
*/
|
| 4710 |
+
class XmlSubscriptionPaymentResponse
|
| 4711 |
+
{
|
| 4712 |
+
private $isError = false;
|
| 4713 |
+
public function IsError()
|
| 4714 |
+
{
|
| 4715 |
+
return $this->isError;
|
| 4716 |
+
}
|
| 4717 |
+
|
| 4718 |
+
private $errorString;
|
| 4719 |
+
public function ErrorString()
|
| 4720 |
+
{
|
| 4721 |
+
return $this->errorString;
|
| 4722 |
+
}
|
| 4723 |
+
|
| 4724 |
+
private $responseCode;
|
| 4725 |
+
public function ResponseCode()
|
| 4726 |
+
{
|
| 4727 |
+
return $this->responseCode;
|
| 4728 |
+
}
|
| 4729 |
+
|
| 4730 |
+
private $responseText;
|
| 4731 |
+
public function ResponseText()
|
| 4732 |
+
{
|
| 4733 |
+
return $this->responseText;
|
| 4734 |
+
}
|
| 4735 |
+
|
| 4736 |
+
private $approvalCode;
|
| 4737 |
+
public function ApprovalCode()
|
| 4738 |
+
{
|
| 4739 |
+
return $this->approvalCode;
|
| 4740 |
+
}
|
| 4741 |
+
|
| 4742 |
+
private $dateTime;
|
| 4743 |
+
public function DateTime()
|
| 4744 |
+
{
|
| 4745 |
+
return $this->dateTime;
|
| 4746 |
+
}
|
| 4747 |
+
|
| 4748 |
+
private $uniqueRef;
|
| 4749 |
+
public function UniqueRef()
|
| 4750 |
+
{
|
| 4751 |
+
return $this->uniqueRef;
|
| 4752 |
+
}
|
| 4753 |
+
|
| 4754 |
+
private $hash;
|
| 4755 |
+
public function Hash()
|
| 4756 |
+
{
|
| 4757 |
+
return $this->hash;
|
| 4758 |
+
}
|
| 4759 |
+
|
| 4760 |
+
public function XmlSubscriptionPaymentResponse($responseXml)
|
| 4761 |
+
{
|
| 4762 |
+
$doc = new DOMDocument();
|
| 4763 |
+
$doc->loadXML($responseXml);
|
| 4764 |
+
try
|
| 4765 |
+
{
|
| 4766 |
+
if (strpos($responseXml, "ERROR"))
|
| 4767 |
+
{
|
| 4768 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4769 |
+
foreach( $responseNodes as $node )
|
| 4770 |
+
{
|
| 4771 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 4772 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4773 |
+
}
|
| 4774 |
+
|
| 4775 |
+
$this->isError = true;
|
| 4776 |
+
}
|
| 4777 |
+
else if (strpos($responseXml, "SUBSCRIPTIONPAYMENTRESPONSE"))
|
| 4778 |
+
{
|
| 4779 |
+
$responseNodes = $doc->getElementsByTagName("SUBSCRIPTIONPAYMENTRESPONSE");
|
| 4780 |
+
|
| 4781 |
+
foreach( $responseNodes as $node )
|
| 4782 |
+
{
|
| 4783 |
+
$this->uniqueRef = $node->getElementsByTagName('UNIQUEREF')->item(0)->nodeValue;
|
| 4784 |
+
$this->responseCode = $node->getElementsByTagName('RESPONSECODE')->item(0)->nodeValue;
|
| 4785 |
+
$this->responseText = $node->getElementsByTagName('RESPONSETEXT')->item(0)->nodeValue;
|
| 4786 |
+
$this->approvalCode = $node->getElementsByTagName('APPROVALCODE')->item(0)->nodeValue;
|
| 4787 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4788 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4789 |
+
}
|
| 4790 |
+
}
|
| 4791 |
+
else
|
| 4792 |
+
{
|
| 4793 |
+
throw new Exception("Invalid Response");
|
| 4794 |
+
}
|
| 4795 |
+
}
|
| 4796 |
+
catch (Exception $e)
|
| 4797 |
+
{
|
| 4798 |
+
$this->isError = true;
|
| 4799 |
+
$this->errorString = $e->getMessage();
|
| 4800 |
+
}
|
| 4801 |
+
}
|
| 4802 |
+
}
|
| 4803 |
+
/**
|
| 4804 |
+
* Holder class for parsed Unreferenced Refund response.
|
| 4805 |
+
*/
|
| 4806 |
+
class XmlUnreferencedRefundResponse
|
| 4807 |
+
{
|
| 4808 |
+
private $isError = false;
|
| 4809 |
+
public function IsError()
|
| 4810 |
+
{
|
| 4811 |
+
return $this->isError;
|
| 4812 |
+
}
|
| 4813 |
+
|
| 4814 |
+
private $errorString;
|
| 4815 |
+
public function ErrorString()
|
| 4816 |
+
{
|
| 4817 |
+
return $this->errorString;
|
| 4818 |
+
}
|
| 4819 |
+
|
| 4820 |
+
private $responseCode;
|
| 4821 |
+
public function ResponseCode()
|
| 4822 |
+
{
|
| 4823 |
+
return $this->responseCode;
|
| 4824 |
+
}
|
| 4825 |
+
|
| 4826 |
+
private $responseText;
|
| 4827 |
+
public function ResponseText()
|
| 4828 |
+
{
|
| 4829 |
+
return $this->responseText;
|
| 4830 |
+
}
|
| 4831 |
+
|
| 4832 |
+
private $orderId;
|
| 4833 |
+
public function OrderId()
|
| 4834 |
+
{
|
| 4835 |
+
return $this->orderId;
|
| 4836 |
+
}
|
| 4837 |
+
|
| 4838 |
+
private $dateTime;
|
| 4839 |
+
public function DateTime()
|
| 4840 |
+
{
|
| 4841 |
+
return $this->dateTime;
|
| 4842 |
+
}
|
| 4843 |
+
|
| 4844 |
+
private $uniqueRef;
|
| 4845 |
+
public function UniqueRef()
|
| 4846 |
+
{
|
| 4847 |
+
return $this->uniqueRef;
|
| 4848 |
+
}
|
| 4849 |
+
|
| 4850 |
+
private $hash;
|
| 4851 |
+
public function Hash()
|
| 4852 |
+
{
|
| 4853 |
+
return $this->hash;
|
| 4854 |
+
}
|
| 4855 |
+
|
| 4856 |
+
public function XmlUnreferencedRefundResponse($responseXml)
|
| 4857 |
+
{
|
| 4858 |
+
$doc = new DOMDocument();
|
| 4859 |
+
$doc->loadXML($responseXml);
|
| 4860 |
+
try
|
| 4861 |
+
{
|
| 4862 |
+
if (strpos($responseXml, "ERROR"))
|
| 4863 |
+
{
|
| 4864 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4865 |
+
foreach( $responseNodes as $node )
|
| 4866 |
+
{
|
| 4867 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 4868 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4869 |
+
}
|
| 4870 |
+
$this->isError = true;
|
| 4871 |
+
}
|
| 4872 |
+
else if (strpos($responseXml, "UNREFERENCEDREFUNDRESPONSE"))
|
| 4873 |
+
{
|
| 4874 |
+
$responseNodes = $doc->getElementsByTagName("UNREFERENCEDREFUNDRESPONSE");
|
| 4875 |
+
|
| 4876 |
+
foreach( $responseNodes as $node )
|
| 4877 |
+
{
|
| 4878 |
+
$this->responseCode = $node->getElementsByTagName('RESPONSECODE')->item(0)->nodeValue;
|
| 4879 |
+
$this->responseText = $node->getElementsByTagName('RESPONSETEXT')->item(0)->nodeValue;
|
| 4880 |
+
$this->uniqueRef = $node->getElementsByTagName('UNIQUEREF')->item(0)->nodeValue;
|
| 4881 |
+
$this->orderId = $node->getElementsByTagName('ORDERID')->item(0)->nodeValue;
|
| 4882 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4883 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4884 |
+
}
|
| 4885 |
+
}
|
| 4886 |
+
else
|
| 4887 |
+
{
|
| 4888 |
+
throw new Exception("Invalid Response");
|
| 4889 |
+
}
|
| 4890 |
+
}
|
| 4891 |
+
catch (Exception $e)
|
| 4892 |
+
{
|
| 4893 |
+
$this->isError = true;
|
| 4894 |
+
$this->errorString = $e->getMessage();
|
| 4895 |
+
}
|
| 4896 |
+
}
|
| 4897 |
+
}
|
| 4898 |
+
/**
|
| 4899 |
+
* Holder class for parsed VoiceID response.
|
| 4900 |
+
*/
|
| 4901 |
+
class XmlVoiceIDResponse
|
| 4902 |
+
{
|
| 4903 |
+
private $isError = false;
|
| 4904 |
+
public function IsError()
|
| 4905 |
+
{
|
| 4906 |
+
return $this->isError;
|
| 4907 |
+
}
|
| 4908 |
+
|
| 4909 |
+
private $errorString;
|
| 4910 |
+
public function ErrorString()
|
| 4911 |
+
{
|
| 4912 |
+
return $this->errorString;
|
| 4913 |
+
}
|
| 4914 |
+
|
| 4915 |
+
private $responseCode;
|
| 4916 |
+
public function ResponseCode()
|
| 4917 |
+
{
|
| 4918 |
+
return $this->responseCode;
|
| 4919 |
+
}
|
| 4920 |
+
|
| 4921 |
+
private $responseText;
|
| 4922 |
+
public function ResponseText()
|
| 4923 |
+
{
|
| 4924 |
+
return $this->responseText;
|
| 4925 |
+
}
|
| 4926 |
+
|
| 4927 |
+
private $orderId;
|
| 4928 |
+
public function OrderId()
|
| 4929 |
+
{
|
| 4930 |
+
return $this->orderId;
|
| 4931 |
+
}
|
| 4932 |
+
|
| 4933 |
+
private $dateTime;
|
| 4934 |
+
public function DateTime()
|
| 4935 |
+
{
|
| 4936 |
+
return $this->dateTime;
|
| 4937 |
+
}
|
| 4938 |
+
|
| 4939 |
+
private $hash;
|
| 4940 |
+
public function Hash()
|
| 4941 |
+
{
|
| 4942 |
+
return $this->hash;
|
| 4943 |
+
}
|
| 4944 |
+
|
| 4945 |
+
public function XmlVoiceIDResponse($responseXml)
|
| 4946 |
+
{
|
| 4947 |
+
$doc = new DOMDocument();
|
| 4948 |
+
$doc->loadXML($responseXml);
|
| 4949 |
+
try
|
| 4950 |
+
{
|
| 4951 |
+
if (strpos($responseXml, "ERROR"))
|
| 4952 |
+
{
|
| 4953 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4954 |
+
foreach( $responseNodes as $node )
|
| 4955 |
+
{
|
| 4956 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 4957 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4958 |
+
}
|
| 4959 |
+
$this->isError = true;
|
| 4960 |
+
}
|
| 4961 |
+
else if (strpos($responseXml, "VOICEIDRESPONSE"))
|
| 4962 |
+
{
|
| 4963 |
+
$responseNodes = $doc->getElementsByTagName("VOICEIDRESPONSE");
|
| 4964 |
+
|
| 4965 |
+
foreach( $responseNodes as $node )
|
| 4966 |
+
{
|
| 4967 |
+
$this->responseCode = $node->getElementsByTagName('RESPONSECODE')->item(0)->nodeValue;
|
| 4968 |
+
$this->responseText = $node->getElementsByTagName('RESPONSETEXT')->item(0)->nodeValue;
|
| 4969 |
+
$this->orderId = $node->getElementsByTagName('ORDERID')->item(0)->nodeValue;
|
| 4970 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4971 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4972 |
+
}
|
| 4973 |
+
}
|
| 4974 |
+
else
|
| 4975 |
+
{
|
| 4976 |
+
throw new Exception("Invalid Response");
|
| 4977 |
+
}
|
| 4978 |
+
}
|
| 4979 |
+
catch (Exception $e)
|
| 4980 |
+
{
|
| 4981 |
+
$this->isError = true;
|
| 4982 |
+
$this->errorString = $e->getMessage();
|
| 4983 |
+
}
|
| 4984 |
+
}
|
| 4985 |
+
}
|
| 4986 |
+
|
| 4987 |
+
/**
|
| 4988 |
+
* For backward compatibility with older class names.
|
| 4989 |
+
*/
|
| 4990 |
+
class XmlStandardRequest extends XmlAuthRequest { }
|
| 4991 |
+
class XmlStandardResponse extends XmlAuthResponse { }
|
| 4992 |
+
|
| 4993 |
+
/**
|
| 4994 |
+
* XML Functions - For internal use.
|
| 4995 |
+
*/
|
| 4996 |
+
function libxml_display_error($error)
|
| 4997 |
+
{
|
| 4998 |
+
$errorString = "<br />";
|
| 4999 |
+
switch ($error->level)
|
| 5000 |
+
{
|
| 5001 |
+
case LIBXML_ERR_WARNING:
|
| 5002 |
+
$errorString .= "<b>Warning $error->code</b>: ";
|
| 5003 |
+
break;
|
| 5004 |
+
case LIBXML_ERR_ERROR:
|
| 5005 |
+
$errorString .= "<b>Error $error->code</b>: ";
|
| 5006 |
+
break;
|
| 5007 |
+
case LIBXML_ERR_FATAL:
|
| 5008 |
+
$errorString .= "<b>Fatal Error $error->code</b>: ";
|
| 5009 |
+
break;
|
| 5010 |
+
}
|
| 5011 |
+
$errorString .= trim($error->message);
|
| 5012 |
+
if ($error->file) $errorString .= " in <b>$error->file</b>";
|
| 5013 |
+
$errorString .= " on line <b>$error->line</b><br />";
|
| 5014 |
+
|
| 5015 |
+
return $errorString;
|
| 5016 |
+
}
|
| 5017 |
+
|
| 5018 |
+
function libxml_display_errors()
|
| 5019 |
+
{
|
| 5020 |
+
$errorString = '';
|
| 5021 |
+
$errors = libxml_get_errors();
|
| 5022 |
+
foreach ($errors as $error) $errorString .= libxml_display_error($error);
|
| 5023 |
+
libxml_clear_errors();
|
| 5024 |
+
return $errorString;
|
| 5025 |
+
}
|
| 5026 |
+
|
| 5027 |
+
// Enable user error handling
|
| 5028 |
+
libxml_use_internal_errors(true);
|
| 5029 |
+
|
| 5030 |
+
?>
|
| 5031 |
+
|
| 5032 |
+
|
app/code/community/Mage/Worldnet/Model/Api/worldnet_tps_xml.php~
ADDED
|
@@ -0,0 +1,4381 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
if(basename(__FILE__) == basename($_SERVER["REQUEST_URI"])) die("<b>ERROR: You cannot display this file directly.</b>");
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* Base Request Class holding common functionality for Request Types.
|
| 7 |
+
*/
|
| 8 |
+
class Request
|
| 9 |
+
{
|
| 10 |
+
protected static function GetRequestHash($plainString)
|
| 11 |
+
{
|
| 12 |
+
return md5($plainString);
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
protected static function GetFormattedDate()
|
| 16 |
+
{
|
| 17 |
+
return date('d-m-Y:H:i:s:000');
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
protected static function SendRequestToGateway($requestString, $testAccount, $gateway)
|
| 21 |
+
{
|
| 22 |
+
$serverUrl = 'https://';
|
| 23 |
+
|
| 24 |
+
if($testAccount) $serverUrl .= 'test';
|
| 25 |
+
switch (strtolower($gateway)) {
|
| 26 |
+
default :
|
| 27 |
+
case 'worldnet' : $serverUrl .= 'payments.worldnettps.com'; break;
|
| 28 |
+
case 'cashflows' : $serverUrl .= 'cashflows.worldnettps.com'; break;
|
| 29 |
+
case 'payius' : $serverUrl .= 'payments.payius.com' ; break;
|
| 30 |
+
case 'pagotechnology' : $serverUrl .= 'payments.pagotechnology.com' ; break;
|
| 31 |
+
case 'globalone' : $serverUrl .= 'payments.globalone.me' ; break;
|
| 32 |
+
case 'anywherecommerce' : $serverUrl .= 'payments.anywherecommerce.com' ; break;
|
| 33 |
+
case 'ctpayment' : $serverUrl .= 'payments.ct-payment.com' ; break;
|
| 34 |
+
case 'payzone' : $serverUrl .= 'payment.payzone.ie' ; break;
|
| 35 |
+
case 'payconex' : $serverUrl .= 'gateway.payconex.net' ; break;
|
| 36 |
+
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
$XMLSchemaFile = $serverUrl . '.worldnettps.com/merchant/gateway.xsd';
|
| 40 |
+
$serverUrl .= '/merchant/xmlpayment';
|
| 41 |
+
|
| 42 |
+
$requestXML = new DOMDocument("1.0");
|
| 43 |
+
$requestXML->formatOutput = true;
|
| 44 |
+
$requestXML->loadXML($requestString);
|
| 45 |
+
// if(!$requestXML->schemaValidate($XMLSchemaFile)) die('<b>XML VALIDATION FAILED AGAINST SCHEMA:</b>' . $XMLSchemaFile . libxml_display_errors());
|
| 46 |
+
unset($requestXML);
|
| 47 |
+
|
| 48 |
+
// Initialisation
|
| 49 |
+
$ch=curl_init();
|
| 50 |
+
// Set parameters
|
| 51 |
+
curl_setopt($ch, CURLOPT_URL, $serverUrl);
|
| 52 |
+
// Return a variable instead of posting it directly
|
| 53 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
| 54 |
+
//curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
|
| 55 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
| 56 |
+
// Activate the POST method
|
| 57 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
| 58 |
+
// Request
|
| 59 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $requestString);
|
| 60 |
+
// execute the connection
|
| 61 |
+
$result = curl_exec($ch);
|
| 62 |
+
// Close it
|
| 63 |
+
curl_close($ch);
|
| 64 |
+
return $result;
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
/**
|
| 69 |
+
* Used for processing XML Authorisations through the WorldNet TPS XML Gateway.
|
| 70 |
+
*
|
| 71 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 72 |
+
*/
|
| 73 |
+
class XmlAuthRequest extends Request
|
| 74 |
+
{
|
| 75 |
+
private $terminalId;
|
| 76 |
+
private $orderId;
|
| 77 |
+
private $currency;
|
| 78 |
+
private $amount;
|
| 79 |
+
public function Amount()
|
| 80 |
+
{
|
| 81 |
+
return $this->amount;
|
| 82 |
+
}
|
| 83 |
+
private $dateTime;
|
| 84 |
+
private $hash;
|
| 85 |
+
private $autoReady;
|
| 86 |
+
private $description;
|
| 87 |
+
private $email;
|
| 88 |
+
private $cardNumber;
|
| 89 |
+
private $cardType;
|
| 90 |
+
private $cardExpiry;
|
| 91 |
+
private $cardHolderName;
|
| 92 |
+
private $cvv;
|
| 93 |
+
private $issueNo;
|
| 94 |
+
private $address1;
|
| 95 |
+
private $address2;
|
| 96 |
+
private $postCode;
|
| 97 |
+
private $cardCurrency;
|
| 98 |
+
private $cardAmount;
|
| 99 |
+
private $conversionRate;
|
| 100 |
+
private $avsOnly;
|
| 101 |
+
private $mpiRef;
|
| 102 |
+
|
| 103 |
+
private $multicur = false;
|
| 104 |
+
private $foreignCurInfoSet = false;
|
| 105 |
+
|
| 106 |
+
/**
|
| 107 |
+
* Creates the standard request less optional parameters for processing an XML Transaction
|
| 108 |
+
* through the WorldNetTPS XML Gateway
|
| 109 |
+
*
|
| 110 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 111 |
+
* @param orderId A unique merchant identifier. Alpha numeric and max size 12 chars.
|
| 112 |
+
* @param currency ISO 4217 3 Digit Currency Code, e.g. EUR / USD / GBP
|
| 113 |
+
* @param amount Transaction Amount, Double formatted to 2 decimal places.
|
| 114 |
+
* @param description Transaction Description
|
| 115 |
+
* @param email Cardholder e-mail
|
| 116 |
+
* @param cardNumber A valid Card Number that passes the Luhn Check.
|
| 117 |
+
* @param cardType
|
| 118 |
+
* Card Type (Accepted Card Types must be configured in the Merchant Selfcare System.)
|
| 119 |
+
*
|
| 120 |
+
* Accepted Values :
|
| 121 |
+
*
|
| 122 |
+
* VISA
|
| 123 |
+
* MASTERCARD
|
| 124 |
+
* LASER
|
| 125 |
+
* SWITCH
|
| 126 |
+
* SOLO
|
| 127 |
+
* AMEX
|
| 128 |
+
* DINERS
|
| 129 |
+
* MAESTRO
|
| 130 |
+
* DELTA
|
| 131 |
+
* ELECTRON
|
| 132 |
+
*
|
| 133 |
+
*/
|
| 134 |
+
public function XmlAuthRequest($terminalId,
|
| 135 |
+
$orderId,
|
| 136 |
+
$currency,
|
| 137 |
+
$amount,
|
| 138 |
+
$cardNumber,
|
| 139 |
+
$cardType)
|
| 140 |
+
{
|
| 141 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 142 |
+
|
| 143 |
+
$this->terminalId = $terminalId;
|
| 144 |
+
$this->orderId = $orderId;
|
| 145 |
+
$this->currency = $currency;
|
| 146 |
+
$this->amount = $amount;
|
| 147 |
+
$this->cardNumber = $cardNumber;
|
| 148 |
+
$this->cardType = $cardType;
|
| 149 |
+
}
|
| 150 |
+
/**
|
| 151 |
+
* Setter for Auto Ready Value
|
| 152 |
+
*
|
| 153 |
+
* @param autoReady
|
| 154 |
+
* Auto Ready is an optional parameter and defines if the transaction should be settled automatically.
|
| 155 |
+
*
|
| 156 |
+
* Accepted Values :
|
| 157 |
+
*
|
| 158 |
+
* Y - Transaction will be settled in next batch
|
| 159 |
+
* N - Transaction will not be settled until user changes state in Merchant Selfcare Section
|
| 160 |
+
*/
|
| 161 |
+
public function SetAutoReady($autoReady)
|
| 162 |
+
{
|
| 163 |
+
$this->autoReady = $autoReady;
|
| 164 |
+
}
|
| 165 |
+
/**
|
| 166 |
+
* Setter for Email Address Value
|
| 167 |
+
*
|
| 168 |
+
* @param email Alpha-numeric field.
|
| 169 |
+
*/
|
| 170 |
+
public function SetEmail($email)
|
| 171 |
+
{
|
| 172 |
+
$this->email = $email;
|
| 173 |
+
}
|
| 174 |
+
/**
|
| 175 |
+
* Setter for Email Address Value
|
| 176 |
+
*
|
| 177 |
+
* @param email Alpha-numeric field.
|
| 178 |
+
*/
|
| 179 |
+
public function SetDescription($description)
|
| 180 |
+
{
|
| 181 |
+
$this->description = $description;
|
| 182 |
+
}
|
| 183 |
+
/**
|
| 184 |
+
* Setter for Card Expiry and Card Holder Name values
|
| 185 |
+
* These are mandatory for non-SecureCard transactions
|
| 186 |
+
*
|
| 187 |
+
* @param cardExpiry Card Expiry formatted MMYY
|
| 188 |
+
* @param cardHolderName Card Holder Name
|
| 189 |
+
*/
|
| 190 |
+
public function SetNonSecureCardCardInfo($cardExpiry, $cardHolderName)
|
| 191 |
+
{
|
| 192 |
+
$this->cardExpiry = $cardExpiry;
|
| 193 |
+
$this->cardHolderName = $cardHolderName;
|
| 194 |
+
}
|
| 195 |
+
/**
|
| 196 |
+
* Setter for Card Verification Value
|
| 197 |
+
*
|
| 198 |
+
* @param cvv Numeric field with a max of 4 characters.
|
| 199 |
+
*/
|
| 200 |
+
public function SetCvv($cvv)
|
| 201 |
+
{
|
| 202 |
+
$this->cvv = $cvv;
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
/**
|
| 206 |
+
* Setter for Issue No
|
| 207 |
+
*
|
| 208 |
+
* @param issueNo Numeric field with a max of 3 characters.
|
| 209 |
+
*/
|
| 210 |
+
public function SetIssueNo($issueNo)
|
| 211 |
+
{
|
| 212 |
+
$this->issueNo = $issueNo;
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
/**
|
| 216 |
+
* Setter for Address Verification Values
|
| 217 |
+
*
|
| 218 |
+
* @param address1 First Line of address - Max size 20
|
| 219 |
+
* @param address2 Second Line of address - Max size 20
|
| 220 |
+
* @param postCode Postcode - Max size 9
|
| 221 |
+
*/
|
| 222 |
+
public function SetAvs($address1, $address2, $postCode)
|
| 223 |
+
{
|
| 224 |
+
$this->address1 = $address1;
|
| 225 |
+
$this->address2 = $address2;
|
| 226 |
+
$this->postCode = $postCode;
|
| 227 |
+
}
|
| 228 |
+
/**
|
| 229 |
+
* Setter for Foreign Currency Information
|
| 230 |
+
*
|
| 231 |
+
* @param cardCurrency ISO 4217 3 Digit Currency Code, e.g. EUR / USD / GBP
|
| 232 |
+
* @param cardAmount (Amount X Conversion rate) Formatted to two decimal places
|
| 233 |
+
* @param conversionRate Converstion rate supplied in rate response
|
| 234 |
+
*/
|
| 235 |
+
public function SetForeignCurrencyInformation($cardCurrency, $cardAmount, $conversionRate)
|
| 236 |
+
{
|
| 237 |
+
$this->cardCurrency = $cardCurrency;
|
| 238 |
+
$this->cardAmount = $cardAmount;
|
| 239 |
+
$this->conversionRate = $conversionRate;
|
| 240 |
+
|
| 241 |
+
$this->foreignCurInfoSet = true;
|
| 242 |
+
}
|
| 243 |
+
/**
|
| 244 |
+
* Setter for AVS only flag
|
| 245 |
+
*
|
| 246 |
+
* @param avsOnly Only perform an AVS check, do not store as a transaction. Possible values: "Y", "N"
|
| 247 |
+
*/
|
| 248 |
+
public function SetAvsOnly($avsOnly)
|
| 249 |
+
{
|
| 250 |
+
$this->avsOnly = $avsOnly;
|
| 251 |
+
}
|
| 252 |
+
/**
|
| 253 |
+
* Setter for MPI Reference code
|
| 254 |
+
*
|
| 255 |
+
* @param mpiRef MPI Reference code supplied by WorldNet TPS MPI redirect
|
| 256 |
+
*/
|
| 257 |
+
public function SetMpiRef($mpiRef)
|
| 258 |
+
{
|
| 259 |
+
$this->mpiRef = $mpiRef;
|
| 260 |
+
}
|
| 261 |
+
/**
|
| 262 |
+
* Setter for multi-currency value
|
| 263 |
+
* This is required to be set for multi-currency terminals because the Hash is calculated differently.
|
| 264 |
+
*/
|
| 265 |
+
public function SetMultiCur()
|
| 266 |
+
{
|
| 267 |
+
$this->multicur = true;
|
| 268 |
+
}
|
| 269 |
+
/**
|
| 270 |
+
* Setter for hash value
|
| 271 |
+
*
|
| 272 |
+
* @param sharedSecret
|
| 273 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 274 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 275 |
+
*/
|
| 276 |
+
public function SetHash($sharedSecret)
|
| 277 |
+
{
|
| 278 |
+
if(isset($this->multicur) && $this->multicur == true) $this->hash = $this->GetRequestHash($this->terminalId . $this->orderId . $this->currency . $this->amount . $this->dateTime . $sharedSecret);
|
| 279 |
+
else $this->hash = $this->GetRequestHash($this->terminalId . $this->orderId . $this->amount . $this->dateTime . $sharedSecret);
|
| 280 |
+
}
|
| 281 |
+
/**
|
| 282 |
+
* (Old) Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 283 |
+
*
|
| 284 |
+
* @param sharedSecret
|
| 285 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 286 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 287 |
+
*
|
| 288 |
+
* @param testAccount
|
| 289 |
+
* Boolean value defining Mode
|
| 290 |
+
* true - This is a test account
|
| 291 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 292 |
+
*
|
| 293 |
+
* @return XmlAuthResponse containing an error or the parsed payment response.
|
| 294 |
+
*/
|
| 295 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 296 |
+
{
|
| 297 |
+
$this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 301 |
+
{
|
| 302 |
+
$this->SetHash($sharedSecret);
|
| 303 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 304 |
+
$response = new XmlAuthResponse($responseString);
|
| 305 |
+
return $response;
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
public function GenerateXml()
|
| 309 |
+
{
|
| 310 |
+
$requestXML = new DOMDocument("1.0");
|
| 311 |
+
$requestXML->formatOutput = true;
|
| 312 |
+
|
| 313 |
+
$requestString = $requestXML->createElement("PAYMENT");
|
| 314 |
+
$requestXML->appendChild($requestString);
|
| 315 |
+
|
| 316 |
+
$node = $requestXML->createElement("ORDERID");
|
| 317 |
+
$node->appendChild($requestXML->createTextNode($this->orderId));
|
| 318 |
+
$requestString->appendChild($node);
|
| 319 |
+
|
| 320 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 321 |
+
$requestString->appendChild($node);
|
| 322 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 323 |
+
|
| 324 |
+
$node = $requestXML->createElement("AMOUNT");
|
| 325 |
+
$requestString->appendChild($node);
|
| 326 |
+
$node->appendChild($requestXML->createTextNode($this->amount));
|
| 327 |
+
|
| 328 |
+
$node = $requestXML->createElement("DATETIME");
|
| 329 |
+
$requestString->appendChild($node);
|
| 330 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 331 |
+
|
| 332 |
+
$node = $requestXML->createElement("CARDNUMBER");
|
| 333 |
+
$requestString->appendChild($node);
|
| 334 |
+
$node->appendChild($requestXML->createTextNode($this->cardNumber));
|
| 335 |
+
|
| 336 |
+
$node = $requestXML->createElement("CARDTYPE");
|
| 337 |
+
$requestString->appendChild($node);
|
| 338 |
+
$node->appendChild($requestXML->createTextNode($this->cardType));
|
| 339 |
+
|
| 340 |
+
if($this->cardExpiry !== NULL && $this->cardHolderName !== NULL)
|
| 341 |
+
{
|
| 342 |
+
$node = $requestXML->createElement("CARDEXPIRY");
|
| 343 |
+
$requestString->appendChild($node);
|
| 344 |
+
$node->appendChild($requestXML->createTextNode($this->cardExpiry));
|
| 345 |
+
|
| 346 |
+
$node = $requestXML->createElement("CARDHOLDERNAME");
|
| 347 |
+
$requestString->appendChild($node);
|
| 348 |
+
$node->appendChild($requestXML->createTextNode($this->cardHolderName));
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
$node = $requestXML->createElement("HASH");
|
| 352 |
+
$requestString->appendChild($node);
|
| 353 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 354 |
+
|
| 355 |
+
$node = $requestXML->createElement("CURRENCY");
|
| 356 |
+
$requestString->appendChild($node);
|
| 357 |
+
$node->appendChild($requestXML->createTextNode($this->currency));
|
| 358 |
+
|
| 359 |
+
if($this->foreignCurInfoSet)
|
| 360 |
+
{
|
| 361 |
+
$dcNode = $requestXML->createElement("FOREIGNCURRENCYINFORMATION");
|
| 362 |
+
$requestString->appendChild($dcNode );
|
| 363 |
+
|
| 364 |
+
$dcSubNode = $requestXML->createElement("CARDCURRENCY");
|
| 365 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->cardCurrency));
|
| 366 |
+
$dcNode->appendChild($dcSubNode);
|
| 367 |
+
|
| 368 |
+
$dcSubNode = $requestXML->createElement("CARDAMOUNT");
|
| 369 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->cardAmount));
|
| 370 |
+
$dcNode->appendChild($dcSubNode);
|
| 371 |
+
|
| 372 |
+
$dcSubNode = $requestXML->createElement("CONVERSIONRATE");
|
| 373 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->conversionRate));
|
| 374 |
+
$dcNode->appendChild($dcSubNode);
|
| 375 |
+
}
|
| 376 |
+
|
| 377 |
+
$node = $requestXML->createElement("TERMINALTYPE");
|
| 378 |
+
$requestString->appendChild($node);
|
| 379 |
+
$nodeText = $requestXML->createTextNode('2');
|
| 380 |
+
$node->appendChild($nodeText);
|
| 381 |
+
|
| 382 |
+
$node = $requestXML->createElement("TRANSACTIONTYPE");
|
| 383 |
+
$requestString->appendChild($node);
|
| 384 |
+
$nodeText = $requestXML->createTextNode('7');
|
| 385 |
+
$node->appendChild($nodeText);
|
| 386 |
+
|
| 387 |
+
if($this->autoReady !== NULL)
|
| 388 |
+
{
|
| 389 |
+
$node = $requestXML->createElement("AUTOREADY");
|
| 390 |
+
$requestString->appendChild($node);
|
| 391 |
+
$node->appendChild($requestXML->createTextNode($this->autoReady));
|
| 392 |
+
}
|
| 393 |
+
|
| 394 |
+
if($this->email !== NULL)
|
| 395 |
+
{
|
| 396 |
+
$node = $requestXML->createElement("EMAIL");
|
| 397 |
+
$requestString->appendChild($node);
|
| 398 |
+
$node->appendChild($requestXML->createTextNode($this->email));
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
if($this->cvv !== NULL)
|
| 402 |
+
{
|
| 403 |
+
$node = $requestXML->createElement("CVV");
|
| 404 |
+
$requestString->appendChild($node);
|
| 405 |
+
$node->appendChild($requestXML->createTextNode($this->cvv));
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
if($this->issueNo !== NULL)
|
| 409 |
+
{
|
| 410 |
+
$node = $requestXML->createElement("ISSUENO");
|
| 411 |
+
$requestString->appendChild($node);
|
| 412 |
+
$node->appendChild($requestXML->createTextNode($this->issueNo));
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
+
if($this->address1 !== NULL &&$this->address2 !== NULL &&$this->postCode !== NULL)
|
| 416 |
+
{
|
| 417 |
+
$node = $requestXML->createElement("ADDRESS1");
|
| 418 |
+
$requestString->appendChild($node);
|
| 419 |
+
$node->appendChild($requestXML->createTextNode($this->address1));
|
| 420 |
+
|
| 421 |
+
$node = $requestXML->createElement("ADDRESS2");
|
| 422 |
+
$requestString->appendChild($node);
|
| 423 |
+
$node->appendChild($requestXML->createTextNode($this->address2));
|
| 424 |
+
|
| 425 |
+
$node = $requestXML->createElement("POSTCODE");
|
| 426 |
+
$requestString->appendChild($node);
|
| 427 |
+
$node->appendChild($requestXML->createTextNode($this->postCode));
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
if($this->avsOnly !== NULL)
|
| 431 |
+
{
|
| 432 |
+
$node = $requestXML->createElement("AVSONLY");
|
| 433 |
+
$requestString->appendChild($node);
|
| 434 |
+
$node->appendChild($requestXML->createTextNode($this->avsOnly));
|
| 435 |
+
}
|
| 436 |
+
|
| 437 |
+
if($this->description !== NULL)
|
| 438 |
+
{
|
| 439 |
+
$node = $requestXML->createElement("DESCRIPTION");
|
| 440 |
+
$requestString->appendChild($node);
|
| 441 |
+
$node->appendChild($requestXML->createTextNode($this->description));
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
if($this->mpiRef !== NULL)
|
| 445 |
+
{
|
| 446 |
+
$node = $requestXML->createElement("MPIREF");
|
| 447 |
+
$requestString->appendChild($node);
|
| 448 |
+
$node->appendChild($requestXML->createTextNode($this->mpiRef));
|
| 449 |
+
}
|
| 450 |
+
|
| 451 |
+
return $requestXML->saveXML();
|
| 452 |
+
}
|
| 453 |
+
}
|
| 454 |
+
|
| 455 |
+
/**
|
| 456 |
+
* Used for processing XML Refund Authorisations through the WorldNet TPS XML Gateway.
|
| 457 |
+
*
|
| 458 |
+
* Basic request is configured on initialisation. There are no coptional fields.
|
| 459 |
+
*/
|
| 460 |
+
class XmlRefundRequest extends Request
|
| 461 |
+
{
|
| 462 |
+
private $terminalId;
|
| 463 |
+
private $orderId;
|
| 464 |
+
private $amount;
|
| 465 |
+
public function Amount()
|
| 466 |
+
{
|
| 467 |
+
return $this->amount;
|
| 468 |
+
}
|
| 469 |
+
private $dateTime;
|
| 470 |
+
private $hash;
|
| 471 |
+
private $operator;
|
| 472 |
+
private $reason;
|
| 473 |
+
private $autoReady;
|
| 474 |
+
|
| 475 |
+
/**
|
| 476 |
+
* Creates the refund request for processing an XML Transaction
|
| 477 |
+
* through the WorldNetTPS XML Gateway
|
| 478 |
+
*
|
| 479 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 480 |
+
* @param orderId A unique merchant identifier. Alpha numeric and max size 12 chars.
|
| 481 |
+
* @param currency ISO 4217 3 Digit Currency Code, e.g. EUR / USD / GBP
|
| 482 |
+
* @param amount Transaction Amount, Double formatted to 2 decimal places.
|
| 483 |
+
* @param operator An identifier for who executed this transaction
|
| 484 |
+
* @param reason The reason for the refund
|
| 485 |
+
*/
|
| 486 |
+
public function XmlRefundRequest($terminalId,
|
| 487 |
+
$orderId,
|
| 488 |
+
$amount,
|
| 489 |
+
$operator,
|
| 490 |
+
$reason)
|
| 491 |
+
{
|
| 492 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 493 |
+
$this->amount = $amount;
|
| 494 |
+
$this->terminalId = $terminalId;
|
| 495 |
+
$this->orderId = $orderId;
|
| 496 |
+
$this->operator = $operator;
|
| 497 |
+
$this->reason = $reason;
|
| 498 |
+
}
|
| 499 |
+
/**
|
| 500 |
+
* Setter for Auto Ready Value
|
| 501 |
+
|
| 502 |
+
*
|
| 503 |
+
* @param autoReady
|
| 504 |
+
* Auto Ready is an optional parameter and defines if the transaction should be settled automatically.
|
| 505 |
+
*
|
| 506 |
+
* Accepted Values :
|
| 507 |
+
|
| 508 |
+
*
|
| 509 |
+
* Y - Transaction will be settled in next batch
|
| 510 |
+
* N - Transaction will not be settled until user changes state in Merchant Selfcare Section
|
| 511 |
+
*/
|
| 512 |
+
public function SetAutoReady($autoReady)
|
| 513 |
+
{
|
| 514 |
+
$this->autoReady = $autoReady;
|
| 515 |
+
}
|
| 516 |
+
/**
|
| 517 |
+
* Setter for hash value
|
| 518 |
+
*
|
| 519 |
+
* @param sharedSecret
|
| 520 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 521 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 522 |
+
*/
|
| 523 |
+
public function SetHash($sharedSecret)
|
| 524 |
+
{
|
| 525 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->orderId . $this->amount . $this->dateTime . $sharedSecret);
|
| 526 |
+
}
|
| 527 |
+
/**
|
| 528 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 529 |
+
*
|
| 530 |
+
* @param sharedSecret
|
| 531 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 532 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 533 |
+
*
|
| 534 |
+
* @param testAccount
|
| 535 |
+
* Boolean value defining Mode
|
| 536 |
+
* true - This is a test account
|
| 537 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 538 |
+
*
|
| 539 |
+
* @return XmlRefundResponse containing an error or the parsed refund response.
|
| 540 |
+
*/
|
| 541 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 542 |
+
{
|
| 543 |
+
$this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 544 |
+
}
|
| 545 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 546 |
+
{
|
| 547 |
+
$this->SetHash($sharedSecret);
|
| 548 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 549 |
+
$response = new XmlRefundResponse($responseString);
|
| 550 |
+
return $response;
|
| 551 |
+
}
|
| 552 |
+
public function GenerateXml()
|
| 553 |
+
{
|
| 554 |
+
$requestXML = new DOMDocument("1.0");
|
| 555 |
+
$requestXML->formatOutput = true;
|
| 556 |
+
|
| 557 |
+
$requestString = $requestXML->createElement("REFUND");
|
| 558 |
+
$requestXML->appendChild($requestString);
|
| 559 |
+
|
| 560 |
+
$node = $requestXML->createElement("ORDERID");
|
| 561 |
+
$node->appendChild($requestXML->createTextNode($this->orderId));
|
| 562 |
+
$requestString->appendChild($node);
|
| 563 |
+
|
| 564 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 565 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 566 |
+
$requestString->appendChild($node);
|
| 567 |
+
|
| 568 |
+
$node = $requestXML->createElement("AMOUNT");
|
| 569 |
+
$node->appendChild($requestXML->createTextNode($this->amount));
|
| 570 |
+
$requestString->appendChild($node);
|
| 571 |
+
|
| 572 |
+
$node = $requestXML->createElement("DATETIME");
|
| 573 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 574 |
+
$requestString->appendChild($node);
|
| 575 |
+
|
| 576 |
+
$node = $requestXML->createElement("HASH");
|
| 577 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 578 |
+
$requestString->appendChild($node);
|
| 579 |
+
|
| 580 |
+
$node = $requestXML->createElement("OPERATOR");
|
| 581 |
+
$node->appendChild($requestXML->createTextNode($this->operator));
|
| 582 |
+
$requestString->appendChild($node);
|
| 583 |
+
|
| 584 |
+
$node = $requestXML->createElement("REASON");
|
| 585 |
+
$node->appendChild($requestXML->createTextNode($this->reason));
|
| 586 |
+
$requestString->appendChild($node);
|
| 587 |
+
|
| 588 |
+
if($this->autoReady !== NULL)
|
| 589 |
+
{
|
| 590 |
+
$node = $requestXML->createElement("AUTOREADY");
|
| 591 |
+
$requestString->appendChild($node);
|
| 592 |
+
$node->appendChild($requestXML->createTextNode($this->autoReady));
|
| 593 |
+
}
|
| 594 |
+
|
| 595 |
+
return $requestXML->saveXML();
|
| 596 |
+
|
| 597 |
+
}
|
| 598 |
+
}
|
| 599 |
+
|
| 600 |
+
/**
|
| 601 |
+
* Used for processing XML Pre-Authorisations through the WorldNet TPS XML Gateway.
|
| 602 |
+
*
|
| 603 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 604 |
+
*/
|
| 605 |
+
class XmlPreAuthRequest extends Request
|
| 606 |
+
{
|
| 607 |
+
private $terminalId;
|
| 608 |
+
private $orderId;
|
| 609 |
+
private $currency;
|
| 610 |
+
private $amount;
|
| 611 |
+
public function Amount()
|
| 612 |
+
{
|
| 613 |
+
return $this->amount;
|
| 614 |
+
}
|
| 615 |
+
private $dateTime;
|
| 616 |
+
private $hash;
|
| 617 |
+
private $description;
|
| 618 |
+
private $email;
|
| 619 |
+
private $cardNumber;
|
| 620 |
+
private $cardType;
|
| 621 |
+
private $cardExpiry;
|
| 622 |
+
private $cardHolderName;
|
| 623 |
+
private $cvv;
|
| 624 |
+
private $issueNo;
|
| 625 |
+
private $address1;
|
| 626 |
+
private $address2;
|
| 627 |
+
private $postCode;
|
| 628 |
+
private $cardCurrency;
|
| 629 |
+
private $cardAmount;
|
| 630 |
+
private $conversionRate;
|
| 631 |
+
|
| 632 |
+
private $multicur = false;
|
| 633 |
+
private $foreignCurInfoSet = false;
|
| 634 |
+
|
| 635 |
+
/**
|
| 636 |
+
* Creates the pre-auth request less optional parameters for processing an XML Transaction
|
| 637 |
+
* through the WorldNetTPS XML Gateway
|
| 638 |
+
*
|
| 639 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 640 |
+
* @param orderId A unique merchant identifier. Alpha numeric and max size 12 chars.
|
| 641 |
+
* @param currency ISO 4217 3 Digit Currency Code, e.g. EUR / USD / GBP
|
| 642 |
+
* @param amount Transaction Amount, Double formatted to 2 decimal places.
|
| 643 |
+
* @param description Transaction Description
|
| 644 |
+
* @param email Cardholder e-mail
|
| 645 |
+
* @param cardNumber A valid Card Number that passes the Luhn Check.
|
| 646 |
+
* @param cardType
|
| 647 |
+
* Card Type (Accepted Card Types must be configured in the Merchant Selfcare System.)
|
| 648 |
+
*
|
| 649 |
+
* Accepted Values :
|
| 650 |
+
*
|
| 651 |
+
* VISA
|
| 652 |
+
* MASTERCARD
|
| 653 |
+
* LASER
|
| 654 |
+
* SWITCH
|
| 655 |
+
* SOLO
|
| 656 |
+
* AMEX
|
| 657 |
+
* DINERS
|
| 658 |
+
* MAESTRO
|
| 659 |
+
* DELTA
|
| 660 |
+
* ELECTRON
|
| 661 |
+
*
|
| 662 |
+
* @param cardExpiry Card Expiry formatted MMYY
|
| 663 |
+
* @param cardHolderName Card Holder Name
|
| 664 |
+
*/
|
| 665 |
+
public function XmlPreAuthRequest($terminalId,
|
| 666 |
+
$orderId,
|
| 667 |
+
$currency,
|
| 668 |
+
$amount,
|
| 669 |
+
$cardNumber,
|
| 670 |
+
$cardType)
|
| 671 |
+
{
|
| 672 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 673 |
+
|
| 674 |
+
$this->terminalId = $terminalId;
|
| 675 |
+
$this->orderId = $orderId;
|
| 676 |
+
$this->currency = $currency;
|
| 677 |
+
$this->amount = $amount;
|
| 678 |
+
$this->cardNumber = $cardNumber;
|
| 679 |
+
$this->cardType = $cardType;
|
| 680 |
+
}
|
| 681 |
+
/**
|
| 682 |
+
* Setter for Card Verification Value
|
| 683 |
+
*
|
| 684 |
+
* @param cvv Numeric field with a max of 4 characters.
|
| 685 |
+
*/
|
| 686 |
+
public function SetCvv($cvv)
|
| 687 |
+
{
|
| 688 |
+
$this->cvv = $cvv;
|
| 689 |
+
}
|
| 690 |
+
|
| 691 |
+
/**
|
| 692 |
+
* Setter for Email Address Value
|
| 693 |
+
*
|
| 694 |
+
* @param email Alpha-numeric field.
|
| 695 |
+
*/
|
| 696 |
+
public function SetEmail($email)
|
| 697 |
+
{
|
| 698 |
+
$this->email = $email;
|
| 699 |
+
}
|
| 700 |
+
/**
|
| 701 |
+
* Setter for Email Address Value
|
| 702 |
+
*
|
| 703 |
+
* @param email Alpha-numeric field.
|
| 704 |
+
*/
|
| 705 |
+
public function SetDescription($description)
|
| 706 |
+
{
|
| 707 |
+
$this->description = $description;
|
| 708 |
+
}
|
| 709 |
+
/**
|
| 710 |
+
* Setter for Card Expiry and Card Holder Name values
|
| 711 |
+
* These are mandatory for non-SecureCard transactions
|
| 712 |
+
*
|
| 713 |
+
* @param email Alpha-numeric field.
|
| 714 |
+
*/
|
| 715 |
+
public function SetNonSecureCardCardInfo($cardExpiry, $cardHolderName)
|
| 716 |
+
{
|
| 717 |
+
$this->cardExpiry = $cardExpiry;
|
| 718 |
+
$this->cardHolderName = $cardHolderName;
|
| 719 |
+
}
|
| 720 |
+
/**
|
| 721 |
+
* Setter for Issue No
|
| 722 |
+
*
|
| 723 |
+
* @param issueNo Numeric field with a max of 3 characters.
|
| 724 |
+
*/
|
| 725 |
+
public function SetIssueNo($issueNo)
|
| 726 |
+
{
|
| 727 |
+
$this->issueNo = $issueNo;
|
| 728 |
+
}
|
| 729 |
+
|
| 730 |
+
/**
|
| 731 |
+
* Setter for Address Verification Values
|
| 732 |
+
*
|
| 733 |
+
* @param address1 First Line of address - Max size 20
|
| 734 |
+
* @param address2 Second Line of address - Max size 20
|
| 735 |
+
* @param postCode Postcode - Max size 9
|
| 736 |
+
*/
|
| 737 |
+
public function SetAvs($address1, $address2, $postCode)
|
| 738 |
+
{
|
| 739 |
+
$this->address1 = $address1;
|
| 740 |
+
$this->address2 = $address2;
|
| 741 |
+
$this->postCode = $postCode;
|
| 742 |
+
}
|
| 743 |
+
/**
|
| 744 |
+
* Setter for Foreign Currency Information
|
| 745 |
+
*
|
| 746 |
+
* @param cardCurrency ISO 4217 3 Digit Currency Code, e.g. EUR / USD / GBP
|
| 747 |
+
* @param cardAmount (Amount X Conversion rate) Formatted to two decimal places
|
| 748 |
+
* @param conversionRate Converstion rate supplied in rate response
|
| 749 |
+
*/
|
| 750 |
+
public function SetForeignCurrencyInformation($cardCurrency, $cardAmount, $conversionRate)
|
| 751 |
+
{
|
| 752 |
+
$this->cardCurrency = $cardCurrency;
|
| 753 |
+
$this->cardAmount = $cardAmount;
|
| 754 |
+
$this->conversionRate = $conversionRate;
|
| 755 |
+
|
| 756 |
+
$this->foreignCurInfoSet = true;
|
| 757 |
+
}
|
| 758 |
+
/**
|
| 759 |
+
* Setter for Multicurrency value
|
| 760 |
+
*/
|
| 761 |
+
public function SetMultiCur()
|
| 762 |
+
{
|
| 763 |
+
$this->multicur = true;
|
| 764 |
+
}
|
| 765 |
+
/**
|
| 766 |
+
* Setter for hash value
|
| 767 |
+
*
|
| 768 |
+
* @param sharedSecret
|
| 769 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 770 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 771 |
+
*/
|
| 772 |
+
public function SetHash($sharedSecret)
|
| 773 |
+
{
|
| 774 |
+
if(isset($this->multicur) && $this->multicur == true) $this->hash = $this->GetRequestHash($this->terminalId . $this->orderId . $this->currency . $this->amount . $this->dateTime . $sharedSecret);
|
| 775 |
+
else $this->hash = $this->GetRequestHash($this->terminalId . $this->orderId . $this->amount . $this->dateTime . $sharedSecret);
|
| 776 |
+
}
|
| 777 |
+
/**
|
| 778 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 779 |
+
*
|
| 780 |
+
* @param sharedSecret
|
| 781 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 782 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 783 |
+
*
|
| 784 |
+
* @param testAccount
|
| 785 |
+
* Boolean value defining Mode
|
| 786 |
+
* true - This is a test account
|
| 787 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 788 |
+
*
|
| 789 |
+
* @return XmlPreAuthResponse containing an error or the parsed payment response.
|
| 790 |
+
*/
|
| 791 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 792 |
+
{
|
| 793 |
+
$this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 794 |
+
}
|
| 795 |
+
|
| 796 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 797 |
+
{
|
| 798 |
+
$this->SetHash($sharedSecret);
|
| 799 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 800 |
+
$response = new XmlPreAuthResponse($responseString);
|
| 801 |
+
return $response;
|
| 802 |
+
}
|
| 803 |
+
|
| 804 |
+
public function GenerateXml()
|
| 805 |
+
{
|
| 806 |
+
$requestXML = new DOMDocument("1.0");
|
| 807 |
+
$requestXML->formatOutput = true;
|
| 808 |
+
|
| 809 |
+
$requestString = $requestXML->createElement("PREAUTH");
|
| 810 |
+
$requestXML->appendChild($requestString);
|
| 811 |
+
|
| 812 |
+
$node = $requestXML->createElement("ORDERID");
|
| 813 |
+
$node->appendChild($requestXML->createTextNode($this->orderId));
|
| 814 |
+
$requestString->appendChild($node);
|
| 815 |
+
|
| 816 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 817 |
+
$requestString->appendChild($node);
|
| 818 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 819 |
+
|
| 820 |
+
$node = $requestXML->createElement("AMOUNT");
|
| 821 |
+
$requestString->appendChild($node);
|
| 822 |
+
$node->appendChild($requestXML->createTextNode($this->amount));
|
| 823 |
+
|
| 824 |
+
$node = $requestXML->createElement("DATETIME");
|
| 825 |
+
$requestString->appendChild($node);
|
| 826 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 827 |
+
|
| 828 |
+
$node = $requestXML->createElement("CARDNUMBER");
|
| 829 |
+
$requestString->appendChild($node);
|
| 830 |
+
$node->appendChild($requestXML->createTextNode($this->cardNumber));
|
| 831 |
+
|
| 832 |
+
$node = $requestXML->createElement("CARDTYPE");
|
| 833 |
+
$requestString->appendChild($node);
|
| 834 |
+
$node->appendChild($requestXML->createTextNode($this->cardType));
|
| 835 |
+
|
| 836 |
+
if($this->cardExpiry !== NULL && $this->cardHolderName !== NULL) {
|
| 837 |
+
$node = $requestXML->createElement("CARDEXPIRY");
|
| 838 |
+
$requestString->appendChild($node);
|
| 839 |
+
$node->appendChild($requestXML->createTextNode($this->cardExpiry));
|
| 840 |
+
|
| 841 |
+
$node = $requestXML->createElement("CARDHOLDERNAME");
|
| 842 |
+
$requestString->appendChild($node);
|
| 843 |
+
$node->appendChild($requestXML->createTextNode($this->cardHolderName));
|
| 844 |
+
}
|
| 845 |
+
|
| 846 |
+
$node = $requestXML->createElement("HASH");
|
| 847 |
+
$requestString->appendChild($node);
|
| 848 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 849 |
+
|
| 850 |
+
$node = $requestXML->createElement("CURRENCY");
|
| 851 |
+
$requestString->appendChild($node);
|
| 852 |
+
$node->appendChild($requestXML->createTextNode($this->currency));
|
| 853 |
+
|
| 854 |
+
if($this->foreignCurInfoSet)
|
| 855 |
+
{
|
| 856 |
+
$dcNode = $requestXML->createElement("FOREIGNCURRENCYINFORMATION");
|
| 857 |
+
$requestString->appendChild($dcNode );
|
| 858 |
+
|
| 859 |
+
$dcSubNode = $requestXML->createElement("CARDCURRENCY");
|
| 860 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->cardCurrency));
|
| 861 |
+
$dcNode->appendChild($dcSubNode);
|
| 862 |
+
|
| 863 |
+
$dcSubNode = $requestXML->createElement("CARDAMOUNT");
|
| 864 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->cardAmount));
|
| 865 |
+
$dcNode->appendChild($dcSubNode);
|
| 866 |
+
|
| 867 |
+
$dcSubNode = $requestXML->createElement("CONVERSIONRATE");
|
| 868 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->conversionRate));
|
| 869 |
+
$dcNode->appendChild($dcSubNode);
|
| 870 |
+
}
|
| 871 |
+
|
| 872 |
+
$node = $requestXML->createElement("TERMINALTYPE");
|
| 873 |
+
$requestString->appendChild($node);
|
| 874 |
+
$nodeText = $requestXML->createTextNode('2');
|
| 875 |
+
$node->appendChild($nodeText);
|
| 876 |
+
|
| 877 |
+
$node = $requestXML->createElement("TRANSACTIONTYPE");
|
| 878 |
+
$requestString->appendChild($node);
|
| 879 |
+
$nodeText = $requestXML->createTextNode('7');
|
| 880 |
+
$node->appendChild($nodeText);
|
| 881 |
+
|
| 882 |
+
if($this->email !== NULL)
|
| 883 |
+
{
|
| 884 |
+
$node = $requestXML->createElement("EMAIL");
|
| 885 |
+
$requestString->appendChild($node);
|
| 886 |
+
$node->appendChild($requestXML->createTextNode($this->email));
|
| 887 |
+
}
|
| 888 |
+
|
| 889 |
+
if($this->cvv !== NULL)
|
| 890 |
+
{
|
| 891 |
+
$node = $requestXML->createElement("CVV");
|
| 892 |
+
$requestString->appendChild($node);
|
| 893 |
+
$node->appendChild($requestXML->createTextNode($this->cvv));
|
| 894 |
+
}
|
| 895 |
+
|
| 896 |
+
if($this->issueNo !== NULL)
|
| 897 |
+
{
|
| 898 |
+
$node = $requestXML->createElement("ISSUENO");
|
| 899 |
+
$requestString->appendChild($node);
|
| 900 |
+
$node->appendChild($requestXML->createTextNode($this->issueNo));
|
| 901 |
+
}
|
| 902 |
+
|
| 903 |
+
if($this->address1 !== NULL &&$this->address2 !== NULL &&$this->postCode !== NULL)
|
| 904 |
+
{
|
| 905 |
+
$node = $requestXML->createElement("ADDRESS1");
|
| 906 |
+
$requestString->appendChild($node);
|
| 907 |
+
$node->appendChild($requestXML->createTextNode($this->address1));
|
| 908 |
+
|
| 909 |
+
$node = $requestXML->createElement("ADDRESS2");
|
| 910 |
+
$requestString->appendChild($node);
|
| 911 |
+
$node->appendChild($requestXML->createTextNode($this->address2));
|
| 912 |
+
|
| 913 |
+
$node = $requestXML->createElement("POSTCODE");
|
| 914 |
+
$requestString->appendChild($node);
|
| 915 |
+
$node->appendChild($requestXML->createTextNode($this->postCode));
|
| 916 |
+
}
|
| 917 |
+
|
| 918 |
+
if($this->description !== NULL)
|
| 919 |
+
{
|
| 920 |
+
$node = $requestXML->createElement("DESCRIPTION");
|
| 921 |
+
$requestString->appendChild($node);
|
| 922 |
+
$node->appendChild($requestXML->createTextNode($this->description));
|
| 923 |
+
}
|
| 924 |
+
|
| 925 |
+
return $requestXML->saveXML();
|
| 926 |
+
|
| 927 |
+
}
|
| 928 |
+
}
|
| 929 |
+
|
| 930 |
+
/**
|
| 931 |
+
* Used for processing XML PreAuthorisation Completions through the WorldNet TPS XML Gateway.
|
| 932 |
+
*
|
| 933 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 934 |
+
*/
|
| 935 |
+
class XmlPreAuthCompletionRequest extends Request
|
| 936 |
+
{
|
| 937 |
+
private $terminalId;
|
| 938 |
+
private $orderId;
|
| 939 |
+
private $amount;
|
| 940 |
+
public function Amount()
|
| 941 |
+
{
|
| 942 |
+
return $this->amount;
|
| 943 |
+
}
|
| 944 |
+
private $dateTime;
|
| 945 |
+
private $hash;
|
| 946 |
+
private $description;
|
| 947 |
+
private $cvv;
|
| 948 |
+
private $cardCurrency;
|
| 949 |
+
private $cardAmount;
|
| 950 |
+
private $conversionRate;
|
| 951 |
+
private $multicur = false;
|
| 952 |
+
|
| 953 |
+
private $foreignCurInfoSet = false;
|
| 954 |
+
|
| 955 |
+
/**
|
| 956 |
+
* Creates the standard request less optional parameters for processing an XML Transaction
|
| 957 |
+
* through the WorldNetTPS XML Gateway
|
| 958 |
+
*
|
| 959 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 960 |
+
* @param orderId A unique merchant identifier. Alpha numeric and max size 12 chars.
|
| 961 |
+
* @param currency ISO 4217 3 Digit Currency Code, e.g. EUR / USD / GBP
|
| 962 |
+
* @param amount Transaction Amount, Double formatted to 2 decimal places.
|
| 963 |
+
* @param description Transaction Description
|
| 964 |
+
* @param email Cardholder e-mail
|
| 965 |
+
* @param cardNumber A valid Card Number that passes the Luhn Check.
|
| 966 |
+
* @param cardType
|
| 967 |
+
* Card Type (Accepted Card Types must be configured in the Merchant Selfcare System.)
|
| 968 |
+
*
|
| 969 |
+
* Accepted Values :
|
| 970 |
+
*
|
| 971 |
+
* VISA
|
| 972 |
+
* MASTERCARD
|
| 973 |
+
* LASER
|
| 974 |
+
* SWITCH
|
| 975 |
+
* SOLO
|
| 976 |
+
* AMEX
|
| 977 |
+
* DINERS
|
| 978 |
+
* MAESTRO
|
| 979 |
+
* DELTA
|
| 980 |
+
* ELECTRON
|
| 981 |
+
*
|
| 982 |
+
* @param cardExpiry Card Expiry formatted MMYY
|
| 983 |
+
* @param cardHolderName Card Holder Name
|
| 984 |
+
*/
|
| 985 |
+
public function XmlPreAuthCompletionRequest($terminalId,
|
| 986 |
+
$orderId,
|
| 987 |
+
$amount)
|
| 988 |
+
{
|
| 989 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 990 |
+
|
| 991 |
+
$this->terminalId = $terminalId;
|
| 992 |
+
$this->orderId = $orderId;
|
| 993 |
+
$this->amount = $amount;
|
| 994 |
+
}
|
| 995 |
+
/**
|
| 996 |
+
* Setter for Card Verification Value
|
| 997 |
+
*
|
| 998 |
+
* @param cvv Numeric field with a max of 4 characters.
|
| 999 |
+
*/
|
| 1000 |
+
public function SetCvv($cvv)
|
| 1001 |
+
{
|
| 1002 |
+
$this->cvv = $cvv;
|
| 1003 |
+
}
|
| 1004 |
+
/**
|
| 1005 |
+
* Setter for transaction description
|
| 1006 |
+
*
|
| 1007 |
+
* @param cvv Discretionary text value
|
| 1008 |
+
*/
|
| 1009 |
+
public function SetDescription($description)
|
| 1010 |
+
{
|
| 1011 |
+
$this->description = $description;
|
| 1012 |
+
}
|
| 1013 |
+
/**
|
| 1014 |
+
* Setter for Foreign Currency Information
|
| 1015 |
+
*
|
| 1016 |
+
* @param cardCurrency ISO 4217 3 Digit Currency Code, e.g. EUR / USD / GBP
|
| 1017 |
+
* @param cardAmount (Amount X Conversion rate) Formatted to two decimal places
|
| 1018 |
+
* @param conversionRate Converstion rate supplied in rate response
|
| 1019 |
+
*/
|
| 1020 |
+
public function SetForeignCurrencyInformation($cardCurrency, $cardAmount, $conversionRate)
|
| 1021 |
+
{
|
| 1022 |
+
$this->cardCurrency = $cardCurrency;
|
| 1023 |
+
$this->cardAmount = $cardAmount;
|
| 1024 |
+
$this->conversionRate = $conversionRate;
|
| 1025 |
+
|
| 1026 |
+
$this->foreignCurInfoSet = true;
|
| 1027 |
+
}
|
| 1028 |
+
/**
|
| 1029 |
+
* Setter for hash value
|
| 1030 |
+
*
|
| 1031 |
+
* @param sharedSecret
|
| 1032 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1033 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1034 |
+
*/
|
| 1035 |
+
public function SetHash($sharedSecret)
|
| 1036 |
+
{
|
| 1037 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->orderId . $this->amount . $this->dateTime . $sharedSecret);
|
| 1038 |
+
}
|
| 1039 |
+
/**
|
| 1040 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 1041 |
+
*
|
| 1042 |
+
* @param sharedSecret
|
| 1043 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1044 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1045 |
+
*
|
| 1046 |
+
* @param testAccount
|
| 1047 |
+
* Boolean value defining Mode
|
| 1048 |
+
* true - This is a test account
|
| 1049 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 1050 |
+
*
|
| 1051 |
+
* @return XmlPreAuthCompletionResponse containing an error or the parsed payment response.
|
| 1052 |
+
*/
|
| 1053 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 1054 |
+
{
|
| 1055 |
+
$this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 1056 |
+
}
|
| 1057 |
+
|
| 1058 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 1059 |
+
{
|
| 1060 |
+
$this->SetHash($sharedSecret);
|
| 1061 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 1062 |
+
$response = new XmlPreAuthCompletionResponse($responseString);
|
| 1063 |
+
return $response;
|
| 1064 |
+
}
|
| 1065 |
+
|
| 1066 |
+
public function GenerateXml()
|
| 1067 |
+
{
|
| 1068 |
+
$requestXML = new DOMDocument("1.0");
|
| 1069 |
+
$requestXML->formatOutput = true;
|
| 1070 |
+
|
| 1071 |
+
$requestString = $requestXML->createElement("PREAUTHCOMPLETION");
|
| 1072 |
+
$requestXML->appendChild($requestString);
|
| 1073 |
+
|
| 1074 |
+
$node = $requestXML->createElement("ORDERID");
|
| 1075 |
+
$node->appendChild($requestXML->createTextNode($this->orderId));
|
| 1076 |
+
$requestString->appendChild($node);
|
| 1077 |
+
|
| 1078 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 1079 |
+
$requestString->appendChild($node);
|
| 1080 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 1081 |
+
|
| 1082 |
+
$node = $requestXML->createElement("AMOUNT");
|
| 1083 |
+
$requestString->appendChild($node);
|
| 1084 |
+
$node->appendChild($requestXML->createTextNode($this->amount));
|
| 1085 |
+
|
| 1086 |
+
if($this->foreignCurInfoSet)
|
| 1087 |
+
{
|
| 1088 |
+
$dcNode = $requestXML->createElement("FOREIGNCURRENCYINFORMATION");
|
| 1089 |
+
$requestString->appendChild($dcNode );
|
| 1090 |
+
|
| 1091 |
+
$dcSubNode = $requestXML->createElement("CARDCURRENCY");
|
| 1092 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->cardCurrency));
|
| 1093 |
+
$dcNode->appendChild($dcSubNode);
|
| 1094 |
+
|
| 1095 |
+
$dcSubNode = $requestXML->createElement("CARDAMOUNT");
|
| 1096 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->cardAmount));
|
| 1097 |
+
$dcNode->appendChild($dcSubNode);
|
| 1098 |
+
|
| 1099 |
+
$dcSubNode = $requestXML->createElement("CONVERSIONRATE");
|
| 1100 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->conversionRate));
|
| 1101 |
+
$dcNode->appendChild($dcSubNode);
|
| 1102 |
+
}
|
| 1103 |
+
|
| 1104 |
+
if($this->description !== NULL)
|
| 1105 |
+
{
|
| 1106 |
+
$node = $requestXML->createElement("DESCRIPTION");
|
| 1107 |
+
$requestString->appendChild($node);
|
| 1108 |
+
$nodeText = $requestXML->createTextNode($this->description);
|
| 1109 |
+
$node->appendChild($nodeText);
|
| 1110 |
+
}
|
| 1111 |
+
|
| 1112 |
+
$node = $requestXML->createElement("DATETIME");
|
| 1113 |
+
$requestString->appendChild($node);
|
| 1114 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 1115 |
+
|
| 1116 |
+
if($this->cvv !== NULL)
|
| 1117 |
+
{
|
| 1118 |
+
$node = $requestXML->createElement("CVV");
|
| 1119 |
+
$requestString->appendChild($node);
|
| 1120 |
+
$node->appendChild($requestXML->createTextNode($this->cvv));
|
| 1121 |
+
}
|
| 1122 |
+
|
| 1123 |
+
$node = $requestXML->createElement("HASH");
|
| 1124 |
+
$requestString->appendChild($node);
|
| 1125 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 1126 |
+
|
| 1127 |
+
return $requestXML->saveXML();
|
| 1128 |
+
|
| 1129 |
+
}
|
| 1130 |
+
}
|
| 1131 |
+
|
| 1132 |
+
/**
|
| 1133 |
+
* Used for processing XML PreAuthorisation Completions through the WorldNet TPS XML Gateway.
|
| 1134 |
+
*
|
| 1135 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 1136 |
+
*/
|
| 1137 |
+
class XmlRateRequest extends Request
|
| 1138 |
+
{
|
| 1139 |
+
private $terminalId;
|
| 1140 |
+
private $cardBin;
|
| 1141 |
+
private $baseAmount;
|
| 1142 |
+
|
| 1143 |
+
/**
|
| 1144 |
+
* Creates the rate request for processing an XML Transaction
|
| 1145 |
+
* through the WorldNetTPS XML Gateway
|
| 1146 |
+
*
|
| 1147 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 1148 |
+
* @param cardBin First 6 digits of the card number
|
| 1149 |
+
*/
|
| 1150 |
+
public function XmlRateRequest($terminalId,
|
| 1151 |
+
$cardBin)
|
| 1152 |
+
{
|
| 1153 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 1154 |
+
|
| 1155 |
+
$this->terminalId = $terminalId;
|
| 1156 |
+
$this->cardBin = $cardBin;
|
| 1157 |
+
}
|
| 1158 |
+
/**
|
| 1159 |
+
* Setter for Card Verification Value
|
| 1160 |
+
*
|
| 1161 |
+
* @param cvv Numeric field with a max of 4 characters.
|
| 1162 |
+
*/
|
| 1163 |
+
public function SetBaseAmount($baseAmount)
|
| 1164 |
+
{
|
| 1165 |
+
$this->baseAmount = $baseAmount;
|
| 1166 |
+
}
|
| 1167 |
+
/**
|
| 1168 |
+
* Setter for hash value
|
| 1169 |
+
*
|
| 1170 |
+
* @param sharedSecret
|
| 1171 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1172 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1173 |
+
*/
|
| 1174 |
+
public function SetHash($sharedSecret)
|
| 1175 |
+
{
|
| 1176 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->cardBin . $this->dateTime . $sharedSecret);
|
| 1177 |
+
}
|
| 1178 |
+
/**
|
| 1179 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 1180 |
+
*
|
| 1181 |
+
* @param sharedSecret
|
| 1182 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1183 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1184 |
+
*
|
| 1185 |
+
* @param testAccount
|
| 1186 |
+
* Boolean value defining Mode
|
| 1187 |
+
* true - This is a test account
|
| 1188 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 1189 |
+
*
|
| 1190 |
+
* @return XmlRateResponse containing an error or the parsed response.
|
| 1191 |
+
*/
|
| 1192 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 1193 |
+
{
|
| 1194 |
+
$this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 1195 |
+
}
|
| 1196 |
+
|
| 1197 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 1198 |
+
{
|
| 1199 |
+
$this->SetHash($sharedSecret);
|
| 1200 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 1201 |
+
$response = new XmlRateResponse($responseString);
|
| 1202 |
+
return $response;
|
| 1203 |
+
}
|
| 1204 |
+
|
| 1205 |
+
public function GenerateXml()
|
| 1206 |
+
{
|
| 1207 |
+
$requestXML = new DOMDocument("1.0");
|
| 1208 |
+
$requestXML->formatOutput = true;
|
| 1209 |
+
|
| 1210 |
+
$requestString = $requestXML->createElement("GETCARDCURRENCYRATE");
|
| 1211 |
+
$requestXML->appendChild($requestString);
|
| 1212 |
+
|
| 1213 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 1214 |
+
$requestString->appendChild($node);
|
| 1215 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 1216 |
+
|
| 1217 |
+
$node = $requestXML->createElement("CARDBIN");
|
| 1218 |
+
$requestString->appendChild($node);
|
| 1219 |
+
$node->appendChild($requestXML->createTextNode($this->cardBin));
|
| 1220 |
+
|
| 1221 |
+
$node = $requestXML->createElement("DATETIME");
|
| 1222 |
+
$requestString->appendChild($node);
|
| 1223 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 1224 |
+
|
| 1225 |
+
if($this->baseAmount != NULL )
|
| 1226 |
+
{
|
| 1227 |
+
$node = $requestXML->createElement("BASEAMOUNT");
|
| 1228 |
+
$requestString->appendChild($node);
|
| 1229 |
+
$node->appendChild($requestXML->createTextNode($this->baseAmount));
|
| 1230 |
+
}
|
| 1231 |
+
|
| 1232 |
+
$node = $requestXML->createElement("HASH");
|
| 1233 |
+
$requestString->appendChild($node);
|
| 1234 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 1235 |
+
|
| 1236 |
+
return $requestXML->saveXML();
|
| 1237 |
+
}
|
| 1238 |
+
}
|
| 1239 |
+
|
| 1240 |
+
/**
|
| 1241 |
+
* Used for processing XML SecureCard Registrations through the WorldNet TPS XML Gateway.
|
| 1242 |
+
*
|
| 1243 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 1244 |
+
*/
|
| 1245 |
+
class XmlSecureCardRegRequest extends Request
|
| 1246 |
+
{
|
| 1247 |
+
private $merchantRef;
|
| 1248 |
+
private $terminalId;
|
| 1249 |
+
private $cardNumber;
|
| 1250 |
+
private $cardExpiry;
|
| 1251 |
+
private $cardHolderName;
|
| 1252 |
+
private $dateTime;
|
| 1253 |
+
private $hash;
|
| 1254 |
+
|
| 1255 |
+
/**
|
| 1256 |
+
* Creates the SecureCard Registration/Update request for processing
|
| 1257 |
+
* through the WorldNetTPS XML Gateway
|
| 1258 |
+
*
|
| 1259 |
+
* @param merchantRef A unique card identifier. Alpha numeric and max size 48 chars.
|
| 1260 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 1261 |
+
* @param cardNumber A valid Card Number that passes the Luhn Check.
|
| 1262 |
+
* @param cardType
|
| 1263 |
+
* Card Type (Accepted Card Types must be configured in the Merchant Selfcare System.)
|
| 1264 |
+
*
|
| 1265 |
+
* Accepted Values :
|
| 1266 |
+
*
|
| 1267 |
+
* VISA
|
| 1268 |
+
* MASTERCARD
|
| 1269 |
+
* LASER
|
| 1270 |
+
* SWITCH
|
| 1271 |
+
* SOLO
|
| 1272 |
+
* AMEX
|
| 1273 |
+
* DINERS
|
| 1274 |
+
|
| 1275 |
+
* MAESTRO
|
| 1276 |
+
* DELTA
|
| 1277 |
+
* ELECTRON
|
| 1278 |
+
*
|
| 1279 |
+
* @param cardExpiry Card Expiry formatted MMYY
|
| 1280 |
+
* @param cardHolderName Card Holder Name
|
| 1281 |
+
*/
|
| 1282 |
+
public function XmlSecureCardRegRequest($merchantRef,
|
| 1283 |
+
$terminalId,
|
| 1284 |
+
$cardNumber,
|
| 1285 |
+
$cardExpiry,
|
| 1286 |
+
$cardType,
|
| 1287 |
+
$cardHolderName)
|
| 1288 |
+
{
|
| 1289 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 1290 |
+
|
| 1291 |
+
$this->merchantRef = $merchantRef;
|
| 1292 |
+
$this->terminalId = $terminalId;
|
| 1293 |
+
$this->cardNumber = $cardNumber;
|
| 1294 |
+
$this->cardExpiry = $cardExpiry;
|
| 1295 |
+
$this->cardType = $cardType;
|
| 1296 |
+
$this->cardHolderName = $cardHolderName;
|
| 1297 |
+
}
|
| 1298 |
+
/**
|
| 1299 |
+
* Setter for hash value
|
| 1300 |
+
*
|
| 1301 |
+
* @param sharedSecret
|
| 1302 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1303 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1304 |
+
*/
|
| 1305 |
+
public function SetHash($sharedSecret)
|
| 1306 |
+
{
|
| 1307 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->dateTime . $this->cardNumber . $this->cardExpiry . $this->cardType . $this->cardHolderName . $sharedSecret);
|
| 1308 |
+
}
|
| 1309 |
+
/**
|
| 1310 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 1311 |
+
*
|
| 1312 |
+
* @param sharedSecret
|
| 1313 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1314 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1315 |
+
*
|
| 1316 |
+
* @param testAccount
|
| 1317 |
+
* Boolean value defining Mode
|
| 1318 |
+
* true - This is a test account
|
| 1319 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 1320 |
+
*
|
| 1321 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 1322 |
+
*/
|
| 1323 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 1324 |
+
{
|
| 1325 |
+
$this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 1326 |
+
}
|
| 1327 |
+
|
| 1328 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 1329 |
+
{
|
| 1330 |
+
$this->SetHash($sharedSecret);
|
| 1331 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 1332 |
+
$response = new XmlSecureCardRegResponse($responseString);
|
| 1333 |
+
return $response;
|
| 1334 |
+
}
|
| 1335 |
+
|
| 1336 |
+
public function GenerateXml()
|
| 1337 |
+
{
|
| 1338 |
+
$requestXML = new DOMDocument("1.0");
|
| 1339 |
+
$requestXML->formatOutput = true;
|
| 1340 |
+
|
| 1341 |
+
$requestString = $requestXML->createElement("SECURECARDREGISTRATION");
|
| 1342 |
+
$requestXML->appendChild($requestString);
|
| 1343 |
+
|
| 1344 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 1345 |
+
$requestString->appendChild($node);
|
| 1346 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 1347 |
+
|
| 1348 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 1349 |
+
$requestString->appendChild($node);
|
| 1350 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 1351 |
+
|
| 1352 |
+
$node = $requestXML->createElement("DATETIME");
|
| 1353 |
+
$requestString->appendChild($node);
|
| 1354 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 1355 |
+
|
| 1356 |
+
$node = $requestXML->createElement("CARDNUMBER");
|
| 1357 |
+
$requestString->appendChild($node);
|
| 1358 |
+
$node->appendChild($requestXML->createTextNode($this->cardNumber));
|
| 1359 |
+
|
| 1360 |
+
$node = $requestXML->createElement("CARDEXPIRY");
|
| 1361 |
+
$requestString->appendChild($node);
|
| 1362 |
+
$node->appendChild($requestXML->createTextNode($this->cardExpiry));
|
| 1363 |
+
|
| 1364 |
+
$node = $requestXML->createElement("CARDTYPE");
|
| 1365 |
+
$requestString->appendChild($node);
|
| 1366 |
+
$node->appendChild($requestXML->createTextNode($this->cardType));
|
| 1367 |
+
|
| 1368 |
+
$node = $requestXML->createElement("CARDHOLDERNAME");
|
| 1369 |
+
$requestString->appendChild($node);
|
| 1370 |
+
$node->appendChild($requestXML->createTextNode($this->cardHolderName));
|
| 1371 |
+
|
| 1372 |
+
$node = $requestXML->createElement("HASH");
|
| 1373 |
+
$requestString->appendChild($node);
|
| 1374 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 1375 |
+
|
| 1376 |
+
return $requestXML->saveXML();
|
| 1377 |
+
}
|
| 1378 |
+
}
|
| 1379 |
+
|
| 1380 |
+
/**
|
| 1381 |
+
* Used for processing XML SecureCard Registrations through the WorldNet TPS XML Gateway.
|
| 1382 |
+
*
|
| 1383 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 1384 |
+
*/
|
| 1385 |
+
class XmlSecureCardUpdRequest extends Request
|
| 1386 |
+
{
|
| 1387 |
+
private $merchantRef;
|
| 1388 |
+
private $terminalId;
|
| 1389 |
+
private $cardNumber;
|
| 1390 |
+
private $cardExpiry;
|
| 1391 |
+
private $cardHolderName;
|
| 1392 |
+
private $dateTime;
|
| 1393 |
+
private $hash;
|
| 1394 |
+
|
| 1395 |
+
/**
|
| 1396 |
+
* Creates the SecureCard Registration/Update request for processing
|
| 1397 |
+
* through the WorldNetTPS XML Gateway
|
| 1398 |
+
*
|
| 1399 |
+
* @param merchantRef A unique card identifier. Alpha numeric and max size 48 chars.
|
| 1400 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 1401 |
+
* @param cardNumber A valid Card Number that passes the Luhn Check.
|
| 1402 |
+
* @param cardType
|
| 1403 |
+
* Card Type (Accepted Card Types must be configured in the Merchant Selfcare System.)
|
| 1404 |
+
*
|
| 1405 |
+
* Accepted Values :
|
| 1406 |
+
*
|
| 1407 |
+
* VISA
|
| 1408 |
+
* MASTERCARD
|
| 1409 |
+
* LASER
|
| 1410 |
+
* SWITCH
|
| 1411 |
+
* SOLO
|
| 1412 |
+
* AMEX
|
| 1413 |
+
* DINERS
|
| 1414 |
+
* MAESTRO
|
| 1415 |
+
* DELTA
|
| 1416 |
+
* ELECTRON
|
| 1417 |
+
*
|
| 1418 |
+
* @param cardExpiry Card Expiry formatted MMYY
|
| 1419 |
+
* @param cardHolderName Card Holder Name
|
| 1420 |
+
*/
|
| 1421 |
+
public function XmlSecureCardUpdRequest($merchantRef,
|
| 1422 |
+
$terminalId,
|
| 1423 |
+
$cardNumber,
|
| 1424 |
+
$cardExpiry,
|
| 1425 |
+
$cardType,
|
| 1426 |
+
$cardHolderName)
|
| 1427 |
+
{
|
| 1428 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 1429 |
+
|
| 1430 |
+
$this->merchantRef = $merchantRef;
|
| 1431 |
+
$this->terminalId = $terminalId;
|
| 1432 |
+
$this->cardNumber = $cardNumber;
|
| 1433 |
+
$this->cardExpiry = $cardExpiry;
|
| 1434 |
+
$this->cardType = $cardType;
|
| 1435 |
+
$this->cardHolderName = $cardHolderName;
|
| 1436 |
+
}
|
| 1437 |
+
/**
|
| 1438 |
+
* Setter for hash value
|
| 1439 |
+
*
|
| 1440 |
+
* @param sharedSecret
|
| 1441 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1442 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1443 |
+
*/
|
| 1444 |
+
public function SetHash($sharedSecret)
|
| 1445 |
+
{
|
| 1446 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->dateTime . $this->cardNumber . $this->cardExpiry . $this->cardType . $this->cardHolderName . $sharedSecret);
|
| 1447 |
+
}
|
| 1448 |
+
/**
|
| 1449 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 1450 |
+
*
|
| 1451 |
+
* @param sharedSecret
|
| 1452 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1453 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1454 |
+
*
|
| 1455 |
+
* @param testAccount
|
| 1456 |
+
* Boolean value defining Mode
|
| 1457 |
+
* true - This is a test account
|
| 1458 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 1459 |
+
*
|
| 1460 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 1461 |
+
*/
|
| 1462 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 1463 |
+
{
|
| 1464 |
+
$this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 1465 |
+
}
|
| 1466 |
+
|
| 1467 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 1468 |
+
{
|
| 1469 |
+
$this->SetHash($sharedSecret);
|
| 1470 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 1471 |
+
$response = new XmlSecureCardUpdResponse($responseString);
|
| 1472 |
+
return $response;
|
| 1473 |
+
}
|
| 1474 |
+
|
| 1475 |
+
public function GenerateXml()
|
| 1476 |
+
{
|
| 1477 |
+
$requestXML = new DOMDocument("1.0");
|
| 1478 |
+
$requestXML->formatOutput = true;
|
| 1479 |
+
|
| 1480 |
+
$requestString = $requestXML->createElement("SECURECARDUPDATE");
|
| 1481 |
+
$requestXML->appendChild($requestString);
|
| 1482 |
+
|
| 1483 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 1484 |
+
$requestString->appendChild($node);
|
| 1485 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 1486 |
+
|
| 1487 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 1488 |
+
$requestString->appendChild($node);
|
| 1489 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 1490 |
+
|
| 1491 |
+
$node = $requestXML->createElement("DATETIME");
|
| 1492 |
+
$requestString->appendChild($node);
|
| 1493 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 1494 |
+
|
| 1495 |
+
$node = $requestXML->createElement("CARDNUMBER");
|
| 1496 |
+
$requestString->appendChild($node);
|
| 1497 |
+
$node->appendChild($requestXML->createTextNode($this->cardNumber));
|
| 1498 |
+
|
| 1499 |
+
$node = $requestXML->createElement("CARDEXPIRY");
|
| 1500 |
+
$requestString->appendChild($node);
|
| 1501 |
+
$node->appendChild($requestXML->createTextNode($this->cardExpiry));
|
| 1502 |
+
|
| 1503 |
+
$node = $requestXML->createElement("CARDTYPE");
|
| 1504 |
+
$requestString->appendChild($node);
|
| 1505 |
+
$node->appendChild($requestXML->createTextNode($this->cardType));
|
| 1506 |
+
|
| 1507 |
+
$node = $requestXML->createElement("CARDHOLDERNAME");
|
| 1508 |
+
$requestString->appendChild($node);
|
| 1509 |
+
$node->appendChild($requestXML->createTextNode($this->cardHolderName));
|
| 1510 |
+
|
| 1511 |
+
$node = $requestXML->createElement("HASH");
|
| 1512 |
+
$requestString->appendChild($node);
|
| 1513 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 1514 |
+
|
| 1515 |
+
return $requestXML->saveXML();
|
| 1516 |
+
}
|
| 1517 |
+
}
|
| 1518 |
+
|
| 1519 |
+
/**
|
| 1520 |
+
* Used for processing XML SecureCard deletion through the WorldNet TPS XML Gateway.
|
| 1521 |
+
*
|
| 1522 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 1523 |
+
*/
|
| 1524 |
+
class XmlSecureCarDelRequest extends Request
|
| 1525 |
+
{
|
| 1526 |
+
private $merchantRef;
|
| 1527 |
+
private $terminalId;
|
| 1528 |
+
private $secureCardMerchantRef;
|
| 1529 |
+
private $dateTime;
|
| 1530 |
+
private $hash;
|
| 1531 |
+
|
| 1532 |
+
/**
|
| 1533 |
+
* Creates the SecureCard searche request for processing
|
| 1534 |
+
* through the WorldNetTPS XML Gateway
|
| 1535 |
+
*
|
| 1536 |
+
* @param merchantRef A unique card identifier. Alpha numeric and max size 48 chars.
|
| 1537 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 1538 |
+
*/
|
| 1539 |
+
public function XmlSecureCarDelRequest($merchantRef,
|
| 1540 |
+
$terminalId,
|
| 1541 |
+
$secureCardMerchantRef)
|
| 1542 |
+
{
|
| 1543 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 1544 |
+
|
| 1545 |
+
$this->merchantRef = $merchantRef;
|
| 1546 |
+
$this->terminalId = $terminalId;
|
| 1547 |
+
$this->secureCardMerchantRef = $secureCardMerchantRef;
|
| 1548 |
+
}
|
| 1549 |
+
/**
|
| 1550 |
+
* Setter for hash value
|
| 1551 |
+
*
|
| 1552 |
+
* @param sharedSecret
|
| 1553 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1554 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1555 |
+
|
| 1556 |
+
*/
|
| 1557 |
+
public function SetHash($sharedSecret)
|
| 1558 |
+
{
|
| 1559 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->dateTime . $this->secureCardMerchantRef . $sharedSecret);
|
| 1560 |
+
}
|
| 1561 |
+
/**
|
| 1562 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 1563 |
+
*
|
| 1564 |
+
* @param sharedSecret
|
| 1565 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1566 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1567 |
+
*
|
| 1568 |
+
* @param testAccount
|
| 1569 |
+
* Boolean value defining Mode
|
| 1570 |
+
* true - This is a test account
|
| 1571 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 1572 |
+
*
|
| 1573 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 1574 |
+
*/
|
| 1575 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 1576 |
+
{
|
| 1577 |
+
$this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 1578 |
+
}
|
| 1579 |
+
|
| 1580 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 1581 |
+
{
|
| 1582 |
+
$this->SetHash($sharedSecret);
|
| 1583 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 1584 |
+
$response = new XmlSecureCardDelResponse($responseString);
|
| 1585 |
+
return $response;
|
| 1586 |
+
}
|
| 1587 |
+
|
| 1588 |
+
public function GenerateXml()
|
| 1589 |
+
{
|
| 1590 |
+
$requestXML = new DOMDocument("1.0");
|
| 1591 |
+
$requestXML->formatOutput = true;
|
| 1592 |
+
|
| 1593 |
+
$requestString = $requestXML->createElement("SECURECARDREMOVAL");
|
| 1594 |
+
$requestXML->appendChild($requestString);
|
| 1595 |
+
|
| 1596 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 1597 |
+
$requestString->appendChild($node);
|
| 1598 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 1599 |
+
|
| 1600 |
+
$node = $requestXML->createElement("CARDREFERENCE");
|
| 1601 |
+
$requestString->appendChild($node);
|
| 1602 |
+
$node->appendChild($requestXML->createTextNode($this->secureCardMerchantRef));
|
| 1603 |
+
|
| 1604 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 1605 |
+
$requestString->appendChild($node);
|
| 1606 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 1607 |
+
|
| 1608 |
+
$node = $requestXML->createElement("DATETIME");
|
| 1609 |
+
$requestString->appendChild($node);
|
| 1610 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 1611 |
+
|
| 1612 |
+
$node = $requestXML->createElement("HASH");
|
| 1613 |
+
$requestString->appendChild($node);
|
| 1614 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 1615 |
+
|
| 1616 |
+
return $requestXML->saveXML();
|
| 1617 |
+
}
|
| 1618 |
+
}
|
| 1619 |
+
|
| 1620 |
+
/**
|
| 1621 |
+
* Used for processing XML SecureCard searching through the WorldNet TPS XML Gateway.
|
| 1622 |
+
*
|
| 1623 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 1624 |
+
*/
|
| 1625 |
+
class XmlSecureCardSearchRequest extends Request
|
| 1626 |
+
{
|
| 1627 |
+
private $merchantRef;
|
| 1628 |
+
private $terminalId;
|
| 1629 |
+
private $dateTime;
|
| 1630 |
+
private $hash;
|
| 1631 |
+
|
| 1632 |
+
/**
|
| 1633 |
+
* Creates the SecureCard searche request for processing
|
| 1634 |
+
* through the WorldNetTPS XML Gateway
|
| 1635 |
+
*
|
| 1636 |
+
* @param merchantRef A unique card identifier. Alpha numeric and max size 48 chars.
|
| 1637 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 1638 |
+
*/
|
| 1639 |
+
public function XmlSecureCardSearchRequest($merchantRef,
|
| 1640 |
+
$terminalId)
|
| 1641 |
+
{
|
| 1642 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 1643 |
+
|
| 1644 |
+
$this->merchantRef = $merchantRef;
|
| 1645 |
+
$this->terminalId = $terminalId;
|
| 1646 |
+
}
|
| 1647 |
+
/**
|
| 1648 |
+
* Setter for hash value
|
| 1649 |
+
*
|
| 1650 |
+
* @param sharedSecret
|
| 1651 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1652 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1653 |
+
*/
|
| 1654 |
+
public function SetHash($sharedSecret)
|
| 1655 |
+
{
|
| 1656 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->dateTime . $sharedSecret);
|
| 1657 |
+
}
|
| 1658 |
+
/**
|
| 1659 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 1660 |
+
*
|
| 1661 |
+
* @param sharedSecret
|
| 1662 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1663 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1664 |
+
*
|
| 1665 |
+
* @param testAccount
|
| 1666 |
+
* Boolean value defining Mode
|
| 1667 |
+
* true - This is a test account
|
| 1668 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 1669 |
+
*
|
| 1670 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 1671 |
+
*/
|
| 1672 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 1673 |
+
{
|
| 1674 |
+
$this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 1675 |
+
}
|
| 1676 |
+
|
| 1677 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 1678 |
+
{
|
| 1679 |
+
$this->SetHash($sharedSecret);
|
| 1680 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 1681 |
+
$response = new XmlSecureCardSearchResponse($responseString);
|
| 1682 |
+
return $response;
|
| 1683 |
+
}
|
| 1684 |
+
|
| 1685 |
+
public function GenerateXml()
|
| 1686 |
+
{
|
| 1687 |
+
$requestXML = new DOMDocument("1.0");
|
| 1688 |
+
$requestXML->formatOutput = true;
|
| 1689 |
+
|
| 1690 |
+
$requestString = $requestXML->createElement("SECURECARDSEARCH");
|
| 1691 |
+
$requestXML->appendChild($requestString);
|
| 1692 |
+
|
| 1693 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 1694 |
+
$requestString->appendChild($node);
|
| 1695 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 1696 |
+
|
| 1697 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 1698 |
+
$requestString->appendChild($node);
|
| 1699 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 1700 |
+
|
| 1701 |
+
$node = $requestXML->createElement("DATETIME");
|
| 1702 |
+
$requestString->appendChild($node);
|
| 1703 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 1704 |
+
|
| 1705 |
+
$node = $requestXML->createElement("HASH");
|
| 1706 |
+
$requestString->appendChild($node);
|
| 1707 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 1708 |
+
|
| 1709 |
+
return $requestXML->saveXML();
|
| 1710 |
+
}
|
| 1711 |
+
}
|
| 1712 |
+
|
| 1713 |
+
/**
|
| 1714 |
+
* Used for processing XML Stored Subscription Registrations through the WorldNet TPS XML Gateway.
|
| 1715 |
+
*
|
| 1716 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 1717 |
+
*/
|
| 1718 |
+
class XmlStoredSubscriptionRegRequest extends Request
|
| 1719 |
+
{
|
| 1720 |
+
private $merchantRef;
|
| 1721 |
+
private $terminalId;
|
| 1722 |
+
private $name;
|
| 1723 |
+
private $description;
|
| 1724 |
+
private $periodType;
|
| 1725 |
+
private $length;
|
| 1726 |
+
private $recurringAmount;
|
| 1727 |
+
private $initialAmount;
|
| 1728 |
+
private $type;
|
| 1729 |
+
private $onUpdate;
|
| 1730 |
+
private $onDelete;
|
| 1731 |
+
private $dateTime;
|
| 1732 |
+
private $hash;
|
| 1733 |
+
|
| 1734 |
+
/**
|
| 1735 |
+
* Creates the SecureCard Registration/Update request for processing
|
| 1736 |
+
* through the WorldNetTPS XML Gateway
|
| 1737 |
+
*
|
| 1738 |
+
* @param merchantRef A unique subscription identifier. Alpha numeric and max size 48 chars.
|
| 1739 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 1740 |
+
* @param secureCardMerchantRef A valid, registered SecureCard Merchant Reference.
|
| 1741 |
+
* @param name Name of the subscription
|
| 1742 |
+
* @param description Card Holder Name
|
| 1743 |
+
*/
|
| 1744 |
+
public function XmlStoredSubscriptionRegRequest($merchantRef,
|
| 1745 |
+
$terminalId,
|
| 1746 |
+
$name,
|
| 1747 |
+
$description,
|
| 1748 |
+
|
| 1749 |
+
$periodType,
|
| 1750 |
+
$length,
|
| 1751 |
+
$currency,
|
| 1752 |
+
$recurringAmount,
|
| 1753 |
+
$initialAmount,
|
| 1754 |
+
$type,
|
| 1755 |
+
$onUpdate,
|
| 1756 |
+
$onDelete)
|
| 1757 |
+
{
|
| 1758 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 1759 |
+
|
| 1760 |
+
|
| 1761 |
+
$this->merchantRef = $merchantRef;
|
| 1762 |
+
$this->terminalId = $terminalId;
|
| 1763 |
+
|
| 1764 |
+
$this->name = $name;
|
| 1765 |
+
$this->description = $description;
|
| 1766 |
+
$this->periodType = $periodType;
|
| 1767 |
+
$this->length = $length;
|
| 1768 |
+
$this->currency = $currency;
|
| 1769 |
+
$this->recurringAmount = $recurringAmount;
|
| 1770 |
+
$this->initialAmount = $initialAmount;
|
| 1771 |
+
$this->type = $type;
|
| 1772 |
+
$this->onUpdate = $onUpdate;
|
| 1773 |
+
$this->onDelete = $onDelete;
|
| 1774 |
+
}
|
| 1775 |
+
/**
|
| 1776 |
+
* Setter for hash value
|
| 1777 |
+
*
|
| 1778 |
+
* @param sharedSecret
|
| 1779 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1780 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1781 |
+
*/
|
| 1782 |
+
public function SetHash($sharedSecret)
|
| 1783 |
+
{
|
| 1784 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->dateTime . $this->type . $this->name . $this->periodType . $this->currency . $this->recurringAmount . $this->initialAmount . $this->length . $sharedSecret);
|
| 1785 |
+
}
|
| 1786 |
+
/**
|
| 1787 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 1788 |
+
*
|
| 1789 |
+
* @param sharedSecret
|
| 1790 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1791 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1792 |
+
*
|
| 1793 |
+
* @param testAccount
|
| 1794 |
+
* Boolean value defining Mode
|
| 1795 |
+
* true - This is a test account
|
| 1796 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 1797 |
+
*
|
| 1798 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 1799 |
+
*/
|
| 1800 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 1801 |
+
{
|
| 1802 |
+
$this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 1803 |
+
}
|
| 1804 |
+
|
| 1805 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 1806 |
+
{
|
| 1807 |
+
$this->SetHash($sharedSecret);
|
| 1808 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 1809 |
+
$response = new XmlStoredSubscriptionRegResponse($responseString);
|
| 1810 |
+
return $response;
|
| 1811 |
+
}
|
| 1812 |
+
|
| 1813 |
+
public function GenerateXml()
|
| 1814 |
+
{
|
| 1815 |
+
$requestXML = new DOMDocument("1.0");
|
| 1816 |
+
$requestXML->formatOutput = true;
|
| 1817 |
+
|
| 1818 |
+
$requestString = $requestXML->createElement("ADDSTOREDSUBSCRIPTION");
|
| 1819 |
+
$requestXML->appendChild($requestString);
|
| 1820 |
+
|
| 1821 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 1822 |
+
$requestString->appendChild($node);
|
| 1823 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 1824 |
+
|
| 1825 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 1826 |
+
$requestString->appendChild($node);
|
| 1827 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 1828 |
+
|
| 1829 |
+
$node = $requestXML->createElement("DATETIME");
|
| 1830 |
+
$requestString->appendChild($node);
|
| 1831 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 1832 |
+
|
| 1833 |
+
$node = $requestXML->createElement("NAME");
|
| 1834 |
+
$requestString->appendChild($node);
|
| 1835 |
+
$node->appendChild($requestXML->createTextNode($this->name));
|
| 1836 |
+
|
| 1837 |
+
$node = $requestXML->createElement("DESCRIPTION");
|
| 1838 |
+
$requestString->appendChild($node);
|
| 1839 |
+
$node->appendChild($requestXML->createTextNode($this->description));
|
| 1840 |
+
|
| 1841 |
+
$node = $requestXML->createElement("PERIODTYPE");
|
| 1842 |
+
$requestString->appendChild($node);
|
| 1843 |
+
$node->appendChild($requestXML->createTextNode($this->periodType));
|
| 1844 |
+
|
| 1845 |
+
$node = $requestXML->createElement("LENGTH");
|
| 1846 |
+
$requestString->appendChild($node);
|
| 1847 |
+
$node->appendChild($requestXML->createTextNode($this->length));
|
| 1848 |
+
|
| 1849 |
+
$node = $requestXML->createElement("CURRENCY");
|
| 1850 |
+
$requestString->appendChild($node);
|
| 1851 |
+
$node->appendChild($requestXML->createTextNode($this->currency));
|
| 1852 |
+
|
| 1853 |
+
if($this->type != "AUTOMATIC (WITHOUT AMOUNTS)")
|
| 1854 |
+
{
|
| 1855 |
+
$node = $requestXML->createElement("RECURRINGAMOUNT");
|
| 1856 |
+
$requestString->appendChild($node);
|
| 1857 |
+
$node->appendChild($requestXML->createTextNode($this->recurringAmount));
|
| 1858 |
+
|
| 1859 |
+
$node = $requestXML->createElement("INITIALAMOUNT");
|
| 1860 |
+
$requestString->appendChild($node);
|
| 1861 |
+
$node->appendChild($requestXML->createTextNode($this->initialAmount));
|
| 1862 |
+
}
|
| 1863 |
+
|
| 1864 |
+
$node = $requestXML->createElement("TYPE");
|
| 1865 |
+
$requestString->appendChild($node);
|
| 1866 |
+
$node->appendChild($requestXML->createTextNode($this->type));
|
| 1867 |
+
|
| 1868 |
+
$node = $requestXML->createElement("ONUPDATE");
|
| 1869 |
+
$requestString->appendChild($node);
|
| 1870 |
+
$node->appendChild($requestXML->createTextNode($this->onUpdate));
|
| 1871 |
+
|
| 1872 |
+
$node = $requestXML->createElement("ONDELETE");
|
| 1873 |
+
$requestString->appendChild($node);
|
| 1874 |
+
$node->appendChild($requestXML->createTextNode($this->onDelete));
|
| 1875 |
+
|
| 1876 |
+
$node = $requestXML->createElement("HASH");
|
| 1877 |
+
$requestString->appendChild($node);
|
| 1878 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 1879 |
+
|
| 1880 |
+
return $requestXML->saveXML();
|
| 1881 |
+
}
|
| 1882 |
+
}
|
| 1883 |
+
|
| 1884 |
+
/**
|
| 1885 |
+
* Used for processing XML Stored Subscription Registrations through the WorldNet TPS XML Gateway.
|
| 1886 |
+
*
|
| 1887 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 1888 |
+
*/
|
| 1889 |
+
class XmlStoredSubscriptionUpdRequest extends Request
|
| 1890 |
+
{
|
| 1891 |
+
private $merchantRef;
|
| 1892 |
+
private $terminalId;
|
| 1893 |
+
private $name;
|
| 1894 |
+
private $description;
|
| 1895 |
+
private $periodType;
|
| 1896 |
+
private $length;
|
| 1897 |
+
private $currency;
|
| 1898 |
+
private $recurringAmount;
|
| 1899 |
+
private $initialAmount;
|
| 1900 |
+
private $type;
|
| 1901 |
+
private $onUpdate;
|
| 1902 |
+
private $onDelete;
|
| 1903 |
+
private $dateTime;
|
| 1904 |
+
private $hash;
|
| 1905 |
+
|
| 1906 |
+
/**
|
| 1907 |
+
* Creates the SecureCard Registration/Update request for processing
|
| 1908 |
+
* through the WorldNetTPS XML Gateway
|
| 1909 |
+
*
|
| 1910 |
+
* @param merchantRef A unique subscription identifier. Alpha numeric and max size 48 chars.
|
| 1911 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 1912 |
+
* @param secureCardMerchantRef A valid, registered SecureCard Merchant Reference.
|
| 1913 |
+
* @param name Name of the subscription
|
| 1914 |
+
* @param description Card Holder Name
|
| 1915 |
+
*/
|
| 1916 |
+
public function XmlStoredSubscriptionUpdRequest($merchantRef,
|
| 1917 |
+
$terminalId,
|
| 1918 |
+
$name,
|
| 1919 |
+
$description,
|
| 1920 |
+
$periodType,
|
| 1921 |
+
$length,
|
| 1922 |
+
$currency,
|
| 1923 |
+
$recurringAmount,
|
| 1924 |
+
$initialAmount,
|
| 1925 |
+
$type,
|
| 1926 |
+
$onUpdate,
|
| 1927 |
+
$onDelete)
|
| 1928 |
+
{
|
| 1929 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 1930 |
+
|
| 1931 |
+
$this->merchantRef = $merchantRef;
|
| 1932 |
+
$this->terminalId = $terminalId;
|
| 1933 |
+
|
| 1934 |
+
$this->name = $name;
|
| 1935 |
+
$this->description = $description;
|
| 1936 |
+
$this->periodType = $periodType;
|
| 1937 |
+
$this->length = $length;
|
| 1938 |
+
$this->currency = $currency;
|
| 1939 |
+
$this->recurringAmount = $recurringAmount;
|
| 1940 |
+
$this->initialAmount = $initialAmount;
|
| 1941 |
+
$this->type = $type;
|
| 1942 |
+
$this->onUpdate = $onUpdate;
|
| 1943 |
+
$this->onDelete = $onDelete;
|
| 1944 |
+
}
|
| 1945 |
+
/**
|
| 1946 |
+
* Setter for hash value
|
| 1947 |
+
*
|
| 1948 |
+
* @param sharedSecret
|
| 1949 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1950 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1951 |
+
*/
|
| 1952 |
+
public function SetHash($sharedSecret)
|
| 1953 |
+
{
|
| 1954 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->dateTime . $this->type . $this->name . $this->periodType . $this->currency . $this->recurringAmount . $this->initialAmount . $this->length . $sharedSecret);
|
| 1955 |
+
}
|
| 1956 |
+
/**
|
| 1957 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 1958 |
+
*
|
| 1959 |
+
* @param sharedSecret
|
| 1960 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 1961 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 1962 |
+
*
|
| 1963 |
+
* @param testAccount
|
| 1964 |
+
* Boolean value defining Mode
|
| 1965 |
+
* true - This is a test account
|
| 1966 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 1967 |
+
*
|
| 1968 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 1969 |
+
*/
|
| 1970 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 1971 |
+
{
|
| 1972 |
+
$this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 1973 |
+
}
|
| 1974 |
+
|
| 1975 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 1976 |
+
{
|
| 1977 |
+
$this->SetHash($sharedSecret);
|
| 1978 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 1979 |
+
$response = new XmlStoredSubscriptionUpdResponse($responseString);
|
| 1980 |
+
return $response;
|
| 1981 |
+
}
|
| 1982 |
+
|
| 1983 |
+
public function GenerateXml()
|
| 1984 |
+
{
|
| 1985 |
+
$requestXML = new DOMDocument("1.0");
|
| 1986 |
+
$requestXML->formatOutput = true;
|
| 1987 |
+
|
| 1988 |
+
$requestString = $requestXML->createElement("UPDATESTOREDSUBSCRIPTION");
|
| 1989 |
+
$requestXML->appendChild($requestString);
|
| 1990 |
+
|
| 1991 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 1992 |
+
$requestString->appendChild($node);
|
| 1993 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 1994 |
+
|
| 1995 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 1996 |
+
$requestString->appendChild($node);
|
| 1997 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 1998 |
+
|
| 1999 |
+
$node = $requestXML->createElement("DATETIME");
|
| 2000 |
+
$requestString->appendChild($node);
|
| 2001 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 2002 |
+
|
| 2003 |
+
$node = $requestXML->createElement("NAME");
|
| 2004 |
+
$requestString->appendChild($node);
|
| 2005 |
+
$node->appendChild($requestXML->createTextNode($this->name));
|
| 2006 |
+
|
| 2007 |
+
$node = $requestXML->createElement("DESCRIPTION");
|
| 2008 |
+
$requestString->appendChild($node);
|
| 2009 |
+
$node->appendChild($requestXML->createTextNode($this->description));
|
| 2010 |
+
|
| 2011 |
+
$node = $requestXML->createElement("PERIODTYPE");
|
| 2012 |
+
$requestString->appendChild($node);
|
| 2013 |
+
$node->appendChild($requestXML->createTextNode($this->periodType));
|
| 2014 |
+
|
| 2015 |
+
$node = $requestXML->createElement("LENGTH");
|
| 2016 |
+
$requestString->appendChild($node);
|
| 2017 |
+
$node->appendChild($requestXML->createTextNode($this->length));
|
| 2018 |
+
|
| 2019 |
+
$node = $requestXML->createElement("CURRENCY");
|
| 2020 |
+
$requestString->appendChild($node);
|
| 2021 |
+
$node->appendChild($requestXML->createTextNode($this->currency));
|
| 2022 |
+
|
| 2023 |
+
if($this->type != "AUTOMATIC (WITHOUT AMOUNTS)")
|
| 2024 |
+
{
|
| 2025 |
+
$node = $requestXML->createElement("RECURRINGAMOUNT");
|
| 2026 |
+
$requestString->appendChild($node);
|
| 2027 |
+
$node->appendChild($requestXML->createTextNode($this->recurringAmount));
|
| 2028 |
+
|
| 2029 |
+
$node = $requestXML->createElement("INITIALAMOUNT");
|
| 2030 |
+
$requestString->appendChild($node);
|
| 2031 |
+
$node->appendChild($requestXML->createTextNode($this->initialAmount));
|
| 2032 |
+
}
|
| 2033 |
+
|
| 2034 |
+
$node = $requestXML->createElement("TYPE");
|
| 2035 |
+
$requestString->appendChild($node);
|
| 2036 |
+
$node->appendChild($requestXML->createTextNode($this->type));
|
| 2037 |
+
|
| 2038 |
+
$node = $requestXML->createElement("ONUPDATE");
|
| 2039 |
+
$requestString->appendChild($node);
|
| 2040 |
+
$node->appendChild($requestXML->createTextNode($this->onUpdate));
|
| 2041 |
+
|
| 2042 |
+
$node = $requestXML->createElement("ONDELETE");
|
| 2043 |
+
$requestString->appendChild($node);
|
| 2044 |
+
$node->appendChild($requestXML->createTextNode($this->onDelete));
|
| 2045 |
+
|
| 2046 |
+
$node = $requestXML->createElement("HASH");
|
| 2047 |
+
$requestString->appendChild($node);
|
| 2048 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 2049 |
+
|
| 2050 |
+
return $requestXML->saveXML();
|
| 2051 |
+
}
|
| 2052 |
+
}
|
| 2053 |
+
|
| 2054 |
+
/**
|
| 2055 |
+
* Used for processing XML SecureCard Registrations through the WorldNet TPS XML Gateway.
|
| 2056 |
+
*
|
| 2057 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 2058 |
+
*/
|
| 2059 |
+
class XmlStoredSubscriptionDelRequest extends Request
|
| 2060 |
+
{
|
| 2061 |
+
private $merchantRef;
|
| 2062 |
+
private $terminalId;
|
| 2063 |
+
private $dateTime;
|
| 2064 |
+
private $hash;
|
| 2065 |
+
|
| 2066 |
+
/**
|
| 2067 |
+
* Creates the SecureCard Registration/Update request for processing
|
| 2068 |
+
* through the WorldNetTPS XML Gateway
|
| 2069 |
+
*
|
| 2070 |
+
* @param merchantRef A unique subscription identifier. Alpha numeric and max size 48 chars.
|
| 2071 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 2072 |
+
*/
|
| 2073 |
+
public function XmlStoredSubscriptionDelRequest($merchantRef,
|
| 2074 |
+
$terminalId)
|
| 2075 |
+
{
|
| 2076 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 2077 |
+
|
| 2078 |
+
$this->merchantRef = $merchantRef;
|
| 2079 |
+
$this->terminalId = $terminalId;
|
| 2080 |
+
}
|
| 2081 |
+
/**
|
| 2082 |
+
* Setter for hash value
|
| 2083 |
+
*
|
| 2084 |
+
* @param sharedSecret
|
| 2085 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2086 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2087 |
+
*/
|
| 2088 |
+
public function SetHash($sharedSecret)
|
| 2089 |
+
{
|
| 2090 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->dateTime . $sharedSecret);
|
| 2091 |
+
}
|
| 2092 |
+
/**
|
| 2093 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 2094 |
+
*
|
| 2095 |
+
* @param sharedSecret
|
| 2096 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2097 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2098 |
+
*
|
| 2099 |
+
* @param testAccount
|
| 2100 |
+
* Boolean value defining Mode
|
| 2101 |
+
* true - This is a test account
|
| 2102 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 2103 |
+
*
|
| 2104 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 2105 |
+
*/
|
| 2106 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 2107 |
+
{
|
| 2108 |
+
$this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 2109 |
+
}
|
| 2110 |
+
|
| 2111 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 2112 |
+
{
|
| 2113 |
+
$this->SetHash($sharedSecret);
|
| 2114 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 2115 |
+
$response = new XmlStoredSubscriptionDelResponse($responseString);
|
| 2116 |
+
return $response;
|
| 2117 |
+
}
|
| 2118 |
+
|
| 2119 |
+
public function GenerateXml()
|
| 2120 |
+
{
|
| 2121 |
+
$requestXML = new DOMDocument("1.0");
|
| 2122 |
+
$requestXML->formatOutput = true;
|
| 2123 |
+
|
| 2124 |
+
$requestString = $requestXML->createElement("DELETESTOREDSUBSCRIPTION");
|
| 2125 |
+
$requestXML->appendChild($requestString);
|
| 2126 |
+
|
| 2127 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 2128 |
+
$requestString->appendChild($node);
|
| 2129 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 2130 |
+
|
| 2131 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 2132 |
+
$requestString->appendChild($node);
|
| 2133 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 2134 |
+
|
| 2135 |
+
$node = $requestXML->createElement("DATETIME");
|
| 2136 |
+
$requestString->appendChild($node);
|
| 2137 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 2138 |
+
|
| 2139 |
+
$node = $requestXML->createElement("HASH");
|
| 2140 |
+
$requestString->appendChild($node);
|
| 2141 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 2142 |
+
|
| 2143 |
+
return $requestXML->saveXML();
|
| 2144 |
+
}
|
| 2145 |
+
}
|
| 2146 |
+
|
| 2147 |
+
class XmlSubscriptionRegRequest extends Request
|
| 2148 |
+
{
|
| 2149 |
+
private $merchantRef;
|
| 2150 |
+
private $terminalId;
|
| 2151 |
+
private $storedSubscriptionRef;
|
| 2152 |
+
private $secureCardMerchantRef;
|
| 2153 |
+
private $name;
|
| 2154 |
+
private $description;
|
| 2155 |
+
private $periodType;
|
| 2156 |
+
private $length;
|
| 2157 |
+
private $currency;
|
| 2158 |
+
private $recurringAmount;
|
| 2159 |
+
private $initialAmount;
|
| 2160 |
+
private $type;
|
| 2161 |
+
private $startDate;
|
| 2162 |
+
private $endDate;
|
| 2163 |
+
private $onUpdate;
|
| 2164 |
+
private $onDelete;
|
| 2165 |
+
private $dateTime;
|
| 2166 |
+
private $hash;
|
| 2167 |
+
private $eDCCDecision;
|
| 2168 |
+
|
| 2169 |
+
private $newStoredSubscription = false;
|
| 2170 |
+
|
| 2171 |
+
public function SetNewStoredSubscriptionValues($name,
|
| 2172 |
+
$description,
|
| 2173 |
+
$periodType,
|
| 2174 |
+
$length,
|
| 2175 |
+
$currency,
|
| 2176 |
+
$recurringAmount,
|
| 2177 |
+
$initialAmount,
|
| 2178 |
+
$type,
|
| 2179 |
+
$onUpdate,
|
| 2180 |
+
$onDelete)
|
| 2181 |
+
{
|
| 2182 |
+
$this->name = $name;
|
| 2183 |
+
$this->description = $description;
|
| 2184 |
+
$this->periodType = $periodType;
|
| 2185 |
+
$this->length = $length;
|
| 2186 |
+
$this->currency = $currency;
|
| 2187 |
+
$this->recurringAmount = $recurringAmount;
|
| 2188 |
+
$this->initialAmount = $initialAmount;
|
| 2189 |
+
$this->type = $type;
|
| 2190 |
+
$this->onUpdate = $onUpdate;
|
| 2191 |
+
$this->onDelete = $onDelete;
|
| 2192 |
+
|
| 2193 |
+
$this->newStoredSubscription = true;
|
| 2194 |
+
}
|
| 2195 |
+
public function SetSubscriptionAmounts($recurringAmount,
|
| 2196 |
+
$initialAmount)
|
| 2197 |
+
{
|
| 2198 |
+
$this->recurringAmount = $recurringAmount;
|
| 2199 |
+
$this->initialAmount = $initialAmount;
|
| 2200 |
+
}
|
| 2201 |
+
/**
|
| 2202 |
+
* Setter for end date
|
| 2203 |
+
*
|
| 2204 |
+
* @param endDate End Date of subscription
|
| 2205 |
+
*/
|
| 2206 |
+
public function SetEndDate($endDate)
|
| 2207 |
+
{
|
| 2208 |
+
$this->endDate = $endDate;
|
| 2209 |
+
}
|
| 2210 |
+
/**
|
| 2211 |
+
* Setter for when the cardholder has accepted the eDCC offering
|
| 2212 |
+
*
|
| 2213 |
+
* @param eDCCDecision eDCC decision ("Y" or "N")
|
| 2214 |
+
*/
|
| 2215 |
+
public function EDCCDecision($eDCCDecision)
|
| 2216 |
+
{
|
| 2217 |
+
$this->eDCCDecision = $eDCCDecision;
|
| 2218 |
+
}
|
| 2219 |
+
/**
|
| 2220 |
+
* Creates the SecureCard Registration/Update request for processing
|
| 2221 |
+
* through the WorldNetTPS XML Gateway
|
| 2222 |
+
*
|
| 2223 |
+
* @param merchantRef A unique subscription identifier. Alpha numeric and max size 48 chars.
|
| 2224 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 2225 |
+
|
| 2226 |
+
* @param storedSubscriptionRef Name of the Stored subscription under which this subscription should run
|
| 2227 |
+
* @param secureCardMerchantRef A valid, registered SecureCard Merchant Reference.
|
| 2228 |
+
* @param startDate Card Holder Name
|
| 2229 |
+
*/
|
| 2230 |
+
public function XmlSubscriptionRegRequest($merchantRef,
|
| 2231 |
+
$terminalId,
|
| 2232 |
+
$storedSubscriptionRef,
|
| 2233 |
+
$secureCardMerchantRef,
|
| 2234 |
+
$startDate)
|
| 2235 |
+
{
|
| 2236 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 2237 |
+
|
| 2238 |
+
$this->storedSubscriptionRef = $storedSubscriptionRef;
|
| 2239 |
+
$this->secureCardMerchantRef = $secureCardMerchantRef;
|
| 2240 |
+
$this->merchantRef = $merchantRef;
|
| 2241 |
+
$this->terminalId = $terminalId;
|
| 2242 |
+
$this->startDate = $startDate;
|
| 2243 |
+
}
|
| 2244 |
+
/**
|
| 2245 |
+
* Setter for hash value
|
| 2246 |
+
*
|
| 2247 |
+
* @param sharedSecret
|
| 2248 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2249 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2250 |
+
*/
|
| 2251 |
+
public function SetHash($sharedSecret)
|
| 2252 |
+
{
|
| 2253 |
+
if($this->newStoredSubscription) $this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->secureCardMerchantRef . $this->dateTime . $this->startDate . $sharedSecret);
|
| 2254 |
+
else $this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->storedSubscriptionRef . $this->secureCardMerchantRef . $this->dateTime . $this->startDate . $sharedSecret);
|
| 2255 |
+
|
| 2256 |
+
}
|
| 2257 |
+
/**
|
| 2258 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 2259 |
+
*
|
| 2260 |
+
* @param sharedSecret
|
| 2261 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2262 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2263 |
+
*
|
| 2264 |
+
* @param testAccount
|
| 2265 |
+
* Boolean value defining Mode
|
| 2266 |
+
* true - This is a test account
|
| 2267 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 2268 |
+
*
|
| 2269 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 2270 |
+
*/
|
| 2271 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 2272 |
+
{
|
| 2273 |
+
$this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 2274 |
+
}
|
| 2275 |
+
|
| 2276 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 2277 |
+
{
|
| 2278 |
+
$this->SetHash($sharedSecret);
|
| 2279 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 2280 |
+
$response = new XmlSubscriptionRegResponse($responseString);
|
| 2281 |
+
return $response;
|
| 2282 |
+
}
|
| 2283 |
+
|
| 2284 |
+
public function GenerateXml()
|
| 2285 |
+
{
|
| 2286 |
+
$requestXML = new DOMDocument("1.0");
|
| 2287 |
+
$requestXML->formatOutput = true;
|
| 2288 |
+
|
| 2289 |
+
$requestString = $requestXML->createElement("ADDSUBSCRIPTION");
|
| 2290 |
+
$requestXML->appendChild($requestString);
|
| 2291 |
+
|
| 2292 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 2293 |
+
$requestString->appendChild($node);
|
| 2294 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 2295 |
+
|
| 2296 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 2297 |
+
$requestString->appendChild($node);
|
| 2298 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 2299 |
+
|
| 2300 |
+
if(!$this->newStoredSubscription)
|
| 2301 |
+
{
|
| 2302 |
+
$node = $requestXML->createElement("STOREDSUBSCRIPTIONREF");
|
| 2303 |
+
$requestString->appendChild($node);
|
| 2304 |
+
$node->appendChild($requestXML->createTextNode($this->storedSubscriptionRef));
|
| 2305 |
+
}
|
| 2306 |
+
|
| 2307 |
+
$node = $requestXML->createElement("SECURECARDMERCHANTREF");
|
| 2308 |
+
$requestString->appendChild($node);
|
| 2309 |
+
$node->appendChild($requestXML->createTextNode($this->secureCardMerchantRef));
|
| 2310 |
+
|
| 2311 |
+
$node = $requestXML->createElement("DATETIME");
|
| 2312 |
+
$requestString->appendChild($node);
|
| 2313 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 2314 |
+
|
| 2315 |
+
if($this->recurringAmount != null && $this->recurringAmount != null && !$this->newStoredSubscription)
|
| 2316 |
+
{
|
| 2317 |
+
$node = $requestXML->createElement("RECURRINGAMOUNT");
|
| 2318 |
+
$requestString->appendChild($node);
|
| 2319 |
+
$node->appendChild($requestXML->createTextNode($this->recurringAmount));
|
| 2320 |
+
|
| 2321 |
+
$node = $requestXML->createElement("INITIALAMOUNT");
|
| 2322 |
+
$requestString->appendChild($node);
|
| 2323 |
+
$node->appendChild($requestXML->createTextNode($this->initialAmount));
|
| 2324 |
+
}
|
| 2325 |
+
|
| 2326 |
+
$node = $requestXML->createElement("STARTDATE");
|
| 2327 |
+
$requestString->appendChild($node);
|
| 2328 |
+
$node->appendChild($requestXML->createTextNode($this->startDate));
|
| 2329 |
+
|
| 2330 |
+
|
| 2331 |
+
if($this->endDate != null)
|
| 2332 |
+
{
|
| 2333 |
+
$node = $requestXML->createElement("ENDDATE");
|
| 2334 |
+
$requestString->appendChild($node);
|
| 2335 |
+
$node->appendChild($requestXML->createTextNode($this->endDate));
|
| 2336 |
+
}
|
| 2337 |
+
|
| 2338 |
+
if($this->eDCCDecision !== NULL)
|
| 2339 |
+
{
|
| 2340 |
+
$node = $requestXML->createElement("EDCCDECISION");
|
| 2341 |
+
$requestString->appendChild($node);
|
| 2342 |
+
$node->appendChild($requestXML->createTextNode($this->eDCCDecision));
|
| 2343 |
+
}
|
| 2344 |
+
|
| 2345 |
+
if($this->newStoredSubscription)
|
| 2346 |
+
{
|
| 2347 |
+
$ssNode = $requestXML->createElement("NEWSTOREDSUBSCRIPTIONINFO");
|
| 2348 |
+
$requestString->appendChild($ssNode );
|
| 2349 |
+
|
| 2350 |
+
$ssSubNode = $requestXML->createElement("MERCHANTREF");
|
| 2351 |
+
$ssNode->appendChild($ssSubNode);
|
| 2352 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->storedSubscriptionRef));
|
| 2353 |
+
|
| 2354 |
+
$ssSubNode = $requestXML->createElement("NAME");
|
| 2355 |
+
$ssNode->appendChild($ssSubNode);
|
| 2356 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->name));
|
| 2357 |
+
|
| 2358 |
+
$ssSubNode = $requestXML->createElement("DESCRIPTION");
|
| 2359 |
+
$ssNode->appendChild($ssSubNode);
|
| 2360 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->description));
|
| 2361 |
+
|
| 2362 |
+
$ssSubNode = $requestXML->createElement("PERIODTYPE");
|
| 2363 |
+
$ssNode->appendChild($ssSubNode);
|
| 2364 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->periodType));
|
| 2365 |
+
|
| 2366 |
+
$ssSubNode = $requestXML->createElement("LENGTH");
|
| 2367 |
+
$ssNode->appendChild($ssSubNode);
|
| 2368 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->length));
|
| 2369 |
+
|
| 2370 |
+
$ssSubNode = $requestXML->createElement("CURRENCY");
|
| 2371 |
+
$ssNode->appendChild($ssSubNode);
|
| 2372 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->currency));
|
| 2373 |
+
|
| 2374 |
+
if($this->type != "AUTOMATIC (WITHOUT AMOUNTS)")
|
| 2375 |
+
{
|
| 2376 |
+
$ssSubNode = $requestXML->createElement("RECURRINGAMOUNT");
|
| 2377 |
+
$ssNode->appendChild($ssSubNode);
|
| 2378 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->recurringAmount));
|
| 2379 |
+
|
| 2380 |
+
$ssSubNode = $requestXML->createElement("INITIALAMOUNT");
|
| 2381 |
+
$ssNode->appendChild($ssSubNode);
|
| 2382 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->initialAmount));
|
| 2383 |
+
}
|
| 2384 |
+
|
| 2385 |
+
$ssSubNode = $requestXML->createElement("TYPE");
|
| 2386 |
+
$ssNode->appendChild($ssSubNode);
|
| 2387 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->type));
|
| 2388 |
+
|
| 2389 |
+
$ssSubNode = $requestXML->createElement("ONUPDATE");
|
| 2390 |
+
$ssNode->appendChild($ssSubNode);
|
| 2391 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->onUpdate));
|
| 2392 |
+
|
| 2393 |
+
$ssSubNode = $requestXML->createElement("ONDELETE");
|
| 2394 |
+
$ssNode->appendChild($ssSubNode);
|
| 2395 |
+
$ssSubNode->appendChild($requestXML->createTextNode($this->onDelete));
|
| 2396 |
+
}
|
| 2397 |
+
|
| 2398 |
+
$node = $requestXML->createElement("HASH");
|
| 2399 |
+
$requestString->appendChild($node);
|
| 2400 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 2401 |
+
|
| 2402 |
+
return $requestXML->saveXML();
|
| 2403 |
+
}
|
| 2404 |
+
}
|
| 2405 |
+
|
| 2406 |
+
/**
|
| 2407 |
+
* Used for processing XML SecureCard Registrations through the WorldNet TPS XML Gateway.
|
| 2408 |
+
*
|
| 2409 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 2410 |
+
*/
|
| 2411 |
+
class XmlSubscriptionUpdRequest extends Request
|
| 2412 |
+
{
|
| 2413 |
+
private $merchantRef;
|
| 2414 |
+
private $terminalId;
|
| 2415 |
+
private $secureCardMerchantRef;
|
| 2416 |
+
private $name;
|
| 2417 |
+
private $description;
|
| 2418 |
+
private $periodType;
|
| 2419 |
+
private $length;
|
| 2420 |
+
private $recurringAmount;
|
| 2421 |
+
private $type;
|
| 2422 |
+
private $startDate;
|
| 2423 |
+
private $endDate;
|
| 2424 |
+
private $dateTime;
|
| 2425 |
+
private $hash;
|
| 2426 |
+
private $eDCCDecision;
|
| 2427 |
+
|
| 2428 |
+
/**
|
| 2429 |
+
* Setter for subscription name
|
| 2430 |
+
*
|
| 2431 |
+
* @param name Subscription name
|
| 2432 |
+
*/
|
| 2433 |
+
public function SetSubName($name)
|
| 2434 |
+
{
|
| 2435 |
+
$this->name = $name;
|
| 2436 |
+
}
|
| 2437 |
+
/**
|
| 2438 |
+
* Setter for subscription description
|
| 2439 |
+
*
|
| 2440 |
+
* @param description Subscription description
|
| 2441 |
+
*/
|
| 2442 |
+
public function SetDescription($description)
|
| 2443 |
+
{
|
| 2444 |
+
$this->description = $description;
|
| 2445 |
+
}
|
| 2446 |
+
/**
|
| 2447 |
+
* Setter for subscription period type
|
| 2448 |
+
*
|
| 2449 |
+
* @param periodType Subscription period type
|
| 2450 |
+
*/
|
| 2451 |
+
public function SetPeriodType($periodType)
|
| 2452 |
+
{
|
| 2453 |
+
$this->periodType = $periodType;
|
| 2454 |
+
}
|
| 2455 |
+
/**
|
| 2456 |
+
* Setter for subscription length
|
| 2457 |
+
*
|
| 2458 |
+
* @param length Subscription length
|
| 2459 |
+
*/
|
| 2460 |
+
public function SetLength($length)
|
| 2461 |
+
{
|
| 2462 |
+
$this->length = $length;
|
| 2463 |
+
}
|
| 2464 |
+
/**
|
| 2465 |
+
* Setter for subscription recurring amount
|
| 2466 |
+
*
|
| 2467 |
+
* @param recurringAmount Subscription recurring amount
|
| 2468 |
+
*/
|
| 2469 |
+
public function SetRecurringAmount($recurringAmount)
|
| 2470 |
+
{
|
| 2471 |
+
$this->recurringAmount = $recurringAmount;
|
| 2472 |
+
}
|
| 2473 |
+
/**
|
| 2474 |
+
* Setter for stored subscription type
|
| 2475 |
+
*
|
| 2476 |
+
* @param endDate Stored subscription type
|
| 2477 |
+
*/
|
| 2478 |
+
public function SetSubType($type)
|
| 2479 |
+
{
|
| 2480 |
+
$this->type = $type;
|
| 2481 |
+
}
|
| 2482 |
+
/**
|
| 2483 |
+
* Setter for stored subscription start date
|
| 2484 |
+
*
|
| 2485 |
+
* @param startDate Stored subscription start date
|
| 2486 |
+
*/
|
| 2487 |
+
public function SetStartDate($startDate)
|
| 2488 |
+
{
|
| 2489 |
+
$this->startDate = $startDate;
|
| 2490 |
+
}
|
| 2491 |
+
/**
|
| 2492 |
+
* Setter for stored subscription end date
|
| 2493 |
+
*
|
| 2494 |
+
* @param endDate Stored subscription end date
|
| 2495 |
+
*/
|
| 2496 |
+
public function SetEndDate($endDate)
|
| 2497 |
+
{
|
| 2498 |
+
$this->endDate = $endDate;
|
| 2499 |
+
}
|
| 2500 |
+
/**
|
| 2501 |
+
* Setter for when the cardholder has accepted the eDCC offering
|
| 2502 |
+
*
|
| 2503 |
+
* @param eDCCDecision eDCC decision ("Y" or "N")
|
| 2504 |
+
*/
|
| 2505 |
+
public function EDCCDecision($eDCCDecision)
|
| 2506 |
+
{
|
| 2507 |
+
$this->eDCCDecision = $eDCCDecision;
|
| 2508 |
+
}
|
| 2509 |
+
/**
|
| 2510 |
+
* Creates the SecureCard Update request for processing
|
| 2511 |
+
* through the WorldNetTPS XML Gateway
|
| 2512 |
+
*
|
| 2513 |
+
* @param merchantRef A unique subscription identifier. Alpha numeric and max size 48 chars.
|
| 2514 |
+
* @param terminalId Terminal ID provided by WorldNet TPS.
|
| 2515 |
+
* @param secureCardMerchantRef Reference to the existing or new SecureCard for the subscription.
|
| 2516 |
+
*/
|
| 2517 |
+
public function XmlSubscriptionUpdRequest($merchantRef,
|
| 2518 |
+
$terminalId,
|
| 2519 |
+
$secureCardMerchantRef)
|
| 2520 |
+
{
|
| 2521 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 2522 |
+
|
| 2523 |
+
$this->merchantRef = $merchantRef;
|
| 2524 |
+
$this->terminalId = $terminalId;
|
| 2525 |
+
$this->secureCardMerchantRef = $secureCardMerchantRef;
|
| 2526 |
+
}
|
| 2527 |
+
/**
|
| 2528 |
+
* Setter for hash value
|
| 2529 |
+
*
|
| 2530 |
+
* @param sharedSecret
|
| 2531 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2532 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2533 |
+
*/
|
| 2534 |
+
public function SetHash($sharedSecret)
|
| 2535 |
+
{
|
| 2536 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->secureCardMerchantRef . $this->dateTime . $this->startDate . $sharedSecret);
|
| 2537 |
+
}
|
| 2538 |
+
/**
|
| 2539 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 2540 |
+
*
|
| 2541 |
+
* @param sharedSecret
|
| 2542 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2543 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2544 |
+
*
|
| 2545 |
+
* @param testAccount
|
| 2546 |
+
* Boolean value defining Mode
|
| 2547 |
+
* true - This is a test account
|
| 2548 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 2549 |
+
*
|
| 2550 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 2551 |
+
*/
|
| 2552 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 2553 |
+
{
|
| 2554 |
+
$this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 2555 |
+
}
|
| 2556 |
+
|
| 2557 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 2558 |
+
{
|
| 2559 |
+
$this->SetHash($sharedSecret);
|
| 2560 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 2561 |
+
$response = new XmlSubscriptionUpdResponse($responseString);
|
| 2562 |
+
return $response;
|
| 2563 |
+
}
|
| 2564 |
+
|
| 2565 |
+
public function GenerateXml()
|
| 2566 |
+
{
|
| 2567 |
+
$requestXML = new DOMDocument("1.0");
|
| 2568 |
+
$requestXML->formatOutput = true;
|
| 2569 |
+
|
| 2570 |
+
$requestString = $requestXML->createElement("UPDATESUBSCRIPTION");
|
| 2571 |
+
$requestXML->appendChild($requestString);
|
| 2572 |
+
|
| 2573 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 2574 |
+
$requestString->appendChild($node);
|
| 2575 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 2576 |
+
|
| 2577 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 2578 |
+
$requestString->appendChild($node);
|
| 2579 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 2580 |
+
|
| 2581 |
+
$node = $requestXML->createElement("SECURECARDMERCHANTREF");
|
| 2582 |
+
$requestString->appendChild($node);
|
| 2583 |
+
$node->appendChild($requestXML->createTextNode($this->secureCardMerchantRef));
|
| 2584 |
+
|
| 2585 |
+
$node = $requestXML->createElement("DATETIME");
|
| 2586 |
+
$requestString->appendChild($node);
|
| 2587 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 2588 |
+
|
| 2589 |
+
if($this->name !== NULL)
|
| 2590 |
+
{
|
| 2591 |
+
$node = $requestXML->createElement("NAME");
|
| 2592 |
+
$requestString->appendChild($node);
|
| 2593 |
+
$node->appendChild($requestXML->createTextNode($this->name));
|
| 2594 |
+
}
|
| 2595 |
+
|
| 2596 |
+
if($this->description !== NULL)
|
| 2597 |
+
{
|
| 2598 |
+
$node = $requestXML->createElement("DESCRIPTION");
|
| 2599 |
+
$requestString->appendChild($node);
|
| 2600 |
+
$node->appendChild($requestXML->createTextNode($this->description));
|
| 2601 |
+
}
|
| 2602 |
+
|
| 2603 |
+
if($this->periodType !== NULL)
|
| 2604 |
+
{
|
| 2605 |
+
$node = $requestXML->createElement("PERIODTYPE");
|
| 2606 |
+
$requestString->appendChild($node);
|
| 2607 |
+
$node->appendChild($requestXML->createTextNode($this->periodType));
|
| 2608 |
+
}
|
| 2609 |
+
|
| 2610 |
+
if($this->length != null)
|
| 2611 |
+
{
|
| 2612 |
+
$node = $requestXML->createElement("LENGTH");
|
| 2613 |
+
$requestString->appendChild($node);
|
| 2614 |
+
$node->appendChild($requestXML->createTextNode($this->length));
|
| 2615 |
+
}
|
| 2616 |
+
|
| 2617 |
+
if($this->recurringAmount !== NULL)
|
| 2618 |
+
{
|
| 2619 |
+
$node = $requestXML->createElement("RECURRINGAMOUNT");
|
| 2620 |
+
$requestString->appendChild($node);
|
| 2621 |
+
$node->appendChild($requestXML->createTextNode($this->recurringAmount));
|
| 2622 |
+
}
|
| 2623 |
+
|
| 2624 |
+
if($this->type !== NULL)
|
| 2625 |
+
{
|
| 2626 |
+
$node = $requestXML->createElement("TYPE");
|
| 2627 |
+
$requestString->appendChild($node);
|
| 2628 |
+
$node->appendChild($requestXML->createTextNode($this->type));
|
| 2629 |
+
}
|
| 2630 |
+
|
| 2631 |
+
if($this->startDate !== NULL)
|
| 2632 |
+
{
|
| 2633 |
+
$node = $requestXML->createElement("STARTDATE");
|
| 2634 |
+
$requestString->appendChild($node);
|
| 2635 |
+
$node->appendChild($requestXML->createTextNode($this->startDate));
|
| 2636 |
+
}
|
| 2637 |
+
|
| 2638 |
+
if($this->endDate != null)
|
| 2639 |
+
{
|
| 2640 |
+
$node = $requestXML->createElement("ENDDATE");
|
| 2641 |
+
$requestString->appendChild($node);
|
| 2642 |
+
$node->appendChild($requestXML->createTextNode($this->endDate));
|
| 2643 |
+
}
|
| 2644 |
+
|
| 2645 |
+
if($this->eDCCDecision !== NULL)
|
| 2646 |
+
{
|
| 2647 |
+
$node = $requestXML->createElement("EDCCDECISION");
|
| 2648 |
+
$requestString->appendChild($node);
|
| 2649 |
+
$node->appendChild($requestXML->createTextNode($this->eDCCDecision));
|
| 2650 |
+
}
|
| 2651 |
+
|
| 2652 |
+
$node = $requestXML->createElement("HASH");
|
| 2653 |
+
$requestString->appendChild($node);
|
| 2654 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 2655 |
+
|
| 2656 |
+
return $requestXML->saveXML();
|
| 2657 |
+
}
|
| 2658 |
+
}
|
| 2659 |
+
|
| 2660 |
+
/**
|
| 2661 |
+
* Used for processing XML SecureCard Registrations through the WorldNet TPS XML Gateway.
|
| 2662 |
+
*
|
| 2663 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 2664 |
+
*/
|
| 2665 |
+
class XmlSubscriptionDelRequest extends Request
|
| 2666 |
+
{
|
| 2667 |
+
private $merchantRef;
|
| 2668 |
+
private $terminalId;
|
| 2669 |
+
private $dateTime;
|
| 2670 |
+
private $hash;
|
| 2671 |
+
|
| 2672 |
+
/**
|
| 2673 |
+
* Creates the SecureCard Registration/Update request for processing
|
| 2674 |
+
* through the WorldNetTPS XML Gateway
|
| 2675 |
+
*
|
| 2676 |
+
* @param merchantRef A unique subscription identifier. Alpha numeric and max size 48 chars.
|
| 2677 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 2678 |
+
*/
|
| 2679 |
+
public function XmlSubscriptionDelRequest($merchantRef,
|
| 2680 |
+
$terminalId)
|
| 2681 |
+
{
|
| 2682 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 2683 |
+
|
| 2684 |
+
$this->merchantRef = $merchantRef;
|
| 2685 |
+
$this->terminalId = $terminalId;
|
| 2686 |
+
}
|
| 2687 |
+
/**
|
| 2688 |
+
* Setter for hash value
|
| 2689 |
+
*
|
| 2690 |
+
* @param sharedSecret
|
| 2691 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2692 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2693 |
+
*/
|
| 2694 |
+
public function SetHash($sharedSecret)
|
| 2695 |
+
{
|
| 2696 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->merchantRef . $this->dateTime . $sharedSecret);
|
| 2697 |
+
}
|
| 2698 |
+
/**
|
| 2699 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 2700 |
+
*
|
| 2701 |
+
* @param sharedSecret
|
| 2702 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2703 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2704 |
+
*
|
| 2705 |
+
* @param testAccount
|
| 2706 |
+
* Boolean value defining Mode
|
| 2707 |
+
* true - This is a test account
|
| 2708 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 2709 |
+
*
|
| 2710 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 2711 |
+
*/
|
| 2712 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 2713 |
+
{
|
| 2714 |
+
$this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 2715 |
+
}
|
| 2716 |
+
|
| 2717 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 2718 |
+
{
|
| 2719 |
+
$this->SetHash($sharedSecret);
|
| 2720 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 2721 |
+
$response = new XmlSubscriptionDelResponse($responseString);
|
| 2722 |
+
return $response;
|
| 2723 |
+
}
|
| 2724 |
+
|
| 2725 |
+
public function GenerateXml()
|
| 2726 |
+
{
|
| 2727 |
+
$requestXML = new DOMDocument("1.0");
|
| 2728 |
+
$requestXML->formatOutput = true;
|
| 2729 |
+
|
| 2730 |
+
$requestString = $requestXML->createElement("DELETESUBSCRIPTION");
|
| 2731 |
+
$requestXML->appendChild($requestString);
|
| 2732 |
+
|
| 2733 |
+
$node = $requestXML->createElement("MERCHANTREF");
|
| 2734 |
+
$requestString->appendChild($node);
|
| 2735 |
+
$node->appendChild($requestXML->createTextNode($this->merchantRef));
|
| 2736 |
+
|
| 2737 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 2738 |
+
$requestString->appendChild($node);
|
| 2739 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 2740 |
+
|
| 2741 |
+
$node = $requestXML->createElement("DATETIME");
|
| 2742 |
+
$requestString->appendChild($node);
|
| 2743 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 2744 |
+
|
| 2745 |
+
$node = $requestXML->createElement("HASH");
|
| 2746 |
+
$requestString->appendChild($node);
|
| 2747 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 2748 |
+
|
| 2749 |
+
return $requestXML->saveXML();
|
| 2750 |
+
}
|
| 2751 |
+
}
|
| 2752 |
+
|
| 2753 |
+
/**
|
| 2754 |
+
* Used for processing XML SecureCard Registrations through the WorldNet TPS XML Gateway.
|
| 2755 |
+
*
|
| 2756 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 2757 |
+
*/
|
| 2758 |
+
class XmlSubscriptionPaymentRequest extends Request
|
| 2759 |
+
{
|
| 2760 |
+
private $terminalId;
|
| 2761 |
+
private $orderId;
|
| 2762 |
+
private $amount;
|
| 2763 |
+
private $subscriptionRef;
|
| 2764 |
+
private $cardCurrency;
|
| 2765 |
+
private $cardAmount;
|
| 2766 |
+
private $conversionRate;
|
| 2767 |
+
private $email;
|
| 2768 |
+
private $dateTime;
|
| 2769 |
+
private $hash;
|
| 2770 |
+
|
| 2771 |
+
private $foreignCurInfoSet = false;
|
| 2772 |
+
|
| 2773 |
+
/**
|
| 2774 |
+
* Setter for Email Address Value
|
| 2775 |
+
*
|
| 2776 |
+
* @param email Alpha-numeric field.
|
| 2777 |
+
*/
|
| 2778 |
+
public function SetEmail($email)
|
| 2779 |
+
{
|
| 2780 |
+
$this->email = $email;
|
| 2781 |
+
}
|
| 2782 |
+
/**
|
| 2783 |
+
* Setter for Foreign Currency Information
|
| 2784 |
+
*
|
| 2785 |
+
* @param cardCurrency ISO 4217 3 Digit Currency Code, e.g. EUR / USD / GBP
|
| 2786 |
+
* @param cardAmount (Amount X Conversion rate) Formatted to two decimal places
|
| 2787 |
+
* @param conversionRate Converstion rate supplied in rate response
|
| 2788 |
+
*/
|
| 2789 |
+
public function SetForeignCurrencyInformation($cardCurrency, $cardAmount, $conversionRate)
|
| 2790 |
+
{
|
| 2791 |
+
$this->cardCurrency = $cardCurrency;
|
| 2792 |
+
$this->cardAmount = $cardAmount;
|
| 2793 |
+
$this->conversionRate = $conversionRate;
|
| 2794 |
+
|
| 2795 |
+
$this->foreignCurInfoSet = true;
|
| 2796 |
+
}
|
| 2797 |
+
|
| 2798 |
+
public function XmlSubscriptionPaymentRequest($terminalId,
|
| 2799 |
+
$orderId,
|
| 2800 |
+
$amount,
|
| 2801 |
+
$subscriptionRef)
|
| 2802 |
+
{
|
| 2803 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 2804 |
+
|
| 2805 |
+
$this->terminalId = $terminalId;
|
| 2806 |
+
$this->orderId = $orderId;
|
| 2807 |
+
$this->amount = $amount;
|
| 2808 |
+
$this->subscriptionRef = $subscriptionRef;
|
| 2809 |
+
}
|
| 2810 |
+
/**
|
| 2811 |
+
* Setter for hash value
|
| 2812 |
+
*
|
| 2813 |
+
* @param sharedSecret
|
| 2814 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2815 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2816 |
+
*/
|
| 2817 |
+
public function SetHash($sharedSecret)
|
| 2818 |
+
{
|
| 2819 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->orderId . $this->subscriptionRef . $this->amount . $this->dateTime . $sharedSecret);
|
| 2820 |
+
}
|
| 2821 |
+
/**
|
| 2822 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 2823 |
+
*
|
| 2824 |
+
* @param sharedSecret
|
| 2825 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2826 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2827 |
+
*
|
| 2828 |
+
* @param testAccount
|
| 2829 |
+
* Boolean value defining Mode
|
| 2830 |
+
* true - This is a test account
|
| 2831 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 2832 |
+
*
|
| 2833 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 2834 |
+
*/
|
| 2835 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 2836 |
+
{
|
| 2837 |
+
$this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 2838 |
+
}
|
| 2839 |
+
|
| 2840 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 2841 |
+
{
|
| 2842 |
+
$this->SetHash($sharedSecret);
|
| 2843 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 2844 |
+
$response = new XmlSubscriptionPaymentResponse($responseString);
|
| 2845 |
+
return $response;
|
| 2846 |
+
}
|
| 2847 |
+
|
| 2848 |
+
public function GenerateXml()
|
| 2849 |
+
{
|
| 2850 |
+
$requestXML = new DOMDocument("1.0");
|
| 2851 |
+
$requestXML->formatOutput = true;
|
| 2852 |
+
|
| 2853 |
+
$requestString = $requestXML->createElement("SUBSCRIPTIONPAYMENT");
|
| 2854 |
+
$requestXML->appendChild($requestString);
|
| 2855 |
+
|
| 2856 |
+
$node = $requestXML->createElement("ORDERID");
|
| 2857 |
+
$requestString->appendChild($node);
|
| 2858 |
+
$node->appendChild($requestXML->createTextNode($this->orderId));
|
| 2859 |
+
|
| 2860 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 2861 |
+
$requestString->appendChild($node);
|
| 2862 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 2863 |
+
|
| 2864 |
+
$node = $requestXML->createElement("AMOUNT");
|
| 2865 |
+
$requestString->appendChild($node);
|
| 2866 |
+
$node->appendChild($requestXML->createTextNode($this->amount));
|
| 2867 |
+
|
| 2868 |
+
$node = $requestXML->createElement("SUBSCRIPTIONREF");
|
| 2869 |
+
$requestString->appendChild($node);
|
| 2870 |
+
$node->appendChild($requestXML->createTextNode($this->subscriptionRef));
|
| 2871 |
+
|
| 2872 |
+
if($this->foreignCurInfoSet)
|
| 2873 |
+
{
|
| 2874 |
+
$dcNode = $requestXML->createElement("FOREIGNCURRENCYINFORMATION");
|
| 2875 |
+
$requestString->appendChild($dcNode );
|
| 2876 |
+
|
| 2877 |
+
$dcSubNode = $requestXML->createElement("CARDCURRENCY");
|
| 2878 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->cardCurrency));
|
| 2879 |
+
$dcNode->appendChild($dcSubNode);
|
| 2880 |
+
|
| 2881 |
+
$dcSubNode = $requestXML->createElement("CARDAMOUNT");
|
| 2882 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->cardAmount));
|
| 2883 |
+
$dcNode->appendChild($dcSubNode);
|
| 2884 |
+
|
| 2885 |
+
$dcSubNode = $requestXML->createElement("CONVERSIONRATE");
|
| 2886 |
+
$dcSubNode ->appendChild($requestXML->createTextNode($this->conversionRate));
|
| 2887 |
+
$dcNode->appendChild($dcSubNode);
|
| 2888 |
+
}
|
| 2889 |
+
|
| 2890 |
+
if($this->email !== NULL)
|
| 2891 |
+
{
|
| 2892 |
+
$node = $requestXML->createElement("EMAIL");
|
| 2893 |
+
$requestString->appendChild($node);
|
| 2894 |
+
$node->appendChild($requestXML->createTextNode($this->email));
|
| 2895 |
+
}
|
| 2896 |
+
|
| 2897 |
+
$node = $requestXML->createElement("DATETIME");
|
| 2898 |
+
$requestString->appendChild($node);
|
| 2899 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 2900 |
+
|
| 2901 |
+
$node = $requestXML->createElement("HASH");
|
| 2902 |
+
$requestString->appendChild($node);
|
| 2903 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 2904 |
+
|
| 2905 |
+
return $requestXML->saveXML();
|
| 2906 |
+
}
|
| 2907 |
+
}
|
| 2908 |
+
|
| 2909 |
+
/**
|
| 2910 |
+
* Used for processing XML Unreferenced Refund through the WorldNet TPS XML Gateway.
|
| 2911 |
+
*
|
| 2912 |
+
* Basic request is configured on initialisation and optional fields can be configured.
|
| 2913 |
+
*/
|
| 2914 |
+
class XmlUnreferencedRefundRequest extends Request
|
| 2915 |
+
{
|
| 2916 |
+
private $orderId;
|
| 2917 |
+
private $terminalId;
|
| 2918 |
+
private $secureCardMerchantRef;
|
| 2919 |
+
private $amount;
|
| 2920 |
+
private $email;
|
| 2921 |
+
private $autoReady;
|
| 2922 |
+
private $dateTime;
|
| 2923 |
+
private $hash;
|
| 2924 |
+
private $operator;
|
| 2925 |
+
private $description;
|
| 2926 |
+
|
| 2927 |
+
/**
|
| 2928 |
+
* Creates the SecureCard Registration/Update request for processing
|
| 2929 |
+
* through the WorldNetTPS XML Gateway
|
| 2930 |
+
*
|
| 2931 |
+
* @param merchantRef A unique subscription identifier. Alpha numeric and max size 48 chars.
|
| 2932 |
+
* @param terminalId Terminal ID provided by WorldNet TPS
|
| 2933 |
+
*/
|
| 2934 |
+
public function XmlUnreferencedRefundRequest($orderId,
|
| 2935 |
+
$terminalId,
|
| 2936 |
+
$secureCardMerchantRef,
|
| 2937 |
+
$amount,
|
| 2938 |
+
$operator)
|
| 2939 |
+
{
|
| 2940 |
+
$this->dateTime = $this->GetFormattedDate();
|
| 2941 |
+
|
| 2942 |
+
$this->orderId = $orderId;
|
| 2943 |
+
$this->terminalId = $terminalId;
|
| 2944 |
+
$this->secureCardMerchantRef = $secureCardMerchantRef;
|
| 2945 |
+
$this->amount = $amount;
|
| 2946 |
+
$this->operator = $operator;
|
| 2947 |
+
}
|
| 2948 |
+
/**
|
| 2949 |
+
* Setter for Transaction Description
|
| 2950 |
+
*
|
| 2951 |
+
* @param email Alpha-numeric field.
|
| 2952 |
+
*/
|
| 2953 |
+
public function SetDescription($description)
|
| 2954 |
+
{
|
| 2955 |
+
$this->description = $description;
|
| 2956 |
+
}
|
| 2957 |
+
/**
|
| 2958 |
+
* Setter for Email Address Value
|
| 2959 |
+
*
|
| 2960 |
+
* @param email Alpha-numeric field.
|
| 2961 |
+
*/
|
| 2962 |
+
public function SetEmail($email)
|
| 2963 |
+
{
|
| 2964 |
+
$this->email = $email;
|
| 2965 |
+
}
|
| 2966 |
+
/**
|
| 2967 |
+
* Setter for Auto Ready Value
|
| 2968 |
+
*
|
| 2969 |
+
* @param autoReady
|
| 2970 |
+
* Auto Ready is an optional parameter and defines if the transaction should be settled automatically.
|
| 2971 |
+
*
|
| 2972 |
+
* Accepted Values :
|
| 2973 |
+
*
|
| 2974 |
+
* Y - Transaction will be settled in next batch
|
| 2975 |
+
* N - Transaction will not be settled until user changes state in Merchant Selfcare Section
|
| 2976 |
+
*/
|
| 2977 |
+
public function SetAutoReady($autoReady)
|
| 2978 |
+
{
|
| 2979 |
+
$this->autoReady = $autoReady;
|
| 2980 |
+
}
|
| 2981 |
+
/**
|
| 2982 |
+
* Setter for hash value
|
| 2983 |
+
*
|
| 2984 |
+
* @param sharedSecret
|
| 2985 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2986 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2987 |
+
*/
|
| 2988 |
+
public function SetHash($sharedSecret)
|
| 2989 |
+
{
|
| 2990 |
+
$this->hash = $this->GetRequestHash($this->terminalId . $this->orderId . $this->amount . $this->dateTime . $sharedSecret);
|
| 2991 |
+
}
|
| 2992 |
+
/**
|
| 2993 |
+
* Method to process transaction and return parsed response from the WorldNet TPS XML Gateway
|
| 2994 |
+
*
|
| 2995 |
+
* @param sharedSecret
|
| 2996 |
+
* Shared secret either supplied by WorldNet TPS or configured under
|
| 2997 |
+
* Terminal Settings in the Merchant Selfcare System.
|
| 2998 |
+
*
|
| 2999 |
+
* @param testAccount
|
| 3000 |
+
* Boolean value defining Mode
|
| 3001 |
+
* true - This is a test account
|
| 3002 |
+
* false - Production mode, all transactions will be processed by Issuer.
|
| 3003 |
+
*
|
| 3004 |
+
* @return XmlSecureCardRegResponse containing an error or the parsed payment response.
|
| 3005 |
+
*/
|
| 3006 |
+
public function ProcessRequest($sharedSecret, $testAccount)
|
| 3007 |
+
{
|
| 3008 |
+
$this->ProcessRequestToGateway($sharedSecret, $testAccount, "worldnet");
|
| 3009 |
+
}
|
| 3010 |
+
|
| 3011 |
+
public function ProcessRequestToGateway($sharedSecret, $testAccount, $gateway)
|
| 3012 |
+
{
|
| 3013 |
+
$this->SetHash($sharedSecret);
|
| 3014 |
+
$responseString = $this->SendRequestToGateway($this->GenerateXml(), $testAccount, $gateway);
|
| 3015 |
+
$response = new XmlUnreferencedRefundResponse($responseString);
|
| 3016 |
+
return $response;
|
| 3017 |
+
}
|
| 3018 |
+
|
| 3019 |
+
public function GenerateXml()
|
| 3020 |
+
{
|
| 3021 |
+
$requestXML = new DOMDocument("1.0");
|
| 3022 |
+
$requestXML->formatOutput = true;
|
| 3023 |
+
|
| 3024 |
+
$requestString = $requestXML->createElement("UNREFERENCEDREFUND");
|
| 3025 |
+
$requestXML->appendChild($requestString);
|
| 3026 |
+
|
| 3027 |
+
$node = $requestXML->createElement("ORDERID");
|
| 3028 |
+
$requestString->appendChild($node);
|
| 3029 |
+
$node->appendChild($requestXML->createTextNode($this->orderId));
|
| 3030 |
+
|
| 3031 |
+
$node = $requestXML->createElement("TERMINALID");
|
| 3032 |
+
$requestString->appendChild($node);
|
| 3033 |
+
$node->appendChild($requestXML->createTextNode($this->terminalId));
|
| 3034 |
+
|
| 3035 |
+
$node = $requestXML->createElement("CARDREFERENCE");
|
| 3036 |
+
$requestString->appendChild($node);
|
| 3037 |
+
$node->appendChild($requestXML->createTextNode($this->secureCardMerchantRef));
|
| 3038 |
+
|
| 3039 |
+
$node = $requestXML->createElement("AMOUNT");
|
| 3040 |
+
$requestString->appendChild($node);
|
| 3041 |
+
$node->appendChild($requestXML->createTextNode($this->amount));
|
| 3042 |
+
|
| 3043 |
+
if($this->email !== NULL)
|
| 3044 |
+
{
|
| 3045 |
+
$node = $requestXML->createElement("EMAIL");
|
| 3046 |
+
$requestString->appendChild($node);
|
| 3047 |
+
$node->appendChild($requestXML->createTextNode($this->email));
|
| 3048 |
+
}
|
| 3049 |
+
|
| 3050 |
+
if($this->autoReady !== NULL)
|
| 3051 |
+
{
|
| 3052 |
+
$node = $requestXML->createElement("AUTOREADY");
|
| 3053 |
+
$requestString->appendChild($node);
|
| 3054 |
+
$node->appendChild($requestXML->createTextNode($this->autoReady));
|
| 3055 |
+
}
|
| 3056 |
+
|
| 3057 |
+
$node = $requestXML->createElement("DATETIME");
|
| 3058 |
+
$requestString->appendChild($node);
|
| 3059 |
+
$node->appendChild($requestXML->createTextNode($this->dateTime));
|
| 3060 |
+
|
| 3061 |
+
$node = $requestXML->createElement("HASH");
|
| 3062 |
+
$requestString->appendChild($node);
|
| 3063 |
+
$node->appendChild($requestXML->createTextNode($this->hash));
|
| 3064 |
+
|
| 3065 |
+
$node = $requestXML->createElement("OPERATOR");
|
| 3066 |
+
$requestString->appendChild($node);
|
| 3067 |
+
$node->appendChild($requestXML->createTextNode($this->operator));
|
| 3068 |
+
|
| 3069 |
+
if($this->description !== NULL)
|
| 3070 |
+
{
|
| 3071 |
+
$node = $requestXML->createElement("DESCRIPTION");
|
| 3072 |
+
$requestString->appendChild($node);
|
| 3073 |
+
$node->appendChild($requestXML->createTextNode($this->description));
|
| 3074 |
+
}
|
| 3075 |
+
|
| 3076 |
+
return $requestXML->saveXML();
|
| 3077 |
+
}
|
| 3078 |
+
}
|
| 3079 |
+
|
| 3080 |
+
/**
|
| 3081 |
+
* Holder class for parsed response. If there was an error there will be an error string
|
| 3082 |
+
* otherwise all values will be populated with the parsed payment response values.
|
| 3083 |
+
*
|
| 3084 |
+
* IsError should be checked before accessing any fields.
|
| 3085 |
+
*
|
| 3086 |
+
* ErrorString will contain the error if one occurred.
|
| 3087 |
+
*/
|
| 3088 |
+
class XmlAuthResponse
|
| 3089 |
+
{
|
| 3090 |
+
private $isError = false;
|
| 3091 |
+
public function IsError()
|
| 3092 |
+
{
|
| 3093 |
+
return $this->isError;
|
| 3094 |
+
}
|
| 3095 |
+
|
| 3096 |
+
private $errorString;
|
| 3097 |
+
public function ErrorString()
|
| 3098 |
+
{
|
| 3099 |
+
return $this->errorString;
|
| 3100 |
+
}
|
| 3101 |
+
|
| 3102 |
+
private $responseCode;
|
| 3103 |
+
public function ResponseCode()
|
| 3104 |
+
{
|
| 3105 |
+
return $this->responseCode;
|
| 3106 |
+
}
|
| 3107 |
+
|
| 3108 |
+
private $responseText;
|
| 3109 |
+
public function ResponseText()
|
| 3110 |
+
{
|
| 3111 |
+
return $this->responseText;
|
| 3112 |
+
}
|
| 3113 |
+
|
| 3114 |
+
private $approvalCode;
|
| 3115 |
+
public function ApprovalCode()
|
| 3116 |
+
{
|
| 3117 |
+
return $this->approvalCode;
|
| 3118 |
+
}
|
| 3119 |
+
|
| 3120 |
+
private $dateTime;
|
| 3121 |
+
public function DateTime()
|
| 3122 |
+
{
|
| 3123 |
+
return $this->dateTime;
|
| 3124 |
+
}
|
| 3125 |
+
|
| 3126 |
+
private $avsResponse;
|
| 3127 |
+
public function AvsResponse()
|
| 3128 |
+
{
|
| 3129 |
+
return $this->avsResponse;
|
| 3130 |
+
}
|
| 3131 |
+
|
| 3132 |
+
private $cvvResponse;
|
| 3133 |
+
public function CvvResponse()
|
| 3134 |
+
{
|
| 3135 |
+
return $this->cvvResponse;
|
| 3136 |
+
}
|
| 3137 |
+
|
| 3138 |
+
private $hash;
|
| 3139 |
+
public function Hash()
|
| 3140 |
+
{
|
| 3141 |
+
return $this->hash;
|
| 3142 |
+
}
|
| 3143 |
+
|
| 3144 |
+
public function XmlAuthResponse($responseXml)
|
| 3145 |
+
{
|
| 3146 |
+
$doc = new DOMDocument();
|
| 3147 |
+
$doc->loadXML($responseXml);
|
| 3148 |
+
try
|
| 3149 |
+
{
|
| 3150 |
+
if (strpos($responseXml, "ERROR"))
|
| 3151 |
+
{
|
| 3152 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 3153 |
+
foreach( $responseNodes as $node )
|
| 3154 |
+
{
|
| 3155 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 3156 |
+
}
|
| 3157 |
+
$this->isError = true;
|
| 3158 |
+
}
|
| 3159 |
+
else if (strpos($responseXml, "PAYMENTRESPONSE"))
|
| 3160 |
+
{
|
| 3161 |
+
$responseNodes = $doc->getElementsByTagName("PAYMENTRESPONSE");
|
| 3162 |
+
|
| 3163 |
+
foreach( $responseNodes as $node )
|
| 3164 |
+
{
|
| 3165 |
+
$this->responseCode = $node->getElementsByTagName('RESPONSECODE')->item(0)->nodeValue;
|
| 3166 |
+
$this->responseText = $node->getElementsByTagName('RESPONSETEXT')->item(0)->nodeValue;
|
| 3167 |
+
$this->approvalCode = $node->getElementsByTagName('APPROVALCODE')->item(0)->nodeValue;
|
| 3168 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 3169 |
+
$this->avsResponse = $node->getElementsByTagName('AVSRESPONSE')->item(0)->nodeValue;
|
| 3170 |
+
$this->cvvResponse = $node->getElementsByTagName('CVVRESPONSE')->item(0)->nodeValue;
|
| 3171 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 3172 |
+
}
|
| 3173 |
+
}
|
| 3174 |
+
else
|
| 3175 |
+
{
|
| 3176 |
+
throw new Exception("Invalid Response");
|
| 3177 |
+
}
|
| 3178 |
+
}
|
| 3179 |
+
catch (Exception $e)
|
| 3180 |
+
{
|
| 3181 |
+
$this->isError = true;
|
| 3182 |
+
$this->errorString = $e->getMessage();
|
| 3183 |
+
}
|
| 3184 |
+
}
|
| 3185 |
+
}
|
| 3186 |
+
|
| 3187 |
+
/**
|
| 3188 |
+
* Holder class for parsed response. If there was an error there will be an error string
|
| 3189 |
+
* otherwise all values will be populated with the parsed payment response values.
|
| 3190 |
+
*
|
| 3191 |
+
* IsError should be checked before accessing any fields.
|
| 3192 |
+
*
|
| 3193 |
+
* ErrorString will contain the error if one occurred.
|
| 3194 |
+
*/
|
| 3195 |
+
class XmlRefundResponse
|
| 3196 |
+
{
|
| 3197 |
+
private $isError = false;
|
| 3198 |
+
public function IsError()
|
| 3199 |
+
{
|
| 3200 |
+
return $this->isError;
|
| 3201 |
+
}
|
| 3202 |
+
|
| 3203 |
+
private $errorString;
|
| 3204 |
+
public function ErrorString()
|
| 3205 |
+
{
|
| 3206 |
+
return $this->errorString;
|
| 3207 |
+
}
|
| 3208 |
+
|
| 3209 |
+
private $responseCode;
|
| 3210 |
+
public function ResponseCode()
|
| 3211 |
+
{
|
| 3212 |
+
return $this->responseCode;
|
| 3213 |
+
}
|
| 3214 |
+
|
| 3215 |
+
private $responseText;
|
| 3216 |
+
public function ResponseText()
|
| 3217 |
+
{
|
| 3218 |
+
return $this->responseText;
|
| 3219 |
+
}
|
| 3220 |
+
|
| 3221 |
+
private $approvalCode;
|
| 3222 |
+
public function OrderId()
|
| 3223 |
+
{
|
| 3224 |
+
return $this->orderId;
|
| 3225 |
+
}
|
| 3226 |
+
|
| 3227 |
+
private $dateTime;
|
| 3228 |
+
public function DateTime()
|
| 3229 |
+
{
|
| 3230 |
+
return $this->dateTime;
|
| 3231 |
+
}
|
| 3232 |
+
|
| 3233 |
+
private $hash;
|
| 3234 |
+
public function Hash()
|
| 3235 |
+
{
|
| 3236 |
+
return $this->hash;
|
| 3237 |
+
}
|
| 3238 |
+
|
| 3239 |
+
public function XmlRefundResponse($responseXml)
|
| 3240 |
+
{
|
| 3241 |
+
$doc = new DOMDocument();
|
| 3242 |
+
$doc->loadXML($responseXml);
|
| 3243 |
+
try
|
| 3244 |
+
{
|
| 3245 |
+
if (strpos($responseXml, "ERROR"))
|
| 3246 |
+
{
|
| 3247 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 3248 |
+
foreach( $responseNodes as $node )
|
| 3249 |
+
{
|
| 3250 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 3251 |
+
}
|
| 3252 |
+
$this->isError = true;
|
| 3253 |
+
}
|
| 3254 |
+
else if (strpos($responseXml, "REFUNDRESPONSE"))
|
| 3255 |
+
{
|
| 3256 |
+
$responseNodes = $doc->getElementsByTagName("REFUNDRESPONSE");
|
| 3257 |
+
|
| 3258 |
+
foreach( $responseNodes as $node )
|
| 3259 |
+
{
|
| 3260 |
+
$this->responseCode = $node->getElementsByTagName('RESPONSECODE')->item(0)->nodeValue;
|
| 3261 |
+
$this->responseText = $node->getElementsByTagName('RESPONSETEXT')->item(0)->nodeValue;
|
| 3262 |
+
$this->orderId = $node->getElementsByTagName('ORDERID')->item(0)->nodeValue;
|
| 3263 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 3264 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 3265 |
+
}
|
| 3266 |
+
}
|
| 3267 |
+
else
|
| 3268 |
+
{
|
| 3269 |
+
throw new Exception("Invalid Response");
|
| 3270 |
+
}
|
| 3271 |
+
}
|
| 3272 |
+
catch (Exception $e)
|
| 3273 |
+
{
|
| 3274 |
+
$this->isError = true;
|
| 3275 |
+
$this->errorString = $e->getMessage();
|
| 3276 |
+
}
|
| 3277 |
+
}
|
| 3278 |
+
}
|
| 3279 |
+
|
| 3280 |
+
/**
|
| 3281 |
+
* Holder class for parsed response. If there was an error there will be an error string
|
| 3282 |
+
* otherwise all values will be populated with the parsed payment response values.
|
| 3283 |
+
*
|
| 3284 |
+
* IsError should be checked before accessing any fields.
|
| 3285 |
+
*
|
| 3286 |
+
* ErrorString will contain the error if one occurred.
|
| 3287 |
+
*/
|
| 3288 |
+
class XmlPreAuthResponse
|
| 3289 |
+
{
|
| 3290 |
+
private $isError = false;
|
| 3291 |
+
public function IsError()
|
| 3292 |
+
{
|
| 3293 |
+
return $this->isError;
|
| 3294 |
+
}
|
| 3295 |
+
|
| 3296 |
+
private $errorString;
|
| 3297 |
+
public function ErrorString()
|
| 3298 |
+
{
|
| 3299 |
+
return $this->errorString;
|
| 3300 |
+
}
|
| 3301 |
+
|
| 3302 |
+
private $responseCode;
|
| 3303 |
+
public function ResponseCode()
|
| 3304 |
+
{
|
| 3305 |
+
return $this->responseCode;
|
| 3306 |
+
}
|
| 3307 |
+
|
| 3308 |
+
private $responseText;
|
| 3309 |
+
public function ResponseText()
|
| 3310 |
+
{
|
| 3311 |
+
return $this->responseText;
|
| 3312 |
+
}
|
| 3313 |
+
|
| 3314 |
+
private $approvalCode;
|
| 3315 |
+
public function ApprovalCode()
|
| 3316 |
+
{
|
| 3317 |
+
return $this->approvalCode;
|
| 3318 |
+
}
|
| 3319 |
+
|
| 3320 |
+
private $dateTime;
|
| 3321 |
+
public function DateTime()
|
| 3322 |
+
{
|
| 3323 |
+
return $this->dateTime;
|
| 3324 |
+
}
|
| 3325 |
+
|
| 3326 |
+
private $avsResponse;
|
| 3327 |
+
public function AvsResponse()
|
| 3328 |
+
{
|
| 3329 |
+
return $this->avsResponse;
|
| 3330 |
+
}
|
| 3331 |
+
|
| 3332 |
+
private $cvvResponse;
|
| 3333 |
+
public function CvvResponse()
|
| 3334 |
+
{
|
| 3335 |
+
return $this->cvvResponse;
|
| 3336 |
+
}
|
| 3337 |
+
|
| 3338 |
+
private $hash;
|
| 3339 |
+
public function Hash()
|
| 3340 |
+
{
|
| 3341 |
+
return $this->hash;
|
| 3342 |
+
}
|
| 3343 |
+
|
| 3344 |
+
public function XmlPreAuthResponse($responseXml)
|
| 3345 |
+
{
|
| 3346 |
+
$doc = new DOMDocument();
|
| 3347 |
+
$doc->loadXML($responseXml);
|
| 3348 |
+
try
|
| 3349 |
+
{
|
| 3350 |
+
if (strpos($responseXml, "ERROR"))
|
| 3351 |
+
{
|
| 3352 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 3353 |
+
foreach( $responseNodes as $node )
|
| 3354 |
+
{
|
| 3355 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 3356 |
+
}
|
| 3357 |
+
$this->isError = true;
|
| 3358 |
+
}
|
| 3359 |
+
else if (strpos($responseXml, "PREAUTHRESPONSE"))
|
| 3360 |
+
{
|
| 3361 |
+
$responseNodes = $doc->getElementsByTagName("PREAUTHRESPONSE");
|
| 3362 |
+
|
| 3363 |
+
foreach( $responseNodes as $node )
|
| 3364 |
+
{
|
| 3365 |
+
$this->responseCode = $node->getElementsByTagName('RESPONSECODE')->item(0)->nodeValue;
|
| 3366 |
+
$this->responseText = $node->getElementsByTagName('RESPONSETEXT')->item(0)->nodeValue;
|
| 3367 |
+
$this->approvalCode = $node->getElementsByTagName('APPROVALCODE')->item(0)->nodeValue;
|
| 3368 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 3369 |
+
$this->avsResponse = $node->getElementsByTagName('AVSRESPONSE')->item(0)->nodeValue;
|
| 3370 |
+
$this->cvvResponse = $node->getElementsByTagName('CVVRESPONSE')->item(0)->nodeValue;
|
| 3371 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 3372 |
+
}
|
| 3373 |
+
}
|
| 3374 |
+
else
|
| 3375 |
+
{
|
| 3376 |
+
throw new Exception("Invalid Response");
|
| 3377 |
+
}
|
| 3378 |
+
}
|
| 3379 |
+
catch (Exception $e)
|
| 3380 |
+
{
|
| 3381 |
+
$this->isError = true;
|
| 3382 |
+
$this->errorString = $e->getMessage();
|
| 3383 |
+
}
|
| 3384 |
+
}
|
| 3385 |
+
}
|
| 3386 |
+
|
| 3387 |
+
/**
|
| 3388 |
+
* Holder class for parsed response. If there was an error there will be an error string
|
| 3389 |
+
* otherwise all values will be populated with the parsed payment response values.
|
| 3390 |
+
*
|
| 3391 |
+
* IsError should be checked before accessing any fields.
|
| 3392 |
+
*
|
| 3393 |
+
* ErrorString will contain the error if one occurred.
|
| 3394 |
+
*/
|
| 3395 |
+
class XmlPreAuthCompletionResponse
|
| 3396 |
+
{
|
| 3397 |
+
private $isError = false;
|
| 3398 |
+
public function IsError()
|
| 3399 |
+
{
|
| 3400 |
+
return $this->isError;
|
| 3401 |
+
}
|
| 3402 |
+
|
| 3403 |
+
private $errorString;
|
| 3404 |
+
public function ErrorString()
|
| 3405 |
+
{
|
| 3406 |
+
return $this->errorString;
|
| 3407 |
+
}
|
| 3408 |
+
|
| 3409 |
+
private $responseCode;
|
| 3410 |
+
public function ResponseCode()
|
| 3411 |
+
{
|
| 3412 |
+
return $this->responseCode;
|
| 3413 |
+
}
|
| 3414 |
+
|
| 3415 |
+
private $responseText;
|
| 3416 |
+
public function ResponseText()
|
| 3417 |
+
{
|
| 3418 |
+
return $this->responseText;
|
| 3419 |
+
}
|
| 3420 |
+
|
| 3421 |
+
private $approvalCode;
|
| 3422 |
+
public function ApprovalCode()
|
| 3423 |
+
{
|
| 3424 |
+
return $this->approvalCode;
|
| 3425 |
+
}
|
| 3426 |
+
|
| 3427 |
+
private $dateTime;
|
| 3428 |
+
public function DateTime()
|
| 3429 |
+
{
|
| 3430 |
+
return $this->dateTime;
|
| 3431 |
+
}
|
| 3432 |
+
|
| 3433 |
+
private $avsResponse;
|
| 3434 |
+
public function AvsResponse()
|
| 3435 |
+
{
|
| 3436 |
+
return $this->avsResponse;
|
| 3437 |
+
}
|
| 3438 |
+
|
| 3439 |
+
private $cvvResponse;
|
| 3440 |
+
public function CvvResponse()
|
| 3441 |
+
{
|
| 3442 |
+
return $this->cvvResponse;
|
| 3443 |
+
}
|
| 3444 |
+
|
| 3445 |
+
private $hash;
|
| 3446 |
+
public function Hash()
|
| 3447 |
+
{
|
| 3448 |
+
return $this->hash;
|
| 3449 |
+
}
|
| 3450 |
+
|
| 3451 |
+
public function XmlPreAuthCompletionResponse($responseXml)
|
| 3452 |
+
{
|
| 3453 |
+
$doc = new DOMDocument();
|
| 3454 |
+
$doc->loadXML($responseXml);
|
| 3455 |
+
try
|
| 3456 |
+
{
|
| 3457 |
+
if (strpos($responseXml, "ERROR"))
|
| 3458 |
+
{
|
| 3459 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 3460 |
+
foreach( $responseNodes as $node )
|
| 3461 |
+
{
|
| 3462 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 3463 |
+
}
|
| 3464 |
+
$this->isError = true;
|
| 3465 |
+
}
|
| 3466 |
+
else if (strpos($responseXml, "PREAUTHCOMPLETIONRESPONSE"))
|
| 3467 |
+
{
|
| 3468 |
+
$responseNodes = $doc->getElementsByTagName("PREAUTHCOMPLETIONRESPONSE");
|
| 3469 |
+
|
| 3470 |
+
foreach( $responseNodes as $node )
|
| 3471 |
+
{
|
| 3472 |
+
$this->responseCode = $node->getElementsByTagName('RESPONSECODE')->item(0)->nodeValue;
|
| 3473 |
+
$this->responseText = $node->getElementsByTagName('RESPONSETEXT')->item(0)->nodeValue;
|
| 3474 |
+
$this->approvalCode = $node->getElementsByTagName('APPROVALCODE')->item(0)->nodeValue;
|
| 3475 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 3476 |
+
$this->avsResponse = $node->getElementsByTagName('AVSRESPONSE')->item(0)->nodeValue;
|
| 3477 |
+
$this->cvvResponse = $node->getElementsByTagName('CVVRESPONSE')->item(0)->nodeValue;
|
| 3478 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 3479 |
+
}
|
| 3480 |
+
}
|
| 3481 |
+
else
|
| 3482 |
+
{
|
| 3483 |
+
throw new Exception("Invalid Response");
|
| 3484 |
+
}
|
| 3485 |
+
}
|
| 3486 |
+
catch (Exception $e)
|
| 3487 |
+
{
|
| 3488 |
+
$this->isError = true;
|
| 3489 |
+
$this->errorString = $e->getMessage();
|
| 3490 |
+
}
|
| 3491 |
+
}
|
| 3492 |
+
}
|
| 3493 |
+
|
| 3494 |
+
/**
|
| 3495 |
+
* Holder class for parsed response. If there was an error there will be an error string
|
| 3496 |
+
* otherwise all values will be populated with the parsed payment response values.
|
| 3497 |
+
*
|
| 3498 |
+
* IsError should be checked before accessing any fields.
|
| 3499 |
+
*
|
| 3500 |
+
* ErrorString will contain the error if one occurred.
|
| 3501 |
+
*/
|
| 3502 |
+
class XmlRateResponse
|
| 3503 |
+
{
|
| 3504 |
+
private $isError = false;
|
| 3505 |
+
public function IsError()
|
| 3506 |
+
{
|
| 3507 |
+
return $this->isError;
|
| 3508 |
+
}
|
| 3509 |
+
|
| 3510 |
+
private $errorString;
|
| 3511 |
+
public function ErrorString()
|
| 3512 |
+
{
|
| 3513 |
+
return $this->errorString;
|
| 3514 |
+
}
|
| 3515 |
+
|
| 3516 |
+
private $terminalCurrency;
|
| 3517 |
+
public function TerminalCurrency()
|
| 3518 |
+
{
|
| 3519 |
+
return $this->terminalCurrency;
|
| 3520 |
+
}
|
| 3521 |
+
|
| 3522 |
+
private $cardCurrency;
|
| 3523 |
+
public function CardCurrency()
|
| 3524 |
+
{
|
| 3525 |
+
return $this->cardCurrency;
|
| 3526 |
+
}
|
| 3527 |
+
|
| 3528 |
+
private $conversionRate;
|
| 3529 |
+
public function ConversionRate()
|
| 3530 |
+
{
|
| 3531 |
+
return $this->conversionRate;
|
| 3532 |
+
}
|
| 3533 |
+
private $foreignAmount;
|
| 3534 |
+
public function ForeignAmount()
|
| 3535 |
+
{
|
| 3536 |
+
return $this->foreignAmount;
|
| 3537 |
+
}
|
| 3538 |
+
|
| 3539 |
+
private $dateTime;
|
| 3540 |
+
public function DateTime()
|
| 3541 |
+
{
|
| 3542 |
+
return $this->dateTime;
|
| 3543 |
+
}
|
| 3544 |
+
|
| 3545 |
+
private $hash;
|
| 3546 |
+
public function Hash()
|
| 3547 |
+
{
|
| 3548 |
+
return $this->hash;
|
| 3549 |
+
}
|
| 3550 |
+
|
| 3551 |
+
public function XmlRateResponse($responseXml)
|
| 3552 |
+
{
|
| 3553 |
+
$doc = new DOMDocument();
|
| 3554 |
+
$doc->loadXML($responseXml);
|
| 3555 |
+
try
|
| 3556 |
+
{
|
| 3557 |
+
|
| 3558 |
+
if (strpos($responseXml, "ERROR"))
|
| 3559 |
+
{
|
| 3560 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 3561 |
+
foreach( $responseNodes as $node )
|
| 3562 |
+
{
|
| 3563 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 3564 |
+
}
|
| 3565 |
+
$this->isError = true;
|
| 3566 |
+
}
|
| 3567 |
+
else if (strpos($responseXml, "CARDCURRENCYRATERESPONSE"))
|
| 3568 |
+
{
|
| 3569 |
+
$responseNodes = $doc->getElementsByTagName("CARDCURRENCYRATERESPONSE");
|
| 3570 |
+
|
| 3571 |
+
foreach( $responseNodes as $node )
|
| 3572 |
+
{
|
| 3573 |
+
$this->terminalCurrency = $node->getElementsByTagName('TERMINALCURRENCY')->item(0)->nodeValue;
|
| 3574 |
+
$this->cardCurrency = $node->getElementsByTagName('CARDCURRENCY')->item(0)->nodeValue;
|
| 3575 |
+
$this->conversionRate = $node->getElementsByTagName('CONVERSIONRATE')->item(0)->nodeValue;
|
| 3576 |
+
$this->foreignAmount = $node->getElementsByTagName('FOREIGNAMOUNT')->item(0)->nodeValue;
|
| 3577 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 3578 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 3579 |
+
}
|
| 3580 |
+
}
|
| 3581 |
+
else
|
| 3582 |
+
{
|
| 3583 |
+
throw new Exception("Invalid Response");
|
| 3584 |
+
}
|
| 3585 |
+
}
|
| 3586 |
+
catch (Exception $e)
|
| 3587 |
+
{
|
| 3588 |
+
$this->isError = true;
|
| 3589 |
+
$this->errorString = $e->getMessage();
|
| 3590 |
+
}
|
| 3591 |
+
}
|
| 3592 |
+
}
|
| 3593 |
+
|
| 3594 |
+
/**
|
| 3595 |
+
* Base holder class for parsed SecureCard response. If there was an error there will be an error string
|
| 3596 |
+
* otherwise all values will be populated with the parsed payment response values.
|
| 3597 |
+
*/
|
| 3598 |
+
class XmlSecureCardResponse
|
| 3599 |
+
{
|
| 3600 |
+
protected $isError = false;
|
| 3601 |
+
public function IsError()
|
| 3602 |
+
{
|
| 3603 |
+
return $this->isError;
|
| 3604 |
+
}
|
| 3605 |
+
|
| 3606 |
+
protected $errorString;
|
| 3607 |
+
public function ErrorString()
|
| 3608 |
+
{
|
| 3609 |
+
return $this->errorString;
|
| 3610 |
+
}
|
| 3611 |
+
|
| 3612 |
+
protected $errorCode;
|
| 3613 |
+
public function ErrorCode()
|
| 3614 |
+
{
|
| 3615 |
+
return $this->errorCode;
|
| 3616 |
+
}
|
| 3617 |
+
|
| 3618 |
+
protected $merchantRef;
|
| 3619 |
+
public function MerchantReference()
|
| 3620 |
+
{
|
| 3621 |
+
return $this->merchantRef;
|
| 3622 |
+
}
|
| 3623 |
+
|
| 3624 |
+
protected $cardRef;
|
| 3625 |
+
public function CardReference()
|
| 3626 |
+
{
|
| 3627 |
+
return $this->cardRef;
|
| 3628 |
+
}
|
| 3629 |
+
|
| 3630 |
+
protected $dateTime;
|
| 3631 |
+
public function DateTime()
|
| 3632 |
+
{
|
| 3633 |
+
return $this->dateTime;
|
| 3634 |
+
}
|
| 3635 |
+
|
| 3636 |
+
protected $hash;
|
| 3637 |
+
public function Hash()
|
| 3638 |
+
{
|
| 3639 |
+
return $this->hash;
|
| 3640 |
+
}
|
| 3641 |
+
}
|
| 3642 |
+
|
| 3643 |
+
/**
|
| 3644 |
+
* Holder class for parsed SecureCard registration response.
|
| 3645 |
+
*/
|
| 3646 |
+
class XmlSecureCardRegResponse extends XmlSecureCardResponse
|
| 3647 |
+
{
|
| 3648 |
+
public function XmlSecureCardRegResponse($responseXml)
|
| 3649 |
+
{
|
| 3650 |
+
$doc = new DOMDocument();
|
| 3651 |
+
$doc->loadXML($responseXml);
|
| 3652 |
+
try
|
| 3653 |
+
{
|
| 3654 |
+
if (strpos($responseXml, "ERROR"))
|
| 3655 |
+
{
|
| 3656 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 3657 |
+
foreach( $responseNodes as $node )
|
| 3658 |
+
{
|
| 3659 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 3660 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 3661 |
+
}
|
| 3662 |
+
$this->isError = true;
|
| 3663 |
+
}
|
| 3664 |
+
else if (strpos($responseXml, "SECURECARDREGISTRATIONRESPONSE"))
|
| 3665 |
+
{
|
| 3666 |
+
$responseNodes = $doc->getElementsByTagName("SECURECARDREGISTRATIONRESPONSE");
|
| 3667 |
+
|
| 3668 |
+
foreach( $responseNodes as $node )
|
| 3669 |
+
{
|
| 3670 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 3671 |
+
$this->cardRef = $node->getElementsByTagName('CARDREFERENCE')->item(0)->nodeValue;
|
| 3672 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 3673 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 3674 |
+
}
|
| 3675 |
+
}
|
| 3676 |
+
else
|
| 3677 |
+
{
|
| 3678 |
+
throw new Exception("Invalid Response");
|
| 3679 |
+
}
|
| 3680 |
+
}
|
| 3681 |
+
catch (Exception $e)
|
| 3682 |
+
{
|
| 3683 |
+
$this->isError = true;
|
| 3684 |
+
$this->errorString = $e->getMessage();
|
| 3685 |
+
}
|
| 3686 |
+
}
|
| 3687 |
+
}
|
| 3688 |
+
|
| 3689 |
+
/**
|
| 3690 |
+
* Holder class for parsed SecureCard update response.
|
| 3691 |
+
*/
|
| 3692 |
+
class XmlSecureCardUpdResponse extends XmlSecureCardResponse
|
| 3693 |
+
{
|
| 3694 |
+
public function XmlSecureCardUpdResponse($responseXml)
|
| 3695 |
+
{
|
| 3696 |
+
$doc = new DOMDocument();
|
| 3697 |
+
$doc->loadXML($responseXml);
|
| 3698 |
+
try
|
| 3699 |
+
{
|
| 3700 |
+
if (strpos($responseXml, "ERROR"))
|
| 3701 |
+
{
|
| 3702 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 3703 |
+
foreach( $responseNodes as $node )
|
| 3704 |
+
{
|
| 3705 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 3706 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 3707 |
+
}
|
| 3708 |
+
$this->isError = true;
|
| 3709 |
+
}
|
| 3710 |
+
else if (strpos($responseXml, "SECURECARDUPDATERESPONSE"))
|
| 3711 |
+
{
|
| 3712 |
+
$responseNodes = $doc->getElementsByTagName("SECURECARDUPDATERESPONSE");
|
| 3713 |
+
|
| 3714 |
+
foreach( $responseNodes as $node )
|
| 3715 |
+
{
|
| 3716 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 3717 |
+
$this->cardRef = $node->getElementsByTagName('CARDREFERENCE')->item(0)->nodeValue;
|
| 3718 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 3719 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 3720 |
+
}
|
| 3721 |
+
}
|
| 3722 |
+
else
|
| 3723 |
+
{
|
| 3724 |
+
throw new Exception("Invalid Response");
|
| 3725 |
+
}
|
| 3726 |
+
}
|
| 3727 |
+
catch (Exception $e)
|
| 3728 |
+
{
|
| 3729 |
+
$this->isError = true;
|
| 3730 |
+
$this->errorString = $e->getMessage();
|
| 3731 |
+
}
|
| 3732 |
+
}
|
| 3733 |
+
}
|
| 3734 |
+
|
| 3735 |
+
/**
|
| 3736 |
+
* Holder class for parsed SecureCard search response.
|
| 3737 |
+
*/
|
| 3738 |
+
class XmlSecureCardDelResponse extends XmlSecureCardResponse
|
| 3739 |
+
{
|
| 3740 |
+
public function XmlSecureCardDelResponse($responseXml)
|
| 3741 |
+
{
|
| 3742 |
+
$doc = new DOMDocument();
|
| 3743 |
+
$doc->loadXML($responseXml);
|
| 3744 |
+
try
|
| 3745 |
+
{
|
| 3746 |
+
if (strpos($responseXml, "ERROR"))
|
| 3747 |
+
{
|
| 3748 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 3749 |
+
foreach( $responseNodes as $node )
|
| 3750 |
+
{
|
| 3751 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 3752 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 3753 |
+
}
|
| 3754 |
+
$this->isError = true;
|
| 3755 |
+
}
|
| 3756 |
+
else if (strpos($responseXml, "SECURECARDREMOVALRESPONSE"))
|
| 3757 |
+
{
|
| 3758 |
+
$responseNodes = $doc->getElementsByTagName("SECURECARDREMOVALRESPONSE");
|
| 3759 |
+
|
| 3760 |
+
foreach( $responseNodes as $node )
|
| 3761 |
+
{
|
| 3762 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 3763 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 3764 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 3765 |
+
}
|
| 3766 |
+
}
|
| 3767 |
+
else
|
| 3768 |
+
{
|
| 3769 |
+
throw new Exception("Invalid Response");
|
| 3770 |
+
}
|
| 3771 |
+
}
|
| 3772 |
+
catch (Exception $e)
|
| 3773 |
+
{
|
| 3774 |
+
$this->isError = true;
|
| 3775 |
+
$this->errorString = $e->getMessage();
|
| 3776 |
+
}
|
| 3777 |
+
}
|
| 3778 |
+
}
|
| 3779 |
+
|
| 3780 |
+
/**
|
| 3781 |
+
* Holder class for parsed SecureCard search response.
|
| 3782 |
+
*/
|
| 3783 |
+
class XmlSecureCardSearchResponse extends XmlSecureCardResponse
|
| 3784 |
+
{
|
| 3785 |
+
private $cardType;
|
| 3786 |
+
public function CardType()
|
| 3787 |
+
{
|
| 3788 |
+
return $this->cardType;
|
| 3789 |
+
}
|
| 3790 |
+
|
| 3791 |
+
private $expiry;
|
| 3792 |
+
public function CardExpiry()
|
| 3793 |
+
{
|
| 3794 |
+
return $this->expiry;
|
| 3795 |
+
}
|
| 3796 |
+
|
| 3797 |
+
private $cardHolderName;
|
| 3798 |
+
public function CardHolderName()
|
| 3799 |
+
{
|
| 3800 |
+
return $this->cardHolderName;
|
| 3801 |
+
}
|
| 3802 |
+
|
| 3803 |
+
public function XmlSecureCardSearchResponse($responseXml)
|
| 3804 |
+
{
|
| 3805 |
+
$doc = new DOMDocument();
|
| 3806 |
+
$doc->loadXML($responseXml);
|
| 3807 |
+
try
|
| 3808 |
+
{
|
| 3809 |
+
if (strpos($responseXml, "ERROR"))
|
| 3810 |
+
{
|
| 3811 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 3812 |
+
foreach( $responseNodes as $node )
|
| 3813 |
+
{
|
| 3814 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 3815 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 3816 |
+
}
|
| 3817 |
+
$this->isError = true;
|
| 3818 |
+
}
|
| 3819 |
+
else if (strpos($responseXml, "SECURECARDSEARCHRESPONSE"))
|
| 3820 |
+
{
|
| 3821 |
+
$responseNodes = $doc->getElementsByTagName("SECURECARDSEARCHRESPONSE");
|
| 3822 |
+
|
| 3823 |
+
foreach( $responseNodes as $node )
|
| 3824 |
+
{
|
| 3825 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 3826 |
+
$this->cardRef = $node->getElementsByTagName('CARDREFERENCE')->item(0)->nodeValue;
|
| 3827 |
+
$this->cardType = $node->getElementsByTagName('CARDTYPE')->item(0)->nodeValue;
|
| 3828 |
+
$this->expiry = $node->getElementsByTagName('CARDEXPIRY')->item(0)->nodeValue;
|
| 3829 |
+
$this->cardHolderName = $node->getElementsByTagName('CARDHOLDERNAME')->item(0)->nodeValue;
|
| 3830 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 3831 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 3832 |
+
}
|
| 3833 |
+
}
|
| 3834 |
+
else
|
| 3835 |
+
{
|
| 3836 |
+
throw new Exception("Invalid Response");
|
| 3837 |
+
}
|
| 3838 |
+
}
|
| 3839 |
+
catch (Exception $e)
|
| 3840 |
+
{
|
| 3841 |
+
$this->isError = true;
|
| 3842 |
+
$this->errorString = $e->getMessage();
|
| 3843 |
+
}
|
| 3844 |
+
}
|
| 3845 |
+
}
|
| 3846 |
+
|
| 3847 |
+
/**
|
| 3848 |
+
* Base holder class for parsed Subscription response. If there was an error there will be an error string
|
| 3849 |
+
* otherwise all values will be populated with the parsed payment response values.
|
| 3850 |
+
*/
|
| 3851 |
+
class XmlSubscriptionResponse
|
| 3852 |
+
{
|
| 3853 |
+
protected $isError = false;
|
| 3854 |
+
public function IsError()
|
| 3855 |
+
{
|
| 3856 |
+
return $this->isError;
|
| 3857 |
+
}
|
| 3858 |
+
|
| 3859 |
+
protected $errorString;
|
| 3860 |
+
public function ErrorString()
|
| 3861 |
+
{
|
| 3862 |
+
return $this->errorString;
|
| 3863 |
+
}
|
| 3864 |
+
|
| 3865 |
+
protected $errorCode;
|
| 3866 |
+
public function ErrorCode()
|
| 3867 |
+
{
|
| 3868 |
+
return $this->errorCode;
|
| 3869 |
+
}
|
| 3870 |
+
|
| 3871 |
+
protected $merchantRef;
|
| 3872 |
+
public function MerchantReference()
|
| 3873 |
+
{
|
| 3874 |
+
return $this->merchantRef;
|
| 3875 |
+
}
|
| 3876 |
+
|
| 3877 |
+
protected $dateTime;
|
| 3878 |
+
public function DateTime()
|
| 3879 |
+
{
|
| 3880 |
+
return $this->dateTime;
|
| 3881 |
+
}
|
| 3882 |
+
|
| 3883 |
+
protected $hash;
|
| 3884 |
+
public function Hash()
|
| 3885 |
+
{
|
| 3886 |
+
return $this->hash;
|
| 3887 |
+
}
|
| 3888 |
+
}
|
| 3889 |
+
|
| 3890 |
+
/**
|
| 3891 |
+
* Holder class for parsed Stored Subscription registration response.
|
| 3892 |
+
*/
|
| 3893 |
+
class XmlStoredSubscriptionRegResponse extends XmlSubscriptionResponse
|
| 3894 |
+
{
|
| 3895 |
+
public function XmlStoredSubscriptionRegResponse($responseXml)
|
| 3896 |
+
{
|
| 3897 |
+
$doc = new DOMDocument();
|
| 3898 |
+
$doc->loadXML($responseXml);
|
| 3899 |
+
try
|
| 3900 |
+
{
|
| 3901 |
+
if (strpos($responseXml, "ERROR"))
|
| 3902 |
+
{
|
| 3903 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 3904 |
+
foreach( $responseNodes as $node )
|
| 3905 |
+
{
|
| 3906 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 3907 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 3908 |
+
}
|
| 3909 |
+
$this->isError = true;
|
| 3910 |
+
}
|
| 3911 |
+
else if (strpos($responseXml, "ADDSTOREDSUBSCRIPTIONRESPONSE"))
|
| 3912 |
+
{
|
| 3913 |
+
$responseNodes = $doc->getElementsByTagName("ADDSTOREDSUBSCRIPTIONRESPONSE");
|
| 3914 |
+
|
| 3915 |
+
foreach( $responseNodes as $node )
|
| 3916 |
+
{
|
| 3917 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 3918 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 3919 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 3920 |
+
}
|
| 3921 |
+
}
|
| 3922 |
+
else
|
| 3923 |
+
{
|
| 3924 |
+
throw new Exception("Invalid Response");
|
| 3925 |
+
}
|
| 3926 |
+
}
|
| 3927 |
+
catch (Exception $e)
|
| 3928 |
+
{
|
| 3929 |
+
$this->isError = true;
|
| 3930 |
+
$this->errorString = $e->getMessage();
|
| 3931 |
+
}
|
| 3932 |
+
}
|
| 3933 |
+
}
|
| 3934 |
+
|
| 3935 |
+
/**
|
| 3936 |
+
* Holder class for parsed Stored Subscription update response.
|
| 3937 |
+
*/
|
| 3938 |
+
class XmlStoredSubscriptionUpdResponse extends XmlSubscriptionResponse
|
| 3939 |
+
{
|
| 3940 |
+
public function XmlStoredSubscriptionUpdResponse($responseXml)
|
| 3941 |
+
{
|
| 3942 |
+
$doc = new DOMDocument();
|
| 3943 |
+
$doc->loadXML($responseXml);
|
| 3944 |
+
try
|
| 3945 |
+
{
|
| 3946 |
+
if (strpos($responseXml, "ERROR"))
|
| 3947 |
+
{
|
| 3948 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 3949 |
+
foreach( $responseNodes as $node )
|
| 3950 |
+
{
|
| 3951 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 3952 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 3953 |
+
}
|
| 3954 |
+
$this->isError = true;
|
| 3955 |
+
}
|
| 3956 |
+
else if (strpos($responseXml, "UPDATESTOREDSUBSCRIPTIONRESPONSE"))
|
| 3957 |
+
{
|
| 3958 |
+
$responseNodes = $doc->getElementsByTagName("UPDATESTOREDSUBSCRIPTIONRESPONSE");
|
| 3959 |
+
|
| 3960 |
+
foreach( $responseNodes as $node )
|
| 3961 |
+
{
|
| 3962 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 3963 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 3964 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 3965 |
+
}
|
| 3966 |
+
}
|
| 3967 |
+
else
|
| 3968 |
+
{
|
| 3969 |
+
throw new Exception("Invalid Response");
|
| 3970 |
+
}
|
| 3971 |
+
}
|
| 3972 |
+
catch (Exception $e)
|
| 3973 |
+
{
|
| 3974 |
+
$this->isError = true;
|
| 3975 |
+
$this->errorString = $e->getMessage();
|
| 3976 |
+
}
|
| 3977 |
+
}
|
| 3978 |
+
}
|
| 3979 |
+
|
| 3980 |
+
/**
|
| 3981 |
+
* Holder class for parsed Stored Subscription deletion response.
|
| 3982 |
+
*/
|
| 3983 |
+
class XmlStoredSubscriptionDelResponse extends XmlSubscriptionResponse
|
| 3984 |
+
{
|
| 3985 |
+
public function XmlStoredSubscriptionDelResponse($responseXml)
|
| 3986 |
+
{
|
| 3987 |
+
$doc = new DOMDocument();
|
| 3988 |
+
$doc->loadXML($responseXml);
|
| 3989 |
+
try
|
| 3990 |
+
{
|
| 3991 |
+
if (strpos($responseXml, "ERROR"))
|
| 3992 |
+
{
|
| 3993 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 3994 |
+
foreach( $responseNodes as $node )
|
| 3995 |
+
{
|
| 3996 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 3997 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 3998 |
+
}
|
| 3999 |
+
$this->isError = true;
|
| 4000 |
+
}
|
| 4001 |
+
else if (strpos($responseXml, "DELETESTOREDSUBSCRIPTIONRESPONSE"))
|
| 4002 |
+
{
|
| 4003 |
+
$responseNodes = $doc->getElementsByTagName("DELETESTOREDSUBSCRIPTIONRESPONSE");
|
| 4004 |
+
|
| 4005 |
+
foreach( $responseNodes as $node )
|
| 4006 |
+
{
|
| 4007 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 4008 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4009 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4010 |
+
}
|
| 4011 |
+
}
|
| 4012 |
+
else
|
| 4013 |
+
{
|
| 4014 |
+
throw new Exception("Invalid Response");
|
| 4015 |
+
}
|
| 4016 |
+
}
|
| 4017 |
+
catch (Exception $e)
|
| 4018 |
+
{
|
| 4019 |
+
$this->isError = true;
|
| 4020 |
+
$this->errorString = $e->getMessage();
|
| 4021 |
+
}
|
| 4022 |
+
}
|
| 4023 |
+
}
|
| 4024 |
+
|
| 4025 |
+
/**
|
| 4026 |
+
* Holder class for parsed Subscription registration response.
|
| 4027 |
+
*/
|
| 4028 |
+
class XmlSubscriptionRegResponse extends XmlSubscriptionResponse
|
| 4029 |
+
{
|
| 4030 |
+
public function XmlSubscriptionRegResponse($responseXml)
|
| 4031 |
+
{
|
| 4032 |
+
$doc = new DOMDocument();
|
| 4033 |
+
$doc->loadXML($responseXml);
|
| 4034 |
+
try
|
| 4035 |
+
{
|
| 4036 |
+
if (strpos($responseXml, "ERROR"))
|
| 4037 |
+
{
|
| 4038 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4039 |
+
foreach( $responseNodes as $node )
|
| 4040 |
+
{
|
| 4041 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 4042 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4043 |
+
}
|
| 4044 |
+
$this->isError = true;
|
| 4045 |
+
}
|
| 4046 |
+
else if (strpos($responseXml, "ADDSUBSCRIPTIONRESPONSE"))
|
| 4047 |
+
{
|
| 4048 |
+
$responseNodes = $doc->getElementsByTagName("ADDSUBSCRIPTIONRESPONSE");
|
| 4049 |
+
|
| 4050 |
+
foreach( $responseNodes as $node )
|
| 4051 |
+
{
|
| 4052 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 4053 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4054 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4055 |
+
}
|
| 4056 |
+
}
|
| 4057 |
+
else
|
| 4058 |
+
{
|
| 4059 |
+
throw new Exception("Invalid Response");
|
| 4060 |
+
}
|
| 4061 |
+
}
|
| 4062 |
+
catch (Exception $e)
|
| 4063 |
+
{
|
| 4064 |
+
$this->isError = true;
|
| 4065 |
+
$this->errorString = $e->getMessage();
|
| 4066 |
+
}
|
| 4067 |
+
}
|
| 4068 |
+
}
|
| 4069 |
+
|
| 4070 |
+
/**
|
| 4071 |
+
* Holder class for parsed Subscription update response.
|
| 4072 |
+
*/
|
| 4073 |
+
class XmlSubscriptionUpdResponse extends XmlSubscriptionResponse
|
| 4074 |
+
{
|
| 4075 |
+
public function XmlSubscriptionUpdResponse($responseXml)
|
| 4076 |
+
{
|
| 4077 |
+
$doc = new DOMDocument();
|
| 4078 |
+
$doc->loadXML($responseXml);
|
| 4079 |
+
try
|
| 4080 |
+
{
|
| 4081 |
+
if (strpos($responseXml, "ERROR"))
|
| 4082 |
+
{
|
| 4083 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4084 |
+
foreach( $responseNodes as $node )
|
| 4085 |
+
{
|
| 4086 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 4087 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4088 |
+
}
|
| 4089 |
+
$this->isError = true;
|
| 4090 |
+
}
|
| 4091 |
+
else if (strpos($responseXml, "UPDATESUBSCRIPTIONRESPONSE"))
|
| 4092 |
+
{
|
| 4093 |
+
$responseNodes = $doc->getElementsByTagName("UPDATESUBSCRIPTIONRESPONSE");
|
| 4094 |
+
|
| 4095 |
+
foreach( $responseNodes as $node )
|
| 4096 |
+
{
|
| 4097 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 4098 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4099 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4100 |
+
}
|
| 4101 |
+
}
|
| 4102 |
+
else
|
| 4103 |
+
{
|
| 4104 |
+
throw new Exception("Invalid Response");
|
| 4105 |
+
}
|
| 4106 |
+
}
|
| 4107 |
+
catch (Exception $e)
|
| 4108 |
+
{
|
| 4109 |
+
$this->isError = true;
|
| 4110 |
+
$this->errorString = $e->getMessage();
|
| 4111 |
+
}
|
| 4112 |
+
}
|
| 4113 |
+
}
|
| 4114 |
+
|
| 4115 |
+
/**
|
| 4116 |
+
* Holder class for parsed Subscription deletion response.
|
| 4117 |
+
*/
|
| 4118 |
+
class XmlSubscriptionDelResponse extends XmlSubscriptionResponse
|
| 4119 |
+
{
|
| 4120 |
+
public function XmlSubscriptionDelResponse($responseXml)
|
| 4121 |
+
{
|
| 4122 |
+
$doc = new DOMDocument();
|
| 4123 |
+
$doc->loadXML($responseXml);
|
| 4124 |
+
try
|
| 4125 |
+
{
|
| 4126 |
+
if (strpos($responseXml, "ERROR"))
|
| 4127 |
+
{
|
| 4128 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4129 |
+
foreach( $responseNodes as $node )
|
| 4130 |
+
{
|
| 4131 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 4132 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4133 |
+
}
|
| 4134 |
+
$this->isError = true;
|
| 4135 |
+
}
|
| 4136 |
+
else if (strpos($responseXml, "DELETESUBSCRIPTIONRESPONSE"))
|
| 4137 |
+
{
|
| 4138 |
+
$responseNodes = $doc->getElementsByTagName("DELETESUBSCRIPTIONRESPONSE");
|
| 4139 |
+
|
| 4140 |
+
foreach( $responseNodes as $node )
|
| 4141 |
+
{
|
| 4142 |
+
$this->merchantRef = $node->getElementsByTagName('MERCHANTREF')->item(0)->nodeValue;
|
| 4143 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4144 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4145 |
+
}
|
| 4146 |
+
}
|
| 4147 |
+
else
|
| 4148 |
+
{
|
| 4149 |
+
throw new Exception("Invalid Response");
|
| 4150 |
+
}
|
| 4151 |
+
}
|
| 4152 |
+
catch (Exception $e)
|
| 4153 |
+
{
|
| 4154 |
+
$this->isError = true;
|
| 4155 |
+
$this->errorString = $e->getMessage();
|
| 4156 |
+
}
|
| 4157 |
+
}
|
| 4158 |
+
}
|
| 4159 |
+
|
| 4160 |
+
/**
|
| 4161 |
+
* Holder class for parsed Subscription Payment response.
|
| 4162 |
+
*/
|
| 4163 |
+
class XmlSubscriptionPaymentResponse
|
| 4164 |
+
{
|
| 4165 |
+
private $isError = false;
|
| 4166 |
+
public function IsError()
|
| 4167 |
+
{
|
| 4168 |
+
return $this->isError;
|
| 4169 |
+
}
|
| 4170 |
+
|
| 4171 |
+
private $errorString;
|
| 4172 |
+
public function ErrorString()
|
| 4173 |
+
{
|
| 4174 |
+
return $this->errorString;
|
| 4175 |
+
}
|
| 4176 |
+
|
| 4177 |
+
private $responseCode;
|
| 4178 |
+
public function ResponseCode()
|
| 4179 |
+
{
|
| 4180 |
+
return $this->responseCode;
|
| 4181 |
+
}
|
| 4182 |
+
|
| 4183 |
+
private $responseText;
|
| 4184 |
+
public function ResponseText()
|
| 4185 |
+
{
|
| 4186 |
+
return $this->responseText;
|
| 4187 |
+
}
|
| 4188 |
+
|
| 4189 |
+
private $approvalCode;
|
| 4190 |
+
public function ApprovalCode()
|
| 4191 |
+
{
|
| 4192 |
+
return $this->approvalCode;
|
| 4193 |
+
}
|
| 4194 |
+
|
| 4195 |
+
private $dateTime;
|
| 4196 |
+
public function DateTime()
|
| 4197 |
+
{
|
| 4198 |
+
return $this->dateTime;
|
| 4199 |
+
}
|
| 4200 |
+
|
| 4201 |
+
private $hash;
|
| 4202 |
+
public function Hash()
|
| 4203 |
+
{
|
| 4204 |
+
return $this->hash;
|
| 4205 |
+
}
|
| 4206 |
+
|
| 4207 |
+
public function XmlSubscriptionPaymentResponse($responseXml)
|
| 4208 |
+
{
|
| 4209 |
+
$doc = new DOMDocument();
|
| 4210 |
+
$doc->loadXML($responseXml);
|
| 4211 |
+
try
|
| 4212 |
+
{
|
| 4213 |
+
if (strpos($responseXml, "ERROR"))
|
| 4214 |
+
{
|
| 4215 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4216 |
+
foreach( $responseNodes as $node )
|
| 4217 |
+
{
|
| 4218 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 4219 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4220 |
+
}
|
| 4221 |
+
|
| 4222 |
+
$this->isError = true;
|
| 4223 |
+
}
|
| 4224 |
+
else if (strpos($responseXml, "SUBSCRIPTIONPAYMENTRESPONSE"))
|
| 4225 |
+
{
|
| 4226 |
+
$responseNodes = $doc->getElementsByTagName("SUBSCRIPTIONPAYMENTRESPONSE");
|
| 4227 |
+
|
| 4228 |
+
foreach( $responseNodes as $node )
|
| 4229 |
+
{
|
| 4230 |
+
$this->responseCode = $node->getElementsByTagName('RESPONSECODE')->item(0)->nodeValue;
|
| 4231 |
+
$this->responseText = $node->getElementsByTagName('RESPONSETEXT')->item(0)->nodeValue;
|
| 4232 |
+
$this->approvalCode = $node->getElementsByTagName('APPROVALCODE')->item(0)->nodeValue;
|
| 4233 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4234 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4235 |
+
}
|
| 4236 |
+
}
|
| 4237 |
+
else
|
| 4238 |
+
{
|
| 4239 |
+
throw new Exception("Invalid Response");
|
| 4240 |
+
}
|
| 4241 |
+
}
|
| 4242 |
+
catch (Exception $e)
|
| 4243 |
+
{
|
| 4244 |
+
$this->isError = true;
|
| 4245 |
+
$this->errorString = $e->getMessage();
|
| 4246 |
+
}
|
| 4247 |
+
}
|
| 4248 |
+
}
|
| 4249 |
+
/**
|
| 4250 |
+
* Holder class for parsed Unreferenced Refund response.
|
| 4251 |
+
*/
|
| 4252 |
+
class XmlUnreferencedRefundResponse
|
| 4253 |
+
{
|
| 4254 |
+
private $isError = false;
|
| 4255 |
+
public function IsError()
|
| 4256 |
+
{
|
| 4257 |
+
return $this->isError;
|
| 4258 |
+
}
|
| 4259 |
+
|
| 4260 |
+
private $errorString;
|
| 4261 |
+
public function ErrorString()
|
| 4262 |
+
{
|
| 4263 |
+
return $this->errorString;
|
| 4264 |
+
}
|
| 4265 |
+
|
| 4266 |
+
private $responseCode;
|
| 4267 |
+
public function ResponseCode()
|
| 4268 |
+
{
|
| 4269 |
+
return $this->responseCode;
|
| 4270 |
+
}
|
| 4271 |
+
|
| 4272 |
+
private $responseText;
|
| 4273 |
+
public function ResponseText()
|
| 4274 |
+
{
|
| 4275 |
+
return $this->responseText;
|
| 4276 |
+
}
|
| 4277 |
+
|
| 4278 |
+
private $orderId;
|
| 4279 |
+
public function OrderId()
|
| 4280 |
+
{
|
| 4281 |
+
return $this->orderId;
|
| 4282 |
+
}
|
| 4283 |
+
|
| 4284 |
+
private $dateTime;
|
| 4285 |
+
public function DateTime()
|
| 4286 |
+
{
|
| 4287 |
+
return $this->dateTime;
|
| 4288 |
+
}
|
| 4289 |
+
|
| 4290 |
+
private $hash;
|
| 4291 |
+
public function Hash()
|
| 4292 |
+
{
|
| 4293 |
+
return $this->hash;
|
| 4294 |
+
}
|
| 4295 |
+
|
| 4296 |
+
public function XmlUnreferencedRefundResponse($responseXml)
|
| 4297 |
+
{
|
| 4298 |
+
$doc = new DOMDocument();
|
| 4299 |
+
$doc->loadXML($responseXml);
|
| 4300 |
+
try
|
| 4301 |
+
{
|
| 4302 |
+
if (strpos($responseXml, "ERROR"))
|
| 4303 |
+
{
|
| 4304 |
+
$responseNodes = $doc->getElementsByTagName("ERROR");
|
| 4305 |
+
foreach( $responseNodes as $node )
|
| 4306 |
+
{
|
| 4307 |
+
$this->errorCode = $node->getElementsByTagName('ERRORCODE')->item(0)->nodeValue;
|
| 4308 |
+
$this->errorString = $node->getElementsByTagName('ERRORSTRING')->item(0)->nodeValue;
|
| 4309 |
+
}
|
| 4310 |
+
$this->isError = true;
|
| 4311 |
+
}
|
| 4312 |
+
else if (strpos($responseXml, "UNREFERENCEDREFUNDRESPONSE"))
|
| 4313 |
+
{
|
| 4314 |
+
$responseNodes = $doc->getElementsByTagName("UNREFERENCEDREFUNDRESPONSE");
|
| 4315 |
+
|
| 4316 |
+
foreach( $responseNodes as $node )
|
| 4317 |
+
{
|
| 4318 |
+
$this->responseCode = $node->getElementsByTagName('RESPONSECODE')->item(0)->nodeValue;
|
| 4319 |
+
$this->responseText = $node->getElementsByTagName('RESPONSETEXT')->item(0)->nodeValue;
|
| 4320 |
+
$this->orderId = $node->getElementsByTagName('ORDERID')->item(0)->nodeValue;
|
| 4321 |
+
$this->dateTime = $node->getElementsByTagName('DATETIME')->item(0)->nodeValue;
|
| 4322 |
+
$this->hash = $node->getElementsByTagName('HASH')->item(0)->nodeValue;
|
| 4323 |
+
}
|
| 4324 |
+
}
|
| 4325 |
+
else
|
| 4326 |
+
{
|
| 4327 |
+
throw new Exception("Invalid Response");
|
| 4328 |
+
}
|
| 4329 |
+
}
|
| 4330 |
+
catch (Exception $e)
|
| 4331 |
+
{
|
| 4332 |
+
$this->isError = true;
|
| 4333 |
+
$this->errorString = $e->getMessage();
|
| 4334 |
+
}
|
| 4335 |
+
}
|
| 4336 |
+
}
|
| 4337 |
+
|
| 4338 |
+
/**
|
| 4339 |
+
* For backward compatibility with older class names.
|
| 4340 |
+
*/
|
| 4341 |
+
class XmlStandardRequest extends XmlAuthRequest { }
|
| 4342 |
+
class XmlStandardResponse extends XmlAuthResponse { }
|
| 4343 |
+
|
| 4344 |
+
/**
|
| 4345 |
+
* XML Functions - For internal use.
|
| 4346 |
+
*/
|
| 4347 |
+
function libxml_display_error($error)
|
| 4348 |
+
{
|
| 4349 |
+
$errorString = "<br/>\n";
|
| 4350 |
+
switch ($error->level)
|
| 4351 |
+
{
|
| 4352 |
+
case LIBXML_ERR_WARNING:
|
| 4353 |
+
$errorString .= "<b>Warning $error->code</b>: ";
|
| 4354 |
+
break;
|
| 4355 |
+
case LIBXML_ERR_ERROR:
|
| 4356 |
+
$errorString .= "<b>Error $error->code</b>: ";
|
| 4357 |
+
break;
|
| 4358 |
+
case LIBXML_ERR_FATAL:
|
| 4359 |
+
$errorString .= "<b>Fatal Error $error->code</b>: ";
|
| 4360 |
+
break;
|
| 4361 |
+
}
|
| 4362 |
+
$errorString .= trim($error->message);
|
| 4363 |
+
if ($error->file) $errorString .= " in <b>$error->file</b>";
|
| 4364 |
+
$errorString .= " on line <b>$error->line</b>\n";
|
| 4365 |
+
|
| 4366 |
+
return $errorString;
|
| 4367 |
+
}
|
| 4368 |
+
|
| 4369 |
+
function libxml_display_errors()
|
| 4370 |
+
{
|
| 4371 |
+
$errorString = '';
|
| 4372 |
+
$errors = libxml_get_errors();
|
| 4373 |
+
foreach ($errors as $error) $errorString .= libxml_display_error($error);
|
| 4374 |
+
libxml_clear_errors();
|
| 4375 |
+
return $errorString;
|
| 4376 |
+
}
|
| 4377 |
+
|
| 4378 |
+
// Enable user error handling
|
| 4379 |
+
libxml_use_internal_errors(true);
|
| 4380 |
+
|
| 4381 |
+
?>
|
app/code/community/Mage/Worldnet/Model/Config.php
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
/**
|
| 27 |
+
* Worldnet Configuration Model
|
| 28 |
+
*
|
| 29 |
+
* @category Mage
|
| 30 |
+
* @package Mage_Worldnet
|
| 31 |
+
* @name Mage_Worldnet_Model_Config
|
| 32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
+
*/
|
| 34 |
+
|
| 35 |
+
class Mage_Worldnet_Model_Config extends Varien_Object
|
| 36 |
+
{
|
| 37 |
+
const GATEWAY_WORLDNET = 'payments';
|
| 38 |
+
const GATEWAY_CASHFLOWS = 'cashflows';
|
| 39 |
+
const GATEWAY_PAYIUS = 'payius';
|
| 40 |
+
const GATEWAY_PAGOTECHNOLOGY = 'pagotechnology';
|
| 41 |
+
const GATEWAY_GLOBALONEPAY = 'globalonepay';
|
| 42 |
+
const GATEWAY_ANYWHERECOMMERCE = 'anywherecommerce';
|
| 43 |
+
const GATEWAY_CTPAYMENT = 'ctpayment';
|
| 44 |
+
const GATEWAY_PAYCONEX = 'payconex';
|
| 45 |
+
const GATEWAY_PAYZONE = 'payzone';
|
| 46 |
+
|
| 47 |
+
const CHECKOUTCUR_STORE = 'checkoutcur_store';
|
| 48 |
+
const CHECKOUTCUR_DISPLAY = 'checkoutcur_display';
|
| 49 |
+
|
| 50 |
+
const MODE_SIMULATOR = 'SIMULATOR';
|
| 51 |
+
const MODE_TEST = 'TEST';
|
| 52 |
+
const MODE_LIVE = 'LIVE';
|
| 53 |
+
|
| 54 |
+
const CURRENCY_EUR = 'EUR';
|
| 55 |
+
const CURRENCY_GBP = 'GBP';
|
| 56 |
+
const CURRENCY_USD = 'USD';
|
| 57 |
+
const CURRENCY_CAD = 'CAD';
|
| 58 |
+
const CURRENCY_AUD = 'AUD';
|
| 59 |
+
const CURRENCY_DKK = 'DKK';
|
| 60 |
+
const CURRENCY_SEK = 'SEK';
|
| 61 |
+
const CURRENCY_NOK = 'NOK';
|
| 62 |
+
|
| 63 |
+
const PAYMENT_TYPE_PAYMENT = 'PAYMENT';
|
| 64 |
+
const PAYMENT_TYPE_DEFERRED = 'DEFERRED';
|
| 65 |
+
const PAYMENT_TYPE_AUTHENTICATE = 'AUTHENTICATE';
|
| 66 |
+
const PAYMENT_TYPE_AUTHORISE = 'AUTHORISE';
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* Return config var
|
| 71 |
+
*
|
| 72 |
+
* @param string Var key
|
| 73 |
+
* @param string Default value for non-existing key
|
| 74 |
+
* @return mixed
|
| 75 |
+
*/
|
| 76 |
+
public function getConfigData($key, $default=false)
|
| 77 |
+
{
|
| 78 |
+
if (!$this->hasData($key)) {
|
| 79 |
+
$value = Mage::getStoreConfig('payment/worldnet_standard/'.$key);
|
| 80 |
+
if (is_null($value) || false===$value) {
|
| 81 |
+
$value = $default;
|
| 82 |
+
}
|
| 83 |
+
$this->setData($key, $value);
|
| 84 |
+
}
|
| 85 |
+
return $this->getData($key);
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
* Return Protocol version
|
| 90 |
+
*
|
| 91 |
+
* @return string Protocol version
|
| 92 |
+
*/
|
| 93 |
+
public function getVersion ()
|
| 94 |
+
{
|
| 95 |
+
return '2.22';
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
/**
|
| 99 |
+
* Return Store description sent to Worldnet
|
| 100 |
+
*
|
| 101 |
+
* @return string Description
|
| 102 |
+
*/
|
| 103 |
+
public function getDescription ()
|
| 104 |
+
{
|
| 105 |
+
return $this->getConfigData('description');
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
/**
|
| 109 |
+
* Return Worldnet registered merchant account name
|
| 110 |
+
*
|
| 111 |
+
* @return string Merchant account name
|
| 112 |
+
*/
|
| 113 |
+
public function getVendorName ()
|
| 114 |
+
{
|
| 115 |
+
return $this->getConfigData('vendor_name');
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
/**
|
| 119 |
+
* Return Worldnet merchant password
|
| 120 |
+
*
|
| 121 |
+
* @return string Merchant password
|
| 122 |
+
*/
|
| 123 |
+
public function getVendorPassword ()
|
| 124 |
+
{
|
| 125 |
+
return $this->getConfigData('vendor_password');
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
/**
|
| 129 |
+
* Return preferred payment type (see SELF::PAYMENT_TYPE_* constants)
|
| 130 |
+
*
|
| 131 |
+
* @return string payment type
|
| 132 |
+
*/
|
| 133 |
+
public function getWorldnetGateway ()
|
| 134 |
+
{
|
| 135 |
+
return $this->getConfigData('gateway');
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
/**
|
| 140 |
+
* Return preferred payment type (see SELF::PAYMENT_TYPE_* constants)
|
| 141 |
+
*
|
| 142 |
+
* @return string payment type
|
| 143 |
+
*/
|
| 144 |
+
public function getWorldnetCheckoutCurrency ()
|
| 145 |
+
{
|
| 146 |
+
return $this->getConfigData('checkoutcurrency');
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
/**
|
| 150 |
+
* Return preferred payment type (see SELF::PAYMENT_TYPE_* constants)
|
| 151 |
+
*
|
| 152 |
+
* @return string payment type
|
| 153 |
+
*/
|
| 154 |
+
public function getPaymentType ()
|
| 155 |
+
{
|
| 156 |
+
return $this->getConfigData('payment_action');
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
/**
|
| 160 |
+
* Return working mode (see SELF::MODE_* constants)
|
| 161 |
+
*
|
| 162 |
+
* @return string Working mode
|
| 163 |
+
*/
|
| 164 |
+
public function getMode ()
|
| 165 |
+
{
|
| 166 |
+
return $this->getConfigData('mode');
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
/**
|
| 170 |
+
* Return new order status
|
| 171 |
+
*
|
| 172 |
+
* @return string New order status
|
| 173 |
+
*/
|
| 174 |
+
public function getNewOrderStatus ()
|
| 175 |
+
{
|
| 176 |
+
return $this->getConfigData('order_status');
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
/**
|
| 180 |
+
* Return debug flag
|
| 181 |
+
*
|
| 182 |
+
* @return boolean Debug flag (0/1)
|
| 183 |
+
*/
|
| 184 |
+
public function getDebug ()
|
| 185 |
+
{
|
| 186 |
+
return $this->getConfigData('debug_flag');
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
/**
|
| 190 |
+
* Return primary currency code
|
| 191 |
+
*
|
| 192 |
+
* @return 3 digit currency code
|
| 193 |
+
*/
|
| 194 |
+
public function getCurrency ()
|
| 195 |
+
{
|
| 196 |
+
return $this->getConfigData('currency');
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
/**
|
| 200 |
+
* Return primary currencies terminal id
|
| 201 |
+
*
|
| 202 |
+
* @return 3 digit currency code
|
| 203 |
+
*/
|
| 204 |
+
public function getTerminalid ()
|
| 205 |
+
{
|
| 206 |
+
return $this->getConfigData('terminalid');
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
/**
|
| 210 |
+
* Return primary currencies shared secret
|
| 211 |
+
*
|
| 212 |
+
* @return shared secret between worldnet & merchant
|
| 213 |
+
*/
|
| 214 |
+
public function getSharedsecret ()
|
| 215 |
+
{
|
| 216 |
+
return $this->getConfigData('sharedsecret');
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
/**
|
| 220 |
+
* Return secondary currency code
|
| 221 |
+
*
|
| 222 |
+
* @return 3 digit currency code
|
| 223 |
+
*/
|
| 224 |
+
public function getCurrencyTwo ()
|
| 225 |
+
{
|
| 226 |
+
return $this->getConfigData('currencytwo');
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
/**
|
| 230 |
+
* Return secondary currencies terminal id
|
| 231 |
+
*
|
| 232 |
+
* @return 3 digit currency code
|
| 233 |
+
*/
|
| 234 |
+
public function getTerminalidTwo ()
|
| 235 |
+
{
|
| 236 |
+
return $this->getConfigData('terminalidtwo');
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
/**
|
| 240 |
+
* Return secondary currencies shared secret
|
| 241 |
+
*
|
| 242 |
+
* @return shared secret between worldnet & merchant
|
| 243 |
+
*/
|
| 244 |
+
public function getSharedsecretTwo ()
|
| 245 |
+
{
|
| 246 |
+
return $this->getConfigData('sharedsecrettwo');
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
/**
|
| 250 |
+
* Return tertiary currency code
|
| 251 |
+
*
|
| 252 |
+
* @return 3 digit currency code
|
| 253 |
+
*/
|
| 254 |
+
public function getCurrencyThree ()
|
| 255 |
+
{
|
| 256 |
+
return $this->getConfigData('currencythree');
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
/**
|
| 260 |
+
* Return tertiary currencies terminal id
|
| 261 |
+
*
|
| 262 |
+
* @return 3 digit currency code
|
| 263 |
+
*/
|
| 264 |
+
public function getTerminalidThree ()
|
| 265 |
+
{
|
| 266 |
+
return $this->getConfigData('terminalidthree');
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
/**
|
| 270 |
+
* Return tertiary currencies shared secret
|
| 271 |
+
*
|
| 272 |
+
* @return shared secret between worldnet & merchant
|
| 273 |
+
*/
|
| 274 |
+
public function getSharedsecretThree ()
|
| 275 |
+
{
|
| 276 |
+
return $this->getConfigData('sharedsecretthree');
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
/**
|
| 280 |
+
* Return key for simple XOR crypt, using Vendor encrypted password by Worldnet
|
| 281 |
+
*
|
| 282 |
+
* @return string Key for simple XOR crypt
|
| 283 |
+
*/
|
| 284 |
+
public function getCryptKey ()
|
| 285 |
+
{
|
| 286 |
+
return $this->getVendorPassword();
|
| 287 |
+
}
|
| 288 |
+
}
|
app/code/community/Mage/Worldnet/Model/Config.php~
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
/**
|
| 27 |
+
* Worldnet Configuration Model
|
| 28 |
+
*
|
| 29 |
+
* @category Mage
|
| 30 |
+
* @package Mage_Worldnet
|
| 31 |
+
* @name Mage_Worldnet_Model_Config
|
| 32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
+
*/
|
| 34 |
+
|
| 35 |
+
class Mage_Worldnet_Model_Config extends Varien_Object
|
| 36 |
+
{
|
| 37 |
+
const GATEWAY_WORLDNET = 'payments';
|
| 38 |
+
const GATEWAY_CASHFLOWS = 'cashflows';
|
| 39 |
+
const GATEWAY_PAYIUS = 'payius';
|
| 40 |
+
const GATEWAY_PAGOTECHNOLOGY = 'pagotechnology';
|
| 41 |
+
const GATEWAY_GLOBALONEPAY = 'globalonepay';
|
| 42 |
+
const GATEWAY_ANYWHERECOMMERCE = 'anywherecommerce';
|
| 43 |
+
const GATEWAY_CTPAYMNET = 'ctpayment';
|
| 44 |
+
const GATEWAY_PAYCONEX = 'payconex';
|
| 45 |
+
const GATEWAY_PAYZONE = 'payzone';
|
| 46 |
+
|
| 47 |
+
const CHECKOUTCUR_STORE = 'checkoutcur_store';
|
| 48 |
+
const CHECKOUTCUR_DISPLAY = 'checkoutcur_display';
|
| 49 |
+
|
| 50 |
+
const MODE_SIMULATOR = 'SIMULATOR';
|
| 51 |
+
const MODE_TEST = 'TEST';
|
| 52 |
+
const MODE_LIVE = 'LIVE';
|
| 53 |
+
|
| 54 |
+
const CURRENCY_EUR = 'EUR';
|
| 55 |
+
const CURRENCY_GBP = 'GBP';
|
| 56 |
+
const CURRENCY_USD = 'USD';
|
| 57 |
+
const CURRENCY_CAD = 'CAD';
|
| 58 |
+
const CURRENCY_AUD = 'AUD';
|
| 59 |
+
const CURRENCY_DKK = 'DKK';
|
| 60 |
+
const CURRENCY_SEK = 'SEK';
|
| 61 |
+
const CURRENCY_NOK = 'NOK';
|
| 62 |
+
|
| 63 |
+
const PAYMENT_TYPE_PAYMENT = 'PAYMENT';
|
| 64 |
+
const PAYMENT_TYPE_DEFERRED = 'DEFERRED';
|
| 65 |
+
const PAYMENT_TYPE_AUTHENTICATE = 'AUTHENTICATE';
|
| 66 |
+
const PAYMENT_TYPE_AUTHORISE = 'AUTHORISE';
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* Return config var
|
| 71 |
+
*
|
| 72 |
+
* @param string Var key
|
| 73 |
+
* @param string Default value for non-existing key
|
| 74 |
+
* @return mixed
|
| 75 |
+
*/
|
| 76 |
+
public function getConfigData($key, $default=false)
|
| 77 |
+
{
|
| 78 |
+
if (!$this->hasData($key)) {
|
| 79 |
+
$value = Mage::getStoreConfig('payment/worldnet_standard/'.$key);
|
| 80 |
+
if (is_null($value) || false===$value) {
|
| 81 |
+
$value = $default;
|
| 82 |
+
}
|
| 83 |
+
$this->setData($key, $value);
|
| 84 |
+
}
|
| 85 |
+
return $this->getData($key);
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
* Return Protocol version
|
| 90 |
+
*
|
| 91 |
+
* @return string Protocol version
|
| 92 |
+
*/
|
| 93 |
+
public function getVersion ()
|
| 94 |
+
{
|
| 95 |
+
return '2.22';
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
/**
|
| 99 |
+
* Return Store description sent to Worldnet
|
| 100 |
+
*
|
| 101 |
+
* @return string Description
|
| 102 |
+
*/
|
| 103 |
+
public function getDescription ()
|
| 104 |
+
{
|
| 105 |
+
return $this->getConfigData('description');
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
/**
|
| 109 |
+
* Return Worldnet registered merchant account name
|
| 110 |
+
*
|
| 111 |
+
* @return string Merchant account name
|
| 112 |
+
*/
|
| 113 |
+
public function getVendorName ()
|
| 114 |
+
{
|
| 115 |
+
return $this->getConfigData('vendor_name');
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
/**
|
| 119 |
+
* Return Worldnet merchant password
|
| 120 |
+
*
|
| 121 |
+
* @return string Merchant password
|
| 122 |
+
*/
|
| 123 |
+
public function getVendorPassword ()
|
| 124 |
+
{
|
| 125 |
+
return $this->getConfigData('vendor_password');
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
/**
|
| 129 |
+
* Return preferred payment type (see SELF::PAYMENT_TYPE_* constants)
|
| 130 |
+
*
|
| 131 |
+
* @return string payment type
|
| 132 |
+
*/
|
| 133 |
+
public function getWorldnetGateway ()
|
| 134 |
+
{
|
| 135 |
+
return $this->getConfigData('gateway');
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
/**
|
| 140 |
+
* Return preferred payment type (see SELF::PAYMENT_TYPE_* constants)
|
| 141 |
+
*
|
| 142 |
+
* @return string payment type
|
| 143 |
+
*/
|
| 144 |
+
public function getWorldnetCheckoutCurrency ()
|
| 145 |
+
{
|
| 146 |
+
return $this->getConfigData('checkoutcurrency');
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
/**
|
| 150 |
+
* Return preferred payment type (see SELF::PAYMENT_TYPE_* constants)
|
| 151 |
+
*
|
| 152 |
+
* @return string payment type
|
| 153 |
+
*/
|
| 154 |
+
public function getPaymentType ()
|
| 155 |
+
{
|
| 156 |
+
return $this->getConfigData('payment_action');
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
/**
|
| 160 |
+
* Return working mode (see SELF::MODE_* constants)
|
| 161 |
+
*
|
| 162 |
+
* @return string Working mode
|
| 163 |
+
*/
|
| 164 |
+
public function getMode ()
|
| 165 |
+
{
|
| 166 |
+
return $this->getConfigData('mode');
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
/**
|
| 170 |
+
* Return new order status
|
| 171 |
+
*
|
| 172 |
+
* @return string New order status
|
| 173 |
+
*/
|
| 174 |
+
public function getNewOrderStatus ()
|
| 175 |
+
{
|
| 176 |
+
return $this->getConfigData('order_status');
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
/**
|
| 180 |
+
* Return debug flag
|
| 181 |
+
*
|
| 182 |
+
* @return boolean Debug flag (0/1)
|
| 183 |
+
*/
|
| 184 |
+
public function getDebug ()
|
| 185 |
+
{
|
| 186 |
+
return $this->getConfigData('debug_flag');
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
/**
|
| 190 |
+
* Return primary currency code
|
| 191 |
+
*
|
| 192 |
+
* @return 3 digit currency code
|
| 193 |
+
*/
|
| 194 |
+
public function getCurrency ()
|
| 195 |
+
{
|
| 196 |
+
return $this->getConfigData('currency');
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
/**
|
| 200 |
+
* Return primary currencies terminal id
|
| 201 |
+
*
|
| 202 |
+
* @return 3 digit currency code
|
| 203 |
+
*/
|
| 204 |
+
public function getTerminalid ()
|
| 205 |
+
{
|
| 206 |
+
return $this->getConfigData('terminalid');
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
/**
|
| 210 |
+
* Return primary currencies shared secret
|
| 211 |
+
*
|
| 212 |
+
* @return shared secret between worldnet & merchant
|
| 213 |
+
*/
|
| 214 |
+
public function getSharedsecret ()
|
| 215 |
+
{
|
| 216 |
+
return $this->getConfigData('sharedsecret');
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
/**
|
| 220 |
+
* Return secondary currency code
|
| 221 |
+
*
|
| 222 |
+
* @return 3 digit currency code
|
| 223 |
+
*/
|
| 224 |
+
public function getCurrencyTwo ()
|
| 225 |
+
{
|
| 226 |
+
return $this->getConfigData('currencytwo');
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
/**
|
| 230 |
+
* Return secondary currencies terminal id
|
| 231 |
+
*
|
| 232 |
+
* @return 3 digit currency code
|
| 233 |
+
*/
|
| 234 |
+
public function getTerminalidTwo ()
|
| 235 |
+
{
|
| 236 |
+
return $this->getConfigData('terminalidtwo');
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
/**
|
| 240 |
+
* Return secondary currencies shared secret
|
| 241 |
+
*
|
| 242 |
+
* @return shared secret between worldnet & merchant
|
| 243 |
+
*/
|
| 244 |
+
public function getSharedsecretTwo ()
|
| 245 |
+
{
|
| 246 |
+
return $this->getConfigData('sharedsecrettwo');
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
/**
|
| 250 |
+
* Return tertiary currency code
|
| 251 |
+
*
|
| 252 |
+
* @return 3 digit currency code
|
| 253 |
+
*/
|
| 254 |
+
public function getCurrencyThree ()
|
| 255 |
+
{
|
| 256 |
+
return $this->getConfigData('currencythree');
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
/**
|
| 260 |
+
* Return tertiary currencies terminal id
|
| 261 |
+
*
|
| 262 |
+
* @return 3 digit currency code
|
| 263 |
+
*/
|
| 264 |
+
public function getTerminalidThree ()
|
| 265 |
+
{
|
| 266 |
+
return $this->getConfigData('terminalidthree');
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
/**
|
| 270 |
+
* Return tertiary currencies shared secret
|
| 271 |
+
*
|
| 272 |
+
* @return shared secret between worldnet & merchant
|
| 273 |
+
*/
|
| 274 |
+
public function getSharedsecretThree ()
|
| 275 |
+
{
|
| 276 |
+
return $this->getConfigData('sharedsecretthree');
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
/**
|
| 280 |
+
* Return key for simple XOR crypt, using Vendor encrypted password by Worldnet
|
| 281 |
+
*
|
| 282 |
+
* @return string Key for simple XOR crypt
|
| 283 |
+
*/
|
| 284 |
+
public function getCryptKey ()
|
| 285 |
+
{
|
| 286 |
+
return $this->getVendorPassword();
|
| 287 |
+
}
|
| 288 |
+
}
|
app/code/community/Mage/Worldnet/Model/Mysql4/Api/Debug.php
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
h<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Worldnet API Debug Resource
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_Model_Mysql4_Api_Debug
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
|
| 36 |
+
class Mage_Worldnet_Model_Mysql4_Api_Debug extends Mage_Core_Model_Mysql4_Abstract
|
| 37 |
+
{
|
| 38 |
+
protected function _construct()
|
| 39 |
+
{
|
| 40 |
+
$this->_init('worldnet/api_debug', 'transaction_id');
|
| 41 |
+
}
|
| 42 |
+
}
|
app/code/community/Mage/Worldnet/Model/Mysql4/Api/Debug/Collection.php
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Worldnet API Debug Resource Collection
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_Model_Mysql4_Api_Debug_Collection
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
class Mage_Worldnet_Model_Mysql4_Api_Debug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 36 |
+
{
|
| 37 |
+
protected function _construct()
|
| 38 |
+
{
|
| 39 |
+
$this->_init('worldnet/api_debug');
|
| 40 |
+
}
|
| 41 |
+
}
|
app/code/community/Mage/Worldnet/Model/Mysql4/Setup.php
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Setup model
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_Model_Mysql4_Setup
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
|
| 36 |
+
class Mage_Worldnet_Model_Mysql4_Setup extends Mage_Sales_Model_Mysql4_Setup
|
| 37 |
+
{
|
| 38 |
+
|
| 39 |
+
}
|
app/code/community/Mage/Worldnet/Model/Session.php
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_PackageName
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Worldnet Session Model
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_Model_Session
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
|
| 36 |
+
class Mage_Worldnet_Model_Session extends Mage_Core_Model_Session_Abstract
|
| 37 |
+
{
|
| 38 |
+
public function __construct()
|
| 39 |
+
{
|
| 40 |
+
$this->init('worldnet');
|
| 41 |
+
}
|
| 42 |
+
}
|
app/code/community/Mage/Worldnet/Model/Source/CheckoutCurrencyAction.php
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Worldnet Modes Resource
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_Model_Source_ModeAction
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
|
| 36 |
+
class Mage_Worldnet_Model_Source_checkoutCurrencyAction
|
| 37 |
+
{
|
| 38 |
+
public function toOptionArray()
|
| 39 |
+
{
|
| 40 |
+
return array(
|
| 41 |
+
array('value' => Mage_Worldnet_Model_Config::CHECKOUTCUR_STORE, 'label' => Mage::helper('worldnet')->__('Store base currency')),
|
| 42 |
+
array('value' => Mage_Worldnet_Model_Config::CHECKOUTCUR_DISPLAY, 'label' => Mage::helper('worldnet')->__('Cart Display currency')),
|
| 43 |
+
);
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
|
app/code/community/Mage/Worldnet/Model/Source/CurrencyAction.php
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Worldnet Modes Resource
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_Model_Source_ModeAction
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
|
| 36 |
+
class Mage_Worldnet_Model_Source_currencyAction
|
| 37 |
+
{
|
| 38 |
+
public function toOptionArray()
|
| 39 |
+
{
|
| 40 |
+
return array(
|
| 41 |
+
array('value' => Mage_Worldnet_Model_Config::CURRENCY_EUR, 'label' => Mage::helper('worldnet')->__('Euro')),
|
| 42 |
+
array('value' => Mage_Worldnet_Model_Config::CURRENCY_GBP, 'label' => Mage::helper('worldnet')->__('Sterling')),
|
| 43 |
+
array('value' => Mage_Worldnet_Model_Config::CURRENCY_USD, 'label' => Mage::helper('worldnet')->__('US Dollar')),
|
| 44 |
+
array('value' => Mage_Worldnet_Model_Config::CURRENCY_CAD, 'label' => Mage::helper('worldnet')->__('Canadian Dollar')),
|
| 45 |
+
array('value' => Mage_Worldnet_Model_Config::CURRENCY_AUD, 'label' => Mage::helper('worldnet')->__('Australian Dollar')),
|
| 46 |
+
array('value' => Mage_Worldnet_Model_Config::CURRENCY_DKK, 'label' => Mage::helper('worldnet')->__('Danish Krone')),
|
| 47 |
+
array('value' => Mage_Worldnet_Model_Config::CURRENCY_SEK, 'label' => Mage::helper('worldnet')->__('Swedish Krona')),
|
| 48 |
+
array('value' => Mage_Worldnet_Model_Config::CURRENCY_NOK, 'label' => Mage::helper('worldnet')->__('Norwegian Krone')),
|
| 49 |
+
);
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
|
app/code/community/Mage/Worldnet/Model/Source/CurrencyAction.php~
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Worldnet Modes Resource
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_Model_Source_ModeAction
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
|
| 36 |
+
class Mage_Worldnet_Model_Source_currencyAction
|
| 37 |
+
{
|
| 38 |
+
public function toOptionArray()
|
| 39 |
+
{
|
| 40 |
+
return array(
|
| 41 |
+
array('value' => Mage_Worldnet_Model_Config::CURRENCY_EUR, 'label' => Mage::helper('worldnet')->__('Euro')),
|
| 42 |
+
array('value' => Mage_Worldnet_Model_Config::CURRENCY_GBP, 'label' => Mage::helper('worldnet')->__('Sterling')),
|
| 43 |
+
array('value' => Mage_Worldnet_Model_Config::CURRENCY_USD, 'label' => Mage::helper('worldnet')->__('US Dollar')),
|
| 44 |
+
array('value' => Mage_Worldnet_Model_Config::CURRENCY_CAD, 'label' => Mage::helper('worldnet')->__('Canadian Dollar')),
|
| 45 |
+
array('value' => Mage_Worldnet_Model_Config::CURRENCY_AUD, 'label' => Mage::helper('worldnet')->__('Australian Dollar')),
|
| 46 |
+
array('value' => Mage_Worldnet_Model_Config::CURRENCY_DKK, 'label' => Mage::helper('worldnet')->__('Danish Krone')),
|
| 47 |
+
array('value' => Mage_Worldnet_Model_Config::CURRENCY_SEK, 'label' => Mage::helper('worldnet')->__('Swedish Krona')),
|
| 48 |
+
);
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
|
app/code/community/Mage/Worldnet/Model/Source/GatewayAction.php
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Worldnet Modes Resource
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_Model_Source_ModeAction
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
|
| 36 |
+
class Mage_Worldnet_Model_Source_gatewayAction
|
| 37 |
+
{
|
| 38 |
+
public function toOptionArray()
|
| 39 |
+
{
|
| 40 |
+
return array(
|
| 41 |
+
array('value' => Mage_Worldnet_Model_Config::GATEWAY_WORLDNET, 'label' => Mage::helper('worldnet')->__('WorldNet')),
|
| 42 |
+
array('value' => Mage_Worldnet_Model_Config::GATEWAY_CASHFLOWS, 'label' => Mage::helper('worldnet')->__('CashFlows')),
|
| 43 |
+
array('value' => Mage_Worldnet_Model_Config::GATEWAY_PAYIUS, 'label' => Mage::helper('worldnet')->__('Payius')),
|
| 44 |
+
array('value' => Mage_Worldnet_Model_Config::GATEWAY_PAGOTECHNOLOGY, 'label' => Mage::helper('worldnet')->__('Pago Technology')),
|
| 45 |
+
array('value' => Mage_Worldnet_Model_Config::GATEWAY_GLOBALONEPAY, 'label' => Mage::helper('worldnet')->__('GlobalOnePay')),
|
| 46 |
+
array('value' => Mage_Worldnet_Model_Config::GATEWAY_ANYWHERECOMMERCE, 'label' => Mage::helper('worldnet')->__('AnywhereCommerce')),
|
| 47 |
+
array('value' => Mage_Worldnet_Model_Config::GATEWAY_CTPAYMENT, 'label' => Mage::helper('worldnet')->__('CT Payments')),
|
| 48 |
+
array('value' => Mage_Worldnet_Model_Config::GATEWAY_PAYCONEX, 'label' => Mage::helper('worldnet')->__('PayConex Plus')),
|
| 49 |
+
array('value' => Mage_Worldnet_Model_Config::GATEWAY_PAYZONE, 'label' => Mage::helper('worldnet')->__('Payzone')),
|
| 50 |
+
);
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
|
app/code/community/Mage/Worldnet/Model/Source/GatewayAction.php~
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Worldnet Modes Resource
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_Model_Source_ModeAction
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
|
| 36 |
+
class Mage_Worldnet_Model_Source_gatewayAction
|
| 37 |
+
{
|
| 38 |
+
public function toOptionArray()
|
| 39 |
+
{
|
| 40 |
+
return array(
|
| 41 |
+
array('value' => Mage_Worldnet_Model_Config::GATEWAY_WORLDNET, 'label' => Mage::helper('worldnet')->__('WorldNet')),
|
| 42 |
+
array('value' => Mage_Worldnet_Model_Config::GATEWAY_CASHFLOWS, 'label' => Mage::helper('worldnet')->__('CashFlows')),
|
| 43 |
+
array('value' => Mage_Worldnet_Model_Config::GATEWAY_PAYIUS, 'label' => Mage::helper('worldnet')->__('Payius')),
|
| 44 |
+
array('value' => Mage_Worldnet_Model_Config::GATEWAY_PAGOTECHNOLOGY, 'label' => Mage::helper('worldnet')->__('Pago Technology')),
|
| 45 |
+
array('value' => Mage_Worldnet_Model_Config::GATEWAY_GLOBALONEPAY, 'label' => Mage::helper('worldnet')->__('GlobalOnePay')),
|
| 46 |
+
array('value' => Mage_Worldnet_Model_Config::GATEWAY_ANYWHERECOMMERCE, 'label' => Mage::helper('worldnet')->__('AnywhereCommerce')),
|
| 47 |
+
array('value' => Mage_Worldnet_Model_Config::GATEWAY_CTPAYMNET, 'label' => Mage::helper('worldnet')->__('CT Payments')),
|
| 48 |
+
array('value' => Mage_Worldnet_Model_Config::GATEWAY_PAYCONEX, 'label' => Mage::helper('worldnet')->__('PayConex Plus')),
|
| 49 |
+
array('value' => Mage_Worldnet_Model_Config::GATEWAY_PAYZONE, 'label' => Mage::helper('worldnet')->__('Payzone')),
|
| 50 |
+
);
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
|
app/code/community/Mage/Worldnet/Model/Source/ModeAction.php
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Worldnet Modes Resource
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_Model_Source_ModeAction
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
|
| 36 |
+
class Mage_Worldnet_Model_Source_ModeAction
|
| 37 |
+
{
|
| 38 |
+
public function toOptionArray()
|
| 39 |
+
{
|
| 40 |
+
return array(
|
| 41 |
+
array('value' => Mage_Worldnet_Model_Config::MODE_TEST, 'label' => Mage::helper('worldnet')->__('Test')),
|
| 42 |
+
array('value' => Mage_Worldnet_Model_Config::MODE_LIVE, 'label' => Mage::helper('worldnet')->__('Live')),
|
| 43 |
+
);
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
|
app/code/community/Mage/Worldnet/Model/Source/ModeAction.php~
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Worldnet Modes Resource
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_Model_Source_ModeAction
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
|
| 36 |
+
class Mage_Worldnet_Model_Source_ModeAction
|
| 37 |
+
{
|
| 38 |
+
public function toOptionArray()
|
| 39 |
+
{
|
| 40 |
+
return array(
|
| 41 |
+
array('value' => Mage_Worldnet_Model_Config::MODE_TEST, 'label' => Mage::helper('worldnet')->__('Test')),
|
| 42 |
+
array('value' => Mage_Worldnet_Model_Config::MODE_LIVE, 'label' => Mage::helper('worldnet')->__('Live')),
|
| 43 |
+
);
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
|
app/code/community/Mage/Worldnet/Model/Source/PaymentAction.php
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Worldnet Payment Actions Resource
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_Model_Source_PaymentAction
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
|
| 36 |
+
class Mage_Worldnet_Model_Source_PaymentAction
|
| 37 |
+
{
|
| 38 |
+
public function toOptionArray()
|
| 39 |
+
{
|
| 40 |
+
return array(
|
| 41 |
+
array('value' => Mage_Worldnet_Model_Config::PAYMENT_TYPE_PAYMENT, 'label' => M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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Worldnet Form Model
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_Model_Standard
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
class Mage_Worldnet_Model_Standard extends Mage_Payment_Model_Method_Abstract
|
| 36 |
+
{
|
| 37 |
+
protected $_code = 'worldnet_standard';
|
| 38 |
+
protected $_formBlockType = 'worldnet/standard_form';
|
| 39 |
+
|
| 40 |
+
protected $_isGateway = false;
|
| 41 |
+
protected $_canAuthorize = true;
|
| 42 |
+
protected $_canCapture = true;
|
| 43 |
+
protected $_canCapturePartial = false;
|
| 44 |
+
protected $_canRefund = true;
|
| 45 |
+
protected $_canVoid = false;
|
| 46 |
+
protected $_canUseInternal = false;
|
| 47 |
+
protected $_canUseCheckout = true;
|
| 48 |
+
protected $_canUseForMultishipping = false;
|
| 49 |
+
|
| 50 |
+
protected $_order = null;
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Get Config model
|
| 55 |
+
*
|
| 56 |
+
* @return object Mage_Worldnet_Model_Config
|
| 57 |
+
*/
|
| 58 |
+
public function getConfig()
|
| 59 |
+
{
|
| 60 |
+
return Mage::getSingleton('worldnet/config');
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* Return debug flag
|
| 65 |
+
*
|
| 66 |
+
* @return boolean
|
| 67 |
+
*/
|
| 68 |
+
public function getDebug ()
|
| 69 |
+
{
|
| 70 |
+
return $this->getConfig()->getDebug();
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
/**
|
| 74 |
+
* Returns Target URL
|
| 75 |
+
*
|
| 76 |
+
* @return string Target URL
|
| 77 |
+
*/
|
| 78 |
+
public function getWorldnetUrl ()
|
| 79 |
+
{
|
| 80 |
+
$gateway = $this->getConfig()->getWorldnetGateway();
|
| 81 |
+
$testAccount = $this->getConfig()->getMode();
|
| 82 |
+
|
| 83 |
+
$serverUrl = 'https://';
|
| 84 |
+
|
| 85 |
+
if($testAccount) $serverUrl .= 'test';
|
| 86 |
+
switch (strtolower($gateway)) {
|
| 87 |
+
default :
|
| 88 |
+
case 'worldnet' : $serverUrl .= 'payments.worldnettps.com'; break;
|
| 89 |
+
case 'cashflows' : $serverUrl .= 'cashflows.worldnettps.com'; break;
|
| 90 |
+
case 'payius' : $serverUrl .= 'payments.payius.com' ; break;
|
| 91 |
+
case 'pagotechnology' : $serverUrl .= 'payments.pagotechnology.com' ; break;
|
| 92 |
+
case 'globalonepay' : $serverUrl .= 'payments.globalone.me' ; break;
|
| 93 |
+
case 'anywherecommerce' : $serverUrl .= 'payments.anywherecommerce.com' ; break;
|
| 94 |
+
case 'ctpayment' : $serverUrl .= 'payments.ct-payment.com' ; break;
|
| 95 |
+
case 'payzone' : $serverUrl .= 'payment.payzone.ie' ; break;
|
| 96 |
+
case 'payconex' : $serverUrl .= 'gateway.payconex.net' ; break;
|
| 97 |
+
|
| 98 |
+
}
|
| 99 |
+
$serverUrl .= '/merchant/paymentpage';
|
| 100 |
+
return $serverUrl;
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
/**
|
| 106 |
+
* Return URL for Worldnet success response
|
| 107 |
+
*
|
| 108 |
+
* @return string URL
|
| 109 |
+
*/
|
| 110 |
+
protected function getSuccessURL ()
|
| 111 |
+
{
|
| 112 |
+
return Mage::getUrl('worldnet/standard/successresponse');
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
/**
|
| 116 |
+
* Return URL for Worldnet failure response
|
| 117 |
+
*
|
| 118 |
+
* @return string URL
|
| 119 |
+
*/
|
| 120 |
+
protected function getFailureURL ()
|
| 121 |
+
{
|
| 122 |
+
return Mage::getUrl('worldnet/standard/failureresponse');
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
/**
|
| 126 |
+
* Transaction unique ID sent to Worldnet and sent back by Worldnet for order restore
|
| 127 |
+
* Using created order ID
|
| 128 |
+
*
|
| 129 |
+
* @return string Transaction unique number
|
| 130 |
+
*/
|
| 131 |
+
protected function getVendorTxCode ()
|
| 132 |
+
{
|
| 133 |
+
return $this->getOrder()->getRealOrderId();
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
/**
|
| 137 |
+
* Returns cart formatted
|
| 138 |
+
* String format:
|
| 139 |
+
* Number of lines:Name1:Quantity1:CostNoTax1:Tax1:CostTax1:Total1:Name2:Quantity2:CostNoTax2...
|
| 140 |
+
*
|
| 141 |
+
* @return string Formatted cart items
|
| 142 |
+
*/
|
| 143 |
+
protected function getFormattedCart ()
|
| 144 |
+
{
|
| 145 |
+
$items = $this->getOrder()->getAllItems();
|
| 146 |
+
$resultParts = array();
|
| 147 |
+
$totalLines = 0;
|
| 148 |
+
if ($items) {
|
| 149 |
+
foreach($items as $item) {
|
| 150 |
+
if ($item->getParentItem()) {
|
| 151 |
+
continue;
|
| 152 |
+
}
|
| 153 |
+
$quantity = $item->getQtyOrdered();
|
| 154 |
+
|
| 155 |
+
$cost = sprintf('%.2f', $item->getBasePrice() - $item->getBaseDiscountAmount());
|
| 156 |
+
$tax = sprintf('%.2f', $item->getBaseTaxAmount());
|
| 157 |
+
$costPlusTax = sprintf('%.2f', $cost + $tax/$quantity);
|
| 158 |
+
|
| 159 |
+
$totalCostPlusTax = sprintf('%.2f', $quantity * $cost + $tax);
|
| 160 |
+
|
| 161 |
+
$resultParts[] = str_replace(':', ' ', $item->getName());
|
| 162 |
+
$resultParts[] = $quantity;
|
| 163 |
+
$resultParts[] = $cost;
|
| 164 |
+
$resultParts[] = $tax;
|
| 165 |
+
$resultParts[] = $costPlusTax;
|
| 166 |
+
$resultParts[] = $totalCostPlusTax;
|
| 167 |
+
$totalLines++; //counting actual formatted items
|
| 168 |
+
}
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
// add delivery
|
| 172 |
+
$shipping = $this->getOrder()->getBaseShippingAmount();
|
| 173 |
+
if ((int)$shipping > 0) {
|
| 174 |
+
$totalLines++;
|
| 175 |
+
$resultParts = array_merge($resultParts, array('Shipping','','','','',sprintf('%.2f', $shipping)));
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
$result = $totalLines . ':' . implode(':', $resultParts);
|
| 179 |
+
return $result;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
/**
|
| 183 |
+
* Format Crypted string with all order data for request to Worldnet
|
| 184 |
+
*
|
| 185 |
+
* @return string Crypted string
|
| 186 |
+
*/
|
| 187 |
+
protected function getCrypted ()
|
| 188 |
+
{
|
| 189 |
+
$order = $this->getOrder();
|
| 190 |
+
if (!($order instanceof Mage_Sales_Model_Order)) {
|
| 191 |
+
Mage::throwException($this->_getHelper()->__('Cannot retrieve order object'));
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
$shipping = $order->getShippingAddress();
|
| 195 |
+
$billing = $order->getBillingAddress();
|
| 196 |
+
|
| 197 |
+
$amount = $order->getBaseGrandTotal();
|
| 198 |
+
|
| 199 |
+
$currency = $order->getBaseCurrencyCode();
|
| 200 |
+
|
| 201 |
+
$queryPairs = array();
|
| 202 |
+
|
| 203 |
+
$transactionId = $this->getVendorTxCode();
|
| 204 |
+
$queryPairs['VendorTxCode'] = $transactionId;
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
$queryPairs['Amount'] = sprintf('%.2f', $amount);
|
| 208 |
+
$queryPairs['Currency'] = $currency;
|
| 209 |
+
|
| 210 |
+
// Up to 100 chars of free format description
|
| 211 |
+
$description = $this->getConfig()->getDescription() != ''
|
| 212 |
+
? $this->getConfig()->getDescription()
|
| 213 |
+
: Mage::app()->getStore()->getName() . ' ' . ' payment';
|
| 214 |
+
$queryPairs['Description'] = $description;
|
| 215 |
+
|
| 216 |
+
$queryPairs['SuccessURL'] = $this->getSuccessURL();
|
| 217 |
+
$queryPairs['FailureURL'] = $this->getFailureURL();
|
| 218 |
+
|
| 219 |
+
$queryPairs['CustomerName'] = $billing->getFirstname().' '.$billing->getLastname();
|
| 220 |
+
$queryPairs['CustomerEMail'] = $order->getCustomerEmail();
|
| 221 |
+
$queryPairs['ContactNumber'] = $billing->getTelephone();
|
| 222 |
+
$queryPairs['ContactFax'] = $billing->getFax();
|
| 223 |
+
|
| 224 |
+
$queryPairs['VendorEMail'] = '';
|
| 225 |
+
$queryPairs['eMailMessage'] = '';
|
| 226 |
+
|
| 227 |
+
$queryPairs['BillingAddress'] = $billing->format('oneline');
|
| 228 |
+
$queryPairs['BillingPostCode'] = $billing->getPostcode();
|
| 229 |
+
|
| 230 |
+
if ($shipping) {
|
| 231 |
+
$queryPairs['DeliveryAddress'] = $shipping->getFormated();
|
| 232 |
+
$queryPairs['DeliveryPostCode'] = $shipping->getPostcode();
|
| 233 |
+
} else {
|
| 234 |
+
$queryPairs['DeliveryAddress'] = '';
|
| 235 |
+
$queryPairs['DeliveryPostCode'] = '';
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
$queryPairs['Basket'] = $this->getFormattedCart();
|
| 239 |
+
|
| 240 |
+
// For charities registered for Gift Aid
|
| 241 |
+
$queryPairs['AllowGiftAid'] = '0';
|
| 242 |
+
|
| 243 |
+
/**
|
| 244 |
+
* Allow fine control over AVS/CV2 checks and rules by changing this value. 0 is Default
|
| 245 |
+
* It can be changed dynamically, per transaction, if you wish. See the VSP Server Protocol document
|
| 246 |
+
*/
|
| 247 |
+
if ($this->getConfig()->getPaymentType() !== Mage_Worldnet_Model_Config::PAYMENT_TYPE_AUTHENTICATE) {
|
| 248 |
+
$queryPairs['ApplyAVSCV2'] = '0';
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
/**
|
| 252 |
+
* Allow fine control over 3D-Secure checks and rules by changing this value. 0 is Default
|
| 253 |
+
* It can be changed dynamically, per transaction, if you wish. See the VSP Server Protocol document
|
| 254 |
+
*/
|
| 255 |
+
$queryPairs['Apply3DSecure'] = '0';
|
| 256 |
+
|
| 257 |
+
if ($this->getDebug()) {
|
| 258 |
+
Mage::getModel('worldnet/api_debug')
|
| 259 |
+
->setRequestBody($this->getWorldnetUrl()."\n".print_r($queryPairs,1))
|
| 260 |
+
->save();
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
// Encrypt the plaintext string for inclusion in the hidden field
|
| 264 |
+
$result = $this->arrayToCrypt($queryPairs);
|
| 265 |
+
return $result;
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
/**
|
| 269 |
+
* Form block description
|
| 270 |
+
*
|
| 271 |
+
* @return object
|
| 272 |
+
*/
|
| 273 |
+
public function createFormBlock($name)
|
| 274 |
+
{
|
| 275 |
+
$block = $this->getLayout()->createBlock('worldnet/form_standard', $name);
|
| 276 |
+
$block->setMethod($this->_code);
|
| 277 |
+
$block->setPayment($this->getPayment());
|
| 278 |
+
return $block;
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
/**
|
| 282 |
+
* Return Order Place Redirect URL
|
| 283 |
+
*
|
| 284 |
+
* @return string Order Redirect URL
|
| 285 |
+
*/
|
| 286 |
+
public function getOrderPlaceRedirectUrl()
|
| 287 |
+
{
|
| 288 |
+
return Mage::getUrl('worldnet/standard/redirect');
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
/**
|
| 292 |
+
* Return encrypted string with simple XOR algorithm
|
| 293 |
+
*
|
| 294 |
+
* @param string String to be encrypted
|
| 295 |
+
* @return string Encrypted string
|
| 296 |
+
*/
|
| 297 |
+
protected function simpleXOR ($string)
|
| 298 |
+
{
|
| 299 |
+
$result = '';
|
| 300 |
+
$cryptKey = $this->getConfig()->getCryptKey();
|
| 301 |
+
|
| 302 |
+
if (!$cryptKey) {
|
| 303 |
+
return $string;
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
// Initialise key array
|
| 307 |
+
$keyList = array();
|
| 308 |
+
|
| 309 |
+
// Convert $cryptKey into array of ASCII values
|
| 310 |
+
for($i = 0; $i < strlen($cryptKey); $i++){
|
| 311 |
+
$keyList[$i] = ord(substr($cryptKey, $i, 1));
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
// Step through string a character at a time
|
| 315 |
+
for($i = 0; $i < strlen($string); $i++) {
|
| 316 |
+
/**
|
| 317 |
+
* Get ASCII code from string, get ASCII code from key (loop through with MOD),
|
| 318 |
+
* XOR the two, get the character from the result
|
| 319 |
+
* % is MOD (modulus), ^ is XOR
|
| 320 |
+
*/
|
| 321 |
+
$result .= chr(ord(substr($string, $i, 1)) ^ ($keyList[$i % strlen($cryptKey)]));
|
| 322 |
+
}
|
| 323 |
+
return $result;
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
/**
|
| 327 |
+
* Extract possible response values into array from query string
|
| 328 |
+
*
|
| 329 |
+
* @param string Query string i.e. var1=value1&var2=value3...
|
| 330 |
+
* @return array
|
| 331 |
+
*/
|
| 332 |
+
protected function getToken($queryString) {
|
| 333 |
+
|
| 334 |
+
// List the possible tokens
|
| 335 |
+
$Tokens = array(
|
| 336 |
+
"Status",
|
| 337 |
+
"StatusDetail",
|
| 338 |
+
"VendorTxCode",
|
| 339 |
+
"VPSTxId",
|
| 340 |
+
"TxAuthNo",
|
| 341 |
+
"Amount",
|
| 342 |
+
"AVSCV2",
|
| 343 |
+
"AddressResult",
|
| 344 |
+
"PostCodeResult",
|
| 345 |
+
"CV2Result",
|
| 346 |
+
"GiftAid",
|
| 347 |
+
"3DSecureStatus",
|
| 348 |
+
"CAVV"
|
| 349 |
+
);
|
| 350 |
+
|
| 351 |
+
// Initialise arrays
|
| 352 |
+
$output = array();
|
| 353 |
+
$resultArray = array();
|
| 354 |
+
|
| 355 |
+
// Get the next token in the sequence
|
| 356 |
+
$c = count($Tokens);
|
| 357 |
+
for ($i = $c - 1; $i >= 0 ; $i--){
|
| 358 |
+
// Find the position in the string
|
| 359 |
+
$start = strpos($queryString, $Tokens[$i]);
|
| 360 |
+
// If it's present
|
| 361 |
+
if ($start !== false){
|
| 362 |
+
// Record position and token name
|
| 363 |
+
$resultArray[$i]['start'] = $start;
|
| 364 |
+
$resultArray[$i]['token'] = $Tokens[$i];
|
| 365 |
+
}
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
// Sort in order of position
|
| 369 |
+
sort($resultArray);
|
| 370 |
+
|
| 371 |
+
// Go through the result array, getting the token values
|
| 372 |
+
$c = count($resultArray);
|
| 373 |
+
for ($i = 0; $i < $c; $i++){
|
| 374 |
+
// Get the start point of the value
|
| 375 |
+
$valueStart = $resultArray[$i]['start'] + strlen($resultArray[$i]['token']) + 1;
|
| 376 |
+
// Get the length of the value
|
| 377 |
+
if ($i == $c-1) {
|
| 378 |
+
$output[$resultArray[$i]['token']] = substr($queryString, $valueStart);
|
| 379 |
+
} else {
|
| 380 |
+
$valueLength = $resultArray[$i+1]['start'] - $resultArray[$i]['start'] - strlen($resultArray[$i]['token']) - 2;
|
| 381 |
+
$output[$resultArray[$i]['token']] = substr($queryString, $valueStart, $valueLength);
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
return $output;
|
| 387 |
+
}
|
| 388 |
+
|
| 389 |
+
/**
|
| 390 |
+
* Convert array (key => value, key => value, ...) to crypt string
|
| 391 |
+
*
|
| 392 |
+
* @param array Array to be converted
|
| 393 |
+
* @return string Crypt string
|
| 394 |
+
*/
|
| 395 |
+
public function arrayToCrypt ($array)
|
| 396 |
+
{
|
| 397 |
+
$parts = array();
|
| 398 |
+
if (is_array($array)) {
|
| 399 |
+
foreach ($array as $k => $v) {
|
| 400 |
+
$parts[] = $k . '=' . $v;
|
| 401 |
+
}
|
| 402 |
+
}
|
| 403 |
+
$result = implode('&', $parts);
|
| 404 |
+
$result = $this->simpleXOR($result);
|
| 405 |
+
$result = $this->base64Encode($result);
|
| 406 |
+
return $result;
|
| 407 |
+
}
|
| 408 |
+
|
| 409 |
+
/**
|
| 410 |
+
* Reverse arrayToCrypt
|
| 411 |
+
*
|
| 412 |
+
* @param string Crypt string
|
| 413 |
+
* @return array
|
| 414 |
+
*/
|
| 415 |
+
public function cryptToArray ($crypted)
|
| 416 |
+
{
|
| 417 |
+
$decoded = $this->base64Decode($crypted);
|
| 418 |
+
$uncrypted = $this->simpleXOR($decoded);
|
| 419 |
+
$tokens = $this->getToken($uncrypted);
|
| 420 |
+
return $tokens;
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
/**
|
| 424 |
+
* Custom base64_encode()
|
| 425 |
+
*
|
| 426 |
+
* @param String
|
| 427 |
+
* @return String
|
| 428 |
+
*/
|
| 429 |
+
protected function base64Encode($plain)
|
| 430 |
+
{
|
| 431 |
+
return base64_encode($plain);
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
/**
|
| 435 |
+
* Custom base64_decode()
|
| 436 |
+
*
|
| 437 |
+
* @param String
|
| 438 |
+
* @return String
|
| 439 |
+
*/
|
| 440 |
+
protected function base64Decode($scrambled)
|
| 441 |
+
{
|
| 442 |
+
// Fix plus to space conversion issue
|
| 443 |
+
$scrambled = str_replace(" ","+",$scrambled);
|
| 444 |
+
return base64_decode($scrambled);
|
| 445 |
+
}
|
| 446 |
+
|
| 447 |
+
/**
|
| 448 |
+
* Return Standard Checkout Form Fields for request to WorldnetTPS
|
| 449 |
+
*
|
| 450 |
+
* @return array Array of hidden form fields
|
| 451 |
+
*/
|
| 452 |
+
public function getStandardCheckoutFormFields ()
|
| 453 |
+
{
|
| 454 |
+
$order = $this->getOrder();
|
| 455 |
+
|
| 456 |
+
if (!($order instanceof Mage_Sales_Model_Order)) {
|
| 457 |
+
Mage::throwException($this->_getHelper()->__('Cannot retrieve order object'));
|
| 458 |
+
}
|
| 459 |
+
$session = Mage::getSingleton('checkout/session');
|
| 460 |
+
|
| 461 |
+
$gateway = $this->getConfig()->getWorldnetGateway();
|
| 462 |
+
|
| 463 |
+
// Get correct currency and checkout total in that currency
|
| 464 |
+
if($this->getConfig()->getWorldnetCheckoutCurrency() == Mage_Worldnet_Model_Config::CHECKOUTCUR_DISPLAY) {
|
| 465 |
+
$currency = Mage::app()->getStore()->getCurrentCurrencyCode();
|
| 466 |
+
$amount = sprintf('%.2f', $order->getGrandTotal());
|
| 467 |
+
} else {
|
| 468 |
+
$currency = $order->getBaseCurrencyCode();
|
| 469 |
+
$amount = sprintf('%.2f', $order->getBaseGrandTotal());
|
| 470 |
+
}
|
| 471 |
+
|
| 472 |
+
// Get relevant WorldNet account details for that currency
|
| 473 |
+
if($currency == $this->getConfig()->getCurrency()) {
|
| 474 |
+
$terminalid = $this->getConfig()->getTerminalid();
|
| 475 |
+
$sharedsecret = $this->getConfig()->getSharedsecret();
|
| 476 |
+
} elseif($currency == $this->getConfig()->getCurrencyTwo()) {
|
| 477 |
+
$terminalid = $this->getConfig()->getTerminalidTwo();
|
| 478 |
+
$sharedsecret = $this->getConfig()->getSharedsecretTwo();
|
| 479 |
+
} else {
|
| 480 |
+
$terminalid = $this->getConfig()->getTerminalidThree();
|
| 481 |
+
$sharedsecret = $this->getConfig()->getSharedsecretThree();
|
| 482 |
+
}
|
| 483 |
+
|
| 484 |
+
$orderid = $session->getQuoteId();
|
| 485 |
+
$datetime = date("d-m-y:H:i:s:000");
|
| 486 |
+
$billing = $order->getBillingAddress();
|
| 487 |
+
|
| 488 |
+
$receiptPageURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, Mage::app()->getStore()->isCurrentlySecure()) . 'index.php/worldnet/standard/successResponse';
|
| 489 |
+
|
| 490 |
+
$fields = array(
|
| 491 |
+
'TERMINALID' => $terminalid,
|
| 492 |
+
'ORDERID' => $orderid,
|
| 493 |
+
'CURRENCY' => $currency,
|
| 494 |
+
'AMOUNT' => $amount,
|
| 495 |
+
'DATETIME' => $datetime,
|
| 496 |
+
'CARDHOLDERNAME' => $billing->getFirstname() . ' ' . $billing->getLastname(),
|
| 497 |
+
'ADDRESS1' => $billing->getStreet(1),
|
| 498 |
+
'ADDRESS2' => $billing->getCity() . ', ' . $billing->getRegion(),
|
| 499 |
+
'POSTCODE' => $billing->getPostcode(),
|
| 500 |
+
'RECEIPTPAGEURL' => $receiptPageURL,
|
| 501 |
+
'HASH' => md5($terminalid.$orderid.$amount.$datetime.$receiptPageURL.$sharedsecret)
|
| 502 |
+
);
|
| 503 |
+
return $fields;
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
public function refund(Varien_Object $payment, $amount) {
|
| 507 |
+
require("Api/worldnet_tps_xml.php");
|
| 508 |
+
|
| 509 |
+
$order = $payment->getOrder();
|
| 510 |
+
|
| 511 |
+
if($this->getConfig()->getWorldnetCheckoutCurrency() == Mage_Worldnet_Model_Config::CHECKOUTCUR_DISPLAY) {
|
| 512 |
+
Mage::throwException("WorldNet plug-in cannot process refunds when the checkout currency is the cart display currency.");
|
| 513 |
+
} else {
|
| 514 |
+
$orderCurrency = $order->getBaseCurrencyCode();
|
| 515 |
+
}
|
| 516 |
+
|
| 517 |
+
if($orderCurrency == $this->getConfig()->getCurrency()) {
|
| 518 |
+
$terminalid = $this->getConfig()->getTerminalid();
|
| 519 |
+
$sharedsecret = $this->getConfig()->getSharedsecret();
|
| 520 |
+
} elseif($order->getBaseCurrencyCode() == $this->getConfig()->getCurrencyTwo()) {
|
| 521 |
+
$terminalid = $this->getConfig()->getTerminalidTwo();
|
| 522 |
+
$sharedsecret = $this->getConfig()->getSharedsecretTwo();
|
| 523 |
+
} else {
|
| 524 |
+
$terminalid = $this->getConfig()->getTerminalidThree();
|
| 525 |
+
$sharedsecret = $this->getConfig()->getSharedsecretThree();
|
| 526 |
+
}
|
| 527 |
+
|
| 528 |
+
$orderid = $payment->getRefundTransactionId();
|
| 529 |
+
$amount = sprintf('%.2f', $amount);
|
| 530 |
+
$gateway = $this->getConfig()->getWorldnetGateway();
|
| 531 |
+
|
| 532 |
+
$reason = "See Magento credit memo comments for more info";
|
| 533 |
+
|
| 534 |
+
$refund = new XmlRefundRequest($terminalid,$orderid,$amount,"Magento Admin",$reason);
|
| 535 |
+
$response = $refund->ProcessRequestToGateway($sharedsecret, ($this->getConfig()->getMode() == Mage_Worldnet_Model_Config::MODE_LIVE ? false : true), $gateway);
|
| 536 |
+
|
| 537 |
+
if($response->IsError()) {
|
| 538 |
+
$error = $response->ErrorString();
|
| 539 |
+
} else {
|
| 540 |
+
$expectedResponseHash = md5($terminalid . $orderid . $amount . $response->DateTime() . $response->ResponseCode() . $response->ResponseText() . $sharedsecret);
|
| 541 |
+
if($response->Hash() != $expectedResponseHash) {
|
| 542 |
+
$error = "Response Hash not as expected";
|
| 543 |
+
} else {
|
| 544 |
+
$payment->setStatus(self::STATUS_SUCCESS);
|
| 545 |
+
}
|
| 546 |
+
}
|
| 547 |
+
|
| 548 |
+
if (isset($error)) {
|
| 549 |
+
Mage::throwException($error);
|
| 550 |
+
}
|
| 551 |
+
|
| 552 |
+
return $this;
|
| 553 |
+
}
|
| 554 |
+
}
|
app/code/community/Mage/Worldnet/Model/Standard.php~
ADDED
|
@@ -0,0 +1,554 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Worldnet Form Model
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_Model_Standard
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
class Mage_Worldnet_Model_Standard extends Mage_Payment_Model_Method_Abstract
|
| 36 |
+
{
|
| 37 |
+
protected $_code = 'worldnet_standard';
|
| 38 |
+
protected $_formBlockType = 'worldnet/standard_form';
|
| 39 |
+
|
| 40 |
+
protected $_isGateway = false;
|
| 41 |
+
protected $_canAuthorize = true;
|
| 42 |
+
protected $_canCapture = true;
|
| 43 |
+
protected $_canCapturePartial = false;
|
| 44 |
+
protected $_canRefund = true;
|
| 45 |
+
protected $_canVoid = false;
|
| 46 |
+
protected $_canUseInternal = false;
|
| 47 |
+
protected $_canUseCheckout = true;
|
| 48 |
+
protected $_canUseForMultishipping = false;
|
| 49 |
+
|
| 50 |
+
protected $_order = null;
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Get Config model
|
| 55 |
+
*
|
| 56 |
+
* @return object Mage_Worldnet_Model_Config
|
| 57 |
+
*/
|
| 58 |
+
public function getConfig()
|
| 59 |
+
{
|
| 60 |
+
return Mage::getSingleton('worldnet/config');
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* Return debug flag
|
| 65 |
+
*
|
| 66 |
+
* @return boolean
|
| 67 |
+
*/
|
| 68 |
+
public function getDebug ()
|
| 69 |
+
{
|
| 70 |
+
return $this->getConfig()->getDebug();
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
/**
|
| 74 |
+
* Returns Target URL
|
| 75 |
+
*
|
| 76 |
+
* @return string Target URL
|
| 77 |
+
*/
|
| 78 |
+
public function getWorldnetUrl ()
|
| 79 |
+
{
|
| 80 |
+
$gateway = $this->getConfig()->getWorldnetGateway();
|
| 81 |
+
$testAccount = $this->getConfig()->getMode();
|
| 82 |
+
|
| 83 |
+
$serverUrl = 'https://';
|
| 84 |
+
|
| 85 |
+
if($testAccount) $serverUrl .= 'test';
|
| 86 |
+
switch (strtolower($gateway)) {
|
| 87 |
+
default :
|
| 88 |
+
case 'worldnet' : $serverUrl .= 'payments.worldnettps.com'; break;
|
| 89 |
+
case 'cashflows' : $serverUrl .= 'cashflows.worldnettps.com'; break;
|
| 90 |
+
case 'payius' : $serverUrl .= 'payments.payius.com' ; break;
|
| 91 |
+
case 'pagotechnology' : $serverUrl .= 'payments.pagotechnology.com' ; break;
|
| 92 |
+
case 'globalonepay' : $serverUrl .= 'payments.globalone.me' ; break;
|
| 93 |
+
case 'anywherecommerce' : $serverUrl .= 'payments.anywherecommerce.com' ; break;
|
| 94 |
+
case 'ctpayment' : $serverUrl .= 'payments.ct-payment.com' ; break;
|
| 95 |
+
case 'payzone' : $serverUrl .= 'payment.payzone.ie' ; break;
|
| 96 |
+
case 'payconex' : $serverUrl .= 'gateway.payconex.net' ; break;
|
| 97 |
+
|
| 98 |
+
}
|
| 99 |
+
$serverUrl .= '/merchant/paymentpage';
|
| 100 |
+
return $serverUrl;
|
| 101 |
+
|
| 102 |
+
//'https://' . ($testAccount == Mage_Worldnet_Model_Config::MODE_LIVE ? '' : 'test') . $gateway . '.worldnettps.com/merchant/paymentpage';
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
/**
|
| 106 |
+
* Return URL for Worldnet success response
|
| 107 |
+
*
|
| 108 |
+
* @return string URL
|
| 109 |
+
*/
|
| 110 |
+
protected function getSuccessURL ()
|
| 111 |
+
{
|
| 112 |
+
return Mage::getUrl('worldnet/standard/successresponse');
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
/**
|
| 116 |
+
* Return URL for Worldnet failure response
|
| 117 |
+
*
|
| 118 |
+
* @return string URL
|
| 119 |
+
*/
|
| 120 |
+
protected function getFailureURL ()
|
| 121 |
+
{
|
| 122 |
+
return Mage::getUrl('worldnet/standard/failureresponse');
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
/**
|
| 126 |
+
* Transaction unique ID sent to Worldnet and sent back by Worldnet for order restore
|
| 127 |
+
* Using created order ID
|
| 128 |
+
*
|
| 129 |
+
* @return string Transaction unique number
|
| 130 |
+
*/
|
| 131 |
+
protected function getVendorTxCode ()
|
| 132 |
+
{
|
| 133 |
+
return $this->getOrder()->getRealOrderId();
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
/**
|
| 137 |
+
* Returns cart formatted
|
| 138 |
+
* String format:
|
| 139 |
+
* Number of lines:Name1:Quantity1:CostNoTax1:Tax1:CostTax1:Total1:Name2:Quantity2:CostNoTax2...
|
| 140 |
+
*
|
| 141 |
+
* @return string Formatted cart items
|
| 142 |
+
*/
|
| 143 |
+
protected function getFormattedCart ()
|
| 144 |
+
{
|
| 145 |
+
$items = $this->getOrder()->getAllItems();
|
| 146 |
+
$resultParts = array();
|
| 147 |
+
$totalLines = 0;
|
| 148 |
+
if ($items) {
|
| 149 |
+
foreach($items as $item) {
|
| 150 |
+
if ($item->getParentItem()) {
|
| 151 |
+
continue;
|
| 152 |
+
}
|
| 153 |
+
$quantity = $item->getQtyOrdered();
|
| 154 |
+
|
| 155 |
+
$cost = sprintf('%.2f', $item->getBasePrice() - $item->getBaseDiscountAmount());
|
| 156 |
+
$tax = sprintf('%.2f', $item->getBaseTaxAmount());
|
| 157 |
+
$costPlusTax = sprintf('%.2f', $cost + $tax/$quantity);
|
| 158 |
+
|
| 159 |
+
$totalCostPlusTax = sprintf('%.2f', $quantity * $cost + $tax);
|
| 160 |
+
|
| 161 |
+
$resultParts[] = str_replace(':', ' ', $item->getName());
|
| 162 |
+
$resultParts[] = $quantity;
|
| 163 |
+
$resultParts[] = $cost;
|
| 164 |
+
$resultParts[] = $tax;
|
| 165 |
+
$resultParts[] = $costPlusTax;
|
| 166 |
+
$resultParts[] = $totalCostPlusTax;
|
| 167 |
+
$totalLines++; //counting actual formatted items
|
| 168 |
+
}
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
// add delivery
|
| 172 |
+
$shipping = $this->getOrder()->getBaseShippingAmount();
|
| 173 |
+
if ((int)$shipping > 0) {
|
| 174 |
+
$totalLines++;
|
| 175 |
+
$resultParts = array_merge($resultParts, array('Shipping','','','','',sprintf('%.2f', $shipping)));
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
$result = $totalLines . ':' . implode(':', $resultParts);
|
| 179 |
+
return $result;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
/**
|
| 183 |
+
* Format Crypted string with all order data for request to Worldnet
|
| 184 |
+
*
|
| 185 |
+
* @return string Crypted string
|
| 186 |
+
*/
|
| 187 |
+
protected function getCrypted ()
|
| 188 |
+
{
|
| 189 |
+
$order = $this->getOrder();
|
| 190 |
+
if (!($order instanceof Mage_Sales_Model_Order)) {
|
| 191 |
+
Mage::throwException($this->_getHelper()->__('Cannot retrieve order object'));
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
$shipping = $order->getShippingAddress();
|
| 195 |
+
$billing = $order->getBillingAddress();
|
| 196 |
+
|
| 197 |
+
$amount = $order->getBaseGrandTotal();
|
| 198 |
+
|
| 199 |
+
$currency = $order->getBaseCurrencyCode();
|
| 200 |
+
|
| 201 |
+
$queryPairs = array();
|
| 202 |
+
|
| 203 |
+
$transactionId = $this->getVendorTxCode();
|
| 204 |
+
$queryPairs['VendorTxCode'] = $transactionId;
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
$queryPairs['Amount'] = sprintf('%.2f', $amount);
|
| 208 |
+
$queryPairs['Currency'] = $currency;
|
| 209 |
+
|
| 210 |
+
// Up to 100 chars of free format description
|
| 211 |
+
$description = $this->getConfig()->getDescription() != ''
|
| 212 |
+
? $this->getConfig()->getDescription()
|
| 213 |
+
: Mage::app()->getStore()->getName() . ' ' . ' payment';
|
| 214 |
+
$queryPairs['Description'] = $description;
|
| 215 |
+
|
| 216 |
+
$queryPairs['SuccessURL'] = $this->getSuccessURL();
|
| 217 |
+
$queryPairs['FailureURL'] = $this->getFailureURL();
|
| 218 |
+
|
| 219 |
+
$queryPairs['CustomerName'] = $billing->getFirstname().' '.$billing->getLastname();
|
| 220 |
+
$queryPairs['CustomerEMail'] = $order->getCustomerEmail();
|
| 221 |
+
$queryPairs['ContactNumber'] = $billing->getTelephone();
|
| 222 |
+
$queryPairs['ContactFax'] = $billing->getFax();
|
| 223 |
+
|
| 224 |
+
$queryPairs['VendorEMail'] = '';
|
| 225 |
+
$queryPairs['eMailMessage'] = '';
|
| 226 |
+
|
| 227 |
+
$queryPairs['BillingAddress'] = $billing->format('oneline');
|
| 228 |
+
$queryPairs['BillingPostCode'] = $billing->getPostcode();
|
| 229 |
+
|
| 230 |
+
if ($shipping) {
|
| 231 |
+
$queryPairs['DeliveryAddress'] = $shipping->getFormated();
|
| 232 |
+
$queryPairs['DeliveryPostCode'] = $shipping->getPostcode();
|
| 233 |
+
} else {
|
| 234 |
+
$queryPairs['DeliveryAddress'] = '';
|
| 235 |
+
$queryPairs['DeliveryPostCode'] = '';
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
$queryPairs['Basket'] = $this->getFormattedCart();
|
| 239 |
+
|
| 240 |
+
// For charities registered for Gift Aid
|
| 241 |
+
$queryPairs['AllowGiftAid'] = '0';
|
| 242 |
+
|
| 243 |
+
/**
|
| 244 |
+
* Allow fine control over AVS/CV2 checks and rules by changing this value. 0 is Default
|
| 245 |
+
* It can be changed dynamically, per transaction, if you wish. See the VSP Server Protocol document
|
| 246 |
+
*/
|
| 247 |
+
if ($this->getConfig()->getPaymentType() !== Mage_Worldnet_Model_Config::PAYMENT_TYPE_AUTHENTICATE) {
|
| 248 |
+
$queryPairs['ApplyAVSCV2'] = '0';
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
/**
|
| 252 |
+
* Allow fine control over 3D-Secure checks and rules by changing this value. 0 is Default
|
| 253 |
+
* It can be changed dynamically, per transaction, if you wish. See the VSP Server Protocol document
|
| 254 |
+
*/
|
| 255 |
+
$queryPairs['Apply3DSecure'] = '0';
|
| 256 |
+
|
| 257 |
+
if ($this->getDebug()) {
|
| 258 |
+
Mage::getModel('worldnet/api_debug')
|
| 259 |
+
->setRequestBody($this->getWorldnetUrl()."\n".print_r($queryPairs,1))
|
| 260 |
+
->save();
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
// Encrypt the plaintext string for inclusion in the hidden field
|
| 264 |
+
$result = $this->arrayToCrypt($queryPairs);
|
| 265 |
+
return $result;
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
/**
|
| 269 |
+
* Form block description
|
| 270 |
+
*
|
| 271 |
+
* @return object
|
| 272 |
+
*/
|
| 273 |
+
public function createFormBlock($name)
|
| 274 |
+
{
|
| 275 |
+
$block = $this->getLayout()->createBlock('worldnet/form_standard', $name);
|
| 276 |
+
$block->setMethod($this->_code);
|
| 277 |
+
$block->setPayment($this->getPayment());
|
| 278 |
+
return $block;
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
/**
|
| 282 |
+
* Return Order Place Redirect URL
|
| 283 |
+
*
|
| 284 |
+
* @return string Order Redirect URL
|
| 285 |
+
*/
|
| 286 |
+
public function getOrderPlaceRedirectUrl()
|
| 287 |
+
{
|
| 288 |
+
return Mage::getUrl('worldnet/standard/redirect');
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
/**
|
| 292 |
+
* Return encrypted string with simple XOR algorithm
|
| 293 |
+
*
|
| 294 |
+
* @param string String to be encrypted
|
| 295 |
+
* @return string Encrypted string
|
| 296 |
+
*/
|
| 297 |
+
protected function simpleXOR ($string)
|
| 298 |
+
{
|
| 299 |
+
$result = '';
|
| 300 |
+
$cryptKey = $this->getConfig()->getCryptKey();
|
| 301 |
+
|
| 302 |
+
if (!$cryptKey) {
|
| 303 |
+
return $string;
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
// Initialise key array
|
| 307 |
+
$keyList = array();
|
| 308 |
+
|
| 309 |
+
// Convert $cryptKey into array of ASCII values
|
| 310 |
+
for($i = 0; $i < strlen($cryptKey); $i++){
|
| 311 |
+
$keyList[$i] = ord(substr($cryptKey, $i, 1));
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
// Step through string a character at a time
|
| 315 |
+
for($i = 0; $i < strlen($string); $i++) {
|
| 316 |
+
/**
|
| 317 |
+
* Get ASCII code from string, get ASCII code from key (loop through with MOD),
|
| 318 |
+
* XOR the two, get the character from the result
|
| 319 |
+
* % is MOD (modulus), ^ is XOR
|
| 320 |
+
*/
|
| 321 |
+
$result .= chr(ord(substr($string, $i, 1)) ^ ($keyList[$i % strlen($cryptKey)]));
|
| 322 |
+
}
|
| 323 |
+
return $result;
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
/**
|
| 327 |
+
* Extract possible response values into array from query string
|
| 328 |
+
*
|
| 329 |
+
* @param string Query string i.e. var1=value1&var2=value3...
|
| 330 |
+
* @return array
|
| 331 |
+
*/
|
| 332 |
+
protected function getToken($queryString) {
|
| 333 |
+
|
| 334 |
+
// List the possible tokens
|
| 335 |
+
$Tokens = array(
|
| 336 |
+
"Status",
|
| 337 |
+
"StatusDetail",
|
| 338 |
+
"VendorTxCode",
|
| 339 |
+
"VPSTxId",
|
| 340 |
+
"TxAuthNo",
|
| 341 |
+
"Amount",
|
| 342 |
+
"AVSCV2",
|
| 343 |
+
"AddressResult",
|
| 344 |
+
"PostCodeResult",
|
| 345 |
+
"CV2Result",
|
| 346 |
+
"GiftAid",
|
| 347 |
+
"3DSecureStatus",
|
| 348 |
+
"CAVV"
|
| 349 |
+
);
|
| 350 |
+
|
| 351 |
+
// Initialise arrays
|
| 352 |
+
$output = array();
|
| 353 |
+
$resultArray = array();
|
| 354 |
+
|
| 355 |
+
// Get the next token in the sequence
|
| 356 |
+
$c = count($Tokens);
|
| 357 |
+
for ($i = $c - 1; $i >= 0 ; $i--){
|
| 358 |
+
// Find the position in the string
|
| 359 |
+
$start = strpos($queryString, $Tokens[$i]);
|
| 360 |
+
// If it's present
|
| 361 |
+
if ($start !== false){
|
| 362 |
+
// Record position and token name
|
| 363 |
+
$resultArray[$i]['start'] = $start;
|
| 364 |
+
$resultArray[$i]['token'] = $Tokens[$i];
|
| 365 |
+
}
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
// Sort in order of position
|
| 369 |
+
sort($resultArray);
|
| 370 |
+
|
| 371 |
+
// Go through the result array, getting the token values
|
| 372 |
+
$c = count($resultArray);
|
| 373 |
+
for ($i = 0; $i < $c; $i++){
|
| 374 |
+
// Get the start point of the value
|
| 375 |
+
$valueStart = $resultArray[$i]['start'] + strlen($resultArray[$i]['token']) + 1;
|
| 376 |
+
// Get the length of the value
|
| 377 |
+
if ($i == $c-1) {
|
| 378 |
+
$output[$resultArray[$i]['token']] = substr($queryString, $valueStart);
|
| 379 |
+
} else {
|
| 380 |
+
$valueLength = $resultArray[$i+1]['start'] - $resultArray[$i]['start'] - strlen($resultArray[$i]['token']) - 2;
|
| 381 |
+
$output[$resultArray[$i]['token']] = substr($queryString, $valueStart, $valueLength);
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
return $output;
|
| 387 |
+
}
|
| 388 |
+
|
| 389 |
+
/**
|
| 390 |
+
* Convert array (key => value, key => value, ...) to crypt string
|
| 391 |
+
*
|
| 392 |
+
* @param array Array to be converted
|
| 393 |
+
* @return string Crypt string
|
| 394 |
+
*/
|
| 395 |
+
public function arrayToCrypt ($array)
|
| 396 |
+
{
|
| 397 |
+
$parts = array();
|
| 398 |
+
if (is_array($array)) {
|
| 399 |
+
foreach ($array as $k => $v) {
|
| 400 |
+
$parts[] = $k . '=' . $v;
|
| 401 |
+
}
|
| 402 |
+
}
|
| 403 |
+
$result = implode('&', $parts);
|
| 404 |
+
$result = $this->simpleXOR($result);
|
| 405 |
+
$result = $this->base64Encode($result);
|
| 406 |
+
return $result;
|
| 407 |
+
}
|
| 408 |
+
|
| 409 |
+
/**
|
| 410 |
+
* Reverse arrayToCrypt
|
| 411 |
+
*
|
| 412 |
+
* @param string Crypt string
|
| 413 |
+
* @return array
|
| 414 |
+
*/
|
| 415 |
+
public function cryptToArray ($crypted)
|
| 416 |
+
{
|
| 417 |
+
$decoded = $this->base64Decode($crypted);
|
| 418 |
+
$uncrypted = $this->simpleXOR($decoded);
|
| 419 |
+
$tokens = $this->getToken($uncrypted);
|
| 420 |
+
return $tokens;
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
/**
|
| 424 |
+
* Custom base64_encode()
|
| 425 |
+
*
|
| 426 |
+
* @param String
|
| 427 |
+
* @return String
|
| 428 |
+
*/
|
| 429 |
+
protected function base64Encode($plain)
|
| 430 |
+
{
|
| 431 |
+
return base64_encode($plain);
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
/**
|
| 435 |
+
* Custom base64_decode()
|
| 436 |
+
*
|
| 437 |
+
* @param String
|
| 438 |
+
* @return String
|
| 439 |
+
*/
|
| 440 |
+
protected function base64Decode($scrambled)
|
| 441 |
+
{
|
| 442 |
+
// Fix plus to space conversion issue
|
| 443 |
+
$scrambled = str_replace(" ","+",$scrambled);
|
| 444 |
+
return base64_decode($scrambled);
|
| 445 |
+
}
|
| 446 |
+
|
| 447 |
+
/**
|
| 448 |
+
* Return Standard Checkout Form Fields for request to WorldnetTPS
|
| 449 |
+
*
|
| 450 |
+
* @return array Array of hidden form fields
|
| 451 |
+
*/
|
| 452 |
+
public function getStandardCheckoutFormFields ()
|
| 453 |
+
{
|
| 454 |
+
$order = $this->getOrder();
|
| 455 |
+
|
| 456 |
+
if (!($order instanceof Mage_Sales_Model_Order)) {
|
| 457 |
+
Mage::throwException($this->_getHelper()->__('Cannot retrieve order object'));
|
| 458 |
+
}
|
| 459 |
+
$session = Mage::getSingleton('checkout/session');
|
| 460 |
+
|
| 461 |
+
$gateway = $this->getConfig()->getWorldnetGateway();
|
| 462 |
+
|
| 463 |
+
// Get correct currency and checkout total in that currency
|
| 464 |
+
if($this->getConfig()->getWorldnetCheckoutCurrency() == Mage_Worldnet_Model_Config::CHECKOUTCUR_DISPLAY) {
|
| 465 |
+
$currency = Mage::app()->getStore()->getCurrentCurrencyCode();
|
| 466 |
+
$amount = sprintf('%.2f', $order->getGrandTotal());
|
| 467 |
+
} else {
|
| 468 |
+
$currency = $order->getBaseCurrencyCode();
|
| 469 |
+
$amount = sprintf('%.2f', $order->getBaseGrandTotal());
|
| 470 |
+
}
|
| 471 |
+
|
| 472 |
+
// Get relevant WorldNet account details for that currency
|
| 473 |
+
if($currency == $this->getConfig()->getCurrency()) {
|
| 474 |
+
$terminalid = $this->getConfig()->getTerminalid();
|
| 475 |
+
$sharedsecret = $this->getConfig()->getSharedsecret();
|
| 476 |
+
} elseif($currency == $this->getConfig()->getCurrencyTwo()) {
|
| 477 |
+
$terminalid = $this->getConfig()->getTerminalidTwo();
|
| 478 |
+
$sharedsecret = $this->getConfig()->getSharedsecretTwo();
|
| 479 |
+
} else {
|
| 480 |
+
$terminalid = $this->getConfig()->getTerminalidThree();
|
| 481 |
+
$sharedsecret = $this->getConfig()->getSharedsecretThree();
|
| 482 |
+
}
|
| 483 |
+
|
| 484 |
+
$orderid = $session->getQuoteId();
|
| 485 |
+
$datetime = date("d-m-y:H:i:s:000");
|
| 486 |
+
$billing = $order->getBillingAddress();
|
| 487 |
+
|
| 488 |
+
$receiptPageURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, Mage::app()->getStore()->isCurrentlySecure()) . 'index.php/worldnet/standard/successResponse';
|
| 489 |
+
|
| 490 |
+
$fields = array(
|
| 491 |
+
'TERMINALID' => $terminalid,
|
| 492 |
+
'ORDERID' => $orderid,
|
| 493 |
+
'CURRENCY' => $currency,
|
| 494 |
+
'AMOUNT' => $amount,
|
| 495 |
+
'DATETIME' => $datetime,
|
| 496 |
+
'CARDHOLDERNAME' => $billing->getFirstname() . ' ' . $billing->getLastname(),
|
| 497 |
+
'ADDRESS1' => $billing->getStreet(1),
|
| 498 |
+
'ADDRESS2' => $billing->getCity() . ', ' . $billing->getRegion(),
|
| 499 |
+
'POSTCODE' => $billing->getPostcode(),
|
| 500 |
+
'RECEIPTPAGEURL' => $receiptPageURL,
|
| 501 |
+
'HASH' => md5($terminalid.$orderid.$amount.$datetime.$receiptPageURL.$sharedsecret)
|
| 502 |
+
);
|
| 503 |
+
return $fields;
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
public function refund(Varien_Object $payment, $amount) {
|
| 507 |
+
require("Api/worldnet_tps_xml.php");
|
| 508 |
+
|
| 509 |
+
$order = $payment->getOrder();
|
| 510 |
+
|
| 511 |
+
if($this->getConfig()->getWorldnetCheckoutCurrency() == Mage_Worldnet_Model_Config::CHECKOUTCUR_DISPLAY) {
|
| 512 |
+
Mage::throwException("WorldNet plug-in cannot process refunds when the checkout currency is the cart display currency.");
|
| 513 |
+
} else {
|
| 514 |
+
$orderCurrency = $order->getBaseCurrencyCode();
|
| 515 |
+
}
|
| 516 |
+
|
| 517 |
+
if($orderCurrency == $this->getConfig()->getCurrency()) {
|
| 518 |
+
$terminalid = $this->getConfig()->getTerminalid();
|
| 519 |
+
$sharedsecret = $this->getConfig()->getSharedsecret();
|
| 520 |
+
} elseif($order->getBaseCurrencyCode() == $this->getConfig()->getCurrencyTwo()) {
|
| 521 |
+
$terminalid = $this->getConfig()->getTerminalidTwo();
|
| 522 |
+
$sharedsecret = $this->getConfig()->getSharedsecretTwo();
|
| 523 |
+
} else {
|
| 524 |
+
$terminalid = $this->getConfig()->getTerminalidThree();
|
| 525 |
+
$sharedsecret = $this->getConfig()->getSharedsecretThree();
|
| 526 |
+
}
|
| 527 |
+
|
| 528 |
+
$orderid = $payment->getRefundTransactionId();
|
| 529 |
+
$amount = sprintf('%.2f', $amount);
|
| 530 |
+
$gateway = $this->getConfig()->getWorldnetGateway();
|
| 531 |
+
|
| 532 |
+
$reason = "See Magento credit memo comments for more info";
|
| 533 |
+
|
| 534 |
+
$refund = new XmlRefundRequest($terminalid,$orderid,$amount,"Magento Admin",$reason);
|
| 535 |
+
$response = $refund->ProcessRequestToGateway($sharedsecret, ($this->getConfig()->getMode() == Mage_Worldnet_Model_Config::MODE_LIVE ? false : true), $gateway);
|
| 536 |
+
|
| 537 |
+
if($response->IsError()) {
|
| 538 |
+
$error = $response->ErrorString();
|
| 539 |
+
} else {
|
| 540 |
+
$expectedResponseHash = md5($terminalid . $orderid . $amount . $response->DateTime() . $response->ResponseCode() . $response->ResponseText() . $sharedsecret);
|
| 541 |
+
if($response->Hash() != $expectedResponseHash) {
|
| 542 |
+
$error = "Response Hash not as expected";
|
| 543 |
+
} else {
|
| 544 |
+
$payment->setStatus(self::STATUS_SUCCESS);
|
| 545 |
+
}
|
| 546 |
+
}
|
| 547 |
+
|
| 548 |
+
if (isset($error)) {
|
| 549 |
+
Mage::throwException($error);
|
| 550 |
+
}
|
| 551 |
+
|
| 552 |
+
return $this;
|
| 553 |
+
}
|
| 554 |
+
}
|
app/code/community/Mage/Worldnet/controllers/StandardController.php
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* WorldnetTPS Form Method Front Controller
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Worldnet
|
| 32 |
+
* @name Mage_Worldnet_StandardController
|
| 33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 34 |
+
*/
|
| 35 |
+
class Mage_Worldnet_StandardController extends Mage_Core_Controller_Front_Action
|
| 36 |
+
{
|
| 37 |
+
public $isValidResponse = false;
|
| 38 |
+
|
| 39 |
+
/**
|
| 40 |
+
* Get singleton with worldnet strandard
|
| 41 |
+
*
|
| 42 |
+
* @return object Mage_Worldnet_Model_Standard
|
| 43 |
+
*/
|
| 44 |
+
public function getStandard()
|
| 45 |
+
{
|
| 46 |
+
return Mage::getSingleton('worldnet/standard');
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/**
|
| 50 |
+
* Get Config model
|
| 51 |
+
*
|
| 52 |
+
* @return object Mage_Worldnet_Model_Config
|
| 53 |
+
*/
|
| 54 |
+
public function getConfig()
|
| 55 |
+
{
|
| 56 |
+
return $this->getStandard()->getConfig();
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* Return debug flag
|
| 61 |
+
*
|
| 62 |
+
* @return boolean
|
| 63 |
+
*/
|
| 64 |
+
public function getDebug ()
|
| 65 |
+
{
|
| 66 |
+
return $this->getStandard()->getDebug();
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* When a customer chooses Worldnet on Checkout/Payment page
|
| 71 |
+
*
|
| 72 |
+
*/
|
| 73 |
+
public function redirectAction()
|
| 74 |
+
{
|
| 75 |
+
$session = Mage::getSingleton('checkout/session');
|
| 76 |
+
$session->setWorldnetStandardQuoteId($session->getQuoteId());
|
| 77 |
+
|
| 78 |
+
$order = Mage::getModel('sales/order');
|
| 79 |
+
$order->loadByIncrementId($session->getLastRealOrderId());
|
| 80 |
+
$order->addStatusToHistory(
|
| 81 |
+
$order->getStatus(),
|
| 82 |
+
Mage::helper('worldnet')->__('Customer was redirected to WorldnetTPS')
|
| 83 |
+
);
|
| 84 |
+
$order->save();
|
| 85 |
+
|
| 86 |
+
$this->getResponse()
|
| 87 |
+
->setBody($this->getLayout()
|
| 88 |
+
->createBlock('worldnet/standard_redirect')
|
| 89 |
+
->setOrder($order)
|
| 90 |
+
->toHtml());
|
| 91 |
+
|
| 92 |
+
$session->unsQuoteId();
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
/**
|
| 96 |
+
* Success response from Worldnet
|
| 97 |
+
*
|
| 98 |
+
* @return void
|
| 99 |
+
*/
|
| 100 |
+
public function successResponseAction()
|
| 101 |
+
{
|
| 102 |
+
$session = Mage::getSingleton('checkout/session');
|
| 103 |
+
$session->setQuoteId($session->getWorldnetStandardQuoteId(true));
|
| 104 |
+
|
| 105 |
+
$wnOrderId = $this->getRequest()->ORDERID;
|
| 106 |
+
$wnApprovalCode = $this->getRequest()->APPROVALCODE;
|
| 107 |
+
$wnResponseCode = $this->getRequest()->RESPONSECODE;
|
| 108 |
+
$wnResponseText = $this->getRequest()->RESPONSETEXT;
|
| 109 |
+
$wnDateTime = $this->getRequest()->DATETIME;
|
| 110 |
+
$wnHash = $this->getRequest()->HASH;
|
| 111 |
+
|
| 112 |
+
$order = Mage::getModel('sales/order');
|
| 113 |
+
|
| 114 |
+
Mage::log("Session Order ID : ".$session->getLastRealOrderId());
|
| 115 |
+
Mage::log("Worldnet Order ID : ".$wnOrderId);
|
| 116 |
+
$order->loadByIncrementId($session->getLastRealOrderId());
|
| 117 |
+
|
| 118 |
+
if (!$order->getId()) {
|
| 119 |
+
Mage::log('No order found.');
|
| 120 |
+
/*
|
| 121 |
+
* need to have logic when there is no order with the order id from WorldnetTPS
|
| 122 |
+
*/
|
| 123 |
+
return false;
|
| 124 |
+
}
|
| 125 |
+
Mage::log('Order Found');
|
| 126 |
+
if($wnResponseCode == 'A'){
|
| 127 |
+
$order->addStatusToHistory(
|
| 128 |
+
$order->getStatus(),
|
| 129 |
+
Mage::helper('worldnet')->__('Worldnet TPS: Transaction Authorised.')
|
| 130 |
+
);
|
| 131 |
+
|
| 132 |
+
// $order->setStatus("complete");
|
| 133 |
+
$order->sendNewOrderEmail();
|
| 134 |
+
$order->getPayment()->setTransactionId($wnOrderId);
|
| 135 |
+
|
| 136 |
+
$this->saveInvoice($order);
|
| 137 |
+
$order->save();
|
| 138 |
+
|
| 139 |
+
$session = Mage::getSingleton('checkout/session');
|
| 140 |
+
$session->setQuoteId($wnOrderId);
|
| 141 |
+
Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
|
| 142 |
+
$this->_redirect('checkout/onepage/success');
|
| 143 |
+
}
|
| 144 |
+
else{
|
| 145 |
+
$session = Mage::getSingleton('checkout/session');
|
| 146 |
+
$session->setQuoteId($session->getWorldnetStandardQuoteId(true));
|
| 147 |
+
|
| 148 |
+
if($wnResponseCode == 'R') $order->addStatusToHistory($order->getStatus(), Mage::helper('worldnet')->__("Worldnet TPS: Transaction Authorised. TRANSACTION REFERRED."));
|
| 149 |
+
else $order->addStatusToHistory($order->getStatus(), Mage::helper('worldnet')->__("Worldnet TPS: Transaction Authorised. TRANSACTION DECLINED."));
|
| 150 |
+
|
| 151 |
+
$session->setErrorMessage("Transaction was not authorised by your Issuer.<br /><br />Response Text : ".$wnResponseText."<br />Response Code :".$wnResponseCode);
|
| 152 |
+
// cancel order in anyway
|
| 153 |
+
$order->cancel();
|
| 154 |
+
$order->save();
|
| 155 |
+
|
| 156 |
+
$this->_redirect('worldnet/standard/failure');
|
| 157 |
+
}
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
/**
|
| 161 |
+
* Save invoice for order
|
| 162 |
+
*
|
| 163 |
+
* @param Mage_Sales_Model_Order $order
|
| 164 |
+
* @return boolean Can save invoice or not
|
| 165 |
+
*/
|
| 166 |
+
protected function saveInvoice (Mage_Sales_Model_Order $order)
|
| 167 |
+
{
|
| 168 |
+
if ($order->canInvoice()) {
|
| 169 |
+
$invoice = $order->prepareInvoice();
|
| 170 |
+
|
| 171 |
+
$invoice->register()->capture();
|
| 172 |
+
Mage::getModel('core/resource_transaction')
|
| 173 |
+
->addObject($invoice)
|
| 174 |
+
->addObject($invoice->getOrder())
|
| 175 |
+
->save();
|
| 176 |
+
return true;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
return false;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
/**
|
| 183 |
+
* Failure response from Worldnet
|
| 184 |
+
*
|
| 185 |
+
* @return void
|
| 186 |
+
*/
|
| 187 |
+
public function failureResponseAction ()
|
| 188 |
+
{
|
| 189 |
+
$this->preResponse();
|
| 190 |
+
|
| 191 |
+
if (!$this->isValidResponse) {
|
| 192 |
+
$this->_redirect('');
|
| 193 |
+
return ;
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
$transactionId = $this->responseArr['VendorTxCode'];
|
| 197 |
+
|
| 198 |
+
if ($this->getDebug()) {
|
| 199 |
+
Mage::getModel('worldnet/api_debug')
|
| 200 |
+
->setResponseBody(print_r($this->responseArr,1))
|
| 201 |
+
->save();
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
$order = Mage::getModel('sales/order');
|
| 205 |
+
$order->loadByIncrementId($transactionId);
|
| 206 |
+
|
| 207 |
+
if (!$order->getId()) {
|
| 208 |
+
/**
|
| 209 |
+
* need to have logic when there is no order with the order id from Worldnet
|
| 210 |
+
*/
|
| 211 |
+
return false;
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
// cancel order in anyway
|
| 215 |
+
$order->cancel();
|
| 216 |
+
|
| 217 |
+
$session = Mage::getSingleton('checkout/session');
|
| 218 |
+
$session->setQuoteId($session->getWorldnetStandardQuoteId(true));
|
| 219 |
+
|
| 220 |
+
// Customer clicked CANCEL Butoon
|
| 221 |
+
if ($this->responseArr['Status'] == 'ABORT') {
|
| 222 |
+
$history = Mage::helper('worldnet')->__('Order '.$order->getId().' was canceled by customer');
|
| 223 |
+
$redirectTo = 'checkout/cart';
|
| 224 |
+
} else {
|
| 225 |
+
$history = Mage::helper('worldnet')->__($this->responseArr['StatusDetail']);
|
| 226 |
+
$session->setErrorMessage($this->responseArr['StatusDetail']);
|
| 227 |
+
$redirectTo = 'worldnet/standard/failure';
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
$history = Mage::helper('worldnet')->__('Customer was returned from WorldnetTPS.') . ' ' . $history;
|
| 231 |
+
$order->addStatusToHistory($order->getStatus(), $history);
|
| 232 |
+
$order->save();
|
| 233 |
+
|
| 234 |
+
$this->_redirect($redirectTo);
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
/**
|
| 238 |
+
* Expected GET HTTP Method
|
| 239 |
+
*
|
| 240 |
+
* @return void
|
| 241 |
+
*/
|
| 242 |
+
protected function preResponse ()
|
| 243 |
+
{
|
| 244 |
+
$responseCryptString = $this->getRequest()->crypt;
|
| 245 |
+
|
| 246 |
+
if ($responseCryptString != '') {
|
| 247 |
+
$rArr = $this->getStandard()->cryptToArray($responseCryptString);
|
| 248 |
+
$ok = is_array($rArr)
|
| 249 |
+
&& isset($rArr['Status']) && $rArr['Status'] != ''
|
| 250 |
+
&& isset($rArr['VendorTxCode']) && $rArr['VendorTxCode'] != ''
|
| 251 |
+
&& isset($rArr['Amount']) && $rArr['Amount'] != '';
|
| 252 |
+
|
| 253 |
+
if ($ok) {
|
| 254 |
+
$this->responseArr = $rArr;
|
| 255 |
+
$this->isValidResponse = true;
|
| 256 |
+
}
|
| 257 |
+
}
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
/**
|
| 261 |
+
* Failure Action
|
| 262 |
+
*
|
| 263 |
+
* @return void
|
| 264 |
+
*/
|
| 265 |
+
public function failureAction ()
|
| 266 |
+
{
|
| 267 |
+
$session = Mage::getSingleton('checkout/session');
|
| 268 |
+
|
| 269 |
+
if (!$session->getErrorMessage()) {
|
| 270 |
+
$this->_redirect('checkout/cart');
|
| 271 |
+
return;
|
| 272 |
+
}
|
| 273 |
+
$this->_redirect('checkout/onepage/failure');
|
| 274 |
+
}
|
| 275 |
+
}
|
app/code/community/Mage/Worldnet/etc/config.xml
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* Magento
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 12 |
+
* If you did not receive a copy of the license and are unable to
|
| 13 |
+
* obtain it through the world-wide-web, please send an email
|
| 14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 15 |
+
*
|
| 16 |
+
* DISCLAIMER
|
| 17 |
+
*
|
| 18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 19 |
+
* versions in the future. If you wish to customize Magento for your
|
| 20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 21 |
+
*
|
| 22 |
+
* @category Mage
|
| 23 |
+
* @package Mage_Worldnet
|
| 24 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 26 |
+
*/
|
| 27 |
+
-->
|
| 28 |
+
<config>
|
| 29 |
+
<modules>
|
| 30 |
+
<Mage_Worldnet>
|
| 31 |
+
<version>1.3.0</version>
|
| 32 |
+
</Mage_Worldnet>
|
| 33 |
+
</modules>
|
| 34 |
+
<global>
|
| 35 |
+
<models>
|
| 36 |
+
<worldnet>
|
| 37 |
+
<class>Mage_Worldnet_Model</class>
|
| 38 |
+
<resourceModel>worldnet_mysql4</resourceModel>
|
| 39 |
+
</worldnet>
|
| 40 |
+
<worldnet_mysql4>
|
| 41 |
+
<class>Mage_Worldnet_Model_Mysql4</class>
|
| 42 |
+
<entities>
|
| 43 |
+
<api_debug><table>worldnet_api_debug</table></api_debug>
|
| 44 |
+
</entities>
|
| 45 |
+
</worldnet_mysql4>
|
| 46 |
+
</models>
|
| 47 |
+
<resources>
|
| 48 |
+
<worldnet_setup>
|
| 49 |
+
<setup>
|
| 50 |
+
<module>Mage_Worldnet</module>
|
| 51 |
+
</setup>
|
| 52 |
+
<connection>
|
| 53 |
+
<use>core_setup</use>
|
| 54 |
+
</connection>
|
| 55 |
+
</worldnet_setup>
|
| 56 |
+
<worldnet_write>
|
| 57 |
+
<connection>
|
| 58 |
+
<use>core_write</use>
|
| 59 |
+
</connection>
|
| 60 |
+
</worldnet_write>
|
| 61 |
+
<worldnet_read>
|
| 62 |
+
<connection>
|
| 63 |
+
<use>core_read</use>
|
| 64 |
+
</connection>
|
| 65 |
+
</worldnet_read>
|
| 66 |
+
</resources>
|
| 67 |
+
<blocks>
|
| 68 |
+
<worldnet><class>Mage_Worldnet_Block</class></worldnet>
|
| 69 |
+
</blocks>
|
| 70 |
+
</global>
|
| 71 |
+
<frontend>
|
| 72 |
+
<secure_url>
|
| 73 |
+
<worldnet_standard>/worldnet/standard</worldnet_standard>
|
| 74 |
+
</secure_url>
|
| 75 |
+
<routers>
|
| 76 |
+
<worldnet>
|
| 77 |
+
<use>standard</use>
|
| 78 |
+
<args>
|
| 79 |
+
<module>Mage_Worldnet</module>
|
| 80 |
+
<frontName>worldnet</frontName>
|
| 81 |
+
</args>
|
| 82 |
+
</worldnet>
|
| 83 |
+
</routers>
|
| 84 |
+
<translate>
|
| 85 |
+
<modules>
|
| 86 |
+
<Mage_Worldnet>
|
| 87 |
+
<files>
|
| 88 |
+
<default>Mage_Worldnet.csv</default>
|
| 89 |
+
</files>
|
| 90 |
+
</Mage_Worldnet>
|
| 91 |
+
</modules>
|
| 92 |
+
</translate>
|
| 93 |
+
<layout>
|
| 94 |
+
<updates>
|
| 95 |
+
<worldnet>
|
| 96 |
+
<file>worldnet.xml</file>
|
| 97 |
+
</worldnet>
|
| 98 |
+
</updates>
|
| 99 |
+
</layout>
|
| 100 |
+
</frontend>
|
| 101 |
+
<adminhtml>
|
| 102 |
+
<translate>
|
| 103 |
+
<modules>
|
| 104 |
+
<Mage_Worldnet>
|
| 105 |
+
<files>
|
| 106 |
+
<default>Mage_Worldnet.csv</default>
|
| 107 |
+
</files>
|
| 108 |
+
</Mage_Worldnet>
|
| 109 |
+
</modules>
|
| 110 |
+
</translate>
|
| 111 |
+
</adminhtml>
|
| 112 |
+
<default>
|
| 113 |
+
<payment>
|
| 114 |
+
<worldnet_standard>
|
| 115 |
+
<worldnet_action>Payment</worldnet_action>
|
| 116 |
+
<model>worldnet/standard</model>
|
| 117 |
+
<order_status>pending</order_status>
|
| 118 |
+
<title>WorldNet TPS secure payment page</title>
|
| 119 |
+
<allowspecific>0</allowspecific>
|
| 120 |
+
</worldnet_standard>
|
| 121 |
+
</payment>
|
| 122 |
+
</default>
|
| 123 |
+
</config>
|
app/code/community/Mage/Worldnet/etc/system.xml
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 12 |
+
* If you did not receive a copy of the license and are unable to
|
| 13 |
+
* obtain it through the world-wide-web, please send an email
|
| 14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 15 |
+
*
|
| 16 |
+
* DISCLAIMER
|
| 17 |
+
*
|
| 18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 19 |
+
* versions in the future. If you wish to customize Magento for your
|
| 20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 21 |
+
*
|
| 22 |
+
* @category Mage
|
| 23 |
+
* @package Mage_Worldnet
|
| 24 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 26 |
+
*/
|
| 27 |
+
-->
|
| 28 |
+
<config>
|
| 29 |
+
<sections>
|
| 30 |
+
<payment>
|
| 31 |
+
<groups>
|
| 32 |
+
<worldnet_standard translate="label" module="worldnet">
|
| 33 |
+
<label>WorldNet TPS (via Payment Page)</label>
|
| 34 |
+
<frontend_type>text</frontend_type>
|
| 35 |
+
<sort_order>101</sort_order>
|
| 36 |
+
<show_in_default>1</show_in_default>
|
| 37 |
+
<show_in_website>1</show_in_website>
|
| 38 |
+
<show_in_store>0</show_in_store>
|
| 39 |
+
<fields>
|
| 40 |
+
<active translate="label">
|
| 41 |
+
<label>Enabled</label>
|
| 42 |
+
<frontend_type>select</frontend_type>
|
| 43 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 44 |
+
<sort_order>1</sort_order>
|
| 45 |
+
<show_in_default>1</show_in_default>
|
| 46 |
+
<show_in_website>1</show_in_website>
|
| 47 |
+
<show_in_store>0</show_in_store>
|
| 48 |
+
</active>
|
| 49 |
+
<!-- <payment_action translate="label">
|
| 50 |
+
<label>Payment Action</label>
|
| 51 |
+
<frontend_type>select</frontend_type>
|
| 52 |
+
<source_model>worldnet/source_paymentAction</source_model>
|
| 53 |
+
<sort_order>2</sort_order>
|
| 54 |
+
<show_in_default>1</show_in_default>
|
| 55 |
+
<show_in_website>1</show_in_website>
|
| 56 |
+
<show_in_store>0</show_in_store>
|
| 57 |
+
</payment_action>
|
| 58 |
+
<title translate="label">
|
| 59 |
+
<label>Title</label>
|
| 60 |
+
<frontend_type>text</frontend_type>
|
| 61 |
+
<sort_order>3</sort_order>
|
| 62 |
+
<show_in_default>1</show_in_default>
|
| 63 |
+
<show_in_website>1</show_in_website>
|
| 64 |
+
<show_in_store>0</show_in_store>
|
| 65 |
+
</title>
|
| 66 |
+
<description translate="label">
|
| 67 |
+
<label>Transaction Description</label>
|
| 68 |
+
<comment>Store name will be used if left empty</comment>
|
| 69 |
+
<frontend_type>text</frontend_type>
|
| 70 |
+
<sort_order>3</sort_order>
|
| 71 |
+
<show_in_default>1</show_in_default>
|
| 72 |
+
<show_in_website>1</show_in_website>
|
| 73 |
+
<show_in_store>0</show_in_store>
|
| 74 |
+
</description>
|
| 75 |
+
<vendor_name translate="label">
|
| 76 |
+
<label>Vendor name</label>
|
| 77 |
+
<frontend_type>text</frontend_type>
|
| 78 |
+
<sort_order>5</sort_order>
|
| 79 |
+
<show_in_default>1</show_in_default>
|
| 80 |
+
<show_in_website>1</show_in_website>
|
| 81 |
+
<show_in_store>0</show_in_store>
|
| 82 |
+
</vendor_name>
|
| 83 |
+
<vendor_password translate="label">
|
| 84 |
+
<label>Vendor encrypted password</label>
|
| 85 |
+
<frontend_type>text</frontend_type>
|
| 86 |
+
<sort_order>6</sort_order>
|
| 87 |
+
<show_in_default>1</show_in_default>
|
| 88 |
+
<show_in_website>1</show_in_website>
|
| 89 |
+
<show_in_store>0</show_in_store>
|
| 90 |
+
</vendor_password>
|
| 91 |
+
--> <gateway translate="label">
|
| 92 |
+
<label>WorldNet Gateway</label>
|
| 93 |
+
<frontend_type>select</frontend_type>
|
| 94 |
+
<source_model>worldnet/source_gatewayAction</source_model>
|
| 95 |
+
<sort_order>2</sort_order>
|
| 96 |
+
<show_in_default>1</show_in_default>
|
| 97 |
+
<show_in_website>1</show_in_website>
|
| 98 |
+
<show_in_store>0</show_in_store>
|
| 99 |
+
</gateway>
|
| 100 |
+
<mode translate="label">
|
| 101 |
+
<label>Account Type</label>
|
| 102 |
+
<frontend_type>select</frontend_type>
|
| 103 |
+
<source_model>worldnet/source_modeAction</source_model>
|
| 104 |
+
<sort_order>3</sort_order>
|
| 105 |
+
<show_in_default>1</show_in_default>
|
| 106 |
+
<show_in_website>1</show_in_website>
|
| 107 |
+
<show_in_store>0</show_in_store>
|
| 108 |
+
</mode>
|
| 109 |
+
<debug_flag translate="label">
|
| 110 |
+
<label>Debug</label>
|
| 111 |
+
<frontend_type>select</frontend_type>
|
| 112 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 113 |
+
<sort_order>4</sort_order>
|
| 114 |
+
<show_in_default>1</show_in_default>
|
| 115 |
+
<show_in_website>1</show_in_website>
|
| 116 |
+
<show_in_store>0</show_in_store>
|
| 117 |
+
</debug_flag>
|
| 118 |
+
<checkoutcurrency translate="label">
|
| 119 |
+
<label>Checkout currency</label>
|
| 120 |
+
<frontend_type>select</frontend_type>
|
| 121 |
+
<source_model>worldnet/source_checkoutCurrencyAction</source_model>
|
| 122 |
+
<sort_order>5</sort_order>
|
| 123 |
+
<show_in_default>1</show_in_default>
|
| 124 |
+
<show_in_website>1</show_in_website>
|
| 125 |
+
<show_in_store>0</show_in_store>
|
| 126 |
+
</checkoutcurrency>
|
| 127 |
+
<currency translate="label">
|
| 128 |
+
<label>Primary Currency</label>
|
| 129 |
+
<frontend_type>select</frontend_type>
|
| 130 |
+
<source_model>worldnet/source_currencyAction</source_model>
|
| 131 |
+
<sort_order>6</sort_order>
|
| 132 |
+
<show_in_default>1</show_in_default>
|
| 133 |
+
<show_in_website>1</show_in_website>
|
| 134 |
+
<show_in_store>0</show_in_store>
|
| 135 |
+
</currency>
|
| 136 |
+
<terminalid translate="label">
|
| 137 |
+
<label>Primary Terminal ID</label>
|
| 138 |
+
<frontend_type>text</frontend_type>
|
| 139 |
+
<sort_order>7</sort_order>
|
| 140 |
+
<show_in_default>1</show_in_default>
|
| 141 |
+
<show_in_website>1</show_in_website>
|
| 142 |
+
<show_in_store>0</show_in_store>
|
| 143 |
+
</terminalid>
|
| 144 |
+
<sharedsecret translate="label">
|
| 145 |
+
<label>Primary Shared Secret</label>
|
| 146 |
+
<frontend_type>text</frontend_type>
|
| 147 |
+
<sort_order>8</sort_order>
|
| 148 |
+
<show_in_default>1</show_in_default>
|
| 149 |
+
<show_in_website>1</show_in_website>
|
| 150 |
+
<show_in_store>0</show_in_store>
|
| 151 |
+
</sharedsecret>
|
| 152 |
+
<currencytwo translate="label">
|
| 153 |
+
<label>Second Currency</label>
|
| 154 |
+
<frontend_type>select</frontend_type>
|
| 155 |
+
<source_model>worldnet/source_currencyAction</source_model>
|
| 156 |
+
<sort_order>9</sort_order>
|
| 157 |
+
<show_in_default>1</show_in_default>
|
| 158 |
+
<show_in_website>1</show_in_website>
|
| 159 |
+
<show_in_store>0</show_in_store>
|
| 160 |
+
</currencytwo>
|
| 161 |
+
<terminalidtwo translate="label">
|
| 162 |
+
<label>Second Terminal ID</label>
|
| 163 |
+
<frontend_type>text</frontend_type>
|
| 164 |
+
<sort_order>10</sort_order>
|
| 165 |
+
<show_in_default>1</show_in_default>
|
| 166 |
+
<show_in_website>1</show_in_website>
|
| 167 |
+
<show_in_store>0</show_in_store>
|
| 168 |
+
</terminalidtwo>
|
| 169 |
+
<sharedsecrettwo translate="label">
|
| 170 |
+
<label>Second Shared Secret</label>
|
| 171 |
+
<frontend_type>text</frontend_type>
|
| 172 |
+
<sort_order>11</sort_order>
|
| 173 |
+
<show_in_default>1</show_in_default>
|
| 174 |
+
<show_in_website>1</show_in_website>
|
| 175 |
+
<show_in_store>0</show_in_store>
|
| 176 |
+
</sharedsecrettwo>
|
| 177 |
+
<currencythree translate="label">
|
| 178 |
+
<label>Third Currency</label>
|
| 179 |
+
<frontend_type>select</frontend_type>
|
| 180 |
+
<source_model>worldnet/source_currencyAction</source_model>
|
| 181 |
+
<sort_order>12</sort_order>
|
| 182 |
+
<show_in_default>1</show_in_default>
|
| 183 |
+
<show_in_website>1</show_in_website>
|
| 184 |
+
<show_in_store>0</show_in_store>
|
| 185 |
+
</currencythree>
|
| 186 |
+
<terminalidthree translate="label">
|
| 187 |
+
<label>Third Terminal ID</label>
|
| 188 |
+
<frontend_type>text</frontend_type>
|
| 189 |
+
<sort_order>13</sort_order>
|
| 190 |
+
<show_in_default>1</show_in_default>
|
| 191 |
+
<show_in_website>1</show_in_website>
|
| 192 |
+
<show_in_store>0</show_in_store>
|
| 193 |
+
</terminalidthree>
|
| 194 |
+
<sharedsecretthree translate="label">
|
| 195 |
+
<label>Third Shared Secret</label>
|
| 196 |
+
<frontend_type>text</frontend_type>
|
| 197 |
+
<sort_order>14</sort_order>
|
| 198 |
+
<show_in_default>1</show_in_default>
|
| 199 |
+
<show_in_website>1</show_in_website>
|
| 200 |
+
<show_in_store>0</show_in_store>
|
| 201 |
+
</sharedsecretthree>
|
| 202 |
+
<!-- <allowspecific translate="label">
|
| 203 |
+
<label>Payment from applicable countries</label>
|
| 204 |
+
<frontend_type>allowspecific</frontend_type>
|
| 205 |
+
<sort_order>50</sort_order>
|
| 206 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
| 207 |
+
<show_in_default>1</show_in_default>
|
| 208 |
+
<show_in_website>1</show_in_website>
|
| 209 |
+
<show_in_store>1</show_in_store>
|
| 210 |
+
</allowspecific>
|
| 211 |
+
<specificcountry translate="label">
|
| 212 |
+
<label>Payment from Specific countries</label>
|
| 213 |
+
<frontend_type>multiselect</frontend_type>
|
| 214 |
+
<sort_order>51</sort_order>
|
| 215 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
| 216 |
+
<show_in_default>1</show_in_default>
|
| 217 |
+
<show_in_website>1</show_in_website>
|
| 218 |
+
<show_in_store>1</show_in_store>
|
| 219 |
+
</specificcountry>
|
| 220 |
+
--> <order_status translate="label">
|
| 221 |
+
<label>New order status</label>
|
| 222 |
+
<frontend_type>select</frontend_type>
|
| 223 |
+
<source_model>adminhtml/system_config_source_order_status_new</source_model>
|
| 224 |
+
<sort_order>15</sort_order>
|
| 225 |
+
<show_in_default>1</show_in_default>
|
| 226 |
+
<show_in_website>1</show_in_website>
|
| 227 |
+
<show_in_store>0</show_in_store>
|
| 228 |
+
</order_status>
|
| 229 |
+
<title translate="label">
|
| 230 |
+
<label>Plug-in public name</label>
|
| 231 |
+
<frontend_type>text</frontend_type>
|
| 232 |
+
<sort_order>16</sort_order>
|
| 233 |
+
<show_in_default>1</show_in_default>
|
| 234 |
+
<show_in_website>1</show_in_website>
|
| 235 |
+
<show_in_store>0</show_in_store>
|
| 236 |
+
</title>
|
| 237 |
+
<sort_order translate="label">
|
| 238 |
+
<label>Sort order</label>
|
| 239 |
+
<frontend_type>text</frontend_type>
|
| 240 |
+
<sort_order>100</sort_order>
|
| 241 |
+
<show_in_default>1</show_in_default>
|
| 242 |
+
<show_in_website>1</show_in_website>
|
| 243 |
+
<show_in_store>0</show_in_store>
|
| 244 |
+
</sort_order>
|
| 245 |
+
</fields>
|
| 246 |
+
</worldnet_standard>
|
| 247 |
+
</groups>
|
| 248 |
+
</payment>
|
| 249 |
+
</sections>
|
| 250 |
+
</config>
|
app/code/community/Mage/Worldnet/nbproject/private/private.properties
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
copy.src.files=false
|
| 2 |
+
copy.src.target=
|
| 3 |
+
index.file=
|
| 4 |
+
run.as=LOCAL
|
| 5 |
+
url=http://localhost/magento/
|
app/code/community/Mage/Worldnet/nbproject/private/private.xml
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
| 3 |
+
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
|
| 4 |
+
</project-private>
|
app/code/community/Mage/Worldnet/nbproject/project.properties
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
include.path=${php.global.include.path}
|
| 2 |
+
source.encoding=UTF-8
|
| 3 |
+
src.dir=.
|
| 4 |
+
tags.asp=false
|
| 5 |
+
tags.short=true
|
| 6 |
+
web.root=.
|
app/code/community/Mage/Worldnet/nbproject/project.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<project xmlns="http://www.netbeans.org/ns/project/1">
|
| 3 |
+
<type>org.netbeans.modules.php.project</type>
|
| 4 |
+
<configuration>
|
| 5 |
+
<data xmlns="http://www.netbeans.org/ns/php-project/1">
|
| 6 |
+
<name>Protx</name>
|
| 7 |
+
</data>
|
| 8 |
+
</configuration>
|
| 9 |
+
</project>
|
app/code/community/Mage/Worldnet/sql/worldnet_setup/mysql4-install-0.1.0.php
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Worldnet
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
$installer = $this;
|
| 29 |
+
/* @var $installer Mage_Worldnet_Model_Mysql4_Setup */
|
| 30 |
+
|
| 31 |
+
$installer->startSetup();
|
| 32 |
+
|
| 33 |
+
$installer->run("
|
| 34 |
+
CREATE TABLE `{$this->getTable('worldnet_api_debug')}` (
|
| 35 |
+
`debug_id` int(10) unsigned NOT NULL auto_increment,
|
| 36 |
+
`transaction_id` varchar(255) NOT NULL default '',
|
| 37 |
+
`debug_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
| 38 |
+
`request_body` text,
|
| 39 |
+
`response_body` text,
|
| 40 |
+
PRIMARY KEY (`debug_id`),
|
| 41 |
+
KEY `debug_at` (`debug_at`)
|
| 42 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 43 |
+
|
| 44 |
+
");
|
| 45 |
+
|
| 46 |
+
$installer->endSetup();
|
app/etc/modules/Mage_Worldnet.xml
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* Magento
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 12 |
+
* If you did not receive a copy of the license and are unable to
|
| 13 |
+
* obtain it through the world-wide-web, please send an email
|
| 14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 15 |
+
*
|
| 16 |
+
* DISCLAIMER
|
| 17 |
+
*
|
| 18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 19 |
+
* versions in the future. If you wish to customize Magento for your
|
| 20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 21 |
+
*
|
| 22 |
+
* @category Mage
|
| 23 |
+
* @package Mage_Protx
|
| 24 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 26 |
+
*/
|
| 27 |
+
-->
|
| 28 |
+
<config>
|
| 29 |
+
<modules>
|
| 30 |
+
<Mage_Worldnet>
|
| 31 |
+
<active>true</active>
|
| 32 |
+
<codePool>community</codePool>
|
| 33 |
+
<depends>
|
| 34 |
+
<Mage_Paygate />
|
| 35 |
+
</depends>
|
| 36 |
+
</Mage_Worldnet>
|
| 37 |
+
</modules>
|
| 38 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>worldnet_payment</name>
|
| 4 |
+
<version>1.2.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://www.gnu.org/licenses/gpl-3.0.html">GPLv3</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>This plugin enables Hosted Payment Page for WorldNet Payment Gateway.</summary>
|
| 10 |
+
<description>A checkout button on your site will redirect your client to a secure payment page, where the cardholder enters credit card details.
|
| 11 |
+
Once the payment is completed, the cardholder is redirected back to your site.</description>
|
| 12 |
+
<notes>This plugin enables Hosted Payment Page for WorldNet Payment Gateway.</notes>
|
| 13 |
+
<authors><author><name>Worldnet</name><user>worldnet</user><email>namita.kapoor@worldnettps.com</email></author></authors>
|
| 14 |
+
<date>2016-04-05</date>
|
| 15 |
+
<time>14:55:09</time>
|
| 16 |
+
<contents><target name="magecommunity"><dir><dir name="Mage"><dir name="Worldnet"><dir name="Block"><dir name="Standard"><file name="Failure.php" hash="f3e705cf711932100589d3b4c8106c08"/><file name="Form.php" hash="56b33428fc43ae46322dda8e62a3ac76"/><file name="Redirect.php" hash="8b389476af008fc61f9412d4313d41a6"/></dir></dir><dir name="Helper"><file name="Data.php" hash="b28afe532c421add22571db28ed4bd43"/></dir><dir name="Model"><dir name="Api"><file name="Debug.php" hash="560d9c6823b9a3f9421dd1db88f6e547"/><file name="worldnet_tps_xml.php" hash="ab9be284401f3a489bfe65a3aa12d15e"/><file name="worldnet_tps_xml.php~" hash="cff53e5e8580545e1ecab08c4b318684"/></dir><file name="Config.php" hash="833e56c13f4a37c877812f88a214b738"/><file name="Config.php~" hash="36361e108e66c4486a8d492705577848"/><dir name="Mysql4"><dir name="Api"><dir name="Debug"><file name="Collection.php" hash="fba9218bab730ea4e9f161de17c45c1c"/></dir><file name="Debug.php" hash="96e22a9c503931d85c1e64a360712c3c"/></dir><file name="Setup.php" hash="621ba5546a08ef619bc2c6f7c84b9beb"/></dir><file name="Session.php" hash="5ae214b0aad30f6ca5062d958654e99a"/><dir name="Source"><file name="CheckoutCurrencyAction.php" hash="78c40401e1ecb0bf0412ec18e6939943"/><file name="CurrencyAction.php" hash="41700075dfb0ca0e76e3270d4363db79"/><file name="CurrencyAction.php~" hash="9e7d36d6503a72919ec5113d2708dfe8"/><file name="GatewayAction.php" hash="11775036a62bba612cd27b18311c623e"/><file name="GatewayAction.php~" hash="c9c414e539456d50f5125b53b78d8285"/><file name="ModeAction.php" hash="898d443ba60d7b19311f51fd23632923"/><file name="ModeAction.php~" hash="898d443ba60d7b19311f51fd23632923"/><file name="PaymentAction.php" hash="8862c80076b4d59c0972da24a95a4c35"/></dir><file name="Standard.php" hash="778efe89f957724b2347a68adcc96adb"/><file name="Standard.php~" hash="ffacff0635663695ea822f1e3aa10fd4"/></dir><dir name="controllers"><file name="StandardController.php" hash="cd6bdfa713a716f8eda1fd3db0426e67"/></dir><dir name="etc"><file name="config.xml" hash="7fd3991593aee20f05091b3e1bce69a1"/><file name="system.xml" hash="193b6ce79e797937969e3f44b6707499"/></dir><dir name="nbproject"><dir name="private"><file name="private.properties" hash="c425fb8252951c8e34648ed14e4a1b4b"/><file name="private.xml" hash="8db5aa1af9a60c837ae0c674b2111063"/></dir><file name="project.properties" hash="4aad25e24c83519ab6ea9012d5995504"/><file name="project.xml" hash="78cdc8723b5bff4bf29711d0b7d8e626"/></dir><dir name="sql"><dir name="worldnet_setup"><file name="mysql4-install-0.1.0.php" hash="5715d336662b1012de6c72399ebecea8"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="design"><dir name="default"><dir name="default"><dir name="layout"><file name="worldnet.xml" hash=""/></dir></dir></dir></dir></target><target name="magelocal"><dir name="design"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="worldnet.xml" hash=""/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_Worldnet.xml" hash="dd1a60a687b48ad37cc414910e8aabcf"/></dir></target><target name="magelocale"><dir/></target></contents>
|
| 17 |
+
<compatible/>
|
| 18 |
+
<dependencies><required><php><min>5.4.0</min><max>5.5.0</max></php></required></dependencies>
|
| 19 |
+
</package>
|
