Version Notes
Bug Fixes:
- Refunded orders now receive the 'on hold' state instead of being locked.
- Cart is no longer empty when cancelling an order.
- Crossdomain configuration has been fixed.
Enhancements:
- Compatible with the Multifees extension from MageWorx
Download this release
Release Info
| Developer | ICEPAY |
| Extension | Icepay_IceAdvanced |
| Version | 1.1.10 |
| Comparing to | |
| See all releases | |
Code changes from version 1.1.9 to 1.1.10
- app/code/community/Icepay/IceAdvanced/Block/Adminhtml/Grid/Paymentmethods.php +3 -3
- app/code/community/Icepay/IceAdvanced/Helper/Data.php +2 -1
- app/code/community/Icepay/IceAdvanced/Model/Extensions/MageWorx/MultiFees.php +42 -0
- app/code/community/Icepay/IceAdvanced/Model/Observer.php +20 -1
- app/code/community/Icepay/IceAdvanced/Model/Pay.php +6 -1
- app/code/community/Icepay/IceAdvanced/etc/config.xml +9 -0
- app/code/community/Icepay/IceCore/Block/Adminhtml/GenerateURL.php +6 -4
- app/code/community/Icepay/IceCore/Block/Adminhtml/Grid/Modules.php +13 -25
- app/code/community/Icepay/IceCore/Helper/Data.php +1 -1
- app/code/community/Icepay/IceCore/Model/Icepay/Postback.php +48 -25
- app/code/community/Icepay/IceCore/Model/Icepay/Result.php +23 -19
- app/code/community/Icepay/IceCore/Model/Mysql4/IceCore.php +1 -1
- app/design/adminhtml/default/default/template/icepaycore/grid_modules.phtml +1 -1
- package.xml +12 -11
app/code/community/Icepay/IceAdvanced/Block/Adminhtml/Grid/Paymentmethods.php
CHANGED
|
@@ -25,9 +25,9 @@ class Icepay_IceAdvanced_Block_Adminhtml_Grid_PaymentMethods extends Mage_Adminh
|
|
| 25 |
public function __construct()
|
| 26 |
{
|
| 27 |
$this->_scope = Mage::app()->getStore(Mage::helper("icecore")->getStoreFromRequest())->getId();
|
| 28 |
-
$this->_ajaxLoadPaymentMethodURL = Mage::helper('adminhtml')->getUrl('icepayadvanced/config/index/paymentmethod/{{pm_code}}', array('_secure' => true
|
| 29 |
-
$this->_ajaxSavePaymentMethodURL = Mage::helper('adminhtml')->getUrl('icepayadvanced/ajax/save_paymentmethod', array('_secure' => true
|
| 30 |
-
$this->_ajaxGetPaymentMethodsURL = Mage::helper('adminhtml')->getUrl('icepayadvanced/ajax/get_paymentmethods', array('_secure' => true
|
| 31 |
|
| 32 |
$this->setTemplate('icepayadvanced/grid_paymentmethods.phtml');
|
| 33 |
}
|
| 25 |
public function __construct()
|
| 26 |
{
|
| 27 |
$this->_scope = Mage::app()->getStore(Mage::helper("icecore")->getStoreFromRequest())->getId();
|
| 28 |
+
$this->_ajaxLoadPaymentMethodURL = Mage::helper('adminhtml')->getUrl('icepayadvanced/config/index/paymentmethod/{{pm_code}}', array('_secure' => true));
|
| 29 |
+
$this->_ajaxSavePaymentMethodURL = Mage::helper('adminhtml')->getUrl('icepayadvanced/ajax/save_paymentmethod', array('_secure' => true));
|
| 30 |
+
$this->_ajaxGetPaymentMethodsURL = Mage::helper('adminhtml')->getUrl('icepayadvanced/ajax/get_paymentmethods', array('_secure' => true));
|
| 31 |
|
| 32 |
$this->setTemplate('icepayadvanced/grid_paymentmethods.phtml');
|
| 33 |
}
|
app/code/community/Icepay/IceAdvanced/Helper/Data.php
CHANGED
|
@@ -4,6 +4,7 @@
|
|
| 4 |
* ICEPAY Advanced - Helper class
|
| 5 |
* @version 1.0.0
|
| 6 |
* @author Olaf Abbenhuis
|
|
|
|
| 7 |
* @copyright ICEPAY <www.icepay.com>
|
| 8 |
*
|
| 9 |
* Disclaimer:
|
|
@@ -17,7 +18,7 @@ class Icepay_IceAdvanced_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
| 17 |
/* Install values */
|
| 18 |
|
| 19 |
public $title = 'Advanced';
|
| 20 |
-
public $version = '1.1.
|
| 21 |
public $id = 'ADV';
|
| 22 |
public $fingerprint = '7f4de76ecbf7d847caeba64c42938a6a05821c4f';
|
| 23 |
public $compatibility_oldest_version = '1.5.0.0';
|
| 4 |
* ICEPAY Advanced - Helper class
|
| 5 |
* @version 1.0.0
|
| 6 |
* @author Olaf Abbenhuis
|
| 7 |
+
* @author Wouter van Tilburg
|
| 8 |
* @copyright ICEPAY <www.icepay.com>
|
| 9 |
*
|
| 10 |
* Disclaimer:
|
| 18 |
/* Install values */
|
| 19 |
|
| 20 |
public $title = 'Advanced';
|
| 21 |
+
public $version = '1.1.10';
|
| 22 |
public $id = 'ADV';
|
| 23 |
public $fingerprint = '7f4de76ecbf7d847caeba64c42938a6a05821c4f';
|
| 24 |
public $compatibility_oldest_version = '1.5.0.0';
|
app/code/community/Icepay/IceAdvanced/Model/Extensions/MageWorx/MultiFees.php
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Icepay_IceAdvanced_Model_Extensions_MageWorx_MultiFees extends Mage_Payment_Model_Method_Abstract {
|
| 4 |
+
|
| 5 |
+
private $helper;
|
| 6 |
+
|
| 7 |
+
public function __construct()
|
| 8 |
+
{
|
| 9 |
+
$this->helper = Mage::helper('multifees');
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
public function addPrice($fee, $ic_order)
|
| 13 |
+
{
|
| 14 |
+
$feeDetails = $fee[1];
|
| 15 |
+
|
| 16 |
+
// Get Total price in cents
|
| 17 |
+
$price = (int) (string) ($feeDetails['price'] * 100);
|
| 18 |
+
|
| 19 |
+
// Calculate VAT percentage
|
| 20 |
+
$vatPercentage = 0;
|
| 21 |
+
|
| 22 |
+
if ($feeDetails['tax_class_id'] != '0') {
|
| 23 |
+
$tax = (int) (string) ($feeDetails['tax'] * 100);
|
| 24 |
+
$priceExTax = $price - $tax;
|
| 25 |
+
$vatPercentage = (int)(string)(($tax / $priceExTax) * 100);
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
$product = $ic_order->createProduct()
|
| 29 |
+
->setProductID('00')
|
| 30 |
+
->setProductName($feeDetails['title'])
|
| 31 |
+
->setDescription($feeDetails['options'][1]['title'])
|
| 32 |
+
->setQuantity('1')
|
| 33 |
+
->setUnitPrice($price)
|
| 34 |
+
->setVATCategory($ic_order->getCategoryForPercentage($vatPercentage))
|
| 35 |
+
;
|
| 36 |
+
|
| 37 |
+
$ic_order->addProduct($product);
|
| 38 |
+
|
| 39 |
+
return $ic_order;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
}
|
app/code/community/Icepay/IceAdvanced/Model/Observer.php
CHANGED
|
@@ -44,6 +44,25 @@ class Icepay_IceAdvanced_Model_Observer extends Mage_Payment_Block_Form_Containe
|
|
| 44 |
return true;
|
| 45 |
}
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
public function sales_quote_collect_totals_after(Varien_Event_Observer $observer)
|
| 48 |
{
|
| 49 |
$paymentMethod = Mage::app()->getFrontController()->getRequest()->getParam('payment');
|
|
@@ -246,7 +265,7 @@ class Icepay_IceAdvanced_Model_Observer extends Mage_Payment_Block_Form_Containe
|
|
| 246 |
if ($this->isIssuer()) {
|
| 247 |
|
| 248 |
$issuerListArr = array();
|
| 249 |
-
foreach ($this->getIssuers() as $issuer) {
|
| 250 |
if (!in_array($issuer->IssuerKeyword, Mage::helper("iceadvanced")->filteredPaymentMethodIssuers))
|
| 251 |
array_push($issuerListArr, $issuer->IssuerKeyword);
|
| 252 |
}
|
| 44 |
return true;
|
| 45 |
}
|
| 46 |
|
| 47 |
+
public function custom_quote_process(Varien_Event_Observer $observer)
|
| 48 |
+
{
|
| 49 |
+
$session = Mage::getSingleton('core/session');
|
| 50 |
+
$quoteID = $session->getData('ic_quoteid');
|
| 51 |
+
|
| 52 |
+
if (!is_null($quoteID)) {
|
| 53 |
+
$quoteDate = $session->getData('ic_quotedate');
|
| 54 |
+
|
| 55 |
+
$diff = abs(strtotime(date("Y-m-d H:i:s")) - strtotime($quoteDate));
|
| 56 |
+
|
| 57 |
+
if ($diff < 360) {
|
| 58 |
+
$observer['checkout_session']->setQuoteId($quoteID);
|
| 59 |
+
$observer['checkout_session']->setLoadInactive(true);
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
return $observer;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
public function sales_quote_collect_totals_after(Varien_Event_Observer $observer)
|
| 67 |
{
|
| 68 |
$paymentMethod = Mage::app()->getFrontController()->getRequest()->getParam('payment');
|
| 265 |
if ($this->isIssuer()) {
|
| 266 |
|
| 267 |
$issuerListArr = array();
|
| 268 |
+
foreach ($this->getIssuers() as $issuer) {
|
| 269 |
if (!in_array($issuer->IssuerKeyword, Mage::helper("iceadvanced")->filteredPaymentMethodIssuers))
|
| 270 |
array_push($issuerListArr, $issuer->IssuerKeyword);
|
| 271 |
}
|
app/code/community/Icepay/IceAdvanced/Model/Pay.php
CHANGED
|
@@ -16,7 +16,7 @@
|
|
| 16 |
class Icepay_IceAdvanced_Model_Pay extends Mage_Payment_Model_Method_Abstract {
|
| 17 |
|
| 18 |
private $sqlModel;
|
| 19 |
-
|
| 20 |
public function __construct()
|
| 21 |
{
|
| 22 |
$this->sqlModel = Mage::getModel('icecore/mysql4_iceCore');
|
|
@@ -153,6 +153,11 @@ class Icepay_IceAdvanced_Model_Pay extends Mage_Payment_Model_Method_Abstract {
|
|
| 153 |
$ic_order->setShippingCosts(0, -1);
|
| 154 |
}
|
| 155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
if (Mage::helper('icecore')->isModuleInstalled('MW_GiftWrap')) {
|
| 157 |
$giftWrapExtension = Mage::getModel('iceadvanced/extensions_MW_GiftWrap');
|
| 158 |
$ic_order = $giftWrapExtension->addGiftWrapPrices($session->getLastQuoteId(), $ic_order);
|
| 16 |
class Icepay_IceAdvanced_Model_Pay extends Mage_Payment_Model_Method_Abstract {
|
| 17 |
|
| 18 |
private $sqlModel;
|
| 19 |
+
|
| 20 |
public function __construct()
|
| 21 |
{
|
| 22 |
$this->sqlModel = Mage::getModel('icecore/mysql4_iceCore');
|
| 153 |
$ic_order->setShippingCosts(0, -1);
|
| 154 |
}
|
| 155 |
|
| 156 |
+
if (Mage::helper('icecore')->isModuleInstalled('MageWorx_MultiFees')) {
|
| 157 |
+
$multiFeesExtension = Mage::getModel('iceadvanced/extensions_Mageworx_MultiFees');
|
| 158 |
+
$ic_order = $multiFeesExtension->addPrice(unserialize($order->getDetailsMultifees()), $ic_order);
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
if (Mage::helper('icecore')->isModuleInstalled('MW_GiftWrap')) {
|
| 162 |
$giftWrapExtension = Mage::getModel('iceadvanced/extensions_MW_GiftWrap');
|
| 163 |
$ic_order = $giftWrapExtension->addGiftWrapPrices($session->getLastQuoteId(), $ic_order);
|
app/code/community/Icepay/IceAdvanced/etc/config.xml
CHANGED
|
@@ -42,6 +42,15 @@
|
|
| 42 |
</iceadvanced>
|
| 43 |
</observers>
|
| 44 |
</sales_quote_collect_totals_after>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
</events>
|
| 46 |
</frontend>
|
| 47 |
|
| 42 |
</iceadvanced>
|
| 43 |
</observers>
|
| 44 |
</sales_quote_collect_totals_after>
|
| 45 |
+
<custom_quote_process>
|
| 46 |
+
<observers>
|
| 47 |
+
<iceadvanced>
|
| 48 |
+
<type>singleton</type>
|
| 49 |
+
<class>iceadvanced/observer</class>
|
| 50 |
+
<method>custom_quote_process</method>
|
| 51 |
+
</iceadvanced>
|
| 52 |
+
</observers>
|
| 53 |
+
</custom_quote_process>
|
| 54 |
</events>
|
| 55 |
</frontend>
|
| 56 |
|
app/code/community/Icepay/IceCore/Block/Adminhtml/GenerateURL.php
CHANGED
|
@@ -13,15 +13,16 @@
|
|
| 13 |
* charged in accordance with the standard ICEPAY tariffs.
|
| 14 |
*
|
| 15 |
*/
|
| 16 |
-
|
| 17 |
class Icepay_IceCore_Block_Adminhtml_GenerateURL extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
| 18 |
|
| 19 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
|
|
|
| 20 |
$this->setElement($element);
|
| 21 |
return $this->enCase(Mage::helper("icecore")->getStoreFrontURL($this->setAction($this->getElement()->getName())));
|
| 22 |
}
|
| 23 |
|
| 24 |
-
protected function setAction($elementName)
|
|
|
|
| 25 |
switch ($elementName) {
|
| 26 |
case "groups[settings][fields][merchant_url_ok][value]": return "result";
|
| 27 |
case "groups[settings][fields][merchant_url_err][value]": return "result";
|
|
@@ -29,7 +30,8 @@ class Icepay_IceCore_Block_Adminhtml_GenerateURL extends Mage_Adminhtml_Block_Sy
|
|
| 29 |
}
|
| 30 |
}
|
| 31 |
|
| 32 |
-
protected function enCase($str)
|
|
|
|
| 33 |
return '<input type="text" name="" class="icepay_url_form" value="' . $str . '"/>';
|
| 34 |
}
|
| 35 |
|
| 13 |
* charged in accordance with the standard ICEPAY tariffs.
|
| 14 |
*
|
| 15 |
*/
|
|
|
|
| 16 |
class Icepay_IceCore_Block_Adminhtml_GenerateURL extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
| 17 |
|
| 18 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
| 19 |
+
{
|
| 20 |
$this->setElement($element);
|
| 21 |
return $this->enCase(Mage::helper("icecore")->getStoreFrontURL($this->setAction($this->getElement()->getName())));
|
| 22 |
}
|
| 23 |
|
| 24 |
+
protected function setAction($elementName)
|
| 25 |
+
{
|
| 26 |
switch ($elementName) {
|
| 27 |
case "groups[settings][fields][merchant_url_ok][value]": return "result";
|
| 28 |
case "groups[settings][fields][merchant_url_err][value]": return "result";
|
| 30 |
}
|
| 31 |
}
|
| 32 |
|
| 33 |
+
protected function enCase($str)
|
| 34 |
+
{
|
| 35 |
return '<input type="text" name="" class="icepay_url_form" value="' . $str . '"/>';
|
| 36 |
}
|
| 37 |
|
app/code/community/Icepay/IceCore/Block/Adminhtml/Grid/Modules.php
CHANGED
|
@@ -13,50 +13,38 @@
|
|
| 13 |
* charged in accordance with the standard ICEPAY tariffs.
|
| 14 |
*
|
| 15 |
*/
|
| 16 |
-
|
| 17 |
class Icepay_IceCore_Block_Adminhtml_Grid_Modules extends Mage_Adminhtml_Block_Widget implements Varien_Data_Form_Element_Renderer_Interface {
|
| 18 |
|
| 19 |
protected $_element;
|
| 20 |
|
| 21 |
-
public function __construct()
|
|
|
|
| 22 |
$this->setTemplate('icepaycore/grid_modules.phtml');
|
| 23 |
}
|
| 24 |
|
| 25 |
-
public function render(Varien_Data_Form_Element_Abstract $element)
|
| 26 |
-
|
| 27 |
-
return $this->toHtml();
|
| 28 |
-
}
|
| 29 |
-
|
| 30 |
-
public function setElement(Varien_Data_Form_Element_Abstract $element) {
|
| 31 |
$this->_element = $element;
|
| 32 |
-
return $this;
|
| 33 |
}
|
| 34 |
|
| 35 |
-
public function getElement()
|
|
|
|
| 36 |
return $this->_element;
|
| 37 |
}
|
| 38 |
|
| 39 |
-
public function getModules()
|
|
|
|
| 40 |
|
| 41 |
$core_sql = Mage::getSingleton('icecore/mysql4_iceCore');
|
| 42 |
return $core_sql->getModulesConfiguration();
|
| 43 |
}
|
| 44 |
|
| 45 |
-
public function getAddButtonHtml() {
|
| 46 |
-
return $this->getChildHtml('add_button');
|
| 47 |
-
}
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
'onclick' => 'return tierPriceControl.addItem()',
|
| 54 |
-
'class' => 'add'
|
| 55 |
-
));
|
| 56 |
-
$button->setName('add_tier_price_item_button');
|
| 57 |
-
|
| 58 |
-
$this->setChild('add_button', $button);
|
| 59 |
-
return parent::_prepareLayout();
|
| 60 |
}
|
| 61 |
|
| 62 |
}
|
| 13 |
* charged in accordance with the standard ICEPAY tariffs.
|
| 14 |
*
|
| 15 |
*/
|
|
|
|
| 16 |
class Icepay_IceCore_Block_Adminhtml_Grid_Modules extends Mage_Adminhtml_Block_Widget implements Varien_Data_Form_Element_Renderer_Interface {
|
| 17 |
|
| 18 |
protected $_element;
|
| 19 |
|
| 20 |
+
public function __construct()
|
| 21 |
+
{
|
| 22 |
$this->setTemplate('icepaycore/grid_modules.phtml');
|
| 23 |
}
|
| 24 |
|
| 25 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
| 26 |
+
{
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
$this->_element = $element;
|
| 28 |
+
return $this->toHtml();
|
| 29 |
}
|
| 30 |
|
| 31 |
+
public function getElement()
|
| 32 |
+
{
|
| 33 |
return $this->_element;
|
| 34 |
}
|
| 35 |
|
| 36 |
+
public function getModules()
|
| 37 |
+
{
|
| 38 |
|
| 39 |
$core_sql = Mage::getSingleton('icecore/mysql4_iceCore');
|
| 40 |
return $core_sql->getModulesConfiguration();
|
| 41 |
}
|
| 42 |
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
+
|
| 45 |
+
protected function _prepareLayout()
|
| 46 |
+
{
|
| 47 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
}
|
| 49 |
|
| 50 |
}
|
app/code/community/Icepay/IceCore/Helper/Data.php
CHANGED
|
@@ -17,7 +17,7 @@ class Icepay_IceCore_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
| 17 |
/* Install values */
|
| 18 |
|
| 19 |
public $title = "Core";
|
| 20 |
-
public $version = "1.1.
|
| 21 |
public $id = "003";
|
| 22 |
public $fingerprint = "003";
|
| 23 |
public $compatibility_oldest_version = "1.5.0.0";
|
| 17 |
/* Install values */
|
| 18 |
|
| 19 |
public $title = "Core";
|
| 20 |
+
public $version = "1.1.10";
|
| 21 |
public $id = "003";
|
| 22 |
public $fingerprint = "003";
|
| 23 |
public $compatibility_oldest_version = "1.5.0.0";
|
app/code/community/Icepay/IceCore/Model/Icepay/Postback.php
CHANGED
|
@@ -21,12 +21,14 @@ class Icepay_IceCore_Model_Icepay_Postback {
|
|
| 21 |
protected $storeID;
|
| 22 |
private $_post;
|
| 23 |
|
| 24 |
-
public function __construct()
|
|
|
|
| 25 |
$this->sqlModel = Mage::getModel('icecore/mysql4_iceCore');
|
| 26 |
$this->orderModel = Mage::getModel('sales/order');
|
| 27 |
}
|
| 28 |
|
| 29 |
-
public function handle($_vars)
|
|
|
|
| 30 |
if (!$_vars) {
|
| 31 |
Mage::helper("icecore")->log("No Postback vars");
|
| 32 |
die("ICEPAY postback page installed correctly.");
|
|
@@ -96,7 +98,8 @@ class Icepay_IceCore_Model_Icepay_Postback {
|
|
| 96 |
}
|
| 97 |
}
|
| 98 |
|
| 99 |
-
protected function outputVersion($extended = false)
|
|
|
|
| 100 |
$dump = array(
|
| 101 |
"module" => $this->getVersions(),
|
| 102 |
"notice" => "Checksum validation passed!"
|
|
@@ -115,13 +118,15 @@ class Icepay_IceCore_Model_Icepay_Postback {
|
|
| 115 |
exit();
|
| 116 |
}
|
| 117 |
|
| 118 |
-
protected function validateVersion()
|
|
|
|
| 119 |
if ($this->generateChecksumForVersion() != $this->_post["Checksum"])
|
| 120 |
return false;
|
| 121 |
return true;
|
| 122 |
}
|
| 123 |
|
| 124 |
-
protected function getVersions()
|
|
|
|
| 125 |
$_v = "";
|
| 126 |
if (class_exists(Mage::getConfig()->getHelperClassName('icecore')))
|
| 127 |
$_v.= sprintf("%s %s. ", Mage::helper('icecore')->title, Mage::helper('icecore')->version);
|
|
@@ -132,14 +137,16 @@ class Icepay_IceCore_Model_Icepay_Postback {
|
|
| 132 |
return $_v;
|
| 133 |
}
|
| 134 |
|
| 135 |
-
protected function generateChecksumForVersion()
|
|
|
|
| 136 |
return sha1(
|
| 137 |
-
|
| 138 |
-
|
| 139 |
);
|
| 140 |
}
|
| 141 |
|
| 142 |
-
protected function sendMail($currentStatus, $newStatus)
|
|
|
|
| 143 |
switch ($currentStatus) {
|
| 144 |
case Icepay_IceCore_Model_Config::STATUS_NEW:
|
| 145 |
if ($newStatus == Icepay_IceCore_Model_Config::STATUS_ERROR) {
|
|
@@ -153,7 +160,8 @@ class Icepay_IceCore_Model_Icepay_Postback {
|
|
| 153 |
}
|
| 154 |
}
|
| 155 |
|
| 156 |
-
protected function saveTransaction($_vars)
|
|
|
|
| 157 |
$payment = $this->order->getPayment();
|
| 158 |
|
| 159 |
$transaction = $payment->getTransaction($_vars['PaymentID']);
|
|
@@ -187,7 +195,8 @@ class Icepay_IceCore_Model_Icepay_Postback {
|
|
| 187 |
return $id;
|
| 188 |
}
|
| 189 |
|
| 190 |
-
protected function createInvoice($id)
|
|
|
|
| 191 |
$invoice = $this->order->prepareInvoice()
|
| 192 |
->setTransactionId($id)
|
| 193 |
->addComment(Mage::helper('icecore')->__('Auto-generated by ICEPAY'))
|
|
@@ -205,7 +214,8 @@ class Icepay_IceCore_Model_Icepay_Postback {
|
|
| 205 |
return $invoice;
|
| 206 |
}
|
| 207 |
|
| 208 |
-
protected function specialActions($newStatus, $transActionID)
|
|
|
|
| 209 |
$msg = "";
|
| 210 |
switch ($newStatus) {
|
| 211 |
case Icepay_IceCore_Model_Config::STATUS_SUCCESS:
|
|
@@ -218,7 +228,8 @@ class Icepay_IceCore_Model_Icepay_Postback {
|
|
| 218 |
return $msg;
|
| 219 |
}
|
| 220 |
|
| 221 |
-
protected function canUpdate($currentStatus, $newStatus)
|
|
|
|
| 222 |
switch ($newStatus) {
|
| 223 |
case Icepay_IceCore_Model_Config::STATUS_SUCCESS: return ($currentStatus == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT || $currentStatus == Mage_Sales_Model_Order::STATE_NEW);
|
| 224 |
case Icepay_IceCore_Model_Config::STATUS_OPEN: return ($currentStatus == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT || $currentStatus == Mage_Sales_Model_Order::STATE_NEW);
|
|
@@ -231,7 +242,8 @@ class Icepay_IceCore_Model_Icepay_Postback {
|
|
| 231 |
};
|
| 232 |
}
|
| 233 |
|
| 234 |
-
protected function canUpdateBasedOnIcepayTable($currentStatus, $newStatus)
|
|
|
|
| 235 |
switch ($currentStatus) {
|
| 236 |
case Icepay_IceCore_Model_Config::STATUS_NEW:
|
| 237 |
case Icepay_IceCore_Model_Config::STATUS_OPEN:
|
|
@@ -265,7 +277,8 @@ class Icepay_IceCore_Model_Icepay_Postback {
|
|
| 265 |
}
|
| 266 |
}
|
| 267 |
|
| 268 |
-
protected function getMagentoStatus($icepayStatus)
|
|
|
|
| 269 |
switch ($icepayStatus) {
|
| 270 |
case Icepay_IceCore_Model_Config::STATUS_SUCCESS: return Icepay_IceCore_Model_Config::STATUS_MAGENTO_SUCCESS;
|
| 271 |
case Icepay_IceCore_Model_Config::STATUS_OPEN: return Icepay_IceCore_Model_Config::STATUS_MAGENTO_OPEN;
|
|
@@ -278,7 +291,8 @@ class Icepay_IceCore_Model_Icepay_Postback {
|
|
| 278 |
};
|
| 279 |
}
|
| 280 |
|
| 281 |
-
protected function getMagentoState($icepayStatus)
|
|
|
|
| 282 |
switch ($icepayStatus) {
|
| 283 |
case Icepay_IceCore_Model_Config::STATUS_SUCCESS:
|
| 284 |
return Mage_Sales_Model_Order::STATE_PROCESSING;
|
|
@@ -292,14 +306,16 @@ class Icepay_IceCore_Model_Icepay_Postback {
|
|
| 292 |
break;
|
| 293 |
case Icepay_IceCore_Model_Config::STATUS_CHARGEBACK:
|
| 294 |
case Icepay_IceCore_Model_Config::STATUS_REFUND:
|
| 295 |
-
return Mage_Sales_Model_Order::
|
|
|
|
| 296 |
break;
|
| 297 |
default:
|
| 298 |
return false;
|
| 299 |
};
|
| 300 |
}
|
| 301 |
|
| 302 |
-
protected function getTransactionStatus($icepayStatus)
|
|
|
|
| 303 |
switch ($icepayStatus) {
|
| 304 |
case Icepay_IceCore_Model_Config::STATUS_SUCCESS: return Mage_Sales_Model_Order_Payment_Transaction::TYPE_PAYMENT;
|
| 305 |
case Icepay_IceCore_Model_Config::STATUS_OPEN: return Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID;
|
|
@@ -311,7 +327,8 @@ class Icepay_IceCore_Model_Icepay_Postback {
|
|
| 311 |
};
|
| 312 |
}
|
| 313 |
|
| 314 |
-
protected function isClosedStatus($icepayStatus)
|
|
|
|
| 315 |
switch ($icepayStatus) {
|
| 316 |
case Icepay_IceCore_Model_Config::STATUS_SUCCESS: return true;
|
| 317 |
case Icepay_IceCore_Model_Config::STATUS_OPEN: return false;
|
|
@@ -323,7 +340,8 @@ class Icepay_IceCore_Model_Icepay_Postback {
|
|
| 323 |
};
|
| 324 |
}
|
| 325 |
|
| 326 |
-
protected function isRefund($icepayStatus)
|
|
|
|
| 327 |
switch ($icepayStatus) {
|
| 328 |
case Icepay_IceCore_Model_Config::STATUS_CHARGEBACK: return true;
|
| 329 |
case Icepay_IceCore_Model_Config::STATUS_REFUND: return true;
|
|
@@ -332,12 +350,14 @@ class Icepay_IceCore_Model_Icepay_Postback {
|
|
| 332 |
};
|
| 333 |
}
|
| 334 |
|
| 335 |
-
protected function getParentPaymentID($statusString)
|
|
|
|
| 336 |
$arr = explode("PaymentID:", $statusString);
|
| 337 |
return intval($arr[1]);
|
| 338 |
}
|
| 339 |
|
| 340 |
-
protected function getTransactionString($_vars)
|
|
|
|
| 341 |
$str = "";
|
| 342 |
foreach ($_vars as $key => $value) {
|
| 343 |
$str .= "{$key}: {$value}<BR>";
|
|
@@ -345,7 +365,8 @@ class Icepay_IceCore_Model_Icepay_Postback {
|
|
| 345 |
return $str;
|
| 346 |
}
|
| 347 |
|
| 348 |
-
protected function checkIP($remote_ip)
|
|
|
|
| 349 |
return true;
|
| 350 |
$whiteList = array('194.30.175.0-194.30.175.255', '194.126.241.128-194.126.241.191');
|
| 351 |
|
|
@@ -366,11 +387,13 @@ class Icepay_IceCore_Model_Icepay_Postback {
|
|
| 366 |
return false;
|
| 367 |
}
|
| 368 |
|
| 369 |
-
protected function decbin32($dec)
|
|
|
|
| 370 |
return str_pad(decbin($dec), 32, '0', STR_PAD_LEFT);
|
| 371 |
}
|
| 372 |
|
| 373 |
-
protected function ip_in_range($ip, $range)
|
|
|
|
| 374 |
if (strpos($range, '/') !== false) {
|
| 375 |
// $range is in IP/NETMASK format
|
| 376 |
list($range, $netmask) = explode('/', $range, 2);
|
| 21 |
protected $storeID;
|
| 22 |
private $_post;
|
| 23 |
|
| 24 |
+
public function __construct()
|
| 25 |
+
{
|
| 26 |
$this->sqlModel = Mage::getModel('icecore/mysql4_iceCore');
|
| 27 |
$this->orderModel = Mage::getModel('sales/order');
|
| 28 |
}
|
| 29 |
|
| 30 |
+
public function handle($_vars)
|
| 31 |
+
{
|
| 32 |
if (!$_vars) {
|
| 33 |
Mage::helper("icecore")->log("No Postback vars");
|
| 34 |
die("ICEPAY postback page installed correctly.");
|
| 98 |
}
|
| 99 |
}
|
| 100 |
|
| 101 |
+
protected function outputVersion($extended = false)
|
| 102 |
+
{
|
| 103 |
$dump = array(
|
| 104 |
"module" => $this->getVersions(),
|
| 105 |
"notice" => "Checksum validation passed!"
|
| 118 |
exit();
|
| 119 |
}
|
| 120 |
|
| 121 |
+
protected function validateVersion()
|
| 122 |
+
{
|
| 123 |
if ($this->generateChecksumForVersion() != $this->_post["Checksum"])
|
| 124 |
return false;
|
| 125 |
return true;
|
| 126 |
}
|
| 127 |
|
| 128 |
+
protected function getVersions()
|
| 129 |
+
{
|
| 130 |
$_v = "";
|
| 131 |
if (class_exists(Mage::getConfig()->getHelperClassName('icecore')))
|
| 132 |
$_v.= sprintf("%s %s. ", Mage::helper('icecore')->title, Mage::helper('icecore')->version);
|
| 137 |
return $_v;
|
| 138 |
}
|
| 139 |
|
| 140 |
+
protected function generateChecksumForVersion()
|
| 141 |
+
{
|
| 142 |
return sha1(
|
| 143 |
+
sprintf("%s|%s|%s|%s", Mage::helper('icecore')->getConfig(Icepay_IceCore_Model_Config::SECRETCODE), Mage::helper('icecore')->getConfig(Icepay_IceCore_Model_Config::MERCHANTID), $this->_post["Status"], substr(strval(time()), 0, 8)
|
| 144 |
+
)
|
| 145 |
);
|
| 146 |
}
|
| 147 |
|
| 148 |
+
protected function sendMail($currentStatus, $newStatus)
|
| 149 |
+
{
|
| 150 |
switch ($currentStatus) {
|
| 151 |
case Icepay_IceCore_Model_Config::STATUS_NEW:
|
| 152 |
if ($newStatus == Icepay_IceCore_Model_Config::STATUS_ERROR) {
|
| 160 |
}
|
| 161 |
}
|
| 162 |
|
| 163 |
+
protected function saveTransaction($_vars)
|
| 164 |
+
{
|
| 165 |
$payment = $this->order->getPayment();
|
| 166 |
|
| 167 |
$transaction = $payment->getTransaction($_vars['PaymentID']);
|
| 195 |
return $id;
|
| 196 |
}
|
| 197 |
|
| 198 |
+
protected function createInvoice($id)
|
| 199 |
+
{
|
| 200 |
$invoice = $this->order->prepareInvoice()
|
| 201 |
->setTransactionId($id)
|
| 202 |
->addComment(Mage::helper('icecore')->__('Auto-generated by ICEPAY'))
|
| 214 |
return $invoice;
|
| 215 |
}
|
| 216 |
|
| 217 |
+
protected function specialActions($newStatus, $transActionID)
|
| 218 |
+
{
|
| 219 |
$msg = "";
|
| 220 |
switch ($newStatus) {
|
| 221 |
case Icepay_IceCore_Model_Config::STATUS_SUCCESS:
|
| 228 |
return $msg;
|
| 229 |
}
|
| 230 |
|
| 231 |
+
protected function canUpdate($currentStatus, $newStatus)
|
| 232 |
+
{
|
| 233 |
switch ($newStatus) {
|
| 234 |
case Icepay_IceCore_Model_Config::STATUS_SUCCESS: return ($currentStatus == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT || $currentStatus == Mage_Sales_Model_Order::STATE_NEW);
|
| 235 |
case Icepay_IceCore_Model_Config::STATUS_OPEN: return ($currentStatus == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT || $currentStatus == Mage_Sales_Model_Order::STATE_NEW);
|
| 242 |
};
|
| 243 |
}
|
| 244 |
|
| 245 |
+
protected function canUpdateBasedOnIcepayTable($currentStatus, $newStatus)
|
| 246 |
+
{
|
| 247 |
switch ($currentStatus) {
|
| 248 |
case Icepay_IceCore_Model_Config::STATUS_NEW:
|
| 249 |
case Icepay_IceCore_Model_Config::STATUS_OPEN:
|
| 277 |
}
|
| 278 |
}
|
| 279 |
|
| 280 |
+
protected function getMagentoStatus($icepayStatus)
|
| 281 |
+
{
|
| 282 |
switch ($icepayStatus) {
|
| 283 |
case Icepay_IceCore_Model_Config::STATUS_SUCCESS: return Icepay_IceCore_Model_Config::STATUS_MAGENTO_SUCCESS;
|
| 284 |
case Icepay_IceCore_Model_Config::STATUS_OPEN: return Icepay_IceCore_Model_Config::STATUS_MAGENTO_OPEN;
|
| 291 |
};
|
| 292 |
}
|
| 293 |
|
| 294 |
+
protected function getMagentoState($icepayStatus)
|
| 295 |
+
{
|
| 296 |
switch ($icepayStatus) {
|
| 297 |
case Icepay_IceCore_Model_Config::STATUS_SUCCESS:
|
| 298 |
return Mage_Sales_Model_Order::STATE_PROCESSING;
|
| 306 |
break;
|
| 307 |
case Icepay_IceCore_Model_Config::STATUS_CHARGEBACK:
|
| 308 |
case Icepay_IceCore_Model_Config::STATUS_REFUND:
|
| 309 |
+
return Mage_Sales_Model_Order::STATE_HOLDED;
|
| 310 |
+
//return Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
|
| 311 |
break;
|
| 312 |
default:
|
| 313 |
return false;
|
| 314 |
};
|
| 315 |
}
|
| 316 |
|
| 317 |
+
protected function getTransactionStatus($icepayStatus)
|
| 318 |
+
{
|
| 319 |
switch ($icepayStatus) {
|
| 320 |
case Icepay_IceCore_Model_Config::STATUS_SUCCESS: return Mage_Sales_Model_Order_Payment_Transaction::TYPE_PAYMENT;
|
| 321 |
case Icepay_IceCore_Model_Config::STATUS_OPEN: return Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID;
|
| 327 |
};
|
| 328 |
}
|
| 329 |
|
| 330 |
+
protected function isClosedStatus($icepayStatus)
|
| 331 |
+
{
|
| 332 |
switch ($icepayStatus) {
|
| 333 |
case Icepay_IceCore_Model_Config::STATUS_SUCCESS: return true;
|
| 334 |
case Icepay_IceCore_Model_Config::STATUS_OPEN: return false;
|
| 340 |
};
|
| 341 |
}
|
| 342 |
|
| 343 |
+
protected function isRefund($icepayStatus)
|
| 344 |
+
{
|
| 345 |
switch ($icepayStatus) {
|
| 346 |
case Icepay_IceCore_Model_Config::STATUS_CHARGEBACK: return true;
|
| 347 |
case Icepay_IceCore_Model_Config::STATUS_REFUND: return true;
|
| 350 |
};
|
| 351 |
}
|
| 352 |
|
| 353 |
+
protected function getParentPaymentID($statusString)
|
| 354 |
+
{
|
| 355 |
$arr = explode("PaymentID:", $statusString);
|
| 356 |
return intval($arr[1]);
|
| 357 |
}
|
| 358 |
|
| 359 |
+
protected function getTransactionString($_vars)
|
| 360 |
+
{
|
| 361 |
$str = "";
|
| 362 |
foreach ($_vars as $key => $value) {
|
| 363 |
$str .= "{$key}: {$value}<BR>";
|
| 365 |
return $str;
|
| 366 |
}
|
| 367 |
|
| 368 |
+
protected function checkIP($remote_ip)
|
| 369 |
+
{
|
| 370 |
return true;
|
| 371 |
$whiteList = array('194.30.175.0-194.30.175.255', '194.126.241.128-194.126.241.191');
|
| 372 |
|
| 387 |
return false;
|
| 388 |
}
|
| 389 |
|
| 390 |
+
protected function decbin32($dec)
|
| 391 |
+
{
|
| 392 |
return str_pad(decbin($dec), 32, '0', STR_PAD_LEFT);
|
| 393 |
}
|
| 394 |
|
| 395 |
+
protected function ip_in_range($ip, $range)
|
| 396 |
+
{
|
| 397 |
if (strpos($range, '/') !== false) {
|
| 398 |
// $range is in IP/NETMASK format
|
| 399 |
list($range, $netmask) = explode('/', $range, 2);
|
app/code/community/Icepay/IceCore/Model/Icepay/Result.php
CHANGED
|
@@ -13,31 +13,37 @@
|
|
| 13 |
* charged in accordance with the standard ICEPAY tariffs.
|
| 14 |
*
|
| 15 |
*/
|
| 16 |
-
|
| 17 |
class Icepay_IceCore_Model_Icepay_Result {
|
| 18 |
|
| 19 |
protected $sqlModel;
|
| 20 |
|
| 21 |
-
public function
|
|
|
|
| 22 |
$this->sqlModel = Mage::getModel('icecore/mysql4_iceCore');
|
| 23 |
}
|
| 24 |
|
| 25 |
-
public function handle(array $_vars)
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
$order->loadByIncrementId(($_vars['OrderID'] == "DUMMY")
|
| 31 |
-
->addStatusHistoryComment(sprintf(Mage::helper("icecore")->__("Customer returned with status: %s")
|
| 32 |
->save();
|
| 33 |
|
| 34 |
-
switch(strtoupper($_vars['Status'])){
|
| 35 |
-
case "ERR":
|
| 36 |
-
$
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
$
|
|
|
|
|
|
|
| 41 |
break;
|
| 42 |
case "OK":
|
| 43 |
case "OPEN":
|
|
@@ -47,11 +53,9 @@ class Icepay_IceCore_Model_Icepay_Result {
|
|
| 47 |
};
|
| 48 |
|
| 49 |
/* Redirect based on store */
|
| 50 |
-
|
| 51 |
-
$url = Mage::app()->getStore($order->getStoreId())->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK,true) . $url;
|
| 52 |
Mage::app()->getFrontController()->getResponse()->setRedirect($url);
|
| 53 |
-
|
| 54 |
}
|
| 55 |
|
| 56 |
-
|
| 57 |
}
|
| 13 |
* charged in accordance with the standard ICEPAY tariffs.
|
| 14 |
*
|
| 15 |
*/
|
|
|
|
| 16 |
class Icepay_IceCore_Model_Icepay_Result {
|
| 17 |
|
| 18 |
protected $sqlModel;
|
| 19 |
|
| 20 |
+
public function __construct()
|
| 21 |
+
{
|
| 22 |
$this->sqlModel = Mage::getModel('icecore/mysql4_iceCore');
|
| 23 |
}
|
| 24 |
|
| 25 |
+
public function handle(array $_vars)
|
| 26 |
+
{
|
| 27 |
+
|
| 28 |
+
if (count($_vars) == 0)
|
| 29 |
+
die("ICEPAY result page installed correctly.");
|
| 30 |
+
if (!$_vars['OrderID'])
|
| 31 |
+
die("No orderID found");
|
| 32 |
|
| 33 |
+
$order = Mage::getModel('sales/order');
|
| 34 |
+
$order->loadByIncrementId(($_vars['OrderID'] == "DUMMY") ? $_vars['Reference'] : $_vars['OrderID'])
|
| 35 |
+
->addStatusHistoryComment(sprintf(Mage::helper("icecore")->__("Customer returned with status: %s"), $_vars['StatusCode']))
|
| 36 |
->save();
|
| 37 |
|
| 38 |
+
switch (strtoupper($_vars['Status'])) {
|
| 39 |
+
case "ERR":
|
| 40 |
+
$quoteID = Mage::getSingleton('checkout/session')->getQuoteId();
|
| 41 |
+
Mage::getSingleton('core/session')->setData('ic_quoteid', $quoteID);
|
| 42 |
+
Mage::getSingleton('core/session')->setData('ic_quotedate', date("Y-m-d H:i:s"));
|
| 43 |
+
|
| 44 |
+
$msg = sprintf(Mage::helper("icecore")->__("The payment provider has returned the following error message: %s"), Mage::helper("icecore")->__($_vars['Status'] . ": " . $_vars['StatusCode']));
|
| 45 |
+
$url = 'checkout/cart';
|
| 46 |
+
Mage::getSingleton('checkout/session')->addError($msg);
|
| 47 |
break;
|
| 48 |
case "OK":
|
| 49 |
case "OPEN":
|
| 53 |
};
|
| 54 |
|
| 55 |
/* Redirect based on store */
|
| 56 |
+
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl($url));
|
| 57 |
+
$url = Mage::app()->getStore($order->getStoreId())->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, true) . $url;
|
| 58 |
Mage::app()->getFrontController()->getResponse()->setRedirect($url);
|
|
|
|
| 59 |
}
|
| 60 |
|
|
|
|
| 61 |
}
|
app/code/community/Icepay/IceCore/Model/Mysql4/IceCore.php
CHANGED
|
@@ -78,7 +78,7 @@ class Icepay_IceCore_Model_Mysql4_IceCore extends Mage_Core_Model_Mysql4_Abstrac
|
|
| 78 |
$select = $conn
|
| 79 |
->select()
|
| 80 |
->from($this->getTable('core/config_data'), array('scope', 'scope_id', 'path', 'value'))
|
| 81 |
-
->where(new Zend_Db_Expr("path LIKE '
|
| 82 |
->order('path');
|
| 83 |
$data = $conn->fetchAll($select);
|
| 84 |
|
| 78 |
$select = $conn
|
| 79 |
->select()
|
| 80 |
->from($this->getTable('core/config_data'), array('scope', 'scope_id', 'path', 'value'))
|
| 81 |
+
->where(new Zend_Db_Expr("path LIKE 'iceadvanced/module/" . $unique . "'"))
|
| 82 |
->order('path');
|
| 83 |
$data = $conn->fetchAll($select);
|
| 84 |
|
app/design/adminhtml/default/default/template/icepaycore/grid_modules.phtml
CHANGED
|
@@ -20,7 +20,7 @@
|
|
| 20 |
</thead>
|
| 21 |
<tbody id="<?php echo $_htmlId ?>_container"></tbody>
|
| 22 |
</table>
|
| 23 |
-
|
| 24 |
<script type="text/javascript">
|
| 25 |
//<