OnePica_AvaTax - Version 2.4.0.0

Version Notes

Added support for Enterprise functionality for gift wrapping and messaging, increased capability to filter tax calls in the cart tax and shipping estimator.

Download this release

Release Info

Developer One Pica Codemaster
Extension OnePica_AvaTax
Version 2.4.0.0
Comparing to
See all releases


Version 2.4.0.0

Files changed (149) hide show
  1. app/code/community/OnePica/AvaTax/Block/Adminhtml/Export/Abstract/Grid.php +113 -0
  2. app/code/community/OnePica/AvaTax/Block/Adminhtml/Export/Log/Grid.php +65 -0
  3. app/code/community/OnePica/AvaTax/Block/Adminhtml/Export/Queue/Grid.php +78 -0
  4. app/code/community/OnePica/AvaTax/Block/Adminhtml/Notification/Toolbar.php +57 -0
  5. app/code/community/OnePica/AvaTax/Block/Adminhtml/System/Config/Form/Field/Export.php +42 -0
  6. app/code/community/OnePica/AvaTax/Block/Adminhtml/Tax/Class/Edit/Form.php +38 -0
  7. app/code/community/OnePica/AvaTax/Block/Adminhtml/Tax/Class/Grid.php +46 -0
  8. app/code/community/OnePica/AvaTax/Block/Checkout/Onepage/Shipping/Method/Available.php +76 -0
  9. app/code/community/OnePica/AvaTax/Helper/Data.php +384 -0
  10. app/code/community/OnePica/AvaTax/Helper/Tax/Data.php +124 -0
  11. app/code/community/OnePica/AvaTax/Model/Abstract.php +111 -0
  12. app/code/community/OnePica/AvaTax/Model/Admin/Session.php +46 -0
  13. app/code/community/OnePica/AvaTax/Model/Adminhtml/Config.php +40 -0
  14. app/code/community/OnePica/AvaTax/Model/Adminhtml/Sales/Order/Create.php +60 -0
  15. app/code/community/OnePica/AvaTax/Model/Avatax/Abstract.php +234 -0
  16. app/code/community/OnePica/AvaTax/Model/Avatax/Address.php +214 -0
  17. app/code/community/OnePica/AvaTax/Model/Avatax/Estimate.php +420 -0
  18. app/code/community/OnePica/AvaTax/Model/Avatax/Exception/Address.php +21 -0
  19. app/code/community/OnePica/AvaTax/Model/Avatax/Exception/Commitfailure.php +21 -0
  20. app/code/community/OnePica/AvaTax/Model/Avatax/Exception/Unbalanced.php +21 -0
  21. app/code/community/OnePica/AvaTax/Model/Avatax/Invoice.php +418 -0
  22. app/code/community/OnePica/AvaTax/Model/Avatax/Ping.php +49 -0
  23. app/code/community/OnePica/AvaTax/Model/Config.php +240 -0
  24. app/code/community/OnePica/AvaTax/Model/Observer.php +205 -0
  25. app/code/community/OnePica/AvaTax/Model/Records/Log.php +35 -0
  26. app/code/community/OnePica/AvaTax/Model/Records/Mysql4/Log.php +38 -0
  27. app/code/community/OnePica/AvaTax/Model/Records/Mysql4/Log/Collection.php +25 -0
  28. app/code/community/OnePica/AvaTax/Model/Records/Mysql4/Queue.php +79 -0
  29. app/code/community/OnePica/AvaTax/Model/Records/Mysql4/Queue/Collection.php +25 -0
  30. app/code/community/OnePica/AvaTax/Model/Records/Queue.php +60 -0
  31. app/code/community/OnePica/AvaTax/Model/Records/Queue/Process.php +127 -0
  32. app/code/community/OnePica/AvaTax/Model/Sales/Quote/Address.php +186 -0
  33. app/code/community/OnePica/AvaTax/Model/Sales/Quote/Address/Total/Grand.php +44 -0
  34. app/code/community/OnePica/AvaTax/Model/Sales/Quote/Address/Total/Tax.php +263 -0
  35. app/code/community/OnePica/AvaTax/Model/Session.php +27 -0
  36. app/code/community/OnePica/AvaTax/Model/Source/Actions.php +43 -0
  37. app/code/community/OnePica/AvaTax/Model/Source/Customercodeformat.php +44 -0
  38. app/code/community/OnePica/AvaTax/Model/Source/Error.php +37 -0
  39. app/code/community/OnePica/AvaTax/Model/Source/Logmode.php +44 -0
  40. app/code/community/OnePica/AvaTax/Model/Source/Onerrorfrontend.php +34 -0
  41. app/code/community/OnePica/AvaTax/Model/Source/Regionfilter/List.php +59 -0
  42. app/code/community/OnePica/AvaTax/Model/Source/Regionfilter/Mode.php +40 -0
  43. app/code/community/OnePica/AvaTax/controllers/Adminhtml/ExportController.php +52 -0
  44. app/code/community/OnePica/AvaTax/controllers/Adminhtml/GridController.php +69 -0
  45. app/code/community/OnePica/AvaTax/etc/adminhtml.xml +71 -0
  46. app/code/community/OnePica/AvaTax/etc/config.xml +296 -0
  47. app/code/community/OnePica/AvaTax/etc/system-disabled.xml +91 -0
  48. app/code/community/OnePica/AvaTax/etc/system.xml +485 -0
  49. app/code/community/OnePica/AvaTax/lib/AvaTax.php +101 -0
  50. app/code/community/OnePica/AvaTax/lib/classes/ATConfig.class.php +71 -0
  51. app/code/community/OnePica/AvaTax/lib/classes/ATObject.class.php +55 -0
  52. app/code/community/OnePica/AvaTax/lib/classes/AVObject.class.php +1 -0
  53. app/code/community/OnePica/AvaTax/lib/classes/Address.class.php +229 -0
  54. app/code/community/OnePica/AvaTax/lib/classes/AddressServiceSoap.class.php +157 -0
  55. app/code/community/OnePica/AvaTax/lib/classes/AddressType.class.php +40 -0
  56. app/code/community/OnePica/AvaTax/lib/classes/AdjustTaxRequest.class.php +77 -0
  57. app/code/community/OnePica/AvaTax/lib/classes/AdjustTaxResult.class.php +263 -0
  58. app/code/community/OnePica/AvaTax/lib/classes/ApplyPaymentRequest.class.php +79 -0
  59. app/code/community/OnePica/AvaTax/lib/classes/ApplyPaymentResult.class.php +15 -0
  60. app/code/community/OnePica/AvaTax/lib/classes/AvalaraSoapClient.class.php +36 -0
  61. app/code/community/OnePica/AvaTax/lib/classes/BaseResult.class.php +39 -0
  62. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/AuditMessage.class.php +15 -0
  63. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/AvaTaxBatchSvc.php +74 -0
  64. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BaseResult.class.php +23 -0
  65. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/Batch.class.php +88 -0
  66. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchDelete.class.php +15 -0
  67. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchDeleteResponse.class.php +15 -0
  68. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFetch.class.php +15 -0
  69. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFetchResponse.class.php +15 -0
  70. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFetchResult.class.php +19 -0
  71. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFile.class.php +54 -0
  72. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFileDelete.class.php +15 -0
  73. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFileDeleteResponse.class.php +15 -0
  74. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFileFetch.class.php +15 -0
  75. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFileFetchResponse.class.php +15 -0
  76. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFileFetchResult.class.php +19 -0
  77. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFileSave.class.php +15 -0
  78. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFileSaveResponse.class.php +15 -0
  79. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFileSaveResult.class.php +15 -0
  80. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchProcess.class.php +15 -0
  81. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchProcessRequest.class.php +26 -0
  82. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchProcessResponse.class.php +15 -0
  83. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchProcessResult.class.php +11 -0
  84. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchSave.class.php +15 -0
  85. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchSaveResponse.class.php +15 -0
  86. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchSaveResult.class.php +19 -0
  87. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchSvc.class.php +175 -0
  88. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/DeleteRequest.class.php +26 -0
  89. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/DeleteResult.class.php +11 -0
  90. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/FetchRequest.class.php +47 -0
  91. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/FilterRequest.class.php +25 -0
  92. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/FilterResult.class.php +15 -0
  93. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/IsAuthorized.class.php +15 -0
  94. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/IsAuthorizedResponse.class.php +15 -0
  95. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/IsAuthorizedResult.class.php +19 -0
  96. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/Message.class.php +39 -0
  97. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/Ping.class.php +15 -0
  98. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/PingResponse.class.php +15 -0
  99. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/PingResult.class.php +28 -0
  100. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/Profile.class.php +27 -0
  101. app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/SeverityLevel.class.php +15 -0
  102. app/code/community/OnePica/AvaTax/lib/classes/BoundaryLevel.class.php +60 -0
  103. app/code/community/OnePica/AvaTax/lib/classes/CancelCode.class.php +74 -0
  104. app/code/community/OnePica/AvaTax/lib/classes/CancelTaxRequest.class.php +61 -0
  105. app/code/community/OnePica/AvaTax/lib/classes/CancelTaxResult.class.php +58 -0
  106. app/code/community/OnePica/AvaTax/lib/classes/CommitTaxRequest.class.php +46 -0
  107. app/code/community/OnePica/AvaTax/lib/classes/CommitTaxResult.class.php +54 -0
  108. app/code/community/OnePica/AvaTax/lib/classes/DetailLevel.class.php +57 -0
  109. app/code/community/OnePica/AvaTax/lib/classes/DocStatus.class.php +87 -0
  110. app/code/community/OnePica/AvaTax/lib/classes/DocumentType.class.php +90 -0
  111. app/code/community/OnePica/AvaTax/lib/classes/DynamicSoapClient.class.php +63 -0
  112. app/code/community/OnePica/AvaTax/lib/classes/Enum.class.php +32 -0
  113. app/code/community/OnePica/AvaTax/lib/classes/GetTaxHistoryRequest.class.php +54 -0
  114. app/code/community/OnePica/AvaTax/lib/classes/GetTaxHistoryResult.class.php +72 -0
  115. app/code/community/OnePica/AvaTax/lib/classes/GetTaxRequest.class.php +502 -0
  116. app/code/community/OnePica/AvaTax/lib/classes/GetTaxResult.class.php +263 -0
  117. app/code/community/OnePica/AvaTax/lib/classes/IsAuthorizedResult.class.php +81 -0
  118. app/code/community/OnePica/AvaTax/lib/classes/JurisdictionType.class.php +75 -0
  119. app/code/community/OnePica/AvaTax/lib/classes/Line.class.php +267 -0
  120. app/code/community/OnePica/AvaTax/lib/classes/Message.class.php +88 -0
  121. app/code/community/OnePica/AvaTax/lib/classes/PingResult.class.php +76 -0
  122. app/code/community/OnePica/AvaTax/lib/classes/PostTaxRequest.class.php +84 -0
  123. app/code/community/OnePica/AvaTax/lib/classes/PostTaxResult.class.php +54 -0
  124. app/code/community/OnePica/AvaTax/lib/classes/ReconcileTaxHistoryRequest.class.php +91 -0
  125. app/code/community/OnePica/AvaTax/lib/classes/ReconcileTaxHistoryResult.class.php +112 -0
  126. app/code/community/OnePica/AvaTax/lib/classes/SearchTaxHistoryResult.class.php +102 -0
  127. app/code/community/OnePica/AvaTax/lib/classes/ServiceMode.class.php +47 -0
  128. app/code/community/OnePica/AvaTax/lib/classes/SeverityLevel.class.php +40 -0
  129. app/code/community/OnePica/AvaTax/lib/classes/TaxDetail.class.php +196 -0
  130. app/code/community/OnePica/AvaTax/lib/classes/TaxLine.class.php +134 -0
  131. app/code/community/OnePica/AvaTax/lib/classes/TaxOverride.class.php +42 -0
  132. app/code/community/OnePica/AvaTax/lib/classes/TaxOverrideType.class.php +16 -0
  133. app/code/community/OnePica/AvaTax/lib/classes/TaxRequest.class.php +163 -0
  134. app/code/community/OnePica/AvaTax/lib/classes/TaxServiceSoap.class.php +308 -0
  135. app/code/community/OnePica/AvaTax/lib/classes/TaxType.class.php +39 -0
  136. app/code/community/OnePica/AvaTax/lib/classes/TextCase.class.php +34 -0
  137. app/code/community/OnePica/AvaTax/lib/classes/ValidAddress.class.php +478 -0
  138. app/code/community/OnePica/AvaTax/lib/classes/ValidateRequest.class.php +192 -0
  139. app/code/community/OnePica/AvaTax/lib/classes/ValidateResult.class.php +89 -0
  140. app/code/community/OnePica/AvaTax/lib/classes/wsdl/Address.wsdl +512 -0
  141. app/code/community/OnePica/AvaTax/lib/classes/wsdl/BatchSvc.wsdl +659 -0
  142. app/code/community/OnePica/AvaTax/lib/classes/wsdl/Tax.wsdl +1278 -0
  143. app/code/community/OnePica/AvaTax/lib/functions.php +74 -0
  144. app/code/community/OnePica/AvaTax/sql/avatax_records_setup/mysql4-install-0.1.0.php +33 -0
  145. app/code/community/OnePica/AvaTax/sql/avatax_records_setup/mysql4-upgrade-0.1.4-0.1.5.php +34 -0
  146. app/code/community/OnePica/AvaTax/sql/avatax_records_setup/mysql4-upgrade-1.0.1-2.0.0.php +37 -0
  147. app/code/community/OnePica/AvaTax/sql/avatax_records_setup/mysql4-upgrade-2.2.0-2.2.1.php +29 -0
  148. app/etc/modules/OnePica_AvaTax.xml +9 -0
  149. package.xml +23 -0
app/code/community/OnePica/AvaTax/Block/Adminhtml/Export/Abstract/Grid.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ abstract class OnePica_AvaTax_Block_Adminhtml_Export_Abstract_Grid extends Mage_Adminhtml_Block_Widget_Grid
19
+ {
20
+
21
+ /**
22
+ * Constructor: sets grid id and sort order
23
+ *
24
+ */
25
+ public function __construct() {
26
+ parent::__construct();
27
+ $this->setId('export_grid');
28
+ $this->setDefaultDir('DESC');
29
+ $this->setSaveParametersInSession(false);
30
+
31
+ $url = Mage::helper('avatax')->getDocumentationUrl();
32
+ Mage::helper('adminhtml')->setPageHelpUrl($url);
33
+ }
34
+
35
+ /**
36
+ * Mass adds columns based on passed in array
37
+ *
38
+ * @param array $columns array(columnName => dataType)
39
+ * @return self
40
+ */
41
+ protected function _addColumnsForExport($columns) {
42
+ foreach ($columns as $name=>$type) {
43
+ if(is_array($type)) {
44
+ $this->addColumn($name, array(
45
+ 'header' => Mage::helper('avatax')->__(ucwords(str_replace('_', ' ', $name))),
46
+ 'index' => $name,
47
+ 'type' => 'options',
48
+ 'options' => $type
49
+ ));
50
+ } else {
51
+ $this->addColumn($name, array(
52
+ 'header' => Mage::helper('avatax')->__(ucwords(str_replace('_', ' ', $name))),
53
+ 'index' => $name,
54
+ 'type' => $type
55
+ ));
56
+ }
57
+ }
58
+ return $this;
59
+ }
60
+
61
+ /**
62
+ * Creates SQL code from collection
63
+ *
64
+ * @return string
65
+ */
66
+ public function getSql() {
67
+ $this->_isExport = true;
68
+ $this->_prepareGrid();
69
+ $this->getCollection()->getSelect()->limit();
70
+ $this->getCollection()->setPageSize(0);
71
+ $this->getCollection()->load();
72
+ $this->_afterLoadCollection();
73
+
74
+ $columns = array();
75
+ foreach ($this->_columns as $column) {
76
+ if (!$column->getIsSystem()) {
77
+ $columns[] = $column->getIndex();
78
+ }
79
+ }
80
+
81
+ $resourceModel = $this->getCollection()->getResource();
82
+ $adapter = $resourceModel->getReadConnection();
83
+ $version = Mage::getResourceModel('core/resource')->getDbVersion('avatax_records_setup');
84
+ $stores = count(Mage::app()->getStores());
85
+
86
+ $sql = '-- ' . strtoupper($resourceModel->getMainTable()) . " EXPORT\n";
87
+ $sql .= '-- Created at: ' . gmdate(DATE_W3C) . "\n";
88
+ $sql .= '-- Created by: ' . Mage::getUrl('/') . "\n";
89
+ $sql .= '-- Magento v' . Mage::getVersion() . ' // OP_AvaTax v' . $version . ' // Stores: ' . $stores . "\n";
90
+ $sql .= '-- Total rows: ' . $this->getCollection()->count() . "\n\n";
91
+
92
+ $rows = array();
93
+ foreach ($this->getCollection() as $item) {
94
+ $values = array();
95
+ foreach($columns as $column) {
96
+ $values[] = $adapter->quote($item->getData($column));
97
+ }
98
+ $rows[] = "(" . implode(", ", $values) . ")";
99
+ }
100
+
101
+ $chunks = array_chunk($rows, 50);
102
+ unset($rows);
103
+
104
+ foreach($chunks as $chunk) {
105
+ $sql .= 'INSERT INTO `' . $resourceModel->getMainTable() . '` (`' . implode('`, `', $columns) . '`) VALUES ';
106
+ $sql .= "\n" . implode(",\n", $chunk);
107
+ $sql .= ";\n\n";
108
+ }
109
+
110
+ return $sql;
111
+ }
112
+
113
+ }
app/code/community/OnePica/AvaTax/Block/Adminhtml/Export/Log/Grid.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class OnePica_AvaTax_Block_Adminhtml_Export_Log_Grid extends OnePica_AvaTax_Block_Adminhtml_Export_Abstract_Grid
19
+ {
20
+
21
+ /**
22
+ * Sets default sort to id field
23
+ *
24
+ */
25
+ public function __construct() {
26
+ parent::__construct();
27
+ $this->setDefaultSort('log_id');
28
+ $this->setGridHeader(
29
+ '<h3 class="icon-head" style="background-image:url(' . $this->getSkinUrl('images/fam_application_view_tile.gif') . ');">' .
30
+ $this->__('AvaTax Action Log') .
31
+ '</h3>'
32
+ );
33
+ }
34
+
35
+ /**
36
+ * Adds columns to grid
37
+ *
38
+ * @return self
39
+ */
40
+ protected function _prepareColumns() {
41
+ return $this->_addColumnsForExport(array(
42
+ 'log_id' => 'number',
43
+ 'store_id' => 'number',
44
+ 'level' => 'default',
45
+ 'type' => 'default',
46
+ 'request' => 'text',
47
+ 'result' => 'text',
48
+ 'additional' => 'text',
49
+ 'created_at' => 'datetime'
50
+ ));
51
+ return $this;
52
+ }
53
+
54
+ /**
55
+ * Adds collection
56
+ *
57
+ * @return unknown
58
+ */
59
+ protected function _prepareCollection() {
60
+ $collection = Mage::getModel('avatax_records/log')->getCollection();
61
+ $this->setCollection($collection);
62
+ return parent::_prepareCollection();
63
+ }
64
+
65
+ }
app/code/community/OnePica/AvaTax/Block/Adminhtml/Export/Queue/Grid.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class OnePica_AvaTax_Block_Adminhtml_Export_Queue_Grid extends OnePica_AvaTax_Block_Adminhtml_Export_Abstract_Grid
19
+ {
20
+
21
+ /**
22
+ * Sets default sort to id field
23
+ *
24
+ */
25
+ public function __construct() {
26
+ parent::__construct();
27
+ $this->setDefaultSort('id');
28
+ $this->setGridHeader(
29
+ '<h3 class="icon-head" style="background-image:url(' . $this->getSkinUrl('images/fam_application_view_tile.gif') . ');">' .
30
+ $this->__('AvaTax Order Sync Queue') .
31
+ '</h3>'
32
+ );
33
+ }
34
+
35
+ /**
36
+ * Adds custom buttons
37
+ *
38
+ */
39
+ public function getMainButtonsHtml()
40
+ {
41
+ $html = $this->getButtonHtml($this->__('Process Queue Now'), 'setLocation(\'' . $this->getUrl('*/*/processQueue') . '\')');
42
+ $html .= parent::getMainButtonsHtml();
43
+ return $html;
44
+ }
45
+
46
+ /**
47
+ * Adds columns to grid
48
+ *
49
+ * @return self
50
+ */
51
+ protected function _prepareColumns() {
52
+ return $this->_addColumnsForExport(array(
53
+ 'id' => 'number',
54
+ 'store_id' => 'number',
55
+ 'entity_id' => 'number',
56
+ 'entity_increment_id' => 'number',
57
+ 'type' => Mage::getModel('avatax/records_queue')->getTypeOptions(),
58
+ 'status' => Mage::getModel('avatax/records_queue')->getStatusOptions(),
59
+ 'attempt' => 'number',
60
+ 'message' => 'default',
61
+ 'created_at' => 'datetime',
62
+ 'updated_at' => 'datetime'
63
+ ));
64
+ return $this;
65
+ }
66
+
67
+ /**
68
+ * Adds collection
69
+ *
70
+ * @return unknown
71
+ */
72
+ protected function _prepareCollection() {
73
+ $collection = Mage::getModel('avatax_records/queue')->getCollection();
74
+ $this->setCollection($collection);
75
+ return parent::_prepareCollection();
76
+ }
77
+
78
+ }
app/code/community/OnePica/AvaTax/Block/Adminhtml/Notification/Toolbar.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class OnePica_AvaTax_Block_Adminhtml_Notification_Toolbar extends Mage_Adminhtml_Block_Notification_Toolbar
19
+ {
20
+
21
+ /**
22
+ * Count the number of pending_retry items in queue
23
+ *
24
+ * @return int
25
+ */
26
+ protected function _getQueuePendingRetryCount() {
27
+ return Mage::getModel('avatax_records/queue')->getCollection()
28
+ ->addFieldToFilter('status', OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_RETRY)
29
+ ->load()
30
+ ->count();
31
+ }
32
+
33
+ /**
34
+ * Piggyback the admin notification messages block to show AvaTax warnings as needed
35
+ *
36
+ * @return string
37
+ */
38
+ protected function _toHtml() {
39
+ $html = '';
40
+
41
+ if(Mage::getStoreConfig('tax/avatax/error_notification_toolbar')) {
42
+ $count = $this->_getQueuePendingRetryCount();
43
+ if ($count) {
44
+ if($count==1) $text = 'There is <strong>' . $count . '</strong> entry in the AvaTax Order Sync Queue that has errored. Syncing is attemped ' . OnePica_AvaTax_Model_Config::QUEUE_ATTEMPT_MAX . ' times before permanently failing.';
45
+ else $text = 'There are <strong>' . $count . '</strong> entries in the AvaTax Order Sync Queue that have errored. Syncing is attemped ' . OnePica_AvaTax_Model_Config::QUEUE_ATTEMPT_MAX . ' times before permanently failing.';
46
+
47
+ $html = '<div class="notification-global">';
48
+ if (Mage::getSingleton('admin/session')->isAllowed('avatax')) {
49
+ $html .= '<span class="f-right">Go to the <a href="' . $this->getUrl('avatax/adminhtml_grid/queue') . '">AvaTax Order Sync Queue</a></span>';
50
+ }
51
+ $html .= '<strong class="label">AvaTax:</strong> ' . $text . '</div>';
52
+ }
53
+ }
54
+
55
+ return parent::_toHtml() . $html;
56
+ }
57
+ }
app/code/community/OnePica/AvaTax/Block/Adminhtml/System/Config/Form/Field/Export.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class OnePica_AvaTax_Block_Adminhtml_System_Config_Form_Field_Export extends Mage_Adminhtml_Block_System_Config_Form_Field
19
+ {
20
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
21
+ $buttonBlock = $this->getLayout()->createBlock('adminhtml/widget_button');
22
+ $params = array(
23
+ 'website' => $buttonBlock->getRequest()->getParam('website')
24
+ );
25
+
26
+ $data1 = array(
27
+ 'label' => Mage::helper('avatax')->__('Export Logs'),
28
+ 'onclick' => 'setLocation(\''.Mage::helper('adminhtml')->getUrl("avatax/adminhtml_export/log", $params) . '\')',
29
+ 'class' => '',
30
+ );
31
+ $data2 = array(
32
+ 'label' => Mage::helper('avatax')->__('Export Queue'),
33
+ 'onclick' => 'setLocation(\''.Mage::helper('adminhtml')->getUrl("avatax/adminhtml_export/queue", $params) . '\')',
34
+ 'class' => '',
35
+ );
36
+
37
+ $html = $buttonBlock->setData($data1)->toHtml() . ' &nbsp; ';
38
+ $html .= $buttonBlock->setData($data2)->toHtml();
39
+
40
+ return $html;
41
+ }
42
+ }
app/code/community/OnePica/AvaTax/Block/Adminhtml/Tax/Class/Edit/Form.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Block_Adminhtml_Tax_Class_Edit_Form extends Mage_Adminhtml_Block_Tax_Class_Edit_Form
20
+ {
21
+
22
+ protected function _prepareForm()
23
+ {
24
+ parent::_prepareForm();
25
+ $fieldset = $this->getForm()->getElement('base_fieldset');
26
+
27
+ $model = Mage::registry('tax_class');
28
+ $fieldset->addField('op_avatax_code', 'text',
29
+ array(
30
+ 'name' => 'op_avatax_code',
31
+ 'label' => Mage::helper('avatax')->__('AvaTax Code'),
32
+ 'value' => $model->getOpAvataxCode(),
33
+ )
34
+ );
35
+
36
+ return $this;
37
+ }
38
+ }
app/code/community/OnePica/AvaTax/Block/Adminhtml/Tax/Class/Grid.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Block_Adminhtml_Tax_Class_Grid extends Mage_Adminhtml_Block_Tax_Class_Grid
20
+ {
21
+
22
+ /**
23
+ * Set the help url
24
+ *
25
+ */
26
+ public function __construct() {
27
+ $url = Mage::helper('avatax')->getDocumentationUrl();
28
+ Mage::helper('adminhtml')->setPageHelpUrl($url);
29
+
30
+ return parent::__construct();
31
+ }
32
+
33
+ protected function _prepareColumns() {
34
+ $this->addColumn('op_avatax_code',
35
+ array(
36
+ 'header' => Mage::helper('avatax')->__('AvaTax Code'),
37
+ 'align' => 'left',
38
+ 'index' => 'op_avatax_code',
39
+ 'width' => '175px'
40
+ )
41
+ );
42
+
43
+ return parent::_prepareColumns();
44
+ }
45
+
46
+ }
app/code/community/OnePica/AvaTax/Block/Checkout/Onepage/Shipping/Method/Available.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * The Onepage Shipping Method Available block
20
+ */
21
+ class OnePica_AvaTax_Block_Checkout_Onepage_Shipping_Method_Available extends Mage_Core_Block_Abstract
22
+ {
23
+ protected $_address;
24
+
25
+ public function getAddress()
26
+ {
27
+ if (empty($this->_address)) {
28
+ $this->_address = $this->getQuote()->getShippingAddress();
29
+ }
30
+ return $this->_address;
31
+ }
32
+
33
+ /**
34
+ * Retrieve checkout session model
35
+ *
36
+ * @return Mage_Checkout_Model_Session
37
+ */
38
+ public function getCheckout()
39
+ {
40
+ if (empty($this->_checkout)) {
41
+ $this->_checkout = Mage::getSingleton('checkout/session');
42
+ }
43
+ return $this->_checkout;
44
+ }
45
+
46
+ /**
47
+ * Retrieve sales quote model
48
+ *
49
+ * @return Mage_Sales_Model_Quote
50
+ */
51
+ public function getQuote()
52
+ {
53
+ if (empty($this->_quote)) {
54
+ $this->_quote = $this->getCheckout()->getQuote();
55
+ }
56
+ return $this->_quote;
57
+ }
58
+
59
+ /**
60
+ * Overriding parent to insert session message block if an address has been validated.
61
+ *
62
+ * @return string
63
+ */
64
+ protected function _toHtml ()
65
+ {
66
+ $additional = parent::_toHtml();
67
+ if ($this->getAddress()->getAddressNormalized()) {
68
+ $notice = Mage::getSingleton('avatax/config')->getConfig('onepage_normalize_message');
69
+ if ($notice) {
70
+ Mage::getSingleton('core/session')->addNotice($notice);
71
+ $additional .= $this->getMessagesBlock()->getGroupedHtml();
72
+ }
73
+ }
74
+ return $additional;
75
+ }
76
+ }
app/code/community/OnePica/AvaTax/Helper/Data.php ADDED
@@ -0,0 +1,384 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * The base AvaTax Helper class.
20
+ */
21
+ class OnePica_AvaTax_Helper_Data extends Mage_Core_Helper_Abstract
22
+ {
23
+ public function isAvataxEnabled($store = null)
24
+ {
25
+ return ($this->_getConfig('action', $store) != OnePica_AvaTax_Model_Config::ACTION_DISABLE);
26
+ }
27
+
28
+ /**
29
+ * Gets the documenation url
30
+ *
31
+ * @return string
32
+ */
33
+ public function getDocumentationUrl()
34
+ {
35
+ return 'http://www.onepica.com/magento-extensions/avatax/';
36
+ }
37
+
38
+ /**
39
+ * Loads a class from the AvaTax library.
40
+ *
41
+ * @param string $className
42
+ * @return OnePica_AvaTax_Helper_Data
43
+ */
44
+ public function loadClass ($className)
45
+ {
46
+ require_once $this->getLibPath() . DS . 'classes' . DS . $className . '.class.php';
47
+ return $this;
48
+ }
49
+
50
+ /**
51
+ * Loads an array of AvaTax classes.
52
+ *
53
+ * @param array $classes
54
+ * @return OnePica_AvaTax_Helper_Data
55
+ */
56
+ public function loadClasses (array $classes)
57
+ {
58
+ foreach ($classes as $class) {
59
+ $this->loadClass($class);
60
+ }
61
+ return $this;
62
+ }
63
+
64
+ /**
65
+ * Returns the path to the etc directory.
66
+ *
67
+ * @return string
68
+ */
69
+ public function getEtcPath ()
70
+ {
71
+ return dirname(dirname(__FILE__)) . DS . 'etc';
72
+ }
73
+
74
+ /**
75
+ * Returns the path to the AvaTax SDK lib directory.
76
+ *
77
+ * @return string
78
+ */
79
+ public function getLibPath ()
80
+ {
81
+ return Mage::getModuleDir('', 'OnePica_AvaTax') . DS . 'lib';
82
+ }
83
+
84
+ /**
85
+ * Returns the path to the AvaTax SDK WSDL directory.
86
+ *
87
+ * @return string
88
+ */
89
+ public function getWsdlPath ()
90
+ {
91
+ return $this->getLibPath() . DS . 'wsdl';
92
+ }
93
+
94
+ /**
95
+ * Returns a config value from the admin.
96
+ *
97
+ * @param string $path
98
+ * @param int $store
99
+ * @return string
100
+ */
101
+ protected function _getConfig ($path, $store = null)
102
+ {
103
+ return Mage::getSingleton('avatax/config')->getConfig($path, $store);
104
+ }
105
+
106
+ /**
107
+ * Returns the logging level
108
+ *
109
+ * @return int
110
+ */
111
+ public function getLogMode($store=null)
112
+ {
113
+ return $this->_getConfig('log_status', $store);
114
+ }
115
+
116
+ /**
117
+ * Returns shipping line item faked sku
118
+ *
119
+ * @return string
120
+ */
121
+ public function getShippingSku($store=null)
122
+ {
123
+ return $this->_getConfig('shipping_sku', $store);
124
+ }
125
+
126
+ /**
127
+ * Returns giftwraporder line item faked sku
128
+ *
129
+ * @return string
130
+ */
131
+ public function getGwOrderSku($store=null)
132
+ {
133
+ return $this->_getConfig('gw_order_sku', $store);
134
+ }
135
+
136
+ /**
137
+ * Returns giftwrapitems line item faked sku
138
+ *
139
+ * @return string
140
+ */
141
+ public function getGwItemsSku($store=null)
142
+ {
143
+ return $this->_getConfig('gw_items_sku', $store);
144
+ }
145
+
146
+ /**
147
+ * Returns giftwrapprintedcard line item faked sku
148
+ *
149
+ * @return string
150
+ */
151
+ public function getGwPrintedCardSku($store=null)
152
+ {
153
+ return $this->_getConfig('gw_printed_card_sku', $store);
154
+ }
155
+
156
+ /**
157
+ * Returns shipping line item faked sku
158
+ *
159
+ * @return string
160
+ */
161
+ public function getSalesPersonCode($store=null)
162
+ {
163
+ return $this->_getConfig('sales_person_code', $store);
164
+ }
165
+
166
+ /**
167
+ * Returns attribute code for the location code to send to Avalara
168
+ *
169
+ * @return string
170
+ */
171
+ public function getLocationCode($store=null)
172
+ {
173
+ return $this->_getConfig('location_code', $store);
174
+ }
175
+
176
+ /**
177
+ * Returns attribute code for the reference code 1 to send to Avalara
178
+ *
179
+ * @return string
180
+ */
181
+ public function getRef1AttributeCode($store=null)
182
+ {
183
+ return $this->_getConfig('line_ref1_code', $store);
184
+ }
185
+
186
+ /**
187
+ * Returns attribute code for the reference code 2 to send to Avalara
188
+ *
189
+ * @return string
190
+ */
191
+ public function getRef2AttributeCode($store=null)
192
+ {
193
+ return $this->_getConfig('line_ref2_code', $store);
194
+ }
195
+
196
+ /**
197
+ * Returns the positive adjustment identifier to send to Avalara
198
+ *
199
+ * @return string
200
+ */
201
+ public function getPositiveAdjustmentSku($store=null)
202
+ {
203
+ return $this->_getConfig('adjustment_positive_sku', $store);
204
+ }
205
+
206
+ /**
207
+ * Returns the negative adjustment identifier to send to Avalara
208
+ *
209
+ * @return string
210
+ */
211
+ public function getNegativeAdjustmentSku($store=null)
212
+ {
213
+ return $this->_getConfig('adjustment_negative_sku', $store);
214
+ }
215
+
216
+ /**
217
+ *
218
+ *
219
+ * @return string
220
+ */
221
+ public function fullStopOnError($store=null)
222
+ {
223
+ return (bool)$this->_getConfig('error_full_stop', $store);
224
+ }
225
+
226
+ /**
227
+ * Adds error message if there is an error
228
+ *
229
+ * @return string
230
+ */
231
+ public function addErrorMessage($store=null)
232
+ {
233
+ static $isMessageSet = false;
234
+ $message = $this->getErrorMessage($store);
235
+
236
+ if(Mage::app()->getStore()->isAdmin()) {
237
+ if(!$isMessageSet) Mage::getSingleton('adminhtml/session_quote')->addError($message);
238
+ } else {
239
+ if(!$isMessageSet) Mage::getSingleton('checkout/session')->addError($message);
240
+ }
241
+
242
+ $isMessageSet = true;
243
+ return $message;
244
+ }
245
+
246
+ /**
247
+ * Gets error message
248
+ *
249
+ * @return string
250
+ */
251
+ public function getErrorMessage($store=null) {
252
+ if(Mage::app()->getStore()->isAdmin()) {
253
+ return $this->_getConfig('error_backend_message', $store);
254
+ } else {
255
+ return $this->_getConfig('error_frontend_message', $store);
256
+ }
257
+ }
258
+
259
+ /**
260
+ * Does any store have this extension disabled?
261
+ *
262
+ * @return bool
263
+ */
264
+ public function isAnyStoreDisabled()
265
+ {
266
+ $disabled = false;
267
+ $storeCollection = Mage::app()->getStores();
268
+
269
+ foreach($storeCollection as $store) {
270
+ $disabled |= Mage::getStoreConfig('tax/avatax/action', $store->getId()) == OnePica_AvaTax_Model_Config::ACTION_DISABLE;
271
+ }
272
+
273
+ return $disabled;
274
+ }
275
+
276
+ /**
277
+ * Determines if address validation is enabled
278
+ *
279
+ * @param Mage_Customer_Model_Address $address
280
+ * @param int $storeId
281
+ * @return bool
282
+ */
283
+ public function isAddressValidationOn($address, $storeId) {
284
+ if(!$this->isAddressActionable($address, $storeId)) {
285
+ return false;
286
+ }
287
+ return Mage::getStoreConfig('tax/avatax/validate_address', $storeId);
288
+ }
289
+
290
+ /**
291
+ * Determines if address normalization is enabled
292
+ *
293
+ * @param Mage_Customer_Model_Address $address
294
+ * @param int $storeId
295
+ * @return bool
296
+ */
297
+ public function isAddressNormalizationOn($address, $storeId) {
298
+ if(!$this->isAddressActionable($address, $storeId)) {
299
+ return false;
300
+ }
301
+ return Mage::getStoreConfig('tax/avatax/normalize_address', $storeId);
302
+ }
303
+
304
+ /**
305
+ * Determines if the address should be filtered
306
+ *
307
+ * @param Mage_Customer_Model_Address
308
+ * @param int $storeId
309
+ * @return bool
310
+ */
311
+ public function isAddressActionable($address, $storeId, $filterMode = OnePica_AvaTax_Model_Config::REGIONFILTER_ALL) {
312
+ $filter = false;
313
+
314
+ if(Mage::getStoreConfig('tax/avatax/action', $storeId) == OnePica_AvaTax_Model_Config::ACTION_DISABLE) {
315
+ return false;
316
+ }
317
+
318
+ if(Mage::getStoreConfig('tax/avatax/region_filter_mode', $storeId) >= $filterMode) {
319
+ $regionFilters = explode(',', Mage::getStoreConfig('tax/avatax/region_filter_list', $storeId));
320
+ if(!in_array($address->getRegionId(), $regionFilters)) {
321
+ $filter = 'region';
322
+ }
323
+ }
324
+
325
+ $countryFilters = explode(',', Mage::getStoreConfig('tax/avatax/country_filter_list', $storeId));
326
+ if(!in_array($address->getCountryId(), $countryFilters)) {
327
+ $filter = 'country';
328
+ }
329
+
330
+ if($filter && $this->getLogMode($storeId)) {
331
+ $filterLog = Mage::getSingleton('avatax/session')->getFilterLog();
332
+ if(!is_array($filterLog)) $filterLog = array();
333
+ $key = $address->getCacheHashKey();
334
+
335
+ //did we already log this filtered address?
336
+ if(!in_array($key, $filterLog)) {
337
+ $filterLog[] = $key;
338
+ Mage::getSingleton('avatax/session')->setFilterLog($filterLog);
339
+
340
+ $type = ($filterMode == OnePica_AvaTax_Model_Config::REGIONFILTER_TAX) ? 'tax_calc' : 'tax_calc|address_opts';
341
+ Mage::getModel('avatax_records/log')
342
+ ->setStoreId($storeId)
343
+ ->setLevel('Success')
344
+ ->setType('Filter')
345
+ ->setRequest(print_r($address->debug(), true))
346
+ ->setResult('filter: ' . $filter . ', type: ' . $type)
347
+ ->save();
348
+ }
349
+ }
350
+
351
+ return $filter ? false : true;
352
+ }
353
+
354
+ /**
355
+ * Determines if the object (quote, invoice, or credit memo) should use AvaTax services
356
+ *
357
+ * @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo
358
+ * @param Mage_Sales_Model_Quote_Address
359
+ * @return bool
360
+ */
361
+ public function isObjectActionable($object, $shippingAddress=null) {
362
+ $storeId = $object->getStore()->getId();
363
+
364
+ //is action enabled?
365
+ $action = $object->getOrder() ? OnePica_AvaTax_Model_Config::ACTION_CALC_SUBMIT : OnePica_AvaTax_Model_Config::ACTION_CALC;
366
+ if(Mage::getStoreConfig('tax/avatax/action', $storeId) < $action) {
367
+ return false;
368
+ }
369
+
370
+ if(!$shippingAddress) {
371
+ $shippingAddress = $object->getShippingAddress();
372
+ }
373
+ if(!$shippingAddress) {
374
+ $shippingAddress = $object->getBillingAddress();
375
+ }
376
+
377
+ //is the region filtered?
378
+ if(!$this->isAddressActionable($shippingAddress, $storeId, OnePica_AvaTax_Model_Config::REGIONFILTER_TAX)) {
379
+ return false;
380
+ }
381
+
382
+ return true;
383
+ }
384
+ }
app/code/community/OnePica/AvaTax/Helper/Tax/Data.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ /**
20
+ * Catalog data helper
21
+ */
22
+ class OnePica_AvaTax_Helper_Tax_Data extends Mage_Tax_Helper_Data
23
+ {
24
+ /**
25
+ * Items should not include tax so that AvaTax can calculate it
26
+ *
27
+ * @return bool
28
+ */
29
+ public function priceIncludesTax($store = null)
30
+ {
31
+ if (Mage::helper('avatax')->isAvataxEnabled($store)) {
32
+ return false;
33
+ }
34
+ return parent::priceIncludesTax($store);
35
+ }
36
+
37
+ /**
38
+ * Shipping should not include tax so that AvaTax can calculate it
39
+ *
40
+ * @return bool
41
+ */
42
+ public function shippingPriceIncludesTax($store = null)
43
+ {
44
+ if (Mage::helper('avatax')->isAvataxEnabled($store)) {
45
+ return false;
46
+ }
47
+ return parent::shippingPriceIncludesTax($store);
48
+ }
49
+
50
+ /**
51
+ * Returns AvaTax's hard-coded shipping tax class
52
+ *
53
+ * @return string
54
+ */
55
+ public function getShippingTaxClass($store)
56
+ {
57
+ if (Mage::helper('avatax')->isAvataxEnabled($store)) {
58
+ return 'FR020100';
59
+ }
60
+ return parent::getShippingTaxClass($store);
61
+ }
62
+
63
+ /**
64
+ * AvaTax always computes tax based on ship from and ship to addresses
65
+ *
66
+ * @return string
67
+ */
68
+ public function getTaxBasedOn($store = null)
69
+ {
70
+ if (Mage::helper('avatax')->isAvataxEnabled($store)) {
71
+ return 'shipping';
72
+ }
73
+ return parent::getTaxBasedOn($store);
74
+ }
75
+
76
+ /**
77
+ * Always apply tax on custom price
78
+ *
79
+ * @return bool
80
+ */
81
+ public function applyTaxOnCustomPrice($store = null) {
82
+ if (Mage::helper('avatax')->isAvataxEnabled($store)) {
83
+ return true;
84
+ }
85
+ return parent::applyTaxOnCustomPrice($store);
86
+ }
87
+
88
+ /**
89
+ * Always apply tax on custom price (not original)
90
+ *
91
+ * @return bool
92
+ */
93
+ public function applyTaxOnOriginalPrice($store = null) {
94
+ if (Mage::helper('avatax')->isAvataxEnabled($store)) {
95
+ return false;
96
+ }
97
+ return parent::applyTaxOnOriginalPrice($store);
98
+ }
99
+
100
+ /**
101
+ * Always apply discount first since AvaTax doesn't support line-level item discount amounts
102
+ *
103
+ * @return bool
104
+ */
105
+ public function applyTaxAfterDiscount($store = null) {
106
+ if (Mage::helper('avatax')->isAvataxEnabled($store)) {
107
+ return true;
108
+ }
109
+ return parent::applyTaxAfterDiscount($store);
110
+ }
111
+
112
+ /**
113
+ * Always apply discount first since AvaTax doesn't support line-level item discount amounts
114
+ *
115
+ * @return bool
116
+ */
117
+ public function discountTax($store = null) {
118
+ if (Mage::helper('avatax')->isAvataxEnabled($store)) {
119
+ return false;
120
+ }
121
+ return parent::discountTax($store);
122
+ }
123
+
124
+ }
app/code/community/OnePica/AvaTax/Model/Abstract.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * The abstract base AvaTax model.
20
+ */
21
+ abstract class OnePica_AvaTax_Model_Abstract extends Varien_Object
22
+ {
23
+ /**
24
+ * The module helper
25
+ *
26
+ * @var OnePica_AvaTax_Helper_Data
27
+ */
28
+ protected $_helper = null;
29
+
30
+ /**
31
+ * Constructor
32
+ *
33
+ * @return null
34
+ */
35
+ protected function _construct ()
36
+ {
37
+ Mage::getSingleton('avatax/config');
38
+ }
39
+
40
+ /**
41
+ * Logs a debug message
42
+ *
43
+ * @param string $request the request string
44
+ * @param string $result the result string
45
+ * @param int $storeId id of the store the call is make for
46
+ * @param mixed $additional any other info
47
+ */
48
+ protected function _log ($request, $result, $storeId=null, $additional=null)
49
+ {
50
+ if($result->getResultCode() == SeverityLevel::$Success) {
51
+ switch(Mage::helper('avatax')->getLogMode($storeId)) {
52
+ case OnePica_AvaTax_Model_Source_Logmode::ERRORS:
53
+ return;
54
+ break;
55
+ case OnePica_AvaTax_Model_Source_Logmode::NORMAL:
56
+ $additional = null;
57
+ break;
58
+ }
59
+ }
60
+
61
+ $requestType = str_replace('Request', '', get_class($request));
62
+ $resultType = str_replace('Result', '', get_class($result));
63
+ $type = $requestType ? $requestType : $resultType;
64
+ if($type == 'Varien_Object') $type = 'Unknown';
65
+
66
+ Mage::getModel('avatax_records/log')
67
+ ->setStoreId($storeId)
68
+ ->setLevel($result->getResultCode())
69
+ ->setType($type)
70
+ ->setRequest(print_r($request, true))
71
+ ->setResult(print_r($result, true))
72
+ ->setAdditional($additional)
73
+ ->save();
74
+ }
75
+
76
+ /**
77
+ * Returns the AvaTax session.
78
+ *
79
+ * @return OnePica_AvaTax_Model_Session
80
+ */
81
+ public function getSession ()
82
+ {
83
+ return Mage::getSingleton('avatax/session');
84
+ }
85
+
86
+ /**
87
+ * Returns the AvaTax helper.
88
+ *
89
+ * @return OnePica_AvaTax_Helper_Data
90
+ */
91
+ public function getHelper ()
92
+ {
93
+ if (!$this->_helper) {
94
+ $this->_helper = Mage::helper('avatax');
95
+ }
96
+ return $this->_helper;
97
+ }
98
+
99
+ /**
100
+ * Alias to the helper translate method.
101
+ *
102
+ * @param string $message
103
+ * @param string var number of replacement vars
104
+ * @return string
105
+ */
106
+ public function __ ($message)
107
+ {
108
+ $args = func_get_args();
109
+ return call_user_func_array(array($this->getHelper(), '__'), $args);
110
+ }
111
+ }
app/code/community/OnePica/AvaTax/Model/Admin/Session.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Model_Admin_Session extends Mage_Admin_Model_Session
20
+ {
21
+
22
+ /**
23
+ * Check current user permission on resource and privilege
24
+ *
25
+ * Mage::getSingleton('admin/session')->isAllowed('admin/catalog')
26
+ * Mage::getSingleton('admin/session')->isAllowed('catalog')
27
+ *
28
+ * @param string $resource
29
+ * @param string $privilege
30
+ * @return boolean
31
+ */
32
+ public function isAllowed($resource, $privilege=null)
33
+ {
34
+ $block = array(
35
+ 'admin/sales/tax/rules',
36
+ 'admin/sales/tax/rates',
37
+ 'admin/sales/tax/import_export'
38
+ );
39
+
40
+ if(in_array($resource, $block) && !Mage::helper('avatax')->isAnyStoreDisabled()) {
41
+ return false;
42
+ } else {
43
+ return parent::isAllowed($resource, $privilege);
44
+ }
45
+ }
46
+ }
app/code/community/OnePica/AvaTax/Model/Adminhtml/Config.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Model_Adminhtml_Config extends Mage_Adminhtml_Model_Config
20
+ {
21
+
22
+ protected function _initSectionsAndTabs() {
23
+ if(Mage::helper('avatax')->isAnyStoreDisabled()) {
24
+ $mergeConfig = Mage::getModel('core/config_base');
25
+ $config = Mage::getConfig()->loadModulesConfiguration('system.xml');
26
+
27
+ //these 4 lines are the only added content
28
+ $configFile = Mage::helper('avatax')->getEtcPath() . DS . 'system-disabled.xml';
29
+ $mergeModel = new Mage_Core_Model_Config_Base();
30
+ $mergeModel->loadFile($configFile);
31
+ $config = $config->extend($mergeModel, true);
32
+
33
+ $this->_sections = $config->getNode('sections');
34
+ $this->_tabs = $config->getNode('tabs');
35
+ } else {
36
+ return parent::_initSectionsAndTabs();
37
+ }
38
+ }
39
+
40
+ }
app/code/community/OnePica/AvaTax/Model/Adminhtml/Sales/Order/Create.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * The Admin Sales Order Create model.
20
+ */
21
+ class OnePica_AvaTax_Model_Adminhtml_Sales_Order_Create extends Mage_Adminhtml_Model_Sales_Order_Create
22
+ {
23
+ /**
24
+ * If a session message has been added.
25
+ *
26
+ * @var bool
27
+ */
28
+ protected $_messageAdded = false;
29
+
30
+ /**
31
+ * Overrides the parent to validate the shipping address.
32
+ *
33
+ * @param array $address
34
+ * @return OnePica_AvaTax_Model_Adminhtml_Sales_Order_Create
35
+ */
36
+ public function setShippingAddress($address)
37
+ {
38
+ parent::setShippingAddress($address);
39
+
40
+ if (Mage::helper('avatax')->isAvataxEnabled()) {
41
+ if (!Mage::app()->getFrontController()->getRequest()->getParam('isAjax')) {
42
+ $result = $this->getShippingAddress()->validate();
43
+ if ($result !== true) {
44
+ $storeId = $this->_session->getStore()->getId();
45
+ if(Mage::helper('avatax')->fullStopOnError($storeId)) {
46
+ foreach ($result as $error) {
47
+ $this->getSession()->addError($error);
48
+ }
49
+ Mage::throwException('');
50
+ }
51
+ }
52
+ else if ($this->getShippingAddress()->getAddressNormalized() && !$this->_messageAdded) {
53
+ Mage::getSingleton('avatax/session')->addNotice(Mage::helper('avatax')->__('The shipping address has been modified during the validation process. Please confirm the address below is accurate.'));
54
+ $this->_messageAdded = true; // only add the message once
55
+ }
56
+ }
57
+ }
58
+ return $this;
59
+ }
60
+ }
app/code/community/OnePica/AvaTax/Model/Avatax/Abstract.php ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ abstract class OnePica_AvaTax_Model_Avatax_Abstract extends OnePica_AvaTax_Model_Abstract
20
+ {
21
+
22
+ /**
23
+ * Flag that states if there was an error
24
+ *
25
+ * @var bool
26
+ */
27
+ protected static $_hasError = false;
28
+
29
+ /**
30
+ * The request data object
31
+ *
32
+ * @var mixed
33
+ */
34
+ protected $_request = null;
35
+
36
+ /**
37
+ * Sets the company code on the request
38
+ *
39
+ * @return null
40
+ */
41
+ protected function _setCompanyCode($storeId=null) {
42
+ $config = Mage::getSingleton('avatax/config');
43
+ $this->_request->setCompanyCode($config->getCompanyCode($storeId));
44
+ }
45
+
46
+ /**
47
+ * Sends a request to the Avatax server
48
+ *
49
+ * @param int $storeId
50
+ * @return mixed
51
+ */
52
+ protected function _send($storeId) {
53
+ $config = Mage::getSingleton('avatax/config')->init($storeId);
54
+ $connection = $config->getTaxConnection();
55
+ $result = null;
56
+ $message = null;
57
+
58
+ try { $result = $connection->getTax($this->_request); }
59
+ catch(Exception $exception) { $message = $exception->getMessage(); }
60
+
61
+ if(!isset($result) || !is_object($result) || !$result->getResultCode()) {
62
+ $result = Mage::getModel('Varien_Object')
63
+ ->setResultCode(SeverityLevel::$Exception)
64
+ ->setActualResult($result)
65
+ ->setMessage($message);
66
+ }
67
+
68
+ $this->_log($this->_request, $result, $storeId, $connection);
69
+
70
+ if($result->getResultCode() != SeverityLevel::$Success) {
71
+ self::$_hasError = true;
72
+ if(Mage::helper('avatax')->fullStopOnError($storeId)) {
73
+ Mage::helper('avatax')->addErrorMessage($storeId);
74
+ }
75
+ }
76
+
77
+ return $result;
78
+ }
79
+
80
+ /**
81
+ * Adds additional transaction based data
82
+ *
83
+ * @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
84
+ */
85
+ protected function _addGeneralInfo($object) {
86
+ $storeId = $object->getStoreId();
87
+ $this->_setCompanyCode($storeId);
88
+ $this->_request->setDetailLevel(DetailLevel::$Document);
89
+ $this->_request->setDocDate(date('Y-m-d'));
90
+ $this->_request->setExemptionNo('');
91
+ $this->_request->setDiscount(0.00); //cannot be used in Magento
92
+ $this->_request->setSalespersonCode(Mage::helper('avatax')->getSalesPersonCode($storeId));
93
+ $this->_request->setLocationCode(Mage::helper('avatax')->getLocationCode($storeId));
94
+ $this->_addCustomer($object);
95
+ if($object instanceof Mage_Sales_Model_Order && $object->getIncrementId()) {
96
+ $this->_request->setReferenceCode('Magento Order #' . $object->getIncrementId());
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Sets the customer info if available
102
+ *
103
+ * @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
104
+ */
105
+ protected function _addCustomer($object) {
106
+ $format = Mage::getStoreConfig('tax/avatax/cust_code_format', $object->getStoreId());
107
+ $customer = Mage::getModel('customer/customer');
108
+ $customerCode = '';
109
+
110
+ if($object->getCustomerId()) {
111
+ $customer->load($object->getCustomerId());
112
+ $taxClass = Mage::getModel('tax/class')->load($customer->getTaxClassId())->getOpAvataxCode();
113
+ $this->_request->setCustomerUsageType($taxClass);
114
+ }
115
+
116
+ switch($format) {
117
+ case OnePica_AvaTax_Model_Source_Customercodeformat::LEGACY:
118
+ if($customer->getId()) {
119
+ $customerCode = $customer->getName() . ' (' . $customer->getId() . ')';
120
+ } else {
121
+ $address = $object->getBillingAddress() ? $object->getBillingAddress() : $object;
122
+ $customerCode = $address->getFirstname() . ' ' . $address->getLastname() . ' (Guest)';
123
+ }
124
+ break;
125
+
126
+ case OnePica_AvaTax_Model_Source_Customercodeformat::CUST_EMAIL:
127
+ $customerCode = $object->getCustomerEmail() ? $object->getCustomerEmail() : $customer->getEmail();
128
+ break;
129
+
130
+ case OnePica_AvaTax_Model_Source_Customercodeformat::CUST_ID:
131
+ default:
132
+ $customerCode = $object->getCustomerId() ? $object->getCustomerId() : 'guest-'.$object->getId();
133
+ break;
134
+ }
135
+
136
+ $this->_request->setCustomerCode($customerCode);
137
+ }
138
+
139
+ /**
140
+ * Adds the orgin address to the request
141
+ *
142
+ * @return Address
143
+ */
144
+ protected function _setOriginAddress($store=null) {
145
+ $country = Mage::getStoreConfig('shipping/origin/country_id', $store);
146
+ $zip = Mage::getStoreConfig('shipping/origin/postcode', $store);
147
+ $regionId = Mage::getStoreConfig('shipping/origin/region_id', $store);
148
+ $state = Mage::getModel('directory/region')->load($regionId)->getCode();
149
+ $city = Mage::getStoreConfig('shipping/origin/city', $store);
150
+ $street = Mage::getStoreConfig('shipping/origin/street', $store);
151
+ $address = $this->_newAddress($street, '', $city, $state, $zip, $country);
152
+ return $this->_request->setOriginAddress($address);
153
+ }
154
+
155
+ /**
156
+ * Adds the shipping address to the request
157
+ *
158
+ * @param Address
159
+ * @return bool
160
+ */
161
+ protected function _setDestinationAddress($address) {
162
+ //$shippingAddress = $quote->getShippingAddress();
163
+ $street = $address->getStreet();
164
+ $street1 = isset($street[0]) ? $street[0] : null;
165
+ $street2 = isset($street[1]) ? $street[1] : null;
166
+ $city = $address->getCity();
167
+ $zip = preg_replace('/[^0-9\-]*/', '', $address->getPostcode());
168
+ $state = Mage::getModel('directory/region')->load($address->getRegionId())->getCode();
169
+ $country = $address->getCountry();
170
+
171
+ if(($city && $state) || $zip) {
172
+ $address = $this->_newAddress($street1, $street2, $city, $state, $zip, $country);
173
+ return $this->_request->setDestinationAddress($address);
174
+ } else {
175
+ return false;
176
+ }
177
+ }
178
+
179
+ /**
180
+ * Generic address maker
181
+ *
182
+ * @param string $line1
183
+ * @param string $line2
184
+ * @param string $city
185
+ * @param string $state
186
+ * @param string $zip
187
+ * @param string $country
188
+ * @return Address
189
+ */
190
+ protected function _newAddress($line1, $line2, $city, $state, $zip, $country='USA') {
191
+ $address = new Address();
192
+ $address->setLine1($line1);
193
+ $address->setLine2($line2);
194
+ $address->setCity($city);
195
+ $address->setRegion($state);
196
+ $address->setPostalCode($zip);
197
+ $address->setCountry($country);
198
+ return $address;
199
+ }
200
+
201
+ /**
202
+ * Test to see if the product carries its own numbers or is calculated based on parent or children
203
+ *
204
+ * @param Mage_Sales_Model_Quote_Item|Mage_Sales_Model_Order_Item|mixed $item
205
+ * @return bool
206
+ */
207
+ public function isProductCalculated($item) {
208
+ try {
209
+ if($item->isChildrenCalculated() && !$item->getParentItem()) {
210
+ return true;
211
+ }
212
+ if(!$item->isChildrenCalculated() && $item->getParentItem()) {
213
+ return true;
214
+ }
215
+ } catch(Exception $e) { }
216
+ return false;
217
+ }
218
+
219
+ /**
220
+ * Adds a comment to order history. Method choosen based on Magento version.
221
+ *
222
+ * @param Mage_Sales_Model_Order
223
+ * @param string
224
+ * @return self
225
+ */
226
+ protected function _addStatusHistoryComment($order, $comment) {
227
+ if(method_exists($order, 'addStatusHistoryComment')) {
228
+ $order->addStatusHistoryComment($comment)->save();;
229
+ } elseif(method_exists($order, 'addStatusToHistory')) {
230
+ $order->addStatusToHistory($order->getStatus(), $comment, false)->save();;
231
+ }
232
+ return $this;
233
+ }
234
+ }
app/code/community/OnePica/AvaTax/Model/Avatax/Address.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * The AvaTax Address Validator model.
20
+ */
21
+ class OnePica_AvaTax_Model_Avatax_Address extends OnePica_AvaTax_Model_Abstract
22
+ {
23
+ /**
24
+ * An array of previously checked addresses
25
+ * Example: $_cache[$key] = serialize($resultObjectFromAvalara)
26
+ *
27
+ * @var array
28
+ */
29
+ protected $_cache = array();
30
+
31
+ /**
32
+ * The Mage Address object
33
+ *
34
+ * @var Mage_Customer_Model_Address_Abstract
35
+ */
36
+ protected $_mageAddress = null;
37
+
38
+ /**
39
+ * The AvaTax Request Address object.
40
+ * This is a Ava address copy of the Mage address attributes.
41
+ *
42
+ * @var Address
43
+ */
44
+ protected $_requestAddress = null;
45
+
46
+ /**
47
+ * The AvaTax Response (Normalized) Address object.
48
+ * This is the normalized Ava address returned by the validation request.
49
+ *
50
+ * @var ValidAddress
51
+ */
52
+ protected $_responseAddress = null;
53
+
54
+ /**
55
+ * Saves the store id
56
+ *
57
+ * @var int
58
+ */
59
+ protected $_storeId = null;
60
+
61
+ /**
62
+ * Loads any saved addresses in session
63
+ *
64
+ */
65
+ public function __construct() {
66
+ $addresses = Mage::getSingleton('avatax/session')->getAddresses();
67
+ if(is_array($addresses)) {
68
+ $this->_cache = $addresses;
69
+ }
70
+ parent::__construct();
71
+ }
72
+
73
+ /**
74
+ * Saves any current addresses to session
75
+ *
76
+ */
77
+ public function __destruct() {
78
+ Mage::getSingleton('avatax/session')->setAddresses($this->_cache);
79
+
80
+ if(method_exists(get_parent_class(), '__destruct')) {
81
+ parent::__destruct();
82
+ }
83
+ }
84
+
85
+ /**
86
+ * Sets the Mage address.
87
+ *
88
+ * @return OnePica_AvaTax_Model_Validate_Address
89
+ */
90
+ public function setAddress (Mage_Customer_Model_Address_Abstract $address)
91
+ {
92
+ $this->_storeId = Mage::app()->getStore()->getId();
93
+ $this->_mageAddress = $address;
94
+ $this->_convertRequestAddress();
95
+ return $this;
96
+ }
97
+
98
+ /**
99
+ * Sets attributes from the Mage address on the AvaTax Request address.
100
+ *
101
+ * @return OnePica_AvaTax_Model_Validate_Address
102
+ */
103
+ protected function _convertRequestAddress ()
104
+ {
105
+ if (!$this->_requestAddress) {
106
+ $this->_requestAddress = new Address();
107
+ }
108
+ $this->_requestAddress->setLine1($this->_mageAddress->getStreet(1));
109
+ $this->_requestAddress->setLine2($this->_mageAddress->getStreet(2));
110
+ $this->_requestAddress->setCity($this->_mageAddress->getCity());
111
+ $this->_requestAddress->setRegion($this->_mageAddress->getRegionCode());
112
+ $this->_requestAddress->setCountry($this->_mageAddress->getCountry());
113
+ $this->_requestAddress->setPostalCode($this->_mageAddress->getPostcode());
114
+
115
+ return $this;
116
+ }
117
+
118
+ /**
119
+ * Sets attributes from the AvaTax Response address on the Mage address.
120
+ *
121
+ * @return OnePica_AvaTax_Model_Validate_Address
122
+ */
123
+ protected function _convertResponseAddress ()
124
+ {
125
+ $street = array($this->_responseAddress->getLine1(), $this->_responseAddress->getLine2());
126
+ $region = Mage::getModel('directory/region')->loadByCode($this->_responseAddress->getRegion(), $this->_mageAddress->getCountryId());
127
+
128
+ $this->_mageAddress->setStreet($street)
129
+ ->setCity($this->_responseAddress->getCity())
130
+ ->setRegionId($region->getId())
131
+ ->setPostcode($this->_responseAddress->getPostalCode())
132
+ ->setCountryId($this->_responseAddress->getCountry())
133
+ ->save()
134
+ ->setAddressNormalized(true);
135
+ return $this;
136
+ }
137
+
138
+ /**
139
+ * Validates the address with the AvaTax validation API.
140
+ * Returns true on success and an array with an error on failure.
141
+ *
142
+ * @return true|array
143
+ */
144
+ public function validate () {
145
+ if (!$this->_mageAddress) {
146
+ throw new OnePica_AvaTax_Model_Avatax_Address_Exception($this->__('An address must be set before validation.'));
147
+ }
148
+
149
+ $config = Mage::getSingleton('avatax/config')->init($this->_storeId);
150
+ $isAddressValidationOn = Mage::helper('avatax')->isAddressValidationOn($this->_mageAddress, $this->_storeId);
151
+ $isAddressNormalizationOn = Mage::helper('avatax')->isAddressNormalizationOn($this->_mageAddress, $this->_storeId);
152
+ $isQuoteActionable = Mage::helper('avatax')->isObjectActionable($this->_mageAddress->getQuote(), $this->_mageAddress);
153
+
154
+ //if there is no use cases for AvaTax services, return address as valid without doing a lookup
155
+ if(!$isAddressValidationOn && !$isAddressNormalizationOn && !$isQuoteActionable) {
156
+ return true;
157
+ }
158
+
159
+ //lookup in AvaTax (with caching)
160
+ $key = $this->_mageAddress->getCacheHashKey();
161
+ if (array_key_exists($key, $this->_cache)) {
162
+ $result = unserialize($this->_cache[$key]);
163
+ } else {
164
+ $client = $config->getAddressConnection();
165
+ $request = new ValidateRequest($this->_requestAddress, TextCase::$Mixed, 0);
166
+ $request->setTaxability(true);
167
+ $result = $client->Validate($request);
168
+ $this->_log($request, $result, $this->_storeId, $client);
169
+ $this->_cache[$key] = serialize($result);
170
+ }
171
+
172
+ //normalization
173
+ if ($isAddressNormalizationOn && $result->getResultCode() == SeverityLevel::$Success) {
174
+ $responseAddress = $result->getValidAddresses();
175
+ $responseAddress = array_pop($responseAddress);
176
+ if ($responseAddress instanceof ValidAddress) {
177
+ $this->_responseAddress = $responseAddress;
178
+ $this->_convertResponseAddress();
179
+ } else {
180
+ throw new OnePica_AvaTax_Model_Avatax_Address_Exception($this->__('Invalid response address type.'));
181
+ }
182
+ }
183
+
184
+ //validation
185
+ if($isAddressValidationOn) {
186
+ if($result->getResultCode() == SeverityLevel::$Success) {
187
+ $this->_mageAddress->setAddressValidated(true);
188
+ return true;
189
+ } else {
190
+ $errors = array();
191
+ foreach ($result->getMessages() as $message) {
192
+ $errors[] = $this->__($message->getSummary());
193
+ }
194
+ return $errors;
195
+ }
196
+
197
+ //a valid address isn't required, but Avalara has to say there is
198
+ //enough info to drill down to a tax jurisdiction to calc on
199
+ } elseif(!$isAddressValidationOn && $isQuoteActionable) {
200
+ if($result->isTaxable()) {
201
+ $this->_mageAddress->setAddressValidated(true);
202
+ return true;
203
+ } else {
204
+ $errors = array();
205
+ foreach ($result->getMessages() as $message) {
206
+ $errors[] = $this->__($message->getSummary());
207
+ }
208
+ return $errors;
209
+ }
210
+ }
211
+
212
+ return true;
213
+ }
214
+ }
app/code/community/OnePica/AvaTax/Model/Avatax/Estimate.php ADDED
@@ -0,0 +1,420 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * OnePica_AvaTax
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0), a
9
+ * copy of which is available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category OnePica
13
+ * @package OnePica_AvaTax
14
+ * @author OnePica Codemaster <codemaster@onepica.com>
15
+ * @copyright Copyright (c) 2009 One Pica, Inc.
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+ class OnePica_AvaTax_Model_Avatax_Estimate extends OnePica_AvaTax_Model_Avatax_Abstract {
19
+ /**
20
+ * Length of time in minutes for cached rates
21
+ *
22
+ * @var int
23
+ */
24
+ const CACHE_TTL = 120;
25
+
26
+ /**
27
+ * An array of rates that acts as a cache
28
+ * Example: $_rates[$cachekey] = array(
29
+ * 'timestamp' => 1325015952
30
+ * 'summary' => array(
31
+ * array('name'=>'NY STATE TAX', 'rate'=>4, 'amt'=>6),
32
+ * array('name'=>'NY CITY TAX', 'rate'=>4.50, 'amt'=>6.75),
33
+ * array('name'=>'NY SPECIAL TAX', 'rate'=>4.375, 'amt'=>0.56)
34
+ * ),
35
+ * 'items' => array(
36
+ * 5 => array('rate'=>8.875, 'amt'=>13.31),
37
+ * 'Shipping' => array('rate'=>0, 'amt'=>0)
38
+ * )
39
+ * )
40
+ *
41
+ * @var array
42
+ */
43
+ protected $_rates = array();
44
+
45
+ /**
46
+ * An array of line items
47
+ *
48
+ * @var array
49
+ */
50
+ protected $_lines = array();
51
+
52
+ /**
53
+ * An array of line numbers to quote item ids
54
+ *
55
+ * @var array
56
+ */
57
+ protected $_lineToLineId = array();
58
+
59
+ /**
60
+ * Loads any saved rates in session
61
+ *
62
+ */
63
+ protected function _construct() {
64
+ $rates = Mage::getSingleton('avatax/session')->getRates();
65
+ if (is_array($rates)) {
66
+ foreach ($rates as $key => $rate) {
67
+ if ($rate['timestamp'] < strtotime('-' . self::CACHE_TTL . ' minutes')) {
68
+ unset($rates[$key]);
69
+ }
70
+ }
71
+ $this->_rates = $rates;
72
+ }
73
+ return parent::_construct();
74
+ }
75
+
76
+ /**
77
+ * Estimates tax rate for one item.
78
+ *
79
+ * @param Varien_Object $item
80
+ * @return int
81
+ */
82
+ public function getItemRate($item) {
83
+ if ($this->isProductCalculated($item)) {
84
+ return 0;
85
+ } else {
86
+ $key = $this->_getRates($item);
87
+ $id = $item->getId();
88
+ return isset($this->_rates[$key]['items'][$id]['rate']) ? $this->_rates[$key]['items'][$id]['rate'] : 0;
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Estimates tax amount for one item.
94
+ *
95
+ * @param Varien_Object $data
96
+ * @return int
97
+ */
98
+ public function getItemTax($item) {
99
+ if ($this->isProductCalculated($item)) {
100
+ $tax = 0;
101
+ foreach ($item->getChildren() as $child) {
102
+ $tax += $this->getItemTax($child);
103
+ }
104
+ return $tax;
105
+ } else {
106
+ $key = $this->_getRates($item);
107
+ $id = $item->getId();
108
+ return isset($this->_rates[$key]['items'][$id]['amt']) ? $this->_rates[$key]['items'][$id]['amt'] : 0;
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Get tax detail summary
114
+ *
115
+ * @return array
116
+ */
117
+ public function getSummary($addressId=null) {
118
+ $summary = null;
119
+
120
+ if ($addressId) {
121
+ $timestamp = 0;
122
+ foreach ($this->_rates as $row) {
123
+ if (isset($row['address_id']) && $row['address_id'] == $addressId && $row['timestamp'] > $timestamp) {
124
+ $summary = $row['summary'];
125
+ $timestamp = $row['timestamp'];
126
+ }
127
+ }
128
+ }
129
+
130
+ if (is_null($summary)) {
131
+ $requestKey = Mage::getSingleton('avatax/session')->getLastRequestKey();
132
+ $summary = isset($this->_rates[$requestKey]['summary']) ? $this->_rates[$requestKey]['summary'] : array();
133
+ }
134
+
135
+ return $summary;
136
+ }
137
+
138
+ /**
139
+ * Get rates from Avalara
140
+ *
141
+ * @param Varien_Object $data
142
+ * @return string
143
+ */
144
+ protected function _getRates($item) {
145
+ if (self::$_hasError) {
146
+ return 'error';
147
+ }
148
+
149
+ $address = $item->getAddress();
150
+ $this->_lines = array();
151
+
152
+ //set up request
153
+ $this->_request = new GetTaxRequest();
154
+ $this->_request->setDocType(DocumentType::$SalesOrder);
155
+ $this->_request->setDocCode('quote-' . $address->getId());
156
+ $this->_addGeneralInfo($address);
157
+ $this->_setOriginAddress($address->getStoreId());
158
+ $this->_setDestinationAddress($address);
159
+ $this->_request->setDetailLevel(DetailLevel::$Line);
160
+ $this->_addCustomer($address);
161
+ $this->_addItemsInCart($item);
162
+ $this->_addShipping($address);
163
+ //Added code for calculating tax for giftwrap items
164
+ $this->_addGwOrderAmount($address);
165
+ $this->_addGwItemsAmount($address);
166
+ $this->_addGwPrintedCardAmount($address);
167
+ //check to see if we can/need to make the request to Avalara
168
+ $requestKey = $this->_genRequestKey();
169
+ $makeRequest = !isset($this->_rates[$requestKey]['items'][$item->getId()]);
170
+ $makeRequest &= count($this->_lineToLineId) ? true : false;
171
+ $makeRequest &= $this->_request->getDestinationAddress() == '' ? false : true;
172
+ $makeRequest &= $address->getId() ? true : false;
173
+
174
+ //make request if needed and save results in cache
175
+ if ($makeRequest) {
176
+ $result = $this->_send($address->getStoreId());
177
+
178
+ //success
179
+ if ($result->getResultCode() == SeverityLevel::$Success) {
180
+ $this->_rates[$requestKey] = array(
181
+ 'timestamp' => time(),
182
+ 'address_id' => $address->getId(),
183
+ 'summary' => array(),
184
+ 'items' => array()
185
+ );
186
+
187
+ foreach ($result->getTaxLines() as $ctl) {
188
+ $id = $this->_lineToLineId[$ctl->getNo()];
189
+ $this->_rates[$requestKey]['items'][$id] = array(
190
+ 'rate' => ($ctl->getTax() ? $ctl->getRate() : 0) * 100,
191
+ 'amt' => $ctl->getTax()
192
+ );
193
+ }
194
+
195
+ foreach ($result->getTaxSummary() as $row) {
196
+ $this->_rates[$requestKey]['summary'][] = array(
197
+ 'name' => $row->getTaxName(),
198
+ 'rate' => $row->getRate() * 100,
199
+ 'amt' => $row->getTax()
200
+ );
201
+ }
202
+
203
+ //failure
204
+ } else {
205
+ if (Mage::helper('avatax')->fullStopOnError($address->getStoreId())) {
206
+ $address->getQuote()->setHasError(true);
207
+ }
208
+ }
209
+
210
+ Mage::getSingleton('avatax/session')->setRates($this->_rates);
211
+ }
212
+
213
+ //return $requestKey so it doesn't have to be calculated again
214
+ return $requestKey;
215
+ }
216
+
217
+ /**
218
+ * Generates a hash key for the exact request
219
+ *
220
+ * @return string
221
+ */
222
+ protected function _genRequestKey() {
223
+ $hash = sprintf("%u", crc32(serialize($this->_request)));
224
+ Mage::getSingleton('avatax/session')->setLastRequestKey($hash);
225
+ return $hash;
226
+ }
227
+
228
+ /**
229
+ * Adds shipping cost to request as item
230
+ *
231
+ * @param Mage_Sales_Model_Quote
232
+ * @return int
233
+ */
234
+ protected function _addShipping($address) {
235
+ $lineNumber = count($this->_lines);
236
+ $storeId = Mage::app()->getStore()->getId();
237
+ $taxClass = Mage::helper('tax')->getShippingTaxClass($storeId);
238
+ $shippingAmount = (float) $address->getShippingAmount();
239
+
240
+ $line = new Line();
241
+ $line->setNo($lineNumber);
242
+ $shippingSku = Mage::helper('avatax')->getShippingSku($storeId);
243
+ $line->setItemCode($shippingSku ? $shippingSku : 'Shipping');
244
+ $line->setDescription('Shipping costs');
245
+ $line->setTaxCode($taxClass);
246
+ $line->setQty(1);
247
+ $line->setAmount($shippingAmount);
248
+ $line->setDiscounted(false);
249
+
250
+ $this->_lines[$lineNumber] = $line;
251
+ $this->_request->setLines($this->_lines);
252
+ $this->_lineToLineId[$lineNumber] = Mage::helper('avatax')->getShippingSku($storeId);
253
+ return $lineNumber;
254
+ }
255
+
256
+ /**
257
+ * Adds giftwraporder cost to request as item
258
+ *
259
+ * @param Mage_Sales_Model_Quote
260
+ * @return int
261
+ */
262
+ protected function _addGwOrderAmount($address) {
263
+ if(!$address->getGwPrice())
264
+ return;
265
+ $lineNumber = count($this->_lines);
266
+ $storeId = Mage::app()->getStore()->getId();
267
+ //Add gift wrapping price(for entire order)
268
+ $gwOrderAmount = $address->getGwPrice();
269
+
270
+ $line = new Line();
271
+ $line->setNo($lineNumber);
272
+ $gwOrderSku = Mage::helper('avatax')->getGwOrderSku($storeId);
273
+ $line->setItemCode($gwOrderSku ? $gwOrderSku : 'GwOrderAmount');
274
+ $line->setDescription('Gift Wrap Order Amount');
275
+ $line->setTaxCode('');
276
+ $line->setQty(1);
277
+ $line->setAmount($gwOrderAmount);
278
+ $line->setDiscounted(false);
279
+
280
+ $this->_lines[$lineNumber] = $line;
281
+ $this->_request->setLines($this->_lines);
282
+ $this->_lineToLineId[$lineNumber] = Mage::helper('avatax')->getGwOrderSku($storeId);
283
+ return $lineNumber;
284
+ }
285
+
286
+ /**
287
+ * Adds giftwrapitems cost to request as item
288
+ *
289
+ * @param Mage_Sales_Model_Quote
290
+ * @return int
291
+ */
292
+ protected function _addGwItemsAmount($address) {
293
+ if(!$address->getGwItemsPrice())
294
+ return;
295
+ $lineNumber = count($this->_lines);
296
+ $storeId = Mage::app()->getStore()->getId();
297
+ //Add gift wrapping price(for individual items)
298
+ $gwItemsAmount = $address->getGwItemsPrice();
299
+
300
+ $line = new Line();
301
+ $line->setNo($lineNumber);
302
+ $gwItemsSku = Mage::helper('avatax')->getGwItemsSku($storeId);
303
+ $line->setItemCode($gwItemsSku ? $gwItemsSku : 'GwItemsAmount');
304
+ $line->setDescription('Gift Wrap Items Amount');
305
+ $line->setTaxCode('');
306
+ $line->setQty(1);
307
+ $line->setAmount($gwItemsAmount);
308
+ $line->setDiscounted(false);
309
+
310
+ $this->_lines[$lineNumber] = $line;
311
+ $this->_request->setLines($this->_lines);
312
+ $this->_lineToLineId[$lineNumber] = Mage::helper('avatax')->getGwItemsSku($storeId);
313
+ return $lineNumber;
314
+ }
315
+
316
+ /**
317
+ * Adds giftwrap printed card cost to request as item
318
+ *
319
+ * @param Mage_Sales_Model_Quote
320
+ * @return int
321
+ */
322
+ protected function _addGwPrintedCardAmount($address) {
323
+ if(!$address->getGwPrintedCardPrice())
324
+ return;
325
+ $lineNumber = count($this->_lines);
326
+ $storeId = Mage::app()->getStore()->getId();
327
+ //Add printed card price
328
+ $gwPrintedCardAmount = $address->getGwPrintedCardPrice();
329
+
330
+ $line = new Line();
331
+ $line->setNo($lineNumber);
332
+ $gwPrintedCardSku = Mage::helper('avatax')->getGwPrintedCardSku($storeId);
333
+ $line->setItemCode($gwPrintedCardSku ? $gwPrintedCardSku : 'GwPrintedCardAmount');
334
+ $line->setDescription('Gift Wrap Printed Card Amount');
335
+ $line->setTaxCode('');
336
+ $line->setQty(1);
337
+ $line->setAmount($gwPrintedCardAmount);
338
+ $line->setDiscounted(false);
339
+
340
+ $this->_lines[$lineNumber] = $line;
341
+ $this->_request->setLines($this->_lines);
342
+ $this->_lineToLineId[$lineNumber] = Mage::helper('avatax')->getGwPrintedCardSku($storeId);
343
+ return $lineNumber;
344
+ }
345
+
346
+ /**
347
+ * Adds all items in the cart to the request
348
+ *
349
+ * @param Mage_Sales_Model_Quote_item|Mage_Sales_Model_Quote_Address_item
350
+ * @return int
351
+ */
352
+ protected function _addItemsInCart($item) {
353
+ if ($item->getAddress() instanceof Mage_Sales_Model_Quote_Address) {
354
+ $items = $item->getAddress()->getAllItems();
355
+ } elseif ($item->getQuote() instanceof Mage_Sales_Model_Quote) {
356
+ $items = $item->getQuote()->getAllItems();
357
+ } else {
358
+ $items = array();
359
+ }
360
+
361
+ if (count($items) > 0) {
362
+ foreach ($items as $item) {
363
+ $lineNum = $this->_newLine($item);
364
+ }
365
+ $this->_request->setLines($this->_lines);
366
+ }
367
+ return count($this->_lines);
368
+ }
369
+
370
+ /**
371
+ * Makes a Line object from a product item object
372
+ *
373
+ * @param Varien_Object
374
+ * @return int
375
+ */
376
+ protected function _newLine($item) {
377
+ $product = $item->getProduct();
378
+ $lineNumber = count($this->_lines);
379
+ $line = new Line();
380
+
381
+ if ($this->isProductCalculated($item)) {
382
+ $price = 0;
383
+ } else {
384
+ $price = $item->getRowTotal() - $item->getDiscountAmount();
385
+ }
386
+
387
+ $line->setNo($lineNumber);
388
+ $line->setItemCode(substr($product->getSku(), 0, 50));
389
+ $line->setDescription($product->getName());
390
+ $taxClass = Mage::getModel('tax/class')->load($product->getTaxClassId())->getOpAvataxCode();
391
+ $line->setTaxCode($taxClass);
392
+ $line->setQty($item->getQty());
393
+ $line->setAmount($price);
394
+ $line->setDiscounted($item->getDiscountAmount() ? true : false);
395
+
396
+ $ref1Code = Mage::helper('avatax')->getRef1AttributeCode($product->getStoreId());
397
+ if ($ref1Code && $product->getResource()->getAttribute($ref1Code)) {
398
+ $ref1 = $product->getResource()->getAttribute($ref1Code)->getFrontend()->getValue($product);
399
+ try {
400
+ $line->setRef1((string) $ref1);
401
+ } catch (Exception $e) {
402
+
403
+ }
404
+ }
405
+ $ref2Code = Mage::helper('avatax')->getRef2AttributeCode($product->getStoreId());
406
+ if ($ref2Code && $product->getResource()->getAttribute($ref2Code)) {
407
+ $ref2 = $product->getResource()->getAttribute($ref2Code)->getFrontend()->getValue($product);
408
+ try {
409
+ $line->setRef2((string) $ref2);
410
+ } catch (Exception $e) {
411
+
412
+ }
413
+ }
414
+
415
+ $this->_lines[$lineNumber] = $line;
416
+ $this->_lineToLineId[$lineNumber] = $item->getId();
417
+ return $lineNumber;
418
+ }
419
+
420
+ }
app/code/community/OnePica/AvaTax/Model/Avatax/Exception/Address.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * The AvaTax Validation Exception class.
20
+ */
21
+ class OnePica_AvaTax_Model_Avatax_Address_Exception extends Exception {}
app/code/community/OnePica/AvaTax/Model/Avatax/Exception/Commitfailure.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * UnbalancedException
20
+ */
21
+ class OnePica_AvaTax_Model_Avatax_Exception_Commitfailure extends Exception {}
app/code/community/OnePica/AvaTax/Model/Avatax/Exception/Unbalanced.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * UnbalancedException
20
+ */
21
+ class OnePica_AvaTax_Model_Avatax_Exception_Unbalanced extends Exception {}
app/code/community/OnePica/AvaTax/Model/Avatax/Invoice.php ADDED
@@ -0,0 +1,418 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Model_Avatax_Invoice extends OnePica_AvaTax_Model_Avatax_Abstract
20
+ {
21
+
22
+ /**
23
+ * An array of line items
24
+ *
25
+ * @var array
26
+ */
27
+ protected $_lines = array();
28
+
29
+ /**
30
+ * An array of line numbers to product ids
31
+ *
32
+ * @var array
33
+ */
34
+ protected $_lineToItemId = array();
35
+
36
+ /**
37
+ * Save order in AvaTax system
38
+ *
39
+ * @see OnePica_AvaTax_Model_Observer::salesOrderPlaceAfter()
40
+ * @param Mage_Sales_Model_Order_Invoice $invoice
41
+ * @return array
42
+ */
43
+ public function invoice($invoice) {
44
+ $order = $invoice->getOrder();
45
+
46
+ $shippingAddress = ($order->getShippingAddress()) ? $order->getShippingAddress() : $order->getBillingAddress();
47
+ if(!$shippingAddress) {
48
+ throw new Exception($this->__('There is no address attached to this order'));
49
+ }
50
+
51
+ $this->_request = new GetTaxRequest();
52
+ $this->_request->setDocCode($invoice->getIncrementId());
53
+ $this->_request->setDocType(DocumentType::$SalesInvoice);
54
+
55
+ $this->_addGeneralInfo($order);
56
+ $this->_addShipping($invoice);
57
+ //Added code for calculating tax for giftwrap items
58
+ $this->_addGwOrderAmount($invoice);
59
+ $this->_addGwItemsAmount($invoice);
60
+ $this->_addGwPrintedCardAmount($invoice);
61
+
62
+ $this->_setOriginAddress($order->getStoreId());
63
+ $this->_setDestinationAddress($shippingAddress);
64
+ $this->_request->setPaymentDate(date('Y-m-d'));
65
+
66
+ $configAction = Mage::getStoreConfig('tax/avatax/action', $order->getStoreId());
67
+ $commitAction = OnePica_AvaTax_Model_Config::ACTION_CALC_SUBMIT_COMMIT;
68
+ $this->_request->setCommit(($configAction==$commitAction) ? true : false);
69
+
70
+ foreach($invoice->getItemsCollection() as $item) {
71
+ $this->_newLine($item);
72
+ }
73
+ $this->_request->setLines($this->_lines);
74
+
75
+ //send to AvaTax
76
+ $result = $this->_send($order->getStoreId());
77
+
78
+ //if successful
79
+ if($result->getResultCode() == SeverityLevel::$Success) {
80
+ $message = Mage::helper('avatax')->__('Invoice #%s was saved to AvaTax', $result->getDocCode());
81
+ $this->_addStatusHistoryComment($order, $message);
82
+
83
+ if($result->getTotalTax() != $invoice->getTaxAmount()) {
84
+ throw new OnePica_AvaTax_Model_Avatax_Exception_Unbalanced('Collected: ' . $invoice->getTaxAmount() . ', Actual: ' . $result->getTotalTax());
85
+ }
86
+
87
+ //if not successful
88
+ } else {
89
+ $messages = array();
90
+ foreach($result->getMessages() as $message) $messages[] = $message->getSummary();
91
+ throw new OnePica_AvaTax_Model_Avatax_Exception_Commitfailure(implode(' // ', $messages));
92
+ }
93
+
94
+ return true;
95
+ }
96
+
97
+ /**
98
+ * Save order in AvaTax system
99
+ *
100
+ * @see OnePica_AvaTax_Model_Observer::salesOrderPlaceAfter()
101
+ * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
102
+ */
103
+ public function creditmemo($creditmemo) {
104
+ $order = $creditmemo->getOrder();
105
+
106
+ $shippingAddress = ($order->getShippingAddress()) ? $order->getShippingAddress() : $order->getBillingAddress();
107
+ if(!$shippingAddress) {
108
+ throw new Exception($this->__('There is no address attached to this order'));
109
+ }
110
+
111
+ $this->_request = new GetTaxRequest();
112
+ $this->_request->setDocCode($creditmemo->getIncrementId());
113
+ $this->_request->setDocType(DocumentType::$ReturnInvoice);
114
+
115
+ $this->_addGeneralInfo($order);
116
+ $this->_addShipping($creditmemo, true);
117
+ //Added code for calculating tax for giftwrap items
118
+ $this->_addGwOrderAmount($creditmemo);
119
+ $this->_addGwItemsAmount($creditmemo);
120
+ $this->_addGwPrintedCardAmount($creditmemo);
121
+
122
+ $this->_addAdjustments($creditmemo->getAdjustmentPositive(), $creditmemo->getAdjustmentNegative());
123
+ $this->_setOriginAddress($order->getStoreId());
124
+ $this->_setDestinationAddress($shippingAddress);
125
+
126
+ // Set the tax date for calculation.
127
+ $invoiceDate = $order->getInvoiceCollection()->getFirstItem()->getCreatedAt();
128
+ $override = new TaxOverride();
129
+ $override->setTaxDate(substr($invoiceDate, 0, 10));
130
+ $override->setTaxOverrideType(TaxOverrideType::$TaxDate);
131
+ $override->setReason('Credit memo - refund');
132
+ $this->_request->setTaxOverride($override);
133
+
134
+ $configAction = Mage::getStoreConfig('tax/avatax/action', $order->getStoreId());
135
+ $commitAction = OnePica_AvaTax_Model_Config::ACTION_CALC_SUBMIT_COMMIT;
136
+ $this->_request->setCommit(($configAction==$commitAction) ? true : false);
137
+
138
+ foreach($creditmemo->getAllItems() as $item) {
139
+ $this->_newLine($item, true);
140
+ }
141
+ $this->_request->setLines($this->_lines);
142
+
143
+ //send to AvaTax
144
+ $result = $this->_send($order->getStoreId());
145
+
146
+ //if successful
147
+ if($result->getResultCode() == SeverityLevel::$Success) {
148
+ $message = Mage::helper('avatax')->__('Credit memo #%s was saved to AvaTax', $result->getDocCode());
149
+ $this->_addStatusHistoryComment($order, $message);
150
+
151
+ if($result->getTotalTax() != ($creditmemo->getTaxAmount()*-1)) {
152
+ throw new OnePica_AvaTax_Model_Avatax_Exception_Unbalanced('Collected: ' . $creditmemo->getTaxAmount() . ', Actual: ' . $result->getTotalTax());
153
+ }
154
+
155
+ //if not successful
156
+ } else {
157
+ $messages = array();
158
+ foreach($result->getMessages() as $message) $messages[] = $message->getSummary();
159
+ throw new OnePica_AvaTax_Model_Avatax_Exception_Commitfailure(implode(' // ', $messages));
160
+ }
161
+
162
+ return $result;
163
+ }
164
+
165
+ /**
166
+ * Adds shipping cost to request as item
167
+ *
168
+ * @param int $shippingAmount
169
+ * @return int
170
+ */
171
+ protected function _addShipping($object, $credit=false) {
172
+ if($object->getShippingAmount() == 0) {
173
+ return false;
174
+ }
175
+
176
+ $lineNumber = count($this->_lines);
177
+ $storeId = Mage::app()->getStore()->getId();
178
+ $taxClass = Mage::helper('tax')->getShippingTaxClass($storeId);
179
+
180
+ $amount = $object->getShippingAmount();
181
+ if($credit) $amount *= -1;
182
+
183
+ $line = new Line();
184
+ $line->setNo($lineNumber);
185
+ $line->setItemCode(Mage::helper('avatax')->getShippingSku($storeId));
186
+ $line->setDescription('Shipping costs');
187
+ $line->setTaxCode($taxClass);
188
+ $line->setQty(1);
189
+ $line->setAmount($amount);
190
+ $line->setDiscounted(false);
191
+
192
+ $this->_lineToItemId[$lineNumber] = 'shipping';
193
+ $this->_lines[$lineNumber] = $line;
194
+ $this->_request->setLines($this->_lines);
195
+ return $lineNumber;
196
+ }
197
+
198
+ /**
199
+ * Adds giftwraporder cost to request as item
200
+ *
201
+ * @param int $shippingAmount
202
+ * @return int
203
+ */
204
+ protected function _addGwOrderAmount($object, $credit=false) {
205
+ if($object->getGwPrice() == 0) {
206
+ return false;
207
+ }
208
+
209
+ $lineNumber = count($this->_lines);
210
+ $storeId = Mage::app()->getStore()->getId();
211
+ $taxClass = Mage::helper('tax')->getShippingTaxClass($storeId);
212
+
213
+ $amount = $object->getGwPrice();
214
+ if($credit) $amount *= -1;
215
+
216
+ $line = new Line();
217
+ $line->setNo($lineNumber);
218
+ $line->setItemCode(Mage::helper('avatax')->getGwOrderSku($storeId));
219
+ $line->setDescription('Gift Wrap Order Amount');
220
+ $line->setTaxCode('');
221
+ $line->setQty(1);
222
+ $line->setAmount($amount);
223
+ $line->setDiscounted(false);
224
+
225
+ $this->_lineToItemId[$lineNumber] = Mage::helper('avatax')->getGwOrderSku($storeId);
226
+ $this->_lines[$lineNumber] = $line;
227
+ $this->_request->setLines($this->_lines);
228
+ return $lineNumber;
229
+ }
230
+
231
+ /**
232
+ * Adds giftwrapitems cost to request as item
233
+ *
234
+ * @param int $shippingAmount
235
+ * @return int
236
+ */
237
+ protected function _addGwItemsAmount($object, $credit=false) {
238
+ if($object->getGwItemsPrice() == 0) {
239
+ return false;
240
+ }
241
+
242
+ $lineNumber = count($this->_lines);
243
+ $storeId = Mage::app()->getStore()->getId();
244
+
245
+ $amount = $object->getGwItemsPrice();
246
+ if($credit) $amount *= -1;
247
+
248
+ $line = new Line();
249
+ $line->setNo($lineNumber);
250
+ $line->setItemCode(Mage::helper('avatax')->getGwItemsSku($storeId));
251
+ $line->setDescription('Gift Wrap Items Amount');
252
+ $line->setTaxCode('');
253
+ $line->setQty(1);
254
+ $line->setAmount($amount);
255
+ $line->setDiscounted(false);
256
+
257
+ $this->_lineToItemId[$lineNumber] = Mage::helper('avatax')->getGwItemsSku($storeId);
258
+ $this->_lines[$lineNumber] = $line;
259
+ $this->_request->setLines($this->_lines);
260
+ return $lineNumber;
261
+ }
262
+
263
+ /**
264
+ * Adds giftwrap printed card cost to request as item
265
+ *
266
+ * @param int $shippingAmount
267
+ * @return int
268
+ */
269
+ protected function _addGwPrintedCardAmount($object, $credit=false) {
270
+ if($object->getGwPrintedCardSku() == 0) {
271
+ return false;
272
+ }
273
+
274
+ $lineNumber = count($this->_lines);
275
+ $storeId = Mage::app()->getStore()->getId();
276
+
277
+ $amount = $object->getGwPrintedCardPrice();
278
+ if($credit) $amount *= -1;
279
+
280
+ $line = new Line();
281
+ $line->setNo($lineNumber);
282
+ $line->setItemCode(Mage::helper('avatax')->getGwPrintedCardSku($storeId));
283
+ $line->setDescription('Gift Wrap Printed Card Amount');
284
+ $line->setTaxCode('');
285
+ $line->setQty(1);
286
+ $line->setAmount($amount);
287
+ $line->setDiscounted(false);
288
+
289
+ $this->_lineToItemId[$lineNumber] = Mage::helper('avatax')->getGwPrintedCardSku($storeId);
290
+ $this->_lines[$lineNumber] = $line;
291
+ $this->_request->setLines($this->_lines);
292
+ return $lineNumber;
293
+ }
294
+
295
+ /**
296
+ * Adds shipping cost to request as item
297
+ *
298
+ * @param int $shippingAmount
299
+ * @return int
300
+ */
301
+ protected function _addGiftAmount($object, $credit=false) {
302
+ if($object->getGiftCardsAmount() == 0) {
303
+ return false;
304
+ }
305
+
306
+ $lineNumber = count($this->_lines);
307
+ $storeId = Mage::app()->getStore()->getId();
308
+
309
+ $giftAmount = $object->getShippingAmount();
310
+ if($credit) $amount *= -1;
311
+ $line = new Line();
312
+ $line->setNo($lineNumber);
313
+ $giftSku = Mage::helper('avatax')->getGiftSku($storeId);
314
+ $line->setItemCode($giftSku ? $giftSku : 'GiftAmount');
315
+ $line->setDescription('Gift Amount');
316
+ $line->setTaxCode('');
317
+ $line->setQty(1);
318
+ $line->setAmount($giftAmount);
319
+ $line->setDiscounted(false);
320
+
321
+ $this->_lineToItemId[$lineNumber] = Mage::helper('avatax')->getGiftSku($storeId);
322
+ $this->_lines[$lineNumber] = $line;
323
+ $this->_request->setLines($this->_lines);
324
+ return $lineNumber;
325
+ }
326
+
327
+ /**
328
+ * Adds adjustments to request as items
329
+ *
330
+ * @param float $positive
331
+ * @param float $negative
332
+ * @return array
333
+ */
334
+ protected function _addAdjustments($positive, $negative) {
335
+ $storeId = Mage::app()->getStore()->getId();
336
+
337
+ if($positive != 0) {
338
+ $lineNumber = count($this->_lines);
339
+ $identifier = Mage::helper('avatax')->getPositiveAdjustmentSku($storeId);
340
+
341
+ $line = new Line();
342
+ $line->setNo($lineNumber);
343
+ $line->setItemCode($identifier ? $identifier : 'adjustment');
344
+ $line->setDescription('Adjustment refund');
345
+ $line->setTaxCode($identifier);
346
+ $line->setQty(1);
347
+ $line->setAmount($positive*-1);
348
+ $line->setDiscounted(false);
349
+ $line->setTaxIncluded(true);
350
+ $this->_lineToItemId[$lineNumber] = 'positive-adjustment';
351
+ $this->_lines[$lineNumber] = $line;
352
+ $this->_request->setLines($this->_lines);
353
+ }
354
+
355
+ if($negative != 0) {
356
+ $lineNumber = count($this->_lines);
357
+ $identifier = Mage::helper('avatax')->getNegativeAdjustmentSku($storeId);
358
+
359
+ $line = new Line();
360
+ $line->setNo($lineNumber);
361
+ $line->setItemCode($identifier ? $identifier : 'adjustment');
362
+ $line->setDescription('Adjustment fee');
363
+ $line->setTaxCode($identifier);
364
+ $line->setQty(1);
365
+ $line->setAmount($negative);
366
+ $line->setDiscounted(false);
367
+ $line->setTaxIncluded(true);
368
+ $this->_lineToItemId[$lineNumber] = 'negative-adjustment';
369
+ $this->_lines[$lineNumber] = $line;
370
+ $this->_request->setLines($this->_lines);
371
+ }
372
+ }
373
+
374
+ /**
375
+ * Makes a Line object from a product item object
376
+ *
377
+ * @param Varien_Object $item
378
+ * @return null
379
+ */
380
+ protected function _newLine($item, $credit=false) {
381
+ if($this->isProductCalculated($item->getOrderItem())) {
382
+ return false;
383
+ }
384
+ if($item->getQty() == 0) {
385
+ return false;
386
+ }
387
+
388
+ $price = $item->getRowTotal() - $item->getDiscountAmount();
389
+ if($credit) $price *= -1;
390
+
391
+ $line = new Line();
392
+ $line->setNo(count($this->_lines));
393
+ $line->setItemCode(substr($item->getSku(), 0, 50));
394
+ $line->setDescription($item->getName());
395
+ $line->setQty($item->getQty());
396
+ $line->setAmount($price);
397
+ $line->setDiscounted($item->getDiscountAmount() ? true : false);
398
+
399
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
400
+ $taxClass = Mage::getModel('tax/class')->load($product->getTaxClassId())->getOpAvataxCode();
401
+ $line->setTaxCode($taxClass);
402
+
403
+ $ref1Code = Mage::helper('avatax')->getRef1AttributeCode($product->getStoreId());
404
+ if($ref1Code && $product->getResource()->getAttribute($ref1Code)) {
405
+ $ref1 = $product->getResource()->getAttribute($ref1Code)->getFrontend()->getValue($product);
406
+ try { $line->setRef1((string)$ref1); } catch(Exception $e) { }
407
+ }
408
+ $ref2Code = Mage::helper('avatax')->getRef2AttributeCode($product->getStoreId());
409
+ if($ref2Code && $product->getResource()->getAttribute($ref2Code)) {
410
+ $ref2 = $product->getResource()->getAttribute($ref2Code)->getFrontend()->getValue($product);
411
+ try { $line->setRef2((string)$ref2); } catch(Exception $e) { }
412
+ }
413
+
414
+ $this->_lineToItemId[count($this->_lines)] = $item->getOrderItemId();
415
+ $this->_lines[] = $line;
416
+ }
417
+
418
+ }
app/code/community/OnePica/AvaTax/Model/Avatax/Ping.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Model_Avatax_Ping extends OnePica_AvaTax_Model_Avatax_Abstract
20
+ {
21
+
22
+ /**
23
+ * Tries to ping AvaTax service with provided credentials
24
+ *
25
+ * @param int $storeId
26
+ * @return bool|array
27
+ */
28
+ public function ping($storeId = null) {
29
+ $config = Mage::getSingleton('avatax/config')->init($storeId);
30
+ $connection = $config->getTaxConnection();
31
+ $result = null;
32
+ $message = null;
33
+
34
+ try { $result = $connection->ping(); }
35
+ catch(Exception $exception) { $message = $exception->getMessage(); }
36
+
37
+ if(!isset($result) || !is_object($result) || !$result->getResultCode()) {
38
+ $actualResult = $result;
39
+ $result = new Varien_Object;
40
+ $result->setResultCode(SeverityLevel::$Exception);
41
+ $result->setActualResult($actualResult);
42
+ $result->setMessage($message);
43
+ }
44
+
45
+ $this->_log(new stdClass(), $result, $storeId);
46
+ return ($result->getResultCode() == SeverityLevel::$Success) ? true : $result->getMessage();
47
+ }
48
+
49
+ }
app/code/community/OnePica/AvaTax/Model/Config.php ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ require_once(Mage::getModuleDir('', 'OnePica_AvaTax').DS.'lib'.DS.'functions.php');
20
+
21
+ /**
22
+ * The AvaTax Config Model, which registers config settings with the AvaTax SDK.
23
+ */
24
+ class OnePica_AvaTax_Model_Config extends Varien_Object
25
+ {
26
+ const CONFIG_KEY = 'Magento';
27
+ const APP_NAME = 'OP_AvaTax by One Pica';
28
+
29
+ /**
30
+ * Values for the admin config action options
31
+ */
32
+ const ACTION_DISABLE = 0;
33
+ const ACTION_CALC = 1;
34
+ const ACTION_CALC_SUBMIT = 2;
35
+ const ACTION_CALC_SUBMIT_COMMIT = 3;
36
+
37
+ /**
38
+ * Values for the admin config action options
39
+ */
40
+ const REGIONFILTER_OFF = 0;
41
+ const REGIONFILTER_TAX = 1;
42
+ const REGIONFILTER_ALL = 2;
43
+
44
+ /**
45
+ * Number of times a queue item will try to send
46
+ */
47
+ const QUEUE_ATTEMPT_MAX = 5;
48
+
49
+ /**
50
+ * The AvaTax ATConfig object.
51
+ *
52
+ * @var ATConfig
53
+ */
54
+ protected $_config = null;
55
+
56
+ /**
57
+ * The AvaTax TaxServiceSoap object.
58
+ *
59
+ * @var TaxServiceSoap
60
+ */
61
+ protected $_taxConnection;
62
+
63
+ /**
64
+ * The AvaTax AddressServiceSoap object.
65
+ *
66
+ * @var AddressServiceSoap
67
+ */
68
+ protected $_addressConnection;
69
+
70
+ /**
71
+ * Constructor. Loads all required AvaTax classes.
72
+ *
73
+ * @return null
74
+ */
75
+ protected function _construct ()
76
+ {
77
+ $helper = Mage::helper('avatax');
78
+
79
+ // AvaTax functions
80
+ require_once $helper->getLibPath() . DS . 'functions.php';
81
+
82
+ // AvaTax classes
83
+ $helper->loadClasses(array(
84
+ 'TaxRequest',
85
+ 'PostTaxRequest',
86
+ 'PostTaxResult',
87
+ 'CommitTaxRequest',
88
+ 'CommitTaxResult',
89
+ 'CancelTaxRequest',
90
+ 'CancelTaxResult',
91
+ 'Enum',
92
+ 'CancelCode',
93
+ 'ATConfig',
94
+ 'ATObject',
95
+ 'DynamicSoapClient',
96
+ 'AvalaraSoapClient',
97
+ 'AddressServiceSoap',
98
+ 'Address',
99
+ 'Enum',
100
+ 'TextCase',
101
+ 'Message',
102
+ 'SeverityLevel',
103
+ 'ValidateRequest',
104
+ 'ValidateResult',
105
+ 'ValidAddress',
106
+ 'TaxServiceSoap',
107
+ 'GetTaxRequest',
108
+ 'DocumentType',
109
+ 'DetailLevel',
110
+ 'Line',
111
+ 'ServiceMode',
112
+ 'GetTaxResult',
113
+ 'TaxLine',
114
+ 'TaxDetail',
115
+ 'PingResult',
116
+ 'TaxOverride',
117
+ 'TaxOverrideType'
118
+ ));
119
+ }
120
+
121
+ /**
122
+ * Initializes the AvaTax SDK with connection settings found in the Admin config.
123
+ *
124
+ * @param int $storeId
125
+ * @return OnePica_AvaTax_Model_Config
126
+ */
127
+ public function init ($storeId)
128
+ {
129
+ if (!$this->_config) {
130
+ $this->_config = new ATConfig(self::CONFIG_KEY, array(
131
+ 'url' => $this->getConfig('url', $storeId),
132
+ 'account' => $this->getConfig('account', $storeId),
133
+ 'license' => $this->getConfig('license', $storeId),
134
+ 'trace' => (Mage::helper('avatax')->getLogMode($storeId) == OnePica_AvaTax_Model_Source_Logmode::DEBUG) ? true : false,
135
+ 'client' => $this->getClientName()
136
+ ));
137
+ }
138
+ return $this;
139
+ }
140
+
141
+ /**
142
+ * Generates client name to pass with communications
143
+ *
144
+ * Parts:
145
+ * - MyERP: the ERP that this connector is for (not always applicable)
146
+ * - Majver: version info for the ERP (not always applicable)
147
+ * - MinVer: version info for the ERP (not always applicable)
148
+ * - MyConnector: Name of the OEM�s connector AND the name of the OEM (company) *required*
149
+ * - Majver: OEM�s connector version *required*
150
+ * - MinVer: OEM�s connector version *required*
151
+ *
152
+ * @example Magento,1.4,.0.1,OP_AvaTax by One Pica,2,0.1
153
+ * @return string
154
+ */
155
+ public function getClientName() {
156
+ $mageVersion = Mage::getVersion();
157
+ $mageVerParts = explode('.', $mageVersion, 2);
158
+
159
+ $opVersion = Mage::getResourceModel('core/resource')->getDbVersion('avatax_records_setup');
160
+ $opVerParts = explode('.', $opVersion, 2);
161
+
162
+ $part = array();
163
+ $part[] = self::CONFIG_KEY;
164
+ $part[] = $mageVerParts[0];
165
+ $part[] = $mageVerParts[1];
166
+ $part[] = self::APP_NAME;
167
+ $part[] = $opVerParts[0];
168
+ $part[] = $opVerParts[1];
169
+ return implode(',', $part);
170
+ }
171
+
172
+ /**
173
+ * Returns the AvaTax Address soap connection client.
174
+ *
175
+ * @return AddressServiceSoap
176
+ */
177
+ public function getAddressConnection ()
178
+ {
179
+ if (!$this->_addressConnection) {
180
+ $this->_addressConnection = new AddressServiceSoap(self::CONFIG_KEY);
181
+ }
182
+ return $this->_addressConnection;
183
+ }
184
+
185
+ /**
186
+ * Returns the AvaTax Address soap connection client.
187
+ *
188
+ * @return AddressServiceSoap
189
+ */
190
+ public function getTaxConnection ()
191
+ {
192
+ if (!$this->_taxConnection) {
193
+ $this->_taxConnection = new TaxServiceSoap(self::CONFIG_KEY);
194
+ }
195
+ return $this->_taxConnection;
196
+ }
197
+
198
+ /**
199
+ * Returns a parameter from the AvaTax ATConfig object.
200
+ *
201
+ * @return string
202
+ */
203
+ public function getParam ($param)
204
+ {
205
+ return $this->_avataxConfig->$param;
206
+ }
207
+
208
+ /**
209
+ * Returns data from the admin system config.
210
+ *
211
+ * @param string $path
212
+ * @param int $store
213
+ * @return string
214
+ */
215
+ public function getConfig ($path, $store=null)
216
+ {
217
+ return Mage::getStoreConfig('tax/avatax/' . $path, $store);
218
+ }
219
+
220
+ /**
221
+ * Returns true if the admin is configured to normalize addresses.
222
+ *
223
+ * @return boolean
224
+ */
225
+ public function normalizeAddress ()
226
+ {
227
+ $storeId = Mage::app()->getStore()->getId();
228
+ return $this->getConfig('normalize_address', $storeId);
229
+ }
230
+
231
+ /**
232
+ * Returns the company code to use from the AvaTax dashboard
233
+ *
234
+ * @return string
235
+ */
236
+ public function getCompanyCode ($store=null)
237
+ {
238
+ return $this->getConfig('company_code', $store);
239
+ }
240
+ }
app/code/community/OnePica/AvaTax/Model/Observer.php ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Model_Observer extends Mage_Core_Model_Abstract
20
+ {
21
+
22
+ /**
23
+ * Sets the collectTotals tax node based on the extensions enabled/disabled status
24
+ *
25
+ * @param Varien_Event_Observer $observer
26
+ */
27
+ public function salesQuoteCollectTotalsBefore(Varien_Event_Observer $observer) {
28
+ $storeId = $observer->getEvent()->getQuote()->getStoreId();
29
+ if(Mage::getStoreConfig('tax/avatax/action', $storeId) != OnePica_AvaTax_Model_Config::ACTION_DISABLE) {
30
+ Mage::getConfig()->setNode('global/sales/quote/totals/tax/class', 'avatax/sales_quote_address_total_tax');
31
+ }
32
+ }
33
+
34
+ /**
35
+ * Create a sales invoice record in Avalara
36
+ *
37
+ * @param Varien_Event_Observer $observer
38
+ */
39
+ public function salesOrderInvoiceSaveAfter(Varien_Event_Observer $observer) {
40
+ $invoice = $observer->getEvent()->getInvoice();
41
+ if(!$invoice->getOrigData($invoice->getIdFieldName()) && Mage::helper('avatax')->isObjectActionable($invoice)) {
42
+ Mage::getModel('avatax_records/queue')
43
+ ->setEntity($invoice)
44
+ ->setType(OnePica_AvaTax_Model_Records_Queue::QUEUE_TYPE_INVOICE)
45
+ ->setStatus(OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_PENDING)
46
+ ->save();
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Create a return invoice record in Avalara
52
+ *
53
+ * @param Varien_Event_Observer $observer
54
+ */
55
+ public function salesOrderCreditmemoSaveAfter(Varien_Event_Observer $observer) {
56
+ $creditmemo = $observer->getEvent()->getCreditmemo();
57
+ if(!$creditmemo->getOrigData($creditmemo->getIdFieldName()) && Mage::helper('avatax')->isObjectActionable($creditmemo)) {
58
+ Mage::getModel('avatax_records/queue')
59
+ ->setEntity($creditmemo)
60
+ ->setType(OnePica_AvaTax_Model_Records_Queue::QUEUE_TYPE_CREDITMEMEO)
61
+ ->setStatus(OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_PENDING)
62
+ ->save();
63
+ }
64
+ }
65
+
66
+ public function multishippingSetShippingItems(Varien_Event_Observer $observer) {
67
+ /* @var $quote Mage_Sales_Model_Quote */
68
+ $quote = $observer->getEvent()->getQuote();
69
+
70
+ $errors = array();
71
+ $normalized = false;
72
+ $store = Mage::getModel('core/store')->load($quote->getStoreId());
73
+ $addresses = $quote->getAllShippingAddresses();
74
+ $message = Mage::getStoreConfig('tax/avatax/validate_address_message', $store);
75
+ foreach ($addresses as $address) {
76
+ /* @var $address OnePica_AvaTax_Model_Sales_Quote_Address */
77
+ if ($address->validate() !== true) {
78
+ $errors[] = sprintf($message, $address->format('oneline'));
79
+ }
80
+ if ($address->getAddressNormalized()) {
81
+ $normalized = true;
82
+ }
83
+ }
84
+
85
+ $session = Mage::getSingleton('checkout/session');
86
+ if ($normalized) {
87
+ $session->addNotice(Mage::getStoreConfig('tax/avatax/multiaddress_normalize_message', $store));
88
+ }
89
+
90
+ if (!empty($errors)) {
91
+ Mage::throwException(implode('<br />', $errors));
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Observer push data to Avalara
97
+ *
98
+ * @param Mage_Cron_Model_Schedule $schedule
99
+ * @return null
100
+ */
101
+ public function processQueue($schedule) {
102
+ Mage::getModel('avatax_records/queue_process')->run();
103
+ }
104
+
105
+ /**
106
+ * Test for required values when admin config setting related to the this extension are changed
107
+ *
108
+ * @param Mage_Cron_Model_Schedule $schedule
109
+ * @return bool
110
+ */
111
+ public function adminSystemConfigChangedSectionTax($schedule) {
112
+ Mage::app()->cleanCache('block_html');
113
+
114
+ $session = Mage::getSingleton('adminhtml/session');
115
+ $storeId = Mage::getModel('core/store')->load($schedule->getEvent()->getStore())->getStoreId();
116
+ $warnings = array();
117
+ $errors = array();
118
+
119
+ if(strpos(Mage::getStoreConfig('tax/avatax/url', $storeId), 'development.avalara.net') !== false) {
120
+ $warnings[] = Mage::helper('avatax')->__('You are using the AvaTax development connection URL. If you are receiving errors about authentication, please ensure that you have a development account.');
121
+ }
122
+ if(Mage::getStoreConfig('tax/avatax/action', $storeId) == OnePica_AvaTax_Model_Config::ACTION_DISABLE) {
123
+ $warnings[] = Mage::helper('avatax')->__('All AvaTax services are disabled');
124
+ }
125
+ if(Mage::getStoreConfig('tax/avatax/action', $storeId) == OnePica_AvaTax_Model_Config::ACTION_CALC) {
126
+ $warnings[] = Mage::helper('avatax')->__('Orders will not be sent to the AvaTax system');
127
+ }
128
+ if(Mage::getStoreConfig('tax/avatax/action', $storeId) == OnePica_AvaTax_Model_Config::ACTION_CALC_SUBMIT) {
129
+ $warnings[] = Mage::helper('avatax')->__('Orders will be sent but never committed to the AvaTax system');
130
+ }
131
+
132
+ $ping = Mage::getSingleton('avatax/avatax_ping')->ping($storeId);
133
+ if($ping !== true) {
134
+ $errors[] = $ping;
135
+ }
136
+ if(!Mage::getStoreConfig('tax/avatax/url', $storeId)) {
137
+ $errors[] = Mage::helper('avatax')->__('You must enter a connection URL');
138
+ }
139
+ if(!Mage::getStoreConfig('tax/avatax/account', $storeId)) {
140
+ $errors[] = Mage::helper('avatax')->__('You must enter an account number');
141
+ }
142
+ if(!Mage::getStoreConfig('tax/avatax/license', $storeId)) {
143
+ $errors[] = Mage::helper('avatax')->__('You must enter a license key');
144
+ }
145
+ if(!is_numeric(Mage::getStoreConfig('tax/avatax/log_lifetime'))) {
146
+ $errors[] = Mage::helper('avatax')->__('You must enter the number of days to keep log entries');
147
+ }
148
+ if(!Mage::getStoreConfig('tax/avatax/company_code', $storeId)) {
149
+ $errors[] = Mage::helper('avatax')->__('You must enter a company code');
150
+ }
151
+ if(!Mage::getStoreConfig('tax/avatax/shipping_sku', $storeId)) {
152
+ $errors[] = Mage::helper('avatax')->__('You must enter a shipping sku');
153
+ }
154
+ if(!Mage::getStoreConfig('tax/avatax/adjustment_positive_sku', $storeId)) {
155
+ $errors[] = Mage::helper('avatax')->__('You must enter an adjustment refund sku');
156
+ }
157
+ if(!Mage::getStoreConfig('tax/avatax/adjustment_negative_sku', $storeId)) {
158
+ $errors[] = Mage::helper('avatax')->__('You must enter an adjustment fee sku');
159
+ }
160
+
161
+ if(!class_exists('SoapClient')) {
162
+ $errors[] = Mage::helper('avatax')->__('The PHP class SoapClient is missing. It must be enabled to use this extension. See %s for details.', '<a href="http://www.php.net/manual/en/book.soap.php" target="_blank">http://www.php.net/manual/en/book.soap.php</a>');
163
+ }
164
+
165
+ if(!function_exists('openssl_sign') && count($errors)) {
166
+ $key = array_search(Mage::helper('avatax')->__('SSL support is not available in this build'), $errors);
167
+ if(isset($errors[$key])) unset($errors[$key]);
168
+ $errors[] = Mage::helper('avatax')->__('SSL must be enabled in PHP to use this extension. Typically, OpenSSL is used but it is not enabled on your server. This may not be a problem if you have some other form of SSL in place. For more information about OpenSSL, see %s.', '<a href="http://www.php.net/manual/en/book.openssl.php" target="_blank">http://www.php.net/manual/en/book.openssl.php</a>');
169
+ }
170
+
171
+ if(!Mage::getResourceModel('cron/schedule_collection')->count()) {
172
+ $warnings[] = Mage::helper('avatax')->__('It appears that Magento\'s cron scheduler is not running. For more information, see %s.', '<a href="http://www.magentocommerce.com/wiki/how_to_setup_a_cron_job" target="_black">How to Set Up a Cron Job</a>');
173
+ }
174
+
175
+
176
+ if(count($errors) == 1) {
177
+ $session->addError(implode('', $errors));
178
+ } elseif(count($errors)) {
179
+ $session->addError(Mage::helper('avatax')->__('Please fix the following issues:') . '<br /> - ' . implode('<br /> - ', $errors));
180
+ }
181
+
182
+ if(count($warnings) == 1) {
183
+ $session->addWarning(implode('', $warnings));
184
+ } elseif(count($warnings)) {
185
+ $session->addWarning(Mage::helper('avatax')->__('Please be aware of the following warnings:') . '<br /> - ' . implode('<br /> - ', $warnings));
186
+ }
187
+ }
188
+
189
+ /**
190
+ * Observer to clean the log every so often so it does not get too big.
191
+ *
192
+ * @param Mage_Cron_Model_Schedule $schedule
193
+ * @return (none)
194
+ */
195
+ public function cleanLog($schedule) {
196
+ $days = floatval(Mage::getStoreConfig('tax/avatax/log_lifetime'));
197
+
198
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
199
+ $connection->delete(
200
+ Mage::getResourceModel('avatax_records/log')->getTable('avatax_records/log'),
201
+ $connection->quoteInto('created_at < DATE_SUB(UTC_DATE(), INTERVAL ? DAY)', $days)
202
+ );
203
+ }
204
+
205
+ }
app/code/community/OnePica/AvaTax/Model/Records/Log.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Model_Records_Log extends Mage_Core_Model_Abstract
20
+ {
21
+ public function _construct()
22
+ {
23
+ parent::_construct();
24
+ $this->_init('avatax_records/log');
25
+ }
26
+
27
+ public function setAdditional($value=null) {
28
+ if($value) {
29
+ $value = str_replace(Mage::getStoreConfig('tax/avatax/license'), '[MASKED::LICENSE_KEY]', print_r($value, true));
30
+ }
31
+ $this->setData('additional', $value);
32
+ return $this;
33
+ }
34
+
35
+ }
app/code/community/OnePica/AvaTax/Model/Records/Mysql4/Log.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Model_Records_Mysql4_Log extends Mage_Core_Model_Mysql4_Abstract
20
+ {
21
+ protected function _construct() {
22
+ $this->_init('avatax_records/log', 'log_id');
23
+ }
24
+
25
+ /**
26
+ * Sets various dates before the model is saved.
27
+ *
28
+ * @param Mage_Core_Model_Abstract $object
29
+ * @return OnePica_AvaTax_Model_Mysql4_Log
30
+ */
31
+ protected function _beforeSave(Mage_Core_Model_Abstract $object) {
32
+ $object->setCreatedAt(gmdate('Y-m-d H:i:s'));
33
+ if(!$object->getLevel()) {
34
+ $object->setLevel('Unknown');
35
+ }
36
+ return $this;
37
+ }
38
+ }
app/code/community/OnePica/AvaTax/Model/Records/Mysql4/Log/Collection.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Model_Records_Mysql4_Log_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
20
+ {
21
+ public function _construct() {
22
+ parent::_construct();
23
+ $this->_init('avatax_records/log');
24
+ }
25
+ }
app/code/community/OnePica/AvaTax/Model/Records/Mysql4/Queue.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Model_Records_Mysql4_Queue extends Mage_Core_Model_Mysql4_Abstract
20
+ {
21
+ protected function _construct() {
22
+ $this->_init('avatax_records/queue', 'id');
23
+ }
24
+
25
+ /**
26
+ * Sets various dates before the model is saved.
27
+ *
28
+ * @param Mage_Core_Model_Abstract $object
29
+ * @return OnePica_AvaTax_Model_Mysql4_Queue
30
+ */
31
+ protected function _beforeSave(Mage_Core_Model_Abstract $object) {
32
+ if(!$object->hasCreatedAt()) {
33
+ $object->setCreatedAt(gmdate('Y-m-d H:i:s'));
34
+ }
35
+ $object->setUpdatedAt(gmdate('Y-m-d H:i:s'));
36
+ return $this;
37
+ }
38
+
39
+ /**
40
+ * Log the save
41
+ *
42
+ * @param Mage_Core_Model_Abstract $object
43
+ * @return OnePica_AvaTax_Model_Mysql4_Queue
44
+ */
45
+ protected function _afterSave(Mage_Core_Model_Abstract $object) {
46
+ $logStatus = Mage::getStoreConfig('tax/avatax/log_status', $object->getStoreId());
47
+ if($logStatus) {
48
+ Mage::getModel('avatax_records/log')
49
+ ->setStoreId($object->getStoreId())
50
+ ->setLevel('Success')
51
+ ->setType('Queue')
52
+ ->setRequest(print_r($object->getData(), true))
53
+ ->setResult('Saved')
54
+ ->save();
55
+ }
56
+ return $this;
57
+ }
58
+
59
+ /**
60
+ * Log the delete
61
+ *
62
+ * @param Mage_Core_Model_Abstract $object
63
+ * @return OnePica_AvaTax_Model_Mysql4_Queue
64
+ */
65
+ protected function _afterDelete(Mage_Core_Model_Abstract $object) {
66
+ $logStatus = Mage::getStoreConfig('tax/avatax/log_status', $object->getStoreId());
67
+ if($logStatus) {
68
+ Mage::getModel('avatax_records/log')
69
+ ->setStoreId($object->getStoreId())
70
+ ->setLevel('Success')
71
+ ->setType('Queue')
72
+ ->setRequest(print_r($object->getData(), true))
73
+ ->setResult('Deleted')
74
+ ->save();
75
+ }
76
+ return $this;
77
+ }
78
+
79
+ }
app/code/community/OnePica/AvaTax/Model/Records/Mysql4/Queue/Collection.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Model_Records_Mysql4_Queue_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
20
+ {
21
+ public function _construct() {
22
+ parent::_construct();
23
+ $this->_init('avatax_records/queue');
24
+ }
25
+ }
app/code/community/OnePica/AvaTax/Model/Records/Queue.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Model_Records_Queue extends Mage_Core_Model_Abstract
20
+ {
21
+ const QUEUE_TYPE_INVOICE = 'Invoice';
22
+ const QUEUE_TYPE_CREDITMEMEO = 'Credit memo';
23
+
24
+ const QUEUE_STATUS_PENDING = 'Pending';
25
+ const QUEUE_STATUS_RETRY = 'Retry pending';
26
+ const QUEUE_STATUS_FAILED = 'Failed';
27
+ const QUEUE_STATUS_COMPLETE = 'Complete';
28
+ const QUEUE_STATUS_UNBALANCED = 'Unbalanced';
29
+
30
+ public function _construct()
31
+ {
32
+ parent::_construct();
33
+ $this->_init('avatax_records/queue');
34
+ }
35
+
36
+ public function setEntity($object) {
37
+ $this->setEntityId($object->getId());
38
+ $this->setEntityIncrementId($object->getIncrementId());
39
+ $this->setStoreId($object->getStoreId());
40
+ return $this;
41
+ }
42
+
43
+ public function getTypeOptions() {
44
+ return array(
45
+ self::QUEUE_TYPE_INVOICE => self::QUEUE_TYPE_INVOICE,
46
+ self::QUEUE_TYPE_CREDITMEMEO => self::QUEUE_TYPE_CREDITMEMEO
47
+ );
48
+ }
49
+
50
+ public function getStatusOptions() {
51
+ return array(
52
+ self::QUEUE_STATUS_PENDING => self::QUEUE_STATUS_PENDING,
53
+ self::QUEUE_STATUS_RETRY => self::QUEUE_STATUS_RETRY,
54
+ self::QUEUE_STATUS_FAILED => self::QUEUE_STATUS_FAILED,
55
+ self::QUEUE_STATUS_COMPLETE => self::QUEUE_STATUS_COMPLETE,
56
+ self::QUEUE_STATUS_UNBALANCED => self::QUEUE_STATUS_UNBALANCED
57
+ );
58
+ }
59
+
60
+ }
app/code/community/OnePica/AvaTax/Model/Records/Queue/Process.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class OnePica_AvaTax_Model_Records_Queue_Process extends OnePica_AvaTax_Model_Abstract
19
+ {
20
+ /**
21
+ * Run the complete process
22
+ *
23
+ * @return self
24
+ */
25
+ public function run() {
26
+ $this->_cleanCompleted()
27
+ ->_cleanFailed()
28
+ ->_parseInvoices()
29
+ ->_parseCreditMemos();
30
+ return $this;
31
+ }
32
+
33
+ /**
34
+ * Delete any queue items that have been completed. Items stay in queue for some
35
+ * transparency into the process.
36
+ *
37
+ * @return self
38
+ */
39
+ protected function _cleanCompleted() {
40
+ $days = intval(Mage::getStoreConfig('tax/avatax/queue_success_lifetime'));
41
+ $queue = Mage::getModel('avatax_records/queue')->getCollection()
42
+ ->addFieldToFilter('status', OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_COMPLETE)
43
+ ->addFieldToFilter('updated_at', array('lt' => gmdate('Y-m-d H:i:s', strtotime('-' . $days . ' days'))));
44
+
45
+ foreach($queue as $item) {
46
+ $item->delete();
47
+ }
48
+
49
+ return $this;
50
+ }
51
+
52
+ /**
53
+ * Delete any queue items that have failed. Items stay in queue for some
54
+ * transparency into the process.
55
+ *
56
+ * @return self
57
+ */
58
+ protected function _cleanFailed() {
59
+ $days = intval(Mage::getStoreConfig('tax/avatax/queue_failed_lifetime'));
60
+ $queue = Mage::getModel('avatax_records/queue')->getCollection()
61
+ ->addFieldToFilter('status', OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_FAILED)
62
+ ->addFieldToFilter('updated_at', array('lt' => gmdate('Y-m-d H:i:s', strtotime('-' . $days . ' days'))));
63
+
64
+ foreach($queue as $item) {
65
+ $item->delete();
66
+ }
67
+
68
+ return $this;
69
+ }
70
+
71
+ /**
72
+ * Attempt to send any pending invoices to Avalara
73
+ *
74
+ * @return self
75
+ */
76
+ protected function _parseInvoices() {
77
+ $queue = Mage::getModel('avatax_records/queue')->getCollection()
78
+ ->addFieldToFilter('type', OnePica_AvaTax_Model_Records_Queue::QUEUE_TYPE_INVOICE)
79
+ ->addFieldToFilter('status', array('neq' => OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_FAILED))
80
+ ->addFieldToFilter('status', array('neq' => OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_COMPLETE))
81
+ ->addFieldToFilter('status', array('neq' => OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_UNBALANCED));
82
+ foreach($queue as $item) {
83
+ $item->setAttempt($item->getAttempt() + 1);
84
+ try {
85
+ $invoice = Mage::getModel('sales/order_invoice')->load($item->getEntityId());
86
+ if($invoice->getId()) Mage::getModel('avatax/avatax_invoice')->invoice($invoice);
87
+ $item->setStatus(OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_COMPLETE)->setMessage(null)->save();
88
+ } catch (OnePica_AvaTax_Model_Avatax_Exception_Unbalanced $e) {
89
+ $item->setStatus(OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_UNBALANCED)->setMessage($e->getMessage())->save();
90
+ } catch (Exception $e) {
91
+ $status = ($item->getAttempt() >= OnePica_AvaTax_Model_Config::QUEUE_ATTEMPT_MAX) ? OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_FAILED : OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_RETRY;
92
+ $item->setStatus($status)->setMessage($e->getMessage())->save();
93
+ }
94
+ }
95
+
96
+ return $this;
97
+ }
98
+
99
+ /**
100
+ * Attempt to send any pending credit memos to Avalara
101
+ *
102
+ * @return self
103
+ */
104
+ protected function _parseCreditMemos() {
105
+ $queue = Mage::getModel('avatax_records/queue')->getCollection()
106
+ ->addFieldToFilter('type', OnePica_AvaTax_Model_Records_Queue::QUEUE_TYPE_CREDITMEMEO)
107
+ ->addFieldToFilter('status', array('neq' => OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_FAILED))
108
+ ->addFieldToFilter('status', array('neq' => OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_COMPLETE))
109
+ ->addFieldToFilter('status', array('neq' => OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_UNBALANCED));
110
+ foreach($queue as $item) {
111
+ $item->setAttempt($item->getAttempt() + 1);
112
+ try {
113
+ $creditmemo = Mage::getModel('sales/order_creditmemo')->load($item->getEntityId());
114
+ if($creditmemo->getId()) Mage::getModel('avatax/avatax_invoice')->creditmemo($creditmemo);
115
+ $item->setStatus(OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_COMPLETE)->setMessage(null)->save();
116
+ } catch (OnePica_AvaTax_Model_Avatax_Exception_Unbalanced $e) {
117
+ $item->setStatus(OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_UNBALANCED)->setMessage($e->getMessage())->save();
118
+ } catch (Exception $e) {
119
+ $status = ($item->getAttempt() >= OnePica_AvaTax_Model_Config::QUEUE_ATTEMPT_MAX) ? OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_FAILED : OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_RETRY;
120
+ $item->setStatus($status)->setMessage($e->getMessage())->save();
121
+ }
122
+ }
123
+
124
+ return $this;
125
+ }
126
+
127
+ }
app/code/community/OnePica/AvaTax/Model/Sales/Quote/Address.php ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * The Sales Quote Address model.
20
+ */
21
+ class OnePica_AvaTax_Model_Sales_Quote_Address extends Mage_Sales_Model_Quote_Address
22
+ {
23
+ /**
24
+ * Avatax address validator instance
25
+ *
26
+ * @var OnePica_AvaTax_Model_Avatax_Address
27
+ */
28
+ protected $_avataxValidator = null;
29
+
30
+ /**
31
+ * Avatax address validator accessor method
32
+ *
33
+ * @return OnePica_AvaTax_Model_Avatax_Address
34
+ */
35
+ public function getAvataxValidator() {
36
+ return $this->_avataxValidator;
37
+ }
38
+
39
+ /**
40
+ * Avatax address validator mutator method
41
+ *
42
+ * @return OnePica_AvaTax_Model_Avatax_Address
43
+ * @return self
44
+ */
45
+ public function setAvataxValidator(OnePica_AvaTax_Model_Avatax_Address $object) {
46
+ $this->_avataxValidator = $object;
47
+ return $this;
48
+ }
49
+
50
+ /**
51
+ * Creates a hash key based on only address data for caching
52
+ *
53
+ * @return string
54
+ */
55
+ public function getCacheHashKey() {
56
+ if(!$this->getData('cache_hash_key')) {
57
+ $this->setData('cache_hash_key', hash('md4', $this->format('text')));
58
+ }
59
+ return $this->getData('cache_hash_key');
60
+ }
61
+
62
+ /**
63
+ * Validates the address. AvaTax validation is invoked if the this is a ship-to address.
64
+ * Returns true on success and an array with an error on failure.
65
+ *
66
+ * @return true|array
67
+ */
68
+ public function validate () {
69
+ $result = parent::validate();
70
+
71
+ //if base validation fails, don't bother with additional validation
72
+ if ($result !== true) {
73
+ return $result;
74
+ }
75
+
76
+ //if ship-to address, do AvaTax validation
77
+ $data = Mage::app()->getRequest()->getPost('billing', array());
78
+ $useForShipping = isset($data['use_for_shipping']) ? (int)$data['use_for_shipping'] : 0;
79
+
80
+ if($this->getAddressType() == self::TYPE_SHIPPING || $this->getUseForShipping() /* <1.9 */ || $useForShipping /* >=1.9 */) {
81
+ if(!$this->getAvataxValidator()) {
82
+ $validator = Mage::getModel('avatax/avatax_address')->setAddress($this);
83
+ $this->setAvataxValidator($validator);
84
+ }
85
+ return $this->getAvataxValidator()->validate();
86
+ }
87
+
88
+ return $result;
89
+ }
90
+
91
+
92
+ /* BELOW ARE MAGE CORE PROPERTIES AND METHODS ADDED FOR OLDER VERSION COMPATABILITY */
93
+
94
+ protected $_totalAmounts = array();
95
+ protected $_baseTotalAmounts = array();
96
+
97
+ /**
98
+ * Add amount total amount value
99
+ *
100
+ * @param string $code
101
+ * @param float $amount
102
+ * @return Mage_Sales_Model_Quote_Address
103
+ */
104
+ public function addTotalAmount($code, $amount)
105
+ {
106
+ $amount = $this->getTotalAmount($code)+$amount;
107
+ $this->setTotalAmount($code, $amount);
108
+ return $this;
109
+ }
110
+
111
+ /**
112
+ * Add amount total amount value in base store currency
113
+ *
114
+ * @param string $code
115
+ * @param float $amount
116
+ * @return Mage_Sales_Model_Quote_Address
117
+ */
118
+ public function addBaseTotalAmount($code, $amount)
119
+ {
120
+ $amount = $this->getBaseTotalAmount($code)+$amount;
121
+ $this->setBaseTotalAmount($code, $amount);
122
+ return $this;
123
+ }
124
+
125
+ /**
126
+ * Set total amount value
127
+ *
128
+ * @param string $code
129
+ * @param float $amount
130
+ * @return Mage_Sales_Model_Quote_Address
131
+ */
132
+ public function setTotalAmount($code, $amount)
133
+ {
134
+ $this->_totalAmounts[$code] = $amount;
135
+ if ($code != 'subtotal') {
136
+ $code = $code.'_amount';
137
+ }
138
+ $this->setData($code, $amount);
139
+ return $this;
140
+ }
141
+
142
+ /**
143
+ * Set total amount value in base store currency
144
+ *
145
+ * @param string $code
146
+ * @param float $amount
147
+ * @return Mage_Sales_Model_Quote_Address
148
+ */
149
+ public function setBaseTotalAmount($code, $amount)
150
+ {
151
+ $this->_baseTotalAmounts[$code] = $amount;
152
+ if ($code != 'subtotal') {
153
+ $code = $code.'_amount';
154
+ }
155
+ $this->setData('base_'.$code, $amount);
156
+ return $this;
157
+ }
158
+
159
+ /**
160
+ * Get total amount value by code
161
+ *
162
+ * @param string $code
163
+ * @return float
164
+ */
165
+ public function getTotalAmount($code)
166
+ {
167
+ if (isset($this->_totalAmounts[$code])) {
168
+ return $this->_totalAmounts[$code];
169
+ }
170
+ return 0;
171
+ }
172
+
173
+ /**
174
+ * Get total amount value by code in base store curncy
175
+ *
176
+ * @param string $code
177
+ * @return float
178
+ */
179
+ public function getBaseTotalAmount($code)
180
+ {
181
+ if (isset($this->_baseTotalAmounts[$code])) {
182
+ return $this->_baseTotalAmounts[$code];
183
+ }
184
+ return 0;
185
+ }
186
+ }
app/code/community/OnePica/AvaTax/Model/Sales/Quote/Address/Total/Grand.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * Grand totals calculation model
20
+ */
21
+ class OnePica_AvaTax_Model_Sales_Quote_Address_Total_Grand extends Mage_Sales_Model_Quote_Address_Total_Grand
22
+ {
23
+
24
+ /**
25
+ * Collect grand total address amount
26
+ *
27
+ * @param Mage_Sales_Model_Quote_Address $address
28
+ * @return OnePica_AvaTax_Model_Sales_Quote_Address_Total_Grand
29
+ */
30
+ public function collect(Mage_Sales_Model_Quote_Address $address) {
31
+ $grandTotal = $address->getGrandTotal();
32
+ parent::collect($address);
33
+
34
+ if(Mage::helper('avatax')->isAddressActionable($address->getQuote()->getShippingAddress(), $address->getQuote()->getStoreId())) {
35
+ if($address->getGrandTotal() == $grandTotal) {
36
+ $address->setGrandTotal($address->getGrandTotal() + $address->getTaxAmount());
37
+ $address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseTaxAmount());
38
+ }
39
+ }
40
+
41
+ return $this;
42
+ }
43
+
44
+ }
app/code/community/OnePica/AvaTax/Model/Sales/Quote/Address/Total/Tax.php ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * OnePica_AvaTax
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0), a
9
+ * copy of which is available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category OnePica
13
+ * @package OnePica_AvaTax
14
+ * @author OnePica Codemaster <codemaster@onepica.com>
15
+ * @copyright Copyright (c) 2009 One Pica, Inc.
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+
19
+ /**
20
+ * Tax totals calculation model
21
+ */
22
+ class OnePica_AvaTax_Model_Sales_Quote_Address_Total_Tax extends Mage_Sales_Model_Quote_Address_Total_Abstract {
23
+
24
+ /**
25
+ * Class constructor
26
+ */
27
+ public function __construct() {
28
+ $this->setCode('tax');
29
+ }
30
+
31
+ /**
32
+ * Collect tax totals for quote address
33
+ *
34
+ * @param Mage_Sales_Model_Quote_Address $address
35
+ * @return Mage_Tax_Model_Sales_Total_Quote
36
+ */
37
+ public function collect(Mage_Sales_Model_Quote_Address $address) {
38
+ $this->_setAddress($address);
39
+ parent::collect($address);
40
+
41
+ $store = $address->getQuote()->getStore();
42
+ $customer = $address->getQuote()->getCustomer();
43
+ $calculator = Mage::getModel('avatax/avatax_estimate');
44
+
45
+ $address->setTotalAmount($this->getCode(), 0);
46
+ $address->setBaseTotalAmount($this->getCode(), 0);
47
+
48
+ $address->setTaxAmount(0);
49
+ $address->setBaseTaxAmount(0);
50
+ $address->setShippingTaxAmount(0);
51
+ $address->setBaseShippingTaxAmount(0);
52
+
53
+ if(Mage::helper('avatax')->isAddressActionable($address->getQuote()->getShippingAddress(), $address->getQuote()->getStoreId())){ //Added check for calculating tax for regions filtered in the admin
54
+
55
+ foreach ($address->getAllItems() as $item) {
56
+ $item->setAddress($address);
57
+ $amount = $calculator->getItemTax($item);
58
+ $percent = $calculator->getItemRate($item);
59
+
60
+ $item->setTaxAmount($amount);
61
+ $item->setBaseTaxAmount($amount);
62
+ $item->setTaxPercent($percent);
63
+
64
+ $item->setPriceInclTax($item->getPrice() + ($amount / $item->getQty()));
65
+ $item->setBasePriceInclTax($item->getBasePrice() + ($amount / $item->getQty()));
66
+ $item->setRowTotalInclTax($item->getRowTotal() + $amount);
67
+ $item->setBaseRowTotalInclTax($item->getBaseRowTotal() + $amount);
68
+
69
+ if (!$calculator->isProductCalculated($item)) {
70
+ $this->_addAmount($amount);
71
+ $this->_addBaseAmount($amount);
72
+ }
73
+ }
74
+
75
+ if ($address->getAddressType() == Mage_Sales_Model_Quote_Address::TYPE_SHIPPING || $address->getUseForShipping()) {
76
+ $shippingItem = new Varien_Object();
77
+ $shippingItem->setId(Mage::helper('avatax')->getShippingSku($store->getId()));
78
+ $shippingItem->setProductId(Mage::helper('avatax')->getShippingSku($store->getId()));
79
+ $shippingItem->setAddress($address);
80
+ $shippingTax = $calculator->getItemTax($shippingItem);
81
+
82
+ $shippingAmt = $address->getTotalAmount('shipping');
83
+ $baseShippingAmt = $address->getBaseTotalAmount('shipping');
84
+
85
+ $address->setShippingTaxAmount($shippingTax);
86
+ $address->setBaseShippingTaxAmount($shippingTax);
87
+ $address->setShippingInclTax($shippingAmt + $shippingTax);
88
+ $address->setBaseShippingInclTax($baseShippingAmt + $shippingTax);
89
+ $address->setShippingTaxable($shippingTax ? $shippingAmt : 0);
90
+ $address->setBaseShippingTaxable($shippingTax ? $baseShippingAmt : 0);
91
+ $address->setIsShippingInclTax(false);
92
+
93
+ $this->_addAmount($shippingTax);
94
+ $this->_addBaseAmount($shippingTax);
95
+ }
96
+
97
+ if($address->getGwPrice()) {
98
+ $gwOrderItem = new Varien_Object();
99
+ $gwOrderItem->setId(Mage::helper('avatax')->getGwOrderSku($store->getId()));
100
+ $gwOrderItem->setProductId(Mage::helper('avatax')->getGwOrderSku($store->getId()));
101
+ $gwOrderItem->setAddress($address);
102
+ $gwOrderTax = $calculator->getItemTax($gwOrderItem);
103
+
104
+ $address->setGwBaseTaxAmount($address->getGwBasePrice()+$gwOrderTax);
105
+ $address->setGwTaxAmount($address->getGwPrice()+$gwOrderTax);
106
+
107
+ $this->_addAmount($gwOrderTax);
108
+ $this->_addBaseAmount($gwOrderTax);
109
+ }
110
+
111
+ if($address->getGwItemsPrice()) {
112
+ $gwIndividualItem = new Varien_Object();
113
+ $gwIndividualItem->setId(Mage::helper('avatax')->getGwItemsSku($store->getId()));
114
+ $gwIndividualItem->setProductId(Mage::helper('avatax')->getGwItemsSku($store->getId()));
115
+ $gwIndividualItem->setAddress($address);
116
+ $gwItemsTax = $calculator->getItemTax($gwIndividualItem);
117
+
118
+ $address->setGwItemsBaseTaxAmount($address->getGwItemsPrice()+$gwItemsTax);
119
+ $address->setGwItemsTaxAmount($address->getGwItemsBasePrice()+$gwItemsTax);
120
+
121
+ $this->_addAmount($gwItemsTax);
122
+ $this->_addBaseAmount($gwItemsTax);
123
+ }
124
+
125
+ if($address->getGwAddPrintedCard()) {
126
+ $gwPrintedCardItem = new Varien_Object();
127
+ $gwPrintedCardItem->setId(Mage::helper('avatax')->getGwPrintedCardSku($store->getId()));
128
+ $gwPrintedCardItem->setProductId(Mage::helper('avatax')->getGwPrintedCardSku($store->getId()));
129
+ $gwPrintedCardItem->setAddress($address);
130
+ $gwPrintedCardTax = $calculator->getItemTax($gwPrintedCardItem);
131
+
132
+ $address->setGwPrintedCardBaseTaxAmount($address->getGwPrintedCardBasePrice()+$gwPrintedCardTax);
133
+ $address->setGwPrintedCardTaxAmount($address->getGwPrintedCardPrice()+$gwPrintedCardTax);
134
+
135
+ $this->_addAmount($gwPrintedCardTax);
136
+ $this->_addBaseAmount($gwPrintedCardTax);
137
+ }
138
+ }
139
+ return $this;
140
+ }
141
+
142
+ /**
143
+ * Add tax totals information to address object
144
+ *
145
+ * @param Mage_Sales_Model_Quote_Address $address
146
+ * @return Mage_Tax_Model_Sales_Total_Quote
147
+ */
148
+ public function fetch(Mage_Sales_Model_Quote_Address $address) {
149
+ $config = Mage::getSingleton('tax/config');
150
+ $quote = $address->getQuote();
151
+ $store = $quote->getStore();
152
+ $amount = $address->getTaxAmount();
153
+
154
+ $fullInfo = array();
155
+ $summary = Mage::getModel('avatax/avatax_estimate')->getSummary($address->getId());
156
+
157
+ foreach ($summary as $key => $row) {
158
+ $id = 'avatax-' . $key;
159
+ $fullInfo[$id] = array(
160
+ 'rates' => array(array(
161
+ 'code' => $row['name'],
162
+ 'title' => $row['name'],
163
+ 'percent' => $row['rate'],
164
+ 'position' => $key,
165
+ 'priority' => $key,
166
+ 'rule_id' => 0
167
+ )),
168
+ 'percent' => $row['rate'],
169
+ 'id' => $id,
170
+ 'process' => 0,
171
+ 'amount' => $row['amt'],
172
+ 'base_amount' => $row['amt']
173
+ );
174
+ }
175
+
176
+ if (($amount != 0) || (Mage::helper('tax')->displayZeroTax($store))) {
177
+ $address->addTotal(array(
178
+ 'code' => $this->getCode(),
179
+ 'title' => Mage::helper('tax')->__('Tax'),
180
+ 'full_info' => $fullInfo,
181
+ 'value' => $amount,
182
+ 'area' => null
183
+ ));
184
+ }
185
+
186
+ /**
187
+ * Modify subtotal
188
+ */
189
+ if ($config->displayCartSubtotalBoth($store) || $config->displayCartSubtotalInclTax($store)) {
190
+ $subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount() - $address->getShippingTaxAmount();
191
+ $address->setSubtotalInclTax($subtotalInclTax);
192
+
193
+ $address->addTotal(array(
194
+ 'code' => 'subtotal',
195
+ 'title' => Mage::helper('sales')->__('Subtotal'),
196
+ 'value' => $subtotalInclTax,
197
+ 'value_incl_tax' => $subtotalInclTax,
198
+ 'value_excl_tax' => $address->getSubtotal(),
199
+ ));
200
+ }
201
+
202
+ return $this;
203
+ }
204
+
205
+ /* BELOW ARE MAGE CORE PROPERTIES AND METHODS ADDED FOR OLDER VERSION COMPATABILITY */
206
+
207
+ /**
208
+ * Total Code name
209
+ *
210
+ * @var string
211
+ */
212
+ protected $_code;
213
+ protected $_address = null;
214
+
215
+ /**
216
+ * Add total model amount value to address
217
+ *
218
+ * @param float $amount
219
+ * @return Mage_Sales_Model_Quote_Address_Total_Abstract
220
+ */
221
+ protected function _addAmount($amount) {
222
+ $this->_getAddress()->addTotalAmount($this->getCode(), $amount);
223
+ return $this;
224
+ }
225
+
226
+ /**
227
+ * Add total model base amount value to address
228
+ *
229
+ * @param float $amount
230
+ * @return Mage_Sales_Model_Quote_Address_Total_Abstract
231
+ */
232
+ protected function _addBaseAmount($baseAmount) {
233
+ $this->_getAddress()->addBaseTotalAmount($this->getCode(), $baseAmount);
234
+ return $this;
235
+ }
236
+
237
+ /**
238
+ * Set address shich can be used inside totals calculation
239
+ *
240
+ * @param Mage_Sales_Model_Quote_Address $address
241
+ * @return Mage_Sales_Model_Quote_Address_Total_Abstract
242
+ */
243
+ protected function _setAddress(Mage_Sales_Model_Quote_Address $address) {
244
+ $this->_address = $address;
245
+ return $this;
246
+ }
247
+
248
+ /**
249
+ * Get quote address object
250
+ *
251
+ * @throw Mage_Core_Exception if address not declared
252
+ * @return Mage_Sales_Model_Quote_Address
253
+ */
254
+ protected function _getAddress() {
255
+ if ($this->_address === null) {
256
+ Mage::throwException(
257
+ Mage::helper('sales')->__('Address model is not defined')
258
+ );
259
+ }
260
+ return $this->_address;
261
+ }
262
+
263
+ }
app/code/community/OnePica/AvaTax/Model/Session.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * The AvaTax Session model.
20
+ */
21
+ class OnePica_AvaTax_Model_Session extends Mage_Core_Model_Session_Abstract {
22
+
23
+ public function __construct($data=array()) {
24
+ $this->init('avatax');
25
+ }
26
+
27
+ }
app/code/community/OnePica/AvaTax/Model/Source/Actions.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Model_Source_Actions
20
+ {
21
+ /**
22
+ * Gets the list of cache methods for the admin config dropdown
23
+ *
24
+ * @return array
25
+ */
26
+ public function toOptionArray()
27
+ {
28
+ return array(
29
+ array(
30
+ 'value' => OnePica_AvaTax_Model_Config::ACTION_DISABLE,
31
+ 'label' => Mage::helper('avatax')->__('Disable')),
32
+ array(
33
+ 'value' => OnePica_AvaTax_Model_Config::ACTION_CALC,
34
+ 'label' => Mage::helper('avatax')->__('Enable: calculate tax')),
35
+ array(
36
+ 'value' => OnePica_AvaTax_Model_Config::ACTION_CALC_SUBMIT,
37
+ 'label' => Mage::helper('avatax')->__('Enable: calculate tax, submit data')),
38
+ array(
39
+ 'value' => OnePica_AvaTax_Model_Config::ACTION_CALC_SUBMIT_COMMIT,
40
+ 'label' => Mage::helper('avatax')->__('Enable: calculate tax, submit data, and commit')),
41
+ );
42
+ }
43
+ }
app/code/community/OnePica/AvaTax/Model/Source/Customercodeformat.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Model_Source_Customercodeformat
20
+ {
21
+ const LEGACY = 0; //depricated, included for stores who are upgrading so the code format doesn't change unexpectedly
22
+ const CUST_ID = 1; //recommended
23
+ const CUST_EMAIL = 2;
24
+
25
+ /**
26
+ * Gets the list of cache methods for the admin config dropdown
27
+ *
28
+ * @return array
29
+ */
30
+ public function toOptionArray()
31
+ {
32
+ return array(
33
+ array(
34
+ 'value' => self::CUST_ID,
35
+ 'label' => 'customer_id'),
36
+ array(
37
+ 'value' => self::CUST_EMAIL,
38
+ 'label' => 'customer_email'),
39
+ array(
40
+ 'value' => self::LEGACY,
41
+ 'label' => 'customer_name (customer_id)'),
42
+ );
43
+ }
44
+ }
app/code/community/OnePica/AvaTax/Model/Source/Error.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Model_Source_Error
20
+ {
21
+ /**
22
+ * Gets the list of cache methods for the admin config dropdown
23
+ *
24
+ * @return array
25
+ */
26
+ public function toOptionArray()
27
+ {
28
+ return array(
29
+ array(
30
+ 'value' => 1,
31
+ 'label' => Mage::helper('avatax')->__('Disable checkout & show error message')),
32
+ array(
33
+ 'value' => 0,
34
+ 'label' => Mage::helper('avatax')->__('Allow checkout without charging tax (no error message)')),
35
+ );
36
+ }
37
+ }
app/code/community/OnePica/AvaTax/Model/Source/Logmode.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Model_Source_Logmode
20
+ {
21
+ const ERRORS = 0;
22
+ const NORMAL = 1;
23
+ const DEBUG = 2;
24
+
25
+ /**
26
+ * Gets the list of cache methods for the admin config dropdown
27
+ *
28
+ * @return array
29
+ */
30
+ public function toOptionArray()
31
+ {
32
+ return array(
33
+ array(
34
+ 'value' => self::ERRORS,
35
+ 'label' => Mage::helper('avatax')->__('Log only errors')),
36
+ array(
37
+ 'value' => self::NORMAL,
38
+ 'label' => Mage::helper('avatax')->__('Log all actions (recommended)')),
39
+ array(
40
+ 'value' => self::DEBUG,
41
+ 'label' => Mage::helper('avatax')->__('Log all actions with trace (debug mode)'))
42
+ );
43
+ }
44
+ }
app/code/community/OnePica/AvaTax/Model/Source/Onerrorfrontend.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Model_Source_Onerrorfrontend
20
+ {
21
+ /**
22
+ * Gets the list of cache methods for the admin config dropdown
23
+ *
24
+ * @return array
25
+ */
26
+ public function toOptionArray()
27
+ {
28
+ return array(
29
+ array('value'=>1, 'label'=>Mage::helper('avatax')->__('Always show no tax')),
30
+ array('value'=>2, 'label'=>Mage::helper('avatax')->__('Always show no tax and warn user')),
31
+ array('value'=>3, 'label'=>Mage::helper('avatax')->__('Stop orders from completing and warn user')),
32
+ );
33
+ }
34
+ }
app/code/community/OnePica/AvaTax/Model/Source/Regionfilter/List.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ class OnePica_AvaTax_Model_Source_Regionfilter_List
29
+ {
30
+ protected $_options;
31
+
32
+ public function toOptionArray($isMultiselect=false)
33
+ {
34
+ if (!$this->_options) {
35
+ $countries = array('US', 'CA');
36
+ $this->_options = array();
37
+
38
+ $this->_options[] = array(
39
+ 'label' => '',
40
+ 'value' => ''
41
+ );
42
+
43
+ foreach($countries as $country) {
44
+ $regions = Mage::getResourceModel('directory/region_collection')
45
+ ->addCountryFilter($country)
46
+ ->loadData()
47
+ ->toOptionArray();
48
+ array_shift($regions);
49
+
50
+ $this->_options[] = array(
51
+ 'label' => Mage::app()->getLocale()->getCountryTranslation($country),
52
+ 'value' => $regions
53
+ );
54
+ }
55
+ }
56
+
57
+ return $this->_options;
58
+ }
59
+ }
app/code/community/OnePica/AvaTax/Model/Source/Regionfilter/Mode.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class OnePica_AvaTax_Model_Source_Regionfilter_Mode
20
+ {
21
+ /**
22
+ * Gets the list of cache methods for the admin config dropdown
23
+ *
24
+ * @return array
25
+ */
26
+ public function toOptionArray()
27
+ {
28
+ return array(
29
+ array(
30
+ 'value' => OnePica_AvaTax_Model_Config::REGIONFILTER_OFF,
31
+ 'label' => Mage::helper('avatax')->__('None')),
32
+ array(
33
+ 'value' => OnePica_AvaTax_Model_Config::REGIONFILTER_TAX,
34
+ 'label' => Mage::helper('avatax')->__('Filter tax calculations')),
35
+ array(
36
+ 'value' => OnePica_AvaTax_Model_Config::REGIONFILTER_ALL,
37
+ 'label' => Mage::helper('avatax')->__('Filter tax calculations & address options')),
38
+ );
39
+ }
40
+ }
app/code/community/OnePica/AvaTax/controllers/Adminhtml/ExportController.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class OnePica_AvaTax_Adminhtml_ExportController extends Mage_Adminhtml_Controller_Action
19
+ {
20
+ protected function _isAllowed()
21
+ {
22
+ return Mage::getSingleton('admin/session')->isAllowed('avatax');
23
+ }
24
+
25
+ public function logAction() {
26
+ $fileName = 'avatax-log-' . gmdate('U') . '.sql';
27
+ $content = $this->getLayout()->createBlock('avatax/adminhtml_export_log_grid')->getSql();
28
+ $this->_sendResponse($fileName, $content);
29
+ }
30
+
31
+ public function queueAction() {
32
+ $fileName = 'avatax-queue-' . gmdate('U') . '.sql';
33
+ $content = $this->getLayout()->createBlock('avatax/adminhtml_export_queue_grid')->getSql();
34
+ $this->_sendResponse($fileName, $content);
35
+ }
36
+
37
+ protected function _sendResponse($fileName, $content, $contentType='application/octet-stream') {
38
+ $response = $this->getResponse();
39
+ $response->setHeader('HTTP/1.1 200 OK','');
40
+ $response->setHeader('Pragma', 'public', true);
41
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
42
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
43
+ $response->setHeader('Last-Modified', date('r'));
44
+ $response->setHeader('Accept-Ranges', 'bytes');
45
+ $response->setHeader('Content-Length', strlen($content));
46
+ $response->setHeader('Content-type', $contentType);
47
+ $response->setBody($content);
48
+ $response->sendResponse();
49
+ exit;
50
+ }
51
+
52
+ }
app/code/community/OnePica/AvaTax/controllers/Adminhtml/GridController.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class OnePica_AvaTax_Adminhtml_GridController extends Mage_Adminhtml_Controller_Action
19
+ {
20
+
21
+ /**
22
+ * Additional initialization
23
+ *
24
+ */
25
+ protected function _construct() {
26
+ $this->setUsedModuleName('OnePica_AvaTax');
27
+ }
28
+
29
+ public function logAction() {
30
+ $this->_setTitle($this->__('Sales'))->_setTitle($this->__('Tax'))->_setTitle($this->__('AvaTax Log'));
31
+
32
+ $this->loadLayout()
33
+ ->_setActiveMenu('sales/tax/avatax_log')
34
+ ->_addContent($this->getLayout()->createBlock('avatax/adminhtml_export_log_grid'))
35
+ ->renderLayout();
36
+ }
37
+
38
+ public function queueAction() {
39
+ $this->_setTitle($this->__('Sales'))->_setTitle($this->__('Tax'))->_setTitle($this->__('AvaTax Queue'));
40
+
41
+ $this->loadLayout()
42
+ ->_setActiveMenu('sales/tax/avatax_queue')
43
+ ->_addContent($this->getLayout()->createBlock('avatax/adminhtml_export_queue_grid'))
44
+ ->renderLayout();
45
+ }
46
+
47
+ public function processQueueAction() {
48
+ Mage::getModel('avatax_records/queue_process')->run();
49
+ $this->_redirect('*/*/queue');
50
+ }
51
+
52
+ protected function _isAllowed() {
53
+ return Mage::getSingleton('admin/session')->isAllowed('avatax');
54
+ }
55
+
56
+ /**
57
+ * Magento <1.4 does not let the title be set
58
+ *
59
+ * @param string
60
+ * @return self
61
+ */
62
+ protected function _setTitle($title) {
63
+ if(method_exists($this, '_title')) {
64
+ $this->_title($title);
65
+ }
66
+ return $this;
67
+ }
68
+
69
+ }
app/code/community/OnePica/AvaTax/etc/adminhtml.xml ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * OnePica_AvaTax
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0), a
9
+ * copy of which is available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category OnePica
13
+ * @package OnePica_AvaTax
14
+ * @author OnePica Codemaster <codemaster@onepica.com>
15
+ * @copyright Copyright (c) 2009 One Pica, Inc.
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+ -->
19
+
20
+ <config>
21
+ <!-- the adminhtml section is repeated in config.xml & adminhtml.xml for backwards compatibility -->
22
+ <!-- @see http://www.magentocommerce.com/bug-tracking/issue?issue=8496 -->
23
+ <layout>
24
+ <updates>
25
+ <avatax>
26
+ <file>avatax.xml</file>
27
+ </avatax>
28
+ </updates>
29
+ </layout>
30
+ <menu>
31
+ <sales>
32
+ <children>
33
+ <tax>
34
+ <children>
35
+ <rules>
36
+ <!-- enabled/disabled in OnePica_AvaTax_Model_Admin_Session -->
37
+ </rules>
38
+ <rates>
39
+ <!-- enabled/disabled in OnePica_AvaTax_Model_Admin_Session -->
40
+ </rates>
41
+ <import_export>
42
+ <!-- enabled/disabled in OnePica_AvaTax_Model_Admin_Session -->
43
+ </import_export>
44
+ <avatax_queue translate="title" module="avatax">
45
+ <title>AvaTax Order Sync Queue</title>
46
+ <action>avatax/adminhtml_grid/queue</action>
47
+ </avatax_queue>
48
+ <!--
49
+ <avatax_log translate="title" module="avatax">
50
+ <title>AvaTax Log</title>
51
+ <action>avatax/adminhtml_grid/log</action>
52
+ </avatax_log>
53
+ -->
54
+ </children>
55
+ </tax>
56
+ </children>
57
+ </sales>
58
+ </menu>
59
+ <acl>
60
+ <resources>
61
+ <admin>
62
+ <children>
63
+ <avatax translate="title">
64
+ <title>AvaTax Module</title>
65
+ <sort_order>100</sort_order>
66
+ </avatax>
67
+ </children>
68
+ </admin>
69
+ </resources>
70
+ </acl>
71
+ </config>
app/code/community/OnePica/AvaTax/etc/config.xml ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * OnePica_AvaTax
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0), a
9
+ * copy of which is available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category OnePica
13
+ * @package OnePica_AvaTax
14
+ * @author OnePica Codemaster <codemaster@onepica.com>
15
+ * @copyright Copyright (c) 2009 One Pica, Inc.
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+ -->
19
+
20
+ <config>
21
+ <modules>
22
+ <OnePica_AvaTax>
23
+ <version>2.3.0</version>
24
+ </OnePica_AvaTax>
25
+ </modules>
26
+ <global>
27
+ <models>
28
+ <avatax>
29
+ <class>OnePica_AvaTax_Model</class>
30
+ </avatax>
31
+ <avatax_records>
32
+ <class>OnePica_AvaTax_Model_Records</class>
33
+ <resourceModel>avatax_records_mysql4</resourceModel>
34
+ </avatax_records>
35
+ <avatax_records_mysql4>
36
+ <class>OnePica_AvaTax_Model_Records_Mysql4</class>
37
+ <entities>
38
+ <log>
39
+ <table>op_avatax_log</table>
40
+ </log>
41
+ <queue>
42
+ <table>op_avatax_queue</table>
43
+ </queue>
44
+ </entities>
45
+ </avatax_records_mysql4>
46
+ <adminhtml>
47
+ <rewrite>
48
+ <config>OnePica_AvaTax_Model_Adminhtml_Config</config>
49
+ <sales_order_create>OnePica_AvaTax_Model_Adminhtml_Sales_Order_Create</sales_order_create>
50
+ </rewrite>
51
+ </adminhtml>
52
+ <admin>
53
+ <rewrite>
54
+ <session>OnePica_AvaTax_Model_Admin_Session</session>
55
+ </rewrite>
56
+ </admin>
57
+ <sales>
58
+ <rewrite>
59
+ <quote_address>OnePica_AvaTax_Model_Sales_Quote_Address</quote_address>
60
+ <quote_address_total_grand>OnePica_AvaTax_Model_Sales_Quote_Address_Total_Grand</quote_address_total_grand>
61
+ </rewrite>
62
+ </sales>
63
+ </models>
64
+ <helpers>
65
+ <avatax>
66
+ <class>OnePica_AvaTax_Helper</class>
67
+ </avatax>
68
+ <tax>
69
+ <rewrite>
70
+ <data>OnePica_AvaTax_Helper_Tax_Data</data>
71
+ </rewrite>
72
+ </tax>
73
+ </helpers>
74
+ <blocks>
75
+ <avatax>
76
+ <class>OnePica_AvaTax_Block</class>
77
+ </avatax>
78
+ <adminhtml>
79
+ <rewrite>
80
+ <tax_class_grid>OnePica_AvaTax_Block_Adminhtml_Tax_Class_Grid</tax_class_grid>
81
+ <tax_class_edit_form>OnePica_AvaTax_Block_Adminhtml_Tax_Class_Edit_Form</tax_class_edit_form>
82
+ </rewrite>
83
+ </adminhtml>
84
+ </blocks>
85
+ <resources>
86
+ <avatax_records_setup>
87
+ <setup>
88
+ <module>OnePica_AvaTax</module>
89
+ </setup>
90
+ <connection>
91
+ <use>core_setup</use>
92
+ </connection>
93
+ </avatax_records_setup>
94
+ <avatax_records_write>
95
+ <connection>
96
+ <use>core_write</use>
97
+ </connection>
98
+ </avatax_records_write>
99
+ <avatax_records_read>
100
+ <connection>
101
+ <use>core_read</use>
102
+ </connection>
103
+ </avatax_records_read>
104
+ </resources>
105
+ <events>
106
+ <sales_quote_collect_totals_before>
107
+ <observers>
108
+ <avatax>
109
+ <type>singleton</type>
110
+ <class>avatax/observer</class>
111
+ <method>salesQuoteCollectTotalsBefore</method>
112
+ </avatax>
113
+ </observers>
114
+ </sales_quote_collect_totals_before>
115
+ <sales_order_invoice_save_after>
116
+ <observers>
117
+ <avatax>
118
+ <type>singleton</type>
119
+ <class>avatax/observer</class>
120
+ <method>salesOrderInvoiceSaveAfter</method>
121
+ </avatax>
122
+ </observers>
123
+ </sales_order_invoice_save_after>
124
+ <sales_order_creditmemo_save_after>
125
+ <observers>
126
+ <avatax>
127
+ <type>singleton</type>
128
+ <class>avatax/observer</class>
129
+ <method>salesOrderCreditmemoSaveAfter</method>
130
+ </avatax>
131
+ </observers>
132
+ </sales_order_creditmemo_save_after>
133
+ <admin_system_config_changed_section_tax>
134
+ <observers>
135
+ <avatax>
136
+ <type>singleton</type>
137
+ <class>avatax/observer</class>
138
+ <method>adminSystemConfigChangedSectionTax</method>
139
+ </avatax>
140
+ </observers>
141
+ </admin_system_config_changed_section_tax>
142
+ <checkout_type_multishipping_set_shipping_items>
143
+ <observers>
144
+ <avatax>
145
+ <type>singleton</type>
146
+ <class>avatax/observer</class>
147
+ <method>multishippingSetShippingItems</method>
148
+ </avatax>
149
+ </observers>
150
+ </checkout_type_multishipping_set_shipping_items>
151
+ </events>
152
+ <!-- set on-the-fly in OnePica_AvaTax_Model_Observer::salesQuoteCollectTotalsBefore
153
+ <sales>
154
+ <quote>
155
+ <totals>
156
+ <tax>
157
+ <class>avatax/sales_quote_address_total_tax</class>
158
+ <after>subtotal,shipping</after>
159
+ <before>customerbalance,grand_total</before>
160
+ </tax>
161
+ </totals>
162
+ </quote>
163
+ </sales>
164
+ -->
165
+ </global>
166
+ <frontend>
167
+ <layout>
168
+ <updates>
169
+ <avatax>
170
+ <file>avatax.xml</file>
171
+ </avatax>
172
+ </updates>
173
+ </layout>
174
+ </frontend>
175
+ <admin>
176
+ <routers>
177
+ <avatax>
178
+ <use>admin</use>
179
+ <args>
180
+ <module>OnePica_AvaTax</module>
181
+ <frontName>avatax</frontName>
182
+ </args>
183
+ </avatax>
184
+ </routers>
185
+ </admin>
186
+ <!-- the adminhtml section is repeated in config.xml & adminhtml.xml for backwards compatibility -->
187
+ <!-- @see http://www.magentocommerce.com/bug-tracking/issue?issue=8496 -->
188
+ <adminhtml>
189
+ <layout>
190
+ <updates>
191
+ <avatax>
192
+ <file>avatax.xml</file>
193
+ </avatax>
194
+ </updates>
195
+ </layout>
196
+ <menu>
197
+ <sales>
198
+ <children>
199
+ <tax>
200
+ <children>
201
+ <rules>
202
+ <!-- enabled/disabled in OnePica_AvaTax_Model_Admin_Session -->
203
+ </rules>
204
+ <rates>
205
+ <!-- enabled/disabled in OnePica_AvaTax_Model_Admin_Session -->
206
+ </rates>
207
+ <import_export>
208
+ <!-- enabled/disabled in OnePica_AvaTax_Model_Admin_Session -->
209
+ </import_export>
210
+ <avatax_queue translate="title" module="avatax">
211
+ <title>AvaTax Order Sync Queue</title>
212
+ <action>avatax/adminhtml_grid/queue</action>
213
+ </avatax_queue>
214
+ <!--
215
+ <avatax_log translate="title" module="avatax">
216
+ <title>AvaTax Log</title>
217
+ <action>avatax/adminhtml_grid/log</action>
218
+ </avatax_log>
219
+ -->
220
+ </children>
221
+ </tax>
222
+ </children>
223
+ </sales>
224
+ </menu>
225
+ <acl>
226
+ <resources>
227
+ <admin>
228
+ <children>
229
+ <avatax translate="title">
230
+ <title>AvaTax Module</title>
231
+ <sort_order>100</sort_order>
232
+ </avatax>
233
+ </children>
234
+ </admin>
235
+ </resources>
236
+ </acl>
237
+ </adminhtml>
238
+ <default>
239
+ <tax>
240
+ <avatax>
241
+ <action>0</action>
242
+ <url>https://avatax.avalara.net/</url>
243
+ <region_filter_mode>0</region_filter_mode>
244
+ <country_filter_list>CA,US</country_filter_list>
245
+ <log_status>1</log_status>
246
+ <log_lifetime>3</log_lifetime>
247
+ <queue_success_lifetime>7</queue_success_lifetime>
248
+ <queue_failed_lifetime>60</queue_failed_lifetime>
249
+ <cust_code_format>0</cust_code_format>
250
+ <shipping_sku>Shipping</shipping_sku>
251
+ <gw_order_sku>GwOrder</gw_order_sku>
252
+ <gw_items_sku>GwItems</gw_items_sku>
253
+ <gw_printed_card_sku>GwPrintedCard</gw_printed_card_sku>
254
+ <adjustment_positive_sku>Adjustment</adjustment_positive_sku>
255
+ <adjustment_negative_sku>Adjustment</adjustment_negative_sku>
256
+ <sales_person_code>Magento</sales_person_code>
257
+ <error_full_stop>1</error_full_stop>
258
+ <error_frontend_action>2</error_frontend_action>
259
+ <error_frontend_message>Unfortunately, we could not calculate tax for your order. Please try again with a different address or contact us to complete your order.</error_frontend_message>
260
+ <error_backend_message>There was an error getting tax rates from Avalara. Please see the error log for details.</error_backend_message>
261
+ <error_notification_toolbar>1</error_notification_toolbar>
262
+ <onepage_normalize_message>Your shipping address has been modified during our validation process. Please confirm the address to the right is accurate.</onepage_normalize_message>
263
+ <multiaddress_normalize_message>Your shipping addresses have been modified during our validation process. Please confirm they are still correct.</multiaddress_normalize_message>
264
+ <validate_address_message>The address '%s' appears invalid. Please correct it or select another address.</validate_address_message>
265
+ </avatax>
266
+ <calculation>
267
+ <based_on>shipping</based_on>
268
+ <price_includes_tax>0</price_includes_tax>
269
+ <shipping_includes_tax>0</shipping_includes_tax>
270
+ <apply_after_discount>1</apply_after_discount>
271
+ <discount_tax>1</discount_tax>
272
+ <apply_tax_on>0</apply_tax_on>
273
+ </calculation>
274
+ <defaults>
275
+ <region>0</region>
276
+ <postcode>*</postcode>
277
+ </defaults>
278
+ </tax>
279
+ </default>
280
+ <crontab>
281
+ <jobs>
282
+ <avatax_processqueue>
283
+ <schedule><cron_expr>0 * * * *</cron_expr></schedule>
284
+ <run>
285
+ <model>avatax/observer::processQueue</model>
286
+ </run>
287
+ </avatax_processqueue>
288
+ <avatax_cleanlog>
289
+ <schedule><cron_expr>0 0 * * *</cron_expr></schedule>
290
+ <run>
291
+ <model>avatax/observer::cleanLog</model>
292
+ </run>
293
+ </avatax_cleanlog>
294
+ </jobs>
295
+ </crontab>
296
+ </config>
app/code/community/OnePica/AvaTax/etc/system-disabled.xml ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * OnePica_AvaTax
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0), a
9
+ * copy of which is available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category OnePica
13
+ * @package OnePica_AvaTax
14
+ * @author OnePica Codemaster <codemaster@onepica.com>
15
+ * @copyright Copyright (c) 2009 One Pica, Inc.
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+ -->
19
+
20
+ <config>
21
+ <sections>
22
+ <tax>
23
+ <groups>
24
+ <classes>
25
+ <fields>
26
+ <shipping_tax_class>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ </shipping_tax_class>
31
+ </fields>
32
+ </classes>
33
+ <calculation>
34
+ <fields>
35
+ <based_on>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ </based_on>
40
+ <price_includes_tax>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ </price_includes_tax>
45
+ <shipping_includes_tax>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ </shipping_includes_tax>
50
+ <apply_after_discount>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ </apply_after_discount>
55
+ <discount_tax>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>1</show_in_website>
58
+ <show_in_store>1</show_in_store>
59
+ </discount_tax>
60
+ <apply_tax_on>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ </apply_tax_on>
65
+ </fields>
66
+ </calculation>
67
+ <defaults>
68
+ <fields>
69
+ <region>
70
+ <comment></comment>
71
+ </region>
72
+ <postcode>
73
+ <comment></comment>
74
+ </postcode>
75
+ </fields>
76
+ </defaults>
77
+ <sales_display>
78
+ <display>
79
+ <fields>
80
+ <full_summary>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ </full_summary>
85
+ </fields>
86
+ </display>
87
+ </sales_display>
88
+ </groups>
89
+ </tax>
90
+ </sections>
91
+ </config>
app/code/community/OnePica/AvaTax/etc/system.xml ADDED
@@ -0,0 +1,485 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * OnePica_AvaTax
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0), a
9
+ * copy of which is available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category OnePica
13
+ * @package OnePica_AvaTax
14
+ * @author OnePica Codemaster <codemaster@onepica.com>
15
+ * @copyright Copyright (c) 2009 One Pica, Inc.
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+ -->
19
+
20
+ <config>
21
+ <sections>
22
+ <tax>
23
+ <tab>sales</tab>
24
+ <groups>
25
+ <avatax translate="label comment">
26
+ <label>AvaTax</label>
27
+ <comment><![CDATA[
28
+ <style type="text/css"> #tax_avatax textarea { height:65px; } #tax_avatax .multiselect { height:155px; } </style>
29
+ <p class="switcher">For complete and up-to-date documentation, please visit <a href="http://www.onepica.com/magento-extensions/avatax/" target="_blank">http://www.onepica.com/magento-extensions/avatax</a>.</p>
30
+ ]]></comment>
31
+ <sort_order>0</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ <fields>
36
+ <title_connection_settings translate="label">
37
+ <label><![CDATA[<strong>Connection Settings</strong>]]></label>
38
+ <frontend_type>label</frontend_type>
39
+ <sort_order>0</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ </title_connection_settings>
44
+ <action translate="label">
45
+ <label>Action</label>
46
+ <frontend_type>select</frontend_type>
47
+ <source_model>avatax/source_actions</source_model>
48
+ <sort_order>10</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ </action>
53
+ <url translate="label">
54
+ <label>URL</label>
55
+ <frontend_type>text</frontend_type>
56
+ <sort_order>20</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>1</show_in_website>
59
+ <show_in_store>1</show_in_store>
60
+ </url>
61
+ <account translate="label">
62
+ <label>Account Number</label>
63
+ <frontend_type>text</frontend_type>
64
+ <sort_order>30</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>1</show_in_store>
68
+ </account>
69
+ <license translate="label">
70
+ <label>License Key</label>
71
+ <frontend_type>text</frontend_type>
72
+ <sort_order>40</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </license>
77
+ <company_code translate="label comment">
78
+ <label>Company Code</label>
79
+ <comment>Required. Your company code from the dashboard.</comment>
80
+ <frontend_type>text</frontend_type>
81
+ <sort_order>50</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ </company_code>
86
+ <region_filter_mode translate="label">
87
+ <label>Filter Requests by Region</label>
88
+ <frontend_type>select</frontend_type>
89
+ <source_model>avatax/source_regionfilter_mode</source_model>
90
+ <sort_order>60</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ <show_in_store>1</show_in_store>
94
+ </region_filter_mode>
95
+ <region_filter_list translate="label comment">
96
+ <label></label>
97
+ <comment><![CDATA[Select regions to use AvaTax services. Ignored if <em>Filter Requests by Region</em> is set to <em>None</em>.]]></comment>
98
+ <frontend_type>multiselect</frontend_type>
99
+ <source_model>avatax/source_regionfilter_list</source_model>
100
+ <sort_order>70</sort_order>
101
+ <show_in_default>1</show_in_default>
102
+ <show_in_website>1</show_in_website>
103
+ <show_in_store>1</show_in_store>
104
+ </region_filter_list>
105
+ <country_filter_list>
106
+ <frontend_type>multiselect</frontend_type>
107
+ <source_model>adminhtml/system_config_source_country</source_model>
108
+ <sort_order>80</sort_order>
109
+ <show_in_default>0</show_in_default>
110
+ <show_in_website>0</show_in_website>
111
+ <show_in_store>0</show_in_store>
112
+ </country_filter_list>
113
+
114
+ <title_debug_settings translate="label">
115
+ <label><![CDATA[<strong>Log &amp; Queue Settings</strong>]]></label>
116
+ <frontend_type>label</frontend_type>
117
+ <sort_order>100</sort_order>
118
+ <show_in_default>1</show_in_default>
119
+ <show_in_website>1</show_in_website>
120
+ <show_in_store>1</show_in_store>
121
+ </title_debug_settings>
122
+ <log_status translate="label">
123
+ <label>Log Mode</label>
124
+ <frontend_type>select</frontend_type>
125
+ <source_model>avatax/source_logmode</source_model>
126
+ <sort_order>110</sort_order>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>1</show_in_website>
129
+ <show_in_store>1</show_in_store>
130
+ </log_status>
131
+ <log_lifetime translate="label comment">
132
+ <label>Log Entry Lifetime</label>
133
+ <comment>Required. Days before entries are auto-purged.</comment>
134
+ <frontend_type>text</frontend_type>
135
+ <sort_order>120</sort_order>
136
+ <show_in_default>1</show_in_default>
137
+ <show_in_website>0</show_in_website>
138
+ <show_in_store>0</show_in_store>
139
+ </log_lifetime>
140
+ <queue_success_lifetime translate="label comment">
141
+ <label>Successful Queue Lifetime</label>
142
+ <comment>Required. Days before entries are auto-purged.</comment>
143
+ <frontend_type>text</frontend_type>
144
+ <sort_order>122</sort_order>
145
+ <show_in_default>1</show_in_default>
146
+ <show_in_website>0</show_in_website>
147
+ <show_in_store>0</show_in_store>
148
+ </queue_success_lifetime>
149
+ <queue_failed_lifetime translate="label comment">
150
+ <label>Failed Queue Lifetime</label>
151
+ <comment>Required. Days before entries are auto-purged.</comment>
152
+ <frontend_type>text</frontend_type>
153
+ <sort_order>124</sort_order>
154
+ <show_in_default>1</show_in_default>
155
+ <show_in_website>0</show_in_website>
156
+ <show_in_store>0</show_in_store>
157
+ </queue_failed_lifetime>
158
+ <log_export>
159
+ <label></label>
160
+ <frontend_model>avatax/adminhtml_system_config_form_field_export</frontend_model>
161
+ <sort_order>130</sort_order>
162
+ <show_in_default>1</show_in_default>
163
+ <show_in_website>0</show_in_website>
164
+ <show_in_store>0</show_in_store>
165
+ </log_export>
166
+
167
+ <title_data_mapping translate="label">
168
+ <label><![CDATA[<strong>Data Mapping</strong>]]></label>
169
+ <frontend_type>label</frontend_type>
170
+ <sort_order>200</sort_order>
171
+ <show_in_default>1</show_in_default>
172
+ <show_in_website>1</show_in_website>
173
+ <show_in_store>1</show_in_store>
174
+ </title_data_mapping>
175
+ <cust_code_format translate="label comment">
176
+ <label>Customer Code Format</label>
177
+ <comment><![CDATA[Recommended: <code>customer_id</code>]]></comment>
178
+ <frontend_type>select</frontend_type>
179
+ <source_model>avatax/source_customercodeformat</source_model>
180
+ <sort_order>205</sort_order>
181
+ <show_in_default>1</show_in_default>
182
+ <show_in_website>1</show_in_website>
183
+ <show_in_store>1</show_in_store>
184
+ </cust_code_format>
185
+ <shipping_sku translate="label comment">
186
+ <label>Shipping Sku</label>
187
+ <comment>Required. The sku sent to denote shipping costs.</comment>
188
+ <frontend_type>text</frontend_type>
189
+ <sort_order>210</sort_order>
190
+ <show_in_default>1</show_in_default>
191
+ <show_in_website>1</show_in_website>
192
+ <show_in_store>1</show_in_store>
193
+ </shipping_sku>
194
+ <gw_order_sku translate="label comment">
195
+ <label>Gift Wrap Order Sku</label>
196
+ <comment>Required. The sku sent to denote gift wrap order costs.</comment>
197
+ <frontend_type>text</frontend_type>
198
+ <sort_order>215</sort_order>
199
+ <show_in_default>1</show_in_default>
200
+ <show_in_website>1</show_in_website>
201
+ <show_in_store>1</show_in_store>
202
+ </gw_order_sku>
203
+ <gw_items_sku translate="label comment">
204
+ <label>Gift Wrap Items Sku</label>
205
+ <comment>Required. The sku sent to denote gift wrap items costs.</comment>
206
+ <frontend_type>text</frontend_type>
207
+ <sort_order>216</sort_order>
208
+ <show_in_default>1</show_in_default>
209
+ <show_in_website>1</show_in_website>
210
+ <show_in_store>1</show_in_store>
211
+ </gw_items_sku>
212
+ <gw_printed_card_sku translate="label comment">
213
+ <label>Gift Wrap Printed Card Sku</label>
214
+ <comment>Required. The sku sent to denote gift wrap printed card costs.</comment>
215
+ <frontend_type>text</frontend_type>
216
+ <sort_order>217</sort_order>
217
+ <show_in_default>1</show_in_default>
218
+ <show_in_website>1</show_in_website>
219
+ <show_in_store>1</show_in_store>
220
+ </gw_printed_card_sku>
221
+ <adjustment_positive_sku translate="label comment">
222
+ <label>Adjustment Refund Sku</label>
223
+ <comment>Required. The sku sent to denote positive ajustments.</comment>
224
+ <frontend_type>text</frontend_type>
225
+ <sort_order>220</sort_order>
226
+ <show_in_default>1</show_in_default>
227
+ <show_in_website>1</show_in_website>
228
+ <show_in_store>1</show_in_store>
229
+ </adjustment_positive_sku>
230
+ <adjustment_negative_sku translate="label comment">
231
+ <label>Adjustment Fee Sku</label>
232
+ <comment>Required. The sku sent to denote negative ajustments.</comment>
233
+ <frontend_type>text</frontend_type>
234
+ <sort_order>230</sort_order>
235
+ <show_in_default>1</show_in_default>
236
+ <show_in_website>1</show_in_website>
237
+ <show_in_store>1</show_in_store>
238
+ </adjustment_negative_sku>
239
+ <sales_person_code translate="label comment">
240
+ <label>Sales Person Code</label>
241
+ <comment>Optional. The sales person code for orders.</comment>
242
+ <frontend_type>text</frontend_type>
243
+ <sort_order>240</sort_order>
244
+ <show_in_default>1</show_in_default>
245
+ <show_in_website>1</show_in_website>
246
+ <show_in_store>1</show_in_store>
247
+ </sales_person_code>
248
+ <location_code translate="label comment">
249
+ <label>Location Code</label>
250
+ <comment>Optional. The location code for orders.</comment>
251
+ <frontend_type>text</frontend_type>
252
+ <sort_order>250</sort_order>
253
+ <show_in_default>1</show_in_default>
254
+ <show_in_website>1</show_in_website>
255
+ <show_in_store>1</show_in_store>
256
+ </location_code>
257
+ <line_ref1_code translate="label">
258
+ <label>Reference Code 1</label>
259
+ <frontend_type>text</frontend_type>
260
+ <sort_order>260</sort_order>
261
+ <show_in_default>1</show_in_default>
262
+ <show_in_website>1</show_in_website>
263
+ <show_in_store>1</show_in_store>
264
+ </line_ref1_code>
265
+ <line_ref2_code translate="label comment">
266
+ <label>Reference Code 2</label>
267
+ <comment>Optional. An attribute code to pass with each product. See product attributes in catalog > attributes.</comment>
268
+ <frontend_type>text</frontend_type>
269
+ <sort_order>270</sort_order>
270
+ <show_in_default>1</show_in_default>
271
+ <show_in_website>1</show_in_website>
272
+ <show_in_store>1</show_in_store>
273
+ </line_ref2_code>
274
+
275
+ <title_address_validation translate="label">
276
+ <label><![CDATA[<strong>Shipping Address Options</strong>]]></label>
277
+ <frontend_type>label</frontend_type>
278
+ <sort_order>300</sort_order>
279
+ <show_in_default>1</show_in_default>
280
+ <show_in_website>1</show_in_website>
281
+ <show_in_store>1</show_in_store>
282
+ </title_address_validation>
283
+ <validate_address translate="label comment">
284
+ <label>Address Validation</label>
285
+ <frontend_type>select</frontend_type>
286
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
287
+ <comment>Require a validated address from AvaTax to checkout</comment>
288
+ <sort_order>301</sort_order>
289
+ <show_in_default>1</show_in_default>
290
+ <show_in_website>1</show_in_website>
291
+ <show_in_store>1</show_in_store>
292
+ </validate_address>
293
+ <validate_address_message translate="label comment">
294
+ <label>Multi-Address Address Validation Error</label>
295
+ <comment>Only applies if address validation is enabled and shows ONLY for the multi-address checkout</comment>
296
+ <frontend_type>textarea</frontend_type>
297
+ <sort_order>331</sort_order>
298
+ <show_in_default>1</show_in_default>
299
+ <show_in_website>1</show_in_website>
300
+ <show_in_store>1</show_in_store>
301
+ </validate_address_message>
302
+ <normalize_address translate="label comment">
303
+ <label>Address Normalization</label>
304
+ <frontend_type>select</frontend_type>
305
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
306
+ <comment>Replace address with well-formed one from AvaTax</comment>
307
+ <sort_order>320</sort_order>
308
+ <show_in_default>1</show_in_default>
309
+ <show_in_website>1</show_in_website>
310
+ <show_in_store>1</show_in_store>
311
+ </normalize_address>
312
+ <onepage_normalize_message translate="label comment">
313
+ <label>Onepage Checkout Address Normalized Notice</label>
314
+ <comment>Only applies if address normalization is enabled</comment>
315
+ <frontend_type>textarea</frontend_type>
316
+ <sort_order>330</sort_order>
317
+ <show_in_default>1</show_in_default>
318
+ <show_in_website>1</show_in_website>
319
+ <show_in_store>1</show_in_store>
320
+ </onepage_normalize_message>
321
+ <multiaddress_normalize_message translate="label comment">
322
+ <label>Multi-Address Checkout Address Normalized Notice</label>
323
+ <comment>Only applies if address normalization is enabled</comment>
324
+ <frontend_type>textarea</frontend_type>
325
+ <sort_order>330</sort_order>
326
+ <show_in_default>1</show_in_default>
327
+ <show_in_website>1</show_in_website>
328
+ <show_in_store>1</show_in_store>
329
+ </multiaddress_normalize_message>
330
+
331
+ <title_error_handling translate="label">
332
+ <label><![CDATA[<strong>Error Handling</strong>]]></label>
333
+ <frontend_type>label</frontend_type>
334
+ <sort_order>400</sort_order>
335
+ <show_in_default>1</show_in_default>
336
+ <show_in_website>1</show_in_website>
337
+ <show_in_store>1</show_in_store>
338
+ </title_error_handling>
339
+ <error_full_stop translate="label">
340
+ <label>Action on Error</label>
341
+ <frontend_type>select</frontend_type>
342
+ <source_model>avatax/source_error</source_model>
343
+ <sort_order>410</sort_order>
344
+ <show_in_default>1</show_in_default>
345
+ <show_in_website>1</show_in_website>
346
+ <show_in_store>1</show_in_store>
347
+ </error_full_stop>
348
+ <error_frontend_message translate="label">
349
+ <label>Frontend Error Message</label>
350
+ <frontend_type>textarea</frontend_type>
351
+ <sort_order>420</sort_order>
352
+ <show_in_default>1</show_in_default>
353
+ <show_in_website>1</show_in_website>
354
+ <show_in_store>1</show_in_store>
355
+ </error_frontend_message>
356
+ <error_backend_message translate="label">
357
+ <label>Backend Error Message</label>
358
+ <frontend_type>textarea</frontend_type>
359
+ <sort_order>430</sort_order>
360
+ <show_in_default>1</show_in_default>
361
+ <show_in_website>1</show_in_website>
362
+ <show_in_store>1</show_in_store>
363
+ </error_backend_message>
364
+ <error_notification_toolbar translate="label comment">
365
+ <label>Notification Toolbar</label>
366
+ <frontend_type>select</frontend_type>
367
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
368
+ <comment>If there are issues syncing invoice or credit memo data, show warning in admin notification toolbar.</comment>
369
+ <sort_order>440</sort_order>
370
+ <show_in_default>1</show_in_default>
371
+ <show_in_website>0</show_in_website>
372
+ <show_in_store>0</show_in_store>
373
+ </error_notification_toolbar>
374
+ </fields>
375
+ </avatax>
376
+ <classes>
377
+ <fields>
378
+ <shipping_tax_class>
379
+ <!-- Will always be FR020100. It is hardcoded in OnePica_AvaTax_Helper_Tax_Data. -->
380
+ <show_in_default>0</show_in_default>
381
+ <show_in_website>0</show_in_website>
382
+ <show_in_store>0</show_in_store>
383
+ </shipping_tax_class>
384
+ </fields>
385
+ </classes>
386
+ <calculation>
387
+ <fields>
388
+ <based_on>
389
+ <!-- AvaTax always computes tax based on ship from and ship to addresses. -->
390
+ <show_in_default>0</show_in_default>
391
+ <show_in_website>0</show_in_website>
392
+ <show_in_store>0</show_in_store>
393
+ </based_on>
394
+ <price_includes_tax>
395
+ <!-- Items should not include tax so that AvaTax can calculate it. -->
396
+ <show_in_default>0</show_in_default>
397
+ <show_in_website>0</show_in_website>
398
+ <show_in_store>0</show_in_store>
399
+ </price_includes_tax>
400
+ <shipping_includes_tax>
401
+ <!-- Shipping should not include tax so that AvaTax can calculate it. -->
402
+ <show_in_default>0</show_in_default>
403
+ <show_in_website>0</show_in_website>
404
+ <show_in_store>0</show_in_store>
405
+ </shipping_includes_tax>
406
+ <apply_after_discount>
407
+ <!-- Always apply discount first since AvaTax doesn't support line-level item discount amounts -->
408
+ <show_in_default>0</show_in_default>
409
+ <show_in_website>0</show_in_website>
410
+ <show_in_store>0</show_in_store>
411
+ </apply_after_discount>
412
+ <discount_tax>
413
+ <!-- Always apply discount first since AvaTax doesn't support line-level item discount amounts -->
414
+ <show_in_default>0</show_in_default>
415
+ <show_in_website>0</show_in_website>
416
+ <show_in_store>0</show_in_store>
417
+ </discount_tax>
418
+ <apply_tax_on>
419
+ <!-- Always apply tax to custom price if available -->
420
+ <show_in_default>0</show_in_default>
421
+ <show_in_website>0</show_in_website>
422
+ <show_in_store>0</show_in_store>
423
+ </apply_tax_on>
424
+ <algorithm>
425
+ <!-- Always based on row (actually determined by Avalara) -->
426
+ <show_in_default>0</show_in_default>
427
+ <show_in_website>0</show_in_website>
428
+ <show_in_store>0</show_in_store>
429
+ </algorithm>
430
+ </fields>
431
+ </calculation>
432
+ <defaults>
433
+ <fields>
434
+ <region translate="comment">
435
+ <comment>Set this to "*" (asterisk) to stop unneeded requests to Avalara and to help speed up page loads</comment>
436
+ </region>
437
+ <postcode translate="comment">
438
+ <comment>Set this to "*" (asterisk) to stop unneeded requests to Avalara and to help speed up page loads</comment>
439
+ </postcode>
440
+ </fields>
441
+ </defaults>
442
+ <display>
443
+ <fields>
444
+ <type>
445
+ <show_in_default>0</show_in_default>
446
+ <show_in_website>0</show_in_website>
447
+ <show_in_store>0</show_in_store>
448
+ </type>
449
+ <shipping>
450
+ <show_in_default>0</show_in_default>
451
+ <show_in_website>0</show_in_website>
452
+ <show_in_store>0</show_in_store>
453
+ </shipping>
454
+ </fields>
455
+ </display>
456
+ <sales_display>
457
+ <fields>
458
+ <full_summary>
459
+ <!-- Jurisdiction data is not kept in Magento at this time after the quote -->
460
+ <show_in_default>0</show_in_default>
461
+ <show_in_website>0</show_in_website>
462
+ <show_in_store>0</show_in_store>
463
+ </full_summary>
464
+ </fields>
465
+ </sales_display>
466
+ </groups>
467
+ </tax>
468
+ <shipping>
469
+ <groups>
470
+ <origin>
471
+ <fields>
472
+ <street translate="label">
473
+ <label><![CDATA[Number & Street]]></label>
474
+ <frontend_type>text</frontend_type>
475
+ <sort_order>99</sort_order>
476
+ <show_in_default>1</show_in_default>
477
+ <show_in_website>1</show_in_website>
478
+ <show_in_store>1</show_in_store>
479
+ </street>
480
+ </fields>
481
+ </origin>
482
+ </groups>
483
+ </shipping>
484
+ </sections>
485
+ </config>
app/code/community/OnePica/AvaTax/lib/AvaTax.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * AvaTax.php
4
+ *
5
+ * @package Base
6
+ */
7
+
8
+ /**
9
+ * Defines class loading search path.
10
+ */
11
+
12
+ function __autoload($class_name)
13
+ {
14
+
15
+ $path=dirname(__FILE__).'/classes/'.$class_name . '.class.php';
16
+
17
+ if(!file_exists($path))
18
+ {
19
+ $path=dirname(__FILE__).'/classes/BatchSvc/'.$class_name . '.class.php';
20
+
21
+ }
22
+
23
+ require_once $path;
24
+
25
+
26
+ }
27
+
28
+ function EnsureIsArray( $obj )
29
+ {
30
+ if( is_object($obj))
31
+ {
32
+ $item[0] = $obj;
33
+ }
34
+ else
35
+ {
36
+ $item = (array)$obj;
37
+ }
38
+ return $item;
39
+ }
40
+
41
+
42
+
43
+ /**
44
+ * Takes xml as a string and returns it nicely indented
45
+ *
46
+ * @param string $xml The xml to beautify
47
+ * @param boolean $html_output If the xml should be formatted for display on an html page
48
+ * @return string The beautified xml
49
+ */
50
+
51
+ function xml_pretty_printer($xml, $html_output=FALSE)
52
+ {
53
+ $xml_obj = new SimpleXMLElement($xml);
54
+ $xml_lines = explode("n", $xml_obj->asXML());
55
+ $indent_level = 0;
56
+
57
+ $new_xml_lines = array();
58
+ foreach ($xml_lines as $xml_line) {
59
+ if (preg_match('#(<[a-z0-9:-]+((s+[a-z0-9:-]+="[^"]+")*)?>.*<s*/s*[^>]+>)|(<[a-z0-9:-]+((s+[a-z0-9:-]+="[^"]+")*)?s*/s*>)#i', $xml_line)) {
60
+ $new_line = str_pad('', $indent_level*4) . $xml_line;
61
+ $new_xml_lines[] = $new_line;
62
+ } elseif (preg_match('#<[a-z0-9:-]+((s+[a-z0-9:-]+="[^"]+")*)?>#i', $xml_line)) {
63
+ $new_line = str_pad('', $indent_level*4) . $xml_line;
64
+ $indent_level++;
65
+ $new_xml_lines[] = $new_line;
66
+ } elseif (preg_match('#<s*/s*[^>/]+>#i', $xml_line)) {
67
+ $indent_level--;
68
+ if (trim($new_xml_lines[sizeof($new_xml_lines)-1]) == trim(str_replace("/", "", $xml_line))) {
69
+ $new_xml_lines[sizeof($new_xml_lines)-1] .= $xml_line;
70
+ } else {
71
+ $new_line = str_pad('', $indent_level*4) . $xml_line;
72
+ $new_xml_lines[] = $new_line;
73
+ }
74
+ } else {
75
+ $new_line = str_pad('', $indent_level*4) . $xml_line;
76
+ $new_xml_lines[] = $new_line;
77
+ }
78
+ }
79
+
80
+ $xml = join("n", $new_xml_lines);
81
+ return ($html_output) ? '<pre>' . htmlentities($xml) . '</pre>' : $xml;
82
+ }
83
+
84
+ function getDefaultDate()
85
+ {
86
+ $dateTime=new DateTime();
87
+ $dateTime->setDate(1900,01,01);
88
+
89
+ return $dateTime->format("Y-m-d");
90
+ }
91
+
92
+ function getCurrentDate()
93
+ {
94
+ $dateTime=new DateTime();
95
+ return $dateTime->format("Y-m-d");
96
+ }
97
+
98
+
99
+
100
+
101
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/ATConfig.class.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ATConfig.class.php
4
+ *
5
+ * @package Base
6
+ */
7
+
8
+ /**
9
+ * Contains various service configuration parameters as class static variables.
10
+ *
11
+ * {@link AddressServiceSoap} and {@link TaxServiceSoap} read this file during initialization.
12
+ *
13
+ * @package Base
14
+ */
15
+
16
+ class ATConfig
17
+ {
18
+ private static $Configurations = array();
19
+ private $_ivars;
20
+
21
+ public function __construct($name, $values = null)
22
+ {
23
+ if($values)
24
+ {
25
+ ATConfig::$Configurations[$name] = $values;
26
+ }
27
+ $this->_ivars = ATConfig::$Configurations[$name];
28
+ }
29
+
30
+ public function __get($n)
31
+ {
32
+ if($n == '_ivars') { return parent::__get($n); }
33
+ if(isset($this->_ivars[$n]))
34
+ {
35
+ return $this->_ivars[$n];
36
+ }
37
+ else if(isset(ATConfig::$Configurations['Default'][$n])) // read missing values from default
38
+ {
39
+ return ATConfig::$Configurations['Default'][$n];
40
+ }
41
+ else
42
+ {
43
+ return null;
44
+ }
45
+ }
46
+ }
47
+ /* Specify configurations by name here. You can specify as many as you like */
48
+
49
+
50
+ $__wsdldir = dirname(__FILE__)."/wsdl";
51
+
52
+ /* This is the default configuration - it is used if no other configuration is specified */
53
+ new ATConfig('Default', array(
54
+ 'url' => 'no url specified',
55
+ 'addressService' => '/Address/AddressSvc.asmx',
56
+ 'taxService' => '/Tax/TaxSvc.asmx',
57
+ 'batchService'=> '/Batch/BatchSvc.asmx',
58
+ 'addressWSDL' => 'file://'.$__wsdldir.'/Address.wsdl',
59
+ 'taxWSDL' => 'file://'.$__wsdldir.'/Tax.wsdl',
60
+ 'batchWSDL' => 'file://'.$__wsdldir.'/BatchSvc.wsdl',
61
+ 'account' => '<your account number here>',
62
+ 'license' => '<your license key here>',
63
+ 'adapter' => 'avatax4php,5.7.3.0',
64
+ 'client' => 'AvalaraPHPInterface,1.0',
65
+ 'name' => 'PHPAdapter',
66
+ 'trace' => true) // change to false for production
67
+ );
68
+
69
+
70
+
71
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/ATObject.class.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ATObject.class.php
4
+ *
5
+ * @package Base
6
+ */
7
+
8
+ /**
9
+ * Generic Dynamic Object
10
+ *
11
+ * @package Base
12
+ */
13
+ class ATObject
14
+ {
15
+ private $_ivars = array();
16
+ public function __get($n)
17
+ {
18
+ if(isset($this->_ivars[$n]))
19
+ {
20
+ return $this->_ivars[$n];
21
+ }
22
+ else
23
+ {
24
+ return null;
25
+ }
26
+ }
27
+ public function __set($n,$v)
28
+ {
29
+ if($v == null)
30
+ {
31
+ unset($this->_ivars[$n]);
32
+ }
33
+ else
34
+ {
35
+ $this->_ivars[$n] = $v;
36
+ }
37
+ }
38
+ public function __isset($n) { return isset($ivars[$n]); }
39
+ public function __unset($n) { unset($this->_ivars[$n]); }
40
+ public function __call($n,$args)
41
+ {
42
+ if(sizeof($args) == 1)
43
+ {
44
+ $this->__set($n,$args[0]);
45
+ return null;
46
+ }
47
+ else if(sizeof($args) == 0)
48
+ {
49
+ return $this->__get($n);
50
+ }
51
+ }
52
+ public function ivars() { return $this->_ivars; }
53
+ }
54
+
55
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/AVObject.class.php ADDED
@@ -0,0 +1 @@
 
1
+
app/code/community/OnePica/AvaTax/lib/classes/Address.class.php ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Address.class.php
4
+ *
5
+ * @package Address
6
+ */
7
+
8
+ /**
9
+ * Contains address data; Can be passed to {@link AddressServiceSoap#validate};
10
+ * Also part of the {@link GetTaxRequest}
11
+ * result returned from the {@link TaxServiceSoap#getTax} tax calculation service;
12
+ * No behavior - basically a glorified struct.
13
+ *
14
+ * <b>Example:</b>
15
+ * <pre>
16
+ * $port = new AddressServiceSoap();
17
+ *
18
+ * $address = new Address();
19
+ * $address->setLine1("900 Winslow Way");
20
+ * $address->setLine2("Suite 130");
21
+ * $address->setCity("Bainbridge Is");
22
+ * $address->setRegion("WA");
23
+ * $address->setPostalCode("98110-2450");
24
+ *
25
+ * $result = $port->validate($address,TextCase::$Upper);
26
+ * $addresses = $result->ValidAddresses;
27
+ * print("Number of addresses returned is ". sizseof($addresses));
28
+ *
29
+ * </pre>
30
+ * @package Address
31
+ * @author tblanchard
32
+ * Copyright (c) 2007, Avalara. All rights reserved.
33
+ */
34
+
35
+ class Address
36
+ {
37
+
38
+ private $AddressCode;
39
+ private $Line1;
40
+ private $Line2;
41
+ private $Line3;
42
+ private $City;
43
+ private $Region;
44
+ private $PostalCode;
45
+ private $Country = 'USA';
46
+ private $TaxRegionId = 0;
47
+
48
+ /**
49
+ * Construct a new Address.
50
+ *
51
+ * Constructs a new instance of Address.
52
+ * <pre>
53
+ * $address = new Address();
54
+ * </pre>
55
+ *
56
+ * @param string $line1
57
+ * @param string $line2
58
+ * @param string $line3
59
+ * @param string $city
60
+ * @param string $region
61
+ * @param string $postalCode
62
+ * @param string $country
63
+ * @param integer $taxRegionId
64
+ */
65
+
66
+ public function __construct($line1=null,$line2=null,$line3=null,$city=null,$region=null,$postalCode=null,$country='USA',$taxRegionId=0)
67
+ {
68
+ $this->Line1 = $line1;
69
+ $this->Line2 = $line2;
70
+ $this->Line3 = $line3;
71
+ $this->City = $city;
72
+ $this->Region = $region;
73
+ $this->PostalCode = $postalCode;
74
+ $this->Country = $country;
75
+ $this->TaxRegionId = $taxRegionId;
76
+ }
77
+
78
+ /**
79
+ * Programmatically determined value used internally by the adapter.
80
+ *
81
+ * @param string $value
82
+ *
83
+ */
84
+ public function setAddressCode($value) { $this->AddressCode = $value; }
85
+
86
+ /**
87
+ * Address line 1
88
+ *
89
+ * @param string $value
90
+ */
91
+ public function setLine1($value) { $this->Line1 = $value; }
92
+
93
+ /**
94
+ * Address line 2
95
+ *
96
+ * @param string $value
97
+ */
98
+ public function setLine2($value) { $this->Line2 = $value; }
99
+
100
+ /**
101
+ * Address line 3
102
+ *
103
+ * @param string $value
104
+ */
105
+ public function setLine3($value) { $this->Line3 = $value; }
106
+
107
+ /**
108
+ * City name
109
+ *
110
+ * @param string $value
111
+ */
112
+ public function setCity($value) { $this->City = $value; }
113
+
114
+ /**
115
+ * State or province name or abbreviation
116
+ *
117
+ * @param string $value
118
+ */
119
+ public function setRegion($value) { $this->Region = $value; }
120
+
121
+ /**
122
+ * Postal or ZIP code
123
+ *
124
+ * @param string $value
125
+ */
126
+ public function setPostalCode($value) { $this->PostalCode = $value; }
127
+
128
+ /**
129
+ * Country name
130
+ *
131
+ * @param string $value
132
+ */
133
+ public function setCountry($value) { $this->Country = $value; }
134
+
135
+
136
+ /**
137
+ * TaxRegionId provides the ability to override the tax region assignment for an address.
138
+ *
139
+ * @param string $value
140
+ */
141
+ public function setTaxRegionId($value) { $this->TaxRegionId = $value; }
142
+
143
+ /**
144
+ * Programmatically determined value used internally by the adapter.
145
+ *
146
+ * @return string $value
147
+ */
148
+ public function getAddressCode() { return $this->AddressCode; }
149
+
150
+ /**
151
+ * Address line 1
152
+ *
153
+ * @return string $value
154
+ */
155
+ public function getLine1() { return $this->Line1; }
156
+
157
+ /**
158
+ * Address line 2
159
+ *
160
+ * @return string $value
161
+ */
162
+ public function getLine2() { return $this->Line2; }
163
+
164
+ /**
165
+ * Address line 3
166
+ *
167
+ * @return string $value
168
+ */
169
+ public function getLine3() { return $this->Line3; }
170
+
171
+ /**
172
+ * City name
173
+ *
174
+ * @return string $value
175
+ */
176
+ public function getCity() { return $this->City; }
177
+
178
+ /**
179
+ * State or province name or abbreviation
180
+ *
181
+ * @return string $value
182
+ */
183
+ public function getRegion() { return $this->Region; }
184
+
185
+ /**
186
+ * Postal or ZIP code
187
+ *
188
+ * @return string $value
189
+ */
190
+ public function getPostalCode() { return $this->PostalCode; }
191
+
192
+ /**
193
+ * Country name
194
+ *
195
+ * @return string $value
196
+ */
197
+ public function getCountry() { return $this->AddressCode; }
198
+
199
+ /**
200
+ * TaxRegionId provides the ability to override the tax region assignment for an address.
201
+ *
202
+ * @return string $value
203
+ */
204
+ public function getTaxRegionId() { return $this->TaxRegionId; }
205
+
206
+
207
+ /**
208
+ * Compares Addresses
209
+ * @access public
210
+ * @param Address
211
+ * @return boolean
212
+ */
213
+ public function equals(&$other) // fix me after replace
214
+ {
215
+ return $this === $other || (
216
+ strcmp($this->AddressCode , $other->AddressCode) == 0 &&
217
+ strcmp($this->Line1 , $other->Line1) == 0 &&
218
+ strcmp($this->Line2 , $other->Line2) == 0 &&
219
+ strcmp($this->Line3 , $other->Line3) == 0 &&
220
+ strcmp($this->City , $other->City) == 0 &&
221
+ strcmp($this->Region , $other->Region) == 0 &&
222
+ strcmp($this->PostalCode , $other->PostalCode) == 0 &&
223
+ strcmp($this->Country , $other->Country) == 0 &&
224
+ $this->TaxRegionId === $other->TaxRegionId
225
+ );
226
+ }
227
+ }
228
+
229
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/AddressServiceSoap.class.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * AddressServiceSoap.class.php
5
+ *
6
+ * Proxy for Avalara Address Service.
7
+ *
8
+ * @package Address
9
+ */
10
+
11
+ /**
12
+ * Proxy interface for the Avalara Address Web Service.
13
+ *
14
+ * AddressServiceSoap reads its configuration values from static variables defined
15
+ * in ATConfig.class.php. This file must be properly configured with your security credentials.
16
+ *
17
+ * <p>
18
+ * <b>Example:</b>
19
+ * <pre>
20
+ * $addressService = new AddressServiceSoap();
21
+ * </pre>
22
+ *
23
+ * @package Address
24
+ * @author tblanchard
25
+ * Copyright (c) 2007, Avalara. All rights reserved.
26
+ */
27
+
28
+ class AddressServiceSoap extends AvalaraSoapClient
29
+ {
30
+ static private $servicePath = '/Address/AddressSvc.asmx';
31
+ static protected $classmap = array(
32
+ 'Validate' => 'Validate',
33
+ 'BaseRequest' => 'BaseRequest',
34
+ 'ValidateRequest' => 'ValidateRequest',
35
+ 'BaseAddress' => 'BaseAddress',
36
+ 'ValidAddress' => 'ValidAddress',
37
+ 'TextCase' => 'TextCase',
38
+ 'ValidateResult' => 'ValidateResult',
39
+ 'BaseResult' => 'BaseResult',
40
+ 'SeverityLevel' => 'SeverityLevel',
41
+ 'Message' => 'Message',
42
+ 'Profile' => 'Profile',
43
+ 'Ping' => 'Ping',
44
+ 'PingResult' => 'PingResult',
45
+ 'IsAuthorized' => 'IsAuthorized',
46
+ 'IsAuthorizedResult' => 'IsAuthorizedResult');
47
+
48
+ /**
49
+ * Construct a proxy for Avalara's Address Web Service using the default URL as coded in the class or programatically set.
50
+ *
51
+ * <b>Example:</b>
52
+ * <pre>
53
+ * $port = new AddressServiceSoap();
54
+ * $port->ping();
55
+ * </pre>
56
+ *
57
+ * @see AvalaraSoapClient
58
+ * @see TaxServiceSoap
59
+ */
60
+
61
+ public function __construct($configurationName = 'Default')
62
+ {
63
+ $config = new ATConfig($configurationName);
64
+ $this->client = new DynamicSoapClient (
65
+ $config->addressWSDL,
66
+ array
67
+ (
68
+ 'location' => $config->url.$config->addressService,
69
+ 'trace' => $config->trace,
70
+ 'classmap' => AddressServiceSoap::$classmap
71
+ ),
72
+ $config
73
+ );
74
+ }
75
+
76
+ /**
77
+ * Checks authentication of and authorization to one or more
78
+ * operations on the service.
79
+ *
80
+ * This operation allows pre-authorization checking of any
81
+ * or all operations. It will return a comma delimited set of
82
+ * operation names which will be all or a subset of the requested
83
+ * operation names. For security, it will never return operation
84
+ * names other than those requested (no phishing allowed).
85
+ *
86
+ * <b>Example:</b><br>
87
+ * <code> isAuthorized("GetTax,PostTax")</code>
88
+ *
89
+ * @param string $operations a comma-delimited list of operation names
90
+ *
91
+ * @return IsAuthorizedResult
92
+ * @throws SoapFault
93
+ */
94
+
95
+ public function isAuthorized($operations)
96
+ {
97
+ return $this->client->IsAuthorized(array('Operations' => $operations))->IsAuthorizedResult;
98
+ }
99
+
100
+ /**
101
+ * Verifies connectivity to the web service and returns version
102
+ * information about the service.
103
+ *
104
+ * <b>NOTE:</b>This replaces TestConnection and is available on
105
+ * every service.
106
+ *
107
+ * @param string $message for future use
108
+ * @return PingResult
109
+ * @throws SoapFault
110
+ */
111
+
112
+ public function ping($message = '')
113
+ {
114
+ return $this->client->Ping(array('Message' => $message))->PingResult;
115
+ }
116
+
117
+ /**
118
+ * Validates an address and returns a collection of possible
119
+ * {@link ValidAddress} objects in a {@link ValidateResult} object.
120
+ *
121
+ * Takes an {@link Address}, an optional {@link TextCase}
122
+ * property that determines the casing applied to a validated
123
+ * address. It defaults to TextCase::$Default.
124
+ * <b>Example:</b><br>
125
+ * <pre>
126
+ * $port = new AddressServiceSoap();
127
+ *
128
+ * $address = new Address();
129
+ * $address->setLine1("900 Winslow Way");
130
+ * $address->setLine2("Suite 130");
131
+ * $address->setCity("Bainbridge Is");
132
+ * $address->setRegion("WA");
133
+ * $address->setPostalCode("98110-2450");
134
+ *
135
+ * $result = $port->validate(new ValidateRequest($address,TextCase::$Upper));
136
+ * $addresses = $result->validAddresses();
137
+ * print('Number of addresses returned is: '.sizeof($addresses));
138
+ * </pre>
139
+ *
140
+ * @param ValidateRequest
141
+ * @return ValidateResult
142
+ *
143
+ * @throws SoapFault
144
+ */
145
+
146
+
147
+ public function validate($validateRequest)
148
+ {
149
+ return $this->client->Validate(array('ValidateRequest' => $validateRequest))->ValidateResult;
150
+ }
151
+
152
+
153
+ }
154
+
155
+
156
+
157
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/AddressType.class.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * AddressType.class.php
4
+ * @package Address
5
+ */
6
+
7
+ /**
8
+ * The type of the address(es) returned in the validation result.
9
+ *
10
+ * @package Address
11
+ * @author tblanchard
12
+ * Copyright (c) 2007, Avalara. All rights reserved.
13
+ */
14
+
15
+ class AddressType extends Enum
16
+ {
17
+ public static $FirmOrCompany = 'F';
18
+ public static $GeneralDelivery = 'G';
19
+ public static $HighRise = 'H';
20
+ public static $POBox = 'P';
21
+ public static $RuralRoute = 'R';
22
+ public static $StreetOrResidential = 'S';
23
+
24
+ public static function Values()
25
+ {
26
+ return array(
27
+ 'FirmOrCompany' => AddressType::$FirmOrCompany,
28
+ 'GeneralDelivery' => AddressType::$GeneralDelivery,
29
+ 'HighRise' => AddressType::$HighRise,
30
+ 'POBox' => AddressType::$POBox,
31
+ 'RuralRoute' => AddressType::$RuralRoute,
32
+ 'StreetOrResidential' => AddressType::$StreetOrResidential
33
+ );
34
+ }
35
+
36
+ // Unfortunate boiler plate due to polymorphism issues on static functions
37
+ public static function Validate($value) { self::__Validate($value,self::Values(),__CLASS__); }
38
+ }
39
+
40
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/AdjustTaxRequest.class.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * AdjustTaxRequest.class.php
4
+ * @package Tax
5
+ */
6
+
7
+ /**
8
+ * Data to pass to {@link TaxServiceSoap#adjustTax}.
9
+ *
10
+ * @see AdjustTaxRequest
11
+ * @package Tax
12
+ * @author tblanchard
13
+ * Copyright (c) 2008, Avalara. All rights reserved.
14
+ */
15
+
16
+
17
+
18
+ class AdjustTaxRequest
19
+ {
20
+ private $AdjustmentReason; //int
21
+ private $AdjustmentDescription; //string
22
+ private $GetTaxRequest; //string
23
+
24
+
25
+ /**
26
+ * Adjustment Description is required when AdjustmentReason is "Other" for enhanced tracability.
27
+ *
28
+ * @param string $value
29
+ */
30
+ public function setAdjustmentDescription($value) { $this->AdjustmentDescription = $value; }
31
+
32
+
33
+
34
+ /**
35
+ * Reason for Adjusting document.
36
+ * <pre>
37
+ * Sets a valid reason for the given AdjustTax call. Adjustment Reason is a high level classification of why an Original Document is being modified.
38
+ * 0 Not Adjusted
39
+ * 1 Sourcing Issue
40
+ * 2 Reconciled with General Ledger
41
+ * 3 Exemption Certificate Applied
42
+ * 4 Price or Quantity Adjusted
43
+ * 5 Item Returned
44
+ * 6 Item Exchanged
45
+ * 7 Bad Debt
46
+ * 8 Other (Explain)
47
+ Must provide AdjustmentDescription
48
+ <pre>
49
+ *
50
+ * Please visit Avalara's Administrative Console's transaction adjustment section for latest AdjustmentReasonList.
51
+ *
52
+ * @param int $value
53
+ */
54
+ public function setAdjustmentReason($value) { $this->AdjustmentReason = $value;}
55
+
56
+
57
+ /**
58
+ * Holds the data for Adjust Tax call. It takes the information needed for GetTax call.
59
+ *
60
+ * @param GetTaxRequest $value
61
+ */
62
+ public function setGetTaxRequest($value) { $this->GetTaxRequest = $value;}
63
+
64
+ public function getAdjustmentReason() { return $this->AdjustmentReason;} //int
65
+
66
+ public function getAdjustmentDescription() { return $this->AdjustmentDescription;}
67
+
68
+
69
+ public function getGetTaxRequest() { return $this->GetTaxRequest;} //string invoice number
70
+
71
+
72
+
73
+
74
+
75
+ }
76
+
77
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/AdjustTaxResult.class.php ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * AdjustTaxResult.class.php
4
+ * @package Tax
5
+ */
6
+
7
+
8
+ /**
9
+ * Result data returned from {@link TaxServiceSoap#getTax}.
10
+ *
11
+ * @see AdjustTaxRequest
12
+ * @package Tax
13
+ * @author tblanchard
14
+ * Copyright (c) 2008, Avalara. All rights reserved.
15
+ */
16
+
17
+ class AdjustTaxResult //extends GetTaxResult
18
+ {
19
+
20
+
21
+ ///From GetTaxResult- Bug in soapclient requires this copy
22
+ private $DocCode; //string
23
+ private $AdjustmentDescription; //string
24
+ private $DocDate; //date
25
+ private $TaxDate; //date
26
+ private $DocType; //DocumentType
27
+ private $DocStatus; //DocStatus
28
+ private $Reconciled; //boolean
29
+ private $Locked; //boolean
30
+ private $Timestamp; //dateTime
31
+ private $TotalAmount; //decimal
32
+ private $TotalDiscount; //decimal
33
+ private $TotalExemption; //decimal
34
+ private $TotalTaxable; //decimal
35
+ private $TotalTax; //decimal
36
+ private $HashCode; //int
37
+ private $AdjustmentReason; //int
38
+ private $Version; //int
39
+ private $TaxLines; //ArrayOfTaxLine
40
+
41
+ //@author:swetal
42
+ //Added new properties to upgrade to 5.3 interface
43
+ private $TotalTaxCalculated; //decimal
44
+ private $TaxSummary; //ArrayOfTaxDetail
45
+
46
+
47
+
48
+ /**
49
+ * Gets the internal reference code used by the client application. This is used for operations such as Post and GetTaxHistory.
50
+ * <p>
51
+ * See {@link GetTaxRequest#getDocCode} on <b>GetTaxRequest</b> for more information about this member.
52
+ * </p>
53
+ *
54
+ * @return string
55
+ */
56
+ public function getDocCode() {return $this->DocCode; }
57
+
58
+ /**
59
+ * AdjustmentDescription set while making AdjustTax call.
60
+ *
61
+ * @return string
62
+ */
63
+ public function getAdjustmentDescription() { return $this->AdjustmentDescription; }
64
+
65
+ /**
66
+ * AdjustmentReason set while making AdjustTax call. It is a high level classification of why an Original Document is being modified.
67
+ *
68
+ * @return int
69
+ */
70
+ public function getAdjustmentReason(){ return $this->AdjustmentReason; }
71
+
72
+ /**
73
+ * Gets the date on the invoice, purchase order, etc.
74
+ * <p>
75
+ * See {@link GetTaxRequest#getDocDate} on <b>GetTaxRequest</b> for more information about this member.
76
+ * </p>
77
+ *
78
+ * @return date
79
+ */
80
+ public function getDocDate() {return $this->DocDate; }
81
+
82
+ /**
83
+ * Tax Date is the date used to calculate tax on the Document.
84
+ * <p>
85
+ * See {@link GetTaxRequest#taxDate} on <b>GetTaxRequest</b> for more information about this member.
86
+ * </p>
87
+ *
88
+ * @return date
89
+ */
90
+ public function getTaxDate() {return $this->TaxDate; }
91
+
92
+ /**
93
+ * Gets the Document Type.
94
+ * <p>
95
+ * See {@link GetTaxRequest#DocType} on <b>GetTaxRequest</b> for more information about this member.
96
+ * </p>
97
+ *
98
+ * @return DocumentType
99
+ */
100
+ public function getDocType() {return $this->DocType; }
101
+
102
+ /**
103
+ * Gets the document's status after the tax calculation.
104
+ *
105
+ * @return DocStatus
106
+ */
107
+ public function getDocStatus() {return $this->DocStatus; }
108
+
109
+ /**
110
+ * True if the document has been reconciled; Only committed documents can be reconciled.
111
+ * <p>
112
+ * For information on committing documents, see the <b>TaxSvc</b>'s
113
+ * {@link TaxSvcSoap#commitTax} method. For information
114
+ * on reconciling documents, see the {@link TaxSvcSoap#reconcileTaxHistory} method.
115
+ * </p>
116
+ *
117
+ * @return boolean
118
+ */
119
+ public function getIsReconciled() {return $this->Reconciled; }
120
+
121
+ /**
122
+ * Flag indicating if a Document has been locked by Avalara's MRS process. Locked documents can not be modified and can not be cancelled because they have been reported on Tax Return.
123
+ *
124
+ * @return boolean
125
+ */
126
+ public function getLocked() {return $this->Locked; }
127
+
128
+ /**
129
+ * Date of the last status change on the document (i.e. Save date, Post date, Commit date, Cancel date).
130
+ *
131
+ * @return dateTime
132
+ */
133
+ public function getTimestamp() {return $this->Timestamp; }
134
+
135
+ /**
136
+ * The sum of all line {@link Line#getAmount} values.
137
+ *
138
+ * @param decimal
139
+ */
140
+ public function getTotalAmount() {return $this->TotalAmount; }
141
+
142
+ /**
143
+ * Gets the sum of all <b>TaxLine</b> {@link TaxLine#getDiscount} amounts; Typically it
144
+ * will equal the requested Discount, but, but it is possible that no lines were marked as discounted.
145
+ *
146
+ * @return decimal
147
+ */
148
+ public function getTotalDiscount() {return $this->TotalDiscount; }
149
+
150
+ /**
151
+ * Gets the sum of all <b>TaxLine</b> {@link TaxLine#getExemption} amounts.
152
+ *
153
+ * @return decimal
154
+ * @deprecated See {@link TaxDetail#getExemption}.
155
+ */
156
+ public function getTotalExemption() {return $this->TotalExemption; }
157
+
158
+ /**
159
+ * Gets the amount the tax is based on; This is the total of all {@link Line} <b>Base</b> amounts;
160
+ * Typically it will be equal to the document
161
+ * {@link GetTaxResult#getTotalAmount} - {@link GetTaxRequest#getDiscount} - {@link #getTotalExemption}.
162
+ *
163
+ * @return decimal
164
+ * @deprecated See {@link TaxDetail#getTaxable}.
165
+ */
166
+ public function getTotalTaxable() {return $this->TotalTaxable; }
167
+
168
+ /**
169
+ * Gets the total tax for the document.
170
+ *
171
+ * @return decimal
172
+ */
173
+ public function getTotalTax() {return $this->TotalTax; }
174
+
175
+ /**
176
+ * HashCode to support Reconciliation.
177
+ *
178
+ * @return hashCode
179
+ */
180
+ public function getHashCode() {return $this->HashCode; }
181
+
182
+ /**
183
+ * Current version of the document.
184
+ *
185
+ * @return int
186
+ */
187
+ public function getVersion() {return $this->Version; }
188
+
189
+ /**
190
+ * Gets the Tax broken down by individual {@link TaxLine}.
191
+ *
192
+ * @return taxLines
193
+ */
194
+ public function getTaxLines() {return EnsureIsArray($this->TaxLines->TaxLine); }
195
+
196
+ /**
197
+ * TotalTaxCalculated indicates the total tax calculated by AvaTax. This is usually the same as the TotalTax, except when a tax override amount is specified.
198
+ * This is for informational purposes.The TotalTax will still be used for reporting
199
+ *
200
+ * @return unknown
201
+ */
202
+ public function getTotalTaxCalculated(){ return $this->TotalTaxCalculated;}
203
+
204
+ /**
205
+ * TaxSummary is now returned when GetTaxRequest.DetailLevel == DetailLevel.Line in addition to DetailLevel.Summary.
206
+ * It is not returned for DetailLevel.Document or DetailLevel.TaxDetail.
207
+ *
208
+ * @return ArrayOfTaxDetail
209
+ */
210
+ public function getTaxSummary() {return EnsureIsArray($this->TaxSummary->TaxDetail);}
211
+
212
+ public function getTaxLine($lineNo)
213
+ {
214
+ if($this->getTaxLines() != null)
215
+ {
216
+ foreach($this->getTaxLines() as $taxLine)
217
+ {
218
+ if($lineNo == $taxLine->getNo())
219
+ {
220
+ return $taxLine;
221
+ }
222
+
223
+ }
224
+ }
225
+ }
226
+
227
+
228
+ /////////////////////////////////////////////PHP bug requires this copy from BaseResult ///////////
229
+ /**
230
+ * @var string
231
+ */
232
+ private $TransactionId;
233
+ /**
234
+ * @var string must be one of the values defined in {@link SeverityLevel}.
235
+ */
236
+ private $ResultCode = 'Success';
237
+ /**
238
+ * @var array of Message.
239
+ */
240
+ private $Messages = array();
241
+
242
+ /**
243
+ * Accessor
244
+ * @return string
245
+ */
246
+ public function getTransactionId() { return $this->TransactionId; }
247
+ /**
248
+ * Accessor
249
+ * @return string
250
+ */
251
+ public function getResultCode() { return $this->ResultCode; }
252
+ /**
253
+ * Accessor
254
+ * @return array
255
+ */
256
+ public function getMessages() { return EnsureIsArray($this->Messages->Message); }
257
+
258
+
259
+
260
+
261
+ }
262
+
263
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/ApplyPaymentRequest.class.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ApplyPaymentRequest.class.php
4
+ *
5
+ * @package Tax
6
+ */
7
+
8
+ class ApplyPaymentRequest
9
+ {
10
+ private $CompanyCode; //string
11
+ private $DocType; //DocumentType
12
+ private $DocCode; //string
13
+ private $PaymentDate; //date
14
+
15
+
16
+ public function __construct()
17
+ {
18
+ $this->DocType=DocumentType::$SalesOrder;
19
+ }
20
+
21
+ /**
22
+ * Sets the companyCode value for this ApplyPaymentRequest.
23
+ *
24
+ * @param string $value
25
+ */
26
+ public function setCompanyCode($value){ $this->CompanyCode=$value;} //string
27
+
28
+ /**
29
+ * Sets the docCode value for this ApplyPaymentRequest.
30
+ *
31
+ * @param DocumentType $value
32
+ */
33
+ public function setDocType($value){ $this->DocType=$value;} //DocumentType
34
+
35
+ /**
36
+ * Sets the docType value for this ApplyPaymentRequest.
37
+ *
38
+ * @param string $value
39
+ */
40
+ public function setDocCode($value){ $this->DocCode=$value;} //string
41
+
42
+ /**
43
+ * PaymentDate should be in the format yyyy-mm-dd
44
+ *
45
+ * @param date $value
46
+ */
47
+ public function setPaymentDate($value){ $this->PaymentDate=$value;} //date
48
+
49
+
50
+ /**
51
+ * Gets the companyCode value for this ApplyPaymentRequest.
52
+ *
53
+ * @return string
54
+ */
55
+ public function getCompanyCode(){ return $this->CompanyCode;} //string
56
+
57
+ /**
58
+ * Gets the docType value for this ApplyPaymentRequest.
59
+ *
60
+ * @return DocumentType
61
+ */
62
+ public function getDocType(){ return $this->DocType;} //DocumentType
63
+
64
+ /**
65
+ * Gets the docCode value for this ApplyPaymentRequest.
66
+ *
67
+ * @return unknown
68
+ */
69
+ public function getDocCode(){ return $this->DocCode;} //string
70
+ /**
71
+ * PaymentDate should be in the format yyyy-mm-dd
72
+ *
73
+ * @param date $value
74
+ */
75
+ public function getPaymentDate(){ return $this->PaymentDate;} //date
76
+
77
+ }
78
+
79
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/ApplyPaymentResult.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ApplyPaymentResult.class.php
4
+ *
5
+ * @package Tax
6
+ */
7
+
8
+ class ApplyPaymentResult extends BaseResult
9
+ {
10
+
11
+
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/AvalaraSoapClient.class.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * AvalaraSoapClient.class.php
5
+ *
6
+ * @package Base
7
+ */
8
+
9
+ /**
10
+ * Abstract base class for all Avalara web service clients.
11
+ *
12
+ * Users should never create instances of this class.
13
+ *
14
+ * @package Base
15
+ * @abstract
16
+ * @see AddressServiceSoap
17
+ * @see TaxServiceSoap
18
+ * @author tblanchard
19
+ *
20
+ * Copyright (c) 2007, Avalara. All rights reserved.
21
+ */
22
+
23
+ class AvalaraSoapClient
24
+ {
25
+ protected $client;
26
+
27
+ public function __getLastRequest() { return $this->client->__getLastRequest(); }
28
+ public function __getLastResponse() { return $this->client->__getLastResponse(); }
29
+ public function __getLastRequestHeaders() { return $this->client->__getLastRequestHeaders(); }
30
+ public function __getLastResponseHeaders() { return $this->client->__getLastResponseHeaders(); }
31
+
32
+ }
33
+
34
+
35
+
36
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BaseResult.class.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BaseResult.class.php
4
+ * @package Base
5
+ */
6
+
7
+ /**
8
+ * The base class for result objects that return a ResultCode and Messages collection -- There is no reason for clients to create these.
9
+ * @package Base
10
+ * @author tblanchard
11
+ * Copyright (c) 2005, Avalara. All rights reserved.
12
+ */
13
+
14
+
15
+ class BaseResult
16
+ {
17
+
18
+ //@author:swetal
19
+ //Removed declarations of variable as it was creating problem due to bug in SoapClient
20
+
21
+ /**
22
+ * A unique Transaction ID identifying a specific request/response set.
23
+ * @return string
24
+ */
25
+ public function getTransactionId() { return $this->TransactionId; }
26
+ /**
27
+ * Indicates whether operation was successfully completed or not.
28
+ * @return string
29
+ */
30
+ public function getResultCode() { return $this->ResultCode; }
31
+ /**
32
+ * Accessor
33
+ * @return array
34
+ */
35
+ public function getMessages() { return EnsureIsArray($this->Messages->Message); }
36
+
37
+ }
38
+
39
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/AuditMessage.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * AuditMessage.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class AuditMessage {
8
+ private $Message; // string
9
+
10
+ public function setMessage($value){$this->Message=$value;} // string
11
+ public function getMessage(){return $this->Message;} // string
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/AvaTaxBatchSvc.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * AvaTax.php
4
+ *
5
+ * @package Base
6
+ */
7
+
8
+ /**
9
+ * Defines class loading search path.
10
+ */
11
+
12
+ function __autoload($class_name)
13
+ {
14
+ require_once $class_name . '.class.php';
15
+ }
16
+
17
+ function EnsureIsArray( $obj )
18
+ {
19
+ if( is_object($obj))
20
+ {
21
+ $item[0] = $obj;
22
+ }
23
+ else
24
+ {
25
+ $item = (array)$obj;
26
+ }
27
+ return $item;
28
+ }
29
+
30
+
31
+
32
+ /**
33
+ * Takes xml as a string and returns it nicely indented
34
+ *
35
+ * @param string $xml The xml to beautify
36
+ * @param boolean $html_output If the xml should be formatted for display on an html page
37
+ * @return string The beautified xml
38
+ */
39
+
40
+ function xml_pretty_printer($xml, $html_output=FALSE)
41
+ {
42
+ $xml_obj = new SimpleXMLElement($xml);
43
+ $xml_lines = explode("n", $xml_obj->asXML());
44
+ $indent_level = 0;
45
+
46
+ $new_xml_lines = array();
47
+ foreach ($xml_lines as $xml_line) {
48
+ if (preg_match('#(<[a-z0-9:-]+((s+[a-z0-9:-]+="[^"]+")*)?>.*<s*/s*[^>]+>)|(<[a-z0-9:-]+((s+[a-z0-9:-]+="[^"]+")*)?s*/s*>)#i', $xml_line)) {
49
+ $new_line = str_pad('', $indent_level*4) . $xml_line;
50
+ $new_xml_lines[] = $new_line;
51
+ } elseif (preg_match('#<[a-z0-9:-]+((s+[a-z0-9:-]+="[^"]+")*)?>#i', $xml_line)) {
52
+ $new_line = str_pad('', $indent_level*4) . $xml_line;
53
+ $indent_level++;
54
+ $new_xml_lines[] = $new_line;
55
+ } elseif (preg_match('#<s*/s*[^>/]+>#i', $xml_line)) {
56
+ $indent_level--;
57
+ if (trim($new_xml_lines[sizeof($new_xml_lines)-1]) == trim(str_replace("/", "", $xml_line))) {
58
+ $new_xml_lines[sizeof($new_xml_lines)-1] .= $xml_line;
59
+ } else {
60
+ $new_line = str_pad('', $indent_level*4) . $xml_line;
61
+ $new_xml_lines[] = $new_line;
62
+ }
63
+ } else {
64
+ $new_line = str_pad('', $indent_level*4) . $xml_line;
65
+ $new_xml_lines[] = $new_line;
66
+ }
67
+ }
68
+
69
+ $xml = join("n", $new_xml_lines);
70
+ return ($html_output) ? '<pre>' . htmlentities($xml) . '</pre>' : $xml;
71
+ }
72
+
73
+
74
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BaseResult.class.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BaseResult.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BaseResult {
8
+ private $TransactionId; // string
9
+ private $ResultCode; // SeverityLevel
10
+ private $Messages; // ArrayOfMessage
11
+
12
+ public function setTransactionId($value){$this->TransactionId=$value;} // string
13
+ public function getTransactionId(){return $this->TransactionId;} // string
14
+
15
+ public function setResultCode($value){$this->ResultCode=$value;} // SeverityLevel
16
+ public function getResultCode(){return $this->ResultCode;} // SeverityLevel
17
+
18
+ public function setMessages($value){$this->Messages=$value;} // ArrayOfMessage
19
+ public function getMessages(){return $this->Messages;} // ArrayOfMessage
20
+
21
+ }
22
+
23
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/Batch.class.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Batch.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class Batch {
8
+ private $AccountId; // int
9
+ private $BatchId; // int
10
+ private $BatchStatusId; // string
11
+ private $BatchTypeId; // string
12
+ private $CompanyId; // int
13
+ private $CreatedDate; // dateTime
14
+ private $CreatedUserId; // int
15
+ private $CompletedDate; // dateTime
16
+ private $Files; // ArrayOfBatchFile
17
+ private $ModifiedDate; // dateTime
18
+ private $ModifiedUserId; // int
19
+ private $Name; // string
20
+ private $Options; // string
21
+ private $RecordCount; // int
22
+ private $CurrentRecord; // int
23
+
24
+ function __construct()
25
+ {
26
+ $this->AccountId=0;
27
+ $this->BatchId=0;
28
+ $this->CreatedUserId=0;
29
+ $this->ModifiedUserId=0;
30
+ $this->RecordCount=0;
31
+ $this->CurrentRecord=0;
32
+
33
+ $this->CreatedDate=getCurrentDate();
34
+ $this->CompletedDate=getCurrentDate();
35
+ $this->ModifiedDate=getCurrentDate();
36
+
37
+
38
+
39
+ }
40
+
41
+ public function setAccountId($value){$this->AccountId=$value;} // int
42
+ public function getAccountId(){return $this->AccountId;} // int
43
+
44
+ public function setBatchId($value){$this->BatchId=$value;} // int
45
+ public function getBatchId(){return $this->BatchId;} // int
46
+
47
+ public function setBatchStatusId($value){$this->BatchStatusId=$value;} // string
48
+ public function getBatchStatusId(){return $this->BatchStatusId;} // string
49
+
50
+ public function setBatchTypeId($value){$this->BatchTypeId=$value;} // string
51
+ public function getBatchTypeId(){return $this->BatchTypeId;} // string
52
+
53
+ public function setCompanyId($value){$this->CompanyId=$value;} // int
54
+ public function getCompanyId(){return $this->CompanyId;} // int
55
+
56
+ public function setCreatedDate($value){$this->CreatedDate=$value;} // dateTime
57
+ public function getCreatedDate(){return $this->CreatedDate;} // dateTime
58
+
59
+ public function setCreatedUserId($value){$this->CreatedUserId=$value;} // int
60
+ public function getCreatedUserId(){return $this->CreatedUserId;} // int
61
+
62
+ public function setCompletedDate($value){$this->CompletedDate=$value;} // dateTime
63
+ public function getCompletedDate(){return $this->CompletedDate;} // dateTime
64
+
65
+ public function setFiles($value){$this->Files=$value;} // ArrayOfBatchFile
66
+ public function getFiles(){return $this->Files;} // ArrayOfBatchFile
67
+
68
+ public function setModifiedDate($value){$this->ModifiedDate=$value;} // dateTime
69
+ public function getModifiedDate(){return $this->ModifiedDate;} // dateTime
70
+
71
+ public function setModifiedUserId($value){$this->ModifiedUserId=$value;} // int
72
+ public function getModifiedUserId(){return $this->ModifiedUserId;} // int
73
+
74
+ public function setName($value){$this->Name=$value;} // string
75
+ public function getName(){return $this->Name;} // string
76
+
77
+ public function setOptions($value){$this->Options=$value;} // string
78
+ public function getOptions(){return $this->Options;} // string
79
+
80
+ public function setRecordCount($value){$this->RecordCount=$value;} // int
81
+ public function getRecordCount(){return $this->RecordCount;} // int
82
+
83
+ public function setCurrentRecord($value){$this->CurrentRecord=$value;} // int
84
+ public function getCurrentRecord(){return $this->CurrentRecord;} // int
85
+
86
+ }
87
+
88
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchDelete.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchDelete.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchDelete {
8
+ private $DeleteRequest; // DeleteRequest
9
+
10
+ public function setDeleteRequest($value){$this->DeleteRequest=$value;} // DeleteRequest
11
+ public function getDeleteRequest(){return $this->DeleteRequest;} // DeleteRequest
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchDeleteResponse.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchDeleteResponse.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchDeleteResponse {
8
+ private $BatchDeleteResult; // DeleteResult
9
+
10
+ public function setBatchDeleteResult($value){$this->BatchDeleteResult=$value;} // DeleteResult
11
+ public function getBatchDeleteResult(){return $this->BatchDeleteResult;} // DeleteResult
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFetch.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchFetch.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchFetch {
8
+ private $FetchRequest; // FetchRequest
9
+
10
+ public function setFetchRequest($value){$this->FetchRequest=$value;} // FetchRequest
11
+ public function getFetchRequest(){return $this->FetchRequest;} // FetchRequest
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFetchResponse.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchFetchResponse.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchFetchResponse {
8
+ private $BatchFetchResult; // BatchFetchResult
9
+
10
+ public function setBatchFetchResult($value){$this->BatchFetchResult=$value;} // BatchFetchResult
11
+ public function getBatchFetchResult(){return $this->BatchFetchResult;} // BatchFetchResult
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFetchResult.class.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchFetchResult.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchFetchResult extends BaseResult {
8
+ private $Batches; // ArrayOfBatch
9
+ private $RecordCount; // int
10
+
11
+ public function setBatches($value){$this->Batches=$value;} // ArrayOfBatch
12
+ public function getBatches(){return $this->Batches;} // ArrayOfBatch
13
+
14
+ public function setRecordCount($value){$this->RecordCount=$value;} // int
15
+ public function getRecordCount(){return $this->RecordCount;} // int
16
+
17
+ }
18
+
19
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFile.class.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchFile.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchFile {
8
+ private $BatchFileId; // int
9
+ private $BatchId; // int
10
+ private $Content; // base64Binary
11
+ private $ContentType; // string
12
+ private $Ext; // string
13
+ private $FilePath; // string
14
+ private $Name; // string
15
+ private $Size; // int
16
+ private $ErrorCount; // int
17
+
18
+ function __construct()
19
+ {
20
+ $this->BatchFileId=0;
21
+ $this->BatchId=0;
22
+ $this->ErrorCount=0;
23
+ }
24
+
25
+ public function setBatchFileId($value){$this->BatchFileId=$value;} // int
26
+ public function getBatchFileId(){return $this->BatchFileId;} // int
27
+
28
+ public function setBatchId($value){$this->BatchId=$value;} // int
29
+ public function getBatchId(){return $this->BatchId;} // int
30
+
31
+ public function setContent($value){$this->Content=$value;} // base64Binary
32
+ public function getContent(){return $this->Content;} // base64Binary
33
+
34
+ public function setContentType($value){$this->ContentType=$value;} // string
35
+ public function getContentType(){return $this->ContentType;} // string
36
+
37
+ public function setExt($value){$this->Ext=$value;} // string
38
+ public function getExt(){return $this->Ext;} // string
39
+
40
+ public function setFilePath($value){$this->FilePath=$value;} // string
41
+ public function getFilePath(){return $this->FilePath;} // string
42
+
43
+ public function setName($value){$this->Name=$value;} // string
44
+ public function getName(){return $this->Name;} // string
45
+
46
+ public function setSize($value){$this->Size=$value;} // int
47
+ public function getSize(){return $this->Size;} // int
48
+
49
+ public function setErrorCount($value){$this->ErrorCount=$value;} // int
50
+ public function getErrorCount(){return $this->ErrorCount;} // int
51
+
52
+ }
53
+
54
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFileDelete.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchFileDelete.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchFileDelete {
8
+ private $DeleteRequest; // DeleteRequest
9
+
10
+ public function setDeleteRequest($value){$this->DeleteRequest=$value;} // DeleteRequest
11
+ public function getDeleteRequest(){return $this->DeleteRequest;} // DeleteRequest
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFileDeleteResponse.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchFileDeleteResponse.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchFileDeleteResponse {
8
+ private $BatchFileDeleteResult; // DeleteResult
9
+
10
+ public function setBatchFileDeleteResult($value){$this->BatchFileDeleteResult=$value;} // DeleteResult
11
+ public function getBatchFileDeleteResult(){return $this->BatchFileDeleteResult;} // DeleteResult
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFileFetch.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchFileFetch.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchFileFetch {
8
+ private $FetchRequest; // FetchRequest
9
+
10
+ public function setFetchRequest($value){$this->FetchRequest=$value;} // FetchRequest
11
+ public function getFetchRequest(){return $this->FetchRequest;} // FetchRequest
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFileFetchResponse.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchFileFetchResponse.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchFileFetchResponse {
8
+ private $BatchFileFetchResult; // BatchFileFetchResult
9
+
10
+ public function setBatchFileFetchResult($value){$this->BatchFileFetchResult=$value;} // BatchFileFetchResult
11
+ public function getBatchFileFetchResult(){return $this->BatchFileFetchResult;} // BatchFileFetchResult
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFileFetchResult.class.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchFileFetchResult.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchFileFetchResult extends BaseResult {
8
+ private $BatchFiles; // ArrayOfBatchFile
9
+ private $RecordCount; // int
10
+
11
+ public function setBatchFiles($value){$this->BatchFiles=$value;} // ArrayOfBatchFile
12
+ public function getBatchFiles(){return $this->BatchFiles;} // ArrayOfBatchFile
13
+
14
+ public function setRecordCount($value){$this->RecordCount=$value;} // int
15
+ public function getRecordCount(){return $this->RecordCount;} // int
16
+
17
+ }
18
+
19
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFileSave.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchFileSave.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchFileSave {
8
+ private $BatchFile; // BatchFile
9
+
10
+ public function setBatchFile($value){$this->BatchFile=$value;} // BatchFile
11
+ public function getBatchFile(){return $this->BatchFile;} // BatchFile
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFileSaveResponse.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchFileSaveResponse.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchFileSaveResponse {
8
+ private $BatchFileSaveResult; // BatchFileSaveResult
9
+
10
+ public function setBatchFileSaveResult($value){$this->BatchFileSaveResult=$value;} // BatchFileSaveResult
11
+ public function getBatchFileSaveResult(){return $this->BatchFileSaveResult;} // BatchFileSaveResult
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchFileSaveResult.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchFileSaveResult.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchFileSaveResult extends BaseResult {
8
+ private $BatchFileId; // int
9
+
10
+ public function setBatchFileId($value){$this->BatchFileId=$value;} // int
11
+ public function getBatchFileId(){return $this->BatchFileId;} // int
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchProcess.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchProcess.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchProcess {
8
+ private $BatchProcessRequest; // BatchProcessRequest
9
+
10
+ public function setBatchProcessRequest($value){$this->BatchProcessRequest=$value;} // BatchProcessRequest
11
+ public function getBatchProcessRequest(){return $this->BatchProcessRequest;} // BatchProcessRequest
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchProcessRequest.class.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchProcessRequest.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchProcessRequest //extends FilterRequest
8
+ {
9
+ private $Filters; // string
10
+ private $MaxCount; // int
11
+
12
+ function __construct()
13
+ {
14
+ $this->MaxCount=0;
15
+
16
+ }
17
+
18
+ public function setFilters($value){$this->Filters=$value;} // string
19
+ public function getFilters(){return $this->Filters;} // string
20
+
21
+ public function setMaxCount($value){$this->MaxCount=$value;} // int
22
+ public function getMaxCount(){return $this->MaxCount;} // int
23
+
24
+ }
25
+
26
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchProcessResponse.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchProcessResponse.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchProcessResponse {
8
+ private $BatchProcessResult; // BatchProcessResult
9
+
10
+ public function setBatchProcessResult($value){$this->BatchProcessResult=$value;} // BatchProcessResult
11
+ public function getBatchProcessResult(){return $this->BatchProcessResult;} // BatchProcessResult
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchProcessResult.class.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchProcessResult.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchProcessResult extends BaseResult {
8
+
9
+ }
10
+
11
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchSave.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchSave.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchSave {
8
+ private $Batch; // Batch
9
+
10
+ public function setBatch($value){$this->Batch=$value;} // Batch
11
+ public function getBatch(){return $this->Batch;} // Batch
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchSaveResponse.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchSaveResponse.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchSaveResponse {
8
+ private $BatchSaveResult; // BatchSaveResult
9
+
10
+ public function setBatchSaveResult($value){$this->BatchSaveResult=$value;} // BatchSaveResult
11
+ public function getBatchSaveResult(){return $this->BatchSaveResult;} // BatchSaveResult
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchSaveResult.class.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchSaveResult.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class BatchSaveResult extends BaseResult {
8
+ private $BatchId; // int
9
+ private $EstimatedCompletion; // dateTime
10
+
11
+ public function setBatchId($value){$this->BatchId=$value;} // int
12
+ public function getBatchId(){return $this->BatchId;} // int
13
+
14
+ public function setEstimatedCompletion($value){$this->EstimatedCompletion=$value;} // dateTime
15
+ public function getEstimatedCompletion(){return $this->EstimatedCompletion;} // dateTime
16
+
17
+ }
18
+
19
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/BatchSvc.class.php ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BatchSvc.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+
8
+
9
+ class BatchSvc extends SoapClient {
10
+
11
+ private $client;
12
+ private static $classmap = array(
13
+ 'BatchFetch' => 'BatchFetch',
14
+ 'FetchRequest' => 'FetchRequest',
15
+ 'BatchFetchResponse' => 'BatchFetchResponse',
16
+ 'BatchFetchResult' => 'BatchFetchResult',
17
+ 'BaseResult' => 'BaseResult',
18
+ 'SeverityLevel' => 'SeverityLevel',
19
+ 'Message' => 'Message',
20
+ 'Batch' => 'Batch',
21
+ 'BatchFile' => 'BatchFile',
22
+ 'Profile' => 'Profile',
23
+ 'BatchSave' => 'BatchSave',
24
+ 'BatchSaveResponse' => 'BatchSaveResponse',
25
+ 'BatchSaveResult' => 'BatchSaveResult',
26
+ 'AuditMessage' => 'AuditMessage',
27
+ 'BatchDelete' => 'BatchDelete',
28
+ 'DeleteRequest' => 'DeleteRequest',
29
+ 'FilterRequest' => 'FilterRequest',
30
+ 'BatchDeleteResponse' => 'BatchDeleteResponse',
31
+ 'DeleteResult' => 'DeleteResult',
32
+ 'FilterResult' => 'FilterResult',
33
+ 'BatchProcess' => 'BatchProcess',
34
+ 'BatchProcessRequest' => 'BatchProcessRequest',
35
+ 'BatchProcessResponse' => 'BatchProcessResponse',
36
+ 'BatchProcessResult' => 'BatchProcessResult',
37
+ 'BatchFileFetch' => 'BatchFileFetch',
38
+ 'BatchFileFetchResponse' => 'BatchFileFetchResponse',
39
+ 'BatchFileFetchResult' => 'BatchFileFetchResult',
40
+ 'BatchFileSave' => 'BatchFileSave',
41
+ 'BatchFileSaveResponse' => 'BatchFileSaveResponse',
42
+ 'BatchFileSaveResult' => 'BatchFileSaveResult',
43
+ 'BatchFileDelete' => 'BatchFileDelete',
44
+ 'BatchFileDeleteResponse' => 'BatchFileDeleteResponse',
45
+ 'Ping' => 'Ping',
46
+ 'PingResponse' => 'PingResponse',
47
+ 'PingResult' => 'PingResult',
48
+ 'IsAuthorized' => 'IsAuthorized',
49
+ 'IsAuthorizedResponse' => 'IsAuthorizedResponse',
50
+ 'IsAuthorizedResult' => 'IsAuthorizedResult',
51
+ );
52
+
53
+ public function __construct($configurationName = 'Default')
54
+ {
55
+ $config = new ATConfig($configurationName);
56
+
57
+ $this->client = new DynamicSoapClient (
58
+ $config->batchWSDL,
59
+ array
60
+ (
61
+ 'location' => $config->url.$config->batchService,
62
+ 'trace' => $config->trace,
63
+ 'classmap' => BatchSvc::$classmap
64
+ ),
65
+ $config
66
+ );
67
+ }
68
+
69
+ /**
70
+ * Fetches one or more Batch
71
+ *
72
+ * @param BatchFetch $parameters
73
+ * @return BatchFetchResponse
74
+ */
75
+ public function BatchFetch(&$fetchRequest) {
76
+
77
+ return $this->client->BatchFetch(array('FetchRequest' => $fetchRequest))->getBatchFetchResult();
78
+ }
79
+
80
+ /**
81
+ * Saves a Batch entry
82
+ *
83
+ * @param BatchSave $parameters
84
+ * @return BatchSaveResponse
85
+ */
86
+ public function BatchSave(&$batch) {
87
+
88
+ return $this->client->BatchSave(array('Batch' => $batch))->getBatchSaveResult();
89
+
90
+ }
91
+
92
+ /**
93
+ * Deletes one or more Batches
94
+ *
95
+ * @param BatchDelete $parameters
96
+ * @return BatchDeleteResponse
97
+ */
98
+ public function BatchDelete(&$deleteRequest) {
99
+
100
+ return $this->client->BatchDelete(array('DeleteRequest' => $deleteRequest))->getBatchDeleteResult();
101
+
102
+ }
103
+
104
+ /**
105
+ * Processes one or more Batches
106
+ *
107
+ * @param BatchProcess $parameters
108
+ * @return BatchProcessResponse
109
+ */
110
+ public function BatchProcess(&$batchProcessRequest) {
111
+
112
+ return $this->client->BatchProcess(array('BatchProcessRequest' => $batchProcessRequest))->getBatchProcessResult();
113
+
114
+ }
115
+
116
+ /**
117
+ * Fetches one or more BatchFiles
118
+ *
119
+ * @param BatchFileFetch $parameters
120
+ * @return BatchFileFetchResponse
121
+ */
122
+ public function BatchFileFetch(&$fetchRequest) {
123
+
124
+ return $this->client->BatchFileFetch(array('FetchRequest' => $fetchRequest))->getBatchFileFetchResult();
125
+
126
+ }
127
+
128
+ /**
129
+ * Saves a Batch File
130
+ *
131
+ * @param BatchFileSave $parameters
132
+ * @return BatchFileSaveResponse
133
+ */
134
+ public function BatchFileSave(&$batchFile) {
135
+
136
+ return $this->client->BatchFileSave(array('BatchFile' => $batchFile))->getBatchFileSaveResult();
137
+
138
+ }
139
+
140
+ /**
141
+ * Deletes one or more BatchFiles
142
+ *
143
+ * @param BatchFileDelete $parameters
144
+ * @return BatchFileDeleteResponse
145
+ */
146
+ public function BatchFileDelete(&$deleteRequest) {
147
+
148
+ return $this->client->BatchFileDelete(array('DeleteRequest' => $deleteRequest))->getBatchFileDeleteResult();
149
+
150
+ }
151
+
152
+ /**
153
+ * Tests connectivity and version of the service
154
+ *
155
+ * @param Ping $parameters
156
+ * @return PingResponse
157
+ */
158
+ public function Ping($message = '') {
159
+ return $this->client->Ping(array('Message' => $message))->getPingResult();
160
+ }
161
+
162
+ /**
163
+ * Checks authentication and authorization to one or more operations on the service.
164
+ *
165
+ * @param IsAuthorized $parameters
166
+ * @return IsAuthorizedResponse
167
+ */
168
+ public function IsAuthorized($operations)
169
+ {
170
+ return $this->client->IsAuthorized(array('Operations' => $operations))->getIsAuthorizedResult();
171
+ }
172
+
173
+ }
174
+
175
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/DeleteRequest.class.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DeleteRequest.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class DeleteRequest //extends FilterRequest
8
+ {
9
+ private $Filters; // string
10
+ private $MaxCount; // int
11
+
12
+ function __construct()
13
+ {
14
+ $this->MaxCount=0;
15
+
16
+ }
17
+
18
+ public function setFilters($value){$this->Filters=$value;} // string
19
+ public function getFilters(){return $this->Filters;} // string
20
+
21
+ public function setMaxCount($value){$this->MaxCount=$value;} // int
22
+ public function getMaxCount(){return $this->MaxCount;} // int
23
+
24
+ }
25
+
26
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/DeleteResult.class.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DeleteResult.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class DeleteResult extends BaseResult {
8
+
9
+ }
10
+
11
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/FetchRequest.class.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FetchRequest.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class FetchRequest {
8
+ private $Fields; // string
9
+ private $Filters; // string
10
+ private $Sort; // string
11
+ private $MaxCount; // int
12
+ private $PageIndex; // int
13
+ private $PageSize; // int
14
+ private $RecordCount; // int
15
+
16
+ function __construct()
17
+ {
18
+ $this->MaxCount=0;
19
+ $this->PageIndex=0;
20
+ $this->PageSize=0;
21
+ $this->RecordCount=0;
22
+ }
23
+
24
+ public function setFields($value){$this->Fields=$value;} // string
25
+ public function getFields(){return $this->Fields;} // string
26
+
27
+ public function setFilters($value){$this->Filters=$value;} // string
28
+ public function getFilters(){return $this->Filters;} // string
29
+
30
+ public function setSort($value){$this->Sort=$value;} // string
31
+ public function getSort(){return $this->Sort;} // string
32
+
33
+ public function setMaxCount($value){$this->MaxCount=$value;} // int
34
+ public function getMaxCount(){return $this->MaxCount;} // int
35
+
36
+ public function setPageIndex($value){$this->PageIndex=$value;} // int
37
+ public function getPageIndex(){return $this->PageIndex;} // int
38
+
39
+ public function setPageSize($value){$this->PageSize=$value;} // int
40
+ public function getPageSize(){return $this->PageSize;} // int
41
+
42
+ public function setRecordCount($value){$this->RecordCount=$value;} // int
43
+ public function getRecordCount(){return $this->RecordCount;} // int
44
+
45
+ }
46
+
47
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/FilterRequest.class.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FilterRequest.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class FilterRequest {
8
+ private $Filters; // string
9
+ private $MaxCount; // int
10
+
11
+ function __construct()
12
+ {
13
+ $this->MaxCount=0;
14
+
15
+ }
16
+
17
+ public function setFilters($value){$this->Filters=$value;} // string
18
+ public function getFilters(){return $this->Filters;} // string
19
+
20
+ public function setMaxCount($value){$this->MaxCount=$value;} // int
21
+ public function getMaxCount(){return $this->MaxCount;} // int
22
+
23
+ }
24
+
25
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/FilterResult.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * FilterResult.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class FilterResult {
8
+ private $Count; // int
9
+
10
+ public function setCount($value){$this->Count=$value;} // int
11
+ public function getCount(){return $this->Count;} // int
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/IsAuthorized.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * IsAuthorized.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class IsAuthorized {
8
+ private $Operations; // string
9
+
10
+ public function setOperations($value){$this->Operations=$value;} // string
11
+ public function getOperations(){return $this->Operations;} // string
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/IsAuthorizedResponse.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * IsAuthorizedResponse.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class IsAuthorizedResponse {
8
+ private $IsAuthorizedResult; // IsAuthorizedResult
9
+
10
+ public function setIsAuthorizedResult($value){$this->IsAuthorizedResult=$value;} // IsAuthorizedResult
11
+ public function getIsAuthorizedResult(){return $this->IsAuthorizedResult;} // IsAuthorizedResult
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/IsAuthorizedResult.class.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * IsAuthorizedResult.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class IsAuthorizedResult {
8
+ private $Operations; // string
9
+ private $Expires; // dateTime
10
+
11
+ public function setOperations($value){$this->Operations=$value;} // string
12
+ public function getOperations(){return $this->Operations;} // string
13
+
14
+ public function setExpires($value){$this->Expires=$value;} // dateTime
15
+ public function getExpires(){return $this->Expires;} // dateTime
16
+
17
+ }
18
+
19
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/Message.class.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Message.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class Message {
8
+ private $Summary; // string
9
+ private $Details; // string
10
+ private $HelpLink; // string
11
+ private $RefersTo; // string
12
+ private $Severity; // SeverityLevel
13
+ private $Source; // string
14
+ private $Name; // string
15
+
16
+ public function setSummary($value){$this->Summary=$value;} // string
17
+ public function getSummary(){return $this->Summary;} // string
18
+
19
+ public function setDetails($value){$this->Details=$value;} // string
20
+ public function getDetails(){return $this->Details;} // string
21
+
22
+ public function setHelpLink($value){$this->HelpLink=$value;} // string
23
+ public function getHelpLink(){return $this->HelpLink;} // string
24
+
25
+ public function setRefersTo($value){$this->RefersTo=$value;} // string
26
+ public function getRefersTo(){return $this->RefersTo;} // string
27
+
28
+ public function setSeverity($value){$this->Severity=$value;} // SeverityLevel
29
+ public function getSeverity(){return $this->Severity;} // SeverityLevel
30
+
31
+ public function setSource($value){$this->Source=$value;} // string
32
+ public function getSource(){return $this->Source;} // string
33
+
34
+ public function setName($value){$this->Name=$value;} // string
35
+ public function getName(){return $this->Name;} // string
36
+
37
+ }
38
+
39
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/Ping.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ping.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class Ping {
8
+ private $Message; // string
9
+
10
+ public function setMessage($value){$this->Message=$value;} // string
11
+ public function getMessage(){return $this->Message;} // string
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/PingResponse.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PingResponse.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class PingResponse {
8
+ private $PingResult; // PingResult
9
+
10
+ public function setPingResult($value){$this->PingResult=$value;} // PingResult
11
+ public function getPingResult(){return $this->PingResult;} // PingResult
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/PingResult.class.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PingResult.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class PingResult extends BaseResult
8
+ {
9
+ private $Version; // string
10
+
11
+ public function setVersion($value){$this->Version=$value;} // string
12
+ public function getVersion(){return $this->Version;} // string
13
+
14
+ //public function getTransactionId() { return $this->TransactionId; }
15
+ /**
16
+ * Accessor
17
+ * @return string
18
+ */
19
+ //public function getResultCode() { return $this->ResultCode; }
20
+ /**
21
+ * Accessor
22
+ * @return array
23
+ */
24
+ //public function getMessages() { return EnsureIsArray($this->Messages->Message);}
25
+
26
+ }
27
+
28
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/Profile.class.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Profile.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class Profile {
8
+ private $Name; // string
9
+ private $Client; // string
10
+ private $Adapter; // string
11
+ private $Machine; // string
12
+
13
+ public function setName($value){$this->Name=$value;} // string
14
+ public function getName(){return $this->Name;} // string
15
+
16
+ public function setClient($value){$this->Client=$value;} // string
17
+ public function getClient(){return $this->Client;} // string
18
+
19
+ public function setAdapter($value){$this->Adapter=$value;} // string
20
+ public function getAdapter(){return $this->Adapter;} // string
21
+
22
+ public function setMachine($value){$this->Machine=$value;} // string
23
+ public function getMachine(){return $this->Machine;} // string
24
+
25
+ }
26
+
27
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BatchSvc/SeverityLevel.class.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SeverityLevel.class.php
4
+ *
5
+ * @package Batch
6
+ */
7
+ class SeverityLevel {
8
+ const Success = 'Success';
9
+ const Warning = 'Warning';
10
+ const Error = 'Error';
11
+ const Exception = 'Exception';
12
+
13
+ }
14
+
15
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/BoundaryLevel.class.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BoundaryLevel.class.php
4
+ * @package Tax
5
+ */
6
+
7
+ /**
8
+ * BoundaryLevel.class.php
9
+ *
10
+ * Jurisdiction boundary precision level found for address;
11
+ * This depends on the accuracy of the address as well as the
12
+ * precision level of the state provided jurisdiction boundaries.
13
+ * @package Tax
14
+ * @see TaxLine
15
+ * @author tblanchard
16
+ * Copyright (c) 2008, Avalara. All rights reserved.
17
+ */
18
+
19
+ class BoundaryLevel extends Enum
20
+ {
21
+
22
+ /**
23
+ * Street address precision
24
+ *
25
+ * @var unknown_type
26
+ */
27
+ public static $Address = 'Address'; //enum
28
+
29
+ /**
30
+ *5-digit zip precision
31
+ *
32
+ * @var unknown_type
33
+ */
34
+ public static $Zip9 = 'Zip9'; //enum
35
+
36
+ /**
37
+ *9-digit zip precision
38
+ *
39
+ * @var unknown_type
40
+ */
41
+ public static $Zip5 = 'Zip5'; //enum
42
+
43
+
44
+
45
+ public static function Values()
46
+ {
47
+ return array(
48
+ BoundaryLevel::$Address,
49
+ BoundaryLevel::$Zip9,
50
+ BoundaryLevel::$Zip5
51
+ );
52
+ }
53
+
54
+
55
+ // Unfortunate boiler plate due to polymorphism issues on static functions
56
+ public static function Validate($value) { self::__Validate($value,self::Values(),__CLASS__); }
57
+ }
58
+
59
+
60
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/CancelCode.class.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CancelCode.class.php
4
+ *
5
+ * @package Tax
6
+ */
7
+
8
+ /**
9
+ * CancelCode.class.php
10
+
11
+ * A cancel code is set on a {@link CancelTaxRequest} and specifies the reason the
12
+ * tax calculation is being canceled (or in the case of posting, returned to its prior state).
13
+ * @author tblanchard
14
+ * @package Tax
15
+ * @see CancelTaxRequest
16
+ * Copyright (c) 2008, Avalara. All rights reserved.
17
+
18
+ */
19
+ class CancelCode extends Enum
20
+ {
21
+
22
+
23
+ /**
24
+ * The operation failed for an unknown reason.
25
+ */
26
+
27
+ public static $Unspecified = 'Unspecified';
28
+
29
+ /**
30
+ * Specifies the post operation failed when attempting to post an invoice within
31
+ * a client's application, for example, to the client's General Ledger; The
32
+ * document's status will be changed to <b>Saved</b>.
33
+ */
34
+
35
+ public static $PostFailed = 'PostFailed';
36
+
37
+ /**
38
+ * Specifies the document was deleted within the client's application and
39
+ * should be removed from the AvaTax records; If the document within AvaTax
40
+ * is already committed, the document status will be changed to <b>Cancelled</b>
41
+ * and retained for historical records; If the document was not committed,
42
+ * (was <b>Saved</b> or <b>Posted</b>) the document will be deleted within AvaTax.
43
+ */
44
+
45
+ public static $DocDeleted = 'DocDeleted';
46
+
47
+ /**
48
+ * Specifies the document was voided within the client's application and
49
+ * should be removed from the AvaTax records; If the document within AvaTax
50
+ * is already committed, the document status will be changed to <b>Cancelled</b>
51
+ * and retained for historical records; If the document was not committed,
52
+ * (was <b>Saved</b> or <b>Posted</b>) the document will be deleted within AvaTax.
53
+ */
54
+ public static $DocVoided = 'DocVoided';
55
+ public static $AdjustmentCancelled = 'AdjustmentCancelled';
56
+
57
+
58
+ public static function Values()
59
+ {
60
+ return array(
61
+ CancelCode::$Unspecified,
62
+ CancelCode::$PostFailed,
63
+ CancelCode::$DocDeleted,
64
+ CancelCode::$DocVoided,
65
+ CancelCode::$AdjustmentCancelled
66
+ );
67
+ }
68
+
69
+ // Unfortunate boiler plate due to polymorphism issues on static functions
70
+ public static function Validate($value) { self::__Validate($value,self::Values(),__CLASS__); }
71
+
72
+ }
73
+
74
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/CancelTaxRequest.class.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CancelTaxRequest.class.php
4
+ * @package Tax
5
+ */
6
+
7
+
8
+ /**
9
+ * Data to pass to CancelTax indicating
10
+ * the document that should be cancelled and the reason for the operation.
11
+ * <p>
12
+ * A document can be indicated solely by the DocId if it is known.
13
+ * Otherwise the request must specify all of CompanyCode,
14
+ * DocCode, and
15
+ * DocType in order to uniquely identify the document.
16
+ * </p>
17
+ *
18
+ * @package Tax
19
+ * @see CancelTaxResult, DocumentType
20
+ * @author tblanchard
21
+ * Copyright (c) 2008, Avalara. All rights reserved.
22
+ *
23
+ */
24
+
25
+ class CancelTaxRequest extends TaxRequest
26
+ {
27
+ private $CancelCode; //Unspecified or PostFailed or DocDeleted or DocVoided or AdjustmentCancelled
28
+
29
+ public function __construct()
30
+ {
31
+ $this->DocType = DocumentType::$SalesInvoice; // this is right Document
32
+ $this->CancelCode = CancelCode::$Unspecified;
33
+ }
34
+
35
+
36
+ /**
37
+ * A code indicating the reason the document is getting canceled.
38
+ *
39
+ * @return string
40
+ * @see CancelCode
41
+ */
42
+
43
+ public function getCancelCode() { return $this->CancelCode; }
44
+
45
+
46
+ /**
47
+ * A code indicating the reason the document is getting canceled.
48
+ *
49
+ * @var string
50
+ * @see CancelCode
51
+ */
52
+
53
+ public function setCancelCode($value) { CancelCode::Validate($value); $this->CancelCode = $value; return $this; }
54
+
55
+ }
56
+
57
+
58
+
59
+
60
+
61
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/CancelTaxResult.class.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CancelTaxResult.class.php
4
+ *
5
+ * @package Tax
6
+ */
7
+
8
+ /**
9
+ * CancelTaxResult.class.php
10
+ *
11
+ **
12
+ * Result data returned from {@link TaxSvcSoap#cancelTax}
13
+ * @see CancelTaxRequest
14
+ * @author tblanchard
15
+ * @package Tax
16
+ * Copyright (c) 2008, Avalara. All rights reserved.
17
+ */
18
+
19
+ class CancelTaxResult // extends BaseResult
20
+ {
21
+
22
+
23
+ // BaseResult innards - workaround a bug in SoapClient
24
+
25
+ /**
26
+ * @var string
27
+ */
28
+ private $TransactionId;
29
+ /**
30
+ * @var string must be one of the values defined in {@link SeverityLevel}.
31
+ */
32
+ private $ResultCode = 'Success';
33
+ /**
34
+ * @var array of Message.
35
+ */
36
+ private $Messages = array();
37
+
38
+ /**
39
+ * Accessor
40
+ * @return string
41
+ */
42
+ public function getTransactionId() { return $this->TransactionId; }
43
+ /**
44
+ * Accessor
45
+ * @return string
46
+ */
47
+ public function getResultCode() { return $this->ResultCode; }
48
+ /**
49
+ * Accessor
50
+ * @return array
51
+ */
52
+ public function getMessages() { return EnsureIsArray($this->Messages->Message); }
53
+
54
+
55
+
56
+ }
57
+
58
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/CommitTaxRequest.class.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommitTaxRequest.class.php
4
+ * @package Tax
5
+ */
6
+
7
+ /**
8
+ * Data to pass to {@link TaxServiceSoap#commitTax}.
9
+ * <p>
10
+ * A document can be indicated solely by the {@link CommitTaxRequest#DocId} if it is known.
11
+ * Otherwise the request must specify all of {@link CommitTaxRequest#CompanyCode},
12
+ * {@link CommitTaxRequest#DocCode}, and
13
+ * {@link CommitTaxRequest#tDocType} in order to uniquely identify the document.
14
+ * </p>
15
+ *
16
+ * @package Tax
17
+ * @see CommitTaxResult
18
+ * @author tblanchard
19
+ * Copyright (c) 2007, Avalara. All rights reserved.
20
+ */
21
+
22
+ class CommitTaxRequest extends TaxRequest
23
+ {
24
+ private $NewDocCode; //string
25
+
26
+ /**
27
+ * As on this version of SDK DocCode can be changed during commit using NewDocCode.
28
+ *
29
+ * @return string
30
+ */
31
+ public function getNewDocCode() { return $this->NewDocCode; }
32
+
33
+ /**
34
+ * As on this version of SDK DocCode can be changed during commit using NewDocCode.
35
+ *
36
+ * @param string $value
37
+ */
38
+ public function setNewDocCode($value) { $this->NewDocCode = $value; }
39
+
40
+
41
+
42
+
43
+ }
44
+
45
+
46
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/CommitTaxResult.class.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CommitTaxResult.class.php
4
+ * @package Tax
5
+ */
6
+
7
+ /**
8
+ * Result data returned from {@link TaxServiceSoap#commitTax}.
9
+ *
10
+ * @package Tax
11
+ * @see CommitTaxRequest
12
+ * @author tblanchard
13
+ * Copyright (c) 2008, Avalara. All rights reserved.
14
+ */
15
+
16
+ class CommitTaxResult //extends BaseResult
17
+ {
18
+
19
+
20
+ // BaseResult innards - workaround a bug in SoapClient
21
+
22
+ /**
23
+ * @var string
24
+ */
25
+ private $TransactionId;
26
+ /**
27
+ * @var string must be one of the values defined in {@link SeverityLevel}.
28
+ */
29
+ private $ResultCode = 'Success';
30
+ /**
31
+ * @var array of Message.
32
+ */
33
+ private $Messages = array();
34
+
35
+ /**
36
+ * Accessor
37
+ * @return string
38
+ */
39
+ public function getTransactionId() { return $this->TransactionId; }
40
+ /**
41
+ * Accessor
42
+ * @return string
43
+ */
44
+ public function getResultCode() { return $this->ResultCode; }
45
+ /**
46
+ * Accessor
47
+ * @return array
48
+ */
49
+ public function getMessages() { return EnsureIsArray($this->Messages->Message); }
50
+
51
+
52
+ }
53
+
54
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/DetailLevel.class.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DetailLevel.class.php
4
+ * @package Tax
5
+ */
6
+
7
+ /**
8
+ * Specifies the level of tax detail to return to the client application following a tax calculation.
9
+ *
10
+ * @package Tax
11
+ * @see GetTaxRequest, GetTaxHistoryRequest
12
+ * @author tblanchard
13
+ * Copyright (c) 2007, Avalara. All rights reserved. */
14
+
15
+
16
+ class DetailLevel extends Enum
17
+ {
18
+ /**
19
+ * Reserved for future use.
20
+ */
21
+ public static $Summary = 'Summary';
22
+
23
+ /**
24
+ * Document ({@link GetTaxResult}) level details; {@link ArrayOfTaxLine} will not be returned.
25
+ */
26
+ public static $Document = 'Document';
27
+
28
+ /**
29
+ * Line level details (includes Document details). {@link ArrayOfTaxLine} will
30
+ * be returned but {@link ArrayOfTaxDetail} will not be returned.
31
+ */
32
+ public static $Line = 'Line';
33
+
34
+ /**
35
+ * Tax jurisdiction level details (includes Document, {@link ArrayOfTaxLine},
36
+ * and {@link ArrayOfTaxDetail})
37
+ */
38
+ public static $Tax = 'Tax';
39
+ public static $Diagnostic = 'Diagnostic';
40
+
41
+
42
+ public static function Values()
43
+ {
44
+ return array(
45
+ DetailLevel::$Summary,
46
+ DetailLevel::$Document,
47
+ DetailLevel::$Line,
48
+ DetailLevel::$Tax,
49
+ DetailLevel::$Diagnostic
50
+ );
51
+ }
52
+
53
+ // Unfortunate boiler plate due to polymorphism issues on static functions
54
+ public static function Validate($value) { self::__Validate($value,self::Values(),__CLASS__); }
55
+ }
56
+
57
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/DocStatus.class.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DocStatus.class.php
4
+ * @package Tax
5
+ */
6
+
7
+ /**
8
+ * The document's status is returned in the GetTaxResult (except for <b>DocStatus::$Any</b>)
9
+ * and indicates the state of the document in tax history.
10
+ *
11
+ * @package Tax
12
+ * @author tblanchard
13
+ * Copyright (c) 2007, Avalara. All rights reserved.
14
+ */
15
+
16
+
17
+ class DocStatus extends Enum
18
+ {
19
+
20
+ /**
21
+ * A temporary document not saved (DocumentType was SalesOrder, PurchaseOrder, ReturnOrder)
22
+ *
23
+ * @var unknown_type
24
+ */
25
+ public static $Temporary= 'Temporary';
26
+
27
+ /**
28
+ * A saved document (DocumentType was SalesInvoice, PurchaseInvoice, ReturnInvoice) ready to be posted.
29
+ *
30
+ * @var DocStatus
31
+ */
32
+ public static $Saved = 'Saved';
33
+
34
+ /**
35
+ * A posted document (not committed).
36
+ *
37
+ * @var DocStatus
38
+ */
39
+ public static $Posted = 'Posted';
40
+
41
+ /**
42
+ * A posted document that has been committed.
43
+ *
44
+ * @var DocStatus
45
+ */
46
+ public static $Committed = 'Committed';
47
+
48
+ /**
49
+ * A committed document that has been cancelled.
50
+ *
51
+ * @var DocStatus
52
+ */
53
+ public static $Cancelled = 'Cancelled';
54
+
55
+ /**
56
+ * Enter description here...
57
+ *
58
+ * @var DocStatus
59
+ */
60
+ public static $Adjusted = 'Adjusted';
61
+
62
+ /**
63
+ * Any status (used for searching)
64
+ *
65
+ * @var DocStatus
66
+ */
67
+ public static $Any = 'Any';
68
+
69
+
70
+ public static function Values()
71
+ {
72
+ return array(
73
+ DocStatus::$Temporary,
74
+ DocStatus::$Saved,
75
+ DocStatus::$Posted,
76
+ DocStatus::$Committed,
77
+ DocStatus::$Cancelled,
78
+ DocStatus::$Adjusted,
79
+ DocStatus::$Any
80
+ );
81
+ }
82
+ // Unfortunate boiler plate due to polymorphism issues on static functions
83
+ public static function Validate($value) { self::__Validate($value,self::Values(),__CLASS__); }
84
+
85
+ }
86
+
87
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/DocumentType.class.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DocumentType.class.php
4
+ *
5
+ * @package Tax
6
+ */
7
+
8
+ /**
9
+ * The document type specifies the category of the document and affects how the document
10
+ * is treated after a tax calculation. Specified when constructing a {@link GetTaxRequest}.
11
+ *
12
+ * @package Tax
13
+ * @author tblanchard
14
+ * Copyright (c) 2008, Avalara. All rights reserved.
15
+ */
16
+
17
+
18
+ class DocumentType extends Enum
19
+ {
20
+
21
+ /**
22
+ * Sales Order, estimate or quote.
23
+ *
24
+ * @var DocumentType
25
+ */
26
+ public static $SalesOrder = 'SalesOrder';
27
+
28
+ /**
29
+ * The document is a permanent invoice; document and tax calculation results are saved in the tax history.
30
+ *
31
+ * @var DocumentType
32
+ */
33
+ public static $SalesInvoice = 'SalesInvoice';
34
+
35
+ /**
36
+ * Purchase order, estimate, or quote.
37
+ *
38
+ * @var DocumentType
39
+ */
40
+ public static $PurchaseOrder = 'PurchaseOrder';
41
+
42
+ /**
43
+ * The document is a permanent invoice; document and tax calculation results are saved in the tax history.
44
+ *
45
+ * @var DocumentType
46
+ */
47
+ public static $PurchaseInvoice = 'PurchaseInvoice';
48
+
49
+ /**
50
+ *Sales Return Order.
51
+ *
52
+ * @var DocumentType
53
+ */
54
+ public static $ReturnOrder = 'ReturnOrder';
55
+
56
+ /**
57
+ * The document is a permanent sales return invoice; document and tax calculation results are saved in the tax history GetTaxResult will return with a DocStatus of Saved.
58
+ *
59
+ * @var DocumentType
60
+ */
61
+ public static $ReturnInvoice = 'ReturnInvoice';
62
+
63
+ /**
64
+ * This will return all types of documents.
65
+ *
66
+ * @var DocumentType
67
+ */
68
+ public static $Any = 'Any';
69
+
70
+ public static function Values()
71
+ {
72
+ return array(
73
+ DocumentType::$SalesOrder,
74
+ DocumentType::$SalesInvoice,
75
+ DocumentType::$PurchaseOrder,
76
+ DocumentType::$PurchaseInvoice,
77
+ DocumentType::$ReturnOrder,
78
+ DocumentType::$ReturnInvoice,
79
+ DocumentType::$Any
80
+ );
81
+ }
82
+ // Unfortunate boiler plate due to polymorphism issues on static functions
83
+ public static function Validate($value) { self::__Validate($value,self::Values(),__CLASS__); }
84
+
85
+
86
+
87
+
88
+ }
89
+
90
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/DynamicSoapClient.class.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DynamicSoapClient.class.php
4
+ * @package Base
5
+ */
6
+
7
+ /**
8
+ * Private implementation class for all Avalara web service clients.
9
+ *
10
+ * Users should never need to create instances of this class. This class provides the underlying implementation
11
+ * for instances of {@link AvalaraSoapClient} and it's subclasses.
12
+ *
13
+ * @package Base
14
+ * @see AvalaraSoapClient
15
+ * @see AddressServiceSoap
16
+ * @see TaxServiceSoap
17
+ * @author tblanchard
18
+ *
19
+ * Copyright (c) 2007, Avalara. All rights reserved.
20
+ */
21
+
22
+ class DynamicSoapClient extends SoapClient
23
+ {
24
+ private $config;
25
+ public function __construct($wsdl,$options,&$config)
26
+ {
27
+ parent::__construct($wsdl,$options);
28
+ $this->config = $config;
29
+ }
30
+
31
+ public function __call($n,$args)
32
+ {
33
+ $profileHeader = new SoapHeader('http://avatax.avalara.com/services','Profile',new SoapVar($this->profileXML(),XSD_ANYXML));
34
+ $securityHeader = new SoapHeader('http://avatax.avalara.com/services','Security',new SoapVar($this->securityXML(),XSD_ANYXML));
35
+ $result = $this->__soapCall($n,$args,NULL,array($securityHeader,$profileHeader));
36
+ return $result;
37
+ }
38
+
39
+ private function securityXML()
40
+ {
41
+ return
42
+ '<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" SOAP-ENV:mustUnderstand="1">'.
43
+ '<wsse:UsernameToken>'.
44
+ '<wsse:Username>'.$this->config->account.'</wsse:Username>'.
45
+ '<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">'.$this->config->license.'</wsse:Password>'.
46
+ //<wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2005-11-22T06:33:26.203Z</wsu:Created>
47
+ '</wsse:UsernameToken>'.
48
+ '</wsse:Security>';
49
+ }
50
+
51
+ private function profileXML()
52
+ {
53
+ return
54
+ '<Profile xmlns="http://avatax.avalara.com/services" SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:mustUnderstand="0">'.
55
+ '<Name>'.$this->config->name.'</Name>'.
56
+ '<Client>'.$this->config->client.'</Client>'.
57
+ '<Adapter>'.$this->config->adapter.'</Adapter>'.
58
+ '</Profile>';
59
+ }
60
+
61
+ }
62
+
63
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/Enum.class.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Enum.class.php
4
+ * @package Base
5
+ */
6
+
7
+ /**
8
+ * Abstract class for enumerated types - provides validation.
9
+ *
10
+ * @package Base
11
+ * @author tblanchard
12
+ * Copyright (c) 2008, Avalara. All rights reserved.
13
+ */
14
+
15
+ class Enum
16
+ {
17
+ // Basic implementation - check and throw
18
+ protected static function __Validate($value,$values,$class=__CLASS__)
19
+ {
20
+ foreach($values as $valid)
21
+ {
22
+ if($value == $valid)
23
+ {
24
+ return true;
25
+ }
26
+ }
27
+
28
+ throw new Exception('Invalid '.$class.' "'.$value.'" - must be one of "'.implode('"|"',$values).'"');
29
+ }
30
+ }
31
+
32
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/GetTaxHistoryRequest.class.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * GetTaxHistoryRequest.class.php
4
+ *
5
+ * @package Tax
6
+ */
7
+
8
+
9
+ /**
10
+ * Data to pass to {@link TaxServiceSoap#getTaxHistory}.
11
+ * <p>
12
+ * The request must specify all of CompanyCode, DocCode, and DocType in order to uniquely identify the document.
13
+ * </p>
14
+ *
15
+ * @see GetTaxHistoryResult
16
+ * @package Tax
17
+ * @author tblanchard
18
+ * Copyright (c) 2008, Avalara. All rights reserved.
19
+ */
20
+
21
+ class GetTaxHistoryRequest extends TaxRequest
22
+ {
23
+ private $DetailLevel;
24
+
25
+ public function __construct()
26
+ {
27
+ parent::__construct();
28
+ $this->DetailLevel = DetailLevel::$Document; // this is right Document
29
+ $this->DocType = DocumentType::$SalesOrder; // this is right Document
30
+
31
+ }
32
+
33
+ /**
34
+ * Specifies the level of detail to return.
35
+ *
36
+ * @return detailLevel
37
+ * @var string
38
+ * @see DetailLevel
39
+ */
40
+
41
+ public function getDetailLevel() { return $this->DetailLevel; }
42
+
43
+ /**
44
+ * Specifies the level of detail to return.
45
+ *
46
+ * @see DetailLevel
47
+ * @return string
48
+ */
49
+
50
+ public function setDetailLevel($value) { DetailLevel::Validate($value); $this->DetailLevel = $value; return $this; } //Summary or Document or Line or Tax or Diagnostic - enum
51
+
52
+ }
53
+
54
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/GetTaxHistoryResult.class.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * GetTaxHistoryResult.class.php
4
+ * @package Tax
5
+ */
6
+
7
+ /**
8
+ * Result data returned from {@link TaxServiceSoap#getTaxHistory} for a previously calculated tax document.
9
+ *
10
+ * @package Tax
11
+ * @see GetTaxHistoryRequest
12
+ * @author tblanchard
13
+ * Copyright (c) 2007, Avalara. All rights reserved.
14
+ */
15
+
16
+ class GetTaxHistoryResult //extends BaseResult
17
+ {
18
+ private $GetTaxRequest;
19
+ private $GetTaxResult;
20
+
21
+ /**
22
+ * Gets the original {@link GetTaxRequest} for the document.
23
+ *
24
+ * @return GetTaxRequest
25
+ */
26
+
27
+ public function getGetTaxRequest() { return $this->GetTaxRequest; }
28
+
29
+ /**
30
+ * Gets the original {@link GetTaxResult} for the document.
31
+ *
32
+ * @return GetTaxResult
33
+ */
34
+
35
+ public function getGetTaxResult() { return $this->GetTaxResult; }
36
+
37
+
38
+ // BaseResult innards - work around a bug in SoapClient
39
+
40
+ /**
41
+ * @var string
42
+ */
43
+ private $TransactionId;
44
+ /**
45
+ * @var string must be one of the values defined in {@link SeverityLevel}.
46
+ */
47
+ private $ResultCode = 'Success';
48
+ /**
49
+ * @var array of Message.
50
+ */
51
+ private $Messages = array();
52
+
53
+ /**
54
+ * Accessor
55
+ * @return string
56
+ */
57
+ public function getTransactionId() { return $this->TransactionId; }
58
+ /**
59
+ * Accessor
60
+ * @return string
61
+ */
62
+ public function getResultCode() { return $this->ResultCode; }
63
+ /**
64
+ * Accessor
65
+ * @return array
66
+ */
67
+ public function getMessages() { return EnsureIsArray($this->Messages->Message); }
68
+
69
+
70
+ }
71
+
72
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/GetTaxRequest.class.php ADDED
@@ -0,0 +1,502 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * GetTaxRequest.class.php
4
+ * @package Tax
5
+ */
6
+
7
+ /**
8
+ * Data to pass to {@link TaxServiceSoap#getTax}.
9
+ *
10
+ * @see GetTaxResult
11
+ * @package Tax
12
+ * @author tblanchard
13
+ * Copyright (c) 2007, Avalara. All rights reserved.
14
+ */
15
+
16
+
17
+
18
+ class GetTaxRequest
19
+ {
20
+ private $CompanyCode; // string
21
+ private $DocCode;
22
+ private $DocType;
23
+ private $DocDate; //date
24
+ private $SalespersonCode; //string
25
+ private $CustomerCode; //string
26
+ private $CustomerUsageType; //string Entity Usage
27
+ private $Discount; //decimal
28
+ private $PurchaseOrderNo; //string
29
+ private $ExemptionNo; //string if not using ECMS which keys on customer code
30
+ private $OriginCode; //string
31
+ private $DestinationCode; //string
32
+ private $Addresses; //array
33
+ private $Lines; //array
34
+ private $DetailLevel; //Summary or Document or Line or Tax or Diagnostic
35
+ private $ReferenceCode; // string
36
+ private $LocationCode; //string
37
+ private $Commit=false; //boolean
38
+ private $BatchCode; //string
39
+ private $OriginAddress; //address
40
+ private $DestinationAddress; //address
41
+
42
+
43
+ //@author: Swetal
44
+ //Added new properties to upgrade to 5.3 interface
45
+ private $TaxOverride; //TaxOverride
46
+ private $CurrencyCode; //string
47
+ private $ServiceMode; //type: ServiceMode
48
+ private $PaymentDate; //date
49
+ private $ExchangeRate; //decimal
50
+ private $ExchangeRateEffDate; //date
51
+
52
+
53
+
54
+
55
+ public function __construct()
56
+ {
57
+
58
+ $this->DocDate = date("Y-m-d");
59
+ $this->Commit=false;
60
+ $this->HashCode=0;
61
+ $this->Discount=0.0;
62
+ $this->DocType=DocumentType::$SalesInvoice;
63
+ $this->DetailLevel=DetailLevel::$Document;
64
+ $this->DocCode = date("Y-m-d-H-i-s.u");
65
+ $this->CustomerCode='CustomerCodeString';
66
+ $this->Lines=array(new Line());
67
+
68
+ $this->ServiceMode=ServiceMode::$Automatic;
69
+ $this->ExchangeRate=1.0;
70
+
71
+ $dateTime=new DateTime();
72
+ $dateTime->setDate(1900,01,01);
73
+ $this->ExchangeRateEffDate=$dateTime->format("Y-m-d");
74
+ $this->PaymentDate=$dateTime->format("Y-m-d");
75
+
76
+
77
+ }
78
+
79
+ public function prepare()
80
+ {
81
+ $this->Addresses = array();
82
+ $this->OriginCode = $this->registerAddress($this->OriginAddress);
83
+ $this->DestinationCode = $this->registerAddress($this->DestinationAddress);
84
+ foreach($this->Lines as &$line)
85
+ {
86
+ $line->registerAddressesIn($this);
87
+ }
88
+ return $this;
89
+ }
90
+
91
+ public function registerAddress(&$address)
92
+ {
93
+ if($address == null) { return null; }
94
+ $index = sizeof($this->Addresses);
95
+ foreach($this->Addresses as $index=>$a)
96
+ {
97
+ if($address->equals($a))
98
+ {
99
+ return $index;
100
+ }
101
+ }
102
+ $index = sizeof($this->Addresses);
103
+ $this->Addresses[] = $address;
104
+ $address->setAddressCode ( $index);
105
+ return $index;
106
+ }
107
+
108
+ public function postFetch()
109
+ {
110
+ $addresses = $this->getAddresses();
111
+ $this->OriginAddress = $addresses[$this->OriginCode];
112
+ $this->DestinationAddress = $addresses[$this->DestinationCode];
113
+
114
+ //@author: Swetal
115
+ //Commenting following foreach loop
116
+ //Reason is postFetch function is called after getTaxHistory to populate origin and destination address
117
+ //but taxHistory does not return origin and destination code so with followign loop we can not retrive origin
118
+ //and destination adress for line. This gives invalid index error if not commented
119
+ /*foreach($this->getLines() as $line)
120
+ {
121
+ $line->postFetchWithAddresses($addresses);
122
+ }*/
123
+
124
+ return $this;
125
+ }
126
+
127
+
128
+ /**
129
+ * Enter description here...
130
+ *
131
+ * @param string $value
132
+ */
133
+ public function setAddressCode($value) { $this->AddressCode = $value; return $this; }
134
+
135
+ /**
136
+ * Enter description here...
137
+ *
138
+ * @param string $value
139
+ */
140
+ public function setLine1($value) { $this->Line1 = $value; return $this; }
141
+
142
+ /**
143
+ * Enter description here...
144
+ *
145
+ * @param string $value
146
+ */
147
+ public function setLine2($value) { $this->Line2 = $value; return $this; }
148
+
149
+ /**
150
+ * Enter description here...
151
+ *
152
+ * @param string $value
153
+ */
154
+ public function setLine3($value) { $this->Line3 = $value; return $this; }
155
+
156
+ /**
157
+ * Enter description here...
158
+ *
159
+ * @param string $value
160
+ */
161
+ public function setCity($value) { $this->City = $value; return $this; }
162
+
163
+ /**
164
+ * Enter description here...
165
+ *
166
+ * @param string $value
167
+ */
168
+ public function setRegion($value) { $this->Region = $value; return $this; }
169
+
170
+ /**
171
+ * Enter description here...
172
+ *
173
+ * @param string $value
174
+ */
175
+ public function setPostalCode($value) { $this->PostalCode = $value; return $this; }
176
+
177
+ /**
178
+ * Enter description here...
179
+ *
180
+ * @param string $value
181
+ */
182
+ public function setCountry($value) { $this->Country = $value; return $this; }
183
+
184
+ /**
185
+ * Mutator
186
+ * @access public
187
+ * @param integer
188
+ */
189
+
190
+
191
+ /**
192
+ * DocDate should be in the format yyyy-mm-dd
193
+ *
194
+ * @param date $value
195
+ */
196
+ public function setDocDate($value) { $this->DocDate = $value; return $this; } //date
197
+
198
+
199
+ /**
200
+ * Sets the client application company reference code.
201
+ *
202
+ * @param string $value
203
+ *
204
+ */
205
+ public function setCompanyCode($value) { $this->CompanyCode = $value; return $this; } //string
206
+
207
+ /**
208
+ * The document type specifies the category of the document and affects how the document is treated after a tax calculation; see DocumentType for more information about the specific document types.
209
+ *
210
+ * @param DocumentType $value
211
+ *
212
+ */
213
+ public function setDocType($value) { DocumentType::Validate($value); $this->DocType = $value; return $this; } //SalesOrder or SalesInvoice or PurchaseOrder or PurchaseInvoice or ReturnOrder or ReturnInvoice
214
+
215
+ /**
216
+ * Specifies the level of detail to return.
217
+ *
218
+ * @param DetailLevel $value
219
+
220
+ */
221
+ public function setDetailLevel($value) { DetailLevel::Validate($value); $this->DetailLevel = $value; return $this; } //Summary or Document or Line or Tax or Diagnostic - enum
222
+
223
+ /**
224
+ * Sets the Document Code, i.e. the internal reference code used by the client application.
225
+ *
226
+ * @param string $value
227
+
228
+ */
229
+ public function setDocCode($value) { $this->DocCode = $value; return $this; } //string invoice number
230
+
231
+ /**
232
+ * The client application salesperson reference code.
233
+ *
234
+ * @param string $value
235
+
236
+ */
237
+ public function setSalespersonCode($value) { $this->SalespersonCode = $value; return $this; } //string
238
+
239
+ /**
240
+ * The client application customer reference code.
241
+ *
242
+ * @param string $value
243
+
244
+ */
245
+ public function setCustomerCode($value) { $this->CustomerCode = $value; return $this; } //string
246
+
247
+ /**
248
+ * The client application customer or usage type.
249
+ * <p>
250
+ * This is used to determine the exempt status of the transaction based on the exemption tax rules for the
251
+ * jurisdictions involved. This may also be set at the line level.
252
+ * </p>
253
+ * <p>
254
+ * The standard values for the CustomerUsageType (A-L).<br/>
255
+ A � Federal Government<br/>
256
+ B � State/Local Govt.<br/>
257
+ C � Tribal Government<br/>
258
+ D � Foreign Diplomat<br/>
259
+ E � Charitable Organization<br/>
260
+ F � Religious/Education<br/>
261
+ G � Resale<br/>
262
+ H � Agricultural Production<br/>
263
+ I � Industrial Prod/Mfg.<br/>
264
+ J � Direct Pay Permit<br/>
265
+ K � Direct Mail<br/>
266
+ L - Other<br/>
267
+ * </p>
268
+ * @param customerUsageType
269
+ */
270
+ public function setCustomerUsageType($value) { $this->CustomerUsageType = $value; return $this; } //string Entity Usage
271
+
272
+ /**
273
+ *Purchase Order Number for this document.
274
+ *
275
+ * @param string $value
276
+
277
+ */
278
+ public function setPurchaseOrderNo($value) { $this->PurchaseOrderNo = $value; return $this; } //string
279
+
280
+ /**
281
+ * Exemption Number for this document
282
+ *
283
+ * @param string $value
284
+
285
+ */
286
+ public function setExemptionNo($value) { $this->ExemptionNo = $value; return $this; } //string if not using ECMS which keys on customer code
287
+
288
+
289
+
290
+ /**
291
+ * Also referred to as a Store Location, Outlet Id, or Outlet code is a number assigned by the State which identifies a Store location. Some state returns require taxes are broken out separatly for Store Locations.
292
+ *
293
+ * @param string $value
294
+
295
+ */
296
+ public function setLocationCode($value) { $this->LocationCode = $value; return $this; } //string
297
+
298
+
299
+ public function setBatchCode($value) { $this->BatchCode = $value; return $this; } //string
300
+
301
+ /**
302
+ * The discount amount to apply to the document.
303
+ *
304
+ * @param decimal $value
305
+
306
+ */
307
+ public function setDiscount($value) { $this->Discount = $value; return $this; } //decimal
308
+ //public function setTotalTaxOverride($value) { $this->TotalTaxOverride = $value; return $this; } //decimal
309
+
310
+ /**
311
+ * Set addresses
312
+ *
313
+ * @param array $value
314
+
315
+ */
316
+ public function setAddresses($value) { $this->Addresses = $value; return $this; } //array
317
+
318
+ /**
319
+ * Set tax lines
320
+ *
321
+ * @param array $value
322
+
323
+ */
324
+ public function setLines($value) { $this->Lines = $value; return $this; } //array
325
+
326
+ public function setHashCode($value) { $this->HashCode = $value; return $this; } //int
327
+
328
+ /**
329
+ * This has been defaulted to False ; invoice will be committed if this flag has been set to True.
330
+ *
331
+ * @param boolean $value
332
+ *
333
+ */
334
+ public function setCommit($value) { $this->Commit = $value; return $this; } //boolean
335
+ //public function setIsTotalTaxOverriden($value) { $this->IsTotalTaxOverriden = ($value ? true : false); return $this; } //boolean
336
+
337
+ /**
338
+ * Set ship from address
339
+ *
340
+ * @param Address $value
341
+
342
+ */
343
+ public function setOriginAddress($value) { $this->OriginAddress = $value; return $this; } //address
344
+
345
+ /**
346
+ * set ship to address
347
+ *
348
+ * @param Address $value
349
+
350
+ */
351
+ public function setDestinationAddress($value) { $this->DestinationAddress = $value; return $this; } //address
352
+
353
+ //@author:swetal
354
+
355
+ /**
356
+ * ExchangeRate indicates the currency exchange rate from the transaction currency (indicated by CurrencyCode) to the company base currency.
357
+ * This only needs to be set if the transaction currency is different than the company base currency. It defaults to 1.0.
358
+ *
359
+ * @param decimal $value
360
+
361
+ */
362
+ public function setExchangeRate($value) { $this->ExchangeRate = $value; return $this; } //decimal
363
+
364
+ /**
365
+ * 3 character ISO 4217 currency code.
366
+ *
367
+ * @param string $value
368
+
369
+ */
370
+ public function setCurrencyCode($value) { $this->CurrencyCode = $value; return $this; } //string
371
+
372
+ /**
373
+ * It provides the ability to controls whether tax is calculated locally or remotely when using an AvaLocal server.
374
+ * The default is Automatic which calculates locally unless remote is necessary for non-local addresses.
375
+ *
376
+ * @param ServiceMode $value
377
+ */
378
+ public function setServiceMode($value) { $this->ServiceMode = $value; return $this; } //type: ServiceMode
379
+
380
+ /**
381
+ * PaymentDate indicates the date when payment was received for the document. It is only applicable for cash-basis accounting and does not need to be set otherwise.
382
+ * It defaults to 1/1/1900 which indicates no payment. The new TaxSvc.ApplyPayment method may be used to apply a payment to an existing invoice.
383
+ *
384
+ * @param date $value
385
+
386
+ */
387
+ public function setPaymentDate($value) { $this->PaymentDate = $value; return $this; } //date
388
+
389
+ /**
390
+ * ExchangeRateEffDate indicates the effective date of the exchange rate.
391
+ * It should be set in conjunction with ExchangeRate. It will default to the DocDate if not set.
392
+ *
393
+ * @param date $value
394
+
395
+ */
396
+ public function setExchangeRateEffDate($value){ $this->ExchangeRateEffDate = $value; return $this; } //date
397
+
398
+ /**
399
+ *TaxOverride for the document.
400
+ *
401
+ * @param TaxOverride $value
402
+
403
+ */
404
+ public function setTaxOverride($value){ $this->TaxOverride=$value;} //tax override
405
+
406
+ public function setReferenceCode($value)
407
+ {
408
+ $this->ReferenceCode=$value;
409
+ }
410
+
411
+ /**#@+
412
+ * Accessor
413
+ * @access public
414
+ * @return string
415
+ */
416
+
417
+ public function getCompanyCode() { return $this->CompanyCode;} //string
418
+ public function getDocType() { return $this->DocType;} //SalesOrder or SalesInvoice or PurchaseOrder or PurchaseInvoice or ReturnOrder or ReturnInvoice
419
+ public function getDocCode() { return $this->DocCode;} //string invoice number
420
+ public function getDocDate() { return $this->DocDate;} //date
421
+ public function salespersonCode() { return $this->SalespersonCode;} //string
422
+ public function getCustomerCode() { return $this->CustomerCode;} //string
423
+ public function getCustomerUsageType() { return $this->CustomerUsageType;} //string Entity Usage
424
+
425
+ public function getDiscount() { return $this->Discount;} //decimal
426
+ //public function getTotalTaxOverride() { return $this->TotalTaxOverride;} //decimal
427
+
428
+ public function getPurchaseOrderNo() { return $this->PurchaseOrderNo;} //string
429
+ public function getExemptionNo() { return $this->ExemptionNo;} //string if not using ECMS which keys on customer code
430
+ public function getAddresses()
431
+ {
432
+ // this is kind of icky
433
+ // when we build one of these to send, it is an array of Address
434
+ // however, when it is fetched, there is an extra std::Object stuck in place to represent the array
435
+ // which contains the array in an ivar called Address. Such are the vagaries of
436
+ // the php SoapClient.
437
+
438
+ //@swetal
439
+ //Changed from $this->Addresses to $this->Addresses->BaseAddress
440
+ return is_array($this->Addresses) ? $this->Addresses : EnsureIsArray($this->Addresses->BaseAddress);
441
+
442
+
443
+
444
+
445
+
446
+
447
+ } //array
448
+ public function getLines()
449
+ {
450
+ return is_array($this->Lines) ? $this->Lines : EnsureIsArray($this->Lines->Line);
451
+ } //array
452
+ public function getDetailLevel() { return $this->DetailLevel;} //Summary or Document or Line or Tax or Diagnostic ********************************** make class
453
+
454
+ public function getHashCode() { return $this->HashCode;} //int
455
+ public function getLocationCode() { return $this->LocationCode;} //string
456
+ public function getBatchCode() { return $this->BatchCode;} //string
457
+
458
+ public function getCommit() { return $this->Commit;} //boolean
459
+ //public function getIsTotalTaxOverriden() { return $this->IsTotalTaxOverriden;} //boolean
460
+
461
+
462
+ public function getOriginAddress() { return $this->OriginAddress;} //address
463
+ public function getDestinationAddress() { return $this->DestinationAddress;} //address
464
+
465
+ //@author:swetal
466
+ public function getExchangeRate() { return $this->ExchangeRate; } //decimal
467
+ public function getCurrencyCode() { return $this->CurrencyCode; } //string
468
+ public function getServiceMode() { return $this->ServiceMode; } //type: ServiceMode
469
+ public function getPaymentDate() { return $this->PaymentDate; } //date
470
+ public function getExchangeRateEffDate(){ return $this->ExchangeRateEffDate; } //date
471
+ public function getTaxOverride(){ return $this->TaxOverride;}
472
+
473
+ public function getReferenceCode()
474
+ {
475
+ return $this->ReferenceCode;
476
+ }
477
+
478
+ //@author:swetal
479
+ //Adding getLine function which returns line based on line number
480
+ public function getLine($lineNo)
481
+ {
482
+ if($this->Lines != null)
483
+ {
484
+ foreach($this->getLines() as $line)
485
+ {
486
+ if($lineNo == $line->getNo())
487
+ {
488
+ return $line;
489
+ }
490
+
491
+ }
492
+ }
493
+ }
494
+
495
+
496
+ /**#@-*/
497
+
498
+
499
+
500
+ }
501
+
502
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/GetTaxResult.class.php ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * GetTaxResult.class.php
4
+ * @package Tax
5
+ */
6
+
7
+
8
+ /**
9
+ * Result data returned from {@link TaxServiceSoap#getTax}.
10
+ *
11
+ * @see GetTaxRequest
12
+ * @package Tax
13
+ * @author tblanchard
14
+ * Copyright (c) 2007, Avalara. All rights reserved.
15
+ */
16
+
17
+ class GetTaxResult // extends BaseResult
18
+ {
19
+
20
+ private $DocCode; //string
21
+ private $AdjustmentDescription; //string
22
+ private $DocDate; //date
23
+ private $TaxDate; //date
24
+ private $DocType; //DocumentType
25
+ private $DocStatus; //DocStatus
26
+ private $Reconciled; //boolean
27
+ private $Locked; //boolean
28
+ private $Timestamp; //dateTime
29
+ private $TotalAmount; //decimal
30
+ private $TotalDiscount; //decimal
31
+ private $TotalExemption; //decimal
32
+ private $TotalTaxable; //decimal
33
+ private $TotalTax; //decimal
34
+ private $AdjustmentReason; //int
35
+ private $Version; //int
36
+ private $TaxLines; //ArrayOfTaxLine
37
+
38
+ //@author:swetal
39
+ //Added new properties to upgrade to 5.3 interface
40
+ private $TotalTaxCalculated; //decimal
41
+ private $TaxSummary; //ArrayOfTaxDetail
42
+
43
+
44
+
45
+ /**
46
+ * Gets the internal reference code used by the client application. This is used for operations such as Post and GetTaxHistory.
47
+ * <p>
48
+ * See {@link GetTaxRequest#getDocCode} on <b>GetTaxRequest</b> for more information about this member.
49
+ * </p>
50
+ *
51
+ * @return string
52
+ */
53
+ public function getDocCode() {return $this->DocCode; }
54
+
55
+ /**
56
+ * AdjustmentDescription set while making AdjustTax call.
57
+ *
58
+ * @return string
59
+ */
60
+ public function getAdjustmentDescription() { return $this->AdjustmentDescription; }
61
+
62
+ /**
63
+ * AdjustmentReason set while making AdjustTax call. It is a high level classification of why an Original Document is being modified.
64
+ *
65
+ * @return int
66
+ */
67
+ public function getAdjustmentReason(){ return $this->AdjustmentReason; }
68
+
69
+ /**
70
+ * Gets the date on the invoice, purchase order, etc.
71
+ * <p>
72
+ * See {@link GetTaxRequest#getDocDate} on <b>GetTaxRequest</b> for more information about this member.
73
+ * </p>
74
+ *
75
+ * @return date
76
+ */
77
+ public function getDocDate() {return $this->DocDate; }
78
+
79
+ /**
80
+ * Tax Date is the date used to calculate tax on the Document.
81
+ * <p>
82
+ * See {@link GetTaxRequest#taxDate} on <b>GetTaxRequest</b> for more information about this member.
83
+ * </p>
84
+ *
85
+ * @return date
86
+ */
87
+ public function getTaxDate() {return $this->TaxDate; }
88
+
89
+ /**
90
+ * Gets the Document Type.
91
+ * <p>
92
+ * See {@link GetTaxRequest#DocType} on <b>GetTaxRequest</b> for more information about this member.
93
+ * </p>
94
+ *
95
+ * @return DocumentType
96
+ */
97
+ public function getDocType() {return $this->DocType; }
98
+
99
+ /**
100
+ * Gets the document's status after the tax calculation.
101
+ *
102
+ * @return DocStatus
103
+ */
104
+ public function getDocStatus() {return $this->DocStatus; }
105
+
106
+ /**
107
+ * True if the document has been reconciled; Only committed documents can be reconciled.
108
+ * <p>
109
+ * For information on committing documents, see the <b>TaxSvc</b>'s
110
+ * {@link TaxSvcSoap#commitTax} method. For information
111
+ * on reconciling documents, see the {@link TaxSvcSoap#reconcileTaxHistory} method.
112
+ * </p>
113
+ *
114
+ * @return boolean
115
+ */
116
+ public function getIsReconciled() {return $this->Reconciled; }
117
+
118
+ /**
119
+ * Flag indicating if a Document has been locked by Avalara's MRS process. Locked documents can not be modified and can not be cancelled because they have been reported on Tax Return.
120
+ *
121
+ * @return boolean
122
+ */
123
+ public function getLocked() {return $this->Locked; }
124
+
125
+ /**
126
+ * Date of the last status change on the document (i.e. Save date, Post date, Commit date, Cancel date).
127
+ *
128
+ * @return dateTime
129
+ */
130
+ public function getTimestamp() {return $this->Timestamp; }
131
+
132
+ /**
133
+ * The sum of all line {@link Line#getAmount} values.
134
+ *
135
+ * @param decimal
136
+ */
137
+ public function getTotalAmount() {return $this->TotalAmount; }
138
+
139
+ /**
140
+ * Gets the sum of all <b>TaxLine</b> {@link TaxLine#getDiscount} amounts; Typically it
141
+ * will equal the requested Discount, but, but it is possible that no lines were marked as discounted.
142
+ *
143
+ * @return decimal
144
+ */
145
+ public function getTotalDiscount() {return $this->TotalDiscount; }
146
+
147
+ /**
148
+ * Gets the sum of all <b>TaxLine</b> {@link TaxLine#getExemption} amounts.
149
+ *
150
+ * @return decimal
151
+ * @deprecated See {@link TaxDetail#getExemption}.
152
+ */
153
+ public function getTotalExemption() {return $this->TotalExemption; }
154
+
155
+ /**
156
+ * Gets the amount the tax is based on; This is the total of all {@link Line} <b>Base</b> amounts;
157
+ * Typically it will be equal to the document
158
+ * {@link GetTaxResult#getTotalAmount} - {@link GetTaxRequest#getDiscount} - {@link #getTotalExemption}.
159
+ *
160
+ * @return decimal
161
+ * @deprecated See {@link TaxDetail#getTaxable}.
162
+ */
163
+ public function getTotalTaxable() {return $this->TotalTaxable; }
164
+
165
+ /**
166
+ * Gets the total tax for the document.
167
+ *
168
+ * @return decimal
169
+ */
170
+ public function getTotalTax() {return $this->TotalTax; }
171
+
172
+ /**
173
+ * HashCode to support Reconciliation.
174
+ *
175
+ * @return hashCode
176
+ */
177
+ public function getHashCode() {return $this->HashCode; }
178
+
179
+ /**
180
+ * Current version of the document.
181
+ *
182
+ * @return int
183
+ */
184
+ public function getVersion() {return $this->Version; }
185
+
186
+ /**
187
+ * Gets the Tax broken down by individual {@link TaxLine}.
188
+ *
189
+ * @return taxLines
190
+ */
191
+ public function getTaxLines() {return EnsureIsArray($this->TaxLines->TaxLine); }
192
+
193
+ /**
194
+ * TotalTaxCalculated indicates the total tax calculated by AvaTax. This is usually the same as the TotalTax, except when a tax override amount is specified.
195
+ * This is for informational purposes.The TotalTax will still be used for reporting
196
+ *
197
+ * @return unknown
198
+ */
199
+ public function getTotalTaxCalculated(){ return $this->TotalTaxCalculated;}
200
+
201
+ /**
202
+ * TaxSummary is now returned when GetTaxRequest.DetailLevel == DetailLevel.Line in addition to DetailLevel.Summary.
203
+ * It is not returned for DetailLevel.Document or DetailLevel.TaxDetail.
204
+ *
205
+ * @return ArrayOfTaxDetail
206
+ */
207
+ public function getTaxSummary() {return EnsureIsArray($this->TaxSummary->TaxDetail);}
208
+
209
+ public function getTaxLine($lineNo)
210
+ {
211
+ if($this->getTaxLines() != null)
212
+ {
213
+ foreach($this->getTaxLines() as $taxLine)
214
+ {
215
+ if($lineNo == $taxLine->getNo())
216
+ {
217
+ return $taxLine;
218
+ }
219
+
220
+ }
221
+ }
222
+ }
223
+
224
+
225
+
226
+ /////////////////////////////////////////////PHP bug requires this copy from BaseResult ///////////
227
+ /**
228
+ * @var string
229
+ */
230
+ private $TransactionId;
231
+ /**
232
+ * @var string must be one of the values defined in {@link SeverityLevel}.
233
+ */
234
+ private $ResultCode = 'Success';
235
+ /**
236
+ * @var array of Message.
237
+ */
238
+ private $Messages = array();
239
+
240
+ /**
241
+ * Accessor
242
+ * @return string
243
+ */
244
+ public function getTransactionId() { return $this->TransactionId; }
245
+ /**
246
+ * Accessor
247
+ * @return string
248
+ */
249
+ public function getResultCode() { return $this->ResultCode; }
250
+ /**
251
+ * Accessor
252
+ * @return array
253
+ */
254
+ public function getMessages() { return EnsureIsArray($this->Messages->Message); }
255
+
256
+
257
+
258
+
259
+
260
+
261
+ }
262
+
263
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/IsAuthorizedResult.class.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * IsAuthorizedResult.class.php
4
+ * @package Address
5
+ */
6
+
7
+ /**
8
+ * Result information returned from the AddressSvc's
9
+ * {@link AddressServiceSoap#isAuthorized} method and the TaxSvc's
10
+ * {@link TaxServiceSoap#isAuthorized}
11
+ * method.
12
+ * <p><b>Example:</b><br>
13
+ * <pre>
14
+ * $port = new AddressServiceSoap();
15
+ *
16
+ * $result = port->ping("");
17
+ * $numMessages = sizeof($result->Messages);
18
+ * print('Ping Result # of messages is '.$numMessages);
19
+ * </pre>
20
+ *
21
+ * @package Address
22
+ * @author tblanchard
23
+ * Copyright (c) 2007, Avalara. All rights reserved.
24
+ */
25
+
26
+ class IsAuthorizedResult //extends BaseResult
27
+ {
28
+ private $Operations;
29
+ private $Expires;
30
+
31
+ /**
32
+ * Authorized operations for the user.
33
+ *
34
+ * @return string
35
+ */
36
+ public function getOperations() { return $this->Operations; }
37
+
38
+ /**
39
+ * Indicates the subscription expiration date in yyyy-mm-dd format
40
+ *
41
+ * @return date
42
+ */
43
+ public function getExpires() { return $this->Expires; }
44
+
45
+ public function setOperations($value) { $this->Operations = $value; return $this; }
46
+ public function setExpires($value) { $this->Expires = $value; return $this; }
47
+
48
+ //BaseResult innards - workaround for SoapClient bug
49
+ /**
50
+ * @var string
51
+ */
52
+ private $TransactionId;
53
+ /**
54
+ * @var string must be one of the values defined in {@link SeverityLevel}.
55
+ */
56
+ private $ResultCode = 'Success';
57
+ /**
58
+ * @var array of Message.
59
+ */
60
+ private $Messages = array();
61
+
62
+ /**
63
+ * Accessor
64
+ * @return string
65
+ */
66
+ public function getTransactionId() { return $this->TransactionId; }
67
+ /**
68
+ * Accessor
69
+ * @return string
70
+ */
71
+ public function getResultCode() { return $this->ResultCode; }
72
+ /**
73
+ * Accessor
74
+ * @return array
75
+ */
76
+ public function getMessages() { return EnsureIsArray($this->Messages->Message); }
77
+
78
+
79
+ }
80
+
81
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/JurisdictionType.class.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * JurisdictionType.class.php
5
+ * @package Tax
6
+ */
7
+
8
+ /**
9
+ * A Jurisdiction Type describes the jurisdiction for which a particular tax is applied to a document.
10
+ * Jurisdiction is determined by the GetTaxRequest#getDestinationAddress or GetTaxRequest#getOriginAddress of a GetTaxRequest.
11
+ * Multiple jurisdictions might be applied to a single Line during a tax calcuation.
12
+ * Details are available in the TaxDetail of the GetTaxResult.
13
+ *
14
+ * @package Tax
15
+ * @see TaxDetail
16
+ * @author tblanchard
17
+ * Copyright (c) 2008, Avalara. All rights reserved.
18
+ */
19
+ class JurisdictionType
20
+ {
21
+ /**
22
+ * Unspecified Jurisdiction
23
+ *
24
+ * @var JurisdictionType
25
+ */
26
+ public static $Composite = 'Composite';
27
+
28
+ /**
29
+ * State
30
+ *
31
+ * @var JurisdictionType
32
+ */
33
+ public static $State = 'State';
34
+
35
+ /**
36
+ * County
37
+ *
38
+ * @var JurisdictionType
39
+ */
40
+ public static $County = 'County';
41
+
42
+ /**
43
+ * City
44
+ *
45
+ * @var JurisdictionType
46
+ */
47
+ public static $City = 'City';
48
+
49
+ /**
50
+ * Special Tax Jurisdiction
51
+ *
52
+ * @var JurisdictionType
53
+ */
54
+ public static $Special = 'Special';
55
+ /*
56
+
57
+ public static function Values()
58
+ {
59
+ return array(
60
+ JurisdictionType::$Composite,
61
+ JurisdictionType::$State,
62
+ JurisdictionType::$County,
63
+ JurisdictionType::$City,
64
+ JurisdictionType::$Special
65
+ );
66
+ }
67
+
68
+ // Unfortunate boiler plate due to polymorphism issues on static functions
69
+ public static function Validate($value) { self::__Validate($value,self::Values(),__CLASS__); }
70
+
71
+ */
72
+
73
+ }
74
+
75
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/Line.class.php ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Line.class.php
4
+ * @package Tax
5
+ */
6
+
7
+ /**
8
+ * A single line within a document containing data used for calculating tax.
9
+
10
+ *
11
+ * @see GetTaxRequest
12
+ * @package Tax
13
+ * @author tblanchard
14
+ * Copyright (c) 2007, Avalara. All rights reserved.
15
+ */
16
+
17
+ class Line
18
+ {
19
+ private $No; //string // line Number of invoice
20
+ private $OriginCode; //string Line#getOriginAddress.
21
+ private $DestinationCode; //string Line#getDestinationAddress.
22
+ private $ItemCode; //string
23
+ private $Description; //string
24
+ private $TaxCode; //string
25
+ private $Qty; //decimal
26
+ private $Amount; //decimal // TotalAmmount
27
+ private $Discounted; //boolean is discount applied to this item
28
+ private $RevAcct; //string
29
+ private $Ref1; //string
30
+ private $Ref2; //string
31
+ private $ExemptionNo; //string //zero tax will result if filled in
32
+ private $CustomerUsageType; //string
33
+ private $BatchCode; //string
34
+
35
+ private $TaxOverride; //TaxOverride
36
+ private $OriginAddress; //Address
37
+ private $DestinationAddress; //Address
38
+ private $TaxIncluded; //boolean
39
+
40
+
41
+
42
+ public function __construct($no=1,$qty=1,$amount=100.00)
43
+ {
44
+ $this->No=$no;
45
+ $this->Qty=$qty;
46
+ $this->Amount=$amount;
47
+
48
+
49
+ $this->Discounted=false;
50
+
51
+
52
+ }
53
+
54
+
55
+ /*
56
+ * Mutator
57
+ * @access public
58
+ * @param integer
59
+ */
60
+
61
+ /**
62
+ * Line Number.
63
+ *
64
+ * @param string $value
65
+ */
66
+ public function setNo($value) { $this->No = $value; return $this; } //string // line Number of invoice
67
+
68
+ /**
69
+ * Item Code (SKU)
70
+ *
71
+ * @param string $value
72
+ */
73
+ public function setItemCode($value) { $this->ItemCode = $value; return $this; } //string
74
+
75
+ /**
76
+ * Sets the description which defines the description for the product or item.
77
+ *
78
+ * @param string $value
79
+ */
80
+ public function setDescription($value) { $this->Description = $value; return $this; } //string
81
+
82
+ /**
83
+ * System or Custom Tax Code.
84
+ *
85
+ * @param string $value
86
+ */
87
+ public function setTaxCode($value) { $this->TaxCode = $value; return $this; } //string
88
+
89
+ /**
90
+ * Revenue Account.
91
+ *
92
+ * @param string $value
93
+ */
94
+ public function setRevAcct($value) { $this->RevAcct = $value; return $this; } //string
95
+
96
+ /**
97
+ * Client specific reference field.
98
+ *
99
+ * @param string $value
100
+ */
101
+ public function setRef1($value) { $this->Ref1 = $value; return $this; } //string
102
+
103
+ /**
104
+ * Client specific reference field.
105
+ *
106
+ * @param string $value
107
+ */
108
+ public function setRef2($value) { $this->Ref2 = $value; return $this; } //string
109
+
110
+ /**
111
+ * Exemption number for this line
112
+ *
113
+ * @param string $value
114
+ */
115
+ public function setExemptionNo($value) { $this->ExemptionNo = $value; return $this; } //string //zero tax will result if filled in
116
+
117
+ /**
118
+ * The client application customer or usage type.
119
+ * <p>
120
+ * This is used to determine the exempt status of the transaction based on the exemption tax rules for the
121
+ * jurisdictions involved. This may also be set at the line level.
122
+ * </p>
123
+ * <p>
124
+ * The standard values for the CustomerUsageType (A-L).<br/>
125
+ A � Federal Government<br/>
126
+ B � State/Local Govt.<br/>
127
+ C � Tribal Government<br/>
128
+ D � Foreign Diplomat<br/>
129
+ E � Charitable Organization<br/>
130
+ F � Religious/Education<br/>
131
+ G � Resale<br/>
132
+ H � Agricultural Production<br/>
133
+ I � Industrial Prod/Mfg.<br/>
134
+ J � Direct Pay Permit<br/>
135
+ K � Direct Mail<br/>
136
+ L - Other<br/>
137
+ * </p>
138
+ * @param string $value
139
+ */
140
+ public function setCustomerUsageType($value) { $this->CustomerUsageType = $value; return $this; } //string
141
+
142
+ /**
143
+ * Enter description here...
144
+ *
145
+ * @param string $value
146
+ */
147
+ public function setBatchCode($value) { $this->BatchCode = $value; return $this; } //string
148
+
149
+ /**
150
+ * The quantity represented by this line.
151
+ *
152
+ * @param string $value
153
+ */
154
+ public function setQty($value) { $this->Qty = $value; return $this; } //decimal
155
+
156
+ /**
157
+ * The total amount for this line item (Qty * UnitPrice).
158
+ *
159
+ * @param string $value
160
+ */
161
+ public function setAmount($value) { $this->Amount = $value; return $this; } //decimal // TotalAmmount
162
+
163
+ /**
164
+ * TaxOverride for the document at line level.
165
+ *
166
+ * @param string $value
167
+ */
168
+ public function setTaxOverride($value) { $this->TaxOverride = $value; return $this; } //decimal
169
+
170
+ /**
171
+ * True if the document discount should be applied to this line
172
+ *
173
+ * @param string $value
174
+ */
175
+ public function setDiscounted( $value) { $this->Discounted = ($value ? true : false); return $this; } //boolean is discount applied to this item
176
+
177
+ /**
178
+ * Sets the Address used as the "Ship From" location for a specific line item.
179
+ *
180
+ * @param string $value
181
+ */
182
+ public function setOriginAddress(&$value) { $this->OriginAddress = $value; return $this; } //Address
183
+
184
+ /**
185
+ * Sets the Address used as the "Ship To" location for a specific line item.
186
+ *
187
+ * @param string $value
188
+ */
189
+ public function setDestinationAddress(&$value) { $this->DestinationAddress = $value; return $this; } //Address
190
+
191
+ /**
192
+ * True if tax is included in the line.
193
+ * @param boolean
194
+ */
195
+ public function setTaxIncluded($value)
196
+ {
197
+ $this->TaxIncluded=$value;
198
+ }
199
+
200
+ /**
201
+ * True if tax is included in the line.
202
+ * @return boolean
203
+ */
204
+ public function getTaxIncluded($value)
205
+ {
206
+ return $this->TaxIncluded;
207
+ }
208
+
209
+ public function registerAddressesIn(&$getTaxRequest)
210
+ {
211
+ if(is_null($this->OriginAddress))
212
+ {
213
+ $this->OriginAddress = $getTaxRequest->getOriginAddress();
214
+
215
+ }
216
+ if(is_null($this->DestinationAddress))
217
+ {
218
+ $this->DestinationAddress = $getTaxRequest->getDestinationAddress();
219
+
220
+ }
221
+ $this->OriginCode = $getTaxRequest->registerAddress($this->OriginAddress);
222
+ $this->DestinationCode = $getTaxRequest->registerAddress($this->DestinationAddress);
223
+ }
224
+
225
+ public function postFetchWithAddresses($addresses)
226
+ {
227
+ $this->OriginAddress = $addresses[$this->OriginCode];
228
+ $this->DestinationAddress = $addresses[$this->DestinationCode];
229
+ }
230
+
231
+ //accessors
232
+ /**#@+
233
+ * Accessor
234
+ * @access public
235
+ * @return string
236
+ */
237
+
238
+
239
+ public function getNo () { return $this->No; } //string // line Number of invoice
240
+ public function getItemCode() { return $this->ItemCode; } //string
241
+ public function getDescription() { return $this->Description; } //string
242
+ public function getTaxCode() { return $this->TaxCode; } //string
243
+ public function getRevAcct() { return $this->RevAcct; } //string
244
+ public function getRef1() { return $this->Ref1; } //string
245
+ public function getRef2() { return $this->Ref2; } //string
246
+ public function getExemptionNo() { return $this->ExemptionNo; } //string //zero tax will result if filled in
247
+ public function getCustomerUsageType() { return $this->CustomerUsageType; } //string
248
+ public function getBatchCode() { return $this->BatchCode; } //string
249
+
250
+ public function getQty() { return $this->Qty; } //decimal
251
+ public function getAmount() { return $this->Amount; } //decimal // TotalAmmount
252
+ public function getTaxOverride() { return $this->TaxOverride; } //decimal
253
+
254
+ public function getDiscounted() { return $this->Discounted; } //boolean is discount applied to this item
255
+
256
+
257
+ public function getOriginAddress() { return $this->OriginAddress; } //Address
258
+ public function getDestinationAddress() { return $this->DestinationAddress; } //Address
259
+
260
+
261
+
262
+ /**#@-*/
263
+
264
+ }
265
+
266
+
267
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/Message.class.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Message.class.php
4
+ *
5
+ * @package Address
6
+ */
7
+
8
+ /**
9
+ * Message class used in results and exceptions.
10
+ *
11
+ * Contains status detail about call results.
12
+ *
13
+ * @package Address
14
+ * @author tblanchard
15
+ * Copyright (c) 2007, Avalara. All rights reserved.
16
+ */
17
+
18
+ class Message
19
+ {
20
+ private $Summary;
21
+ private $Details;
22
+ private $HelpLink;
23
+ private $RefersTo;
24
+ private $Severity;
25
+ private $Source;
26
+ private $Name;
27
+
28
+ /**
29
+ * Gets the concise summary of the message.
30
+ *
31
+ * @return string
32
+ */
33
+ public function getSummary() { return $this->Summary; }
34
+
35
+ /**
36
+ * Gets the details of the message.
37
+ *
38
+ * @return string
39
+ */
40
+ public function getDetails() { return $this->Details; }
41
+
42
+ /**
43
+ *Gets the URL to help page for this message.
44
+ *
45
+ * @return unknown
46
+ */
47
+ public function getHelpLink() { return $this->HelpLink; }
48
+
49
+ /**
50
+ * Gets the item the message refers to, if applicable. Used to indicate a missing or incorrect value.
51
+ *
52
+ * @return unknown
53
+ */
54
+ public function getRefersTo() { return $this->RefersTo; }
55
+
56
+ /**
57
+ * Gets the Severity Level of the message.
58
+ *
59
+ * @return unknown
60
+ */
61
+ public function getSeverity() { return $this->Severity; }
62
+
63
+ /**
64
+ * Gets the source of the message.
65
+ *
66
+ * @return unknown
67
+ */
68
+ public function getSource() { return $this->Source; }
69
+
70
+ /**
71
+ * Gets the name of the message.
72
+ *
73
+ * @return unknown
74
+ */
75
+ public function getName() { return $this->Name; }
76
+
77
+ // mutators
78
+ public function setSummary($value) { $this->Summary = $value; return $this; }
79
+ public function setDetails($value) { $this->Details = $value; return $this; }
80
+ public function setHelpLink($value) { $this->HelpLink = $value; return $this; }
81
+ public function setRefersTo($value) { $this->RefersTo = $value; return $this; }
82
+ public function setSeverity($value) { SeverityLevel::Validate($value); $this->Severity = $value; return $this; }
83
+ public function setSource($value) { $this->Source = $value; return $this; }
84
+ public function setName($value) { $this->Name = $value; return $this; }
85
+
86
+ }
87
+
88
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/PingResult.class.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PingResult.class.php
4
+ *
5
+ * @package Base
6
+ */
7
+
8
+ /**
9
+ * Result information returned from the {@link AddressServiceSoap}'s
10
+ * {@link AddressServiceSoap#ping} method and the {@link TaxServiceSoap}'s
11
+ * {@link TaxServiceSoap#ping} method.
12
+ * <b>Example:</b><br>
13
+ * <pre>
14
+ * $svc = new AddressServiceSoap();
15
+ *
16
+ * $result = svc->ping();
17
+ * $numMessages = sizeof($result->getMessages());
18
+ *
19
+ * </pre>
20
+ *
21
+ * @package Base
22
+ * @author tblanchard
23
+ * Copyright (c) 2007, Avalara. All rights reserved.
24
+ */
25
+
26
+
27
+ class PingResult //extends BaseResult
28
+ {
29
+ /**
30
+ * Version string of the pinged service.
31
+ * @var string
32
+ */
33
+ private $Version;
34
+
35
+ /**
36
+ * Method returning version string of the pinged service.
37
+ * @return string
38
+ */
39
+ public function getVersion() { return $this->Version; }
40
+
41
+ // BaseResult innards - workaround a bug in SoapClient
42
+
43
+ /**
44
+ * @var string
45
+ */
46
+ private $TransactionId;
47
+ /**
48
+ * @var string must be one of the values defined in {@link SeverityLevel}.
49
+ */
50
+ private $ResultCode = 'Success';
51
+ /**
52
+ * @var array of Message.
53
+ */
54
+ private $Messages = array();
55
+
56
+ /**
57
+ * Accessor
58
+ * @return string
59
+ */
60
+ public function getTransactionId() { return $this->TransactionId; }
61
+ /**
62
+ * Accessor
63
+ * @return string
64
+ */
65
+ public function getResultCode() { return $this->ResultCode; }
66
+ /**
67
+ * Accessor
68
+ * @return array
69
+ */
70
+ public function getMessages() { return EnsureIsArray($this->Messages->Message); }
71
+
72
+
73
+
74
+ }
75
+
76
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/PostTaxRequest.class.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PostTaxRequest.class.php
4
+ * @package Tax
5
+ */
6
+
7
+ /**
8
+ * Data to pass to {@link TaxServiceSoap#commitTax}.
9
+ * <p>
10
+ * The request must specify all of CompanyCode, DocCode, and DocType in order to uniquely identify the document.
11
+ * </p>
12
+ *
13
+ * @package Tax
14
+ * @see PostTaxResult
15
+ * @author tblanchard
16
+ * Copyright (c) 2007, Avalara. All rights reserved.
17
+ */
18
+
19
+ class PostTaxRequest extends TaxRequest
20
+ {
21
+ private $DocDate; //date
22
+ private $TotalAmount; // decimal
23
+ private $TotalTax; // decimal
24
+ private $Commit=false; // boolean
25
+ private $NewDocCode; //string
26
+
27
+
28
+ public function __construct()
29
+ {
30
+ parent::__construct();
31
+
32
+
33
+ }
34
+
35
+ public function getDocDate() { return $this->DocDate; }
36
+ public function getTotalAmount() { return $this->TotalAmount; }
37
+ public function getTotalTax() { return $this->TotalTax; }
38
+ public function getCommit() { return $this->Commit; }
39
+ public function getNewDocCode() { return $this->NewDocCode; }
40
+
41
+
42
+ /**
43
+ * DocDate should be in the format yyyy-mm-dd
44
+ *
45
+ * @param date $value
46
+ */
47
+ public function setDocDate($value) { $this->DocDate = $value; return $this; }
48
+
49
+ /**
50
+ *The total amount (not including tax) for the document.
51
+ *
52
+ * @param decimal $value
53
+ */
54
+ public function setTotalAmount($value) { $this->TotalAmount = $value; return $this; }
55
+
56
+ /**
57
+ * The total tax for the document.
58
+ *
59
+ * @param decimal $value
60
+ */
61
+ public function setTotalTax($value) { $this->TotalTax = $value; return $this; }
62
+
63
+ /**
64
+ * If this is set to True, AvaTax will Post and Commit the document in one call.
65
+ * A very useful feature if you want to Post/Commit the document in one call this avoides one round trip to AvaTax server.
66
+ *
67
+ * @param string $value
68
+ */
69
+ public function setCommit($value) { $this->Commit = ($value ? true : false); return $this; }
70
+
71
+ /**
72
+ * New Document Code for the document.
73
+ * As on this version of SDK DocCode can be changed during post using NewDocCode.
74
+
75
+ * @param string $value
76
+ */
77
+ public function setNewDocCode($value) { $this->NewDocCode = $value; }
78
+
79
+ }
80
+
81
+
82
+
83
+
84
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/PostTaxResult.class.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PostTaxResult.class.php
4
+ * @package Tax
5
+ */
6
+
7
+ /**
8
+ * Result data returned from {@link TaxServiceSoap#postTax}.
9
+ *
10
+ * @package Tax
11
+ * @see PostTaxRequest
12
+ * @author tblanchard
13
+ * Copyright (c) 2007, Avalara. All rights reserved.
14
+ */
15
+
16
+ class PostTaxResult //extends BaseResult
17
+ {
18
+
19
+
20
+ // BaseResult innards - work around a bug in SoapClient
21
+
22
+ /**
23
+ * @var string
24
+ */
25
+ private $TransactionId;
26
+ /**
27
+ * @var string must be one of the values defined in {@link SeverityLevel}.
28
+ */
29
+ private $ResultCode = 'Success';
30
+ /**
31
+ * @var array of Message.
32
+ */
33
+ private $Messages = array();
34
+
35
+ /**
36
+ * Accessor
37
+ * @return string
38
+ */
39
+ public function getTransactionId() { return $this->TransactionId; }
40
+ /**
41
+ * Accessor
42
+ * @return string
43
+ */
44
+ public function getResultCode() { return $this->ResultCode; }
45
+ /**
46
+ * Accessor
47
+ * @return array
48
+ */
49
+ public function getMessages() { return EnsureIsArray($this->Messages->Message); }
50
+
51
+
52
+ }
53
+
54
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/ReconcileTaxHistoryRequest.class.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * ReconcileTaxHistoryRequest.class.php
5
+ * @package Tax
6
+ */
7
+
8
+ /**
9
+ * Data to pass to {@link TaxServiceSoap#reconcileTaxHistory(ReconcileTaxHistoryRequest)}
10
+ *
11
+ * @package Tax
12
+ * @see ReconcileTaxHistoryResult
13
+ * @author tblanchard
14
+ * Copyright (c) 2007, Avalara. All rights reserved.
15
+ */
16
+
17
+
18
+ class ReconcileTaxHistoryRequest// extends TaxRequest
19
+ {
20
+ private $CompanyCode; //string
21
+ private $StartDate; //date
22
+ private $EndDate; //date
23
+ private $DocStatus; //int
24
+
25
+ private $DocType; // DocType
26
+ private $LastDocCode; // string
27
+ private $PageSize; // int
28
+
29
+ private $Reconciled=true;
30
+
31
+ public function __construct()
32
+ {
33
+ //parent::__construct();
34
+ $this->EndDate = date("Y-m-d");
35
+ $this->DocStatus =DocStatus::$Any;
36
+
37
+ }
38
+
39
+
40
+
41
+ public function getCompanyCode() { return $this->CompanyCode;}
42
+
43
+
44
+ public function getstartDate() { return $this->StartDate; }
45
+ public function getEndDate() { return $this->EndDate; }
46
+ public function getDocStatus() { return $this->DocStatus; }
47
+
48
+ /**
49
+ * Sets the client application company reference code.
50
+ *
51
+ * @param string $value
52
+ */
53
+ public function setCompanyCode($value) { $this->CompanyCode = $value; return $this; }
54
+
55
+
56
+
57
+ /**
58
+ * Set this to retrieve data FROM a specific date.
59
+ *
60
+ * @param date $value
61
+ */
62
+ public function setStartDate($value) { $this->StartDate = $value; return $this; }
63
+
64
+ /**
65
+ * Set this to retrieve data TO a specific date.
66
+ *
67
+ * @param date $value
68
+ */
69
+ public function setEndDate($value) { $this->EndDate = $value; return $this; }
70
+
71
+ /**
72
+ * Set this to retrieve data with a specific DocStatus.
73
+ *
74
+ * @param string $value
75
+ */
76
+ public function setDocStatus($value) { DocStatus::Validate($value); $this->DocStatus = $value; return $this; }
77
+
78
+
79
+ public function setDocType($value){$this->DocType=$value;} // DocType
80
+ public function getDocType(){return $this->DocType;} // DocType
81
+
82
+ public function setLastDocCode($value){$this->LastDocCode=$value;} // string
83
+ public function getLastDocCode(){return $this->LastDocCode;} // string
84
+
85
+ public function setPageSize($value){$this->PageSize=$value;} // int
86
+ public function getPageSize(){return $this->PageSize;} // int
87
+
88
+
89
+ }
90
+
91
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/ReconcileTaxHistoryResult.class.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ReconcileTaxHistoryResult.class.php
4
+ * @package Tax
5
+ */
6
+
7
+ /**
8
+ * Result data returned from {@link TaxServiceSoap#reconcileTaxHistory}.
9
+ *
10
+ * @package Tax
11
+ * @see ReconcileTaxHistoryRequest
12
+ * @author tblanchard
13
+ * Copyright (c) 2007, Avalara. All rights reserved.
14
+ */
15
+
16
+ class ReconcileTaxHistoryResult //extends SearchTaxHistoryResult
17
+ {
18
+ // SearchTaxHistoryResult innards - work around a bug in SoapClient
19
+
20
+ public $GetTaxResults; // array of GetTaxResult
21
+ private $RecordCount; // int
22
+ private $LastDocCode; //string
23
+
24
+
25
+
26
+ /**
27
+ * Gets zero or more {@link GetTaxResult} summaries matching search criteria.
28
+ * <p>
29
+ * If <b>LastDocId</b> was not specified by the {@link ReconcileTaxHistoryRequest},
30
+ * then this is the first set of records that need reconciliation. If <b>LastDocId</b> was specified,
31
+ * the collection represents the next set of records after <b>LastDocId</b>. If the collection is
32
+ * empty, then all records have been reconciled and the result's <b>LastDocId</b> will be set to the
33
+ * last record of the last result set.
34
+ * <br>
35
+ * The GetTaxResults are returned in an Axis wrapper {@link ArrayOfGetTaxResult}, which has a
36
+ * raw GetTaxResult[] array accessible via its {@link ArrayOfGetTaxResult#getGetTaxResult} method.
37
+ * <pre>
38
+ * <b>Example:</b>
39
+ * $result = $taxSvc->reconcileTaxHistory($request);
40
+ * foreach($result->getTaxResults() as $taxResult)
41
+ * {
42
+ * ...
43
+ * }
44
+ *
45
+ * </pre>
46
+ * @see GetTaxResult
47
+ * @return array
48
+ */
49
+
50
+ public function getGetTaxResults()
51
+ {
52
+
53
+ if(isset($this->GetTaxResults->GetTaxResult))
54
+ {
55
+ return EnsureIsArray($this->GetTaxResults->GetTaxResult);
56
+ }
57
+ else
58
+ {
59
+ return null;
60
+ }
61
+ }
62
+
63
+ public function setRecordCount($value){$this->RecordCount=$value;} // int
64
+ public function getRecordCount(){return $this->RecordCount;} // int
65
+
66
+ public function setLastDocCode($value)
67
+ {
68
+ $this->LastDocCode=$value;
69
+ }
70
+ public function getLastDocCode()
71
+ {
72
+ return $this->LastDocCode;
73
+ }
74
+
75
+
76
+
77
+ // BaseResult innards - work around a bug in SoapClient
78
+
79
+ /**
80
+ * @var string
81
+ */
82
+ private $TransactionId;
83
+ /**
84
+ * @var string must be one of the values defined in {@link SeverityLevel}.
85
+ */
86
+ private $ResultCode = 'Success';
87
+ /**
88
+ * @var array of Message.
89
+ */
90
+ private $Messages = array();
91
+
92
+ /**
93
+ * Accessor
94
+ * @return string
95
+ */
96
+ public function getTransactionId() { return $this->TransactionId; }
97
+ /**
98
+ * Accessor
99
+ * @return string
100
+ */
101
+ public function getResultCode() { return $this->ResultCode; }
102
+ /**
103
+ * Accessor
104
+ * @return array
105
+ */
106
+ public function getMessages() { return EnsureIsArray($this->Messages->Message); }
107
+
108
+
109
+
110
+ }
111
+
112
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/SearchTaxHistoryResult.class.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SearchTaxHistoryResult.class.php
4
+ * @package Tax
5
+ */
6
+
7
+ /**
8
+ * Result data returned from {@link TaxSvcSoap#reconcileTaxHistory}.
9
+ * This class encapsulates the data and methods used by {@link ReconcileTaxHistoryResult}.
10
+ *
11
+ * @package Tax
12
+ * @see ReconcileTaxHistoryRequest
13
+ * @author tblanchard
14
+ * Copyright (c) 2007, Avalara. All rights reserved.
15
+ */
16
+
17
+ class SearchTaxHistoryResult //extends BaseResult
18
+ {
19
+
20
+ private $GetTaxResults; // array of GetTaxResult
21
+ private $LastDocId; // string
22
+
23
+
24
+ /**
25
+ * Gets zero or more {@link GetTaxResult} summaries matching search criteria.
26
+ * <p>
27
+ * If <b>LastDocId</b> was not specified by the {@link ReconcileTaxHistoryRequest},
28
+ * then this is the first set of records that need reconciliation. If <b>LastDocId</b> was specified,
29
+ * the collection represents the next set of records after <b>LastDocId</b>. If the collection is
30
+ * empty, then all records have been reconciled and the result's <b>LastDocId</b> will be set to the
31
+ * last record of the last result set.
32
+ * <br>
33
+ * The GetTaxResults are returned in an Axis wrapper {@link ArrayOfGetTaxResult}, which has a
34
+ * raw GetTaxResult[] array accessible via its {@link ArrayOfGetTaxResult#getGetTaxResult} method.
35
+ * <pre>
36
+ * <b>Example:</b>
37
+ * $result = $taxSvc->reconcileTaxHistory($request);
38
+ * foreach($result->getTaxResults() as $taxResult)
39
+ * {
40
+ * ...
41
+ * }
42
+ *
43
+ * </pre>
44
+ * @see GetTaxResult
45
+ * @return array
46
+ */
47
+
48
+ public function getTaxResults() { return EnsureIsArray($this->GetTaxResults->GetTaxResult); }
49
+
50
+ /**
51
+ * Indicates the last Document Code ({@link GetTaxResult#getDocId}) the results list.
52
+ * <p>
53
+ * If {@link #getGetTaxResults} is not empty, then this
54
+ * <b>LastDocId</b> should be passed to the next {@link ReconcileTaxHistoryRequest}.
55
+ * If {@link #getGetTaxResults} is empty, then this <b>LastDocId</b> can be
56
+ * passed to {@link ReconcileTaxHistoryRequest} with the request's
57
+ * {@link ReconcileTaxHistoryRequest#isReconciled} flag
58
+ * set to true in order to reconcile all documents up to and including the LastDocId.
59
+ * </p>
60
+ *
61
+ * @see ReconcileTaxHistoryResult
62
+ * @return string
63
+ */
64
+
65
+ public function getLastDocId() { return $this->LastDocId; }
66
+
67
+ // BaseResult innards - work around a bug in SoapClient
68
+
69
+ /**
70
+ * @var string
71
+ */
72
+ private $TransactionId;
73
+ /**
74
+ * @var string must be one of the values defined in {@link SeverityLevel}.
75
+ */
76
+ private $ResultCode = 'Success';
77
+ /**
78
+ * @var array of Message.
79
+ */
80
+ private $Messages = array();
81
+
82
+ /**
83
+ * Accessor
84
+ * @return string
85
+ */
86
+ public function getTransactionId() { return $this->TransactionId; }
87
+ /**
88
+ * Accessor
89
+ * @return string
90
+ */
91
+ public function getResultCode() { return $this->ResultCode; }
92
+ /**
93
+ * Accessor
94
+ * @return array
95
+ */
96
+ public function getMessages() { return EnsureIsArray($this->Messages->Message); }
97
+
98
+
99
+
100
+ }
101
+
102
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/ServiceMode.class.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ServiceMode.class.php
4
+ * @package Tax
5
+ */
6
+
7
+ /**
8
+ * Specifies the ServiceMode.
9
+ *
10
+ * @package Tax
11
+ * @see GetTaxRequest, GetTaxHistoryRequest
12
+ * @author swetal
13
+ * Copyright (c) 2008, Avalara. All rights reserved.
14
+ * This is only supported by AvaLocal servers. It provides the ability to controls whether tax is calculated locally or remotely when using an AvaLocal server.
15
+ * The default is Automatic which calculates locally unless remote is necessary for non-local addresses*/
16
+
17
+ class ServiceMode extends Enum
18
+ {
19
+ /**
20
+ * Automated handling by local and/or remote server.
21
+ */
22
+ public static $Automatic = "Automatic";
23
+
24
+
25
+ /**
26
+ * AvaLocal server only. Lines requiring remote will not be calculated.
27
+ */
28
+ public static $Local = "Local";
29
+
30
+ /**
31
+ * All lines are calculated by AvaTax remote server.
32
+ */
33
+ public static $Remote = "Remote";
34
+
35
+ public static function Values()
36
+ {
37
+ return array(
38
+ ServiceMode::$Automatic,
39
+ ServiceMode::$Local,
40
+ ServiceMode::$Remote
41
+ );
42
+ }
43
+
44
+ // Unfortunate boiler plate due to polymorphism issues on static functions
45
+ public static function Validate($value) { self::__Validate($value,self::Values(),__CLASS__); }
46
+ }
47
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/SeverityLevel.class.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SeverityLevel.class.php
4
+ *
5
+ * @package Address
6
+ */
7
+
8
+ /**
9
+ * Severity of the result {@link Message}.
10
+ *
11
+ * Defines the constants used to specify SeverityLevel in {@link Message}
12
+ *
13
+ * @package Address
14
+ * @author tblanchard
15
+ * Copyright (c) 2007, Avalara. All rights reserved.
16
+ */
17
+
18
+ class SeverityLevel extends Enum
19
+ {
20
+ public static $Success = 'Success';
21
+ public static $Warning = 'Warning';
22
+ public static $Error = 'Error';
23
+ public static $Exception = 'Exception';
24
+
25
+
26
+ public static function Values()
27
+ {
28
+ return array(
29
+ SeverityLevel::$Success,
30
+ SeverityLevel::$Warning,
31
+ SeverityLevel::$Error,
32
+ SeverityLevel::$Tax
33
+ );
34
+ }
35
+
36
+ // Unfortunate boiler plate due to polymorphism issues on static functions
37
+ public static function Validate($value) { self::__Validate($value,self::Values(),__CLASS__); }
38
+ }
39
+
40
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/TaxDetail.class.php ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * TaxDetail.class.php
4
+ * @package Tax
5
+ */
6
+
7
+ /**
8
+ * Holds calculated tax information by jurisdiction.
9
+ *
10
+ * @package Tax
11
+ * @see ArrayOfTaxDetail
12
+ * @see TaxLine
13
+ * @see GetTaxResult
14
+ * @author tblanchard
15
+ * Copyright (c) 2008, Avalara. All rights reserved.
16
+ */
17
+
18
+ class TaxDetail
19
+ {
20
+
21
+ private $JurisType; //JurisdictionType
22
+ private $JurisCode; //string
23
+ private $TaxType; //TaxType
24
+
25
+ private $Base; //decimal // See Taxable
26
+ private $Taxable; //decimal
27
+ private $Rate; //decimal
28
+
29
+ private $Tax; //decimal
30
+ private $NonTaxable; //decimal
31
+ private $Exemption; //decimal
32
+ private $JurisName; //string
33
+ private $TaxName; //string
34
+ private $TaxAuthorityType; // int
35
+
36
+ //@author:swetal
37
+ //Added new properties to upgrade it to 5.3 interface
38
+ private $Country; //string
39
+ private $Region; //string
40
+ private $TaxCalculated; //decimal
41
+ private $TaxGroup; //string
42
+
43
+ //Task# 25610
44
+ private $StateAssignedNo;
45
+
46
+ public function getStateAssignedNo()
47
+ {
48
+ return $this->StateAssignedNo;
49
+ }
50
+
51
+
52
+
53
+ /**
54
+ * Gets the JurisdictionType.
55
+ * <p>
56
+ *
57
+
58
+ * </p>
59
+ * @see JurisdictionType
60
+ @see GetTaxResults
61
+ * @return JurisdictionType
62
+ */
63
+
64
+ public function getJurisType() {return $this->JurisType; }
65
+
66
+ /**
67
+ * Gets the JurisCode.
68
+ * <p>
69
+ * </p>
70
+ * @see JurisCode
71
+ @see GetTaxResults
72
+ * @return string
73
+ */
74
+
75
+ public function getJurisCode() {return $this->JurisCode; }
76
+
77
+ /**
78
+ * Gets the TaxType.
79
+ * <p>
80
+ * </p>
81
+ @see GetTaxResults
82
+ * @return TaxType
83
+ */
84
+
85
+ public function getTaxType() {return $this->TaxType; }
86
+
87
+ /**
88
+ * Gets the Taxable amount.
89
+ * <p>
90
+ * </p>
91
+ @see GetTaxResults
92
+ * @return decimal
93
+ */
94
+
95
+ public function getTaxable() {return $this->Taxable; }
96
+
97
+ /**
98
+ * Gets the Taxable amount.
99
+ * <p>
100
+ * </p>
101
+ @see GetTaxResults
102
+ * @return decimal
103
+ */
104
+
105
+ public function getBase() {return $this->Base; }
106
+
107
+
108
+ /**
109
+ * Gets the Rate amount.
110
+ * <p>
111
+ * </p>
112
+ @see GetTaxResults
113
+ * @return decimal
114
+ */
115
+
116
+ public function getRate() {return $this->Rate; }
117
+
118
+ /**
119
+ * Gets the Tax amount.
120
+ * <p>
121
+ The tax amount, i.e. the calculated tax (base() * rate())
122
+ * </p>
123
+ @see GetTaxResults
124
+ * @return decimal
125
+ */
126
+
127
+ public function getTax() {return $this->Tax; }
128
+
129
+ /**
130
+ * Gets the non-taxable amount..
131
+ * <p>
132
+ The non-taxable amount.
133
+ * </p>
134
+ @see GetTaxResults
135
+ * @return decimal
136
+ */
137
+
138
+ public function getNonTaxable() {return $this->NonTaxable; }
139
+
140
+
141
+ /**
142
+ * Gets theExemption amount..
143
+ * <p>
144
+ The exempt amount for this TaxDetail.
145
+ * </p>
146
+ @see GetTaxResults
147
+ * @return decimal
148
+ */
149
+
150
+ public function getExemption() {return $this->Exemption; }
151
+ /**
152
+ * Gets the jurisdiction name for this TaxDetail.
153
+
154
+ * <p>
155
+ Gets the jurisdiction name for this TaxDetail.
156
+ * </p>
157
+ @see GetTaxResults
158
+ * @return decimal
159
+ */
160
+
161
+ public function getJurisName() {return $this->JurisName; }
162
+ /**
163
+ *
164
+ * <p>
165
+ Gets the taxName value.
166
+ It further defines tax and jurisdiction. * </p>
167
+ @see GetTaxResults
168
+ * @return decimal
169
+ */
170
+
171
+ public function getTaxName() {return $this->TaxName; }
172
+ /**
173
+ * Gets the taxAuthorityType value for this TaxDetail.
174
+ * <p>
175
+ Gets the taxAuthorityType value for this TaxDetail.
176
+ * </p>
177
+ @see GetTaxResults
178
+ * @return decimal
179
+ */
180
+
181
+ public function getTaxAuthorityType() {return $this->TaxAuthorityType; }
182
+
183
+ //@author:swetal
184
+ public function getCountry(){ return $this->Country;}
185
+ public function getRegion(){ return $this->Region;}
186
+ public function getTaxCalculated(){ return $this->TaxCalculated;}
187
+ public function getTaxGroup(){ return $this->TaxGroup;}
188
+
189
+
190
+ }
191
+
192
+
193
+
194
+
195
+
196
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/TaxLine.class.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * TaxLine.class.php
4
+ *
5
+ * @package Tax
6
+ */
7
+
8
+ /**
9
+ * Contains Tax data; Retunded form {@link AddressServiceSoap#getTax};
10
+ * Also part of the {@link GetTaxRequest}
11
+ * result returned from the {@link TaxServiceSoap#getTax} tax calculation service;
12
+ * @package Tax
13
+ * @author tblanchard
14
+ * Copyright (c) 2008, Avalara. All rights reserved.
15
+ */
16
+ /*
17
+ */
18
+
19
+ class TaxLine
20
+ {
21
+
22
+ private $No; //string
23
+ private $TaxCode; //string
24
+ private $Taxability; //boolean
25
+ private $BoundaryLevel; //BoundaryLevel
26
+ private $Exemption; //decimal
27
+ private $Discount; //decimal
28
+ private $Taxable; //decimal
29
+ private $Rate; //decimal
30
+ private $Tax; //decimal
31
+ private $ExemptCertId; //int
32
+ private $TaxDetails; //ArrayOfTaxDetail
33
+
34
+ //@author:swetal
35
+ //added following properties to upgrade to 5.3 interface
36
+ private $TaxCalculated; //decimal
37
+ private $ReportingDate; //date
38
+ private $AccountingMethod;//String
39
+
40
+ private $TaxIncluded; //boolean
41
+
42
+ /**
43
+ * Accessor
44
+ * @return string
45
+ */
46
+ public function getNo() { return $this->No; }
47
+
48
+
49
+ /**
50
+ * Accessor
51
+ * @return string
52
+ */
53
+ public function getTaxCode() { return $this->TaxCode; }
54
+ /**
55
+ * Accessor
56
+ * @return boolean
57
+ */
58
+ public function getTaxability() { return $this->Taxability; }
59
+ /**
60
+ * Accessor
61
+ * @see BoundaryLevel
62
+ * @return string
63
+ */
64
+ public function getBoundaryLevel() { return $this->BoundaryLevel; }
65
+ /**
66
+ * Accessor
67
+ * @return decimal
68
+ */
69
+ public function getExemption() { return $this->Exemption; }
70
+ /**
71
+ * Accessor
72
+ * @return decimal
73
+ */
74
+ public function getDiscount() { return $this->Discount; }
75
+ /**
76
+ * Accessor
77
+ * @return decimal
78
+ */
79
+ public function getTaxable() { return $this->Taxable; }
80
+ /**
81
+ * Accessor
82
+ * @return decimal
83
+ */
84
+ public function getRate() { return $this->Rate; }
85
+ /**
86
+ * Accessor
87
+ * @return string
88
+ */
89
+ public function getTax() { return $this->Tax; }
90
+
91
+
92
+ /**
93
+ * Accessor
94
+ * @return decimal
95
+ */
96
+ public function getTaxDetails() { return EnsureIsArray($this->TaxDetails->TaxDetail); }
97
+
98
+
99
+ /**
100
+ * Accessor
101
+ * @return int
102
+ */
103
+ public function getExemptCertId() { return $this->ExemptCertId; }
104
+
105
+ /**
106
+ * Accessor
107
+ * @return decimal
108
+ */
109
+ public function getTaxCalculated(){ return $this->TaxCalculated; } //decimalt
110
+ public function getReportingDate(){ return $this->ReportingDate;} //date
111
+ public function getAccountingMethod(){ return $this->AccountingMethod;}//String
112
+
113
+ /**
114
+ * True if tax is included in the line.
115
+ * @param boolean
116
+ */
117
+ public function setTaxIncluded($value)
118
+ {
119
+ $this->TaxIncluded=$value;
120
+ }
121
+
122
+ /**
123
+ * True if tax is included in the line.
124
+ * @return boolean
125
+ */
126
+ public function getTaxIncluded()
127
+ {
128
+ return $this->TaxIncluded;
129
+ }
130
+
131
+
132
+
133
+ }
134
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/TaxOverride.class.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * TaxOverride.class.php
5
+ *
6
+ * @package Tax
7
+ */
8
+
9
+ class TaxOverride
10
+ {
11
+ private $TaxOverrideType; //TaxOverrideType
12
+ private $TaxAmount; //decimal
13
+ private $TaxDate; //date
14
+ private $Reason; //string
15
+
16
+
17
+
18
+ public function __construct()
19
+ {
20
+ $this->TaxAmount=0.0;
21
+
22
+ $dateTime=new DateTime();
23
+ $dateTime->setDate(1900,01,01);
24
+
25
+ $this->TaxDate=$dateTime->format("Y-m-d");
26
+ }
27
+
28
+ public function setTaxOverrideType($value){ $this->TaxOverrideType=$value; } //TaxOverrideType
29
+ public function setTaxAmount($value){$this->TaxAmount=$value;} //decimal
30
+ public function setTaxDate($value){$this->TaxDate=$value;} //date
31
+ public function setReason($value){$this->Reason=$value;} //string
32
+
33
+
34
+ public function getTaxOverrideType(){ return $this->TaxOverrideType; } //TaxOverrideType
35
+ public function getTaxAmount(){return $this->TaxAmount;} //decimal
36
+ public function getTaxDate(){return $this->TaxDate;} //date
37
+ public function getReason(){return $this->Reason;} //string
38
+
39
+
40
+ }
41
+
42
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/TaxOverrideType.class.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * TaxOverrideType.class.php
4
+ *
5
+ * @package Tax
6
+ */
7
+ class TaxOverrideType
8
+ {
9
+ public static $None = "None";
10
+ public static $TaxAmount = "TaxAmount";
11
+ public static $Exemption = "Exemption";
12
+ public static $TaxDate = "TaxDate";
13
+
14
+ }
15
+
16
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/TaxRequest.class.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * TaxRequest.class.php
4
+ * @package Tax
5
+ */
6
+
7
+ /**
8
+ * Abstract base class for all CancelTax,GetTaxHistory,PostTax, Service Requests.
9
+ * Tax Requests require either a DocId, or CompanyCode, DocType, and DocCode.
10
+ *
11
+ * @see TaxServiceSoap
12
+ * @package Tax
13
+ * @author tblanchard
14
+ * Copyright (c) 2007, Avalara. All rights reserved.
15
+ */
16
+
17
+ class TaxRequest
18
+ {
19
+
20
+ /**
21
+ * @access public
22
+ * @var string
23
+ */
24
+ protected $CompanyCode;
25
+ /**
26
+ * Must be one of SalesOrder or SalesInvoice or PurchaseOrder or PurchaseInvoice or ReturnOrder or ReturnInvoice
27
+ * Constants defined in DocumentType.
28
+ *
29
+ * @see DocumentType
30
+ * @access public
31
+ * @var string
32
+ */
33
+ protected $DocType;
34
+ /**
35
+ * Invoice Number
36
+ *
37
+ * @access public
38
+ * @var string
39
+ */
40
+ protected $DocCode;
41
+
42
+ /**
43
+ * A unique document ID.
44
+ * <p>
45
+ * This is a unique AvaTax identifier for this document. If known, the
46
+ * <b>CompanyCode</b>, <b>DocCode</b>, and <b>DocType</b> are not needed.
47
+ *
48
+ * @access public
49
+ * @var string
50
+ */
51
+ //protected $DocId;
52
+
53
+ /**
54
+ * Sets the client application company reference code.
55
+ * <br>If docId is specified, this is not needed.
56
+ *
57
+ * @param string
58
+ */
59
+
60
+ protected $HashCode;
61
+
62
+ public function setCompanyCode($value) { $this->CompanyCode = $value; return $this; }
63
+
64
+ /**
65
+ * The original document's type, such as Sales Invoice or Purchase Invoice.
66
+ *
67
+ * @var string
68
+ * @see DocumentType
69
+ */
70
+ public function setDocType($value) { DocumentType::Validate($value); $this->DocType=$value; return $this; }
71
+
72
+ /**
73
+ * Sets the Document Code, that is the internal reference code used by the client application.
74
+ * <br>If docId is specified, this is not needed.
75
+ *
76
+ * @var string
77
+ */
78
+ public function setDocCode($value) { $this->DocCode = $value; return $this; }
79
+
80
+ /**
81
+ * A unique document ID.
82
+ * <p>
83
+ * This is a unique AvaTax identifier for this document. If known, the
84
+ * <b>CompanyCode</b>, <b>DocCode</b>, and <b>DocType</b> are not needed.
85
+ *
86
+ * @var string
87
+ * @see GetTaxResult#DocId
88
+ */
89
+
90
+ //public function setDocId($value) { $this->DocId = $value; return $this; }
91
+
92
+ /**
93
+ * Sets the hashCode value for this GetTaxRequest.
94
+ * <p>
95
+ * This should be computed by an SDK developer using some standard algorithm out of the content of the object. This value gets stored in the system and can be retrieved for the cross checking [Internal Reconciliation purpose].
96
+ * See sample code for more details
97
+ * </p>
98
+ * @var int
99
+ */
100
+
101
+ public function setHashCode($value) { $this->HashCode = $value; return $this; }
102
+ // Accessors
103
+ /**
104
+ * Gets the client application company reference code.
105
+ *
106
+ * @return string
107
+ */
108
+
109
+ public function getCompanyCode() { return $this->CompanyCode; }
110
+
111
+
112
+ /**
113
+ * Gets the hashCode value for this GetTaxRequest.
114
+ * <p>
115
+ * This should be computed by an SDK developer using some standard algorithm out of the content of the object. This value gets stored in the system and can be retrieved for the cross checking [Internal Reconciliation purpose].
116
+ * See sample code for more details
117
+ * </p>
118
+ * @return int
119
+ */
120
+
121
+ public function getHashCode() { return $this->HashCode; }
122
+
123
+ /**
124
+ * The original document's type, such as Sales Invoice or Purchase Invoice.
125
+ *
126
+ * @return string
127
+ * @see DocumentType
128
+ */
129
+
130
+
131
+ public function getDocType() { return $this->DocType; }
132
+
133
+ /**
134
+ * Gets the Document Code, that is the internal reference code used by the client application.
135
+ * <br>If docId is specified, this is not needed.
136
+ *
137
+ * @return string
138
+ */
139
+
140
+ public function getDocCode() { return $this->DocCode; }
141
+
142
+ /**
143
+ * A unique document ID.
144
+ * <p>
145
+ * This is a unique AvaTax identifier for this document. If known, the
146
+ * <b>CompanyCode</b>, <b>DocCode</b>, and <b>DocType</b> are not needed.
147
+ *
148
+ * @return string
149
+ * @see GetTaxResult#DocId
150
+ */
151
+
152
+ //public function getDocId() { return $this->DocId; }
153
+
154
+ public function __construct()
155
+ {
156
+ $this->DocType = DocumentType::$SalesOrder; // this is right Document
157
+ $this->HashCode= 0;
158
+
159
+ }
160
+
161
+ }
162
+
163
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/TaxServiceSoap.class.php ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * TaxServiceSoap.class.php
5
+ *
6
+ * This is a proxy for the Avalara Tax service. It contains methods that perform remote calls
7
+ * to the Avalara Tax Service.
8
+ *
9
+ * @package Tax
10
+ */
11
+
12
+ /**
13
+ * Proxy interface for the Avalara Tax Web Service.
14
+ *
15
+ * TaxServiceSoap reads its configuration values from static variables defined
16
+ * in ATConfig.class.php. This file must be properly configured with your security credentials.
17
+ *
18
+ * <p>
19
+ * <b>Example:</b>
20
+ * <pre>
21
+ * $taxService = new TaxServiceSoap();
22
+ * $result = $taxService->ping();
23
+ * </pre>
24
+ *
25
+ * @package Tax
26
+ * @author tblanchard
27
+ * Copyright (c) 2007, Avalara. All rights reserved.
28
+ */
29
+
30
+
31
+ class TaxServiceSoap extends AvalaraSoapClient
32
+ {
33
+ static $servicePath = '/Tax/TaxSvc.asmx';
34
+ static protected $classmap = array(
35
+ 'BaseAddress' => 'Address',
36
+ 'ValidAddress' => 'ValidAddress',
37
+ 'Message' => 'Message',
38
+ 'ValidateRequest' => 'ValidateRequest',
39
+ 'IsAuthorizedResult' => 'IsAuthorizedResult',
40
+ 'PingResult' => 'PingResult',
41
+ 'ValidateResult' => 'ValidateResult',
42
+ 'Line'=>'Line',
43
+ 'AdjustTaxRequest'=>'AdjustTaxRequest',
44
+ 'AdjustTaxResult'=>'AdjustTaxResult',
45
+ 'CancelTaxRequest'=>'CancelTaxRequest',
46
+ 'CancelTaxResult'=>'CancelTaxResult',
47
+ 'CommitTaxRequest'=>'CommitTaxRequest',
48
+ 'CommitTaxResult'=>'CommitTaxResult',
49
+ 'GetTaxRequest'=>'GetTaxRequest',
50
+ 'GetTaxResult'=>'GetTaxResult',
51
+ 'GetTaxHistoryRequest'=>'GetTaxHistoryRequest',
52
+ 'GetTaxHistoryResult'=>'GetTaxHistoryResult',
53
+ 'PostTaxRequest'=>'PostTaxRequest',
54
+ 'PostTaxResult'=>'PostTaxResult',
55
+ 'ReconcileTaxHistoryRequest'=>'ReconcileTaxHistoryRequest',
56
+ 'ReconcileTaxHistoryResult'=>'ReconcileTaxHistoryResult',
57
+ 'TaxLine'=>'TaxLine',
58
+ 'TaxDetail' => 'TaxDetail',
59
+ 'ApplyPaymentRequest'=>'ApplyPaymentRequest',
60
+ 'ApplyPaymentResult'=>'ApplyPaymentResult',
61
+ 'BaseResult'=>'BaseResult',
62
+ 'TaxOverride'=>'TaxOverride'
63
+ );
64
+
65
+ public function __construct($configurationName = 'Default')
66
+ {
67
+ $config = new ATConfig($configurationName);
68
+
69
+ $this->client = new DynamicSoapClient (
70
+ $config->taxWSDL,
71
+ array
72
+ (
73
+ 'location' => $config->url.$config->taxService,
74
+ 'trace' => $config->trace,
75
+ 'classmap' => TaxServiceSoap::$classmap
76
+ ),
77
+ $config
78
+ );
79
+ }
80
+
81
+
82
+
83
+ /**
84
+ * Calculates taxes on a document such as a sales order, sales invoice, purchase order, purchase invoice, or credit memo.
85
+ * <br>The tax data is saved Sales Invoice and Purchase Invoice document types {@link GetTaxRequest#getDocType}.
86
+ *
87
+ * @param getTaxRequest -- Tax calculation request
88
+ *
89
+ * @return GetTaxResult
90
+ * @throws SoapFault
91
+ */
92
+ public function getTax(&$getTaxRequest)
93
+ {
94
+ $getTaxRequest->prepare();
95
+ return $this->client->GetTax(array('GetTaxRequest' => $getTaxRequest))->GetTaxResult;
96
+ }
97
+
98
+ /**
99
+ * Retrieves a previously calculated tax document.
100
+ * <p>
101
+ * This is only available for saved tax documents (Sales Invoices, Purchase Invoices).
102
+ * </p>
103
+ * <p>
104
+ * A document can be indicated solely by the {@link PostTaxRequest#getDocId} if it is known.
105
+ * Otherwise the request must specify all of {@link PostTaxRequest#getCompanyCode}, see {@link PostTaxRequest#getDocCode}
106
+ * and {@link PostTaxRequest#getDocType} in order to uniquely identify the document.
107
+ * </p>
108
+ *
109
+ * @param getTaxHistoryRequest a {@link GetTaxHistoryRequest} object indicating the document for which history should be retrieved.
110
+ * @return a {@link GetTaxHistoryResult} object
111
+ * @throws SoapFault
112
+ */
113
+ /*public com.avalara.avatax.services.tax.GetTaxHistoryResult getTaxHistory(com.avalara.avatax.services.tax.GetTaxHistoryRequest getTaxHistoryRequest) throws SoapFault;
114
+ */
115
+ public function getTaxHistory(&$getTaxHistoryRequest)
116
+ {
117
+ $result = $this->client->GetTaxHistory(array('GetTaxHistoryRequest'=>$getTaxHistoryRequest))->GetTaxHistoryResult;
118
+ $result->getGetTaxRequest()->postFetch();
119
+ return $result;
120
+ }
121
+
122
+ /**
123
+ * Posts a previously calculated tax
124
+ * <p>
125
+ * This is only available for saved tax documents (Sales Invoices, Purchase Invoices).
126
+ * </p>
127
+ * <p>
128
+ * A document can be indicated solely by the {@link PostTaxRequest#getDocId} if it is known.
129
+ * Otherwise the request must specify all of {@link PostTaxRequest#getCompanyCode}, {@link PostTaxRequest#getDocCode}, and
130
+ * {@link PostTaxRequest#getDocType} in order to uniquely identify the document.
131
+ * </p>
132
+ *
133
+ * @param postTaxRequest a {@link PostTaxRequest} object indicating the document that should be posted.
134
+ * @return a {@link PostTaxResult} object
135
+ * @throws SoapFault
136
+ */
137
+
138
+ /*public com.avalara.avatax.services.tax.PostTaxResult postTax(com.avalara.avatax.services.tax.PostTaxRequest postTaxRequest) throws SoapFault;
139
+ */
140
+ public function postTax(&$postTaxRequest)
141
+ {
142
+ return $this->client->PostTax(array('PostTaxRequest'=>$postTaxRequest))->PostTaxResult;
143
+ }
144
+
145
+ /**
146
+ * Commits a previously posted tax.
147
+ * <p>
148
+ * This is only available for posted tax documents (Sales Invoices, Purchase Invoices). Committed documents cannot
149
+ * be changed or deleted.
150
+ * </p>
151
+ * <p>
152
+ * A document can be indicated solely by the {@link CommitTaxRequest#getDocId} if it is known. Otherwise the
153
+ * request must specify all of {@link CommitTaxRequest#getCompanyCode}, {@link CommitTaxRequest#getDocCode}, and
154
+ * {@link CommitTaxRequest#getDocType} in order to uniquely identify the document.
155
+ * </p>
156
+ *
157
+ * @param commitTaxRequest a {@link CommitTaxRequest} object indicating the document that should be committed.
158
+ * @return a {@link CommitTaxResult} object
159
+ * @throws SoapFault
160
+ */
161
+
162
+ /*public com.avalara.avatax.services.tax.CommitTaxResult commitTax(com.avalara.avatax.services.tax.CommitTaxRequest commitTaxRequest) throws SoapFault;
163
+ */
164
+ public function commitTax(&$commitTaxRequest)
165
+ {
166
+ return $this->client->CommitTax(array('CommitTaxRequest'=>$commitTaxRequest))->CommitTaxResult;
167
+ }
168
+ /**
169
+ * Cancels a previously calculated tax; This is for use as a
170
+ * compensating action when posting on the client fails to complete.
171
+ * <p>
172
+ * This is only available for saved tax document types (Sales Invoices, Purchase Invoices). A document that is saved
173
+ * but not posted will be deleted if canceled. A document that has been posted will revert to a saved state if canceled
174
+ * (in this case <b>CancelTax</b> should be called with a {@link CancelTaxRequest#getCancelCode} of
175
+ * <i>PostFailed</i>). A document that has been committed cannot be reverted to a posted state or deleted. In the case
176
+ * that a document on the client side no longer exists, a committed document can be virtually removed by calling
177
+ * <b>CancelTax</b> with a <b>CancelCode</b> of <i>DocDeleted</i>. The record will be retained in history but removed
178
+ * from all reports.
179
+ * </p>
180
+ * <p>
181
+ * A document can be indicated solely by the {@link CancelTaxRequest#getDocId} if it is known. Otherwise the request
182
+ * must specify all of {@link CancelTaxRequest#getCompanyCode}, {@link CancelTaxRequest#getDocCode}, and
183
+ * {@link CancelTaxRequest#getDocType} in order to uniquely identify the document.
184
+ *
185
+ * @param cancelTaxRequest a {@link CancelTaxRequest} object indicating the document that should be canceled.
186
+ * @return a {@link CancelTaxResult} object
187
+ * @throws SoapFault
188
+ */
189
+ /* public com.avalara.avatax.services.tax.CancelTaxResult cancelTax(com.avalara.avatax.services.tax.CancelTaxRequest cancelTaxRequest) throws SoapFault;
190
+ */
191
+ public function cancelTax(&$cancelTaxRequest)
192
+ {
193
+ return $this->client->CancelTax(array('CancelTaxRequest'=>$cancelTaxRequest))->CancelTaxResult;
194
+ }
195
+
196
+ /**
197
+ * Reconciles tax history to ensure the client data matches the
198
+ * AvaTax history.
199
+ * <p>The Reconcile operation allows reconciliation of the AvaTax history with the client accounting system.
200
+ * It must be used periodically according to your service contract.
201
+ * </p>
202
+ * <p>
203
+ * Because there may be a large number of documents to reconcile, it is designed to be called repetitively
204
+ * until all documents have been reconciled. It should be called until no more documents are returned.
205
+ * Each subsequent call should pass the previous results {@link ReconcileTaxHistoryRequest#getLastDocId}.
206
+ * </p>
207
+ * <p>
208
+ * When all results have been reconciled, Reconcile should be called once more with
209
+ * {@link ReconcileTaxHistoryRequest#getLastDocId}
210
+ * equal to the last document code processed and {@link ReconcileTaxHistoryRequest#isReconciled} set to true to indicate
211
+ * that all items have been reconciled. If desired, this may be done incrementally with each result set. Just send
212
+ * Reconciled as true when requesting the next result set and the prior results will be marked as reconciled.
213
+ * </p>
214
+ * <p>
215
+ * The {@link #postTax}, {@link #commitTax}, and {@link #cancelTax} operations can be used to correct any differences.
216
+ * {@link #getTax} should be called if any committed documents are out of balance
217
+ * ({@link GetTaxResult#getTotalAmount} or {@link GetTaxResult#getTotalTax}
218
+ * don't match the accounting system records). This is to make sure the correct tax is reported.
219
+ * </p>
220
+ *
221
+ * @param reconcileTaxHistoryRequest a Reconciliation request
222
+ * @return A collection of documents that have been posted or committed since the last reconciliation.
223
+ * @throws SoapFault
224
+ */
225
+ /*public com.avalara.avatax.services.tax.ReconcileTaxHistoryResult reconcileTaxHistory(com.avalara.avatax.services.tax.ReconcileTaxHistoryRequest reconcileTaxHistoryRequest) throws SoapFault;
226
+ */
227
+ public function reconcileTaxHistory(&$reconcileTaxHistoryRequest)
228
+ {
229
+ return $this->client->ReconcileTaxHistory(array('ReconcileTaxHistoryRequest'=>$reconcileTaxHistoryRequest))->ReconcileTaxHistoryResult;
230
+ }
231
+
232
+ /**
233
+ * Adjusts a previously calculated tax.
234
+ * <p>
235
+ * This is only available for unlocked tax documents (Sales Invoices, Purchase Invoices). * </p>
236
+ * <p>
237
+ * </p>
238
+ *
239
+ * @param adjustTaxRequest a {@link AdjustTaxRequest} object indicating the document that should be edited.
240
+ * @return a {@link AdjustTaxResult} object
241
+ * @throws SoapFault
242
+ */
243
+
244
+ /*public com.avalara.avatax.services.tax.CommitTaxResult commitTax(com.avalara.avatax.services.tax.CommitTaxRequest commitTaxRequest) throws SoapFault;
245
+ */
246
+ public function adjustTax(&$adjustTaxRequest)
247
+ {
248
+ $adjustTaxRequest->getGetTaxRequest()->prepare();
249
+ return $this->client->AdjustTax(array('AdjustTaxRequest'=>$adjustTaxRequest))->AdjustTaxResult;
250
+ }
251
+ /**
252
+ * Checks authentication of and authorization to one or more
253
+ * operations on the service.
254
+ *
255
+ * This operation allows pre-authorization checking of any
256
+ * or all operations. It will return a comma delimited set of
257
+ * operation names which will be all or a subset of the requested
258
+ * operation names. For security, it will never return operation
259
+ * names other than those requested (no phishing allowed).
260
+ *
261
+ * <b>Example:</b><br>
262
+ * <code> isAuthorized("GetTax,PostTax")</code>
263
+ *
264
+ * @param string $operations a comma-delimited list of operation names
265
+ *
266
+ * @return IsAuthorizedResult
267
+ * @throws SoapFault
268
+ */
269
+
270
+
271
+ public function isAuthorized($operations)
272
+ {
273
+ return $this->client->IsAuthorized(array('Operations' => $operations))->IsAuthorizedResult;
274
+ }
275
+
276
+ /**
277
+ * Verifies connectivity to the web service and returns version
278
+ * information about the service.
279
+ *
280
+ * <b>NOTE:</b>This replaces TestConnection and is available on
281
+ * every service.
282
+ *
283
+ * @param string $message for future use
284
+ * @return PingResult
285
+ * @throws SoapFault
286
+ */
287
+
288
+ public function ping($message = '')
289
+ {
290
+ return $this->client->Ping(array('Message' => $message))->PingResult;
291
+ }
292
+
293
+ /**
294
+ * This method is used to apply a payment to a document for cash basis accounting. Applies a payment date to an existing invoice
295
+ * It sets the document PaymentDate and changes the reporting date from the DocDate default. It may be called before or after a document is committed. It should not be used for accrual basis accounting
296
+ *
297
+ * @param ApplyPaymentRequest $applyPaymentRequest
298
+ * @return ApplyPaymentResult
299
+ */
300
+
301
+ public function applyPayment(&$applyPaymentRequest)
302
+ {
303
+ return $this->client->ApplyPayment(array('ApplyPaymentRequest' => $applyPaymentRequest))->ApplyPaymentResult;
304
+ }
305
+
306
+ }
307
+
308
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/TaxType.class.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * TaxType.class.php
4
+ * @package Tax
5
+ */
6
+
7
+ /**
8
+ * The Type of the tax.
9
+ *
10
+ * @package Tax
11
+ * @author tblanchard
12
+ * Copyright (c) 2008, Avalara. All rights reserved.
13
+ */
14
+
15
+ class TaxType// extends Enum
16
+ {
17
+ public static $Sales = 'Sales';
18
+ public static $Use = 'Use';
19
+ public static $ConsumerUse = 'ConsumerUse';
20
+ /*
21
+ public static function Values()
22
+ {
23
+ return array(
24
+ $TaxType::$Sales,
25
+ $TaxType::$Use,
26
+ $TaxType::$ConsumerUse
27
+ );
28
+ }
29
+
30
+ // Unfortunate boiler plate due to polymorphism issues on static functions
31
+ public static function Validate($value) { self::__Validate($value,self::Values(),__CLASS__); }
32
+
33
+ */
34
+
35
+ }
36
+
37
+
38
+
39
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/TextCase.class.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * TextCase.class.php
4
+ * @package Address
5
+ */
6
+
7
+ /**
8
+ * The casing to apply to the valid address(es) returned in the validation result.
9
+ *
10
+ * @package Address
11
+ * @author tblanchard
12
+ * Copyright (c) 2007, Avalara. All rights reserved.
13
+ */
14
+
15
+ class TextCase extends Enum
16
+ {
17
+ public static $Default = 'Default';
18
+ public static $Upper = 'Upper';
19
+ public static $Mixed = 'Mixed';
20
+
21
+ public static function Values()
22
+ {
23
+ return array(
24
+ TextCase::$Default,
25
+ TextCase::$Upper,
26
+ TextCase::$Mixed,
27
+ );
28
+ }
29
+
30
+ // Unfortunate boiler plate due to polymorphism issues on static functions
31
+ public static function Validate($value) { self::__Validate($value,self::Values(),__CLASS__); }
32
+ }
33
+
34
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/ValidAddress.class.php ADDED
@@ -0,0 +1,478 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ValidAddress.class.php
4
+ * @package Address
5
+ */
6
+
7
+ /**
8
+ * A fully validated address based on initial {@link Address}
9
+ * data passed to {@link AddressServiceSoap#validate}.
10
+ * <pre>
11
+ * <b>Example:</b>
12
+ * $address = new Address();
13
+ * $address->setLine1("900 Winslow Way");
14
+ * $address->setLine2("Suite 130");
15
+ * $address->setCity("Bainbridge Is");
16
+ * $address->setRegion("WA");
17
+ * $address->setPostalCode("98110-2450");
18
+ *
19
+ * $result = svc->validate($address,TextCase::$Upper);
20
+ *
21
+ * if ($result->getResultCode() == SeverityLevel::$Success)
22
+ * {
23
+ * $addresses = result->validAddresses();
24
+ * if (sizeof($addresses) > 0)
25
+ * {
26
+ * $validAddress = $addresses[0];
27
+ * print($validAddress->getLine1()); // "900 WINSLOW WAY E STE 130",
28
+ * print($validAddress->getLine4()); // "BAINBRIDGE IS WA 98110-2450"
29
+ * print($validAddress->getFipsCode()); // "5303500000"
30
+ * print($validAddress->getCounty()); // "KITSAP"
31
+ * }
32
+ * }
33
+ * </pre>
34
+ *
35
+ * @see Address
36
+ * @package Address
37
+ * @author tblanchard
38
+ * Copyright (c) 2007, Avalara. All rights reserved.
39
+ */
40
+
41
+ class ValidAddress //extends Address - or it should - SoapClient has issues mapping attributes in superclasses
42
+ {
43
+ /**#@+
44
+ * @access private
45
+ * @var string
46
+ */
47
+ private $AddressCode;
48
+ private $Line1;
49
+ private $Line2;
50
+ private $Line3;
51
+ private $City;
52
+ private $Region;
53
+ private $PostalCode;
54
+ private $Country = 'USA';
55
+
56
+ private $Line4;
57
+ private $County;
58
+ private $FipsCode;
59
+ private $CarrierRoute;
60
+ private $PostNet;
61
+ private $AddressType;
62
+ private $Latitude;
63
+ private $Longitude;
64
+ /**#@-*/
65
+
66
+ /**
67
+ * @access private
68
+ * @var integer
69
+ */
70
+ private $TaxRegionId = 0;
71
+
72
+
73
+ /**#@+
74
+ * Accessor
75
+ * @access public
76
+ * @return string
77
+ */
78
+ public function getAddressCode() { return $this->AddressCode; }
79
+ public function getLine1() { return $this->Line1; }
80
+ public function getLine2() { return $this->Line2; }
81
+ public function getLine3() { return $this->Line3; }
82
+ public function getCity() { return $this->City; }
83
+ public function getRegion() { return $this->Region; }
84
+ public function getPostalCode() { return $this->PostalCode; }
85
+ public function getCountry() { return $this->Country; }
86
+ /**#@-*/
87
+
88
+ /**
89
+ * Accessor
90
+ * @access public
91
+ * @return integer
92
+ */
93
+ public function getTaxRegionId() { return $this->TaxRegionId; }
94
+
95
+ /**
96
+ * Compare Addresses
97
+ * @access public
98
+ * @param Address
99
+ * @return boolean
100
+ */
101
+
102
+ public function equals(&$other)
103
+ {
104
+ return $this === $other || (
105
+ strcmp($this->AddressCode , $other->AddressCode) == 0 &&
106
+ strcmp($this->Line1 , $other->Line1) == 0 &&
107
+ strcmp($this->Line2 , $other->Line2) == 0 &&
108
+ strcmp($this->Line3 , $other->Line3) == 0 &&
109
+ strcmp($this->City , $other->City) == 0 &&
110
+ strcmp($this->Region , $other->Region) == 0 &&
111
+ strcmp($this->PostalCode , $other->PostalCode) == 0 &&
112
+ strcmp($this->Country , $other->Country) == 0 &&
113
+ $this->TaxRegionId === $other->TaxRegionId
114
+ );
115
+ }
116
+
117
+
118
+
119
+ /**
120
+ * Address line 4.
121
+ *
122
+ * @return line4 - Address line 4
123
+ */
124
+
125
+ public function getLine4() { return $this->Line4; }
126
+
127
+ /**
128
+ * County Name.
129
+ *
130
+ * @return county - County Name
131
+ */
132
+
133
+ public function getCounty() { return $this->County; }
134
+
135
+ /**
136
+ * Federal Information Processing Standards Code (USA).
137
+ * <p> This is a unique code representing each geographic combination of state, county, and city.
138
+ * The code is made up of the Federal Information Processing Code (FIPS) that uniquely identifies each state, county, and city in the U.S.
139
+ * See <a href="http://www.census.gov/geo/www/fips/fips.html">Federal Information Processing Standards (FIPS) Codes</a> for more details.
140
+ * <table>
141
+ * <tr>
142
+ * <th>Digits</th>
143
+ * <th>Description</th>
144
+ * </tr>
145
+ * <tr>
146
+ * <td>1-2</td>
147
+ * <td>State code</td>
148
+ * </tr>
149
+ * <tr>
150
+ * <td>3-5</td><td>County code</td>
151
+ * </tr>
152
+ * <tr>
153
+ * <td>6-10</td><td>City code</td>
154
+ * </tr>
155
+ * </table>
156
+ *
157
+ * @return fipsCode
158
+ */
159
+
160
+ public function getFipsCode() { return $this->FipsCode; }
161
+
162
+ /**
163
+ * The carrier route associated with the input address (USA).
164
+ * <p>The CarrierRoute Property is a 4 character string set
165
+ * after a successful return from the VerifyAddress Method.
166
+ * <p>The first character of this property is always alphabetic,
167
+ * and the last three characters are numeric. For example,
168
+ * "R001" or "C027" would be typical carrier routes. The
169
+ * alphabetic letter indicates the type of delivery associated
170
+ * with this address.
171
+ * <table>
172
+ * <tr>
173
+ * <th>Term</th>
174
+ *
175
+ * <th>Description</th>
176
+ * </tr>
177
+ * <tr>
178
+ * <td>B</td>
179
+ * <td>PO Box</td>
180
+ * </tr>
181
+ * <tr>
182
+ * <td>C</td>
183
+ * <td>City Delivery</td>
184
+ * </tr>
185
+ * <tr>
186
+ * <td>G</td>
187
+ * <td>General Delivery</td>
188
+ * </tr>
189
+ * <tr>
190
+ * <td>H</td>
191
+ * <td>Highway Contract</td>
192
+ * </tr>
193
+ * <tr>
194
+ * <td>R</td>
195
+ * <td>Rural Route</td>
196
+ * </tr>
197
+ * </table>
198
+ *
199
+ * @return carrierRoute
200
+ */
201
+
202
+ public function getCarrierRoute() { return $this->CarrierRoute; }
203
+
204
+ /**
205
+ * A 12-digit POSTNet barcode (USA).
206
+ * <table>
207
+ * <tr>
208
+ * <th>Digits</th>
209
+ * <th>Description</th>
210
+ * </tr>
211
+ * <tr>
212
+ * <td>1-5<td><td>ZIP Code</td>
213
+ * </tr>
214
+ * <tr>
215
+ * <td>6-9<td><td>Plus4 code</td>
216
+ * </tr>
217
+ * <tr>
218
+ * <td>10-11<td><td>Delivery point</td>
219
+ * </tr>
220
+ * <tr>
221
+ * <td>12<td><td>Check digit</td>
222
+ * </tr>
223
+ * </table>
224
+ *
225
+ * @return postNet
226
+ */
227
+
228
+ public function getPostNet() { return $this->PostNet; }
229
+
230
+ /**
231
+ * Address Type - The type of address that was coded
232
+ * (PO Box, Rural Route, and so on), using the input address.
233
+ *
234
+ * <table>
235
+ * <tr>
236
+ * <th>Code</th>
237
+ * <th>Type</th>
238
+ * </tr>
239
+ * <tr>
240
+ * <td>F<td><td>Firm or company address</td>
241
+ * </tr>
242
+ * <tr>
243
+ * <td>G<td><td>General Delivery address</td>
244
+ * </tr>
245
+ * <tr>
246
+ * <td>H<td><td>High-rise or business complexs</td>
247
+ * </tr>
248
+ * <tr>
249
+ * <td>P<td><td>PO Box address</td>
250
+ * </tr>
251
+ * <tr>
252
+ * <td>R<td><td>Rural route address</td>
253
+ * </tr>
254
+ * <tr>
255
+ * <td>S<td><td>Street or residential address</td>
256
+ * </tr>
257
+ * </table>
258
+ *
259
+ * @see AddressType
260
+ * @return string
261
+ */
262
+
263
+ public function getAddressType() { return $this->AddressType; }
264
+
265
+ /**
266
+ * Gets the latitude value for this ValidAddress.
267
+ *
268
+ * @return latitude
269
+ */
270
+
271
+ public function getLatitude() { return $this->Latitude; }
272
+
273
+ /**
274
+ * Gets the longitude value for this ValidAddress.
275
+ *
276
+ * @return longitude
277
+ */
278
+
279
+ public function getLongitude() { return $this->Longitude; }
280
+
281
+ // mutators
282
+
283
+ /**#@+
284
+ * Mutator
285
+ * @access public
286
+ * @var string
287
+ * @return Address
288
+ */
289
+ public function setAddressCode($value) { $this->AddressCode = $value; return $this; }
290
+ public function setLine1($value) { $this->Line1 = $value; return $this; }
291
+ public function setLine2($value) { $this->Line2 = $value; return $this; }
292
+ public function setLine3($value) { $this->Line3 = $value; return $this; }
293
+ public function setCity($value) { $this->City = $value; return $this; }
294
+ public function setRegion($value) { $this->Region = $value; return $this; }
295
+ public function setPostalCode($value) { $this->PostalCode = $value; return $this; }
296
+ public function setCountry($value) { $this->Country = $value; return $this; }
297
+ /**#@-*/
298
+
299
+ /**
300
+ * Mutator
301
+ * @access public
302
+ * @param integer
303
+ * @return Address
304
+ */
305
+ public function setTaxRegionId($value) { $this->TaxRegionId = $value; return $this; }
306
+ /**
307
+ * Address line 4.
308
+ *
309
+ * @param line4 - Address line 4
310
+ * @var string
311
+ */
312
+
313
+ public function setLine4($value) { $this->Line4 = $value; return $this; }
314
+
315
+ /**
316
+ * County Name.
317
+ *
318
+ * @param county - County Name
319
+ * @var string
320
+ */
321
+
322
+ public function setCounty($value) { $this->County= $value; return $this; }
323
+
324
+ /**
325
+ * Federal Information Processing Standards Code (USA).
326
+ * <p> This is a unique code representing each geographic combination of state, county, and city.
327
+ * The code is made up of the Federal Information Processing Code (FIPS) that uniquely identifies each state, county, and city in the U.S.
328
+ * See <a href="http://www.census.gov/geo/www/fips/fips.html">Federal Information Processing Standards (FIPS) Codes</a> for more details.
329
+ * <table>
330
+ * <tr>
331
+ * <th>Digits</th>
332
+ * <th>Description</th>
333
+ * </tr>
334
+ * <tr>
335
+ * <td>1-2</td>
336
+ * <td>State code</td>
337
+ * </tr>
338
+ * <tr>
339
+ * <td>3-5</td><td>County code</td>
340
+ * </tr>
341
+ * <tr>
342
+ * <td>6-10</td><td>City code</td>
343
+ * </tr>
344
+ * </table>
345
+ *
346
+ * @param fipsCode
347
+ * @var string
348
+ */
349
+
350
+ public function setFipsCode($value) { $this->FipsCode= $value; return $this; }
351
+
352
+ /**
353
+ * The carrier route associated with the input address (USA).
354
+ * <p>The CarrierRoute Property is a 4 character string set
355
+ * after a successful return from the VerifyAddress Method.
356
+ * <p>The first character of this property is always alphabetic,
357
+ * and the last three characters are numeric. For example,
358
+ * "R001" or "C027" would be typical carrier routes. The
359
+ * alphabetic letter indicates the type of delivery associated
360
+ * with this address.
361
+ * <table>
362
+ * <tr>
363
+ * <th>Term</th>
364
+ *
365
+ * <th>Description</th>
366
+ * </tr>
367
+ * <tr>
368
+ * <td>B</td>
369
+ * <td>PO Box</td>
370
+ * </tr>
371
+ * <tr>
372
+ * <td>C</td>
373
+ * <td>City Delivery</td>
374
+ * </tr>
375
+ * <tr>
376
+ * <td>G</td>
377
+ * <td>General Delivery</td>
378
+ * </tr>
379
+ * <tr>
380
+ * <td>H</td>
381
+ * <td>Highway Contract</td>
382
+ * </tr>
383
+ * <tr>
384
+ * <td>R</td>
385
+ * <td>Rural Route</td>
386
+ * </tr>
387
+ * </table>
388
+ *
389
+ * @param carrierRoute
390
+ * @var string
391
+ */
392
+
393
+ public function setCarrierRoute($value) { $this->CarrierRoute= $value; return $this; }
394
+
395
+ /**
396
+ * A 12-digit POSTNet barcode (USA).
397
+ * <table>
398
+ * <tr>
399
+ * <th>Digits</th>
400
+ * <th>Description</th>
401
+ * </tr>
402
+ * <tr>
403
+ * <td>1-5<td><td>ZIP Code</td>
404
+ * </tr>
405
+ * <tr>
406
+ * <td>6-9<td><td>Plus4 code</td>
407
+ * </tr>
408
+ * <tr>
409
+ * <td>10-11<td><td>Delivery point</td>
410
+ * </tr>
411
+ * <tr>
412
+ * <td>12<td><td>Check digit</td>
413
+ * </tr>
414
+ * </table>
415
+ *
416
+ * @param postNet
417
+ * @var string
418
+ */
419
+
420
+ public function setPostNet($value) { $this->PostNet= $value; return $this; }
421
+
422
+ /**
423
+ * Address Type - The type of address that was coded
424
+ * (PO Box, Rural Route, and so on), using the input address.
425
+ *
426
+ * <table>
427
+ * <tr>
428
+ * <th>Code</th>
429
+ * <th>Type</th>
430
+ * </tr>
431
+ * <tr>
432
+ * <td>F<td><td>Firm or company address</td>
433
+ * </tr>
434
+ * <tr>
435
+ * <td>G<td><td>General Delivery address</td>
436
+ * </tr>
437
+ * <tr>
438
+ * <td>H<td><td>High-rise or business complexs</td>
439
+ * </tr>
440
+ * <tr>
441
+ * <td>P<td><td>PO Box address</td>
442
+ * </tr>
443
+ * <tr>
444
+ * <td>R<td><td>Rural route address</td>
445
+ * </tr>
446
+ * <tr>
447
+ * <td>S<td><td>Street or residential address</td>
448
+ * </tr>
449
+ * </table>
450
+ *
451
+ * @see AddressType
452
+ * @param addressType
453
+ * @var string
454
+ */
455
+
456
+ public function setAddressType($value) { $this->AddressType= $value; return $this; }
457
+
458
+ /**
459
+ * Sets the latitude value for this ValidAddress.
460
+ *
461
+ * @param latitude
462
+ */
463
+
464
+ public function setLatitude($value) { $this->Latitude= $value; return $this;}
465
+
466
+ /**
467
+ * Sets the longitude value for this ValidAddress.
468
+ *
469
+ * @param longitude
470
+ */
471
+
472
+ public function setLongitude($value) { $this->Longitude= $value; return $this; }
473
+
474
+
475
+
476
+ }
477
+
478
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/ValidateRequest.class.php ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ValidateRequest.class.php
4
+ * @package Address
5
+ */
6
+
7
+ /**
8
+ * Data wrapper used internally to pass arguments within {@link AddressServiceSoap#validate}. End users should not need to use this class.
9
+ *
10
+ * <pre>
11
+ * <b>Example:</b>
12
+ * $svc = new AddressServiceSoap();
13
+ *
14
+ * $address = new Address();
15
+ * $address->setLine1("900 Winslow Way");
16
+ * $address->setCity("Bainbridge Island");
17
+ * $address->setRegion("WA");
18
+ * $address->setPostalCode("98110");
19
+ *
20
+ * ValidateRequest validateRequest = new ValidateRequest();
21
+ * validateRequest.setAddress(address);
22
+ * validateRequest.setTextCase(TextCase.Upper);
23
+ *
24
+ * ValidateResult result = svc.validate(validateRequest);
25
+ * ArrayOfValidAddress arrValids = result.getValidAddresses();
26
+ * int numAddresses = (arrValids == null ||
27
+ * arrValids.getValidAddress() == null ? 0 :
28
+ * arrValids.getValidAddress().length);
29
+ * System.out.println("Number of Addresses is " + numAddresses);
30
+ * </pre>
31
+ *
32
+ * @package Address
33
+ * @author tblanchard
34
+ * Copyright (c) 2006, Avalara. All rights reserved.
35
+ */
36
+
37
+ //public function validate($address, $textCase = 'Default', $coordinates = false)
38
+ //{
39
+ // $request = new ValidateRequest($address, ($textCase ? $textCase : TextCase::$Default), $coordinates);
40
+ // return $this->client->Validate(array('ValidateRequest' => $request))->ValidateResult;
41
+ //}
42
+
43
+
44
+ class ValidateRequest
45
+ {
46
+ private $Address;
47
+ private $TextCase = 'Default';
48
+ private $Coordinates = false;
49
+ private $Taxability=false;
50
+
51
+ public function __construct($address = null, $textCase = 'Default', $coordinates = false)
52
+ {
53
+ $this->setAddress($address);
54
+ $this->setTextCase($textCase);
55
+ $this->setCoordinates($coordinates);
56
+ }
57
+
58
+ // mutators
59
+ /**
60
+ * The address to Validate.
61
+ * <pre>
62
+ * <b>Example:</b>
63
+ * $address = new Address();
64
+ * $address->setLine1("900 Winslow Way");
65
+ * $address->setCity("Bainbridge Island");
66
+ * $address->setRegion("WA");
67
+ * $address->setPostalCode("98110");
68
+ *
69
+ * $validateRequest = new ValidateRequest();
70
+ * $validateRequest->setAddress(address);
71
+ * $validateRequest->setTextCase(TextCase::$Upper);
72
+ *
73
+ * $result = svc->validate(validateRequest);
74
+ * </pre>
75
+ *
76
+ * @var Address
77
+ */
78
+
79
+ public function setAddress(&$value) { $this->Address = $value; return $this; }
80
+
81
+ /**
82
+ * The casing to apply to the validated address(es).
83
+ * <pre>
84
+ * <b>Example:</b>
85
+ * <b>Example:</b>
86
+ * $address = new Address();
87
+ * $address->setLine1("900 Winslow Way");
88
+ * $address->setCity("Bainbridge Island");
89
+ * $address->setRegion("WA");
90
+ * $address->setPostalCode("98110");
91
+ *
92
+ * $validateRequest = new ValidateRequest();
93
+ * $validateRequest->setAddress(address);
94
+ * $validateRequest->setTextCase(TextCase::$Upper);
95
+ *
96
+ * $result = svc->validate(validateRequest);
97
+ * </pre>
98
+ *
99
+ * @var string
100
+ * @see TextCase
101
+ */
102
+
103
+ public function setTextCase($value)
104
+ {
105
+ if($value)
106
+ {
107
+ TextCase::Validate($value);
108
+ $this->TextCase = $value;
109
+ }
110
+ else
111
+ {
112
+ $this->TextCase = TextCase::$Default;
113
+ }
114
+ return $this;
115
+ }
116
+
117
+ /**
118
+ * Sets whether to fetch the coordinates value for this ValidateRequest.
119
+ * <p>
120
+ * True will return the @see ValidAddress#Latitude and @see ValidAddress#Longitude values for the @see ValidAddresses
121
+ * Default value is <b>false</b>
122
+ * </p>
123
+ * @var boolean
124
+ */
125
+ public function setCoordinates($value) { $this->Coordinates = ($value ? true : false); return $this; }
126
+
127
+
128
+ //@author:swetal
129
+ public function setTaxability($value)
130
+ {
131
+ $this->Taxability=$value;
132
+ }
133
+ // accessors
134
+ /**
135
+ * The address to Validate.
136
+ * <pre>
137
+ * <b>Example:</b>
138
+ * $address = new Address();
139
+ * $address->setLine1("900 Winslow Way");
140
+ * $address->setCity("Bainbridge Island");
141
+ * $address->setRegion("WA");
142
+ * $address->setPostalCode("98110");
143
+ *
144
+ * $validateRequest = new ValidateRequest();
145
+ * $validateRequest->setAddress(address);
146
+ * $validateRequest->setTextCase(TextCase::$Upper);
147
+ *
148
+ * $result = svc->validate(validateRequest);
149
+ * </pre>
150
+ *
151
+ * @return Address
152
+ */
153
+
154
+ public function getAddress() { return $this->Address; }
155
+
156
+ /**
157
+ * The casing to apply to the validated address(es).
158
+ * <pre>
159
+ * <b>Example:</b>
160
+ * <b>Example:</b>
161
+ * $address = new Address();
162
+ * $address->setLine1("900 Winslow Way");
163
+ * $address->setCity("Bainbridge Island");
164
+ * $address->setRegion("WA");
165
+ * $address->setPostalCode("98110");
166
+ *
167
+ * $validateRequest = new ValidateRequest();
168
+ * $validateRequest->setAddress(address);
169
+ * $validateRequest->setTextCase(TextCase::$Upper);
170
+ *
171
+ * $result = svc->validate(validateRequest);
172
+ * </pre>
173
+ *
174
+ * @return string
175
+ * @see TextCase
176
+ */
177
+
178
+ public function getTextCase() { return $this->TextCase; }
179
+
180
+ /**
181
+ * Returns whether to return the coordinates value for this ValidateRequest.
182
+ * <p>
183
+ * True will return the @see ValidAddress#Latitude and @see ValidAddress#Longitude values for the @see ValidAddresses
184
+ * Default value is <b>false</b>
185
+ * </p>
186
+ * @return boolean
187
+ */
188
+
189
+ public function getCoordinates() { return $this->Coordinates; }
190
+ }
191
+
192
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/ValidateResult.class.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ValidateResult.class.php
4
+ *
5
+ * @package Address
6
+ */
7
+
8
+ /**
9
+ * Contains an array of {@link ValidAddress} objects returned by {@link AddressServiceSoap#validate}
10
+ *
11
+ * <pre>
12
+ * $port = new AddressServiceSoap();
13
+ *
14
+ * $address = new Address();
15
+ * $address->setLine1("900 Winslow Way");
16
+ * $address->setLine2("Suite 130");
17
+ * $address->setCity("Bainbridge Is");
18
+ * $address->setRegion("WA");
19
+ * $address->setPostalCode("98110-2450");
20
+ *
21
+ * $result = $port->validate($address,TextCase::$Upper);
22
+ * $addresses = $result->ValidAddresses;
23
+ * print("Number of addresses returned is ". sizeoof($addresses));
24
+ *
25
+ * </pre>
26
+ * @package Address
27
+ * @see ValidAddress
28
+ * @author tblanchard
29
+ * Copyright (c) 2005, Avalara. All rights reserved.
30
+ */
31
+
32
+
33
+ class ValidateResult// extends BaseResult
34
+ {
35
+ /**
36
+ * Array of matching {@link ValidAddress}'s.
37
+ * @var array
38
+ */
39
+ private $ValidAddresses;
40
+
41
+ /**
42
+ * Method returning array of matching {@link ValidAddress}'s.
43
+ * @return array
44
+ */
45
+ public function getValidAddresses() { return EnsureIsArray($this->ValidAddresses->ValidAddress); }
46
+
47
+
48
+
49
+
50
+
51
+ /**
52
+ * @var string
53
+ */
54
+ private $TransactionId;
55
+ /**
56
+ * @var string must be one of the values defined in {@link SeverityLevel}.
57
+ */
58
+ private $ResultCode = 'Success';
59
+ /**
60
+ * @var array of Message.
61
+ */
62
+ private $Messages = array();
63
+
64
+ /**
65
+ * Accessor
66
+ * @return string
67
+ */
68
+ public function getTransactionId() { return $this->TransactionId; }
69
+ /**
70
+ * Accessor
71
+ * @return string
72
+ */
73
+ public function getResultCode() { return $this->ResultCode; }
74
+ /**
75
+ * Accessor
76
+ * @return array
77
+ */
78
+ public function getMessages() { return EnsureIsArray($this->Messages->Message); }
79
+
80
+ //@author:swetal
81
+
82
+ public function isTaxable()
83
+ {
84
+ return $this->Taxable;
85
+ }
86
+
87
+ }
88
+
89
+ ?>
app/code/community/OnePica/AvaTax/lib/classes/wsdl/Address.wsdl ADDED
@@ -0,0 +1,512 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://avatax.avalara.com/services" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://avatax.avalara.com/services" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
3
+ <wsdl:types>
4
+ <s:schema elementFormDefault="qualified" targetNamespace="http://avatax.avalara.com/services">
5
+ <s:element name="Validate">
6
+ <s:complexType>
7
+ <s:sequence>
8
+ <s:element minOccurs="0" maxOccurs="1" name="ValidateRequest" type="tns:ValidateRequest" />
9
+ </s:sequence>
10
+ </s:complexType>
11
+ </s:element>
12
+ <s:complexType name="BaseRequest" />
13
+ <s:complexType name="ValidateRequest">
14
+ <s:complexContent mixed="false">
15
+ <s:extension base="tns:BaseRequest">
16
+ <s:sequence>
17
+ <s:element minOccurs="0" maxOccurs="1" name="Address" type="tns:BaseAddress" />
18
+ <s:element minOccurs="1" maxOccurs="1" name="TextCase" type="tns:TextCase" />
19
+ <s:element minOccurs="1" maxOccurs="1" name="Coordinates" type="s:boolean" />
20
+ <s:element minOccurs="1" maxOccurs="1" name="Taxability" type="s:boolean" />
21
+ </s:sequence>
22
+ </s:extension>
23
+ </s:complexContent>
24
+ </s:complexType>
25
+ <s:complexType name="BaseAddress">
26
+ <s:sequence>
27
+ <s:element minOccurs="0" maxOccurs="1" name="AddressCode" type="s:string" />
28
+ <s:element minOccurs="0" maxOccurs="1" name="Line1" type="s:string" />
29
+ <s:element minOccurs="0" maxOccurs="1" name="Line2" type="s:string" />
30
+ <s:element minOccurs="0" maxOccurs="1" name="Line3" type="s:string" />
31
+ <s:element minOccurs="0" maxOccurs="1" name="City" type="s:string" />
32
+ <s:element minOccurs="0" maxOccurs="1" name="Region" type="s:string" />
33
+ <s:element minOccurs="0" maxOccurs="1" name="PostalCode" type="s:string" />
34
+ <s:element minOccurs="0" maxOccurs="1" name="Country" type="s:string" />
35
+ <s:element minOccurs="1" maxOccurs="1" name="TaxRegionId" type="s:int" />
36
+ </s:sequence>
37
+ </s:complexType>
38
+ <s:complexType name="ValidAddress">
39
+ <s:complexContent mixed="false">
40
+ <s:extension base="tns:BaseAddress">
41
+ <s:sequence>
42
+ <s:element minOccurs="0" maxOccurs="1" name="Line4" type="s:string" />
43
+ <s:element minOccurs="0" maxOccurs="1" name="County" type="s:string" />
44
+ <s:element minOccurs="0" maxOccurs="1" name="FipsCode" type="s:string" />
45
+ <s:element minOccurs="0" maxOccurs="1" name="CarrierRoute" type="s:string" />
46
+ <s:element minOccurs="0" maxOccurs="1" name="PostNet" type="s:string" />
47
+ <s:element minOccurs="0" maxOccurs="1" name="AddressType" type="s:string" />
48
+ <s:element minOccurs="0" maxOccurs="1" name="Latitude" type="s:string" />
49
+ <s:element minOccurs="0" maxOccurs="1" name="Longitude" type="s:string" />
50
+ </s:sequence>
51
+ </s:extension>
52
+ </s:complexContent>
53
+ </s:complexType>
54
+ <s:simpleType name="TextCase">
55
+ <s:restriction base="s:string">
56
+ <s:enumeration value="Default" />
57
+ <s:enumeration value="Upper" />
58
+ <s:enumeration value="Mixed" />
59
+ </s:restriction>
60
+ </s:simpleType>
61
+ <s:element name="ValidateResponse">
62
+ <s:complexType>
63
+ <s:sequence>
64
+ <s:element minOccurs="0" maxOccurs="1" name="ValidateResult" type="tns:ValidateResult" />
65
+ </s:sequence>
66
+ </s:complexType>
67
+ </s:element>
68
+ <s:complexType name="ValidateResult">
69
+ <s:complexContent mixed="false">
70
+ <s:extension base="tns:BaseResult">
71
+ <s:sequence>
72
+ <s:element minOccurs="0" maxOccurs="1" name="ValidAddresses" type="tns:ArrayOfValidAddress" />
73
+ <s:element minOccurs="1" maxOccurs="1" name="Taxable" type="s:boolean" />
74
+ </s:sequence>
75
+ </s:extension>
76
+ </s:complexContent>
77
+ </s:complexType>
78
+
79
+ <!-- Begin New Methods-->
80
+ <s:element name="SubmitBatch">
81
+ <s:complexType>
82
+ <s:sequence>
83
+ <s:element minOccurs="0" maxOccurs="1" name="SubmitAddressBatchRequest" type="tns:SubmitAddressBatchRequest" />
84
+ </s:sequence>
85
+ </s:complexType>
86
+ </s:element>
87
+ <s:complexType name="SubmitAddressBatchRequest">
88
+ <s:complexContent mixed="false">
89
+ <s:extension base="tns:BaseRequest">
90
+ <s:sequence>
91
+ <s:element minOccurs="0" maxOccurs="1" name="Requests" type="tns:AddressRequestList" />
92
+ </s:sequence>
93
+ </s:extension>
94
+ </s:complexContent>
95
+ </s:complexType>
96
+ <s:complexType name="AddressRequestList">
97
+ <s:choice minOccurs="0" maxOccurs="unbounded">
98
+ <s:element name="ValidateRequest" nillable="true" type="tns:ValidateRequest" />
99
+ </s:choice>
100
+ </s:complexType>
101
+ <s:element name="SubmitBatchResponse">
102
+ <s:complexType>
103
+ <s:sequence>
104
+ <s:element minOccurs="0" maxOccurs="1" name="SubmitBatchResult" type="tns:SubmitAddressBatchResult" />
105
+ </s:sequence>
106
+ </s:complexType>
107
+ </s:element>
108
+ <s:complexType name="SubmitAddressBatchResult">
109
+ <s:complexContent mixed="false">
110
+ <s:extension base="tns:BaseResult">
111
+ <s:sequence>
112
+ <s:element minOccurs="0" maxOccurs="1" name="BatchId" type="s:string" />
113
+ </s:sequence>
114
+ </s:extension>
115
+ </s:complexContent>
116
+ </s:complexType>
117
+
118
+ <s:element name="GetBatch">
119
+ <s:complexType>
120
+ <s:sequence>
121
+ <s:element minOccurs="0" maxOccurs="1" name="GetAddressBatchRequest" type="tns:GetAddressBatchRequest" />
122
+ </s:sequence>
123
+ </s:complexType>
124
+ </s:element>
125
+ <s:complexType name="GetAddressBatchRequest">
126
+ <s:complexContent mixed="false">
127
+ <s:extension base="tns:BaseRequest">
128
+ <s:sequence>
129
+ <s:element minOccurs="1" maxOccurs="1" name="BatchId" type="s:string" />
130
+ </s:sequence>
131
+ </s:extension>
132
+ </s:complexContent>
133
+ </s:complexType>
134
+ <s:element name="GetBatchResponse">
135
+ <s:complexType>
136
+ <s:sequence>
137
+ <s:element minOccurs="0" maxOccurs="1" name="GetBatchResult" type="tns:GetAddressBatchResult" />
138
+ </s:sequence>
139
+ </s:complexType>
140
+ </s:element>
141
+ <s:complexType name="GetAddressBatchResult">
142
+ <s:complexContent mixed="false">
143
+ <s:extension base="tns:BaseResult">
144
+ <s:sequence>
145
+ <s:element minOccurs="1" maxOccurs="1" name="BatchId" type="s:string" />
146
+ <s:element minOccurs="1" maxOccurs="1" name="BatchStatus" type="s:string" />
147
+ <s:element minOccurs="1" maxOccurs="1" name="RecordCount" type="s:int" />
148
+ <s:element minOccurs="1" maxOccurs="1" name="CurrentRecord" type="s:int" />
149
+ <s:element minOccurs="0" maxOccurs="1" name="Results" type="tns:AddressResultList" />
150
+ </s:sequence>
151
+ </s:extension>
152
+ </s:complexContent>
153
+ </s:complexType>
154
+ <s:complexType name="AddressResultList">
155
+ <s:choice minOccurs="0" maxOccurs="unbounded">
156
+ <s:element name="ValidateResult" nillable="true" type="tns:ValidateResult" />
157
+ </s:choice>
158
+ </s:complexType>
159
+
160
+ <s:element name="CancelBatch">
161
+ <s:complexType>
162
+ <s:sequence>
163
+ <s:element minOccurs="0" maxOccurs="1" name="CancelAddressBatchRequest" type="tns:CancelAddressBatchRequest" />
164
+ </s:sequence>
165
+ </s:complexType>
166
+ </s:element>
167
+ <s:complexType name="CancelAddressBatchRequest">
168
+ <s:complexContent mixed="false">
169
+ <s:extension base="tns:BaseRequest">
170
+ <s:sequence>
171
+ <s:element minOccurs="1" maxOccurs="1" name="BatchId" type="s:string" />
172
+ </s:sequence>
173
+ </s:extension>
174
+ </s:complexContent>
175
+ </s:complexType>
176
+ <s:element name="CancelBatchResponse">
177
+ <s:complexType>
178
+ <s:sequence>
179
+ <s:element minOccurs="0" maxOccurs="1" name="CancelBatchResult" type="tns:CancelAddressBatchResult" />
180
+ </s:sequence>
181
+ </s:complexType>
182
+ </s:element>
183
+ <s:complexType name="CancelAddressBatchResult">
184
+ <s:complexContent mixed="false">
185
+ <s:extension base="tns:BaseResult" />
186
+ </s:complexContent>
187
+ </s:complexType>
188
+ <!-- End New Methods -->
189
+
190
+ <s:complexType name="BaseResult">
191
+ <s:sequence>
192
+ <s:element minOccurs="0" maxOccurs="1" name="TransactionId" type="s:string" />
193
+ <s:element minOccurs="1" maxOccurs="1" name="ResultCode" type="tns:SeverityLevel" />
194
+ <s:element minOccurs="0" maxOccurs="1" name="Messages" type="tns:ArrayOfMessage" />
195
+ </s:sequence>
196
+ </s:complexType>
197
+ <s:simpleType name="SeverityLevel">
198
+ <s:restriction base="s:string">
199
+ <s:enumeration value="Success" />
200
+ <s:enumeration value="Warning" />
201
+ <s:enumeration value="Error" />
202
+ <s:enumeration value="Exception" />
203
+ </s:restriction>
204
+ </s:simpleType>
205
+ <s:complexType name="ArrayOfMessage">
206
+ <s:sequence>
207
+ <s:element minOccurs="0" maxOccurs="unbounded" name="Message" nillable="true" type="tns:Message" />
208
+ </s:sequence>
209
+ </s:complexType>
210
+ <s:complexType name="Message">
211
+ <s:sequence>
212
+ <s:element minOccurs="0" maxOccurs="1" name="Summary" type="s:string" />
213
+ <s:element minOccurs="0" maxOccurs="1" name="Details" type="s:string" />
214
+ <s:element minOccurs="0" maxOccurs="1" name="HelpLink" type="s:string" />
215
+ <s:element minOccurs="0" maxOccurs="1" name="RefersTo" type="s:string" />
216
+ <s:element minOccurs="1" maxOccurs="1" name="Severity" type="tns:SeverityLevel" />
217
+ <s:element minOccurs="0" maxOccurs="1" name="Source" type="s:string" />
218
+ </s:sequence>
219
+ <s:attribute name="Name" type="s:string" />
220
+ </s:complexType>
221
+ <s:complexType name="ArrayOfValidAddress">
222
+ <s:sequence>
223
+ <s:element minOccurs="0" maxOccurs="unbounded" name="ValidAddress" nillable="true" type="tns:ValidAddress" />
224
+ </s:sequence>
225
+ </s:complexType>
226
+ <s:element name="Profile" type="tns:Profile" />
227
+ <s:complexType name="Profile">
228
+ <s:sequence>
229
+ <s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" />
230
+ <s:element minOccurs="0" maxOccurs="1" name="Client" type="s:string" />
231
+ <s:element minOccurs="0" maxOccurs="1" name="Adapter" type="s:string" />
232
+ <s:element minOccurs="0" maxOccurs="1" name="Machine" type="s:string" />
233
+ </s:sequence>
234
+ <s:anyAttribute />
235
+ </s:complexType>
236
+
237
+ <s:element name="Ping">
238
+ <s:complexType>
239
+ <s:sequence>
240
+ <s:element minOccurs="0" maxOccurs="1" name="Message" type="s:string" />
241
+ </s:sequence>
242
+ </s:complexType>
243
+ </s:element>
244
+ <s:element name="PingResponse">
245
+ <s:complexType>
246
+ <s:sequence>
247
+ <s:element minOccurs="0" maxOccurs="1" name="PingResult" type="tns:PingResult" />
248
+ </s:sequence>
249
+ </s:complexType>
250
+ </s:element>
251
+ <s:complexType name="PingResult">
252
+ <s:complexContent mixed="false">
253
+ <s:extension base="tns:BaseResult">
254
+ <s:sequence>
255
+ <s:element minOccurs="0" maxOccurs="1" name="Version" type="s:string" />
256
+ </s:sequence>
257
+ </s:extension>
258
+ </s:complexContent>
259
+ </s:complexType>
260
+ <s:element name="IsAuthorized">
261
+ <s:complexType>
262
+ <s:sequence>
263
+ <s:element minOccurs="0" maxOccurs="1" name="Operations" type="s:string" />
264
+ </s:sequence>
265
+ </s:complexType>
266
+ </s:element>
267
+ <s:element name="IsAuthorizedResponse">
268
+ <s:complexType>
269
+ <s:sequence>
270
+ <s:element minOccurs="0" maxOccurs="1" name="IsAuthorizedResult" type="tns:IsAuthorizedResult" />
271
+ </s:sequence>
272
+ </s:complexType>
273
+ </s:element>
274
+ <s:complexType name="IsAuthorizedResult">
275
+ <s:complexContent mixed="false">
276
+ <s:extension base="tns:BaseResult">
277
+ <s:sequence>
278
+ <s:element minOccurs="0" maxOccurs="1" name="Operations" type="s:string" />
279
+ <s:element minOccurs="1" maxOccurs="1" name="Expires" type="s:dateTime" />
280
+ </s:sequence>
281
+ </s:extension>
282
+ </s:complexContent>
283
+ </s:complexType>
284
+ </s:schema>
285
+ </wsdl:types>
286
+ <wsdl:message name="ValidateSoapIn">
287
+ <wsdl:part name="parameters" element="tns:Validate" />
288
+ </wsdl:message>
289
+ <wsdl:message name="ValidateSoapOut">
290
+ <wsdl:part name="parameters" element="tns:ValidateResponse" />
291
+ </wsdl:message>
292
+ <wsdl:message name="ValidateProfile">
293
+ <wsdl:part name="Profile" element="tns:Profile" />
294
+ </wsdl:message>
295
+ <wsdl:message name="PingSoapIn">
296
+ <wsdl:part name="parameters" element="tns:Ping" />
297
+ </wsdl:message>
298
+ <wsdl:message name="PingSoapOut">
299
+ <wsdl:part name="parameters" element="tns:PingResponse" />
300
+ </wsdl:message>
301
+ <wsdl:message name="PingProfile">
302
+ <wsdl:part name="Profile" element="tns:Profile" />
303
+ </wsdl:message>
304
+ <wsdl:message name="IsAuthorizedSoapIn">
305
+ <wsdl:part name="parameters" element="tns:IsAuthorized" />
306
+ </wsdl:message>
307
+ <wsdl:message name="IsAuthorizedSoapOut">
308
+ <wsdl:part name="parameters" element="tns:IsAuthorizedResponse" />
309
+ </wsdl:message>
310
+ <wsdl:message name="IsAuthorizedProfile">
311
+ <wsdl:part name="Profile" element="tns:Profile" />
312
+ </wsdl:message>
313
+ <!--New Methods Begin-->
314
+ <wsdl:message name="SubmitBatchSoapIn">
315
+ <wsdl:part name="parameters" element="tns:SubmitBatch" />
316
+ </wsdl:message>
317
+ <wsdl:message name="SubmitBatchSoapOut">
318
+ <wsdl:part name="parameters" element="tns:SubmitBatchResponse" />
319
+ </wsdl:message>
320
+ <wsdl:message name="SubmitBatchProfile">
321
+ <wsdl:part name="Profile" element="tns:Profile" />
322
+ </wsdl:message>
323
+ <wsdl:message name="GetBatchSoapIn">
324
+ <wsdl:part name="parameters" element="tns:GetBatch" />
325
+ </wsdl:message>
326
+ <wsdl:message name="GetBatchSoapOut">
327
+ <wsdl:part name="parameters" element="tns:GetBatchResponse" />
328
+ </wsdl:message>
329
+ <wsdl:message name="GetBatchProfile">
330
+ <wsdl:part name="Profile" element="tns:Profile" />
331
+ </wsdl:message>
332
+ <wsdl:message name="CancelBatchSoapIn">
333
+ <wsdl:part name="parameters" element="tns:CancelBatch" />
334
+ </wsdl:message>
335
+ <wsdl:message name="CancelBatchSoapOut">
336
+ <wsdl:part name="parameters" element="tns:CancelBatchResponse" />
337
+ </wsdl:message>
338
+ <wsdl:message name="CancelBatchProfile">
339
+ <wsdl:part name="Profile" element="tns:Profile" />
340
+ </wsdl:message>
341
+ <!--New Methods End-->
342
+ <wsdl:portType name="AddressSvcSoap">
343
+ <wsdl:operation name="Validate">
344
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Validate an Address</wsdl:documentation>
345
+ <wsdl:input message="tns:ValidateSoapIn" />
346
+ <wsdl:output message="tns:ValidateSoapOut" />
347
+ </wsdl:operation>
348
+ <wsdl:operation name="SubmitBatch">
349
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Submits a batch of AddressSvc requests to be processed.</wsdl:documentation>
350
+ <wsdl:input message="tns:SubmitBatchSoapIn" />
351
+ <wsdl:output message="tns:SubmitBatchSoapOut" />
352
+ </wsdl:operation>
353
+ <wsdl:operation name="GetBatch">
354
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Gets the status and results of a submitted batch.</wsdl:documentation>
355
+ <wsdl:input message="tns:GetBatchSoapIn" />
356
+ <wsdl:output message="tns:GetBatchSoapOut" />
357
+ </wsdl:operation>
358
+ <wsdl:operation name="CancelBatch">
359
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Cancels an incomplete batch operation.</wsdl:documentation>
360
+ <wsdl:input message="tns:CancelBatchSoapIn" />
361
+ <wsdl:output message="tns:CancelBatchSoapOut" />
362
+ </wsdl:operation>
363
+ <wsdl:operation name="Ping">
364
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Tests connectivity and version of the service</wsdl:documentation>
365
+ <wsdl:input message="tns:PingSoapIn" />
366
+ <wsdl:output message="tns:PingSoapOut" />
367
+ </wsdl:operation>
368
+ <wsdl:operation name="IsAuthorized">
369
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Checks authentication and authorization to one or more operations on the service.</wsdl:documentation>
370
+ <wsdl:input message="tns:IsAuthorizedSoapIn" />
371
+ <wsdl:output message="tns:IsAuthorizedSoapOut" />
372
+ </wsdl:operation>
373
+ </wsdl:portType>
374
+ <wsdl:binding name="AddressSvcSoap" type="tns:AddressSvcSoap">
375
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
376
+ <wsdl:operation name="Validate">
377
+ <soap:operation soapAction="http://avatax.avalara.com/services/Validate" style="document" />
378
+ <wsdl:input>
379
+ <soap:body use="literal" />
380
+ <soap:header message="tns:ValidateProfile" part="Profile" use="literal" />
381
+ </wsdl:input>
382
+ <wsdl:output>
383
+ <soap:body use="literal" />
384
+ </wsdl:output>
385
+ </wsdl:operation>
386
+ <!--New Methods Begin-->
387
+ <wsdl:operation name="SubmitBatch">
388
+ <soap:operation soapAction="http://avatax.avalara.com/services/SubmitBatch" style="document" />
389
+ <wsdl:input>
390
+ <soap:body use="literal" />
391
+ <soap:header message="tns:SubmitBatchProfile" part="Profile" use="literal" />
392
+ </wsdl:input>
393
+ <wsdl:output>
394
+ <soap:body use="literal" />
395
+ </wsdl:output>
396
+ </wsdl:operation>
397
+ <wsdl:operation name="GetBatch">
398
+ <soap:operation soapAction="http://avatax.avalara.com/services/GetBatch" style="document" />
399
+ <wsdl:input>
400
+ <soap:body use="literal" />
401
+ <soap:header message="tns:GetBatchProfile" part="Profile" use="literal" />
402
+ </wsdl:input>
403
+ <wsdl:output>
404
+ <soap:body use="literal" />
405
+ </wsdl:output>
406
+ </wsdl:operation>
407
+ <wsdl:operation name="CancelBatch">
408
+ <soap:operation soapAction="http://avatax.avalara.com/services/CancelBatch" style="document" />
409
+ <wsdl:input>
410
+ <soap:body use="literal" />
411
+ <soap:header message="tns:CancelBatchProfile" part="Profile" use="literal" />
412
+ </wsdl:input>
413
+ <wsdl:output>
414
+ <soap:body use="literal" />
415
+ </wsdl:output>
416
+ </wsdl:operation>
417
+ <!--New Methods End-->
418
+ <wsdl:operation name="Ping">
419
+ <soap:operation soapAction="http://avatax.avalara.com/services/Ping" style="document" />
420
+ <wsdl:input>
421
+ <soap:body use="literal" />
422
+ <soap:header message="tns:PingProfile" part="Profile" use="literal" />
423
+ </wsdl:input>
424
+ <wsdl:output>
425
+ <soap:body use="literal" />
426
+ </wsdl:output>
427
+ </wsdl:operation>
428
+ <wsdl:operation name="IsAuthorized">
429
+ <soap:operation soapAction="http://avatax.avalara.com/services/IsAuthorized" style="document" />
430
+ <wsdl:input>
431
+ <soap:body use="literal" />
432
+ <soap:header message="tns:IsAuthorizedProfile" part="Profile" use="literal" />
433
+ </wsdl:input>
434
+ <wsdl:output>
435
+ <soap:body use="literal" />
436
+ </wsdl:output>
437
+ </wsdl:operation>
438
+ </wsdl:binding>
439
+ <wsdl:binding name="AddressSvcSoap12" type="tns:AddressSvcSoap">
440
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
441
+ <wsdl:operation name="Validate">
442
+ <soap12:operation soapAction="http://avatax.avalara.com/services/Validate" style="document" />
443
+ <wsdl:input>
444
+ <soap12:body use="literal" />
445
+ <soap12:header message="tns:ValidateProfile" part="Profile" use="literal" />
446
+ </wsdl:input>
447
+ <wsdl:output>
448
+ <soap12:body use="literal" />
449
+ </wsdl:output>
450
+ </wsdl:operation>
451
+ <wsdl:operation name="Ping">
452
+ <soap12:operation soapAction="http://avatax.avalara.com/services/Ping" style="document" />
453
+ <wsdl:input>
454
+ <soap12:body use="literal" />
455
+ <soap12:header message="tns:PingProfile" part="Profile" use="literal" />
456
+ </wsdl:input>
457
+ <wsdl:output>
458
+ <soap12:body use="literal" />
459
+ </wsdl:output>
460
+ </wsdl:operation>
461
+ <wsdl:operation name="IsAuthorized">
462
+ <soap12:operation soapAction="http://avatax.avalara.com/services/IsAuthorized" style="document" />
463
+ <wsdl:input>
464
+ <soap12:body use="literal" />
465
+ <soap12:header message="tns:IsAuthorizedProfile" part="Profile" use="literal" />
466
+ </wsdl:input>
467
+ <wsdl:output>
468
+ <soap12:body use="literal" />
469
+ </wsdl:output>
470
+ </wsdl:operation>
471
+ <!--New Methods Begin-->
472
+ <wsdl:operation name="SubmitBatch">
473
+ <soap12:operation soapAction="http://avatax.avalara.com/services/SubmitBatch" style="document" />
474
+ <wsdl:input>
475
+ <soap12:body use="literal" />
476
+ <soap12:header message="tns:SubmitBatchProfile" part="Profile" use="literal" />
477
+ </wsdl:input>
478
+ <wsdl:output>
479
+ <soap12:body use="literal" />
480
+ </wsdl:output>
481
+ </wsdl:operation>
482
+ <wsdl:operation name="GetBatch">
483
+ <soap12:operation soapAction="http://avatax.avalara.com/services/GetBatch" style="document" />
484
+ <wsdl:input>
485
+ <soap12:body use="literal" />
486
+ <soap12:header message="tns:GetBatchProfile" part="Profile" use="literal" />
487
+ </wsdl:input>
488
+ <wsdl:output>
489
+ <soap12:body use="literal" />
490
+ </wsdl:output>
491
+ </wsdl:operation>
492
+ <wsdl:operation name="CancelBatch">
493
+ <soap12:operation soapAction="http://avatax.avalara.com/services/CancelBatch" style="document" />
494
+ <wsdl:input>
495
+ <soap12:body use="literal" />
496
+ <soap12:header message="tns:CancelBatchProfile" part="Profile" use="literal" />
497
+ </wsdl:input>
498
+ <wsdl:output>
499
+ <soap12:body use="literal" />
500
+ </wsdl:output>
501
+ </wsdl:operation>
502
+ <!--New Methods End-->
503
+ </wsdl:binding>
504
+ <wsdl:service name="AddressSvc">
505
+ <wsdl:port name="AddressSvcSoap" binding="tns:AddressSvcSoap">
506
+ <soap:address location="http://localhost/avatax.services/Address/AddressSvc.asmx" />
507
+ </wsdl:port>
508
+ <wsdl:port name="AddressSvcSoap12" binding="tns:AddressSvcSoap12">
509
+ <soap12:address location="http://localhost/avatax.services/Address/AddressSvc.asmx" />
510
+ </wsdl:port>
511
+ </wsdl:service>
512
+ </wsdl:definitions>
app/code/community/OnePica/AvaTax/lib/classes/wsdl/BatchSvc.wsdl ADDED
@@ -0,0 +1,659 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://avatax.avalara.com/services" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://avatax.avalara.com/services" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
3
+ <wsdl:types>
4
+ <s:schema elementFormDefault="qualified" targetNamespace="http://avatax.avalara.com/services">
5
+ <s:element name="BatchFetch">
6
+ <s:complexType>
7
+ <s:sequence>
8
+ <s:element minOccurs="0" maxOccurs="1" name="FetchRequest" type="tns:FetchRequest"/>
9
+ </s:sequence>
10
+ </s:complexType>
11
+ </s:element>
12
+ <s:complexType name="FetchRequest">
13
+ <s:sequence>
14
+ <s:element minOccurs="0" maxOccurs="1" name="Fields" type="s:string"/>
15
+ <s:element minOccurs="0" maxOccurs="1" name="Filters" type="s:string"/>
16
+ <s:element minOccurs="0" maxOccurs="1" name="Sort" type="s:string"/>
17
+ <s:element minOccurs="1" maxOccurs="1" name="MaxCount" type="s:int"/>
18
+ <s:element minOccurs="1" maxOccurs="1" name="PageIndex" type="s:int"/>
19
+ <s:element minOccurs="1" maxOccurs="1" name="PageSize" type="s:int"/>
20
+ <s:element minOccurs="1" maxOccurs="1" name="RecordCount" type="s:int"/>
21
+ </s:sequence>
22
+ </s:complexType>
23
+ <s:element name="BatchFetchResponse">
24
+ <s:complexType>
25
+ <s:sequence>
26
+ <s:element minOccurs="0" maxOccurs="1" name="BatchFetchResult" type="tns:BatchFetchResult"/>
27
+ </s:sequence>
28
+ </s:complexType>
29
+ </s:element>
30
+ <s:complexType name="BatchFetchResult">
31
+ <s:complexContent mixed="false">
32
+ <s:extension base="tns:BaseResult">
33
+ <s:sequence>
34
+ <s:element minOccurs="0" maxOccurs="1" name="Batches" type="tns:ArrayOfBatch"/>
35
+ <s:element minOccurs="1" maxOccurs="1" name="RecordCount" type="s:int"/>
36
+ </s:sequence>
37
+ </s:extension>
38
+ </s:complexContent>
39
+ </s:complexType>
40
+ <s:complexType name="BaseResult">
41
+ <s:sequence>
42
+ <s:element minOccurs="0" maxOccurs="1" name="TransactionId" type="s:string"/>
43
+ <s:element minOccurs="1" maxOccurs="1" name="ResultCode" type="tns:SeverityLevel"/>
44
+ <s:element minOccurs="0" maxOccurs="1" name="Messages" type="tns:ArrayOfMessage"/>
45
+ </s:sequence>
46
+ </s:complexType>
47
+ <s:simpleType name="SeverityLevel">
48
+ <s:restriction base="s:string">
49
+ <s:enumeration value="Success"/>
50
+ <s:enumeration value="Warning"/>
51
+ <s:enumeration value="Error"/>
52
+ <s:enumeration value="Exception"/>
53
+ </s:restriction>
54
+ </s:simpleType>
55
+ <s:complexType name="ArrayOfMessage">
56
+ <s:sequence>
57
+ <s:element minOccurs="0" maxOccurs="unbounded" name="Message" nillable="true" type="tns:Message"/>
58
+ </s:sequence>
59
+ </s:complexType>
60
+ <s:complexType name="Message">
61
+ <s:sequence>
62
+ <s:element minOccurs="0" maxOccurs="1" name="Summary" type="s:string"/>
63
+ <s:element minOccurs="0" maxOccurs="1" name="Details" type="s:string"/>
64
+ <s:element minOccurs="0" maxOccurs="1" name="HelpLink" type="s:string"/>
65
+ <s:element minOccurs="0" maxOccurs="1" name="RefersTo" type="s:string"/>
66
+ <s:element minOccurs="1" maxOccurs="1" name="Severity" type="tns:SeverityLevel"/>
67
+ <s:element minOccurs="0" maxOccurs="1" name="Source" type="s:string"/>
68
+ </s:sequence>
69
+ <s:attribute name="Name" type="s:string"/>
70
+ </s:complexType>
71
+ <s:complexType name="ArrayOfBatch">
72
+ <s:sequence>
73
+ <s:element minOccurs="0" maxOccurs="unbounded" name="Batch" nillable="true" type="tns:Batch"/>
74
+ </s:sequence>
75
+ </s:complexType>
76
+ <s:complexType name="Batch">
77
+ <s:sequence>
78
+ <s:element minOccurs="1" maxOccurs="1" name="AccountId" type="s:int"/>
79
+ <s:element minOccurs="1" maxOccurs="1" name="BatchId" type="s:int"/>
80
+ <s:element minOccurs="0" maxOccurs="1" name="BatchStatusId" type="s:string"/>
81
+ <s:element minOccurs="0" maxOccurs="1" name="BatchTypeId" type="s:string"/>
82
+ <s:element minOccurs="1" maxOccurs="1" name="CompanyId" type="s:int"/>
83
+ <s:element minOccurs="1" maxOccurs="1" name="CreatedDate" type="s:dateTime"/>
84
+ <s:element minOccurs="1" maxOccurs="1" name="CreatedUserId" type="s:int"/>
85
+ <s:element minOccurs="1" maxOccurs="1" name="CompletedDate" type="s:dateTime"/>
86
+ <s:element minOccurs="0" maxOccurs="1" name="Files" type="tns:ArrayOfBatchFile"/>
87
+ <s:element minOccurs="1" maxOccurs="1" name="ModifiedDate" type="s:dateTime"/>
88
+ <s:element minOccurs="1" maxOccurs="1" name="ModifiedUserId" type="s:int"/>
89
+ <s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string"/>
90
+ <s:element minOccurs="0" maxOccurs="1" name="Options" type="s:string"/>
91
+ <s:element minOccurs="1" maxOccurs="1" name="RecordCount" type="s:int"/>
92
+ <s:element minOccurs="1" maxOccurs="1" name="CurrentRecord" type="s:int"/>
93
+ </s:sequence>
94
+ </s:complexType>
95
+ <s:complexType name="ArrayOfBatchFile">
96
+ <s:sequence>
97
+ <s:element minOccurs="0" maxOccurs="unbounded" name="BatchFile" nillable="true" type="tns:BatchFile"/>
98
+ </s:sequence>
99
+ </s:complexType>
100
+ <s:complexType name="BatchFile">
101
+ <s:sequence>
102
+ <s:element minOccurs="1" maxOccurs="1" name="BatchFileId" type="s:int"/>
103
+ <s:element minOccurs="1" maxOccurs="1" name="BatchId" type="s:int"/>
104
+ <s:element minOccurs="0" maxOccurs="1" name="Content" type="s:base64Binary"/>
105
+ <s:element minOccurs="0" maxOccurs="1" name="ContentType" type="s:string"/>
106
+ <s:element minOccurs="0" maxOccurs="1" name="Ext" type="s:string"/>
107
+ <s:element minOccurs="0" maxOccurs="1" name="FilePath" type="s:string"/>
108
+ <s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string"/>
109
+ <s:element minOccurs="1" maxOccurs="1" name="Size" type="s:int"/>
110
+ <s:element minOccurs="1" maxOccurs="1" name="ErrorCount" type="s:int"/>
111
+ </s:sequence>
112
+ </s:complexType>
113
+ <s:element name="Profile" type="tns:Profile"/>
114
+ <s:complexType name="Profile">
115
+ <s:sequence>
116
+ <s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string"/>
117
+ <s:element minOccurs="0" maxOccurs="1" name="Client" type="s:string"/>
118
+ <s:element minOccurs="0" maxOccurs="1" name="Adapter" type="s:string"/>
119
+ <s:element minOccurs="0" maxOccurs="1" name="Machine" type="s:string"/>
120
+ </s:sequence>
121
+ <s:anyAttribute/>
122
+ </s:complexType>
123
+ <s:element name="BatchSave">
124
+ <s:complexType>
125
+ <s:sequence>
126
+ <s:element minOccurs="0" maxOccurs="1" name="Batch" type="tns:Batch"/>
127
+ </s:sequence>
128
+ </s:complexType>
129
+ </s:element>
130
+ <s:element name="BatchSaveResponse">
131
+ <s:complexType>
132
+ <s:sequence>
133
+ <s:element minOccurs="0" maxOccurs="1" name="BatchSaveResult" type="tns:BatchSaveResult"/>
134
+ </s:sequence>
135
+ </s:complexType>
136
+ </s:element>
137
+ <s:complexType name="BatchSaveResult">
138
+ <s:complexContent mixed="false">
139
+ <s:extension base="tns:BaseResult">
140
+ <s:sequence>
141
+ <s:element minOccurs="1" maxOccurs="1" name="BatchId" type="s:int"/>
142
+ <s:element minOccurs="1" maxOccurs="1" name="EstimatedCompletion" type="s:dateTime"/>
143
+ </s:sequence>
144
+ </s:extension>
145
+ </s:complexContent>
146
+ </s:complexType>
147
+ <s:element name="AuditMessage" type="tns:AuditMessage"/>
148
+ <s:complexType name="AuditMessage">
149
+ <s:sequence>
150
+ <s:element minOccurs="0" maxOccurs="1" name="Message" type="s:string"/>
151
+ </s:sequence>
152
+ <s:anyAttribute/>
153
+ </s:complexType>
154
+ <s:element name="BatchDelete">
155
+ <s:complexType>
156
+ <s:sequence>
157
+ <s:element minOccurs="0" maxOccurs="1" name="DeleteRequest" type="tns:DeleteRequest"/>
158
+ </s:sequence>
159
+ </s:complexType>
160
+ </s:element>
161
+ <s:complexType name="DeleteRequest">
162
+ <s:complexContent mixed="false">
163
+ <s:extension base="tns:FilterRequest"/>
164
+ </s:complexContent>
165
+ </s:complexType>
166
+ <s:complexType name="FilterRequest">
167
+ <s:sequence>
168
+ <s:element minOccurs="0" maxOccurs="1" name="Filters" type="s:string"/>
169
+ <s:element minOccurs="1" maxOccurs="1" name="MaxCount" type="s:int"/>
170
+ </s:sequence>
171
+ </s:complexType>
172
+ <s:element name="BatchDeleteResponse">
173
+ <s:complexType>
174
+ <s:sequence>
175
+ <s:element minOccurs="0" maxOccurs="1" name="BatchDeleteResult" type="tns:DeleteResult"/>
176
+ </s:sequence>
177
+ </s:complexType>
178
+ </s:element>
179
+ <s:complexType name="DeleteResult">
180
+ <s:complexContent mixed="false">
181
+ <s:extension base="tns:FilterResult"/>
182
+ </s:complexContent>
183
+ </s:complexType>
184
+ <s:complexType name="FilterResult">
185
+ <s:complexContent mixed="false">
186
+ <s:extension base="tns:BaseResult">
187
+ <s:sequence>
188
+ <s:element minOccurs="1" maxOccurs="1" name="Count" type="s:int"/>
189
+ </s:sequence>
190
+ </s:extension>
191
+ </s:complexContent>
192
+ </s:complexType>
193
+ <s:element name="BatchProcess">
194
+ <s:complexType>
195
+ <s:sequence>
196
+ <s:element minOccurs="0" maxOccurs="1" name="BatchProcessRequest" type="tns:BatchProcessRequest"/>
197
+ </s:sequence>
198
+ </s:complexType>
199
+ </s:element>
200
+ <s:complexType name="BatchProcessRequest">
201
+ <s:complexContent mixed="false">
202
+ <s:extension base="tns:FilterRequest"/>
203
+ </s:complexContent>
204
+ </s:complexType>
205
+ <s:element name="BatchProcessResponse">
206
+ <s:complexType>
207
+ <s:sequence>
208
+ <s:element minOccurs="0" maxOccurs="1" name="BatchProcessResult" type="tns:BatchProcessResult"/>
209
+ </s:sequence>
210
+ </s:complexType>
211
+ </s:element>
212
+ <s:complexType name="BatchProcessResult">
213
+ <s:complexContent mixed="false">
214
+ <s:extension base="tns:FilterResult"/>
215
+ </s:complexContent>
216
+ </s:complexType>
217
+ <s:element name="BatchFileFetch">
218
+ <s:complexType>
219
+ <s:sequence>
220
+ <s:element minOccurs="0" maxOccurs="1" name="FetchRequest" type="tns:FetchRequest"/>
221
+ </s:sequence>
222
+ </s:complexType>
223
+ </s:element>
224
+ <s:element name="BatchFileFetchResponse">
225
+ <s:complexType>
226
+ <s:sequence>
227
+ <s:element minOccurs="0" maxOccurs="1" name="BatchFileFetchResult" type="tns:BatchFileFetchResult"/>
228
+ </s:sequence>
229
+ </s:complexType>
230
+ </s:element>
231
+ <s:complexType name="BatchFileFetchResult">
232
+ <s:complexContent mixed="false">
233
+ <s:extension base="tns:BaseResult">
234
+ <s:sequence>
235
+ <s:element minOccurs="0" maxOccurs="1" name="BatchFiles" type="tns:ArrayOfBatchFile"/>
236
+ <s:element minOccurs="1" maxOccurs="1" name="RecordCount" type="s:int"/>
237
+ </s:sequence>
238
+ </s:extension>
239
+ </s:complexContent>
240
+ </s:complexType>
241
+ <s:element name="BatchFileSave">
242
+ <s:complexType>
243
+ <s:sequence>
244
+ <s:element minOccurs="0" maxOccurs="1" name="BatchFile" type="tns:BatchFile"/>
245
+ </s:sequence>
246
+ </s:complexType>
247
+ </s:element>
248
+ <s:element name="BatchFileSaveResponse">
249
+ <s:complexType>
250
+ <s:sequence>
251
+ <s:element minOccurs="0" maxOccurs="1" name="BatchFileSaveResult" type="tns:BatchFileSaveResult"/>
252
+ </s:sequence>
253
+ </s:complexType>
254
+ </s:element>
255
+ <s:complexType name="BatchFileSaveResult">
256
+ <s:complexContent mixed="false">
257
+ <s:extension base="tns:BaseResult">
258
+ <s:sequence>
259
+ <s:element minOccurs="1" maxOccurs="1" name="BatchFileId" type="s:int"/>
260
+ </s:sequence>
261
+ </s:extension>
262
+ </s:complexContent>
263
+ </s:complexType>
264
+ <s:element name="BatchFileDelete">
265
+ <s:complexType>
266
+ <s:sequence>
267
+ <s:element minOccurs="0" maxOccurs="1" name="DeleteRequest" type="tns:DeleteRequest"/>
268
+ </s:sequence>
269
+ </s:complexType>
270
+ </s:element>
271
+ <s:element name="BatchFileDeleteResponse">
272
+ <s:complexType>
273
+ <s:sequence>
274
+ <s:element minOccurs="0" maxOccurs="1" name="BatchFileDeleteResult" type="tns:DeleteResult"/>
275
+ </s:sequence>
276
+ </s:complexType>
277
+ </s:element>
278
+ <s:element name="Ping">
279
+ <s:complexType>
280
+ <s:sequence>
281
+ <s:element minOccurs="0" maxOccurs="1" name="Message" type="s:string"/>
282
+ </s:sequence>
283
+ </s:complexType>
284
+ </s:element>
285
+ <s:element name="PingResponse">
286
+ <s:complexType>
287
+ <s:sequence>
288
+ <s:element minOccurs="0" maxOccurs="1" name="PingResult" type="tns:PingResult"/>
289
+ </s:sequence>
290
+ </s:complexType>
291
+ </s:element>
292
+ <s:complexType name="PingResult">
293
+ <s:complexContent mixed="false">
294
+ <s:extension base="tns:BaseResult">
295
+ <s:sequence>
296
+ <s:element minOccurs="0" maxOccurs="1" name="Version" type="s:string"/>
297
+ </s:sequence>
298
+ </s:extension>
299
+ </s:complexContent>
300
+ </s:complexType>
301
+ <s:element name="IsAuthorized">
302
+ <s:complexType>
303
+ <s:sequence>
304
+ <s:element minOccurs="0" maxOccurs="1" name="Operations" type="s:string"/>
305
+ </s:sequence>
306
+ </s:complexType>
307
+ </s:element>
308
+ <s:element name="IsAuthorizedResponse">
309
+ <s:complexType>
310
+ <s:sequence>
311
+ <s:element minOccurs="0" maxOccurs="1" name="IsAuthorizedResult" type="tns:IsAuthorizedResult"/>
312
+ </s:sequence>
313
+ </s:complexType>
314
+ </s:element>
315
+ <s:complexType name="IsAuthorizedResult">
316
+ <s:complexContent mixed="false">
317
+ <s:extension base="tns:BaseResult">
318
+ <s:sequence>
319
+ <s:element minOccurs="0" maxOccurs="1" name="Operations" type="s:string"/>
320
+ <s:element minOccurs="1" maxOccurs="1" name="Expires" type="s:dateTime"/>
321
+ </s:sequence>
322
+ </s:extension>
323
+ </s:complexContent>
324
+ </s:complexType>
325
+ </s:schema>
326
+ </wsdl:types>
327
+ <wsdl:message name="BatchFetchSoapIn">
328
+ <wsdl:part name="parameters" element="tns:BatchFetch"/>
329
+ </wsdl:message>
330
+ <wsdl:message name="BatchFetchSoapOut">
331
+ <wsdl:part name="parameters" element="tns:BatchFetchResponse"/>
332
+ </wsdl:message>
333
+ <wsdl:message name="BatchFetchProfile">
334
+ <wsdl:part name="Profile" element="tns:Profile"/>
335
+ </wsdl:message>
336
+ <wsdl:message name="BatchSaveSoapIn">
337
+ <wsdl:part name="parameters" element="tns:BatchSave"/>
338
+ </wsdl:message>
339
+ <wsdl:message name="BatchSaveSoapOut">
340
+ <wsdl:part name="parameters" element="tns:BatchSaveResponse"/>
341
+ </wsdl:message>
342
+ <wsdl:message name="BatchSaveAuditMessage">
343
+ <wsdl:part name="AuditMessage" element="tns:AuditMessage"/>
344
+ </wsdl:message>
345
+ <wsdl:message name="BatchSaveProfile">
346
+ <wsdl:part name="Profile" element="tns:Profile"/>
347
+ </wsdl:message>
348
+ <wsdl:message name="BatchDeleteSoapIn">
349
+ <wsdl:part name="parameters" element="tns:BatchDelete"/>
350
+ </wsdl:message>
351
+ <wsdl:message name="BatchDeleteSoapOut">
352
+ <wsdl:part name="parameters" element="tns:BatchDeleteResponse"/>
353
+ </wsdl:message>
354
+ <wsdl:message name="BatchDeleteAuditMessage">
355
+ <wsdl:part name="AuditMessage" element="tns:AuditMessage"/>
356
+ </wsdl:message>
357
+ <wsdl:message name="BatchDeleteProfile">
358
+ <wsdl:part name="Profile" element="tns:Profile"/>
359
+ </wsdl:message>
360
+ <wsdl:message name="BatchProcessSoapIn">
361
+ <wsdl:part name="parameters" element="tns:BatchProcess"/>
362
+ </wsdl:message>
363
+ <wsdl:message name="BatchProcessSoapOut">
364
+ <wsdl:part name="parameters" element="tns:BatchProcessResponse"/>
365
+ </wsdl:message>
366
+ <wsdl:message name="BatchProcessProfile">
367
+ <wsdl:part name="Profile" element="tns:Profile"/>
368
+ </wsdl:message>
369
+ <wsdl:message name="BatchFileFetchSoapIn">
370
+ <wsdl:part name="parameters" element="tns:BatchFileFetch"/>
371
+ </wsdl:message>
372
+ <wsdl:message name="BatchFileFetchSoapOut">
373
+ <wsdl:part name="parameters" element="tns:BatchFileFetchResponse"/>
374
+ </wsdl:message>
375
+ <wsdl:message name="BatchFileFetchProfile">
376
+ <wsdl:part name="Profile" element="tns:Profile"/>
377
+ </wsdl:message>
378
+ <wsdl:message name="BatchFileSaveSoapIn">
379
+ <wsdl:part name="parameters" element="tns:BatchFileSave"/>
380
+ </wsdl:message>
381
+ <wsdl:message name="BatchFileSaveSoapOut">
382
+ <wsdl:part name="parameters" element="tns:BatchFileSaveResponse"/>
383
+ </wsdl:message>
384
+ <wsdl:message name="BatchFileSaveProfile">
385
+ <wsdl:part name="Profile" element="tns:Profile"/>
386
+ </wsdl:message>
387
+ <wsdl:message name="BatchFileDeleteSoapIn">
388
+ <wsdl:part name="parameters" element="tns:BatchFileDelete"/>
389
+ </wsdl:message>
390
+ <wsdl:message name="BatchFileDeleteSoapOut">
391
+ <wsdl:part name="parameters" element="tns:BatchFileDeleteResponse"/>
392
+ </wsdl:message>
393
+ <wsdl:message name="BatchFileDeleteProfile">
394
+ <wsdl:part name="Profile" element="tns:Profile"/>
395
+ </wsdl:message>
396
+ <wsdl:message name="PingSoapIn">
397
+ <wsdl:part name="parameters" element="tns:Ping"/>
398
+ </wsdl:message>
399
+ <wsdl:message name="PingSoapOut">
400
+ <wsdl:part name="parameters" element="tns:PingResponse"/>
401
+ </wsdl:message>
402
+ <wsdl:message name="PingProfile">
403
+ <wsdl:part name="Profile" element="tns:Profile"/>
404
+ </wsdl:message>
405
+ <wsdl:message name="IsAuthorizedSoapIn">
406
+ <wsdl:part name="parameters" element="tns:IsAuthorized"/>
407
+ </wsdl:message>
408
+ <wsdl:message name="IsAuthorizedSoapOut">
409
+ <wsdl:part name="parameters" element="tns:IsAuthorizedResponse"/>
410
+ </wsdl:message>
411
+ <wsdl:message name="IsAuthorizedProfile">
412
+ <wsdl:part name="Profile" element="tns:Profile"/>
413
+ </wsdl:message>
414
+ <wsdl:portType name="BatchSvcSoap">
415
+ <wsdl:operation name="BatchFetch">
416
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Fetches one or more Batch</wsdl:documentation>
417
+ <wsdl:input message="tns:BatchFetchSoapIn"/>
418
+ <wsdl:output message="tns:BatchFetchSoapOut"/>
419
+ </wsdl:operation>
420
+ <wsdl:operation name="BatchSave">
421
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Saves a Batch entry</wsdl:documentation>
422
+ <wsdl:input message="tns:BatchSaveSoapIn"/>
423
+ <wsdl:output message="tns:BatchSaveSoapOut"/>
424
+ </wsdl:operation>
425
+ <wsdl:operation name="BatchDelete">
426
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Deletes one or more Batches</wsdl:documentation>
427
+ <wsdl:input message="tns:BatchDeleteSoapIn"/>
428
+ <wsdl:output message="tns:BatchDeleteSoapOut"/>
429
+ </wsdl:operation>
430
+ <wsdl:operation name="BatchProcess">
431
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Processes one or more Batches</wsdl:documentation>
432
+ <wsdl:input message="tns:BatchProcessSoapIn"/>
433
+ <wsdl:output message="tns:BatchProcessSoapOut"/>
434
+ </wsdl:operation>
435
+ <wsdl:operation name="BatchFileFetch">
436
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Fetches one or more BatchFiles</wsdl:documentation>
437
+ <wsdl:input message="tns:BatchFileFetchSoapIn"/>
438
+ <wsdl:output message="tns:BatchFileFetchSoapOut"/>
439
+ </wsdl:operation>
440
+ <wsdl:operation name="BatchFileSave">
441
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Saves a Batch File</wsdl:documentation>
442
+ <wsdl:input message="tns:BatchFileSaveSoapIn"/>
443
+ <wsdl:output message="tns:BatchFileSaveSoapOut"/>
444
+ </wsdl:operation>
445
+ <wsdl:operation name="BatchFileDelete">
446
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Deletes one or more BatchFiles</wsdl:documentation>
447
+ <wsdl:input message="tns:BatchFileDeleteSoapIn"/>
448
+ <wsdl:output message="tns:BatchFileDeleteSoapOut"/>
449
+ </wsdl:operation>
450
+ <wsdl:operation name="Ping">
451
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Tests connectivity and version of the service</wsdl:documentation>
452
+ <wsdl:input message="tns:PingSoapIn"/>
453
+ <wsdl:output message="tns:PingSoapOut"/>
454
+ </wsdl:operation>
455
+ <wsdl:operation name="IsAuthorized">
456
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Checks authentication and authorization to one or more operations on the service.</wsdl:documentation>
457
+ <wsdl:input message="tns:IsAuthorizedSoapIn"/>
458
+ <wsdl:output message="tns:IsAuthorizedSoapOut"/>
459
+ </wsdl:operation>
460
+ </wsdl:portType>
461
+ <wsdl:binding name="BatchSvcSoap" type="tns:BatchSvcSoap">
462
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
463
+ <wsdl:operation name="BatchFetch">
464
+ <soap:operation soapAction="http://avatax.avalara.com/services/BatchFetch" style="document"/>
465
+ <wsdl:input>
466
+ <soap:body use="literal"/>
467
+ <soap:header message="tns:BatchFetchProfile" part="Profile" use="literal"/>
468
+ </wsdl:input>
469
+ <wsdl:output>
470
+ <soap:body use="literal"/>
471
+ </wsdl:output>
472
+ </wsdl:operation>
473
+ <wsdl:operation name="BatchSave">
474
+ <soap:operation soapAction="http://avatax.avalara.com/services/BatchSave" style="document"/>
475
+ <wsdl:input>
476
+ <soap:body use="literal"/>
477
+ <soap:header message="tns:BatchSaveAuditMessage" part="AuditMessage" use="literal"/>
478
+ <soap:header message="tns:BatchSaveProfile" part="Profile" use="literal"/>
479
+ </wsdl:input>
480
+ <wsdl:output>
481
+ <soap:body use="literal"/>
482
+ </wsdl:output>
483
+ </wsdl:operation>
484
+ <wsdl:operation name="BatchDelete">
485
+ <soap:operation soapAction="http://avatax.avalara.com/services/BatchDelete" style="document"/>
486
+ <wsdl:input>
487
+ <soap:body use="literal"/>
488
+ <soap:header message="tns:BatchDeleteAuditMessage" part="AuditMessage" use="literal"/>
489
+ <soap:header message="tns:BatchDeleteProfile" part="Profile" use="literal"/>
490
+ </wsdl:input>
491
+ <wsdl:output>
492
+ <soap:body use="literal"/>
493
+ </wsdl:output>
494
+ </wsdl:operation>
495
+ <wsdl:operation name="BatchProcess">
496
+ <soap:operation soapAction="http://avatax.avalara.com/services/BatchProcess" style="document"/>
497
+ <wsdl:input>
498
+ <soap:body use="literal"/>
499
+ <soap:header message="tns:BatchProcessProfile" part="Profile" use="literal"/>
500
+ </wsdl:input>
501
+ <wsdl:output>
502
+ <soap:body use="literal"/>
503
+ </wsdl:output>
504
+ </wsdl:operation>
505
+ <wsdl:operation name="BatchFileFetch">
506
+ <soap:operation soapAction="http://avatax.avalara.com/services/BatchFileFetch" style="document"/>
507
+ <wsdl:input>
508
+ <soap:body use="literal"/>
509
+ <soap:header message="tns:BatchFileFetchProfile" part="Profile" use="literal"/>
510
+ </wsdl:input>
511
+ <wsdl:output>
512
+ <soap:body use="literal"/>
513
+ </wsdl:output>
514
+ </wsdl:operation>
515
+ <wsdl:operation name="BatchFileSave">
516
+ <soap:operation soapAction="http://avatax.avalara.com/services/BatchFileSave" style="document"/>
517
+ <wsdl:input>
518
+ <soap:body use="literal"/>
519
+ <soap:header message="tns:BatchFileSaveProfile" part="Profile" use="literal"/>
520
+ </wsdl:input>
521
+ <wsdl:output>
522
+ <soap:body use="literal"/>
523
+ </wsdl:output>
524
+ </wsdl:operation>
525
+ <wsdl:operation name="BatchFileDelete">
526
+ <soap:operation soapAction="http://avatax.avalara.com/services/BatchFileDelete" style="document"/>
527
+ <wsdl:input>
528
+ <soap:body use="literal"/>
529
+ <soap:header message="tns:BatchFileDeleteProfile" part="Profile" use="literal"/>
530
+ </wsdl:input>
531
+ <wsdl:output>
532
+ <soap:body use="literal"/>
533
+ </wsdl:output>
534
+ </wsdl:operation>
535
+ <wsdl:operation name="Ping">
536
+ <soap:operation soapAction="http://avatax.avalara.com/services/Ping" style="document"/>
537
+ <wsdl:input>
538
+ <soap:body use="literal"/>
539
+ <soap:header message="tns:PingProfile" part="Profile" use="literal"/>
540
+ </wsdl:input>
541
+ <wsdl:output>
542
+ <soap:body use="literal"/>
543
+ </wsdl:output>
544
+ </wsdl:operation>
545
+ <wsdl:operation name="IsAuthorized">
546
+ <soap:operation soapAction="http://avatax.avalara.com/services/IsAuthorized" style="document"/>
547
+ <wsdl:input>
548
+ <soap:body use="literal"/>
549
+ <soap:header message="tns:IsAuthorizedProfile" part="Profile" use="literal"/>
550
+ </wsdl:input>
551
+ <wsdl:output>
552
+ <soap:body use="literal"/>
553
+ </wsdl:output>
554
+ </wsdl:operation>
555
+ </wsdl:binding>
556
+ <wsdl:binding name="BatchSvcSoap12" type="tns:BatchSvcSoap">
557
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
558
+ <wsdl:operation name="BatchFetch">
559
+ <soap12:operation soapAction="http://avatax.avalara.com/services/BatchFetch" style="document"/>
560
+ <wsdl:input>
561
+ <soap12:body use="literal"/>
562
+ <soap12:header message="tns:BatchFetchProfile" part="Profile" use="literal"/>
563
+ </wsdl:input>
564
+ <wsdl:output>
565
+ <soap12:body use="literal"/>
566
+ </wsdl:output>
567
+ </wsdl:operation>
568
+ <wsdl:operation name="BatchSave">
569
+ <soap12:operation soapAction="http://avatax.avalara.com/services/BatchSave" style="document"/>
570
+ <wsdl:input>
571
+ <soap12:body use="literal"/>
572
+ <soap12:header message="tns:BatchSaveAuditMessage" part="AuditMessage" use="literal"/>
573
+ <soap12:header message="tns:BatchSaveProfile" part="Profile" use="literal"/>
574
+ </wsdl:input>
575
+ <wsdl:output>
576
+ <soap12:body use="literal"/>
577
+ </wsdl:output>
578
+ </wsdl:operation>
579
+ <wsdl:operation name="BatchDelete">
580
+ <soap12:operation soapAction="http://avatax.avalara.com/services/BatchDelete" style="document"/>
581
+ <wsdl:input>
582
+ <soap12:body use="literal"/>
583
+ <soap12:header message="tns:BatchDeleteAuditMessage" part="AuditMessage" use="literal"/>
584
+ <soap12:header message="tns:BatchDeleteProfile" part="Profile" use="literal"/>
585
+ </wsdl:input>
586
+ <wsdl:output>
587
+ <soap12:body use="literal"/>
588
+ </wsdl:output>
589
+ </wsdl:operation>
590
+ <wsdl:operation name="BatchProcess">
591
+ <soap12:operation soapAction="http://avatax.avalara.com/services/BatchProcess" style="document"/>
592
+ <wsdl:input>
593
+ <soap12:body use="literal"/>
594
+ <soap12:header message="tns:BatchProcessProfile" part="Profile" use="literal"/>
595
+ </wsdl:input>
596
+ <wsdl:output>
597
+ <soap12:body use="literal"/>
598
+ </wsdl:output>
599
+ </wsdl:operation>
600
+ <wsdl:operation name="BatchFileFetch">
601
+ <soap12:operation soapAction="http://avatax.avalara.com/services/BatchFileFetch" style="document"/>
602
+ <wsdl:input>
603
+ <soap12:body use="literal"/>
604
+ <soap12:header message="tns:BatchFileFetchProfile" part="Profile" use="literal"/>
605
+ </wsdl:input>
606
+ <wsdl:output>
607
+ <soap12:body use="literal"/>
608
+ </wsdl:output>
609
+ </wsdl:operation>
610
+ <wsdl:operation name="BatchFileSave">
611
+ <soap12:operation soapAction="http://avatax.avalara.com/services/BatchFileSave" style="document"/>
612
+ <wsdl:input>
613
+ <soap12:body use="literal"/>
614
+ <soap12:header message="tns:BatchFileSaveProfile" part="Profile" use="literal"/>
615
+ </wsdl:input>
616
+ <wsdl:output>
617
+ <soap12:body use="literal"/>
618
+ </wsdl:output>
619
+ </wsdl:operation>
620
+ <wsdl:operation name="BatchFileDelete">
621
+ <soap12:operation soapAction="http://avatax.avalara.com/services/BatchFileDelete" style="document"/>
622
+ <wsdl:input>
623
+ <soap12:body use="literal"/>
624
+ <soap12:header message="tns:BatchFileDeleteProfile" part="Profile" use="literal"/>
625
+ </wsdl:input>
626
+ <wsdl:output>
627
+ <soap12:body use="literal"/>
628
+ </wsdl:output>
629
+ </wsdl:operation>
630
+ <wsdl:operation name="Ping">
631
+ <soap12:operation soapAction="http://avatax.avalara.com/services/Ping" style="document"/>
632
+ <wsdl:input>
633
+ <soap12:body use="literal"/>
634
+ <soap12:header message="tns:PingProfile" part="Profile" use="literal"/>
635
+ </wsdl:input>
636
+ <wsdl:output>
637
+ <soap12:body use="literal"/>
638
+ </wsdl:output>
639
+ </wsdl:operation>
640
+ <wsdl:operation name="IsAuthorized">
641
+ <soap12:operation soapAction="http://avatax.avalara.com/services/IsAuthorized" style="document"/>
642
+ <wsdl:input>
643
+ <soap12:body use="literal"/>
644
+ <soap12:header message="tns:IsAuthorizedProfile" part="Profile" use="literal"/>
645
+ </wsdl:input>
646
+ <wsdl:output>
647
+ <soap12:body use="literal"/>
648
+ </wsdl:output>
649
+ </wsdl:operation>
650
+ </wsdl:binding>
651
+ <wsdl:service name="BatchSvc">
652
+ <wsdl:port name="BatchSvcSoap" binding="tns:BatchSvcSoap">
653
+ <soap:address location="http://localhost/avatax.services/Batch/BatchSvc.asmx"/>
654
+ </wsdl:port>
655
+ <wsdl:port name="BatchSvcSoap12" binding="tns:BatchSvcSoap12">
656
+ <soap12:address location="http://localhost/avatax.services/Batch/BatchSvc.asmx"/>
657
+ </wsdl:port>
658
+ </wsdl:service>
659
+ </wsdl:definitions>
app/code/community/OnePica/AvaTax/lib/classes/wsdl/Tax.wsdl ADDED
@@ -0,0 +1,1278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://avatax.avalara.com/services" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://avatax.avalara.com/services" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
3
+ <wsdl:types>
4
+ <s:schema elementFormDefault="qualified" targetNamespace="http://avatax.avalara.com/services">
5
+ <s:element name="GetTax">
6
+ <s:complexType>
7
+ <s:sequence>
8
+ <s:element minOccurs="0" maxOccurs="1" name="GetTaxRequest" type="tns:GetTaxRequest" />
9
+ </s:sequence>
10
+ </s:complexType>
11
+ </s:element>
12
+ <s:complexType name="BaseRequest" />
13
+ <s:complexType name="GetTaxRequest">
14
+ <s:complexContent mixed="false">
15
+ <s:extension base="tns:BaseRequest">
16
+ <s:sequence>
17
+ <s:element minOccurs="0" maxOccurs="1" name="CompanyCode" type="s:string" />
18
+ <s:element minOccurs="1" maxOccurs="1" name="DocType" type="tns:DocumentType" />
19
+ <s:element minOccurs="0" maxOccurs="1" name="DocCode" type="s:string" />
20
+ <s:element minOccurs="1" maxOccurs="1" name="DocDate" type="s:date" />
21
+ <s:element minOccurs="0" maxOccurs="1" name="SalespersonCode" type="s:string" />
22
+ <s:element minOccurs="0" maxOccurs="1" name="CustomerCode" type="s:string" />
23
+ <s:element minOccurs="0" maxOccurs="1" name="CustomerUsageType" type="s:string" />
24
+ <s:element minOccurs="1" maxOccurs="1" name="Discount" type="s:decimal" />
25
+ <s:element minOccurs="0" maxOccurs="1" name="PurchaseOrderNo" type="s:string" />
26
+ <s:element minOccurs="0" maxOccurs="1" name="ExemptionNo" type="s:string" />
27
+ <s:element minOccurs="0" maxOccurs="1" name="OriginCode" type="s:string" />
28
+ <s:element minOccurs="0" maxOccurs="1" name="DestinationCode" type="s:string" />
29
+ <s:element minOccurs="0" maxOccurs="1" name="Addresses" type="tns:ArrayOfBaseAddress" />
30
+ <s:element minOccurs="0" maxOccurs="1" name="Lines" type="tns:ArrayOfLine" />
31
+ <s:element minOccurs="1" maxOccurs="1" name="DetailLevel" type="tns:DetailLevel" />
32
+ <s:element minOccurs="0" maxOccurs="1" name="ReferenceCode" type="s:string" />
33
+ <s:element minOccurs="1" maxOccurs="1" name="HashCode" type="s:int" />
34
+ <s:element minOccurs="0" maxOccurs="1" name="LocationCode" type="s:string" />
35
+ <s:element minOccurs="1" maxOccurs="1" name="Commit" type="s:boolean" />
36
+ <s:element minOccurs="0" maxOccurs="1" name="BatchCode" type="s:string" />
37
+ <s:element minOccurs="0" maxOccurs="1" name="TaxOverride" type="tns:TaxOverride" />
38
+ <s:element minOccurs="0" maxOccurs="1" name="CurrencyCode" type="s:string" />
39
+ <s:element minOccurs="1" maxOccurs="1" name="ServiceMode" type="tns:ServiceMode" />
40
+ <s:element minOccurs="1" maxOccurs="1" name="PaymentDate" type="s:date" />
41
+ <s:element minOccurs="1" maxOccurs="1" name="ExchangeRate" type="s:decimal" />
42
+ <s:element minOccurs="1" maxOccurs="1" name="ExchangeRateEffDate" type="s:date" />
43
+ </s:sequence>
44
+ </s:extension>
45
+ </s:complexContent>
46
+ </s:complexType>
47
+ <s:simpleType name="DocumentType">
48
+ <s:restriction base="s:string">
49
+ <s:enumeration value="SalesOrder" />
50
+ <s:enumeration value="SalesInvoice" />
51
+ <s:enumeration value="PurchaseOrder" />
52
+ <s:enumeration value="PurchaseInvoice" />
53
+ <s:enumeration value="ReturnOrder" />
54
+ <s:enumeration value="ReturnInvoice" />
55
+ <s:enumeration value="PendingAdjustment" />
56
+ <s:enumeration value="Any" />
57
+ </s:restriction>
58
+ </s:simpleType>
59
+ <s:complexType name="ArrayOfBaseAddress">
60
+ <s:sequence>
61
+ <s:element minOccurs="0" maxOccurs="unbounded" name="BaseAddress" nillable="true" type="tns:BaseAddress" />
62
+ </s:sequence>
63
+ </s:complexType>
64
+ <s:complexType name="BaseAddress">
65
+ <s:sequence>
66
+ <s:element minOccurs="0" maxOccurs="1" name="AddressCode" type="s:string" />
67
+ <s:element minOccurs="0" maxOccurs="1" name="Line1" type="s:string" />
68
+ <s:element minOccurs="0" maxOccurs="1" name="Line2" type="s:string" />
69
+ <s:element minOccurs="0" maxOccurs="1" name="Line3" type="s:string" />
70
+ <s:element minOccurs="0" maxOccurs="1" name="City" type="s:string" />
71
+ <s:element minOccurs="0" maxOccurs="1" name="Region" type="s:string" />
72
+ <s:element minOccurs="0" maxOccurs="1" name="PostalCode" type="s:string" />
73
+ <s:element minOccurs="0" maxOccurs="1" name="Country" type="s:string" />
74
+ <s:element minOccurs="1" maxOccurs="1" name="TaxRegionId" type="s:int" />
75
+ </s:sequence>
76
+ </s:complexType>
77
+ <s:complexType name="ArrayOfLine">
78
+ <s:sequence>
79
+ <s:element minOccurs="0" maxOccurs="unbounded" name="Line" nillable="true" type="tns:Line" />
80
+ </s:sequence>
81
+ </s:complexType>
82
+ <s:complexType name="Line">
83
+ <s:sequence>
84
+ <s:element minOccurs="0" maxOccurs="1" name="No" type="s:string" />
85
+ <s:element minOccurs="0" maxOccurs="1" name="OriginCode" type="s:string" />
86
+ <s:element minOccurs="0" maxOccurs="1" name="DestinationCode" type="s:string" />
87
+ <s:element minOccurs="0" maxOccurs="1" name="ItemCode" type="s:string" />
88
+ <s:element minOccurs="0" maxOccurs="1" name="TaxCode" type="s:string" />
89
+ <s:element minOccurs="1" maxOccurs="1" name="Qty" type="s:decimal" />
90
+ <s:element minOccurs="1" maxOccurs="1" name="Amount" type="s:decimal" />
91
+ <s:element minOccurs="1" maxOccurs="1" name="Discounted" type="s:boolean" />
92
+ <s:element minOccurs="0" maxOccurs="1" name="RevAcct" type="s:string" />
93
+ <s:element minOccurs="0" maxOccurs="1" name="Ref1" type="s:string" />
94
+ <s:element minOccurs="0" maxOccurs="1" name="Ref2" type="s:string" />
95
+ <s:element minOccurs="0" maxOccurs="1" name="ExemptionNo" type="s:string" />
96
+ <s:element minOccurs="0" maxOccurs="1" name="CustomerUsageType" type="s:string" />
97
+ <s:element minOccurs="0" maxOccurs="1" name="Description" type="s:string" />
98
+ <s:element minOccurs="0" maxOccurs="1" name="TaxOverride" type="tns:TaxOverride" />
99
+ <s:element minOccurs="0" maxOccurs="1" name="TaxIncluded" type="s:boolean" default="false" />
100
+ </s:sequence>
101
+ </s:complexType>
102
+ <s:complexType name="TaxOverride">
103
+ <s:sequence>
104
+ <s:element minOccurs="1" maxOccurs="1" name="TaxOverrideType" type="tns:TaxOverrideType" />
105
+ <s:element minOccurs="1" maxOccurs="1" name="TaxAmount" type="s:decimal" />
106
+ <s:element minOccurs="1" maxOccurs="1" name="TaxDate" type="s:date" />
107
+ <s:element minOccurs="0" maxOccurs="1" name="Reason" type="s:string" />
108
+ </s:sequence>
109
+ </s:complexType>
110
+ <s:simpleType name="TaxOverrideType">
111
+ <s:restriction base="s:string">
112
+ <s:enumeration value="None" />
113
+ <s:enumeration value="TaxAmount" />
114
+ <s:enumeration value="Exemption" />
115
+ <s:enumeration value="TaxDate" />
116
+ </s:restriction>
117
+ </s:simpleType>
118
+ <s:simpleType name="DetailLevel">
119
+ <s:restriction base="s:string">
120
+ <s:enumeration value="Document" />
121
+ <s:enumeration value="Summary" />
122
+ <s:enumeration value="Line" />
123
+ <s:enumeration value="Tax" />
124
+ <s:enumeration value="Diagnostic" />
125
+ </s:restriction>
126
+ </s:simpleType>
127
+ <s:simpleType name="ServiceMode">
128
+ <s:restriction base="s:string">
129
+ <s:enumeration value="Automatic" />
130
+ <s:enumeration value="Local" />
131
+ <s:enumeration value="Remote" />
132
+ </s:restriction>
133
+ </s:simpleType>
134
+ <s:element name="GetTaxResponse">
135
+ <s:complexType>
136
+ <s:sequence>
137
+ <s:element minOccurs="0" maxOccurs="1" name="GetTaxResult" type="tns:GetTaxResult" />
138
+ </s:sequence>
139
+ </s:complexType>
140
+ </s:element>
141
+ <s:complexType name="GetTaxResult">
142
+ <s:complexContent mixed="false">
143
+ <s:extension base="tns:BaseResult">
144
+ <s:sequence>
145
+ <s:element minOccurs="0" maxOccurs="1" name="DocId" type="s:string" />
146
+ <s:element minOccurs="1" maxOccurs="1" name="DocType" type="tns:DocumentType" />
147
+ <s:element minOccurs="0" maxOccurs="1" name="DocCode" type="s:string" />
148
+ <s:element minOccurs="1" maxOccurs="1" name="DocDate" type="s:date" />
149
+ <s:element minOccurs="1" maxOccurs="1" name="DocStatus" type="tns:DocStatus" />
150
+ <s:element minOccurs="1" maxOccurs="1" name="Reconciled" type="s:boolean" />
151
+ <s:element minOccurs="1" maxOccurs="1" name="Timestamp" type="s:dateTime" />
152
+ <s:element minOccurs="1" maxOccurs="1" name="TotalAmount" type="s:decimal" />
153
+ <s:element minOccurs="1" maxOccurs="1" name="TotalDiscount" type="s:decimal" />
154
+ <s:element minOccurs="1" maxOccurs="1" name="TotalExemption" type="s:decimal" />
155
+ <s:element minOccurs="1" maxOccurs="1" name="TotalTaxable" type="s:decimal" />
156
+ <s:element minOccurs="1" maxOccurs="1" name="TotalTax" type="s:decimal" />
157
+ <s:element minOccurs="1" maxOccurs="1" name="TotalTaxCalculated" type="s:decimal" />
158
+ <s:element minOccurs="1" maxOccurs="1" name="HashCode" type="s:int" />
159
+ <s:element minOccurs="0" maxOccurs="1" name="TaxLines" type="tns:ArrayOfTaxLine" />
160
+ <s:element minOccurs="0" maxOccurs="1" name="TaxAddresses" type="tns:ArrayOfTaxAddress" />
161
+ <s:element minOccurs="1" maxOccurs="1" name="Locked" type="s:boolean" />
162
+ <s:element minOccurs="1" maxOccurs="1" name="AdjustmentReason" type="s:int" />
163
+ <s:element minOccurs="0" maxOccurs="1" name="AdjustmentDescription" type="s:string" />
164
+ <s:element minOccurs="1" maxOccurs="1" name="Version" type="s:int" />
165
+ <s:element minOccurs="1" maxOccurs="1" name="TaxDate" type="s:date" />
166
+ <s:element minOccurs="0" maxOccurs="1" name="TaxSummary" type="tns:ArrayOfTaxDetail" />
167
+ <s:element minOccurs="0" maxOccurs="1" name="Signature" type="s:string" />
168
+ </s:sequence>
169
+ </s:extension>
170
+ </s:complexContent>
171
+ </s:complexType>
172
+ <s:complexType name="BaseResult">
173
+ <s:sequence>
174
+ <s:element minOccurs="0" maxOccurs="1" name="TransactionId" type="s:string" />
175
+ <s:element minOccurs="1" maxOccurs="1" name="ResultCode" type="tns:SeverityLevel" />
176
+ <s:element minOccurs="0" maxOccurs="1" name="Messages" type="tns:ArrayOfMessage" />
177
+ </s:sequence>
178
+ </s:complexType>
179
+ <s:simpleType name="SeverityLevel">
180
+ <s:restriction base="s:string">
181
+ <s:enumeration value="Success" />
182
+ <s:enumeration value="Warning" />
183
+ <s:enumeration value="Error" />
184
+ <s:enumeration value="Exception" />
185
+ </s:restriction>
186
+ </s:simpleType>
187
+ <s:complexType name="ArrayOfMessage">
188
+ <s:sequence>
189
+ <s:element minOccurs="0" maxOccurs="unbounded" name="Message" nillable="true" type="tns:Message" />
190
+ </s:sequence>
191
+ </s:complexType>
192
+ <s:complexType name="Message">
193
+ <s:sequence>
194
+ <s:element minOccurs="0" maxOccurs="1" name="Summary" type="s:string" />
195
+ <s:element minOccurs="0" maxOccurs="1" name="Details" type="s:string" />
196
+ <s:element minOccurs="0" maxOccurs="1" name="HelpLink" type="s:string" />
197
+ <s:element minOccurs="0" maxOccurs="1" name="RefersTo" type="s:string" />
198
+ <s:element minOccurs="1" maxOccurs="1" name="Severity" type="tns:SeverityLevel" />
199
+ <s:element minOccurs="0" maxOccurs="1" name="Source" type="s:string" />
200
+ </s:sequence>
201
+ <s:attribute name="Name" type="s:string" />
202
+ </s:complexType>
203
+ <s:simpleType name="DocStatus">
204
+ <s:restriction base="s:string">
205
+ <s:enumeration value="Temporary" />
206
+ <s:enumeration value="Saved" />
207
+ <s:enumeration value="Posted" />
208
+ <s:enumeration value="Committed" />
209
+ <s:enumeration value="Cancelled" />
210
+ <s:enumeration value="Adjusted" />
211
+ <s:enumeration value="Any" />
212
+ </s:restriction>
213
+ </s:simpleType>
214
+ <s:complexType name="ArrayOfTaxLine">
215
+ <s:sequence>
216
+ <s:element minOccurs="0" maxOccurs="unbounded" name="TaxLine" nillable="true" type="tns:TaxLine" />
217
+ </s:sequence>
218
+ </s:complexType>
219
+ <s:complexType name="TaxLine">
220
+ <s:sequence>
221
+ <s:element minOccurs="0" maxOccurs="1" name="No" type="s:string" />
222
+ <s:element minOccurs="0" maxOccurs="1" name="TaxCode" type="s:string" />
223
+ <s:element minOccurs="1" maxOccurs="1" name="Taxability" type="s:boolean" />
224
+ <s:element minOccurs="1" maxOccurs="1" name="BoundaryLevel" type="tns:BoundaryLevel" />
225
+ <s:element minOccurs="1" maxOccurs="1" name="Exemption" type="s:decimal" />
226
+ <s:element minOccurs="1" maxOccurs="1" name="Discount" type="s:decimal" />
227
+ <s:element minOccurs="1" maxOccurs="1" name="Taxable" type="s:decimal" />
228
+ <s:element minOccurs="1" maxOccurs="1" name="Rate" type="s:decimal" />
229
+ <s:element minOccurs="1" maxOccurs="1" name="Tax" type="s:decimal" />
230
+ <s:element minOccurs="1" maxOccurs="1" name="TaxCalculated" type="s:decimal" />
231
+ <s:element minOccurs="0" maxOccurs="1" name="TaxDetails" type="tns:ArrayOfTaxDetail" />
232
+ <s:element minOccurs="1" maxOccurs="1" name="ExemptCertId" type="s:int" />
233
+ <s:element minOccurs="1" maxOccurs="1" name="TaxDate" type="s:date" />
234
+ <s:element minOccurs="1" maxOccurs="1" name="ReportingDate" type="s:date" />
235
+ <s:element minOccurs="1" maxOccurs="1" name="AccountingMethod" type="tns:AccountingMethod" />
236
+ <s:element minOccurs="0" maxOccurs="1" name="TaxIncluded" type="s:boolean" default="false" />
237
+ </s:sequence>
238
+ </s:complexType>
239
+ <s:simpleType name="BoundaryLevel">
240
+ <s:restriction base="s:string">
241
+ <s:enumeration value="Address" />
242
+ <s:enumeration value="Zip9" />
243
+ <s:enumeration value="Zip5" />
244
+ </s:restriction>
245
+ </s:simpleType>
246
+ <s:complexType name="ArrayOfTaxDetail">
247
+ <s:sequence>
248
+ <s:element minOccurs="0" maxOccurs="unbounded" name="TaxDetail" nillable="true" type="tns:TaxDetail" />
249
+ </s:sequence>
250
+ </s:complexType>
251
+ <s:complexType name="TaxDetail">
252
+ <s:sequence>
253
+ <s:element minOccurs="0" maxOccurs="1" name="Country" type="s:string" />
254
+ <s:element minOccurs="0" maxOccurs="1" name="Region" type="s:string" />
255
+ <s:element minOccurs="1" maxOccurs="1" name="JurisType" type="tns:JurisdictionType" />
256
+ <s:element minOccurs="0" maxOccurs="1" name="JurisCode" type="s:string" />
257
+ <s:element minOccurs="1" maxOccurs="1" name="TaxType" type="tns:TaxType" />
258
+ <s:element minOccurs="1" maxOccurs="1" name="Base" type="s:decimal" />
259
+ <s:element minOccurs="1" maxOccurs="1" name="Taxable" type="s:decimal" />
260
+ <s:element minOccurs="1" maxOccurs="1" name="Rate" type="s:decimal" />
261
+ <s:element minOccurs="1" maxOccurs="1" name="Tax" type="s:decimal" />
262
+ <s:element minOccurs="1" maxOccurs="1" name="TaxCalculated" type="s:decimal" />
263
+ <s:element minOccurs="1" maxOccurs="1" name="NonTaxable" type="s:decimal" />
264
+ <s:element minOccurs="1" maxOccurs="1" name="Exemption" type="s:decimal" />
265
+ <s:element minOccurs="0" maxOccurs="1" name="JurisName" type="s:string" />
266
+ <s:element minOccurs="0" maxOccurs="1" name="TaxName" type="s:string" />
267
+ <s:element minOccurs="1" maxOccurs="1" name="TaxAuthorityType" type="s:int" />
268
+ <s:element minOccurs="0" maxOccurs="1" name="TaxGroup" type="s:string" />
269
+ <s:element minOccurs="0" maxOccurs="1" name="RateType" type="s:string" />
270
+ <s:element minOccurs="0" maxOccurs="1" name="StateAssignedNo" type="s:string" />
271
+ </s:sequence>
272
+ </s:complexType>
273
+ <s:simpleType name="JurisdictionType">
274
+ <s:restriction base="s:string">
275
+ <s:enumeration value="Country" />
276
+ <s:enumeration value="Composite" />
277
+ <s:enumeration value="State" />
278
+ <s:enumeration value="County" />
279
+ <s:enumeration value="City" />
280
+ <s:enumeration value="Special" />
281
+ </s:restriction>
282
+ </s:simpleType>
283
+ <s:simpleType name="TaxType">
284
+ <s:restriction base="s:string">
285
+ <s:enumeration value="Sales" />
286
+ <s:enumeration value="Use" />
287
+ <s:enumeration value="ConsumerUse" />
288
+ <s:enumeration value="Output" />
289
+ <s:enumeration value="Input" />
290
+ <s:enumeration value="Nonrecoverable" />
291
+ <s:enumeration value="Fee" />
292
+ <s:enumeration value="Rental" />
293
+ </s:restriction>
294
+ </s:simpleType>
295
+ <s:simpleType name="AccountingMethod">
296
+ <s:restriction base="s:string">
297
+ <s:enumeration value="Accrual" />
298
+ <s:enumeration value="Cash" />
299
+ </s:restriction>
300
+ </s:simpleType>
301
+ <s:complexType name="ArrayOfTaxAddress">
302
+ <s:sequence>
303
+ <s:element minOccurs="0" maxOccurs="unbounded" name="TaxAddress" nillable="true" type="tns:TaxAddress" />
304
+ </s:sequence>
305
+ </s:complexType>
306
+ <s:complexType name="TaxAddress">
307
+ <s:sequence>
308
+ <s:element minOccurs="0" maxOccurs="1" name="Address" type="s:string" />
309
+ <s:element minOccurs="0" maxOccurs="1" name="AddressCode" type="s:string" />
310
+ <s:element minOccurs="1" maxOccurs="1" name="BoundaryLevel" type="s:int" />
311
+ <s:element minOccurs="0" maxOccurs="1" name="City" type="s:string" />
312
+ <s:element minOccurs="0" maxOccurs="1" name="Country" type="s:string" />
313
+ <s:element minOccurs="0" maxOccurs="1" name="PostalCode" type="s:string" />
314
+ <s:element minOccurs="0" maxOccurs="1" name="Region" type="s:string" />
315
+ <s:element minOccurs="1" maxOccurs="1" name="TaxRegionId" type="s:int" />
316
+ <s:element minOccurs="0" maxOccurs="1" name="JurisCode" type="s:string" />
317
+ </s:sequence>
318
+ </s:complexType>
319
+ <s:element name="Profile" type="tns:Profile" />
320
+ <s:complexType name="Profile">
321
+ <s:sequence>
322
+ <s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" />
323
+ <s:element minOccurs="0" maxOccurs="1" name="Client" type="s:string" />
324
+ <s:element minOccurs="0" maxOccurs="1" name="Adapter" type="s:string" />
325
+ <s:element minOccurs="0" maxOccurs="1" name="Machine" type="s:string" />
326
+ </s:sequence>
327
+ <s:anyAttribute />
328
+ </s:complexType>
329
+ <s:element name="GetTaxHistory">
330
+ <s:complexType>
331
+ <s:sequence>
332
+ <s:element minOccurs="0" maxOccurs="1" name="GetTaxHistoryRequest" type="tns:GetTaxHistoryRequest" />
333
+ </s:sequence>
334
+ </s:complexType>
335
+ </s:element>
336
+ <s:complexType name="GetTaxHistoryRequest">
337
+ <s:complexContent mixed="false">
338
+ <s:extension base="tns:BaseRequest">
339
+ <s:sequence>
340
+ <s:element minOccurs="0" maxOccurs="1" name="DocId" type="s:string" />
341
+ <s:element minOccurs="0" maxOccurs="1" name="CompanyCode" type="s:string" />
342
+ <s:element minOccurs="1" maxOccurs="1" name="DocType" type="tns:DocumentType" />
343
+ <s:element minOccurs="0" maxOccurs="1" name="DocCode" type="s:string" />
344
+ <s:element minOccurs="1" maxOccurs="1" name="DetailLevel" type="tns:DetailLevel" />
345
+ </s:sequence>
346
+ </s:extension>
347
+ </s:complexContent>
348
+ </s:complexType>
349
+ <s:element name="GetTaxHistoryResponse">
350
+ <s:complexType>
351
+ <s:sequence>
352
+ <s:element minOccurs="0" maxOccurs="1" name="GetTaxHistoryResult" type="tns:GetTaxHistoryResult" />
353
+ </s:sequence>
354
+ </s:complexType>
355
+ </s:element>
356
+ <s:complexType name="GetTaxHistoryResult">
357
+ <s:complexContent mixed="false">
358
+ <s:extension base="tns:BaseResult">
359
+ <s:sequence>
360
+ <s:element minOccurs="0" maxOccurs="1" name="GetTaxRequest" type="tns:GetTaxRequest" />
361
+ <s:element minOccurs="0" maxOccurs="1" name="GetTaxResult" type="tns:GetTaxResult" />
362
+ </s:sequence>
363
+ </s:extension>
364
+ </s:complexContent>
365
+ </s:complexType>
366
+ <!-- <s:simpleType name="ConfirmationType">
367
+ <s:restriction base="s:string">
368
+ <s:enumeration value="None" />
369
+ <s:enumeration value="Optional" />
370
+ <s:enumeration value="Required" />
371
+ </s:restriction>
372
+ </s:simpleType> -->
373
+ <s:element name="PostTax">
374
+ <s:complexType>
375
+ <s:sequence>
376
+ <s:element minOccurs="0" maxOccurs="1" name="PostTaxRequest" type="tns:PostTaxRequest" />
377
+ </s:sequence>
378
+ </s:complexType>
379
+ </s:element>
380
+ <s:complexType name="PostTaxRequest">
381
+ <s:complexContent mixed="false">
382
+ <s:extension base="tns:BaseRequest">
383
+ <s:sequence>
384
+ <s:element minOccurs="0" maxOccurs="1" name="DocId" type="s:string" />
385
+ <s:element minOccurs="0" maxOccurs="1" name="CompanyCode" type="s:string" />
386
+ <s:element minOccurs="1" maxOccurs="1" name="DocType" type="tns:DocumentType" />
387
+ <s:element minOccurs="0" maxOccurs="1" name="DocCode" type="s:string" />
388
+ <s:element minOccurs="1" maxOccurs="1" name="DocDate" type="s:date" />
389
+ <s:element minOccurs="1" maxOccurs="1" name="TotalAmount" type="s:decimal" />
390
+ <s:element minOccurs="1" maxOccurs="1" name="TotalTax" type="s:decimal" />
391
+ <s:element minOccurs="1" maxOccurs="1" name="HashCode" type="s:int" />
392
+ <s:element minOccurs="1" maxOccurs="1" name="Commit" type="s:boolean" />
393
+ <s:element minOccurs="0" maxOccurs="1" name="NewDocCode" type="s:string" />
394
+ <s:element minOccurs="0" maxOccurs="1" name="Signature" type="s:string" />
395
+ <!-- <s:element minOccurs="0" maxOccurs="1" name="Confirmation" type="tns:ConfirmationType" /> -->
396
+ </s:sequence>
397
+ </s:extension>
398
+ </s:complexContent>
399
+ </s:complexType>
400
+ <s:element name="PostTaxResponse">
401
+ <s:complexType>
402
+ <s:sequence>
403
+ <s:element minOccurs="0" maxOccurs="1" name="PostTaxResult" type="tns:PostTaxResult" />
404
+ </s:sequence>
405
+ </s:complexType>
406
+ </s:element>
407
+ <s:complexType name="PostTaxResult">
408
+ <s:complexContent mixed="false">
409
+ <s:extension base="tns:BaseResult">
410
+ <s:sequence>
411
+ <s:element minOccurs="0" maxOccurs="1" name="DocId" type="s:string" />
412
+ </s:sequence>
413
+ </s:extension>
414
+ </s:complexContent>
415
+ </s:complexType>
416
+ <s:element name="CommitTax">
417
+ <s:complexType>
418
+ <s:sequence>
419
+ <s:element minOccurs="0" maxOccurs="1" name="CommitTaxRequest" type="tns:CommitTaxRequest" />
420
+ </s:sequence>
421
+ </s:complexType>
422
+ </s:element>
423
+ <s:complexType name="CommitTaxRequest">
424
+ <s:complexContent mixed="false">
425
+ <s:extension base="tns:BaseRequest">
426
+ <s:sequence>
427
+ <s:element minOccurs="0" maxOccurs="1" name="DocId" type="s:string" />
428
+ <s:element minOccurs="0" maxOccurs="1" name="CompanyCode" type="s:string" />
429
+ <s:element minOccurs="1" maxOccurs="1" name="DocType" type="tns:DocumentType" />
430
+ <s:element minOccurs="0" maxOccurs="1" name="DocCode" type="s:string" />
431
+ <s:element minOccurs="0" maxOccurs="1" name="NewDocCode" type="s:string" />
432
+ </s:sequence>
433
+ </s:extension>
434
+ </s:complexContent>
435
+ </s:complexType>
436
+ <s:element name="CommitTaxResponse">
437
+ <s:complexType>
438
+ <s:sequence>
439
+ <s:element minOccurs="0" maxOccurs="1" name="CommitTaxResult" type="tns:CommitTaxResult" />
440
+ </s:sequence>
441
+ </s:complexType>
442
+ </s:element>
443
+ <s:complexType name="CommitTaxResult">
444
+ <s:complexContent mixed="false">
445
+ <s:extension base="tns:BaseResult">
446
+ <s:sequence>
447
+ <s:element minOccurs="0" maxOccurs="1" name="DocId" type="s:string" />
448
+ </s:sequence>
449
+ </s:extension>
450
+ </s:complexContent>
451
+ </s:complexType>
452
+ <s:element name="AuditMessage" type="tns:AuditMessage" />
453
+ <s:complexType name="AuditMessage">
454
+ <s:sequence>
455
+ <s:element minOccurs="0" maxOccurs="1" name="Message" type="s:string" />
456
+ </s:sequence>
457
+ <s:anyAttribute />
458
+ </s:complexType>
459
+ <s:element name="CancelTax">
460
+ <s:complexType>
461
+ <s:sequence>
462
+ <s:element minOccurs="0" maxOccurs="1" name="CancelTaxRequest" type="tns:CancelTaxRequest" />
463
+ </s:sequence>
464
+ </s:complexType>
465
+ </s:element>
466
+ <s:complexType name="CancelTaxRequest">
467
+ <s:complexContent mixed="false">
468
+ <s:extension base="tns:BaseRequest">
469
+ <s:sequence>
470
+ <s:element minOccurs="0" maxOccurs="1" name="DocId" type="s:string" />
471
+ <s:element minOccurs="0" maxOccurs="1" name="CompanyCode" type="s:string" />
472
+ <s:element minOccurs="1" maxOccurs="1" name="DocType" type="tns:DocumentType" />
473
+ <s:element minOccurs="0" maxOccurs="1" name="DocCode" type="s:string" />
474
+ <s:element minOccurs="1" maxOccurs="1" name="CancelCode" type="tns:CancelCode" />
475
+ </s:sequence>
476
+ </s:extension>
477
+ </s:complexContent>
478
+ </s:complexType>
479
+ <s:simpleType name="CancelCode">
480
+ <s:restriction base="s:string">
481
+ <s:enumeration value="Unspecified" />
482
+ <s:enumeration value="PostFailed" />
483
+ <s:enumeration value="DocDeleted" />
484
+ <s:enumeration value="DocVoided" />
485
+ <s:enumeration value="AdjustmentCancelled" />
486
+ </s:restriction>
487
+ </s:simpleType>
488
+ <s:element name="CancelTaxResponse">
489
+ <s:complexType>
490
+ <s:sequence>
491
+ <s:element minOccurs="0" maxOccurs="1" name="CancelTaxResult" type="tns:CancelTaxResult" />
492
+ </s:sequence>
493
+ </s:complexType>
494
+ </s:element>
495
+ <s:complexType name="CancelTaxResult">
496
+ <s:complexContent mixed="false">
497
+ <s:extension base="tns:BaseResult">
498
+ <s:sequence>
499
+ <s:element minOccurs="0" maxOccurs="1" name="DocId" type="s:string" />
500
+ </s:sequence>
501
+ </s:extension>
502
+ </s:complexContent>
503
+ </s:complexType>
504
+ <s:element name="ReconcileTaxHistory">
505
+ <s:complexType>
506
+ <s:sequence>
507
+ <s:element minOccurs="0" maxOccurs="1" name="ReconcileTaxHistoryRequest" type="tns:ReconcileTaxHistoryRequest" />
508
+ </s:sequence>
509
+ </s:complexType>
510
+ </s:element>
511
+ <s:complexType name="ReconcileTaxHistoryRequest">
512
+ <s:complexContent mixed="false">
513
+ <s:extension base="tns:BaseRequest">
514
+ <s:sequence>
515
+ <s:element minOccurs="0" maxOccurs="1" name="CompanyCode" type="s:string" />
516
+ <s:element minOccurs="1" maxOccurs="1" name="StartDate" type="s:date" />
517
+ <s:element minOccurs="1" maxOccurs="1" name="EndDate" type="s:date" />
518
+ <s:element minOccurs="1" maxOccurs="1" name="DocStatus" type="tns:DocStatus" />
519
+ <s:element minOccurs="1" maxOccurs="1" name="DocType" type="tns:DocumentType"/>
520
+ <s:element minOccurs="1" maxOccurs="1" name="LastDocCode" type="s:string"/>
521
+ <s:element minOccurs="1" maxOccurs="1" name="PageSize" type="s:int"/>
522
+ </s:sequence>
523
+ </s:extension>
524
+ </s:complexContent>
525
+ </s:complexType>
526
+ <s:element name="ReconcileTaxHistoryResponse">
527
+ <s:complexType>
528
+ <s:sequence>
529
+ <s:element minOccurs="0" maxOccurs="1" name="ReconcileTaxHistoryResult" type="tns:ReconcileTaxHistoryResult" />
530
+ </s:sequence>
531
+ </s:complexType>
532
+ </s:element>
533
+ <s:complexType name="ReconcileTaxHistoryResult">
534
+ <s:complexContent mixed="false">
535
+ <s:extension base="tns:SearchTaxHistoryResult">
536
+ <s:sequence>
537
+ <s:element minOccurs="0" maxOccurs="1" name="RecordCount" type="s:int"></s:element>
538
+ </s:sequence>
539
+ </s:extension>
540
+ </s:complexContent>
541
+ </s:complexType>
542
+ <s:complexType name="SearchTaxHistoryResult">
543
+ <s:complexContent mixed="false">
544
+ <s:extension base="tns:BaseResult">
545
+ <s:sequence>
546
+ <s:element minOccurs="0" maxOccurs="1" name="GetTaxResults" type="tns:ArrayOfGetTaxResult" />
547
+ <s:element minOccurs="0" maxOccurs="1" name="LastDocCode" type="s:string" />
548
+ </s:sequence>
549
+ </s:extension>
550
+ </s:complexContent>
551
+ </s:complexType>
552
+ <s:complexType name="ArrayOfGetTaxResult">
553
+ <s:sequence>
554
+ <s:element minOccurs="0" maxOccurs="unbounded" name="GetTaxResult" nillable="true" type="tns:GetTaxResult" />
555
+ </s:sequence>
556
+ </s:complexType>
557
+ <s:element name="AdjustTax">
558
+ <s:complexType>
559
+ <s:sequence>
560
+ <s:element minOccurs="0" maxOccurs="1" name="AdjustTaxRequest" type="tns:AdjustTaxRequest" />
561
+ </s:sequence>
562
+ </s:complexType>
563
+ </s:element>
564
+ <s:complexType name="AdjustTaxRequest">
565
+ <s:complexContent mixed="false">
566
+ <s:extension base="tns:BaseRequest">
567
+ <s:sequence>
568
+ <s:element minOccurs="1" maxOccurs="1" name="AdjustmentReason" type="s:int" />
569
+ <s:element minOccurs="0" maxOccurs="1" name="AdjustmentDescription" type="s:string" />
570
+ <s:element minOccurs="0" maxOccurs="1" name="GetTaxRequest" type="tns:GetTaxRequest" />
571
+ </s:sequence>
572
+ </s:extension>
573
+ </s:complexContent>
574
+ </s:complexType>
575
+ <s:element name="AdjustTaxResponse">
576
+ <s:complexType>
577
+ <s:sequence>
578
+ <s:element minOccurs="0" maxOccurs="1" name="AdjustTaxResult" type="tns:AdjustTaxResult" />
579
+ </s:sequence>
580
+ </s:complexType>
581
+ </s:element>
582
+ <s:complexType name="AdjustTaxResult">
583
+ <s:complexContent mixed="false">
584
+ <s:extension base="tns:GetTaxResult" />
585
+ </s:complexContent>
586
+ </s:complexType>
587
+ <s:element name="ApplyPayment">
588
+ <s:complexType>
589
+ <s:sequence>
590
+ <s:element minOccurs="0" maxOccurs="1" name="ApplyPaymentRequest" type="tns:ApplyPaymentRequest" />
591
+ </s:sequence>
592
+ </s:complexType>
593
+ </s:element>
594
+ <s:complexType name="ApplyPaymentRequest">
595
+ <s:complexContent mixed="false">
596
+ <s:extension base="tns:BaseRequest">
597
+ <s:sequence>
598
+ <s:element minOccurs="0" maxOccurs="1" name="DocId" type="s:string" />
599
+ <s:element minOccurs="0" maxOccurs="1" name="CompanyCode" type="s:string" />
600
+ <s:element minOccurs="1" maxOccurs="1" name="DocType" type="tns:DocumentType" />
601
+ <s:element minOccurs="0" maxOccurs="1" name="DocCode" type="s:string" />
602
+ <s:element minOccurs="1" maxOccurs="1" name="PaymentDate" type="s:dateTime" />
603
+ </s:sequence>
604
+ </s:extension>
605
+ </s:complexContent>
606
+ </s:complexType>
607
+ <s:element name="ApplyPaymentResponse">
608
+ <s:complexType>
609
+ <s:sequence>
610
+ <s:element minOccurs="0" maxOccurs="1" name="ApplyPaymentResult" type="tns:ApplyPaymentResult" />
611
+ </s:sequence>
612
+ </s:complexType>
613
+ </s:element>
614
+ <s:complexType name="ApplyPaymentResult">
615
+ <s:complexContent mixed="false">
616
+ <s:extension base="tns:BaseResult">
617
+ <s:sequence>
618
+ <s:element minOccurs="0" maxOccurs="1" name="DocId" type="s:string" />
619
+ </s:sequence>
620
+ </s:extension>
621
+ </s:complexContent>
622
+ </s:complexType>
623
+ <!-- Begin New Methods-->
624
+ <s:element name="SubmitBatch">
625
+ <s:complexType>
626
+ <s:sequence>
627
+ <s:element minOccurs="0" maxOccurs="1" name="SubmitTaxBatchRequest" type="tns:SubmitTaxBatchRequest" />
628
+ </s:sequence>
629
+ </s:complexType>
630
+ </s:element>
631
+ <s:complexType name="SubmitTaxBatchRequest">
632
+ <s:complexContent mixed="false">
633
+ <s:extension base="tns:BaseRequest">
634
+ <s:sequence>
635
+ <s:element minOccurs="0" maxOccurs="1" name="Requests" type="tns:RequestList" />
636
+ <s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string"/>
637
+ <s:element minOccurs="0" maxOccurs="1" name="BatchTypeId" type="s:string"/>
638
+ <s:element minOccurs="0" maxOccurs="1" name="Options" type="s:string"/>
639
+ </s:sequence>
640
+ </s:extension>
641
+ </s:complexContent>
642
+ </s:complexType>
643
+ <s:complexType name="RequestList">
644
+ <s:choice minOccurs="0" maxOccurs="unbounded">
645
+ <s:element name="AdjustTaxRequest" nillable="true" type="tns:AdjustTaxRequest" />
646
+ <s:element name="ApplyPaymentRequest" nillable="true" type="tns:ApplyPaymentRequest" />
647
+ <s:element name="CancelTaxRequest" nillable="true" type="tns:CancelTaxRequest" />
648
+ <s:element name="CommitTaxRequest" nillable="true" type="tns:CommitTaxRequest" />
649
+ <s:element name="GetTaxHistoryRequest" nillable="true" type="tns:GetTaxHistoryRequest" />
650
+ <s:element name="GetTaxRequest" nillable="true" type="tns:GetTaxRequest" />
651
+ <s:element name="PostTaxRequest" nillable="true" type="tns:PostTaxRequest" />
652
+ <s:element name="ReconcileTaxHistoryRequest" nillable="true" type="tns:ReconcileTaxHistoryRequest" />
653
+ </s:choice>
654
+ </s:complexType>
655
+ <s:element name="SubmitBatchResponse">
656
+ <s:complexType>
657
+ <s:sequence>
658
+ <s:element minOccurs="0" maxOccurs="1" name="SubmitBatchResult" type="tns:SubmitTaxBatchResult" />
659
+ </s:sequence>
660
+ </s:complexType>
661
+ </s:element>
662
+ <s:complexType name="SubmitTaxBatchResult">
663
+ <s:complexContent mixed="false">
664
+ <s:extension base="tns:BaseResult">
665
+ <s:sequence>
666
+ <s:element minOccurs="0" maxOccurs="1" name="BatchId" type="s:string" />
667
+ </s:sequence>
668
+ </s:extension>
669
+ </s:complexContent>
670
+ </s:complexType>
671
+
672
+ <s:element name="GetBatch">
673
+ <s:complexType>
674
+ <s:sequence>
675
+ <s:element minOccurs="0" maxOccurs="1" name="GetTaxBatchRequest" type="tns:GetTaxBatchRequest" />
676
+ </s:sequence>
677
+ </s:complexType>
678
+ </s:element>
679
+ <s:complexType name="GetTaxBatchRequest">
680
+ <s:complexContent mixed="false">
681
+ <s:extension base="tns:BaseRequest">
682
+ <s:sequence>
683
+ <s:element minOccurs="1" maxOccurs="1" name="BatchId" type="s:string" />
684
+ </s:sequence>
685
+ </s:extension>
686
+ </s:complexContent>
687
+ </s:complexType>
688
+ <s:element name="GetBatchResponse">
689
+ <s:complexType>
690
+ <s:sequence>
691
+ <s:element minOccurs="0" maxOccurs="1" name="GetBatchResult" type="tns:GetTaxBatchResult" />
692
+ </s:sequence>
693
+ </s:complexType>
694
+ </s:element>
695
+ <s:complexType name="GetTaxBatchResult">
696
+ <s:complexContent mixed="false">
697
+ <s:extension base="tns:BaseResult">
698
+ <s:sequence>
699
+ <s:element minOccurs="1" maxOccurs="1" name="BatchId" type="s:string" />
700
+ <s:element minOccurs="1" maxOccurs="1" name="BatchStatus" type="s:string" />
701
+ <s:element minOccurs="1" maxOccurs="1" name="RecordCount" type="s:int" />
702
+ <s:element minOccurs="1" maxOccurs="1" name="CurrentRecord" type="s:int" />
703
+ <s:element minOccurs="0" maxOccurs="1" name="Results" type="tns:ResultList" />
704
+ </s:sequence>
705
+ </s:extension>
706
+ </s:complexContent>
707
+ </s:complexType>
708
+ <s:complexType name="ResultList">
709
+ <s:choice minOccurs="0" maxOccurs="unbounded">
710
+ <s:element name="AdjustTaxResult" nillable="true" type="tns:AdjustTaxResult" />
711
+ <s:element name="ApplyPaymentResult" nillable="true" type="tns:ApplyPaymentResult" />
712
+ <s:element name="CancelTaxResult" nillable="true" type="tns:CancelTaxResult" />
713
+ <s:element name="CommitTaxResult" nillable="true" type="tns:CommitTaxResult" />
714
+ <s:element name="GetTaxHistoryResult" nillable="true" type="tns:GetTaxHistoryResult" />
715
+ <s:element name="GetTaxResult" nillable="true" type="tns:GetTaxResult" />
716
+ <s:element name="PostTaxResult" nillable="true" type="tns:PostTaxResult" />
717
+ <s:element name="ReconcileTaxHistoryResult" nillable="true" type="tns:ReconcileTaxHistoryResult" />
718
+ </s:choice>
719
+ </s:complexType>
720
+
721
+ <s:element name="CancelBatch">
722
+ <s:complexType>
723
+ <s:sequence>
724
+ <s:element minOccurs="0" maxOccurs="1" name="CancelTaxBatchRequest" type="tns:CancelTaxBatchRequest" />
725
+ </s:sequence>
726
+ </s:complexType>
727
+ </s:element>
728
+ <s:complexType name="CancelTaxBatchRequest">
729
+ <s:complexContent mixed="false">
730
+ <s:extension base="tns:BaseRequest">
731
+ <s:sequence>
732
+ <s:element minOccurs="1" maxOccurs="1" name="BatchId" type="s:string" />
733
+ </s:sequence>
734
+ </s:extension>
735
+ </s:complexContent>
736
+ </s:complexType>
737
+ <s:element name="CancelBatchResponse">
738
+ <s:complexType>
739
+ <s:sequence>
740
+ <s:element minOccurs="0" maxOccurs="1" name="CancelBatchResult" type="tns:CancelTaxBatchResult" />
741
+ </s:sequence>
742
+ </s:complexType>
743
+ </s:element>
744
+ <s:complexType name="CancelTaxBatchResult">
745
+ <s:complexContent mixed="false">
746
+ <s:extension base="tns:BaseResult" />
747
+ </s:complexContent>
748
+ </s:complexType>
749
+ <!-- End New Methods -->
750
+ <s:element name="Ping">
751
+ <s:complexType>
752
+ <s:sequence>
753
+ <s:element minOccurs="0" maxOccurs="1" name="Message" type="s:string" />
754
+ </s:sequence>
755
+ </s:complexType>
756
+ </s:element>
757
+ <s:element name="PingResponse">
758
+ <s:complexType>
759
+ <s:sequence>
760
+ <s:element minOccurs="0" maxOccurs="1" name="PingResult" type="tns:PingResult" />
761
+ </s:sequence>
762
+ </s:complexType>
763
+ </s:element>
764
+ <s:complexType name="PingResult">
765
+ <s:complexContent mixed="false">
766
+ <s:extension base="tns:BaseResult">
767
+ <s:sequence>
768
+ <s:element minOccurs="0" maxOccurs="1" name="Version" type="s:string" />
769
+ </s:sequence>
770
+ </s:extension>
771
+ </s:complexContent>
772
+ </s:complexType>
773
+ <s:element name="IsAuthorized">
774
+ <s:complexType>
775
+ <s:sequence>
776
+ <s:element minOccurs="0" maxOccurs="1" name="Operations" type="s:string" />
777
+ </s:sequence>
778
+ </s:complexType>
779
+ </s:element>
780
+ <s:element name="IsAuthorizedResponse">
781
+ <s:complexType>
782
+ <s:sequence>
783
+ <s:element minOccurs="0" maxOccurs="1" name="IsAuthorizedResult" type="tns:IsAuthorizedResult" />
784
+ </s:sequence>
785
+ </s:complexType>
786
+ </s:element>
787
+ <s:complexType name="IsAuthorizedResult">
788
+ <s:complexContent mixed="false">
789
+ <s:extension base="tns:BaseResult">
790
+ <s:sequence>
791
+ <s:element minOccurs="0" maxOccurs="1" name="Operations" type="s:string" />
792
+ <s:element minOccurs="1" maxOccurs="1" name="Expires" type="s:dateTime" />
793
+ </s:sequence>
794
+ </s:extension>
795
+ </s:complexContent>
796
+ </s:complexType>
797
+ </s:schema>
798
+ </wsdl:types>
799
+ <wsdl:message name="GetTaxSoapIn">
800
+ <wsdl:part name="parameters" element="tns:GetTax" />
801
+ </wsdl:message>
802
+ <wsdl:message name="GetTaxSoapOut">
803
+ <wsdl:part name="parameters" element="tns:GetTaxResponse" />
804
+ </wsdl:message>
805
+ <wsdl:message name="GetTaxProfile">
806
+ <wsdl:part name="Profile" element="tns:Profile" />
807
+ </wsdl:message>
808
+ <wsdl:message name="GetTaxHistorySoapIn">
809
+ <wsdl:part name="parameters" element="tns:GetTaxHistory" />
810
+ </wsdl:message>
811
+ <wsdl:message name="GetTaxHistorySoapOut">
812
+ <wsdl:part name="parameters" element="tns:GetTaxHistoryResponse" />
813
+ </wsdl:message>
814
+ <wsdl:message name="GetTaxHistoryProfile">
815
+ <wsdl:part name="Profile" element="tns:Profile" />
816
+ </wsdl:message>
817
+ <wsdl:message name="PostTaxSoapIn">
818
+ <wsdl:part name="parameters" element="tns:PostTax" />
819
+ </wsdl:message>
820
+ <wsdl:message name="PostTaxSoapOut">
821
+ <wsdl:part name="parameters" element="tns:PostTaxResponse" />
822
+ </wsdl:message>
823
+ <wsdl:message name="PostTaxProfile">
824
+ <wsdl:part name="Profile" element="tns:Profile" />
825
+ </wsdl:message>
826
+ <wsdl:message name="CommitTaxSoapIn">
827
+ <wsdl:part name="parameters" element="tns:CommitTax" />
828
+ </wsdl:message>
829
+ <wsdl:message name="CommitTaxSoapOut">
830
+ <wsdl:part name="parameters" element="tns:CommitTaxResponse" />
831
+ </wsdl:message>
832
+ <wsdl:message name="CommitTaxAuditMessage">
833
+ <wsdl:part name="AuditMessage" element="tns:AuditMessage" />
834
+ </wsdl:message>
835
+ <wsdl:message name="CommitTaxProfile">
836
+ <wsdl:part name="Profile" element="tns:Profile" />
837
+ </wsdl:message>
838
+ <wsdl:message name="CancelTaxSoapIn">
839
+ <wsdl:part name="parameters" element="tns:CancelTax" />
840
+ </wsdl:message>
841
+ <wsdl:message name="CancelTaxSoapOut">
842
+ <wsdl:part name="parameters" element="tns:CancelTaxResponse" />
843
+ </wsdl:message>
844
+ <wsdl:message name="CancelTaxAuditMessage">
845
+ <wsdl:part name="AuditMessage" element="tns:AuditMessage" />
846
+ </wsdl:message>
847
+ <wsdl:message name="CancelTaxProfile">
848
+ <wsdl:part name="Profile" element="tns:Profile" />
849
+ </wsdl:message>
850
+ <wsdl:message name="ReconcileTaxHistorySoapIn">
851
+ <wsdl:part name="parameters" element="tns:ReconcileTaxHistory" />
852
+ </wsdl:message>
853
+ <wsdl:message name="ReconcileTaxHistorySoapOut">
854
+ <wsdl:part name="parameters" element="tns:ReconcileTaxHistoryResponse" />
855
+ </wsdl:message>
856
+ <wsdl:message name="ReconcileTaxHistoryProfile">
857
+ <wsdl:part name="Profile" element="tns:Profile" />
858
+ </wsdl:message>
859
+ <wsdl:message name="AdjustTaxSoapIn">
860
+ <wsdl:part name="parameters" element="tns:AdjustTax" />
861
+ </wsdl:message>
862
+ <wsdl:message name="AdjustTaxSoapOut">
863
+ <wsdl:part name="parameters" element="tns:AdjustTaxResponse" />
864
+ </wsdl:message>
865
+ <wsdl:message name="AdjustTaxProfile">
866
+ <wsdl:part name="Profile" element="tns:Profile" />
867
+ </wsdl:message>
868
+ <wsdl:message name="ApplyPaymentSoapIn">
869
+ <wsdl:part name="parameters" element="tns:ApplyPayment" />
870
+ </wsdl:message>
871
+ <wsdl:message name="ApplyPaymentSoapOut">
872
+ <wsdl:part name="parameters" element="tns:ApplyPaymentResponse" />
873
+ </wsdl:message>
874
+ <wsdl:message name="ApplyPaymentAuditMessage">
875
+ <wsdl:part name="AuditMessage" element="tns:AuditMessage" />
876
+ </wsdl:message>
877
+ <wsdl:message name="ApplyPaymentProfile">
878
+ <wsdl:part name="Profile" element="tns:Profile" />
879
+ </wsdl:message>
880
+ <!--New Methods-->
881
+ <wsdl:message name="SubmitBatchSoapIn">
882
+ <wsdl:part name="parameters" element="tns:SubmitBatch" />
883
+ </wsdl:message>
884
+ <wsdl:message name="SubmitBatchSoapOut">
885
+ <wsdl:part name="parameters" element="tns:SubmitBatchResponse" />
886
+ </wsdl:message>
887
+ <wsdl:message name="SubmitBatchProfile">
888
+ <wsdl:part name="Profile" element="tns:Profile" />
889
+ </wsdl:message>
890
+ <wsdl:message name="GetBatchSoapIn">
891
+ <wsdl:part name="parameters" element="tns:GetBatch" />
892
+ </wsdl:message>
893
+ <wsdl:message name="GetBatchSoapOut">
894
+ <wsdl:part name="parameters" element="tns:GetBatchResponse" />
895
+ </wsdl:message>
896
+ <wsdl:message name="GetBatchProfile">
897
+ <wsdl:part name="Profile" element="tns:Profile" />
898
+ </wsdl:message>
899
+ <wsdl:message name="CancelBatchSoapIn">
900
+ <wsdl:part name="parameters" element="tns:CancelBatch" />
901
+ </wsdl:message>
902
+ <wsdl:message name="CancelBatchSoapOut">
903
+ <wsdl:part name="parameters" element="tns:CancelBatchResponse" />
904
+ </wsdl:message>
905
+ <wsdl:message name="CancelBatchProfile">
906
+ <wsdl:part name="Profile" element="tns:Profile" />
907
+ </wsdl:message>
908
+ <!--New Methods-->
909
+ <wsdl:message name="PingSoapIn">
910
+ <wsdl:part name="parameters" element="tns:Ping" />
911
+ </wsdl:message>
912
+ <wsdl:message name="PingSoapOut">
913
+ <wsdl:part name="parameters" element="tns:PingResponse" />
914
+ </wsdl:message>
915
+ <wsdl:message name="PingProfile">
916
+ <wsdl:part name="Profile" element="tns:Profile" />
917
+ </wsdl:message>
918
+ <wsdl:message name="IsAuthorizedSoapIn">
919
+ <wsdl:part name="parameters" element="tns:IsAuthorized" />
920
+ </wsdl:message>
921
+ <wsdl:message name="IsAuthorizedSoapOut">
922
+ <wsdl:part name="parameters" element="tns:IsAuthorizedResponse" />
923
+ </wsdl:message>
924
+ <wsdl:message name="IsAuthorizedProfile">
925
+ <wsdl:part name="Profile" element="tns:Profile" />
926
+ </wsdl:message>
927
+ <wsdl:portType name="TaxSvcSoap">
928
+ <wsdl:operation name="GetTax">
929
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Calculates taxes on a document</wsdl:documentation>
930
+ <wsdl:input message="tns:GetTaxSoapIn" />
931
+ <wsdl:output message="tns:GetTaxSoapOut" />
932
+ </wsdl:operation>
933
+ <wsdl:operation name="GetTaxHistory">
934
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Retrieves a previously calculated tax document</wsdl:documentation>
935
+ <wsdl:input message="tns:GetTaxHistorySoapIn" />
936
+ <wsdl:output message="tns:GetTaxHistorySoapOut" />
937
+ </wsdl:operation>
938
+ <wsdl:operation name="PostTax">
939
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Posts a previously calculated tax</wsdl:documentation>
940
+ <wsdl:input message="tns:PostTaxSoapIn" />
941
+ <wsdl:output message="tns:PostTaxSoapOut" />
942
+ </wsdl:operation>
943
+ <wsdl:operation name="CommitTax">
944
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Commits a previously posted tax</wsdl:documentation>
945
+ <wsdl:input message="tns:CommitTaxSoapIn" />
946
+ <wsdl:output message="tns:CommitTaxSoapOut" />
947
+ </wsdl:operation>
948
+ <wsdl:operation name="CancelTax">
949
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Cancels a previously calculated tax. This is for use as a compensating action when posting on the client fails to complete.</wsdl:documentation>
950
+ <wsdl:input message="tns:CancelTaxSoapIn" />
951
+ <wsdl:output message="tns:CancelTaxSoapOut" />
952
+ </wsdl:operation>
953
+ <wsdl:operation name="ReconcileTaxHistory">
954
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Reconciles tax history to ensure the client data matches the AvaTax history.</wsdl:documentation>
955
+ <wsdl:input message="tns:ReconcileTaxHistorySoapIn" />
956
+ <wsdl:output message="tns:ReconcileTaxHistorySoapOut" />
957
+ </wsdl:operation>
958
+ <wsdl:operation name="AdjustTax">
959
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Adjusts taxes on an existing invoice</wsdl:documentation>
960
+ <wsdl:input message="tns:AdjustTaxSoapIn" />
961
+ <wsdl:output message="tns:AdjustTaxSoapOut" />
962
+ </wsdl:operation>
963
+ <wsdl:operation name="ApplyPayment">
964
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Applies a payment date to an existing invoice</wsdl:documentation>
965
+ <wsdl:input message="tns:ApplyPaymentSoapIn" />
966
+ <wsdl:output message="tns:ApplyPaymentSoapOut" />
967
+ </wsdl:operation>
968
+ <wsdl:operation name="SubmitBatch">
969
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Submits a batch of TaxSvc requests to be processed.</wsdl:documentation>
970
+ <wsdl:input message="tns:SubmitBatchSoapIn" />
971
+ <wsdl:output message="tns:SubmitBatchSoapOut" />
972
+ </wsdl:operation>
973
+ <wsdl:operation name="GetBatch">
974
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Gets the status and results of a submitted batch.</wsdl:documentation>
975
+ <wsdl:input message="tns:GetBatchSoapIn" />
976
+ <wsdl:output message="tns:GetBatchSoapOut" />
977
+ </wsdl:operation>
978
+ <wsdl:operation name="CancelBatch">
979
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Cancels an incomplete batch operation.</wsdl:documentation>
980
+ <wsdl:input message="tns:CancelBatchSoapIn" />
981
+ <wsdl:output message="tns:CancelBatchSoapOut" />
982
+ </wsdl:operation>
983
+ <wsdl:operation name="Ping">
984
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Tests connectivity and version of the service</wsdl:documentation>
985
+ <wsdl:input message="tns:PingSoapIn" />
986
+ <wsdl:output message="tns:PingSoapOut" />
987
+ </wsdl:operation>
988
+ <wsdl:operation name="IsAuthorized">
989
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Checks authentication and authorization to one or more operations on the service.</wsdl:documentation>
990
+ <wsdl:input message="tns:IsAuthorizedSoapIn" />
991
+ <wsdl:output message="tns:IsAuthorizedSoapOut" />
992
+ </wsdl:operation>
993
+ </wsdl:portType>
994
+ <wsdl:binding name="TaxSvcSoap" type="tns:TaxSvcSoap">
995
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
996
+ <wsdl:operation name="GetTax">
997
+ <soap:operation soapAction="http://avatax.avalara.com/services/GetTax" style="document" />
998
+ <wsdl:input>
999
+ <soap:body use="literal" />
1000
+ <soap:header message="tns:GetTaxProfile" part="Profile" use="literal" />
1001
+ </wsdl:input>
1002
+ <wsdl:output>
1003
+ <soap:body use="literal" />
1004
+ </wsdl:output>
1005
+ </wsdl:operation>
1006
+ <wsdl:operation name="GetTaxHistory">
1007
+ <soap:operation soapAction="http://avatax.avalara.com/services/GetTaxHistory" style="document" />
1008
+ <wsdl:input>
1009
+ <soap:body use="literal" />
1010
+ <soap:header message="tns:GetTaxHistoryProfile" part="Profile" use="literal" />
1011
+ </wsdl:input>
1012
+ <wsdl:output>
1013
+ <soap:body use="literal" />
1014
+ </wsdl:output>
1015
+ </wsdl:operation>
1016
+ <wsdl:operation name="PostTax">
1017
+ <soap:operation soapAction="http://avatax.avalara.com/services/PostTax" style="document" />
1018
+ <wsdl:input>
1019
+ <soap:body use="literal" />
1020
+ <soap:header message="tns:PostTaxProfile" part="Profile" use="literal" />
1021
+ </wsdl:input>
1022
+ <wsdl:output>
1023
+ <soap:body use="literal" />
1024
+ </wsdl:output>
1025
+ </wsdl:operation>
1026
+ <wsdl:operation name="CommitTax">
1027
+ <soap:operation soapAction="http://avatax.avalara.com/services/CommitTax" style="document" />
1028
+ <wsdl:input>
1029
+ <soap:body use="literal" />
1030
+ <soap:header message="tns:CommitTaxAuditMessage" part="AuditMessage" use="literal" />
1031
+ <soap:header message="tns:CommitTaxProfile" part="Profile" use="literal" />
1032
+ </wsdl:input>
1033
+ <wsdl:output>
1034
+ <soap:body use="literal" />
1035
+ </wsdl:output>
1036
+ </wsdl:operation>
1037
+ <wsdl:operation name="CancelTax">
1038
+ <soap:operation soapAction="http://avatax.avalara.com/services/CancelTax" style="document" />
1039
+ <wsdl:input>
1040
+ <soap:body use="literal" />
1041
+ <soap:header message="tns:CancelTaxAuditMessage" part="AuditMessage" use="literal" />
1042
+ <soap:header message="tns:CancelTaxProfile" part="Profile" use="literal" />
1043
+ </wsdl:input>
1044
+ <wsdl:output>
1045
+ <soap:body use="literal" />
1046
+ </wsdl:output>
1047
+ </wsdl:operation>
1048
+ <wsdl:operation name="ReconcileTaxHistory">
1049
+ <soap:operation soapAction="http://avatax.avalara.com/services/ReconcileTaxHistory" style="document" />
1050
+ <wsdl:input>
1051
+ <soap:body use="literal" />
1052
+ <soap:header message="tns:ReconcileTaxHistoryProfile" part="Profile" use="literal" />
1053
+ </wsdl:input>
1054
+ <wsdl:output>
1055
+ <soap:body use="literal" />
1056
+ </wsdl:output>
1057
+ </wsdl:operation>
1058
+ <wsdl:operation name="AdjustTax">
1059
+ <soap:operation soapAction="http://avatax.avalara.com/services/AdjustTax" style="document" />
1060
+ <wsdl:input>
1061
+ <soap:body use="literal" />
1062
+ <soap:header message="tns:AdjustTaxProfile" part="Profile" use="literal" />
1063
+ </wsdl:input>
1064
+ <wsdl:output>
1065
+ <soap:body use="literal" />
1066
+ </wsdl:output>
1067
+ </wsdl:operation>
1068
+ <wsdl:operation name="ApplyPayment">
1069
+ <soap:operation soapAction="http://avatax.avalara.com/services/ApplyPayment" style="document" />
1070
+ <wsdl:input>
1071
+ <soap:body use="literal" />
1072
+ <soap:header message="tns:ApplyPaymentAuditMessage" part="AuditMessage" use="literal" />
1073
+ <soap:header message="tns:ApplyPaymentProfile" part="Profile" use="literal" />
1074
+ </wsdl:input>
1075
+ <wsdl:output>
1076
+ <soap:body use="literal" />
1077
+ </wsdl:output>
1078
+ </wsdl:operation>
1079
+ <!--New Methods Begin-->
1080
+ <wsdl:operation name="SubmitBatch">
1081
+ <soap:operation soapAction="http://avatax.avalara.com/services/SubmitBatch" style="document" />
1082
+ <wsdl:input>
1083
+ <soap:body use="literal" />
1084
+ <soap:header message="tns:SubmitBatchProfile" part="Profile" use="literal" />
1085
+ </wsdl:input>
1086
+ <wsdl:output>
1087
+ <soap:body use="literal" />
1088
+ </wsdl:output>
1089
+ </wsdl:operation>
1090
+ <wsdl:operation name="GetBatch">
1091
+ <soap:operation soapAction="http://avatax.avalara.com/services/GetBatch" style="document" />
1092
+ <wsdl:input>
1093
+ <soap:body use="literal" />
1094
+ <soap:header message="tns:GetBatchProfile" part="Profile" use="literal" />
1095
+ </wsdl:input>
1096
+ <wsdl:output>
1097
+ <soap:body use="literal" />
1098
+ </wsdl:output>
1099
+ </wsdl:operation>
1100
+ <wsdl:operation name="CancelBatch">
1101
+ <soap:operation soapAction="http://avatax.avalara.com/services/CancelBatch" style="document" />
1102
+ <wsdl:input>
1103
+ <soap:body use="literal" />
1104
+ <soap:header message="tns:CancelBatchProfile" part="Profile" use="literal" />
1105
+ </wsdl:input>
1106
+ <wsdl:output>
1107
+ <soap:body use="literal" />
1108
+ </wsdl:output>
1109
+ </wsdl:operation>
1110
+ <!--New Methods End-->
1111
+ <wsdl:operation name="Ping">
1112
+ <soap:operation soapAction="http://avatax.avalara.com/services/Ping" style="document" />
1113
+ <wsdl:input>
1114
+ <soap:body use="literal" />
1115
+ <soap:header message="tns:PingProfile" part="Profile" use="literal" />
1116
+ </wsdl:input>
1117
+ <wsdl:output>
1118
+ <soap:body use="literal" />
1119
+ </wsdl:output>
1120
+ </wsdl:operation>
1121
+ <wsdl:operation name="IsAuthorized">
1122
+ <soap:operation soapAction="http://avatax.avalara.com/services/IsAuthorized" style="document" />
1123
+ <wsdl:input>
1124
+ <soap:body use="literal" />
1125
+ <soap:header message="tns:IsAuthorizedProfile" part="Profile" use="literal" />
1126
+ </wsdl:input>
1127
+ <wsdl:output>
1128
+ <soap:body use="literal" />
1129
+ </wsdl:output>
1130
+ </wsdl:operation>
1131
+ </wsdl:binding>
1132
+ <wsdl:binding name="TaxSvcSoap12" type="tns:TaxSvcSoap">
1133
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
1134
+ <wsdl:operation name="GetTax">
1135
+ <soap12:operation soapAction="http://avatax.avalara.com/services/GetTax" style="document" />
1136
+ <wsdl:input>
1137
+ <soap12:body use="literal" />
1138
+ <soap12:header message="tns:GetTaxProfile" part="Profile" use="literal" />
1139
+ </wsdl:input>
1140
+ <wsdl:output>
1141
+ <soap12:body use="literal" />
1142
+ </wsdl:output>
1143
+ </wsdl:operation>
1144
+ <wsdl:operation name="GetTaxHistory">
1145
+ <soap12:operation soapAction="http://avatax.avalara.com/services/GetTaxHistory" style="document" />
1146
+ <wsdl:input>
1147
+ <soap12:body use="literal" />
1148
+ <soap12:header message="tns:GetTaxHistoryProfile" part="Profile" use="literal" />
1149
+ </wsdl:input>
1150
+ <wsdl:output>
1151
+ <soap12:body use="literal" />
1152
+ </wsdl:output>
1153
+ </wsdl:operation>
1154
+ <wsdl:operation name="PostTax">
1155
+ <soap12:operation soapAction="http://avatax.avalara.com/services/PostTax" style="document" />
1156
+ <wsdl:input>
1157
+ <soap12:body use="literal" />
1158
+ <soap12:header message="tns:PostTaxProfile" part="Profile" use="literal" />
1159
+ </wsdl:input>
1160
+ <wsdl:output>
1161
+ <soap12:body use="literal" />
1162
+ </wsdl:output>
1163
+ </wsdl:operation>
1164
+ <wsdl:operation name="CommitTax">
1165
+ <soap12:operation soapAction="http://avatax.avalara.com/services/CommitTax" style="document" />
1166
+ <wsdl:input>
1167
+ <soap12:body use="literal" />
1168
+ <soap12:header message="tns:CommitTaxAuditMessage" part="AuditMessage" use="literal" />
1169
+ <soap12:header message="tns:CommitTaxProfile" part="Profile" use="literal" />
1170
+ </wsdl:input>
1171
+ <wsdl:output>
1172
+ <soap12:body use="literal" />
1173
+ </wsdl:output>
1174
+ </wsdl:operation>
1175
+ <wsdl:operation name="CancelTax">
1176
+ <soap12:operation soapAction="http://avatax.avalara.com/services/CancelTax" style="document" />
1177
+ <wsdl:input>
1178
+ <soap12:body use="literal" />
1179
+ <soap12:header message="tns:CancelTaxAuditMessage" part="AuditMessage" use="literal" />
1180
+ <soap12:header message="tns:CancelTaxProfile" part="Profile" use="literal" />
1181
+ </wsdl:input>
1182
+ <wsdl:output>
1183
+ <soap12:body use="literal" />
1184
+ </wsdl:output>
1185
+ </wsdl:operation>
1186
+ <wsdl:operation name="ReconcileTaxHistory">
1187
+ <soap12:operation soapAction="http://avatax.avalara.com/services/ReconcileTaxHistory" style="document" />
1188
+ <wsdl:input>
1189
+ <soap12:body use="literal" />
1190
+ <soap12:header message="tns:ReconcileTaxHistoryProfile" part="Profile" use="literal" />
1191
+ </wsdl:input>
1192
+ <wsdl:output>
1193
+ <soap12:body use="literal" />
1194
+ </wsdl:output>
1195
+ </wsdl:operation>
1196
+ <wsdl:operation name="AdjustTax">
1197
+ <soap12:operation soapAction="http://avatax.avalara.com/services/AdjustTax" style="document" />
1198
+ <wsdl:input>
1199
+ <soap12:body use="literal" />
1200
+ <soap12:header message="tns:AdjustTaxProfile" part="Profile" use="literal" />
1201
+ </wsdl:input>
1202
+ <wsdl:output>
1203
+ <soap12:body use="literal" />
1204
+ </wsdl:output>
1205
+ </wsdl:operation>
1206
+ <wsdl:operation name="ApplyPayment">
1207
+ <soap12:operation soapAction="http://avatax.avalara.com/services/ApplyPayment" style="document" />
1208
+ <wsdl:input>
1209
+ <soap12:body use="literal" />
1210
+ <soap12:header message="tns:ApplyPaymentAuditMessage" part="AuditMessage" use="literal" />
1211
+ <soap12:header message="tns:ApplyPaymentProfile" part="Profile" use="literal" />
1212
+ </wsdl:input>
1213
+ <wsdl:output>
1214
+ <soap12:body use="literal" />
1215
+ </wsdl:output>
1216
+ </wsdl:operation>
1217
+ <wsdl:operation name="Ping">
1218
+ <soap12:operation soapAction="http://avatax.avalara.com/services/Ping" style="document" />
1219
+ <wsdl:input>
1220
+ <soap12:body use="literal" />
1221
+ <soap12:header message="tns:PingProfile" part="Profile" use="literal" />
1222
+ </wsdl:input>
1223
+ <wsdl:output>
1224
+ <soap12:body use="literal" />
1225
+ </wsdl:output>
1226
+ </wsdl:operation>
1227
+ <wsdl:operation name="IsAuthorized">
1228
+ <soap12:operation soapAction="http://avatax.avalara.com/services/IsAuthorized" style="document" />
1229
+ <wsdl:input>
1230
+ <soap12:body use="literal" />
1231
+ <soap12:header message="tns:IsAuthorizedProfile" part="Profile" use="literal" />
1232
+ </wsdl:input>
1233
+ <wsdl:output>
1234
+ <soap12:body use="literal" />
1235
+ </wsdl:output>
1236
+ </wsdl:operation>
1237
+ <!--New Methods Begin-->
1238
+ <wsdl:operation name="SubmitBatch">
1239
+ <soap12:operation soapAction="http://avatax.avalara.com/services/SubmitBatch" style="document" />
1240
+ <wsdl:input>
1241
+ <soap12:body use="literal" />
1242
+ <soap12:header message="tns:SubmitBatchProfile" part="Profile" use="literal" />
1243
+ </wsdl:input>
1244
+ <wsdl:output>
1245
+ <soap12:body use="literal" />
1246
+ </wsdl:output>
1247
+ </wsdl:operation>
1248
+ <wsdl:operation name="GetBatch">
1249
+ <soap12:operation soapAction="http://avatax.avalara.com/services/GetBatch" style="document" />
1250
+ <wsdl:input>
1251
+ <soap12:body use="literal" />
1252
+ <soap12:header message="tns:GetBatchProfile" part="Profile" use="literal" />
1253
+ </wsdl:input>
1254
+ <wsdl:output>
1255
+ <soap12:body use="literal" />
1256
+ </wsdl:output>
1257
+ </wsdl:operation>
1258
+ <wsdl:operation name="CancelBatch">
1259
+ <soap12:operation soapAction="http://avatax.avalara.com/services/CancelBatch" style="document" />
1260
+ <wsdl:input>
1261
+ <soap12:body use="literal" />
1262
+ <soap12:header message="tns:CancelBatchProfile" part="Profile" use="literal" />
1263
+ </wsdl:input>
1264
+ <wsdl:output>
1265
+ <soap12:body use="literal" />
1266
+ </wsdl:output>
1267
+ </wsdl:operation>
1268
+ <!--New Methods End-->
1269
+ </wsdl:binding>
1270
+ <wsdl:service name="TaxSvc">
1271
+ <wsdl:port name="TaxSvcSoap" binding="tns:TaxSvcSoap">
1272
+ <soap:address location="http://localhost/avatax.services/Tax/TaxSvc.asmx" />
1273
+ </wsdl:port>
1274
+ <wsdl:port name="TaxSvcSoap12" binding="tns:TaxSvcSoap12">
1275
+ <soap12:address location="http://localhost/avatax.services/Tax/TaxSvc.asmx" />
1276
+ </wsdl:port>
1277
+ </wsdl:service>
1278
+ </wsdl:definitions>
app/code/community/OnePica/AvaTax/lib/functions.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * The functions below are copied from AvaTax.php. That file cannot be included because
20
+ * it defines the function __autoload(), which Magento already uses.
21
+ */
22
+
23
+ function EnsureIsArray( $obj )
24
+ {
25
+ if( is_object($obj))
26
+ {
27
+ $item[0] = $obj;
28
+ }
29
+ else
30
+ {
31
+ $item = (array)$obj;
32
+ }
33
+ return $item;
34
+ }
35
+
36
+ /**
37
+ * Takes xml as a string and returns it nicely indented
38
+ *
39
+ * @param string $xml The xml to beautify
40
+ * @param boolean $html_output If the xml should be formatted for display on an html page
41
+ * @return string The beautified xml
42
+ */
43
+ function xml_pretty_printer($xml, $html_output=FALSE)
44
+ {
45
+ $xml_obj = new SimpleXMLElement($xml);
46
+ $xml_lines = explode("n", $xml_obj->asXML());
47
+ $indent_level = 0;
48
+
49
+ $new_xml_lines = array();
50
+ foreach ($xml_lines as $xml_line) {
51
+ if (preg_match('#(<[a-z0-9:-]+((s+[a-z0-9:-]+="[^"]+")*)?>.*<s*/s*[^>]+>)|(<[a-z0-9:-]+((s+[a-z0-9:-]+="[^"]+")*)?s*/s*>)#i', $xml_line)) {
52
+ $new_line = str_pad('', $indent_level*4) . $xml_line;
53
+ $new_xml_lines[] = $new_line;
54
+ } elseif (preg_match('#<[a-z0-9:-]+((s+[a-z0-9:-]+="[^"]+")*)?>#i', $xml_line)) {
55
+ $new_line = str_pad('', $indent_level*4) . $xml_line;
56
+ $indent_level++;
57
+ $new_xml_lines[] = $new_line;
58
+ } elseif (preg_match('#<s*/s*[^>/]+>#i', $xml_line)) {
59
+ $indent_level--;
60
+ if (trim($new_xml_lines[sizeof($new_xml_lines)-1]) == trim(str_replace("/", "", $xml_line))) {
61
+ $new_xml_lines[sizeof($new_xml_lines)-1] .= $xml_line;
62
+ } else {
63
+ $new_line = str_pad('', $indent_level*4) . $xml_line;
64
+ $new_xml_lines[] = $new_line;
65
+ }
66
+ } else {
67
+ $new_line = str_pad('', $indent_level*4) . $xml_line;
68
+ $new_xml_lines[] = $new_line;
69
+ }
70
+ }
71
+
72
+ $xml = join("n", $new_xml_lines);
73
+ return ($html_output) ? '<pre>' . htmlentities($xml) . '</pre>' : $xml;
74
+ }
app/code/community/OnePica/AvaTax/sql/avatax_records_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ $installer = $this;
20
+
21
+ $installer->startSetup();
22
+
23
+ try {
24
+ $installer->run("
25
+
26
+ ALTER TABLE `" . $this->getTable('tax/tax_class') . "`
27
+ ADD `op_avatax_code` VARCHAR(255) DEFAULT '' NOT NULL COMMENT 'Used by One Pica AvaTax extension'
28
+ AFTER `class_name`;
29
+
30
+ ");
31
+ } catch(Exception $e) { }
32
+
33
+ $installer->endSetup();
app/code/community/OnePica/AvaTax/sql/avatax_records_setup/mysql4-upgrade-0.1.4-0.1.5.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ $installer = $this;
20
+
21
+ $this->startSetup();
22
+
23
+ $installer->run("CREATE TABLE IF NOT EXISTS `" . $this->getTable('avatax_records/log') . "` (
24
+ `log_id` INT UNSIGNED AUTO_INCREMENT,
25
+ `store_id` SMALLINT (5) UNSIGNED,
26
+ `level` VARCHAR (50),
27
+ `type` VARCHAR (50),
28
+ `request` TEXT,
29
+ `result` TEXT,
30
+ `additional` TEXT,
31
+ `created_at` DATETIME,
32
+ PRIMARY KEY(`log_id`)) COMMENT = 'Used by One Pica AvaTax extension' ENGINE = InnoDB");
33
+
34
+ $this->endSetup();
app/code/community/OnePica/AvaTax/sql/avatax_records_setup/mysql4-upgrade-1.0.1-2.0.0.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ $installer = $this;
20
+
21
+ $this->startSetup();
22
+
23
+ $installer->run("CREATE TABLE IF NOT EXISTS `" . $this->getTable('avatax_records/queue') . "` (
24
+ `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
25
+ `store_id` SMALLINT(5) UNSIGNED NULL DEFAULT NULL,
26
+ `entity_id` INT(10) UNSIGNED NOT NULL,
27
+ `entity_increment_id` VARCHAR(50) NOT NULL,
28
+ `type` ENUM('Invoice','Credit memo') NOT NULL,
29
+ `status` ENUM('Pending','Retry pending','Failed','Complete','Unbalanced') NOT NULL DEFAULT 'pending',
30
+ `attempt` TINYINT UNSIGNED NOT NULL DEFAULT '0',
31
+ `message` VARCHAR (255) NULL DEFAULT NULL,
32
+ `created_at` DATETIME NOT NULL,
33
+ `updated_at` DATETIME NOT NULL,
34
+ PRIMARY KEY (`id`)
35
+ ) COMMENT = 'Used by One Pica AvaTax extension' ENGINE = InnoDB");
36
+
37
+ $this->endSetup();
app/code/community/OnePica/AvaTax/sql/avatax_records_setup/mysql4-upgrade-2.2.0-2.2.1.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OnePica_AvaTax
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category OnePica
12
+ * @package OnePica_AvaTax
13
+ * @author OnePica Codemaster <codemaster@onepica.com>
14
+ * @copyright Copyright (c) 2009 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ $installer = $this;
20
+
21
+ $this->startSetup();
22
+
23
+ $installer->run("
24
+ UPDATE `" . $this->getTable('tax/tax_class') . "`
25
+ SET `class_name`='Shipping (not used by AvaTax)'
26
+ WHERE `class_name`='Shipping' AND `class_type`='" . Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT . "';
27
+ ");
28
+
29
+ $this->endSetup();
app/etc/modules/OnePica_AvaTax.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <OnePica_AvaTax>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </OnePica_AvaTax>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>OnePica_AvaTax</name>
4
+ <version>2.4.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>Open Software License (OSL 3.0)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension integrates Magento with AvaTax, a tax service provided by Avalara. This will replace existing Magento-based, zipcode tax calculation with the more complex and centralized rules AvaTax provides.</summary>
10
+ <description>This extension integrates Magento with AvaTax, a tax service provided by Avalara. This will replace existing Magento-based, zipcode tax calculation with the more complex and centralized rules AvaTax provides.&#xD;
11
+ &#xD;
12
+ For details about AvaTax and the functionality it provides, please visit www.avalara.com.&#xD;
13
+ Released as a commercial extension, this software will not work unless you have a valid AvaTax account. To obtain the installation key, please contact your Avalara representative.&#xD;
14
+ &#xD;
15
+ At One Pica (www.onepica.com), we strive to build increasingly scalable and flexible enterprise systems for all of our clients, large and small. We want to give back to this community both to promote its success and as a sign of our gratitude. Please feel free to contact us on ways we can improve this extension or extend on this framework.</description>
16
+ <notes>Added support for Enterprise functionality for gift wrapping and messaging, increased capability to filter tax calls in the cart tax and shipping estimator.</notes>
17
+ <authors><author><name>One Pica Codemaster</name><user>onepica</user><email>codemaster@onepica.com</email></author></authors>
18
+ <date>2012-06-18</date>
19
+ <time>16:11:55</time>
20
+ <contents><target name="magecommunity"><dir name="OnePica"><dir name="AvaTax"><dir name="Block"><dir name="Adminhtml"><dir name="Export"><dir name="Abstract"><file name="Grid.php" hash="b5db0baa25adca61990553cdfae054f8"/></dir><dir name="Log"><file name="Grid.php" hash="c6bb9de3726a50b0cdd2521b26453826"/></dir><dir name="Queue"><file name="Grid.php" hash="4636d4ac081ab67534f4a67923548f97"/></dir></dir><dir name="Notification"><file name="Toolbar.php" hash="a0cb132e6fb73412879a5b0b7f85871c"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Export.php" hash="a834887971b517d7141cb2c8868d68b1"/></dir></dir></dir></dir><dir name="Tax"><dir name="Class"><dir name="Edit"><file name="Form.php" hash="a34316cf45867eb83de49243f0fdf4c6"/></dir><file name="Grid.php" hash="a7222bf20619ea8104e4d3d0066f27fd"/></dir></dir></dir><dir name="Checkout"><dir name="Onepage"><dir name="Shipping"><dir name="Method"><file name="Available.php" hash="d8af44108fc4b6da43ebe039acb0dea0"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="43b9d348dd541ab5d0b20cc14b623276"/><dir name="Tax"><file name="Data.php" hash="81edee6048e5e9487f5c0a3e985d1b15"/></dir></dir><dir name="Model"><file name="Abstract.php" hash="2726b0e3fd4985d30e63720831be3ded"/><dir name="Admin"><file name="Session.php" hash="e19ebf06208e3d2edef45683401fe7a8"/></dir><dir name="Adminhtml"><file name="Config.php" hash="9b6824426007b7714f58bab8dd857f2b"/><dir name="Sales"><dir name="Order"><file name="Create.php" hash="21d324f879214b08894f9c672aac5d16"/></dir></dir></dir><dir name="Avatax"><file name="Abstract.php" hash="557caa8520555003ff20f87369734bd9"/><file name="Address.php" hash="8752e8b8edcf9011a8b6d41f69e86ed0"/><file name="Estimate.php" hash="ee51a6c82cca2611d3a046d8e2f4461e"/><dir name="Exception"><file name="Address.php" hash="9052a48d9c3b46811c3db4090dc610d4"/><file name="Commitfailure.php" hash="23559a21d37fd14904f088e8c2357992"/><file name="Unbalanced.php" hash="3ee206bb1cfb87cceae006a2c1b6b5e7"/></dir><file name="Invoice.php" hash="1781b3f3586a5f0e8cc7eba249f6152d"/><file name="Ping.php" hash="61fc25b14e144ffbae8629e497cd5305"/></dir><file name="Config.php" hash="7f202ecb12a601971369714f1281d5ba"/><file name="Observer.php" hash="29f3b36cc3ee84b06e5d38f142eb7594"/><dir name="Records"><file name="Log.php" hash="f9ba2ae74bf896bbb10193ab8701975a"/><dir name="Mysql4"><dir name="Log"><file name="Collection.php" hash="14344f43b12f84d745f522589b83e271"/></dir><file name="Log.php" hash="dd367bc03d936fab12d93b5a950ec102"/><dir name="Queue"><file name="Collection.php" hash="faac004ece9a1e413f870dedfc925e38"/></dir><file name="Queue.php" hash="6a792249159a89fb4ae81bec09d8d227"/></dir><dir name="Queue"><file name="Process.php" hash="2cbce4248c0ceff2492a410067872fd5"/></dir><file name="Queue.php" hash="881da6750ca3e3e43425b3182533b39d"/></dir><dir name="Sales"><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Grand.php" hash="ce472ac13ac610db29175afc735c5701"/><file name="Tax.php" hash="9c3b7cf9a499296b5a0c0a55d9e31fc2"/></dir></dir><file name="Address.php" hash="1d081008d83046eba3869006918dc171"/></dir></dir><file name="Session.php" hash="72849341ba81db155cc8d998b7dfef69"/><dir name="Source"><file name="Actions.php" hash="55cde933437761b778ebea15075568ab"/><file name="Customercodeformat.php" hash="1478c6fcba951ae497e7621d6cf808e0"/><file name="Error.php" hash="467b37421490cfe5eba060fc5e1af240"/><file name="Logmode.php" hash="63ab9699d71f2a6031a37d249c816b10"/><file name="Onerrorfrontend.php" hash="9ecd5015d95925adfe1626634d91820e"/><dir name="Regionfilter"><file name="List.php" hash="3b86c8f2a69aeeb9eb0c1988393f10ac"/><file name="Mode.php" hash="1a1bc328674db870d0cf4ef69a05de17"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ExportController.php" hash="3d770db9c1dbc8199c305e69387b679f"/><file name="GridController.php" hash="a8c319bc7815618399e56bad11f36fb8"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="33c360104d36eed21cd7172637fb6227"/><file name="config.xml" hash="53005377a02bf49daa21acdfe6fd76a7"/><file name="system-disabled.xml" hash="851329d6173bca6f2a2f074880c8289a"/><file name="system.xml" hash="f9dff318f3a544ab8fdf376dcc6fa5f5"/></dir><dir name="lib"><file name="AvaTax.php" hash="d9d2ac44a3a7a4d5ca34752df3d70afb"/><dir name="classes"><file name="ATConfig.class.php" hash="9ccc6722b520cf4068235ecea5d9cade"/><file name="ATObject.class.php" hash="b9b910adcb86703cff3a59f38665a003"/><file name="AVObject.class.php" hash="b65c5532b01074a57a20703513148301"/><file name="Address.class.php" hash="06f5487c223132005a65d633930f5b72"/><file name="AddressServiceSoap.class.php" hash="776cbf348c32a7dc20cc47f90b2cc806"/><file name="AddressType.class.php" hash="1458d719ab0c4d1ff93244527b8c75cf"/><file name="AdjustTaxRequest.class.php" hash="a67ce5082335bcd553ac7ead85a7a36c"/><file name="AdjustTaxResult.class.php" hash="0fb71e82a0aa38ff792fb45d3b19c664"/><file name="ApplyPaymentRequest.class.php" hash="65fab85ca47b7c9ad84e861d6e2e9a01"/><file name="ApplyPaymentResult.class.php" hash="ddf7a332575f7c972f11f95430179b01"/><file name="AvalaraSoapClient.class.php" hash="e3561a81c82ac293767271195c8cf2e5"/><file name="BaseResult.class.php" hash="8dc91ad90e7b9fb12dbea3d5e3279892"/><dir name="BatchSvc"><file name="AuditMessage.class.php" hash="b2cf0248904656cd10b3d28f3cfa25a1"/><file name="AvaTaxBatchSvc.php" hash="2c6ecf16cec6926ca0438772c08e4f70"/><file name="BaseResult.class.php" hash="911a199f0fd54e00ccab6fad53f89ba3"/><file name="Batch.class.php" hash="ded2b8509c4223732b91608fffea43a5"/><file name="BatchDelete.class.php" hash="27b5510c8199a6e348e7c983a1b68778"/><file name="BatchDeleteResponse.class.php" hash="a181bdf63032b6f292f32a3c2d8dc008"/><file name="BatchFetch.class.php" hash="efeee6d7bcc181c1a4d4a5d165169ca8"/><file name="BatchFetchResponse.class.php" hash="e5c8f28218e1240cf360a61456baeeb5"/><file name="BatchFetchResult.class.php" hash="10549cd50bc803814381bea5e62d951e"/><file name="BatchFile.class.php" hash="0ef50e2a8147f2f57d3072128f6561ee"/><file name="BatchFileDelete.class.php" hash="b937b21facf90fb1db1f1ee70a0fefdd"/><file name="BatchFileDeleteResponse.class.php" hash="8753ed5b4aa5ed2b8f790b5d529698d2"/><file name="BatchFileFetch.class.php" hash="3a374c13d668707e004d779ee6377880"/><file name="BatchFileFetchResponse.class.php" hash="09fe9b8cc3a426b3ab13b4eb9a462914"/><file name="BatchFileFetchResult.class.php" hash="49e84f4dd96483229649539e4bcea9bd"/><file name="BatchFileSave.class.php" hash="72589688feea7a1d6afd1c27794b2585"/><file name="BatchFileSaveResponse.class.php" hash="1850184ea711a501f61ad3cbd7284069"/><file name="BatchFileSaveResult.class.php" hash="1266eefddc041b850b58616935300187"/><file name="BatchProcess.class.php" hash="60912e77dd6e6a0f6629b2e86ce0df09"/><file name="BatchProcessRequest.class.php" hash="a01a7987cc0dc962ee1499f0ab92f346"/><file name="BatchProcessResponse.class.php" hash="db13565dc7b3b1544ef5ada36c32a568"/><file name="BatchProcessResult.class.php" hash="7a4d631658c89539ea07a0236b17cf13"/><file name="BatchSave.class.php" hash="616295413418b16410cd008e3f20b28b"/><file name="BatchSaveResponse.class.php" hash="2cb0ada61c6501877c08da49bbb4a946"/><file name="BatchSaveResult.class.php" hash="bced01bdbfbdd476bca9c9d0176bd785"/><file name="BatchSvc.class.php" hash="a42b48303d7ffa8074821d738ec5b37e"/><file name="DeleteRequest.class.php" hash="259dd71651fbc6307e3ba39ba37b0982"/><file name="DeleteResult.class.php" hash="8c39215b0e317f7834a147869ca7fb17"/><file name="FetchRequest.class.php" hash="3b2cea507374b08bd6b6ea23c9487494"/><file name="FilterRequest.class.php" hash="14d910ba0d03a2179263a03404a85194"/><file name="FilterResult.class.php" hash="0608a53670e6e156628451303d11ace3"/><file name="IsAuthorized.class.php" hash="589c1aff4109cc480312675f2e04aa0e"/><file name="IsAuthorizedResponse.class.php" hash="64db8c37e7946c2902ea9e46ae86cb78"/><file name="IsAuthorizedResult.class.php" hash="5b177cc88d91c63ee998fe5712b44bcc"/><file name="Message.class.php" hash="034c2276b6de0eb234f63d9cb5c1dae0"/><file name="Ping.class.php" hash="119c38ad0e7cd85eb1b550d51a6e2425"/><file name="PingResponse.class.php" hash="f92a631e8c09cfa884acd6b820232e83"/><file name="PingResult.class.php" hash="f818d99e05c0d3c014dbf3e5986ec599"/><file name="Profile.class.php" hash="7fda4e5d8db696d854cd7d1cec25f799"/><file name="SeverityLevel.class.php" hash="043ecef6038f2e95fe282f4c979af425"/></dir><file name="BoundaryLevel.class.php" hash="9a27f3e00bbe8dde729e7e54fb323d62"/><file name="CancelCode.class.php" hash="ef3f56a04d1aade150cb08c3a9134c9b"/><file name="CancelTaxRequest.class.php" hash="19d5af5d81c6e125766c927e76971e4e"/><file name="CancelTaxResult.class.php" hash="07228ddee4ab305bc9b1512b996105f7"/><file name="CommitTaxRequest.class.php" hash="b066a6d15874be72549053f66826c9e1"/><file name="CommitTaxResult.class.php" hash="30372831394d6bdeb705b93af413b71f"/><file name="DetailLevel.class.php" hash="82c39ae81735c84cf42e45f08d2a09a9"/><file name="DocStatus.class.php" hash="bbdb6cc343319bb996f5780d90d3a5a0"/><file name="DocumentType.class.php" hash="d27a4700fefed81cb9f8c701c3939982"/><file name="DynamicSoapClient.class.php" hash="0ab14d845214d6a4c4d1dbe32666bf2f"/><file name="Enum.class.php" hash="0d16eadf4c991e7f52ef41de5cbc92e7"/><file name="GetTaxHistoryRequest.class.php" hash="b598dcee1bcaa13e4c123e558bc5d545"/><file name="GetTaxHistoryResult.class.php" hash="4c85747ef17f770ae4ec94d9e27f681f"/><file name="GetTaxRequest.class.php" hash="fa70226c752f353c3e136f7f530721cf"/><file name="GetTaxResult.class.php" hash="e2cf17e68126a6b0e4f5440a072dc581"/><file name="IsAuthorizedResult.class.php" hash="c570782cd50745810995c787048c8864"/><file name="JurisdictionType.class.php" hash="68b8022228fbc22d60fd74914f2a2749"/><file name="Line.class.php" hash="9afc25c9ce2581b929173d92af8b801d"/><file name="Message.class.php" hash="06a099c0f099e4e6a10c3be887b07b30"/><file name="PingResult.class.php" hash="22d83358dd7c4f8ffe3e720da3c1b565"/><file name="PostTaxRequest.class.php" hash="3301991ededc9fbad1dd45c6aa80dc51"/><file name="PostTaxResult.class.php" hash="36f02467db90d6beb33681e4f1c0a26e"/><file name="ReconcileTaxHistoryRequest.class.php" hash="ce0164310a18a7d464217ce69d7b4fc2"/><file name="ReconcileTaxHistoryResult.class.php" hash="baab8d603255b246731bcb7bca149596"/><file name="SearchTaxHistoryResult.class.php" hash="6a86da07d80fff3518a2be6e74694662"/><file name="ServiceMode.class.php" hash="9a4e633e225d4cdc62b28a041ca4d739"/><file name="SeverityLevel.class.php" hash="72d3fe39e2ced741aa8917b8e8be7c6f"/><file name="TaxDetail.class.php" hash="b6be13edfa217119a5c82c3a291ba340"/><file name="TaxLine.class.php" hash="be67b350e74efc326d1d6dcf5a21978c"/><file name="TaxOverride.class.php" hash="b0f99ad5bfe71e06bfcb60312032fdb3"/><file name="TaxOverrideType.class.php" hash="f5d2434c2a369605f82d2a182ddbea74"/><file name="TaxRequest.class.php" hash="7a6a1dbf317aedb18b225efa7c90da88"/><file name="TaxServiceSoap.class.php" hash="9deec191eb6a90239eaed2537d06ffe1"/><file name="TaxType.class.php" hash="a8a6fe2ed98440606f50190e3f5aa914"/><file name="TextCase.class.php" hash="dd265892e4733ef7f2e6d5cd53daa087"/><file name="ValidAddress.class.php" hash="9aef14ddcda74827f288bce6cf5e18e0"/><file name="ValidateRequest.class.php" hash="df76ee0d0acef422e1640796f627bd4f"/><file name="ValidateResult.class.php" hash="cd7fff7ffa3fbc9d04d3fe15b9d877e9"/><dir name="wsdl"><file name="Address.wsdl" hash="2ca743760c961db0ae03e4c6900667cb"/><file name="BatchSvc.wsdl" hash="eae666b959c1889d586919da4ebccefd"/><file name="Tax.wsdl" hash="03e2e9f97c0a553d91ca42c53d64a83b"/></dir></dir><file name="functions.php" hash="b94adf9f4887ff8f023fdaff5c64d974"/></dir><dir name="sql"><dir name="avatax_records_setup"><file name="mysql4-install-0.1.0.php" hash="cae21cd6e672cb07b606b5ab58fc5fd7"/><file name="mysql4-upgrade-0.1.4-0.1.5.php" hash="3bde3555bafe3f4dbb6b620b75abfa02"/><file name="mysql4-upgrade-1.0.1-2.0.0.php" hash="1b6d23e38621253e76c12a48e5494c64"/><file name="mysql4-upgrade-2.2.0-2.2.1.php" hash="82c4fc41cf9a235072c585028c23fecd"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="OnePica_AvaTax.xml" hash="9a548b57f519da49acf5fe116d2aeabe"/></dir></target></contents>
21
+ <compatible/>
22
+ <dependencies><required><php><min>5.2.3</min><max>6.0.0</max></php><extension><name>curl</name><min></min><max></max></extension><extension><name>soap</name><min></min><max></max></extension></required></dependencies>
23
+ </package>