Version Notes
Fully tested on the Internet Payment Gateway (IPG) test environment.
Download this release
Release Info
| Developer | VirtualPayer |
| Extension | VirtualPayer_AuthipayRedirect |
| Version | 1.0.0 |
| Comparing to | |
| See all releases | |
Version 1.0.0
- app/code/local/VirtualPayer/AuthipayRedirect/Block/Adminhtml/AuthipayRedirect.php +12 -0
- app/code/local/VirtualPayer/AuthipayRedirect/Block/Adminhtml/AuthipayRedirect/Grid.php +115 -0
- app/code/local/VirtualPayer/AuthipayRedirect/Block/Redirect/Error.php +29 -0
- app/code/local/VirtualPayer/AuthipayRedirect/Block/Redirect/Form.php +27 -0
- app/code/local/VirtualPayer/AuthipayRedirect/Block/Redirect/Redirect.php +279 -0
- app/code/local/VirtualPayer/AuthipayRedirect/Block/Redirect/Success.php +30 -0
- app/code/local/VirtualPayer/AuthipayRedirect/Helper/Data.php +56 -0
- app/code/local/VirtualPayer/AuthipayRedirect/Model/AuthipayRedirect.php +10 -0
- app/code/local/VirtualPayer/AuthipayRedirect/Model/Mysql4/AuthipayRedirect.php +9 -0
- app/code/local/VirtualPayer/AuthipayRedirect/Model/Mysql4/AuthipayRedirect/Collection.php +10 -0
- app/code/local/VirtualPayer/AuthipayRedirect/Model/Redirect.php +284 -0
- app/code/local/VirtualPayer/AuthipayRedirect/Model/Setup.php +38 -0
- app/code/local/VirtualPayer/AuthipayRedirect/Model/Source/Cctype.php +23 -0
- app/code/local/VirtualPayer/AuthipayRedirect/Model/Source/Currency.php +34 -0
- app/code/local/VirtualPayer/AuthipayRedirect/Model/Source/OrderStatus.php +27 -0
- app/code/local/VirtualPayer/AuthipayRedirect/Model/Source/PaymentAction.php +34 -0
- app/code/local/VirtualPayer/AuthipayRedirect/Model/Source/PaymentMode.php +30 -0
- app/code/local/VirtualPayer/AuthipayRedirect/controllers/Adminhtml/AuthipayRedirectController.php +271 -0
- app/code/local/VirtualPayer/AuthipayRedirect/controllers/RedirectController.php +131 -0
- app/code/local/VirtualPayer/AuthipayRedirect/controllers/ResponseController.php +65 -0
- app/code/local/VirtualPayer/AuthipayRedirect/etc/config.xml +172 -0
- app/code/local/VirtualPayer/AuthipayRedirect/etc/system.xml +143 -0
- app/code/local/VirtualPayer/AuthipayRedirect/sql/authipayredirect_setup/mysql4-install-0.1.0.php +41 -0
- app/design/adminhtml/default/default/layout/authipayredirect.xml +8 -0
- app/design/frontend/base/default/layout/authipayredirect.xml +21 -0
- app/design/frontend/base/default/template/authipayredirect/redirect/failure.phtml +9 -0
- app/design/frontend/base/default/template/authipayredirect/redirect/form.phtml +13 -0
- app/design/frontend/base/default/template/authipayredirect/redirect/success.phtml +9 -0
- app/etc/modules/VirtualPayer_AuthipayRedirect.xml +29 -0
- package.xml +19 -0
app/code/local/VirtualPayer/AuthipayRedirect/Block/Adminhtml/AuthipayRedirect.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class VirtualPayer_AuthipayRedirect_Block_Adminhtml_AuthipayRedirect extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 3 |
+
{
|
| 4 |
+
public function __construct()
|
| 5 |
+
{
|
| 6 |
+
$this->_controller = 'adminhtml_authipayredirect';
|
| 7 |
+
$this->_blockGroup = 'authipayredirect';
|
| 8 |
+
$this->_headerText = Mage::helper('authipayredirect')->__('Authipay Redirect Transactions');
|
| 9 |
+
parent::__construct();
|
| 10 |
+
$this->_removeButton('add');
|
| 11 |
+
}
|
| 12 |
+
}
|
app/code/local/VirtualPayer/AuthipayRedirect/Block/Adminhtml/AuthipayRedirect/Grid.php
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class VirtualPayer_AuthipayRedirect_Block_Adminhtml_AuthipayRedirect_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 4 |
+
{
|
| 5 |
+
public function __construct()
|
| 6 |
+
{
|
| 7 |
+
parent::__construct();
|
| 8 |
+
$this->setId('authipayredirectGrid');
|
| 9 |
+
$this->setDefaultSort('timestamp');
|
| 10 |
+
$this->setDefaultDir('DESC');
|
| 11 |
+
$this->setSaveParametersInSession(true);
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
protected function _prepareCollection()
|
| 15 |
+
{
|
| 16 |
+
$collection = Mage::getModel('authipayredirect/authipayredirect')->getCollection();
|
| 17 |
+
$this->setCollection($collection);
|
| 18 |
+
return parent::_prepareCollection();
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Return Current work store
|
| 23 |
+
*
|
| 24 |
+
* @return Mage_Core_Model_Store
|
| 25 |
+
*/
|
| 26 |
+
protected function _getStore()
|
| 27 |
+
{
|
| 28 |
+
return Mage::app()->getStore();
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
protected function _prepareColumns()
|
| 32 |
+
{
|
| 33 |
+
|
| 34 |
+
$this->addColumn('order_id', array(
|
| 35 |
+
'header' => Mage::helper('authipayredirect')->__('Order ID'),
|
| 36 |
+
'index' => 'order_id',
|
| 37 |
+
));
|
| 38 |
+
|
| 39 |
+
$this->addColumn('timestamp', array(
|
| 40 |
+
'header' => Mage::helper('authipayredirect')->__('Timestamp'),
|
| 41 |
+
'type' => 'datetime',
|
| 42 |
+
'index' => 'timestamp',
|
| 43 |
+
));
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
$this->addColumn('oid', array(
|
| 47 |
+
'header' => Mage::helper('authipayredirect')->__('authipayredirect Order ID'),
|
| 48 |
+
'index' => 'oid',
|
| 49 |
+
));
|
| 50 |
+
|
| 51 |
+
$this->addColumn('status', array(
|
| 52 |
+
'header' => Mage::helper('authipayredirect')->__('Status'),
|
| 53 |
+
'index' => 'status',
|
| 54 |
+
'width' => '50px',
|
| 55 |
+
|
| 56 |
+
));
|
| 57 |
+
|
| 58 |
+
$this->addColumn('fail_reason', array(
|
| 59 |
+
'header' => Mage::helper('authipayredirect')->__('Fail Reason'),
|
| 60 |
+
'index' => 'fail_reason',
|
| 61 |
+
));
|
| 62 |
+
|
| 63 |
+
$this->addColumn('cardnumber', array(
|
| 64 |
+
'header' => Mage::helper('authipayredirect')->__('Card Number'),
|
| 65 |
+
'index' => 'cardnumber',
|
| 66 |
+
));
|
| 67 |
+
|
| 68 |
+
$this->addColumn('currency', array(
|
| 69 |
+
'header' => Mage::helper('authipayredirect')->__('Currency'),
|
| 70 |
+
'index' => 'currency',
|
| 71 |
+
'width' => '50px',
|
| 72 |
+
));
|
| 73 |
+
|
| 74 |
+
$this->addColumn('refnumber', array(
|
| 75 |
+
'header' => Mage::helper('authipayredirect')->__('Referance Number'),
|
| 76 |
+
'index' => 'refnumber',
|
| 77 |
+
));
|
| 78 |
+
|
| 79 |
+
$this->addColumn('chargetotal', array(
|
| 80 |
+
'header' => Mage::helper('authipayredirect')->__('Amount'),
|
| 81 |
+
'index' => 'chargetotal',
|
| 82 |
+
));
|
| 83 |
+
|
| 84 |
+
$this->addColumn('paymentMethod', array(
|
| 85 |
+
'header' => Mage::helper('authipayredirect')->__('Payment Method'),
|
| 86 |
+
'index' => 'paymentMethod',
|
| 87 |
+
));
|
| 88 |
+
|
| 89 |
+
$this->addColumn('processor_response_code', array(
|
| 90 |
+
'header' => Mage::helper('authipayredirect')->__('Response Code'),
|
| 91 |
+
'index' => 'processor_response_code',
|
| 92 |
+
));
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('authipayredirect')->__('CSV'));
|
| 97 |
+
$this->addExportType('*/*/exportXml', Mage::helper('authipayredirect')->__('XML'));
|
| 98 |
+
|
| 99 |
+
return parent::_prepareColumns();
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
protected function _prepareMassaction()
|
| 103 |
+
{
|
| 104 |
+
$this->setMassactionIdField('authipayredirect_id');
|
| 105 |
+
$this->getMassactionBlock()->setFormFieldName('authipayredirect');
|
| 106 |
+
|
| 107 |
+
return $this;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
public function getRowUrl($row)
|
| 111 |
+
{
|
| 112 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
}
|
app/code/local/VirtualPayer/AuthipayRedirect/Block/Redirect/Error.php
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* VirtualPayer_AuthipayRedirect extension
|
| 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 |
+
*
|
| 12 |
+
* @category VirtualPayer
|
| 13 |
+
* @package VirtualPayer_AuthipayRedirect
|
| 14 |
+
* @copyright Copyright (c) 2016 VirtualPayer
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
class VirtualPayer_AuthipayRedirect_Block_Redirect_Error extends Mage_Core_Block_Abstract
|
| 18 |
+
{
|
| 19 |
+
/**
|
| 20 |
+
* @return string
|
| 21 |
+
*/
|
| 22 |
+
protected function _toHtml()
|
| 23 |
+
{
|
| 24 |
+
$html = '<script type="text/javascript">window.location = "' . Mage::getBaseUrl() . 'authipayredirect/redirect/failure' . '"</script>';
|
| 25 |
+
return $html;
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
?>
|
app/code/local/VirtualPayer/AuthipayRedirect/Block/Redirect/Form.php
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* VirtualPayer_AuthipayRedirect extension
|
| 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 |
+
*
|
| 12 |
+
* @category VirtualPayer
|
| 13 |
+
* @package VirtualPayer_AuthipayRedirect
|
| 14 |
+
* @copyright Copyright (c) 2016 VirtualPayer
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
class VirtualPayer_AuthipayRedirect_Block_Redirect_Form extends Mage_Payment_Block_Form
|
| 18 |
+
{
|
| 19 |
+
/**
|
| 20 |
+
* @return void
|
| 21 |
+
*/
|
| 22 |
+
protected function _construct()
|
| 23 |
+
{
|
| 24 |
+
$this->setTemplate('authipayredirect/redirect/form.phtml');
|
| 25 |
+
parent::_construct();
|
| 26 |
+
}
|
| 27 |
+
}
|
app/code/local/VirtualPayer/AuthipayRedirect/Block/Redirect/Redirect.php
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* VirtualPayer_AuthipayRedirect extension
|
| 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 |
+
*
|
| 12 |
+
* @category VirtualPayer
|
| 13 |
+
* @package VirtualPayer_AuthipayRedirect
|
| 14 |
+
* @copyright Copyright (c) 2016 VirtualPayer
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
class VirtualPayer_AuthipayRedirect_Block_Redirect_Redirect extends Mage_Core_Block_Abstract
|
| 18 |
+
{
|
| 19 |
+
/**
|
| 20 |
+
* @return string
|
| 21 |
+
*/
|
| 22 |
+
protected function _toHtml()
|
| 23 |
+
{
|
| 24 |
+
$currency_map = array (
|
| 25 |
+
'ADP' => 20,
|
| 26 |
+
'AED' => 784,
|
| 27 |
+
'AFN' => 971,
|
| 28 |
+
'ALL' => 8,
|
| 29 |
+
'AMD' => 51,
|
| 30 |
+
'ANG' => 532,
|
| 31 |
+
'AOA' => 973,
|
| 32 |
+
'ARS' => 32,
|
| 33 |
+
'ATS' => 40,
|
| 34 |
+
'AUD' => 36,
|
| 35 |
+
'AWG' => 533,
|
| 36 |
+
'AZN' => 31,
|
| 37 |
+
'BAM' => 977,
|
| 38 |
+
'BBD' => 52,
|
| 39 |
+
'BDT' => 50,
|
| 40 |
+
'BEF' => 56,
|
| 41 |
+
'BGL' => 100,
|
| 42 |
+
'BGN' => 975,
|
| 43 |
+
'BHD' => 48,
|
| 44 |
+
'BIF' => 108,
|
| 45 |
+
'BMD' => 60,
|
| 46 |
+
'BND' => 96,
|
| 47 |
+
'BOB' => 68,
|
| 48 |
+
'BOV' => 984,
|
| 49 |
+
'BRL' => 986,
|
| 50 |
+
'BSD' => 44,
|
| 51 |
+
'BTN' => 64,
|
| 52 |
+
'BWP' => 72,
|
| 53 |
+
'BYR' => 974,
|
| 54 |
+
'BZD' => 84,
|
| 55 |
+
'CAD' => 124,
|
| 56 |
+
'CDF' => 976,
|
| 57 |
+
'CHF' => 756,
|
| 58 |
+
'CLF' => 990,
|
| 59 |
+
'CLP' => 152,
|
| 60 |
+
'CNY' => 156,
|
| 61 |
+
'COP' => 170,
|
| 62 |
+
'CRC' => 188,
|
| 63 |
+
'CSD' => 891,
|
| 64 |
+
'CUP' => 192,
|
| 65 |
+
'CVE' => 132,
|
| 66 |
+
'CZK' => 203,
|
| 67 |
+
'DEM' => 280,
|
| 68 |
+
'DJF' => 262,
|
| 69 |
+
'DKK' => 208,
|
| 70 |
+
'DOP' => 214,
|
| 71 |
+
'DZD' => 12,
|
| 72 |
+
'EEK' => 233,
|
| 73 |
+
'EGP' => 818,
|
| 74 |
+
'ERN' => 232,
|
| 75 |
+
'ESP' => 724,
|
| 76 |
+
'ETB' => 230,
|
| 77 |
+
'EUR' => 978,
|
| 78 |
+
'FIM' => 246,
|
| 79 |
+
'FJD' => 242,
|
| 80 |
+
'FKP' => 238,
|
| 81 |
+
'FRF' => 250,
|
| 82 |
+
'GBP' => 826,
|
| 83 |
+
'GEL' => 981,
|
| 84 |
+
'GHC' => 288,
|
| 85 |
+
'GIP' => 292,
|
| 86 |
+
'GMD' => 270,
|
| 87 |
+
'GNF' => 324,
|
| 88 |
+
'GRD' => 300,
|
| 89 |
+
'GTQ' => 320,
|
| 90 |
+
'GWP' => 624,
|
| 91 |
+
'GYD' => 328,
|
| 92 |
+
'HKD' => 344,
|
| 93 |
+
'HNL' => 340,
|
| 94 |
+
'HRK' => 191,
|
| 95 |
+
'HTG' => 332,
|
| 96 |
+
'HUF' => 348,
|
| 97 |
+
'IDR' => 360,
|
| 98 |
+
'IEP' => 372,
|
| 99 |
+
'ILS' => 376,
|
| 100 |
+
'INR' => 356,
|
| 101 |
+
'IQD' => 368,
|
| 102 |
+
'IRR' => 364,
|
| 103 |
+
'ISK' => 352,
|
| 104 |
+
'ITL' => 380,
|
| 105 |
+
'JMD' => 388,
|
| 106 |
+
'JOD' => 400,
|
| 107 |
+
'JPY' => 392,
|
| 108 |
+
'KES' => 404,
|
| 109 |
+
'KGS' => 417,
|
| 110 |
+
'KHR' => 116,
|
| 111 |
+
'KMF' => 174,
|
| 112 |
+
'KPW' => 408,
|
| 113 |
+
'KRW' => 410,
|
| 114 |
+
'KWD' => 414,
|
| 115 |
+
'KYD' => 136,
|
| 116 |
+
'KZT' => 398,
|
| 117 |
+
'LAK' => 418,
|
| 118 |
+
'LBP' => 422,
|
| 119 |
+
'LKR' => 144,
|
| 120 |
+
'LRD' => 430,
|
| 121 |
+
'LTL' => 440,
|
| 122 |
+
'LUF' => 442,
|
| 123 |
+
'LVL' => 428,
|
| 124 |
+
'LYD' => 434,
|
| 125 |
+
'MAD' => 504,
|
| 126 |
+
'MDL' => 498,
|
| 127 |
+
'MGF' => 450,
|
| 128 |
+
'MKD' => 807,
|
| 129 |
+
'MMK' => 104,
|
| 130 |
+
'MNT' => 496,
|
| 131 |
+
'MOP' => 446,
|
| 132 |
+
'MRO' => 478,
|
| 133 |
+
'MTL' => 470,
|
| 134 |
+
'MUR' => 480,
|
| 135 |
+
'MVR' => 462,
|
| 136 |
+
'MWK' => 454,
|
| 137 |
+
'MXN' => 484,
|
| 138 |
+
'MXV' => 979,
|
| 139 |
+
'MYR' => 458,
|
| 140 |
+
'MZM' => 508,
|
| 141 |
+
'NAD' => 516,
|
| 142 |
+
'NGN' => 566,
|
| 143 |
+
'NIO' => 558,
|
| 144 |
+
'NLG' => 528,
|
| 145 |
+
'NOK' => 578,
|
| 146 |
+
'NPR' => 524,
|
| 147 |
+
'NZD' => 554,
|
| 148 |
+
'OMR' => 512,
|
| 149 |
+
'PAB' => 590,
|
| 150 |
+
'PEN' => 604,
|
| 151 |
+
'PGK' => 598,
|
| 152 |
+
'PHP' => 608,
|
| 153 |
+
'PKR' => 586,
|
| 154 |
+
'PLN' => 985,
|
| 155 |
+
'PTE' => 620,
|
| 156 |
+
'PYG' => 600,
|
| 157 |
+
'QAR' => 634,
|
| 158 |
+
'ROL' => 642,
|
| 159 |
+
'RUB' => 643,
|
| 160 |
+
'RUR' => 810,
|
| 161 |
+
'RWF' => 646,
|
| 162 |
+
'SAR' => 682,
|
| 163 |
+
'SBD' => 90,
|
| 164 |
+
'SCR' => 690,
|
| 165 |
+
'SDD' => 736,
|
| 166 |
+
'SDG' => 938,
|
| 167 |
+
'SEK' => 752,
|
| 168 |
+
'SGD' => 702,
|
| 169 |
+
'SHP' => 654,
|
| 170 |
+
'SIT' => 705,
|
| 171 |
+
'SKK' => 703,
|
| 172 |
+
'SLL' => 694,
|
| 173 |
+
'SOS' => 706,
|
| 174 |
+
'SRG' => 740,
|
| 175 |
+
'STD' => 678,
|
| 176 |
+
'SVC' => 222,
|
| 177 |
+
'SYP' => 760,
|
| 178 |
+
'SZL' => 748,
|
| 179 |
+
'THB' => 764,
|
| 180 |
+
'TJS' => 972,
|
| 181 |
+
'TMM' => 795,
|
| 182 |
+
'TND' => 788,
|
| 183 |
+
'TOP' => 776,
|
| 184 |
+
'TRY' => 949,
|
| 185 |
+
'TTD' => 780,
|
| 186 |
+
'TWD' => 901,
|
| 187 |
+
'TZS' => 834,
|
| 188 |
+
'UAH' => 980,
|
| 189 |
+
'UGX' => 800,
|
| 190 |
+
'USD' => 840,
|
| 191 |
+
'USN' => 997,
|
| 192 |
+
'USS' => 998,
|
| 193 |
+
'UYU' => 858,
|
| 194 |
+
'UZS' => 860,
|
| 195 |
+
'VEB' => 862,
|
| 196 |
+
'VEF' => 937,
|
| 197 |
+
'VND' => 704,
|
| 198 |
+
'VUV' => 548,
|
| 199 |
+
'WST' => 882,
|
| 200 |
+
'XAF' => 950,
|
| 201 |
+
'XCD' => 951,
|
| 202 |
+
'XOF' => 952,
|
| 203 |
+
'XPF' => 953,
|
| 204 |
+
'YER' => 886,
|
| 205 |
+
'ZAR' => 710,
|
| 206 |
+
'ZMK' => 894,
|
| 207 |
+
'ZWD' => 716
|
| 208 |
+
);
|
| 209 |
+
|
| 210 |
+
$timestamp = $orderid = $currency = $sha1hash = '';
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
$redirect = Mage::getModel('authipayredirect/redirect');
|
| 214 |
+
|
| 215 |
+
$dateTime = date("Y:m:d-H:i:s");
|
| 216 |
+
$timestamp = strftime("%Y%m%d%H%M%S");
|
| 217 |
+
|
| 218 |
+
$gateway= $redirect->getAuthipayRedirectUrl();
|
| 219 |
+
if($redirect->getConfigData('test'))
|
| 220 |
+
$gateway = $redirect->getAuthipayRedirectTestUrl();
|
| 221 |
+
|
| 222 |
+
$form = new Varien_Data_Form();
|
| 223 |
+
$form->setAction($gateway)
|
| 224 |
+
->setId('authipayredirect_redirect_checkout')
|
| 225 |
+
->setName('authipayredirect_redirect_checkout')
|
| 226 |
+
->setMethod('POST')
|
| 227 |
+
->setUseContainer(true);
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
$orderid = $redirect->getCheckout()->getLastRealOrderId();
|
| 231 |
+
$order = Mage::getModel('sales/order');
|
| 232 |
+
$order->loadByIncrementId($orderid);
|
| 233 |
+
|
| 234 |
+
if($redirect->getConfigData('currency') == 'display'){
|
| 235 |
+
$currency = $redirect->getQuote()->getStore()->getCurrentCurrency();
|
| 236 |
+
$amount = $order->getGrandTotal();
|
| 237 |
+
}else{
|
| 238 |
+
$currency = $order->getBaseCurrencyCode();
|
| 239 |
+
$amount = $order->getBaseGrandTotal();
|
| 240 |
+
}
|
| 241 |
+
$currency=$currency_map[$currency];
|
| 242 |
+
|
| 243 |
+
$storeid = $redirect->getConfigData('storeid');
|
| 244 |
+
$secret = $redirect->getConfigData('sharedsecret');
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
$stringToHash = $storeid . $dateTime . $amount . $currency . $secret;
|
| 248 |
+
$ascii = bin2hex($stringToHash);
|
| 249 |
+
$sha1hash = sha1($ascii);
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
$form->addField('txntype', 'hidden', array('name'=>'txntype', 'value'=>'sale'));
|
| 253 |
+
$form->addField('oid', 'hidden', array('name'=>'oid', 'value'=>$orderid));
|
| 254 |
+
$form->addField('timezone', 'hidden', array('name'=>'timezone', 'value'=>date(T)));
|
| 255 |
+
$form->addField('txndatetime', 'hidden', array('name'=>'txndatetime', 'value'=>$dateTime));
|
| 256 |
+
$form->addField('hash', 'hidden', array('name'=>'hash', 'value'=>$sha1hash));
|
| 257 |
+
$form->addField('storename', 'hidden', array('name'=>'storename', 'value'=>$storeid));
|
| 258 |
+
$form->addField('mode', 'hidden', array('name'=>'mode', 'value'=>'payonly'));
|
| 259 |
+
$form->addField('responseSuccessURL', 'hidden', array('name'=>'responseSuccessURL', 'value'=>$redirect->getSuccessUrl()));
|
| 260 |
+
$form->addField('responseFailURL', 'hidden', array('name'=>'responseFailURL', 'value'=>$redirect->getCancelUrl()));
|
| 261 |
+
$form->addField('chargetotal', 'hidden', array('name'=>'chargetotal', 'value'=>$amount));
|
| 262 |
+
$form->addField('currency', 'hidden', array('name'=>'currency', 'value'=>$currency));
|
| 263 |
+
|
| 264 |
+
$html = '<html><body>';
|
| 265 |
+
$html.= Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('authipayredirect_redirect')->toHtml();
|
| 266 |
+
$html.= $form->toHtml();
|
| 267 |
+
$html.= '<script type="text/javascript">document.getElementById("authipayredirect_redirect_checkout").submit();</script>';
|
| 268 |
+
$html.= '</body></html>';
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
|
| 273 |
+
if($redirect->getConfigData('debug')){
|
| 274 |
+
Mage::log($html);
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
return $html;
|
| 278 |
+
}
|
| 279 |
+
}
|
app/code/local/VirtualPayer/AuthipayRedirect/Block/Redirect/Success.php
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* VirtualPayer_AuthipayRedirect extension
|
| 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 |
+
*
|
| 12 |
+
* @category VirtualPayer
|
| 13 |
+
* @package VirtualPayer_AuthipayRedirect
|
| 14 |
+
* @copyright Copyright (c) 2016 VirtualPayer
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
class VirtualPayer_AuthipayRedirect_Block_Redirect_Success extends Mage_Core_Block_Abstract
|
| 18 |
+
{
|
| 19 |
+
/**
|
| 20 |
+
* @return string
|
| 21 |
+
*/
|
| 22 |
+
protected function _toHtml()
|
| 23 |
+
{
|
| 24 |
+
$html = '<script type="text/javascript">window.location = "' . Mage::getBaseUrl() . 'authipayredirect/redirect/success' . '"</script>';
|
| 25 |
+
|
| 26 |
+
return $html;
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
?>
|
app/code/local/VirtualPayer/AuthipayRedirect/Helper/Data.php
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* VirtualPayer_AuthipayRedirect extension
|
| 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 |
+
*
|
| 12 |
+
* @category VirtualPayer
|
| 13 |
+
* @package VirtualPayer_AuthipayRedirect
|
| 14 |
+
* @copyright Copyright (c) 2016 VirtualPayer
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
class VirtualPayer_AuthipayRedirect_Helper_Data extends Mage_Core_Helper_Abstract
|
| 18 |
+
{
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* @param $orderIncrementId
|
| 22 |
+
* @return string
|
| 23 |
+
*/
|
| 24 |
+
public function createInvoice(string $orderIncrementId){
|
| 25 |
+
$_order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
|
| 26 |
+
|
| 27 |
+
if($_order->canInvoice()) {
|
| 28 |
+
$invoiceId = Mage::getModel('sales/order_invoice_api')->create($_order->getIncrementId(), array(), 'Invoice Created', true, true);
|
| 29 |
+
|
| 30 |
+
$invoice = Mage::getModel('sales/order_invoice_api')->capture($invoiceId);
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
public function getDateFromTimestamp($timestamp){
|
| 35 |
+
$year = substr($timestamp, 0, 4);
|
| 36 |
+
$month = substr($timestamp, 4, 2);
|
| 37 |
+
$day = substr($timestamp, 6, 2);
|
| 38 |
+
$hour = substr($timestamp, 8, 2);
|
| 39 |
+
$minutes = substr($timestamp, 10, 2);
|
| 40 |
+
$seconds = substr($timestamp, 12, 2);
|
| 41 |
+
$date = $year . '-' . $month . '-' . $day . ' ' . $hour . ':' . $minutes . ':' . $seconds;
|
| 42 |
+
Mage::log($date);
|
| 43 |
+
return strtotime($date);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
public function getCustomerMessage($block, $order, $response){
|
| 47 |
+
$variables = array();
|
| 48 |
+
$variables['order'] = $order;
|
| 49 |
+
$variables['response'] = $response;
|
| 50 |
+
$filter = Mage::getModel('core/email_template_filter');
|
| 51 |
+
$filter->setVariables($variables);
|
| 52 |
+
return $filter->filter($block->toHtml());
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
|
app/code/local/VirtualPayer/AuthipayRedirect/Model/AuthipayRedirect.php
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class VirtualPayer_AuthipayRedirect_Model_AuthipayRedirect extends Mage_Core_Model_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
parent::_construct();
|
| 8 |
+
$this->_init('authipayredirect/authipayredirect');
|
| 9 |
+
}
|
| 10 |
+
}
|
app/code/local/VirtualPayer/AuthipayRedirect/Model/Mysql4/AuthipayRedirect.php
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class VirtualPayer_AuthipayRedirect_Model_Mysql4_AuthipayRedirect extends Mage_Core_Model_Mysql4_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
$this->_init('authipayredirect/authipayredirect', 'authipayredirect_id');
|
| 8 |
+
}
|
| 9 |
+
}
|
app/code/local/VirtualPayer/AuthipayRedirect/Model/Mysql4/AuthipayRedirect/Collection.php
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class VirtualPayer_AuthipayRedirect_Model_Mysql4_AuthipayRedirect_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
parent::_construct();
|
| 8 |
+
$this->_init('authipayredirect/authipayredirect');
|
| 9 |
+
}
|
| 10 |
+
}
|
app/code/local/VirtualPayer/AuthipayRedirect/Model/Redirect.php
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* VirtualPayer_AuthipayRedirect extension
|
| 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 |
+
*
|
| 12 |
+
* @category VirtualPayer
|
| 13 |
+
* @package VirtualPayer_AuthipayRedirect
|
| 14 |
+
* @copyright Copyright (c) 2016 VirtualPayer
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
class VirtualPayer_AuthipayRedirect_Model_Redirect extends Mage_Payment_Model_Method_Abstract{
|
| 18 |
+
|
| 19 |
+
protected $_code = 'authipayredirect';
|
| 20 |
+
protected $_formBlockType = 'authipayredirect/redirect_form';
|
| 21 |
+
protected $_allowCurrencyCode = array('AUD', 'CAD', 'CHF', 'CZK', 'DKK', 'EUR', 'GBP', 'HKD', 'HUF', 'JPY', 'NOK', 'NZD', 'PLN', 'SEK', 'SGD','USD');
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* @param $data
|
| 25 |
+
* @return VirtualPayer_AuthipayRedirect_Model_Redirect
|
| 26 |
+
*/
|
| 27 |
+
public function assignData($data)
|
| 28 |
+
{
|
| 29 |
+
if (!($data instanceof Varien_Object)) {
|
| 30 |
+
$data = new Varien_Object($data);
|
| 31 |
+
}
|
| 32 |
+
$info = $this->getInfoInstance();
|
| 33 |
+
$info->setCcType($data->getAmex());
|
| 34 |
+
|
| 35 |
+
return $this;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Get checkout session namespace
|
| 40 |
+
*
|
| 41 |
+
* @return Mage_Checkout_Model_Session
|
| 42 |
+
*/
|
| 43 |
+
public function getCheckout()
|
| 44 |
+
{
|
| 45 |
+
return Mage::getSingleton('checkout/session');
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* Get current quote
|
| 50 |
+
*
|
| 51 |
+
* @return Mage_Sales_Model_Quote
|
| 52 |
+
*/
|
| 53 |
+
public function getQuote()
|
| 54 |
+
{
|
| 55 |
+
return $this->getCheckout()->getQuote();
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
/**
|
| 59 |
+
* Using internal pages for input payment data
|
| 60 |
+
*
|
| 61 |
+
* @return bool
|
| 62 |
+
*/
|
| 63 |
+
public function canUseInternal()
|
| 64 |
+
{
|
| 65 |
+
return false;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
/**
|
| 69 |
+
* Using for multiple shipping address
|
| 70 |
+
*
|
| 71 |
+
* @return bool
|
| 72 |
+
*/
|
| 73 |
+
public function canUseForMultishipping()
|
| 74 |
+
{
|
| 75 |
+
return false;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
public function createFormBlock($name)
|
| 79 |
+
{
|
| 80 |
+
$block = $this->getLayout()->createBlock('authipayredirect/redirect_form', $name)
|
| 81 |
+
->setMethod('authipayredirect_redirect')
|
| 82 |
+
->setPayment($this->getPayment())
|
| 83 |
+
->setTemplate('authipayredirect/redirect/form.phtml');
|
| 84 |
+
|
| 85 |
+
return $block;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
* Validate the currency code is available to use for FdmsConnect or not
|
| 90 |
+
*
|
| 91 |
+
* @return VirtualPayer_AuthipayRedirect_Model_Redirect
|
| 92 |
+
*/
|
| 93 |
+
|
| 94 |
+
public function validate()
|
| 95 |
+
{
|
| 96 |
+
parent::validate();
|
| 97 |
+
$currency_code = $this->getQuote()->getBaseCurrencyCode();
|
| 98 |
+
if (!in_array($currency_code,$this->_allowCurrencyCode)) {
|
| 99 |
+
}
|
| 100 |
+
return $this;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
/**
|
| 104 |
+
* @param Mage_Sales_Model_Order_Payment $payment
|
| 105 |
+
* @return VirtualPayer_AuthipayRedirect_Model_Redirect
|
| 106 |
+
*/
|
| 107 |
+
public function onOrderValidate(Mage_Sales_Model_Order_Payment $payment)
|
| 108 |
+
{
|
| 109 |
+
return $this;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
/**
|
| 113 |
+
* @param Mage_Sales_Model_Invoice_Payment $payment
|
| 114 |
+
* @return void
|
| 115 |
+
*/
|
| 116 |
+
public function onInvoiceCreate(Mage_Sales_Model_Invoice_Payment $payment)
|
| 117 |
+
{
|
| 118 |
+
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
/**
|
| 122 |
+
* @return bool
|
| 123 |
+
*/
|
| 124 |
+
public function canCapture()
|
| 125 |
+
{
|
| 126 |
+
return true;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
/**
|
| 130 |
+
* @return string
|
| 131 |
+
*/
|
| 132 |
+
public function getOrderPlaceRedirectUrl()
|
| 133 |
+
{
|
| 134 |
+
return Mage::getUrl('authipayredirect/redirect/', array('_secure' => true));
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
/**
|
| 139 |
+
* @return string
|
| 140 |
+
*/
|
| 141 |
+
public function getSuccessUrl(){
|
| 142 |
+
return Mage::getUrl('authipayredirect/response/');
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
/**
|
| 146 |
+
* @return string
|
| 147 |
+
*/
|
| 148 |
+
public function getCancelUrl(){
|
| 149 |
+
return Mage::getUrl('authipayredirect/redirect/cancel');
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
/**
|
| 153 |
+
* @return string
|
| 154 |
+
*/
|
| 155 |
+
public function getAuthipayRedirectUrl(){
|
| 156 |
+
$url = "https://www.ipg-online.com/connect/gateway/processing";
|
| 157 |
+
return $url;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
public function getAuthipayRedirectTestUrl(){
|
| 161 |
+
$url = "https://test.ipg-online.com/connect/gateway/processing";
|
| 162 |
+
return $url;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
/**
|
| 166 |
+
* @return bool
|
| 167 |
+
*/
|
| 168 |
+
public function isInitializeNeeded()
|
| 169 |
+
{
|
| 170 |
+
return true;
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
/**
|
| 174 |
+
* @param $paymentAction
|
| 175 |
+
* @param $stateObject
|
| 176 |
+
* @return void
|
| 177 |
+
*/
|
| 178 |
+
public function initialize($paymentAction, $stateObject)
|
| 179 |
+
{
|
| 180 |
+
$state = "Authipay Redirect Connect Processing";
|
| 181 |
+
$stateObject->setState($state);
|
| 182 |
+
$stateObject->setIsNotified(false);
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
/**
|
| 186 |
+
* @return bool
|
| 187 |
+
*/
|
| 188 |
+
public function processRedirectResponse($post){
|
| 189 |
+
Mage::log($post);
|
| 190 |
+
$this->saveAuthipayRedirectTransaction($post);
|
| 191 |
+
|
| 192 |
+
$timestamp = $post['tdate'];
|
| 193 |
+
$result = $post['processor_response_code'];
|
| 194 |
+
$orderid = $post['oid'];
|
| 195 |
+
$message = $post['status'];
|
| 196 |
+
$authcode = $post['terminal_id'];
|
| 197 |
+
$pasref = $post['refnumber'];
|
| 198 |
+
$authipayredirectsha1 = $post['response_hash'];
|
| 199 |
+
|
| 200 |
+
$redirect = Mage::getModel('authipayredirect/redirect');
|
| 201 |
+
$storeid = $redirect->getConfigData('storeid');
|
| 202 |
+
$secret = $redirect->getConfigData('sharedsecret');
|
| 203 |
+
|
| 204 |
+
$tmp = "$timestamp.$storeid.$orderid.$result.$message.$pasref.$authcode";
|
| 205 |
+
$sha1hash = sha1($tmp);
|
| 206 |
+
$tmp = "$sha1hash.$secret";
|
| 207 |
+
$sha1hash = sha1($tmp);
|
| 208 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderid);
|
| 209 |
+
|
| 210 |
+
$session = Mage::getSingleton('checkout/session');
|
| 211 |
+
$session->setOrderId($orderid);
|
| 212 |
+
|
| 213 |
+
if ($result != "00" && $message != 'APPROVED') {
|
| 214 |
+
if ($order->getId()) {
|
| 215 |
+
$order->cancel();
|
| 216 |
+
$order->addStatusToHistory('cancelled', $post['fail_reason'], false);
|
| 217 |
+
$order->save();
|
| 218 |
+
}
|
| 219 |
+
return false;
|
| 220 |
+
}else{
|
| 221 |
+
if ($result == "00" || $message == 'APPROVED') {
|
| 222 |
+
if ($order->getId()) {
|
| 223 |
+
$order->addStatusToHistory('processing', 'Payment Successful: ' . $result . ': ' . $message, false);
|
| 224 |
+
$order->addStatusToHistory('processing', 'Authorisation Code: ' . $authcode, false);
|
| 225 |
+
$order->sendNewOrderEmail();
|
| 226 |
+
$order->setEmailSent(true);
|
| 227 |
+
|
| 228 |
+
$session->setLastSuccessQuoteId($order->getId());
|
| 229 |
+
$session->setLastQuoteId($order->getId());
|
| 230 |
+
$session->setLastOrderId($order->getId());
|
| 231 |
+
|
| 232 |
+
$order->save();
|
| 233 |
+
}
|
| 234 |
+
if($redirect->getConfigData('capture')){
|
| 235 |
+
Mage::helper('authipayredirect')->createInvoice($orderid);
|
| 236 |
+
}
|
| 237 |
+
return true;
|
| 238 |
+
}else{
|
| 239 |
+
$session->addError('There was a problem completing your order. Please try again');
|
| 240 |
+
if ($order->getId()) {
|
| 241 |
+
$order->addStatusToHistory('cancelled', $result . ': ' . $message, false);
|
| 242 |
+
$order->cancel();
|
| 243 |
+
}
|
| 244 |
+
$order->save();
|
| 245 |
+
return false;
|
| 246 |
+
}
|
| 247 |
+
}
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
public function saveauthipayredirectTransaction($post){
|
| 251 |
+
$authipayredirect = Mage::getModel('authipayredirect/authipayredirect');
|
| 252 |
+
|
| 253 |
+
try{
|
| 254 |
+
$authipayredirect->setOrderId($post['oid'])
|
| 255 |
+
->setTimestamp(Mage::helper('authipayredirect')->getDateFromTimestamp($post['txndatetime']))
|
| 256 |
+
->setTerminalid($post['terminal_id'])
|
| 257 |
+
->setExpmonth($post['expmonth'])
|
| 258 |
+
->setStatus($post['status'])
|
| 259 |
+
->setFailreason($post['fail_reason'])
|
| 260 |
+
->setOid($post['oid'])
|
| 261 |
+
->setCurrency($post['currency'])
|
| 262 |
+
->setProcessorresponsecode($post['processor_response_code'])
|
| 263 |
+
->setApprovalcode($post['approval_code'])
|
| 264 |
+
->setExpyear($post['expyear'])
|
| 265 |
+
->setRefnumber($post['refnumber'])
|
| 266 |
+
->setCcbrand($post['ccbrand'])
|
| 267 |
+
->setCccountry($post['cccountry'])
|
| 268 |
+
->setTimezone($post['timezone'])
|
| 269 |
+
->setChargetotal($post['chargetotal'])
|
| 270 |
+
->setTxntype($post['txntype'])
|
| 271 |
+
->setCcbin($post['ccbin'])
|
| 272 |
+
->setTdate($post['tdate'])
|
| 273 |
+
->setTxndate_processed($post['txndate_processed'])
|
| 274 |
+
->setFailrc($post['fail_rc'])
|
| 275 |
+
->setResponsehash($post['response_hash'])
|
| 276 |
+
->setPaymentMethod($post['paymentMethod'])
|
| 277 |
+
->save();
|
| 278 |
+
}catch(Exception $e){
|
| 279 |
+
Mage::logException($e);
|
| 280 |
+
}
|
| 281 |
+
}
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
?>
|
app/code/local/VirtualPayer/AuthipayRedirect/Model/Setup.php
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class VirtualPayer_AuthipayRedirect_Model_Setup extends Mage_Eav_Model_Entity_Setup
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
public function createStaticBlocks(){
|
| 7 |
+
$error = Mage::getModel('cms/block');
|
| 8 |
+
$error->setTitle('AuthipayRedirect Error Message')
|
| 9 |
+
->setIdentifier('authipayredirect_error')
|
| 10 |
+
->setContent('{{var response.message}}')
|
| 11 |
+
->setCreationTime(date('Y-m-d H:i:s'))
|
| 12 |
+
->setUpdateTime(date('Y-m-d H:i:s'))
|
| 13 |
+
->setIsActive(1)
|
| 14 |
+
->setStores(0)
|
| 15 |
+
->save();
|
| 16 |
+
|
| 17 |
+
$success = Mage::getModel('cms/block');
|
| 18 |
+
$success->setTitle('AuthipayRedirect Success Message')
|
| 19 |
+
->setIdentifier('authipayredirect_success')
|
| 20 |
+
->setContent('{{var response.message}}')
|
| 21 |
+
->setCreationTime(date('Y-m-d H:i:s'))
|
| 22 |
+
->setUpdateTime(date('Y-m-d H:i:s'))
|
| 23 |
+
->setIsActive(1)
|
| 24 |
+
->setStores(0)
|
| 25 |
+
->save();
|
| 26 |
+
|
| 27 |
+
$redirect = Mage::getModel('cms/block');
|
| 28 |
+
$redirect->setTitle('AuthipayRedirect Redirect Message')
|
| 29 |
+
->setIdentifier('authipayredirect_redirect')
|
| 30 |
+
->setContent('You will be redirected to Authipay in a few seconds.')
|
| 31 |
+
->setCreationTime(date('Y-m-d H:i:s'))
|
| 32 |
+
->setUpdateTime(date('Y-m-d H:i:s'))
|
| 33 |
+
->setIsActive(1)
|
| 34 |
+
->setStores(0)
|
| 35 |
+
->save();
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
}
|
app/code/local/VirtualPayer/AuthipayRedirect/Model/Source/Cctype.php
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* VirtualPayer_AuthipayRedirect extension
|
| 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 |
+
*
|
| 12 |
+
* @category VirtualPayer
|
| 13 |
+
* @package VirtualPayer_AuthipayRedirect
|
| 14 |
+
* @copyright Copyright (c) 2016 VirtualPayer
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
class VirtualPayer_AuthipayRedirect_Model_Source_Cctype extends Mage_Payment_Model_Source_Cctype
|
| 18 |
+
{
|
| 19 |
+
public function getAllowedTypes()
|
| 20 |
+
{
|
| 21 |
+
return array('VI', 'MC', 'AE');
|
| 22 |
+
}
|
| 23 |
+
}
|
app/code/local/VirtualPayer/AuthipayRedirect/Model/Source/Currency.php
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* VirtualPayer_AuthipayRedirect extension
|
| 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 |
+
*
|
| 12 |
+
* @category VirtualPayer
|
| 13 |
+
* @package VirtualPayer_AuthipayRedirect
|
| 14 |
+
* @copyright Copyright (c) 2016 VirtualPayer
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
class VirtualPayer_AuthipayRedirect_Model_Source_Currency
|
| 18 |
+
{
|
| 19 |
+
public function toOptionArray()
|
| 20 |
+
{
|
| 21 |
+
return array(
|
| 22 |
+
array(
|
| 23 |
+
'value' => 'base',
|
| 24 |
+
'label' => Mage::helper('authipayredirect')->__('Use Base Currency')
|
| 25 |
+
),
|
| 26 |
+
array(
|
| 27 |
+
'value' => 'display',
|
| 28 |
+
'label' => Mage::helper('authipayredirect')->__('Use Display Currency')
|
| 29 |
+
),
|
| 30 |
+
);
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
?>
|
app/code/local/VirtualPayer/AuthipayRedirect/Model/Source/OrderStatus.php
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* VirtualPayer_AuthipayRedirect extension
|
| 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 |
+
*
|
| 12 |
+
* @category VirtualPayer
|
| 13 |
+
* @package VirtualPayer_AuthipayRedirect
|
| 14 |
+
* @copyright Copyright (c) 2016 VirtualPayer
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
class VirtualPayer_AuthipayRedirect_Model_Source_OrderStatus{
|
| 18 |
+
|
| 19 |
+
public function toOptionArray()
|
| 20 |
+
{
|
| 21 |
+
return array(
|
| 22 |
+
array('value' => 'canceled', 'label' => Mage::helper('authipayredirect')->__('Canceled')),
|
| 23 |
+
array('value' => 'pending', 'label' => Mage::helper('authipayredirect')->__('Pending')),
|
| 24 |
+
array('value' => 'processing', 'label' => Mage::helper('authipayredirect')->__('Processing')),
|
| 25 |
+
);
|
| 26 |
+
}
|
| 27 |
+
}
|
app/code/local/VirtualPayer/AuthipayRedirect/Model/Source/PaymentAction.php
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* VirtualPayer_AuthipayRedirect extension
|
| 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 |
+
*
|
| 12 |
+
* @category VirtualPayer
|
| 13 |
+
* @package VirtualPayer_AuthipayRedirect
|
| 14 |
+
* @copyright Copyright (c) 2016 VirtualPayer
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
class VirtualPayer_AuthipayRedirect_Model_Source_PaymentAction
|
| 18 |
+
{
|
| 19 |
+
public function toOptionArray()
|
| 20 |
+
{
|
| 21 |
+
return array(
|
| 22 |
+
array(
|
| 23 |
+
'value' => Mage_AuthipayRedirect_Model_Redirect::ACTION_AUTHORIZE,
|
| 24 |
+
'label' => Mage::helper('authipayredirect')->__('Defer Settlement')
|
| 25 |
+
),
|
| 26 |
+
array(
|
| 27 |
+
'value' => Mage_AuthipayRedirect_Model_Redirect::ACTION_AUTHORIZE_CAPTURE,
|
| 28 |
+
'label' => Mage::helper('authipayredirect')->__('Settle Immediately')
|
| 29 |
+
),
|
| 30 |
+
);
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
?>
|
app/code/local/VirtualPayer/AuthipayRedirect/Model/Source/PaymentMode.php
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* VirtualPayer_AuthipayRedirect extension
|
| 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 |
+
*
|
| 12 |
+
* @category VirtualPayer
|
| 13 |
+
* @package VirtualPayer_AuthipayRedirect
|
| 14 |
+
* @copyright Copyright (c) 2016 VirtualPayer
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
class VirtualPayer_AuthipayRedirect_Model_Source_PaymentMode
|
| 18 |
+
{
|
| 19 |
+
public function toOptionArray()
|
| 20 |
+
{
|
| 21 |
+
return array(
|
| 22 |
+
array(
|
| 23 |
+
'value' => 'authipayredirect/redirect',
|
| 24 |
+
'label' => Mage::helper('authipayredirect')->__('Redirect')
|
| 25 |
+
),
|
| 26 |
+
);
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
?>
|
app/code/local/VirtualPayer/AuthipayRedirect/controllers/Adminhtml/AuthipayRedirectController.php
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class VirtualPayer_AuthipayRedirect_Adminhtml_AuthipayRedirectController extends Mage_Adminhtml_Controller_Action
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
protected function _initAction() {
|
| 7 |
+
$this->loadLayout()
|
| 8 |
+
->_setActiveMenu('authipayredirect/items')
|
| 9 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Authipay Transactions Manager'), Mage::helper('adminhtml')->__('Authipay Transactions Manager'));
|
| 10 |
+
|
| 11 |
+
return $this;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
public function indexAction() {
|
| 15 |
+
$this->_initAction()
|
| 16 |
+
->renderLayout();
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
public function editAction() {
|
| 20 |
+
$id = $this->getRequest()->getParam('id');
|
| 21 |
+
$model = Mage::getModel('authipayredirect/authipayredirect')->load($id);
|
| 22 |
+
|
| 23 |
+
if ($model->getId() || $id == 0) {
|
| 24 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
| 25 |
+
if (!empty($data)) {
|
| 26 |
+
$model->setData($data);
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
Mage::register('authipayredirect_data', $model);
|
| 30 |
+
|
| 31 |
+
$this->loadLayout();
|
| 32 |
+
$this->_setActiveMenu('authipayredirect/items');
|
| 33 |
+
|
| 34 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('authipayredirect Manager'), Mage::helper('adminhtml')->__('authipayredirect Manager'));
|
| 35 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Code News'), Mage::helper('adminhtml')->__('Code News'));
|
| 36 |
+
|
| 37 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
| 38 |
+
|
| 39 |
+
$this->_addContent($this->getLayout()->createBlock('authipayredirect/adminhtml_authipayredirect_edit'))
|
| 40 |
+
->_addLeft($this->getLayout()->createBlock('authipayredirect/adminhtml_authipayredirect_edit_tabs'));
|
| 41 |
+
|
| 42 |
+
$this->renderLayout();
|
| 43 |
+
} else {
|
| 44 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('authipayredirect')->__('Code does not exist'));
|
| 45 |
+
$this->_redirect('*/*/');
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
public function newAction() {
|
| 50 |
+
$this->_forward('edit');
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
public function uploadAction() {
|
| 54 |
+
$this->loadLayout();
|
| 55 |
+
$this->_setActiveMenu('authipayredirect/items');
|
| 56 |
+
|
| 57 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('authipayredirect Manager'), Mage::helper('adminhtml')->__('authipayredirect Manager'));
|
| 58 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Code Import'), Mage::helper('adminhtml')->__('Code Import'));
|
| 59 |
+
|
| 60 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
| 61 |
+
|
| 62 |
+
$this->_addContent($this->getLayout()->createBlock('authipayredirect/adminhtml_authipayredirect_import'))
|
| 63 |
+
->_addLeft($this->getLayout()->createBlock('authipayredirect/adminhtml_authipayredirect_import_tabs'));
|
| 64 |
+
|
| 65 |
+
$this->renderLayout();
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
public function importCSV(){
|
| 69 |
+
try {
|
| 70 |
+
$uploader = new Varien_File_Uploader('filename');
|
| 71 |
+
$uploader->setAllowedExtensions(array('csv'));
|
| 72 |
+
$uploader->setAllowRenameFiles(false);
|
| 73 |
+
$uploader->setFilesDispersion(false);
|
| 74 |
+
|
| 75 |
+
$path = Mage::getBaseDir('media') . DS ;
|
| 76 |
+
$uploader->save($path, $_FILES['filename']['name'] );
|
| 77 |
+
|
| 78 |
+
$row = 1;
|
| 79 |
+
if (($handle = fopen($path . $_FILES['filename']['name'], "r")) !== FALSE) {
|
| 80 |
+
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
|
| 81 |
+
if($row == 1){
|
| 82 |
+
$num = count($data);
|
| 83 |
+
$headings = array();
|
| 84 |
+
for ($c=0; $c < $num; $c++) {
|
| 85 |
+
$headings[$c] = $data[$c];
|
| 86 |
+
}
|
| 87 |
+
$row++;
|
| 88 |
+
continue;
|
| 89 |
+
}else{
|
| 90 |
+
$model = Mage::getModel('authipayredirect/authipayredirect');
|
| 91 |
+
$row++;
|
| 92 |
+
$num = count($data);
|
| 93 |
+
for ($c=0; $c < $num; $c++) {
|
| 94 |
+
$model->setData($headings[$c], $data[$c]);
|
| 95 |
+
}
|
| 96 |
+
$model->save();
|
| 97 |
+
}
|
| 98 |
+
}
|
| 99 |
+
fclose($handle);
|
| 100 |
+
}else{
|
| 101 |
+
Mage::throwException('File Not Found');
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
} catch (Exception $e) {
|
| 105 |
+
Mage::throwException($e->getMessage());
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
public function saveAction() {
|
| 110 |
+
if ($data = $this->getRequest()->getPost()) {
|
| 111 |
+
|
| 112 |
+
if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
|
| 113 |
+
$this->importCSV();
|
| 114 |
+
$this->_redirect('*/*/');
|
| 115 |
+
return;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
$model = Mage::getModel('authipayredirect/authipayredirect');
|
| 119 |
+
$model->setData($data)
|
| 120 |
+
->setId($this->getRequest()->getParam('id'));
|
| 121 |
+
|
| 122 |
+
try {
|
| 123 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
| 124 |
+
$model->setCreatedTime(now())
|
| 125 |
+
->setUpdateTime(now());
|
| 126 |
+
} else {
|
| 127 |
+
$model->setUpdateTime(now());
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
$model->save();
|
| 131 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('authipayredirect')->__('Code was successfully saved'));
|
| 132 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
| 133 |
+
|
| 134 |
+
if ($this->getRequest()->getParam('back')) {
|
| 135 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
| 136 |
+
return;
|
| 137 |
+
}
|
| 138 |
+
$this->_redirect('*/*/');
|
| 139 |
+
return;
|
| 140 |
+
} catch (Exception $e) {
|
| 141 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 142 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
| 143 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
| 144 |
+
return;
|
| 145 |
+
}
|
| 146 |
+
}
|
| 147 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('authipayredirect')->__('Unable to find code to save'));
|
| 148 |
+
$this->_redirect('*/*/');
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
public function deleteAction() {
|
| 152 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
| 153 |
+
try {
|
| 154 |
+
$model = Mage::getModel('authipayredirect/authipayredirect');
|
| 155 |
+
|
| 156 |
+
$model->setId($this->getRequest()->getParam('id'))
|
| 157 |
+
->delete();
|
| 158 |
+
|
| 159 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Code was successfully deleted'));
|
| 160 |
+
$this->_redirect('*/*/');
|
| 161 |
+
} catch (Exception $e) {
|
| 162 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 163 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
$this->_redirect('*/*/');
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
public function massDeleteAction() {
|
| 170 |
+
$authipayredirectIds = $this->getRequest()->getParam('authipayredirect');
|
| 171 |
+
if(!is_array($authipayredirectIds)) {
|
| 172 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select code(s)'));
|
| 173 |
+
} else {
|
| 174 |
+
try {
|
| 175 |
+
foreach ($authipayredirectIds as $authipayredirectId) {
|
| 176 |
+
$authipayredirect = Mage::getModel('authipayredirect/authipayredirect')->load($authipayredirectId);
|
| 177 |
+
$authipayredirect->delete();
|
| 178 |
+
}
|
| 179 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 180 |
+
Mage::helper('adminhtml')->__(
|
| 181 |
+
'Total of %d code(s) were successfully deleted', count($authipayredirectIds)
|
| 182 |
+
)
|
| 183 |
+
);
|
| 184 |
+
} catch (Exception $e) {
|
| 185 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
+
$this->_redirect('*/*/index');
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
public function massStatusAction()
|
| 192 |
+
{
|
| 193 |
+
$authipayredirectIds = $this->getRequest()->getParam('authipayredirect');
|
| 194 |
+
if(!is_array($authipayredirectIds)) {
|
| 195 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select code(s)'));
|
| 196 |
+
} else {
|
| 197 |
+
try {
|
| 198 |
+
foreach ($authipayredirectIds as $authipayredirectId) {
|
| 199 |
+
$authipayredirect = Mage::getSingleton('authipayredirect/authipayredirect')
|
| 200 |
+
->load($authipayredirectId)
|
| 201 |
+
->setStatus($this->getRequest()->getParam('status'))
|
| 202 |
+
->setIsMassupdate(true)
|
| 203 |
+
->save();
|
| 204 |
+
}
|
| 205 |
+
$this->_getSession()->addSuccess(
|
| 206 |
+
$this->__('Total of %d code(s) were successfully updated', count($authipayredirectIds))
|
| 207 |
+
);
|
| 208 |
+
} catch (Exception $e) {
|
| 209 |
+
$this->_getSession()->addError($e->getMessage());
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
$this->_redirect('*/*/index');
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
public function massAssignAction(){
|
| 216 |
+
$authipayredirectIds = $this->getRequest()->getParam('authipayredirect');
|
| 217 |
+
if(!is_array($authipayredirectIds)) {
|
| 218 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select code(s)'));
|
| 219 |
+
} else {
|
| 220 |
+
try {
|
| 221 |
+
foreach ($authipayredirectIds as $authipayredirectId) {
|
| 222 |
+
$authipayredirect = Mage::getSingleton('authipayredirect/authipayredirect')
|
| 223 |
+
->load($authipayredirectId)
|
| 224 |
+
->setAgentId($this->getRequest()->getParam('agent_id'))
|
| 225 |
+
->setIsMassupdate(true)
|
| 226 |
+
->save();
|
| 227 |
+
}
|
| 228 |
+
$this->_getSession()->addSuccess(
|
| 229 |
+
$this->__('Total of %d code(s) were successfully updated', count($authipayredirectIds))
|
| 230 |
+
);
|
| 231 |
+
} catch (Exception $e) {
|
| 232 |
+
$this->_getSession()->addError($e->getMessage());
|
| 233 |
+
}
|
| 234 |
+
}
|
| 235 |
+
$this->_redirect('*/*/index');
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
public function exportCsvAction()
|
| 239 |
+
{
|
| 240 |
+
$fileName = 'authipayredirect.csv';
|
| 241 |
+
$content = $this->getLayout()->createBlock('authipayredirect/adminhtml_authipayredirect_grid')
|
| 242 |
+
->getCsv();
|
| 243 |
+
|
| 244 |
+
$this->_sendUploadResponse($fileName, $content);
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
public function exportXmlAction()
|
| 248 |
+
{
|
| 249 |
+
$fileName = 'authipayredirect.xml';
|
| 250 |
+
$content = $this->getLayout()->createBlock('authipayredirect/adminhtml_authipayredirect_grid')
|
| 251 |
+
->getXml();
|
| 252 |
+
|
| 253 |
+
$this->_sendUploadResponse($fileName, $content);
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
| 257 |
+
{
|
| 258 |
+
$response = $this->getResponse();
|
| 259 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
| 260 |
+
$response->setHeader('Pragma', 'public', true);
|
| 261 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
| 262 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
| 263 |
+
$response->setHeader('Last-Modified', date('r'));
|
| 264 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
| 265 |
+
$response->setHeader('Content-Length', strlen($content));
|
| 266 |
+
$response->setHeader('Content-type', $contentType);
|
| 267 |
+
$response->setBody($content);
|
| 268 |
+
$response->sendResponse();
|
| 269 |
+
die;
|
| 270 |
+
}
|
| 271 |
+
}
|
app/code/local/VirtualPayer/AuthipayRedirect/controllers/RedirectController.php
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* VirtualPayer_AuthipayRedirect extension
|
| 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 |
+
*
|
| 12 |
+
* @category VirtualPayer
|
| 13 |
+
* @package VirtualPayer_AuthipayRedirect
|
| 14 |
+
* @copyright Copyright (c) 2016 VirtualPayer
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
class VirtualPayer_AuthipayRedirect_RedirectController extends Mage_Core_Controller_Front_Action
|
| 18 |
+
{
|
| 19 |
+
/**
|
| 20 |
+
* Order instance
|
| 21 |
+
*/
|
| 22 |
+
protected $_order;
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Get one page checkout model
|
| 26 |
+
*
|
| 27 |
+
* @return Mage_Checkout_Model_Type_Onepage
|
| 28 |
+
*/
|
| 29 |
+
public function getOnepage()
|
| 30 |
+
{
|
| 31 |
+
return Mage::getSingleton('checkout/type_onepage');
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* Get order
|
| 36 |
+
*
|
| 37 |
+
* @param none
|
| 38 |
+
* @return Mage_Sales_Model_Order
|
| 39 |
+
*/
|
| 40 |
+
public function getOrder()
|
| 41 |
+
{
|
| 42 |
+
if ($this->_order == null) {
|
| 43 |
+
}
|
| 44 |
+
return $this->_order;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
* Get singleton with Authipay Connect Redirect order transaction information
|
| 49 |
+
*
|
| 50 |
+
* @return Mage_AuthipayRedirect_Model_Redirect
|
| 51 |
+
*/
|
| 52 |
+
public function getRedirect()
|
| 53 |
+
{
|
| 54 |
+
return Mage::getSingleton('authipayredirect/redirect');
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
/**
|
| 58 |
+
* @return void
|
| 59 |
+
*/
|
| 60 |
+
public function indexAction()
|
| 61 |
+
{
|
| 62 |
+
$session = Mage::getSingleton('checkout/session');
|
| 63 |
+
$session->setAuthipayRedirectQuoteId($session->getQuoteId());
|
| 64 |
+
$session->unsQuoteId();
|
| 65 |
+
|
| 66 |
+
$this->loadLayout();
|
| 67 |
+
$this->getLayout()->getBlock('content')->append($this->getLayout()->createBlock('authipayredirect/redirect_redirect'));
|
| 68 |
+
$this->renderLayout();
|
| 69 |
+
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
/**
|
| 73 |
+
* @return void
|
| 74 |
+
*/
|
| 75 |
+
public function cancelAction()
|
| 76 |
+
{
|
| 77 |
+
$session = Mage::getSingleton('checkout/session');
|
| 78 |
+
|
| 79 |
+
// cancel order
|
| 80 |
+
if ($session->getLastRealOrderId()) {
|
| 81 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
| 82 |
+
if ($order->getId()) {
|
| 83 |
+
$session->addNotice($this->__('Your order with Authipay has been cancelled.'));
|
| 84 |
+
$order->cancel()->save();
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
$this->_redirect('checkout/cart');
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
/**
|
| 92 |
+
* Order success action
|
| 93 |
+
*/
|
| 94 |
+
public function successAction()
|
| 95 |
+
{
|
| 96 |
+
$session = $this->getOnepage()->getCheckout();
|
| 97 |
+
if (!$session->getLastSuccessQuoteId()) {
|
| 98 |
+
$this->_redirect('checkout/cart');
|
| 99 |
+
return;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
$lastQuoteId = $session->getLastQuoteId();
|
| 103 |
+
$lastOrderId = $session->getLastOrderId();
|
| 104 |
+
$lastRecurringProfiles = $session->getLastRecurringProfileIds();
|
| 105 |
+
if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) {
|
| 106 |
+
$this->_redirect('checkout/cart');
|
| 107 |
+
return;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
$session->clear();
|
| 111 |
+
$this->loadLayout();
|
| 112 |
+
$this->_initLayoutMessages('checkout/session');
|
| 113 |
+
Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)));
|
| 114 |
+
$this->renderLayout();
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
public function failureAction()
|
| 118 |
+
{
|
| 119 |
+
$lastQuoteId = $this->getOnepage()->getCheckout()->getLastQuoteId();
|
| 120 |
+
$lastOrderId = $this->getOnepage()->getCheckout()->getLastOrderId();
|
| 121 |
+
|
| 122 |
+
if (!$lastQuoteId || !$lastOrderId) {
|
| 123 |
+
$this->_redirect('checkout/cart');
|
| 124 |
+
return;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
$this->loadLayout();
|
| 128 |
+
$this->renderLayout();
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
}
|
app/code/local/VirtualPayer/AuthipayRedirect/controllers/ResponseController.php
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* VirtualPayer_AuthipayRedirect extension
|
| 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 |
+
*
|
| 12 |
+
* @category VirtualPayer
|
| 13 |
+
* @package VirtualPayer_AuthipayRedirect
|
| 14 |
+
* @copyright Copyright (c) 2016 VirtualPayer
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
class VirtualPayer_AuthipayRedirect_ResponseController extends Mage_Core_Controller_Front_Action
|
| 18 |
+
{
|
| 19 |
+
/**
|
| 20 |
+
* @return void
|
| 21 |
+
*/
|
| 22 |
+
public function indexAction()
|
| 23 |
+
{
|
| 24 |
+
$session = Mage::getSingleton('checkout/session');
|
| 25 |
+
$post = $this->getRequest()->getPost();
|
| 26 |
+
|
| 27 |
+
if($post){
|
| 28 |
+
if (isset($post['oid'])) {
|
| 29 |
+
if(Mage::getModel('authipayredirect/redirect')->processRedirectResponse($post)){
|
| 30 |
+
$session->setQuoteId($session->getAuthipayRedirectRedirectQuoteId());
|
| 31 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('authipayredirect/redirect_success')->toHtml());
|
| 32 |
+
}else{
|
| 33 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('authipayredirect/redirect_error')->toHtml());
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}else{
|
| 37 |
+
//set the quote as inactive after back from Authipay
|
| 38 |
+
$session->getQuote()->setIsActive(false)->save();
|
| 39 |
+
$this->_redirect('checkout/onepage/success', array('_secure'=>true));
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* @return
|
| 45 |
+
*/
|
| 46 |
+
public function failureAction(){
|
| 47 |
+
$session = Mage::getSingleton('checkout/session');
|
| 48 |
+
$lastQuoteId = $session->getLastQuoteId();
|
| 49 |
+
$lastOrderId = $session->getLastOrderId();
|
| 50 |
+
|
| 51 |
+
if (!$lastQuoteId || !$lastOrderId) {
|
| 52 |
+
$this->_redirect('checkout/cart');
|
| 53 |
+
return;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
$order = Mage::getModel('sales/order')->loadByAttribute('entity_id', $lastOrderId);
|
| 57 |
+
|
| 58 |
+
if ($order->getId()) {
|
| 59 |
+
$order->addStatusToHistory('canceled', $session->getErrorMessage())->save();
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
$this->_redirect('checkout/onepage/failure');
|
| 63 |
+
return;
|
| 64 |
+
}
|
| 65 |
+
}
|
app/code/local/VirtualPayer/AuthipayRedirect/etc/config.xml
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* VirtualPayer_AuthipayRedirect extension
|
| 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 |
+
*
|
| 13 |
+
* @category VirtualPayer
|
| 14 |
+
* @package VirtualPayer_AuthipayRedirect
|
| 15 |
+
* @copyright Copyright (c) 2016 VirtualPayer
|
| 16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 17 |
+
*/
|
| 18 |
+
-->
|
| 19 |
+
<config>
|
| 20 |
+
<modules>
|
| 21 |
+
<VirtualPayer_AuthipayRedirect>
|
| 22 |
+
<version>1.0.0</version>
|
| 23 |
+
</VirtualPayer_AuthipayRedirect>
|
| 24 |
+
</modules>
|
| 25 |
+
<global>
|
| 26 |
+
<models>
|
| 27 |
+
<authipayredirect>
|
| 28 |
+
<class>VirtualPayer_AuthipayRedirect_Model</class>
|
| 29 |
+
<resourceModel>authipayredirect_mysql4</resourceModel>
|
| 30 |
+
</authipayredirect>
|
| 31 |
+
<authipayredirect_mysql4>
|
| 32 |
+
<class>VirtualPayer_AuthipayRedirect_Model_Mysql4</class>
|
| 33 |
+
<entities>
|
| 34 |
+
<authipayredirect>
|
| 35 |
+
<table>authipayredirect</table>
|
| 36 |
+
</authipayredirect>
|
| 37 |
+
</entities>
|
| 38 |
+
</authipayredirect_mysql4>
|
| 39 |
+
</models>
|
| 40 |
+
<blocks>
|
| 41 |
+
<authipayredirect>
|
| 42 |
+
<class>VirtualPayer_AuthipayRedirect_Block</class>
|
| 43 |
+
</authipayredirect>
|
| 44 |
+
</blocks>
|
| 45 |
+
<helpers>
|
| 46 |
+
<authipayredirect>
|
| 47 |
+
<class>VirtualPayer_AuthipayRedirect_Helper</class>
|
| 48 |
+
</authipayredirect>
|
| 49 |
+
</helpers>
|
| 50 |
+
<resources>
|
| 51 |
+
<authipayredirect_setup>
|
| 52 |
+
<setup>
|
| 53 |
+
<module>VirtualPayer_AuthipayRedirect</module>
|
| 54 |
+
<class>VirtualPayer_AuthipayRedirect_Model_Setup</class>
|
| 55 |
+
</setup>
|
| 56 |
+
<connection>
|
| 57 |
+
<use>core_setup</use>
|
| 58 |
+
</connection>
|
| 59 |
+
</authipayredirect_setup>
|
| 60 |
+
<authipayredirect_write>
|
| 61 |
+
<connection>
|
| 62 |
+
<use>core_write</use>
|
| 63 |
+
</connection>
|
| 64 |
+
</authipayredirect_write>
|
| 65 |
+
<authipayredirect_read>
|
| 66 |
+
<connection>
|
| 67 |
+
<use>core_read</use>
|
| 68 |
+
</connection>
|
| 69 |
+
</authipayredirect_read>
|
| 70 |
+
</resources>
|
| 71 |
+
<payment>
|
| 72 |
+
<cc>
|
| 73 |
+
<types>
|
| 74 |
+
<VI>
|
| 75 |
+
<code>VI</code>
|
| 76 |
+
<name>Visa</name>
|
| 77 |
+
<order>0</order>
|
| 78 |
+
</VI>
|
| 79 |
+
<MC>
|
| 80 |
+
<code>MC</code>
|
| 81 |
+
<name>MasterCard</name>
|
| 82 |
+
<order>100</order>
|
| 83 |
+
</MC>
|
| 84 |
+
<AM>
|
| 85 |
+
<code>AM</code>
|
| 86 |
+
<name>American Express</name>
|
| 87 |
+
<order>200</order>
|
| 88 |
+
</AM>
|
| 89 |
+
</types>
|
| 90 |
+
</cc>
|
| 91 |
+
</payment>
|
| 92 |
+
</global>
|
| 93 |
+
<frontend>
|
| 94 |
+
<routers>
|
| 95 |
+
<authipayredirect>
|
| 96 |
+
<use>standard</use>
|
| 97 |
+
<args>
|
| 98 |
+
<module>VirtualPayer_AuthipayRedirect</module>
|
| 99 |
+
<frontName>authipayredirect</frontName>
|
| 100 |
+
</args>
|
| 101 |
+
</authipayredirect>
|
| 102 |
+
</routers>
|
| 103 |
+
|
| 104 |
+
<layout>
|
| 105 |
+
<updates>
|
| 106 |
+
<authipayredirect>
|
| 107 |
+
<file>authipayredirect.xml</file>
|
| 108 |
+
</authipayredirect>
|
| 109 |
+
</updates>
|
| 110 |
+
</layout>
|
| 111 |
+
</frontend>
|
| 112 |
+
|
| 113 |
+
<adminhtml>
|
| 114 |
+
<!--<routers>
|
| 115 |
+
<authipayredirect>
|
| 116 |
+
<use>admin</use>
|
| 117 |
+
<args>
|
| 118 |
+
<module>VirtualPayer_AuthipayRedirect</module>
|
| 119 |
+
<frontName>authipayredirect</frontName>
|
| 120 |
+
</args>
|
| 121 |
+
</authipayredirect>
|
| 122 |
+
</routers>-->
|
| 123 |
+
<menu>
|
| 124 |
+
<sales module="sales">
|
| 125 |
+
<children>
|
| 126 |
+
<authipayredirect module="authipayredirect">
|
| 127 |
+
<title>Authipay Transactions</title>
|
| 128 |
+
<sort_order>300</sort_order>
|
| 129 |
+
<action>authipayredirect/adminhtml_authipayredirect</action>
|
| 130 |
+
</authipayredirect>
|
| 131 |
+
</children>
|
| 132 |
+
</sales>
|
| 133 |
+
</menu>
|
| 134 |
+
<acl>
|
| 135 |
+
<resources>
|
| 136 |
+
<all>
|
| 137 |
+
<title>Allow Everything</title>
|
| 138 |
+
</all>
|
| 139 |
+
<admin>
|
| 140 |
+
<children>
|
| 141 |
+
<sales>
|
| 142 |
+
<children>
|
| 143 |
+
<authipayredirect>
|
| 144 |
+
<title>Authipay Transactions</title>
|
| 145 |
+
<sort_order>10</sort_order>
|
| 146 |
+
</authipayredirect>
|
| 147 |
+
</children>
|
| 148 |
+
</sales>
|
| 149 |
+
</children>
|
| 150 |
+
</admin>
|
| 151 |
+
</resources>
|
| 152 |
+
</acl>
|
| 153 |
+
<layout>
|
| 154 |
+
<updates>
|
| 155 |
+
<authipayredirect>
|
| 156 |
+
<file>authipayredirect.xml</file>
|
| 157 |
+
</authipayredirect>
|
| 158 |
+
</updates>
|
| 159 |
+
</layout>
|
| 160 |
+
</adminhtml>
|
| 161 |
+
<default>
|
| 162 |
+
<payment>
|
| 163 |
+
<authipayredirect>
|
| 164 |
+
<active>0</active>
|
| 165 |
+
<title>Authipay Payment Gateway</title>
|
| 166 |
+
<model>authipayredirect/redirect</model>
|
| 167 |
+
<order_status>processing</order_status>
|
| 168 |
+
<payment_action>authorize</payment_action>
|
| 169 |
+
</authipayredirect>
|
| 170 |
+
</payment>
|
| 171 |
+
</default>
|
| 172 |
+
</config>
|
app/code/local/VirtualPayer/AuthipayRedirect/etc/system.xml
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* VirtualPayer_AuthipayRedirect extension
|
| 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 |
+
*
|
| 13 |
+
* @category VirtualPayer
|
| 14 |
+
* @package VirtualPayer_AuthipayRedirect
|
| 15 |
+
* @copyright Copyright (c) 2016 VirtualPayer
|
| 16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 17 |
+
*/
|
| 18 |
+
-->
|
| 19 |
+
<config>
|
| 20 |
+
<sections>
|
| 21 |
+
<payment>
|
| 22 |
+
<groups>
|
| 23 |
+
<authipayredirect translate="label" module="paygate">
|
| 24 |
+
<label>Authipay Payment Gateway</label>
|
| 25 |
+
<sort_order>670</sort_order>
|
| 26 |
+
<show_in_default>1</show_in_default>
|
| 27 |
+
<show_in_website>1</show_in_website>
|
| 28 |
+
<show_in_store>1</show_in_store>
|
| 29 |
+
<fields>
|
| 30 |
+
<active translate="label">
|
| 31 |
+
<label>Enabled</label>
|
| 32 |
+
<frontend_type>select</frontend_type>
|
| 33 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 34 |
+
<sort_order>10</sort_order>
|
| 35 |
+
<show_in_default>1</show_in_default>
|
| 36 |
+
<show_in_website>1</show_in_website>
|
| 37 |
+
<show_in_store>1</show_in_store>
|
| 38 |
+
</active>
|
| 39 |
+
<title translate="label">
|
| 40 |
+
<label>Title</label>
|
| 41 |
+
<frontend_type>text</frontend_type>
|
| 42 |
+
<sort_order>20</sort_order>
|
| 43 |
+
<show_in_default>1</show_in_default>
|
| 44 |
+
<show_in_website>1</show_in_website>
|
| 45 |
+
<show_in_store>1</show_in_store>
|
| 46 |
+
<validate>required-entry</validate>
|
| 47 |
+
<comment>Appears in the checkout and in emails sent to the customer.</comment>
|
| 48 |
+
<depends>
|
| 49 |
+
<active>1</active>
|
| 50 |
+
</depends>
|
| 51 |
+
</title>
|
| 52 |
+
<model translate="label">
|
| 53 |
+
<label>Payment Gateway Mode</label>
|
| 54 |
+
<frontend_type>select</frontend_type>
|
| 55 |
+
<source_model>authipayredirect/source_paymentMode</source_model>
|
| 56 |
+
<sort_order>25</sort_order>
|
| 57 |
+
<show_in_default>1</show_in_default>
|
| 58 |
+
<show_in_website>1</show_in_website>
|
| 59 |
+
<show_in_store>1</show_in_store>
|
| 60 |
+
<comment>For PCI DSS related reasons, please contact Authipay or developer for other Payment Modes.</comment>
|
| 61 |
+
<depends>
|
| 62 |
+
<active>1</active>
|
| 63 |
+
</depends>
|
| 64 |
+
</model>
|
| 65 |
+
<storeid translate="label">
|
| 66 |
+
<label>Store ID</label>
|
| 67 |
+
<frontend_type>text</frontend_type>
|
| 68 |
+
<sort_order>40</sort_order>
|
| 69 |
+
<show_in_default>1</show_in_default>
|
| 70 |
+
<show_in_website>1</show_in_website>
|
| 71 |
+
<show_in_store>1</show_in_store>
|
| 72 |
+
<validate>required-entry</validate>
|
| 73 |
+
<depends>
|
| 74 |
+
<active>1</active>
|
| 75 |
+
</depends>
|
| 76 |
+
</storeid>
|
| 77 |
+
<sharedsecret translate="label">
|
| 78 |
+
<label>Shared Secret</label>
|
| 79 |
+
<frontend_type>password</frontend_type>
|
| 80 |
+
<sort_order>50</sort_order>
|
| 81 |
+
<show_in_default>1</show_in_default>
|
| 82 |
+
<show_in_website>1</show_in_website>
|
| 83 |
+
<show_in_store>1</show_in_store>
|
| 84 |
+
<validate>required-entry</validate>
|
| 85 |
+
<depends>
|
| 86 |
+
<active>1</active>
|
| 87 |
+
</depends>
|
| 88 |
+
</sharedsecret>
|
| 89 |
+
<order_status translate="label">
|
| 90 |
+
<label>New order status</label>
|
| 91 |
+
<frontend_type>select</frontend_type>
|
| 92 |
+
<source_model>authipayredirect/source_orderStatus</source_model>
|
| 93 |
+
<sort_order>80</sort_order>
|
| 94 |
+
<show_in_default>1</show_in_default>
|
| 95 |
+
<show_in_website>1</show_in_website>
|
| 96 |
+
<show_in_store>1</show_in_store>
|
| 97 |
+
<depends>
|
| 98 |
+
<active>1</active>
|
| 99 |
+
</depends>
|
| 100 |
+
</order_status>
|
| 101 |
+
<currency translate="label">
|
| 102 |
+
<label>Transaction Currency</label>
|
| 103 |
+
<frontend_type>select</frontend_type>
|
| 104 |
+
<source_model>authipayredirect/source_currency</source_model>
|
| 105 |
+
<sort_order>95</sort_order>
|
| 106 |
+
<show_in_default>1</show_in_default>
|
| 107 |
+
<show_in_website>1</show_in_website>
|
| 108 |
+
<show_in_store>1</show_in_store>
|
| 109 |
+
<depends>
|
| 110 |
+
<active>1</active>
|
| 111 |
+
</depends>
|
| 112 |
+
</currency>
|
| 113 |
+
<test translate="label">
|
| 114 |
+
<label>Test Environment</label>
|
| 115 |
+
<frontend_type>select</frontend_type>
|
| 116 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 117 |
+
<sort_order>100</sort_order>
|
| 118 |
+
<show_in_default>1</show_in_default>
|
| 119 |
+
<show_in_website>1</show_in_website>
|
| 120 |
+
<show_in_store>1</show_in_store>
|
| 121 |
+
<depends>
|
| 122 |
+
<active>1</active>
|
| 123 |
+
</depends>
|
| 124 |
+
</test>
|
| 125 |
+
<debug translate="label">
|
| 126 |
+
<label>Debug</label>
|
| 127 |
+
<frontend_type>select</frontend_type>
|
| 128 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 129 |
+
<sort_order>110</sort_order>
|
| 130 |
+
<show_in_default>1</show_in_default>
|
| 131 |
+
<show_in_website>1</show_in_website>
|
| 132 |
+
<show_in_store>1</show_in_store>
|
| 133 |
+
<comment>Logs requests to and responses from Authipay to /var/log.system.log provided that logging is enabled.</comment>
|
| 134 |
+
<depends>
|
| 135 |
+
<active>1</active>
|
| 136 |
+
</depends>
|
| 137 |
+
</debug>
|
| 138 |
+
</fields>
|
| 139 |
+
</authipayredirect>
|
| 140 |
+
</groups>
|
| 141 |
+
</payment>
|
| 142 |
+
</sections>
|
| 143 |
+
</config>
|
app/code/local/VirtualPayer/AuthipayRedirect/sql/authipayredirect_setup/mysql4-install-0.1.0.php
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
|
| 7 |
+
$installer->run("
|
| 8 |
+
|
| 9 |
+
DROP TABLE IF EXISTS {$this->getTable('authipayredirect')};
|
| 10 |
+
CREATE TABLE {$this->getTable('authipayredirect')} (
|
| 11 |
+
`authipayredirect_id` int(11) unsigned NOT NULL auto_increment,
|
| 12 |
+
`order_id` varchar(255) NOT NULL default '',
|
| 13 |
+
`timestamp` datetime NULL,
|
| 14 |
+
`terminal_id` varchar(255) NOT NULL default '',
|
| 15 |
+
`oid` varchar(255) NOT NULL default '',
|
| 16 |
+
`status` varchar(255) NOT NULL default '',
|
| 17 |
+
`fail_reason` varchar(255) NOT NULL default '',
|
| 18 |
+
`fail_rc` varchar(255) NOT NULL default '',
|
| 19 |
+
`approval_code` varchar(255) NOT NULL default '',
|
| 20 |
+
`processor_response_code` varchar(255) NOT NULL default '',
|
| 21 |
+
`cardnumber` varchar(255) NOT NULL default '',
|
| 22 |
+
`currency` varchar(255) NOT NULL default '',
|
| 23 |
+
`ccbin` varchar(255) NOT NULL default '',
|
| 24 |
+
`tdate` date NULL,
|
| 25 |
+
`txndate_processed` varchar(255) NOT NULL default '',
|
| 26 |
+
`expyear` varchar(255) NOT NULL default '',
|
| 27 |
+
`expmonth` varchar(255) NOT NULL default '',
|
| 28 |
+
`refnumber` varchar(255) NOT NULL default '',
|
| 29 |
+
`ccbrand` varchar(255) NOT NULL default '',
|
| 30 |
+
`cccountry` varchar(255) NOT NULL default '',
|
| 31 |
+
`chargetotal` varchar(255) NOT NULL default '',
|
| 32 |
+
`txntype` varchar(255) NOT NULL default '',
|
| 33 |
+
`response_hash` varchar(255) NOT NULL default '',
|
| 34 |
+
`paymentMethod` varchar(2) NOT NULL default '',
|
| 35 |
+
PRIMARY KEY (`authipayredirect_id`)
|
| 36 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 37 |
+
|
| 38 |
+
");
|
| 39 |
+
|
| 40 |
+
$installer->endSetup();
|
| 41 |
+
|
app/design/adminhtml/default/default/layout/authipayredirect.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout version="0.1.0">
|
| 3 |
+
<authipayredirect_adminhtml_authipayredirect_index>
|
| 4 |
+
<reference name="content">
|
| 5 |
+
<block type="authipayredirect/adminhtml_authipayredirect" name="authipayredirect" />
|
| 6 |
+
</reference>
|
| 7 |
+
</authipayredirect_adminhtml_authipayredirect_index>
|
| 8 |
+
</layout>
|
app/design/frontend/base/default/layout/authipayredirect.xml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<layout version="0.1.0">
|
| 2 |
+
<authipayredirect_redirect_success>
|
| 3 |
+
<reference name="root">
|
| 4 |
+
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
| 5 |
+
</reference>
|
| 6 |
+
|
| 7 |
+
<reference name="content">
|
| 8 |
+
<block type="core/template" name="authipayredirect.redirect.success" template="authipayredirect/redirect/success.phtml" />
|
| 9 |
+
</reference>
|
| 10 |
+
</authipayredirect_redirect_success>
|
| 11 |
+
|
| 12 |
+
<authipayredirect_redirect_failure>
|
| 13 |
+
<reference name="root">
|
| 14 |
+
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
| 15 |
+
</reference>
|
| 16 |
+
|
| 17 |
+
<reference name="content">
|
| 18 |
+
<block type="core/template" name="authipayredirect.redirect.failure" template="authipayredirect/redirect/failure.phtml" />
|
| 19 |
+
</reference>
|
| 20 |
+
</authipayredirect_redirect_failure>
|
| 21 |
+
</layout>
|
app/design/frontend/base/default/template/authipayredirect/redirect/failure.phtml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$block = Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('authipayredirect_error');
|
| 4 |
+
|
| 5 |
+
$html = Mage::helper('authipayredirect')->getCustomerMessage($block, Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId()), Mage::getModel('authipayredirect/authipayredirect')->getCollection()->addFieldToFilter('order_id', Mage::getSingleton('checkout/session')->getLastRealOrderId())->getFirstItem());
|
| 6 |
+
|
| 7 |
+
echo $html;
|
| 8 |
+
|
| 9 |
+
?>
|
app/design/frontend/base/default/template/authipayredirect/redirect/form.phtml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
?>
|
| 4 |
+
<fieldset class="form-list">
|
| 5 |
+
<?php $_code=$this->getMethodCode() ?>
|
| 6 |
+
|
| 7 |
+
<?php $redirect = Mage::getModel('authipayredirect/redirect'); ?>
|
| 8 |
+
<ul id="payment_form_<?php echo $_code ?>" style="display:none">
|
| 9 |
+
<li>
|
| 10 |
+
<?php echo $this->__('You will be redirected to Authipay secured hosted pages.') ?>
|
| 11 |
+
</li>
|
| 12 |
+
</ul>
|
| 13 |
+
</fieldset>
|
app/design/frontend/base/default/template/authipayredirect/redirect/success.phtml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$block = Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('authipayredirect_success');
|
| 4 |
+
|
| 5 |
+
$html = Mage::helper('authipayredirect')->getCustomerMessage($block, Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId()), Mage::getModel('authipayredirect/authipayredirect')->getCollection()->addFieldToFilter('order_id', Mage::getSingleton('checkout/session')->getLastRealOrderId())->getFirstItem());
|
| 6 |
+
|
| 7 |
+
echo $html;
|
| 8 |
+
|
| 9 |
+
?>
|
app/etc/modules/VirtualPayer_AuthipayRedirect.xml
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* VirtualPayer_AuthipayRedirect extension
|
| 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 |
+
*
|
| 13 |
+
* @category VirtualPayer
|
| 14 |
+
* @package VirtualPayer_AuthipayRedirect
|
| 15 |
+
* @copyright Copyright (c) 2016 VirtualPayer
|
| 16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 17 |
+
*/
|
| 18 |
+
-->
|
| 19 |
+
<config>
|
| 20 |
+
<modules>
|
| 21 |
+
<VirtualPayer_AuthipayRedirect>
|
| 22 |
+
<active>true</active>
|
| 23 |
+
<codePool>local</codePool>
|
| 24 |
+
<depends>
|
| 25 |
+
<Mage_Payment />
|
| 26 |
+
</depends>
|
| 27 |
+
</VirtualPayer_AuthipayRedirect>
|
| 28 |
+
</modules>
|
| 29 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>VirtualPayer_AuthipayRedirect</name>
|
| 4 |
+
<version>1.0.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Allied Irish Banks Merchant Services (AIBMS) Authipay Redirect module. This module redirects customers to the Authipay secured hosted payment pages.</summary>
|
| 10 |
+
<description>This module integrates Authipay with your Magento store and its fully tested on the Internet Payment Gateway (IPG) environments for Authipay.
|
| 11 |
+
The module supports card types enabled on your AIBMS Merchant Account.</description>
|
| 12 |
+
<notes>Fully tested on the Internet Payment Gateway (IPG) test environment.</notes>
|
| 13 |
+
<authors><author><name>VirtualPayer</name><user>VirtualPayer</user><email>support@virtualpayer.com</email></author></authors>
|
| 14 |
+
<date>2016-02-28</date>
|
| 15 |
+
<time>13:16:31</time>
|
| 16 |
+
<contents><target name="magelocal"><dir name="VirtualPayer"><dir name="AuthipayRedirect"><dir name="Block"><dir name="Adminhtml"><dir name="AuthipayRedirect"><file name="Grid.php" hash="0307d86a6a66d9adf65341124890e9ed"/></dir><file name="AuthipayRedirect.php" hash="e273830d5e86606f13f87727d1ee1e78"/></dir><dir name="Redirect"><file name="Error.php" hash="c6fd17e1d33b5017d8a5312e75c32afc"/><file name="Form.php" hash="c37af6b4fa6cded295ad762001af5c22"/><file name="Redirect.php" hash="fd40c4e09d75885402a191aa85b0f0fc"/><file name="Success.php" hash="a134c4f3d2bd29d741d37989e12c34ad"/></dir></dir><dir name="Helper"><file name="Data.php" hash="e3b415322b3e0d7cac9d21dd424b2cb1"/></dir><dir name="Model"><file name="AuthipayRedirect.php" hash="1eb546e5c9a512a09797281771725b2a"/><dir name="Mysql4"><dir name="AuthipayRedirect"><file name="Collection.php" hash="c2795d430788ab37daf183662b79c9d5"/></dir><file name="AuthipayRedirect.php" hash="4ca631394b32b17d06fe82572145edf3"/></dir><file name="Redirect.php" hash="4a080ec3be82a9aa6353863885fb50e3"/><file name="Setup.php" hash="a1a364793dbbae533b62ea386e39aadd"/><dir name="Source"><file name="Cctype.php" hash="91d322e23770489f6afc4c2e9bc63dfc"/><file name="Currency.php" hash="e0c7d271f65f8d8aa73cd624c2bfddbf"/><file name="OrderStatus.php" hash="aa76d3969c3586e8aa2e3066769b9df3"/><file name="PaymentAction.php" hash="919edea08322b45dd9d8bf1895cd148b"/><file name="PaymentMode.php" hash="3e8ebd7cca5e66cb4977aa823e550cb4"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AuthipayRedirectController.php" hash="ccec0bbc2c93db777a5904acbee1c0ea"/></dir><file name="RedirectController.php" hash="ad33ee05de0b7c4a43aa9d64f8224ea9"/><file name="ResponseController.php" hash="375e84f43fb6194f17f10e8a0abd5485"/></dir><dir name="etc"><file name="config.xml" hash="ebe9f939959c305dd10b432fb803cb41"/><file name="system.xml" hash="eea5e8db50a71f5233d9b0383445cb50"/></dir><dir name="sql"><dir name="authipayredirect_setup"><file name="mysql4-install-0.1.0.php" hash="e28cb69776d9cd431921154be6b6ddf9"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="authipayredirect.xml" hash="bc2f12134d8bd247c2349a9a091613f5"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="authipayredirect.xml" hash="330f84f6a3cbbc726d072f2041a3d6e5"/></dir><dir name="template"><dir name="authipayredirect"><dir><dir name="redirect"><file name="failure.phtml" hash="15e0232fde04cc908a30272c6e25f44d"/><file name="form.phtml" hash="78875c6924b7ba009df31b573f3b708c"/><file name="success.phtml" hash="90dfc664a6fd8cd021778c10d598c461"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="VirtualPayer_AuthipayRedirect.xml" hash="e6de65d173ce7abdddc806ff5573e319"/></dir></target></contents>
|
| 17 |
+
<compatible/>
|
| 18 |
+
<dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php></required></dependencies>
|
| 19 |
+
</package>
|
