Version Notes
Supported Magento 1.5.0.0 - 1.7.x, Magento Enterprise 1.8-1.12.x
Download this release
Release Info
| Developer | Exactor, Inc. |
| Extension | Mage_Exactor_Tax |
| Version | 2012.10.19 |
| Comparing to | |
| See all releases | |
Code changes from version 2012.09.20 to 2012.10.19
- app/code/local/Exactor/Core/Model/MerchantSettings.php +15 -0
- app/code/local/Exactor/ExactorSettings/Block/Form.php +11 -1
- app/code/local/Exactor/ExactorSettings/controllers/Adminhtml/FormController.php +15 -2
- app/code/local/Exactor/ExactorSettings/etc/config.xml +3 -3
- app/code/local/Exactor/ExactorSettings/sql/ExactorSettings_setup/mysql4-install-14.04.2012.php +1 -0
- app/code/local/Exactor/ExactorSettings/sql/ExactorSettings_setup/upgrade-2012.06.14-2012.09.25.php +37 -0
- app/code/local/Exactor/Sales/Model/Observer.php +168 -25
- app/code/local/Exactor/Sales/etc/config.xml +12 -3
- app/code/local/Exactor/Tax/Helper/Mapping.php +163 -17
- app/code/local/Exactor/Tax/etc/config.xml +1 -1
- app/design/adminhtml/default/default/template/ExactorSettings/settingsform.phtml +24 -0
- lib/ExactorCommons/ExactorCommons.php +34 -8
- lib/ExactorCommons/ExactorDomainObjects.php +10 -1
- lib/ExactorCommons/config.php +2 -2
- lib/ExactorCommons/config.php~ +0 -11
- package.xml +4 -4
app/code/local/Exactor/Core/Model/MerchantSettings.php
CHANGED
|
@@ -216,6 +216,14 @@ class Exactor_Core_Model_MerchantSettings extends Mage_Core_Model_Abstract
|
|
| 216 |
return $this->getData("CommitOption");
|
| 217 |
}
|
| 218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
|
| 220 |
function setCommitOption($CommitOption)
|
| 221 |
{
|
|
@@ -260,6 +268,12 @@ class Exactor_Core_Model_MerchantSettings extends Mage_Core_Model_Abstract
|
|
| 260 |
return $default;
|
| 261 |
}
|
| 262 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
public function populateFromArray($array){
|
| 264 |
$this->setCity($this->valueOrDefaultFromArray($array, 'City'));
|
| 265 |
$this->setCommitOption($this->valueOrDefaultFromArray($array, 'CommitOption'));
|
|
@@ -275,5 +289,6 @@ class Exactor_Core_Model_MerchantSettings extends Mage_Core_Model_Abstract
|
|
| 275 |
$this->setStoreViewID($this->valueOrDefaultFromArray($array, 'StoreViewID'));
|
| 276 |
$this->setStreet1($this->valueOrDefaultFromArray($array, 'Street1'));
|
| 277 |
$this->setStreet2($this->valueOrDefaultFromArray($array, 'Street2'));
|
|
|
|
| 278 |
}
|
| 279 |
}
|
| 216 |
return $this->getData("CommitOption");
|
| 217 |
}
|
| 218 |
|
| 219 |
+
function getEffectiveDate() {
|
| 220 |
+
return $this->getData("EffectiveDate");
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
function setEffectiveDate($EffectiveDate){
|
| 224 |
+
$this->setData("EffectiveDate", $EffectiveDate);
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
|
| 228 |
function setCommitOption($CommitOption)
|
| 229 |
{
|
| 268 |
return $default;
|
| 269 |
}
|
| 270 |
|
| 271 |
+
public function getDefaultEffectiveDate() {
|
| 272 |
+
$date_array = getdate();
|
| 273 |
+
$timestamp = mktime(0,0,0,$date_array['mon'],1,$date_array['year']);
|
| 274 |
+
return date("Y-m-d", $timestamp);
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
public function populateFromArray($array){
|
| 278 |
$this->setCity($this->valueOrDefaultFromArray($array, 'City'));
|
| 279 |
$this->setCommitOption($this->valueOrDefaultFromArray($array, 'CommitOption'));
|
| 289 |
$this->setStoreViewID($this->valueOrDefaultFromArray($array, 'StoreViewID'));
|
| 290 |
$this->setStreet1($this->valueOrDefaultFromArray($array, 'Street1'));
|
| 291 |
$this->setStreet2($this->valueOrDefaultFromArray($array, 'Street2'));
|
| 292 |
+
$this->setEffectiveDate($this->valueOrDefaultFromArray($array, 'EffectiveDate'));
|
| 293 |
}
|
| 294 |
}
|
app/code/local/Exactor/ExactorSettings/Block/Form.php
CHANGED
|
@@ -54,13 +54,23 @@ class Exactor_ExactorSettings_Block_Form extends Mage_Core_Block_Template {
|
|
| 54 |
));
|
| 55 |
}
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
/**
|
| 58 |
* Load settings object for template
|
| 59 |
* This method always will return MerchantSettings object even if there are no any settings in DB
|
| 60 |
* @return void
|
| 61 |
*/
|
| 62 |
protected function loadMerchantSettings(){
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
}
|
| 65 |
|
| 66 |
public function setStoreViewId($storeViewId)
|
| 54 |
));
|
| 55 |
}
|
| 56 |
|
| 57 |
+
private function dateForView($dateStr){
|
| 58 |
+
$timestamp = strtotime($dateStr);
|
| 59 |
+
return date("m/d/Y", $timestamp);
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
/**
|
| 63 |
* Load settings object for template
|
| 64 |
* This method always will return MerchantSettings object even if there are no any settings in DB
|
| 65 |
* @return void
|
| 66 |
*/
|
| 67 |
protected function loadMerchantSettings(){
|
| 68 |
+
$settings = $this->exactorSettingsHelper->loadMerchantSettingsOrEmptyObject($this->getStoreViewId());
|
| 69 |
+
if (trim($settings->getEffectiveDate())==""){
|
| 70 |
+
$settings->setEffectiveDate($settings->getDefaultEffectiveDate());
|
| 71 |
+
}
|
| 72 |
+
$settings->setEffectiveDate($this->dateForView($settings->getEffectiveDate()));
|
| 73 |
+
return $settings;
|
| 74 |
}
|
| 75 |
|
| 76 |
public function setStoreViewId($storeViewId)
|
app/code/local/Exactor/ExactorSettings/controllers/Adminhtml/FormController.php
CHANGED
|
@@ -81,10 +81,23 @@ class Exactor_ExactorSettings_Adminhtml_FormController extends Mage_Adminhtml_Co
|
|
| 81 |
protected function preprocessInput(&$merchantSettings){
|
| 82 |
foreach($merchantSettings->getData() as $key => $value){
|
| 83 |
if (is_string($value))
|
| 84 |
-
|
| 85 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
}
|
| 87 |
|
|
|
|
|
|
|
| 88 |
private function sendRequestBack(){
|
| 89 |
$storeviewId = $this->getRequest()->getParam('storeview',null);
|
| 90 |
$postData = $this->getRequest()->getPost(self::FORM_PARAM_CONTAINER);
|
|
@@ -140,7 +153,7 @@ class Exactor_ExactorSettings_Adminhtml_FormController extends Mage_Adminhtml_Co
|
|
| 140 |
// Do validation
|
| 141 |
$isInputValid = $this->validate($merchantSettings);
|
| 142 |
// if valid - Save to DB
|
| 143 |
-
if ($isInputValid){
|
| 144 |
$merchantSettings->save();
|
| 145 |
return $this->sendSuccess(self::MSG_SETTINGS_SAVED);
|
| 146 |
}else{ // else - notify error
|
| 81 |
protected function preprocessInput(&$merchantSettings){
|
| 82 |
foreach($merchantSettings->getData() as $key => $value){
|
| 83 |
if (is_string($value))
|
| 84 |
+
$merchantSettings->setData($key, trim($value));
|
| 85 |
}
|
| 86 |
+
// Convert effective date from string or set default value
|
| 87 |
+
if ($merchantSettings->getEffectiveDate()==""){
|
| 88 |
+
$merchantSettings->setEffectiveDate($merchantSettings->getDefaultEffectiveDate());
|
| 89 |
+
} else {
|
| 90 |
+
$merchantSettings->setEffectiveDate($this->dateForDb($merchantSettings->getEffectiveDate()));
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
private function dateForDb($dateStr){
|
| 95 |
+
$timestamp = strtotime($dateStr);
|
| 96 |
+
return date("Y-m-d", $timestamp);
|
| 97 |
}
|
| 98 |
|
| 99 |
+
|
| 100 |
+
|
| 101 |
private function sendRequestBack(){
|
| 102 |
$storeviewId = $this->getRequest()->getParam('storeview',null);
|
| 103 |
$postData = $this->getRequest()->getPost(self::FORM_PARAM_CONTAINER);
|
| 153 |
// Do validation
|
| 154 |
$isInputValid = $this->validate($merchantSettings);
|
| 155 |
// if valid - Save to DB
|
| 156 |
+
if ($isInputValid) {
|
| 157 |
$merchantSettings->save();
|
| 158 |
return $this->sendSuccess(self::MSG_SETTINGS_SAVED);
|
| 159 |
}else{ // else - notify error
|
app/code/local/Exactor/ExactorSettings/etc/config.xml
CHANGED
|
@@ -28,7 +28,7 @@
|
|
| 28 |
<config>
|
| 29 |
<modules>
|
| 30 |
<Exactor_ExactorSettings>
|
| 31 |
-
<version>2012.
|
| 32 |
</Exactor_ExactorSettings>
|
| 33 |
</modules>
|
| 34 |
|
|
@@ -77,7 +77,7 @@
|
|
| 77 |
</admin>
|
| 78 |
|
| 79 |
<adminhtml>
|
| 80 |
-
|
| 81 |
<modules>
|
| 82 |
<Exactor_adminhtml>
|
| 83 |
<files>
|
|
@@ -85,7 +85,7 @@
|
|
| 85 |
</files>
|
| 86 |
</Exactor_adminhtml>
|
| 87 |
</modules>
|
| 88 |
-
</translate
|
| 89 |
|
| 90 |
<menu>
|
| 91 |
<system>
|
| 28 |
<config>
|
| 29 |
<modules>
|
| 30 |
<Exactor_ExactorSettings>
|
| 31 |
+
<version>2012.09.25</version>
|
| 32 |
</Exactor_ExactorSettings>
|
| 33 |
</modules>
|
| 34 |
|
| 77 |
</admin>
|
| 78 |
|
| 79 |
<adminhtml>
|
| 80 |
+
<!--<translate>
|
| 81 |
<modules>
|
| 82 |
<Exactor_adminhtml>
|
| 83 |
<files>
|
| 85 |
</files>
|
| 86 |
</Exactor_adminhtml>
|
| 87 |
</modules>
|
| 88 |
+
</translate>-->
|
| 89 |
|
| 90 |
<menu>
|
| 91 |
<system>
|
app/code/local/Exactor/ExactorSettings/sql/ExactorSettings_setup/mysql4-install-14.04.2012.php
CHANGED
|
@@ -48,6 +48,7 @@
|
|
| 48 |
`AttributeName` varchar(50) DEFAULT NULL,
|
| 49 |
`CommitOption` varchar(2) DEFAULT NULL,
|
| 50 |
`EntityExemptions` varchar(2) DEFAULT NULL,
|
|
|
|
| 51 |
PRIMARY KEY (`ID`)
|
| 52 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 53 |
|
| 48 |
`AttributeName` varchar(50) DEFAULT NULL,
|
| 49 |
`CommitOption` varchar(2) DEFAULT NULL,
|
| 50 |
`EntityExemptions` varchar(2) DEFAULT NULL,
|
| 51 |
+
`EffectiveDate` date DEFAULT NULL,
|
| 52 |
PRIMARY KEY (`ID`)
|
| 53 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 54 |
|
app/code/local/Exactor/ExactorSettings/sql/ExactorSettings_setup/upgrade-2012.06.14-2012.09.25.php
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Exactor
|
| 22 |
+
* @package Exactor_Exactordetails
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 28 |
+
$installer = $this;
|
| 29 |
+
|
| 30 |
+
$installer->startSetup();
|
| 31 |
+
|
| 32 |
+
$installer->run("
|
| 33 |
+
ALTER TABLE `exactor_account`
|
| 34 |
+
ADD COLUMN `EffectiveDate` date NULL;
|
| 35 |
+
");
|
| 36 |
+
|
| 37 |
+
$installer->endSetup();
|
app/code/local/Exactor/Sales/Model/Observer.php
CHANGED
|
@@ -62,19 +62,70 @@ class Exactor_Sales_Model_Observer {
|
|
| 62 |
return $merchantSettings;
|
| 63 |
}
|
| 64 |
|
| 65 |
-
private function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
try{
|
| 67 |
-
$
|
| 68 |
-
|
| 69 |
-
|
|
|
|
|
|
|
| 70 |
}
|
| 71 |
}
|
| 72 |
|
| 73 |
-
private function refundTransactionForOrder($
|
| 74 |
try{
|
| 75 |
-
$
|
|
|
|
|
|
|
| 76 |
}catch (Exception $e){
|
| 77 |
-
$this->logger->error("Can't commit transaction. See details above.", '
|
| 78 |
}
|
| 79 |
}
|
| 80 |
|
|
@@ -88,9 +139,11 @@ class Exactor_Sales_Model_Observer {
|
|
| 88 |
private function processFinishedOrder($order){
|
| 89 |
$merchantSettings = $this->loadMerchantSettings($order);
|
| 90 |
if ($merchantSettings==null) false;
|
| 91 |
-
$
|
|
|
|
|
|
|
| 92 |
if ($transactionInfo == null){
|
| 93 |
-
$this->logger->error('Nothing to process. There is no transaction in the session cache', '
|
| 94 |
return false;
|
| 95 |
}
|
| 96 |
// Update transaction info with order information
|
|
@@ -101,12 +154,55 @@ class Exactor_Sales_Model_Observer {
|
|
| 101 |
// if CommitOption is set up to commit on sales order - do commit the
|
| 102 |
// latest transaction from the session storage
|
| 103 |
if ($merchantSettings->getCommitOption() == Exactor_Core_Model_MerchantSettings::COMMIT_ON_SALES_ORDER){
|
| 104 |
-
$this->logger->info("Commiting transaction for order $orderId - " . $transactionInfo->getExactorTrnId(), '
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
}
|
| 107 |
return true;
|
| 108 |
}
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
public function handleAllOrdersCompleted(Varien_Event_Observer $observer){
|
| 111 |
$this->logger->trace('called', 'handleAllOrdersCompleted');
|
| 112 |
if (is_array($observer->getOrders()))
|
|
@@ -121,22 +217,24 @@ class Exactor_Sales_Model_Observer {
|
|
| 121 |
}
|
| 122 |
|
| 123 |
private function partialRefund(Mage_Sales_Model_Order_Creditmemo $creditMemo){
|
| 124 |
-
$transactionInfo = $this->exactorProcessingService->loadTransactionInfoByOrderId($creditMemo->getOrder()->getIncrementId());
|
| 125 |
-
if ($transactionInfo==null || !$transactionInfo->getIsCommited()){
|
| 126 |
-
$this->logger->info("Exactor transaction for order " .
|
| 127 |
-
$creditMemo->getOrder()->getIncrementId() . "doesn't exists or wasn't commited", 'partialRefund' );
|
| 128 |
-
return;
|
| 129 |
-
}
|
| 130 |
$merchantSettings = $this->loadMerchantSettings($creditMemo->getOrder());
|
| 131 |
if ($merchantSettings==null) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
$invoiceRequests = $this->exactorMappingHelper->buildInvoiceRequestsForCreditMemo($creditMemo, $merchantSettings);
|
| 133 |
$exactorProcessingService = ExactorProcessingServiceFactory::getInstance()->buildExactorProcessingService($merchantSettings->getMerchantID(),
|
| 134 |
$merchantSettings->getUserID());
|
| 135 |
foreach ($invoiceRequests as $invoice) {
|
| 136 |
-
$exactorProcessingService->partialRefund($invoice, new DateTime(),
|
| 137 |
}
|
| 138 |
}
|
| 139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
/**
|
| 141 |
* Event will be fired once new order has been created
|
| 142 |
* @param Varien_Event_Observer $observer
|
|
@@ -169,15 +267,37 @@ class Exactor_Sales_Model_Observer {
|
|
| 169 |
$this->logger->trace('called', 'handleNewCreditMemo');
|
| 170 |
$merchantSettings = $this->loadMerchantSettings($observer->getCreditmemo()->getOrder());
|
| 171 |
if ($merchantSettings==null) return;
|
| 172 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
}
|
| 174 |
|
| 175 |
public function handleCancelOrder(Varien_Event_Observer $observer){
|
| 176 |
$this->logger->trace('called', 'handleCancelOrder');
|
| 177 |
$merchantSettings = $this->loadMerchantSettings($observer->getPayment()->getOrder());
|
| 178 |
if ($merchantSettings==null) return;
|
| 179 |
-
|
| 180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
}
|
| 182 |
|
| 183 |
public function handleNewShipment(Varien_Event_Observer $observer){
|
|
@@ -185,8 +305,16 @@ class Exactor_Sales_Model_Observer {
|
|
| 185 |
$merchantSettings = $this->loadMerchantSettings($observer->getShipment()->getOrder());
|
| 186 |
if ($merchantSettings==null) return;
|
| 187 |
if ($merchantSettings->getCommitOption() == Exactor_Core_Model_MerchantSettings::COMMIT_ON_SHIPMENT){
|
| 188 |
-
$
|
| 189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
}
|
| 191 |
}
|
| 192 |
|
|
@@ -194,11 +322,26 @@ class Exactor_Sales_Model_Observer {
|
|
| 194 |
$this->logger->trace('called', 'handleNewInvoice');
|
| 195 |
$merchantSettings = $this->loadMerchantSettings($observer->getInvoice()->getOrder());
|
| 196 |
if ($merchantSettings==null) return;
|
|
|
|
| 197 |
if ($merchantSettings->getCommitOption() == Exactor_Core_Model_MerchantSettings::COMMIT_ON_INVOICE){
|
| 198 |
-
$
|
| 199 |
-
$this->commitTransactionForOrder($orderId);
|
| 200 |
}
|
|
|
|
| 201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
}
|
| 203 |
|
| 204 |
/**
|
| 62 |
return $merchantSettings;
|
| 63 |
}
|
| 64 |
|
| 65 |
+
private function getInvoiceIncrementId(Mage_Sales_Model_Order_Invoice &$invoice) {
|
| 66 |
+
if ($invoice->getIncrementId() == null) {
|
| 67 |
+
try{
|
| 68 |
+
$entityType = Mage::getModel('eav/entity_type')->loadByCode("invoice");
|
| 69 |
+
$invoice->setIncrementId($entityType->fetchNewIncrementId($invoice->getStoreId()));
|
| 70 |
+
} catch (Exception $e) {
|
| 71 |
+
$this->logger->error("Failed to get increment id ", 'getInvoiceIncrementId');
|
| 72 |
+
return null;
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
return $invoice->getIncrementId();
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
private function commitTransactionForInvoice(Mage_Sales_Model_Order_Invoice $invoice, Exactor_Core_Model_MerchantSettings $merchantSettings) {
|
| 79 |
+
try {
|
| 80 |
+
if (!$this->underEffectiveDate($merchantSettings->getEffectiveDate(), $invoice->getOrder()->getCreatedAt())){
|
| 81 |
+
$this->logger->info("Order " . $invoice->getOrder()->getIncrementId() ." is not under effective date. Skipping.", "commitTransactionForInvoice");
|
| 82 |
+
return;
|
| 83 |
+
}
|
| 84 |
+
$exactorProcessingService = ExactorProcessingServiceFactory::getInstance()
|
| 85 |
+
->buildExactorProcessingService($merchantSettings->getMerchantID(), $merchantSettings->getUserID());
|
| 86 |
+
$invoiceRequests = $this->exactorMappingHelper->buildInvoiceRequestForMagentoInvoice($invoice, $merchantSettings);
|
| 87 |
+
foreach ($invoiceRequests as $invoiceRequest) {
|
| 88 |
+
$exactorProcessingService->partialPayment($invoiceRequest, new DateTime(), $this->getInvoiceIncrementId($invoice));
|
| 89 |
+
}
|
| 90 |
+
} catch (Exception $e) {
|
| 91 |
+
$this->logger->error("Can't commit transaction. See details above.", 'commitTransactionForInvoice');
|
| 92 |
+
}
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
private function refundTransactionForInvoice(Mage_Sales_Model_Order_Invoice $invoice, Exactor_Core_Model_MerchantSettings $merchantSettings) {
|
| 96 |
+
try {
|
| 97 |
+
$exactorProcessingService = ExactorProcessingServiceFactory::getInstance()
|
| 98 |
+
->buildExactorProcessingService($merchantSettings->getMerchantID(), $merchantSettings->getUserID());
|
| 99 |
+
if (!$this->underEffectiveDate($merchantSettings->getEffectiveDate(), $invoice->getOrder()->getCreatedAt())){
|
| 100 |
+
$this->logger->info("Order " . $invoice->getOrder()->getIncrementId() ." is not under effective date. Skipping.", "refundTransactionForInvoice");
|
| 101 |
+
return;
|
| 102 |
+
}
|
| 103 |
+
$invoiceRequests = $this->exactorMappingHelper->buildInvoiceRequestForMagentoInvoice($invoice, $merchantSettings);
|
| 104 |
+
foreach ($invoiceRequests as $invoiceRequest) {
|
| 105 |
+
$exactorProcessingService->partialRefund($invoiceRequest, new DateTime(), $invoice->getIncrementId());
|
| 106 |
+
}
|
| 107 |
+
} catch (Exception $e) {
|
| 108 |
+
$this->logger->error("Can't commit transaction. See details above.", 'refundTransactionForInvoice');
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
private function refundAllInvoicesForOrder(Mage_Sales_Model_Order $order, Exactor_Core_Model_MerchantSettings $merchantSettings) {
|
| 113 |
try{
|
| 114 |
+
foreach ($order->getInvoiceCollection() as $invoice){
|
| 115 |
+
$this->refundTransactionForInvoice($invoice, $merchantSettings);
|
| 116 |
+
}
|
| 117 |
+
} catch (Exception $e) {
|
| 118 |
+
$this->logger->error("Can't commit transaction. See details above.", 'refundAllInvoicesForOrder');
|
| 119 |
}
|
| 120 |
}
|
| 121 |
|
| 122 |
+
private function refundTransactionForOrder($order, $merchantSettings){
|
| 123 |
try{
|
| 124 |
+
$exactorProcessingService = ExactorProcessingServiceFactory::getInstance()
|
| 125 |
+
->buildExactorProcessingService($merchantSettings->getMerchantID(), $merchantSettings->getUserID());
|
| 126 |
+
$exactorProcessingService->refundTransactionForOrder($order->getIncrementId());
|
| 127 |
}catch (Exception $e){
|
| 128 |
+
$this->logger->error("Can't commit transaction. See details above.", 'refundTransactionForOrder');
|
| 129 |
}
|
| 130 |
}
|
| 131 |
|
| 139 |
private function processFinishedOrder($order){
|
| 140 |
$merchantSettings = $this->loadMerchantSettings($order);
|
| 141 |
if ($merchantSettings==null) false;
|
| 142 |
+
$exactorProcessingService = ExactorProcessingServiceFactory::getInstance()
|
| 143 |
+
->buildExactorProcessingService($merchantSettings->getMerchantID(), $merchantSettings->getUserID());
|
| 144 |
+
$transactionInfo = $this->sessionCache->popTransactionInfo();
|
| 145 |
if ($transactionInfo == null){
|
| 146 |
+
$this->logger->error('Nothing to process. There is no transaction in the session cache', 'processFinishedOrder');
|
| 147 |
return false;
|
| 148 |
}
|
| 149 |
// Update transaction info with order information
|
| 154 |
// if CommitOption is set up to commit on sales order - do commit the
|
| 155 |
// latest transaction from the session storage
|
| 156 |
if ($merchantSettings->getCommitOption() == Exactor_Core_Model_MerchantSettings::COMMIT_ON_SALES_ORDER){
|
| 157 |
+
$this->logger->info("Commiting transaction for order $orderId - " . $transactionInfo->getExactorTrnId(), 'processFinishedOrder');
|
| 158 |
+
try {
|
| 159 |
+
if (!$this->underEffectiveDate($merchantSettings->getEffectiveDate(), $order->getCreatedAt())){
|
| 160 |
+
$this->logger->info("Order " . $order->getIncrementId() ." is not under effective date. Skipping.",
|
| 161 |
+
"commitTransactionForOrder");
|
| 162 |
+
}
|
| 163 |
+
$invoiceRequests = $this->exactorMappingHelper->buildInvoiceRequestForMagentoOrder($order, $merchantSettings);
|
| 164 |
+
$taxResponse = $this->commitTransactionForOrder($order, $merchantSettings);
|
| 165 |
+
}catch (Exception $e){
|
| 166 |
+
$this->logger->error("Can't commit transaction. See details above.", 'processFinishedOrder');
|
| 167 |
+
}
|
| 168 |
+
//$this->exactorProcessingService->commitExistingInvoiceForOrder($orderId);
|
| 169 |
}
|
| 170 |
return true;
|
| 171 |
}
|
| 172 |
|
| 173 |
+
/**
|
| 174 |
+
* Returns TaxResponse on success, and null - otherwise.
|
| 175 |
+
*
|
| 176 |
+
* @param \Mage_Sales_Model_Order $order
|
| 177 |
+
* @param \Exactor_Core_Model_MerchantSettings $merchantSettings
|
| 178 |
+
* @return TaxResponseType
|
| 179 |
+
*/
|
| 180 |
+
public function commitTransactionForOrder(Mage_Sales_Model_Order $order, Exactor_Core_Model_MerchantSettings $merchantSettings) {
|
| 181 |
+
$exactorProcessingService = ExactorProcessingServiceFactory::getInstance()
|
| 182 |
+
->buildExactorProcessingService($merchantSettings->getMerchantID(), $merchantSettings->getUserID());
|
| 183 |
+
try {
|
| 184 |
+
if (!$this->underEffectiveDate($merchantSettings->getEffectiveDate(), $order->getCreatedAt())){
|
| 185 |
+
$this->logger->info("Order " . $order->getIncrementId() ." is not under effective date. Skipping.",
|
| 186 |
+
"commitTransactionForOrder");
|
| 187 |
+
}
|
| 188 |
+
$exactorTransaction = $exactorProcessingService->loadTransactionInfoByOrderId($order->getIncrementId());
|
| 189 |
+
$invoiceRequests = $this->exactorMappingHelper->buildInvoiceRequestForMagentoOrder($order, $merchantSettings);
|
| 190 |
+
if (count($invoiceRequests) == 1 && $exactorTransaction != null && !$exactorTransaction->getIsCommited()) {
|
| 191 |
+
$taxResponse = $exactorProcessingService->partialPayment($invoiceRequests[0], new DateTime(), "");
|
| 192 |
+
$exactorTransaction->setIsCommited(true);
|
| 193 |
+
$exactorTransaction->setExactorTrnId($taxResponse->getFirstCommit()->getTransactionId());
|
| 194 |
+
$exactorProcessingService->getPluginCallback()
|
| 195 |
+
->saveTransactionInfo($exactorTransaction, $exactorTransaction->getSignature());
|
| 196 |
+
return $taxResponse;
|
| 197 |
+
} else {
|
| 198 |
+
$this->logger->error("New order should be represented by the single exactor transaction. Is", 'processFinishedOrder');
|
| 199 |
+
}
|
| 200 |
+
}catch (Exception $e){
|
| 201 |
+
$this->logger->error("Can't commit transaction. See details above.", 'processFinishedOrder');
|
| 202 |
+
}
|
| 203 |
+
return null;
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
public function handleAllOrdersCompleted(Varien_Event_Observer $observer){
|
| 207 |
$this->logger->trace('called', 'handleAllOrdersCompleted');
|
| 208 |
if (is_array($observer->getOrders()))
|
| 217 |
}
|
| 218 |
|
| 219 |
private function partialRefund(Mage_Sales_Model_Order_Creditmemo $creditMemo){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
$merchantSettings = $this->loadMerchantSettings($creditMemo->getOrder());
|
| 221 |
if ($merchantSettings==null) return;
|
| 222 |
+
if (!$this->underEffectiveDate($merchantSettings->getEffectiveDate(), $creditMemo->getOrder()->getCreatedAt())){
|
| 223 |
+
$this->logger->info("Order " . $creditMemo->getOrder()->getIncrementId() ." is not under effective date. Skipping.", "partialRefund");
|
| 224 |
+
return;
|
| 225 |
+
}
|
| 226 |
$invoiceRequests = $this->exactorMappingHelper->buildInvoiceRequestsForCreditMemo($creditMemo, $merchantSettings);
|
| 227 |
$exactorProcessingService = ExactorProcessingServiceFactory::getInstance()->buildExactorProcessingService($merchantSettings->getMerchantID(),
|
| 228 |
$merchantSettings->getUserID());
|
| 229 |
foreach ($invoiceRequests as $invoice) {
|
| 230 |
+
$exactorProcessingService->partialRefund($invoice, new DateTime(), "");
|
| 231 |
}
|
| 232 |
}
|
| 233 |
|
| 234 |
+
// ====================================================================================================================
|
| 235 |
+
// =================================== EVENT HANDLERS =================================================================
|
| 236 |
+
// ====================================================================================================================
|
| 237 |
+
|
| 238 |
/**
|
| 239 |
* Event will be fired once new order has been created
|
| 240 |
* @param Varien_Event_Observer $observer
|
| 267 |
$this->logger->trace('called', 'handleNewCreditMemo');
|
| 268 |
$merchantSettings = $this->loadMerchantSettings($observer->getCreditmemo()->getOrder());
|
| 269 |
if ($merchantSettings==null) return;
|
| 270 |
+
// TODO: What about COMMIT on shipment
|
| 271 |
+
if ($merchantSettings->getCommitOption() != Exactor_Core_Model_MerchantSettings::COMMIT_NEVER) {
|
| 272 |
+
if ($merchantSettings->getCommitOption() == Exactor_Core_Model_MerchantSettings::COMMIT_ON_SHIPMENT) {
|
| 273 |
+
$exactorTrnInfo = $this->exactorProcessingService->loadTransactionInfoByOrderId(
|
| 274 |
+
$observer->getCreditmemo()->getOrder()->getIncrementId());
|
| 275 |
+
if ($exactorTrnInfo != null && $exactorTrnInfo->getIsCommited()){
|
| 276 |
+
try{
|
| 277 |
+
$this->refundTransactionForOrder($observer->getCreditmemo()->getOrder(), $merchantSettings);
|
| 278 |
+
$exactorTrnInfo->setIsCommited(false);
|
| 279 |
+
$this->exactorProcessingService->getPluginCallback()
|
| 280 |
+
->saveTransactionInfo($exactorTrnInfo, $exactorTrnInfo->getSignature());
|
| 281 |
+
} catch (Exception $e) {
|
| 282 |
+
$this->logger->error("Can't refund credit memo", 'handleNewCreditMemo');
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
} else {
|
| 286 |
+
$this->partialRefund($observer->getCreditmemo());
|
| 287 |
+
}
|
| 288 |
+
}
|
| 289 |
}
|
| 290 |
|
| 291 |
public function handleCancelOrder(Varien_Event_Observer $observer){
|
| 292 |
$this->logger->trace('called', 'handleCancelOrder');
|
| 293 |
$merchantSettings = $this->loadMerchantSettings($observer->getPayment()->getOrder());
|
| 294 |
if ($merchantSettings==null) return;
|
| 295 |
+
if ($merchantSettings->getCommitOption() == Exactor_Core_Model_MerchantSettings::COMMIT_ON_INVOICE) {
|
| 296 |
+
// Just do nothing
|
| 297 |
+
//$this->refundAllInvoicesForOrder($observer->getPayment()->getOrder(), $merchantSettings);
|
| 298 |
+
} else {
|
| 299 |
+
$this->refundTransactionForOrder($observer->getPayment()->getOrder(), $merchantSettings);
|
| 300 |
+
}
|
| 301 |
}
|
| 302 |
|
| 303 |
public function handleNewShipment(Varien_Event_Observer $observer){
|
| 305 |
$merchantSettings = $this->loadMerchantSettings($observer->getShipment()->getOrder());
|
| 306 |
if ($merchantSettings==null) return;
|
| 307 |
if ($merchantSettings->getCommitOption() == Exactor_Core_Model_MerchantSettings::COMMIT_ON_SHIPMENT){
|
| 308 |
+
$this->commitTransactionForOrder($observer->getShipment()->getOrder(), $merchantSettings);
|
| 309 |
+
}
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
public function handleCancelInvoice(Varien_Event_Observer $observer){
|
| 313 |
+
$this->logger->trace('called', 'handleNewInvoice');
|
| 314 |
+
$merchantSettings = $this->loadMerchantSettings($observer->getInvoice()->getOrder());
|
| 315 |
+
if ($merchantSettings==null) return;
|
| 316 |
+
if ($merchantSettings->getCommitOption() == Exactor_Core_Model_MerchantSettings::COMMIT_ON_INVOICE){
|
| 317 |
+
$this->refundTransactionForInvoice($observer->getInvoice(), $merchantSettings);
|
| 318 |
}
|
| 319 |
}
|
| 320 |
|
| 322 |
$this->logger->trace('called', 'handleNewInvoice');
|
| 323 |
$merchantSettings = $this->loadMerchantSettings($observer->getInvoice()->getOrder());
|
| 324 |
if ($merchantSettings==null) return;
|
| 325 |
+
|
| 326 |
if ($merchantSettings->getCommitOption() == Exactor_Core_Model_MerchantSettings::COMMIT_ON_INVOICE){
|
| 327 |
+
$this->commitTransactionForInvoice($observer->getInvoice(), $merchantSettings);
|
|
|
|
| 328 |
}
|
| 329 |
+
}
|
| 330 |
|
| 331 |
+
/**
|
| 332 |
+
* Checks if target date is under effective date, false - otherwise.
|
| 333 |
+
*
|
| 334 |
+
* @param $effectiveDate - Effective date
|
| 335 |
+
* @param $targetDate - Date to check
|
| 336 |
+
* @return boolean
|
| 337 |
+
*/
|
| 338 |
+
private function underEffectiveDate($effectiveDate, $targetDate){
|
| 339 |
+
$effectiveTimestamp = strtotime($effectiveDate);
|
| 340 |
+
$targetTimestamp = strtotime('now');
|
| 341 |
+
if ($targetDate != null) {
|
| 342 |
+
$targetTimestamp = strtotime($targetDate);
|
| 343 |
+
}
|
| 344 |
+
return $targetTimestamp >= $effectiveTimestamp;
|
| 345 |
}
|
| 346 |
|
| 347 |
/**
|
app/code/local/Exactor/Sales/etc/config.xml
CHANGED
|
@@ -28,7 +28,7 @@
|
|
| 28 |
<config>
|
| 29 |
<modules>
|
| 30 |
<Exactor_Sales>
|
| 31 |
-
<version>2012.
|
| 32 |
</Exactor_Sales>
|
| 33 |
</modules>
|
| 34 |
<global>
|
|
@@ -78,7 +78,7 @@
|
|
| 78 |
</exactor_sales_observer>
|
| 79 |
</observers>
|
| 80 |
</sales_order_shipment_save_after>
|
| 81 |
-
<
|
| 82 |
<observers>
|
| 83 |
<exactor_sales_observer>
|
| 84 |
<type>singleton</type>
|
|
@@ -86,7 +86,16 @@
|
|
| 86 |
<method>handleNewInvoice</method>
|
| 87 |
</exactor_sales_observer>
|
| 88 |
</observers>
|
| 89 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
</events>
|
| 91 |
<models>
|
| 92 |
<tax>
|
| 28 |
<config>
|
| 29 |
<modules>
|
| 30 |
<Exactor_Sales>
|
| 31 |
+
<version>2012.10.19</version>
|
| 32 |
</Exactor_Sales>
|
| 33 |
</modules>
|
| 34 |
<global>
|
| 78 |
</exactor_sales_observer>
|
| 79 |
</observers>
|
| 80 |
</sales_order_shipment_save_after>
|
| 81 |
+
<sales_order_invoice_register>
|
| 82 |
<observers>
|
| 83 |
<exactor_sales_observer>
|
| 84 |
<type>singleton</type>
|
| 86 |
<method>handleNewInvoice</method>
|
| 87 |
</exactor_sales_observer>
|
| 88 |
</observers>
|
| 89 |
+
</sales_order_invoice_register>
|
| 90 |
+
<sales_order_invoice_cancel>
|
| 91 |
+
<observers>
|
| 92 |
+
<exactor_sales_observer>
|
| 93 |
+
<type>singleton</type>
|
| 94 |
+
<class>Exactor_Sales_Model_Observer</class>
|
| 95 |
+
<method>handleCancelInvoice</method>
|
| 96 |
+
</exactor_sales_observer>
|
| 97 |
+
</observers>
|
| 98 |
+
</sales_order_invoice_cancel>
|
| 99 |
</events>
|
| 100 |
<models>
|
| 101 |
<tax>
|
app/code/local/Exactor/Tax/Helper/Mapping.php
CHANGED
|
@@ -13,6 +13,7 @@ class Exactor_Tax_Helper_Mapping extends Mage_Core_Helper_Abstract {
|
|
| 13 |
const EUC_HANDLING = 'EUC-13010301';
|
| 14 |
const EUC_NON_TAXABLE = 'EUC-99990101';
|
| 15 |
const EUC_GIFT_CARD = self::EUC_NON_TAXABLE;
|
|
|
|
| 16 |
|
| 17 |
const MSG_DEFAULT_SHIPPING_NAME = 'Default Shipping';
|
| 18 |
const MSG_HANDLING_FEE = 'Handling Fee';
|
|
@@ -22,10 +23,13 @@ class Exactor_Tax_Helper_Mapping extends Mage_Core_Helper_Abstract {
|
|
| 22 |
const MSG_DISCOUNTED_BY = 'Discounted by $';
|
| 23 |
const MSG_ADJUSTMENTS_REFUND = "Adjustments Refund";
|
| 24 |
const MSG_GIFT_CARD_ITEM = "Gift card(-s)";
|
|
|
|
| 25 |
|
| 26 |
const LINE_ITEM_ID_SHIPPING = "SHIPPING";
|
| 27 |
const LINE_ITEM_ID_HANDLING = "HANDLING";
|
| 28 |
const LINE_ITEM_ID_ADJUSTMENTS = "ADJUSTMENTS";
|
|
|
|
|
|
|
| 29 |
const INDEXED_LINE_ITEM_ID_PREFIX = '_';
|
| 30 |
|
| 31 |
const ATTRIBUTE_NAME_EXEMPTION = 'taxvat';
|
|
@@ -152,7 +156,7 @@ class Exactor_Tax_Helper_Mapping extends Mage_Core_Helper_Abstract {
|
|
| 152 |
Exactor_Core_Model_MerchantSettings $merchantSettings){
|
| 153 |
|
| 154 |
if ($quoteAddress->getAddressType() == Mage_Sales_Model_Quote_Address::TYPE_BILLING) return null; // There is no shipping fees there
|
| 155 |
-
if ($quoteAddress->getShippingAmount()==
|
| 156 |
$shippingLineItem = $this->getShippingLineItem($merchantSettings, $quoteAddress->getShippingMethod(),
|
| 157 |
$quoteAddress->getShippingDescription(),
|
| 158 |
$quoteAddress->getShippingAmount(),
|
|
@@ -161,7 +165,7 @@ class Exactor_Tax_Helper_Mapping extends Mage_Core_Helper_Abstract {
|
|
| 161 |
}
|
| 162 |
|
| 163 |
public function getShippingLineItemForCreditMemo(Mage_Sales_Model_Order_Creditmemo $creditMemo, Exactor_Core_Model_MerchantSettings $merchantSettings){
|
| 164 |
-
if ($creditMemo->getShippingAmount()==
|
| 165 |
$lineItem = $this->getShippingLineItem($merchantSettings, $creditMemo->getOrder()->getShippingMethod(),
|
| 166 |
$creditMemo->getOrder()->getShippingDescription(),
|
| 167 |
$creditMemo->getShippingAmount());
|
|
@@ -170,6 +174,19 @@ class Exactor_Tax_Helper_Mapping extends Mage_Core_Helper_Abstract {
|
|
| 170 |
return $lineItem;
|
| 171 |
}
|
| 172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
private function getShippingLineItem(Exactor_Core_Model_MerchantSettings $merchantSettings,
|
| 174 |
$carrierName, $carrierDescription, $amount, $discount=0){
|
| 175 |
$shippingLineItem = new LineItemType();
|
|
@@ -300,6 +317,16 @@ class Exactor_Tax_Helper_Mapping extends Mage_Core_Helper_Abstract {
|
|
| 300 |
return $exemptionId;
|
| 301 |
}
|
| 302 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 303 |
private function getCurrentCurrencyCode(Mage_Sales_Model_Quote_Address $quoteAddress){
|
| 304 |
$store = Mage::app()->getStore();
|
| 305 |
if ($quoteAddress->getQuote() != null && $quoteAddress->getQuote()->getStoreId() != null){
|
|
@@ -321,10 +348,21 @@ class Exactor_Tax_Helper_Mapping extends Mage_Core_Helper_Abstract {
|
|
| 321 |
$lineItem->setGrossAmount($amount);
|
| 322 |
$lineItem->setQuantity(1);
|
| 323 |
$lineItem->setSKU(self::EUC_GIFT_CARD);
|
|
|
|
| 324 |
$lineItem->setDescription(self::MSG_GIFT_CARD_ITEM);
|
| 325 |
return $lineItem;
|
| 326 |
}
|
| 327 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 328 |
/**
|
| 329 |
* @param Mage_Sales_Model_Quote_Address $quoteAddress
|
| 330 |
* @param Exactor_Core_Model_MerchantSettings $merchantSettings
|
|
@@ -365,11 +403,11 @@ class Exactor_Tax_Helper_Mapping extends Mage_Core_Helper_Abstract {
|
|
| 365 |
$invoiceRequest->setExemptionId($this->getExemptionIdForQuoteAddress($quoteAddress, $merchantSettings));
|
| 366 |
// Line items list
|
| 367 |
$magentoItems = $quoteAddress->getAllItems();
|
| 368 |
-
$itemNum =
|
| 369 |
/**
|
| 370 |
* @var $magentoItem Mage_Sales_Model_Quote_Item
|
| 371 |
*/
|
| 372 |
-
foreach ($magentoItems as $magentoItem){
|
| 373 |
$exactorLineItem = $this->buildLineItemForMagentoItem($magentoItem, $quoteAddress, $merchantSettings);
|
| 374 |
if ($exactorLineItem == null) continue;
|
| 375 |
$exactorLineItem->setId(self::INDEXED_LINE_ITEM_ID_PREFIX . $magentoItem->getId());
|
|
@@ -386,18 +424,46 @@ class Exactor_Tax_Helper_Mapping extends Mage_Core_Helper_Abstract {
|
|
| 386 |
$invoiceRequest->addLineItem($exactorLineItem);
|
| 387 |
}
|
| 388 |
// Gift Cards
|
| 389 |
-
if ($quoteAddress->getBaseGiftCardsAmount() != null && $quoteAddress->getBaseGiftCardsAmount() !=
|
| 390 |
$invoiceRequest->addLineItem($this->buildGiftCardLineItem(-1 * $quoteAddress->getBaseGiftCardsAmount()));
|
| 391 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 392 |
// Shipping & Handling
|
| 393 |
$invoiceRequest->addLineItem($this->getShippingLineItemForQuoteAddress($quoteAddress, $merchantSettings));
|
| 394 |
$invoiceRequest->addLineItem($this->getHandlingLineItemForQuoteAddress($quoteAddress, $merchantSettings));
|
| 395 |
return $invoiceRequest;
|
| 396 |
}
|
| 397 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 398 |
|
| 399 |
-
|
| 400 |
-
/**Return invoice requests by credit memo. In case if credit memo contains adjustments - returns 2 separated invoices
|
| 401 |
* @param Mage_Sales_Model_Order_Creditmemo $creditMemo
|
| 402 |
* @param Exactor_Core_Model_MerchantSettings $merchantSettings
|
| 403 |
* @return array InvoiceRequestType
|
|
@@ -409,7 +475,7 @@ class Exactor_Tax_Helper_Mapping extends Mage_Core_Helper_Abstract {
|
|
| 409 |
$invoiceRequest->setShipTo($this->buildExactorAddressForOrderAddress($creditMemo->getShippingAddress()));
|
| 410 |
$invoiceRequest->setShipFrom($merchantSettings->getExactorShippingAddress());
|
| 411 |
$invoiceRequest->setCurrencyCode($creditMemo->getOrder()->getOrderCurrencyCode());
|
| 412 |
-
$invoiceRequest->setPurchaseOrderNumber(
|
| 413 |
$invoiceRequest->setSaleDate(new DateTime("@".$creditMemo->getOrder()->getCreatedAtDate()->getTimestamp()));
|
| 414 |
$invoiceRequest->setExemptionId($this->getExemptionIdForCreditMemo($creditMemo, $merchantSettings));
|
| 415 |
// Line items
|
|
@@ -427,7 +493,7 @@ class Exactor_Tax_Helper_Mapping extends Mage_Core_Helper_Abstract {
|
|
| 427 |
|
| 428 |
if ($shippingLineItem!=null) {
|
| 429 |
$handlingLineItem = $this->getHandlingLineItem($merchantSettings, $creditMemo->getOrder()->getShippingMethod());
|
| 430 |
-
if ($handlingLineItem!=null){
|
| 431 |
$delta = $creditMemo->getOrder()->getBaseShippingAmount() - $creditMemo->getOrder()->getBaseShippingRefunded() + $creditMemo->getBaseShippingAmount();
|
| 432 |
$shippingFactor = $creditMemo->getBaseShippingAmount() / $delta;
|
| 433 |
$handlingAmount = $handlingLineItem->getGrossAmount()*$shippingFactor;
|
|
@@ -449,28 +515,108 @@ class Exactor_Tax_Helper_Mapping extends Mage_Core_Helper_Abstract {
|
|
| 449 |
$adjustmentsItem->setQuantity(1);
|
| 450 |
$adjustmentsItem->setSKU(self::EUC_NON_TAXABLE);
|
| 451 |
$adjustmentsItem->setGrossAmount($creditMemo->getAdjustmentPositive()-$creditMemo->getAdjustmentNegative());
|
| 452 |
-
if ($adjustmentsItem->getGrossAmount() !=
|
| 453 |
-
$creditMemo->getBaseGiftCardsAmount() != null && $creditMemo->getBaseGiftCardsAmount() !=
|
| 454 |
-
|
|
|
|
| 455 |
$adjustmentInvoice = clone $invoiceRequest;
|
| 456 |
$adjustmentInvoice->setPurchaseOrderNumber(self::MSG_ADJUSTMENTS_REFUND);
|
| 457 |
$adjustmentInvoice->setLineItems(array());
|
| 458 |
-
if ($adjustmentsItem->getGrossAmount() !=
|
| 459 |
$adjustmentInvoice->addLineItem($adjustmentsItem);
|
| 460 |
}
|
| 461 |
// Gift Cards
|
| 462 |
-
if ($creditMemo->getBaseGiftCardsAmount() != null && $creditMemo->getBaseGiftCardsAmount() !=
|
| 463 |
$adjustmentInvoice->addLineItem($this->buildGiftCardLineItem(-1 * $creditMemo->getBaseGiftCardsAmount()));
|
| 464 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 465 |
$result[] = $adjustmentInvoice;
|
| 466 |
}
|
| 467 |
return $result;
|
| 468 |
}
|
| 469 |
|
| 470 |
-
public function buildInvoiceRequestForMagentoInvoice(){
|
|
|
|
| 471 |
$invoiceRequest = new InvoiceRequestType();
|
| 472 |
-
|
| 473 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 474 |
}
|
| 475 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 476 |
}
|
| 13 |
const EUC_HANDLING = 'EUC-13010301';
|
| 14 |
const EUC_NON_TAXABLE = 'EUC-99990101';
|
| 15 |
const EUC_GIFT_CARD = self::EUC_NON_TAXABLE;
|
| 16 |
+
const EUC_STORE_CREDIT = self::EUC_NON_TAXABLE;
|
| 17 |
|
| 18 |
const MSG_DEFAULT_SHIPPING_NAME = 'Default Shipping';
|
| 19 |
const MSG_HANDLING_FEE = 'Handling Fee';
|
| 23 |
const MSG_DISCOUNTED_BY = 'Discounted by $';
|
| 24 |
const MSG_ADJUSTMENTS_REFUND = "Adjustments Refund";
|
| 25 |
const MSG_GIFT_CARD_ITEM = "Gift card(-s)";
|
| 26 |
+
const MSG_STORE_CREDIT_ITEM = "Store credit";
|
| 27 |
|
| 28 |
const LINE_ITEM_ID_SHIPPING = "SHIPPING";
|
| 29 |
const LINE_ITEM_ID_HANDLING = "HANDLING";
|
| 30 |
const LINE_ITEM_ID_ADJUSTMENTS = "ADJUSTMENTS";
|
| 31 |
+
const LINE_ITEM_ID_GIFT_CARD = "GIFT_CARD";
|
| 32 |
+
const LINE_ITEM_ID_STORE_CREDIT = "STORE_CREDIT";
|
| 33 |
const INDEXED_LINE_ITEM_ID_PREFIX = '_';
|
| 34 |
|
| 35 |
const ATTRIBUTE_NAME_EXEMPTION = 'taxvat';
|
| 156 |
Exactor_Core_Model_MerchantSettings $merchantSettings){
|
| 157 |
|
| 158 |
if ($quoteAddress->getAddressType() == Mage_Sales_Model_Quote_Address::TYPE_BILLING) return null; // There is no shipping fees there
|
| 159 |
+
if ($quoteAddress->getShippingAmount()==0) return null;
|
| 160 |
$shippingLineItem = $this->getShippingLineItem($merchantSettings, $quoteAddress->getShippingMethod(),
|
| 161 |
$quoteAddress->getShippingDescription(),
|
| 162 |
$quoteAddress->getShippingAmount(),
|
| 165 |
}
|
| 166 |
|
| 167 |
public function getShippingLineItemForCreditMemo(Mage_Sales_Model_Order_Creditmemo $creditMemo, Exactor_Core_Model_MerchantSettings $merchantSettings){
|
| 168 |
+
if ($creditMemo->getShippingAmount()==0) return null;
|
| 169 |
$lineItem = $this->getShippingLineItem($merchantSettings, $creditMemo->getOrder()->getShippingMethod(),
|
| 170 |
$creditMemo->getOrder()->getShippingDescription(),
|
| 171 |
$creditMemo->getShippingAmount());
|
| 174 |
return $lineItem;
|
| 175 |
}
|
| 176 |
|
| 177 |
+
public function getShippingLineItemForOrder(Mage_Sales_Model_Order $order, Exactor_Core_Model_MerchantSettings $merchantSettings) {
|
| 178 |
+
if ($order->getBaseShippingAmount() == 0) return null;
|
| 179 |
+
$lineItem = $this->getShippingLineItem($merchantSettings, $order->getShippingMethod(),
|
| 180 |
+
$order->getShippingDescription(),
|
| 181 |
+
$order->getBaseShippingAmount());
|
| 182 |
+
return $lineItem;
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
public function getShippingLineItemForInvoice(Mage_Sales_Model_Order_Invoice $invoice, Exactor_Core_Model_MerchantSettings $merchantSettings) {
|
| 186 |
+
if ($invoice->getBaseShippingAmount() == 0) return null;
|
| 187 |
+
return $this->getShippingLineItemForOrder($invoice->getOrder(), $merchantSettings);
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
private function getShippingLineItem(Exactor_Core_Model_MerchantSettings $merchantSettings,
|
| 191 |
$carrierName, $carrierDescription, $amount, $discount=0){
|
| 192 |
$shippingLineItem = new LineItemType();
|
| 317 |
return $exemptionId;
|
| 318 |
}
|
| 319 |
|
| 320 |
+
private function getExemptionIdForOrder(Mage_Sales_Model_Order $order,
|
| 321 |
+
Exactor_Core_Model_MerchantSettings $merchantSettings){
|
| 322 |
+
$exemptionId = '';
|
| 323 |
+
if ($merchantSettings->getExemptionsSupported()){
|
| 324 |
+
$customerExemptionId = $order->getCustomerTaxvat();
|
| 325 |
+
if ($customerExemptionId!=null) $exemptionId=$customerExemptionId;
|
| 326 |
+
}
|
| 327 |
+
return $exemptionId;
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
private function getCurrentCurrencyCode(Mage_Sales_Model_Quote_Address $quoteAddress){
|
| 331 |
$store = Mage::app()->getStore();
|
| 332 |
if ($quoteAddress->getQuote() != null && $quoteAddress->getQuote()->getStoreId() != null){
|
| 348 |
$lineItem->setGrossAmount($amount);
|
| 349 |
$lineItem->setQuantity(1);
|
| 350 |
$lineItem->setSKU(self::EUC_GIFT_CARD);
|
| 351 |
+
$lineItem->setId(self::LINE_ITEM_ID_GIFT_CARD);
|
| 352 |
$lineItem->setDescription(self::MSG_GIFT_CARD_ITEM);
|
| 353 |
return $lineItem;
|
| 354 |
}
|
| 355 |
|
| 356 |
+
private function buildStoreCreditLineItem($amount){
|
| 357 |
+
$lineItem = new LineItemType();
|
| 358 |
+
$lineItem->setGrossAmount($amount);
|
| 359 |
+
$lineItem->setQuantity(1);
|
| 360 |
+
$lineItem->setSKU(self::EUC_STORE_CREDIT);
|
| 361 |
+
$lineItem->setId(self::LINE_ITEM_ID_STORE_CREDIT);
|
| 362 |
+
$lineItem->setDescription(self::MSG_STORE_CREDIT_ITEM);
|
| 363 |
+
return $lineItem;
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
/**
|
| 367 |
* @param Mage_Sales_Model_Quote_Address $quoteAddress
|
| 368 |
* @param Exactor_Core_Model_MerchantSettings $merchantSettings
|
| 403 |
$invoiceRequest->setExemptionId($this->getExemptionIdForQuoteAddress($quoteAddress, $merchantSettings));
|
| 404 |
// Line items list
|
| 405 |
$magentoItems = $quoteAddress->getAllItems();
|
| 406 |
+
$itemNum = 0;
|
| 407 |
/**
|
| 408 |
* @var $magentoItem Mage_Sales_Model_Quote_Item
|
| 409 |
*/
|
| 410 |
+
foreach ($magentoItems as $magentoItem) {
|
| 411 |
$exactorLineItem = $this->buildLineItemForMagentoItem($magentoItem, $quoteAddress, $merchantSettings);
|
| 412 |
if ($exactorLineItem == null) continue;
|
| 413 |
$exactorLineItem->setId(self::INDEXED_LINE_ITEM_ID_PREFIX . $magentoItem->getId());
|
| 424 |
$invoiceRequest->addLineItem($exactorLineItem);
|
| 425 |
}
|
| 426 |
// Gift Cards
|
| 427 |
+
if ($quoteAddress->getBaseGiftCardsAmount() != null && $quoteAddress->getBaseGiftCardsAmount() != 0){
|
| 428 |
$invoiceRequest->addLineItem($this->buildGiftCardLineItem(-1 * $quoteAddress->getBaseGiftCardsAmount()));
|
| 429 |
}
|
| 430 |
+
// Store Credit
|
| 431 |
+
$storeCreditAmount = $quoteAddress->getBaseCustomerBalanceAmount();
|
| 432 |
+
if ($storeCreditAmount != null && $storeCreditAmount != 0) {
|
| 433 |
+
$invoiceRequest->addLineItem($this->buildStoreCreditLineItem(-1 * $storeCreditAmount));
|
| 434 |
+
}
|
| 435 |
// Shipping & Handling
|
| 436 |
$invoiceRequest->addLineItem($this->getShippingLineItemForQuoteAddress($quoteAddress, $merchantSettings));
|
| 437 |
$invoiceRequest->addLineItem($this->getHandlingLineItemForQuoteAddress($quoteAddress, $merchantSettings));
|
| 438 |
return $invoiceRequest;
|
| 439 |
}
|
| 440 |
|
| 441 |
+
/**
|
| 442 |
+
* Calculates prorated shipping and handling amounts for partial payments \ refunds.
|
| 443 |
+
*
|
| 444 |
+
* @param $orderedShippingAmount - total shipping amount from the order. Typically getOrder()->getBaseShippingAmount()
|
| 445 |
+
* @param $alreadyProcessedAmount - a part of shipping amount that was already processed, for instance $creditMemo->getOrder()->getBaseShippingRefunded()
|
| 446 |
+
* @param $targetShippingAmount - shipping amount to process, e.g. $invoice->getBaseShippingAmount()
|
| 447 |
+
* @param $handlingTotalAmount - total handling amount
|
| 448 |
+
* @param Mage_Core_Model_Store $store
|
| 449 |
+
* @return array (shipping amount, handling amount)
|
| 450 |
+
*/
|
| 451 |
+
private function calculateProratedShippingAndHandling($orderedShippingAmount, $alreadyProcessedAmount,
|
| 452 |
+
$targetShippingAmount, $handlingTotalAmount,
|
| 453 |
+
Mage_Core_Model_Store $store) {
|
| 454 |
+
// $orderedShippingAmount = $invoice->getOrder()->getBaseShippingAmount();
|
| 455 |
+
// $alreadyProcessedAmount = $invoice->getOrder()->getBaseShippingRefunded();
|
| 456 |
+
// $targetShippingAmount = $invoice->getBaseShippingAmount();
|
| 457 |
+
// $handlingTotalAmount = $handlingLineItem->getGrossAmount();
|
| 458 |
+
$delta = $orderedShippingAmount - $alreadyProcessedAmount + $targetShippingAmount;
|
| 459 |
+
$shippingFactor = $targetShippingAmount / $delta;
|
| 460 |
+
$handlingAmount = $handlingTotalAmount*$shippingFactor;
|
| 461 |
+
$shippingAmount = $targetShippingAmount - $handlingAmount;
|
| 462 |
+
return array($store->roundPrice($shippingAmount),
|
| 463 |
+
$store->roundPrice($shippingAmount));
|
| 464 |
+
}
|
| 465 |
|
| 466 |
+
/** Return invoice requests by credit memo. In case if credit memo contains adjustments - returns 2 separated invoices
|
|
|
|
| 467 |
* @param Mage_Sales_Model_Order_Creditmemo $creditMemo
|
| 468 |
* @param Exactor_Core_Model_MerchantSettings $merchantSettings
|
| 469 |
* @return array InvoiceRequestType
|
| 475 |
$invoiceRequest->setShipTo($this->buildExactorAddressForOrderAddress($creditMemo->getShippingAddress()));
|
| 476 |
$invoiceRequest->setShipFrom($merchantSettings->getExactorShippingAddress());
|
| 477 |
$invoiceRequest->setCurrencyCode($creditMemo->getOrder()->getOrderCurrencyCode());
|
| 478 |
+
$invoiceRequest->setPurchaseOrderNumber($creditMemo->getOrder()->getIncrementId());
|
| 479 |
$invoiceRequest->setSaleDate(new DateTime("@".$creditMemo->getOrder()->getCreatedAtDate()->getTimestamp()));
|
| 480 |
$invoiceRequest->setExemptionId($this->getExemptionIdForCreditMemo($creditMemo, $merchantSettings));
|
| 481 |
// Line items
|
| 493 |
|
| 494 |
if ($shippingLineItem!=null) {
|
| 495 |
$handlingLineItem = $this->getHandlingLineItem($merchantSettings, $creditMemo->getOrder()->getShippingMethod());
|
| 496 |
+
if ($handlingLineItem!=null){ // TODO: use common method: calculateProratedShippingAndHandling(...)
|
| 497 |
$delta = $creditMemo->getOrder()->getBaseShippingAmount() - $creditMemo->getOrder()->getBaseShippingRefunded() + $creditMemo->getBaseShippingAmount();
|
| 498 |
$shippingFactor = $creditMemo->getBaseShippingAmount() / $delta;
|
| 499 |
$handlingAmount = $handlingLineItem->getGrossAmount()*$shippingFactor;
|
| 515 |
$adjustmentsItem->setQuantity(1);
|
| 516 |
$adjustmentsItem->setSKU(self::EUC_NON_TAXABLE);
|
| 517 |
$adjustmentsItem->setGrossAmount($creditMemo->getAdjustmentPositive()-$creditMemo->getAdjustmentNegative());
|
| 518 |
+
if ($adjustmentsItem->getGrossAmount() != 0
|
| 519 |
+
|| $creditMemo->getBaseGiftCardsAmount() != null && $creditMemo->getBaseGiftCardsAmount() != 0
|
| 520 |
+
|| $creditMemo->getBaseCustomerBalanceAmount() != null && $creditMemo->getBaseCustomerBalanceAmount() != 0
|
| 521 |
+
) {
|
| 522 |
$adjustmentInvoice = clone $invoiceRequest;
|
| 523 |
$adjustmentInvoice->setPurchaseOrderNumber(self::MSG_ADJUSTMENTS_REFUND);
|
| 524 |
$adjustmentInvoice->setLineItems(array());
|
| 525 |
+
if ($adjustmentsItem->getGrossAmount() != 0){
|
| 526 |
$adjustmentInvoice->addLineItem($adjustmentsItem);
|
| 527 |
}
|
| 528 |
// Gift Cards
|
| 529 |
+
if ($creditMemo->getBaseGiftCardsAmount() != null && $creditMemo->getBaseGiftCardsAmount() != 0){
|
| 530 |
$adjustmentInvoice->addLineItem($this->buildGiftCardLineItem(-1 * $creditMemo->getBaseGiftCardsAmount()));
|
| 531 |
}
|
| 532 |
+
// Store Credit
|
| 533 |
+
$storeCreditAmount = $creditMemo->getBaseCustomerBalanceAmount();
|
| 534 |
+
if ($storeCreditAmount != null && $storeCreditAmount != 0) {
|
| 535 |
+
$adjustmentInvoice->addLineItem($this->buildStoreCreditLineItem(-1 * $storeCreditAmount));
|
| 536 |
+
}
|
| 537 |
$result[] = $adjustmentInvoice;
|
| 538 |
}
|
| 539 |
return $result;
|
| 540 |
}
|
| 541 |
|
| 542 |
+
public function buildInvoiceRequestForMagentoInvoice(Mage_Sales_Model_Order_Invoice $invoice, Exactor_Core_Model_MerchantSettings $merchantSettings){
|
| 543 |
+
$result = array();
|
| 544 |
$invoiceRequest = new InvoiceRequestType();
|
| 545 |
+
$invoiceRequest->setBillTo($this->buildExactorAddressForOrderAddress($invoice->getBillingAddress()));
|
| 546 |
+
$invoiceRequest->setShipTo($this->buildExactorAddressForOrderAddress($invoice->getShippingAddress()));
|
| 547 |
+
$invoiceRequest->setShipFrom($merchantSettings->getExactorShippingAddress());
|
| 548 |
+
$invoiceRequest->setCurrencyCode($invoice->getOrder()->getOrderCurrencyCode());
|
| 549 |
+
$invoiceRequest->setPurchaseOrderNumber($invoice->getOrder()->getIncrementId());
|
| 550 |
+
$invoiceRequest->setSaleDate(new DateTime("@".$invoice->getOrder()->getCreatedAtDate()->getTimestamp()));
|
| 551 |
+
$invoiceRequest->setExemptionId($this->getExemptionIdForOrder($invoice->getOrder(), $merchantSettings));
|
| 552 |
+
//$invoiceRequest->setExemptionId($this->getExemptionIdForCreditMemo($creditMemo, $merchantSettings));
|
| 553 |
+
// Line items
|
| 554 |
+
$magentoItems = $invoice->getAllItems();
|
| 555 |
+
foreach ($magentoItems as $magentoItem){
|
| 556 |
+
$exactorLineItem = $this->buildLineItemForMagentoItem($magentoItem, new Mage_Sales_Model_Quote_Address(), $merchantSettings);
|
| 557 |
+
if ($exactorLineItem != null){
|
| 558 |
+
$exactorLineItem->setQuantity($magentoItem->getQty());
|
| 559 |
+
}
|
| 560 |
+
$invoiceRequest->addLineItem($exactorLineItem);
|
| 561 |
+
}
|
| 562 |
+
// Shipping & Handling
|
| 563 |
+
$shippingLineItem = $this->getShippingLineItemForInvoice($invoice, $merchantSettings);
|
| 564 |
+
$handlingLineItem = null;
|
| 565 |
+
if ($shippingLineItem!=null) {
|
| 566 |
+
$handlingLineItem = $this->getHandlingLineItem($merchantSettings, $invoice->getOrder()->getShippingMethod());
|
| 567 |
+
}
|
| 568 |
+
$invoiceRequest->addLineItem($shippingLineItem);
|
| 569 |
+
$invoiceRequest->addLineItem($handlingLineItem);
|
| 570 |
+
// Gift cards
|
| 571 |
+
if ($invoice->getBaseGiftCardsAmount() != null && $invoice->getBaseGiftCardsAmount() != 0){
|
| 572 |
+
$invoiceRequest->addLineItem($this->buildGiftCardLineItem(-1 * $invoice->getBaseGiftCardsAmount()));
|
| 573 |
+
}
|
| 574 |
+
// Store Credit
|
| 575 |
+
$storeCreditAmount = $invoice->getBaseCustomerBalanceAmount();
|
| 576 |
+
if ($storeCreditAmount != null && $storeCreditAmount != 0) {
|
| 577 |
+
$invoiceRequest->addLineItem($this->buildStoreCreditLineItem(-1 * $storeCreditAmount));
|
| 578 |
+
}
|
| 579 |
+
$result[] = $invoiceRequest;
|
| 580 |
+
return $result;
|
| 581 |
}
|
| 582 |
|
| 583 |
+
public function buildInvoiceRequestForMagentoOrder(Mage_Sales_Model_Order $order, Exactor_Core_Model_MerchantSettings $merchantSettings){
|
| 584 |
+
$result = array();
|
| 585 |
+
$invoiceRequest = new InvoiceRequestType();
|
| 586 |
+
$invoiceRequest->setBillTo($this->buildExactorAddressForOrderAddress($order->getBillingAddress()));
|
| 587 |
+
$invoiceRequest->setShipTo($this->buildExactorAddressForOrderAddress($order->getShippingAddress()));
|
| 588 |
+
$invoiceRequest->setShipFrom($merchantSettings->getExactorShippingAddress());
|
| 589 |
+
$invoiceRequest->setCurrencyCode($order->getOrderCurrencyCode());
|
| 590 |
+
$invoiceRequest->setPurchaseOrderNumber($order->getIncrementId());
|
| 591 |
+
$invoiceRequest->setSaleDate(new DateTime("@".$order->getCreatedAtDate()->getTimestamp()));
|
| 592 |
+
$invoiceRequest->setExemptionId($this->getExemptionIdForOrder($order, $merchantSettings));
|
| 593 |
+
// Line items
|
| 594 |
+
$magentoItems = $order->getAllItems();
|
| 595 |
+
foreach ($magentoItems as $magentoItem){
|
| 596 |
+
$exactorLineItem = $this->buildLineItemForMagentoItem($magentoItem, new Mage_Sales_Model_Quote_Address(), $merchantSettings);
|
| 597 |
+
if ($exactorLineItem != null){
|
| 598 |
+
$exactorLineItem->setQuantity($magentoItem->getQtyOrdered());
|
| 599 |
+
}
|
| 600 |
+
$invoiceRequest->addLineItem($exactorLineItem);
|
| 601 |
+
}
|
| 602 |
+
// Shipping & Handling
|
| 603 |
+
$shippingLineItem = $this->getShippingLineItemForOrder($order, $merchantSettings);
|
| 604 |
+
$handlingLineItem = null;
|
| 605 |
+
if ($shippingLineItem!=null) {
|
| 606 |
+
$handlingLineItem = $this->getHandlingLineItem($merchantSettings, $order->getShippingMethod());
|
| 607 |
+
}
|
| 608 |
+
$invoiceRequest->addLineItem($shippingLineItem);
|
| 609 |
+
$invoiceRequest->addLineItem($handlingLineItem);
|
| 610 |
+
// Gift cards
|
| 611 |
+
if ($order->getBaseGiftCardsAmount() != null && $order->getBaseGiftCardsAmount() != 0){
|
| 612 |
+
$invoiceRequest->addLineItem($this->buildGiftCardLineItem(-1 * $order->getBaseGiftCardsAmount()));
|
| 613 |
+
}
|
| 614 |
+
// Store Credit
|
| 615 |
+
$storeCreditAmount = $order->getBaseCustomerBalanceAmount();
|
| 616 |
+
if ($storeCreditAmount != null && $storeCreditAmount != 0) {
|
| 617 |
+
$invoiceRequest->addLineItem($this->buildStoreCreditLineItem(-1 * $storeCreditAmount));
|
| 618 |
+
}
|
| 619 |
+
$result[] = $invoiceRequest;
|
| 620 |
+
return $result;
|
| 621 |
+
}
|
| 622 |
}
|
app/code/local/Exactor/Tax/etc/config.xml
CHANGED
|
@@ -28,7 +28,7 @@
|
|
| 28 |
<config>
|
| 29 |
<modules>
|
| 30 |
<Exactor_Tax>
|
| 31 |
-
<version>2012.
|
| 32 |
</Exactor_Tax>
|
| 33 |
</modules>
|
| 34 |
<global>
|
| 28 |
<config>
|
| 29 |
<modules>
|
| 30 |
<Exactor_Tax>
|
| 31 |
+
<version>2012.10.19</version>
|
| 32 |
</Exactor_Tax>
|
| 33 |
</modules>
|
| 34 |
<global>
|
app/design/adminhtml/default/default/template/ExactorSettings/settingsform.phtml
CHANGED
|
@@ -153,6 +153,30 @@
|
|
| 153 |
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Plugin Settings')?></h4>
|
| 154 |
<fieldset>
|
| 155 |
<table cellspacing="0" class="form-list" width="100%">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
<tr>
|
| 157 |
<td class="label" style="width: 280px"><?php echo $this->__('Do shipping charges include handling fees')?> <span class="required">*</span></td>
|
| 158 |
<td class="input-ele">
|
| 153 |
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Plugin Settings')?></h4>
|
| 154 |
<fieldset>
|
| 155 |
<table cellspacing="0" class="form-list" width="100%">
|
| 156 |
+
<tr>
|
| 157 |
+
<td class="label" style="width: 280px"><?php echo $this->__('Effective Date')?> <span class="required">*</span></td>
|
| 158 |
+
<td class="input-ele">
|
| 159 |
+
<input id="EffectiveDate" class="required-entry input-text validate-date"
|
| 160 |
+
value="<?php echo $accountSettings->getEffectiveDate(); ?>"
|
| 161 |
+
name="exactordetailsform[EffectiveDate]" STYLE="width: 135px" />
|
| 162 |
+
<script type="text/javascript">
|
| 163 |
+
Calendar.setup({
|
| 164 |
+
inputField: "EffectiveDate",
|
| 165 |
+
ifFormat: "%m/%e/%y",
|
| 166 |
+
showsTime: false,
|
| 167 |
+
align: "Bl",
|
| 168 |
+
singleClick : true
|
| 169 |
+
});
|
| 170 |
+
</script>
|
| 171 |
+
</td>
|
| 172 |
+
</tr>
|
| 173 |
+
<tr>
|
| 174 |
+
<td colspan="2">
|
| 175 |
+
<div style="margin-left: 5px; display: inline;">
|
| 176 |
+
<strong>Note:</strong> Changing options below will not affect any existing orders.
|
| 177 |
+
</div>
|
| 178 |
+
</td>
|
| 179 |
+
</tr>
|
| 180 |
<tr>
|
| 181 |
<td class="label" style="width: 280px"><?php echo $this->__('Do shipping charges include handling fees')?> <span class="required">*</span></td>
|
| 182 |
<td class="input-ele">
|
lib/ExactorCommons/ExactorCommons.php
CHANGED
|
@@ -657,21 +657,18 @@ class ExactorProcessingService{
|
|
| 657 |
}
|
| 658 |
|
| 659 |
/**
|
| 660 |
-
*
|
| 661 |
-
*
|
|
|
|
| 662 |
* @param InvoiceRequestType $invoiceRequest
|
| 663 |
* @param DateTime $date
|
| 664 |
* @param string $invoiceNumber
|
| 665 |
* @return TaxResponseType
|
| 666 |
*/
|
| 667 |
-
|
| 668 |
$commitRequest = new CommitRequestType();
|
| 669 |
$commitRequest->setCommitDate($date);
|
| 670 |
$commitRequest->setInvoiceNumber($invoiceNumber);
|
| 671 |
-
// Negate all item amounts
|
| 672 |
-
foreach ($invoiceRequest->getLineItems() as $lineItem){
|
| 673 |
-
$lineItem->setGrossAmount(-1 * $lineItem->getGrossAmount());
|
| 674 |
-
}
|
| 675 |
$commitRequest->setInvoiceRequest($invoiceRequest);
|
| 676 |
$request = ExactorConnectionFactory::getInstance()->buildRequest($this->merchantId, $this->userId, $this->partnerId);
|
| 677 |
$request->addCommitRequest($commitRequest);
|
|
@@ -690,12 +687,41 @@ class ExactorProcessingService{
|
|
| 690 |
$this->pluginCallback->onCommitFail($signature, $response->getFirstError(), $commitRequest);
|
| 691 |
}
|
| 692 |
}else{
|
| 693 |
-
$commitResponses = $response->getCommitResponses();
|
| 694 |
$this->pluginCallback->onCommitSuccess($signature, $commitResponses[0], $commitRequest, null);
|
| 695 |
}
|
| 696 |
return $response;
|
| 697 |
}
|
| 698 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 699 |
/**
|
| 700 |
* Fetch information about transaction from the internal database by given internal id
|
| 701 |
* and send refund request.
|
| 657 |
}
|
| 658 |
|
| 659 |
/**
|
| 660 |
+
* Just creates CommitRequestType and sends commit request to Exactor.
|
| 661 |
+
* If failed due to the invalid date - tries to use current one.
|
| 662 |
+
*
|
| 663 |
* @param InvoiceRequestType $invoiceRequest
|
| 664 |
* @param DateTime $date
|
| 665 |
* @param string $invoiceNumber
|
| 666 |
* @return TaxResponseType
|
| 667 |
*/
|
| 668 |
+
private function commitNewInvoiceRequestObject(InvoiceRequestType $invoiceRequest, DateTime $date, $invoiceNumber="unknown") {
|
| 669 |
$commitRequest = new CommitRequestType();
|
| 670 |
$commitRequest->setCommitDate($date);
|
| 671 |
$commitRequest->setInvoiceNumber($invoiceNumber);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 672 |
$commitRequest->setInvoiceRequest($invoiceRequest);
|
| 673 |
$request = ExactorConnectionFactory::getInstance()->buildRequest($this->merchantId, $this->userId, $this->partnerId);
|
| 674 |
$request->addCommitRequest($commitRequest);
|
| 687 |
$this->pluginCallback->onCommitFail($signature, $response->getFirstError(), $commitRequest);
|
| 688 |
}
|
| 689 |
}else{
|
| 690 |
+
$commitResponses = $response->getCommitResponses();
|
| 691 |
$this->pluginCallback->onCommitSuccess($signature, $commitResponses[0], $commitRequest, null);
|
| 692 |
}
|
| 693 |
return $response;
|
| 694 |
}
|
| 695 |
|
| 696 |
+
/**
|
| 697 |
+
* Performs commit of the given invoice object is useful for partial payments.
|
| 698 |
+
* Basically just convenient method for committing transactions.
|
| 699 |
+
*
|
| 700 |
+
* @param InvoiceRequestType $invoiceRequest
|
| 701 |
+
* @param DateTime $date
|
| 702 |
+
* @param string $invoiceNumber
|
| 703 |
+
* @return TaxResponseType
|
| 704 |
+
*/
|
| 705 |
+
public function partialPayment(InvoiceRequestType $invoiceRequest, DateTime $date, $invoiceNumber="unknown") {
|
| 706 |
+
return $this->commitNewInvoiceRequestObject($invoiceRequest, $date, $invoiceNumber);
|
| 707 |
+
}
|
| 708 |
+
|
| 709 |
+
/**
|
| 710 |
+
* Performs partial refund basing on the InvoiceRequest information.
|
| 711 |
+
* Basically it just negate all amounts in the given invoice transaction and commits it.
|
| 712 |
+
* @param InvoiceRequestType $invoiceRequest
|
| 713 |
+
* @param DateTime $date
|
| 714 |
+
* @param string $invoiceNumber
|
| 715 |
+
* @return TaxResponseType
|
| 716 |
+
*/
|
| 717 |
+
public function partialRefund(InvoiceRequestType $invoiceRequest, DateTime $date, $invoiceNumber="unknown"){
|
| 718 |
+
// Negate all item amounts
|
| 719 |
+
foreach ($invoiceRequest->getLineItems() as $lineItem){
|
| 720 |
+
$lineItem->setGrossAmount(-1 * $lineItem->getGrossAmount());
|
| 721 |
+
}
|
| 722 |
+
return $this->partialPayment($invoiceRequest, $date, $invoiceNumber);
|
| 723 |
+
}
|
| 724 |
+
|
| 725 |
/**
|
| 726 |
* Fetch information about transaction from the internal database by given internal id
|
| 727 |
* and send refund request.
|
lib/ExactorCommons/ExactorDomainObjects.php
CHANGED
|
@@ -1366,12 +1366,21 @@ class TaxResponseType extends XmlSerializationSupport{
|
|
| 1366 |
/** Returns first InvoiceResponseType from the list or null if there are no any invoice responses
|
| 1367 |
* @return InvoiceResponseType|null
|
| 1368 |
*/
|
| 1369 |
-
public function getFirstInvoice(){
|
| 1370 |
if (!count($this->getInvoiceResponses())) return null;
|
| 1371 |
$invoices = $this->getInvoiceResponses();
|
| 1372 |
return $invoices[0];
|
| 1373 |
}
|
| 1374 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1375 |
/* ******** GETTERS AND SETTERS *********** */
|
| 1376 |
|
| 1377 |
/**
|
| 1366 |
/** Returns first InvoiceResponseType from the list or null if there are no any invoice responses
|
| 1367 |
* @return InvoiceResponseType|null
|
| 1368 |
*/
|
| 1369 |
+
public function getFirstInvoice() {
|
| 1370 |
if (!count($this->getInvoiceResponses())) return null;
|
| 1371 |
$invoices = $this->getInvoiceResponses();
|
| 1372 |
return $invoices[0];
|
| 1373 |
}
|
| 1374 |
|
| 1375 |
+
/** Returns first InvoiceResponseType from the list or null if there are no any invoice responses
|
| 1376 |
+
* @return InvoiceResponseType|null
|
| 1377 |
+
*/
|
| 1378 |
+
public function getFirstCommit() {
|
| 1379 |
+
if (!count($this->getCommitResponses())) return null;
|
| 1380 |
+
$commits = $this->getCommitResponses();
|
| 1381 |
+
return $commits[0];
|
| 1382 |
+
}
|
| 1383 |
+
|
| 1384 |
/* ******** GETTERS AND SETTERS *********** */
|
| 1385 |
|
| 1386 |
/**
|
lib/ExactorCommons/config.php
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
* Time: 10:36 AM
|
| 6 |
*/
|
| 7 |
|
| 8 |
-
ExactorLoggingFactory::getInstance()->setup('MagentoLogger', IExactorLogger::
|
| 9 |
-
ExactorConnectionFactory::getInstance()->setup('Magento','
|
| 10 |
ExactorProcessingServiceFactory::getInstance()->setup(new MagentoExactorCallback());
|
| 11 |
|
| 5 |
* Time: 10:36 AM
|
| 6 |
*/
|
| 7 |
|
| 8 |
+
ExactorLoggingFactory::getInstance()->setup('MagentoLogger', IExactorLogger::DEBUG);
|
| 9 |
+
ExactorConnectionFactory::getInstance()->setup('Magento','v20121019');
|
| 10 |
ExactorProcessingServiceFactory::getInstance()->setup(new MagentoExactorCallback());
|
| 11 |
|
lib/ExactorCommons/config.php~
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* User: LOGICIFY\corvis
|
| 4 |
-
* Date: 4/20/12
|
| 5 |
-
* Time: 10:36 AM
|
| 6 |
-
*/
|
| 7 |
-
|
| 8 |
-
ExactorLoggingFactory::getInstance()->setup('MagentoLogger', IExactorLogger::TRACE);
|
| 9 |
-
ExactorConnectionFactory::getInstance()->setup('Magento','v20120614');
|
| 10 |
-
ExactorProcessingServiceFactory::getInstance()->setup(new MagentoExactorCallback());
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Mage_Exactor_Tax</name>
|
| 4 |
-
<version>2012.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -12,9 +12,9 @@ Once installed, neither the merchant, nor the customer, need to perform any addi
|
|
| 12 |
For additional information, please refer to the Exactor Magento User Guide that is attached to the plug-in, or which you can download directly from the Exactor control panel (navigate to Account Management Integration Points & PlugIns).</description>
|
| 13 |
<notes>Supported Magento 1.5.0.0 - 1.7.x, Magento Enterprise 1.8-1.12.x</notes>
|
| 14 |
<authors><author><name>Exactor, Inc.</name><user>exactor</user><email>support@exactor.com</email></author></authors>
|
| 15 |
-
<date>2012-
|
| 16 |
-
<time>
|
| 17 |
-
<contents><target name="magelocal"><dir name="Exactor"><dir name="Core"><dir name="Helper"><file name="SessionCache.php" hash="72692a33574f8ba2f1858e2e93aa4edf"/></dir><dir name="Model"><file name="ExactorTransaction.php" hash="852aa20f6e3b7aa0001439d4bffe9724"/><file name="MerchantSettings.php" hash="
|
| 18 |
<compatible/>
|
| 19 |
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
| 20 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Mage_Exactor_Tax</name>
|
| 4 |
+
<version>2012.10.19</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
| 12 |
For additional information, please refer to the Exactor Magento User Guide that is attached to the plug-in, or which you can download directly from the Exactor control panel (navigate to Account Management Integration Points & PlugIns).</description>
|
| 13 |
<notes>Supported Magento 1.5.0.0 - 1.7.x, Magento Enterprise 1.8-1.12.x</notes>
|
| 14 |
<authors><author><name>Exactor, Inc.</name><user>exactor</user><email>support@exactor.com</email></author></authors>
|
| 15 |
+
<date>2012-10-23</date>
|
| 16 |
+
<time>10:27:34</time>
|
| 17 |
+
<contents><target name="magelocal"><dir name="Exactor"><dir name="Core"><dir name="Helper"><file name="SessionCache.php" hash="72692a33574f8ba2f1858e2e93aa4edf"/></dir><dir name="Model"><file name="ExactorTransaction.php" hash="852aa20f6e3b7aa0001439d4bffe9724"/><file name="MerchantSettings.php" hash="71a7c2308f6f0eda102ae84dd90df751"/><dir name="Mysql4"><dir name="ExactorTransaction"><file name="Collection.php" hash="c7b890b4d3ab35e65a3856ae0e2fdf72"/></dir><file name="ExactorTransaction.php" hash="c91aebaae767613acf1c439a8b513c3b"/><dir name="MerchantSettings"><file name="Collection.php" hash="c1593f52e582e601409c4651c37495af"/><file name="Collection.php~" hash="d360e202eb30432ac41dc023ce13ffc0"/></dir><file name="MerchantSettings.php" hash="8f22b76bb64cdc7b1deb6f0e38889905"/></dir><dir name="Type"><file name="Onepage.php" hash="2441fb08bbeb579831cea4d3fbd31104"/></dir></dir><dir name="etc"><file name="config.xml" hash="98ecc82a5f7b74ac0bfc0f7ab512afdb"/></dir></dir><dir name="ExactorSettings"><dir name="Block"><file name="Form.php" hash="5ea1d72197306072fe5fad9b97d109e8"/></dir><dir name="Helper"><file name="Data.php" hash="a23bb9c251f0dbb77c107d01dde39e86"/><file name="VersionResolver.php" hash="14dce068dfe2a7d3364c4bd29e6f8431"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FormController.php" hash="c0985258b110e0314e6b6ea091ae8c19"/></dir><file name="AjaxController.php" hash="c07aeeca00e1408e52945fc027569793"/><file name="IndexController.php" hash="f47cbc274dd68c57c30b60bbee69259e"/></dir><dir name="etc"><file name="config.xml" hash="674c326bfc901d0becf7c94ddcdd1452"/></dir><dir name="sql"><dir name="ExactorSettings_setup"><file name="mysql4-install-14.04.2012.php" hash="2f70daa04ec8cd640acc11af9dad1f44"/><file name="upgrade-2012.06.14-2012.09.25.php" hash="485f1a8cb461239da40d2e7ff8d1a4e5"/></dir></dir></dir><dir name="Sales"><dir name="Model"><file name="Observer.php" hash="90bcb73580a5092953878c330412529e"/></dir><dir name="etc"><file name="config.xml" hash="ba31618f5165dda20010c40e7ef8dad1"/></dir></dir><dir name="Tax"><dir name="Helper"><file name="Calculation.php" hash="29c5252bdd48b173c90588f449114024"/><file name="Mapping.php" hash="3d81378fe483ca9179b9bd6719c656ec"/></dir><dir name="Model"><dir name="Sales"><dir name="Total"><dir name="Quote"><dir name="Nominal"><file name="Tax.php" hash="156eff380df5b16db55449759f193490"/></dir><file name="Tax.php" hash="2177508f9375ba7c250ae165a798de72"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="5988daba7efbc46db74e581f1079cadf"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="exactorsettings.xml" hash="3707eac08d2393c8796eebf1cf7a0bd9"/><file name="exactoronestepcheckout.xml" hash="9fdfa1db5e4e60b4eec8f348c10aab07"/></dir><dir name="template"><dir name="ExactorSettings"><file name="settingsform.phtml" hash="3f6e14533076ab97dbb0c98ba770bf87"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="exactoronestepcheckout.xml" hash="9fdfa1db5e4e60b4eec8f348c10aab07"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Exactor.xml" hash="e8997e8e36a265141b37790caaef39d6"/></dir></target><target name="mageweb"><dir name="js"><dir name="exactor"><file name="exactor.js" hash="5c23e40f4034e50a6e0df5b1c708b7e1"/></dir></dir></target><target name="magelib"><dir name="ExactorCommons"><file name="ExactorCommons.php" hash="9300c2344a6c8a4683a411614767f757"/><file name="ExactorDomainObjects.php" hash="ae42cff2f17d21922685e46dd47d93ac"/><file name="Magento.php" hash="76da7333fe0692053a47f8564c7b513a"/><file name="RegionResolver.php" hash="2537638a7895a169cee4b1df786d22fb"/><file name="XmlProcessing.php" hash="383fd21839889d720e2094e83ccc7a2a"/><file name="config.php" hash="f08b57de24b410d569ac2e87cf2d1dcc"/></dir></target></contents>
|
| 18 |
<compatible/>
|
| 19 |
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
| 20 |
</package>
|
