Version Notes
Supported Magento 1.5.0.0 - 1.7.x
Download this release
Release Info
Developer | Exactor, Inc. |
Extension | Mage_Exactor_Tax |
Version | 2012.05.28 |
Comparing to | |
See all releases |
Code changes from version 2012.03.26 to 2012.05.28
- app/code/local/Exactor/Adminhtml/Model/Observer.php +0 -168
- app/code/local/Exactor/Adminhtml/Model/Sales/Order/Create.php +0 -118
- app/code/local/Exactor/Adminhtml/etc/config.xml +0 -67
- app/code/local/Exactor/Checkout/Block/Cart/Totals.php +0 -60
- app/code/local/Exactor/Checkout/Model/Observer.php +0 -1
- app/code/local/Exactor/Checkout/etc/config.xml +0 -78
- app/code/local/Exactor/Core/Helper/SessionCache.php +82 -0
- app/code/local/Exactor/{Exactordetails/Model/Exactortransactiondetails.php → Core/Model/ExactorTransaction.php} +117 -119
- app/code/local/Exactor/Core/Model/MerchantSettings.php +279 -0
- app/code/local/Exactor/Core/Model/Mysql4/ExactorTransaction.php +1 -0
- app/code/local/Exactor/{Exactordetails/Model/Mysql4/Exactortransactiondetails → Core/Model/Mysql4/ExactorTransaction}/Collection.php +3 -9
- app/code/local/Exactor/{Exactordetails/Model/Mysql4/Exactoraccount.php → Core/Model/Mysql4/MerchantSettings.php} +1 -1
- app/code/local/Exactor/{Exactordetails/Model/Mysql4/Exactortransactiondetails.php → Core/Model/Mysql4/MerchantSettings/Collection.php} +7 -15
- app/code/local/Exactor/{Exactordetails/Model/Mysql4/Exactoraccount/Collection.php → Core/Model/Mysql4/MerchantSettings/Collection.php~} +3 -3
- app/code/local/Exactor/Core/Model/Type/Onepage.php +75 -0
- app/code/local/Exactor/Core/etc/config.xml +94 -0
- app/code/local/Exactor/ExactorSettings/Block/Form.php +75 -0
- app/code/local/Exactor/ExactorSettings/Helper/Data.php +81 -0
- app/code/local/Exactor/{Exactordetails → ExactorSettings}/Helper/VersionResolver.php +0 -0
- app/code/local/Exactor/ExactorSettings/controllers/Adminhtml/FormController.php +172 -0
- app/code/local/Exactor/ExactorSettings/controllers/AjaxController.php +33 -0
- app/code/local/Exactor/{Exactordetails → ExactorSettings}/controllers/IndexController.php +39 -39
- app/code/local/Exactor/{Exactordetails → ExactorSettings}/etc/config.xml +137 -147
- app/code/local/Exactor/ExactorSettings/sql/ExactorSettings_setup/mysql4-install-14.04.2012.php +66 -0
- app/code/local/Exactor/Exactordetails/Block/Form.php +0 -208
- app/code/local/Exactor/Exactordetails/Block/Switcher.php +0 -206
- app/code/local/Exactor/Exactordetails/Helper/ClassLoader.php +0 -15
- app/code/local/Exactor/Exactordetails/Helper/Data.php +0 -314
- app/code/local/Exactor/Exactordetails/Model/Exactoraccount.php +0 -281
- app/code/local/Exactor/Exactordetails/controllers/Adminhtml/ExactorformController.php +0 -295
- app/code/local/Exactor/Exactordetails/controllers/AjaxController.php +0 -18
- app/code/local/Exactor/Exactordetails/sql/exactordetails_setup/mysql4-install-2011.07.19.php +0 -139
- app/code/local/Exactor/Paypal/Model/Express/Checkout.php +0 -119
- app/code/local/Exactor/Paypal/etc/config.xml +0 -47
- app/code/local/Exactor/Sales/Model/Observer.php +126 -38
- app/code/local/Exactor/Sales/Model/Order.php +10 -56
- app/code/local/Exactor/Sales/etc/config.xml +92 -85
- app/code/local/Exactor/Tax/Helper/Calculation.php +23 -0
- app/code/local/Exactor/Tax/Helper/Mapping.php +279 -0
- app/code/local/Exactor/Tax/Model/Calculation.php +0 -67
- app/code/local/Exactor/Tax/Model/Observer.php +7 -1
- app/code/local/Exactor/Tax/Model/Sales/Total/Quote/Nominal/Tax.php +15 -0
- app/code/local/Exactor/Tax/Model/Sales/Total/Quote/Tax.php +225 -229
- app/code/local/Exactor/Tax/etc/config.xml +57 -59
- app/design/adminhtml/default/default/layout/exactoronestepcheckout.xml +7 -0
- app/design/adminhtml/default/default/layout/{exactordetails.xml → exactorsettings.xml} +3 -8
- app/design/adminhtml/default/default/template/ExactorSettings/settingsform.phtml +291 -0
- app/design/adminhtml/default/default/template/exactordetails/exactordetailsform.phtml +0 -253
- app/design/adminhtml/default/default/template/exactordetails/switcher.phtml +0 -73
- app/design/frontend/base/default/layout/exactoronestepcheckout.xml +7 -0
- app/etc/modules/Exactor.xml +16 -24
- js/exactor/exactor.js +7 -4
- lib/ExactorCommons/ExactorCommons.php +818 -0
- lib/ExactorCommons/ExactorDomainObjects.php +1491 -0
- lib/ExactorCommons/Magento.php +133 -0
- lib/ExactorCommons/XmlProcessing.php +256 -0
- lib/ExactorCommons/config.php +11 -0
- package.xml +9 -11
app/code/local/Exactor/Adminhtml/Model/Observer.php
DELETED
@@ -1,168 +0,0 @@
|
|
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_Adminhtml
|
23 |
-
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Exactor Adminhtml observer model
|
29 |
-
*
|
30 |
-
* @category Exactor
|
31 |
-
* @package Exactor_Adminhtml
|
32 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
-
*/
|
34 |
-
|
35 |
-
class Exactor_Adminhtml_Model_Observer extends Mage_Core_Model_Mysql4_Abstract {
|
36 |
-
|
37 |
-
#to hold the exactor tax class id for product type
|
38 |
-
protected $tax_class_id;
|
39 |
-
|
40 |
-
#constructor is needed to set the main table that will be
|
41 |
-
#accesed for mysql data
|
42 |
-
protected function _construct()
|
43 |
-
{
|
44 |
-
//need to set the main table for tax class
|
45 |
-
$this->_setMainTable('tax/tax_class');
|
46 |
-
}
|
47 |
-
|
48 |
-
|
49 |
-
#The below function is to override the Magento Existing system by Exactor System
|
50 |
-
#An Event is binded with the catalog_product_prepare_save event that is triggered within
|
51 |
-
#Mage_Adminhtml_Catalog_ProductController in function _initProductSave
|
52 |
-
function alter_product_before_save(Varien_Event_Observer $observer)
|
53 |
-
{
|
54 |
-
#get the event object from the observer object
|
55 |
-
$event = $observer->getEvent();
|
56 |
-
|
57 |
-
#get the product object from the varient event object
|
58 |
-
$product = $event->getData('product');
|
59 |
-
|
60 |
-
#get the product data from the post request
|
61 |
-
$productData = $event->getData('request')->getPost('product');
|
62 |
-
|
63 |
-
#set the tax class id for the product
|
64 |
-
$this->get_product_exactor_tax_class_id();
|
65 |
-
|
66 |
-
#assighn the exactor taxes pemenently to the product as to apply the exactor taxation
|
67 |
-
$productData["tax_class_id"] = $this->tax_class_id;
|
68 |
-
|
69 |
-
#after altering the product data save the product so as to
|
70 |
-
#change the product
|
71 |
-
$product->addData($productData);
|
72 |
-
|
73 |
-
return $this;
|
74 |
-
}
|
75 |
-
|
76 |
-
#The below function is to override the Magento Existing system by Exactor System
|
77 |
-
#An Event is binded with the admin_system_config_changed_section_tax event that is triggered within
|
78 |
-
#Mage_Adminhtml_System_ConfigController in function saveAction
|
79 |
-
function alter_shipping_tax_class(Varien_Event_Observer $observer)
|
80 |
-
{
|
81 |
-
#get the request object from the mage app FrontController
|
82 |
-
$request = Mage::app()->getFrontController()->getRequest();
|
83 |
-
|
84 |
-
#get the section from the post request
|
85 |
-
$section = $request->getParam('section');
|
86 |
-
|
87 |
-
#get the store from the post request
|
88 |
-
$store = $request->getParam('store');
|
89 |
-
|
90 |
-
#get the website from the post request
|
91 |
-
$website = $request->getParam('website');
|
92 |
-
|
93 |
-
#get the product data from the post request
|
94 |
-
$groups = $request->getParam('groups');
|
95 |
-
|
96 |
-
#this is the logic which is usend in the saveAction function
|
97 |
-
#within the Mage_Adminhtml_System_ConfigController file
|
98 |
-
#as we are again altering the groups array
|
99 |
-
if (isset($_FILES['groups']['name']) && is_array($_FILES['groups']['name'])) {
|
100 |
-
/**
|
101 |
-
* Carefully merge $_FILES and $_POST information
|
102 |
-
* None of '+=' or 'array_merge_recursive' can do this correct
|
103 |
-
*/
|
104 |
-
foreach($_FILES['groups']['name'] as $groupName => $group) {
|
105 |
-
if (is_array($group)) {
|
106 |
-
foreach ($group['fields'] as $fieldName => $field) {
|
107 |
-
if (!empty($field['value'])) {
|
108 |
-
$groups[$groupName]['fields'][$fieldName] = array('value' => $field['value']);
|
109 |
-
}
|
110 |
-
}
|
111 |
-
}
|
112 |
-
}
|
113 |
-
}
|
114 |
-
|
115 |
-
#set the tax class id for the product
|
116 |
-
$this->get_product_exactor_tax_class_id();
|
117 |
-
|
118 |
-
#reset the shipping groups value to the exactor taxes class
|
119 |
-
$groups["classes"]["fields"]["shipping_tax_class"]["value"] = $this->tax_class_id;
|
120 |
-
|
121 |
-
#reset the calculate tax after discount values to 1
|
122 |
-
$groups["calculation"]["fields"]["apply_after_discount"]["value"] = 1;
|
123 |
-
|
124 |
-
Mage::getModel('adminhtml/config_data')
|
125 |
-
->setSection($section)
|
126 |
-
->setWebsite($website)
|
127 |
-
->setStore($store)
|
128 |
-
->setGroups($groups)
|
129 |
-
->save();
|
130 |
-
|
131 |
-
}
|
132 |
-
|
133 |
-
#function to retrive the exactor tax class for product type
|
134 |
-
function get_product_exactor_tax_class_id($class_id = NULL)
|
135 |
-
{
|
136 |
-
#create the select object for mysql query
|
137 |
-
$select = $this->_getReadAdapter()->select();
|
138 |
-
|
139 |
-
if($class_id == NULL){
|
140 |
-
#make the select query here
|
141 |
-
$select
|
142 |
-
->from(array('main_table'=>$this->getMainTable()))
|
143 |
-
->where('class_name = ?', 'Exactor Tax Product')
|
144 |
-
->where('class_type = ?', 'PRODUCT');
|
145 |
-
|
146 |
-
#query the database to fetch the rows
|
147 |
-
$resultSet = $this->_getReadAdapter()->fetchAll($select);
|
148 |
-
|
149 |
-
#get the tax class id
|
150 |
-
$this->tax_class_id = $resultSet[0]['class_id'];
|
151 |
-
}
|
152 |
-
else{
|
153 |
-
|
154 |
-
#make the select query here
|
155 |
-
$select
|
156 |
-
->from(array('main_table'=>$this->getMainTable()))
|
157 |
-
->where('class_id = ?', $class_id);
|
158 |
-
|
159 |
-
#query the database to fetch the rows
|
160 |
-
$resultSet = $this->_getReadAdapter()->fetchAll($select);
|
161 |
-
|
162 |
-
#return the tax class name
|
163 |
-
return $resultSet[0]['class_name'];
|
164 |
-
}
|
165 |
-
}
|
166 |
-
}
|
167 |
-
|
168 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/Adminhtml/Model/Sales/Order/Create.php
DELETED
@@ -1,118 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Adminhtml
|
23 |
-
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Order create model
|
29 |
-
*
|
30 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
31 |
-
*/
|
32 |
-
class Exactor_Adminhtml_Model_Sales_Order_Create extends Mage_Adminhtml_Model_Sales_Order_Create
|
33 |
-
{
|
34 |
-
public function __construct()
|
35 |
-
{
|
36 |
-
parent::__construct();
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Create new order
|
41 |
-
*
|
42 |
-
* @return Mage_Sales_Model_Order
|
43 |
-
*/
|
44 |
-
public function createOrder()
|
45 |
-
{
|
46 |
-
$this->_validate();
|
47 |
-
$quote = $this->getQuote();
|
48 |
-
$this->_prepareCustomer();
|
49 |
-
$this->_prepareQuoteItems();
|
50 |
-
|
51 |
-
if (! $quote->getCustomer()->getId() || ! $quote->getCustomer()->isInStore($this->getSession()->getStore())) {
|
52 |
-
$quote->getCustomer()->sendNewAccountEmail('registered', '', $quote->getStoreId());
|
53 |
-
}
|
54 |
-
|
55 |
-
$service = Mage::getModel('sales/service_quote', $quote);
|
56 |
-
if ($this->getSession()->getOrder()->getId()) {
|
57 |
-
$oldOrder = $this->getSession()->getOrder();
|
58 |
-
$originalId = $oldOrder->getOriginalIncrementId() ? $oldOrder->getOriginalIncrementId() : $oldOrder->getIncrementId();
|
59 |
-
$orderData = array(
|
60 |
-
'original_increment_id' => $originalId,
|
61 |
-
'relation_parent_id' => $oldOrder->getId(),
|
62 |
-
'relation_parent_real_id' => $oldOrder->getIncrementId(),
|
63 |
-
'edit_increment' => $oldOrder->getEditIncrement()+1,
|
64 |
-
'increment_id' => $originalId.'-'.($oldOrder->getEditIncrement()+1)
|
65 |
-
);
|
66 |
-
$quote->setReservedOrderId($orderData['increment_id']);
|
67 |
-
$service->setOrderData($orderData);
|
68 |
-
}
|
69 |
-
$order = $service->submit();
|
70 |
-
|
71 |
-
if ($this->getSession()->getOrder()->getId()) {
|
72 |
-
$oldOrder = $this->getSession()->getOrder();
|
73 |
-
|
74 |
-
$this->getSession()->getOrder()->setRelationChildId($order->getId());
|
75 |
-
$this->getSession()->getOrder()->setRelationChildRealId($order->getIncrementId());
|
76 |
-
$this->getSession()->getOrder()->cancel()->save();
|
77 |
-
$order->save();
|
78 |
-
}
|
79 |
-
|
80 |
-
if ($this->getSendConfirmation()) {
|
81 |
-
$order->sendNewOrderEmail();
|
82 |
-
}
|
83 |
-
|
84 |
-
#commit the exactor transaction for refunding the amount and commiting the new order
|
85 |
-
#at exactor API
|
86 |
-
$this->set_exactor_commit_refund($order,$quote);
|
87 |
-
|
88 |
-
return $order;
|
89 |
-
}
|
90 |
-
|
91 |
-
#function to commit the admin side created order and to refund the
|
92 |
-
#the previous transactions
|
93 |
-
function set_exactor_commit_refund($order=null,$quote=null) {
|
94 |
-
|
95 |
-
if($order!=null && $quote!=null) {
|
96 |
-
|
97 |
-
#get the exactor tax class model here
|
98 |
-
$this->exactor_tax_model = Mage::getSingleton('exactor_tax/Observer');
|
99 |
-
|
100 |
-
$newOrderId = $order->getIncrementId();
|
101 |
-
|
102 |
-
if((int)$order->getEditIncrement()==1) {
|
103 |
-
|
104 |
-
$OldOrderId = $order->getOriginalIncrementId();
|
105 |
-
} else {
|
106 |
-
|
107 |
-
$OldOrderId = $order->getOriginalIncrementId()."-".($order->getEditIncrement()-1);
|
108 |
-
}
|
109 |
-
|
110 |
-
#commit the old order for refund as new order is created
|
111 |
-
$this->exactor_tax_model->exactordetails_helper->refund_older_order_transaction($OldOrderId,$this->exactor_tax_model);
|
112 |
-
|
113 |
-
#commit the new order at exactor API
|
114 |
-
$this->exactor_tax_model->commitExactor_Transaction_Onepage($newOrderId);
|
115 |
-
}
|
116 |
-
}
|
117 |
-
|
118 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/Adminhtml/etc/config.xml
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
<?xml version="1.0" ?>
|
2 |
-
<!--
|
3 |
-
/**
|
4 |
-
* Magento
|
5 |
-
*
|
6 |
-
* NOTICE OF LICENSE
|
7 |
-
*
|
8 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://opensource.org/licenses/afl-3.0.php
|
12 |
-
* If you did not receive a copy of the license and are unable to
|
13 |
-
* obtain it through the world-wide-web, please send an email
|
14 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
-
*
|
16 |
-
* DISCLAIMER
|
17 |
-
*
|
18 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
-
* versions in the future. If you wish to customize Magento for your
|
20 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
-
*
|
22 |
-
* @category Exactor
|
23 |
-
* @package Exactor_Adminhtml
|
24 |
-
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
25 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
-
*/
|
27 |
-
-->
|
28 |
-
<config>
|
29 |
-
<modules>
|
30 |
-
<Exactor_Adminhtml>
|
31 |
-
<version>2012.03.26</version>
|
32 |
-
</Exactor_Adminhtml>
|
33 |
-
</modules>
|
34 |
-
|
35 |
-
<global>
|
36 |
-
<models>
|
37 |
-
<exactor_adminhtml>
|
38 |
-
<class>Exactor_Adminhtml_Model</class>
|
39 |
-
</exactor_adminhtml>
|
40 |
-
<adminhtml>
|
41 |
-
<rewrite>
|
42 |
-
<sales_order_create>Exactor_Adminhtml_Model_Sales_Order_Create</sales_order_create>
|
43 |
-
</rewrite>
|
44 |
-
</adminhtml>
|
45 |
-
</models>
|
46 |
-
<events>
|
47 |
-
<catalog_product_prepare_save>
|
48 |
-
<observers>
|
49 |
-
<exactor_adminhtml_observer>
|
50 |
-
<type>singleton</type>
|
51 |
-
<class>Exactor_Adminhtml_Model_Observer</class>
|
52 |
-
<method>alter_product_before_save</method>
|
53 |
-
</exactor_adminhtml_observer>
|
54 |
-
</observers>
|
55 |
-
</catalog_product_prepare_save>
|
56 |
-
<admin_system_config_changed_section_tax>
|
57 |
-
<observers>
|
58 |
-
<exactor_adminhtml_observer>
|
59 |
-
<type>singleton</type>
|
60 |
-
<class>Exactor_Adminhtml_Model_Observer</class>
|
61 |
-
<method>alter_shipping_tax_class</method>
|
62 |
-
</exactor_adminhtml_observer>
|
63 |
-
</observers>
|
64 |
-
</admin_system_config_changed_section_tax>
|
65 |
-
</events>
|
66 |
-
</global>
|
67 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/Checkout/Block/Cart/Totals.php
DELETED
@@ -1,60 +0,0 @@
|
|
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 |
-
/**
|
28 |
-
* Exactordetails block
|
29 |
-
*
|
30 |
-
* @category Exactor
|
31 |
-
* @package Exactor_Exactordetails
|
32 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
-
*/
|
34 |
-
|
35 |
-
class Exactor_Checkout_Block_Cart_Totals extends Mage_Checkout_Block_Cart_Totals {
|
36 |
-
|
37 |
-
public function renderTotals($area = null, $colspan = 1)
|
38 |
-
{
|
39 |
-
$html = '';
|
40 |
-
|
41 |
-
foreach($this->getTotals() as $total) {
|
42 |
-
if ($total->getArea() != $area && $area != -1) {
|
43 |
-
continue;
|
44 |
-
}
|
45 |
-
|
46 |
-
// Add Sales Tax line for check Out Page Here
|
47 |
-
if ($total->getCode() == "tax") {
|
48 |
-
|
49 |
-
$total->setTitle('Sales Tax');
|
50 |
-
}
|
51 |
-
|
52 |
-
$html .= $this->renderTotal($total, $area, $colspan);
|
53 |
-
}
|
54 |
-
|
55 |
-
return $html;
|
56 |
-
}
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/Checkout/Model/Observer.php
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<?php
|
2 |
* Magento
|
3 |
*
|
4 |
* NOTICE OF LICENSE
|
5 |
*
|
6 |
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
* that is bundled with this package in the file LICENSE.txt.
|
8 |
* It is also available through the world-wide-web at this URL:
|
9 |
* http://opensource.org/licenses/osl-3.0.php
|
10 |
* If you did not receive a copy of the license and are unable to
|
11 |
* obtain it through the world-wide-web, please send an email
|
12 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
13 |
*
|
14 |
* DISCLAIMER
|
15 |
*
|
16 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
17 |
* versions in the future. If you wish to customize Magento for your
|
18 |
* needs please refer to http://www.magentocommerce.com for more information.
|
19 |
*
|
20 |
* @category Exactor
|
21 |
* @package Exactor_Checkout
|
22 |
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
23 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
24 |
*/
|
25 |
* Exactor Checkout observer model
|
26 |
*
|
27 |
* @category Exactor
|
28 |
* @package Exactor_Checkout
|
29 |
* @author Magento Core Team <core@magentocommerce.com>
|
30 |
*/
|
31 |
|
|
|
0 |
* Magento
|
1 |
*
|
2 |
* NOTICE OF LICENSE
|
3 |
*
|
4 |
* This source file is subject to the Open Software License (OSL 3.0)
|
5 |
* that is bundled with this package in the file LICENSE.txt.
|
6 |
* It is also available through the world-wide-web at this URL:
|
7 |
* http://opensource.org/licenses/osl-3.0.php
|
8 |
* If you did not receive a copy of the license and are unable to
|
9 |
* obtain it through the world-wide-web, please send an email
|
10 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
11 |
*
|
12 |
* DISCLAIMER
|
13 |
*
|
14 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
15 |
* versions in the future. If you wish to customize Magento for your
|
16 |
* needs please refer to http://www.magentocommerce.com for more information.
|
17 |
*
|
18 |
* @category Exactor
|
19 |
* @package Exactor_Checkout
|
20 |
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
*/
|
23 |
* Exactor Checkout observer model
|
24 |
*
|
25 |
* @category Exactor
|
26 |
* @package Exactor_Checkout
|
27 |
* @author Magento Core Team <core@magentocommerce.com>
|
28 |
*/
|
29 |
|
app/code/local/Exactor/Checkout/etc/config.xml
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
<?xml version="1.0" ?>
|
2 |
-
<!--
|
3 |
-
/**
|
4 |
-
* Magento
|
5 |
-
*
|
6 |
-
* NOTICE OF LICENSE
|
7 |
-
*
|
8 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://opensource.org/licenses/afl-3.0.php
|
12 |
-
* If you did not receive a copy of the license and are unable to
|
13 |
-
* obtain it through the world-wide-web, please send an email
|
14 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
-
*
|
16 |
-
* DISCLAIMER
|
17 |
-
*
|
18 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
-
* versions in the future. If you wish to customize Magento for your
|
20 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
-
*
|
22 |
-
* @category Exactor
|
23 |
-
* @package Exactor_Checkout
|
24 |
-
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
25 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
-
*/
|
27 |
-
-->
|
28 |
-
<config>
|
29 |
-
<modules>
|
30 |
-
<Exactor_Checkout>
|
31 |
-
<version>2012.03.26</version>
|
32 |
-
</Exactor_Checkout>
|
33 |
-
</modules>
|
34 |
-
|
35 |
-
<global>
|
36 |
-
<models>
|
37 |
-
<exactor_checkout>
|
38 |
-
<class>Exactor_Checkout_Model</class>
|
39 |
-
</exactor_checkout>
|
40 |
-
</models>
|
41 |
-
<events>
|
42 |
-
<checkout_type_onepage_save_order_after>
|
43 |
-
<observers>
|
44 |
-
<exactor_checkout_observer>
|
45 |
-
<type>singleton</type>
|
46 |
-
<class>Exactor_Checkout_Model_Observer</class>
|
47 |
-
<method>commit_exactor_transaction</method>
|
48 |
-
</exactor_checkout_observer>
|
49 |
-
</observers>
|
50 |
-
</checkout_type_onepage_save_order_after>
|
51 |
-
<checkout_type_multishipping_create_orders_single>
|
52 |
-
<observers>
|
53 |
-
<exactor_checkout_observer>
|
54 |
-
<type>singleton</type>
|
55 |
-
<class>Exactor_Checkout_Model_Observer</class>
|
56 |
-
<method>commit_exactor_transaction</method>
|
57 |
-
</exactor_checkout_observer>
|
58 |
-
</observers>
|
59 |
-
</checkout_type_multishipping_create_orders_single>
|
60 |
-
</events>
|
61 |
-
<blocks>
|
62 |
-
<checkout>
|
63 |
-
<rewrite>
|
64 |
-
<cart_totals>Exactor_Checkout_Block_Cart_Totals</cart_totals>
|
65 |
-
</rewrite>
|
66 |
-
</checkout>
|
67 |
-
</blocks>
|
68 |
-
</global>
|
69 |
-
<frontend>
|
70 |
-
<layout>
|
71 |
-
<updates>
|
72 |
-
<checkout>
|
73 |
-
<!--<file>exactoronestepcheckout.xml</file>-->
|
74 |
-
</checkout>
|
75 |
-
</updates>
|
76 |
-
</layout>
|
77 |
-
</frontend>
|
78 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/Core/Helper/SessionCache.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* User: LOGICIFY\corvis
|
4 |
+
* Date: 4/23/12
|
5 |
+
* Time: 7:05 PM
|
6 |
+
*/
|
7 |
+
|
8 |
+
class Exactor_Core_Helper_SessionCache extends Mage_Core_Helper_Abstract{
|
9 |
+
/**
|
10 |
+
* @var IExactorLogger
|
11 |
+
*/
|
12 |
+
private $logger;
|
13 |
+
/** @var Mage_Core_Model_Session */
|
14 |
+
private $magentoSession;
|
15 |
+
|
16 |
+
public function __construct()
|
17 |
+
{
|
18 |
+
$this->logger = ExactorLoggingFactory::getInstance()->getLogger($this);
|
19 |
+
$this->magentoSession = Mage::getSingleton('core/session');
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Returns the latest tax calculation response from the session or null if nothing to fetch
|
24 |
+
* @param null $internalId
|
25 |
+
* @return ExactorTransactionInfo
|
26 |
+
*/
|
27 |
+
public function getLatestTransactionInfo($internalId=null){
|
28 |
+
$transactionArray = $this->fetchAll();
|
29 |
+
if ($internalId==null){
|
30 |
+
if (count($transactionArray) > 0)
|
31 |
+
return $transactionArray[0];
|
32 |
+
}else{
|
33 |
+
foreach ($transactionArray as $trn){
|
34 |
+
if ($trn->getShoppingCartTrnId() == $internalId) return $trn;
|
35 |
+
}
|
36 |
+
}
|
37 |
+
return null;
|
38 |
+
}
|
39 |
+
|
40 |
+
public function popTransactionInfo(){
|
41 |
+
$transactionsArray = $this->fetchAll();
|
42 |
+
if (count($transactionsArray) == 0) return;
|
43 |
+
$result = array_shift($transactionsArray);
|
44 |
+
$this->magentoSession->setExactorTransactionInfoArray(serialize($transactionsArray));
|
45 |
+
return $result;
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Remove all existing information from the session cache
|
50 |
+
* @return void
|
51 |
+
*/
|
52 |
+
public function clear(){
|
53 |
+
$this->magentoSession->setExactorTransactionInfo(null);
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Returns array with all transactions that are stored into the session cache at the moment
|
58 |
+
* @return array of ExactorTransactionInfo
|
59 |
+
*/
|
60 |
+
public function fetchAll(){
|
61 |
+
$serializedTransactionInfo = $this->magentoSession->getExactorTransactionInfoArray();
|
62 |
+
$transactionsArray = array();
|
63 |
+
if ($serializedTransactionInfo != null)
|
64 |
+
$transactionsArray = unserialize($serializedTransactionInfo);
|
65 |
+
return $transactionsArray;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Pushes transaction info into the session
|
70 |
+
* @param ExactorTransactionInfo $transactionInfo
|
71 |
+
* @return void
|
72 |
+
*/
|
73 |
+
public function pushTransactionInfo(ExactorTransactionInfo $transactionInfo){
|
74 |
+
$this->logger->debug('Pushing transaction ' . $transactionInfo->getExactorTrnId() . ' to the session cache', 'pushTransactionInfo');
|
75 |
+
$serializedTransactionInfo = $this->magentoSession->getExactorTransactionInfoArray();
|
76 |
+
$transactionsArray = array();
|
77 |
+
if ($serializedTransactionInfo != null)
|
78 |
+
$transactionsArray = unserialize($serializedTransactionInfo);
|
79 |
+
array_unshift($transactionsArray, $transactionInfo);
|
80 |
+
$this->magentoSession->setExactorTransactionInfoArray(serialize($transactionsArray));
|
81 |
+
}
|
82 |
+
}
|
app/code/local/Exactor/{Exactordetails/Model/Exactortransactiondetails.php → Core/Model/ExactorTransaction.php}
RENAMED
@@ -1,119 +1,117 @@
|
|
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 |
-
|
28 |
-
/**
|
29 |
-
* Exactor
|
30 |
-
*
|
31 |
-
* @category Exactor
|
32 |
-
* @package
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
{
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
}
|
119 |
-
}
|
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 |
+
|
28 |
+
/**
|
29 |
+
* Exactor Transaction
|
30 |
+
*
|
31 |
+
* @category Exactor
|
32 |
+
* @package Exactor_ExactorSettings
|
33 |
+
*/
|
34 |
+
|
35 |
+
class Exactor_Core_Model_ExactorTransaction extends Mage_Core_Model_Abstract
|
36 |
+
{
|
37 |
+
protected function _construct() {
|
38 |
+
$this->_init('ExactorTransaction/ExactorTransaction');
|
39 |
+
}
|
40 |
+
|
41 |
+
function getID() {
|
42 |
+
|
43 |
+
return $this->getData("ID");
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
+
function setID($ID) {
|
48 |
+
|
49 |
+
$this->setData("ID",$ID);
|
50 |
+
}
|
51 |
+
|
52 |
+
function getTransactionID() {
|
53 |
+
|
54 |
+
return $this->getData("TransactionID");
|
55 |
+
}
|
56 |
+
|
57 |
+
|
58 |
+
function setTransactionID($TransactionID) {
|
59 |
+
|
60 |
+
$this->setData("TransactionID",$TransactionID);
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
function getOrderID() {
|
65 |
+
|
66 |
+
return $this->getData("OrderID");
|
67 |
+
}
|
68 |
+
|
69 |
+
|
70 |
+
function setOrderID($OrderID) {
|
71 |
+
|
72 |
+
$this->setData("OrderID",$OrderID);
|
73 |
+
}
|
74 |
+
|
75 |
+
|
76 |
+
function getUserID() {
|
77 |
+
|
78 |
+
return $this->getData("UserID");
|
79 |
+
}
|
80 |
+
|
81 |
+
|
82 |
+
function setUserID($UserID) {
|
83 |
+
|
84 |
+
$this->setData("UserID",$UserID);
|
85 |
+
}
|
86 |
+
|
87 |
+
function getMerchantID() {
|
88 |
+
|
89 |
+
return $this->getData("MerchantID");
|
90 |
+
}
|
91 |
+
|
92 |
+
|
93 |
+
function setMerchantID($MerchantID) {
|
94 |
+
|
95 |
+
$this->setData("MerchantID",$MerchantID);
|
96 |
+
}
|
97 |
+
|
98 |
+
function getCommited() {
|
99 |
+
$int = $this->getData("Commited");
|
100 |
+
return ($int>0);
|
101 |
+
}
|
102 |
+
|
103 |
+
function setCommited($Commited) {
|
104 |
+
$int = $Commited ? 1 : 0;
|
105 |
+
$this->setData("Commited",$int);
|
106 |
+
}
|
107 |
+
|
108 |
+
function getDateOfOrder() {
|
109 |
+
|
110 |
+
return $this->getData("DateOfOrder");
|
111 |
+
}
|
112 |
+
|
113 |
+
function setDateOfOrder($DateOfOrder) {
|
114 |
+
|
115 |
+
$this->setData("DateOfOrder",$DateOfOrder);
|
116 |
+
}
|
117 |
+
}
|
|
|
|
app/code/local/Exactor/Core/Model/MerchantSettings.php
ADDED
@@ -0,0 +1,279 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* User: LOGICIFY\corvis
|
4 |
+
* Date: 4/20/12
|
5 |
+
* Time: 4:46 PM
|
6 |
+
*/
|
7 |
+
|
8 |
+
class Exactor_Core_Model_MerchantSettings extends Mage_Core_Model_Abstract
|
9 |
+
{
|
10 |
+
// Commit Options
|
11 |
+
const COMMIT_ON_SALES_ORDER = "SL";
|
12 |
+
const COMMIT_ON_INVOICE = "IN";
|
13 |
+
const COMMIT_ON_SHIPMENT = "SP";
|
14 |
+
const COMMIT_NEVER = "NV";
|
15 |
+
// Sku Sources
|
16 |
+
const SKU_SOURCE_NONE = 'NA';
|
17 |
+
const SKU_SOURCE_SKU_FIELD = 'SK';
|
18 |
+
const SKU_SOURCE_ATTRIBUTE_NAME = 'AN';
|
19 |
+
const SKU_SOURCE_TAX_CLASS = 'TC';
|
20 |
+
const SKU_SOURCE_PRODUCT_CATEGORY = 'PC';
|
21 |
+
|
22 |
+
protected $commitOptions = array(self::COMMIT_ON_SALES_ORDER => "Sales order", self::COMMIT_ON_INVOICE =>"Invoice", self::COMMIT_ON_SHIPMENT => "Shipment", self::COMMIT_NEVER => "Never");
|
23 |
+
protected $skuSources = array(self::SKU_SOURCE_SKU_FIELD => 'SKU Field',
|
24 |
+
self::SKU_SOURCE_ATTRIBUTE_NAME => 'Attribute Set Name',
|
25 |
+
self::SKU_SOURCE_TAX_CLASS => 'Tax Class',
|
26 |
+
self::SKU_SOURCE_PRODUCT_CATEGORY => 'Product Category',
|
27 |
+
self::SKU_SOURCE_NONE => 'None'
|
28 |
+
);
|
29 |
+
|
30 |
+
protected function _construct()
|
31 |
+
{
|
32 |
+
$this->_init('MerchantSettings/MerchantSettings');
|
33 |
+
}
|
34 |
+
|
35 |
+
function getID()
|
36 |
+
{
|
37 |
+
|
38 |
+
return $this->getData("ID");
|
39 |
+
}
|
40 |
+
|
41 |
+
function setID($ID)
|
42 |
+
{
|
43 |
+
|
44 |
+
$this->setData("ID", $ID);
|
45 |
+
}
|
46 |
+
|
47 |
+
function getCommitOptionsList()
|
48 |
+
{
|
49 |
+
return $this->commitOptions;
|
50 |
+
}
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
function getCommitOptionDescription()
|
55 |
+
{
|
56 |
+
return $this->commitOptions[$this->getCommitOption()];
|
57 |
+
}
|
58 |
+
|
59 |
+
function getStoreViewID()
|
60 |
+
{
|
61 |
+
|
62 |
+
return $this->getData("StoreViewID");
|
63 |
+
}
|
64 |
+
|
65 |
+
function setStoreViewID($StoreViewID)
|
66 |
+
{
|
67 |
+
|
68 |
+
$this->setData("StoreViewID", $StoreViewID);
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
function getMerchantID()
|
73 |
+
{
|
74 |
+
|
75 |
+
return $this->getData("MerchantID");
|
76 |
+
}
|
77 |
+
|
78 |
+
|
79 |
+
function setMerchantID($MerchantID)
|
80 |
+
{
|
81 |
+
$this->setData("MerchantID", $MerchantID);
|
82 |
+
}
|
83 |
+
|
84 |
+
|
85 |
+
function getUserID()
|
86 |
+
{
|
87 |
+
return $this->getData("UserID");
|
88 |
+
}
|
89 |
+
|
90 |
+
|
91 |
+
function setUserID($UserID)
|
92 |
+
{
|
93 |
+
$this->setData("UserID", $UserID);
|
94 |
+
}
|
95 |
+
|
96 |
+
function getFullName()
|
97 |
+
{
|
98 |
+
return $this->getData("FullName");
|
99 |
+
}
|
100 |
+
|
101 |
+
|
102 |
+
function setFullName($FullName)
|
103 |
+
{
|
104 |
+
$this->setData("FullName", $FullName);
|
105 |
+
}
|
106 |
+
|
107 |
+
|
108 |
+
function getStreet1()
|
109 |
+
{
|
110 |
+
return $this->getData("Street1");
|
111 |
+
}
|
112 |
+
|
113 |
+
|
114 |
+
function setStreet1($Street1)
|
115 |
+
{
|
116 |
+
$this->setData("Street1", $Street1);
|
117 |
+
}
|
118 |
+
|
119 |
+
|
120 |
+
function getStreet2()
|
121 |
+
{
|
122 |
+
return $this->getData("Street2");
|
123 |
+
}
|
124 |
+
|
125 |
+
|
126 |
+
function setStreet2($Street2)
|
127 |
+
{
|
128 |
+
$this->setData("Street2", $Street2);
|
129 |
+
}
|
130 |
+
|
131 |
+
|
132 |
+
function getCity()
|
133 |
+
{
|
134 |
+
return $this->getData("City");
|
135 |
+
}
|
136 |
+
|
137 |
+
|
138 |
+
function setCity($City)
|
139 |
+
{
|
140 |
+
$this->setData("City", $City);
|
141 |
+
}
|
142 |
+
|
143 |
+
|
144 |
+
function getStateOrProvince()
|
145 |
+
{
|
146 |
+
|
147 |
+
return $this->getData("StateOrProvince");
|
148 |
+
}
|
149 |
+
|
150 |
+
|
151 |
+
function setStateOrProvince($StateOrProvince)
|
152 |
+
{
|
153 |
+
|
154 |
+
$this->setData("StateOrProvince", $StateOrProvince);
|
155 |
+
}
|
156 |
+
|
157 |
+
|
158 |
+
function getPostalCode()
|
159 |
+
{
|
160 |
+
|
161 |
+
return $this->getData("PostalCode");
|
162 |
+
}
|
163 |
+
|
164 |
+
|
165 |
+
function setPostalCode($PostalCode)
|
166 |
+
{
|
167 |
+
|
168 |
+
$this->setData("PostalCode", $PostalCode);
|
169 |
+
}
|
170 |
+
|
171 |
+
|
172 |
+
function getCountry()
|
173 |
+
{
|
174 |
+
|
175 |
+
return $this->getData("Country");
|
176 |
+
}
|
177 |
+
|
178 |
+
|
179 |
+
function setCountry($Country)
|
180 |
+
{
|
181 |
+
|
182 |
+
$this->setData("Country", $Country);
|
183 |
+
}
|
184 |
+
|
185 |
+
|
186 |
+
function isShippingIncludeHandling()
|
187 |
+
{
|
188 |
+
|
189 |
+
return $this->getData("ShippingCharges");
|
190 |
+
}
|
191 |
+
|
192 |
+
|
193 |
+
function setShippingIncludeHandling($shippingIncludeHandling)
|
194 |
+
{
|
195 |
+
|
196 |
+
$this->setData("ShippingCharges", $shippingIncludeHandling);
|
197 |
+
}
|
198 |
+
|
199 |
+
|
200 |
+
function getSourceOfSKU()
|
201 |
+
{
|
202 |
+
|
203 |
+
return $this->getData("SourceofSKU");
|
204 |
+
}
|
205 |
+
|
206 |
+
|
207 |
+
function setSourceOfSKU($SourceOfSKU)
|
208 |
+
{
|
209 |
+
|
210 |
+
$this->setData("SourceofSKU", $SourceOfSKU);
|
211 |
+
}
|
212 |
+
|
213 |
+
function getCommitOption()
|
214 |
+
{
|
215 |
+
|
216 |
+
return $this->getData("CommitOption");
|
217 |
+
}
|
218 |
+
|
219 |
+
|
220 |
+
function setCommitOption($CommitOption)
|
221 |
+
{
|
222 |
+
if (!array_key_exists($CommitOption, $this->commitOptions)) {
|
223 |
+
throw new InvalidArgumentException("Invalid value for commit option. Possible values are: "
|
224 |
+
+ implode(", ", array_values($this->commitOptions)));
|
225 |
+
}
|
226 |
+
$this->setData("CommitOption", $CommitOption);
|
227 |
+
}
|
228 |
+
|
229 |
+
function getExactorShippingAddress(){
|
230 |
+
$address = new AddressType();
|
231 |
+
$address->setCity($this->getCity());
|
232 |
+
$address->setCountry($this->getCountry());
|
233 |
+
$address->setFullName($this->getFullName());
|
234 |
+
$address->setPostalCode($this->getPostalCode());
|
235 |
+
$address->setStateOrProvince($this->getStateOrProvince());
|
236 |
+
$address->setStreet1($this->getStreet1());
|
237 |
+
$address->setStreet2($this->getStreet2());
|
238 |
+
return $address;
|
239 |
+
}
|
240 |
+
|
241 |
+
function getExemptionsSupported()
|
242 |
+
{
|
243 |
+
return strlen($this->getData("EntityExemptions"))>0 && $this->getData("EntityExemptions")=='1';
|
244 |
+
}
|
245 |
+
|
246 |
+
function setExemptionsSupported($exemptionsSupported)
|
247 |
+
{
|
248 |
+
$this->setData("EntityExemptions", $exemptionsSupported);
|
249 |
+
}
|
250 |
+
|
251 |
+
public function getSkuSourcesList()
|
252 |
+
{
|
253 |
+
return $this->skuSources;
|
254 |
+
}
|
255 |
+
|
256 |
+
private function valueOrDefaultFromArray($array, $key, $default=null){
|
257 |
+
if (array_key_exists($key,$array))
|
258 |
+
return $array[$key] == null ? $default : $array[$key];
|
259 |
+
else
|
260 |
+
return $default;
|
261 |
+
}
|
262 |
+
|
263 |
+
public function populateFromArray($array){
|
264 |
+
$this->setCity($this->valueOrDefaultFromArray($array, 'City'));
|
265 |
+
$this->setCommitOption($this->valueOrDefaultFromArray($array, 'CommitOption'));
|
266 |
+
$this->setCountry($this->valueOrDefaultFromArray($array, 'Country'));
|
267 |
+
$this->setExemptionsSupported($this->valueOrDefaultFromArray($array, 'EntityExemptions'));
|
268 |
+
$this->setFullName($this->valueOrDefaultFromArray($array, 'FullName'));
|
269 |
+
$this->setMerchantID($this->valueOrDefaultFromArray($array, 'MerchantID'));
|
270 |
+
$this->setUserID($this->valueOrDefaultFromArray($array, 'UserID'));
|
271 |
+
$this->setPostalCode($this->valueOrDefaultFromArray($array, 'PostalCode'));
|
272 |
+
$this->setShippingIncludeHandling($this->valueOrDefaultFromArray($array, 'ShippingCharges'));
|
273 |
+
$this->setSourceOfSKU($this->valueOrDefaultFromArray($array, 'SourceofSKU'));
|
274 |
+
$this->setStateOrProvince($this->valueOrDefaultFromArray($array, 'StateOrProvince'));
|
275 |
+
$this->setStoreViewID($this->valueOrDefaultFromArray($array, 'StoreViewID'));
|
276 |
+
$this->setStreet1($this->valueOrDefaultFromArray($array, 'Street1'));
|
277 |
+
$this->setStreet2($this->valueOrDefaultFromArray($array, 'Street2'));
|
278 |
+
}
|
279 |
+
}
|
app/code/local/Exactor/Core/Model/Mysql4/ExactorTransaction.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
* Magento
|
1 |
*
|
2 |
* NOTICE OF LICENSE
|
3 |
*
|
4 |
* This source file is subject to the Open Software License (OSL 3.0)
|
5 |
* that is bundled with this package in the file LICENSE.txt.
|
6 |
* It is also available through the world-wide-web at this URL:
|
7 |
* http://opensource.org/licenses/osl-3.0.php
|
8 |
* If you did not receive a copy of the license and are unable to
|
9 |
* obtain it through the world-wide-web, please send an email
|
10 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
11 |
*
|
12 |
* DISCLAIMER
|
13 |
*
|
14 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
15 |
* versions in the future. If you wish to customize Magento for your
|
16 |
* needs please refer to http://www.magentocommerce.com for more information.
|
17 |
*
|
18 |
* @category Exactor
|
19 |
* @package Exactor_Exactordetails
|
20 |
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
*/
|
23 |
* Resource model for Exactor Exactordetails
|
24 |
*
|
25 |
* @category Exactor
|
26 |
* @package Exactor_Exactordetails
|
27 |
* @author Magento Core Team <core@magentocommerce.com>
|
28 |
*/
|
29 |
|
30 |
protected function _construct()
|
31 |
{
|
32 |
$this->_init('ExactorTransaction/ExactorTransaction', 'ID');
|
33 |
}
|
1 |
+
<?php
|
2 |
* Magento
|
3 |
*
|
4 |
* NOTICE OF LICENSE
|
5 |
*
|
6 |
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
* that is bundled with this package in the file LICENSE.txt.
|
8 |
* It is also available through the world-wide-web at this URL:
|
9 |
* http://opensource.org/licenses/osl-3.0.php
|
10 |
* If you did not receive a copy of the license and are unable to
|
11 |
* obtain it through the world-wide-web, please send an email
|
12 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
13 |
*
|
14 |
* DISCLAIMER
|
15 |
*
|
16 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
17 |
* versions in the future. If you wish to customize Magento for your
|
18 |
* needs please refer to http://www.magentocommerce.com for more information.
|
19 |
*
|
20 |
* @category Exactor
|
21 |
* @package Exactor_Exactordetails
|
22 |
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
23 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
24 |
*/
|
25 |
* Resource model for Exactor Exactordetails
|
26 |
*
|
27 |
* @category Exactor
|
28 |
* @package Exactor_Exactordetails
|
29 |
* @author Magento Core Team <core@magentocommerce.com>
|
30 |
*/
|
31 |
|
32 |
protected function _construct()
|
33 |
{
|
34 |
$this->_init('ExactorTransaction/ExactorTransaction', 'ID');
|
35 |
}
|
app/code/local/Exactor/{Exactordetails/Model/Mysql4/Exactortransactiondetails → Core/Model/Mysql4/ExactorTransaction}/Collection.php
RENAMED
@@ -24,17 +24,11 @@
|
|
24 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
*
|
30 |
-
* @category Exactor
|
31 |
-
* @package Exactor_Exactordetails
|
32 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
-
*/
|
34 |
-
class Exactor_Exactordetails_Model_Mysql4_Exactortransactiondetails_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
35 |
|
36 |
protected function _construct()
|
37 |
{
|
38 |
-
|
39 |
}
|
40 |
}
|
24 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
|
27 |
+
|
28 |
+
class Exactor_Core_Model_Mysql4_ExactorTransaction_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
protected function _construct()
|
31 |
{
|
32 |
+
$this->_init('Exactor_Core_Model_ExactorTransaction');
|
33 |
}
|
34 |
}
|
app/code/local/Exactor/{Exactordetails/Model/Mysql4/Exactoraccount.php → Core/Model/Mysql4/MerchantSettings.php}
RENAMED
@@ -1 +1 @@
|
|
1 |
-
<?php
|
2 |
* Magento
|
3 |
*
|
4 |
* NOTICE OF LICENSE
|
5 |
*
|
6 |
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
* that is bundled with this package in the file LICENSE.txt.
|
8 |
* It is also available through the world-wide-web at this URL:
|
9 |
* http://opensource.org/licenses/osl-3.0.php
|
10 |
* If you did not receive a copy of the license and are unable to
|
11 |
* obtain it through the world-wide-web, please send an email
|
12 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
13 |
*
|
14 |
* DISCLAIMER
|
15 |
*
|
16 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
17 |
* versions in the future. If you wish to customize Magento for your
|
18 |
* needs please refer to http://www.magentocommerce.com for more information.
|
19 |
*
|
20 |
* @category Exactor
|
21 |
* @package Exactor_Exactordetails
|
22 |
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
23 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
24 |
*/
|
25 |
* Resource model for Exactor Exactordetails
|
26 |
*
|
27 |
* @category Exactor
|
28 |
* @package Exactor_Exactordetails
|
29 |
* @author Magento Core Team <core@magentocommerce.com>
|
30 |
*/
|
31 |
|
32 |
protected function _construct()
|
33 |
{
|
34 |
}
|
|
|
35 |
* Magento
|
36 |
*
|
37 |
* NOTICE OF LICENSE
|
38 |
*
|
39 |
* This source file is subject to the Open Software License (OSL 3.0)
|
40 |
* that is bundled with this package in the file LICENSE.txt.
|
41 |
* It is also available through the world-wide-web at this URL:
|
42 |
* http://opensource.org/licenses/osl-3.0.php
|
43 |
* If you did not receive a copy of the license and are unable to
|
44 |
* obtain it through the world-wide-web, please send an email
|
45 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
46 |
*
|
47 |
* DISCLAIMER
|
48 |
*
|
49 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
50 |
* versions in the future. If you wish to customize Magento for your
|
51 |
* needs please refer to http://www.magentocommerce.com for more information.
|
52 |
*
|
53 |
* @category Exactor
|
54 |
* @package Exactor_Exactordetails
|
55 |
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
56 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
57 |
*/
|
58 |
* Resource model for Exactor Exactordetails
|
59 |
*
|
60 |
* @category Exactor
|
61 |
* @package Exactor_Exactordetails
|
62 |
* @author Magento Core Team <core@magentocommerce.com>
|
63 |
*/
|
64 |
|
65 |
protected function _construct()
|
66 |
{
|
67 |
$this->_init('MerchantSettings/MerchantSettings', 'ID');
|
68 |
}
|
|
|
1 |
* Magento
|
2 |
*
|
3 |
* NOTICE OF LICENSE
|
4 |
*
|
5 |
* This source file is subject to the Open Software License (OSL 3.0)
|
6 |
* that is bundled with this package in the file LICENSE.txt.
|
7 |
* It is also available through the world-wide-web at this URL:
|
8 |
* http://opensource.org/licenses/osl-3.0.php
|
9 |
* If you did not receive a copy of the license and are unable to
|
10 |
* obtain it through the world-wide-web, please send an email
|
11 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
12 |
*
|
13 |
* DISCLAIMER
|
14 |
*
|
15 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
16 |
* versions in the future. If you wish to customize Magento for your
|
17 |
* needs please refer to http://www.magentocommerce.com for more information.
|
18 |
*
|
19 |
* @category Exactor
|
20 |
* @package Exactor_Exactordetails
|
21 |
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
*/
|
24 |
* Resource model for Exactor Exactordetails
|
25 |
*
|
26 |
* @category Exactor
|
27 |
* @package Exactor_Exactordetails
|
28 |
* @author Magento Core Team <core@magentocommerce.com>
|
29 |
*/
|
30 |
|
31 |
protected function _construct()
|
32 |
{
|
33 |
}
|
34 |
+
<?php
|
35 |
* Magento
|
36 |
*
|
37 |
* NOTICE OF LICENSE
|
38 |
*
|
39 |
* This source file is subject to the Open Software License (OSL 3.0)
|
40 |
* that is bundled with this package in the file LICENSE.txt.
|
41 |
* It is also available through the world-wide-web at this URL:
|
42 |
* http://opensource.org/licenses/osl-3.0.php
|
43 |
* If you did not receive a copy of the license and are unable to
|
44 |
* obtain it through the world-wide-web, please send an email
|
45 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
46 |
*
|
47 |
* DISCLAIMER
|
48 |
*
|
49 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
50 |
* versions in the future. If you wish to customize Magento for your
|
51 |
* needs please refer to http://www.magentocommerce.com for more information.
|
52 |
*
|
53 |
* @category Exactor
|
54 |
* @package Exactor_Exactordetails
|
55 |
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
56 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
57 |
*/
|
58 |
* Resource model for Exactor Exactordetails
|
59 |
*
|
60 |
* @category Exactor
|
61 |
* @package Exactor_Exactordetails
|
62 |
* @author Magento Core Team <core@magentocommerce.com>
|
63 |
*/
|
64 |
|
65 |
protected function _construct()
|
66 |
{
|
67 |
$this->_init('MerchantSettings/MerchantSettings', 'ID');
|
68 |
}
|
app/code/local/Exactor/{Exactordetails/Model/Mysql4/Exactortransactiondetails.php → Core/Model/Mysql4/MerchantSettings/Collection.php}
RENAMED
@@ -25,18 +25,10 @@
|
|
25 |
*/
|
26 |
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
class Exactor_Exactordetails_Model_Mysql4_Exactortransactiondetails extends Mage_Core_Model_Mysql4_Abstract{
|
37 |
-
|
38 |
-
protected function _construct()
|
39 |
-
{
|
40 |
-
$this->_init('exactordetails/exactortransactiondetails', 'ID');
|
41 |
-
}
|
42 |
-
}
|
25 |
*/
|
26 |
|
27 |
|
28 |
+
class Exactor_Core_Model_Mysql4_MerchantSettings_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
29 |
+
|
30 |
+
protected function _construct()
|
31 |
+
{
|
32 |
+
$this->_init('Exactor_Core_Model_MerchantSettings');
|
33 |
+
}
|
34 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/{Exactordetails/Model/Mysql4/Exactoraccount/Collection.php → Core/Model/Mysql4/MerchantSettings/Collection.php~}
RENAMED
@@ -31,10 +31,10 @@
|
|
31 |
* @package Exactor_Exactordetails
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class
|
35 |
|
36 |
protected function _construct()
|
37 |
{
|
38 |
-
$this->_init('
|
39 |
}
|
40 |
-
}
|
31 |
* @package Exactor_Exactordetails
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Exactor_Core_Model_Mysql4_MerchantSettings_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
35 |
|
36 |
protected function _construct()
|
37 |
{
|
38 |
+
$this->_init('core/MerchantSettings');
|
39 |
}
|
40 |
+
}
|
app/code/local/Exactor/Core/Model/Type/Onepage.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?
|
2 |
+
|
3 |
+
class Exactor_Core_Model_Type_Onepage extends Mage_Checkout_Model_Type_Onepage{
|
4 |
+
/** @var Mage_Core_Model_Session_Abstract */
|
5 |
+
private $session;
|
6 |
+
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
parent::__construct();
|
10 |
+
$this->session = Mage::getSingleton('core/session', array('name' => 'frontend'));
|
11 |
+
}
|
12 |
+
|
13 |
+
public function saveCheckoutMethod($method)
|
14 |
+
{
|
15 |
+
$errorResponse = $this->getErrorResponse();
|
16 |
+
if ($errorResponse != null)
|
17 |
+
return $errorResponse;
|
18 |
+
return parent::saveCheckoutMethod($method);
|
19 |
+
}
|
20 |
+
|
21 |
+
private function getErrorResponse(){
|
22 |
+
$messages = $this->session->getMessages();
|
23 |
+
if (count($messages->getErrors())>0){
|
24 |
+
$exceptionsArray = array();
|
25 |
+
foreach ($messages->getErrors() as $error){
|
26 |
+
$exceptionsArray[] = $error->getCode();
|
27 |
+
unset($error);
|
28 |
+
}
|
29 |
+
$this->session->getMessages(true);
|
30 |
+
return array('error' => -1, 'message' => join("\n", $exceptionsArray));
|
31 |
+
}
|
32 |
+
return null;
|
33 |
+
}
|
34 |
+
|
35 |
+
public function saveShipping($data, $customerAddressId)
|
36 |
+
{
|
37 |
+
// Cleanup existing error messages
|
38 |
+
$this->getErrorResponse();
|
39 |
+
return parent::saveShipping($data, $customerAddressId);
|
40 |
+
}
|
41 |
+
|
42 |
+
public function saveOrder()
|
43 |
+
{
|
44 |
+
$errorResponse = $this->getErrorResponse();
|
45 |
+
if ($errorResponse != null)
|
46 |
+
return $errorResponse;
|
47 |
+
return parent::saveOrder();
|
48 |
+
}
|
49 |
+
|
50 |
+
public function saveShippingMethod($shippingMethod)
|
51 |
+
{
|
52 |
+
$errorResponse = $this->getErrorResponse();
|
53 |
+
if ($errorResponse != null)
|
54 |
+
return $errorResponse;
|
55 |
+
return parent::saveShippingMethod($shippingMethod);
|
56 |
+
}
|
57 |
+
|
58 |
+
public function savePayment($data)
|
59 |
+
{
|
60 |
+
$errorResponse = $this->getErrorResponse();
|
61 |
+
if ($errorResponse != null)
|
62 |
+
return $errorResponse;
|
63 |
+
return parent::savePayment($data);
|
64 |
+
}
|
65 |
+
|
66 |
+
|
67 |
+
public function saveBilling($data, $customerAddressId)
|
68 |
+
{
|
69 |
+
// Cleanup existing error messages
|
70 |
+
$this->getErrorResponse();
|
71 |
+
return parent::saveBilling($data, $customerAddressId);
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
}
|
app/code/local/Exactor/Core/etc/config.xml
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" ?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Exactor
|
23 |
+
* @package Exactor_Tax
|
24 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<modules>
|
30 |
+
<Exactor_Core>
|
31 |
+
<version>2012.05.14</version>
|
32 |
+
</Exactor_Core>
|
33 |
+
</modules>
|
34 |
+
<global>
|
35 |
+
<models>
|
36 |
+
<checkout>
|
37 |
+
<rewrite>
|
38 |
+
<type_onepage>Exactor_Core_Model_Type_Onepage</type_onepage>
|
39 |
+
</rewrite>
|
40 |
+
</checkout>
|
41 |
+
<!-- Settings -->
|
42 |
+
<MerchantSettings>
|
43 |
+
<class>Exactor_Core_Model_MerchantSettings</class>
|
44 |
+
<resourceModel>MerchantSettings_mysql4</resourceModel>
|
45 |
+
</MerchantSettings>
|
46 |
+
<MerchantSettings_mysql4>
|
47 |
+
<class>Exactor_Core_Model_Mysql4</class>
|
48 |
+
<entities>
|
49 |
+
<MerchantSettings><table>exactor_account</table></MerchantSettings>
|
50 |
+
</entities>
|
51 |
+
</MerchantSettings_mysql4>
|
52 |
+
<!-- Transaction data -->
|
53 |
+
<ExactorTransaction>
|
54 |
+
<class>Exactor_Core_Model_ExactorTransaction</class>
|
55 |
+
<resourceModel>ExactorTransaction_mysql4</resourceModel>
|
56 |
+
</ExactorTransaction>
|
57 |
+
<ExactorTransaction_mysql4>
|
58 |
+
<class>Exactor_Core_Model_Mysql4</class>
|
59 |
+
<entities>
|
60 |
+
<ExactorTransaction><table>exactor_transaction_order</table></ExactorTransaction>
|
61 |
+
</entities>
|
62 |
+
</ExactorTransaction_mysql4>
|
63 |
+
</models>
|
64 |
+
<helpers>
|
65 |
+
<Exactor_Core_SessionCache>
|
66 |
+
<class>Exactor_Core_Helper_SessionCache</class>
|
67 |
+
</Exactor_Core_SessionCache>
|
68 |
+
</helpers>
|
69 |
+
<resources>
|
70 |
+
<!-- Exactor Merchant Settings -->
|
71 |
+
<MerchantSettings_write>
|
72 |
+
<connection>
|
73 |
+
<use>core_write</use>
|
74 |
+
</connection>
|
75 |
+
</MerchantSettings_write>
|
76 |
+
<MerchantSettings_read>
|
77 |
+
<connection>
|
78 |
+
<use>core_read</use>
|
79 |
+
</connection>
|
80 |
+
</MerchantSettings_read>
|
81 |
+
<!-- Exactor Transaction Info -->
|
82 |
+
<ExactorTransaction_write>
|
83 |
+
<connection>
|
84 |
+
<use>core_write</use>
|
85 |
+
</connection>
|
86 |
+
</ExactorTransaction_write>
|
87 |
+
<ExactorTransaction_read>
|
88 |
+
<connection>
|
89 |
+
<use>core_read</use>
|
90 |
+
</connection>
|
91 |
+
</ExactorTransaction_read>
|
92 |
+
</resources>
|
93 |
+
</global>
|
94 |
+
</config>
|
app/code/local/Exactor/ExactorSettings/Block/Form.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_ExactorSettings
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* ExactorSettings block
|
29 |
+
*
|
30 |
+
* @category Exactor
|
31 |
+
* @package Exactor_ExactorSettingss
|
32 |
+
*/
|
33 |
+
|
34 |
+
class Exactor_ExactorSettings_Block_Form extends Mage_Core_Block_Template {
|
35 |
+
|
36 |
+
//const MODEL_MERCHANT_SETTINGS = "Exactor_Core_Model_MerchantSettings";
|
37 |
+
|
38 |
+
private $storeViewId = 0;
|
39 |
+
|
40 |
+
/** @var \Exactor_ExactorSettings_Helper_Data */
|
41 |
+
private $exactorSettingsHelper;
|
42 |
+
|
43 |
+
public function __construct() {
|
44 |
+
parent::_construct();
|
45 |
+
$this->session = Mage::getSingleton('core/session', array('name'=>'frontend'));
|
46 |
+
$this->exactorSettingsHelper = Mage::helper('ExactorSettings');
|
47 |
+
}
|
48 |
+
|
49 |
+
public function loadData(){
|
50 |
+
$pluginVersion = ExactorConnectionFactory::getInstance()->getPluginVersion();
|
51 |
+
$this->addData(array(
|
52 |
+
'pluginVersion' => $pluginVersion,
|
53 |
+
'accountSettings' => $this->loadMerchantSettings()
|
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 |
+
return $this->exactorSettingsHelper->loadMerchantSettingsOrEmptyObject($this->getStoreViewId());
|
64 |
+
}
|
65 |
+
|
66 |
+
public function setStoreViewId($storeViewId)
|
67 |
+
{
|
68 |
+
$this->storeViewId = $storeViewId;
|
69 |
+
}
|
70 |
+
|
71 |
+
public function getStoreViewId()
|
72 |
+
{
|
73 |
+
return $this->storeViewId;
|
74 |
+
}
|
75 |
+
}
|
app/code/local/Exactor/ExactorSettings/Helper/Data.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_ExactorSettings
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* User: LOGICIFY\corvis
|
29 |
+
* Date: 4/24/12
|
30 |
+
* Time: 5:12 PM
|
31 |
+
*/
|
32 |
+
|
33 |
+
class Exactor_ExactorSettings_Helper_Data extends Mage_Core_Helper_Abstract{
|
34 |
+
|
35 |
+
const MODEL_MERCHANT_SETTINGS = "Exactor_Core_Model_MerchantSettings";
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Returns merchant settings from DB or null if there is no any record
|
39 |
+
* @param null $storeViewId
|
40 |
+
* @return Exactor_Core_Model_MerchantSettings|null
|
41 |
+
*/
|
42 |
+
function loadMerchantSettings($storeViewId=null){
|
43 |
+
$merchantSettingsModel = $this->loadMerchantSettingsOrEmptyObject($storeViewId);
|
44 |
+
if (!$merchantSettingsModel->hasData()) return null;
|
45 |
+
return $merchantSettingsModel;
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Returns merchant settings from DB or empty Exactor_Core_Model_MerchantSettings if there is no any record
|
50 |
+
* @param null $storeViewId
|
51 |
+
* @return Exactor_Core_Model_MerchantSettings|null
|
52 |
+
*/
|
53 |
+
function loadMerchantSettingsOrEmptyObject($storeViewId=null){
|
54 |
+
// TODO: Filter by store view id
|
55 |
+
//if ($storeViewId == null) $storeViewId = 1; // 1 - ID of the default store view
|
56 |
+
$merchantSettingsModel = Mage::getModel(self::MODEL_MERCHANT_SETTINGS);
|
57 |
+
$merchantSettingsModel = $merchantSettingsModel
|
58 |
+
->getCollection()
|
59 |
+
->addFilter('StoreViewID', $storeViewId)
|
60 |
+
->getFirstItem();
|
61 |
+
return $merchantSettingsModel;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Returns merchant settings from DB
|
66 |
+
* or null if there is <strong>no any record</strong> or settings <strong>are not populated</strong>
|
67 |
+
* @param null $storeViewId
|
68 |
+
* @return Exactor_Core_Model_MerchantSettings|null
|
69 |
+
*/
|
70 |
+
public function loadValidMerchantSettings($storeViewId=null){
|
71 |
+
return $this->loadMerchantSettings($storeViewId);
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* @return void
|
76 |
+
*/
|
77 |
+
public function updateMageConfig(){
|
78 |
+
Mage::getConfig()->setNode('tax/calculation/based_on','shipping');
|
79 |
+
Mage::getConfig()->setNode('tax/calculation/apply_after_discount','1');
|
80 |
+
}
|
81 |
+
}
|
app/code/local/Exactor/{Exactordetails → ExactorSettings}/Helper/VersionResolver.php
RENAMED
File without changes
|
app/code/local/Exactor/ExactorSettings/controllers/Adminhtml/FormController.php
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_ExactorSettings
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Exactor Settings controller
|
29 |
+
*
|
30 |
+
* @category Exactor
|
31 |
+
* @package Exactor_ExactorSettings
|
32 |
+
*/
|
33 |
+
|
34 |
+
class Exactor_ExactorSettings_Adminhtml_FormController extends Mage_Adminhtml_Controller_Action
|
35 |
+
{
|
36 |
+
const MODEL_MERCHANT_SETTINGS = "Exactor_Core_Model_MerchantSettings";
|
37 |
+
const FORM_PARAM_CONTAINER = 'exactordetailsform';
|
38 |
+
|
39 |
+
private $EXACTOR_ADDRESS_ERROR_CODES = array(13,14);
|
40 |
+
|
41 |
+
const MSG_SESSION_KEY_MISMATCH = 'Session key mismatch';
|
42 |
+
const MSG_NO_DATA = 'No data';
|
43 |
+
const MSG_ERROR_MESSAGE_PREFIX = 'User input consists of the following error(-s): </br>';
|
44 |
+
const MSG_ERROR_COMPANY_ADDRESS = 'Invalid company address. Please correct the company address to ensure that it is set to a valid address.';
|
45 |
+
const MSG_SETTINGS_SAVED = 'Exactor Account was successfully set up.';
|
46 |
+
|
47 |
+
|
48 |
+
private $validationMessages = array();
|
49 |
+
|
50 |
+
private function setupExactorCommonLibrary(){
|
51 |
+
$libDir = Mage::getBaseDir("lib") . '/ExactorCommons';
|
52 |
+
require_once($libDir . '/XmlProcessing.php');
|
53 |
+
require_once($libDir . '/ExactorDomainObjects.php');
|
54 |
+
require_once($libDir . '/ExactorCommons.php');
|
55 |
+
// Magento specific definitions
|
56 |
+
require_once($libDir . '/Magento.php');
|
57 |
+
require_once($libDir . '/config.php');
|
58 |
+
}
|
59 |
+
|
60 |
+
public function indexAction() {
|
61 |
+
$this->setupExactorCommonLibrary();
|
62 |
+
try{
|
63 |
+
$this->loadLayout();
|
64 |
+
$storeViewId = $this->getRequest()->getParam('storeview',Mage::app()->getDefaultStoreView()->getId());
|
65 |
+
$this->getLayout()->getBlock('ExactorSettingsForm')->setStoreViewId($storeViewId);
|
66 |
+
}catch(Exception $e){
|
67 |
+
Mage::log("$e");
|
68 |
+
}
|
69 |
+
|
70 |
+
$this->renderLayout();
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Will be called before validation
|
75 |
+
* @param Exactor_Core_Model_MerchantSettings $merchantSettings
|
76 |
+
* @return void
|
77 |
+
*/
|
78 |
+
protected function preprocessInput(&$merchantSettings){
|
79 |
+
foreach($merchantSettings->getData() as $key => $value){
|
80 |
+
if (is_string($value))
|
81 |
+
$merchantSettings->setData($key, trim($value));
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
private function sendRequestBack(){
|
86 |
+
$storeviewId = $this->getRequest()->getParam('storeview',Mage::app()->getDefaultStoreView()->getId());
|
87 |
+
$this->_redirect("*/*");
|
88 |
+
}
|
89 |
+
|
90 |
+
private function sendError($message){
|
91 |
+
#set the error message in admin session
|
92 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
93 |
+
#redirect to the previous page
|
94 |
+
$this->sendRequestBack();
|
95 |
+
}
|
96 |
+
|
97 |
+
private function sendSuccess($message){
|
98 |
+
#set the error message in admin session
|
99 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
100 |
+
#redirect to the previous page
|
101 |
+
$this->sendRequestBack();
|
102 |
+
}
|
103 |
+
|
104 |
+
public function postAction()
|
105 |
+
{
|
106 |
+
$this->setupExactorCommonLibrary();
|
107 |
+
/** @var Exactor_ExactorSettings_Helper_Data $exactorSettingsHelper */
|
108 |
+
$exactorSettingsHelper = Mage::helper('ExactorSettings');
|
109 |
+
$formData = null;
|
110 |
+
// Validate if we need all needed information from client
|
111 |
+
if($this->getRequest()->getPost(self::FORM_PARAM_CONTAINER) != null) {
|
112 |
+
$formData = $this->getRequest()->getPost(self::FORM_PARAM_CONTAINER);
|
113 |
+
// Check if there is an regionID
|
114 |
+
if (array_key_exists('StateOrProvinceId',$formData)){
|
115 |
+
$regionInfo = Mage::getModel('directory/region')->load($formData['StateOrProvinceId']);
|
116 |
+
if ($regionInfo->hasData())
|
117 |
+
$formData['StateOrProvince'] = $regionInfo->getCode();
|
118 |
+
}
|
119 |
+
}else{
|
120 |
+
return $this->sendError($this->__(self::MSG_NO_DATA));
|
121 |
+
}
|
122 |
+
if($this->getRequest()->getPost('form_key')!=Mage::getSingleton('core/session')->getFormKey()){
|
123 |
+
return $this->sendError($this->__(self::MSG_SESSION_KEY_MISMATCH));
|
124 |
+
}
|
125 |
+
$merchantSettings = $exactorSettingsHelper
|
126 |
+
->loadMerchantSettingsOrEmptyObject($formData['StoreViewID']);
|
127 |
+
$merchantSettings->populateFromArray($formData);
|
128 |
+
// Do pre-processing
|
129 |
+
$this->preprocessInput($merchantSettings);
|
130 |
+
// Do validation
|
131 |
+
$isInputValid = $this->validate($merchantSettings);
|
132 |
+
// if valid - Save to DB
|
133 |
+
if ($isInputValid){
|
134 |
+
$merchantSettings->save();
|
135 |
+
return $this->sendSuccess(self::MSG_SETTINGS_SAVED);
|
136 |
+
}else{ // else - notify error
|
137 |
+
$errorMessage = self::MSG_ERROR_MESSAGE_PREFIX;
|
138 |
+
$errorMessage .= join('<br/>', $this->validationMessages);
|
139 |
+
return $this->sendError($errorMessage);
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Do validation and returns true if there are no any errors,
|
145 |
+
* Otherwise - returns false and populates $this->validationMessages array with error messages
|
146 |
+
* @param Exactor_Core_Model_MerchantSettings $merchantSettings
|
147 |
+
* @return bool
|
148 |
+
*/
|
149 |
+
private function validate($merchantSettings){
|
150 |
+
$address = $merchantSettings->getExactorShippingAddress();
|
151 |
+
|
152 |
+
// If there are no any errors - do Exactor validation
|
153 |
+
if (count($this->validationMessages) > 0) return false;
|
154 |
+
// Validate via exactor
|
155 |
+
$exactorProcessingService = ExactorProcessingServiceFactory::getInstance()
|
156 |
+
->buildExactorProcessingService($merchantSettings->getMerchantID(),
|
157 |
+
$merchantSettings->getUserID());
|
158 |
+
$exactorError = new ErrorResponseType();
|
159 |
+
try{
|
160 |
+
if (!$exactorProcessingService->validateSettings($address, $exactorError)){
|
161 |
+
if (in_array($exactorError->getErrorCode(), $this->EXACTOR_ADDRESS_ERROR_CODES)){
|
162 |
+
$this->validationMessages[] = self::MSG_ERROR_COMPANY_ADDRESS;
|
163 |
+
}else{
|
164 |
+
$this->validationMessages[] = $exactorError->getErrorDescription();
|
165 |
+
}
|
166 |
+
}
|
167 |
+
}catch(Exception $ex){
|
168 |
+
$this->validationMessages[] = $ex->getMessage();
|
169 |
+
}
|
170 |
+
return count($this->validationMessages) == 0;
|
171 |
+
}
|
172 |
+
}
|
app/code/local/Exactor/ExactorSettings/controllers/AjaxController.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* User: LOGICIFY\corvis
|
4 |
+
* Date: 5/7/12
|
5 |
+
* Time: 1:13 PM
|
6 |
+
*/
|
7 |
+
|
8 |
+
class Exactor_ExactorSettings_AjaxController extends Mage_Core_Controller_Front_Action{
|
9 |
+
const FIELD_EXACTOR_STATUS = "exactor_status";
|
10 |
+
|
11 |
+
/** @var Mage_Core_Model_Session_Abstract */
|
12 |
+
private $session;
|
13 |
+
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
parent::_construct();
|
17 |
+
$this->session = Mage::getSingleton('core/session', array('name' => 'frontend'));
|
18 |
+
}
|
19 |
+
|
20 |
+
|
21 |
+
public function getExactorStatusAction(){
|
22 |
+
$jsonBody=array();
|
23 |
+
$messageCollection = $this->session->getMessages();
|
24 |
+
$errorsArray = $messageCollection->getErrors();
|
25 |
+
$jsonBody[self::FIELD_EXACTOR_STATUS] = null;
|
26 |
+
if (count($errorsArray) > 0){
|
27 |
+
$messageCollection->clear();
|
28 |
+
$jsonBody[self::FIELD_EXACTOR_STATUS] = $errorsArray[0]->getCode();
|
29 |
+
}
|
30 |
+
$this->getResponse()->setBody(json_encode($jsonBody));
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
app/code/local/Exactor/{Exactordetails → ExactorSettings}/controllers/IndexController.php
RENAMED
@@ -1,39 +1,39 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Exactor
|
22 |
-
* @package
|
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 |
-
class
|
28 |
-
{
|
29 |
-
public function loginAction()
|
30 |
-
{
|
31 |
-
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
|
32 |
-
$this->_redirect('*');
|
33 |
-
return;
|
34 |
-
}else{
|
35 |
-
$this->_redirect('adminhtml');
|
36 |
-
return;
|
37 |
-
}
|
38 |
-
}
|
39 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Exactor
|
22 |
+
* @package Exactor_ExactorSettings
|
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 |
+
class Exactor_ExactorSettings_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
|
28 |
+
{
|
29 |
+
public function loginAction()
|
30 |
+
{
|
31 |
+
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
|
32 |
+
$this->_redirect('*');
|
33 |
+
return;
|
34 |
+
}else{
|
35 |
+
$this->_redirect('adminhtml');
|
36 |
+
return;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
app/code/local/Exactor/{Exactordetails → ExactorSettings}/etc/config.xml
RENAMED
@@ -1,147 +1,137 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<!--
|
3 |
-
/**
|
4 |
-
* Magento
|
5 |
-
*
|
6 |
-
* NOTICE OF LICENSE
|
7 |
-
*
|
8 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://opensource.org/licenses/afl-3.0.php
|
12 |
-
* If you did not receive a copy of the license and are unable to
|
13 |
-
* obtain it through the world-wide-web, please send an email
|
14 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
-
*
|
16 |
-
* DISCLAIMER
|
17 |
-
*
|
18 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
-
* versions in the future. If you wish to customize Magento for your
|
20 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
-
*
|
22 |
-
* @category Exactor
|
23 |
-
* @package Exactor_Exactordetails
|
24 |
-
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
25 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
-
*/
|
27 |
-
-->
|
28 |
-
<config>
|
29 |
-
<modules>
|
30 |
-
<
|
31 |
-
<version>2012.
|
32 |
-
</
|
33 |
-
</modules>
|
34 |
-
|
35 |
-
<global>
|
36 |
-
<
|
37 |
-
<
|
38 |
-
<class>
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
<
|
91 |
-
<
|
92 |
-
<
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
<layout>
|
140 |
-
<updates>
|
141 |
-
<exactordetails>
|
142 |
-
<file>exactordetails.xml</file>
|
143 |
-
</exactordetails>
|
144 |
-
</updates>
|
145 |
-
</layout>
|
146 |
-
</adminhtml>
|
147 |
-
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Exactor
|
23 |
+
* @package Exactor_Exactordetails
|
24 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<modules>
|
30 |
+
<Exactor_ExactorSettings>
|
31 |
+
<version>2012.05.28</version>
|
32 |
+
</Exactor_ExactorSettings>
|
33 |
+
</modules>
|
34 |
+
|
35 |
+
<global>
|
36 |
+
<helpers>
|
37 |
+
<ExactorSettings>
|
38 |
+
<class>Exactor_ExactorSettings_Helper</class>
|
39 |
+
</ExactorSettings>
|
40 |
+
<ExactorSettings_versionresolver>
|
41 |
+
<class>Exactor_ExactorSettings_Helper_VersionResolver</class>
|
42 |
+
</ExactorSettings_versionresolver>
|
43 |
+
</helpers>
|
44 |
+
|
45 |
+
<resources>
|
46 |
+
<!-- Declaring module setup handler -->
|
47 |
+
<!-- [start] -->
|
48 |
+
<ExactorSettings_setup>
|
49 |
+
<setup>
|
50 |
+
<module>Exactor_ExactorSettings</module>
|
51 |
+
</setup>
|
52 |
+
<connection>
|
53 |
+
<use>core_setup</use>
|
54 |
+
</connection>
|
55 |
+
</ExactorSettings_setup>
|
56 |
+
<!-- [End] -->
|
57 |
+
</resources>
|
58 |
+
|
59 |
+
<blocks>
|
60 |
+
<ExactorSettings>
|
61 |
+
<class>Exactor_ExactorSettings_Block_Form</class>
|
62 |
+
</ExactorSettings>
|
63 |
+
</blocks>
|
64 |
+
|
65 |
+
</global>
|
66 |
+
|
67 |
+
<admin>
|
68 |
+
<routers>
|
69 |
+
<ExactorSettings>
|
70 |
+
<use>admin</use>
|
71 |
+
<args>
|
72 |
+
<module>Exactor_ExactorSettings</module>
|
73 |
+
<frontName>ExactorSettings</frontName>
|
74 |
+
</args>
|
75 |
+
</ExactorSettings>
|
76 |
+
</routers>
|
77 |
+
</admin>
|
78 |
+
|
79 |
+
<adminhtml>
|
80 |
+
<translate>
|
81 |
+
<modules>
|
82 |
+
<Exactor_adminhtml>
|
83 |
+
<files>
|
84 |
+
<ExactorSettings>Exactor_Exactordetails.csv</ExactorSettings>
|
85 |
+
</files>
|
86 |
+
</Exactor_adminhtml>
|
87 |
+
</modules>
|
88 |
+
</translate>
|
89 |
+
|
90 |
+
<menu>
|
91 |
+
<system>
|
92 |
+
<children>
|
93 |
+
<ExactorSettings_adminform translate="title" module="ExactorSettings">
|
94 |
+
<title>Exactor Account</title>
|
95 |
+
<action>ExactorSettings/adminhtml_Form</action>
|
96 |
+
</ExactorSettings_adminform>
|
97 |
+
</children>
|
98 |
+
</system>
|
99 |
+
</menu>
|
100 |
+
|
101 |
+
<acl>
|
102 |
+
<resources>
|
103 |
+
<admin>
|
104 |
+
<children>
|
105 |
+
<system>
|
106 |
+
<children>
|
107 |
+
<exactordetails_adminform>
|
108 |
+
<title>Exactor Account</title>
|
109 |
+
</exactordetails_adminform>
|
110 |
+
</children>
|
111 |
+
</system>
|
112 |
+
</children>
|
113 |
+
</admin>
|
114 |
+
</resources>
|
115 |
+
</acl>
|
116 |
+
|
117 |
+
<layout>
|
118 |
+
<updates>
|
119 |
+
<ExactorSettings>
|
120 |
+
<file>exactorsettings.xml</file>
|
121 |
+
</ExactorSettings>
|
122 |
+
</updates>
|
123 |
+
</layout>
|
124 |
+
</adminhtml>
|
125 |
+
|
126 |
+
|
127 |
+
<frontend>
|
128 |
+
<layout>
|
129 |
+
<updates>
|
130 |
+
<ExactorSettings>
|
131 |
+
<file>exactoronestepcheckout.xml</file>
|
132 |
+
</ExactorSettings>
|
133 |
+
</updates>
|
134 |
+
</layout>
|
135 |
+
</frontend>
|
136 |
+
|
137 |
+
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/ExactorSettings/sql/ExactorSettings_setup/mysql4-install-14.04.2012.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('exactor_account')} (
|
34 |
+
`ID` int(10) NOT NULL AUTO_INCREMENT,
|
35 |
+
`StoreViewID` int(20) DEFAULT NULL,
|
36 |
+
`MerchantID` varchar(50) NOT NULL,
|
37 |
+
`UserID` varchar(50) NOT NULL DEFAULT '',
|
38 |
+
`Password` varchar(50) DEFAULT NULL,
|
39 |
+
`FullName` varchar(250) NOT NULL DEFAULT '',
|
40 |
+
`Street1` varchar(250) NOT NULL DEFAULT '',
|
41 |
+
`Street2` varchar(250) DEFAULT NULL,
|
42 |
+
`City` varchar(150) NOT NULL DEFAULT '',
|
43 |
+
`StateOrProvince` varchar(50) NOT NULL DEFAULT '',
|
44 |
+
`PostalCode` varchar(50) NOT NULL DEFAULT '',
|
45 |
+
`Country` varchar(50) NOT NULL DEFAULT '',
|
46 |
+
`ShippingCharges` varchar(2) DEFAULT NULL,
|
47 |
+
`SourceofSKU` varchar(2) DEFAULT NULL,
|
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 |
+
|
54 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('exactor_transaction_order')} (
|
55 |
+
`ID` int(20) NOT NULL AUTO_INCREMENT,
|
56 |
+
`TransactionID` varchar(100) DEFAULT NULL,
|
57 |
+
`OrderID` varchar(100) DEFAULT NULL,
|
58 |
+
`UserID` varchar(50) DEFAULT NULL,
|
59 |
+
`MerchantID` varchar(50) DEFAULT NULL,
|
60 |
+
`DateOfOrder` date DEFAULT NULL,
|
61 |
+
`Commited` tinyint(1) DEFAULT 1,
|
62 |
+
PRIMARY KEY (`ID`)
|
63 |
+
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
64 |
+
");
|
65 |
+
|
66 |
+
$installer->endSetup();
|
app/code/local/Exactor/Exactordetails/Block/Form.php
DELETED
@@ -1,208 +0,0 @@
|
|
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 |
-
/**
|
28 |
-
* Exactordetails block
|
29 |
-
*
|
30 |
-
* @category Exactor
|
31 |
-
* @package Exactor_Exactordetails
|
32 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
-
*/
|
34 |
-
|
35 |
-
class Exactor_Exactordetails_Block_Form extends Mage_Core_Block_Template {
|
36 |
-
|
37 |
-
public function __construct() {
|
38 |
-
|
39 |
-
#set the core session value to set and unset the values
|
40 |
-
#$session->setData('data', 'hello'); to set the data from session object
|
41 |
-
#$test = $session->getData('data'); to get the data from session object
|
42 |
-
$this->session = Mage::getSingleton('core/session', array('name'=>'frontend'));
|
43 |
-
|
44 |
-
#set the plugin version info here
|
45 |
-
$plugin_version = $this->helper('exactordetails')->get_exactor_plugin_info();
|
46 |
-
Mage::register("plugin_version",$plugin_version);
|
47 |
-
|
48 |
-
#set the exactor details session values if set
|
49 |
-
$this->get_exactor_detail_session_values();
|
50 |
-
}
|
51 |
-
|
52 |
-
|
53 |
-
#function to get the session values if the form returs a error while saving the account details
|
54 |
-
public function get_exactor_detail_session_values() {
|
55 |
-
|
56 |
-
#get the session values from here
|
57 |
-
$exactor_session_details = $this->session->getData('exactor_account_details');
|
58 |
-
|
59 |
-
if(trim($this->getRequest()->getParam('store'))!=$exactor_session_details['StoreViewID']) {
|
60 |
-
|
61 |
-
$exactor_session_details = null;
|
62 |
-
$this->session->getData('exactor_account_details',true);
|
63 |
-
}
|
64 |
-
|
65 |
-
if(is_array($exactor_session_details)) {
|
66 |
-
|
67 |
-
#convert the session password to hexadecimal.
|
68 |
-
$exactor_session_details['Password'] = $this->helper('exactordetails')->str2hex($exactor_session_details["Password"]);
|
69 |
-
|
70 |
-
#register the session value so as to utillise in template
|
71 |
-
Mage::register("exactor_account_details",$exactor_session_details);
|
72 |
-
}
|
73 |
-
else {
|
74 |
-
|
75 |
-
#set the exactor session to null values if no session is set
|
76 |
-
$exactor_account_details = array( 'ID'=>'',
|
77 |
-
'MerchantID'=>'',
|
78 |
-
'UserID'=>'',
|
79 |
-
'Password'=>'',
|
80 |
-
'FullName'=>'',
|
81 |
-
'Street1'=>'',
|
82 |
-
'Street2'=>'',
|
83 |
-
'City'=>'',
|
84 |
-
'StateOrProvince'=>'',
|
85 |
-
'PostalCode'=>'',
|
86 |
-
'Country'=>'',
|
87 |
-
'ShippingCharges'=>'',
|
88 |
-
'SourceofSKU'=>'',
|
89 |
-
'AttributeName'=>'',
|
90 |
-
'CommitOption'=>'',
|
91 |
-
'EntityExemptions'=>'',
|
92 |
-
'object'=>new Exactor_Exactordetails_Model_Exactoraccount()
|
93 |
-
);
|
94 |
-
|
95 |
-
#set the exactor result set
|
96 |
-
$exactor_account_details = $this->set_database_details_if_exits($exactor_account_details);
|
97 |
-
$this->session->setData('exactor_account_details',$exactor_account_details);
|
98 |
-
#register the session value so as to utillise in template if empty
|
99 |
-
Mage::register("exactor_account_details",$exactor_account_details);
|
100 |
-
}
|
101 |
-
|
102 |
-
}
|
103 |
-
|
104 |
-
#function to populate the database details if the user account has already been created
|
105 |
-
function set_database_details_if_exits($exactor_account_details) {
|
106 |
-
|
107 |
-
#get the store view id so as to get the corresponding exactor value
|
108 |
-
$storeViewID = $this->getStoreViewId();
|
109 |
-
|
110 |
-
#register the store id so as to be used in the form template
|
111 |
-
Mage::register("storeViewID",$storeViewID);
|
112 |
-
|
113 |
-
#get all the collection of exactor account details
|
114 |
-
$exactor_result_set = Mage::getModel('exactordetails/exactoraccount')->getCollection()->addFilter('StoreViewID',$storeViewID);
|
115 |
-
|
116 |
-
#loop through the exactor result set
|
117 |
-
foreach($exactor_result_set as $exactor_details) {
|
118 |
-
|
119 |
-
foreach($exactor_account_details as $exactor_details_key=>$exactor_details_value) {
|
120 |
-
|
121 |
-
$exactor_account_details[$exactor_details_key] = $exactor_details->getData($exactor_details_key);
|
122 |
-
|
123 |
-
}
|
124 |
-
// We should use object, Legacy code above is for back compatibility only
|
125 |
-
$exactor_account_details["object"] = $exactor_details;
|
126 |
-
#we will always break the loop after one loop as we
|
127 |
-
#will have only one Exactor account
|
128 |
-
break;
|
129 |
-
}
|
130 |
-
|
131 |
-
|
132 |
-
#return the exactor details array
|
133 |
-
return $exactor_account_details;
|
134 |
-
}
|
135 |
-
|
136 |
-
#function to get the store view id
|
137 |
-
function getStoreViewId(){
|
138 |
-
|
139 |
-
$store_id = array();
|
140 |
-
|
141 |
-
#get the store parameter from the get request value
|
142 |
-
if(trim($this->getRequest()->getParam('store'))!="") {
|
143 |
-
|
144 |
-
return $this->getRequest()->getParam('store');
|
145 |
-
}
|
146 |
-
|
147 |
-
#get the store parameter from the get request value
|
148 |
-
foreach ($this->getWebsites() as $website){
|
149 |
-
|
150 |
-
foreach ($website->getGroups() as $group) {
|
151 |
-
|
152 |
-
foreach ($this->getStores($group) as $store) {
|
153 |
-
|
154 |
-
return $store->getId();
|
155 |
-
}
|
156 |
-
}
|
157 |
-
}
|
158 |
-
}
|
159 |
-
|
160 |
-
|
161 |
-
#function to initiate the switcher block and get the switcher store view drop down
|
162 |
-
public function getStoreSwitcherHtml()
|
163 |
-
{
|
164 |
-
return $this->getChildHtml('exactordetails_switcher');
|
165 |
-
}
|
166 |
-
|
167 |
-
/**
|
168 |
-
* Get websites
|
169 |
-
*
|
170 |
-
* @return array
|
171 |
-
*/
|
172 |
-
public function getWebsites()
|
173 |
-
{
|
174 |
-
$websites = Mage::app()->getWebsites();
|
175 |
-
if ($websiteIds = $this->getWebsiteIds()) {
|
176 |
-
foreach ($websites as $websiteId => $website) {
|
177 |
-
if (!in_array($websiteId, $websiteIds)) {
|
178 |
-
unset($websites[$websiteId]);
|
179 |
-
}
|
180 |
-
}
|
181 |
-
}
|
182 |
-
return $websites;
|
183 |
-
}
|
184 |
-
|
185 |
-
/**
|
186 |
-
* Get store views for specified store group
|
187 |
-
*
|
188 |
-
* @param Mage_Core_Model_Store_Group $group
|
189 |
-
* @return array
|
190 |
-
*/
|
191 |
-
public function getStores($group)
|
192 |
-
{
|
193 |
-
if (!$group instanceof Mage_Core_Model_Store_Group) {
|
194 |
-
$group = Mage::app()->getGroup($group);
|
195 |
-
}
|
196 |
-
$stores = $group->getStores();
|
197 |
-
if ($storeIds = $this->getStoreIds()) {
|
198 |
-
foreach ($stores as $storeId => $store) {
|
199 |
-
if (!in_array($storeId, $storeIds)) {
|
200 |
-
unset($stores[$storeId]);
|
201 |
-
}
|
202 |
-
}
|
203 |
-
}
|
204 |
-
return $stores;
|
205 |
-
}
|
206 |
-
|
207 |
-
}
|
208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/Exactordetails/Block/Switcher.php
DELETED
@@ -1,206 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Adminhtml
|
23 |
-
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Store switcher block
|
29 |
-
*
|
30 |
-
* @category Mage
|
31 |
-
* @package Mage_Adminhtml
|
32 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
-
*/
|
34 |
-
class Exactor_Exactordetails_Block_Switcher extends Mage_Adminhtml_Block_Template
|
35 |
-
{
|
36 |
-
/**
|
37 |
-
* @var array
|
38 |
-
*/
|
39 |
-
protected $_storeIds;
|
40 |
-
|
41 |
-
protected $_storeVarName = 'store';
|
42 |
-
|
43 |
-
/**
|
44 |
-
* @var bool
|
45 |
-
*/
|
46 |
-
protected $_hasDefaultOption = true;
|
47 |
-
|
48 |
-
public function __construct()
|
49 |
-
{
|
50 |
-
parent::__construct();
|
51 |
-
$this->setTemplate('exactordetails/switcher.phtml');
|
52 |
-
$this->setUseConfirm(true);
|
53 |
-
$this->setUseAjax(true);
|
54 |
-
$this->setDefaultStoreName($this->__('All Store Views'));
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Deprecated
|
59 |
-
*/
|
60 |
-
public function getWebsiteCollection()
|
61 |
-
{
|
62 |
-
$collection = Mage::getModel('core/website')->getResourceCollection();
|
63 |
-
|
64 |
-
$websiteIds = $this->getWebsiteIds();
|
65 |
-
if (!is_null($websiteIds)) {
|
66 |
-
$collection->addIdFilter($this->getWebsiteIds());
|
67 |
-
}
|
68 |
-
|
69 |
-
return $collection->load();
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Get websites
|
74 |
-
*
|
75 |
-
* @return array
|
76 |
-
*/
|
77 |
-
public function getWebsites()
|
78 |
-
{
|
79 |
-
$websites = Mage::app()->getWebsites();
|
80 |
-
if ($websiteIds = $this->getWebsiteIds()) {
|
81 |
-
foreach ($websites as $websiteId => $website) {
|
82 |
-
if (!in_array($websiteId, $websiteIds)) {
|
83 |
-
unset($websites[$websiteId]);
|
84 |
-
}
|
85 |
-
}
|
86 |
-
}
|
87 |
-
return $websites;
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Deprecated
|
92 |
-
*/
|
93 |
-
public function getGroupCollection($website)
|
94 |
-
{
|
95 |
-
if (!$website instanceof Mage_Core_Model_Website) {
|
96 |
-
$website = Mage::getModel('core/website')->load($website);
|
97 |
-
}
|
98 |
-
return $website->getGroupCollection();
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Get store groups for specified website
|
103 |
-
*
|
104 |
-
* @param Mage_Core_Model_Website $website
|
105 |
-
* @return array
|
106 |
-
*/
|
107 |
-
public function getStoreGroups($website)
|
108 |
-
{
|
109 |
-
if (!$website instanceof Mage_Core_Model_Website) {
|
110 |
-
$website = Mage::app()->getWebsite($website);
|
111 |
-
}
|
112 |
-
return $website->getGroups();
|
113 |
-
}
|
114 |
-
|
115 |
-
/**
|
116 |
-
* Deprecated
|
117 |
-
*/
|
118 |
-
public function getStoreCollection($group)
|
119 |
-
{
|
120 |
-
if (!$group instanceof Mage_Core_Model_Store_Group) {
|
121 |
-
$group = Mage::getModel('core/store_group')->load($group);
|
122 |
-
}
|
123 |
-
$stores = $group->getStoreCollection();
|
124 |
-
$_storeIds = $this->getStoreIds();
|
125 |
-
if (!empty($_storeIds)) {
|
126 |
-
$stores->addIdFilter($_storeIds);
|
127 |
-
}
|
128 |
-
return $stores;
|
129 |
-
}
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Get store views for specified store group
|
133 |
-
*
|
134 |
-
* @param Mage_Core_Model_Store_Group $group
|
135 |
-
* @return array
|
136 |
-
*/
|
137 |
-
public function getStores($group)
|
138 |
-
{
|
139 |
-
if (!$group instanceof Mage_Core_Model_Store_Group) {
|
140 |
-
$group = Mage::app()->getGroup($group);
|
141 |
-
}
|
142 |
-
$stores = $group->getStores();
|
143 |
-
if ($storeIds = $this->getStoreIds()) {
|
144 |
-
foreach ($stores as $storeId => $store) {
|
145 |
-
if (!in_array($storeId, $storeIds)) {
|
146 |
-
unset($stores[$storeId]);
|
147 |
-
}
|
148 |
-
}
|
149 |
-
}
|
150 |
-
return $stores;
|
151 |
-
}
|
152 |
-
|
153 |
-
public function getSwitchUrl()
|
154 |
-
{
|
155 |
-
if ($url = $this->getData('switch_url')) {
|
156 |
-
return $url;
|
157 |
-
}
|
158 |
-
return $this->getUrl('*/*/*', array('_current' => true, $this->_storeVarName => null));
|
159 |
-
}
|
160 |
-
|
161 |
-
public function setStoreVarName($varName)
|
162 |
-
{
|
163 |
-
$this->_storeVarName = $varName;
|
164 |
-
return $this;
|
165 |
-
}
|
166 |
-
|
167 |
-
public function getStoreId()
|
168 |
-
{
|
169 |
-
return $this->getRequest()->getParam($this->_storeVarName);
|
170 |
-
}
|
171 |
-
|
172 |
-
public function setStoreIds($storeIds)
|
173 |
-
{
|
174 |
-
$this->_storeIds = $storeIds;
|
175 |
-
return $this;
|
176 |
-
}
|
177 |
-
|
178 |
-
public function getStoreIds()
|
179 |
-
{
|
180 |
-
return $this->_storeIds;
|
181 |
-
}
|
182 |
-
|
183 |
-
public function isShow()
|
184 |
-
{
|
185 |
-
return !Mage::app()->isSingleStoreMode();
|
186 |
-
}
|
187 |
-
|
188 |
-
protected function _toHtml()
|
189 |
-
{
|
190 |
-
return parent::_toHtml();
|
191 |
-
}
|
192 |
-
|
193 |
-
/**
|
194 |
-
* Set/Get whether the switcher should show default option
|
195 |
-
*
|
196 |
-
* @param bool $hasDefaultOption
|
197 |
-
* @return bool
|
198 |
-
*/
|
199 |
-
public function hasDefaultOption($hasDefaultOption = null)
|
200 |
-
{
|
201 |
-
if (null !== $hasDefaultOption) {
|
202 |
-
$this->_hasDefaultOption = $hasDefaultOption;
|
203 |
-
}
|
204 |
-
return $this->_hasDefaultOption;
|
205 |
-
}
|
206 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/Exactordetails/Helper/ClassLoader.php
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
* User: Dmitry Berezovsky
|
5 |
-
* Date: 10/19/11
|
6 |
-
* Time: 3:56 PM
|
7 |
-
*/
|
8 |
-
|
9 |
-
class Exactor_Exactordetails_Helper_ClassLoader extends Mage_Core_Helper_Abstract{
|
10 |
-
function __construct() {
|
11 |
-
|
12 |
-
}
|
13 |
-
|
14 |
-
|
15 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/Exactordetails/Helper/Data.php
DELETED
@@ -1,314 +0,0 @@
|
|
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 |
-
/**
|
28 |
-
* Exactordetails helper
|
29 |
-
*
|
30 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
31 |
-
*/
|
32 |
-
class Exactor_Exactordetails_Helper_Data extends Mage_Core_Helper_Abstract {
|
33 |
-
|
34 |
-
#contructor function to initialize the exactor info
|
35 |
-
function __construct() {
|
36 |
-
#call the model function here
|
37 |
-
$this->magentoVersion = Mage::getVersion();
|
38 |
-
$this->exactor_details_model = Mage::getModel('exactordetails/exactoraccount');
|
39 |
-
$this->exactor_transaction_details_model = Mage::getModel('exactordetails/exactortransactiondetails');
|
40 |
-
$this->ExactorUrl = $this->exactor_details_model->getExactorUrl();
|
41 |
-
$this->ExactorCommitUrl = $this->exactor_details_model->getExactorCommitUrl();
|
42 |
-
$this->Exactor_Details_Info = $this->exactor_details_model->getCollection()->getFirstItem();
|
43 |
-
}
|
44 |
-
|
45 |
-
#converts a Character string to hex decimal string
|
46 |
-
function str2hex($s) {
|
47 |
-
$r = "";
|
48 |
-
$hexes = array ("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");
|
49 |
-
for ($i=0; $i<strlen($s); $i++)
|
50 |
-
$r .= ($hexes [(ord($s{$i}) >> 4)] . $hexes [(ord($s{$i}) & 0xf)]);
|
51 |
-
return $r;
|
52 |
-
}
|
53 |
-
|
54 |
-
#converts a hex decimal string to Character string
|
55 |
-
function hex2str($s) {
|
56 |
-
$r = "";
|
57 |
-
for ( $i = 0; $i<strlen($s); $i += 2) {
|
58 |
-
$x1 = ord($s{$i});
|
59 |
-
$x1 = ($x1>=48 && $x1<58) ? $x1-48 : $x1-97+10;
|
60 |
-
$x2 = ord($s{$i+1});
|
61 |
-
$x2 = ($x2>=48 && $x2<58) ? $x2-48 : $x2-97+10;
|
62 |
-
$r .= chr((($x1 << 4) & 0xf0) | ($x2 & 0x0f));
|
63 |
-
}
|
64 |
-
return $r;
|
65 |
-
}
|
66 |
-
|
67 |
-
#function to encrypt the string that are passed
|
68 |
-
function encrypt($key, $plain_text) {
|
69 |
-
$plain_text = trim($plain_text);
|
70 |
-
$iv = substr(md5($key), 0,mcrypt_get_iv_size (MCRYPT_CAST_256,MCRYPT_MODE_CFB));
|
71 |
-
$c_t = mcrypt_cfb (MCRYPT_CAST_256, $key, $plain_text, MCRYPT_ENCRYPT, $iv);
|
72 |
-
return trim(chop(base64_encode($c_t)));
|
73 |
-
}
|
74 |
-
|
75 |
-
#function to decrypt the string that are passed
|
76 |
-
function decrypt($key, $c_t) {
|
77 |
-
$c_t = trim(chop(base64_decode($c_t)));
|
78 |
-
$iv = substr(md5($key), 0,mcrypt_get_iv_size (MCRYPT_CAST_256,MCRYPT_MODE_CFB));
|
79 |
-
$p_t = mcrypt_cfb (MCRYPT_CAST_256, $key, $c_t, MCRYPT_DECRYPT, $iv);
|
80 |
-
return trim(chop($p_t));
|
81 |
-
}
|
82 |
-
|
83 |
-
#function to parseurl that are passed
|
84 |
-
function parseurl($url="")
|
85 |
-
{
|
86 |
-
$url = rawurlencode(mb_convert_encoding($url, 'gb2312', 'utf-8'));
|
87 |
-
$a = array("%3A", "%2F", "%40");
|
88 |
-
$b = array(":", "/", "@");
|
89 |
-
$url = str_replace($a, $b, $url);
|
90 |
-
return $url;
|
91 |
-
}
|
92 |
-
|
93 |
-
#function to get the root path
|
94 |
-
function getRootPath() {
|
95 |
-
$sRealPath = realpath('./');
|
96 |
-
$sSelfPath = $_SERVER['PHP_SELF'];
|
97 |
-
$sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ));
|
98 |
-
return substr($sRealPath, 0, strlen($sRealPath) - strlen($sSelfPath));
|
99 |
-
}
|
100 |
-
|
101 |
-
#function to retrun the string for taxrequest
|
102 |
-
function get_taxrequest_string() {
|
103 |
-
return " plugin='Magento $this->magentoVersion' version='".$this->get_exactor_plugin_info()."' ";
|
104 |
-
}
|
105 |
-
|
106 |
-
#function to get the exactor plugin info
|
107 |
-
function get_exactor_plugin_info() {
|
108 |
-
#get the plugin version from registry that were set up in the block
|
109 |
-
$plugin_version = Mage::getConfig()->getNode('modules/Exactor_Exactordetails')->version;
|
110 |
-
return $plugin_version;
|
111 |
-
}
|
112 |
-
|
113 |
-
#Function to delete transaction from exactor system given the transaction id
|
114 |
-
function deleteExactor_Transaction($transaction_id=null) {
|
115 |
-
|
116 |
-
if($transaction_id!=null) {
|
117 |
-
|
118 |
-
$xml = "<TaxRequest xmlns=\"".$this->ExactorUrl."\" ".htmlspecialchars($this->get_taxrequest_string()).">";
|
119 |
-
$xml .= "<MerchantId>".htmlspecialchars($this->Exactor_Details_Info->getMerchantID())."</MerchantId>";
|
120 |
-
$xml .= "<UserId>".htmlspecialchars($this->Exactor_Details_Info->getUserID())."</UserId>";
|
121 |
-
$xml .= "<DeleteRequest>";
|
122 |
-
$xml .= "<PriorTransactionId>" . $transaction_id . "</PriorTransactionId>";
|
123 |
-
$xml .= "</DeleteRequest>";
|
124 |
-
$xml .= "</TaxRequest>";
|
125 |
-
|
126 |
-
$response = $this->exactor_do_post_request($this->ExactorCommitUrl, $xml);
|
127 |
-
}
|
128 |
-
}
|
129 |
-
##
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Sends commit request to exactor without recalculating tax
|
133 |
-
* @param $invoiceNumber - order number e.g 1000007
|
134 |
-
* @param $transactionId - exactor transction ID. Will be putted into Prior TransactionId field in Exactor request
|
135 |
-
* @return void
|
136 |
-
*/
|
137 |
-
public function commit_existing_transaction($invoiceNumber, $transactionId){
|
138 |
-
assert($transactionId!=null);
|
139 |
-
|
140 |
-
$xml = "<TaxRequest xmlns=\"".$this->ExactorUrl."\" ".htmlspecialchars($this->get_taxrequest_string()).">";
|
141 |
-
$xml .= "<MerchantId>".htmlspecialchars($this->Exactor_Details_Info->getMerchantID())."</MerchantId>";
|
142 |
-
$xml .= "<UserId>".htmlspecialchars($this->Exactor_Details_Info->getUserID())."</UserId>";
|
143 |
-
$xml .= "<CommitRequest>";
|
144 |
-
$xml .= "<CommitDate>".Mage::getModel('core/date')->date('Y-m-d')."</CommitDate>";
|
145 |
-
$xml .= "<InvoiceNumber>".htmlspecialchars($invoiceNumber)."</InvoiceNumber>";
|
146 |
-
$xml .= "<PriorTransactionId>".htmlspecialchars($transactionId)."</PriorTransactionId>";
|
147 |
-
$xml .= "</CommitRequest>";
|
148 |
-
$xml .= "</TaxRequest>";
|
149 |
-
|
150 |
-
$exactorOrderInfo = $this->get_exactor_info_for_order($invoiceNumber, false);
|
151 |
-
if($exactorOrderInfo != null){
|
152 |
-
$exactorOrderInfo->setCommited(true);
|
153 |
-
$exactorOrderInfo->save();
|
154 |
-
}
|
155 |
-
|
156 |
-
$response = $this->exactor_do_post_request($this->ExactorCommitUrl, $xml);
|
157 |
-
}
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Fetch exactor invoice transction from order information and call
|
161 |
-
* commit_existing_transaction to send commit request to Exactor
|
162 |
-
* @param $orderNumber e.g. 100000007
|
163 |
-
* @return void
|
164 |
-
*/
|
165 |
-
public function commit_transaction_for_order($orderNumber){
|
166 |
-
$exactorTransactionId = $this->get_exactor_info_for_order($orderNumber, false)->getTransactionID();
|
167 |
-
if (!$exactorTransactionId) return;
|
168 |
-
$this->commit_existing_transaction($orderNumber, $exactorTransactionId);
|
169 |
-
}
|
170 |
-
|
171 |
-
/**
|
172 |
-
* Load Exactor info for given order
|
173 |
-
* @param $orderId
|
174 |
-
* @param $commited
|
175 |
-
* @return Exactor_Exactordetails_Model_Exactortransactiondetails
|
176 |
-
*/
|
177 |
-
public function get_exactor_info_for_order($orderId, $commited=null){
|
178 |
-
$query = $this->exactor_transaction_details_model->getCollection()->addFilter("OrderID",$orderId);
|
179 |
-
if ($commited != null)
|
180 |
-
$query->addFilter("Commited", $commited);
|
181 |
-
$orderData = $query->getFirstItem();
|
182 |
-
return $orderData;
|
183 |
-
}
|
184 |
-
|
185 |
-
#function to refund the older order transaction that was earlier commited
|
186 |
-
function refund_older_order_transaction($OldOrderId=null,$exactor_tax_model=null,$store_id=null) {
|
187 |
-
|
188 |
-
if($OldOrderId!=null && $exactor_tax_model!=null) {
|
189 |
-
|
190 |
-
#get the transaction id for a particular Older order Id
|
191 |
-
$olderOrderData = $exactor_tax_model->exactor_transaction_details_model->getCollection()->addFilter("OrderID",$OldOrderId)->getFirstItem();
|
192 |
-
$older_tansactionID = $olderOrderData->getTransactionID();
|
193 |
-
|
194 |
-
#pouplate the exactor details model with the store id in case of order cancellation
|
195 |
-
if($store_id!=null && $store_id!="")
|
196 |
-
$exactor_tax_model->set_exactor_transaction_url($store_id);
|
197 |
-
|
198 |
-
#commit the refund transaction into exactor API
|
199 |
-
$exactor_tax_model->commitExactor_RefundTransaction_OlderOrderID($older_tansactionID);
|
200 |
-
|
201 |
-
|
202 |
-
#delete the older transaction ids from the exactor transaction table
|
203 |
-
$exactor_tax_model->exactor_transaction_details_model->setID($olderOrderData->getID());
|
204 |
-
$exactor_tax_model->exactor_transaction_details_model->delete();
|
205 |
-
}
|
206 |
-
}
|
207 |
-
|
208 |
-
|
209 |
-
#Sends curl request and returns response given the url and xml data
|
210 |
-
function exactor_do_post_request($url, $data, $type="xml") {
|
211 |
-
|
212 |
-
$ch = curl_init();
|
213 |
-
curl_setopt($ch, CURLOPT_URL, $url);
|
214 |
-
curl_setopt($ch, CURLOPT_POST, 1);
|
215 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
216 |
-
curl_setopt($ch, CURLOPT_HEADER, false);
|
217 |
-
if($type=="xml") {
|
218 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/xml', 'Content-Type: application/xml; charset=utf-8'));
|
219 |
-
} else {
|
220 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array('application/x-www-form-urlencoded; charset=utf-8'));
|
221 |
-
}
|
222 |
-
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
223 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
224 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
225 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
226 |
-
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
227 |
-
$response = curl_exec($ch);
|
228 |
-
curl_close($ch);
|
229 |
-
|
230 |
-
return $response;
|
231 |
-
}
|
232 |
-
##
|
233 |
-
|
234 |
-
function xml2ary(&$string) {
|
235 |
-
|
236 |
-
$parser = xml_parser_create();
|
237 |
-
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
|
238 |
-
xml_parse_into_struct($parser, $string, $vals, $index);
|
239 |
-
xml_parser_free($parser);
|
240 |
-
|
241 |
-
$mnary=array();
|
242 |
-
$ary=&$mnary;
|
243 |
-
foreach ($vals as $r) {
|
244 |
-
$t=$r['tag'];
|
245 |
-
if ($r['type']=='open') {
|
246 |
-
if (isset($ary[$t])) {
|
247 |
-
if (isset($ary[$t][0])) $ary[$t][]=array(); else $ary[$t]=array($ary[$t], array());
|
248 |
-
$cv=&$ary[$t][count($ary[$t])-1];
|
249 |
-
} else $cv=&$ary[$t];
|
250 |
-
if (isset($r['attributes'])) {foreach ($r['attributes'] as $k=>$v) $cv['_a'][$k]=$v;}
|
251 |
-
$cv['_c']=array();
|
252 |
-
$cv['_c']['_p']=&$ary;
|
253 |
-
$ary=&$cv['_c'];
|
254 |
-
|
255 |
-
} elseif ($r['type']=='complete') {
|
256 |
-
if (isset($ary[$t])) { // same as open
|
257 |
-
if (isset($ary[$t][0])) $ary[$t][]=array(); else $ary[$t]=array($ary[$t], array());
|
258 |
-
$cv=&$ary[$t][count($ary[$t])-1];
|
259 |
-
} else $cv=&$ary[$t];
|
260 |
-
if (isset($r['attributes'])) {foreach ($r['attributes'] as $k=>$v) $cv['_a'][$k]=$v;}
|
261 |
-
$cv['_v']=(isset($r['value']) ? $r['value'] : '');
|
262 |
-
|
263 |
-
} elseif ($r['type']=='close') {
|
264 |
-
$ary=&$ary['_p'];
|
265 |
-
}
|
266 |
-
}
|
267 |
-
|
268 |
-
$this->_del_p($mnary);
|
269 |
-
return $mnary;
|
270 |
-
}
|
271 |
-
|
272 |
-
#_Internal: Remove recursion in result array
|
273 |
-
function _del_p(&$ary) {
|
274 |
-
foreach ($ary as $k=>$v) {
|
275 |
-
if ($k==='_p') unset($ary[$k]);
|
276 |
-
elseif (is_array($ary[$k])) $this->_del_p($ary[$k]);
|
277 |
-
}
|
278 |
-
}
|
279 |
-
|
280 |
-
#Array to XML
|
281 |
-
function ary2xml($cary, $d=0, $forcetag='') {
|
282 |
-
$res=array();
|
283 |
-
foreach ($cary as $tag=>$r) {
|
284 |
-
if (isset($r[0])) {
|
285 |
-
$res[]=ary2xml($r, $d, $tag);
|
286 |
-
} else {
|
287 |
-
if ($forcetag) $tag=$forcetag;
|
288 |
-
$sp=str_repeat("\t", $d);
|
289 |
-
$res[]="$sp<$tag";
|
290 |
-
if (isset($r['_a'])) {foreach ($r['_a'] as $at=>$av) $res[]=" $at=\"$av\"";}
|
291 |
-
$res[]=">".((isset($r['_c'])) ? "\n" : '');
|
292 |
-
if (isset($r['_c'])) $res[]=ary2xml($r['_c'], $d+1);
|
293 |
-
elseif (isset($r['_v'])) $res[]=$r['_v'];
|
294 |
-
$res[]=(isset($r['_c']) ? $sp : '')."</$tag>\n";
|
295 |
-
}
|
296 |
-
|
297 |
-
}
|
298 |
-
return implode('', $res);
|
299 |
-
}
|
300 |
-
|
301 |
-
#Insert element into array
|
302 |
-
function ins2ary(&$ary, $element, $pos) {
|
303 |
-
$ar1=array_slice($ary, 0, $pos); $ar1[]=$element;
|
304 |
-
$ary=array_merge($ar1, array_slice($ary, $pos));
|
305 |
-
}
|
306 |
-
|
307 |
-
function pr($array,$exit=true) {
|
308 |
-
echo "<font color='#fff'> <pre>";
|
309 |
-
print_r($array);
|
310 |
-
echo "</pre> </font>";
|
311 |
-
($exit==true)?exit:"";
|
312 |
-
}
|
313 |
-
|
314 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/Exactordetails/Model/Exactoraccount.php
DELETED
@@ -1,281 +0,0 @@
|
|
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 |
-
|
28 |
-
/**
|
29 |
-
* Exactor Exactordetails model
|
30 |
-
*
|
31 |
-
* @category Exactor
|
32 |
-
* @package Exactor_Exactordetails
|
33 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
-
*/
|
35 |
-
|
36 |
-
class Exactor_Exactordetails_Model_Exactoraccount extends Mage_Core_Model_Abstract
|
37 |
-
{
|
38 |
-
protected $ExactorAccountVerifyUrl = "https://merchant.exactor.com/account/plugin/authenticate_url";
|
39 |
-
protected $ExactorCommitUrl = "https://taxrequest.exactor.com/request/xml" ;
|
40 |
-
protected $ExactorInvoiceUrl = "https://taxrequest.exactor.com/request/xml";
|
41 |
-
protected $ExactorUrl = "http://www.exactor.com/ns";
|
42 |
-
protected $ExactorUploadSkuUrl = "https://merchant.exactor.com/account/sku/upload_table";
|
43 |
-
protected $ExactorUploadProductListUrl = "https://merchant.exactor.com/account/plugin/upload_product_list";
|
44 |
-
|
45 |
-
protected $commitOptions = array("IN"=>"Invoice","SL" => "Sales order", "SP" => "Shipment", "NV" => "Never");
|
46 |
-
|
47 |
-
|
48 |
-
protected function _construct() {
|
49 |
-
|
50 |
-
$this->_init('exactordetails/exactoraccount');
|
51 |
-
}
|
52 |
-
|
53 |
-
function getID() {
|
54 |
-
|
55 |
-
return $this->getData("ID");
|
56 |
-
}
|
57 |
-
|
58 |
-
function setID($ID) {
|
59 |
-
|
60 |
-
$this->setData("ID",$ID);
|
61 |
-
}
|
62 |
-
|
63 |
-
function getCommitOptionsList(){
|
64 |
-
return $this->commitOptions;
|
65 |
-
}
|
66 |
-
|
67 |
-
function getCommitOptionDescription(){
|
68 |
-
return $this->commitOptions[$this->getCommitOption()];
|
69 |
-
}
|
70 |
-
|
71 |
-
function getStoreViewID() {
|
72 |
-
|
73 |
-
return $this->getData("StoreViewID");
|
74 |
-
}
|
75 |
-
|
76 |
-
function setStoreViewID($StoreViewID) {
|
77 |
-
|
78 |
-
$this->setData("StoreViewID",$StoreViewID);
|
79 |
-
}
|
80 |
-
|
81 |
-
|
82 |
-
function getMerchantID() {
|
83 |
-
|
84 |
-
return $this->getData("MerchantID");
|
85 |
-
}
|
86 |
-
|
87 |
-
|
88 |
-
function setMerchantID($MerchantID) {
|
89 |
-
|
90 |
-
$this->setData("MerchantID",$MerchantID);
|
91 |
-
}
|
92 |
-
|
93 |
-
|
94 |
-
function getUserID() {
|
95 |
-
|
96 |
-
return $this->getData("UserID");
|
97 |
-
}
|
98 |
-
|
99 |
-
|
100 |
-
function setUserID($UserID) {
|
101 |
-
|
102 |
-
$this->setData("UserID",$UserID);
|
103 |
-
}
|
104 |
-
|
105 |
-
|
106 |
-
function getPassword() {
|
107 |
-
|
108 |
-
return $this->getData("Password");
|
109 |
-
}
|
110 |
-
|
111 |
-
|
112 |
-
function setPassword($Password) {
|
113 |
-
|
114 |
-
$this->setData("Password",$Password);
|
115 |
-
}
|
116 |
-
|
117 |
-
|
118 |
-
function getFullName() {
|
119 |
-
|
120 |
-
return $this->getData("FullName");
|
121 |
-
}
|
122 |
-
|
123 |
-
|
124 |
-
function setFullName($FullName) {
|
125 |
-
|
126 |
-
$this->setData("FullName",$FullName);
|
127 |
-
}
|
128 |
-
|
129 |
-
|
130 |
-
function getStreet1() {
|
131 |
-
|
132 |
-
return $this->getData("Street1");
|
133 |
-
}
|
134 |
-
|
135 |
-
|
136 |
-
function setStreet1($Street1) {
|
137 |
-
|
138 |
-
$this->setData("Street1",$Street1);
|
139 |
-
}
|
140 |
-
|
141 |
-
|
142 |
-
function getStreet2() {
|
143 |
-
|
144 |
-
return $this->getData("Street2");
|
145 |
-
}
|
146 |
-
|
147 |
-
|
148 |
-
function setStreet2($Street2) {
|
149 |
-
|
150 |
-
$this->setData("Street2",$Street2);
|
151 |
-
}
|
152 |
-
|
153 |
-
|
154 |
-
function getCity() {
|
155 |
-
|
156 |
-
return $this->getData("City");
|
157 |
-
}
|
158 |
-
|
159 |
-
|
160 |
-
function setCity($City) {
|
161 |
-
|
162 |
-
$this->setData("City",$City);
|
163 |
-
}
|
164 |
-
|
165 |
-
|
166 |
-
function getStateOrProvince() {
|
167 |
-
|
168 |
-
return $this->getData("StateOrProvince");
|
169 |
-
}
|
170 |
-
|
171 |
-
|
172 |
-
function setStateOrProvince($StateOrProvince) {
|
173 |
-
|
174 |
-
$this->setData("StateOrProvince",$StateOrProvince);
|
175 |
-
}
|
176 |
-
|
177 |
-
|
178 |
-
function getPostalCode() {
|
179 |
-
|
180 |
-
return $this->getData("PostalCode");
|
181 |
-
}
|
182 |
-
|
183 |
-
|
184 |
-
function setPostalCode($PostalCode) {
|
185 |
-
|
186 |
-
$this->setData("PostalCode",$PostalCode);
|
187 |
-
}
|
188 |
-
|
189 |
-
|
190 |
-
function getCountry() {
|
191 |
-
|
192 |
-
return $this->getData("Country");
|
193 |
-
}
|
194 |
-
|
195 |
-
|
196 |
-
function setCountry($Country) {
|
197 |
-
|
198 |
-
$this->setData("Country",$Country);
|
199 |
-
}
|
200 |
-
|
201 |
-
|
202 |
-
function getShippingCharges() {
|
203 |
-
|
204 |
-
return $this->getData("ShippingCharges");
|
205 |
-
}
|
206 |
-
|
207 |
-
|
208 |
-
function setShippingCharges($ShippingCharges) {
|
209 |
-
|
210 |
-
$this->setData("ShippingCharges",$ShippingCharges);
|
211 |
-
}
|
212 |
-
|
213 |
-
|
214 |
-
function getSourceofSKU() {
|
215 |
-
|
216 |
-
return $this->getData("SourceofSKU");
|
217 |
-
}
|
218 |
-
|
219 |
-
|
220 |
-
function setSourceofSKU($SourceofSKU) {
|
221 |
-
|
222 |
-
$this->setData("SourceofSKU",$SourceofSKU);
|
223 |
-
}
|
224 |
-
|
225 |
-
function getCommitOption() {
|
226 |
-
|
227 |
-
return $this->getData("CommitOption");
|
228 |
-
}
|
229 |
-
|
230 |
-
|
231 |
-
function setCommitOption($CommitOption) {
|
232 |
-
if (!array_key_exists($CommitOption, $this->commitOptions) ){
|
233 |
-
throw new InvalidArgumentException("Invalid value for commit option. Possible values are: "
|
234 |
-
+ implode(", ", array_values($this->commitOptions)));
|
235 |
-
}
|
236 |
-
$this->setData("CommitOption",$CommitOption);
|
237 |
-
}
|
238 |
-
|
239 |
-
function getEntityExemptions() {
|
240 |
-
|
241 |
-
return $this->getData("EntityExemptions");
|
242 |
-
}
|
243 |
-
|
244 |
-
function setEntityExemptions($EntityExemptions) {
|
245 |
-
|
246 |
-
$this->setData("EntityExemptions",$EntityExemptions);
|
247 |
-
}
|
248 |
-
|
249 |
-
function getExactorAccountVerifyUrl() {
|
250 |
-
|
251 |
-
return $this->ExactorAccountVerifyUrl;
|
252 |
-
}
|
253 |
-
|
254 |
-
|
255 |
-
function getExactorCommitUrl() {
|
256 |
-
|
257 |
-
return $this->ExactorCommitUrl;
|
258 |
-
}
|
259 |
-
|
260 |
-
function getExactorInvoiceUrl() {
|
261 |
-
|
262 |
-
return $this->ExactorInvoiceUrl;
|
263 |
-
}
|
264 |
-
|
265 |
-
|
266 |
-
function getExactorUrl() {
|
267 |
-
|
268 |
-
return $this->ExactorUrl;
|
269 |
-
}
|
270 |
-
|
271 |
-
function getExactorUploadSkuUrl() {
|
272 |
-
|
273 |
-
return $this->ExactorUploadSkuUrl;
|
274 |
-
}
|
275 |
-
|
276 |
-
function getExactorUploadProductListUrl() {
|
277 |
-
|
278 |
-
return $this->ExactorUploadProductListUrl;
|
279 |
-
}
|
280 |
-
|
281 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/Exactordetails/controllers/Adminhtml/ExactorformController.php
DELETED
@@ -1,295 +0,0 @@
|
|
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 |
-
/**
|
28 |
-
* Exactor Exactordetails controller
|
29 |
-
*
|
30 |
-
* @category Exactor
|
31 |
-
* @package Exactor_Exactordetails
|
32 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
-
*/
|
34 |
-
|
35 |
-
class Exactor_Exactordetails_Adminhtml_ExactorformController extends Mage_Adminhtml_Controller_Action
|
36 |
-
{
|
37 |
-
#index action which is called by default
|
38 |
-
public function indexAction() {
|
39 |
-
|
40 |
-
#render the layout here
|
41 |
-
$this->loadLayout()->renderLayout();
|
42 |
-
}
|
43 |
-
|
44 |
-
protected function preprocessFormInput(&$data_form){
|
45 |
-
$data_form['MerchantID'] = trim($data_form['MerchantID']);
|
46 |
-
$data_form['UserID'] = trim($data_form['UserID']);
|
47 |
-
}
|
48 |
-
|
49 |
-
#post function which is called when Exactor informations are submitted
|
50 |
-
public function postAction()
|
51 |
-
{
|
52 |
-
#set the custom url here for the store
|
53 |
-
$this->exactor_details_url = "exactordetails/adminhtml_Exactorform/index/store/";
|
54 |
-
|
55 |
-
#validate the form key while the data are submitted
|
56 |
-
$this->validate();
|
57 |
-
|
58 |
-
#check if error flag is set or unset
|
59 |
-
if($this->error_flag) {
|
60 |
-
return $this;
|
61 |
-
}
|
62 |
-
try {
|
63 |
-
#get the form data from the post data
|
64 |
-
$data_form = $this->post["exactordetailsform"];
|
65 |
-
$store_view_id = $data_form["StoreViewID"];
|
66 |
-
|
67 |
-
#call the model function here
|
68 |
-
$exactor_model = $this->exactor_details_model;
|
69 |
-
|
70 |
-
#set all the model function here so as to save data in the database
|
71 |
-
if(trim($data_form["ID"])!="") {
|
72 |
-
$exactor_model->setID($data_form["ID"]);
|
73 |
-
}
|
74 |
-
$exactor_model->setStoreViewID((int)$data_form["StoreViewID"]);
|
75 |
-
$exactor_model->setMerchantID($data_form["MerchantID"]);
|
76 |
-
$exactor_model->setUserID($data_form["UserID"]);
|
77 |
-
$exactor_model->setPassword(Mage::helper('exactordetails/data')->str2hex($data_form["Password"]));
|
78 |
-
$exactor_model->setFullName($data_form["FullName"]);
|
79 |
-
$exactor_model->setStreet1($data_form["Street1"]);
|
80 |
-
$exactor_model->setStreet2($data_form["Street2"]);
|
81 |
-
$exactor_model->setCity($data_form["City"]);
|
82 |
-
$exactor_model->setStateOrProvince($data_form["StateOrProvince"]);
|
83 |
-
$exactor_model->setPostalCode($data_form["PostalCode"]);
|
84 |
-
$exactor_model->setCountry($data_form["Country"]);
|
85 |
-
$exactor_model->setShippingCharges($data_form["ShippingCharges"]);
|
86 |
-
$exactor_model->setCommitOption($data_form["CommitOption"]);
|
87 |
-
$exactor_model->setEntityExemptions($data_form["EntityExemptions"]);
|
88 |
-
$exactor_model->setSourceofSKU($data_form["SourceofSKU"]);
|
89 |
-
|
90 |
-
#save the exactor model details
|
91 |
-
$exactor_model->save();
|
92 |
-
|
93 |
-
#unset the exactor session data value
|
94 |
-
$this->unset_exactor_session_isset();
|
95 |
-
|
96 |
-
#set the success message in admin session
|
97 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($this->succ_message);
|
98 |
-
|
99 |
-
} catch (Exception $e) {
|
100 |
-
|
101 |
-
#set the error message in admin session
|
102 |
-
Mage::getSingleton('adminhtml/session')->addError($this->err_message);
|
103 |
-
}
|
104 |
-
|
105 |
-
#redirect to the previous page
|
106 |
-
$this->_redirect($this->exactor_details_url.$store_view_id);
|
107 |
-
}
|
108 |
-
|
109 |
-
#function to validate the form when submmited
|
110 |
-
#check whther the form key is same
|
111 |
-
function validate() {
|
112 |
-
|
113 |
-
ini_set("display_errors",1);
|
114 |
-
|
115 |
-
#get the post value after inserting the exactor information
|
116 |
-
$this->post = $this->getRequest()->getPost();
|
117 |
-
|
118 |
-
$this->preprocessFormInput($this->post["exactordetailsform"]);
|
119 |
-
|
120 |
-
#call the model function here
|
121 |
-
$this->exactor_details_model = Mage::getModel('exactordetails/exactoraccount');
|
122 |
-
|
123 |
-
#get the session form key
|
124 |
-
$session_form_key = Mage::getSingleton('core/session')->getFormKey();
|
125 |
-
|
126 |
-
#set the helper object here
|
127 |
-
$this->exactordetails_helper = Mage::helper('exactordetails/data');
|
128 |
-
|
129 |
-
#the below variable stores the transaction Id that was generated at exactor API
|
130 |
-
#and to delete after verification id done
|
131 |
-
$this->exactor_transaction_Id = null;
|
132 |
-
|
133 |
-
#check the form key flag here
|
134 |
-
$form_key_flag_unmatch = false;
|
135 |
-
|
136 |
-
#set the error and success messages here ## changed - succ_message -err_message_auth
|
137 |
-
$this->succ_message = "Exactor Account was successfully set up.";
|
138 |
-
$this->err_message = "Some error has been encountered while saving your Exactor Merchant Infomation.
|
139 |
-
Please Try Again.";
|
140 |
-
$this->err_message_auth = "Invalid Account #, User Name or Password. Please setup the correct Exactor
|
141 |
-
Account Information. ";
|
142 |
-
$this->err_message_address = "Invalid company address. Please correct the company address to ensure that it
|
143 |
-
is set to a valid address.";
|
144 |
-
$this->error_flag = 0;
|
145 |
-
//$this->err_message_address = "Exactor information address are not valid. Please enter valid Exactor Address Information.";
|
146 |
-
|
147 |
-
|
148 |
-
#save the exactor post values in the session if error occurs
|
149 |
-
$this->session = Mage::getSingleton('core/session', array('name'=>'frontend'));
|
150 |
-
|
151 |
-
#set the exactor account details session
|
152 |
-
if(isset($this->post['exactordetailsform'])) {
|
153 |
-
|
154 |
-
$data_form = $this->post['exactordetailsform'];
|
155 |
-
//$this->session->setData('exactor_account_details',$data_form);
|
156 |
-
$store_view_id = $data_form["StoreViewID"];
|
157 |
-
}
|
158 |
-
|
159 |
-
#check the form key status here
|
160 |
-
#so as to set the status true
|
161 |
-
if(isset($this->post['form_key'])) {
|
162 |
-
|
163 |
-
if($this->post['form_key']!=$session_form_key) {
|
164 |
-
|
165 |
-
$form_key_flag_unmatch = true;
|
166 |
-
}
|
167 |
-
}
|
168 |
-
|
169 |
-
if(($form_key_flag_unmatch)||(empty($this->post))) {
|
170 |
-
|
171 |
-
#set the error message in admin session
|
172 |
-
Mage::getSingleton('adminhtml/session')->addError($this->err_message);
|
173 |
-
|
174 |
-
#redirect to the previous page
|
175 |
-
$this->_redirect($this->exactor_details_url.$store_view_id);
|
176 |
-
|
177 |
-
$this->error_flag = 1;
|
178 |
-
}else {
|
179 |
-
|
180 |
-
#create the exactor user string to validate exactor details at exactor API
|
181 |
-
$data_string = "merchant_id=" . htmlspecialchars($data_form['MerchantID']) . "&username=" . htmlspecialchars($data_form['UserID']) . "&password=" . htmlspecialchars($data_form['Password']);
|
182 |
-
|
183 |
-
#get the account authentication from exactor model
|
184 |
-
$account_autheticate_url = $this->exactor_details_model->getExactorAccountVerifyUrl();
|
185 |
-
|
186 |
-
$response = $this->exactordetails_helper->exactor_do_post_request($account_autheticate_url,$data_string,"string");
|
187 |
-
|
188 |
-
if(strtolower($response)=='denied') {
|
189 |
-
|
190 |
-
#set the error message in admin session
|
191 |
-
Mage::getSingleton('adminhtml/session')->addError($this->err_message_auth);
|
192 |
-
|
193 |
-
#redirect to the previous page
|
194 |
-
$this->_redirect($this->exactor_details_url.$store_view_id);
|
195 |
-
|
196 |
-
$this->error_flag = 1;
|
197 |
-
}
|
198 |
-
else {
|
199 |
-
|
200 |
-
#check for exactor information address as to validate is it correct or not
|
201 |
-
$this->validate_exactor_information_address($data_form);
|
202 |
-
|
203 |
-
#if validate_address_error is set to 1 then generate an error
|
204 |
-
if($this->exactor_transaction_Id==null) {
|
205 |
-
|
206 |
-
#set the error message in admin session
|
207 |
-
Mage::getSingleton('adminhtml/session')->addError($this->err_message_address);
|
208 |
-
|
209 |
-
#redirect to the previous page
|
210 |
-
$this->_redirect($this->exactor_details_url.$store_view_id);
|
211 |
-
|
212 |
-
$this->error_flag = 1;
|
213 |
-
} else {
|
214 |
-
|
215 |
-
#delete the exactor information from the exactor API if the address verification is successfull or not
|
216 |
-
#so as to reduce the uncommited transaction
|
217 |
-
//$this->exactordetails_helper->deleteExactor_Transaction($this->exactor_transaction_Id);
|
218 |
-
}
|
219 |
-
|
220 |
-
}
|
221 |
-
}
|
222 |
-
|
223 |
-
}
|
224 |
-
|
225 |
-
#the below function is used to validate the exactor information address
|
226 |
-
public function validate_exactor_information_address($data_form) {
|
227 |
-
|
228 |
-
#get the exactor url details here
|
229 |
-
$ExactorUrl = $this->exactor_details_model->getExactorUrl();
|
230 |
-
$ExactorInvoiceUrl = $this->exactor_details_model->getExactorInvoiceUrl();
|
231 |
-
$ExactorPluginVersion = $this->exactordetails_helper->get_taxrequest_string();
|
232 |
-
|
233 |
-
|
234 |
-
$xml = "<TaxRequest xmlns=\"".$ExactorUrl."\" ".htmlspecialchars($ExactorPluginVersion).">";
|
235 |
-
$xml .= "<MerchantId>".htmlspecialchars($data_form['MerchantID'])."</MerchantId>";
|
236 |
-
$xml .= "<UserId>".htmlspecialchars($data_form['UserID'])."</UserId>";
|
237 |
-
$xml .= "<InvoiceRequest>";
|
238 |
-
$xml .= "<SaleDate>" . Mage::getModel('core/date')->date('Y-m-d') . "</SaleDate>";
|
239 |
-
$xml .= "<CurrencyCode>" . "USD" . "</CurrencyCode>";
|
240 |
-
|
241 |
-
$exactor_info = "<FullName>Magento Test Transaction</FullName>";
|
242 |
-
$exactor_info .= "<Street1>".htmlspecialchars($data_form['Street1'])."</Street1>";
|
243 |
-
$exactor_info .= "<Street2>".htmlspecialchars($data_form['Street2'])."</Street2>";
|
244 |
-
$exactor_info .= "<City>".htmlspecialchars($data_form['City'])."</City>";
|
245 |
-
$exactor_info .= "<StateOrProvince>".htmlspecialchars($data_form['StateOrProvince'])."</StateOrProvince>";
|
246 |
-
$exactor_info .= "<PostalCode>".htmlspecialchars($data_form['PostalCode'])."</PostalCode>";
|
247 |
-
$exactor_info .= "<Country>".htmlspecialchars($data_form['Country'])."</Country>";
|
248 |
-
|
249 |
-
$xml .= "<BillTo>";
|
250 |
-
$xml .= $exactor_info;
|
251 |
-
$xml .= "</BillTo>";
|
252 |
-
|
253 |
-
$xml .= "<ShipTo>";
|
254 |
-
$xml .= $exactor_info;
|
255 |
-
$xml .= "</ShipTo>";
|
256 |
-
|
257 |
-
$xml .= "<ShipFrom>";
|
258 |
-
$xml .= $exactor_info;
|
259 |
-
$xml .= "</ShipFrom>";
|
260 |
-
|
261 |
-
$xml .= "<LineItem id=\"_1\">";
|
262 |
-
$xml .= "<Description>Exactor Account Verification</Description>";
|
263 |
-
$xml .= "<Quantity>1</Quantity>";
|
264 |
-
$xml .= "<GrossAmount>0</GrossAmount>";
|
265 |
-
$xml .= "</LineItem>";
|
266 |
-
|
267 |
-
$xml .= "</InvoiceRequest>";
|
268 |
-
$xml .= "</TaxRequest>";
|
269 |
-
|
270 |
-
#sent the xml data to exactor to verify the merchant address
|
271 |
-
$response = $this->exactordetails_helper->exactor_do_post_request($ExactorInvoiceUrl,$xml);
|
272 |
-
|
273 |
-
#convert the xml response into array
|
274 |
-
$xml_responseArray = $this->exactordetails_helper->xml2ary($response);
|
275 |
-
|
276 |
-
#set the transaction ID here
|
277 |
-
if(isset($xml_responseArray["TaxResponse"]["_c"]["InvoiceResponse"]["_c"]["TransactionId"]["_v"])) {
|
278 |
-
|
279 |
-
$this->exactor_transaction_Id = $xml_responseArray["TaxResponse"]["_c"]["InvoiceResponse"]["_c"]["TransactionId"]["_v"];
|
280 |
-
}
|
281 |
-
|
282 |
-
}
|
283 |
-
|
284 |
-
#function to check if the session is set while submiting the form
|
285 |
-
public function unset_exactor_session_isset() {
|
286 |
-
|
287 |
-
#if the session is set
|
288 |
-
$exactor_account_details = $this->session->getData('exactor_account_details');
|
289 |
-
|
290 |
-
if(is_array($exactor_account_details)) {
|
291 |
-
|
292 |
-
$this->session->getData('exactor_account_details',true);
|
293 |
-
}
|
294 |
-
}
|
295 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/Exactordetails/controllers/AjaxController.php
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Exactor_Exactordetails_AjaxController extends Mage_Core_Controller_Front_Action
|
3 |
-
{
|
4 |
-
public function get_exactor_statusAction()
|
5 |
-
{
|
6 |
-
$jsonBody=array();
|
7 |
-
$exactor_status = Mage::getSingleton('checkout/session')->getData("error_message");
|
8 |
-
$ex_error = Mage::getSingleton('checkout/session')->getData("ex_error");
|
9 |
-
|
10 |
-
//$jsonBody["exactor_status"]= $exactor_status;
|
11 |
-
$jsonBody["exactor_status"]= $ex_error;
|
12 |
-
$this->getResponse()->setBody(json_encode($jsonBody));
|
13 |
-
Mage::log("Send ajax : " . $exactor_status);
|
14 |
-
Mage::log("exactor_status : " . $exactor_status );
|
15 |
-
}
|
16 |
-
}
|
17 |
-
|
18 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/Exactordetails/sql/exactordetails_setup/mysql4-install-2011.07.19.php
DELETED
@@ -1,139 +0,0 @@
|
|
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 |
-
/**
|
31 |
-
* @var $versionResolver Exactor_Exactordetails_Helper_VersionResolver
|
32 |
-
*/
|
33 |
-
$versionResolver = Mage::helper("exactordetails/VersionResolver");
|
34 |
-
|
35 |
-
$installer->startSetup();
|
36 |
-
|
37 |
-
$installer->run("
|
38 |
-
CREATE TABLE IF NOT EXISTS {$this->getTable('exactor_account')} (
|
39 |
-
`ID` int(10) NOT NULL AUTO_INCREMENT,
|
40 |
-
`StoreViewID` int(20) DEFAULT NULL,
|
41 |
-
`MerchantID` varchar(50) NOT NULL,
|
42 |
-
`UserID` varchar(50) NOT NULL DEFAULT '',
|
43 |
-
`Password` varchar(50) DEFAULT NULL,
|
44 |
-
`FullName` varchar(250) NOT NULL DEFAULT '',
|
45 |
-
`Street1` varchar(250) NOT NULL DEFAULT '',
|
46 |
-
`Street2` varchar(250) DEFAULT NULL,
|
47 |
-
`City` varchar(150) NOT NULL DEFAULT '',
|
48 |
-
`StateOrProvince` varchar(50) NOT NULL DEFAULT '',
|
49 |
-
`PostalCode` varchar(50) NOT NULL DEFAULT '',
|
50 |
-
`Country` varchar(50) NOT NULL DEFAULT '',
|
51 |
-
`ShippingCharges` varchar(2) DEFAULT NULL,
|
52 |
-
`SourceofSKU` varchar(2) DEFAULT NULL,
|
53 |
-
`AttributeName` varchar(50) DEFAULT NULL,
|
54 |
-
`CommitOption` varchar(2) DEFAULT NULL,
|
55 |
-
`EntityExemptions` varchar(2) DEFAULT NULL,
|
56 |
-
PRIMARY KEY (`ID`)
|
57 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
58 |
-
|
59 |
-
|
60 |
-
CREATE TABLE IF NOT EXISTS {$this->getTable('exactor_uninstall_backup_data')} (
|
61 |
-
`Id` int(50) DEFAULT NULL AUTO_INCREMENT,
|
62 |
-
`TableName` varchar(250) DEFAULT NULL,
|
63 |
-
`ColumnName` varchar(250) DEFAULT NULL,
|
64 |
-
`ColumnValue` varchar(250) DEFAULT NULL,
|
65 |
-
`ColumnConditionName_1` varchar(250) DEFAULT NULL,
|
66 |
-
`ColumnConditionValue_1` varchar(250) DEFAULT NULL,
|
67 |
-
`ColumnConditionName_2` varchar(250) DEFAULT NULL,
|
68 |
-
`ColumnConditionValue_2` varchar(250) DEFAULT NULL,
|
69 |
-
`Date_of_archiving` timestamp ,
|
70 |
-
PRIMARY KEY (`Id`)
|
71 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
72 |
-
|
73 |
-
CREATE TABLE IF NOT EXISTS {$this->getTable('exactor_transaction_order')} (
|
74 |
-
`ID` int(20) NOT NULL AUTO_INCREMENT,
|
75 |
-
`TransactionID` varchar(100) DEFAULT NULL,
|
76 |
-
`OrderID` varchar(100) DEFAULT NULL,
|
77 |
-
`UserID` varchar(50) DEFAULT NULL,
|
78 |
-
`MerchantID` varchar(50) DEFAULT NULL,
|
79 |
-
`DateOfOrder` date DEFAULT NULL,
|
80 |
-
`Commited` tinyint(1) DEFAULT 1,
|
81 |
-
PRIMARY KEY (`ID`)
|
82 |
-
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
83 |
-
|
84 |
-
|
85 |
-
DELETE FROM {$this->getTable('tax_calculation_rule')} WHERE code = 'Exactor Tax';
|
86 |
-
|
87 |
-
INSERT INTO {$this->getTable('tax_calculation_rule')} (code,priority,position)
|
88 |
-
Values('Exactor Tax',1,1);
|
89 |
-
|
90 |
-
DELETE FROM {$this->getTable('tax_class')} WHERE class_name IN('Exactor Tax Product','Exactor Tax Customer');
|
91 |
-
|
92 |
-
INSERT INTO {$this->getTable('tax_class')} (class_name,class_type)
|
93 |
-
Values('Exactor Tax Product','PRODUCT'),
|
94 |
-
('Exactor Tax Customer','CUSTOMER');
|
95 |
-
|
96 |
-
DELETE FROM {$this->getTable('tax_calculation_rate')} WHERE code ='Exactor-Tax';
|
97 |
-
|
98 |
-
INSERT INTO {$this->getTable('tax_calculation_rate')} (tax_country_id,tax_region_id,tax_postcode,code,rate)
|
99 |
-
Values('US',0,'*','Exactor-Tax',0.0);
|
100 |
-
|
101 |
-
INSERT INTO {$this->getTable('tax_calculation')} (tax_calculation_rate_id,tax_calculation_rule_id,customer_tax_class_id,product_tax_class_id)
|
102 |
-
SELECT (SELECT tax_calculation_rate_id FROM {$this->getTable('tax_calculation_rate')}
|
103 |
-
WHERE code='Exactor-Tax'),
|
104 |
-
(SELECT tax_calculation_rule_id FROM {$this->getTable('tax_calculation_rule')}
|
105 |
-
WHERE code='Exactor Tax'),
|
106 |
-
(SELECT class_id FROM {$this->getTable('tax_class')}
|
107 |
-
WHERE class_name='Exactor Tax Customer'),
|
108 |
-
(SELECT class_id FROM {$this->getTable('tax_class')}
|
109 |
-
WHERE class_name='Exactor Tax Product')
|
110 |
-
FROM Dual;
|
111 |
-
|
112 |
-
INSERT INTO {$this->getTable('exactor_uninstall_backup_data')} (TableName,ColumnName,ColumnValue,ColumnConditionName_1,ColumnConditionValue_1,ColumnConditionName_2,ColumnConditionValue_2,Date_of_archiving) SELECT 'customer_group','tax_class_id',tax_class_id,'customer_group_code',customer_group_code,NULL,NULL,CURRENT_TIMESTAMP FROM {$this->getTable('customer_group')};
|
113 |
-
|
114 |
-
UPDATE {$this->getTable('customer_group')} SET tax_class_id = (SELECT class_id FROM {$this->getTable('tax_class')} WHERE class_name='Exactor Tax Customer');
|
115 |
-
|
116 |
-
INSERT INTO {$this->getTable('exactor_uninstall_backup_data')} (TableName,ColumnName,ColumnValue,ColumnConditionName_1,ColumnConditionValue_1,ColumnConditionName_2,ColumnConditionValue_2,Date_of_archiving) SELECT 'catalog_product_entity_int','value',value,'attribute_id',attribute_id,'entity_id',entity_id,CURRENT_TIMESTAMP FROM {$this->getTable('catalog_product_entity_int')} WHERE attribute_id IN (SELECT attribute_id from {$this->getTable('eav_attribute')} WHERE attribute_code='tax_class_id');
|
117 |
-
|
118 |
-
UPDATE {$this->getTable('catalog_product_entity_int')} SET value = (SELECT class_id FROM {$this->getTable('tax_class')} WHERE class_name='Exactor Tax Product') WHERE attribute_id IN (SELECT attribute_id from {$this->getTable('eav_attribute')} WHERE attribute_code='tax_class_id');
|
119 |
-
|
120 |
-
INSERT INTO {$this->getTable('exactor_uninstall_backup_data')} (TableName,ColumnName,ColumnValue,ColumnConditionName_1,ColumnConditionValue_1,ColumnConditionName_2,ColumnConditionValue_2,Date_of_archiving) SELECT 'core_config_data','value',value,'path',path,'scope',scope,CURRENT_TIMESTAMP FROM {$this->getTable('core_config_data')} WHERE path IN ('tax/classes/shipping_tax_class','tax/calculation/based_on','tax/calculation/apply_after_discount');
|
121 |
-
|
122 |
-
DELETE FROM {$this->getTable('core_config_data')} WHERE path IN ('tax/classes/shipping_tax_class','tax/calculation/based_on','tax/calculation/apply_after_discount');
|
123 |
-
|
124 |
-
INSERT INTO {$this->getTable('core_config_data')} (scope,scope_id,path,value) Values('default',0,'tax/calculation/based_on','shipping');
|
125 |
-
|
126 |
-
INSERT INTO {$this->getTable('core_config_data')} (scope,scope_id,path,value) SELECT 'default', 0, 'tax/classes/shipping_tax_class', class_id FROM {$this->getTable('tax_class')} WHERE class_name='Exactor Tax Product';
|
127 |
-
|
128 |
-
INSERT INTO {$this->getTable('core_config_data')} (scope,scope_id,path,value) Values('default',0,'tax/calculation/apply_after_discount','1');
|
129 |
-
|
130 |
-
");
|
131 |
-
|
132 |
-
if ($versionResolver->isAllowedForVersion("1.6<")){
|
133 |
-
// For 1.6<
|
134 |
-
$installer->run("
|
135 |
-
INSERT INTO {$this->getTable('exactor_uninstall_backup_data')} (TableName,ColumnName,ColumnValue,ColumnConditionName_1,ColumnConditionValue_1,ColumnConditionName_2,ColumnConditionValue_2,Date_of_archiving) SELECT 'catalogindex_eav','value',value,'attribute_id',attribute_id,'entity_id',entity_id,CURRENT_TIMESTAMP FROM {$this->getTable('catalogindex_eav')} WHERE attribute_id IN (SELECT attribute_id from {$this->getTable('eav_attribute')} WHERE attribute_code='tax_class_id');
|
136 |
-
UPDATE {$this->getTable('catalogindex_eav')} SET value = (SELECT class_id FROM {$this->getTable('tax_class')} WHERE class_name='Exactor Tax Product') WHERE attribute_id IN (SELECT attribute_id from {$this->getTable('eav_attribute')} WHERE attribute_code='tax_class_id');
|
137 |
-
");
|
138 |
-
}
|
139 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/Paypal/Model/Express/Checkout.php
DELETED
@@ -1,119 +0,0 @@
|
|
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_Sales
|
23 |
-
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Exactor Tax ax Calculation Model
|
29 |
-
*
|
30 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
31 |
-
*/
|
32 |
-
class Exactor_Paypal_Model_Express_Checkout extends Mage_Paypal_Model_Express_Checkout
|
33 |
-
{
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Place the order and recurring payment profiles when customer returned from paypal
|
37 |
-
* Until this moment all quote data must be valid
|
38 |
-
*
|
39 |
-
* @param string $token
|
40 |
-
* @param string $shippingMethodCode
|
41 |
-
*/
|
42 |
-
public function place($token, $shippingMethodCode = null)
|
43 |
-
{
|
44 |
-
if ($shippingMethodCode) {
|
45 |
-
$this->updateShippingMethod($shippingMethodCode);
|
46 |
-
}
|
47 |
-
|
48 |
-
if (!$this->_quote->getCustomerId()) {
|
49 |
-
$this->_quote->setCustomerIsGuest(true)
|
50 |
-
->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID)
|
51 |
-
->setCustomerEmail($this->_quote->getBillingAddress()->getEmail());
|
52 |
-
}
|
53 |
-
|
54 |
-
$this->ignoreAddressValidation();
|
55 |
-
$this->_quote->collectTotals();
|
56 |
-
$service = Mage::getModel('sales/service_quote', $this->_quote);
|
57 |
-
$service->submitAll();
|
58 |
-
$this->_quote->save();
|
59 |
-
$this->_recurringPaymentProfiles = $service->getRecurringPaymentProfiles();
|
60 |
-
// TODO: send recurring profile emails
|
61 |
-
|
62 |
-
$order = $service->getOrder();
|
63 |
-
|
64 |
-
if (!$order) {
|
65 |
-
return;
|
66 |
-
}
|
67 |
-
|
68 |
-
//commit the exactor transaction here
|
69 |
-
$this->commit_exactor_transaction($order);
|
70 |
-
|
71 |
-
$this->_billingAgreement = $order->getPayment()->getBillingAgreement();
|
72 |
-
|
73 |
-
// commence redirecting to finish payment, if paypal requires it
|
74 |
-
if ($order->getPayment()->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_REDIRECT)) {
|
75 |
-
$this->_redirectUrl = $this->_config->getExpressCheckoutCompleteUrl($token);
|
76 |
-
}
|
77 |
-
|
78 |
-
switch ($order->getState()) {
|
79 |
-
// even after placement paypal can disallow to authorize/capture, but will wait until bank transfers money
|
80 |
-
case Mage_Sales_Model_Order::STATE_PENDING_PAYMENT:
|
81 |
-
// TODO
|
82 |
-
break;
|
83 |
-
// regular placement, when everything is ok
|
84 |
-
case Mage_Sales_Model_Order::STATE_PROCESSING:
|
85 |
-
case Mage_Sales_Model_Order::STATE_COMPLETE:
|
86 |
-
case Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW:
|
87 |
-
$order->sendNewOrderEmail();
|
88 |
-
break;
|
89 |
-
}
|
90 |
-
$this->_order = $order;
|
91 |
-
}
|
92 |
-
|
93 |
-
#function to commit exactor transaction in the exactor API
|
94 |
-
function commit_exactor_transaction($order){
|
95 |
-
|
96 |
-
#get the order_id object from the varient event object
|
97 |
-
$order_id = $order->getIncrementId();
|
98 |
-
|
99 |
-
#call the Tax observer model function here
|
100 |
-
$this->exactor_tax_model_observer = Mage::getModel('exactor_tax/observer');
|
101 |
-
|
102 |
-
#if the shipping method is not multiple shipping
|
103 |
-
if(!$this->_quote->getIsMultiShipping()) {
|
104 |
-
#commit the transaction order which is defiend in Xyz_Tax_Model_Observer
|
105 |
-
$this->exactor_tax_model_observer->commitExactor_Transaction_Onepage($order_id);
|
106 |
-
}
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Make sure addresses will be saved without validation errors
|
111 |
-
*/
|
112 |
-
private function ignoreAddressValidation()
|
113 |
-
{
|
114 |
-
$this->_quote->getBillingAddress()->setShouldIgnoreValidation(true);
|
115 |
-
if (!$this->_quote->getIsVirtual()) {
|
116 |
-
$this->_quote->getShippingAddress()->setShouldIgnoreValidation(true);
|
117 |
-
}
|
118 |
-
}
|
119 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/Paypal/etc/config.xml
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?xml version="1.0" ?>
|
2 |
-
<!--
|
3 |
-
/**
|
4 |
-
* Magento
|
5 |
-
*
|
6 |
-
* NOTICE OF LICENSE
|
7 |
-
*
|
8 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://opensource.org/licenses/afl-3.0.php
|
12 |
-
* If you did not receive a copy of the license and are unable to
|
13 |
-
* obtain it through the world-wide-web, please send an email
|
14 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
-
*
|
16 |
-
* DISCLAIMER
|
17 |
-
*
|
18 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
-
* versions in the future. If you wish to customize Magento for your
|
20 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
-
*
|
22 |
-
* @category Exactor
|
23 |
-
* @package Exactor_Sales
|
24 |
-
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
25 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
-
*/
|
27 |
-
-->
|
28 |
-
<config>
|
29 |
-
<modules>
|
30 |
-
<Exactor_Paypal>
|
31 |
-
<version>2012.03.26</version>
|
32 |
-
</Exactor_Paypal>
|
33 |
-
</modules>
|
34 |
-
|
35 |
-
<global>
|
36 |
-
<models>
|
37 |
-
<exactor_paypal>
|
38 |
-
<class>Exactor_Paypal_Model_Express_Checkout</class>
|
39 |
-
</exactor_paypal>
|
40 |
-
<paypal>
|
41 |
-
<rewrite>
|
42 |
-
<express_checkout>Exactor_Paypal_Model_Express_Checkout</express_checkout>
|
43 |
-
</rewrite>
|
44 |
-
</paypal>
|
45 |
-
</models>
|
46 |
-
</global>
|
47 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/Sales/Model/Observer.php
CHANGED
@@ -4,61 +4,149 @@
|
|
4 |
* Date: 11/28/11
|
5 |
* Time: 12:02 PM
|
6 |
*/
|
7 |
-
|
8 |
class Exactor_Sales_Model_Observer {
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
-
|
19 |
try{
|
20 |
-
$this->
|
21 |
-
|
22 |
-
|
23 |
-
Mage::log("Error while sending refund request to Exactor" . $e->getMessage());
|
24 |
}
|
25 |
}
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
31 |
}
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
$this->
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
}
|
|
|
|
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
-
*
|
51 |
* @param Varien_Event_Observer $observer
|
52 |
* @return void
|
53 |
*/
|
54 |
-
public function
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
}
|
64 |
-
}
|
4 |
* Date: 11/28/11
|
5 |
* Time: 12:02 PM
|
6 |
*/
|
7 |
+
|
8 |
class Exactor_Sales_Model_Observer {
|
9 |
|
10 |
+
/** @var Exactor_ExactorSettings_Helper_Data */
|
11 |
+
private $exactorSettingsHelper;
|
12 |
+
/** @var Exactor_Core_Helper_SessionCache */
|
13 |
+
private $sessionCache;
|
14 |
+
/** @var Exactor_Core_Model_MerchantSettings */
|
15 |
+
private $merchantSettings;
|
16 |
+
/** @var ExactorProcessingService*/
|
17 |
+
private $exactorProcessingService;
|
18 |
+
/** @var IExactorLogger */
|
19 |
+
private $logger;
|
20 |
+
|
21 |
+
private function setupExactorCommonLibrary(){
|
22 |
+
$libDir = Mage::getBaseDir("lib") . '/ExactorCommons';
|
23 |
+
require_once($libDir . '/XmlProcessing.php');
|
24 |
+
require_once($libDir . '/ExactorDomainObjects.php');
|
25 |
+
require_once($libDir . '/ExactorCommons.php');
|
26 |
+
// Magento specific definitions
|
27 |
+
require_once($libDir . '/Magento.php');
|
28 |
+
require_once($libDir . '/config.php');
|
29 |
+
}
|
30 |
+
|
31 |
+
function __construct()
|
32 |
+
{
|
33 |
+
$this->setupExactorCommonLibrary();
|
34 |
+
$this->logger = ExactorLoggingFactory::getInstance()->getLogger($this);
|
35 |
+
$this->exactorSettingsHelper = Mage::helper('ExactorSettings');
|
36 |
+
$this->sessionCache = Mage::helper('Exactor_Core_SessionCache/');
|
37 |
+
// Merchant Settings
|
38 |
+
$this->merchantSettings = $this->loadMerchantSettings();
|
39 |
+
if ($this->merchantSettings != null)
|
40 |
+
$this->exactorProcessingService = ExactorProcessingServiceFactory::getInstance()->buildExactorProcessingService(
|
41 |
+
$this->merchantSettings->getMerchantID(),
|
42 |
+
$this->merchantSettings->getUserID());
|
43 |
+
else
|
44 |
+
$this->exactorProcessingService = null;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @return Exactor_Core_Model_MerchantSettings|null
|
49 |
+
*/
|
50 |
+
private function loadMerchantSettings(){
|
51 |
+
$logger = ExactorLoggingFactory::getInstance()->getLogger($this);
|
52 |
+
$merchantSettings = $this->exactorSettingsHelper->loadValidMerchantSettings($this->getStoreViewId());
|
53 |
+
if ($merchantSettings == null){
|
54 |
+
$logger->error('Settings are not populated.', 'buildExactorProcessingService');
|
55 |
+
return null;
|
56 |
+
}
|
57 |
+
return $merchantSettings;
|
58 |
}
|
59 |
|
60 |
+
private function commitTransactionForOrder($orderId){
|
61 |
try{
|
62 |
+
$this->exactorProcessingService->commitExistingInvoiceForOrder($orderId);
|
63 |
+
}catch (Exception $e){
|
64 |
+
$this->logger->error("Can't commit transaction. See details above.", 'commitTransactionForOrder');
|
|
|
65 |
}
|
66 |
}
|
67 |
|
68 |
+
private function refundTransactionForOrder($orderId){
|
69 |
+
try{
|
70 |
+
$this->exactorProcessingService->refundTransactionForOrder($orderId);
|
71 |
+
}catch (Exception $e){
|
72 |
+
$this->logger->error("Can't commit transaction. See details above.", 'commitTransactionForOrder');
|
73 |
+
}
|
74 |
}
|
75 |
|
76 |
+
public function handleAllOrdersCompleted(Varien_Event_Observer $observer){
|
77 |
+
if ($this->merchantSettings == null) return;
|
78 |
+
if (is_array($observer->getOrders()))
|
79 |
+
$orders = array_reverse($observer->getOrders());
|
80 |
+
else
|
81 |
+
$orders = array($observer->getOrder());
|
82 |
+
foreach($orders as $order){
|
83 |
+
$transactionInfo = $this->sessionCache->popTransactionInfo();
|
84 |
+
if ($transactionInfo == null){
|
85 |
+
$this->logger->error('Nothing to process. There is no transaction in the session cache', 'handleCreatedOrder');
|
86 |
+
return;
|
87 |
+
}
|
88 |
+
// Update transaction info with order information
|
89 |
+
$orderId = $order->getIncrementId();
|
90 |
+
$transactionInfo->setShoppingCartTrnId($orderId);
|
91 |
+
// Push latest transaction from the Session to DB
|
92 |
+
$this->exactorProcessingService->getPluginCallback()->saveTransactionInfo($transactionInfo,$transactionInfo->getSignature());
|
93 |
+
// if CommitOption is set up to commit on sales order - do commit the
|
94 |
+
// latest transaction from the session storage
|
95 |
+
if ($this->merchantSettings->getCommitOption() == Exactor_Core_Model_MerchantSettings::COMMIT_ON_SALES_ORDER){
|
96 |
+
$this->exactorProcessingService->commitExistingInvoiceForOrder($orderId);
|
97 |
}
|
98 |
}
|
99 |
+
// We need to clean the session storage here
|
100 |
+
$this->sessionCache->clear();
|
101 |
}
|
102 |
|
103 |
/**
|
104 |
+
* Event will be fired once new order has been created
|
105 |
* @param Varien_Event_Observer $observer
|
106 |
* @return void
|
107 |
*/
|
108 |
+
public function handleCreatedOrder(Varien_Event_Observer $observer){
|
109 |
+
$this->logger->trace('called', 'handleCreatedOrder');
|
110 |
+
return;
|
111 |
+
}
|
112 |
+
|
113 |
+
public function handleNewCreditMemo(Varien_Event_Observer $observer){
|
114 |
+
$this->logger->trace('called', 'handleNewCreditMemo');
|
115 |
+
if ($this->merchantSettings == null) return;
|
116 |
+
$orderId = $observer->getCreditmemo()->getOrder()->getIncrementId();
|
117 |
+
$this->refundTransactionForOrder($orderId);
|
118 |
+
}
|
119 |
+
|
120 |
+
public function handleCancelOrder(Varien_Event_Observer $observer){
|
121 |
+
$this->logger->trace('called', 'handleCancelOrder');
|
122 |
+
if ($this->merchantSettings == null) return;
|
123 |
+
$orderId = $observer->getOrder()->getIncrementId();
|
124 |
+
$this->refundTransactionForOrder($orderId);
|
125 |
+
}
|
126 |
+
|
127 |
+
public function handleNewShipment(Varien_Event_Observer $observer){
|
128 |
+
$this->logger->trace('called', 'handleNewShipment');
|
129 |
+
if ($this->merchantSettings == null) return;
|
130 |
+
if ($this->merchantSettings->getCommitOption() == Exactor_Core_Model_MerchantSettings::COMMIT_ON_SHIPMENT){
|
131 |
+
$orderId = $observer->getShipment()->getOrder()->getIncrementId();
|
132 |
+
$this->commitTransactionForOrder($orderId);
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
public function handleNewInvoice(Varien_Event_Observer $observer){
|
137 |
+
$this->logger->trace('called', 'handleNewInvoice');
|
138 |
+
if ($this->merchantSettings == null) return;
|
139 |
+
|
140 |
+
if ($this->merchantSettings->getCommitOption() == Exactor_Core_Model_MerchantSettings::COMMIT_ON_INVOICE){
|
141 |
+
$orderId = $observer->getInvoice()->getOrder()->getIncrementId();
|
142 |
+
$this->commitTransactionForOrder($orderId);
|
143 |
}
|
144 |
+
|
145 |
+
}
|
146 |
+
|
147 |
+
public function getStoreViewId(){
|
148 |
+
// TODO: Temporary FIX! We should get store view ID from the order
|
149 |
+
$storeId = Mage::app()->getStore()->getId();
|
150 |
+
return $storeId != 0 ? $storeId : Mage::app()->getDefaultStoreView()->getId();
|
151 |
}
|
152 |
+
}
|
app/code/local/Exactor/Sales/Model/Order.php
CHANGED
@@ -1,56 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
*
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
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_Sales
|
23 |
-
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Exactor Tax ax Calculation Model
|
29 |
-
*
|
30 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
31 |
-
*/
|
32 |
-
class Exactor_Sales_Model_Order extends Mage_Sales_Model_Order
|
33 |
-
{
|
34 |
-
/**
|
35 |
-
* Cancel order
|
36 |
-
*
|
37 |
-
* @return Mage_Sales_Model_Order
|
38 |
-
*/
|
39 |
-
public function cancel()
|
40 |
-
{
|
41 |
-
#get the exactor tax class model here
|
42 |
-
$this->exactor_tax_model = Mage::getSingleton('exactor_tax/Observer');
|
43 |
-
|
44 |
-
#commit the refund transaction into exactor API also pass the store id here as in case of cancellation order
|
45 |
-
#quote wont have the store id incase of exactor observer class
|
46 |
-
$this->exactor_tax_model->exactordetails_helper->refund_older_order_transaction($this->getIncrementId(),$this->exactor_tax_model,$this->getStoreId());
|
47 |
-
|
48 |
-
if ($this->canCancel()) {
|
49 |
-
$this->getPayment()->cancel();
|
50 |
-
$this->registerCancellation();
|
51 |
-
}
|
52 |
-
|
53 |
-
return $this;
|
54 |
-
}
|
55 |
-
|
56 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* User: LOGICIFY\corvis
|
4 |
+
* Date: 5/10/12
|
5 |
+
* Time: 2:08 PM
|
6 |
+
*/
|
7 |
+
|
8 |
+
class Exactor_Sales_Model_Order extends Mage_Sales_Model_Order {
|
9 |
+
|
10 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/Sales/etc/config.xml
CHANGED
@@ -1,85 +1,92 @@
|
|
1 |
-
<?xml version="1.0" ?>
|
2 |
-
<!--
|
3 |
-
/**
|
4 |
-
* Magento
|
5 |
-
*
|
6 |
-
* NOTICE OF LICENSE
|
7 |
-
*
|
8 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://opensource.org/licenses/afl-3.0.php
|
12 |
-
* If you did not receive a copy of the license and are unable to
|
13 |
-
* obtain it through the world-wide-web, please send an email
|
14 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
-
*
|
16 |
-
* DISCLAIMER
|
17 |
-
*
|
18 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
-
* versions in the future. If you wish to customize Magento for your
|
20 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
-
*
|
22 |
-
* @category Exactor
|
23 |
-
* @package Exactor_Sales
|
24 |
-
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
25 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
-
*/
|
27 |
-
-->
|
28 |
-
<config>
|
29 |
-
<modules>
|
30 |
-
<Exactor_Sales>
|
31 |
-
<version>2012.
|
32 |
-
</Exactor_Sales>
|
33 |
-
</modules>
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" ?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Exactor
|
23 |
+
* @package Exactor_Sales
|
24 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<modules>
|
30 |
+
<Exactor_Sales>
|
31 |
+
<version>2012.05.14</version>
|
32 |
+
</Exactor_Sales>
|
33 |
+
</modules>
|
34 |
+
<global>
|
35 |
+
<events>
|
36 |
+
<checkout_submit_all_after>
|
37 |
+
<observers>
|
38 |
+
<exactor_sales_observer>
|
39 |
+
<type>singleton</type>
|
40 |
+
<class>Exactor_Sales_Model_Observer</class>
|
41 |
+
<method>handleAllOrdersCompleted</method>
|
42 |
+
</exactor_sales_observer>
|
43 |
+
</observers>
|
44 |
+
</checkout_submit_all_after>
|
45 |
+
<sales_order_place_after>
|
46 |
+
<observers>
|
47 |
+
<exactor_sales_observer>
|
48 |
+
<type>singleton</type>
|
49 |
+
<class>Exactor_Sales_Model_Observer</class>
|
50 |
+
<method>handleCreatedOrder</method>
|
51 |
+
</exactor_sales_observer>
|
52 |
+
</observers>
|
53 |
+
</sales_order_place_after>
|
54 |
+
<sales_order_creditmemo_refund>
|
55 |
+
<observers>
|
56 |
+
<exactor_sales_observer>
|
57 |
+
<type>singleton</type>
|
58 |
+
<class>Exactor_Sales_Model_Observer</class>
|
59 |
+
<method>handleNewCreditMemo</method>
|
60 |
+
</exactor_sales_observer>
|
61 |
+
</observers>
|
62 |
+
</sales_order_creditmemo_refund>
|
63 |
+
<order_cancel_after>
|
64 |
+
<observers>
|
65 |
+
<exactor_sales_observer>
|
66 |
+
<type>singleton</type>
|
67 |
+
<class>Exactor_Sales_Model_Observer</class>
|
68 |
+
<method>handleCancelOrder</method>
|
69 |
+
</exactor_sales_observer>
|
70 |
+
</observers>
|
71 |
+
</order_cancel_after>
|
72 |
+
<sales_order_shipment_save_after>
|
73 |
+
<observers>
|
74 |
+
<exactor_sales_observer>
|
75 |
+
<type>singleton</type>
|
76 |
+
<class>Exactor_Sales_Model_Observer</class>
|
77 |
+
<method>handleNewShipment</method>
|
78 |
+
</exactor_sales_observer>
|
79 |
+
</observers>
|
80 |
+
</sales_order_shipment_save_after>
|
81 |
+
<sales_order_invoice_pay>
|
82 |
+
<observers>
|
83 |
+
<exactor_sales_observer>
|
84 |
+
<type>singleton</type>
|
85 |
+
<class>Exactor_Sales_Model_Observer</class>
|
86 |
+
<method>handleNewInvoice</method>
|
87 |
+
</exactor_sales_observer>
|
88 |
+
</observers>
|
89 |
+
</sales_order_invoice_pay>
|
90 |
+
</events>
|
91 |
+
</global>
|
92 |
+
</config>
|
app/code/local/Exactor/Tax/Helper/Calculation.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* User: LOGICIFY\corvis
|
4 |
+
* Date: 4/20/12
|
5 |
+
* Time: 1:12 PM
|
6 |
+
*/
|
7 |
+
|
8 |
+
class Exactor_Tax_Helper_Calculation extends Mage_Core_Helper_Abstract {
|
9 |
+
|
10 |
+
private $logger;
|
11 |
+
|
12 |
+
private function getLogger(){
|
13 |
+
if ($this->logger==null)
|
14 |
+
$this->logger = ExactorLoggingFactory::getInstance()->getLogger($this);
|
15 |
+
return $this->logger;
|
16 |
+
}
|
17 |
+
|
18 |
+
function __construct()
|
19 |
+
{
|
20 |
+
$this->logger = ExactorLoggingFactory::getInstance()->getLogger($this);
|
21 |
+
}
|
22 |
+
|
23 |
+
}
|
app/code/local/Exactor/Tax/Helper/Mapping.php
ADDED
@@ -0,0 +1,279 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* User: LOGICIFY\corvis
|
4 |
+
* Date: 4/20/12
|
5 |
+
* Time: 1:12 PM
|
6 |
+
*/
|
7 |
+
|
8 |
+
class Exactor_Tax_Helper_Mapping extends Mage_Core_Helper_Abstract {
|
9 |
+
|
10 |
+
const EUC_SHIPPING_COMMON_CARRIER='EUC-13010204';
|
11 |
+
const EUC_SHIPPING_USPS='EUC-13030202';
|
12 |
+
const EUC_SHIPPING_AND_HANDLING='EUC-13010101';
|
13 |
+
const EUC_HANDLING = 'EUC-13010301';
|
14 |
+
|
15 |
+
const MSG_DEFAULT_SHIPPING_NAME = 'Default Shipping';
|
16 |
+
const MSG_HANDLING_FEE = 'Handling Fee';
|
17 |
+
const MSG_SHIPPING_DESCRIPTION_PREFIX = 'Shipping Fee: ';
|
18 |
+
const MSG_ESTIMATION_REQUEST = 'Magento Tax Estimation Request';
|
19 |
+
const MSG_DISCOUNTED_BY = 'Discounted by $';
|
20 |
+
|
21 |
+
const LINE_ITEM_ID_SHIPPING = "SHIPPING";
|
22 |
+
const LINE_ITEM_ID_HANDLING = "HANDLING";
|
23 |
+
|
24 |
+
const ATTRIBUTE_NAME_EXEMPTION = 'taxvat';
|
25 |
+
|
26 |
+
const MAX_SKU_CODE_LENGTH = 16;
|
27 |
+
|
28 |
+
private $logger;
|
29 |
+
|
30 |
+
|
31 |
+
const PO_ESTIMATE_TEXT = 'Estimated Tax ';
|
32 |
+
|
33 |
+
const UNKNOWN_STREET_TEXT = "";
|
34 |
+
|
35 |
+
private function getLogger(){
|
36 |
+
if ($this->logger==null)
|
37 |
+
$this->logger = ExactorLoggingFactory::getInstance()->getLogger($this);
|
38 |
+
return $this->logger;
|
39 |
+
}
|
40 |
+
|
41 |
+
function __construct()
|
42 |
+
{
|
43 |
+
$this->logger = ExactorLoggingFactory::getInstance()->getLogger($this);
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @param $firstName
|
48 |
+
* @param $lastName
|
49 |
+
* @param $middleName
|
50 |
+
* @return string
|
51 |
+
*/
|
52 |
+
private function buildFullName($firstName, $lastName, $middleName=null){
|
53 |
+
$parts = array($firstName, $middleName, $lastName);
|
54 |
+
return join(' ', $parts);
|
55 |
+
}
|
56 |
+
|
57 |
+
public function buildExactorAddressForQuoteAddress(Mage_Sales_Model_Quote_Address $address){
|
58 |
+
$exactorAddress = new AddressType();
|
59 |
+
if ($address==null) return null;
|
60 |
+
// Set defaults
|
61 |
+
$exactorAddress->setStreet1(self::UNKNOWN_STREET_TEXT);
|
62 |
+
$exactorAddress->setFullName("Unknown Buyer");
|
63 |
+
//
|
64 |
+
$fullName = trim($address->getName());//trim($this->buildFullName($address->getFirstname(), $address->getLastname(), $address->getMiddlename()));
|
65 |
+
if (strlen($fullName)>0)
|
66 |
+
$exactorAddress->setFullName($fullName);
|
67 |
+
if ($address->getStreetFull() != null)
|
68 |
+
$exactorAddress->setStreet1($address->getStreetFull());
|
69 |
+
$exactorAddress->setCity($address->getCity());
|
70 |
+
$exactorAddress->setStateOrProvince($address->getRegion());
|
71 |
+
$exactorAddress->setCountry($address->getCountry());
|
72 |
+
$exactorAddress->setPostalCode($address->getPostcode());
|
73 |
+
return $exactorAddress;
|
74 |
+
}
|
75 |
+
|
76 |
+
public function getSKUForItem(Mage_Sales_Model_Quote_Item $magentoItem,
|
77 |
+
Exactor_Core_Model_MerchantSettings $merchantSettings){
|
78 |
+
$sku='';
|
79 |
+
switch ($merchantSettings->getSourceOfSKU()){
|
80 |
+
case Exactor_Core_Model_MerchantSettings::SKU_SOURCE_NONE:
|
81 |
+
$sku = '';
|
82 |
+
break;
|
83 |
+
case Exactor_Core_Model_MerchantSettings::SKU_SOURCE_SKU_FIELD:
|
84 |
+
$sku = $magentoItem->getSku();;
|
85 |
+
break;
|
86 |
+
case Exactor_Core_Model_MerchantSettings::SKU_SOURCE_ATTRIBUTE_NAME:
|
87 |
+
$attributeSetName = 'Default';
|
88 |
+
try{
|
89 |
+
$attributeSetModel = Mage::getModel("eav/entity_attribute_set");
|
90 |
+
$attributeSetModel->load($magentoItem->getProduct()->getAttributeSetId());
|
91 |
+
$attributeSetName = $attributeSetModel->getAttributeSetName();
|
92 |
+
}catch(Exception $e){}
|
93 |
+
$sku = $attributeSetName;
|
94 |
+
break;
|
95 |
+
case Exactor_Core_Model_MerchantSettings::SKU_SOURCE_PRODUCT_CATEGORY:
|
96 |
+
$category = $magentoItem->getProduct()->getCategory();
|
97 |
+
if ($category != null)
|
98 |
+
$sku = $category->getName();
|
99 |
+
break;
|
100 |
+
case Exactor_Core_Model_MerchantSettings::SKU_SOURCE_TAX_CLASS:
|
101 |
+
/** @var Mage_Tax_Model_Mysql4_Class_Collection $taxClassCollection */
|
102 |
+
$taxClassCollection = Mage::getModel('tax/class')->getCollection();
|
103 |
+
/** @var Mage_Tax_Model_Class $taxClass */
|
104 |
+
$taxClass = $taxClassCollection->getItemById($magentoItem->getProduct()->getTaxClassId());
|
105 |
+
if ($taxClass == null) $sku = ''; else $sku = $taxClass->getClassName();
|
106 |
+
break;
|
107 |
+
}
|
108 |
+
return substr($sku,0, self::MAX_SKU_CODE_LENGTH); // Max length for SKU is 16 characters
|
109 |
+
}
|
110 |
+
|
111 |
+
private function isUSPSShipping($methodName){
|
112 |
+
$uspsShippingNames = array('USPS', 'Mail', 'Post', 'USPostal');
|
113 |
+
// Remove all spaces and dots from the original name to simplify search
|
114 |
+
$methodName = preg_replace('/[\.\s]/','',$methodName);
|
115 |
+
foreach($uspsShippingNames as $currName){
|
116 |
+
if (stristr($methodName, $currName)) return true;
|
117 |
+
}
|
118 |
+
return false;
|
119 |
+
}
|
120 |
+
|
121 |
+
public function getShippingLineItem(Mage_Sales_Model_Quote_Address $quoteAddress,
|
122 |
+
Exactor_Core_Model_MerchantSettings $merchantSettings){
|
123 |
+
if ($quoteAddress->getAddressType() == Mage_Sales_Model_Quote_Address::TYPE_BILLING) return null; // There is no shipping fees there
|
124 |
+
if ($quoteAddress->getShippingAmount()==0) return null;
|
125 |
+
$shippingLineItem = new LineItemType();
|
126 |
+
$shippingLineItem->setDescription(self::MSG_SHIPPING_DESCRIPTION_PREFIX . $quoteAddress->getShippingDescription());
|
127 |
+
if (trim($shippingLineItem->getDescription())==''){
|
128 |
+
$shippingLineItem->setDescription(self::MSG_DEFAULT_SHIPPING_NAME);
|
129 |
+
}
|
130 |
+
// Get EUC code for shipping
|
131 |
+
$shippingEUC = self::EUC_SHIPPING_COMMON_CARRIER;
|
132 |
+
if ($merchantSettings->isShippingIncludeHandling()){
|
133 |
+
$shippingEUC = self::EUC_SHIPPING_AND_HANDLING;
|
134 |
+
}else if ($this->isUSPSShipping($quoteAddress->getShippingDescription())){
|
135 |
+
$shippingEUC = self::EUC_SHIPPING_USPS;
|
136 |
+
}
|
137 |
+
$shippingLineItem->setSKU($shippingEUC);
|
138 |
+
// Other fields
|
139 |
+
$shippingLineItem->setId(self::LINE_ITEM_ID_SHIPPING);
|
140 |
+
$shippingLineItem->setQuantity(1);
|
141 |
+
// If shipping doesn't include handling we should subtract handling from the total shipping amount
|
142 |
+
$amount = $quoteAddress->getShippingAmount();
|
143 |
+
if (!$merchantSettings->isShippingIncludeHandling()){
|
144 |
+
$amount -= $this->getHandlingFeeByMethodName($quoteAddress->getShippingMethod());
|
145 |
+
}
|
146 |
+
$shippingLineItem->setGrossAmount($amount);
|
147 |
+
$this->applyDiscountToLineItem($shippingLineItem,$quoteAddress->getShippingDiscountAmount());
|
148 |
+
return $shippingLineItem;
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Returns handling feed amount by given name, or 0 if there is no handling
|
153 |
+
* @param $name
|
154 |
+
* @return void
|
155 |
+
*/
|
156 |
+
private function getHandlingFeeByMethodName($name){
|
157 |
+
if (strpos($name,'_')) $name = substr($name,0,strpos($name,'_'));
|
158 |
+
// Fetch carriers information from Magento config to determine handling amount
|
159 |
+
$carriers = Mage::getStoreConfig('carriers');
|
160 |
+
if (!array_key_exists($name, $carriers)) return 0;
|
161 |
+
foreach($carriers as $id => $carrier){
|
162 |
+
if (array_key_exists('handling_fee', $carrier) ){
|
163 |
+
if ($id == $name)
|
164 |
+
return $carrier['handling_fee'];
|
165 |
+
}
|
166 |
+
}
|
167 |
+
return 0;
|
168 |
+
}
|
169 |
+
|
170 |
+
public function getHandlingLineItem(Mage_Sales_Model_Quote_Address $quoteAddress,
|
171 |
+
Exactor_Core_Model_MerchantSettings $merchantSettings){
|
172 |
+
if ($quoteAddress->getAddressType() == Mage_Sales_Model_Quote_Address::TYPE_BILLING) return null; // There is no shipping fees there
|
173 |
+
if ($merchantSettings->isShippingIncludeHandling()) return null; // Handling already included in the shipping
|
174 |
+
$handlingLineItem = new LineItemType();
|
175 |
+
$handlingLineItem->setId(self::LINE_ITEM_ID_HANDLING);
|
176 |
+
$handlingLineItem->setDescription(self::MSG_HANDLING_FEE);
|
177 |
+
$handlingLineItem->setSKU(self::EUC_HANDLING);
|
178 |
+
$handlingLineItem->setQuantity(1);
|
179 |
+
$handlingLineItem->setGrossAmount($this->getHandlingFeeByMethodName($quoteAddress->getShippingMethod()));
|
180 |
+
if ($handlingLineItem->getGrossAmount()==0) return null;
|
181 |
+
return $handlingLineItem;
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* @param \Mage_Sales_Model_Quote_Address_Item|\Mage_Sales_Model_Quote_Item $magentoItem
|
186 |
+
* @param Mage_Sales_Model_Quote_Address $quoteAddress
|
187 |
+
* @param Exactor_Core_Model_MerchantSettings $merchantSettings
|
188 |
+
* @return LineItemType
|
189 |
+
*/
|
190 |
+
public function buildLineItemForMagentoItem(Mage_Sales_Model_Quote_Item $magentoItem,
|
191 |
+
Mage_Sales_Model_Quote_Address $quoteAddress,
|
192 |
+
Exactor_Core_Model_MerchantSettings $merchantSettings){
|
193 |
+
$lineItem = new LineItemType();
|
194 |
+
$lineItem->setDescription($magentoItem->getName());
|
195 |
+
$lineItem->setGrossAmount($magentoItem->getBaseRowTotal());
|
196 |
+
$lineItem->setQuantity($magentoItem->getTotalQty());
|
197 |
+
$lineItem->setSKU($this->getSKUForItem($magentoItem, $merchantSettings));
|
198 |
+
$this->applyDiscountToLineItem($lineItem, $magentoItem->getDiscountAmount());
|
199 |
+
return $lineItem;
|
200 |
+
}
|
201 |
+
|
202 |
+
public function applyDiscountToLineItem(LineItemType &$item, $discountAmount=0){
|
203 |
+
if ($discountAmount>0){
|
204 |
+
$discountedLine = self::MSG_DISCOUNTED_BY . $discountAmount;
|
205 |
+
$item->setDescription($item->getDescription() . " ($discountedLine)");
|
206 |
+
$item->setGrossAmount($item->getGrossAmount() - $discountAmount);
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
public function getExemptionIdForQuoteAddress(Mage_Sales_Model_Quote_Address $quoteAddress,
|
211 |
+
Exactor_Core_Model_MerchantSettings $merchantSettings){
|
212 |
+
$exemptionId = '';
|
213 |
+
if ($merchantSettings->getExemptionsSupported()){
|
214 |
+
$customerExemptionId = $quoteAddress->getQuote()->getCustomer()->getData(self::ATTRIBUTE_NAME_EXEMPTION);
|
215 |
+
if ($customerExemptionId!=null) $exemptionId=$customerExemptionId;
|
216 |
+
}
|
217 |
+
return $exemptionId;
|
218 |
+
}
|
219 |
+
|
220 |
+
private function getCurrentCurrencyCode(){
|
221 |
+
$currency = Mage::app()->getStore()->getBaseCurrencyCode();
|
222 |
+
if ($currency == null) $currency = 'USD';
|
223 |
+
return $currency;
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* @param Mage_Sales_Model_Quote_Address $quoteAddress
|
228 |
+
* @param Exactor_Core_Model_MerchantSettings $merchantSettings
|
229 |
+
* @param bool $isMultishipping
|
230 |
+
* @return InvoiceRequestType
|
231 |
+
*/
|
232 |
+
public function buildInvoiceRequestForQuoteAddress(Mage_Sales_Model_Quote_Address $quoteAddress,
|
233 |
+
Exactor_Core_Model_MerchantSettings $merchantSettings,
|
234 |
+
$isMultishipping){
|
235 |
+
// Building Invoice Parts
|
236 |
+
$shipToAddress = $this->buildExactorAddressForQuoteAddress($quoteAddress);
|
237 |
+
// Trying to find billing address in the quote
|
238 |
+
$billingAddress = $this->buildExactorAddressForQuoteAddress($quoteAddress->getQuote()->getBillingAddress());
|
239 |
+
$isEstimation = !$billingAddress->hasData();
|
240 |
+
if ($isEstimation) $shipToAddress->setFullName(self::MSG_ESTIMATION_REQUEST);
|
241 |
+
// If this is just tax estimation for not logged in user
|
242 |
+
// we just need to use shipping as billing
|
243 |
+
if ($isEstimation){
|
244 |
+
$billingAddress = $shipToAddress;
|
245 |
+
}
|
246 |
+
if (!$billingAddress->hasData() || !$shipToAddress->hasData()) return null;
|
247 |
+
// Composing invoice object
|
248 |
+
$invoiceRequest = new InvoiceRequestType();
|
249 |
+
$invoiceRequest->setSaleDate(new DateTime());
|
250 |
+
$invoiceRequest->setPurchaseOrderNumber(self::PO_ESTIMATE_TEXT .$quoteAddress->getId());
|
251 |
+
$invoiceRequest->setShipTo($shipToAddress);
|
252 |
+
$invoiceRequest->setBillTo($billingAddress);
|
253 |
+
$invoiceRequest->setCurrencyCode($this->getCurrentCurrencyCode());
|
254 |
+
$invoiceRequest->setShipFrom($merchantSettings->getExactorShippingAddress());
|
255 |
+
$invoiceRequest->setExemptionId($this->getExemptionIdForQuoteAddress($quoteAddress, $merchantSettings));
|
256 |
+
// Line items list
|
257 |
+
$magentoItems = $quoteAddress->getAllItems();
|
258 |
+
$itemNum = 0;
|
259 |
+
foreach ($magentoItems as $magentoItem){
|
260 |
+
$exactorLineItem = $this->buildLineItemForMagentoItem($magentoItem, $quoteAddress, $merchantSettings);
|
261 |
+
$exactorLineItem->setId('_' . $itemNum++);
|
262 |
+
// If this is non-multishipping request we should set
|
263 |
+
// ship to address to billing address for VIRTUAL ITEMS
|
264 |
+
if (!$isMultishipping){
|
265 |
+
if ($magentoItem->getProduct()->getIsVirtual()){
|
266 |
+
// Previouse requirements was to set BillTo address for wi as Shipping info for virtual products
|
267 |
+
/*$virtualShipToAddress = $invoiceRequest->getShipTo(); //( $isEstimation ? $invoiceRequest->getShipFrom() : $billingAddress);
|
268 |
+
$exactorLineItem->setShipTo($virtualShipToAddress);
|
269 |
+
$exactorLineItem->setBillTo($virtualShipToAddress);*/
|
270 |
+
}
|
271 |
+
}
|
272 |
+
$invoiceRequest->addLineItem($exactorLineItem);
|
273 |
+
}
|
274 |
+
// Shipping & Handling
|
275 |
+
$invoiceRequest->addLineItem($this->getShippingLineItem($quoteAddress, $merchantSettings));
|
276 |
+
$invoiceRequest->addLineItem($this->getHandlingLineItem($quoteAddress, $merchantSettings));
|
277 |
+
return $invoiceRequest;
|
278 |
+
}
|
279 |
+
}
|
app/code/local/Exactor/Tax/Model/Calculation.php
DELETED
@@ -1,67 +0,0 @@
|
|
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_Tax
|
23 |
-
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Exactor Tax ax Calculation Model
|
29 |
-
*
|
30 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
31 |
-
*/
|
32 |
-
class Exactor_Tax_Model_Calculation extends Mage_Tax_Model_Calculation
|
33 |
-
{
|
34 |
-
|
35 |
-
public function getRate($request)
|
36 |
-
{
|
37 |
-
if (!$request->getCountryId() || !$request->getCustomerClassId() || !$request->getProductClassId()) {
|
38 |
-
return 0;
|
39 |
-
}
|
40 |
-
|
41 |
-
$cacheKey = $this->_getRequestCacheKey($request);
|
42 |
-
|
43 |
-
#if (!isset($this->_rateCache[$cacheKey])) {
|
44 |
-
$this->unsRateValue();
|
45 |
-
$this->unsCalculationProcess();
|
46 |
-
$this->unsEventModuleId();
|
47 |
-
|
48 |
-
Mage::dispatchEvent('tax_rate_data_fetch', array('request'=>$this,'exactor_set_request'=>$request));
|
49 |
-
if (!$this->hasRateValue()) {
|
50 |
-
$rateInfo = $this->_getResource()->getRateInfo($request);
|
51 |
-
$this->setCalculationProcess($rateInfo['process']);
|
52 |
-
$this->setRateValue($rateInfo['value']);
|
53 |
-
} else {
|
54 |
-
$this->setCalculationProcess($this->_formCalculationProcess());
|
55 |
-
}
|
56 |
-
|
57 |
-
#echo "inside :: ".$this->getRateValue()."<br>";
|
58 |
-
|
59 |
-
$this->_rateCache[$cacheKey] = $this->getRateValue();
|
60 |
-
$this->_rateCalculationProcess[$cacheKey] = $this->getCalculationProcess();
|
61 |
-
#}else
|
62 |
-
# Mage::log('Rate cache: ' . strval($this->_rateCache));
|
63 |
-
|
64 |
-
Mage::log("TAX RES: " . strval($this->_rateCache[$cacheKey]));
|
65 |
-
return $this->_rateCache[$cacheKey];
|
66 |
-
}
|
67 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/Tax/Model/Observer.php
CHANGED
@@ -1 +1,7 @@
|
|
1 |
-
<?php
|
2 |
* Magento
|
3 |
*
|
4 |
* NOTICE OF LICENSE
|
5 |
*
|
6 |
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
* that is bundled with this package in the file LICENSE.txt.
|
8 |
* It is also available through the world-wide-web at this URL:
|
9 |
* http://opensource.org/licenses/osl-3.0.php
|
10 |
* If you did not receive a copy of the license and are unable to
|
11 |
* obtain it through the world-wide-web, please send an email
|
12 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
13 |
*
|
14 |
* DISCLAIMER
|
15 |
*
|
16 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
17 |
* versions in the future. If you wish to customize Magento for your
|
18 |
* needs please refer to http://www.magentocommerce.com for more information.
|
19 |
*
|
20 |
* @category Exactor
|
21 |
* @package Exactor_Tax
|
22 |
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
23 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
24 |
*/
|
25 |
* Exactor Tax observer model
|
26 |
*
|
27 |
* @category Exactor
|
28 |
* @package Exactor_Tax
|
29 |
* @author Magento Core Team <core@magentocommerce.com>
|
30 |
*/
|
31 |
|
32 |
const EXEMPTION_ATTRIBUTE_NAME = 'taxvat';
|
33 |
const VIRTUAL_PRODUCT_SHIPPING_NAME = 'Download for virtual product';
|
34 |
const VIRTUAL_PRODUCT_SHIPPING_METHOD = 'virtual';
|
35 |
function __construct() {
|
36 |
$this->customer_exemption_id = $this->_getQuote()->getCustomer()->getData(Exactor_Tax_Model_Observer::EXEMPTION_ATTRIBUTE_NAME);
|
37 |
|
38 |
* Retrieve shopping cart model object
|
39 |
*
|
40 |
* @return Mage_Checkout_Model_Cart
|
41 |
*/
|
42 |
protected function _getCart() {
|
43 |
}
|
44 |
* Get current active quote instance
|
45 |
*
|
46 |
* @return Mage_Sales_Model_Quote
|
47 |
*/
|
48 |
public function _getQuote() {
|
49 |
return $this->_getCart()->getQuote();
|
50 |
}
|
51 |
// If order contains only virtual products we should use ship from address as shipping and billing address
|
52 |
if ( $this->isCompletelyVirtualOrder($this->_getQuote()->getAllItems()) ){
|
53 |
// Set shipping name
|
54 |
$this->shippingName = self::VIRTUAL_PRODUCT_SHIPPING_NAME;
|
55 |
$this->shippingMethod = self::VIRTUAL_PRODUCT_SHIPPING_METHOD;
|
56 |
// Fetch ship from address from the settings
|
57 |
$this->populateQuoteAddressWithExactorAddress($this->shipping_address, $this->exactor_ship_from_address);
|
58 |
// If billing address is not defined (on the quote page of instance) we should get it form ship from address too
|
59 |
if ($this->billing_address->getStreet()==null && $this->billing_address->getCity()==null){
|
60 |
$this->populateQuoteAddressWithExactorAddress($this->billing_address, $this->exactor_ship_from_address);
|
61 |
}
|
62 |
}
|
63 |
/**
|
64 |
*
|
65 |
* @param array $items
|
66 |
* @return boolean Determines if there is at least one non-virtual item in the order or order is completely virtual
|
67 |
*/
|
68 |
private function isCompletelyVirtualOrder($items){
|
69 |
foreach ($items as $x){
|
70 |
if ( !$x->getIsVirtual() ) return false;
|
71 |
}
|
72 |
return true;
|
73 |
}
|
74 |
/**
|
75 |
* @param Mage_Sales_Model_Quote_Address $quoteAddressObj
|
76 |
* @param array $exactorAddress
|
77 |
* @return void
|
78 |
*/
|
79 |
private function populateQuoteAddressWithExactorAddress(&$quoteAddressObj, $exactorAddress){
|
80 |
$quoteAddressObj->setFirstname($exactorAddress['FullName']);
|
81 |
$quoteAddressObj->setLastname("");
|
82 |
$quoteAddressObj->setStreet($exactorAddress['Street1']);
|
83 |
$quoteAddressObj->setCity($exactorAddress['City']);
|
84 |
$quoteAddressObj->setRegion($exactorAddress['StateOrProvince']);
|
85 |
$quoteAddressObj->setPostcode($exactorAddress['PostalCode']);
|
86 |
$quoteAddressObj->setCountryId($exactorAddress['Country']);
|
87 |
}
|
88 |
list($xml_reponse_array,$productCount) = $this->exactor_invoice_request_Onepage();
|
89 |
//todo: we should store invoice number in DB
|
90 |
$product_id = 'PID_'.($this->exactor_set_request->getExactorProductId() ? $this->exactor_set_request->getExactorProductId() : "");
|
91 |
$address_id = $this->exactor_set_request->getaddressId();
|
92 |
// if this is order with virtual items only we don't interesting in address information, since there is no addresses
|
93 |
if ($this->shippingMethod == self::VIRTUAL_PRODUCT_SHIPPING_METHOD){
|
94 |
$address_tax_perItem_array = reset($exactor_tax_rate_single_array);
|
95 |
$product_id = key($address_tax_perItem_array);
|
96 |
}else{
|
97 |
$address_tax_perItem_array = $exactor_tax_rate_single_array[$address_id];
|
98 |
}
|
99 |
if ($Product->getCalculationPrice()!=0){
|
100 |
$rowTotal = (float)($Product->getQty()*$Product->getCalculationPrice());
|
101 |
}else{
|
102 |
$rowTotal = (float)($Product->getQty()*$Product->getPrice());
|
103 |
}
|
104 |
$this->exactor_transaction_details_model->setCommited($isCommited);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
* Magento
|
2 |
*
|
3 |
* NOTICE OF LICENSE
|
4 |
*
|
5 |
* This source file is subject to the Open Software License (OSL 3.0)
|
6 |
* that is bundled with this package in the file LICENSE.txt.
|
7 |
* It is also available through the world-wide-web at this URL:
|
8 |
* http://opensource.org/licenses/osl-3.0.php
|
9 |
* If you did not receive a copy of the license and are unable to
|
10 |
* obtain it through the world-wide-web, please send an email
|
11 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
12 |
*
|
13 |
* DISCLAIMER
|
14 |
*
|
15 |
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
16 |
* versions in the future. If you wish to customize Magento for your
|
17 |
* needs please refer to http://www.magentocommerce.com for more information.
|
18 |
*
|
19 |
* @category Exactor
|
20 |
* @package Exactor_Tax
|
21 |
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
22 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
23 |
*/
|
24 |
* Exactor Tax observer model
|
25 |
*
|
26 |
* @category Exactor
|
27 |
* @package Exactor_Tax
|
28 |
* @author Magento Core Team <core@magentocommerce.com>
|
29 |
*/
|
30 |
|
31 |
const EXEMPTION_ATTRIBUTE_NAME = 'taxvat';
|
32 |
const VIRTUAL_PRODUCT_SHIPPING_NAME = 'Download for virtual product';
|
33 |
const VIRTUAL_PRODUCT_SHIPPING_METHOD = 'virtual';
|
34 |
function __construct() {
|
35 |
$this->customer_exemption_id = $this->_getQuote()->getCustomer()->getData(Exactor_Tax_Model_Observer::EXEMPTION_ATTRIBUTE_NAME);
|
36 |
|
37 |
* Retrieve shopping cart model object
|
38 |
*
|
39 |
* @return Mage_Checkout_Model_Cart
|
40 |
*/
|
41 |
protected function _getCart() {
|
42 |
}
|
43 |
* Get current active quote instance
|
44 |
*
|
45 |
* @return Mage_Sales_Model_Quote
|
46 |
*/
|
47 |
public function _getQuote() {
|
48 |
return $this->_getCart()->getQuote();
|
49 |
}
|
50 |
// If order contains only virtual products we should use ship from address as shipping and billing address
|
51 |
if ( $this->isCompletelyVirtualOrder($this->_getQuote()->getAllItems()) ){
|
52 |
// Set shipping name
|
53 |
$this->shippingName = self::VIRTUAL_PRODUCT_SHIPPING_NAME;
|
54 |
$this->shippingMethod = self::VIRTUAL_PRODUCT_SHIPPING_METHOD;
|
55 |
// Fetch ship from address from the settings
|
56 |
$this->populateQuoteAddressWithExactorAddress($this->shipping_address, $this->exactor_ship_from_address);
|
57 |
// If billing address is not defined (on the quote page of instance) we should get it form ship from address too
|
58 |
if ($this->billing_address->getStreet()==null && $this->billing_address->getCity()==null){
|
59 |
$this->populateQuoteAddressWithExactorAddress($this->billing_address, $this->exactor_ship_from_address);
|
60 |
}
|
61 |
}
|
62 |
/**
|
63 |
*
|
64 |
* @param array $items
|
65 |
* @return boolean Determines if there is at least one non-virtual item in the order or order is completely virtual
|
66 |
*/
|
67 |
private function isCompletelyVirtualOrder($items){
|
68 |
foreach ($items as $x){
|
69 |
if ( !$x->getIsVirtual() ) return false;
|
70 |
}
|
71 |
return true;
|
72 |
}
|
73 |
/**
|
74 |
* @param Mage_Sales_Model_Quote_Address $quoteAddressObj
|
75 |
* @param array $exactorAddress
|
76 |
* @return void
|
77 |
*/
|
78 |
private function populateQuoteAddressWithExactorAddress(&$quoteAddressObj, $exactorAddress){
|
79 |
$quoteAddressObj->setFirstname($exactorAddress['FullName']);
|
80 |
$quoteAddressObj->setLastname("");
|
81 |
$quoteAddressObj->setStreet($exactorAddress['Street1']);
|
82 |
$quoteAddressObj->setCity($exactorAddress['City']);
|
83 |
$quoteAddressObj->setRegion($exactorAddress['StateOrProvince']);
|
84 |
$quoteAddressObj->setPostcode($exactorAddress['PostalCode']);
|
85 |
$quoteAddressObj->setCountryId($exactorAddress['Country']);
|
86 |
}
|
87 |
list($xml_reponse_array,$productCount) = $this->exactor_invoice_request_Onepage();
|
88 |
//todo: we should store invoice number in DB
|
89 |
$product_id = 'PID_'.($this->exactor_set_request->getExactorProductId() ? $this->exactor_set_request->getExactorProductId() : "");
|
90 |
$address_id = $this->exactor_set_request->getaddressId();
|
91 |
// if this is order with virtual items only we don't interesting in address information, since there is no addresses
|
92 |
if ($this->shippingMethod == self::VIRTUAL_PRODUCT_SHIPPING_METHOD){
|
93 |
$address_tax_perItem_array = reset($exactor_tax_rate_single_array);
|
94 |
$product_id = key($address_tax_perItem_array);
|
95 |
}else{
|
96 |
$address_tax_perItem_array = $exactor_tax_rate_single_array[$address_id];
|
97 |
}
|
98 |
if ($Product->getCalculationPrice()!=0){
|
99 |
$rowTotal = (float)($Product->getQty()*$Product->getCalculationPrice());
|
100 |
}else{
|
101 |
$rowTotal = (float)($Product->getQty()*$Product->getPrice());
|
102 |
}
|
103 |
$this->exactor_transaction_details_model->setCommited($isCommited);
|
104 |
+
<?php
|
105 |
+
/**
|
106 |
+
* User: LOGICIFY\corvis
|
107 |
+
* Date: 4/19/12
|
108 |
+
* Time: 4:35 PM
|
109 |
+
*/
|
110 |
+
|
app/code/local/Exactor/Tax/Model/Sales/Total/Quote/Nominal/Tax.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* User: LOGICIFY\corvis
|
4 |
+
* Date: 4/20/12
|
5 |
+
* Time: 8:39 AM
|
6 |
+
*/
|
7 |
+
|
8 |
+
class Exactor_Tax_Model_Sales_Total_Quote_Nominal_Tax extends Mage_Sales_Model_Quote_Address_Total_Abstract
|
9 |
+
{
|
10 |
+
|
11 |
+
public function collect(Mage_Sales_Model_Quote_Address $address)
|
12 |
+
{
|
13 |
+
// Do nothing we don't need nominal tax
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Exactor/Tax/Model/Sales/Total/Quote/Tax.php
CHANGED
@@ -1,266 +1,262 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Tax
|
23 |
-
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
|
27 |
/**
|
28 |
-
* Tax
|
|
|
29 |
*/
|
30 |
-
class Exactor_Tax_Model_Sales_Total_Quote_Tax extends Mage_Tax_Model_Sales_Total_Quote_Tax
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
-
|
34 |
-
*
|
|
|
|
|
|
|
|
|
35 |
*
|
36 |
-
* @
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
{
|
42 |
-
$
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
$
|
48 |
-
|
49 |
-
$
|
50 |
-
$
|
51 |
-
$
|
|
|
|
|
|
|
|
|
52 |
|
53 |
-
$hiddenTax = null;
|
54 |
-
$baseHiddenTax = null;
|
55 |
-
switch ($this->_helper->getCalculationSequence($this->_store)) {
|
56 |
-
case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_EXCL:
|
57 |
-
case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_INCL:
|
58 |
-
$tax = $this->_calculator->calcTaxAmount($shipping, $rate, $inclTax, false);
|
59 |
-
$baseTax = $this->_calculator->calcTaxAmount($baseShipping, $rate, $inclTax, false);
|
60 |
-
break;
|
61 |
-
case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_EXCL:
|
62 |
-
case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_INCL:
|
63 |
-
$discountAmount = $address->getShippingDiscountAmount();
|
64 |
-
$baseDiscountAmount = $address->getBaseShippingDiscountAmount();
|
65 |
-
$tax = $this->_calculator->calcTaxAmount($shipping - $discountAmount, $rate, $inclTax, false);
|
66 |
-
$baseTax = $this->_calculator->calcTaxAmount($baseShipping - $baseDiscountAmount, $rate, $inclTax, false);
|
67 |
-
break;
|
68 |
-
}
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
$baseHiddenTax = $baseShipping - $baseTax - $address->getBaseShippingAmount();
|
80 |
-
}
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
$
|
88 |
-
|
89 |
-
$address->addBaseTotalAmount('shipping_hidden_tax', $baseHiddenTax);
|
90 |
-
$applied = $this->_calculator->getAppliedRates($taxRateRequest);
|
91 |
-
$this->_saveAppliedTaxes($address, $applied, $tax, $baseTax, $rate);
|
92 |
-
return $this;
|
93 |
}
|
94 |
|
95 |
/**
|
96 |
-
*
|
97 |
*
|
98 |
-
* @param
|
99 |
-
* @return
|
100 |
*/
|
101 |
-
|
102 |
-
{
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
|
|
|
|
108 |
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
}
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
$
|
127 |
-
//set the exactor information here for shipping
|
128 |
-
$taxRateRequest = $this->set_data_taxRequest($item->getId(),$taxRateRequest,0,$address->getId());
|
129 |
-
$rate = $this->_calculator->getRate($taxRateRequest);
|
130 |
-
$this->_calcUnitTaxAmount($item, $rate);
|
131 |
-
$this->_addAmount($item->getTaxAmount());
|
132 |
-
$this->_addBaseAmount($item->getBaseTaxAmount());
|
133 |
-
$this->_getAddress()->addTotalAmount('hidden_tax', $item->getHiddenTaxAmount());
|
134 |
-
$this->_getAddress()->addBaseTotalAmount('hidden_tax', $item->getBaseHiddenTaxAmount());
|
135 |
-
$applied = $this->_calculator->getAppliedRates($taxRateRequest);
|
136 |
-
$this->_saveAppliedTaxes($address, $applied, $item->getTaxAmount(), $item->getBaseTaxAmount(), $rate);
|
137 |
}
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
return $this;
|
140 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
/**
|
143 |
-
*
|
144 |
-
*
|
145 |
-
* @param
|
146 |
-
* @
|
147 |
-
* @return Mage_Tax_Model_Sales_Total_Quote
|
148 |
*/
|
149 |
-
|
150 |
-
|
151 |
-
$
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
$this->_getAddress()->addBaseTotalAmount('hidden_tax', $item->getBaseHiddenTaxAmount());
|
182 |
-
$applied = $this->_calculator->getAppliedRates($taxRateRequest);
|
183 |
-
$this->_saveAppliedTaxes($address, $applied, $item->getTaxAmount(), $item->getBaseTaxAmount(), $rate);
|
184 |
-
}
|
185 |
-
}
|
186 |
-
|
187 |
return $this;
|
188 |
}
|
189 |
|
190 |
/**
|
191 |
-
*
|
192 |
*
|
193 |
-
* @
|
194 |
-
* @param Varien_Object $taxRateRequest
|
195 |
-
* @return Mage_Tax_Model_Sales_Total_Quote
|
196 |
*/
|
197 |
-
|
198 |
{
|
199 |
-
|
|
|
|
|
|
|
|
|
|
|
200 |
$store = $address->getQuote()->getStore();
|
201 |
-
$
|
202 |
-
|
203 |
-
$
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
|
|
|
|
222 |
} else {
|
223 |
-
$
|
224 |
-
//set the exactor information here for shipping
|
225 |
-
$taxRateRequest = $this->set_data_taxRequest($item->getId(),$taxRateRequest,0,$address->getId());
|
226 |
-
$rate = $this->_calculator->getRate($taxRateRequest);
|
227 |
-
|
228 |
-
$taxGroups[(string)$rate]['applied_rates'] = $this->_calculator->getAppliedRates($taxRateRequest);
|
229 |
-
$this->_aggregateTaxPerRate($item, $rate, $taxGroups);
|
230 |
-
$this->_getAddress()->addTotalAmount('hidden_tax', $item->getHiddenTaxAmount());
|
231 |
-
$this->_getAddress()->addBaseTotalAmount('hidden_tax', $item->getBaseHiddenTaxAmount());
|
232 |
-
$inclTax = $item->getIsPriceInclTax();
|
233 |
}
|
234 |
-
}
|
235 |
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
}
|
|
|
244 |
return $this;
|
245 |
}
|
246 |
-
|
247 |
-
/*
|
248 |
-
This function is used to add the product id and shipping to
|
249 |
-
retrive the exact tax per product.
|
250 |
-
*/
|
251 |
-
function set_data_taxRequest($product_id=0, $taxRateRequest, $is_shipping=0, $address_id=0) {
|
252 |
-
|
253 |
-
#set the product id here
|
254 |
-
$taxRateRequest->setExactorProductId($product_id);
|
255 |
-
|
256 |
-
#set whether its a shipping or nor
|
257 |
-
$taxRateRequest->setIsShipping($is_shipping);
|
258 |
-
|
259 |
-
#set the address id here
|
260 |
-
$taxRateRequest->setaddressId($address_id);
|
261 |
-
|
262 |
-
return $taxRateRequest;
|
263 |
-
}
|
264 |
-
|
265 |
-
|
266 |
-
}
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
/**
|
4 |
+
* This class will be used by Magento Core to collect Tax total per address
|
5 |
+
* In magento 1.3 and earlier Mage_Tax_Model_Sales_Total_Quote_Tax
|
6 |
*/
|
7 |
+
class Exactor_Tax_Model_Sales_Total_Quote_Tax extends Mage_Sales_Model_Quote_Address_Total_Abstract {//Mage_Tax_Model_Sales_Total_Quote_Tax { //{
|
8 |
+
|
9 |
+
const MODEL_MERCHANT_SETTINGS = "Exactor_Core_Model_MerchantSettings";
|
10 |
+
|
11 |
+
const LOG_MESSAGE_TAX_CALC_FAILED = 'Tax calculation failed due to the following reason: ';
|
12 |
+
|
13 |
+
const MSG_GENERAL_ERROR = 'An error has occurred while processing the sales taxes for this transaction. Please contact technical support if this problem persists. Code: ';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @var IExactorLogger
|
17 |
+
*/
|
18 |
+
private $logger;
|
19 |
+
|
20 |
+
/**Show message to the buyer on errors listed below, all other Exactor errors will be displayed as General errors
|
21 |
+
* @see self::MSG_GENERAL_ERROR
|
22 |
+
* @var array */
|
23 |
+
private $notifyUserErrorCodes;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Tax module helper
|
27 |
+
*
|
28 |
+
* @var Mage_Tax_Helper_Data
|
29 |
+
*/
|
30 |
+
protected $_helper;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var Exactor_Tax_Helper_Calculation
|
34 |
+
*/
|
35 |
+
private $exactorTaxCalculation;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var Exactor_Tax_Helper_Mapping
|
39 |
+
*/
|
40 |
+
private $exactorMappingHelper;
|
41 |
+
|
42 |
+
/** @var Mage_Core_Model_Session_Abstract */
|
43 |
+
private $session;
|
44 |
|
45 |
+
/**
|
46 |
+
* @var Exactor_Core_Helper_SessionCache
|
47 |
+
*/
|
48 |
+
private $exactorSessionCache;
|
49 |
+
/**
|
50 |
+
* Tax configuration object
|
51 |
*
|
52 |
+
* @var Mage_Tax_Model_Config
|
53 |
+
*/
|
54 |
+
protected $_config;
|
55 |
+
|
56 |
+
/** @var \Exactor_ExactorSettings_Helper_Data */
|
57 |
+
private $exactorSettingsHelper;
|
58 |
+
|
59 |
+
private function setupExactorCommonLibrary(){
|
60 |
+
$libDir = Mage::getBaseDir("lib") . '/ExactorCommons';
|
61 |
+
require_once($libDir . '/XmlProcessing.php');
|
62 |
+
require_once($libDir . '/ExactorDomainObjects.php');
|
63 |
+
require_once($libDir . '/ExactorCommons.php');
|
64 |
+
// Magento specific definitions
|
65 |
+
require_once($libDir . '/Magento.php');
|
66 |
+
require_once($libDir . '/config.php');
|
67 |
+
}
|
68 |
+
|
69 |
+
public function __construct()
|
70 |
{
|
71 |
+
$this->setCode('tax');
|
72 |
+
$this->_helper = Mage::helper('tax');
|
73 |
+
$this->_config = Mage::getSingleton('tax/config');
|
74 |
+
$this->setupExactorCommonLibrary();
|
75 |
+
$this->logger = ExactorLoggingFactory::getInstance()->getLogger($this);
|
76 |
+
$this->exactorTaxCalculation = Mage::helper('tax/calculation');
|
77 |
+
$this->exactorMappingHelper = Mage::helper('tax/mapping');
|
78 |
+
$this->exactorSessionCache = Mage::helper('Exactor_Core_SessionCache/');
|
79 |
+
$this->exactorSettingsHelper = Mage::helper('ExactorSettings');
|
80 |
+
$this->session = Mage::getSingleton('core/session', array('name' => 'frontend'));
|
81 |
+
$this->notifyUserErrorCodes = array(ErrorResponseType::ERROR_MISSING_LINE_ITEMS,
|
82 |
+
ErrorResponseType::ERROR_INVALID_SHIP_TO_ADDRESS,
|
83 |
+
ErrorResponseType::ERROR_INVALID_CURRENCY_CODE);
|
84 |
+
}
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
+
/**
|
88 |
+
* Load merchantSettings from the database
|
89 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
90 |
+
* @return Exactor_Core_Model_MerchantSettings
|
91 |
+
*/
|
92 |
+
public function loadMerchantSettings(Mage_Sales_Model_Quote_Address $address=null){
|
93 |
+
$storeViewId = $address->getQuote()->getStoreId();//Mage::app()->getStore()->getId();
|
94 |
+
return $this->exactorSettingsHelper->loadValidMerchantSettings($storeViewId);
|
95 |
+
}
|
|
|
|
|
96 |
|
97 |
+
/**
|
98 |
+
* Return True if there is multi-shipping request
|
99 |
+
* @return bool
|
100 |
+
*/
|
101 |
+
private function isMultishippingRequest(){
|
102 |
+
$controller = Mage::app()->getRequest()->getControllerName();
|
103 |
+
return (strstr("multishipping",$controller)>0);
|
|
|
|
|
|
|
|
|
104 |
}
|
105 |
|
106 |
/**
|
107 |
+
* Collect totals process.
|
108 |
*
|
109 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
110 |
+
* @return Mage_Sales_Model_Quote_Address_Total_Abstract
|
111 |
*/
|
112 |
+
public function collect(Mage_Sales_Model_Quote_Address $address)
|
113 |
+
{
|
114 |
+
//parent::collect($address);
|
115 |
+
$this->_setAddress($address);
|
116 |
+
if (count($address->getAllItems())<=0) return; // Skip addresses without items
|
117 |
+
if ($address->getId() == null) return; // Skip if there is no address
|
118 |
+
//$this->_setAmount(0);
|
119 |
+
$this->logger->trace('Called for address #' . $address->getId() . ' (' . $address->getAddressType() . ')','collect');
|
120 |
+
$merchantSettings = $this->loadMerchantSettings($address);
|
121 |
|
122 |
+
if ($merchantSettings == null){
|
123 |
+
$this->applyTax(0);
|
124 |
+
$this->logger->error(self::LOG_MESSAGE_TAX_CALC_FAILED . 'Missing or invalid Merchant Settings', 'collect');
|
125 |
+
return;
|
126 |
+
//return $this->processTaxCalculationFail('Missing or invalid Merchant Settings');
|
127 |
+
}
|
128 |
+
|
129 |
+
// Preparing Exactor Invoice Request
|
130 |
+
$invoiceRequest = $this->exactorMappingHelper->buildInvoiceRequestForQuoteAddress($address, $merchantSettings, $this->isMultishippingRequest());
|
131 |
+
$this->logger->trace('Invoice ' . serialize($invoiceRequest),'collect');
|
132 |
+
if ($invoiceRequest != null && $this->checkIfCalculationNeeded($invoiceRequest, $merchantSettings)){
|
133 |
+
// Sending to Exactor Tax Calculation Request to Exactor
|
134 |
+
$exactorProcessingService = ExactorProcessingServiceFactory::getInstance()->buildExactorProcessingService($merchantSettings->getMerchantID(),
|
135 |
+
$merchantSettings->getUserID());
|
136 |
+
$calculatedTax = 0;
|
137 |
+
try{
|
138 |
+
$exactorResponse = $exactorProcessingService->calculateTax($invoiceRequest);
|
139 |
+
if ($exactorResponse->hasErrors()){ // Exactor unable to calculate tax
|
140 |
+
$msg = self::MSG_GENERAL_ERROR . 'EX' . $exactorResponse->getFirstError()->getErrorCode();
|
141 |
+
if (in_array($exactorResponse->getFirstError()->getErrorCode(), $this->notifyUserErrorCodes))
|
142 |
+
$msg = $exactorResponse->getFirstError()->getErrorDescription();
|
143 |
+
return $this->processTaxCalculationFail($msg);
|
144 |
+
}else{
|
145 |
+
$invoiceResponse = $exactorResponse->getFirstInvoice();
|
146 |
+
if ($invoiceResponse!=null)
|
147 |
+
$calculatedTax = $invoiceResponse->getTotalTaxAmount();
|
148 |
}
|
149 |
+
}catch(Exception $e){ // Critical Exactor communication error - Network timeout for instance
|
150 |
+
$this->applyTax(0);
|
151 |
+
$this->logger->error(self::LOG_MESSAGE_TAX_CALC_FAILED . $e->getMessage(), 'collect');
|
152 |
+
$this->session->addError($e->getMessage());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
}
|
154 |
+
$this->applyTax($calculatedTax);
|
155 |
+
$address->setTaxAmount($calculatedTax);
|
156 |
+
$address->setBaseTaxAmount($calculatedTax);
|
157 |
+
}else{
|
158 |
+
$this->applyTax($address->getTaxAmount());
|
159 |
}
|
160 |
return $this;
|
161 |
+
}
|
162 |
+
|
163 |
+
|
164 |
+
private function applyTax($amount){
|
165 |
+
$this->_setBaseAmount($amount);
|
166 |
+
$this->_setAmount($amount);
|
167 |
+
}
|
168 |
|
169 |
/**
|
170 |
+
* Return TRUE if tax calculation IS needed, FALSE - otherwise
|
171 |
+
* @param InvoiceRequestType $invoiceRequest
|
172 |
+
* @param Exactor_Core_Model_MerchantSettings $merchantSettings
|
173 |
+
* @return bool
|
|
|
174 |
*/
|
175 |
+
private function checkIfCalculationNeeded($invoiceRequest, $merchantSettings){
|
176 |
+
// Calculating digital signature for the current request
|
177 |
+
$taxRequest = ExactorConnectionFactory::getInstance()->buildRequest($merchantSettings->getMerchantID(), $merchantSettings->getUserID());
|
178 |
+
$taxRequest->addInvoiceRequest($invoiceRequest);
|
179 |
+
$signatureBuilder = new ExactorDigitalSignatureBuilder();
|
180 |
+
$signatureBuilder->setTargetObject($taxRequest);
|
181 |
+
$signature = $signatureBuilder->buildDigitalSignature();
|
182 |
+
// Loading previous one from the session cache
|
183 |
+
$prviousTrnInfo = $this->exactorSessionCache->getLatestTransactionInfo($invoiceRequest->getPurchaseOrderNumber());
|
184 |
+
if ($prviousTrnInfo==null) return true;
|
185 |
+
if ($prviousTrnInfo->getSignature() == $signature) return false;
|
186 |
+
return true;
|
187 |
+
}
|
188 |
+
|
189 |
+
private function reportError($msg){
|
190 |
+
$errObj = Mage::getSingleton('core/message')->error($msg);
|
191 |
+
foreach ($this->session->getMessages()->getErrors() as $message){
|
192 |
+
if ($message->getCode() == $errObj->getCode())
|
193 |
+
return;
|
194 |
+
}
|
195 |
+
$this->session->addMessage($errObj);
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Do postprocessing after failed tax calculation
|
200 |
+
* @param $reason
|
201 |
+
* @return Exactor_Tax_Model_Sales_Total_Quote_Tax
|
202 |
+
*/
|
203 |
+
private function processTaxCalculationFail($reason){
|
204 |
+
$this->applyTax(0);
|
205 |
+
$this->logger->error(self::LOG_MESSAGE_TAX_CALC_FAILED . $reason, 'collect');
|
206 |
+
$this->reportError($reason);
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
return $this;
|
208 |
}
|
209 |
|
210 |
/**
|
211 |
+
* Get Tax label
|
212 |
*
|
213 |
+
* @return string
|
|
|
|
|
214 |
*/
|
215 |
+
public function getLabel()
|
216 |
{
|
217 |
+
return $this->_helper->__('Tax');
|
218 |
+
}
|
219 |
+
|
220 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
221 |
+
{
|
222 |
+
$applied = $address->getAppliedTaxes();
|
223 |
$store = $address->getQuote()->getStore();
|
224 |
+
$amount = $address->getTaxAmount();
|
225 |
+
$area = null;
|
226 |
+
if ($this->_config->displayCartTaxWithGrandTotal($store) && $address->getGrandTotal()) {
|
227 |
+
$area = 'taxes';
|
228 |
+
}
|
229 |
+
|
230 |
+
// if (is_array($applied) && (($amount!=0) || ($this->_config->displayCartZeroTax($store)))) {
|
231 |
+
$address->addTotal(array(
|
232 |
+
'code' => $this->getCode(),
|
233 |
+
'title' => $this->getLabel(),
|
234 |
+
'full_info' => $applied ? $applied : array(),
|
235 |
+
'value' => $amount,
|
236 |
+
'area' => $area
|
237 |
+
));
|
238 |
+
// }
|
239 |
+
|
240 |
+
$store = $address->getQuote()->getStore();
|
241 |
+
/**
|
242 |
+
* Modify subtotal
|
243 |
+
*/
|
244 |
+
if ($this->_config->displayCartSubtotalBoth($store) || $this->_config->displayCartSubtotalInclTax($store)) {
|
245 |
+
if ($address->getSubtotalInclTax() > 0) {
|
246 |
+
$subtotalInclTax = $address->getSubtotalInclTax();
|
247 |
} else {
|
248 |
+
$subtotalInclTax = $address->getSubtotal()+$address->getTaxAmount()-$address->getShippingTaxAmount();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
}
|
|
|
250 |
|
251 |
+
$address->addTotal(array(
|
252 |
+
'code' => 'subtotal',
|
253 |
+
'title' => Mage::helper('sales')->__('Subtotal'),
|
254 |
+
'value' => $subtotalInclTax,
|
255 |
+
'value_incl_tax' => $subtotalInclTax,
|
256 |
+
'value_excl_tax' => $address->getSubtotal(),
|
257 |
+
));
|
258 |
}
|
259 |
+
|
260 |
return $this;
|
261 |
}
|
262 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Exactor/Tax/etc/config.xml
CHANGED
@@ -1,59 +1,57 @@
|
|
1 |
-
<?xml version="1.0" ?>
|
2 |
-
<!--
|
3 |
-
/**
|
4 |
-
* Magento
|
5 |
-
*
|
6 |
-
* NOTICE OF LICENSE
|
7 |
-
*
|
8 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://opensource.org/licenses/afl-3.0.php
|
12 |
-
* If you did not receive a copy of the license and are unable to
|
13 |
-
* obtain it through the world-wide-web, please send an email
|
14 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
-
*
|
16 |
-
* DISCLAIMER
|
17 |
-
*
|
18 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
-
* versions in the future. If you wish to customize Magento for your
|
20 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
-
*
|
22 |
-
* @category Exactor
|
23 |
-
* @package Exactor_Tax
|
24 |
-
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
25 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
-
*/
|
27 |
-
-->
|
28 |
-
<config>
|
29 |
-
|
30 |
-
<Exactor_Tax>
|
31 |
-
<version>2012.
|
32 |
-
</Exactor_Tax>
|
33 |
-
</modules>
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
<
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
</global>
|
59 |
-
</config>
|
1 |
+
<?xml version="1.0" ?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Exactor
|
23 |
+
* @package Exactor_Tax
|
24 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<modules>
|
30 |
+
<Exactor_Tax>
|
31 |
+
<version>2012.05.14</version>
|
32 |
+
</Exactor_Tax>
|
33 |
+
</modules>
|
34 |
+
<global>
|
35 |
+
<models>
|
36 |
+
<exactor_tax>
|
37 |
+
<class>Exactor_Tax_Model</class>
|
38 |
+
</exactor_tax>
|
39 |
+
<tax>
|
40 |
+
<rewrite>
|
41 |
+
<sales_total_quote_nominal_tax>Exactor_Tax_Model_Sales_Total_Quote_Nominal_Tax</sales_total_quote_nominal_tax>
|
42 |
+
<sales_total_quote_tax>Exactor_Tax_Model_Sales_Total_Quote_Tax</sales_total_quote_tax>
|
43 |
+
<sales_quote_address_total_tax>Exactor_Tax_Model_Sales_Total_Quote_Tax</sales_quote_address_total_tax>
|
44 |
+
</rewrite>
|
45 |
+
</tax>
|
46 |
+
</models>
|
47 |
+
<helpers>
|
48 |
+
<tax>
|
49 |
+
<rewrite>
|
50 |
+
<calculation>Exactor_Tax_Helper_Calculation</calculation>
|
51 |
+
<mapping>Exactor_Tax_Helper_Mapping</mapping>
|
52 |
+
</rewrite>
|
53 |
+
</tax>
|
54 |
+
</helpers>
|
55 |
+
</global>
|
56 |
+
|
57 |
+
</config>
|
|
|
|
app/design/adminhtml/default/default/layout/exactoronestepcheckout.xml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<layoutUpdate>
|
2 |
+
<default>
|
3 |
+
<reference name="head">
|
4 |
+
<action method="addJs"><script>exactor/exactor.js</script></action>
|
5 |
+
</reference>
|
6 |
+
</default>
|
7 |
+
</layoutUpdate>
|
app/design/adminhtml/default/default/layout/{exactordetails.xml → exactorsettings.xml}
RENAMED
@@ -27,14 +27,9 @@
|
|
27 |
-->
|
28 |
|
29 |
<layout>
|
30 |
-
<
|
31 |
-
<update handle="exactordetails_exactorform_index"/>
|
32 |
<reference name="content">
|
33 |
-
<block type="
|
34 |
-
<block type="exactordetails/switcher" name="exactordetails_switcher" as="exactordetails_switcher" >
|
35 |
-
<action method="setUseConfirm"><params>0</params></action>
|
36 |
-
</block>
|
37 |
-
</block>
|
38 |
</reference>
|
39 |
-
</
|
40 |
</layout>
|
27 |
-->
|
28 |
|
29 |
<layout>
|
30 |
+
<exactorsettings_adminhtml_form_index>
|
|
|
31 |
<reference name="content">
|
32 |
+
<block type="Exactor_ExactorSettings_Block_Form" name="ExactorSettingsForm" template="ExactorSettings/settingsform.phtml" />
|
|
|
|
|
|
|
|
|
33 |
</reference>
|
34 |
+
</exactorsettings_adminhtml_form_index>
|
35 |
</layout>
|
app/design/adminhtml/default/default/template/ExactorSettings/settingsform.phtml
ADDED
@@ -0,0 +1,291 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 design_default
|
22 |
+
* @package Exactor
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
#get the country list from country_collection resource model
|
28 |
+
$country_lists = Mage::getResourceModel('directory/country_collection')->load()->toOptionArray();
|
29 |
+
#get the region list from region_collection resource model
|
30 |
+
$region_lists = Mage::getResourceModel('directory/region_collection')->load()->toOptionArray();
|
31 |
+
$this->loadData();
|
32 |
+
$pluginVersion = $this->getData('pluginVersion');
|
33 |
+
$accountSettings = $this->getData('accountSettings');
|
34 |
+
$websites = Mage::app()->getWebsites(true);
|
35 |
+
|
36 |
+
?>
|
37 |
+
<div class="content-header">
|
38 |
+
<table cellspacing="0" class="grid-header">
|
39 |
+
<tr>
|
40 |
+
<td><h3><?php echo $this->__('Exactor Account')?></h3></td>
|
41 |
+
<td><div style='float:right'><h3>Plugin Version: <?php echo $pluginVersion ?></h3></div></td>
|
42 |
+
</tr>
|
43 |
+
</table>
|
44 |
+
</div>
|
45 |
+
<div class="entry-edit">
|
46 |
+
<form id="edit_form" name="edit_form" method="post" action="<?php echo $this->getUrl('*/*/post', array('_secure' => true)); ?>">
|
47 |
+
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
48 |
+
<input name="exactordetailsform[ID]" type="hidden" value="<?php echo $accountSettings->getID(); ?>" />
|
49 |
+
<input name="exactordetailsform[StoreViewID]" type="hidden" value="<?php echo $accountSettings->getStoreViewID(); ?>" />
|
50 |
+
<?php if ($websites): ?>
|
51 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Magento Store View')?></h4>
|
52 |
+
<fieldset id="magento-store">
|
53 |
+
<table cellspacing="0" class="form-list" width="100%">
|
54 |
+
<tr>
|
55 |
+
<td class="label"><?php echo $this->__('Choose Store View')?> <span class="required">*</span></td>
|
56 |
+
<td class="input-ele">
|
57 |
+
<select name="exactordetailsform[StoreViewID]" id="StoreViewID" onchange="return switchStore(this);">
|
58 |
+
<?php foreach (Mage::app()->getStores() as $store): ?>
|
59 |
+
<option value="<?php echo $store->getId() ?>"<?php if(
|
60 |
+
($accountSettings->getStoreViewID() != null && $store->getId() == $accountSettings->getStoreViewID())
|
61 |
+
|| ( $accountSettings->getStoreViewID() == null && $store->getId() == Mage::app()->getDefaultStoreView()->getId() )): ?> selected="selected"<?php endif; ?>> <?php echo $store->getName() ?></option>
|
62 |
+
<?php endforeach; ?>
|
63 |
+
</select>
|
64 |
+
</td>
|
65 |
+
</tr>
|
66 |
+
</table>
|
67 |
+
</fieldset>
|
68 |
+
<?php endif; ?>
|
69 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Exactor Account Information')?></h4>
|
70 |
+
<fieldset id="exactor-account">
|
71 |
+
<table cellspacing="0" class="form-list" width="100%">
|
72 |
+
<tr>
|
73 |
+
<td class="label"><?php echo $this->__('Account #')?> <span class="required">*</span></td>
|
74 |
+
<td class="input-ele">
|
75 |
+
<input class="input-text validate-digits required-entry" name="exactordetailsform[MerchantID]" value="<?php echo $accountSettings->getMerchantID() ;?>" />
|
76 |
+
<div style="font-weight: bold; margin-left: 15px; display: inline;">
|
77 |
+
(<a href="https://merchant.exactor.com/account/signup/application" target="_blank">Click Here</a> to sign up for an Exactor Account)
|
78 |
+
</div>
|
79 |
+
</td>
|
80 |
+
</tr>
|
81 |
+
<tr>
|
82 |
+
<td class="label"><?php echo $this->__('User Name')?> <span class="required">*</span></td>
|
83 |
+
<td class="input-ele"><input class="input-text required-entry" name="exactordetailsform[UserID]" value="<?php echo $accountSettings->getUserID();?>"/></td>
|
84 |
+
</tr>
|
85 |
+
<tr>
|
86 |
+
<td class="label" colspan="2" style="font-weight: bold;"><?php echo $this->__('Business Address') ?></td>
|
87 |
+
</tr>
|
88 |
+
<tr>
|
89 |
+
<td class="label"><?php echo $this->__('Full Name') ?> <span class="required">*</span></td>
|
90 |
+
<td class="input-ele"><input class="input-text validate-length required-entry" maxlength="128" name="exactordetailsform[FullName]" value="<?php echo $accountSettings->getFullName();?>"/></td>
|
91 |
+
</tr>
|
92 |
+
<tr>
|
93 |
+
<td class="label"><?php echo $this->__('Street 1')?> <span class="required">*</span></td>
|
94 |
+
<td class="input-ele">
|
95 |
+
<input class="input-text validate-length validate-street required-entry" maxlength="128" name="exactordetailsform[Street1]" value="<?php echo $accountSettings->getStreet1();?>"/>
|
96 |
+
</td>
|
97 |
+
</tr>
|
98 |
+
<tr>
|
99 |
+
<td class="label"><?php echo $this->__('Street 2')?> </td>
|
100 |
+
<td class="input-ele"><input class="input-text validate-length" name="exactordetailsform[Street2]" maxlength="128" value="<?php echo $accountSettings->getStreet2();?>"/></td>
|
101 |
+
</tr>
|
102 |
+
<tr>
|
103 |
+
<td class="label"><?php echo $this->__('City')?> <span class="required">*</span></td>
|
104 |
+
<td class="input-ele"><input class="input-text validate-length required-entry" maxlength="128" name="exactordetailsform[City]" value="<?php echo $accountSettings->getCity();?>"/></td>
|
105 |
+
</tr>
|
106 |
+
<tr>
|
107 |
+
<td class="label"><?php echo $this->__('State Or Province')?> <span class="required">*</span></td>
|
108 |
+
<td class="input-ele">
|
109 |
+
<select id="StateOrProvince_Id" class="required-entry" name="exactordetailsform[StateOrProvinceId]" STYLE="width: 250px">
|
110 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
111 |
+
</select>
|
112 |
+
<script type="text/javascript">
|
113 |
+
//<![CDATA[
|
114 |
+
$('StateOrProvince_Id').setAttribute('defaultValue', "<?php echo $accountSettings->getStateOrProvince() ?>");
|
115 |
+
//]]>
|
116 |
+
</script>
|
117 |
+
<input id="StateOrProvince" class="input-text validate-length"
|
118 |
+
value="<?php echo $accountSettings->getStateOrProvince() ?>"
|
119 |
+
maxlength="128" name="exactordetailsform[StateOrProvince]" />
|
120 |
+
</td>
|
121 |
+
</tr>
|
122 |
+
<tr>
|
123 |
+
<td class="label"><?php echo $this->__('Postal Code')?> <span class="required">*</span></td>
|
124 |
+
<td class="input-ele"><input class="input-text validate-zip required-entry" name="exactordetailsform[PostalCode]" value="<?php echo $accountSettings->getPostalCode();?>"/></td>
|
125 |
+
</tr>
|
126 |
+
<tr>
|
127 |
+
<td class="label"><?php echo $this->__('Country')?> <span class="required">*</span></td>
|
128 |
+
<td class="input-ele">
|
129 |
+
<select id="Country" class="required-entry" name="exactordetailsform[Country]" STYLE="width: 250px">
|
130 |
+
<?php foreach ($country_lists as $country): ?>
|
131 |
+
<option value=<?php echo $country["value"] ?>
|
132 |
+
<?php if(($country["value"]==$accountSettings->getCountry()) || (trim($country["value"])=="US" && trim($accountSettings->getCountry())=="")): ?>
|
133 |
+
selected="true"<?php endif ?>><?php echo $country["label"]?>
|
134 |
+
</option>
|
135 |
+
<?php endforeach ?>
|
136 |
+
</select>
|
137 |
+
</td>
|
138 |
+
</tr>
|
139 |
+
</table>
|
140 |
+
</fieldset>
|
141 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Plugin Settings')?></h4>
|
142 |
+
<fieldset>
|
143 |
+
<table cellspacing="0" class="form-list" width="100%">
|
144 |
+
<tr>
|
145 |
+
<td class="label" style="width: 280px"><?php echo $this->__('Do shipping charges include handling fees')?> <span class="required">*</span></td>
|
146 |
+
<td class="input-ele">
|
147 |
+
<select id="ShippingCharges" class="required-entry" name="exactordetailsform[ShippingCharges]" STYLE="width: 135px">
|
148 |
+
<option value="1" <?php if($accountSettings->isShippingIncludeHandling()): ?>selected="selected"<?php endif ?>>YES</option>
|
149 |
+
<option value="0" <?php if(!$accountSettings->isShippingIncludeHandling()): ?>selected="selected"<?php endif ?>>NO</option>
|
150 |
+
</select>
|
151 |
+
</td>
|
152 |
+
</tr>
|
153 |
+
<tr>
|
154 |
+
<td class="label" style="width: 280px"><?php echo $this->__('Commit taxes on')?> <span class="required">*</span></td>
|
155 |
+
<td class="input-ele">
|
156 |
+
<select id="CommitOption" class="required-entry" name="exactordetailsform[CommitOption]" style="width: 135px">
|
157 |
+
<?php
|
158 |
+
$commitOptions = $accountSettings->getCommitOptionsList();
|
159 |
+
foreach($commitOptions as $key => $description){
|
160 |
+
?>
|
161 |
+
<option value="<?php echo $key ?>" <?php if($key==$accountSettings->getCommitOption()): ?>selected="selected"<?php endif ?>><?php echo $description ?></option>
|
162 |
+
<?php } ?>
|
163 |
+
</select>
|
164 |
+
</td>
|
165 |
+
</tr>
|
166 |
+
<tr>
|
167 |
+
<td class="label" style="width: 280px"><?php echo $this->__('Enable Entity Exemptions')?> <span class="required">*</span></td>
|
168 |
+
<td class="input-ele">
|
169 |
+
<select id="EntityExemptions" class="required-entry" name="exactordetailsform[EntityExemptions]" STYLE="width: 135px">
|
170 |
+
<option value="1" <?php if($accountSettings->getExemptionsSupported()): ?>selected="selected"<?php endif ?>>YES</option>
|
171 |
+
<option value="0" <?php if(!$accountSettings->getExemptionsSupported()): ?>selected="selected"<?php endif ?>>NO</option>
|
172 |
+
</select>
|
173 |
+
</td>
|
174 |
+
</tr>
|
175 |
+
<tr>
|
176 |
+
<td class="label" STYLE="width: 280px"><?php echo $this->__('Source of SKU Information')?> <span class="required">*</span></td>
|
177 |
+
<td class="input-ele">
|
178 |
+
<select id="SourceofSKU" class="required-entry" name="exactordetailsform[SourceofSKU]" style="width: 135px">
|
179 |
+
<?php
|
180 |
+
foreach($accountSettings->getSkuSourcesList() as $key => $description):
|
181 |
+
?>
|
182 |
+
<option value="<?php echo $key ?>" <?php if($accountSettings->getSourceOfSKU()==$key): ?>selected="selected"<?php endif ?> class="">
|
183 |
+
<?php echo $description ?>
|
184 |
+
</option>
|
185 |
+
<?php endforeach ?>
|
186 |
+
</select>
|
187 |
+
</td>
|
188 |
+
</tr>
|
189 |
+
</table>
|
190 |
+
</fieldset>
|
191 |
+
</form>
|
192 |
+
</div>
|
193 |
+
|
194 |
+
<div>
|
195 |
+
<span class="required">*</span> Required fields
|
196 |
+
</div>
|
197 |
+
|
198 |
+
<div class="content-header">
|
199 |
+
<table cellspacing="0" class="grid-header">
|
200 |
+
<tr>
|
201 |
+
<td class="a-left">
|
202 |
+
<button id="saveBtn" onclick="editForm.submit();" class="scalable save" type="button"><span>Save Data</span></button>
|
203 |
+
</td>
|
204 |
+
</tr>
|
205 |
+
</table>
|
206 |
+
</div>
|
207 |
+
|
208 |
+
<script type="text/javascript">
|
209 |
+
new RegionUpdater('Country', 'StateOrProvince', 'StateOrProvince_Id',
|
210 |
+
<?php echo $this->helper('directory')->getRegionJson() ?>);
|
211 |
+
|
212 |
+
var editForm = new varienForm('edit_form');
|
213 |
+
|
214 |
+
editForm._submit = function(){
|
215 |
+
if(this.submitUrl){
|
216 |
+
$(this.formId).action = this.submitUrl;
|
217 |
+
}
|
218 |
+
showLoading();
|
219 |
+
$(this.formId).submit();
|
220 |
+
}
|
221 |
+
|
222 |
+
function showLoading() {
|
223 |
+
var saveBtn = document.getElementById("saveBtn");
|
224 |
+
try {
|
225 |
+
var x,y;
|
226 |
+
if (self.innerHeight)
|
227 |
+
{
|
228 |
+
// all except Explorer
|
229 |
+
x = self.innerWidth;
|
230 |
+
y = self.innerHeight;
|
231 |
+
}
|
232 |
+
else if (document.documentElement && document.documentElement.clientHeight)
|
233 |
+
{
|
234 |
+
// Explorer 6 Strict Mode
|
235 |
+
x = document.documentElement.clientWidth;
|
236 |
+
y = document.documentElement.clientHeight;
|
237 |
+
}
|
238 |
+
else if (document.body)
|
239 |
+
{
|
240 |
+
// other Explorers
|
241 |
+
x = document.body.clientWidth;
|
242 |
+
y = document.body.clientHeight;
|
243 |
+
}
|
244 |
+
|
245 |
+
var top = (y/2) - 60;
|
246 |
+
var left = (x/2) - 200;
|
247 |
+
|
248 |
+
$('loading-mask').style.visibility = 'visible';
|
249 |
+
$('loading-mask').style.display = "block";
|
250 |
+
$('loading-mask').style.left = left + "px"
|
251 |
+
$('loading-mask').style.top = top + "px";
|
252 |
+
$('loading-mask').style.width = "400px";
|
253 |
+
$('loading-mask').style.zIndex = 2;
|
254 |
+
//Element.show('loading-mask');
|
255 |
+
|
256 |
+
|
257 |
+
var loaderArea = $$('#html-body .wrapper')[0];
|
258 |
+
Element.clonePosition($('loading-mask'), $(loaderArea), {offsetLeft:-2});
|
259 |
+
//toggleSelectsUnderBlock($('loading-mask'), false);
|
260 |
+
Element.show('loading-mask');
|
261 |
+
setLoaderPosition();
|
262 |
+
} catch (err) {
|
263 |
+
// In IE, it will occur error, so I have to re-do the show code again. Do ask me why...
|
264 |
+
//var loaderArea = $$('#html-body .wrapper')[0];
|
265 |
+
//Element.clonePosition($('loading-mask'), $(loaderArea), {offsetLeft:-2});
|
266 |
+
//toggleSelectsUnderBlock($('loading-mask'), false);
|
267 |
+
//Element.show('loading-mask');
|
268 |
+
//setLoaderPosition();
|
269 |
+
}
|
270 |
+
}
|
271 |
+
|
272 |
+
String.prototype.trim = function()
|
273 |
+
{
|
274 |
+
return this.replace(/(^\s*)|(\s*$)/g, "");
|
275 |
+
}
|
276 |
+
|
277 |
+
function switchStore(obj){
|
278 |
+
var storeParam = obj.value ? 'storeview/'+obj.value + '/' : '';
|
279 |
+
if(obj.switchParams){
|
280 |
+
storeParam+= obj.switchParams;
|
281 |
+
}
|
282 |
+
if(confirm("<?php echo $this->__('Please confirm site switching. All data that hasn\'t been saved will be lost.') ?>")){
|
283 |
+
setLocation('<?php echo $this->getUrl('*/*/index', array('_secure' => true)); ?>key/<?php echo $this->getRequest()->getParam('key') ?>/'+storeParam);
|
284 |
+
return true;
|
285 |
+
}
|
286 |
+
else {
|
287 |
+
obj.value = '<?php echo $this->getStoreId() ?>';
|
288 |
+
}
|
289 |
+
return false;
|
290 |
+
}
|
291 |
+
</script>
|
app/design/adminhtml/default/default/template/exactordetails/exactordetailsform.phtml
DELETED
@@ -1,253 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/afl-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 design_default
|
22 |
-
* @package Exactor
|
23 |
-
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
#get the country list from country_collection resource model
|
28 |
-
$country_lists = Mage::getResourceModel('directory/country_collection')->load()->toOptionArray();
|
29 |
-
#get the region list from region_collection resource model
|
30 |
-
$region_lists = Mage::getResourceModel('directory/region_collection')->load()->toOptionArray();
|
31 |
-
|
32 |
-
#get the exactor account details from registry that were set up in the block
|
33 |
-
$exactor_account_details = Mage::registry("exactor_account_details");
|
34 |
-
|
35 |
-
#get the plugin version from registry that were set up in the block
|
36 |
-
$plugin_version = Mage::registry("plugin_version");
|
37 |
-
?>
|
38 |
-
<div class="content-header">
|
39 |
-
<table cellspacing="0" class="grid-header">
|
40 |
-
<tr>
|
41 |
-
<td><h3><?php echo $this->__('Exactor Account')?></h3></td>
|
42 |
-
<td><div style='float:right'><h3>Plugin Version: <?php echo $plugin_version; ?></h3></div></td>
|
43 |
-
</tr>
|
44 |
-
</table>
|
45 |
-
</div>
|
46 |
-
<div class="entry-edit">
|
47 |
-
<form id="edit_form" name="edit_form" method="post" action="<?php echo $this->getUrl('*/*/post', array('_secure' => true)); ?>">
|
48 |
-
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Exactor Account Information')?></h4>
|
49 |
-
<fieldset id="exactor-account">
|
50 |
-
<table cellspacing="0" class="form-list" width="100%">
|
51 |
-
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
52 |
-
<input name="exactordetailsform[ID]" type="hidden" value="<?php echo $exactor_account_details['ID'];?>" />
|
53 |
-
<tr>
|
54 |
-
<td class="label"><?php echo $this->__('Choose Store View') ?><span class="required">*</span></td>
|
55 |
-
<td class="input-ele"><?php echo $this->getStoreSwitcherHtml();?></td>
|
56 |
-
</tr>
|
57 |
-
<tr>
|
58 |
-
<td class="label"><?php echo $this->__('Account #')?> <span class="required">*</span></td>
|
59 |
-
<td class="input-ele">
|
60 |
-
<input class="input-text required-entry" name="exactordetailsform[MerchantID]" value="<?php echo $exactor_account_details['MerchantID'];?>" />
|
61 |
-
<div style="font-weight: bold; margin-left: 15px; display: inline;">
|
62 |
-
(<a href="https://merchant.exactor.com/account/signup/application" target="_blank">Click Here</a> to sign up for an Exactor Account)
|
63 |
-
</div>
|
64 |
-
</td>
|
65 |
-
</tr>
|
66 |
-
<tr>
|
67 |
-
<td class="label"><?php echo $this->__('User Name')?> <span class="required">*</span></td>
|
68 |
-
<td class="input-ele"><input class="input-text required-entry" name="exactordetailsform[UserID]" value="<?php echo $exactor_account_details['UserID'];?>"/></td>
|
69 |
-
</tr>
|
70 |
-
<tr>
|
71 |
-
<td class="label"><?php echo $this->__('Password')?> <span class="required">*</span></td>
|
72 |
-
<td class="input-ele"><input class="input-text required-entry" type="password" name="exactordetailsform[Password]" value="<?php echo $this->helper('exactordetails')->hex2str($exactor_account_details['Password']);?>"/></td>
|
73 |
-
</tr>
|
74 |
-
<tr>
|
75 |
-
<td class="label"><?php echo $this->__('Full Name')?> <span class="required">*</span></td>
|
76 |
-
<td class="input-ele"><input class="input-text required-entry" name="exactordetailsform[FullName]" value="<?php echo htmlspecialchars($exactor_account_details['FullName']);?>"/></td>
|
77 |
-
</tr>
|
78 |
-
<tr>
|
79 |
-
<td class="label"><?php echo $this->__('Street 1')?> <span class="required">*</span></td>
|
80 |
-
<td class="input-ele"><input class="input-text required-entry" name="exactordetailsform[Street1]" value="<?php echo htmlspecialchars($exactor_account_details['Street1']);?>"/></td>
|
81 |
-
</tr>
|
82 |
-
<tr>
|
83 |
-
<td class="label"><?php echo $this->__('Street 2')?> </td>
|
84 |
-
<td class="input-ele"><input class="input-text " name="exactordetailsform[Street2]" value="<?php echo htmlspecialchars($exactor_account_details['Street2']);?>"/></td>
|
85 |
-
</tr>
|
86 |
-
<tr>
|
87 |
-
<td class="label"><?php echo $this->__('City')?> <span class="required">*</span></td>
|
88 |
-
<td class="input-ele"><input class="input-text required-entry" name="exactordetailsform[City]" value="<?php echo htmlspecialchars($exactor_account_details['City']);?>"/></td>
|
89 |
-
</tr>
|
90 |
-
<tr>
|
91 |
-
<td class="label"><?php echo $this->__('State Or Province')?> <span class="required">*</span></td>
|
92 |
-
<td class="input-ele"><select id="StateOrProvince" class="required-entry" name="exactordetailsform[StateOrProvince]" STYLE="width: 250px">
|
93 |
-
<?php foreach ($region_lists as $region): ?>
|
94 |
-
<option value=<?php echo '"'.$region['label'].'"' ?> <?php if($region["label"]==$exactor_account_details['StateOrProvince']): ?>selected="selected"<?php endif ?>><?php echo $region["label"]?></option>
|
95 |
-
<?php endforeach ?>
|
96 |
-
</select>
|
97 |
-
</td>
|
98 |
-
</tr>
|
99 |
-
<tr>
|
100 |
-
<td class="label"><?php echo $this->__('Postal Code')?> <span class="required">*</span></td>
|
101 |
-
<td class="input-ele"><input class="input-text required-entry" name="exactordetailsform[PostalCode]" value="<?php echo $exactor_account_details['PostalCode'];?>"/></td>
|
102 |
-
</tr>
|
103 |
-
<tr>
|
104 |
-
<td class="label"><?php echo $this->__('Country')?> <span class="required">*</span></td>
|
105 |
-
<td class="input-ele">
|
106 |
-
<select id="Country" class="required-entry" name="exactordetailsform[Country]" STYLE="width: 250px">
|
107 |
-
<?php foreach ($country_lists as $country): ?>
|
108 |
-
<option value=<?php echo $country["value"] ?>
|
109 |
-
<?php if(($country["value"]==$exactor_account_details['Country']) || (trim($country["value"])=="US" && trim($exactor_account_details['Country'])=="")): ?>
|
110 |
-
selected="true"<?php endif ?>><?php echo $country["label"]?>
|
111 |
-
</option>
|
112 |
-
<?php endforeach ?>
|
113 |
-
</select>
|
114 |
-
</td>
|
115 |
-
</tr>
|
116 |
-
<tr>
|
117 |
-
<td class="label" STYLE="width: 280px"><?php echo $this->__('Do shipping charges include handling fees')?> <span class="required">*</span></td>
|
118 |
-
<td class="input-ele"><select id="ShippingCharges" class="required-entry" name="exactordetailsform[ShippingCharges]" STYLE="width: 135px">
|
119 |
-
<option value="1" <?php if("1"==$exactor_account_details['ShippingCharges']): ?>selected="selected"<?php endif ?>>YES</option>
|
120 |
-
<option value="0" <?php if(("0"==$exactor_account_details['ShippingCharges']) || empty($exactor_account_details['ShippingCharges'])): ?>selected="selected"<?php endif ?>>NO</option>
|
121 |
-
</select>
|
122 |
-
</td>
|
123 |
-
</tr>
|
124 |
-
<tr>
|
125 |
-
<td class="label" STYLE="width: 280px"><?php echo $this->__('Commit taxes on')?> <span class="required">*</span></td>
|
126 |
-
<td class="input-ele">
|
127 |
-
<select id="CommitOption" class="required-entry" name="exactordetailsform[CommitOption]" STYLE="width: 135px">
|
128 |
-
<?php
|
129 |
-
$commitOptions = $exactor_account_details['object']->getCommitOptionsList();
|
130 |
-
foreach($commitOptions as $key => $description){?>
|
131 |
-
<option value="<?= $key ?>" <?php if($key==$exactor_account_details['object']->getCommitOption()): ?>selected="selected"<?php endif ?>><?= $description ?></option>
|
132 |
-
<?php } ?>
|
133 |
-
</select>
|
134 |
-
</td>
|
135 |
-
</tr>
|
136 |
-
<tr>
|
137 |
-
<td class="label" STYLE="width: 280px"><?php echo $this->__('Enable Entity Exemptions')?> <span class="required">*</span></td>
|
138 |
-
<td class="input-ele"><select id="EntityExemptions" class="required-entry" name="exactordetailsform[EntityExemptions]" STYLE="width: 135px">
|
139 |
-
<option value="1" <?php if("1"==$exactor_account_details['EntityExemptions']): ?>selected="selected"<?php endif ?>>YES</option>
|
140 |
-
<option value="0" <?php if(("0"==$exactor_account_details['EntityExemptions']) || empty($exactor_account_details['EntityExemptions'])): ?>selected="selected"<?php endif ?>>NO</option>
|
141 |
-
</select>
|
142 |
-
</td>
|
143 |
-
</tr>
|
144 |
-
<tr>
|
145 |
-
<td class="label" STYLE="width: 280px"><?php echo $this->__('Source of SKU Information')?> <span class="required">*</span></td>
|
146 |
-
<td class="input-ele"><select id="SourceofSKU" class="required-entry" name="exactordetailsform[SourceofSKU]" STYLE="width: 135px">
|
147 |
-
<option value="NA" <?php if($exactor_account_details['SourceofSKU']=="NA"): ?>selected="selected"<?php endif ?>>None</option>
|
148 |
-
<option value="SK" <?php if($exactor_account_details['SourceofSKU']=="SK" || $exactor_account_details['SourceofSKU']==NULL): ?>selected="selected"<?php endif ?>>SKU Field</option>
|
149 |
-
<option value="AN" <?php if(($exactor_account_details['SourceofSKU']=="AN") || empty($exactor_account_details['SourceofSKU'])): ?>selected="selected"<?php endif ?>>Attribute Set Name</option>
|
150 |
-
<option value="TC" <?php if($exactor_account_details['SourceofSKU']=="TC"): ?>selected="selected"<?php endif ?>>Tax Class</option>
|
151 |
-
<option value="PC" <?php if($exactor_account_details['SourceofSKU']=="PC"): ?>selected="selected"<?php endif ?>>Product Category</option>
|
152 |
-
</select>
|
153 |
-
</td>
|
154 |
-
</tr>
|
155 |
-
<tr>
|
156 |
-
<td class="label"><span class="required">*</span> Required fields</td>
|
157 |
-
</tr>
|
158 |
-
|
159 |
-
</table>
|
160 |
-
</fieldset>
|
161 |
-
</form>
|
162 |
-
</div>
|
163 |
-
|
164 |
-
<div class="content-header">
|
165 |
-
<table cellspacing="0" class="grid-header">
|
166 |
-
<tr>
|
167 |
-
<td class="a-left">
|
168 |
-
<button id="saveBtn" onclick="showLoading();editForm.submit();" class="scalable save" type="button"><span>Save Data</span></button>
|
169 |
-
</td>
|
170 |
-
</tr>
|
171 |
-
</table>
|
172 |
-
</div>
|
173 |
-
|
174 |
-
<script type="text/javascript">
|
175 |
-
var editForm = new varienForm('edit_form');
|
176 |
-
//var exportForm = new varienForm('export_form');
|
177 |
-
|
178 |
-
function showLoading() {
|
179 |
-
var saveBtn = document.getElementById("saveBtn");
|
180 |
-
//saveBtn.disabled = true;
|
181 |
-
//var exportBtn = document.getElementById("exportBtn");
|
182 |
-
//exportBtn.disabled = true;
|
183 |
-
|
184 |
-
var field1 = document.getElementsByName('exactordetailsform[MerchantID]')[0];
|
185 |
-
var field2 = document.getElementsByName('exactordetailsform[UserID]')[0];
|
186 |
-
var field3 = document.getElementsByName('exactordetailsform[Password]')[0];
|
187 |
-
var field4 = document.getElementsByName('exactordetailsform[FullName]')[0];
|
188 |
-
var field5 = document.getElementsByName('exactordetailsform[Street1]')[0];
|
189 |
-
var field7 = document.getElementsByName('exactordetailsform[City]')[0];
|
190 |
-
var field8 = document.getElementsByName('exactordetailsform[PostalCode]')[0];
|
191 |
-
var field9 = document.getElementsByName('exactordetailsform[Country]')[0];
|
192 |
-
if (field1.value.trim() != "" &&
|
193 |
-
field2.value.trim() != "" &&
|
194 |
-
field3.value.trim() != "" &&
|
195 |
-
field4.value.trim() != "" &&
|
196 |
-
field5.value.trim() != "" &&
|
197 |
-
field7.value.trim() != "" &&
|
198 |
-
field8.value.trim() != "" &&
|
199 |
-
field9.value.trim() != "") {
|
200 |
-
try {
|
201 |
-
var x,y;
|
202 |
-
if (self.innerHeight)
|
203 |
-
{
|
204 |
-
// all except Explorer
|
205 |
-
x = self.innerWidth;
|
206 |
-
y = self.innerHeight;
|
207 |
-
}
|
208 |
-
else if (document.documentElement && document.documentElement.clientHeight)
|
209 |
-
{
|
210 |
-
// Explorer 6 Strict Mode
|
211 |
-
x = document.documentElement.clientWidth;
|
212 |
-
y = document.documentElement.clientHeight;
|
213 |
-
}
|
214 |
-
else if (document.body)
|
215 |
-
{
|
216 |
-
// other Explorers
|
217 |
-
x = document.body.clientWidth;
|
218 |
-
y = document.body.clientHeight;
|
219 |
-
}
|
220 |
-
|
221 |
-
var top = (y/2) - 60;
|
222 |
-
var left = (x/2) - 200;
|
223 |
-
|
224 |
-
$('loading-mask').style.visibility = 'visible';
|
225 |
-
$('loading-mask').style.display = "block";
|
226 |
-
$('loading-mask').style.left = left + "px"
|
227 |
-
$('loading-mask').style.top = top + "px";
|
228 |
-
$('loading-mask').style.width = "400px";
|
229 |
-
$('loading-mask').style.zIndex = 2;
|
230 |
-
//Element.show('loading-mask');
|
231 |
-
|
232 |
-
|
233 |
-
var loaderArea = $$('#html-body .wrapper')[0];
|
234 |
-
Element.clonePosition($('loading-mask'), $(loaderArea), {offsetLeft:-2});
|
235 |
-
//toggleSelectsUnderBlock($('loading-mask'), false);
|
236 |
-
Element.show('loading-mask');
|
237 |
-
setLoaderPosition();
|
238 |
-
} catch (err) {
|
239 |
-
// In IE, it will occur error, so I have to re-do the show code again. Do ask me why...
|
240 |
-
//var loaderArea = $$('#html-body .wrapper')[0];
|
241 |
-
//Element.clonePosition($('loading-mask'), $(loaderArea), {offsetLeft:-2});
|
242 |
-
//toggleSelectsUnderBlock($('loading-mask'), false);
|
243 |
-
//Element.show('loading-mask');
|
244 |
-
//setLoaderPosition();
|
245 |
-
}
|
246 |
-
}
|
247 |
-
}
|
248 |
-
|
249 |
-
String.prototype.trim = function()
|
250 |
-
{
|
251 |
-
return this.replace(/(^\s*)|(\s*$)/g, "");
|
252 |
-
}
|
253 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/exactordetails/switcher.phtml
DELETED
@@ -1,73 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/afl-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 design
|
22 |
-
* @package default_default
|
23 |
-
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php if ($websites = $this->getWebsites()): ?>
|
28 |
-
|
29 |
-
<select name="exactordetailsform[StoreViewID]" id="StoreViewID" onchange="return switchStore(this);">
|
30 |
-
|
31 |
-
<?php foreach ($websites as $website): ?>
|
32 |
-
<?php $showWebsite=false; ?>
|
33 |
-
<?php foreach ($website->getGroups() as $group): ?>
|
34 |
-
<?php $showGroup=false; ?>
|
35 |
-
<?php foreach ($this->getStores($group) as $store): ?>
|
36 |
-
<?php if ($showWebsite == false): ?>
|
37 |
-
<?php $showWebsite = true; ?>
|
38 |
-
<optgroup label="<?php echo $website->getName() ?>"></optgroup>
|
39 |
-
<?php endif; ?>
|
40 |
-
<?php if ($showGroup == false): ?>
|
41 |
-
<?php $showGroup = true; ?>
|
42 |
-
<optgroup label=" <?php echo $group->getName() ?>">
|
43 |
-
<?php endif; ?>
|
44 |
-
<option value="<?php echo $store->getId() ?>"<?php if($this->getStoreId() == $store->getId()): ?> selected="selected"<?php endif; ?>> <?php echo $store->getName() ?></option>
|
45 |
-
<?php endforeach; ?>
|
46 |
-
<?php if ($showGroup): ?>
|
47 |
-
</optgroup>
|
48 |
-
<?php endif; ?>
|
49 |
-
<?php endforeach; ?>
|
50 |
-
<?php endforeach; ?>
|
51 |
-
</select>
|
52 |
-
|
53 |
-
<script type="text/javascript">
|
54 |
-
function switchStore(obj){
|
55 |
-
var storeParam = obj.value ? 'store/'+obj.value + '/' : '';
|
56 |
-
if(obj.switchParams){
|
57 |
-
storeParam+= obj.switchParams;
|
58 |
-
}
|
59 |
-
<?php if($this->getUseConfirm()): ?>
|
60 |
-
if(confirm("<?php echo $this->__('Please confirm site switching. All data that hasn\'t been saved will be lost.') ?>")){
|
61 |
-
setLocation('<?php echo $this->getSwitchUrl() ?>'+storeParam);
|
62 |
-
return true;
|
63 |
-
}
|
64 |
-
else {
|
65 |
-
obj.value = '<?php echo $this->getStoreId() ?>';
|
66 |
-
}
|
67 |
-
return false;
|
68 |
-
<?php else: ?>
|
69 |
-
setLocation('<?php echo $this->getSwitchUrl() ?>'+storeParam);
|
70 |
-
<?php endif; ?>
|
71 |
-
}
|
72 |
-
</script>
|
73 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/layout/exactoronestepcheckout.xml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<layoutUpdate>
|
2 |
+
<default>
|
3 |
+
<reference name="head">
|
4 |
+
<action method="addJs"><script>exactor/exactor.js</script></action>
|
5 |
+
</reference>
|
6 |
+
</default>
|
7 |
+
</layoutUpdate>
|
app/etc/modules/Exactor.xml
CHANGED
@@ -27,29 +27,21 @@
|
|
27 |
-->
|
28 |
<config>
|
29 |
<modules>
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
<Exactor_Sales>
|
47 |
-
<codePool>local</codePool>
|
48 |
-
<active>true</active>
|
49 |
-
</Exactor_Sales>
|
50 |
-
<Exactor_Paypal>
|
51 |
-
<codePool>local</codePool>
|
52 |
-
<active>true</active>
|
53 |
-
</Exactor_Paypal>
|
54 |
</modules>
|
55 |
</config>
|
27 |
-->
|
28 |
<config>
|
29 |
<modules>
|
30 |
+
<Exactor_Tax>
|
31 |
+
<codePool>local</codePool>
|
32 |
+
<active>true</active>
|
33 |
+
</Exactor_Tax>
|
34 |
+
<Exactor_Core>
|
35 |
+
<codePool>local</codePool>
|
36 |
+
<active>true</active>
|
37 |
+
</Exactor_Core>
|
38 |
+
<Exactor_ExactorSettings>
|
39 |
+
<codePool>local</codePool>
|
40 |
+
<active>true</active>
|
41 |
+
</Exactor_ExactorSettings>
|
42 |
+
<Exactor_Sales>
|
43 |
+
<codePool>local</codePool>
|
44 |
+
<active>true</active>
|
45 |
+
</Exactor_Sales>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
</modules>
|
47 |
</config>
|
js/exactor/exactor.js
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
document.observe('dom:loaded', function() {
|
2 |
if($('onestepcheckout-place-order')!=null){
|
3 |
-
var exactorStatusUrl="/
|
4 |
var originalOSCHandler=null;
|
|
|
5 |
// Handle place order click event
|
6 |
-
|
7 |
-
|
|
|
8 |
if (submitOriginalHandlers.length > 1){
|
9 |
originalOSCHandler = submitOriginalHandlers[1];
|
10 |
// Unbind original
|
@@ -26,7 +28,8 @@ document.observe('dom:loaded', function() {
|
|
26 |
if(transport.status == 200){
|
27 |
var data = transport.responseText.evalJSON();
|
28 |
if (data.exactor_status){
|
29 |
-
|
|
|
30 |
Event.stop(event);
|
31 |
}
|
32 |
else
|
1 |
document.observe('dom:loaded', function() {
|
2 |
if($('onestepcheckout-place-order')!=null){
|
3 |
+
var exactorStatusUrl="../ExactorSettings/ajax/getExactorStatus";
|
4 |
var originalOSCHandler=null;
|
5 |
+
var buttonElement = $('onestepcheckout-place-order');
|
6 |
// Handle place order click event
|
7 |
+
buttonElement.observe('click', function(e){
|
8 |
+
//$('onestepcheckout-place-order').getStorage().get('prototype_event_registry').get('click');
|
9 |
+
var submitOriginalHandlers = Event.cache[buttonElement._eventId || (buttonElement._prototypeEventID || [])[0]].click;;
|
10 |
if (submitOriginalHandlers.length > 1){
|
11 |
originalOSCHandler = submitOriginalHandlers[1];
|
12 |
// Unbind original
|
28 |
if(transport.status == 200){
|
29 |
var data = transport.responseText.evalJSON();
|
30 |
if (data.exactor_status){
|
31 |
+
alert(data.exactor_status);
|
32 |
+
//window.location.href="javascript:showDialog('','" + data.exactor_status + "','error',2)";
|
33 |
Event.stop(event);
|
34 |
}
|
35 |
else
|
lib/ExactorCommons/ExactorCommons.php
ADDED
@@ -0,0 +1,818 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Contains common Exactor classes and interfaces
|
4 |
+
* User: LOGICIFY\corvis
|
5 |
+
* Date: 4/18/12
|
6 |
+
* Time: 5:33 PM
|
7 |
+
*/
|
8 |
+
|
9 |
+
abstract class IExactorLogger{
|
10 |
+
|
11 |
+
const TRACE = 0;
|
12 |
+
const DEBUG = 1;
|
13 |
+
const INFO = 2;
|
14 |
+
const ERROR = 3;
|
15 |
+
|
16 |
+
private $logLevel = self::INFO;
|
17 |
+
private $loggerName = 'root';
|
18 |
+
protected abstract function doOutput($body);
|
19 |
+
|
20 |
+
public function log($message, $callee=null, $level=self::DEBUG){
|
21 |
+
|
22 |
+
// Check if we should just skip this message on our Log Level
|
23 |
+
if ($level < $this->getLogLevel()) return;
|
24 |
+
|
25 |
+
if ($callee==null)
|
26 |
+
$callee = '';
|
27 |
+
$time = new DateTime();
|
28 |
+
$this->doOutput('[' . $time->format('Y-m-d H:i:s') . '] ' . $this->getLoggerName() . ' - ' . $callee . ': ' . $message . "\n") ;
|
29 |
+
}
|
30 |
+
|
31 |
+
public function debug($msg, $callee=null){
|
32 |
+
$this->log($msg, $callee, self::DEBUG);
|
33 |
+
}
|
34 |
+
|
35 |
+
public function trace($msg, $callee=null){
|
36 |
+
$this->log($msg, $callee, self::TRACE);
|
37 |
+
}
|
38 |
+
|
39 |
+
public function info($msg, $callee=null){
|
40 |
+
$this->log($msg, $callee, self::INFO);
|
41 |
+
}
|
42 |
+
|
43 |
+
public function error($msg, $callee=null){
|
44 |
+
$this->log($msg, $callee, self::ERROR);
|
45 |
+
}
|
46 |
+
|
47 |
+
public function setLogLevel($logLevel)
|
48 |
+
{
|
49 |
+
$this->logLevel = $logLevel;
|
50 |
+
}
|
51 |
+
|
52 |
+
public function getLogLevel()
|
53 |
+
{
|
54 |
+
return $this->logLevel;
|
55 |
+
}
|
56 |
+
|
57 |
+
public function setLoggerName($loggerName)
|
58 |
+
{
|
59 |
+
if (!is_string($loggerName)){ // This is not class name
|
60 |
+
$loggerName = get_class($loggerName); // Get class name
|
61 |
+
}
|
62 |
+
$this->loggerName = $loggerName;
|
63 |
+
}
|
64 |
+
|
65 |
+
public function getLoggerName()
|
66 |
+
{
|
67 |
+
return $this->loggerName;
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
class ExactorFakeLogger extends IExactorLogger{
|
72 |
+
protected function doOutput($body)
|
73 |
+
{
|
74 |
+
// Just do nothing
|
75 |
+
}
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
class ExactorLoggingFactory{
|
80 |
+
private static $instance;
|
81 |
+
|
82 |
+
private $loggerClass='ExactorFakeLogger';
|
83 |
+
private $logLevel=IExactorLogger::INFO;
|
84 |
+
private function __construct()
|
85 |
+
{
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @param string|clazz $name
|
90 |
+
* @return IExactorLogger
|
91 |
+
*/
|
92 |
+
public function getLogger($name = 'root'){
|
93 |
+
$logger = $this->createLoggerInstance();
|
94 |
+
$logger->setLoggerName($name);
|
95 |
+
$logger->setLogLevel($this->logLevel);
|
96 |
+
return $logger;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* @return IExactorLogger
|
101 |
+
*/
|
102 |
+
private function createLoggerInstance(){
|
103 |
+
return new $this->loggerClass;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* @static
|
108 |
+
* @return ExactorLoggingFactory
|
109 |
+
*/
|
110 |
+
public static function getInstance(){
|
111 |
+
if (!isset(self::$instance)) {
|
112 |
+
$className = __CLASS__;
|
113 |
+
self::$instance = new $className;
|
114 |
+
}
|
115 |
+
return self::$instance;
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Shortcut for settings up logging subsystem
|
120 |
+
* @param $loggerClass
|
121 |
+
* @param int $logLevel
|
122 |
+
* @return void
|
123 |
+
*/
|
124 |
+
public function setup($loggerClass, $logLevel=IExactorLogger::INFO){
|
125 |
+
$this->loggerClass = $loggerClass;
|
126 |
+
$this->logLevel = $logLevel;
|
127 |
+
}
|
128 |
+
|
129 |
+
public function setLoggerClass($loggerClass)
|
130 |
+
{
|
131 |
+
$this->loggerClass = $loggerClass;
|
132 |
+
}
|
133 |
+
|
134 |
+
public function getLoggerClass()
|
135 |
+
{
|
136 |
+
return $this->loggerClass;
|
137 |
+
}
|
138 |
+
|
139 |
+
public function setLogLevel($logLevel)
|
140 |
+
{
|
141 |
+
$this->logLevel = $logLevel;
|
142 |
+
}
|
143 |
+
|
144 |
+
public function getLogLevel()
|
145 |
+
{
|
146 |
+
return $this->logLevel;
|
147 |
+
}
|
148 |
+
|
149 |
+
|
150 |
+
}
|
151 |
+
|
152 |
+
/* ******************** EXACTOR CONNECTOR ***************************/
|
153 |
+
|
154 |
+
class ExactorConnector{
|
155 |
+
|
156 |
+
private $endpointUrl='';
|
157 |
+
|
158 |
+
const HTTP_TIMEOUT = 30;
|
159 |
+
private $logger;
|
160 |
+
private $pluginIdentity='';
|
161 |
+
|
162 |
+
function __construct()
|
163 |
+
{
|
164 |
+
$this->logger = ExactorLoggingFactory::getInstance()->getLogger($this);
|
165 |
+
}
|
166 |
+
|
167 |
+
|
168 |
+
private function prepareHttpClient(){
|
169 |
+
$client = curl_init();
|
170 |
+
curl_setopt($client, CURLOPT_URL, $this->endpointUrl);
|
171 |
+
curl_setopt($client, CURLOPT_POST, 1);
|
172 |
+
curl_setopt($client, CURLOPT_HEADER, false);
|
173 |
+
curl_setopt($client, CURLOPT_HTTPHEADER, array('Accept: application/xml', 'Content-Type: application/xml; charset=utf-8'));
|
174 |
+
curl_setopt($client, CURLOPT_FOLLOWLOCATION, true);
|
175 |
+
curl_setopt($client, CURLOPT_RETURNTRANSFER, true);
|
176 |
+
curl_setopt($client, CURLOPT_SSL_VERIFYPEER, 0);
|
177 |
+
curl_setopt($client, CURLOPT_SSL_VERIFYHOST, 0);
|
178 |
+
curl_setopt($client, CURLOPT_TIMEOUT, self::HTTP_TIMEOUT);
|
179 |
+
curl_setopt($client, CURLOPT_USERAGENT, $this->getPluginIdentity());
|
180 |
+
return $client;
|
181 |
+
}
|
182 |
+
|
183 |
+
private function doHttpRequest($client, $postData){
|
184 |
+
curl_setopt($client, CURLOPT_POSTFIELDS, $postData);
|
185 |
+
$response = curl_exec($client);
|
186 |
+
if ($response==false){
|
187 |
+
throw new Exception("Http communication exception. Exactor Server didn't respond in time.");
|
188 |
+
}else if (curl_getinfo($client, CURLINFO_HTTP_CODE)!=200){
|
189 |
+
$statusCode = curl_getinfo($client, CURLINFO_HTTP_CODE);
|
190 |
+
$this->logger->error("Http communication exception. Server respond with status $statusCode. Response $response");
|
191 |
+
throw new Exception("Http communication exception. Server respond with status $statusCode");
|
192 |
+
}
|
193 |
+
return $response;
|
194 |
+
}
|
195 |
+
|
196 |
+
private function destroyHttpClient($client){
|
197 |
+
curl_close($client);
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* @param TaxRequestType $taxRequest
|
202 |
+
* @return TaxResponseType
|
203 |
+
*/
|
204 |
+
public function sendRequest(TaxRequestType $taxRequest){
|
205 |
+
// Serialize object to XML
|
206 |
+
$xml = $taxRequest->toSimpleXmlObject()->asXML();
|
207 |
+
$httpClient = $this->prepareHttpClient();
|
208 |
+
$this->logger->info('Sending HTTP request to Exactor','sendRequest');
|
209 |
+
$this->logger->debug('Request Content: ' . $xml,'sendRequest');
|
210 |
+
$result = $this->doHttpRequest($httpClient, $xml);
|
211 |
+
$this->logger->info('Sent successfully','sendRequest');
|
212 |
+
$this->logger->debug('Response Content: ' . $result,'sendRequest');
|
213 |
+
$this->destroyHttpClient($httpClient); // TODO: move in finally block
|
214 |
+
$taxResponse = new TaxResponseType();
|
215 |
+
$taxResponse->populateWithSimpleXmlObject(simplexml_load_string($result));
|
216 |
+
return $taxResponse;
|
217 |
+
}
|
218 |
+
|
219 |
+
public function setEndpointUrl($endpointUrl)
|
220 |
+
{
|
221 |
+
$this->endpointUrl = $endpointUrl;
|
222 |
+
}
|
223 |
+
|
224 |
+
public function getEndpointUrl()
|
225 |
+
{
|
226 |
+
return $this->endpointUrl;
|
227 |
+
}
|
228 |
+
|
229 |
+
public function setPluginIdentity($pluginIdentity)
|
230 |
+
{
|
231 |
+
$this->pluginIdentity = $pluginIdentity;
|
232 |
+
}
|
233 |
+
|
234 |
+
public function getPluginIdentity()
|
235 |
+
{
|
236 |
+
return $this->pluginIdentity;
|
237 |
+
}
|
238 |
+
|
239 |
+
}
|
240 |
+
|
241 |
+
class ExactorConnectionFactory{
|
242 |
+
const EXACTOR_PRODUCTION_ENDPOINT = 'http://taxrequest.exactor.com/request/xml';
|
243 |
+
private static $instance;
|
244 |
+
|
245 |
+
private $pluginVersion=null;
|
246 |
+
private $pluginName=null;
|
247 |
+
private $endpointUrl=self::EXACTOR_PRODUCTION_ENDPOINT;
|
248 |
+
|
249 |
+
private function __construct()
|
250 |
+
{
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* @static
|
255 |
+
* @return ExactorConnectionFactory
|
256 |
+
*/
|
257 |
+
public static function getInstance(){
|
258 |
+
if (!isset(self::$instance)) {
|
259 |
+
$className = __CLASS__;
|
260 |
+
self::$instance = new $className;
|
261 |
+
}
|
262 |
+
return self::$instance;
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Creates TaxRequestType and populates it with plugin and merchant info
|
267 |
+
* @param $merchantId
|
268 |
+
* @param $userId
|
269 |
+
* @param null $partnerId
|
270 |
+
* @return TaxRequestType
|
271 |
+
*/
|
272 |
+
public function buildRequest($merchantId, $userId, $partnerId=null){
|
273 |
+
$request = new TaxRequestType();
|
274 |
+
$request->setMerchantId($merchantId);
|
275 |
+
$request->setUserId($userId);
|
276 |
+
$request->setPartnerId($partnerId);
|
277 |
+
$request->setPluginName($this->pluginName);
|
278 |
+
$request->setPluginVersion($this->pluginVersion);
|
279 |
+
return $request;
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Creates Exactor connector pre-populated with endpoint url
|
284 |
+
* @return ExactorConnector
|
285 |
+
*/
|
286 |
+
public function buildExactorConnector(){
|
287 |
+
$connector = new ExactorConnector();
|
288 |
+
$connector->setEndpointUrl($this->endpointUrl);
|
289 |
+
$connector->setPluginIdentity($this->getPluginName() .'-'.$this->getPluginVersion());
|
290 |
+
return $connector;
|
291 |
+
}
|
292 |
+
|
293 |
+
/**Shortcut for setting factory properties
|
294 |
+
* @param $pluginName
|
295 |
+
* @param $pluginVersion
|
296 |
+
* @param string $endPointUrl
|
297 |
+
* @return void
|
298 |
+
*/
|
299 |
+
public function setup($pluginName, $pluginVersion, $endPointUrl=self::EXACTOR_PRODUCTION_ENDPOINT){
|
300 |
+
$this->endpointUrl = $endPointUrl;
|
301 |
+
$this->pluginName = $pluginName;
|
302 |
+
$this->pluginVersion = $pluginVersion;
|
303 |
+
}
|
304 |
+
|
305 |
+
public function getEndpointUrl()
|
306 |
+
{
|
307 |
+
return $this->endpointUrl;
|
308 |
+
}
|
309 |
+
|
310 |
+
public function getPluginName()
|
311 |
+
{
|
312 |
+
return $this->pluginName;
|
313 |
+
}
|
314 |
+
|
315 |
+
public function getPluginVersion()
|
316 |
+
{
|
317 |
+
return $this->pluginVersion;
|
318 |
+
}
|
319 |
+
}
|
320 |
+
|
321 |
+
abstract class IExactorPluginCallback{
|
322 |
+
|
323 |
+
/**
|
324 |
+
* Search transaction info by internal transaction id in local database.
|
325 |
+
* Should return <b>null</b> if transaction doesn't exists
|
326 |
+
* @abstract
|
327 |
+
* @param $shoppingCartTrnId
|
328 |
+
* @return ExactorTransactionInfo
|
329 |
+
*/
|
330 |
+
abstract function loadTransactionInfo($shoppingCartTrnId);
|
331 |
+
|
332 |
+
/**
|
333 |
+
* Save given transaction info object in the current DB.
|
334 |
+
* If DB already contains record with given shoppingCartTrnId it should be REPLACED on the new one.
|
335 |
+
* @abstract
|
336 |
+
* @param ExactorTransactionInfo $transactionInfo
|
337 |
+
* @param $requestKey
|
338 |
+
* @return void
|
339 |
+
*/
|
340 |
+
abstract function saveTransactionInfo(ExactorTransactionInfo $transactionInfo, $requestKey);
|
341 |
+
|
342 |
+
/**
|
343 |
+
* This method will be called for each successful tax calculation request.
|
344 |
+
* Plugin should store the latest tax information.
|
345 |
+
* @abstract
|
346 |
+
* @param $requestKey
|
347 |
+
* @param InvoiceResponseType $invoiceResponse
|
348 |
+
* @param InvoiceRequestType $invoiceRequest
|
349 |
+
* @param ExactorTransactionInfo $transactionInfo
|
350 |
+
* @return void
|
351 |
+
*/
|
352 |
+
abstract function onTaxCalculationSuccess($requestKey, $invoiceResponse, $invoiceRequest, $transactionInfo);
|
353 |
+
|
354 |
+
/**
|
355 |
+
* This method will be called once Tax Calculation fails.
|
356 |
+
* Plugin should use it to perform some exception handling if needed. Otherwise just leave it empty.
|
357 |
+
* @abstract
|
358 |
+
* @param $requestKey
|
359 |
+
* @param ErrorResponseType $errorResponse
|
360 |
+
* @param InvoiceRequestType $invoiceRequest
|
361 |
+
* @return void
|
362 |
+
*/
|
363 |
+
abstract function onTaxCalculationFail($requestKey, $errorResponse, $invoiceRequest);
|
364 |
+
|
365 |
+
/**
|
366 |
+
* @abstract
|
367 |
+
* @param $requestKey
|
368 |
+
* @param CommitResponseType $commitResponse
|
369 |
+
* @param CommitRequestType $commitRequest
|
370 |
+
* @param ExactorTransactionInfo $transactionInfo
|
371 |
+
* @return void
|
372 |
+
*/
|
373 |
+
abstract function onCommitSuccess($requestKey, $commitResponse, $commitRequest, $transactionInfo);
|
374 |
+
|
375 |
+
/**
|
376 |
+
* @abstract
|
377 |
+
* @param $requestKey
|
378 |
+
* @param ErrorResponseType $errorResponse
|
379 |
+
* @param CommitRequestType $commitRequest
|
380 |
+
* @return void
|
381 |
+
*/
|
382 |
+
abstract function onCommitFail($requestKey, $errorResponse, $commitRequest);
|
383 |
+
}
|
384 |
+
|
385 |
+
/**
|
386 |
+
* Class should be used to generate Digital signature
|
387 |
+
* Usage:
|
388 |
+
* <pre>
|
389 |
+
* signatureBuilder = new ExactorDigitalSignatureBuilder();
|
390 |
+
* signatureBuilder->setTargetObject($taxRequest);
|
391 |
+
* signatureBuilder->buildSignatureSource(); // To get source string sequence that
|
392 |
+
* // can be used for generation of the digital signature
|
393 |
+
* signatureBuilder->buildDigitalSignature(); // To get digest
|
394 |
+
* </pre>
|
395 |
+
*/
|
396 |
+
class ExactorDigitalSignatureBuilder{
|
397 |
+
|
398 |
+
/**
|
399 |
+
* @var TaxRequestType
|
400 |
+
*/
|
401 |
+
private $targetObject;
|
402 |
+
private $signatureFieldList=array();
|
403 |
+
|
404 |
+
private function appendValue($value){
|
405 |
+
if ($value==null) $value='';
|
406 |
+
$str = str_replace("\n", ' ', $value);
|
407 |
+
$this->signatureFieldList[] = $str;
|
408 |
+
}
|
409 |
+
|
410 |
+
/**
|
411 |
+
* @param AddressType $address
|
412 |
+
* @return void
|
413 |
+
*/
|
414 |
+
private function appendAddressFields($address){
|
415 |
+
if ($address == null) return;
|
416 |
+
$this->appendValue($address->getFullName());
|
417 |
+
$this->appendValue($address->getStreet1());
|
418 |
+
$this->appendValue($address->getStreet2());
|
419 |
+
$this->appendValue($address->getCity());
|
420 |
+
$this->appendValue($address->getCounty());
|
421 |
+
$this->appendValue($address->getStateOrProvince());
|
422 |
+
$this->appendValue($address->getPostalCode());
|
423 |
+
$this->appendValue($address->getCountry());
|
424 |
+
}
|
425 |
+
|
426 |
+
private function appendInvoiceFields($invoice){
|
427 |
+
if ($invoice == null) return;
|
428 |
+
$this->appendValue($invoice->getSaleDate());
|
429 |
+
$this->appendAddressFields($invoice->getShipTo());
|
430 |
+
$this->appendAddressFields($invoice->getShipFrom());
|
431 |
+
foreach ($invoice->getLineItems() as $lineItem){
|
432 |
+
$this->appendValue($lineItem->getGrossAmount());
|
433 |
+
}
|
434 |
+
}
|
435 |
+
|
436 |
+
public function buildSignatureSource(){
|
437 |
+
$this->signatureFieldList = array();
|
438 |
+
// Building field list
|
439 |
+
$this->appendValue($this->targetObject->getMerchantId());
|
440 |
+
$this->appendValue($this->targetObject->getUserId());
|
441 |
+
foreach ($this->targetObject->getInvoiceRequests() as $invoice){
|
442 |
+
$this->appendInvoiceFields($invoice);
|
443 |
+
}
|
444 |
+
foreach ($this->targetObject->getCommitRequests() as $commit){
|
445 |
+
$this->appendValue($commit->getCommitDate());
|
446 |
+
$this->appendValue($commit->getPriorTransactionId());
|
447 |
+
$this->appendValue($commit->getInvoiceRequest);
|
448 |
+
}
|
449 |
+
foreach ($this->targetObject->getRefundRequests() as $refund){
|
450 |
+
$this->appendValue($refund->getRefundDate());
|
451 |
+
$this->appendValue($commit->getPriorTransactionId());
|
452 |
+
}
|
453 |
+
foreach ($this->targetObject->getDeleteRequests() as $delete){
|
454 |
+
$this->appendValue($delete->getPriorTransactionId());
|
455 |
+
}
|
456 |
+
$result = join("\n", $this->signatureFieldList);
|
457 |
+
return $result;
|
458 |
+
}
|
459 |
+
|
460 |
+
public function buildDigitalSignature(){
|
461 |
+
$res = $this->buildSignatureSource();
|
462 |
+
return hash('sha256', $res);
|
463 |
+
}
|
464 |
+
|
465 |
+
/**
|
466 |
+
* @param \TaxRequestType $targetObject
|
467 |
+
*/
|
468 |
+
public function setTargetObject($targetObject)
|
469 |
+
{
|
470 |
+
$this->targetObject = $targetObject;
|
471 |
+
}
|
472 |
+
|
473 |
+
/**
|
474 |
+
* @return \TaxRequestType
|
475 |
+
*/
|
476 |
+
public function getTargetObject()
|
477 |
+
{
|
478 |
+
return $this->targetObject;
|
479 |
+
}
|
480 |
+
}
|
481 |
+
|
482 |
+
class ExactorProcessingService{
|
483 |
+
const MSG_EXACTOR_ACCOUNT_VERIFICATION = 'Exactor Account Verification. Plugin Version ';
|
484 |
+
const MSG_TEST_TRANSACTION_CAPTION = 'Test Transaction';
|
485 |
+
/**
|
486 |
+
* @var IExactorPluginCallback
|
487 |
+
*/
|
488 |
+
private $pluginCallback;
|
489 |
+
private $merchantId;
|
490 |
+
private $userId;
|
491 |
+
private $partnerId;
|
492 |
+
private $logger;
|
493 |
+
|
494 |
+
public function __construct()
|
495 |
+
{
|
496 |
+
$this->logger = ExactorLoggingFactory::getInstance()->getLogger($this);
|
497 |
+
}
|
498 |
+
|
499 |
+
|
500 |
+
/**
|
501 |
+
* Fires following events:
|
502 |
+
* -> onTaxCalculationFail
|
503 |
+
* -> saveTransactionInfo - if calculation was successful and there is order number
|
504 |
+
* -> onTaxCalculationSuccess - if calculation was successful
|
505 |
+
* @param $invoiceRequest
|
506 |
+
* @return TaxResponseType
|
507 |
+
*/
|
508 |
+
public function calculateTax($invoiceRequest){
|
509 |
+
$this->logger->trace('Composing and sending request with one Invoice','calculateTax');
|
510 |
+
$request = ExactorConnectionFactory::getInstance()->buildRequest($this->merchantId, $this->userId, $this->partnerId);
|
511 |
+
$request->addInvoiceRequest($invoiceRequest);
|
512 |
+
// Create signature
|
513 |
+
$signatureBuilder = new ExactorDigitalSignatureBuilder();
|
514 |
+
$signatureBuilder->setTargetObject($request);
|
515 |
+
$signature = $signatureBuilder->buildDigitalSignature();
|
516 |
+
$response = ExactorConnectionFactory::getInstance()->buildExactorConnector()->sendRequest($request);
|
517 |
+
// Do callback to the plugin
|
518 |
+
if ($response->hasErrors()){
|
519 |
+
$this->logger->error('Exactor Tax Calculation request failed. See debug info for details');
|
520 |
+
$this->pluginCallback->onTaxCalculationFail($signature, $response->getFirstError(), $invoiceRequest);
|
521 |
+
}else{
|
522 |
+
$invoice = $response->getFirstInvoice();
|
523 |
+
$transactionInfo = $this->createExactorTransactionInfoForInvoiceResponse($response, $signature);
|
524 |
+
$this->pluginCallback->onTaxCalculationSuccess($signature, $invoice, $invoiceRequest, $transactionInfo);
|
525 |
+
if ($invoice->getPurchaseOrderNumber() != null)
|
526 |
+
$this->pluginCallback->saveTransactionInfo($transactionInfo, $signature);
|
527 |
+
}
|
528 |
+
return $response;
|
529 |
+
}
|
530 |
+
|
531 |
+
/**
|
532 |
+
* @param AddressType $address
|
533 |
+
* @param \ErrorResponseType $errorObject
|
534 |
+
* @internal param $validationMessage
|
535 |
+
* @return bool
|
536 |
+
*/
|
537 |
+
public function validateSettings(AddressType $address, ErrorResponseType &$errorObject){
|
538 |
+
$exactorConnector = ExactorConnectionFactory::getInstance();
|
539 |
+
$request = ExactorConnectionFactory::getInstance()->buildRequest($this->merchantId, $this->userId, $this->partnerId);
|
540 |
+
$invoiceRequest = new InvoiceRequestType();
|
541 |
+
$invoiceRequest->setBillTo($address);
|
542 |
+
$invoiceRequest->getBillTo()->setFullName($exactorConnector->getPluginName() . ' ' . self::MSG_TEST_TRANSACTION_CAPTION);
|
543 |
+
$invoiceRequest->setShipFrom($address);
|
544 |
+
$invoiceRequest->setShipTo($address);
|
545 |
+
$invoiceRequest->setSaleDate(new DateTime());
|
546 |
+
$lineItem = new LineItemType();
|
547 |
+
$lineItem->setDescription(self::MSG_EXACTOR_ACCOUNT_VERIFICATION . $exactorConnector->getPluginVersion());
|
548 |
+
$lineItem->setGrossAmount(0);
|
549 |
+
$lineItem->setId('_0');
|
550 |
+
$lineItem->setSKU('');
|
551 |
+
$invoiceRequest->addLineItem($lineItem);
|
552 |
+
$request->addInvoiceRequest($invoiceRequest);
|
553 |
+
$response = ExactorConnectionFactory::getInstance()->buildExactorConnector()->sendRequest($request);
|
554 |
+
if ($response->hasErrors()){
|
555 |
+
$errorObject = $response->getFirstError();
|
556 |
+
return false;
|
557 |
+
}else{
|
558 |
+
return true;
|
559 |
+
}
|
560 |
+
}
|
561 |
+
|
562 |
+
private function createExactorTransactionInfoForInvoiceResponse(TaxResponseType $taxResponse, $signature){
|
563 |
+
$invoiceResponse = $taxResponse->getFirstInvoice();
|
564 |
+
$exactorResponse = new ExactorTransactionInfo();
|
565 |
+
$exactorResponse->setCreatedDate($invoiceResponse->getTransactionDate());
|
566 |
+
$exactorResponse->setExactorMerchantId($taxResponse->getMerchantId());
|
567 |
+
$exactorResponse->setExactorUserId($taxResponse->getUserId());
|
568 |
+
$exactorResponse->setExactorTrnId($invoiceResponse->getTransactionId());
|
569 |
+
$exactorResponse->setShoppingCartTrnId($invoiceResponse->getPurchaseOrderNumber());
|
570 |
+
$exactorResponse->setIsCommited(false);
|
571 |
+
$exactorResponse->setSignature($signature);
|
572 |
+
$exactorResponse->setShoppingCartTrnId($taxResponse->getFirstInvoice()->getPurchaseOrderNumber());
|
573 |
+
return $exactorResponse;
|
574 |
+
}
|
575 |
+
|
576 |
+
private function buildDateTimeFromString($dateString){
|
577 |
+
return new DateTime($dateString);
|
578 |
+
}
|
579 |
+
|
580 |
+
/**
|
581 |
+
* @param InvoiceResponseType|CommitResponseType $response
|
582 |
+
* @param $orderNumber
|
583 |
+
* @return ExactorTransactionInfo
|
584 |
+
*/
|
585 |
+
private function buildTransactionInfo($response, $orderNumber=null){
|
586 |
+
$transactionInfo = new ExactorTransactionInfo();
|
587 |
+
$transactionInfo->setCreatedDate(new DateTime());
|
588 |
+
$transactionInfo->setExactorMerchantId($this->merchantId);
|
589 |
+
$transactionInfo->setExactorUserId($this->userId);
|
590 |
+
$transactionInfo->setExactorTrnId($response->getTransactionId());
|
591 |
+
if ($orderNumber==null && ($response instanceof CommitResponseType))
|
592 |
+
$transactionInfo->setShoppingCartTrnId($response->getInvoiceNumber());
|
593 |
+
else{
|
594 |
+
$transactionInfo->setShoppingCartTrnId($orderNumber);
|
595 |
+
}
|
596 |
+
if ($response instanceof CommitResponseType){
|
597 |
+
$transactionInfo->setLastModifiedDate($response->getCommitDate());
|
598 |
+
}else{
|
599 |
+
$transactionInfo->setLastModifiedDate(new DateTime());
|
600 |
+
}
|
601 |
+
$transactionInfo->setIsCommited($response instanceof CommitResponseType);
|
602 |
+
return $transactionInfo;
|
603 |
+
}
|
604 |
+
|
605 |
+
/**
|
606 |
+
* Fetch information about transaction from the internal database by given internal id and send commit request.
|
607 |
+
* Fires following events:
|
608 |
+
* -> onCommitFail
|
609 |
+
* -> saveTransactionInfo – after success commit to notify plugin that
|
610 |
+
* the existing transaction info should be updated in the internal database.
|
611 |
+
* -> onCommitSuccess – after the previous one in case when commit was successful.
|
612 |
+
* Throws Exception in case when there is no transaction with given internal ID or it is already commited.
|
613 |
+
* @throws Exception
|
614 |
+
* @param $orderNumber
|
615 |
+
* @return TaxResponseType
|
616 |
+
*/
|
617 |
+
public function commitExistingInvoiceForOrder($orderNumber){
|
618 |
+
$this->logger->trace('Composing and sending request with one Commit(by existing invoice)','commitExistingInvoiceForOrder');
|
619 |
+
$transactionInfo = $this->pluginCallback->loadTransactionInfo($orderNumber);
|
620 |
+
if ($transactionInfo==null){
|
621 |
+
$this->logger->error("Can't load transaction info for order #" . $orderNumber, 'commitExistingInvoiceForOrder' );
|
622 |
+
throw new Exception("Can't load transaction info for order #" . $orderNumber);
|
623 |
+
}
|
624 |
+
if ($transactionInfo->getIsCommited()){
|
625 |
+
$this->logger->error("Transaction for order #" . $orderNumber . " is already marked as COMMITED",'commitExistingInvoiceForOrder');
|
626 |
+
throw new Exception("Transaction for order #" . $orderNumber . " is already marked as COMMITED");
|
627 |
+
}
|
628 |
+
$request = ExactorConnectionFactory::getInstance()->buildRequest($this->merchantId, $this->userId, $this->partnerId);
|
629 |
+
$commitRequest = new CommitRequestType();
|
630 |
+
$commitRequest->setInvoiceNumber($orderNumber);
|
631 |
+
$commitRequest->setCommitDate($this->buildDateTimeFromString($transactionInfo->getLastModifiedDate()));
|
632 |
+
$commitRequest->setPriorTransactionId($transactionInfo->getExactorTrnId());
|
633 |
+
$request->addCommitRequest($commitRequest);
|
634 |
+
$signature = '';
|
635 |
+
$response = ExactorConnectionFactory::getInstance()->buildExactorConnector()->sendRequest($request);
|
636 |
+
// Do callback to the plugin
|
637 |
+
if ($response->hasErrors()){
|
638 |
+
if ($response->getFirstError()->getErrorCode() == ErrorResponseType::ERROR_INVALID){
|
639 |
+
$commitRequest->setCommitDate(new DateTime());
|
640 |
+
$response = ExactorConnectionFactory::getInstance()->buildExactorConnector()->sendRequest($request);
|
641 |
+
if ($response->hasErrors()){
|
642 |
+
$this->logger->error('Exactor Commit request failed. See debug info for details');
|
643 |
+
$this->pluginCallback->onCommitFail($signature, $response->getFirstError(), $commitRequest);
|
644 |
+
}
|
645 |
+
}else{
|
646 |
+
$this->logger->error('Exactor Commit request failed. See debug info for details');
|
647 |
+
$this->pluginCallback->onCommitFail($signature, $response->getFirstError(), $commitRequest);
|
648 |
+
}
|
649 |
+
}else{
|
650 |
+
$commitResponses = $response->getCommitResponses();
|
651 |
+
$trnInfo = $this->buildTransactionInfo($commitResponses[0],$orderNumber);
|
652 |
+
$this->pluginCallback->saveTransactionInfo($trnInfo, $commitRequest);
|
653 |
+
$this->pluginCallback->onCommitSuccess($signature, $commitResponses[0], $commitRequest, null); // TODO: pass transaction info
|
654 |
+
}
|
655 |
+
return $response;
|
656 |
+
}
|
657 |
+
|
658 |
+
/**
|
659 |
+
* Fetch information about transaction from the internal database by given internal id
|
660 |
+
* and send refund request.
|
661 |
+
* Throws Exception in case when there is no transaction with given internal ID or it is not commited.
|
662 |
+
* @throws Exception
|
663 |
+
* @param $orderNumber
|
664 |
+
* @return TaxResponseType
|
665 |
+
*/
|
666 |
+
public function refundTransactionForOrder($orderNumber){
|
667 |
+
$this->logger->trace('Composing and sending request with one Refund(for existing commit)','commitExistingInvoiceForOrder');
|
668 |
+
$transactionInfo = $this->pluginCallback->loadTransactionInfo($orderNumber);
|
669 |
+
if ($transactionInfo==null){
|
670 |
+
$this->logger->error("Can't load transaction info for order #" . $orderNumber, 'commitExistingInvoiceForOrder' );
|
671 |
+
throw new Exception("Can't load transaction info for order #" . $orderNumber);
|
672 |
+
}
|
673 |
+
if (!$transactionInfo->getIsCommited()){
|
674 |
+
$this->logger->error("Transaction for order #" . $orderNumber . " is not COMMITED",'commitExistingInvoiceForOrder');
|
675 |
+
throw new Exception("Transaction for order #" . $orderNumber . " is not COMMITED");
|
676 |
+
}
|
677 |
+
$request = ExactorConnectionFactory::getInstance()->buildRequest($this->merchantId, $this->userId, $this->partnerId);
|
678 |
+
$refundRequest = new RefundRequestType();
|
679 |
+
// Set Refund date to the commit date
|
680 |
+
$refundRequest->setRefundDate($this->buildDateTimeFromString($transactionInfo->getLastModifiedDate()));
|
681 |
+
$refundRequest->setPriorTransactionId($transactionInfo->getExactorTrnId());
|
682 |
+
$request->addRefundRequest($refundRequest);
|
683 |
+
$response = ExactorConnectionFactory::getInstance()->buildExactorConnector()->sendRequest($request);
|
684 |
+
// Do callback to the plugin
|
685 |
+
if ($response->hasErrors()){
|
686 |
+
if ($response->getFirstError()->getErrorCode() == ErrorResponseType::ERROR_INVALID_REFUND_DATE){
|
687 |
+
$refundRequest->setRefundDate(new DateTime());
|
688 |
+
$response = ExactorConnectionFactory::getInstance()->buildExactorConnector()->sendRequest($request);
|
689 |
+
if ($response->hasErrors()){
|
690 |
+
$this->logger->error('Exactor Tax Calculation request failed. See debug info for details');
|
691 |
+
}
|
692 |
+
}else{
|
693 |
+
$this->logger->error('Exactor Tax Calculation request failed. See debug info for details');
|
694 |
+
}
|
695 |
+
}else{
|
696 |
+
// Nothing to do here
|
697 |
+
}
|
698 |
+
return $response;
|
699 |
+
}
|
700 |
+
|
701 |
+
/**
|
702 |
+
* Returns transaction info by given internal order ID. Or null if it doesn't exists.
|
703 |
+
* @param $orderId
|
704 |
+
* @return ExactorTransactionInfo
|
705 |
+
*/
|
706 |
+
public function loadTransactionInfoByOrderId($orderId){
|
707 |
+
return $this->getPluginCallback()->loadTransactionInfo($orderId);
|
708 |
+
}
|
709 |
+
|
710 |
+
/**
|
711 |
+
* @param \IExactorPluginCallback $pluginCallback
|
712 |
+
*/
|
713 |
+
public function setPluginCallback($pluginCallback)
|
714 |
+
{
|
715 |
+
$this->pluginCallback = $pluginCallback;
|
716 |
+
}
|
717 |
+
|
718 |
+
/**
|
719 |
+
* @return \IExactorPluginCallback
|
720 |
+
*/
|
721 |
+
public function getPluginCallback()
|
722 |
+
{
|
723 |
+
return $this->pluginCallback;
|
724 |
+
}
|
725 |
+
|
726 |
+
public function setMerchantId($merchantId)
|
727 |
+
{
|
728 |
+
$this->merchantId = $merchantId;
|
729 |
+
}
|
730 |
+
|
731 |
+
public function getMerchantId()
|
732 |
+
{
|
733 |
+
return $this->merchantId;
|
734 |
+
}
|
735 |
+
|
736 |
+
public function setPartnerId($partnerId)
|
737 |
+
{
|
738 |
+
$this->partnerId = $partnerId;
|
739 |
+
}
|
740 |
+
|
741 |
+
public function getPartnerId()
|
742 |
+
{
|
743 |
+
return $this->partnerId;
|
744 |
+
}
|
745 |
+
|
746 |
+
public function setUserId($userId)
|
747 |
+
{
|
748 |
+
$this->userId = $userId;
|
749 |
+
}
|
750 |
+
|
751 |
+
public function getUserId()
|
752 |
+
{
|
753 |
+
return $this->userId;
|
754 |
+
}
|
755 |
+
}
|
756 |
+
|
757 |
+
class ExactorProcessingServiceFactory{
|
758 |
+
private static $instance;
|
759 |
+
|
760 |
+
/**
|
761 |
+
* @var IExactorPluginCallback
|
762 |
+
*/
|
763 |
+
private $pluginCallback;
|
764 |
+
|
765 |
+
function __construct()
|
766 |
+
{
|
767 |
+
|
768 |
+
}
|
769 |
+
|
770 |
+
/**
|
771 |
+
* @static
|
772 |
+
* @return ExactorProcessingServiceFactory
|
773 |
+
*/
|
774 |
+
public static function getInstance(){
|
775 |
+
if (!isset(self::$instance)) {
|
776 |
+
$className = __CLASS__;
|
777 |
+
self::$instance = new $className;
|
778 |
+
}
|
779 |
+
return self::$instance;
|
780 |
+
}
|
781 |
+
|
782 |
+
public function setup($pluginCallback){
|
783 |
+
$this->setPluginCallback($pluginCallback);
|
784 |
+
}
|
785 |
+
|
786 |
+
/**
|
787 |
+
* Creates Exactor Processing Service for Merchant
|
788 |
+
* @param $merchantId
|
789 |
+
* @param $userId
|
790 |
+
* @param null $partnerId
|
791 |
+
* @return ExactorProcessingService
|
792 |
+
*/
|
793 |
+
public function buildExactorProcessingService($merchantId, $userId, $partnerId=null){
|
794 |
+
$exactorProcessingService = new ExactorProcessingService();
|
795 |
+
$exactorProcessingService->setPluginCallback($this->getPluginCallback());
|
796 |
+
$exactorProcessingService->setMerchantId($merchantId);
|
797 |
+
$exactorProcessingService->setUserId($userId);
|
798 |
+
$exactorProcessingService->setPartnerId($partnerId);
|
799 |
+
return $exactorProcessingService;
|
800 |
+
}
|
801 |
+
|
802 |
+
/**
|
803 |
+
* @param \IExactorPluginCallback $pluginCallback
|
804 |
+
*/
|
805 |
+
public function setPluginCallback($pluginCallback)
|
806 |
+
{
|
807 |
+
$this->pluginCallback = $pluginCallback;
|
808 |
+
}
|
809 |
+
|
810 |
+
/**
|
811 |
+
* @return \IExactorPluginCallback
|
812 |
+
*/
|
813 |
+
public function getPluginCallback()
|
814 |
+
{
|
815 |
+
return $this->pluginCallback;
|
816 |
+
}
|
817 |
+
|
818 |
+
}
|
lib/ExactorCommons/ExactorDomainObjects.php
ADDED
@@ -0,0 +1,1491 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Contains definitions of the bushiness objects
|
4 |
+
* User: LOGICIFY\corvis
|
5 |
+
* Date: 4/18/12
|
6 |
+
* Time: 5:33 PM
|
7 |
+
*/
|
8 |
+
|
9 |
+
define('EXACTOR_DATE_FORMAT', 'Y-m-d');
|
10 |
+
|
11 |
+
function exactor_date_to_string($object){
|
12 |
+
if ($object instanceof DateTime){
|
13 |
+
return $object->format(EXACTOR_DATE_FORMAT);
|
14 |
+
}else
|
15 |
+
return $object;
|
16 |
+
}
|
17 |
+
|
18 |
+
/* ========================= SHOPPING CART OBJECTS =================== */
|
19 |
+
class ExactorTransactionInfo{
|
20 |
+
private $shoppingCartTrnId;
|
21 |
+
private $exactorMerchantId;
|
22 |
+
private $exactorUserId;
|
23 |
+
private $exactorTrnId;
|
24 |
+
private $isCommited=false;
|
25 |
+
private $createdDate;
|
26 |
+
private $lastModifiedDate;
|
27 |
+
private $signature;
|
28 |
+
|
29 |
+
public function setCreatedDate($createdDate)
|
30 |
+
{
|
31 |
+
$this->createdDate = $createdDate;
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getCreatedDate()
|
35 |
+
{
|
36 |
+
return $this->createdDate;
|
37 |
+
}
|
38 |
+
|
39 |
+
public function setExactorMerchantId($exactorMerchantId)
|
40 |
+
{
|
41 |
+
$this->exactorMerchantId = $exactorMerchantId;
|
42 |
+
}
|
43 |
+
|
44 |
+
public function getExactorMerchantId()
|
45 |
+
{
|
46 |
+
return $this->exactorMerchantId;
|
47 |
+
}
|
48 |
+
|
49 |
+
public function setExactorTrnId($exactorTrnId)
|
50 |
+
{
|
51 |
+
$this->exactorTrnId = $exactorTrnId;
|
52 |
+
}
|
53 |
+
|
54 |
+
public function getExactorTrnId()
|
55 |
+
{
|
56 |
+
return $this->exactorTrnId;
|
57 |
+
}
|
58 |
+
|
59 |
+
public function setExactorUserId($exactorUserId)
|
60 |
+
{
|
61 |
+
$this->exactorUserId = $exactorUserId;
|
62 |
+
}
|
63 |
+
|
64 |
+
public function getExactorUserId()
|
65 |
+
{
|
66 |
+
return $this->exactorUserId;
|
67 |
+
}
|
68 |
+
|
69 |
+
public function setIsCommited($isCommited)
|
70 |
+
{
|
71 |
+
$this->isCommited = $isCommited;
|
72 |
+
}
|
73 |
+
|
74 |
+
public function getIsCommited()
|
75 |
+
{
|
76 |
+
return $this->isCommited;
|
77 |
+
}
|
78 |
+
|
79 |
+
public function setLastModifiedDate($lastModifiedDate)
|
80 |
+
{
|
81 |
+
$this->lastModifiedDate = $lastModifiedDate;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function getLastModifiedDate()
|
85 |
+
{
|
86 |
+
return $this->lastModifiedDate;
|
87 |
+
}
|
88 |
+
|
89 |
+
public function setShoppingCartTrnId($shoppingCartTrnId)
|
90 |
+
{
|
91 |
+
$this->shoppingCartTrnId = $shoppingCartTrnId;
|
92 |
+
}
|
93 |
+
|
94 |
+
public function getShoppingCartTrnId()
|
95 |
+
{
|
96 |
+
return $this->shoppingCartTrnId;
|
97 |
+
}
|
98 |
+
|
99 |
+
public function setSignature($signature)
|
100 |
+
{
|
101 |
+
$this->signature = $signature;
|
102 |
+
}
|
103 |
+
|
104 |
+
public function getSignature()
|
105 |
+
{
|
106 |
+
return $this->signature;
|
107 |
+
}
|
108 |
+
|
109 |
+
}
|
110 |
+
|
111 |
+
/* ========================= COMMON OBJECTS ========================== */
|
112 |
+
class AddressType extends XmlSerializationSupport {
|
113 |
+
public $FullName = '';
|
114 |
+
public $Street1 = '';
|
115 |
+
public $Street2;
|
116 |
+
public $City = '';
|
117 |
+
public $County;
|
118 |
+
public $StateOrProvince = '';
|
119 |
+
public $PostalCode ='';
|
120 |
+
public $Country ='USA';
|
121 |
+
|
122 |
+
|
123 |
+
public function setCity($City)
|
124 |
+
{
|
125 |
+
$this->City = $City;
|
126 |
+
}
|
127 |
+
|
128 |
+
public function getCity()
|
129 |
+
{
|
130 |
+
return $this->City;
|
131 |
+
}
|
132 |
+
|
133 |
+
public function setCountry($Country)
|
134 |
+
{
|
135 |
+
$this->Country = $Country;
|
136 |
+
}
|
137 |
+
|
138 |
+
public function getCountry()
|
139 |
+
{
|
140 |
+
return $this->Country;
|
141 |
+
}
|
142 |
+
|
143 |
+
public function setCounty($County)
|
144 |
+
{
|
145 |
+
$this->County = $County;
|
146 |
+
}
|
147 |
+
|
148 |
+
public function getCounty()
|
149 |
+
{
|
150 |
+
return $this->County;
|
151 |
+
}
|
152 |
+
|
153 |
+
public function setFullName($FullName)
|
154 |
+
{
|
155 |
+
$this->FullName = $FullName;
|
156 |
+
}
|
157 |
+
|
158 |
+
public function getFullName()
|
159 |
+
{
|
160 |
+
return $this->FullName;
|
161 |
+
}
|
162 |
+
|
163 |
+
public function setPostalCode($PostalCode)
|
164 |
+
{
|
165 |
+
$this->PostalCode = $PostalCode;
|
166 |
+
}
|
167 |
+
|
168 |
+
public function getPostalCode()
|
169 |
+
{
|
170 |
+
return $this->PostalCode;
|
171 |
+
}
|
172 |
+
|
173 |
+
public function setStateOrProvince($StateOrProvince)
|
174 |
+
{
|
175 |
+
$this->StateOrProvince = $StateOrProvince;
|
176 |
+
}
|
177 |
+
|
178 |
+
public function getStateOrProvince()
|
179 |
+
{
|
180 |
+
return $this->StateOrProvince;
|
181 |
+
}
|
182 |
+
|
183 |
+
public function setStreet1($Street1)
|
184 |
+
{
|
185 |
+
$this->Street1 = $Street1;
|
186 |
+
}
|
187 |
+
|
188 |
+
public function getStreet1()
|
189 |
+
{
|
190 |
+
return $this->Street1;
|
191 |
+
}
|
192 |
+
|
193 |
+
public function setStreet2($Street2)
|
194 |
+
{
|
195 |
+
$this->Street2 = $Street2;
|
196 |
+
}
|
197 |
+
|
198 |
+
public function getStreet2()
|
199 |
+
{
|
200 |
+
return $this->Street2;
|
201 |
+
}
|
202 |
+
|
203 |
+
/** Returns true in case if address contains all required fields
|
204 |
+
* @return bool
|
205 |
+
*/
|
206 |
+
public function hasData(){
|
207 |
+
return //strlen(trim($this->getStreet1()))
|
208 |
+
// && strlen(trim($this->getCity()))
|
209 |
+
strlen(trim($this->getPostalCode()))
|
210 |
+
&& strlen(trim($this->getStateOrProvince()));
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
|
215 |
+
class LineItemType extends XmlSerializationSupport {
|
216 |
+
public $SKU;
|
217 |
+
public $Description;
|
218 |
+
public $Quantity=1;
|
219 |
+
public $GrossAmount;
|
220 |
+
public $BillTo;
|
221 |
+
public $ShipTo;
|
222 |
+
public $ShipFrom;
|
223 |
+
/**
|
224 |
+
* @var string
|
225 |
+
* @xmlName id
|
226 |
+
* @xmlAttribute
|
227 |
+
*/
|
228 |
+
public $id;
|
229 |
+
|
230 |
+
public function setBillTo(AddressType $BillTo)
|
231 |
+
{
|
232 |
+
$this->BillTo = $BillTo;
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* @return AddressType
|
237 |
+
*/
|
238 |
+
public function getBillTo()
|
239 |
+
{
|
240 |
+
return $this->BillTo;
|
241 |
+
}
|
242 |
+
|
243 |
+
public function setDescription($Description)
|
244 |
+
{
|
245 |
+
$this->Description = $Description;
|
246 |
+
}
|
247 |
+
|
248 |
+
public function getDescription()
|
249 |
+
{
|
250 |
+
return $this->Description;
|
251 |
+
}
|
252 |
+
|
253 |
+
public function setGrossAmount($GrossAmount)
|
254 |
+
{
|
255 |
+
$this->GrossAmount = $GrossAmount;
|
256 |
+
}
|
257 |
+
|
258 |
+
public function getGrossAmount()
|
259 |
+
{
|
260 |
+
return $this->GrossAmount;
|
261 |
+
}
|
262 |
+
|
263 |
+
public function setQuantity($Quantity)
|
264 |
+
{
|
265 |
+
$this->Quantity = $Quantity;
|
266 |
+
}
|
267 |
+
|
268 |
+
public function getQuantity()
|
269 |
+
{
|
270 |
+
return $this->Quantity;
|
271 |
+
}
|
272 |
+
|
273 |
+
public function setSKU($SKU)
|
274 |
+
{
|
275 |
+
$this->SKU = $SKU;
|
276 |
+
}
|
277 |
+
|
278 |
+
public function getSKU()
|
279 |
+
{
|
280 |
+
return $this->SKU;
|
281 |
+
}
|
282 |
+
|
283 |
+
public function setShipFrom(AddressType $ShipFrom)
|
284 |
+
{
|
285 |
+
$this->ShipFrom = $ShipFrom;
|
286 |
+
}
|
287 |
+
|
288 |
+
/**
|
289 |
+
* @return AddressType
|
290 |
+
*/
|
291 |
+
public function getShipFrom()
|
292 |
+
{
|
293 |
+
return $this->ShipFrom;
|
294 |
+
}
|
295 |
+
|
296 |
+
public function setShipTo(AddressType $ShipTo)
|
297 |
+
{
|
298 |
+
$this->ShipTo = $ShipTo;
|
299 |
+
}
|
300 |
+
|
301 |
+
/**
|
302 |
+
* @return AddressType
|
303 |
+
*/
|
304 |
+
public function getShipTo()
|
305 |
+
{
|
306 |
+
return $this->ShipTo;
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* @param string $id
|
311 |
+
*/
|
312 |
+
public function setId($id)
|
313 |
+
{
|
314 |
+
$this->id = $id;
|
315 |
+
}
|
316 |
+
|
317 |
+
/**
|
318 |
+
* @return string
|
319 |
+
*/
|
320 |
+
public function getId()
|
321 |
+
{
|
322 |
+
return $this->id;
|
323 |
+
}
|
324 |
+
|
325 |
+
}
|
326 |
+
|
327 |
+
|
328 |
+
/* ========================= REQUESTS ================================*/
|
329 |
+
|
330 |
+
class InvoiceRequestType extends XmlSerializationSupport {
|
331 |
+
public $SaleDate;
|
332 |
+
public $PurchaseOrderNumber;
|
333 |
+
public $CurrencyCode;
|
334 |
+
public $TaxDirection;
|
335 |
+
public $TaxClass;
|
336 |
+
public $ExemptionId;
|
337 |
+
/**
|
338 |
+
* @var AddressType
|
339 |
+
*/
|
340 |
+
public $BillTo;
|
341 |
+
/**
|
342 |
+
* @var AddressType
|
343 |
+
*/
|
344 |
+
public $ShipTo;
|
345 |
+
/**
|
346 |
+
* @var AddressType
|
347 |
+
*/
|
348 |
+
public $ShipFrom;
|
349 |
+
/**
|
350 |
+
* @var array LineItemType
|
351 |
+
* @xmlName LineItem
|
352 |
+
*/
|
353 |
+
public $LineItems;
|
354 |
+
|
355 |
+
|
356 |
+
/**
|
357 |
+
* @param \AddressType $BillTo
|
358 |
+
*/
|
359 |
+
public function setBillTo($BillTo)
|
360 |
+
{
|
361 |
+
$this->BillTo = $BillTo;
|
362 |
+
}
|
363 |
+
|
364 |
+
/**
|
365 |
+
* @return \AddressType
|
366 |
+
*/
|
367 |
+
public function getBillTo()
|
368 |
+
{
|
369 |
+
return $this->BillTo;
|
370 |
+
}
|
371 |
+
|
372 |
+
public function setCurrencyCode($CurrencyCode)
|
373 |
+
{
|
374 |
+
$this->CurrencyCode = $CurrencyCode;
|
375 |
+
}
|
376 |
+
|
377 |
+
public function getCurrencyCode()
|
378 |
+
{
|
379 |
+
return $this->CurrencyCode;
|
380 |
+
}
|
381 |
+
|
382 |
+
public function setExemptionId($ExemptionId)
|
383 |
+
{
|
384 |
+
$this->ExemptionId = $ExemptionId;
|
385 |
+
}
|
386 |
+
|
387 |
+
public function getExemptionId()
|
388 |
+
{
|
389 |
+
return $this->ExemptionId;
|
390 |
+
}
|
391 |
+
|
392 |
+
/**
|
393 |
+
* @param $LineItems
|
394 |
+
*/
|
395 |
+
public function setLineItems($LineItems)
|
396 |
+
{
|
397 |
+
$this->LineItems = $LineItems;
|
398 |
+
}
|
399 |
+
|
400 |
+
/**
|
401 |
+
* @return
|
402 |
+
*/
|
403 |
+
public function getLineItems()
|
404 |
+
{
|
405 |
+
return $this->LineItems;
|
406 |
+
}
|
407 |
+
|
408 |
+
public function setPurchaseOrderNumber($PurchaseOrderNumber)
|
409 |
+
{
|
410 |
+
$this->PurchaseOrderNumber = $PurchaseOrderNumber;
|
411 |
+
}
|
412 |
+
|
413 |
+
public function getPurchaseOrderNumber()
|
414 |
+
{
|
415 |
+
return $this->PurchaseOrderNumber;
|
416 |
+
}
|
417 |
+
|
418 |
+
/**
|
419 |
+
* @param DateTime $SaleDate
|
420 |
+
* @return void
|
421 |
+
*/
|
422 |
+
public function setSaleDate($SaleDate)
|
423 |
+
{
|
424 |
+
$this->SaleDate = exactor_date_to_string($SaleDate);
|
425 |
+
}
|
426 |
+
|
427 |
+
public function getSaleDate()
|
428 |
+
{
|
429 |
+
return $this->SaleDate;
|
430 |
+
}
|
431 |
+
|
432 |
+
/**
|
433 |
+
* @param \AddressType $ShipFrom
|
434 |
+
*/
|
435 |
+
public function setShipFrom($ShipFrom)
|
436 |
+
{
|
437 |
+
$this->ShipFrom = $ShipFrom;
|
438 |
+
}
|
439 |
+
|
440 |
+
/**
|
441 |
+
* @return \AddressType
|
442 |
+
*/
|
443 |
+
public function getShipFrom()
|
444 |
+
{
|
445 |
+
return $this->ShipFrom;
|
446 |
+
}
|
447 |
+
|
448 |
+
/**
|
449 |
+
* @param \AddressType $ShipTo
|
450 |
+
*/
|
451 |
+
public function setShipTo($ShipTo)
|
452 |
+
{
|
453 |
+
$this->ShipTo = $ShipTo;
|
454 |
+
}
|
455 |
+
|
456 |
+
/**
|
457 |
+
* @return \AddressType
|
458 |
+
*/
|
459 |
+
public function getShipTo()
|
460 |
+
{
|
461 |
+
return $this->ShipTo;
|
462 |
+
}
|
463 |
+
|
464 |
+
public function setTaxClass($TaxClass)
|
465 |
+
{
|
466 |
+
$this->TaxClass = $TaxClass;
|
467 |
+
}
|
468 |
+
|
469 |
+
public function getTaxClass()
|
470 |
+
{
|
471 |
+
return $this->TaxClass;
|
472 |
+
}
|
473 |
+
|
474 |
+
public function setTaxDirection($TaxDirection)
|
475 |
+
{
|
476 |
+
$this->TaxDirection = $TaxDirection;
|
477 |
+
}
|
478 |
+
|
479 |
+
public function getTaxDirection()
|
480 |
+
{
|
481 |
+
return $this->TaxDirection;
|
482 |
+
}
|
483 |
+
|
484 |
+
/**
|
485 |
+
* @param LineItemType|null $lineItem
|
486 |
+
* @return
|
487 |
+
*/
|
488 |
+
public function addLineItem($lineItem){
|
489 |
+
if ($lineItem==null) return;
|
490 |
+
if (!is_array($this->getLineItems())) $this->setLineItems(array());
|
491 |
+
$this->LineItems[] = $lineItem;
|
492 |
+
}
|
493 |
+
}
|
494 |
+
|
495 |
+
class CommitRequestType extends XmlSerializationSupport {
|
496 |
+
public $CommitDate;
|
497 |
+
public $InvoiceNumber;
|
498 |
+
/**
|
499 |
+
* @var InvoiceRequestType
|
500 |
+
*/
|
501 |
+
public $InvoiceRequest;
|
502 |
+
public $PriorTransactionId;
|
503 |
+
|
504 |
+
|
505 |
+
/**
|
506 |
+
* @param DateTime $CommitDate
|
507 |
+
* @return void
|
508 |
+
*/
|
509 |
+
public function setCommitDate($CommitDate)
|
510 |
+
{
|
511 |
+
$this->CommitDate = exactor_date_to_string($CommitDate);
|
512 |
+
}
|
513 |
+
|
514 |
+
public function getCommitDate()
|
515 |
+
{
|
516 |
+
return $this->CommitDate;
|
517 |
+
}
|
518 |
+
|
519 |
+
public function setInvoiceNumber($InvoiceNumber)
|
520 |
+
{
|
521 |
+
$this->InvoiceNumber = $InvoiceNumber;
|
522 |
+
}
|
523 |
+
|
524 |
+
public function getInvoiceNumber()
|
525 |
+
{
|
526 |
+
return $this->InvoiceNumber;
|
527 |
+
}
|
528 |
+
|
529 |
+
/**
|
530 |
+
* @param \InvoiceRequestType $InvoiceRequest
|
531 |
+
*/
|
532 |
+
public function setInvoiceRequest($InvoiceRequest)
|
533 |
+
{
|
534 |
+
$this->InvoiceRequest = $InvoiceRequest;
|
535 |
+
}
|
536 |
+
|
537 |
+
/**
|
538 |
+
* @return \InvoiceRequestType
|
539 |
+
*/
|
540 |
+
public function getInvoiceRequest()
|
541 |
+
{
|
542 |
+
return $this->InvoiceRequest;
|
543 |
+
}
|
544 |
+
|
545 |
+
public function setPriorTransactionId($PriorTransactionId)
|
546 |
+
{
|
547 |
+
$this->PriorTransactionId = $PriorTransactionId;
|
548 |
+
}
|
549 |
+
|
550 |
+
public function getPriorTransactionId()
|
551 |
+
{
|
552 |
+
return $this->PriorTransactionId;
|
553 |
+
}
|
554 |
+
}
|
555 |
+
|
556 |
+
class RefundRequestType extends XmlSerializationSupport {
|
557 |
+
public $RefundDate;
|
558 |
+
public $PriorTransactionId;
|
559 |
+
|
560 |
+
public function setPriorTransactionId($PriorTransactionId)
|
561 |
+
{
|
562 |
+
$this->PriorTransactionId = $PriorTransactionId;
|
563 |
+
}
|
564 |
+
|
565 |
+
public function getPriorTransactionId()
|
566 |
+
{
|
567 |
+
return $this->PriorTransactionId;
|
568 |
+
}
|
569 |
+
|
570 |
+
public function setRefundDate($RefundDate)
|
571 |
+
{
|
572 |
+
$this->RefundDate = exactor_date_to_string($RefundDate);
|
573 |
+
}
|
574 |
+
|
575 |
+
public function getRefundDate()
|
576 |
+
{
|
577 |
+
return $this->RefundDate;
|
578 |
+
}
|
579 |
+
}
|
580 |
+
|
581 |
+
class DeleteRequestType extends XmlSerializationSupport {
|
582 |
+
public $PriorTransactionId;
|
583 |
+
|
584 |
+
public function setPriorTransactionId($PriorTransactionId)
|
585 |
+
{
|
586 |
+
$this->PriorTransactionId = $PriorTransactionId;
|
587 |
+
}
|
588 |
+
|
589 |
+
public function getPriorTransactionId()
|
590 |
+
{
|
591 |
+
return $this->PriorTransactionId;
|
592 |
+
}
|
593 |
+
}
|
594 |
+
|
595 |
+
/* ========================= Response Types ========================== */
|
596 |
+
|
597 |
+
class ResponseLineItem extends XmlSerializationSupport{
|
598 |
+
public $GrossAmount;
|
599 |
+
public $TaxDirection;
|
600 |
+
public $TotalTaxAmount;
|
601 |
+
public $TaxInfo;
|
602 |
+
/**
|
603 |
+
* @var
|
604 |
+
* @xmlName id
|
605 |
+
* @xmlAttribute
|
606 |
+
*/
|
607 |
+
public $id;
|
608 |
+
|
609 |
+
|
610 |
+
public function setGrossAmount($GrossAmount)
|
611 |
+
{
|
612 |
+
$this->GrossAmount = $GrossAmount;
|
613 |
+
}
|
614 |
+
|
615 |
+
public function getGrossAmount()
|
616 |
+
{
|
617 |
+
return $this->GrossAmount;
|
618 |
+
}
|
619 |
+
|
620 |
+
public function setTaxDirection($TaxDirection)
|
621 |
+
{
|
622 |
+
$this->TaxDirection = $TaxDirection;
|
623 |
+
}
|
624 |
+
|
625 |
+
public function getTaxDirection()
|
626 |
+
{
|
627 |
+
return $this->TaxDirection;
|
628 |
+
}
|
629 |
+
|
630 |
+
public function setTaxInfo($TaxInfo)
|
631 |
+
{
|
632 |
+
$this->TaxInfo = $TaxInfo;
|
633 |
+
}
|
634 |
+
|
635 |
+
public function getTaxInfo()
|
636 |
+
{
|
637 |
+
return $this->TaxInfo;
|
638 |
+
}
|
639 |
+
|
640 |
+
public function setTotalTaxAmount($TotalTaxAmount)
|
641 |
+
{
|
642 |
+
$this->TotalTaxAmount = $TotalTaxAmount;
|
643 |
+
}
|
644 |
+
|
645 |
+
public function getTotalTaxAmount()
|
646 |
+
{
|
647 |
+
return $this->TotalTaxAmount;
|
648 |
+
}
|
649 |
+
|
650 |
+
/**
|
651 |
+
* @param $id
|
652 |
+
*/
|
653 |
+
public function setId($id)
|
654 |
+
{
|
655 |
+
$this->id = $id;
|
656 |
+
}
|
657 |
+
|
658 |
+
/**
|
659 |
+
* @return
|
660 |
+
*/
|
661 |
+
public function getId()
|
662 |
+
{
|
663 |
+
return $this->id;
|
664 |
+
}
|
665 |
+
}
|
666 |
+
|
667 |
+
class InvoiceResponseType extends XmlSerializationSupport{
|
668 |
+
public $TransactionId;
|
669 |
+
public $TransactionDate;
|
670 |
+
public $SaleDate;
|
671 |
+
public $PurchaseOrderNumber;
|
672 |
+
public $CurrencyCode;
|
673 |
+
public $TaxClass;
|
674 |
+
public $TaxDirection;
|
675 |
+
public $ExemptionId;
|
676 |
+
public $GrossAmount;
|
677 |
+
public $TotalTaxAmount;
|
678 |
+
public $TaxObligation;
|
679 |
+
/**
|
680 |
+
* @var array ResponseLineItem
|
681 |
+
* @xmlName LineItem
|
682 |
+
*/
|
683 |
+
public $LineItems;
|
684 |
+
|
685 |
+
|
686 |
+
public function setCurrencyCode($CurrencyCode)
|
687 |
+
{
|
688 |
+
$this->CurrencyCode = $CurrencyCode;
|
689 |
+
}
|
690 |
+
|
691 |
+
public function getCurrencyCode()
|
692 |
+
{
|
693 |
+
return $this->CurrencyCode;
|
694 |
+
}
|
695 |
+
|
696 |
+
public function setExemptionId($ExemptionId)
|
697 |
+
{
|
698 |
+
$this->ExemptionId = $ExemptionId;
|
699 |
+
}
|
700 |
+
|
701 |
+
public function getExemptionId()
|
702 |
+
{
|
703 |
+
return $this->ExemptionId;
|
704 |
+
}
|
705 |
+
|
706 |
+
public function setGrossAmount($GrossAmount)
|
707 |
+
{
|
708 |
+
$this->GrossAmount = $GrossAmount;
|
709 |
+
}
|
710 |
+
|
711 |
+
public function getGrossAmount()
|
712 |
+
{
|
713 |
+
return $this->GrossAmount;
|
714 |
+
}
|
715 |
+
|
716 |
+
/**
|
717 |
+
* @param array $LineItems
|
718 |
+
*/
|
719 |
+
public function setLineItems($LineItems)
|
720 |
+
{
|
721 |
+
$this->LineItems = $LineItems;
|
722 |
+
}
|
723 |
+
|
724 |
+
/**
|
725 |
+
* @return array
|
726 |
+
*/
|
727 |
+
public function getLineItems()
|
728 |
+
{
|
729 |
+
return $this->LineItems;
|
730 |
+
}
|
731 |
+
|
732 |
+
public function setPurchaseOrderNumber($PurchaseOrderNumber)
|
733 |
+
{
|
734 |
+
$this->PurchaseOrderNumber = $PurchaseOrderNumber;
|
735 |
+
}
|
736 |
+
|
737 |
+
public function getPurchaseOrderNumber()
|
738 |
+
{
|
739 |
+
return $this->PurchaseOrderNumber;
|
740 |
+
}
|
741 |
+
|
742 |
+
public function setSaleDate($SaleDate)
|
743 |
+
{
|
744 |
+
$this->SaleDate = $SaleDate;
|
745 |
+
}
|
746 |
+
|
747 |
+
public function getSaleDate()
|
748 |
+
{
|
749 |
+
return $this->SaleDate;
|
750 |
+
}
|
751 |
+
|
752 |
+
public function setTaxClass($TaxClass)
|
753 |
+
{
|
754 |
+
$this->TaxClass = $TaxClass;
|
755 |
+
}
|
756 |
+
|
757 |
+
public function getTaxClass()
|
758 |
+
{
|
759 |
+
return $this->TaxClass;
|
760 |
+
}
|
761 |
+
|
762 |
+
public function setTaxDirection($TaxDirection)
|
763 |
+
{
|
764 |
+
$this->TaxDirection = $TaxDirection;
|
765 |
+
}
|
766 |
+
|
767 |
+
public function getTaxDirection()
|
768 |
+
{
|
769 |
+
return $this->TaxDirection;
|
770 |
+
}
|
771 |
+
|
772 |
+
public function setTaxObligation($TaxObligation)
|
773 |
+
{
|
774 |
+
$this->TaxObligation = $TaxObligation;
|
775 |
+
}
|
776 |
+
|
777 |
+
public function getTaxObligation()
|
778 |
+
{
|
779 |
+
return $this->TaxObligation;
|
780 |
+
}
|
781 |
+
|
782 |
+
public function setTotalTaxAmount($TotalTaxAmount)
|
783 |
+
{
|
784 |
+
$this->TotalTaxAmount = $TotalTaxAmount;
|
785 |
+
}
|
786 |
+
|
787 |
+
public function getTotalTaxAmount()
|
788 |
+
{
|
789 |
+
return $this->TotalTaxAmount;
|
790 |
+
}
|
791 |
+
|
792 |
+
public function setTransactionDate($TransactionDate)
|
793 |
+
{
|
794 |
+
$this->TransactionDate = $TransactionDate;
|
795 |
+
}
|
796 |
+
|
797 |
+
public function getTransactionDate()
|
798 |
+
{
|
799 |
+
return $this->TransactionDate;
|
800 |
+
}
|
801 |
+
|
802 |
+
public function setTransactionId($TransactionId)
|
803 |
+
{
|
804 |
+
$this->TransactionId = $TransactionId;
|
805 |
+
}
|
806 |
+
|
807 |
+
public function getTransactionId()
|
808 |
+
{
|
809 |
+
return $this->TransactionId;
|
810 |
+
}
|
811 |
+
}
|
812 |
+
|
813 |
+
class CommitResponseType extends XmlSerializationSupport{
|
814 |
+
public $TransactionId;
|
815 |
+
public $TransactionDate;
|
816 |
+
public $CommitDate;
|
817 |
+
public $InvoiceNumber;
|
818 |
+
/**
|
819 |
+
* @var InvoiceResponseType
|
820 |
+
*/
|
821 |
+
public $InvoiceResponse;
|
822 |
+
public $PriorTransactionId;
|
823 |
+
|
824 |
+
public function setCommitDate($CommitDate)
|
825 |
+
{
|
826 |
+
$this->CommitDate = $CommitDate;
|
827 |
+
}
|
828 |
+
|
829 |
+
public function getCommitDate()
|
830 |
+
{
|
831 |
+
return $this->CommitDate;
|
832 |
+
}
|
833 |
+
|
834 |
+
public function setInvoiceNumber($InvoiceNumber)
|
835 |
+
{
|
836 |
+
$this->InvoiceNumber = $InvoiceNumber;
|
837 |
+
}
|
838 |
+
|
839 |
+
public function getInvoiceNumber()
|
840 |
+
{
|
841 |
+
return $this->InvoiceNumber;
|
842 |
+
}
|
843 |
+
|
844 |
+
/**
|
845 |
+
* @param \InvoiceResponseType $InvoiceResponse
|
846 |
+
*/
|
847 |
+
public function setInvoiceResponse($InvoiceResponse)
|
848 |
+
{
|
849 |
+
$this->InvoiceResponse = $InvoiceResponse;
|
850 |
+
}
|
851 |
+
|
852 |
+
/**
|
853 |
+
* @return \InvoiceResponseType
|
854 |
+
*/
|
855 |
+
public function getInvoiceResponse()
|
856 |
+
{
|
857 |
+
return $this->InvoiceResponse;
|
858 |
+
}
|
859 |
+
|
860 |
+
public function setPriorTransactionId($PriorTransactionId)
|
861 |
+
{
|
862 |
+
$this->PriorTransactionId = $PriorTransactionId;
|
863 |
+
}
|
864 |
+
|
865 |
+
public function getPriorTransactionId()
|
866 |
+
{
|
867 |
+
return $this->PriorTransactionId;
|
868 |
+
}
|
869 |
+
|
870 |
+
public function setTransactionDate($TransactionDate)
|
871 |
+
{
|
872 |
+
$this->TransactionDate = $TransactionDate;
|
873 |
+
}
|
874 |
+
|
875 |
+
public function getTransactionDate()
|
876 |
+
{
|
877 |
+
return $this->TransactionDate;
|
878 |
+
}
|
879 |
+
|
880 |
+
public function setTransactionId($TransactionId)
|
881 |
+
{
|
882 |
+
$this->TransactionId = $TransactionId;
|
883 |
+
}
|
884 |
+
|
885 |
+
public function getTransactionId()
|
886 |
+
{
|
887 |
+
return $this->TransactionId;
|
888 |
+
}
|
889 |
+
}
|
890 |
+
|
891 |
+
class RefundResponseType extends XmlSerializationSupport {
|
892 |
+
public $TransactionId;
|
893 |
+
public $TransactionDate;
|
894 |
+
public $RefundDate;
|
895 |
+
public $PriorTransactionId;
|
896 |
+
|
897 |
+
public function setPriorTransactionId($PriorTransactionId)
|
898 |
+
{
|
899 |
+
$this->PriorTransactionId = $PriorTransactionId;
|
900 |
+
}
|
901 |
+
|
902 |
+
public function getPriorTransactionId()
|
903 |
+
{
|
904 |
+
return $this->PriorTransactionId;
|
905 |
+
}
|
906 |
+
|
907 |
+
public function setRefundDate($RefundDate)
|
908 |
+
{
|
909 |
+
$this->RefundDate = $RefundDate;
|
910 |
+
}
|
911 |
+
|
912 |
+
public function getRefundDate()
|
913 |
+
{
|
914 |
+
return $this->RefundDate;
|
915 |
+
}
|
916 |
+
|
917 |
+
public function setTransactionDate($TransactionDate)
|
918 |
+
{
|
919 |
+
$this->TransactionDate = $TransactionDate;
|
920 |
+
}
|
921 |
+
|
922 |
+
public function getTransactionDate()
|
923 |
+
{
|
924 |
+
return $this->TransactionDate;
|
925 |
+
}
|
926 |
+
|
927 |
+
public function setTransactionId($TransactionId)
|
928 |
+
{
|
929 |
+
$this->TransactionId = $TransactionId;
|
930 |
+
}
|
931 |
+
|
932 |
+
public function getTransactionId()
|
933 |
+
{
|
934 |
+
return $this->TransactionId;
|
935 |
+
}
|
936 |
+
}
|
937 |
+
|
938 |
+
class DeleteResponseType extends XmlSerializationSupport {
|
939 |
+
public $TransactionId;
|
940 |
+
public $TransactionDate;
|
941 |
+
public $PriorTransactionId;
|
942 |
+
|
943 |
+
public function setPriorTransactionId($PriorTransactionId)
|
944 |
+
{
|
945 |
+
$this->PriorTransactionId = $PriorTransactionId;
|
946 |
+
}
|
947 |
+
|
948 |
+
public function getPriorTransactionId()
|
949 |
+
{
|
950 |
+
return $this->PriorTransactionId;
|
951 |
+
}
|
952 |
+
|
953 |
+
public function setTransactionDate($TransactionDate)
|
954 |
+
{
|
955 |
+
$this->TransactionDate = $TransactionDate;
|
956 |
+
}
|
957 |
+
|
958 |
+
public function getTransactionDate()
|
959 |
+
{
|
960 |
+
return $this->TransactionDate;
|
961 |
+
}
|
962 |
+
|
963 |
+
public function setTransactionId($TransactionId)
|
964 |
+
{
|
965 |
+
$this->TransactionId = $TransactionId;
|
966 |
+
}
|
967 |
+
|
968 |
+
public function getTransactionId()
|
969 |
+
{
|
970 |
+
return $this->TransactionId;
|
971 |
+
}
|
972 |
+
}
|
973 |
+
|
974 |
+
class ErrorResponseType extends XmlSerializationSupport {
|
975 |
+
const ERROR_INVALID_CURRENCY_CODE = 11;
|
976 |
+
const ERROR_INVALID_SHIP_FROM_ADDRESS = 13;
|
977 |
+
const ERROR_INVALID_SHIP_TO_ADDRESS = 14;
|
978 |
+
const ERROR_MISSING_LINE_ITEMS = 15;
|
979 |
+
const ERROR_INVALID_GROSS_AMOUNT = 17;
|
980 |
+
const ERROR_INVALID_SKU_CODE = 16;
|
981 |
+
const ERROR_INVALID_COMMIT_DATE = 30;
|
982 |
+
const ERROR_INVALID_REFUND_DATE = 40;
|
983 |
+
|
984 |
+
public $LineNumber;
|
985 |
+
public $ColumnNumber;
|
986 |
+
public $ErrorCode;
|
987 |
+
public $ErrorDescription;
|
988 |
+
|
989 |
+
public function setColumnNumber($ColumnNumber)
|
990 |
+
{
|
991 |
+
$this->ColumnNumber = $ColumnNumber;
|
992 |
+
}
|
993 |
+
|
994 |
+
public function getColumnNumber()
|
995 |
+
{
|
996 |
+
return $this->ColumnNumber;
|
997 |
+
}
|
998 |
+
|
999 |
+
public function setErrorCode($ErrorCode)
|
1000 |
+
{
|
1001 |
+
$this->ErrorCode = $ErrorCode;
|
1002 |
+
}
|
1003 |
+
|
1004 |
+
public function getErrorCode()
|
1005 |
+
{
|
1006 |
+
return $this->ErrorCode;
|
1007 |
+
}
|
1008 |
+
|
1009 |
+
public function setErrorDescription($ErrorDescription)
|
1010 |
+
{
|
1011 |
+
$this->ErrorDescription = $ErrorDescription;
|
1012 |
+
}
|
1013 |
+
|
1014 |
+
public function getErrorDescription()
|
1015 |
+
{
|
1016 |
+
return $this->ErrorDescription;
|
1017 |
+
}
|
1018 |
+
|
1019 |
+
public function setLineNumber($LineNumber)
|
1020 |
+
{
|
1021 |
+
$this->LineNumber = $LineNumber;
|
1022 |
+
}
|
1023 |
+
|
1024 |
+
public function getLineNumber()
|
1025 |
+
{
|
1026 |
+
return $this->LineNumber;
|
1027 |
+
}
|
1028 |
+
}
|
1029 |
+
/* ========================= REQUEST\RESPONSE ======================== */
|
1030 |
+
|
1031 |
+
/**
|
1032 |
+
* @xmlName TaxRequest
|
1033 |
+
*/
|
1034 |
+
class TaxRequestType extends XmlSerializationSupport {
|
1035 |
+
protected function getNamespace()
|
1036 |
+
{
|
1037 |
+
return 'http://www.exactor.com/ns';
|
1038 |
+
}
|
1039 |
+
|
1040 |
+
|
1041 |
+
/**
|
1042 |
+
* @var string
|
1043 |
+
* @xmlName MerchantId
|
1044 |
+
*/
|
1045 |
+
public $MerchantId;
|
1046 |
+
/**
|
1047 |
+
* @var string
|
1048 |
+
* @xml UserId
|
1049 |
+
*/
|
1050 |
+
public $UserId;
|
1051 |
+
|
1052 |
+
/**
|
1053 |
+
* @var string
|
1054 |
+
*/
|
1055 |
+
public $PartnerId;
|
1056 |
+
|
1057 |
+
/**
|
1058 |
+
* @var string
|
1059 |
+
*/
|
1060 |
+
public $DigitalSignature;
|
1061 |
+
|
1062 |
+
/**
|
1063 |
+
* @var array InvoiceRequestType
|
1064 |
+
* @xmlName InvoiceRequest
|
1065 |
+
*/
|
1066 |
+
public $InvoiceRequests = array();
|
1067 |
+
|
1068 |
+
/**
|
1069 |
+
* @var array CommitRequestType
|
1070 |
+
* @xmlName CommitRequest
|
1071 |
+
*/
|
1072 |
+
public $CommitRequests = array();
|
1073 |
+
|
1074 |
+
/**
|
1075 |
+
* @var array RefundRequestType
|
1076 |
+
* @xmlName RefundRequest
|
1077 |
+
*/
|
1078 |
+
public $RefundRequests = array();
|
1079 |
+
|
1080 |
+
/**
|
1081 |
+
* @var array DeleteRequestType
|
1082 |
+
* @xmlName DeleteRequest
|
1083 |
+
*/
|
1084 |
+
public $DeleteRequests = array();
|
1085 |
+
|
1086 |
+
/* =========== ATTRIBUTES ============== */
|
1087 |
+
/**
|
1088 |
+
* @var string
|
1089 |
+
* @xmlName version
|
1090 |
+
* @xmlAttribute
|
1091 |
+
*/
|
1092 |
+
public $pluginVersion='';
|
1093 |
+
|
1094 |
+
/**
|
1095 |
+
* @var string
|
1096 |
+
* @xmlName plugin
|
1097 |
+
* @xmlAttribute
|
1098 |
+
*/
|
1099 |
+
public $pluginName='';
|
1100 |
+
|
1101 |
+
|
1102 |
+
/**
|
1103 |
+
* @param array $CommitRequests
|
1104 |
+
*/
|
1105 |
+
public function setCommitRequests($CommitRequests)
|
1106 |
+
{
|
1107 |
+
$this->CommitRequests = $CommitRequests;
|
1108 |
+
}
|
1109 |
+
|
1110 |
+
/**
|
1111 |
+
* @return array
|
1112 |
+
*/
|
1113 |
+
public function getCommitRequests()
|
1114 |
+
{
|
1115 |
+
return $this->CommitRequests;
|
1116 |
+
}
|
1117 |
+
|
1118 |
+
/**
|
1119 |
+
* @param array $DeleteRequests
|
1120 |
+
*/
|
1121 |
+
public function setDeleteRequests($DeleteRequests)
|
1122 |
+
{
|
1123 |
+
$this->DeleteRequests = $DeleteRequests;
|
1124 |
+
}
|
1125 |
+
|
1126 |
+
/**
|
1127 |
+
* @return array
|
1128 |
+
*/
|
1129 |
+
public function getDeleteRequests()
|
1130 |
+
{
|
1131 |
+
return $this->DeleteRequests;
|
1132 |
+
}
|
1133 |
+
|
1134 |
+
/**
|
1135 |
+
* @param string $DigitalSignature
|
1136 |
+
*/
|
1137 |
+
public function setDigitalSignature($DigitalSignature)
|
1138 |
+
{
|
1139 |
+
$this->DigitalSignature = $DigitalSignature;
|
1140 |
+
}
|
1141 |
+
|
1142 |
+
/**
|
1143 |
+
* @return string
|
1144 |
+
*/
|
1145 |
+
public function getDigitalSignature()
|
1146 |
+
{
|
1147 |
+
return $this->DigitalSignature;
|
1148 |
+
}
|
1149 |
+
|
1150 |
+
/**
|
1151 |
+
* @param array $InvoiceRequests
|
1152 |
+
*/
|
1153 |
+
public function setInvoiceRequests($InvoiceRequests)
|
1154 |
+
{
|
1155 |
+
$this->InvoiceRequests = $InvoiceRequests;
|
1156 |
+
}
|
1157 |
+
|
1158 |
+
/**
|
1159 |
+
* @return array
|
1160 |
+
*/
|
1161 |
+
public function getInvoiceRequests()
|
1162 |
+
{
|
1163 |
+
return $this->InvoiceRequests;
|
1164 |
+
}
|
1165 |
+
|
1166 |
+
/**
|
1167 |
+
* @param string $MerchantId
|
1168 |
+
*/
|
1169 |
+
public function setMerchantId($MerchantId)
|
1170 |
+
{
|
1171 |
+
$this->MerchantId = $MerchantId;
|
1172 |
+
}
|
1173 |
+
|
1174 |
+
/**
|
1175 |
+
* @return string
|
1176 |
+
*/
|
1177 |
+
public function getMerchantId()
|
1178 |
+
{
|
1179 |
+
return $this->MerchantId;
|
1180 |
+
}
|
1181 |
+
|
1182 |
+
/**
|
1183 |
+
* @param string $PartnerId
|
1184 |
+
*/
|
1185 |
+
public function setPartnerId($PartnerId)
|
1186 |
+
{
|
1187 |
+
$this->PartnerId = $PartnerId;
|
1188 |
+
}
|
1189 |
+
|
1190 |
+
/**
|
1191 |
+
* @return string
|
1192 |
+
*/
|
1193 |
+
public function getPartnerId()
|
1194 |
+
{
|
1195 |
+
return $this->PartnerId;
|
1196 |
+
}
|
1197 |
+
|
1198 |
+
/**
|
1199 |
+
* @param array $RefundRequests
|
1200 |
+
*/
|
1201 |
+
public function setRefundRequests($RefundRequests)
|
1202 |
+
{
|
1203 |
+
$this->RefundRequests = $RefundRequests;
|
1204 |
+
}
|
1205 |
+
|
1206 |
+
/**
|
1207 |
+
* @return array
|
1208 |
+
*/
|
1209 |
+
public function getRefundRequests()
|
1210 |
+
{
|
1211 |
+
return $this->RefundRequests;
|
1212 |
+
}
|
1213 |
+
|
1214 |
+
/**
|
1215 |
+
* @param string $UserId
|
1216 |
+
*/
|
1217 |
+
public function setUserId($UserId)
|
1218 |
+
{
|
1219 |
+
$this->UserId = $UserId;
|
1220 |
+
}
|
1221 |
+
|
1222 |
+
/**
|
1223 |
+
* @return string
|
1224 |
+
*/
|
1225 |
+
public function getUserId()
|
1226 |
+
{
|
1227 |
+
return $this->UserId;
|
1228 |
+
}
|
1229 |
+
|
1230 |
+
/**
|
1231 |
+
* @param string $pluginName
|
1232 |
+
*/
|
1233 |
+
public function setPluginName($pluginName)
|
1234 |
+
{
|
1235 |
+
$this->pluginName = $pluginName;
|
1236 |
+
}
|
1237 |
+
|
1238 |
+
/**
|
1239 |
+
* @return string
|
1240 |
+
*/
|
1241 |
+
public function getPluginName()
|
1242 |
+
{
|
1243 |
+
return $this->pluginName;
|
1244 |
+
}
|
1245 |
+
|
1246 |
+
/**
|
1247 |
+
* @param string $pluginVersion
|
1248 |
+
*/
|
1249 |
+
public function setPluginVersion($pluginVersion)
|
1250 |
+
{
|
1251 |
+
$this->pluginVersion = $pluginVersion;
|
1252 |
+
}
|
1253 |
+
|
1254 |
+
/**
|
1255 |
+
* @return string
|
1256 |
+
*/
|
1257 |
+
public function getPluginVersion()
|
1258 |
+
{
|
1259 |
+
return $this->pluginVersion;
|
1260 |
+
}
|
1261 |
+
|
1262 |
+
/* ============ SHORTCUTS ================== */
|
1263 |
+
|
1264 |
+
public function addInvoiceRequest(InvoiceRequestType $invoiceRequest){
|
1265 |
+
if (!is_array($this->getInvoiceRequests())) $this->setInvoiceRequests(array());
|
1266 |
+
$this->InvoiceRequests[] = $invoiceRequest;
|
1267 |
+
}
|
1268 |
+
|
1269 |
+
public function addCommitRequest(CommitRequestType $commitRequest){
|
1270 |
+
if (!is_array($this->getCommitRequests())) $this->setCommitRequests(array());
|
1271 |
+
$this->CommitRequests[] = $commitRequest;
|
1272 |
+
}
|
1273 |
+
|
1274 |
+
public function addRefundRequest(RefundRequestType $refundRequest){
|
1275 |
+
if (!is_array($this->getRefundRequests())) $this->setRefundRequests(array());
|
1276 |
+
$this->RefundRequests[] = $refundRequest;
|
1277 |
+
}
|
1278 |
+
|
1279 |
+
public function addDeleteRequest(DeleteRequestType $deleteRequest){
|
1280 |
+
if (!is_array($this->getDeleteRequests())) $this->setDeleteRequests(array());
|
1281 |
+
$this->DeleteRequests[] = $deleteRequest;
|
1282 |
+
}
|
1283 |
+
}
|
1284 |
+
|
1285 |
+
class TaxResponseType extends XmlSerializationSupport{
|
1286 |
+
/**
|
1287 |
+
* @var string
|
1288 |
+
* @xmlName MerchantId
|
1289 |
+
*/
|
1290 |
+
public $MerchantId;
|
1291 |
+
/**
|
1292 |
+
* @var string
|
1293 |
+
* @xml UserId
|
1294 |
+
*/
|
1295 |
+
public $UserId;
|
1296 |
+
|
1297 |
+
/**
|
1298 |
+
* @var string
|
1299 |
+
*/
|
1300 |
+
public $PartnerId;
|
1301 |
+
|
1302 |
+
/**
|
1303 |
+
* @var array InvoiceResponseType
|
1304 |
+
* @xmlName InvoiceResponse
|
1305 |
+
*/
|
1306 |
+
public $InvoiceResponses;
|
1307 |
+
|
1308 |
+
/**
|
1309 |
+
* @var array CommitResponseType
|
1310 |
+
* @xmlName CommitResponse
|
1311 |
+
*/
|
1312 |
+
public $CommitResponses;
|
1313 |
+
|
1314 |
+
/**
|
1315 |
+
* @var array RefundResponseType
|
1316 |
+
* @xmlName RefundResponse
|
1317 |
+
*/
|
1318 |
+
public $RefundResponses;
|
1319 |
+
|
1320 |
+
/**
|
1321 |
+
* @var array DeleteResponseType
|
1322 |
+
* @xmlName DeleteResponse
|
1323 |
+
*/
|
1324 |
+
public $DeleteResponses;
|
1325 |
+
|
1326 |
+
/**
|
1327 |
+
* @var array ErrorResponseType
|
1328 |
+
* @xmlName ErrorResponse
|
1329 |
+
*/
|
1330 |
+
public $ErrorResponses;
|
1331 |
+
|
1332 |
+
/* ******** SOME SHORTCUTS *********** */
|
1333 |
+
|
1334 |
+
/**
|
1335 |
+
* True if there is at least one Error Response
|
1336 |
+
* @return bool
|
1337 |
+
*/
|
1338 |
+
public function hasErrors(){
|
1339 |
+
return count($this->getErrorResponses()) > 0;
|
1340 |
+
}
|
1341 |
+
|
1342 |
+
/**
|
1343 |
+
* Returns first ErrorResponse from the list or null if there are on ane errors
|
1344 |
+
* @return ErrorResponseType|null
|
1345 |
+
*/
|
1346 |
+
public function getFirstError(){
|
1347 |
+
if (!$this->hasErrors()) return null;
|
1348 |
+
$errors = $this->getErrorResponses();
|
1349 |
+
return $errors[0];
|
1350 |
+
}
|
1351 |
+
|
1352 |
+
/** Returns first InvoiceResponseType from the list or null if there are no any invoice responses
|
1353 |
+
* @return InvoiceResponseType|null
|
1354 |
+
*/
|
1355 |
+
public function getFirstInvoice(){
|
1356 |
+
if (!count($this->getInvoiceResponses())) return null;
|
1357 |
+
$invoices = $this->getInvoiceResponses();
|
1358 |
+
return $invoices[0];
|
1359 |
+
}
|
1360 |
+
|
1361 |
+
/* ******** GETTERS AND SETTERS *********** */
|
1362 |
+
|
1363 |
+
/**
|
1364 |
+
* @param string $MerchantId
|
1365 |
+
*/
|
1366 |
+
public function setMerchantId($MerchantId)
|
1367 |
+
{
|
1368 |
+
$this->MerchantId = $MerchantId;
|
1369 |
+
}
|
1370 |
+
|
1371 |
+
/**
|
1372 |
+
* @return string
|
1373 |
+
*/
|
1374 |
+
public function getMerchantId()
|
1375 |
+
{
|
1376 |
+
return $this->MerchantId;
|
1377 |
+
}
|
1378 |
+
|
1379 |
+
/**
|
1380 |
+
* @param string $PartnerId
|
1381 |
+
*/
|
1382 |
+
public function setPartnerId($PartnerId)
|
1383 |
+
{
|
1384 |
+
$this->PartnerId = $PartnerId;
|
1385 |
+
}
|
1386 |
+
|
1387 |
+
/**
|
1388 |
+
* @return string
|
1389 |
+
*/
|
1390 |
+
public function getPartnerId()
|
1391 |
+
{
|
1392 |
+
return $this->PartnerId;
|
1393 |
+
}
|
1394 |
+
|
1395 |
+
/**
|
1396 |
+
* @param string $UserId
|
1397 |
+
*/
|
1398 |
+
public function setUserId($UserId)
|
1399 |
+
{
|
1400 |
+
$this->UserId = $UserId;
|
1401 |
+
}
|
1402 |
+
|
1403 |
+
/**
|
1404 |
+
* @return string
|
1405 |
+
*/
|
1406 |
+
public function getUserId()
|
1407 |
+
{
|
1408 |
+
return $this->UserId;
|
1409 |
+
}
|
1410 |
+
|
1411 |
+
/**
|
1412 |
+
* @param array $CommitResponses
|
1413 |
+
*/
|
1414 |
+
public function setCommitResponses($CommitResponses)
|
1415 |
+
{
|
1416 |
+
$this->CommitResponses = $CommitResponses;
|
1417 |
+
}
|
1418 |
+
|
1419 |
+
/**
|
1420 |
+
* @return array
|
1421 |
+
*/
|
1422 |
+
public function getCommitResponses()
|
1423 |
+
{
|
1424 |
+
return $this->CommitResponses;
|
1425 |
+
}
|
1426 |
+
|
1427 |
+
/**
|
1428 |
+
* @param array $DeleteResponses
|
1429 |
+
*/
|
1430 |
+
public function setDeleteResponses($DeleteResponses)
|
1431 |
+
{
|
1432 |
+
$this->DeleteResponses = $DeleteResponses;
|
1433 |
+
}
|
1434 |
+
|
1435 |
+
/**
|
1436 |
+
* @return array
|
1437 |
+
*/
|
1438 |
+
public function getDeleteResponses()
|
1439 |
+
{
|
1440 |
+
return $this->DeleteResponses;
|
1441 |
+
}
|
1442 |
+
|
1443 |
+
/**
|
1444 |
+
* @param array $ErrorResponses
|
1445 |
+
*/
|
1446 |
+
public function setErrorResponses($ErrorResponses)
|
1447 |
+
{
|
1448 |
+
$this->ErrorResponses = $ErrorResponses;
|
1449 |
+
}
|
1450 |
+
|
1451 |
+
/**
|
1452 |
+
* @return array
|
1453 |
+
*/
|
1454 |
+
public function getErrorResponses()
|
1455 |
+
{
|
1456 |
+
return $this->ErrorResponses;
|
1457 |
+
}
|
1458 |
+
|
1459 |
+
/**
|
1460 |
+
* @param array $InvoiceResponses
|
1461 |
+
*/
|
1462 |
+
public function setInvoiceResponses($InvoiceResponses)
|
1463 |
+
{
|
1464 |
+
$this->InvoiceResponses = $InvoiceResponses;
|
1465 |
+
}
|
1466 |
+
|
1467 |
+
/**
|
1468 |
+
* @return array
|
1469 |
+
*/
|
1470 |
+
public function getInvoiceResponses()
|
1471 |
+
{
|
1472 |
+
return $this->InvoiceResponses;
|
1473 |
+
}
|
1474 |
+
|
1475 |
+
/**
|
1476 |
+
* @param array $RefundResponses
|
1477 |
+
*/
|
1478 |
+
public function setRefundResponses($RefundResponses)
|
1479 |
+
{
|
1480 |
+
$this->RefundResponses = $RefundResponses;
|
1481 |
+
}
|
1482 |
+
|
1483 |
+
/**
|
1484 |
+
* @return array
|
1485 |
+
*/
|
1486 |
+
public function getRefundResponses()
|
1487 |
+
{
|
1488 |
+
return $this->RefundResponses;
|
1489 |
+
}
|
1490 |
+
}
|
1491 |
+
|
lib/ExactorCommons/Magento.php
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* User: LOGICIFY\corvis
|
4 |
+
* Date: 4/20/12
|
5 |
+
* Time: 10:39 AM
|
6 |
+
*/
|
7 |
+
|
8 |
+
class MagentoLogger extends IExactorLogger{
|
9 |
+
protected function doOutput($body)
|
10 |
+
{
|
11 |
+
echo Mage::Log($body);
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
+
class MagentoExactorCallback extends IExactorPluginCallback{
|
16 |
+
|
17 |
+
private $logger;
|
18 |
+
/**
|
19 |
+
* @var Exactor_Core_Helper_SessionCache
|
20 |
+
*/
|
21 |
+
private $sessionCache;
|
22 |
+
|
23 |
+
public function __construct(){
|
24 |
+
$this->logger = ExactorLoggingFactory::getInstance()->getLogger($this);
|
25 |
+
$this->sessionCache = Mage::helper('Exactor_Core_SessionCache/');
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Search transaction info by internal transaction id in local database.
|
30 |
+
* Should return <b>null</b> if transaction doesn't exists
|
31 |
+
* @param $shoppingCartTrnId
|
32 |
+
* @return ExactorTransactionInfo
|
33 |
+
*/
|
34 |
+
function loadTransactionInfo($shoppingCartTrnId)
|
35 |
+
{
|
36 |
+
$this->logger->trace('called', 'loadTransactionInfo');
|
37 |
+
/** @var Exactor_Core_Model_ExactorTransaction $exatorTransaction */
|
38 |
+
$exatorTransaction = Mage::getModel('Exactor_Core_Model_ExactorTransaction');
|
39 |
+
$exatorTransaction = $exatorTransaction->getCollection()->addFilter("OrderID",$shoppingCartTrnId)->getFirstItem();
|
40 |
+
if (!$exatorTransaction->hasData()) return null;
|
41 |
+
// Populating common object with DB dat
|
42 |
+
$transactionInfo = new ExactorTransactionInfo();
|
43 |
+
$transactionInfo->setIsCommited($exatorTransaction->getCommited());
|
44 |
+
$transactionInfo->setCreatedDate($exatorTransaction->getDateOfOrder());
|
45 |
+
$transactionInfo->setExactorMerchantId($exatorTransaction->getMerchantID());
|
46 |
+
$transactionInfo->setExactorUserId($exatorTransaction->getUserID());
|
47 |
+
$transactionInfo->setExactorTrnId($exatorTransaction->getTransactionID());
|
48 |
+
$transactionInfo->setShoppingCartTrnId($exatorTransaction->getOrderID());
|
49 |
+
//$transactionInfo->setLastModifiedDate();
|
50 |
+
//$transactionInfo->setSignature('');
|
51 |
+
return $transactionInfo;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Save given transaction info object in the current DB.
|
56 |
+
* If DB already contains record with given shoppingCartTrnId it should be REPLACED on the new one.
|
57 |
+
* @param ExactorTransactionInfo $transactionInfo
|
58 |
+
* @param $requestKey
|
59 |
+
* @return void
|
60 |
+
*/
|
61 |
+
function saveTransactionInfo(ExactorTransactionInfo $transactionInfo, $requestKey)
|
62 |
+
{
|
63 |
+
$this->logger->trace('called', 'saveTransactionInfo');
|
64 |
+
/** @var Exactor_Core_Model_ExactorTransaction $exatorTransaction */
|
65 |
+
$exatorTransaction = Mage::getModel('Exactor_Core_Model_ExactorTransaction');
|
66 |
+
$exatorTransaction = $exatorTransaction->getCollection()
|
67 |
+
->addFilter("OrderID",$transactionInfo->getShoppingCartTrnId())->getFirstItem();
|
68 |
+
if (!$exatorTransaction->hasData()) $exatorTransaction = Mage::getModel('Exactor_Core_Model_ExactorTransaction');
|
69 |
+
|
70 |
+
$transactionInfo->setSignature($requestKey);
|
71 |
+
$exatorTransaction->setCommited($transactionInfo->getIsCommited());
|
72 |
+
$exatorTransaction->setDateOfOrder($transactionInfo->getLastModifiedDate());
|
73 |
+
$exatorTransaction->setMerchantID($transactionInfo->getExactorMerchantId());
|
74 |
+
$exatorTransaction->setUserID($transactionInfo->getExactorUserId());
|
75 |
+
$exatorTransaction->setOrderID($transactionInfo->getShoppingCartTrnId());
|
76 |
+
$exatorTransaction->setTransactionID($transactionInfo->getExactorTrnId());
|
77 |
+
|
78 |
+
$exatorTransaction->save();
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* This method will be called for each successful tax calculation request.
|
83 |
+
* Plugin should store the latest tax information.
|
84 |
+
* @param $requestKey
|
85 |
+
* @param InvoiceResponseType $invoiceResponse
|
86 |
+
* @param InvoiceRequestType $invoiceRequest
|
87 |
+
* @param ExactorTransactionInfo $transactionInfo
|
88 |
+
* @return void
|
89 |
+
*/
|
90 |
+
function onTaxCalculationSuccess($requestKey, $invoiceResponse, $invoiceRequest, $transactionInfo)
|
91 |
+
{
|
92 |
+
$this->logger->trace('called', 'onTaxCalculationSuccess');
|
93 |
+
if (empty($requestKey)) return;
|
94 |
+
$this->sessionCache->pushTransactionInfo($transactionInfo);
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* This method will be called once Tax Calculation fails.
|
99 |
+
* Plugin should use it to perform some exception handling if needed. Otherwise just leave it empty.
|
100 |
+
* @param $requestKey
|
101 |
+
* @param ErrorResponseType $errorResponse
|
102 |
+
* @param InvoiceRequestType $invoiceRequest
|
103 |
+
* @return void
|
104 |
+
*/
|
105 |
+
function onTaxCalculationFail($requestKey, $errorResponse, $invoiceRequest)
|
106 |
+
{
|
107 |
+
$this->logger->trace('called', 'onTaxCalculationFail');
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* @param $requestKey
|
112 |
+
* @param CommitResponseType $commitResponse
|
113 |
+
* @param CommitRequestType $commitRequest
|
114 |
+
* @param ExactorTransactionInfo $transactionInfo
|
115 |
+
* @return void
|
116 |
+
*/
|
117 |
+
function onCommitSuccess($requestKey, $commitResponse, $commitRequest, $transactionInfo)
|
118 |
+
{
|
119 |
+
$this->logger->trace('called', 'onCommitSuccess');
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* @param $requestKey
|
124 |
+
* @param ErrorResponseType $errorResponse
|
125 |
+
* @param CommitRequestType $commitRequest
|
126 |
+
* @return void
|
127 |
+
*/
|
128 |
+
function onCommitFail($requestKey, $errorResponse, $commitRequest)
|
129 |
+
{
|
130 |
+
$this->logger->trace('called', 'onCommitFail');
|
131 |
+
}
|
132 |
+
|
133 |
+
}
|
lib/ExactorCommons/XmlProcessing.php
ADDED
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This lightweight single-class library provides an ability to marshal\un-marshal XML
|
4 |
+
* using bindings defined in property annotations.
|
5 |
+
* USAGE:
|
6 |
+
* 1. Declare class that extends XmlSerializationSupport.
|
7 |
+
* 2. Define some public properties
|
8 |
+
* 3. Optionally define getters and setters
|
9 |
+
* 4. Use serializeToXML() to serialize to XML string
|
10 |
+
* Use readFromXmlString($xml)
|
11 |
+
* By default class and property names will be used as tag names for serialization and de-serialization.
|
12 |
+
* Besides there is an ability to customize marshaling rules using annotations in doc-comments:
|
13 |
+
* 1. @xmlName SomeName - SomeName will be used as Tag or Attribute name instead of property or class name.
|
14 |
+
* Can be applied to properties and classes.
|
15 |
+
* 2. @xmlAttribute - Value will be stored as attribute. Name will be generated similar to regular nodes
|
16 |
+
* Can be applied only to properties.
|
17 |
+
* 3. @xmlSkip - Property will not be serialized to XML. Can be applied to properties.
|
18 |
+
*
|
19 |
+
* User: LOGICIFY\corvis
|
20 |
+
* Date: 4/18/12
|
21 |
+
* Time: 5:34 PM
|
22 |
+
*/
|
23 |
+
|
24 |
+
class XmlSerializationSupport {
|
25 |
+
|
26 |
+
const DOC_LINE_XML_NAME = '/@xmlName\s+([\w\d]+)\n/i';
|
27 |
+
const DOC_LINE_XML_VAR_TYPE = '/@var\s+([\w\d]+\s*[\w\d]*)/i';
|
28 |
+
const DOC_LINE_XML_ATTRIBUTE = '/@xmlAttribute\s*\n/i';
|
29 |
+
const DOC_LINE_XML_SKIP = '/@xmlSkip\s*\n/i';
|
30 |
+
const SERIALIZE_TO_NOTHING = 0;
|
31 |
+
const SERIALIZE_TO_NODE = 1;
|
32 |
+
const SERIALIZE_TO_ATTRIBUTE = 2;
|
33 |
+
|
34 |
+
const TYPE_ARRAY_MODIFIER = 'array';
|
35 |
+
|
36 |
+
protected function getNamespace(){
|
37 |
+
return null;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**Returns serialization action.
|
41 |
+
* Node - by default
|
42 |
+
* Supported doc lines: @xmlAttribute, @xmlSkip
|
43 |
+
* @param ReflectionProperty $property
|
44 |
+
* @return bool
|
45 |
+
*/
|
46 |
+
protected function getSerializationType(ReflectionProperty $property){
|
47 |
+
$serializationAction = self::SERIALIZE_TO_NODE;
|
48 |
+
// is attribute?
|
49 |
+
if (preg_match(self::DOC_LINE_XML_ATTRIBUTE, $property->getDocComment(), $matches)>0){
|
50 |
+
$serializationAction = self::SERIALIZE_TO_ATTRIBUTE;
|
51 |
+
}else if(preg_match(self::DOC_LINE_XML_SKIP, $property->getDocComment(), $matches)>0){
|
52 |
+
$serializationAction = self::SERIALIZE_TO_NOTHING;
|
53 |
+
}
|
54 |
+
return $serializationAction;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* By default it will be just property name.
|
59 |
+
* If there is a DocComment with attribute @xmlName it will be used instead
|
60 |
+
* @param ReflectionProperty $property
|
61 |
+
* @return string XML Name for the property
|
62 |
+
*/
|
63 |
+
protected function getTagNameForProperty(ReflectionProperty $property){
|
64 |
+
$name = $property->getName();
|
65 |
+
// Trying to parse DOC line of the property to gat valid name
|
66 |
+
if (preg_match(self::DOC_LINE_XML_NAME, $property->getDocComment(), $matches)>0){
|
67 |
+
if (count($matches)>1)
|
68 |
+
$name=$matches[1];
|
69 |
+
}
|
70 |
+
return trim($name);
|
71 |
+
}
|
72 |
+
|
73 |
+
/** Class name by default.
|
74 |
+
* If there is a DocComment with attribute @xmlName it will be used instead.
|
75 |
+
* @param ReflectionClass $class
|
76 |
+
* @return string
|
77 |
+
* @see getTagNameForProperty
|
78 |
+
*/
|
79 |
+
protected function getTagNameForClass(ReflectionClass $class){
|
80 |
+
$name = $class->getName();
|
81 |
+
// Trying to parse DOC line of the property to gat valid name
|
82 |
+
if (preg_match(self::DOC_LINE_XML_NAME, $class->getDocComment(), $matches)>0){
|
83 |
+
if (count($matches)>1)
|
84 |
+
$name=$matches[1];
|
85 |
+
}
|
86 |
+
return trim($name);
|
87 |
+
}
|
88 |
+
|
89 |
+
protected function getTargetClassNameForProperty($property)
|
90 |
+
{
|
91 |
+
$className=null;
|
92 |
+
if (preg_match(self::DOC_LINE_XML_VAR_TYPE, $property->getDocComment(), $matches)>0){
|
93 |
+
if (count($matches)>1){
|
94 |
+
$className=$matches[1];
|
95 |
+
if ((substr($className, 0, strlen(self::TYPE_ARRAY_MODIFIER)) === self::TYPE_ARRAY_MODIFIER)){
|
96 |
+
$className = substr($className,strlen(self::TYPE_ARRAY_MODIFIER));
|
97 |
+
}
|
98 |
+
}
|
99 |
+
}
|
100 |
+
return trim($className);
|
101 |
+
}
|
102 |
+
|
103 |
+
protected function getIsArrayForProperty($property){
|
104 |
+
$res = false;
|
105 |
+
if (preg_match(self::DOC_LINE_XML_VAR_TYPE, $property->getDocComment(), $matches)>0){
|
106 |
+
if (count($matches)>1){
|
107 |
+
if ((substr($matches[1], 0, strlen(self::TYPE_ARRAY_MODIFIER)) === self::TYPE_ARRAY_MODIFIER)){
|
108 |
+
$res = true;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
}
|
112 |
+
return $res;
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Returns true if given object supports XML serialization
|
117 |
+
* @param $obj
|
118 |
+
* @return bool
|
119 |
+
*/
|
120 |
+
protected function isComplexSerializableObject($obj){
|
121 |
+
if (is_string($obj)) return false;
|
122 |
+
return is_subclass_of($obj, 'XmlSerializationSupport');
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Do some preprocessing before serialization, e.g. remove special characters
|
127 |
+
* @param $value
|
128 |
+
* @return void
|
129 |
+
*/
|
130 |
+
protected function preprocessValue($value){
|
131 |
+
return htmlspecialchars($value);
|
132 |
+
}
|
133 |
+
|
134 |
+
public function toSimpleXmlObject($simpleXmlObject=null){
|
135 |
+
$reflectionObj = new ReflectionObject($this);
|
136 |
+
$className = $this->getTagNameForClass($reflectionObj);
|
137 |
+
if ($simpleXmlObject==null)
|
138 |
+
$simpleXmlObject = new SimpleXMLElement("<$className />");
|
139 |
+
if ($this->getNamespace()!=null){
|
140 |
+
$simpleXmlObject->addAttribute('xmlns', $this->getNamespace());
|
141 |
+
}
|
142 |
+
$properties = $reflectionObj->getProperties();
|
143 |
+
foreach ($properties as $property) {
|
144 |
+
switch($this->getSerializationType($property)){
|
145 |
+
case self::SERIALIZE_TO_NODE:
|
146 |
+
$v = $property->getValue($this);
|
147 |
+
if (!is_array($v)){
|
148 |
+
$nodeArray = array($v);
|
149 |
+
}else{
|
150 |
+
$nodeArray = $v;
|
151 |
+
}
|
152 |
+
foreach ($nodeArray as $value){
|
153 |
+
if ($this->isComplexSerializableObject($value)){
|
154 |
+
$obj = $simpleXmlObject->addChild($this->getTagNameForProperty($property));
|
155 |
+
$value->toSimpleXmlObject($obj);
|
156 |
+
}else{
|
157 |
+
if ($value !== null)
|
158 |
+
$simpleXmlObject->addChild($this->getTagNameForProperty($property), $this->preprocessValue($value));
|
159 |
+
}
|
160 |
+
}
|
161 |
+
break;
|
162 |
+
case self::SERIALIZE_TO_ATTRIBUTE:
|
163 |
+
$simpleXmlObject->addAttribute($this->getTagNameForProperty($property), $this->preprocessValue($property->getValue($this)));
|
164 |
+
break;
|
165 |
+
case self::SERIALIZE_TO_NOTHING:
|
166 |
+
break;
|
167 |
+
default:
|
168 |
+
throw new Exception('Unsupported Serialization action for property ' . $property->getName());
|
169 |
+
}
|
170 |
+
}
|
171 |
+
$simpleXmlObject->saveXML();
|
172 |
+
return $simpleXmlObject;
|
173 |
+
}
|
174 |
+
|
175 |
+
public function serializeToXML(){
|
176 |
+
return $this->toSimpleXmlObject()->asXML();
|
177 |
+
}
|
178 |
+
|
179 |
+
public function readFromXmlString($xml){
|
180 |
+
$this->populateWithSimpleXmlObject(simplexml_load_string($xml));
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* @throws Exception
|
185 |
+
* @param string $targetClass
|
186 |
+
* @param $value
|
187 |
+
* @param $xmlElement
|
188 |
+
* @return generated object
|
189 |
+
*/
|
190 |
+
private function _deserializeComplexSimpleXMLField($targetClass, $value, $xmlElement){
|
191 |
+
try{
|
192 |
+
if (trim($targetClass)==='') throw new Exception();
|
193 |
+
$obj = new $targetClass;
|
194 |
+
}catch (Exception $e){
|
195 |
+
throw new Exception("Can't instantiate class '$targetClass'. Please provide type annotation for element $xmlElement");
|
196 |
+
}
|
197 |
+
if (!$this->isComplexSerializableObject($obj))
|
198 |
+
throw new Exception("Class ($targetClass) is not a child of XmlSerializationSupport. Element $xmlElement");
|
199 |
+
$obj->populateWithSimpleXmlObject($value);
|
200 |
+
return $obj;
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* @param SimpleXMLElement $simpleXmlObject
|
205 |
+
* @return void
|
206 |
+
*/
|
207 |
+
public function populateWithSimpleXmlObject($simpleXmlObject){
|
208 |
+
$xmlArray = (array)$simpleXmlObject; // Array representation of the SimpleXMLElement
|
209 |
+
$reflectionObj = new ReflectionObject($this);
|
210 |
+
$properties = $reflectionObj->getProperties();
|
211 |
+
foreach ($properties as $property) {
|
212 |
+
switch($this->getSerializationType($property)){
|
213 |
+
case self::SERIALIZE_TO_NODE:
|
214 |
+
$xmlTagName = $this->getTagNameForProperty($property);
|
215 |
+
//if (is_a($value, 'SimpleXMLElement')){
|
216 |
+
if (!array_key_exists($xmlTagName, $xmlArray)){
|
217 |
+
// If there is no such tag we should put NULL
|
218 |
+
$property->setValue($this, null);
|
219 |
+
} else if (is_array($xmlArray[$xmlTagName])) {
|
220 |
+
$obj = array();
|
221 |
+
foreach ($xmlArray[$xmlTagName] as $value){
|
222 |
+
$targetClass = $this->getTargetClassNameForProperty($property);
|
223 |
+
$obj[] = $this->_deserializeComplexSimpleXMLField($targetClass, $value, $xmlTagName);
|
224 |
+
}
|
225 |
+
$property->setValue($this, $obj);
|
226 |
+
} else if ($xmlArray[$xmlTagName] instanceof SimpleXMLElement){
|
227 |
+
$targetClass = $this->getTargetClassNameForProperty($property);
|
228 |
+
$isArray = $this->getIsArrayForProperty($property);
|
229 |
+
if ($targetClass != ''){
|
230 |
+
$obj = $this->_deserializeComplexSimpleXMLField($targetClass, $xmlArray[$xmlTagName], $xmlTagName);
|
231 |
+
if ($isArray)
|
232 |
+
$obj = array($obj);
|
233 |
+
}else{
|
234 |
+
$obj = '';
|
235 |
+
}
|
236 |
+
$property->setValue($this, $obj);
|
237 |
+
}else{
|
238 |
+
$property->setValue($this, $xmlArray[$xmlTagName]);
|
239 |
+
}
|
240 |
+
break;
|
241 |
+
case self::SERIALIZE_TO_ATTRIBUTE:
|
242 |
+
$attributeName = $this->getTagNameForProperty($property);
|
243 |
+
$value = null;
|
244 |
+
if (array_key_exists('@attributes', $xmlArray))
|
245 |
+
if (array_key_exists($attributeName, $xmlArray['@attributes']))
|
246 |
+
$value = $xmlArray['@attributes'][$attributeName];
|
247 |
+
$property->setValue($this, $value);
|
248 |
+
break;
|
249 |
+
case self::SERIALIZE_TO_NOTHING:
|
250 |
+
break;
|
251 |
+
default:
|
252 |
+
throw new Exception('Unsupported Serialization action for property ' . $property->getName());
|
253 |
+
}
|
254 |
+
}
|
255 |
+
}
|
256 |
+
}
|
lib/ExactorCommons/config.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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','v20120528');
|
10 |
+
ExactorProcessingServiceFactory::getInstance()->setup(new MagentoExactorCallback());
|
11 |
+
|
package.xml
CHANGED
@@ -1,22 +1,20 @@
|
|
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>
|
8 |
<extends/>
|
9 |
<summary>Calculate, file, and remit sales taxes seamlessly through Magento using the Exactor Sales Tax Compliance Service.</summary>
|
10 |
-
<description>This module was developed to enable businesses to incorporate and benefit from the Exactor sales tax compliance service within their Magento shopping cart. Exactor presents a sales tax compliance module for (i) calculating sales tax within the e-commerce shopping process; and (ii) generating and filing sales tax returns in all US jurisdictions (state and local).
|
11 |
-

|
12 |
Once installed, neither the merchant, nor the customer, need to perform any additional functions to obtain sales taxes. The taxes will be calculated and seamlessly displayed in the Magento shopping cart, and because the shopping cart communicates with the Exactor system, the ExactorFile module will be able to generate tax returns without the merchant having to transfer data from one system to another.
|
13 |
-
|
14 |
-
|
15 |
-
<
|
16 |
-
<
|
17 |
-
<
|
18 |
-
<
|
19 |
-
<contents><target name="magelocal"><dir name="Exactor"><dir name="Adminhtml"><dir name="Model"><dir name="Sales"><dir name="Order"><file name="Create.php" hash="d674ced6eb9d65c7af43338950e62656"/></dir></dir><file name="Observer.php" hash="32d8516193e744508787a0bd601b6cbc"/></dir><dir name="etc"><file name="config.xml" hash="1373c3119398e50b65cf13924cf10b0c"/></dir></dir><dir name="Checkout"><dir name="Block"><dir name="Cart"><file name="Totals.php" hash="9cbdd4fbcc0aa3db644154ddc850d9d0"/></dir></dir><dir name="Model"><file name="Observer.php" hash="12c0dae271a868552443527e5e1b6327"/></dir><dir name="etc"><file name="config.xml" hash="dc4aa548fbeaf369f9dfc653d7e12e62"/></dir></dir><dir name="Exactordetails"><dir name="Block"><file name="Form.php" hash="a8ace42cdedcf7457a46cdbd35f8d9e4"/><file name="Switcher.php" hash="741c77e8ae998aefbad7e544c22b2c87"/></dir><dir name="Helper"><file name="ClassLoader.php" hash="c98a946628c6d1d5498d6656d80d2cc4"/><file name="Data.php" hash="1a8daf1afb06fd61c82f6c221b8eeb39"/><file name="VersionResolver.php" hash="14dce068dfe2a7d3364c4bd29e6f8431"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Exactoraccount"><file name="Collection.php" hash="ecd398a61811b320f26698fd37495bc9"/></dir><dir name="Exactortransactiondetails"><file name="Collection.php" hash="2c144746720d53bfd1b5702aa6d85ba8"/></dir><file name="Exactoraccount.php" hash="c4fcfe7e4b723e7e2f50f553877d4317"/><file name="Exactortransactiondetails.php" hash="b2ac1eba439e2b005681201f45838288"/></dir><file name="Exactoraccount.php" hash="e2ec6093563ab64c6d01eff685d249bc"/><file name="Exactortransactiondetails.php" hash="61c6cda5f312162842d3c4d98174e662"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ExactorformController.php" hash="6c14f814b94b819a4cfb3e4d31449714"/></dir><file name="AjaxController.php" hash="732d7e3bd489f8882693d76cdbb2e3bb"/><file name="IndexController.php" hash="4290eaa9101d0caaec6106ceb76b68a6"/></dir><dir name="etc"><file name="config.xml" hash="e7956b889a55fb498f322a6998b1a052"/></dir><dir name="sql"><dir name="exactordetails_setup"><file name="mysql4-install-2011.07.19.php" hash="3cce29b935cc58e76a97383b09e1f195"/></dir></dir></dir><dir name="Paypal"><dir name="Model"><dir name="Express"><file name="Checkout.php" hash="a398dcc1347b09ef043f0c5b745fd62b"/></dir></dir><dir name="etc"><file name="config.xml" hash="7e63915a0560b46763a45be426950c9f"/></dir></dir><dir name="Sales"><dir name="Model"><file name="Observer.php" hash="495dccb26bd4569567e1365b9c6a704b"/><file name="Order.php" hash="a683b319a3a8610db81d75700d010b73"/></dir><dir name="etc"><file name="config.xml" hash="e9c18b4bcfff8bf5764b76ad2890531f"/></dir></dir><dir name="Tax"><dir name="Model"><dir name="Sales"><dir name="Total"><dir name="Quote"><file name="Tax.php" hash="24a12ab41e2e9ef5c1ff03e6027f7665"/></dir></dir></dir><file name="Calculation.php" hash="5229dfca4276e2c4b6264365080ed83f"/><file name="Observer.php" hash="5df5ea5ff5369b1177a8eea8a5486ca0"/></dir><dir name="etc"><file name="config.xml" hash="671255d2257747864ba83bc3b98f7332"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="exactordetails.xml" hash="685044826a7b38996caaa890f90f827c"/></dir><dir name="template"><dir name="exactordetails"><file name="exactordetailsform.phtml" hash="c443547d02f01a5e141d931c7c1500fa"/><file name="switcher.phtml" hash="c87176df6c8a7da383a03827e97cd26d"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Exactor.xml" hash="76cb04b554522911d8845a01a5204320"/></dir></target><target name="mage"><dir name="js"><dir name="exactor"><file name="exactor.js" hash="ef87dbf6290f798eaa3008b2b83cdc32"/></dir></dir></target></contents>
|
20 |
<compatible/>
|
21 |
-
<dependencies
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Mage_Exactor_Tax</name>
|
4 |
+
<version>2012.05.28</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>
|
8 |
<extends/>
|
9 |
<summary>Calculate, file, and remit sales taxes seamlessly through Magento using the Exactor Sales Tax Compliance Service.</summary>
|
10 |
+
<description>This module was developed to enable businesses to incorporate and benefit from the Exactor sales tax compliance service within their Magento shopping cart. Exactor presents a sales tax compliance module for (i) calculating sales tax within the e-commerce shopping process; and (ii) generating and filing sales tax returns in all US jurisdictions (state and local).This plug-in was developed to enable businesses to incorporate and benefit from the Exactor sales tax compliance service within their Magento shopping cart. 
|
|
|
11 |
Once installed, neither the merchant, nor the customer, need to perform any additional functions to obtain sales taxes. The taxes will be calculated and seamlessly displayed in the Magento shopping cart, and because the shopping cart communicates with the Exactor system, the ExactorFile module will be able to generate tax returns without the merchant having to transfer data from one system to another.
|
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</notes>
|
14 |
+
<authors><author><name>Exactor, Inc.</name><user>exactor</user><email>support@exactor.com</email></author></authors>
|
15 |
+
<date>2012-05-29</date>
|
16 |
+
<time>14:11:36</time>
|
17 |
+
<contents><target name="magelocal"><dir name="Exactor"><dir name="Core"><dir name="Helper"><file name="SessionCache.php" hash="4aab06767188e8ead64043654989473d"/></dir><dir name="Model"><file name="ExactorTransaction.php" hash="852aa20f6e3b7aa0001439d4bffe9724"/><file name="MerchantSettings.php" hash="b4c2acde5dfa929e89ea7ec9fe0f1b2f"/><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="2d2aa64ed4562736e77b3cad12e8f48c"/></dir></dir><dir name="etc"><file name="config.xml" hash="853683228cba76b069de709eef9cc1af"/></dir></dir><dir name="ExactorSettings"><dir name="Block"><file name="Form.php" hash="7dcfb00922cfe305d8ae08cb20ca5e87"/></dir><dir name="Helper"><file name="Data.php" hash="9abafb58b091f8976fa289f394465415"/><file name="VersionResolver.php" hash="14dce068dfe2a7d3364c4bd29e6f8431"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FormController.php" hash="474106c737cbcfcf3a3f6ddf39dda90f"/></dir><file name="AjaxController.php" hash="c07aeeca00e1408e52945fc027569793"/><file name="IndexController.php" hash="f47cbc274dd68c57c30b60bbee69259e"/></dir><dir name="etc"><file name="config.xml" hash="a81bdbd636da58ea207eef111ce17f3a"/></dir><dir name="sql"><dir name="ExactorSettings_setup"><file name="mysql4-install-14.04.2012.php" hash="f35af1e12921b57479cb4b5677937a0c"/></dir></dir></dir><dir name="Sales"><dir name="Model"><file name="Observer.php" hash="65e826c0493adece2476ed24788ecb06"/><file name="Order.php" hash="e1b40101f4b60fc7bac20865f564ae17"/></dir><dir name="etc"><file name="config.xml" hash="46efe3b5565f4ae48c620396ee75bef7"/></dir></dir><dir name="Tax"><dir name="Helper"><file name="Calculation.php" hash="29c5252bdd48b173c90588f449114024"/><file name="Mapping.php" hash="a37a20157ce31eda4293b5d5625c122b"/></dir><dir name="Model"><file name="Observer.php" hash="30e509696ce1aa27f7b4a838bd25544a"/><dir name="Sales"><dir name="Total"><dir name="Quote"><dir name="Nominal"><file name="Tax.php" hash="156eff380df5b16db55449759f193490"/></dir><file name="Tax.php" hash="cf72ffeea12ed72126faa54d2404e1d3"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="4e5b936ded2b0dd8707c987d7ddef4ba"/></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="d408fb816628a1935bfe4a4ab226b9ca"/></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="b78ebfdd66c36c419a312fc5c2d1b4bd"/><file name="ExactorDomainObjects.php" hash="390e7f9a18a328d8ef2b67121d1b813e"/><file name="Magento.php" hash="76da7333fe0692053a47f8564c7b513a"/><file name="XmlProcessing.php" hash="383fd21839889d720e2094e83ccc7a2a"/><file name="config.php" hash="767776abc9a242f57be6d4ac8aea3919"/></dir></target></contents>
|
|
|
18 |
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
</package>
|