OnePica_AvaTax - Version 3.2.2

Version Notes

Implemented show up plugin version in System configuration
Fixed Unexpected tax class is used for simple child of configurable products
Fixed Filter logs being saved in Log grid, although not selected in configuration
Fixed Composer install issue
Fixed Validation requests are not sent during Multiple checkout each time user changes Shipping address via Change button
Fixed Invoice and Credit memo is sent from AvaTax Order Sync Queue to AvaTax admin Console after clicking "Process Queue Now" button when AvaTax is disabled
Fixed Size, color attributes values are incorrect in GetTax request after they were configured in Data Mapping block

Download this release

Release Info

Developer Astound Commerce
Extension OnePica_AvaTax
Version 3.2.2
Comparing to
See all releases


Code changes from version 3.2.1 to 3.2.2

Files changed (64) hide show
  1. app/code/community/OnePica/AvaTax/Helper/Address.php +98 -50
  2. app/code/community/OnePica/AvaTax/Model/Action/Validator.php +3 -3
  3. app/code/community/OnePica/AvaTax/Model/Adminhtml/Config.php +32 -0
  4. app/code/community/OnePica/AvaTax/Model/Observer/ControllerActionPostdispatchCheckoutMultishippingAddressEditShipping.php +0 -53
  5. app/code/community/OnePica/AvaTax/Model/Observer/ControllerActionPredispatchCheckoutMultishippingAddressEditShippingPost.php +0 -97
  6. app/code/community/OnePica/AvaTax/Model/Observer/ControllerActionPredispatchCustomerAddressFormPost.php +256 -0
  7. app/code/community/OnePica/AvaTax/Model/Records/Queue/Process.php +43 -2
  8. app/code/community/OnePica/AvaTax/Model/Service/Abstract/Tools.php +37 -0
  9. app/code/community/OnePica/AvaTax/Model/Service/Avatax/Estimate.php +1 -1
  10. app/code/community/OnePica/AvaTax/Model/Service/Avatax/Invoice.php +1 -1
  11. app/code/community/OnePica/AvaTax/Model/Service/Avatax16/Abstract.php +12 -12
  12. app/code/community/OnePica/AvaTax/Model/Service/Avatax16/Address.php +7 -7
  13. app/code/community/OnePica/AvaTax/Model/Service/Avatax16/Config.php +16 -9
  14. app/code/community/OnePica/AvaTax/Model/Service/Avatax16/Estimate.php +10 -10
  15. app/code/community/OnePica/AvaTax/Model/Service/Avatax16/Invoice.php +1 -1
  16. app/code/community/OnePica/AvaTax/Model/Service/Avatax16/Ping.php +1 -1
  17. app/code/community/OnePica/AvaTax/Model/Service/Avatax16/Tax.php +5 -5
  18. app/code/community/OnePica/AvaTax/Model/Source/Logtype.php +11 -0
  19. app/code/community/OnePica/AvaTax/etc/config.xml +11 -1
  20. app/code/community/OnePica/AvaTax/etc/system.xml +4 -1
  21. lib/OnePica/AvaTax16/AddressResolution.php +9 -8
  22. lib/OnePica/AvaTax16/AddressResolution/PingResponse.php +14 -6
  23. lib/OnePica/AvaTax16/AddressResolution/ResolveSingleAddressResponse.php +35 -19
  24. lib/OnePica/AvaTax16/AddressResolution/TaxAuthority.php +20 -8
  25. lib/OnePica/AvaTax16/Calculation.php +16 -15
  26. lib/OnePica/AvaTax16/Calculation/ListItemResponse.php +32 -20
  27. lib/OnePica/AvaTax16/Calculation/ListItemResponse/CalculatedTaxSummary.php +36 -17
  28. lib/OnePica/AvaTax16/Calculation/ListItemResponse/CalculatedTaxSummary/TaxByType.php +21 -12
  29. lib/OnePica/AvaTax16/Calculation/ListItemResponse/CalculatedTaxSummary/TaxByType/Details.php +21 -10
  30. lib/OnePica/AvaTax16/Calculation/ListItemResponse/Header.php +32 -12
  31. lib/OnePica/AvaTax16/Calculation/ListItemResponse/Line.php +11 -5
  32. lib/OnePica/AvaTax16/Calculation/ListItemResponse/ProcessingInfo.php +32 -12
  33. lib/OnePica/AvaTax16/Calculation/ListResponse.php +20 -10
  34. lib/OnePica/AvaTax16/Config.php +25 -24
  35. lib/OnePica/AvaTax16/Document/Part.php +40 -39
  36. lib/OnePica/AvaTax16/Document/Part/Feedback.php +12 -6
  37. lib/OnePica/AvaTax16/Document/Part/Feedback/LatencyData.php +14 -6
  38. lib/OnePica/AvaTax16/Document/Part/Location.php +44 -26
  39. lib/OnePica/AvaTax16/Document/Part/Location/Address.php +47 -17
  40. lib/OnePica/AvaTax16/Document/Part/Location/LatLong.php +14 -6
  41. lib/OnePica/AvaTax16/Document/Request.php +31 -19
  42. lib/OnePica/AvaTax16/Document/Request/Header.php +71 -32
  43. lib/OnePica/AvaTax16/Document/Request/Line.php +64 -29
  44. lib/OnePica/AvaTax16/Document/Response.php +43 -27
  45. lib/OnePica/AvaTax16/Document/Response/CalculatedTaxSummary.php +30 -15
  46. lib/OnePica/AvaTax16/Document/Response/CalculatedTaxSummary/TaxByType.php +21 -12
  47. lib/OnePica/AvaTax16/Document/Response/CalculatedTaxSummary/TaxByType/Details.php +21 -10
  48. lib/OnePica/AvaTax16/Document/Response/Header.php +66 -29
  49. lib/OnePica/AvaTax16/Document/Response/Line.php +70 -33
  50. lib/OnePica/AvaTax16/Document/Response/Line/CalculatedTax.php +24 -14
  51. lib/OnePica/AvaTax16/Document/Response/Line/CalculatedTax/Details.php +47 -18
  52. lib/OnePica/AvaTax16/Document/Response/Line/CalculatedTax/TaxByType.php +13 -9
  53. lib/OnePica/AvaTax16/Document/Response/ProcessingInfo.php +32 -12
  54. lib/OnePica/AvaTax16/Exception.php +5 -4
  55. lib/OnePica/AvaTax16/IO/CaseInsensitiveArray.php +20 -19
  56. lib/OnePica/AvaTax16/IO/Curl.php +136 -134
  57. lib/OnePica/AvaTax16/ResourceAbstract.php +26 -23
  58. lib/OnePica/AvaTax16/TaxService.php +55 -64
  59. lib/OnePica/AvaTax16/Transaction.php +28 -25
  60. lib/OnePica/AvaTax16/Transaction/ListItemResponse.php +7 -5
  61. lib/OnePica/AvaTax16/Transaction/ListResponse.php +20 -10
  62. lib/OnePica/AvaTax16/Transaction/TransitionTransactionStateResponse.php +17 -8
  63. lib/OnePica/autoload.php +6 -6
  64. package.xml +11 -5
app/code/community/OnePica/AvaTax/Helper/Address.php CHANGED
@@ -27,32 +27,42 @@ class OnePica_AvaTax_Helper_Address extends Mage_Core_Helper_Abstract
27
  /**
28
  * Determines if address normalization is enabled
29
  *
30
- * @param Mage_Customer_Model_Address $address
31
- * @param int $storeId
32
  *
33
  * @return bool
34
  */
35
  public function isAddressNormalizationOn($address, $storeId)
36
  {
37
- if (!$this->isAddressActionable($address, $storeId, OnePica_AvaTax_Model_Service_Abstract_Config::REGIONFILTER_ALL, true)) {
 
 
 
 
38
  return false;
39
  }
 
40
  return $this->_getConfigData()->getNormalizeAddress($storeId);
41
  }
42
 
43
  /**
44
  * Determines if address validation is enabled
45
  *
46
- * @param Mage_Customer_Model_Address $address
47
- * @param int $storeId
48
  *
49
  * @return bool
50
  */
51
  public function isAddressValidationOn($address, $storeId)
52
  {
53
- if (!$this->isAddressActionable($address, $storeId, OnePica_AvaTax_Model_Service_Abstract_Config::REGIONFILTER_ALL, true)) {
 
 
 
 
54
  return false;
55
  }
 
56
  return $this->_getConfigData()->getValidateAddress($storeId);
57
  }
58
 
@@ -69,21 +79,24 @@ class OnePica_AvaTax_Helper_Address extends Mage_Core_Helper_Abstract
69
  /**
70
  * Determines if the address should be filtered
71
  *
72
- * @param Mage_Customer_Model_Address $address
73
- * @param int $storeId
74
- * @param int $filterMode
75
- * @param bool $isAddressValidation
76
  *
77
  * @return bool
78
  */
79
- public function isAddressActionable($address, $storeId, $filterMode = OnePica_AvaTax_Model_Service_Abstract_Config::REGIONFILTER_ALL,
80
- $isAddressValidation = false
81
- )
82
- {
 
 
83
  $filter = false;
84
 
85
  if ($this->_getConfigData()->getStatusServiceAction($storeId)
86
- == OnePica_AvaTax_Model_Service_Abstract_Config::ACTION_DISABLE) {
 
87
  return false;
88
  }
89
 
@@ -91,8 +104,11 @@ class OnePica_AvaTax_Helper_Address extends Mage_Core_Helper_Abstract
91
  $filter = $this->_getFilterRegion($address, $storeId);
92
  }
93
 
94
- if ($isAddressValidation && $filter
95
- && ((int)$this->getRegionFilterModByStore($storeId) !== OnePica_AvaTax_Model_Service_Abstract_Config::REGIONFILTER_ALL)
 
 
 
96
  ) {
97
  $filter = false;
98
  }
@@ -101,33 +117,38 @@ class OnePica_AvaTax_Helper_Address extends Mage_Core_Helper_Abstract
101
  $filter = 'country';
102
  }
103
 
104
- if ($isAddressValidation && !$filter
 
105
  && !in_array($address->getCountryId(), $this->getAddressValidationCountries())
106
  ) {
107
  $filter = 'country';
108
  }
109
 
110
- if ($filter && Mage::helper('avatax')->getLogMode($storeId)) {
111
- $filterLog = Mage::getSingleton('avatax/session')->getFilterLog();
112
- if (!is_array($filterLog)) {
113
- $filterLog = array();
114
- }
115
- $key = $address->getCacheHashKey();
116
-
117
- //did we already log this filtered address?
118
- if (!in_array($key, $filterLog)) {
119
- $filterLog[] = $key;
120
- Mage::getSingleton('avatax/session')->setFilterLog($filterLog);
121
-
122
- $type = ($filterMode == OnePica_AvaTax_Model_Service_Abstract_Config::REGIONFILTER_TAX) ?
123
- 'tax_calc' : 'tax_calc|address_opts';
124
- Mage::getModel('avatax_records/log')
125
- ->setStoreId($storeId)
126
- ->setLevel('Success')
127
- ->setType('Filter')
128
- ->setRequest(print_r($address->debug(), true))
129
- ->setResult('filter: ' . $filter . ', type: ' . $type)
130
- ->save();
 
 
 
 
131
  }
132
  }
133
 
@@ -140,7 +161,6 @@ class OnePica_AvaTax_Helper_Address extends Mage_Core_Helper_Abstract
140
  * @param null|int $storeId
141
  *
142
  * @return int
143
- * @internal param int $store
144
  */
145
  public function getRegionFilterModByStore($storeId = null)
146
  {
@@ -156,7 +176,7 @@ class OnePica_AvaTax_Helper_Address extends Mage_Core_Helper_Abstract
156
  public function getRegionFilterModByCurrentScope()
157
  {
158
  $websiteId = Mage::app()->getRequest()->get('website');
159
- $storeId = Mage::app()->getRequest()->get('store');
160
 
161
  if ($websiteId && !$storeId) {
162
  return $this->getRegionFilterModByWebsite($websiteId);
@@ -181,19 +201,20 @@ class OnePica_AvaTax_Helper_Address extends Mage_Core_Helper_Abstract
181
  /**
182
  * Get region filter
183
  *
184
- * @param Mage_Customer_Model_Address $address
185
- * @param int $storeId
186
  *
187
  * @return string|bool
188
  */
189
  protected function _getFilterRegion($address, $storeId)
190
  {
191
- $filter = false;
192
  $regionFilters = explode(',', $this->_getConfigData()->getRegionFilterList($storeId));
193
- $entityId = $address->getRegionId() ?: $address->getCountryId();
194
  if (!in_array($entityId, $regionFilters)) {
195
  $filter = 'region';
196
  }
 
197
  return $filter;
198
  }
199
 
@@ -234,10 +255,11 @@ class OnePica_AvaTax_Helper_Address extends Mage_Core_Helper_Abstract
234
  public function getTaxableCountryByCurrentScope()
235
  {
236
  $websiteId = Mage::app()->getRequest()->get('website');
237
- $storeId = Mage::app()->getRequest()->get('store');
238
  if ($websiteId && !$storeId) {
239
  return $this->getTaxableCountryByWebSite($websiteId);
240
  }
 
241
  return $this->getTaxableCountryByStore($storeId);
242
  }
243
 
@@ -245,7 +267,7 @@ class OnePica_AvaTax_Helper_Address extends Mage_Core_Helper_Abstract
245
  * Determines if the object (quote, invoice, or credit memo) should use AvaTax services
246
  *
247
  * @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo $object
248
- * @param Mage_Sales_Model_Quote_Address $shippingAddress
249
  *
250
  * @return bool
251
  */
@@ -254,8 +276,9 @@ class OnePica_AvaTax_Helper_Address extends Mage_Core_Helper_Abstract
254
  $storeId = $object->getStore()->getId();
255
 
256
  //is action enabled?
257
- $action = $object->getOrder() ?
258
- OnePica_AvaTax_Model_Service_Abstract_Config::ACTION_CALC_SUBMIT : OnePica_AvaTax_Model_Service_Abstract_Config::ACTION_CALC;
 
259
  if ($this->_getConfigData()->getStatusServiceAction($storeId) < $action) {
260
  return false;
261
  }
@@ -268,7 +291,11 @@ class OnePica_AvaTax_Helper_Address extends Mage_Core_Helper_Abstract
268
  }
269
 
270
  //is the region filtered?
271
- if (!$this->isAddressActionable($shippingAddress, $storeId, OnePica_AvaTax_Model_Service_Abstract_Config::REGIONFILTER_TAX)) {
 
 
 
 
272
  return false;
273
  }
274
 
@@ -277,10 +304,31 @@ class OnePica_AvaTax_Helper_Address extends Mage_Core_Helper_Abstract
277
 
278
  /**
279
  * Get config helper
 
280
  * @return OnePica_AvaTax_Helper_Config
281
  */
282
  private function _getConfigData()
283
  {
284
  return Mage::helper('avatax/config');
285
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
  }
27
  /**
28
  * Determines if address normalization is enabled
29
  *
30
+ * @param Mage_Sales_Model_Quote_Address $address
31
+ * @param int $storeId
32
  *
33
  * @return bool
34
  */
35
  public function isAddressNormalizationOn($address, $storeId)
36
  {
37
+ if (!$this->isAddressActionable(
38
+ $address,
39
+ $storeId,
40
+ OnePica_AvaTax_Model_Service_Abstract_Config::REGIONFILTER_ALL, true)
41
+ ) {
42
  return false;
43
  }
44
+
45
  return $this->_getConfigData()->getNormalizeAddress($storeId);
46
  }
47
 
48
  /**
49
  * Determines if address validation is enabled
50
  *
51
+ * @param Mage_Sales_Model_Quote_Address $address
52
+ * @param int $storeId
53
  *
54
  * @return bool
55
  */
56
  public function isAddressValidationOn($address, $storeId)
57
  {
58
+ if (!$this->isAddressActionable(
59
+ $address,
60
+ $storeId,
61
+ OnePica_AvaTax_Model_Service_Abstract_Config::REGIONFILTER_ALL, true)
62
+ ) {
63
  return false;
64
  }
65
+
66
  return $this->_getConfigData()->getValidateAddress($storeId);
67
  }
68
 
79
  /**
80
  * Determines if the address should be filtered
81
  *
82
+ * @param Mage_Sales_Model_Quote_Address $address
83
+ * @param int $storeId
84
+ * @param int $filterMode
85
+ * @param bool $isAddressValidation
86
  *
87
  * @return bool
88
  */
89
+ public function isAddressActionable(
90
+ $address,
91
+ $storeId,
92
+ $filterMode = OnePica_AvaTax_Model_Service_Abstract_Config::REGIONFILTER_ALL,
93
+ $isAddressValidation = false
94
+ ) {
95
  $filter = false;
96
 
97
  if ($this->_getConfigData()->getStatusServiceAction($storeId)
98
+ == OnePica_AvaTax_Model_Service_Abstract_Config::ACTION_DISABLE
99
+ ) {
100
  return false;
101
  }
102
 
104
  $filter = $this->_getFilterRegion($address, $storeId);
105
  }
106
 
107
+ if ($isAddressValidation
108
+ && $filter
109
+ && ((int)$this->getRegionFilterModByStore($storeId)
110
+ !== OnePica_AvaTax_Model_Service_Abstract_Config::REGIONFILTER_ALL
111
+ )
112
  ) {
113
  $filter = false;
114
  }
117
  $filter = 'country';
118
  }
119
 
120
+ if ($isAddressValidation
121
+ && !$filter
122
  && !in_array($address->getCountryId(), $this->getAddressValidationCountries())
123
  ) {
124
  $filter = 'country';
125
  }
126
 
127
+ if ($filter && $this->_getHelper()->getLogMode($storeId)) {
128
+ $logType = $this->_getLogTypeModel()->getFilterType();
129
+ if (in_array($logType, $this->_getHelper()->getLogType($storeId))) {
130
+ $filterLog = Mage::getSingleton('avatax/session')->getFilterLog();
131
+ if (!is_array($filterLog)) {
132
+ $filterLog = array();
133
+ }
134
+ $key = $address->getCacheHashKey();
135
+
136
+ //did we already log this filtered address?
137
+ if (!in_array($key, $filterLog)) {
138
+ $filterLog[] = $key;
139
+ Mage::getSingleton('avatax/session')->setFilterLog($filterLog);
140
+
141
+ $type = ($filterMode == OnePica_AvaTax_Model_Service_Abstract_Config::REGIONFILTER_TAX)
142
+ ? 'tax_calc'
143
+ : 'tax_calc|address_opts';
144
+ Mage::getModel('avatax_records/log')
145
+ ->setStoreId($storeId)
146
+ ->setLevel('Success')
147
+ ->setType($logType)
148
+ ->setRequest(print_r($address->debug(), true))
149
+ ->setResult('filter: ' . $filter . ', type: ' . $type)
150
+ ->save();
151
+ }
152
  }
153
  }
154
 
161
  * @param null|int $storeId
162
  *
163
  * @return int
 
164
  */
165
  public function getRegionFilterModByStore($storeId = null)
166
  {
176
  public function getRegionFilterModByCurrentScope()
177
  {
178
  $websiteId = Mage::app()->getRequest()->get('website');
179
+ $storeId = Mage::app()->getRequest()->get('store');
180
 
181
  if ($websiteId && !$storeId) {
182
  return $this->getRegionFilterModByWebsite($websiteId);
201
  /**
202
  * Get region filter
203
  *
204
+ * @param Mage_Sales_Model_Quote_Address $address
205
+ * @param int $storeId
206
  *
207
  * @return string|bool
208
  */
209
  protected function _getFilterRegion($address, $storeId)
210
  {
211
+ $filter = false;
212
  $regionFilters = explode(',', $this->_getConfigData()->getRegionFilterList($storeId));
213
+ $entityId = $address->getRegionId() ?: $address->getCountryId();
214
  if (!in_array($entityId, $regionFilters)) {
215
  $filter = 'region';
216
  }
217
+
218
  return $filter;
219
  }
220
 
255
  public function getTaxableCountryByCurrentScope()
256
  {
257
  $websiteId = Mage::app()->getRequest()->get('website');
258
+ $storeId = Mage::app()->getRequest()->get('store');
259
  if ($websiteId && !$storeId) {
260
  return $this->getTaxableCountryByWebSite($websiteId);
261
  }
262
+
263
  return $this->getTaxableCountryByStore($storeId);
264
  }
265
 
267
  * Determines if the object (quote, invoice, or credit memo) should use AvaTax services
268
  *
269
  * @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo $object
270
+ * @param Mage_Sales_Model_Quote_Address $shippingAddress
271
  *
272
  * @return bool
273
  */
276
  $storeId = $object->getStore()->getId();
277
 
278
  //is action enabled?
279
+ $action = $object->getOrder()
280
+ ? OnePica_AvaTax_Model_Service_Abstract_Config::ACTION_CALC_SUBMIT
281
+ : OnePica_AvaTax_Model_Service_Abstract_Config::ACTION_CALC;
282
  if ($this->_getConfigData()->getStatusServiceAction($storeId) < $action) {
283
  return false;
284
  }
291
  }
292
 
293
  //is the region filtered?
294
+ if (!$this->isAddressActionable(
295
+ $shippingAddress,
296
+ $storeId,
297
+ OnePica_AvaTax_Model_Service_Abstract_Config::REGIONFILTER_TAX)
298
+ ) {
299
  return false;
300
  }
301
 
304
 
305
  /**
306
  * Get config helper
307
+ *
308
  * @return OnePica_AvaTax_Helper_Config
309
  */
310
  private function _getConfigData()
311
  {
312
  return Mage::helper('avatax/config');
313
  }
314
+
315
+ /**
316
+ * Get avatax data helper
317
+ *
318
+ * @return OnePica_AvaTax_Helper_Data
319
+ */
320
+ protected function _getHelper()
321
+ {
322
+ return Mage::helper('avatax');
323
+ }
324
+
325
+ /**
326
+ * Get log type model
327
+ *
328
+ * @return OnePica_AvaTax_Model_Source_Logtype
329
+ */
330
+ protected function _getLogTypeModel()
331
+ {
332
+ return Mage::getModel('avatax/source_logtype');
333
+ }
334
  }
app/code/community/OnePica/AvaTax/Model/Action/Validator.php CHANGED
@@ -28,7 +28,7 @@ class OnePica_AvaTax_Model_Action_Validator extends OnePica_AvaTax_Model_Action_
28
  * The AvaTax Response (Normalized) Address object.
29
  * This is the normalized Ava address returned by the validation request.
30
  *
31
- * @var OnePica_AvaTax16_Document_Part_Location_Address
32
  */
33
  protected $_responseAddress = null;
34
 
@@ -283,7 +283,7 @@ class OnePica_AvaTax_Model_Action_Validator extends OnePica_AvaTax_Model_Action_
283
  /**
284
  * Get Response Address
285
  *
286
- * @return OnePica_AvaTax16_Document_Part_Location_Address
287
  */
288
  public function getResponseAddress()
289
  {
@@ -293,7 +293,7 @@ class OnePica_AvaTax_Model_Action_Validator extends OnePica_AvaTax_Model_Action_
293
  /**
294
  * Set Response Address
295
  *
296
- * @param OnePica_AvaTax16_Document_Part_Location_Address $responseAddress
297
  * @return $this
298
  */
299
  public function setResponseAddress($responseAddress)
28
  * The AvaTax Response (Normalized) Address object.
29
  * This is the normalized Ava address returned by the validation request.
30
  *
31
+ * @var OnePica\AvaTax16\Document\Part\Location\Address
32
  */
33
  protected $_responseAddress = null;
34
 
283
  /**
284
  * Get Response Address
285
  *
286
+ * @return OnePica\AvaTax16\Document\Part\Location\Address
287
  */
288
  public function getResponseAddress()
289
  {
293
  /**
294
  * Set Response Address
295
  *
296
+ * @param OnePica\AvaTax16\Document\Part\Location\Address $responseAddress
297
  * @return $this
298
  */
299
  public function setResponseAddress($responseAddress)
app/code/community/OnePica/AvaTax/Model/Adminhtml/Config.php CHANGED
@@ -42,6 +42,8 @@ class OnePica_AvaTax_Model_Adminhtml_Config extends Mage_Adminhtml_Model_Config
42
  : parent::_initSectionsAndTabs();
43
  }
44
 
 
 
45
  return $this;
46
  }
47
 
@@ -93,4 +95,34 @@ class OnePica_AvaTax_Model_Adminhtml_Config extends Mage_Adminhtml_Model_Config
93
  {
94
  return Mage::helper('avatax/config');
95
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  }
42
  : parent::_initSectionsAndTabs();
43
  }
44
 
45
+ $this->_initPluginVersion();
46
+
47
  return $this;
48
  }
49
 
95
  {
96
  return Mage::helper('avatax/config');
97
  }
98
+
99
+ /**
100
+ * Init Plugin Version in AvaTax section comment
101
+ *
102
+ * @return \OnePica_AvaTax_Helper_Config
103
+ */
104
+ protected function _initPluginVersion()
105
+ {
106
+ $taxSection = $this->getSection('tax');
107
+ if ($taxSection) {
108
+ $pathComment = 'groups/avatax/comment';
109
+ $comment = $taxSection->descend($pathComment);
110
+ if ($comment) {
111
+ $comment = $comment[0];
112
+
113
+ $version = Mage::getConfig()->getNode('modules/OnePica_AvaTax/version');
114
+ if ($this->_getDataHelper()->isAvatax16()) {
115
+ $version16 = Mage::getConfig()->getNode('default/tax/avatax/avatax16_extension_version');
116
+ $version = $version16.' ('.$version.')';
117
+ }
118
+
119
+ $processor = new Varien_Filter_Template();
120
+ $processor->setVariables(array('avatax_ver' => $version));
121
+ $precessedComment = $processor->filter($comment);
122
+ $taxSection->setNode($pathComment, $precessedComment);
123
+ }
124
+ }
125
+
126
+ return $this;
127
+ }
128
  }
app/code/community/OnePica/AvaTax/Model/Observer/ControllerActionPostdispatchCheckoutMultishippingAddressEditShipping.php DELETED
@@ -1,53 +0,0 @@
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) 2015 One Pica, Inc.
15
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
- */
17
-
18
- /**
19
- * Avatax Observer ControllerActionPostdispatchCheckoutMultishippingAddressEditShipping
20
- *
21
- * @category OnePica
22
- * @package OnePica_AvaTax
23
- * @author OnePica Codemaster <codemaster@onepica.com>
24
- */
25
- class OnePica_AvaTax_Model_Observer_ControllerActionPostdispatchCheckoutMultishippingAddressEditShipping
26
- extends OnePica_AvaTax_Model_Observer_Abstract
27
- {
28
- /**
29
- * Restore customer address from quote shipping address
30
- *
31
- * @param Varien_Event_Observer $observer
32
- * @return $this
33
- */
34
- public function execute(Varien_Event_Observer $observer)
35
- {
36
- $restoreCustomerAddress = $observer->getControllerAction()->getRequest()->getParam('restore_customer_address');
37
- $customerAddressId = $observer->getControllerAction()->getRequest()->getParam('id');
38
- if ($restoreCustomerAddress && $customerAddressId) {
39
- $customerAddress = Mage::getModel('checkout/type_multishipping')
40
- ->getCustomer()
41
- ->getAddressById($customerAddressId);
42
- $shippingAddress = Mage::getSingleton('checkout/session')
43
- ->getQuote()
44
- ->getShippingAddressByCustomerAddressId($customerAddressId);
45
-
46
- Mage::helper('core')->copyFieldset(
47
- 'sales_convert_quote_address', 'to_customer_address',
48
- $shippingAddress, $customerAddress
49
- );
50
- $customerAddress->save();
51
- }
52
- }
53
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/OnePica/AvaTax/Model/Observer/ControllerActionPredispatchCheckoutMultishippingAddressEditShippingPost.php DELETED
@@ -1,97 +0,0 @@
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) 2015 One Pica, Inc.
15
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
- */
17
-
18
- /**
19
- * Avatax Observer ControllerActionPredispatchCheckoutMultishippingAddressEditShippingPost
20
- *
21
- * @category OnePica
22
- * @package OnePica_AvaTax
23
- * @author OnePica Codemaster <codemaster@onepica.com>
24
- */
25
- class OnePica_AvaTax_Model_Observer_ControllerActionPredispatchCheckoutMultishippingAddressEditShippingPost
26
- extends OnePica_AvaTax_Model_Observer_Abstract
27
- {
28
- /**
29
- * Validates customer address during copying address to quote and
30
- * prevent copying if address validation fails
31
- *
32
- * @param Varien_Event_Observer $observer
33
- *
34
- * @return $this
35
- * @throws Mage_Core_Controller_Varien_Exception
36
- */
37
- public function execute(Varien_Event_Observer $observer)
38
- {
39
- try
40
- {
41
- /* @var $quote Mage_Sales_Model_Quote */
42
- $quote = Mage::getSingleton('checkout/session')->getQuote();
43
- $storeId = $quote->getStoreId();
44
-
45
- $customerAddressId = $observer->getControllerAction()->getRequest()->getParam('id');
46
- if ($customerAddressId) {
47
- //make a copy of current editable quote shipping address for validation
48
- $customerAddress = Mage::getModel('checkout/type_multishipping')
49
- ->getCustomer()
50
- ->getAddressById($customerAddressId);
51
- $shippingAddress = clone $quote->getShippingAddressByCustomerAddressId($customerAddressId);
52
- $shippingAddress->importCustomerAddress($customerAddress);
53
-
54
- //perform quote shipping address validation
55
- $errors = array();
56
- $normalized = false;
57
-
58
- $message = Mage::getStoreConfig('tax/avatax/validate_address_message', $storeId);
59
-
60
- if ($shippingAddress->validate() !== true) {
61
- $errors[] = sprintf($message, $shippingAddress->format('oneline'));
62
- }
63
- if ($shippingAddress->getAddressNormalized()) {
64
- $normalized = true;
65
- }
66
-
67
- $session = Mage::getSingleton('checkout/session');
68
- if ($normalized) {
69
- $session->addNotice(Mage::getStoreConfig('tax/avatax/multiaddress_normalize_message', $storeId));
70
- }
71
-
72
- if (!empty($errors)) {
73
- throw new OnePica_AvaTax_Exception(implode('<br />', $errors));
74
- }
75
- }
76
- }
77
- catch (OnePica_AvaTax_Exception $e)
78
- {
79
- //clear all messages
80
- Mage::getSingleton('customer/session')->getMessages(true);
81
- //add validation error message
82
- Mage::getSingleton('customer/session')->addError($e->getMessage());
83
-
84
- //perform forward
85
- $params = $observer->getControllerAction()->getRequest()->getParams();
86
- $exception = new Mage_Core_Controller_Varien_Exception();
87
- $exception->prepareForward(
88
- 'editShipping', null, null,
89
- array_merge(
90
- $params, array('restore_customer_address' => true)
91
- )
92
- );
93
- throw $exception;
94
- }
95
- return $this;
96
- }
97
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/OnePica/AvaTax/Model/Observer/ControllerActionPredispatchCustomerAddressFormPost.php ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2015 One Pica, Inc.
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * Avatax Observer ControllerActionPredispatchCustomerAddressFormPost
20
+ *
21
+ * @category OnePica
22
+ * @package OnePica_AvaTax
23
+ * @author OnePica Codemaster <codemaster@onepica.com>
24
+ */
25
+ class OnePica_AvaTax_Model_Observer_ControllerActionPredispatchCustomerAddressFormPost
26
+ extends OnePica_AvaTax_Model_Observer_Abstract
27
+ {
28
+ /**
29
+ * Success Url
30
+ */
31
+ const SUCCESS_URL = 'checkout/multishipping_address/editShippingPost';
32
+
33
+ /**
34
+ * Error Url
35
+ */
36
+ const ERROR_URL = 'checkout/multishipping_address/editShipping';
37
+
38
+ /**
39
+ * Validates customer address during modifying address from
40
+ * multi shipping
41
+ *
42
+ * @param Varien_Event_Observer $observer
43
+ *
44
+ * @return $this
45
+ */
46
+ public function execute(Varien_Event_Observer $observer)
47
+ {
48
+ if ($this->_haveToProcess($observer)) {
49
+ /* @var Mage_Core_Controller_Request_Http $request */
50
+ $request = $observer->getControllerAction()->getRequest();
51
+
52
+ try {
53
+ $requestObjects = $this->_getRequestObjects($request);
54
+ if ($requestObjects) {
55
+ //validate customer address
56
+ $errors = $requestObjects->newCustomerAddress->validate();
57
+ if ($errors !== true && !empty($errors)) {
58
+ throw new OnePica_AvaTax_Exception(implode('<br />', $errors));
59
+ }
60
+
61
+ //validate shipping address
62
+ $validationResults = $this->_validateShippingAddress($requestObjects);
63
+ if ($validationResults->normalized) {
64
+ Mage::getSingleton('checkout/session')->addNotice(
65
+ Mage::getStoreConfig('tax/avatax/multiaddress_normalize_message', $requestObjects->storeId)
66
+ );
67
+
68
+ $this->_setRedirect($observer, 'checkout/multishipping/shipping', array());
69
+ }
70
+
71
+ if ($validationResults->hasErrors) {
72
+ throw new OnePica_AvaTax_Exception(implode('<br />', $validationResults->errors));
73
+ }
74
+
75
+ //save new customer address
76
+ $requestObjects->newCustomerAddress->save();
77
+ }
78
+ } catch (Exception $e) {
79
+ //clear all messages
80
+ $this->_getCustomerSession()->getMessages(true);
81
+ //add validation error message
82
+ $this->_getCustomerSession()->addError($e->getMessage());
83
+
84
+ //restore entered form data
85
+ $this->_getCustomerSession()->setAddressFormData($request->getPost());
86
+ //redirect to multishipping address editing
87
+ $this->_setRedirect($observer, self::ERROR_URL, array('id' => $request->getParam('id')));
88
+ }
89
+ }
90
+
91
+ return $this;
92
+ }
93
+
94
+ /**
95
+ * Return true
96
+ * - If customer edit address on multishipping second step
97
+ *
98
+ * @param Varien_Event_Observer $observer
99
+ *
100
+ * @return bool
101
+ */
102
+ protected function _haveToProcess(Varien_Event_Observer $observer)
103
+ {
104
+ $request = $observer->getControllerAction()->getRequest();
105
+
106
+ $urlSuccess = $request->getParam(Mage_Core_Controller_Varien_Action::PARAM_NAME_SUCCESS_URL);
107
+ $urlError = $request->getParam(Mage_Core_Controller_Varien_Action::PARAM_NAME_ERROR_URL);
108
+
109
+ return strstr($urlSuccess, self::SUCCESS_URL) && strstr($urlError, self::ERROR_URL);
110
+ }
111
+
112
+ /**
113
+ * Get Current Request Objects
114
+ *
115
+ * @param Mage_Core_Controller_Request_Http $request
116
+ *
117
+ * @return null|object
118
+ */
119
+ protected function _getRequestObjects(Mage_Core_Controller_Request_Http $request)
120
+ {
121
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
122
+
123
+ $newCustomerAddressId = $request->getParam('id');
124
+ if (!$newCustomerAddressId) {
125
+ return null;
126
+ }
127
+
128
+ $shippingAddress = $quote->getShippingAddressByCustomerAddressId($newCustomerAddressId);
129
+ if (!$shippingAddress) {
130
+ return null;
131
+ }
132
+
133
+ $newCustomerAddress = $this->_getFormNewCustomerAddress($request);
134
+
135
+ $orgCustomerAddress = $shippingAddress->exportCustomerAddress();
136
+ $orgCustomerAddress->setData(
137
+ array_merge(
138
+ $newCustomerAddress->getData(),
139
+ $orgCustomerAddress->getData()
140
+ )
141
+ );
142
+
143
+ return (object)
144
+ array('quote' => $quote,
145
+ 'storeId' => $quote->getStoreId(),
146
+ 'shippingAddress' => $shippingAddress,
147
+ 'orgCustomerAddress' => $orgCustomerAddress,
148
+ 'newCustomerAddress' => $newCustomerAddress);
149
+ }
150
+
151
+ /**
152
+ * Get New Customer Address from form
153
+ *
154
+ * @param Mage_Core_Controller_Request_Http $request
155
+ *
156
+ * @return Mage_Customer_Model_Address
157
+ */
158
+ protected function _getFormNewCustomerAddress(Mage_Core_Controller_Request_Http $request)
159
+ {
160
+ $customerAddressId = $request->getParam('id');
161
+ $customerAddress = Mage::getModel('checkout/type_multishipping')
162
+ ->getCustomer()
163
+ ->getAddressById($customerAddressId);
164
+
165
+ /* @var Mage_Customer_Model_Form $addressForm*/
166
+ $addressForm = Mage::getModel('customer/form');
167
+ $addressForm->setFormCode('customer_address_edit')->setEntity($customerAddress);
168
+ $addressData = $addressForm->extractData($request);
169
+ $customerAddress->setData(array_merge($customerAddress->getData(), $addressData));
170
+ $customerAddress
171
+ ->setIsDefaultBilling($request->getParam('default_billing', false))
172
+ ->setIsDefaultShipping($request->getParam('default_shipping', false));
173
+
174
+ return $customerAddress;
175
+ }
176
+
177
+ /**
178
+ * Validate shipping address
179
+ *
180
+ * @param object $requestObjects
181
+ *
182
+ * @return object
183
+ */
184
+ protected function _validateShippingAddress($requestObjects)
185
+ {
186
+ $storeId = $requestObjects->storeId;
187
+ $shippingAddress = $requestObjects->shippingAddress;
188
+ $newCustomerAddress = $requestObjects->newCustomerAddress;
189
+ $orgCustomerAddress = $requestObjects->orgCustomerAddress;
190
+
191
+ //perform quote shipping address validation
192
+ $errors = array();
193
+ $normalized = false;
194
+
195
+ $shippingAddress->importCustomerAddress($newCustomerAddress);
196
+
197
+ if ($shippingAddress->validate() !== true) {
198
+ $message = Mage::getStoreConfig('tax/avatax/validate_address_message', $storeId);
199
+ $errors[] = sprintf($message, $shippingAddress->format('oneline'));
200
+ }
201
+
202
+ if ($shippingAddress->getAddressNormalized()) {
203
+ $normalized = true;
204
+ }
205
+
206
+ if (!empty($errors)) {
207
+ //restore shipping address on error, address saved, if normilization turned on
208
+ $shippingAddress->importCustomerAddress($orgCustomerAddress);
209
+ $shippingAddress->save();
210
+ }
211
+
212
+ return (object)
213
+ array(
214
+ 'hasErrors' => !empty($errors),
215
+ 'errors' => $errors,
216
+ 'normalized' => $normalized);
217
+ }
218
+
219
+ /**
220
+ * Set Redirect
221
+ *
222
+ * @param Varien_Event_Observer $observer
223
+ * @param string $path
224
+ * @param array $params
225
+ *
226
+ * @return $this
227
+ */
228
+ protected function _setRedirect(Varien_Event_Observer $observer, $path, $params)
229
+ {
230
+ $controller = $observer->getControllerAction();
231
+ $controller->setRedirectWithCookieCheck($path, $params);
232
+ $controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
233
+
234
+ return $this;
235
+ }
236
+
237
+ /**
238
+ * Get Customer Session
239
+ *
240
+ * @return Mage_Customer_Model_Session
241
+ */
242
+ protected function _getCustomerSession()
243
+ {
244
+ return Mage::getSingleton('customer/session');
245
+ }
246
+
247
+ /**
248
+ * Get Helper
249
+ *
250
+ * @return OnePica_AvaTax_Helper_Data
251
+ */
252
+ protected function _getHelper()
253
+ {
254
+ return Mage::helper('avatax');
255
+ }
256
+ }
app/code/community/OnePica/AvaTax/Model/Records/Queue/Process.php CHANGED
@@ -24,6 +24,13 @@
24
  */
25
  class OnePica_AvaTax_Model_Records_Queue_Process
26
  {
 
 
 
 
 
 
 
27
  /**
28
  * Remove the Failed process
29
  *
@@ -68,6 +75,38 @@ class OnePica_AvaTax_Model_Records_Queue_Process
68
  return $this;
69
  }
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  /**
72
  * Delete any queue items that have been completed. Items stay in queue for some
73
  * transparency into the process.
@@ -153,7 +192,8 @@ class OnePica_AvaTax_Model_Records_Queue_Process
153
  ->addFieldToFilter('type', OnePica_AvaTax_Model_Records_Queue::QUEUE_TYPE_INVOICE)
154
  ->addFieldToFilter('status', array('neq' => OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_FAILED))
155
  ->addFieldToFilter('status', array('neq' => OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_COMPLETE))
156
- ->addFieldToFilter('status', array('neq' => OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_UNBALANCED));
 
157
 
158
  /** @var OnePica_AvaTax_Model_Action_Invoice $invoiceAction */
159
  $invoiceAction = Mage::getModel('avatax/action_invoice');
@@ -196,7 +236,8 @@ class OnePica_AvaTax_Model_Records_Queue_Process
196
  ->addFieldToFilter('type', OnePica_AvaTax_Model_Records_Queue::QUEUE_TYPE_CREDITMEMEO)
197
  ->addFieldToFilter('status', array('neq' => OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_FAILED))
198
  ->addFieldToFilter('status', array('neq' => OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_COMPLETE))
199
- ->addFieldToFilter('status', array('neq' => OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_UNBALANCED));
 
200
 
201
  /** @var OnePica_AvaTax_Model_Action_Creditmemo $creditmemoAction */
202
  $creditmemoAction = Mage::getModel('avatax/action_creditmemo');
24
  */
25
  class OnePica_AvaTax_Model_Records_Queue_Process
26
  {
27
+ /**
28
+ * Stores with enabled Queue Submit
29
+ *
30
+ * @var array|null
31
+ */
32
+ protected $_storesWithEnabledQueueSubmit;
33
+
34
  /**
35
  * Remove the Failed process
36
  *
75
  return $this;
76
  }
77
 
78
+ /**
79
+ * Get stores with enabled queue submit
80
+ *
81
+ * @return array
82
+ */
83
+ protected function _getStoresWithEnabledQueueSubmit()
84
+ {
85
+ if (null === $this->_storesWithEnabledQueueSubmit) {
86
+ $stores = array();
87
+ foreach (Mage::app()->getStores() as $store) {
88
+ if ($this->_getConfigHelper()->getStatusServiceAction($store->getStoreId())
89
+ >= OnePica_AvaTax_Model_Service_Abstract_Config::ACTION_CALC_SUBMIT
90
+ ) {
91
+ $stores[] = $store->getStoreId();
92
+ }
93
+ }
94
+ $this->_storesWithEnabledQueueSubmit = $stores;
95
+ }
96
+
97
+ return $this->_storesWithEnabledQueueSubmit;
98
+ }
99
+
100
+ /**
101
+ * Get config helper
102
+ *
103
+ * @return OnePica_AvaTax_Helper_Config
104
+ */
105
+ protected function _getConfigHelper()
106
+ {
107
+ return Mage::helper('avatax/config');
108
+ }
109
+
110
  /**
111
  * Delete any queue items that have been completed. Items stay in queue for some
112
  * transparency into the process.
192
  ->addFieldToFilter('type', OnePica_AvaTax_Model_Records_Queue::QUEUE_TYPE_INVOICE)
193
  ->addFieldToFilter('status', array('neq' => OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_FAILED))
194
  ->addFieldToFilter('status', array('neq' => OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_COMPLETE))
195
+ ->addFieldToFilter('status', array('neq' => OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_UNBALANCED))
196
+ ->addFieldToFilter('store_id', array('in' => $this->_getStoresWithEnabledQueueSubmit()));
197
 
198
  /** @var OnePica_AvaTax_Model_Action_Invoice $invoiceAction */
199
  $invoiceAction = Mage::getModel('avatax/action_invoice');
236
  ->addFieldToFilter('type', OnePica_AvaTax_Model_Records_Queue::QUEUE_TYPE_CREDITMEMEO)
237
  ->addFieldToFilter('status', array('neq' => OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_FAILED))
238
  ->addFieldToFilter('status', array('neq' => OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_COMPLETE))
239
+ ->addFieldToFilter('status', array('neq' => OnePica_AvaTax_Model_Records_Queue::QUEUE_STATUS_UNBALANCED))
240
+ ->addFieldToFilter('store_id', array('in' => $this->_getStoresWithEnabledQueueSubmit()));
241
 
242
  /** @var OnePica_AvaTax_Model_Action_Creditmemo $creditmemoAction */
243
  $creditmemoAction = Mage::getModel('avatax/action_creditmemo');
app/code/community/OnePica/AvaTax/Model/Service/Abstract/Tools.php CHANGED
@@ -199,4 +199,41 @@ class OnePica_AvaTax_Model_Service_Abstract_Tools extends Varien_Object
199
 
200
  return $this;
201
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  }
199
 
200
  return $this;
201
  }
202
+
203
+ /**
204
+ * Retrieve simple product id from quote item
205
+ *
206
+ * @param Mage_Sales_Model_Quote_Item|Mage_Sales_Model_Quote_Address_Item $item
207
+ *
208
+ * @return int
209
+ */
210
+ protected function _retrieveProductIdFromQuoteItem($item)
211
+ {
212
+ $productId = $item->getProductId();
213
+
214
+ if ($item->getOptionByCode('simple_product')) {
215
+ $productId = $item->getOptionByCode('simple_product')->getProduct()->getId();
216
+ }
217
+
218
+ return $productId;
219
+ }
220
+
221
+ /**
222
+ * Retrieve simple product id from order item
223
+ *
224
+ * @param Mage_Sales_Model_Order_Invoice_Item|Mage_Sales_Model_Order_Creditmemo_Item $item
225
+ *
226
+ * @return int
227
+ */
228
+ protected function _retrieveProductIdFromOrderItem($item)
229
+ {
230
+ $productId = $item->getProductId();
231
+
232
+ if ($item->getOrderItem()->getChildrenItems()) {
233
+ $items = $item->getOrderItem()->getChildrenItems();
234
+ $productId = $items[0]->getProductId();
235
+ }
236
+
237
+ return $productId;
238
+ }
239
  }
app/code/community/OnePica/AvaTax/Model/Service/Avatax/Estimate.php CHANGED
@@ -430,7 +430,7 @@ class OnePica_AvaTax_Model_Service_Avatax_Estimate
430
  if ($this->isProductCalculated($item)) {
431
  return false;
432
  }
433
- $product = $this->_getProductByProductId($item->getProductId());
434
  $taxClass = $this->_getTaxClassCodeByProduct($product);
435
  $price = $item->getBaseRowTotal();
436
 
430
  if ($this->isProductCalculated($item)) {
431
  return false;
432
  }
433
+ $product = $this->_getProductByProductId($this->_retrieveProductIdFromQuoteItem($item));
434
  $taxClass = $this->_getTaxClassCodeByProduct($product);
435
  $price = $item->getBaseRowTotal();
436
 
app/code/community/OnePica/AvaTax/Model/Service/Avatax/Invoice.php CHANGED
@@ -512,7 +512,7 @@ class OnePica_AvaTax_Model_Service_Avatax_Invoice extends OnePica_AvaTax_Model_S
512
  protected function _getLineProductData($item, $storeId)
513
  {
514
  $lineProductData = new Varien_Object();
515
- $product = $this->_getProductByProductId($item->getProductId());
516
 
517
  if (null === $product) {
518
  return $lineProductData;
512
  protected function _getLineProductData($item, $storeId)
513
  {
514
  $lineProductData = new Varien_Object();
515
+ $product = $this->_getProductByProductId($this->_retrieveProductIdFromOrderItem($item));
516
 
517
  if (null === $product) {
518
  return $lineProductData;
app/code/community/OnePica/AvaTax/Model/Service/Avatax16/Abstract.php CHANGED
@@ -199,8 +199,8 @@ abstract class OnePica_AvaTax_Model_Service_Avatax16_Abstract extends OnePica_Av
199
  $level = $result->getHasError() ? OnePica_AvaTax_Model_Records_Log::LOG_LEVEL_ERROR
200
  : OnePica_AvaTax_Model_Records_Log::LOG_LEVEL_SUCCESS;
201
 
202
- $requestLog = ($request instanceof OnePica_AvaTax16_Document_Part) ? $request->toArray() : $request;
203
- $resultLog = ($result instanceof OnePica_AvaTax16_Document_Part) ? $result->toArray() : $result;
204
 
205
  if (in_array($type, $this->_getHelper()->getLogType($storeId))) {
206
  Mage::getModel('avatax_records/log')
@@ -228,51 +228,51 @@ abstract class OnePica_AvaTax_Model_Service_Avatax16_Abstract extends OnePica_Av
228
  /**
229
  * Get New Document Part Location Address Object
230
  *
231
- * @return OnePica_AvaTax16_Document_Part_Location_Address
232
  */
233
  protected function _getNewDocumentPartLocationAddressObject()
234
  {
235
- return new OnePica_AvaTax16_Document_Part_Location_Address();
236
  }
237
 
238
  /**
239
  * Get New Document Part Location Object
240
  *
241
- * @return OnePica_AvaTax16_Document_Part_Location
242
  */
243
  protected function _getNewDocumentPartLocationObject()
244
  {
245
- return new OnePica_AvaTax16_Document_Part_Location();
246
  }
247
 
248
  /**
249
  * Get New Document Request Header Object
250
  *
251
- * @return OnePica_AvaTax16_Document_Request_Header
252
  */
253
  protected function _getNewDocumentRequestHeaderObject()
254
  {
255
- return new OnePica_AvaTax16_Document_Request_Header();
256
  }
257
 
258
  /**
259
  * Get New Document Request Object
260
  *
261
- * @return OnePica_AvaTax16_Document_Request
262
  */
263
  protected function _getNewDocumentRequestObject()
264
  {
265
- return new OnePica_AvaTax16_Document_Request();
266
  }
267
 
268
  /**
269
  * Get New Document Request Line Object
270
  *
271
- * @return OnePica_AvaTax16_Document_Request_Line
272
  */
273
  protected function _getNewDocumentRequestLineObject()
274
  {
275
- return new OnePica_AvaTax16_Document_Request_Line();
276
  }
277
 
278
  /**
199
  $level = $result->getHasError() ? OnePica_AvaTax_Model_Records_Log::LOG_LEVEL_ERROR
200
  : OnePica_AvaTax_Model_Records_Log::LOG_LEVEL_SUCCESS;
201
 
202
+ $requestLog = ($request instanceof OnePica\AvaTax16\Document\Part) ? $request->toArray() : $request;
203
+ $resultLog = ($result instanceof OnePica\AvaTax16\Document\Part) ? $result->toArray() : $result;
204
 
205
  if (in_array($type, $this->_getHelper()->getLogType($storeId))) {
206
  Mage::getModel('avatax_records/log')
228
  /**
229
  * Get New Document Part Location Address Object
230
  *
231
+ * @return OnePica\AvaTax16\Document\Part\Location\Address
232
  */
233
  protected function _getNewDocumentPartLocationAddressObject()
234
  {
235
+ return new OnePica\AvaTax16\Document\Part\Location\Address();
236
  }
237
 
238
  /**
239
  * Get New Document Part Location Object
240
  *
241
+ * @return OnePica\AvaTax16\Document\Part\Location
242
  */
243
  protected function _getNewDocumentPartLocationObject()
244
  {
245
+ return new OnePica\AvaTax16\Document\Part\Location();
246
  }
247
 
248
  /**
249
  * Get New Document Request Header Object
250
  *
251
+ * @return OnePica\AvaTax16\Document\Request\Header
252
  */
253
  protected function _getNewDocumentRequestHeaderObject()
254
  {
255
+ return new OnePica\AvaTax16\Document\Request\Header();
256
  }
257
 
258
  /**
259
  * Get New Document Request Object
260
  *
261
+ * @return OnePica\AvaTax16\Document\Request
262
  */
263
  protected function _getNewDocumentRequestObject()
264
  {
265
+ return new OnePica\AvaTax16\Document\Request();
266
  }
267
 
268
  /**
269
  * Get New Document Request Line Object
270
  *
271
+ * @return OnePica\AvaTax16\Document\Request\Line
272
  */
273
  protected function _getNewDocumentRequestLineObject()
274
  {
275
+ return new OnePica\AvaTax16\Document\Request\Line();
276
  }
277
 
278
  /**
app/code/community/OnePica/AvaTax/Model/Service/Avatax16/Address.php CHANGED
@@ -43,14 +43,14 @@ class OnePica_AvaTax_Model_Service_Avatax16_Address extends OnePica_AvaTax_Model
43
  /**
44
  * The AvaTax16 Request Address object.
45
  *
46
- * @var OnePica_AvaTax16_Document_Part_Location_Address
47
  */
48
  protected $_locationAddress = null;
49
 
50
  /**
51
  * The AvaTax16 Request Address object.
52
  *
53
- * @var OnePica_AvaTax16_Document_Part_Location_Address
54
  */
55
  protected $_localeObject = null;
56
 
@@ -112,7 +112,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Address extends OnePica_AvaTax_Model
112
  /**
113
  * Getter for address resolution
114
  *
115
- * @return OnePica_AvaTax16_Document_Part_Location_Address
116
  */
117
  public function getLocationAddress()
118
  {
@@ -122,7 +122,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Address extends OnePica_AvaTax_Model
122
  /**
123
  * Setter for address resolution
124
  *
125
- * @param OnePica_AvaTax16_Document_Part_Location_Address $addressResolution
126
  */
127
  public function setLocationAddress($addressResolution)
128
  {
@@ -157,7 +157,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Address extends OnePica_AvaTax_Model
157
  /**
158
  * Get Location Address Object
159
  *
160
- * @return OnePica_AvaTax16_Document_Part_Location_Address
161
  */
162
  public function getLocationAddressObject()
163
  {
@@ -251,11 +251,11 @@ class OnePica_AvaTax_Model_Service_Avatax16_Address extends OnePica_AvaTax_Model
251
  /**
252
  * Validate address
253
  *
254
- * @return OnePica_AvaTax16_AddressResolution_ResolveSingleAddressResponse
255
  */
256
  protected function _sendAddressValidationRequest()
257
  {
258
- /** @var OnePica_AvaTax16_AddressResolution_ResolveSingleAddressResponse $resolvedAddress */
259
  $resolvedAddress = $this->getServiceConfig()->getTaxConnection()
260
  ->resolveSingleAddress($this->getLocationAddress());
261
 
43
  /**
44
  * The AvaTax16 Request Address object.
45
  *
46
+ * @var OnePica\AvaTax16\Document\Part\Location\Address
47
  */
48
  protected $_locationAddress = null;
49
 
50
  /**
51
  * The AvaTax16 Request Address object.
52
  *
53
+ * @var OnePica\AvaTax16\Document\Part\Location\Address
54
  */
55
  protected $_localeObject = null;
56
 
112
  /**
113
  * Getter for address resolution
114
  *
115
+ * @return OnePica\AvaTax16\Document\Part\Location\Address
116
  */
117
  public function getLocationAddress()
118
  {
122
  /**
123
  * Setter for address resolution
124
  *
125
+ * @param OnePica\AvaTax16\Document\Part\Location\Address $addressResolution
126
  */
127
  public function setLocationAddress($addressResolution)
128
  {
157
  /**
158
  * Get Location Address Object
159
  *
160
+ * @return OnePica\AvaTax16\Document\Part\Location\Address
161
  */
162
  public function getLocationAddressObject()
163
  {
251
  /**
252
  * Validate address
253
  *
254
+ * @return OnePica\AvaTax16\AddressResolution\ResolveSingleAddressResponse
255
  */
256
  protected function _sendAddressValidationRequest()
257
  {
258
+ /** @var OnePica\AvaTax16\AddressResolution\ResolveSingleAddressResponse $resolvedAddress */
259
  $resolvedAddress = $this->getServiceConfig()->getTaxConnection()
260
  ->resolveSingleAddress($this->getLocationAddress());
261
 
app/code/community/OnePica/AvaTax/Model/Service/Avatax16/Config.php CHANGED
@@ -25,10 +25,15 @@
25
  */
26
  class OnePica_AvaTax_Model_Service_Avatax16_Config extends OnePica_AvaTax_Model_Service_Abstract_Config
27
  {
 
 
 
 
 
28
  /**
29
  * Set AvaTax16 lib Config
30
  *
31
- * @param OnePica_AvaTax16_Config $config
32
  */
33
  public function setLibConfig($config)
34
  {
@@ -38,7 +43,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Config extends OnePica_AvaTax_Model_
38
  /**
39
  * Get Avatax16 lib config
40
  *
41
- * @return OnePica_AvaTax16_Config
42
  */
43
  public function getLibConfig()
44
  {
@@ -58,7 +63,9 @@ class OnePica_AvaTax_Model_Service_Avatax16_Config extends OnePica_AvaTax_Model_
58
  $this->getLibConfig()->setBaseUrl($this->_getConfigHelper()->getServiceUrl($storeId));
59
  $this->getLibConfig()->setAccountId($this->_getConfigHelper()->getServiceAccountId($storeId));
60
  $this->getLibConfig()->setCompanyCode($this->_getConfigHelper()->getCompanyCode($storeId));
61
- $this->getLibConfig()->setAuthorizationHeader($this->_getConfigHelper()->getServiceKey($storeId));
 
 
62
  $this->getLibConfig()->setUserAgent($this->getClientName());
63
  }
64
 
@@ -68,17 +75,17 @@ class OnePica_AvaTax_Model_Service_Avatax16_Config extends OnePica_AvaTax_Model_
68
  /**
69
  * Get New Service Config Object
70
  *
71
- * @return OnePica_AvaTax16_Config
72
  */
73
  protected function _getNewServiceConfigObject()
74
  {
75
- return new OnePica_AvaTax16_Config();
76
  }
77
 
78
  /**
79
  * Get resource connection
80
  *
81
- * @return null|OnePica_AvaTax16_TaxService
82
  */
83
  public function getTaxConnection()
84
  {
@@ -100,12 +107,12 @@ class OnePica_AvaTax_Model_Service_Avatax16_Config extends OnePica_AvaTax_Model_
100
  }
101
 
102
  /**
103
- * Get object OnePica_AvaTax16_TaxService
104
- * @return OnePica_AvaTax16_TaxService
105
  */
106
  protected function _getAvatax16Service()
107
  {
108
- return new OnePica_AvaTax16_TaxService($this->getLibConfig());
109
  }
110
 
111
  /**
25
  */
26
  class OnePica_AvaTax_Model_Service_Avatax16_Config extends OnePica_AvaTax_Model_Service_Abstract_Config
27
  {
28
+ /**
29
+ * Authorization header prefix
30
+ */
31
+ const AUTHORIZATION_HEADER_PREFIX = 'AvalaraAuth ';
32
+
33
  /**
34
  * Set AvaTax16 lib Config
35
  *
36
+ * @param OnePica\AvaTax16\Config $config
37
  */
38
  public function setLibConfig($config)
39
  {
43
  /**
44
  * Get Avatax16 lib config
45
  *
46
+ * @return OnePica\AvaTax16\Config
47
  */
48
  public function getLibConfig()
49
  {
63
  $this->getLibConfig()->setBaseUrl($this->_getConfigHelper()->getServiceUrl($storeId));
64
  $this->getLibConfig()->setAccountId($this->_getConfigHelper()->getServiceAccountId($storeId));
65
  $this->getLibConfig()->setCompanyCode($this->_getConfigHelper()->getCompanyCode($storeId));
66
+ $authorizationHeader = self::AUTHORIZATION_HEADER_PREFIX
67
+ . $this->_getConfigHelper()->getServiceKey($storeId);
68
+ $this->getLibConfig()->setAuthorizationHeader($authorizationHeader);
69
  $this->getLibConfig()->setUserAgent($this->getClientName());
70
  }
71
 
75
  /**
76
  * Get New Service Config Object
77
  *
78
+ * @return OnePica\AvaTax16\Config
79
  */
80
  protected function _getNewServiceConfigObject()
81
  {
82
+ return new OnePica\AvaTax16\Config();
83
  }
84
 
85
  /**
86
  * Get resource connection
87
  *
88
+ * @return null|OnePica\AvaTax16\TaxService
89
  */
90
  public function getTaxConnection()
91
  {
107
  }
108
 
109
  /**
110
+ * Get object OnePica\AvaTax16\TaxService
111
+ * @return OnePica\AvaTax16\TaxService
112
  */
113
  protected function _getAvatax16Service()
114
  {
115
+ return new OnePica\AvaTax16\TaxService($this->getLibConfig());
116
  }
117
 
118
  /**
app/code/community/OnePica/AvaTax/Model/Service/Avatax16/Estimate.php CHANGED
@@ -134,7 +134,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Estimate extends OnePica_AvaTax_Mode
134
 
135
  //make request if needed and save results in cache
136
  if ($makeRequest) {
137
- /** @var OnePica_AvaTax16_Document_Response $result */
138
  $result = $this->_send($quote->getStoreId());
139
  $this->_rates[$requestKey] = array(
140
  'timestamp' => $this->_getDateModel()->timestamp(),
@@ -147,7 +147,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Estimate extends OnePica_AvaTax_Mode
147
  //success
148
  if (!$result->getHasError()) {
149
  foreach ($result->getLines() as $ctl) {
150
- /** @var OnePica_AvaTax16_Document_Response_Line $ctl */
151
  $id = $this->_getItemIdByLine($ctl);
152
  $code = $this->_getTaxArrayCodeByLine($ctl);
153
  $this->_rates[$requestKey][$code][$id] = array(
@@ -233,7 +233,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Estimate extends OnePica_AvaTax_Mode
233
  if ($this->isProductCalculated($item)) {
234
  return false;
235
  }
236
- $product = $this->_getProductByProductId($item->getProductId());
237
  $taxClass = $this->_getTaxClassCodeByProduct($product);
238
  $price = $item->getBaseRowTotal();
239
  if ($this->_getTaxDataHelper()->applyTaxAfterDiscount($item->getStoreId())) {
@@ -540,7 +540,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Estimate extends OnePica_AvaTax_Mode
540
  /**
541
  * Get item id/code for given line
542
  *
543
- * @param OnePica_AvaTax16_Document_Response_Line $line
544
  * @return string|int
545
  */
546
  protected function _getItemIdByLine($line)
@@ -553,7 +553,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Estimate extends OnePica_AvaTax_Mode
553
  /**
554
  * Get tax array code for given line
555
  *
556
- * @param OnePica_AvaTax16_Document_Response_Line $line
557
  * @return string
558
  */
559
  protected function _getTaxArrayCodeByLine($line)
@@ -564,7 +564,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Estimate extends OnePica_AvaTax_Mode
564
  /**
565
  * Get line rate
566
  *
567
- * @param OnePica_AvaTax16_Document_Response_Line $line
568
  * @return float
569
  */
570
  protected function _getLineRate($line)
@@ -581,7 +581,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Estimate extends OnePica_AvaTax_Mode
581
  /**
582
  * Get line rate
583
  *
584
- * @param OnePica_AvaTax16_Document_Response $response
585
  * @return array
586
  */
587
  protected function _getSummaryFromResponse($response)
@@ -609,7 +609,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Estimate extends OnePica_AvaTax_Mode
609
  /**
610
  * Get Jurisdictions rate array
611
  *
612
- * @param OnePica_AvaTax16_Document_Response $response
613
  * @return array
614
  */
615
  protected function _getJurisdictionsRate($response)
@@ -617,7 +617,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Estimate extends OnePica_AvaTax_Mode
617
  $rates = array();
618
  $fixedRatesData = array();
619
 
620
- /** @var OnePica_AvaTax16_Document_Response_Line $line */
621
  foreach ($response->getLines() as $line) {
622
  if (!$line->getCalculatedTax()->getTax()) {
623
  continue;
@@ -685,7 +685,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Estimate extends OnePica_AvaTax_Mode
685
  /**
686
  * Get item jurisdiction rate
687
  *
688
- * @param OnePica_AvaTax16_Document_Response_Line $line
689
  * @return array
690
  */
691
  protected function _getItemJurisdictionRate($line)
134
 
135
  //make request if needed and save results in cache
136
  if ($makeRequest) {
137
+ /** @var OnePica\AvaTax16\Document\Response $result */
138
  $result = $this->_send($quote->getStoreId());
139
  $this->_rates[$requestKey] = array(
140
  'timestamp' => $this->_getDateModel()->timestamp(),
147
  //success
148
  if (!$result->getHasError()) {
149
  foreach ($result->getLines() as $ctl) {
150
+ /** @var OnePica\AvaTax16\Document\Response\Line $ctl */
151
  $id = $this->_getItemIdByLine($ctl);
152
  $code = $this->_getTaxArrayCodeByLine($ctl);
153
  $this->_rates[$requestKey][$code][$id] = array(
233
  if ($this->isProductCalculated($item)) {
234
  return false;
235
  }
236
+ $product = $this->_getProductByProductId($this->_retrieveProductIdFromQuoteItem($item));
237
  $taxClass = $this->_getTaxClassCodeByProduct($product);
238
  $price = $item->getBaseRowTotal();
239
  if ($this->_getTaxDataHelper()->applyTaxAfterDiscount($item->getStoreId())) {
540
  /**
541
  * Get item id/code for given line
542
  *
543
+ * @param OnePica\AvaTax16\Document\Response\Line $line
544
  * @return string|int
545
  */
546
  protected function _getItemIdByLine($line)
553
  /**
554
  * Get tax array code for given line
555
  *
556
+ * @param OnePica\AvaTax16\Document\Response\Line $line
557
  * @return string
558
  */
559
  protected function _getTaxArrayCodeByLine($line)
564
  /**
565
  * Get line rate
566
  *
567
+ * @param OnePica\AvaTax16\Document\Response\Line $line
568
  * @return float
569
  */
570
  protected function _getLineRate($line)
581
  /**
582
  * Get line rate
583
  *
584
+ * @param OnePica\AvaTax16\Document\Response $response
585
  * @return array
586
  */
587
  protected function _getSummaryFromResponse($response)
609
  /**
610
  * Get Jurisdictions rate array
611
  *
612
+ * @param OnePica\AvaTax16\Document\Response $response
613
  * @return array
614
  */
615
  protected function _getJurisdictionsRate($response)
617
  $rates = array();
618
  $fixedRatesData = array();
619
 
620
+ /** @var OnePica\AvaTax16\Document\Response\Line $line */
621
  foreach ($response->getLines() as $line) {
622
  if (!$line->getCalculatedTax()->getTax()) {
623
  continue;
685
  /**
686
  * Get item jurisdiction rate
687
  *
688
+ * @param OnePica\AvaTax16\Document\Response\Line $line
689
  * @return array
690
  */
691
  protected function _getItemJurisdictionRate($line)
app/code/community/OnePica/AvaTax/Model/Service/Avatax16/Invoice.php CHANGED
@@ -575,7 +575,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Invoice extends OnePica_AvaTax_Model
575
  protected function _getLineProductData($item, $storeId)
576
  {
577
  $lineProductData = new Varien_Object();
578
- $product = $this->_getProductByProductId($item->getProductId());
579
 
580
  if (null === $product) {
581
  return $lineProductData;
575
  protected function _getLineProductData($item, $storeId)
576
  {
577
  $lineProductData = new Varien_Object();
578
+ $product = $this->_getProductByProductId($this->_retrieveProductIdFromOrderItem($item));
579
 
580
  if (null === $product) {
581
  return $lineProductData;
app/code/community/OnePica/AvaTax/Model/Service/Avatax16/Ping.php CHANGED
@@ -40,7 +40,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Ping extends OnePica_AvaTax_Model_Se
40
  $message = '';
41
 
42
  try {
43
- /** @var OnePica_AvaTax16_AddressResolution_PingResponse $result */
44
  $result = $connection->ping();
45
  } catch (Exception $exception) {
46
  $message = $exception->getMessage();
40
  $message = '';
41
 
42
  try {
43
+ /** @var OnePica\AvaTax16\AddressResolution\PingResponse $result */
44
  $result = $connection->ping();
45
  } catch (Exception $exception) {
46
  $message = $exception->getMessage();
app/code/community/OnePica/AvaTax/Model/Service/Avatax16/Tax.php CHANGED
@@ -27,7 +27,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Tax extends OnePica_AvaTax_Model_Ser
27
  /**
28
  * The document request data object
29
  *
30
- * @var OnePica_AvaTax16_Document_Request
31
  */
32
  protected $_request = null;
33
 
@@ -56,7 +56,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Tax extends OnePica_AvaTax_Model_Ser
56
  * Get the orgin address for the request
57
  *
58
  * @param null|bool|int|Mage_Core_Model_Store $store
59
- * @return OnePica_AvaTax16_Document_Part_Location_Address
60
  */
61
  protected function _getOriginAddress($store = null)
62
  {
@@ -74,7 +74,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Tax extends OnePica_AvaTax_Model_Ser
74
  * Get the shipping address for the request
75
  *
76
  * @param OnePica_AvaTax_Model_Sales_Quote_Address $address
77
- * @return OnePica_AvaTax16_Document_Part_Location_Address
78
  */
79
  protected function _getDestinationAddress($address)
80
  {
@@ -98,7 +98,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Tax extends OnePica_AvaTax_Model_Ser
98
  * @param string $state
99
  * @param string $zip
100
  * @param string $country
101
- * @return OnePica_AvaTax16_Document_Part_Location_Address
102
  */
103
  protected function _newAddress($line1, $line2, $city, $state, $zip, $country = 'USA')
104
  {
@@ -341,7 +341,7 @@ class OnePica_AvaTax_Model_Service_Avatax16_Tax extends OnePica_AvaTax_Model_Ser
341
  *
342
  * @param int $storeId
343
  * @param OnePica_AvaTax_Model_Sales_Quote_Address|Mage_Sales_Model_Order $object
344
- * @return \OnePica_AvaTax16_Document_Request_Header
345
  */
346
  protected function _getRequestHeaderWithMainValues($storeId, $object)
347
  {
27
  /**
28
  * The document request data object
29
  *
30
+ * @var OnePica\AvaTax16\Document\Request
31
  */
32
  protected $_request = null;
33
 
56
  * Get the orgin address for the request
57
  *
58
  * @param null|bool|int|Mage_Core_Model_Store $store
59
+ * @return OnePica\AvaTax16\Document\Part\Location\Address
60
  */
61
  protected function _getOriginAddress($store = null)
62
  {
74
  * Get the shipping address for the request
75
  *
76
  * @param OnePica_AvaTax_Model_Sales_Quote_Address $address
77
+ * @return OnePica\AvaTax16\Document\Part\Location\Address
78
  */
79
  protected function _getDestinationAddress($address)
80
  {
98
  * @param string $state
99
  * @param string $zip
100
  * @param string $country
101
+ * @return OnePica\AvaTax16\Document\Part\Location\Address
102
  */
103
  protected function _newAddress($line1, $line2, $city, $state, $zip, $country = 'USA')
104
  {
341
  *
342
  * @param int $storeId
343
  * @param OnePica_AvaTax_Model_Sales_Quote_Address|Mage_Sales_Model_Order $object
344
+ * @return OnePica\AvaTax16\Document\Request\Header
345
  */
346
  protected function _getRequestHeaderWithMainValues($storeId, $object)
347
  {
app/code/community/OnePica/AvaTax/Model/Source/Logtype.php CHANGED
@@ -45,6 +45,17 @@ class OnePica_AvaTax_Model_Source_Logtype
45
  return $this->_getLogTypeModel()->getLogTypes();
46
  }
47
 
 
 
 
 
 
 
 
 
 
 
 
48
  /**
49
  * Get LogType source model
50
  *
45
  return $this->_getLogTypeModel()->getLogTypes();
46
  }
47
 
48
+ /**
49
+ * Get filter type
50
+ *
51
+ * @return string
52
+ */
53
+ public function getFilterType()
54
+ {
55
+ $logType = $this->_getLogTypeModel();
56
+ return $logType::FILTER;
57
+ }
58
+
59
  /**
60
  * Get LogType source model
61
  *
app/code/community/OnePica/AvaTax/etc/config.xml CHANGED
@@ -19,7 +19,7 @@
19
  <config>
20
  <modules>
21
  <OnePica_AvaTax>
22
- <version>3.2.1.0</version>
23
  </OnePica_AvaTax>
24
  </modules>
25
  <global>
@@ -238,6 +238,15 @@
238
  </avatax>
239
  </observers>
240
  </controller_action_predispatch_checkout_multishipping_index>
 
 
 
 
 
 
 
 
 
241
  <sales_model_service_quote_submit_before>
242
  <observers>
243
  <avatax>
@@ -389,6 +398,7 @@
389
  <avatax>
390
  <validate_address>1</validate_address>
391
  <active_service>avatax</active_service>
 
392
  <action>0</action>
393
  <url>https://avatax.avalara.net/</url>
394
  <region_filter_mode>0</region_filter_mode>
19
  <config>
20
  <modules>
21
  <OnePica_AvaTax>
22
+ <version>3.2.2.0</version>
23
  </OnePica_AvaTax>
24
  </modules>
25
  <global>
238
  </avatax>
239
  </observers>
240
  </controller_action_predispatch_checkout_multishipping_index>
241
+ <controller_action_predispatch_customer_address_formPost>
242
+ <observers>
243
+ <avatax>
244
+ <type>singleton</type>
245
+ <class>avatax/observer_controllerActionPredispatchCustomerAddressFormPost</class>
246
+ <method>execute</method>
247
+ </avatax>
248
+ </observers>
249
+ </controller_action_predispatch_customer_address_formPost>
250
  <sales_model_service_quote_submit_before>
251
  <observers>
252
  <avatax>
398
  <avatax>
399
  <validate_address>1</validate_address>
400
  <active_service>avatax</active_service>
401
+ <avatax16_extension_version>2.0.2</avatax16_extension_version>
402
  <action>0</action>
403
  <url>https://avatax.avalara.net/</url>
404
  <region_filter_mode>0</region_filter_mode>
app/code/community/OnePica/AvaTax/etc/system.xml CHANGED
@@ -23,6 +23,9 @@
23
  <groups>
24
  <avatax translate="label comment">
25
  <label>AvaTax</label>
 
 
 
26
  <sort_order>0</sort_order>
27
  <show_in_default>1</show_in_default>
28
  <show_in_website>1</show_in_website>
@@ -504,7 +507,7 @@
504
  <show_in_store>1</show_in_store>
505
  </title_limit_gettax_request>
506
  <limit_gettax_request_on_checkout_onepage_actions translate="label comment">
507
- <label>Limit tax calculation requests on OneStep checkout</label>
508
  <comment>Pay Attention. If any custom checkout (like OneStep Checkout) or some modification is used, this may not work properly and is recommended to be disabled.</comment>
509
  <frontend_type>select</frontend_type>
510
  <source_model>adminhtml/system_config_source_enabledisable</source_model>
23
  <groups>
24
  <avatax translate="label comment">
25
  <label>AvaTax</label>
26
+ <comment><![CDATA[
27
+ <p class="switcher"><i>AvaTax Extension Version:</i> <strong>{{var avatax_ver}}</strong></p>
28
+ ]]></comment>
29
  <sort_order>0</sort_order>
30
  <show_in_default>1</show_in_default>
31
  <show_in_website>1</show_in_website>
507
  <show_in_store>1</show_in_store>
508
  </title_limit_gettax_request>
509
  <limit_gettax_request_on_checkout_onepage_actions translate="label comment">
510
+ <label>Limit tax calculation requests on OnePage checkout</label>
511
  <comment>Pay Attention. If any custom checkout (like OneStep Checkout) or some modification is used, this may not work properly and is recommended to be disabled.</comment>
512
  <frontend_type>select</frontend_type>
513
  <source_model>adminhtml/system_config_source_enabledisable</source_model>
lib/OnePica/AvaTax16/AddressResolution.php CHANGED
@@ -11,15 +11,16 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_AddressResolution
21
  */
22
- class OnePica_AvaTax16_AddressResolution extends OnePica_AvaTax16_ResourceAbstract
23
  {
24
  /**
25
  * Url path for address resolution
@@ -29,8 +30,8 @@ class OnePica_AvaTax16_AddressResolution extends OnePica_AvaTax16_ResourceAbstra
29
  /**
30
  * Resolve a Single Address
31
  *
32
- * @param OnePica_AvaTax16_Document_Part_Location_Address $address
33
- * @return OnePica_AvaTax16_AddressResolution_ResolveSingleAddressResponse $result
34
  */
35
  public function resolveSingleAddress($address)
36
  {
@@ -47,9 +48,9 @@ class OnePica_AvaTax16_AddressResolution extends OnePica_AvaTax16_ResourceAbstra
47
  $requestOptions = array(
48
  'requestType' => 'POST',
49
  'data' => $postData,
50
- 'returnClass' => 'OnePica_AvaTax16_AddressResolution_ResolveSingleAddressResponse'
51
  );
52
- $result = $this->_sendRequest($postUrl, $requestOptions);
53
  return $result;
54
  }
55
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16;
19
 
20
  /**
21
+ * Class \OnePica\AvaTax16\AddressResolution
22
  */
23
+ class AddressResolution extends ResourceAbstract
24
  {
25
  /**
26
  * Url path for address resolution
30
  /**
31
  * Resolve a Single Address
32
  *
33
+ * @param \OnePica\AvaTax16\Document\Part\Location\Address $address
34
+ * @return \OnePica\AvaTax16\AddressResolution\ResolveSingleAddressResponse $result
35
  */
36
  public function resolveSingleAddress($address)
37
  {
48
  $requestOptions = array(
49
  'requestType' => 'POST',
50
  'data' => $postData,
51
+ 'returnClass' => '\OnePica\AvaTax16\AddressResolution\ResolveSingleAddressResponse'
52
  );
53
+ $result = $this->sendRequest($postUrl, $requestOptions);
54
  return $result;
55
  }
56
  }
lib/OnePica/AvaTax16/AddressResolution/PingResponse.php CHANGED
@@ -11,27 +11,35 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_AddressResolution_PingResponse
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_AddressResolution_PingResponse extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Has error
26
  *
27
  * @var bool
28
  */
29
- protected $_hasError = false;
30
 
31
  /**
32
  * Errors
33
  *
34
  * @var array
35
  */
36
- protected $_errors;
37
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\AddressResolution;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\AddressResolution\PingResponse
24
+ *
25
+ * @method bool getHasError()
26
+ * @method setHasError(bool $value)
27
+ * @method array getErrors()
28
+ * @method setErrors(array $value)
29
  */
30
+ class PingResponse extends Part
31
  {
32
  /**
33
  * Has error
34
  *
35
  * @var bool
36
  */
37
+ protected $hasError = false;
38
 
39
  /**
40
  * Errors
41
  *
42
  * @var array
43
  */
44
+ protected $errors = array();
45
  }
lib/OnePica/AvaTax16/AddressResolution/ResolveSingleAddressResponse.php CHANGED
@@ -11,44 +11,60 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_AddressResolution_ResolveSingleAddressResponse
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_AddressResolution_ResolveSingleAddressResponse extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Has error
26
  *
27
  * @var bool
28
  */
29
- protected $_hasError = false;
30
 
31
  /**
32
  * Errors
33
  *
34
  * @var array
35
  */
36
- protected $_errors;
37
 
38
  /**
39
  * Types of complex properties
40
  *
41
  * @var array
42
  */
43
- protected $_propertyComplexTypes = array(
44
- '_address' => array(
45
- 'type' => 'OnePica_AvaTax16_Document_Part_Location_Address'
46
  ),
47
- '_coordinates' => array(
48
- 'type' => 'OnePica_AvaTax16_Document_Part_Location_LatLong'
49
  ),
50
- '_taxAuthorities' => array(
51
- 'type' => 'OnePica_AvaTax16_AddressResolution_TaxAuthority',
52
  'isArrayOf' => 'true'
53
  ),
54
  );
@@ -56,28 +72,28 @@ class OnePica_AvaTax16_AddressResolution_ResolveSingleAddressResponse extends On
56
  /**
57
  * Address
58
  *
59
- * @var OnePica_AvaTax16_Document_Part_Location_Address
60
  */
61
- protected $_address;
62
 
63
  /**
64
  * Coordinates
65
  *
66
- * @var OnePica_AvaTax16_Document_Part_Location_LatLong
67
  */
68
- protected $_coordinates;
69
 
70
  /**
71
  * Resolution Quality
72
  *
73
  * @var string
74
  */
75
- protected $_resolutionQuality;
76
 
77
  /**
78
  * Tax Authorities
79
  *
80
  * @var array
81
  */
82
- protected $_taxAuthorities;
83
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\AddressResolution;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\AddressResolution\ResolveSingleAddressResponse
24
+ *
25
+ * @method bool getHasError()
26
+ * @method setHasError(bool $value)
27
+ * @method array getErrors()
28
+ * @method setErrors(array $value)
29
+ * @method \OnePica\AvaTax16\Document\Part\Location\Address getAddress()
30
+ * @method setAddress(\OnePica\AvaTax16\Document\Part\Location\Address $value)
31
+ * @method \OnePica\AvaTax16\Document\Part\Location\LatLong getCoordinates()
32
+ * @method setCoordinates(\OnePica\AvaTax16\Document\Part\Location\LatLong $value)
33
+ * @method string getResolutionQuality()
34
+ * @method setResolutionQuality(string $value)
35
+ * @method array getTaxAuthorities()
36
+ * @method setTaxAuthorities(array $value)
37
  */
38
+ class ResolveSingleAddressResponse extends Part
39
  {
40
  /**
41
  * Has error
42
  *
43
  * @var bool
44
  */
45
+ protected $hasError = false;
46
 
47
  /**
48
  * Errors
49
  *
50
  * @var array
51
  */
52
+ protected $errors = array();
53
 
54
  /**
55
  * Types of complex properties
56
  *
57
  * @var array
58
  */
59
+ protected $propertyComplexTypes = array(
60
+ 'address' => array(
61
+ 'type' => '\OnePica\AvaTax16\Document\Part\Location\Address'
62
  ),
63
+ 'coordinates' => array(
64
+ 'type' => '\OnePica\AvaTax16\Document\Part\Location\LatLong'
65
  ),
66
+ 'taxAuthorities' => array(
67
+ 'type' => '\OnePica\AvaTax16\AddressResolution\TaxAuthority',
68
  'isArrayOf' => 'true'
69
  ),
70
  );
72
  /**
73
  * Address
74
  *
75
+ * @var \OnePica\AvaTax16\Document\Part\Location\Address
76
  */
77
+ protected $address;
78
 
79
  /**
80
  * Coordinates
81
  *
82
+ * @var \OnePica\AvaTax16\Document\Part\Location\LatLong
83
  */
84
+ protected $coordinates;
85
 
86
  /**
87
  * Resolution Quality
88
  *
89
  * @var string
90
  */
91
+ protected $resolutionQuality;
92
 
93
  /**
94
  * Tax Authorities
95
  *
96
  * @var array
97
  */
98
+ protected $taxAuthorities;
99
  }
lib/OnePica/AvaTax16/AddressResolution/TaxAuthority.php CHANGED
@@ -11,41 +11,53 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_AddressResolution_TaxAuthority
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_AddressResolution_TaxAuthority extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Avalara Id
26
  *
27
  * @var string
28
  */
29
- protected $_avalaraId;
30
 
31
  /**
32
  * Jurisdiction Name
33
  *
34
  * @var string
35
  */
36
- protected $_jurisdictionName;
37
 
38
  /**
39
  * Jurisdiction Type
40
  *
41
  * @var string
42
  */
43
- protected $_jurisdictionType;
44
 
45
  /**
46
  * Signature Code
47
  *
48
  * @var string
49
  */
50
- protected $_signatureCode;
51
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\AddressResolution;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\AddressResolution\TaxAuthority
24
+ *
25
+ * @method string getAvalaraId()
26
+ * @method setAvalaraId(string $value)
27
+ * @method string getJurisdictionName()
28
+ * @method setJurisdictionName(string $value)
29
+ * @method string getJurisdictionType()
30
+ * @method setJurisdictionType(string $value)
31
+ * @method string getSignatureCode()
32
+ * @method setSignatureCode(string $value)
33
  */
34
+ class TaxAuthority extends Part
35
  {
36
  /**
37
  * Avalara Id
38
  *
39
  * @var string
40
  */
41
+ protected $avalaraId;
42
 
43
  /**
44
  * Jurisdiction Name
45
  *
46
  * @var string
47
  */
48
+ protected $jurisdictionName;
49
 
50
  /**
51
  * Jurisdiction Type
52
  *
53
  * @var string
54
  */
55
+ protected $jurisdictionType;
56
 
57
  /**
58
  * Signature Code
59
  *
60
  * @var string
61
  */
62
+ protected $signatureCode;
63
  }
lib/OnePica/AvaTax16/Calculation.php CHANGED
@@ -11,15 +11,16 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Calculation
21
  */
22
- class OnePica_AvaTax16_Calculation extends OnePica_AvaTax16_ResourceAbstract
23
  {
24
  /**
25
  * Url path for calculations
@@ -29,19 +30,19 @@ class OnePica_AvaTax16_Calculation extends OnePica_AvaTax16_ResourceAbstract
29
  /**
30
  * Create Calculation
31
  *
32
- * @param OnePica_AvaTax16_Document_Request $documentRequest
33
- * @return OnePica_AvaTax16_Document_Response $documentResponse
34
  */
35
  public function createCalculation($documentRequest)
36
  {
37
- $postUrl = $this->_config->getBaseUrl() . self::CALCULATION_URL_PATH;
38
  $postData = $documentRequest->toArray();
39
  $requestOptions = array(
40
  'requestType' => 'POST',
41
  'data' => $postData,
42
- 'returnClass' => 'OnePica_AvaTax16_Document_Response'
43
  );
44
- $documentResponse = $this->_sendRequest($postUrl, $requestOptions);
45
  return $documentResponse;
46
  }
47
 
@@ -50,7 +51,7 @@ class OnePica_AvaTax16_Calculation extends OnePica_AvaTax16_ResourceAbstract
50
  *
51
  * @param string $transactionType
52
  * @param string $documentCode
53
- * @return OnePica_AvaTax16_Document_Response $documentResponse
54
  */
55
  public function getCalculation($transactionType, $documentCode)
56
  {
@@ -68,9 +69,9 @@ class OnePica_AvaTax16_Calculation extends OnePica_AvaTax16_ResourceAbstract
68
 
69
  $requestOptions = array(
70
  'requestType' => 'GET',
71
- 'returnClass' => 'OnePica_AvaTax16_Document_Response'
72
  );
73
- $documentResponse = $this->_sendRequest($getUrl, $requestOptions);
74
  return $documentResponse;
75
  }
76
 
@@ -82,7 +83,7 @@ class OnePica_AvaTax16_Calculation extends OnePica_AvaTax16_ResourceAbstract
82
  * @param string $startDate
83
  * @param string $endDate
84
  * @param string $startCode (not implemented)
85
- * @return OnePica_AvaTax16_Calculation_ListResponse $calculationListResponse
86
  */
87
  public function getListOfCalculations($transactionType, $limit = null, $startDate = null, $endDate = null,
88
  $startCode = null)
@@ -106,9 +107,9 @@ class OnePica_AvaTax16_Calculation extends OnePica_AvaTax16_ResourceAbstract
106
  $requestOptions = array(
107
  'requestType' => 'GET',
108
  'data' => $filterData,
109
- 'returnClass' => 'OnePica_AvaTax16_Calculation_ListResponse'
110
  );
111
- $calculationListResponse = $this->_sendRequest($getUrl, $requestOptions);
112
  return $calculationListResponse;
113
  }
114
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16;
19
 
20
  /**
21
+ * Class \OnePica\AvaTax16\Calculation
22
  */
23
+ class Calculation extends ResourceAbstract
24
  {
25
  /**
26
  * Url path for calculations
30
  /**
31
  * Create Calculation
32
  *
33
+ * @param \OnePica\AvaTax16\Document\Request $documentRequest
34
+ * @return \OnePica\AvaTax16\Document\Response $documentResponse
35
  */
36
  public function createCalculation($documentRequest)
37
  {
38
+ $postUrl = $this->getConfig()->getBaseUrl() . self::CALCULATION_URL_PATH;
39
  $postData = $documentRequest->toArray();
40
  $requestOptions = array(
41
  'requestType' => 'POST',
42
  'data' => $postData,
43
+ 'returnClass' => '\OnePica\AvaTax16\Document\Response'
44
  );
45
+ $documentResponse = $this->sendRequest($postUrl, $requestOptions);
46
  return $documentResponse;
47
  }
48
 
51
  *
52
  * @param string $transactionType
53
  * @param string $documentCode
54
+ * @return \OnePica\AvaTax16\Document\Response $documentResponse
55
  */
56
  public function getCalculation($transactionType, $documentCode)
57
  {
69
 
70
  $requestOptions = array(
71
  'requestType' => 'GET',
72
+ 'returnClass' => '\OnePica\AvaTax16\Document\Response'
73
  );
74
+ $documentResponse = $this->sendRequest($getUrl, $requestOptions);
75
  return $documentResponse;
76
  }
77
 
83
  * @param string $startDate
84
  * @param string $endDate
85
  * @param string $startCode (not implemented)
86
+ * @return \OnePica\AvaTax16\Calculation\ListResponse $calculationListResponse
87
  */
88
  public function getListOfCalculations($transactionType, $limit = null, $startDate = null, $endDate = null,
89
  $startCode = null)
107
  $requestOptions = array(
108
  'requestType' => 'GET',
109
  'data' => $filterData,
110
+ 'returnClass' => '\OnePica\AvaTax16\Calculation\ListResponse'
111
  );
112
+ $calculationListResponse = $this->sendRequest($getUrl, $requestOptions);
113
  return $calculationListResponse;
114
  }
115
  }
lib/OnePica/AvaTax16/Calculation/ListItemResponse.php CHANGED
@@ -11,62 +11,74 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Calculation_ListItemResponse
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Calculation_ListItemResponse extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Types of complex properties
26
  *
27
  * @var array
28
  */
29
- protected $_propertyComplexTypes = array(
30
- '_header' => array(
31
- 'type' => 'OnePica_AvaTax16_Calculation_ListItemResponse_Header'
32
  ),
33
- '_lines' => array(
34
- 'type' => 'OnePica_AvaTax16_Calculation_ListItemResponse_Line',
35
  'isArrayOf' => 'true'
36
  ),
37
- '_calculatedTaxSummary' => array(
38
- 'type' => 'OnePica_AvaTax16_Calculation_ListItemResponse_CalculatedTaxSummary'
39
  ),
40
- '_processingInfo' => array(
41
- 'type' => 'OnePica_AvaTax16_Calculation_ListItemResponse_ProcessingInfo'
42
  ),
43
  );
44
 
45
  /**
46
  * Header
47
  *
48
- * @var OnePica_AvaTax16_Calculation_ListItemResponse_Header
49
  */
50
- protected $_header;
51
 
52
  /**
53
  * Lines
54
  *
55
  * @var Array
56
  */
57
- protected $_lines;
58
 
59
  /**
60
  * Feedback
61
  *
62
- * @var OnePica_AvaTax16_Calculation_ListItemResponse_CalculatedTaxSummary
63
  */
64
- protected $_calculatedTaxSummary;
65
 
66
  /**
67
  * Feedback
68
  *
69
- * @var OnePica_AvaTax16_Calculation_ListItemResponse_ProcessingInfo
70
  */
71
- protected $_processingInfo;
72
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Calculation;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Calculation\ListItemResponse
24
+ *
25
+ * @method \OnePica\AvaTax16\Calculation\ListItemResponse\Header getHeader()
26
+ * @method setHeader(\OnePica\AvaTax16\Calculation\ListItemResponse\Header $value)
27
+ * @method array getLines)
28
+ * @method setLines(array $value)
29
+ * @method \OnePica\AvaTax16\Calculation\ListItemResponse\CalculatedTaxSummary getCalculatedTaxSummary()
30
+ * @method setCalculatedTaxSummary(\OnePica\AvaTax16\Calculation\ListItemResponse\CalculatedTaxSummary $value)
31
+ * @method \OnePica\AvaTax16\Calculation\ListItemResponse\ProcessingInfo getProcessingInfo()
32
+ * @method setProcessingInfo(\OnePica\AvaTax16\Calculation\ListItemResponse\ProcessingInfo $value)
33
  */
34
+ class ListItemResponse extends Part
35
  {
36
  /**
37
  * Types of complex properties
38
  *
39
  * @var array
40
  */
41
+ protected $propertyComplexTypes = array(
42
+ 'header' => array(
43
+ 'type' => '\OnePica\AvaTax16\Calculation\ListItemResponse\Header'
44
  ),
45
+ 'lines' => array(
46
+ 'type' => '\OnePica\AvaTax16\Calculation\ListItemResponse\Line',
47
  'isArrayOf' => 'true'
48
  ),
49
+ 'calculatedTaxSummary' => array(
50
+ 'type' => '\OnePica\AvaTax16\Calculation\ListItemResponse\CalculatedTaxSummary'
51
  ),
52
+ 'processingInfo' => array(
53
+ 'type' => '\OnePica\AvaTax16\Calculation\ListItemResponse\ProcessingInfo'
54
  ),
55
  );
56
 
57
  /**
58
  * Header
59
  *
60
+ * @var \OnePica\AvaTax16\Calculation\ListItemResponse\Header
61
  */
62
+ protected $header;
63
 
64
  /**
65
  * Lines
66
  *
67
  * @var Array
68
  */
69
+ protected $lines;
70
 
71
  /**
72
  * Feedback
73
  *
74
+ * @var \OnePica\AvaTax16\Calculation\ListItemResponse\CalculatedTaxSummary
75
  */
76
+ protected $calculatedTaxSummary;
77
 
78
  /**
79
  * Feedback
80
  *
81
+ * @var \OnePica\AvaTax16\Calculation\ListItemResponse\ProcessingInfo
82
  */
83
+ protected $processingInfo;
84
  }
lib/OnePica/AvaTax16/Calculation/ListItemResponse/CalculatedTaxSummary.php CHANGED
@@ -11,25 +11,44 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Calculation_ListItemResponse_CalculatedTaxSummary
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Calculation_ListItemResponse_CalculatedTaxSummary
23
- extends OnePica_AvaTax16_Document_Part
24
  {
25
  /**
26
  * Types of complex properties
27
  *
28
  * @var array
29
  */
30
- protected $_propertyComplexTypes = array(
31
- '_taxByType' => array(
32
- 'type' => 'OnePica_AvaTax16_Calculation_ListItemResponse_CalculatedTaxSummary_TaxByType',
33
  'isArrayOf' => 'true'
34
  )
35
  );
@@ -39,54 +58,54 @@ class OnePica_AvaTax16_Calculation_ListItemResponse_CalculatedTaxSummary
39
  *
40
  * @var int
41
  */
42
- protected $_numberOfLines;
43
 
44
  /**
45
  * Subtotal
46
  *
47
  * @var float
48
  */
49
- protected $_subtotal;
50
 
51
  /**
52
  * Total Tax
53
  *
54
  * @var float
55
  */
56
- protected $_totalTax;
57
 
58
  /**
59
  * Tax By Type
60
  *
61
- * @var OnePica_AvaTax16_Calculation_ListItemResponse_CalculatedTaxSummary_TaxByType
62
  */
63
- protected $_taxByType;
64
 
65
  /**
66
  * Subtotal Taxable
67
  *
68
  * @var float
69
  */
70
- protected $_subtotalTaxable;
71
 
72
  /**
73
  * Subtotal Exempt
74
  *
75
  * @var float
76
  */
77
- protected $_subtotalExempt;
78
 
79
  /**
80
  * Tax
81
  *
82
  * @var float
83
  */
84
- protected $_tax;
85
 
86
  /**
87
  * Grand Total
88
  *
89
  * @var float
90
  */
91
- protected $_grandTotal;
92
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Calculation\ListItemResponse;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Calculation\ListItemResponse\CalculatedTaxSummary
24
+ *
25
+ * @method int getNumberOfLines()
26
+ * @method setNumberOfLines(int $value)
27
+ * @method float getSubtotal()
28
+ * @method setSubtotal(float $value)
29
+ * @method float getTotalTax()
30
+ * @method setTotalTax(float $value)
31
+ * @method \OnePica\AvaTax16\Calculation\ListItemResponse\CalculatedTaxSummary\TaxByType getTaxByType()
32
+ * @method setTaxByType(\OnePica\AvaTax16\Calculation\ListItemResponse\CalculatedTaxSummary\TaxByType $value)
33
+ * @method float getSubtotalTaxable()
34
+ * @method setSubtotalTaxable(float $value)
35
+ * @method float getSubtotalExempt()
36
+ * @method setSubtotalExempt(float $value)
37
+ * @method float getTax()
38
+ * @method setTax(float $value)
39
+ * @method float getGrandTotal()
40
+ * @method setGrandTotal(float $value)
41
  */
42
+ class CalculatedTaxSummary extends Part
 
43
  {
44
  /**
45
  * Types of complex properties
46
  *
47
  * @var array
48
  */
49
+ protected $propertyComplexTypes = array(
50
+ 'taxByType' => array(
51
+ 'type' => '\OnePica\AvaTax16\Calculation\ListItemResponse\CalculatedTaxSummary\TaxByType',
52
  'isArrayOf' => 'true'
53
  )
54
  );
58
  *
59
  * @var int
60
  */
61
+ protected $numberOfLines;
62
 
63
  /**
64
  * Subtotal
65
  *
66
  * @var float
67
  */
68
+ protected $subtotal;
69
 
70
  /**
71
  * Total Tax
72
  *
73
  * @var float
74
  */
75
+ protected $totalTax;
76
 
77
  /**
78
  * Tax By Type
79
  *
80
+ * @var \OnePica\AvaTax16\Calculation\ListItemResponse\CalculatedTaxSummary\TaxByType
81
  */
82
+ protected $taxByType = array();
83
 
84
  /**
85
  * Subtotal Taxable
86
  *
87
  * @var float
88
  */
89
+ protected $subtotalTaxable;
90
 
91
  /**
92
  * Subtotal Exempt
93
  *
94
  * @var float
95
  */
96
+ protected $subtotalExempt;
97
 
98
  /**
99
  * Tax
100
  *
101
  * @var float
102
  */
103
+ protected $tax;
104
 
105
  /**
106
  * Grand Total
107
  *
108
  * @var float
109
  */
110
+ protected $grandTotal;
111
  }
lib/OnePica/AvaTax16/Calculation/ListItemResponse/CalculatedTaxSummary/TaxByType.php CHANGED
@@ -11,25 +11,34 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Calculation_ListItemResponse_CalculatedTaxSummary_TaxByType
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Calculation_ListItemResponse_CalculatedTaxSummary_TaxByType
23
- extends OnePica_AvaTax16_Document_Part
24
  {
25
  /**
26
  * Types of complex properties
27
  *
28
  * @var array
29
  */
30
- protected $_propertyComplexTypes = array(
31
- '_jurisdictions' => array(
32
- 'type' => 'OnePica_AvaTax16_Calculation_ListItemResponse_CalculatedTaxSummary_TaxByType_Details'
33
  )
34
  );
35
 
@@ -38,19 +47,19 @@ class OnePica_AvaTax16_Calculation_ListItemResponse_CalculatedTaxSummary_TaxByTy
38
  *
39
  * @var float
40
  */
41
- protected $_tax;
42
 
43
  /**
44
  * jurisdictions
45
  *
46
- * @var OnePica_AvaTax16_Calculation_ListItemResponse_CalculatedTaxSummary_TaxByType_Details
47
  */
48
- protected $_jurisdictions;
49
 
50
  /**
51
  * Comment
52
  *
53
  * @var string
54
  */
55
- protected $_comment;
56
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Calculation\ListItemResponse\CalculatedTaxSummary;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Calculation\ListItemResponse\CalculatedTaxSummary\TaxByType
24
+ *
25
+ * @method float getTax()
26
+ * @method setTax(float $value)
27
+ * @method float getJurisdictions()
28
+ * @method setJurisdictions(float $value)
29
+ * @method string getComment()
30
+ * @method setComment(string $value)
31
  */
32
+ class TaxByType extends Part
 
33
  {
34
  /**
35
  * Types of complex properties
36
  *
37
  * @var array
38
  */
39
+ protected $propertyComplexTypes = array(
40
+ 'jurisdictions' => array(
41
+ 'type' => '\OnePica\AvaTax16\Calculation\ListItemResponse\CalculatedTaxSummary\TaxByType\Details'
42
  )
43
  );
44
 
47
  *
48
  * @var float
49
  */
50
+ protected $tax;
51
 
52
  /**
53
  * jurisdictions
54
  *
55
+ * @var \OnePica\AvaTax16\Calculation\ListItemResponse\CalculatedTaxSummary\TaxByType\Details
56
  */
57
+ protected $jurisdictions;
58
 
59
  /**
60
  * Comment
61
  *
62
  * @var string
63
  */
64
+ protected $comment;
65
  }
lib/OnePica/AvaTax16/Calculation/ListItemResponse/CalculatedTaxSummary/TaxByType/Details.php CHANGED
@@ -11,42 +11,53 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Calculation_ListItemResponse_CalculatedTaxSummary_TaxByType_Details
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Calculation_ListItemResponse_CalculatedTaxSummary_TaxByType_Details
23
- extends OnePica_AvaTax16_Document_Part
24
  {
25
  /**
26
  * Jurisdiction Name
27
  *
28
  * @var string
29
  */
30
- protected $_jurisdictionName;
31
 
32
  /**
33
  * Jurisdiction Type
34
  *
35
  * @var string
36
  */
37
- protected $_jurisdictionType;
38
 
39
  /**
40
  * Tax
41
  *
42
  * @var float
43
  */
44
- protected $_tax ;
45
 
46
  /**
47
  * Comment
48
  *
49
- * @var float
50
  */
51
- protected $_comment;
52
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Calculation\ListItemResponse\CalculatedTaxSummary\TaxByType;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Calculation\ListItemResponse\CalculatedTaxSummary\TaxByType\Details
24
+ *
25
+ * @method string getJurisdictionName()
26
+ * @method setJurisdictionName(string $value)
27
+ * @method string getJurisdictionType()
28
+ * @method setJurisdictionType(string $value)
29
+ * @method float getTax()
30
+ * @method setTax(float $value)
31
+ * @method string getComment()
32
+ * @method setComment(string $value)
33
  */
34
+ class Details extends Part
 
35
  {
36
  /**
37
  * Jurisdiction Name
38
  *
39
  * @var string
40
  */
41
+ protected $jurisdictionName;
42
 
43
  /**
44
  * Jurisdiction Type
45
  *
46
  * @var string
47
  */
48
+ protected $jurisdictionType;
49
 
50
  /**
51
  * Tax
52
  *
53
  * @var float
54
  */
55
+ protected $tax ;
56
 
57
  /**
58
  * Comment
59
  *
60
+ * @var string
61
  */
62
+ protected $comment;
63
  }
lib/OnePica/AvaTax16/Calculation/ListItemResponse/Header.php CHANGED
@@ -11,69 +11,89 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Calculation_ListItemResponse_Header
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Calculation_ListItemResponse_Header extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Account Id
26
  *
27
  * @var string
28
  */
29
- protected $_accountId;
30
 
31
  /**
32
  * Company Code
33
  *
34
  * @var string
35
  */
36
- protected $_companyCode;
37
 
38
  /**
39
  * Transaction Type
40
  *
41
  * @var string
42
  */
43
- protected $_transactionType;
44
 
45
  /**
46
  * Document Code
47
  *
48
  * @var string
49
  */
50
- protected $_documentCode;
51
 
52
  /**
53
  * Customer Code
54
  *
55
  * @var string
56
  */
57
- protected $_customerCode;
58
 
59
  /**
60
  * Transaction Date
61
  *
62
  * @var string
63
  */
64
- protected $_transactionDate;
65
 
66
  /**
67
  * Currency
68
  *
69
  * @var string
70
  */
71
- protected $_currency;
72
 
73
  /**
74
  * Total Tax Override Amount
75
  *
76
  * @var string
77
  */
78
- protected $_totalTaxOverrideAmount;
79
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Calculation\ListItemResponse;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Calculation\ListItemResponse\Header
24
+ *
25
+ * @method string getAccountId()
26
+ * @method setAccountId(string $value)
27
+ * @method string getCompanyCode()
28
+ * @method setCompanyCode(string $value)
29
+ * @method string getTransactionType()
30
+ * @method setTransactionType(string $value)
31
+ * @method string getDocumentCode()
32
+ * @method setDocumentCode(string $value)
33
+ * @method string getCustomerCode()
34
+ * @method setCustomerCode(string $value)
35
+ * @method string getTransactionDate()
36
+ * @method setTransactionDate(string $value)
37
+ * @method string getCurrency()
38
+ * @method setCurrency(string $value)
39
+ * @method float getTotalTaxOverrideAmount()
40
+ * @method setTotalTaxOverrideAmount(float $value)
41
  */
42
+ class Header extends Part
43
  {
44
  /**
45
  * Account Id
46
  *
47
  * @var string
48
  */
49
+ protected $accountId;
50
 
51
  /**
52
  * Company Code
53
  *
54
  * @var string
55
  */
56
+ protected $companyCode;
57
 
58
  /**
59
  * Transaction Type
60
  *
61
  * @var string
62
  */
63
+ protected $transactionType;
64
 
65
  /**
66
  * Document Code
67
  *
68
  * @var string
69
  */
70
+ protected $documentCode;
71
 
72
  /**
73
  * Customer Code
74
  *
75
  * @var string
76
  */
77
+ protected $customerCode;
78
 
79
  /**
80
  * Transaction Date
81
  *
82
  * @var string
83
  */
84
+ protected $transactionDate;
85
 
86
  /**
87
  * Currency
88
  *
89
  * @var string
90
  */
91
+ protected $currency;
92
 
93
  /**
94
  * Total Tax Override Amount
95
  *
96
  * @var string
97
  */
98
+ protected $totalTaxOverrideAmount;
99
  }
lib/OnePica/AvaTax16/Calculation/ListItemResponse/Line.php CHANGED
@@ -11,20 +11,26 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Calculation_ListItemResponse_Line
 
 
 
21
  */
22
- class OnePica_AvaTax16_Calculation_ListItemResponse_Line extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Avalara Goods And Services Modifier type
26
  *
27
  * @var string
28
  */
29
- protected $_avalaraGoodsAndServicesModifierType;
30
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Calculation\ListItemResponse;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Calculation\ListItemResponse\Line
24
+ *
25
+ * @method string getAvalaraGoodsAndServicesModifierTypet()
26
+ * @method setAvalaraGoodsAndServicesModifierType(string $value)
27
  */
28
+ class Line extends Part
29
  {
30
  /**
31
  * Avalara Goods And Services Modifier type
32
  *
33
  * @var string
34
  */
35
+ protected $avalaraGoodsAndServicesModifierType;
36
  }
lib/OnePica/AvaTax16/Calculation/ListItemResponse/ProcessingInfo.php CHANGED
@@ -11,69 +11,89 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Calculation_ListItemResponse_ProcessingInfo
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Calculation_ListItemResponse_ProcessingInfo extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Transaction State
26
  *
27
  * @var string
28
  */
29
- protected $_transactionState;
30
 
31
  /**
32
  * Version Id
33
  *
34
  * @var string
35
  */
36
- protected $_versionId;
37
 
38
  /**
39
  * Format Id
40
  *
41
  * @var string
42
  */
43
- protected $_formatId;
44
 
45
  /**
46
  * Duration
47
  *
48
  * @var float
49
  */
50
- protected $_duration;
51
 
52
  /**
53
  * Modified Date
54
  *
55
  * @var string
56
  */
57
- protected $_modifiedDate;
58
 
59
  /**
60
  * Batch Id
61
  *
62
  * @var string
63
  */
64
- protected $_batchId;
65
 
66
  /**
67
  * Document Id
68
  *
69
  * @var string
70
  */
71
- protected $_documentId;
72
 
73
  /**
74
  * Message
75
  *
76
  * @var string
77
  */
78
- protected $_message;
79
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Calculation\ListItemResponse;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Calculation\ListItemResponse\ProcessingInfo
24
+ *
25
+ * @method string getTransactionState()
26
+ * @method setTransactionState(string $value)
27
+ * @method string getVersionId()
28
+ * @method setVersionId(string $value)
29
+ * @method string getFormatId()
30
+ * @method setFormatId(string $value)
31
+ * @method float getDuration()
32
+ * @method setDuration(float $value)
33
+ * @method string getModifiedDate()
34
+ * @method setModifiedDate(string $value)
35
+ * @method string getBatchId()
36
+ * @method setBatchId(string $value)
37
+ * @method string getDocumentId()
38
+ * @method setDocumentId(string $value)
39
+ * @method string getMessage()
40
+ * @method setMessage(string $value)
41
  */
42
+ class ProcessingInfo extends Part
43
  {
44
  /**
45
  * Transaction State
46
  *
47
  * @var string
48
  */
49
+ protected $transactionState;
50
 
51
  /**
52
  * Version Id
53
  *
54
  * @var string
55
  */
56
+ protected $versionId;
57
 
58
  /**
59
  * Format Id
60
  *
61
  * @var string
62
  */
63
+ protected $formatId;
64
 
65
  /**
66
  * Duration
67
  *
68
  * @var float
69
  */
70
+ protected $duration;
71
 
72
  /**
73
  * Modified Date
74
  *
75
  * @var string
76
  */
77
+ protected $modifiedDate;
78
 
79
  /**
80
  * Batch Id
81
  *
82
  * @var string
83
  */
84
+ protected $batchId;
85
 
86
  /**
87
  * Document Id
88
  *
89
  * @var string
90
  */
91
+ protected $documentId;
92
 
93
  /**
94
  * Message
95
  *
96
  * @var string
97
  */
98
+ protected $message;
99
  }
lib/OnePica/AvaTax16/Calculation/ListResponse.php CHANGED
@@ -11,41 +11,51 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Calculation_ListResponse
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Calculation_ListResponse extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Has error
26
  *
27
  * @var bool
28
  */
29
- protected $_hasError = false;
30
 
31
  /**
32
  * Errors
33
  *
34
  * @var array
35
  */
36
- protected $_errors;
37
 
38
  /**
39
  * List items
40
  *
41
- * @var OnePica_AvaTax16_Calculation_ListItemResponse[]
42
  */
43
- protected $_items;
44
 
45
  /**
46
  * Fill data from object
47
  *
48
- * @param StdClass|array $data
49
  * @return $this
50
  */
51
  public function fillData($data)
@@ -53,7 +63,7 @@ class OnePica_AvaTax16_Calculation_ListResponse extends OnePica_AvaTax16_Documen
53
  $result = array();
54
  if (is_array($data)) {
55
  foreach ($data as $dataItem) {
56
- $calculationListItem = new OnePica_AvaTax16_Calculation_ListItemResponse();
57
  $result[] = $calculationListItem->fillData($dataItem);
58
  }
59
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Calculation;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Calculation\ListResponse
24
+ *
25
+ * @method bool getHasError()
26
+ * @method setHasError(bool $value)
27
+ * @method array getErrors()
28
+ * @method setErrors(array $value)
29
+ * @method array getItems()
30
+ * @method setItems(array $value)
31
  */
32
+ class ListResponse extends Part
33
  {
34
  /**
35
  * Has error
36
  *
37
  * @var bool
38
  */
39
+ protected $hasError = false;
40
 
41
  /**
42
  * Errors
43
  *
44
  * @var array
45
  */
46
+ protected $errors = array();
47
 
48
  /**
49
  * List items
50
  *
51
+ * @var \OnePica\AvaTax16\Calculation\ListItemResponse[]
52
  */
53
+ protected $items;
54
 
55
  /**
56
  * Fill data from object
57
  *
58
+ * @param \StdClass|array $data
59
  * @return $this
60
  */
61
  public function fillData($data)
63
  $result = array();
64
  if (is_array($data)) {
65
  foreach ($data as $dataItem) {
66
+ $calculationListItem = new ListItemResponse();
67
  $result[] = $calculationListItem->fillData($dataItem);
68
  }
69
  }
lib/OnePica/AvaTax16/Config.php CHANGED
@@ -11,15 +11,16 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Config
21
  */
22
- class OnePica_AvaTax16_Config
23
  {
24
  /**
25
  * Accept header
@@ -41,35 +42,35 @@ class OnePica_AvaTax16_Config
41
  *
42
  * @var string
43
  */
44
- protected $_baseUrl;
45
 
46
  /**
47
  * Account id
48
  *
49
  * @var string
50
  */
51
- protected $_accountId;
52
 
53
  /**
54
  * Company code
55
  *
56
  * @var string
57
  */
58
- protected $_companyCode;
59
 
60
  /**
61
  * Authorization header
62
  *
63
  * @var string
64
  */
65
- protected $_authorizationHeader;
66
 
67
  /**
68
  * User agent
69
  *
70
  * @var string
71
  */
72
- protected $_userAgent;
73
 
74
  /**
75
  * Construct
@@ -84,11 +85,11 @@ class OnePica_AvaTax16_Config
84
  * Set base url
85
  *
86
  * @param string $value
87
- * @return OnePica_AvaTax16_Config
88
  */
89
  public function setBaseUrl($value)
90
  {
91
- $this->_baseUrl = $value;
92
  }
93
 
94
  /**
@@ -98,18 +99,18 @@ class OnePica_AvaTax16_Config
98
  */
99
  public function getBaseUrl()
100
  {
101
- return $this->_baseUrl;
102
  }
103
 
104
  /**
105
  * Set user agent
106
  *
107
  * @param string $value
108
- * @return OnePica_AvaTax16_Config
109
  */
110
  public function setUserAgent($value)
111
  {
112
- $this->_userAgent = $value;
113
  }
114
 
115
  /**
@@ -119,18 +120,18 @@ class OnePica_AvaTax16_Config
119
  */
120
  public function getUserAgent()
121
  {
122
- return $this->_userAgent;
123
  }
124
 
125
  /**
126
  * Set account id
127
  *
128
  * @param string $value
129
- * @return OnePica_AvaTax16_Config
130
  */
131
  public function setAccountId($value)
132
  {
133
- $this->_accountId = $value;
134
  }
135
 
136
  /**
@@ -140,18 +141,18 @@ class OnePica_AvaTax16_Config
140
  */
141
  public function getAccountId()
142
  {
143
- return $this->_accountId;
144
  }
145
 
146
  /**
147
  * Set company code
148
  *
149
  * @param string $value
150
- * @return OnePica_AvaTax16_Config
151
  */
152
  public function setCompanyCode($value)
153
  {
154
- $this->_companyCode = $value;
155
  }
156
 
157
  /**
@@ -161,18 +162,18 @@ class OnePica_AvaTax16_Config
161
  */
162
  public function getCompanyCode()
163
  {
164
- return $this->_companyCode;
165
  }
166
 
167
  /**
168
  * Set authorization header
169
  *
170
  * @param string $value
171
- * @return OnePica_AvaTax16_Config
172
  */
173
  public function setAuthorizationHeader($value)
174
  {
175
- $this->_authorizationHeader = $value;
176
  }
177
 
178
  /**
@@ -182,7 +183,7 @@ class OnePica_AvaTax16_Config
182
  */
183
  public function getAuthorizationHeader()
184
  {
185
- return $this->_authorizationHeader;
186
  }
187
 
188
  /**
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16;
19
 
20
  /**
21
+ * Class \OnePica\AvaTax16\Config
22
  */
23
+ class Config
24
  {
25
  /**
26
  * Accept header
42
  *
43
  * @var string
44
  */
45
+ protected $baseUrl;
46
 
47
  /**
48
  * Account id
49
  *
50
  * @var string
51
  */
52
+ protected $accountId;
53
 
54
  /**
55
  * Company code
56
  *
57
  * @var string
58
  */
59
+ protected $companyCode;
60
 
61
  /**
62
  * Authorization header
63
  *
64
  * @var string
65
  */
66
+ protected $authorizationHeader;
67
 
68
  /**
69
  * User agent
70
  *
71
  * @var string
72
  */
73
+ protected $userAgent;
74
 
75
  /**
76
  * Construct
85
  * Set base url
86
  *
87
  * @param string $value
88
+ * @return \OnePica\AvaTax16\Config
89
  */
90
  public function setBaseUrl($value)
91
  {
92
+ $this->baseUrl = $value;
93
  }
94
 
95
  /**
99
  */
100
  public function getBaseUrl()
101
  {
102
+ return $this->baseUrl;
103
  }
104
 
105
  /**
106
  * Set user agent
107
  *
108
  * @param string $value
109
+ * @return \OnePica\AvaTax16\Config
110
  */
111
  public function setUserAgent($value)
112
  {
113
+ $this->userAgent = $value;
114
  }
115
 
116
  /**
120
  */
121
  public function getUserAgent()
122
  {
123
+ return $this->userAgent;
124
  }
125
 
126
  /**
127
  * Set account id
128
  *
129
  * @param string $value
130
+ * @return \OnePica\AvaTax16\Config
131
  */
132
  public function setAccountId($value)
133
  {
134
+ $this->accountId = $value;
135
  }
136
 
137
  /**
141
  */
142
  public function getAccountId()
143
  {
144
+ return $this->accountId;
145
  }
146
 
147
  /**
148
  * Set company code
149
  *
150
  * @param string $value
151
+ * @return \OnePica\AvaTax16\Config
152
  */
153
  public function setCompanyCode($value)
154
  {
155
+ $this->companyCode = $value;
156
  }
157
 
158
  /**
162
  */
163
  public function getCompanyCode()
164
  {
165
+ return $this->companyCode;
166
  }
167
 
168
  /**
169
  * Set authorization header
170
  *
171
  * @param string $value
172
+ * @return \OnePica\AvaTax16\Config
173
  */
174
  public function setAuthorizationHeader($value)
175
  {
176
+ $this->authorizationHeader = $value;
177
  }
178
 
179
  /**
183
  */
184
  public function getAuthorizationHeader()
185
  {
186
+ return $this->authorizationHeader;
187
  }
188
 
189
  /**
lib/OnePica/AvaTax16/Document/Part.php CHANGED
@@ -11,36 +11,37 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Part
21
  */
22
- class OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Required properties
26
  *
27
  * @var array
28
  */
29
- protected $_requiredProperties = array();
30
 
31
  /**
32
  * Excluded properties (will be ignored during toArray function)
33
  *
34
  * @var array
35
  */
36
- protected $_excludedProperties = array();
37
 
38
  /**
39
  * Types of complex properties
40
  *
41
  * @var array
42
  */
43
- protected $_propertyComplexTypes = array();
44
 
45
  /**
46
  * Properties get and set methods
@@ -50,23 +51,23 @@ class OnePica_AvaTax16_Document_Part
50
  $action = substr($name, 0, 3);
51
  switch ($action) {
52
  case 'get':
53
- $property = '_' . lcfirst(substr($name, 3));
54
- if (property_exists($this,$property)) {
55
  return $this->{$property};
56
  } else {
57
- $this->_throwWrongMethodErrorException($name);
58
  }
59
  break;
60
  case 'set':
61
- $property = '_' . lcfirst(substr($name, 3));
62
- if (property_exists($this,$property)) {
63
  $this->{$property} = $arguments[0];
64
  } else {
65
- $this->_throwWrongMethodErrorException($name);
66
  }
67
  break;
68
  default :
69
- $this->_throwWrongMethodErrorException($name);
70
  }
71
  }
72
 
@@ -74,9 +75,9 @@ class OnePica_AvaTax16_Document_Part
74
  * Throw Wrong Method Error Exception
75
  *
76
  * @param string $methodName
77
- * @throws OnePica_AvaTax16_Exception
78
  */
79
- protected function _throwWrongMethodErrorException($methodName)
80
  {
81
  $trace = debug_backtrace();
82
  $errorMessage = 'Undefined method '
@@ -85,7 +86,7 @@ class OnePica_AvaTax16_Document_Part
85
  . $trace[0]['file']
86
  . ' on line '
87
  . $trace[0]['line'];
88
- throw new OnePica_AvaTax16_Exception($errorMessage);
89
  }
90
 
91
  /**
@@ -96,7 +97,7 @@ class OnePica_AvaTax16_Document_Part
96
  public function isValid()
97
  {
98
  foreach ($this as $key => $value) {
99
- if (in_array($key, $this->_requiredProperties) && (null === $value)) {
100
  return false;
101
  }
102
  }
@@ -107,23 +108,23 @@ class OnePica_AvaTax16_Document_Part
107
  * Convert object data to array
108
  *
109
  * @return array
110
- * @throws OnePica_AvaTax16_Exception
111
  */
112
  public function toArray()
113
  {
114
  if (!$this->isValid()) {
115
- throw new OnePica_AvaTax16_Exception("Not valid data in " . get_class($this));
116
  }
117
  $result = array();
118
  foreach ($this as $key => $value) {
119
- if (in_array($key, $this->_excludedProperties)
120
- || in_array($key, array('_requiredProperties', '_excludedProperties', '_propertyComplexTypes'))
121
  || (null === $value)) {
122
  // skip property
123
  continue;
124
  }
125
- $name = substr($key, 1);
126
- $result[$name] = $this->_proceedToArrayItem($value);
127
  }
128
  return $result;
129
  }
@@ -131,13 +132,13 @@ class OnePica_AvaTax16_Document_Part
131
  /**
132
  * Convert object data to array
133
  *
134
- * @param OnePica_AvaTax16_Document_Part|array|string $item
135
  * @return array|string
136
  */
137
- protected function _proceedToArrayItem($item)
138
  {
139
  $result = null;
140
- $itemType = ($item instanceof OnePica_AvaTax16_Document_Part) ? 'documentPart' :
141
  ((is_array($item)) ? 'array' : 'simple');
142
 
143
  switch ($itemType) {
@@ -146,7 +147,7 @@ class OnePica_AvaTax16_Document_Part
146
  break;
147
  case 'array':
148
  foreach ($item as $key => $value) {
149
- $result[$key] = $this->_proceedToArrayItem($value);
150
  }
151
  break;
152
  case 'simple':
@@ -160,31 +161,31 @@ class OnePica_AvaTax16_Document_Part
160
  /**
161
  * Fill data from object
162
  *
163
- * @param StdClass|array $data
164
  * @return $this
165
  */
166
  public function fillData($data)
167
  {
168
  foreach ($data as $key => $value) {
169
- $propName = '_' . $key;
170
  $method = 'set' . ucfirst($key);
171
- if (!property_exists ($this, $propName)) {
172
  // skip unknown property received from response to prevent error
173
  continue;
174
  }
175
- if (isset($this->_propertyComplexTypes[$propName])) {
176
- $propertyType = $this->_propertyComplexTypes[$propName]['type'];
177
- if (isset($this->_propertyComplexTypes[$propName]['isArrayOf'])) {
178
- $items = null;
179
  if (count($value) > 0) {
180
  foreach ($value as $itemKey => $itemData) {
181
- $item = $this->_createItemAndFillData($propertyType, $itemData);
182
  $items[$itemKey] = $item;
183
  }
184
  }
185
  $this->$method($items);
186
  } else {
187
- $item = $value ? $this->_createItemAndFillData($propertyType, $value) : null;
188
  $this->$method($item);
189
  }
190
  } else {
@@ -198,10 +199,10 @@ class OnePica_AvaTax16_Document_Part
198
  * Create item object and fill data in it
199
  *
200
  * @param string $itemClassName
201
- * @param StdClass|array $data
202
  * @return object $item
203
  */
204
- protected function _createItemAndFillData($itemClassName, $data)
205
  {
206
  $item = new $itemClassName();
207
  $item->fillData($data);
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document;
19
 
20
  /**
21
+ * Class \OnePica\AvaTax16\Document\Part
22
  */
23
+ class Part
24
  {
25
  /**
26
  * Required properties
27
  *
28
  * @var array
29
  */
30
+ protected $requiredProperties = array();
31
 
32
  /**
33
  * Excluded properties (will be ignored during toArray function)
34
  *
35
  * @var array
36
  */
37
+ protected $excludedProperties = array();
38
 
39
  /**
40
  * Types of complex properties
41
  *
42
  * @var array
43
  */
44
+ protected $propertyComplexTypes = array();
45
 
46
  /**
47
  * Properties get and set methods
51
  $action = substr($name, 0, 3);
52
  switch ($action) {
53
  case 'get':
54
+ $property = lcfirst(substr($name, 3));
55
+ if (property_exists($this, $property)) {
56
  return $this->{$property};
57
  } else {
58
+ $this->throwWrongMethodErrorException($name);
59
  }
60
  break;
61
  case 'set':
62
+ $property = lcfirst(substr($name, 3));
63
+ if (property_exists($this, $property)) {
64
  $this->{$property} = $arguments[0];
65
  } else {
66
+ $this->throwWrongMethodErrorException($name);
67
  }
68
  break;
69
  default :
70
+ $this->throwWrongMethodErrorException($name);
71
  }
72
  }
73
 
75
  * Throw Wrong Method Error Exception
76
  *
77
  * @param string $methodName
78
+ * @throws \OnePica\AvaTax16\Exception
79
  */
80
+ protected function throwWrongMethodErrorException($methodName)
81
  {
82
  $trace = debug_backtrace();
83
  $errorMessage = 'Undefined method '
86
  . $trace[0]['file']
87
  . ' on line '
88
  . $trace[0]['line'];
89
+ throw new \OnePica\AvaTax16\Exception($errorMessage);
90
  }
91
 
92
  /**
97
  public function isValid()
98
  {
99
  foreach ($this as $key => $value) {
100
+ if (in_array($key, $this->requiredProperties) && (null === $value)) {
101
  return false;
102
  }
103
  }
108
  * Convert object data to array
109
  *
110
  * @return array
111
+ * @throws \OnePica\AvaTax16\Exception
112
  */
113
  public function toArray()
114
  {
115
  if (!$this->isValid()) {
116
+ throw new \OnePica\AvaTax16\Exception("Not valid data in " . get_class($this));
117
  }
118
  $result = array();
119
  foreach ($this as $key => $value) {
120
+ if (in_array($key, $this->excludedProperties)
121
+ || in_array($key, array('requiredProperties', 'excludedProperties', 'propertyComplexTypes'))
122
  || (null === $value)) {
123
  // skip property
124
  continue;
125
  }
126
+ $name = $key;
127
+ $result[$name] = $this->proceedToArrayItem($value);
128
  }
129
  return $result;
130
  }
132
  /**
133
  * Convert object data to array
134
  *
135
+ * @param \OnePica\AvaTax16\Document\Part|array|string $item
136
  * @return array|string
137
  */
138
+ protected function proceedToArrayItem($item)
139
  {
140
  $result = null;
141
+ $itemType = ($item instanceof Part) ? 'documentPart' :
142
  ((is_array($item)) ? 'array' : 'simple');
143
 
144
  switch ($itemType) {
147
  break;
148
  case 'array':
149
  foreach ($item as $key => $value) {
150
+ $result[$key] = $this->proceedToArrayItem($value);
151
  }
152
  break;
153
  case 'simple':
161
  /**
162
  * Fill data from object
163
  *
164
+ * @param \StdClass|array $data
165
  * @return $this
166
  */
167
  public function fillData($data)
168
  {
169
  foreach ($data as $key => $value) {
170
+ $propName = $key;
171
  $method = 'set' . ucfirst($key);
172
+ if (!property_exists($this, $propName)) {
173
  // skip unknown property received from response to prevent error
174
  continue;
175
  }
176
+ if (isset($this->propertyComplexTypes[$propName])) {
177
+ $propertyType = $this->propertyComplexTypes[$propName]['type'];
178
+ if (isset($this->propertyComplexTypes[$propName]['isArrayOf'])) {
179
+ $items = array();
180
  if (count($value) > 0) {
181
  foreach ($value as $itemKey => $itemData) {
182
+ $item = $this->createItemAndFillData($propertyType, $itemData);
183
  $items[$itemKey] = $item;
184
  }
185
  }
186
  $this->$method($items);
187
  } else {
188
+ $item = $value ? $this->createItemAndFillData($propertyType, $value) : null;
189
  $this->$method($item);
190
  }
191
  } else {
199
  * Create item object and fill data in it
200
  *
201
  * @param string $itemClassName
202
+ * @param \StdClass|array $data
203
  * @return object $item
204
  */
205
+ protected function createItemAndFillData($itemClassName, $data)
206
  {
207
  $item = new $itemClassName();
208
  $item->fillData($data);
lib/OnePica/AvaTax16/Document/Part/Feedback.php CHANGED
@@ -11,20 +11,26 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Part_Feedback
 
 
 
21
  */
22
- class OnePica_AvaTax16_Document_Part_Feedback extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Latency Data
26
  *
27
- * @var OnePica_AvaTax16_Document_Part_Feedback_LatencyData
28
  */
29
- protected $_latencyData;
30
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document\Part;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Document\Part\Feedback
24
+ *
25
+ * @method \OnePica\AvaTax16\Document\Part\Feedback\LatencyData getLatencyData()
26
+ * @method setLatencyData(\OnePica\AvaTax16\Document\Part\Feedback\LatencyData $value)
27
  */
28
+ class Feedback extends Part
29
  {
30
  /**
31
  * Latency Data
32
  *
33
+ * @var \OnePica\AvaTax16\Document\Part\Feedback\LatencyData
34
  */
35
+ protected $latencyData;
36
  }
lib/OnePica/AvaTax16/Document/Part/Feedback/LatencyData.php CHANGED
@@ -11,27 +11,35 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Part_Feedback_LatencyData
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Document_Part_Feedback_LatencyData extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Latency
26
  *
27
  * @var int
28
  */
29
- protected $_latency;
30
 
31
  /**
32
  * Version Id
33
  *
34
  * @var string
35
  */
36
- protected $_versionId;
37
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document\Part\Feedback;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Document\Part\Feedback\LatencyData
24
+ *
25
+ * @method int getLatency()
26
+ * @method setLatency(int $value)
27
+ * @method string getVersionId()
28
+ * @method setVersionId(string $value)
29
  */
30
+ class LatencyData extends Part
31
  {
32
  /**
33
  * Latency
34
  *
35
  * @var int
36
  */
37
+ protected $latency;
38
 
39
  /**
40
  * Version Id
41
  *
42
  * @var string
43
  */
44
+ protected $versionId;
45
  }
lib/OnePica/AvaTax16/Document/Part/Location.php CHANGED
@@ -11,30 +11,48 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Part_Location
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Document_Part_Location extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Types of complex properties
26
  *
27
  * @var array
28
  */
29
- protected $_propertyComplexTypes = array(
30
- '_address' => array(
31
- 'type' => 'OnePica_AvaTax16_Document_Part_Location_Address'
32
  ),
33
- '_latlong' => array(
34
- 'type' => 'OnePica_AvaTax16_Document_Part_Location_LatLong'
35
  ),
36
- '_feedback' => array(
37
- 'type' => 'OnePica_AvaTax16_Document_Part_Feedback'
38
  ),
39
  );
40
 
@@ -44,20 +62,20 @@ class OnePica_AvaTax16_Document_Part_Location extends OnePica_AvaTax16_Document_
44
  *
45
  * @var string
46
  */
47
- protected $_taxLocationPurpose;
48
  /**
49
  * Address
50
  *
51
- * @var OnePica_AvaTax16_Document_Part_Location_Address
52
  */
53
- protected $_address;
54
 
55
  /**
56
  * Latitude and longitude
57
  *
58
- * @var OnePica_AvaTax16_Document_Part_Location_LatLong
59
  */
60
- protected $_latlong;
61
 
62
  /**
63
  * Location code
@@ -65,7 +83,7 @@ class OnePica_AvaTax16_Document_Part_Location extends OnePica_AvaTax16_Document_
65
  *
66
  * @var string
67
  */
68
- protected $_locationCode;
69
 
70
  /**
71
  * Ip Address
@@ -73,14 +91,14 @@ class OnePica_AvaTax16_Document_Part_Location extends OnePica_AvaTax16_Document_
73
  *
74
  * @var string
75
  */
76
- protected $_ipAddress;
77
 
78
  /**
79
  * Resolution Quality
80
  *
81
  * @var string
82
  */
83
- protected $_resolutionQuality;
84
 
85
  /**
86
  * Address Tax Payer Code
@@ -88,41 +106,41 @@ class OnePica_AvaTax16_Document_Part_Location extends OnePica_AvaTax16_Document_
88
  *
89
  * @var string
90
  */
91
- protected $_addressTaxPayerCode;
92
 
93
  /**
94
  * Address Buyer Type
95
  *
96
  * @var string
97
  */
98
- protected $_addressBuyerType;
99
 
100
  /**
101
  * Address Use Type
102
  *
103
  * @var string
104
  */
105
- protected $_addressUseType;
106
 
107
  /**
108
  * Set Address
109
  *
110
- * @param OnePica_AvaTax16_Document_Part_Location_Address $value
111
  * @return $this
112
  */
113
  public function setAddress($value)
114
  {
115
- $this->_address = $value;
116
  return $this;
117
  }
118
 
119
  /**
120
  * Get Address
121
  *
122
- * @return OnePica_AvaTax16_Document_Part_Location_Address
123
  */
124
  public function getAddress()
125
  {
126
- return $this->_address;
127
  }
128
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document\Part;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Document\Part\Location
24
+ *
25
+ * @method string getTaxLocationPurpose()
26
+ * @method setTaxLocationPurpose(string $value)
27
+ * @method \OnePica\AvaTax16\Document\Part\Location\LatLong getLatlong()
28
+ * @method setLatlong(\OnePica\AvaTax16\Document\Part\Location\LatLong $value)
29
+ * @method string getLocationCode()
30
+ * @method setLocationCode(string $value)
31
+ * @method string getIpAddress()
32
+ * @method setIpAddress(string $value)
33
+ * @method string getResolutionQuality()
34
+ * @method setResolutionQuality(string $value)
35
+ * @method string getAddressTaxPayerCode()
36
+ * @method setAddressTaxPayerCode(string $value)
37
+ * @method string getAddressBuyerType()
38
+ * @method setAddressBuyerType(string $value)
39
  */
40
+ class Location extends Part
41
  {
42
  /**
43
  * Types of complex properties
44
  *
45
  * @var array
46
  */
47
+ protected $propertyComplexTypes = array(
48
+ 'address' => array(
49
+ 'type' => '\OnePica\AvaTax16\Document\Part\Location\Address'
50
  ),
51
+ 'latlong' => array(
52
+ 'type' => '\OnePica\AvaTax16\Document\Part\Location\LatLong'
53
  ),
54
+ 'feedback' => array(
55
+ 'type' => '\OnePica\AvaTax16\Document\Part\Feedback'
56
  ),
57
  );
58
 
62
  *
63
  * @var string
64
  */
65
+ protected $taxLocationPurpose;
66
  /**
67
  * Address
68
  *
69
+ * @var \OnePica\AvaTax16\Document\Part\Location\Address
70
  */
71
+ protected $address;
72
 
73
  /**
74
  * Latitude and longitude
75
  *
76
+ * @var \OnePica\AvaTax16\Document\Part\Location\LatLong
77
  */
78
+ protected $latlong;
79
 
80
  /**
81
  * Location code
83
  *
84
  * @var string
85
  */
86
+ protected $locationCode;
87
 
88
  /**
89
  * Ip Address
91
  *
92
  * @var string
93
  */
94
+ protected $ipAddress;
95
 
96
  /**
97
  * Resolution Quality
98
  *
99
  * @var string
100
  */
101
+ protected $resolutionQuality;
102
 
103
  /**
104
  * Address Tax Payer Code
106
  *
107
  * @var string
108
  */
109
+ protected $addressTaxPayerCode;
110
 
111
  /**
112
  * Address Buyer Type
113
  *
114
  * @var string
115
  */
116
+ protected $addressBuyerType;
117
 
118
  /**
119
  * Address Use Type
120
  *
121
  * @var string
122
  */
123
+ protected $addressUseType;
124
 
125
  /**
126
  * Set Address
127
  *
128
+ * @param \OnePica\AvaTax16\Document\Part\Location\Address $value
129
  * @return $this
130
  */
131
  public function setAddress($value)
132
  {
133
+ $this->address = $value;
134
  return $this;
135
  }
136
 
137
  /**
138
  * Get Address
139
  *
140
+ * @return \OnePica\AvaTax16\Document\Part\Location\Address
141
  */
142
  public function getAddress()
143
  {
144
+ return $this->address;
145
  }
146
  }
lib/OnePica/AvaTax16/Document/Part/Location/Address.php CHANGED
@@ -11,22 +11,52 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Part_Location_Address
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Document_Part_Location_Address extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Required properties
26
  *
27
  * @var array
28
  */
29
- protected $_requiredProperties = array('_line1');
30
 
31
  /**
32
  * Line 1
@@ -34,21 +64,21 @@ class OnePica_AvaTax16_Document_Part_Location_Address extends OnePica_AvaTax16_D
34
  *
35
  * @var string
36
  */
37
- protected $_line1;
38
 
39
  /**
40
  * Line 2
41
  *
42
  * @var string
43
  */
44
- protected $_line2;
45
 
46
  /**
47
  * Line3
48
  *
49
  * @var string
50
  */
51
- protected $_line3;
52
 
53
  /**
54
  * City
@@ -56,7 +86,7 @@ class OnePica_AvaTax16_Document_Part_Location_Address extends OnePica_AvaTax16_D
56
  *
57
  * @var string
58
  */
59
- protected $_city;
60
 
61
  /**
62
  * Municipality
@@ -64,7 +94,7 @@ class OnePica_AvaTax16_Document_Part_Location_Address extends OnePica_AvaTax16_D
64
  *
65
  * @var string
66
  */
67
- protected $_municipality;
68
 
69
  /**
70
  * Town
@@ -72,7 +102,7 @@ class OnePica_AvaTax16_Document_Part_Location_Address extends OnePica_AvaTax16_D
72
  *
73
  * @var string
74
  */
75
- protected $_town;
76
 
77
  /**
78
  * State
@@ -80,7 +110,7 @@ class OnePica_AvaTax16_Document_Part_Location_Address extends OnePica_AvaTax16_D
80
  *
81
  * @var string
82
  */
83
- protected $_state;
84
 
85
  /**
86
  * Province
@@ -88,14 +118,14 @@ class OnePica_AvaTax16_Document_Part_Location_Address extends OnePica_AvaTax16_D
88
  *
89
  * @var string
90
  */
91
- protected $_province;
92
 
93
  /**
94
  * Country
95
  *
96
  * @var string
97
  */
98
- protected $_country;
99
 
100
  /**
101
  * Zip Code
@@ -103,7 +133,7 @@ class OnePica_AvaTax16_Document_Part_Location_Address extends OnePica_AvaTax16_D
103
  *
104
  * @var string
105
  */
106
- protected $_zipcode;
107
 
108
  /**
109
  * Postal Code
@@ -111,7 +141,7 @@ class OnePica_AvaTax16_Document_Part_Location_Address extends OnePica_AvaTax16_D
111
  *
112
  * @var string
113
  */
114
- protected $_postalCode;
115
 
116
  /**
117
  * Post Code
@@ -119,5 +149,5 @@ class OnePica_AvaTax16_Document_Part_Location_Address extends OnePica_AvaTax16_D
119
  *
120
  * @var string
121
  */
122
- protected $_postcode;
123
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document\Part\Location;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Document\Part\Location\Address
24
+ *
25
+ * @method string getLine1()
26
+ * @method setLine1(string $value)
27
+ * @method string getLine2()
28
+ * @method setLine2(string $value)
29
+ * @method string getLine3()
30
+ * @method setLine3(string $value)
31
+ * @method string getLatitude()
32
+ * @method setLatitude(string $value)
33
+ * @method string getCity()
34
+ * @method setCity(string $value)
35
+ * @method string getMunicipality()
36
+ * @method setMunicipality(string $value)
37
+ * @method string getTown()
38
+ * @method setTown(string $value)
39
+ * @method string getState()
40
+ * @method setState(string $value)
41
+ * @method string getProvince()
42
+ * @method setProvince(string $value)
43
+ * @method string getCountry()
44
+ * @method setCountry(string $value)
45
+ * @method string getZipcode()
46
+ * @method setZipcode(string $value)
47
+ * @method string getPostalCode()
48
+ * @method setPostalCode(string $value)
49
+ * @method string getPostcode()
50
+ * @method setPostcode(string $value)
51
  */
52
+ class Address extends Part
53
  {
54
  /**
55
  * Required properties
56
  *
57
  * @var array
58
  */
59
+ protected $requiredProperties = array('line1');
60
 
61
  /**
62
  * Line 1
64
  *
65
  * @var string
66
  */
67
+ protected $line1;
68
 
69
  /**
70
  * Line 2
71
  *
72
  * @var string
73
  */
74
+ protected $line2;
75
 
76
  /**
77
  * Line3
78
  *
79
  * @var string
80
  */
81
+ protected $line3;
82
 
83
  /**
84
  * City
86
  *
87
  * @var string
88
  */
89
+ protected $city;
90
 
91
  /**
92
  * Municipality
94
  *
95
  * @var string
96
  */
97
+ protected $municipality;
98
 
99
  /**
100
  * Town
102
  *
103
  * @var string
104
  */
105
+ protected $town;
106
 
107
  /**
108
  * State
110
  *
111
  * @var string
112
  */
113
+ protected $state;
114
 
115
  /**
116
  * Province
118
  *
119
  * @var string
120
  */
121
+ protected $province;
122
 
123
  /**
124
  * Country
125
  *
126
  * @var string
127
  */
128
+ protected $country;
129
 
130
  /**
131
  * Zip Code
133
  *
134
  * @var string
135
  */
136
+ protected $zipcode;
137
 
138
  /**
139
  * Postal Code
141
  *
142
  * @var string
143
  */
144
+ protected $postalCode;
145
 
146
  /**
147
  * Post Code
149
  *
150
  * @var string
151
  */
152
+ protected $postcode;
153
  }
lib/OnePica/AvaTax16/Document/Part/Location/LatLong.php CHANGED
@@ -11,27 +11,35 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Part_Location_LatLong
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Document_Part_Location_LatLong extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Latitude
26
  *
27
  * @var string
28
  */
29
- protected $_latitude;
30
 
31
  /**
32
  * Longitude
33
  *
34
  * @var string
35
  */
36
- protected $_longitude;
37
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document\Part\Location;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Document\Part\Location\LatLong
24
+ *
25
+ * @method string getLatitude()
26
+ * @method setLatitude(string $value)
27
+ * @method string getLongitude)
28
+ * @method setLongitude(string $value)
29
  */
30
+ class LatLong extends Part
31
  {
32
  /**
33
  * Latitude
34
  *
35
  * @var string
36
  */
37
+ protected $latitude;
38
 
39
  /**
40
  * Longitude
41
  *
42
  * @var string
43
  */
44
+ protected $longitude;
45
  }
lib/OnePica/AvaTax16/Document/Request.php CHANGED
@@ -11,66 +11,78 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Request
 
 
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Document_Request extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Has error
26
  *
27
  * @var bool
28
  */
29
- protected $_hasError = false;
30
 
31
  /**
32
  * Errors
33
  *
34
  * @var array
35
  */
36
- protected $_errors;
37
 
38
  /**
39
  * Types of complex properties
40
  *
41
  * @var array
42
  */
43
- protected $_propertyComplexTypes = array(
44
- '_header' => array(
45
- 'type' => 'OnePica_AvaTax16_Document_Request_Header'
46
  ),
47
- '_lines' => array(
48
- 'type' => 'OnePica_AvaTax16_Document_Request_Line',
49
  'isArrayOf' => 'true'
50
  ),
51
- '_feedback' => array(
52
- 'type' => 'OnePica_AvaTax16_Document_Part_Feedback'
53
  ),
54
  );
55
 
56
  /**
57
  * Header
58
  *
59
- * @var OnePica_AvaTax16_Document_Request_Header
60
  */
61
- protected $_header;
62
 
63
  /**
64
  * Lines
65
  *
66
- * @var OnePica_AvaTax16_Document_Request_Line[]
67
  */
68
- protected $_lines;
69
 
70
  /**
71
  * Feedback
72
  *
73
- * @var OnePica_AvaTax16_Document_Part_Feedback
74
  */
75
- protected $_feedback;
76
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document;
19
 
20
  /**
21
+ * Class OnePica\AvaTax16\Document\Request
22
+ *
23
+ * @method bool getHasError()
24
+ * @method setHasError(bool $value)
25
+ * @method array getErrors()
26
+ * @method setErrors(array $value)
27
+ * @method \OnePica\AvaTax16\Document\Request\Header getHeader()
28
+ * @method setHeader(\OnePica\AvaTax16\Document\Request\Header $value)
29
+ * @method array getLines()
30
+ * @method setLines(array $value)
31
+ * @method \OnePica\AvaTax16\Document\Part\Feedback getFeedback()
32
+ * @method setFeedback(\OnePica\AvaTax16\Document\Part\Feedback $value)
33
  */
34
+ class Request extends Part
35
  {
36
  /**
37
  * Has error
38
  *
39
  * @var bool
40
  */
41
+ protected $hasError = false;
42
 
43
  /**
44
  * Errors
45
  *
46
  * @var array
47
  */
48
+ protected $errors = array();
49
 
50
  /**
51
  * Types of complex properties
52
  *
53
  * @var array
54
  */
55
+ protected $propertyComplexTypes = array(
56
+ 'header' => array(
57
+ 'type' => '\OnePica\AvaTax16\Document\Request\Header'
58
  ),
59
+ 'lines' => array(
60
+ 'type' => '\OnePica\AvaTax16\Document\Request\Line',
61
  'isArrayOf' => 'true'
62
  ),
63
+ 'feedback' => array(
64
+ 'type' => '\OnePica\AvaTax16\Document\Part\Feedback'
65
  ),
66
  );
67
 
68
  /**
69
  * Header
70
  *
71
+ * @var \OnePica\AvaTax16\Document\Request\Header
72
  */
73
+ protected $header;
74
 
75
  /**
76
  * Lines
77
  *
78
+ * @var \OnePica\AvaTax16\Document\Request\Line[]
79
  */
80
+ protected $lines;
81
 
82
  /**
83
  * Feedback
84
  *
85
+ * @var \OnePica\AvaTax16\Document\Part\Feedback
86
  */
87
+ protected $feedback;
88
  }
lib/OnePica/AvaTax16/Document/Request/Header.php CHANGED
@@ -11,24 +11,63 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Request_Header
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Document_Request_Header extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Types of complex properties
26
  *
27
  * @var array
28
  */
29
- protected $_propertyComplexTypes = array(
30
- '_defaultLocations' => array(
31
- 'type' => 'OnePica_AvaTax16_Document_Part_Location',
32
  'isArrayOf' => 'true'
33
  ),
34
  );
@@ -38,8 +77,8 @@ class OnePica_AvaTax16_Document_Request_Header extends OnePica_AvaTax16_Document
38
  *
39
  * @var array
40
  */
41
- protected $_requiredProperties = array('_accountId', '_companyCode', '_transactionType', '_documentCode',
42
- '_customerCode', '_transactionDate', '_defaultLocations');
43
 
44
  /**
45
  * Account Id
@@ -47,7 +86,7 @@ class OnePica_AvaTax16_Document_Request_Header extends OnePica_AvaTax16_Document
47
  *
48
  * @var string
49
  */
50
- protected $_accountId;
51
 
52
  /**
53
  * Company Code
@@ -55,7 +94,7 @@ class OnePica_AvaTax16_Document_Request_Header extends OnePica_AvaTax16_Document
55
  *
56
  * @var string
57
  */
58
- protected $_companyCode;
59
 
60
  /**
61
  * Transaction Type
@@ -63,7 +102,7 @@ class OnePica_AvaTax16_Document_Request_Header extends OnePica_AvaTax16_Document
63
  *
64
  * @var string
65
  */
66
- protected $_transactionType;
67
 
68
  /**
69
  * Document Code
@@ -71,7 +110,7 @@ class OnePica_AvaTax16_Document_Request_Header extends OnePica_AvaTax16_Document
71
  *
72
  * @var string
73
  */
74
- protected $_documentCode;
75
 
76
  /**
77
  * Customer Code
@@ -79,7 +118,7 @@ class OnePica_AvaTax16_Document_Request_Header extends OnePica_AvaTax16_Document
79
  *
80
  * @var string
81
  */
82
- protected $_customerCode;
83
 
84
  /**
85
  * Vendor Code
@@ -87,7 +126,7 @@ class OnePica_AvaTax16_Document_Request_Header extends OnePica_AvaTax16_Document
87
  *
88
  * @var string
89
  */
90
- protected $_vendorCode;
91
 
92
  /**
93
  * Transaction Date
@@ -95,7 +134,7 @@ class OnePica_AvaTax16_Document_Request_Header extends OnePica_AvaTax16_Document
95
  *
96
  * @var string
97
  */
98
- protected $_transactionDate;
99
 
100
  /**
101
  * Currency
@@ -103,7 +142,7 @@ class OnePica_AvaTax16_Document_Request_Header extends OnePica_AvaTax16_Document
103
  *
104
  * @var string
105
  */
106
- protected $_currency;
107
 
108
  /**
109
  * Total Tax Override Amount
@@ -111,14 +150,14 @@ class OnePica_AvaTax16_Document_Request_Header extends OnePica_AvaTax16_Document
111
  *
112
  * @var float
113
  */
114
- protected $_totalTaxOverrideAmount;
115
 
116
  /**
117
  * Tax Calculation Date
118
  *
119
  * @var string
120
  */
121
- protected $_taxCalculationDate;
122
 
123
  /**
124
  * Default Avalara Goods And Services Type
@@ -126,7 +165,7 @@ class OnePica_AvaTax16_Document_Request_Header extends OnePica_AvaTax16_Document
126
  *
127
  * @var string
128
  */
129
- protected $_defaultAvalaraGoodsAndServicesType;
130
 
131
  /**
132
  * Default Avalara Goods And Services Modifier Type
@@ -134,15 +173,15 @@ class OnePica_AvaTax16_Document_Request_Header extends OnePica_AvaTax16_Document
134
  *
135
  * @var string
136
  */
137
- protected $_defaultAvalaraGoodsAndServicesModifierType;
138
 
139
  /**
140
  * Default locations
141
  * (Required)
142
  *
143
- * @var OnePica_AvaTax16_Document_Part_Location[]
144
  */
145
- protected $_defaultLocations;
146
 
147
  /**
148
  * Default Tax Payer Code
@@ -150,50 +189,50 @@ class OnePica_AvaTax16_Document_Request_Header extends OnePica_AvaTax16_Document
150
  *
151
  * @var string
152
  */
153
- protected $_defaultTaxPayerCode;
154
 
155
  /**
156
  * Default Buyer Type
157
  *
158
  * @var string
159
  */
160
- protected $_defaultBuyerType;
161
 
162
  /**
163
  * Default Use Type
164
  *
165
  * @var string
166
  */
167
- protected $_defaultUseType;
168
 
169
  /**
170
  * Purchase Order Number
171
  *
172
  * @var string
173
  */
174
- protected $_purchaseOrderNumber;
175
 
176
  /**
177
  * Metadata
178
  *
179
  * @var array
180
  */
181
- protected $_metadata;
182
 
183
  /**
184
  * Set Metadata
185
  *
186
- * @param array|StdClass $value
187
  * @return $this
188
  */
189
  public function setMetadata($value)
190
  {
191
- if ($value instanceof StdClass) {
192
  // convert object data to array
193
  // it is used during filling data from response
194
- $this->_metadata = (array) $value;
195
  } else {
196
- $this->_metadata = $value;
197
  }
198
  }
199
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document\Request;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Document\Request\Header
24
+ *
25
+ * @method string getAccountId()
26
+ * @method setAccountId(string $value)
27
+ * @method string getCompanyCode()
28
+ * @method setCompanyCode(string $value)
29
+ * @method string getTransactionType()
30
+ * @method setTransactionType(string $value)
31
+ * @method string getDocumentCode()
32
+ * @method setDocumentCode(string $value)
33
+ * @method string getCustomerCode()
34
+ * @method setCustomerCode(string $value)
35
+ * @method string getVendorCode()
36
+ * @method setVendorCode(string $value)
37
+ * @method string getTransactionDate()
38
+ * @method setTransactionDate(string $value)
39
+ * @method string getCurrency()
40
+ * @method setCurrency(string $value)
41
+ * @method float getTotalTaxOverrideAmount()
42
+ * @method setTotalTaxOverrideAmount(float $value)
43
+ * @method string getTaxCalculationDate()
44
+ * @method setTaxCalculationDate(string $value)
45
+ * @method string getDefaultAvalaraGoodsAndServicesType()
46
+ * @method setDefaultAvalaraGoodsAndServicesType(string $value)
47
+ * @method string getDefaultAvalaraGoodsAndServicesModifierType()
48
+ * @method setDefaultAvalaraGoodsAndServicesModifierType(string $value)
49
+ * @method array getDefaultLocations()
50
+ * @method setDefaultLocations(array $value)
51
+ * @method string getDefaultTaxPayerCode()
52
+ * @method setDefaultTaxPayerCode(string $value)
53
+ * @method string getDefaultBuyerType()
54
+ * @method setDefaultBuyerType(string $value)
55
+ * @method string getDefaultUseType()
56
+ * @method setDefaultUseType(string $value)
57
+ * @method string getPurchaseOrderNumber()
58
+ * @method setPurchaseOrderNumber(string $value)
59
+ * @method array getMetadata()
60
  */
61
+ class Header extends Part
62
  {
63
  /**
64
  * Types of complex properties
65
  *
66
  * @var array
67
  */
68
+ protected $propertyComplexTypes = array(
69
+ 'defaultLocations' => array(
70
+ 'type' => '\OnePica\AvaTax16\Document\Part\Location',
71
  'isArrayOf' => 'true'
72
  ),
73
  );
77
  *
78
  * @var array
79
  */
80
+ protected $requiredProperties = array('accountId', 'companyCode', 'transactionType', 'documentCode',
81
+ 'customerCode', 'transactionDate', 'defaultLocations');
82
 
83
  /**
84
  * Account Id
86
  *
87
  * @var string
88
  */
89
+ protected $accountId;
90
 
91
  /**
92
  * Company Code
94
  *
95
  * @var string
96
  */
97
+ protected $companyCode;
98
 
99
  /**
100
  * Transaction Type
102
  *
103
  * @var string
104
  */
105
+ protected $transactionType;
106
 
107
  /**
108
  * Document Code
110
  *
111
  * @var string
112
  */
113
+ protected $documentCode;
114
 
115
  /**
116
  * Customer Code
118
  *
119
  * @var string
120
  */
121
+ protected $customerCode;
122
 
123
  /**
124
  * Vendor Code
126
  *
127
  * @var string
128
  */
129
+ protected $vendorCode;
130
 
131
  /**
132
  * Transaction Date
134
  *
135
  * @var string
136
  */
137
+ protected $transactionDate;
138
 
139
  /**
140
  * Currency
142
  *
143
  * @var string
144
  */
145
+ protected $currency;
146
 
147
  /**
148
  * Total Tax Override Amount
150
  *
151
  * @var float
152
  */
153
+ protected $totalTaxOverrideAmount;
154
 
155
  /**
156
  * Tax Calculation Date
157
  *
158
  * @var string
159
  */
160
+ protected $taxCalculationDate;
161
 
162
  /**
163
  * Default Avalara Goods And Services Type
165
  *
166
  * @var string
167
  */
168
+ protected $defaultAvalaraGoodsAndServicesType;
169
 
170
  /**
171
  * Default Avalara Goods And Services Modifier Type
173
  *
174
  * @var string
175
  */
176
+ protected $defaultAvalaraGoodsAndServicesModifierType;
177
 
178
  /**
179
  * Default locations
180
  * (Required)
181
  *
182
+ * @var \OnePica\AvaTax16\Document\Part\Location[]
183
  */
184
+ protected $defaultLocations;
185
 
186
  /**
187
  * Default Tax Payer Code
189
  *
190
  * @var string
191
  */
192
+ protected $defaultTaxPayerCode;
193
 
194
  /**
195
  * Default Buyer Type
196
  *
197
  * @var string
198
  */
199
+ protected $defaultBuyerType;
200
 
201
  /**
202
  * Default Use Type
203
  *
204
  * @var string
205
  */
206
+ protected $defaultUseType;
207
 
208
  /**
209
  * Purchase Order Number
210
  *
211
  * @var string
212
  */
213
+ protected $purchaseOrderNumber;
214
 
215
  /**
216
  * Metadata
217
  *
218
  * @var array
219
  */
220
+ protected $metadata;
221
 
222
  /**
223
  * Set Metadata
224
  *
225
+ * @param array|\StdClass $value
226
  * @return $this
227
  */
228
  public function setMetadata($value)
229
  {
230
+ if ($value instanceof \StdClass) {
231
  // convert object data to array
232
  // it is used during filling data from response
233
+ $this->metadata = (array) $value;
234
  } else {
235
+ $this->metadata = $value;
236
  }
237
  }
238
  }
lib/OnePica/AvaTax16/Document/Request/Line.php CHANGED
@@ -11,31 +11,66 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Request_Line
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Document_Request_Line extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Required properties
26
  *
27
  * @var array
28
  */
29
- protected $_requiredProperties = array('_lineCode', '_lineAmount');
30
 
31
  /**
32
  * Types of complex properties
33
  *
34
  * @var array
35
  */
36
- protected $_propertyComplexTypes = array(
37
- '_locations' => array(
38
- 'type' => 'OnePica_AvaTax16_Document_Part_Location',
39
  'isArrayOf' => 'true'
40
  ),
41
  );
@@ -46,35 +81,35 @@ class OnePica_AvaTax16_Document_Request_Line extends OnePica_AvaTax16_Document_P
46
  *
47
  * @var string
48
  */
49
- protected $_lineCode;
50
 
51
  /**
52
  * Item code
53
  *
54
  * @var string
55
  */
56
- protected $_itemCode;
57
 
58
  /**
59
  * Avalara Goods And Services Type
60
  *
61
  * @var string
62
  */
63
- protected $_avalaraGoodsAndServicesType;
64
 
65
  /**
66
  * Avalara Goods And Services Modifier Type
67
  *
68
  * @var string
69
  */
70
- protected $_avalaraGoodsAndServicesModifierType;
71
 
72
  /**
73
  * Number Of Items
74
  *
75
  * @var float
76
  */
77
- protected $_numberOfItems;
78
 
79
  /**
80
  * Line Amount (The total cost of this line. In its simplest form lineAmount = unit price * numberOfItems)
@@ -82,21 +117,21 @@ class OnePica_AvaTax16_Document_Request_Line extends OnePica_AvaTax16_Document_P
82
  *
83
  * @var float
84
  */
85
- protected $_lineAmount;
86
 
87
  /**
88
  * Discounted
89
  *
90
  * @var bool
91
  */
92
- protected $_discounted;
93
 
94
  /**
95
  * Item Description
96
  *
97
  * @var string
98
  */
99
- protected $_itemDescription;
100
 
101
  /**
102
  * Unit Of Measure
@@ -104,14 +139,14 @@ class OnePica_AvaTax16_Document_Request_Line extends OnePica_AvaTax16_Document_P
104
  *
105
  * @var string
106
  */
107
- protected $_unitOfMeasure;
108
 
109
  /**
110
  * Locations
111
  *
112
- * @var OnePica_AvaTax16_Document_Part_Location[]
113
  */
114
- protected $_locations;
115
 
116
  /**
117
  * Tax Payer Code
@@ -119,21 +154,21 @@ class OnePica_AvaTax16_Document_Request_Line extends OnePica_AvaTax16_Document_P
119
  *
120
  * @var string
121
  */
122
- protected $_taxPayerCode;
123
 
124
  /**
125
  * Buyer Type
126
  *
127
  * @var string
128
  */
129
- protected $_buyerType;
130
 
131
  /**
132
  * Use Type
133
  *
134
  * @var string
135
  */
136
- protected $_useType;
137
 
138
  /**
139
  * Tax Override Amount
@@ -141,7 +176,7 @@ class OnePica_AvaTax16_Document_Request_Line extends OnePica_AvaTax16_Document_P
141
  *
142
  * @var float
143
  */
144
- protected $_taxOverrideAmount;
145
 
146
  /**
147
  * Tax Included
@@ -149,29 +184,29 @@ class OnePica_AvaTax16_Document_Request_Line extends OnePica_AvaTax16_Document_P
149
  *
150
  * @var bool
151
  */
152
- protected $_taxIncluded;
153
 
154
  /**
155
  * Tax Included
156
  *
157
  * @var array
158
  */
159
- protected $_metadata;
160
 
161
  /**
162
  * Set Metadata
163
  *
164
- * @param array|StdClass $value
165
  * @return $this
166
  */
167
  public function setMetadata($value)
168
  {
169
- if ($value instanceof StdClass) {
170
  // convert object data to array
171
  // it is used during filling data from response
172
- $this->_metadata = (array) $value;
173
  } else {
174
- $this->_metadata = $value;
175
  }
176
  }
177
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document\Request;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Document\Request\Line
24
+ *
25
+ * @method string getLineCode()
26
+ * @method setLineCode(string $value)
27
+ * @method string getItemCode()
28
+ * @method setItemCode(string $value)
29
+ * @method string getAvalaraGoodsAndServicesType()
30
+ * @method setAvalaraGoodsAndServicesType(string $value)
31
+ * @method string getAvalaraGoodsAndServicesModifierType()
32
+ * @method setAvalaraGoodsAndServicesModifierType(string $value)
33
+ * @method float getNumberOfItems()
34
+ * @method setNumberOfItems(float $value)
35
+ * @method float getLineAmount()
36
+ * @method setLineAmount(float $value)
37
+ * @method bool getDiscounted()
38
+ * @method setDiscounted(bool $value)
39
+ * @method string getItemDescription()
40
+ * @method setItemDescription(string $value)
41
+ * @method string getUnitOfMeasure()
42
+ * @method setUnitOfMeasure(string $value)
43
+ * @method array getLocations()
44
+ * @method setLocations(array $value)
45
+ * @method string getTaxPayerCode()
46
+ * @method setTaxPayerCode(string $value)
47
+ * @method string getBuyerType()
48
+ * @method setBuyerType(string $value)
49
+ * @method string getUseType()
50
+ * @method setUseType(string $value)
51
+ * @method float getTaxOverrideAmount()
52
+ * @method setTaxOverrideAmount(float $value)
53
+ * @method bool getTaxIncluded()
54
+ * @method setTaxIncluded(bool $value)
55
+ * @method array getMetadata()
56
  */
57
+ class Line extends Part
58
  {
59
  /**
60
  * Required properties
61
  *
62
  * @var array
63
  */
64
+ protected $requiredProperties = array('lineCode', 'lineAmount');
65
 
66
  /**
67
  * Types of complex properties
68
  *
69
  * @var array
70
  */
71
+ protected $propertyComplexTypes = array(
72
+ 'locations' => array(
73
+ 'type' => '\OnePica\AvaTax16\Document\Part\Location',
74
  'isArrayOf' => 'true'
75
  ),
76
  );
81
  *
82
  * @var string
83
  */
84
+ protected $lineCode;
85
 
86
  /**
87
  * Item code
88
  *
89
  * @var string
90
  */
91
+ protected $itemCode;
92
 
93
  /**
94
  * Avalara Goods And Services Type
95
  *
96
  * @var string
97
  */
98
+ protected $avalaraGoodsAndServicesType;
99
 
100
  /**
101
  * Avalara Goods And Services Modifier Type
102
  *
103
  * @var string
104
  */
105
+ protected $avalaraGoodsAndServicesModifierType;
106
 
107
  /**
108
  * Number Of Items
109
  *
110
  * @var float
111
  */
112
+ protected $numberOfItems;
113
 
114
  /**
115
  * Line Amount (The total cost of this line. In its simplest form lineAmount = unit price * numberOfItems)
117
  *
118
  * @var float
119
  */
120
+ protected $lineAmount;
121
 
122
  /**
123
  * Discounted
124
  *
125
  * @var bool
126
  */
127
+ protected $discounted;
128
 
129
  /**
130
  * Item Description
131
  *
132
  * @var string
133
  */
134
+ protected $itemDescription;
135
 
136
  /**
137
  * Unit Of Measure
139
  *
140
  * @var string
141
  */
142
+ protected $unitOfMeasure;
143
 
144
  /**
145
  * Locations
146
  *
147
+ * @var \OnePica\AvaTax16\Document\Part\Location[]
148
  */
149
+ protected $locations;
150
 
151
  /**
152
  * Tax Payer Code
154
  *
155
  * @var string
156
  */
157
+ protected $taxPayerCode;
158
 
159
  /**
160
  * Buyer Type
161
  *
162
  * @var string
163
  */
164
+ protected $buyerType;
165
 
166
  /**
167
  * Use Type
168
  *
169
  * @var string
170
  */
171
+ protected $useType;
172
 
173
  /**
174
  * Tax Override Amount
176
  *
177
  * @var float
178
  */
179
+ protected $taxOverrideAmount;
180
 
181
  /**
182
  * Tax Included
184
  *
185
  * @var bool
186
  */
187
+ protected $taxIncluded;
188
 
189
  /**
190
  * Tax Included
191
  *
192
  * @var array
193
  */
194
+ protected $metadata;
195
 
196
  /**
197
  * Set Metadata
198
  *
199
+ * @param array|\StdClass $value
200
  * @return $this
201
  */
202
  public function setMetadata($value)
203
  {
204
+ if ($value instanceof \StdClass) {
205
  // convert object data to array
206
  // it is used during filling data from response
207
+ $this->metadata = (array) $value;
208
  } else {
209
+ $this->metadata = $value;
210
  }
211
  }
212
  }
lib/OnePica/AvaTax16/Document/Response.php CHANGED
@@ -11,86 +11,102 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Response
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Document_Response extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Has error
26
  *
27
  * @var bool
28
  */
29
- protected $_hasError = false;
30
 
31
  /**
32
  * Errors
33
  *
34
  * @var array
35
  */
36
- protected $_errors;
37
 
38
  /**
39
  * Types of complex properties
40
  *
41
  * @var array
42
  */
43
- protected $_propertyComplexTypes = array(
44
- '_header' => array(
45
- 'type' => 'OnePica_AvaTax16_Document_Response_Header'
46
  ),
47
- '_lines' => array(
48
- 'type' => 'OnePica_AvaTax16_Document_Response_Line',
49
  'isArrayOf' => 'true'
50
  ),
51
- '_calculatedTaxSummary' => array(
52
- 'type' => 'OnePica_AvaTax16_Document_Response_CalculatedTaxSummary'
53
  ),
54
- '_feedback' => array(
55
- 'type' => 'OnePica_AvaTax16_Document_Part_Feedback'
56
  ),
57
- '_processingInfo' => array(
58
- 'type' => 'OnePica_AvaTax16_Document_Response_ProcessingInfo'
59
  ),
60
  );
61
 
62
  /**
63
  * Header
64
  *
65
- * @var OnePica_AvaTax16_Document_Response_Header
66
  */
67
- protected $_header;
68
 
69
  /**
70
  * Lines
71
  *
72
- * @var OnePica_AvaTax16_Document_Response_Line[]
73
  */
74
- protected $_lines;
75
 
76
  /**
77
  * Calculated Tax Summary
78
  *
79
- * @var OnePica_AvaTax16_Document_Response_CalculatedTaxSummary
80
  */
81
- protected $_calculatedTaxSummary;
82
 
83
  /**
84
  * Feedback
85
  *
86
- * @var OnePica_AvaTax16_Document_Part_Feedback
87
  */
88
- protected $_feedback;
89
 
90
  /**
91
  * Processing Info
92
  *
93
- * @var OnePica_AvaTax16_Document_Response_ProcessingInfo
94
  */
95
- protected $_processingInfo;
96
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document;
19
 
20
  /**
21
+ * Class \OnePica\AvaTax16\Document\Response
22
+ *
23
+ * @method bool getHasError()
24
+ * @method setHasError(bool $value)
25
+ * @method array getErrors()
26
+ * @method setErrors(array $value)
27
+ * @method \OnePica\AvaTax16\Document\Response\Header getHeader()
28
+ * @method setHeader(\OnePica\AvaTax16\Document\Response\Header $value)
29
+ * @method array getLines()
30
+ * @method setLines(array $value)
31
+ * @method \OnePica\AvaTax16\Document\Response\CalculatedTaxSummary getCalculatedTaxSummary()
32
+ * @method setCalculatedTaxSummary(\OnePica\AvaTax16\Document\Response\CalculatedTaxSummary $value)
33
+ * @method \OnePica\AvaTax16\Document\Part\Feedback getFeedback()
34
+ * @method setFeedback(\OnePica\AvaTax16\Document\Part\Feedback $value)
35
+ * @method \OnePica\AvaTax16\Document\Response\ProcessingInfo getProcessingInfo()
36
+ * @method setProcessingInfo(\OnePica\AvaTax16\Document\Response\ProcessingInfo $value)
37
  */
38
+ class Response extends Part
39
  {
40
  /**
41
  * Has error
42
  *
43
  * @var bool
44
  */
45
+ protected $hasError = false;
46
 
47
  /**
48
  * Errors
49
  *
50
  * @var array
51
  */
52
+ protected $errors = array();
53
 
54
  /**
55
  * Types of complex properties
56
  *
57
  * @var array
58
  */
59
+ protected $propertyComplexTypes = array(
60
+ 'header' => array(
61
+ 'type' => '\OnePica\AvaTax16\Document\Response\Header'
62
  ),
63
+ 'lines' => array(
64
+ 'type' => '\OnePica\AvaTax16\Document\Response\Line',
65
  'isArrayOf' => 'true'
66
  ),
67
+ 'calculatedTaxSummary' => array(
68
+ 'type' => '\OnePica\AvaTax16\Document\Response\CalculatedTaxSummary'
69
  ),
70
+ 'feedback' => array(
71
+ 'type' => '\OnePica\AvaTax16\Document\Part\Feedback'
72
  ),
73
+ 'processingInfo' => array(
74
+ 'type' => '\OnePica\AvaTax16\Document\Response\ProcessingInfo'
75
  ),
76
  );
77
 
78
  /**
79
  * Header
80
  *
81
+ * @var \OnePica\AvaTax16\Document\Response\Header
82
  */
83
+ protected $header;
84
 
85
  /**
86
  * Lines
87
  *
88
+ * @var \OnePica\AvaTax16\Document\Response\Line[]
89
  */
90
+ protected $lines = array();
91
 
92
  /**
93
  * Calculated Tax Summary
94
  *
95
+ * @var \OnePica\AvaTax16\Document\Response\CalculatedTaxSummary
96
  */
97
+ protected $calculatedTaxSummary;
98
 
99
  /**
100
  * Feedback
101
  *
102
+ * @var \OnePica\AvaTax16\Document\Part\Feedback
103
  */
104
+ protected $feedback;
105
 
106
  /**
107
  * Processing Info
108
  *
109
+ * @var \OnePica\AvaTax16\Document\Response\ProcessingInfo
110
  */
111
+ protected $processingInfo;
112
  }
lib/OnePica/AvaTax16/Document/Response/CalculatedTaxSummary.php CHANGED
@@ -11,25 +11,40 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Response_CalculatedTaxSummary
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Document_Response_CalculatedTaxSummary
23
- extends OnePica_AvaTax16_Document_Part
24
  {
25
  /**
26
  * Types of complex properties
27
  *
28
  * @var array
29
  */
30
- protected $_propertyComplexTypes = array(
31
- '_taxByType' => array(
32
- 'type' => 'OnePica_AvaTax16_Document_Response_CalculatedTaxSummary_TaxByType',
33
  'isArrayOf' => 'true'
34
  )
35
  );
@@ -39,40 +54,40 @@ class OnePica_AvaTax16_Document_Response_CalculatedTaxSummary
39
  *
40
  * @var int
41
  */
42
- protected $_numberOfLines;
43
 
44
  /**
45
  * Subtotal
46
  *
47
  * @var float
48
  */
49
- protected $_subtotal;
50
 
51
  /**
52
  * Total Tax
53
  *
54
  * @var float
55
  */
56
- protected $_totalTax;
57
 
58
  /**
59
  * Tax By Type
60
  *
61
- * @var OnePica_AvaTax16_Document_Response_CalculatedTaxSummary_TaxByType[]
62
  */
63
- protected $_taxByType;
64
 
65
  /**
66
  * Tax
67
  *
68
  * @var float
69
  */
70
- protected $_tax;
71
 
72
  /**
73
  * Grand Total
74
  *
75
  * @var float
76
  */
77
- protected $_grandTotal;
78
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document\Response;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Document\Response\CalculatedTaxSummary
24
+ *
25
+ * @method int getNumberOfLines()
26
+ * @method setNumberOfLines(int $value)
27
+ * @method float getSubtotal()
28
+ * @method setSubtotal(float $value)
29
+ * @method float getTotalTax()
30
+ * @method setTotalTax(float $value)
31
+ * @method array getTaxByType()
32
+ * @method setTaxByType(array $value)
33
+ * @method float getTax()
34
+ * @method setTax(float $value)
35
+ * @method float getGrandTotal()
36
+ * @method setGrandTotal(float $value)
37
  */
38
+ class CalculatedTaxSummary extends Part
 
39
  {
40
  /**
41
  * Types of complex properties
42
  *
43
  * @var array
44
  */
45
+ protected $propertyComplexTypes = array(
46
+ 'taxByType' => array(
47
+ 'type' => '\OnePica\AvaTax16\Document\Response\CalculatedTaxSummary\TaxByType',
48
  'isArrayOf' => 'true'
49
  )
50
  );
54
  *
55
  * @var int
56
  */
57
+ protected $numberOfLines;
58
 
59
  /**
60
  * Subtotal
61
  *
62
  * @var float
63
  */
64
+ protected $subtotal;
65
 
66
  /**
67
  * Total Tax
68
  *
69
  * @var float
70
  */
71
+ protected $totalTax;
72
 
73
  /**
74
  * Tax By Type
75
  *
76
+ * @var \OnePica\AvaTax16\Document\Response\CalculatedTaxSummary\TaxByType[]
77
  */
78
+ protected $taxByType = array();
79
 
80
  /**
81
  * Tax
82
  *
83
  * @var float
84
  */
85
+ protected $tax;
86
 
87
  /**
88
  * Grand Total
89
  *
90
  * @var float
91
  */
92
+ protected $grandTotal;
93
  }
lib/OnePica/AvaTax16/Document/Response/CalculatedTaxSummary/TaxByType.php CHANGED
@@ -11,25 +11,34 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Response_CalculatedTaxSummary_TaxByType
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Document_Response_CalculatedTaxSummary_TaxByType
23
- extends OnePica_AvaTax16_Document_Part
24
  {
25
  /**
26
  * Types of complex properties
27
  *
28
  * @var array
29
  */
30
- protected $_propertyComplexTypes = array(
31
- '_jurisdictions' => array(
32
- 'type' => 'OnePica_AvaTax16_Document_Response_CalculatedTaxSummary_TaxByType_Details',
33
  'isArrayOf' => true
34
  )
35
  );
@@ -39,19 +48,19 @@ class OnePica_AvaTax16_Document_Response_CalculatedTaxSummary_TaxByType
39
  *
40
  * @var float
41
  */
42
- protected $_tax;
43
 
44
  /**
45
  * jurisdictions
46
  *
47
- * @var OnePica_AvaTax16_Document_Response_CalculatedTaxSummary_TaxByType_Details
48
  */
49
- protected $_jurisdictions;
50
 
51
  /**
52
  * Comment
53
  *
54
  * @var string
55
  */
56
- protected $_comment ;
57
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document\Response\CalculatedTaxSummary;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Document\Response\CalculatedTaxSummary\TaxByType
24
+ *
25
+ * @method float getTax()
26
+ * @method setTax(float $value)
27
+ * @method array getJurisdictions()
28
+ * @method setJurisdictions(array $value)
29
+ * @method string getComment()
30
+ * @method setComment(string $value)
31
  */
32
+ class TaxByType extends Part
 
33
  {
34
  /**
35
  * Types of complex properties
36
  *
37
  * @var array
38
  */
39
+ protected $propertyComplexTypes = array(
40
+ 'jurisdictions' => array(
41
+ 'type' => '\OnePica\AvaTax16\Document\Response\CalculatedTaxSummary\TaxByType\Details',
42
  'isArrayOf' => true
43
  )
44
  );
48
  *
49
  * @var float
50
  */
51
+ protected $tax;
52
 
53
  /**
54
  * jurisdictions
55
  *
56
+ * @var \OnePica\AvaTax16\Document\Response\CalculatedTaxSummary\TaxByType\Details[]
57
  */
58
+ protected $jurisdictions;
59
 
60
  /**
61
  * Comment
62
  *
63
  * @var string
64
  */
65
+ protected $comment;
66
  }
lib/OnePica/AvaTax16/Document/Response/CalculatedTaxSummary/TaxByType/Details.php CHANGED
@@ -11,42 +11,53 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Response_CalculatedTaxSummary_TaxByType_Details
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Document_Response_CalculatedTaxSummary_TaxByType_Details
23
- extends OnePica_AvaTax16_Document_Part
24
  {
25
  /**
26
  * Jurisdiction Name
27
  *
28
  * @var string
29
  */
30
- protected $_jurisdictionName;
31
 
32
  /**
33
  * Jurisdiction Type
34
  *
35
  * @var string
36
  */
37
- protected $_jurisdictionType;
38
 
39
  /**
40
  * Tax
41
  *
42
  * @var float
43
  */
44
- protected $_tax ;
45
 
46
  /**
47
  * Comment
48
  *
49
- * @var float
50
  */
51
- protected $_comment;
52
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document\Response\CalculatedTaxSummary\TaxByType;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Document\Response\CalculatedTaxSummary\TaxByType\Details
24
+ *
25
+ * @method string getJurisdictionName()
26
+ * @method setJurisdictionName(string $value)
27
+ * @method string getJurisdictionType()
28
+ * @method setJurisdictionType(string $value)
29
+ * @method float getTax()
30
+ * @method setTax(float $value)
31
+ * @method string getComment()
32
+ * @method setComment(string $value)
33
  */
34
+ class Details extends Part
 
35
  {
36
  /**
37
  * Jurisdiction Name
38
  *
39
  * @var string
40
  */
41
+ protected $jurisdictionName;
42
 
43
  /**
44
  * Jurisdiction Type
45
  *
46
  * @var string
47
  */
48
+ protected $jurisdictionType;
49
 
50
  /**
51
  * Tax
52
  *
53
  * @var float
54
  */
55
+ protected $tax;
56
 
57
  /**
58
  * Comment
59
  *
60
+ * @var string
61
  */
62
+ protected $comment;
63
  }
lib/OnePica/AvaTax16/Document/Response/Header.php CHANGED
@@ -11,24 +11,61 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Response_Header
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Document_Response_Header extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Types of complex properties
26
  *
27
  * @var array
28
  */
29
- protected $_propertyComplexTypes = array(
30
- '_defaultLocations' => array(
31
- 'type' => 'OnePica_AvaTax16_Document_Part_Location',
32
  'isArrayOf' => 'true'
33
  ),
34
  );
@@ -39,7 +76,7 @@ class OnePica_AvaTax16_Document_Response_Header extends OnePica_AvaTax16_Documen
39
  *
40
  * @var string
41
  */
42
- protected $_accountId;
43
 
44
  /**
45
  * Company Code
@@ -47,7 +84,7 @@ class OnePica_AvaTax16_Document_Response_Header extends OnePica_AvaTax16_Documen
47
  *
48
  * @var string
49
  */
50
- protected $_companyCode;
51
 
52
  /**
53
  * Transaction Type
@@ -55,7 +92,7 @@ class OnePica_AvaTax16_Document_Response_Header extends OnePica_AvaTax16_Documen
55
  *
56
  * @var string
57
  */
58
- protected $_transactionType;
59
 
60
  /**
61
  * Document Code
@@ -63,7 +100,7 @@ class OnePica_AvaTax16_Document_Response_Header extends OnePica_AvaTax16_Documen
63
  *
64
  * @var string
65
  */
66
- protected $_documentCode;
67
 
68
  /**
69
  * Customer Code
@@ -71,7 +108,7 @@ class OnePica_AvaTax16_Document_Response_Header extends OnePica_AvaTax16_Documen
71
  *
72
  * @var string
73
  */
74
- protected $_customerCode;
75
 
76
  /**
77
  * Vendor Code
@@ -79,7 +116,7 @@ class OnePica_AvaTax16_Document_Response_Header extends OnePica_AvaTax16_Documen
79
  *
80
  * @var string
81
  */
82
- protected $_vendorCode;
83
 
84
  /**
85
  * Transaction Date
@@ -87,7 +124,7 @@ class OnePica_AvaTax16_Document_Response_Header extends OnePica_AvaTax16_Documen
87
  *
88
  * @var string
89
  */
90
- protected $_transactionDate;
91
 
92
  /**
93
  * Currency
@@ -95,7 +132,7 @@ class OnePica_AvaTax16_Document_Response_Header extends OnePica_AvaTax16_Documen
95
  *
96
  * @var string
97
  */
98
- protected $_currency;
99
 
100
  /**
101
  * Total Tax Override Amount
@@ -103,14 +140,14 @@ class OnePica_AvaTax16_Document_Response_Header extends OnePica_AvaTax16_Documen
103
  *
104
  * @var float
105
  */
106
- protected $_totalTaxOverrideAmount;
107
 
108
  /**
109
  * Tax Calculation Date
110
  *
111
  * @var string
112
  */
113
- protected $_taxCalculationDate;
114
 
115
  /**
116
  * Default Avalara Goods And Services Modifier Type
@@ -118,15 +155,15 @@ class OnePica_AvaTax16_Document_Response_Header extends OnePica_AvaTax16_Documen
118
  *
119
  * @var string
120
  */
121
- protected $_defaultAvalaraGoodsAndServicesModifierType;
122
 
123
  /**
124
  * Default locations
125
  * (Required)
126
  *
127
- * @var OnePica_AvaTax16_Document_Part_Location[]
128
  */
129
- protected $_defaultLocations;
130
 
131
  /**
132
  * Default Tax Payer Code
@@ -134,50 +171,50 @@ class OnePica_AvaTax16_Document_Response_Header extends OnePica_AvaTax16_Documen
134
  *
135
  * @var string
136
  */
137
- protected $_defaultTaxPayerCode;
138
 
139
  /**
140
  * Default Buyer Type
141
  *
142
  * @var string
143
  */
144
- protected $_defaultBuyerType;
145
 
146
  /**
147
  * Default Use Type
148
  *
149
  * @var string
150
  */
151
- protected $_defaultUseType;
152
 
153
  /**
154
  * Purchase Order Number
155
  *
156
  * @var string
157
  */
158
- protected $_purchaseOrderNumber;
159
 
160
  /**
161
  * Metadata
162
  *
163
  * @var array
164
  */
165
- protected $_metadata;
166
 
167
  /**
168
  * Set Metadata
169
  *
170
- * @param array|StdClass $value
171
  * @return $this
172
  */
173
  public function setMetadata($value)
174
  {
175
- if ($value instanceof StdClass) {
176
  // convert object data to array
177
  // it is used during filling data from response
178
- $this->_metadata = (array) $value;
179
  } else {
180
- $this->_metadata = $value;
181
  }
182
  }
183
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document\Response;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Document\Response\Header
24
+ *
25
+ * @method string getAccountId()
26
+ * @method setAccountId(string $value)
27
+ * @method string getCompanyCode()
28
+ * @method setCompanyCode(string $value)
29
+ * @method string getTransactionType()
30
+ * @method setTransactionType(string $value)
31
+ * @method string getDocumentCode()
32
+ * @method setDocumentCode(string $value)
33
+ * @method string getCustomerCode()
34
+ * @method setCustomerCode(string $value)
35
+ * @method string getVendorCode()
36
+ * @method setVendorCode(string $value)
37
+ * @method string getTransactionDate()
38
+ * @method setTransactionDate(string $value)
39
+ * @method string getCurrency()
40
+ * @method setCurrency(string $value)
41
+ * @method float getTotalTaxOverrideAmount()
42
+ * @method setTotalTaxOverrideAmount(float $value)
43
+ * @method string getTaxCalculationDate()
44
+ * @method setTaxCalculationDate(string $value)
45
+ * @method string getDefaultAvalaraGoodsAndServicesModifierType()
46
+ * @method setDefaultAvalaraGoodsAndServicesModifierType(string $value)
47
+ * @method array getDefaultLocations()
48
+ * @method setDefaultLocations(array $value)
49
+ * @method string getDefaultTaxPayerCode()
50
+ * @method setDefaultTaxPayerCode(string $value)
51
+ * @method string getDefaultBuyerType()
52
+ * @method setDefaultBuyerType(string $value)
53
+ * @method string getDefaultUseType()
54
+ * @method setDefaultUseType(string $value)
55
+ * @method string getPurchaseOrderNumber()
56
+ * @method setPurchaseOrderNumber(string $value)
57
+ * @method array getMetadata()
58
  */
59
+ class Header extends Part
60
  {
61
  /**
62
  * Types of complex properties
63
  *
64
  * @var array
65
  */
66
+ protected $propertyComplexTypes = array(
67
+ 'defaultLocations' => array(
68
+ 'type' => '\OnePica\AvaTax16\Document\Part\Location',
69
  'isArrayOf' => 'true'
70
  ),
71
  );
76
  *
77
  * @var string
78
  */
79
+ protected $accountId;
80
 
81
  /**
82
  * Company Code
84
  *
85
  * @var string
86
  */
87
+ protected $companyCode;
88
 
89
  /**
90
  * Transaction Type
92
  *
93
  * @var string
94
  */
95
+ protected $transactionType;
96
 
97
  /**
98
  * Document Code
100
  *
101
  * @var string
102
  */
103
+ protected $documentCode;
104
 
105
  /**
106
  * Customer Code
108
  *
109
  * @var string
110
  */
111
+ protected $customerCode;
112
 
113
  /**
114
  * Vendor Code
116
  *
117
  * @var string
118
  */
119
+ protected $vendorCode;
120
 
121
  /**
122
  * Transaction Date
124
  *
125
  * @var string
126
  */
127
+ protected $transactionDate;
128
 
129
  /**
130
  * Currency
132
  *
133
  * @var string
134
  */
135
+ protected $currency;
136
 
137
  /**
138
  * Total Tax Override Amount
140
  *
141
  * @var float
142
  */
143
+ protected $totalTaxOverrideAmount;
144
 
145
  /**
146
  * Tax Calculation Date
147
  *
148
  * @var string
149
  */
150
+ protected $taxCalculationDate;
151
 
152
  /**
153
  * Default Avalara Goods And Services Modifier Type
155
  *
156
  * @var string
157
  */
158
+ protected $defaultAvalaraGoodsAndServicesModifierType;
159
 
160
  /**
161
  * Default locations
162
  * (Required)
163
  *
164
+ * @var \OnePica\AvaTax16\Document\Part\Location[]
165
  */
166
+ protected $defaultLocations;
167
 
168
  /**
169
  * Default Tax Payer Code
171
  *
172
  * @var string
173
  */
174
+ protected $defaultTaxPayerCode;
175
 
176
  /**
177
  * Default Buyer Type
178
  *
179
  * @var string
180
  */
181
+ protected $defaultBuyerType;
182
 
183
  /**
184
  * Default Use Type
185
  *
186
  * @var string
187
  */
188
+ protected $defaultUseType;
189
 
190
  /**
191
  * Purchase Order Number
192
  *
193
  * @var string
194
  */
195
+ protected $purchaseOrderNumber;
196
 
197
  /**
198
  * Metadata
199
  *
200
  * @var array
201
  */
202
+ protected $metadata;
203
 
204
  /**
205
  * Set Metadata
206
  *
207
+ * @param array|\StdClass $value
208
  * @return $this
209
  */
210
  public function setMetadata($value)
211
  {
212
+ if ($value instanceof \StdClass) {
213
  // convert object data to array
214
  // it is used during filling data from response
215
+ $this->metadata = (array) $value;
216
  } else {
217
+ $this->metadata = $value;
218
  }
219
  }
220
  }
lib/OnePica/AvaTax16/Document/Response/Line.php CHANGED
@@ -11,35 +11,72 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Response_Line
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Document_Response_Line extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Required properties
26
  *
27
  * @var array
28
  */
29
- protected $_requiredProperties = array('_lineCode', '_lineAmount');
30
 
31
  /**
32
  * Types of complex properties
33
  *
34
  * @var array
35
  */
36
- protected $_propertyComplexTypes = array(
37
- '_locations' => array(
38
- 'type' => 'OnePica_AvaTax16_Document_Part_Location',
39
  'isArrayOf' => 'true'
40
  ),
41
- '_calculatedTax' => array(
42
- 'type' => 'OnePica_AvaTax16_Document_Response_Line_CalculatedTax',
43
  ),
44
  );
45
 
@@ -49,49 +86,49 @@ class OnePica_AvaTax16_Document_Response_Line extends OnePica_AvaTax16_Document_
49
  *
50
  * @var string
51
  */
52
- protected $_lineCode;
53
 
54
  /**
55
  * Item code
56
  *
57
  * @var string
58
  */
59
- protected $_itemCode;
60
 
61
  /**
62
  * Avalara Goods And Services Type
63
  *
64
  * @var string
65
  */
66
- protected $_avalaraGoodsAndServicesType;
67
 
68
  /**
69
  * Avalara Goods And Services Modifier Type
70
  *
71
  * @var string
72
  */
73
- protected $_avalaraGoodsAndServicesModifierType;
74
 
75
  /**
76
  * Number Of Items
77
  *
78
  * @var float
79
  */
80
- protected $_numberOfItems;
81
 
82
  /**
83
  * Line Amount
84
  *
85
  * @var float
86
  */
87
- protected $_lineAmount;
88
 
89
  /**
90
  * Item Description
91
  *
92
  * @var string
93
  */
94
- protected $_itemDescription;
95
 
96
  /**
97
  * Unit Of Measure
@@ -99,14 +136,14 @@ class OnePica_AvaTax16_Document_Response_Line extends OnePica_AvaTax16_Document_
99
  *
100
  * @var string
101
  */
102
- protected $_unitOfMeasure;
103
 
104
  /**
105
  * Locations
106
  *
107
- * @var OnePica_AvaTax16_Document_Part_Location[]
108
  */
109
- protected $_locations;
110
 
111
  /**
112
  * Tax Payer Code
@@ -114,21 +151,21 @@ class OnePica_AvaTax16_Document_Response_Line extends OnePica_AvaTax16_Document_
114
  *
115
  * @var string
116
  */
117
- protected $_taxPayerCode;
118
 
119
  /**
120
  * Buyer Type
121
  *
122
  * @var string
123
  */
124
- protected $_buyerType;
125
 
126
  /**
127
  * Use Type
128
  *
129
  * @var string
130
  */
131
- protected $_useType;
132
 
133
  /**
134
  * Line Attributes
@@ -136,7 +173,7 @@ class OnePica_AvaTax16_Document_Response_Line extends OnePica_AvaTax16_Document_
136
  *
137
  * @var string
138
  */
139
- protected $_lineAttributes;
140
 
141
  /**
142
  * Tax Override Amount
@@ -144,7 +181,7 @@ class OnePica_AvaTax16_Document_Response_Line extends OnePica_AvaTax16_Document_
144
  *
145
  * @var float
146
  */
147
- protected $_taxOverrideAmount;
148
 
149
  /**
150
  * Tax Included
@@ -152,37 +189,37 @@ class OnePica_AvaTax16_Document_Response_Line extends OnePica_AvaTax16_Document_
152
  *
153
  * @var bool
154
  */
155
- protected $_taxIncluded;
156
 
157
  /**
158
  * Tax Included
159
  *
160
  * @var array
161
  */
162
- protected $_metadata;
163
 
164
  /**
165
  * Calculated Tax
166
  * (Only response)
167
  *
168
- * @var OnePica_AvaTax16_Document_Response_Line_CalculatedTax
169
  */
170
- protected $_calculatedTax;
171
 
172
  /**
173
  * Set Metadata
174
  *
175
- * @param array|StdClass $value
176
  * @return $this
177
  */
178
  public function setMetadata($value)
179
  {
180
- if ($value instanceof StdClass) {
181
  // convert object data to array
182
  // it is used during filling data from response
183
- $this->_metadata = (array) $value;
184
  } else {
185
- $this->_metadata = $value;
186
  }
187
  }
188
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document\Response;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Document\Response\Line
24
+ *
25
+ * @method string getLineCode()
26
+ * @method setLineCode(string $value)
27
+ * @method string getItemCode()
28
+ * @method setItemCode(string $value)
29
+ * @method string getAvalaraGoodsAndServicesType()
30
+ * @method setAvalaraGoodsAndServicesType(string $value)
31
+ * @method string getAvalaraGoodsAndServicesModifierType()
32
+ * @method setAvalaraGoodsAndServicesModifierType(string $value)
33
+ * @method float getNumberOfItems()
34
+ * @method setNumberOfItems(float $value)
35
+ * @method float getLineAmount()
36
+ * @method setLineAmount(float $value)
37
+ * @method string getItemDescription()
38
+ * @method setItemDescription(string $value)
39
+ * @method string getUnitOfMeasure()
40
+ * @method setUnitOfMeasure(string $value)
41
+ * @method array getLocations()
42
+ * @method setLocations(array $value)
43
+ * @method string getTaxPayerCode()
44
+ * @method setTaxPayerCode(string $value)
45
+ * @method string getBuyerType()
46
+ * @method setBuyerType(string $value)
47
+ * @method string getUseType()
48
+ * @method setUseType(string $value)
49
+ * @method string getLineAttributes()
50
+ * @method setLineAttributes(string $value)
51
+ * @method float getTaxOverrideAmount()
52
+ * @method setTaxOverrideAmount(float $value)
53
+ * @method bool getTaxIncluded()
54
+ * @method setTaxIncluded(bool $value)
55
+ * @method array getMetadata()
56
+ * @method \OnePica\AvaTax16\Document\Response\Line\CalculatedTax getCalculatedTax()
57
+ * @method setCalculatedTax(\OnePica\AvaTax16\Document\Response\Line\CalculatedTax $value)
58
  */
59
+ class Line extends Part
60
  {
61
  /**
62
  * Required properties
63
  *
64
  * @var array
65
  */
66
+ protected $requiredProperties = array('lineCode', 'lineAmount');
67
 
68
  /**
69
  * Types of complex properties
70
  *
71
  * @var array
72
  */
73
+ protected $propertyComplexTypes = array(
74
+ 'locations' => array(
75
+ 'type' => '\OnePica\AvaTax16\Document\Part\Location',
76
  'isArrayOf' => 'true'
77
  ),
78
+ 'calculatedTax' => array(
79
+ 'type' => '\OnePica\AvaTax16\Document\Response\Line\CalculatedTax',
80
  ),
81
  );
82
 
86
  *
87
  * @var string
88
  */
89
+ protected $lineCode;
90
 
91
  /**
92
  * Item code
93
  *
94
  * @var string
95
  */
96
+ protected $itemCode;
97
 
98
  /**
99
  * Avalara Goods And Services Type
100
  *
101
  * @var string
102
  */
103
+ protected $avalaraGoodsAndServicesType;
104
 
105
  /**
106
  * Avalara Goods And Services Modifier Type
107
  *
108
  * @var string
109
  */
110
+ protected $avalaraGoodsAndServicesModifierType;
111
 
112
  /**
113
  * Number Of Items
114
  *
115
  * @var float
116
  */
117
+ protected $numberOfItems;
118
 
119
  /**
120
  * Line Amount
121
  *
122
  * @var float
123
  */
124
+ protected $lineAmount;
125
 
126
  /**
127
  * Item Description
128
  *
129
  * @var string
130
  */
131
+ protected $itemDescription;
132
 
133
  /**
134
  * Unit Of Measure
136
  *
137
  * @var string
138
  */
139
+ protected $unitOfMeasure;
140
 
141
  /**
142
  * Locations
143
  *
144
+ * @var \OnePica\AvaTax16\Document\Part\Location[]
145
  */
146
+ protected $locations;
147
 
148
  /**
149
  * Tax Payer Code
151
  *
152
  * @var string
153
  */
154
+ protected $taxPayerCode;
155
 
156
  /**
157
  * Buyer Type
158
  *
159
  * @var string
160
  */
161
+ protected $buyerType;
162
 
163
  /**
164
  * Use Type
165
  *
166
  * @var string
167
  */
168
+ protected $useType;
169
 
170
  /**
171
  * Line Attributes
173
  *
174
  * @var string
175
  */
176
+ protected $lineAttributes;
177
 
178
  /**
179
  * Tax Override Amount
181
  *
182
  * @var float
183
  */
184
+ protected $taxOverrideAmount;
185
 
186
  /**
187
  * Tax Included
189
  *
190
  * @var bool
191
  */
192
+ protected $taxIncluded;
193
 
194
  /**
195
  * Tax Included
196
  *
197
  * @var array
198
  */
199
+ protected $metadata;
200
 
201
  /**
202
  * Calculated Tax
203
  * (Only response)
204
  *
205
+ * @var \OnePica\AvaTax16\Document\Response\Line\CalculatedTax
206
  */
207
+ protected $calculatedTax;
208
 
209
  /**
210
  * Set Metadata
211
  *
212
+ * @param array|\StdClass $value
213
  * @return $this
214
  */
215
  public function setMetadata($value)
216
  {
217
+ if ($value instanceof \StdClass) {
218
  // convert object data to array
219
  // it is used during filling data from response
220
+ $this->metadata = (array) $value;
221
  } else {
222
+ $this->metadata = $value;
223
  }
224
  }
225
  }
lib/OnePica/AvaTax16/Document/Response/Line/CalculatedTax.php CHANGED
@@ -11,28 +11,38 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Response_Line_CalculatedTax
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Document_Response_Line_CalculatedTax extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Types of complex properties
26
  *
27
  * @var array
28
  */
29
- protected $_propertyComplexTypes = array(
30
- '_taxByType' => array(
31
- 'type' => 'OnePica_AvaTax16_Document_Response_Line_CalculatedTax_TaxByType',
32
  'isArrayOf' => 'true'
33
  ),
34
- '_details' => array(
35
- 'type' => 'OnePica_AvaTax16_Document_Response_Line_CalculatedTax_Details',
36
  'isArrayOf' => 'true'
37
  )
38
  );
@@ -40,21 +50,21 @@ class OnePica_AvaTax16_Document_Response_Line_CalculatedTax extends OnePica_AvaT
40
  /**
41
  * Tax By Type
42
  *
43
- * @var OnePica_AvaTax16_Document_Response_Line_CalculatedTax_TaxByType[]
44
  */
45
- protected $_taxByType;
46
 
47
  /**
48
  * Tax
49
  *
50
  * @var float
51
  */
52
- protected $_tax;
53
 
54
  /**
55
  * Details
56
  *
57
- * @var OnePica_AvaTax16_Document_Response_Line_CalculatedTax_Details[]
58
  */
59
- protected $_details;
60
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document\Response\Line;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Document\Response\Line\CalculatedTax
24
+ *
25
+ * @method array getTaxByType()
26
+ * @method setTaxByType(array $value)
27
+ * @method float getTax()
28
+ * @method setTax(float $value)
29
+ * @method array getDetails()
30
+ * @method setDetails(array $value)
31
  */
32
+ class CalculatedTax extends Part
33
  {
34
  /**
35
  * Types of complex properties
36
  *
37
  * @var array
38
  */
39
+ protected $propertyComplexTypes = array(
40
+ 'taxByType' => array(
41
+ 'type' => '\OnePica\AvaTax16\Document\Response\Line\CalculatedTax\TaxByType',
42
  'isArrayOf' => 'true'
43
  ),
44
+ 'details' => array(
45
+ 'type' => '\OnePica\AvaTax16\Document\Response\Line\CalculatedTax\Details',
46
  'isArrayOf' => 'true'
47
  )
48
  );
50
  /**
51
  * Tax By Type
52
  *
53
+ * @var \OnePica\AvaTax16\Document\Response\Line\CalculatedTax\TaxByType[]
54
  */
55
+ protected $taxByType;
56
 
57
  /**
58
  * Tax
59
  *
60
  * @var float
61
  */
62
+ protected $tax;
63
 
64
  /**
65
  * Details
66
  *
67
+ * @var \OnePica\AvaTax16\Document\Response\Line\CalculatedTax\Details[]
68
  */
69
+ protected $details;
70
  }
lib/OnePica/AvaTax16/Document/Response/Line/CalculatedTax/Details.php CHANGED
@@ -11,105 +11,134 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Response_Line_CalculatedTax_Details
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Document_Response_Line_CalculatedTax_Details
23
- extends OnePica_AvaTax16_Document_Part
24
  {
25
  /**
26
  * Jurisdiction Name
27
  *
28
  * @var string
29
  */
30
- protected $_jurisdictionName;
31
 
32
  /**
33
  * Jurisdiction Type
34
  *
35
  * @var string
36
  */
37
- protected $_jurisdictionType;
38
 
39
  /**
40
  * Tax Type
41
  *
42
  * @var string
43
  */
44
- protected $_taxType;
45
 
46
  /**
47
  * Rate Type
48
  *
49
  * @var string
50
  */
51
- protected $_rateType;
52
 
53
  /**
54
  * Scenario
55
  *
56
  * @var string
57
  */
58
- protected $_scenario;
59
 
60
  /**
61
  * Subtotal Taxable
62
  *
63
  * @var float
64
  */
65
- protected $_subtotalTaxable;
66
 
67
  /**
68
  * Subtotal Exempt
69
  *
70
  * @var float
71
  */
72
- protected $_subtotalExempt;
73
 
74
  /**
75
  * Rate
76
  *
77
  * @var float
78
  */
79
- protected $_rate;
80
 
81
  /**
82
  * Tax
83
  *
84
  * @var float
85
  */
86
- protected $_tax;
87
 
88
  /**
89
  * Exempt
90
  *
91
  * @var bool
92
  */
93
- protected $_exempt;
94
 
95
  /**
96
  * ExemptionReason
97
  *
98
  * @var string
99
  */
100
- protected $_exemptionReason;
101
 
102
  /**
103
  * Significant Locations
104
  *
105
  * @var string[]
106
  */
107
- protected $_significantLocations;
108
 
109
  /**
110
  * Comment
111
  *
112
  * @var string
113
  */
114
- protected $_comment;
115
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document\Response\Line\CalculatedTax;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Document\Response\Line\CalculatedTax\Details
24
+ *
25
+ * @method string getJurisdictionName()
26
+ * @method setJurisdictionName(string $value)
27
+ * @method string getJurisdictionType()
28
+ * @method setJurisdictionType(string $value)
29
+ * @method string getTaxType()
30
+ * @method setTaxType(string $value)
31
+ * @method string getRateType()
32
+ * @method setRateType(string $value)
33
+ * @method string getScenario()
34
+ * @method setScenario(string $value)
35
+ * @method float getSubtotalTaxable()
36
+ * @method setSubtotalTaxable(float $value)
37
+ * @method float getSubtotalExempt()
38
+ * @method setSubtotalExempt(float $value)
39
+ * @method float getRate()
40
+ * @method setRate(float $value)
41
+ * @method float getTax()
42
+ * @method setTax(float $value)
43
+ * @method bool getExempt()
44
+ * @method setExempt(bool $value)
45
+ * @method string getExemptionReason()
46
+ * @method setExemptionReason(string $value)
47
+ * @method array getSignificantLocations()
48
+ * @method setSignificantLocations(array $value)
49
+ * @method string getComment()
50
+ * @method setComment(string $value)
51
  */
52
+ class Details extends Part
 
53
  {
54
  /**
55
  * Jurisdiction Name
56
  *
57
  * @var string
58
  */
59
+ protected $jurisdictionName;
60
 
61
  /**
62
  * Jurisdiction Type
63
  *
64
  * @var string
65
  */
66
+ protected $jurisdictionType;
67
 
68
  /**
69
  * Tax Type
70
  *
71
  * @var string
72
  */
73
+ protected $taxType;
74
 
75
  /**
76
  * Rate Type
77
  *
78
  * @var string
79
  */
80
+ protected $rateType;
81
 
82
  /**
83
  * Scenario
84
  *
85
  * @var string
86
  */
87
+ protected $scenario;
88
 
89
  /**
90
  * Subtotal Taxable
91
  *
92
  * @var float
93
  */
94
+ protected $subtotalTaxable;
95
 
96
  /**
97
  * Subtotal Exempt
98
  *
99
  * @var float
100
  */
101
+ protected $subtotalExempt;
102
 
103
  /**
104
  * Rate
105
  *
106
  * @var float
107
  */
108
+ protected $rate;
109
 
110
  /**
111
  * Tax
112
  *
113
  * @var float
114
  */
115
+ protected $tax;
116
 
117
  /**
118
  * Exempt
119
  *
120
  * @var bool
121
  */
122
+ protected $exempt;
123
 
124
  /**
125
  * ExemptionReason
126
  *
127
  * @var string
128
  */
129
+ protected $exemptionReason;
130
 
131
  /**
132
  * Significant Locations
133
  *
134
  * @var string[]
135
  */
136
+ protected $significantLocations;
137
 
138
  /**
139
  * Comment
140
  *
141
  * @var string
142
  */
143
+ protected $comment;
144
  }
lib/OnePica/AvaTax16/Document/Response/Line/CalculatedTax/TaxByType.php CHANGED
@@ -11,25 +11,29 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
18
 
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Response_Line_CalculatedTax_TaxByType
 
 
 
21
  */
22
- class OnePica_AvaTax16_Document_Response_Line_CalculatedTax_TaxByType
23
- extends OnePica_AvaTax16_Document_Part
24
  {
25
  /**
26
  * Types of complex properties
27
  *
28
  * @var array
29
  */
30
- protected $_propertyComplexTypes = array(
31
- '_jurisdictions' => array(
32
- 'type' => 'OnePica_AvaTax16_Document_Response_Line_CalculatedTax_TaxByType_Details',
33
  'isArrayOf' => true
34
  )
35
  );
@@ -39,5 +43,5 @@ class OnePica_AvaTax16_Document_Response_Line_CalculatedTax_TaxByType
39
  *
40
  * @var float
41
  */
42
- protected $_tax;
43
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document\Response\Line\CalculatedTax;
19
 
20
+ use OnePica\AvaTax16\Document\Part;
21
  /**
22
+ * Class \OnePica\AvaTax16\Document\Response\Line\CalculatedTax\TaxByType
23
+ *
24
+ * @method float getTax()
25
+ * @method setTax(float $value)
26
  */
27
+ class TaxByType extends Part
 
28
  {
29
  /**
30
  * Types of complex properties
31
  *
32
  * @var array
33
  */
34
+ protected $propertyComplexTypes = array(
35
+ 'jurisdictions' => array(
36
+ 'type' => '\OnePica\AvaTax16\Document\Response\Line\CalculatedTax\TaxByType\Details',
37
  'isArrayOf' => true
38
  )
39
  );
43
  *
44
  * @var float
45
  */
46
+ protected $tax;
47
  }
lib/OnePica/AvaTax16/Document/Response/ProcessingInfo.php CHANGED
@@ -11,69 +11,89 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Document_Response_ProcessingInfo
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Document_Response_ProcessingInfo extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Transaction State
26
  *
27
  * @var string
28
  */
29
- protected $_transactionState;
30
 
31
  /**
32
  * Version Id
33
  *
34
  * @var string
35
  */
36
- protected $_versionId;
37
 
38
  /**
39
  * Format Id
40
  *
41
  * @var string
42
  */
43
- protected $_formatId;
44
 
45
  /**
46
  * Duration
47
  *
48
  * @var float
49
  */
50
- protected $_duration;
51
 
52
  /**
53
  * Modified Date
54
  *
55
  * @var string
56
  */
57
- protected $_modifiedDate;
58
 
59
  /**
60
  * Batch Id
61
  *
62
  * @var string
63
  */
64
- protected $_batchId;
65
 
66
  /**
67
  * Document Id
68
  *
69
  * @var string
70
  */
71
- protected $_documentId;
72
 
73
  /**
74
  * Message
75
  *
76
  * @var string
77
  */
78
- protected $_message;
79
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Document\Response;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Document\Response\ProcessingInfo
24
+ *
25
+ * @method string getTransactionState()
26
+ * @method setTransactionState(string $value)
27
+ * @method string getVersionId()
28
+ * @method setVersionId(string $value)
29
+ * @method string getFormatId()
30
+ * @method setFormatId(string $value)
31
+ * @method float getDuration()
32
+ * @method setDuration(float $value)
33
+ * @method string getModifiedDate()
34
+ * @method setModifiedDate(string $value)
35
+ * @method string getBatchId()
36
+ * @method setBatchId(string $value)
37
+ * @method string getDocumentId()
38
+ * @method setDocumentId(string $value)
39
+ * @method string getMessage()
40
+ * @method setMessage(string $value)
41
  */
42
+ class ProcessingInfo extends Part
43
  {
44
  /**
45
  * Transaction State
46
  *
47
  * @var string
48
  */
49
+ protected $transactionState;
50
 
51
  /**
52
  * Version Id
53
  *
54
  * @var string
55
  */
56
+ protected $versionId;
57
 
58
  /**
59
  * Format Id
60
  *
61
  * @var string
62
  */
63
+ protected $formatId;
64
 
65
  /**
66
  * Duration
67
  *
68
  * @var float
69
  */
70
+ protected $duration;
71
 
72
  /**
73
  * Modified Date
74
  *
75
  * @var string
76
  */
77
+ protected $modifiedDate;
78
 
79
  /**
80
  * Batch Id
81
  *
82
  * @var string
83
  */
84
+ protected $batchId;
85
 
86
  /**
87
  * Document Id
88
  *
89
  * @var string
90
  */
91
+ protected $documentId;
92
 
93
  /**
94
  * Message
95
  *
96
  * @var string
97
  */
98
+ protected $message;
99
  }
lib/OnePica/AvaTax16/Exception.php CHANGED
@@ -11,14 +11,15 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Exception
21
  */
22
- class OnePica_AvaTax16_Exception extends Exception
23
  {
24
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16;
19
 
20
  /**
21
+ * Class \OnePica\AvaTax16\IO\Exception
22
  */
23
+ class Exception extends \Exception
24
  {
25
  }
lib/OnePica/AvaTax16/IO/CaseInsensitiveArray.php CHANGED
@@ -11,22 +11,23 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_IO_CaseInsensitiveArray
21
  */
22
- class OnePica_AvaTax16_IO_CaseInsensitiveArray implements \ArrayAccess, \Countable, \Iterator
23
  {
24
  /**
25
  * Container
26
  *
27
  * @var array
28
  */
29
- protected $_container = array();
30
 
31
  /**
32
  * Offset Set
@@ -38,14 +39,14 @@ class OnePica_AvaTax16_IO_CaseInsensitiveArray implements \ArrayAccess, \Countab
38
  public function offsetSet($offset, $value)
39
  {
40
  if ($offset === null) {
41
- $this->_container[] = $value;
42
  } else {
43
- $index = array_search(strtolower($offset), array_keys(array_change_key_case($this->_container, CASE_LOWER)));
44
  if (!($index === false)) {
45
- $keys = array_keys($this->_container);
46
- unset($this->_container[$keys[$index]]);
47
  }
48
- $this->_container[$offset] = $value;
49
  }
50
  }
51
 
@@ -57,7 +58,7 @@ class OnePica_AvaTax16_IO_CaseInsensitiveArray implements \ArrayAccess, \Countab
57
  */
58
  public function offsetExists($offset)
59
  {
60
- return array_key_exists(strtolower($offset), array_change_key_case($this->_container, CASE_LOWER));
61
  }
62
 
63
  /**
@@ -68,7 +69,7 @@ class OnePica_AvaTax16_IO_CaseInsensitiveArray implements \ArrayAccess, \Countab
68
  */
69
  public function offsetUnset($offset)
70
  {
71
- unset($this->_container[$offset]);
72
  }
73
 
74
  /**
@@ -79,12 +80,12 @@ class OnePica_AvaTax16_IO_CaseInsensitiveArray implements \ArrayAccess, \Countab
79
  */
80
  public function offsetGet($offset)
81
  {
82
- $index = array_search(strtolower($offset), array_keys(array_change_key_case($this->_container, CASE_LOWER)));
83
  if ($index === false) {
84
  return null;
85
  }
86
 
87
- $values = array_values($this->_container);
88
  return $values[$index];
89
  }
90
 
@@ -95,7 +96,7 @@ class OnePica_AvaTax16_IO_CaseInsensitiveArray implements \ArrayAccess, \Countab
95
  */
96
  public function count()
97
  {
98
- return count($this->_container);
99
  }
100
 
101
  /**
@@ -105,7 +106,7 @@ class OnePica_AvaTax16_IO_CaseInsensitiveArray implements \ArrayAccess, \Countab
105
  */
106
  public function current()
107
  {
108
- return current($this->_container);
109
  }
110
 
111
  /**
@@ -115,7 +116,7 @@ class OnePica_AvaTax16_IO_CaseInsensitiveArray implements \ArrayAccess, \Countab
115
  */
116
  public function next()
117
  {
118
- return next($this->_container);
119
  }
120
 
121
  /**
@@ -125,7 +126,7 @@ class OnePica_AvaTax16_IO_CaseInsensitiveArray implements \ArrayAccess, \Countab
125
  */
126
  public function key()
127
  {
128
- return key($this->_container);
129
  }
130
 
131
  /**
@@ -145,6 +146,6 @@ class OnePica_AvaTax16_IO_CaseInsensitiveArray implements \ArrayAccess, \Countab
145
  */
146
  public function rewind()
147
  {
148
- reset($this->_container);
149
  }
150
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\IO;
19
 
20
  /**
21
+ * Class \OnePica\AvaTax16\IO\CaseInsensitiveArray
22
  */
23
+ class CaseInsensitiveArray implements \ArrayAccess, \Countable, \Iterator
24
  {
25
  /**
26
  * Container
27
  *
28
  * @var array
29
  */
30
+ protected $container = array();
31
 
32
  /**
33
  * Offset Set
39
  public function offsetSet($offset, $value)
40
  {
41
  if ($offset === null) {
42
+ $this->container[] = $value;
43
  } else {
44
+ $index = array_search(strtolower($offset), array_keys(array_change_key_case($this->container, CASE_LOWER)));
45
  if (!($index === false)) {
46
+ $keys = array_keys($this->container);
47
+ unset($this->container[$keys[$index]]);
48
  }
49
+ $this->container[$offset] = $value;
50
  }
51
  }
52
 
58
  */
59
  public function offsetExists($offset)
60
  {
61
+ return array_key_exists(strtolower($offset), array_change_key_case($this->container, CASE_LOWER));
62
  }
63
 
64
  /**
69
  */
70
  public function offsetUnset($offset)
71
  {
72
+ unset($this->container[$offset]);
73
  }
74
 
75
  /**
80
  */
81
  public function offsetGet($offset)
82
  {
83
+ $index = array_search(strtolower($offset), array_keys(array_change_key_case($this->container, CASE_LOWER)));
84
  if ($index === false) {
85
  return null;
86
  }
87
 
88
+ $values = array_values($this->container);
89
  return $values[$index];
90
  }
91
 
96
  */
97
  public function count()
98
  {
99
+ return count($this->container);
100
  }
101
 
102
  /**
106
  */
107
  public function current()
108
  {
109
+ return current($this->container);
110
  }
111
 
112
  /**
116
  */
117
  public function next()
118
  {
119
+ return next($this->container);
120
  }
121
 
122
  /**
126
  */
127
  public function key()
128
  {
129
+ return key($this->container);
130
  }
131
 
132
  /**
146
  */
147
  public function rewind()
148
  {
149
+ reset($this->container);
150
  }
151
  }
lib/OnePica/AvaTax16/IO/Curl.php CHANGED
@@ -11,15 +11,16 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_IO_Curl
21
  */
22
- class OnePica_AvaTax16_IO_Curl
23
  {
24
  /**
25
  * Version
@@ -36,210 +37,210 @@ class OnePica_AvaTax16_IO_Curl
36
  *
37
  * @var resource
38
  */
39
- protected $_curl;
40
 
41
  /**
42
  * Id
43
  *
44
  * @var string
45
  */
46
- protected $_id = null;
47
 
48
  /**
49
  * Error
50
  *
51
  * @var bool
52
  */
53
- protected $_error = false;
54
 
55
  /**
56
  * Error code
57
  *
58
  * @var int
59
  */
60
- protected $_errorCode = 0;
61
 
62
  /**
63
  * Error message
64
  *
65
  * @var string
66
  */
67
- protected $_errorMessage = null;
68
 
69
  /**
70
  * Curl error
71
  *
72
  * @var bool
73
  */
74
- protected $_curlError = false;
75
 
76
  /**
77
  * Curl error code
78
  *
79
  * @var int
80
  */
81
- protected $_curlErrorCode = 0;
82
 
83
  /**
84
  * Curl error message
85
  *
86
  * @var string
87
  */
88
- protected $_curlErrorMessage = null;
89
 
90
  /**
91
  * Http error
92
  *
93
  * @var bool
94
  */
95
- protected $_httpError = false;
96
 
97
  /**
98
  * Http status code
99
  *
100
  * @var int
101
  */
102
- protected $_httpStatusCode = 0;
103
 
104
  /**
105
  * Http error message
106
  *
107
  * @var string
108
  */
109
- protected $_httpErrorMessage = null;
110
 
111
  /**
112
  * Base url
113
  *
114
  * @var string
115
  */
116
- protected $_baseUrl = null;
117
 
118
  /**
119
  * Url
120
  *
121
  * @var string
122
  */
123
- protected $_url = null;
124
 
125
  /**
126
  * Request headers
127
  *
128
  * @var array
129
  */
130
- protected $_requestHeaders = null;
131
 
132
  /**
133
  * Response headers
134
  *
135
  * @var array
136
  */
137
- protected $_responseHeaders = null;
138
 
139
  /**
140
  * Raw response headers
141
  *
142
  * @var string
143
  */
144
- protected $_rawResponseHeaders = '';
145
 
146
  /**
147
  * Response
148
  *
149
  * @var mixed
150
  */
151
- protected $_response = null;
152
 
153
  /**
154
  * Raw response
155
  *
156
  * @var string
157
  */
158
- protected $_rawResponse = null;
159
 
160
  /**
161
  * Before send function
162
  *
163
  * @var string
164
  */
165
- protected $_beforeSendFunction = null;
166
 
167
  /**
168
  * Download complete function
169
  *
170
  * @var string
171
  */
172
- protected $_downloadCompleteFunction = null;
173
 
174
  /**
175
  * Success function
176
  *
177
  * @var string
178
  */
179
- protected $_successFunction = null;
180
 
181
  /**
182
  * Error function
183
  *
184
  * @var string
185
  */
186
- protected $_errorFunction = null;
187
 
188
  /**
189
  * Complete function
190
  *
191
  * @var string
192
  */
193
- protected $_completeFunction = null;
194
 
195
  /**
196
  * Cookies
197
  *
198
  * @var array
199
  */
200
- protected $_cookies = array();
201
 
202
  /**
203
  * Response cookies
204
  *
205
  * @var array
206
  */
207
- protected $_responseCookies = array();
208
 
209
  /**
210
  * Headers
211
  *
212
  * @var array
213
  */
214
- protected $_headers = array();
215
 
216
  /**
217
  * Options
218
  *
219
  * @var array
220
  */
221
- protected $_options = array();
222
 
223
  /**
224
  * Options
225
  *
226
  * @var function
227
  */
228
- protected $_jsonDecoder = null;
229
 
230
  /**
231
  * Json pattern
232
  *
233
  * @var string
234
  */
235
- protected $_jsonPattern = '/^(?:application|text)\/(?:[a-z]+(?:[\.-][0-9a-z]+){0,}[\+\.]|x-)?json(?:-[a-z]+)?/i';
236
 
237
  /**
238
  * XML pattern
239
  *
240
  * @var string
241
  */
242
- protected $_xmlPattern = '~^(?:text/|application/(?:atom\+|rss\+)?)xml~i';
243
 
244
  /**
245
  * Construct
@@ -254,15 +255,16 @@ class OnePica_AvaTax16_IO_Curl
254
  throw new \ErrorException('cURL library is not loaded');
255
  }
256
 
257
- $this->_curl = curl_init();
258
- $this->_id = 1;
259
  $this->setDefaultUserAgent();
260
  $this->setDefaultJsonDecoder();
261
  $this->setDefaultTimeout();
262
  $this->setOpt(CURLINFO_HEADER_OUT, true);
263
  $this->setOpt(CURLOPT_HEADERFUNCTION, array($this, 'headerCallback'));
264
  $this->setOpt(CURLOPT_RETURNTRANSFER, true);
265
- $this->_headers = new OnePica_AvaTax16_IO_CaseInsensitiveArray();
 
266
  $this->setURL($base_url);
267
  }
268
 
@@ -278,8 +280,8 @@ class OnePica_AvaTax16_IO_Curl
278
  {
279
  if (is_array($data)) {
280
  if (self::is_array_multidim($data)) {
281
- if (isset($this->_headers['Content-Type']) &&
282
- preg_match($this->_jsonPattern, $this->_headers['Content-Type'])) {
283
  $json_str = json_encode($data);
284
  if (!($json_str === false)) {
285
  $data = $json_str;
@@ -309,8 +311,8 @@ class OnePica_AvaTax16_IO_Curl
309
  }
310
 
311
  if (!$binary_data) {
312
- if (isset($this->_headers['Content-Type']) &&
313
- preg_match($this->_jsonPattern, $this->_headers['Content-Type'])) {
314
  $json_str = json_encode($data);
315
  if (!($json_str === false)) {
316
  $data = $json_str;
@@ -347,11 +349,11 @@ class OnePica_AvaTax16_IO_Curl
347
  */
348
  public function close()
349
  {
350
- if (is_resource($this->_curl)) {
351
- curl_close($this->_curl);
352
  }
353
- $this->_options = null;
354
- $this->_jsonDecoder = null;
355
  }
356
 
357
  /**
@@ -362,7 +364,7 @@ class OnePica_AvaTax16_IO_Curl
362
  */
363
  public function complete($callback)
364
  {
365
- $this->_completeFunction = $callback;
366
  }
367
 
368
  /**
@@ -392,7 +394,7 @@ class OnePica_AvaTax16_IO_Curl
392
  if (is_array($url)) {
393
  $data = $query_parameters;
394
  $query_parameters = $url;
395
- $url = $this->_baseUrl;
396
  }
397
 
398
  $this->setURL($url, $query_parameters);
@@ -409,10 +411,10 @@ class OnePica_AvaTax16_IO_Curl
409
  */
410
  public function downloadComplete($fh)
411
  {
412
- if (!$this->_error && $this->_downloadCompleteFunction) {
413
  rewind($fh);
414
- $this->call($this->_downloadCompleteFunction, $fh);
415
- $this->_downloadCompleteFunction = null;
416
  }
417
 
418
  if (is_resource($fh)) {
@@ -448,7 +450,7 @@ class OnePica_AvaTax16_IO_Curl
448
  public function download($url, $mixed_filename)
449
  {
450
  if (is_callable($mixed_filename)) {
451
- $this->_downloadCompleteFunction = $mixed_filename;
452
  $fh = tmpfile();
453
  } else {
454
  $filename = $mixed_filename;
@@ -459,7 +461,7 @@ class OnePica_AvaTax16_IO_Curl
459
  $this->get($url);
460
  $this->downloadComplete($fh);
461
 
462
- return ! $this->_error;
463
  }
464
 
465
  /**
@@ -470,7 +472,7 @@ class OnePica_AvaTax16_IO_Curl
470
  */
471
  public function error($callback)
472
  {
473
- $this->_errorFunction = $callback;
474
  }
475
 
476
  /**
@@ -483,46 +485,46 @@ class OnePica_AvaTax16_IO_Curl
483
  */
484
  public function exec($ch = null)
485
  {
486
- $this->_responseCookies = array();
487
  if (!($ch === null)) {
488
- $this->_rawResponse = curl_multi_getcontent($ch);
489
  } else {
490
- $this->call($this->_beforeSendFunction);
491
- $this->_rawResponse = curl_exec($this->_curl);
492
- $this->_curlErrorCode = curl_errno($this->_curl);
493
  }
494
- $this->_curlErrorMessage = curl_error($this->_curl);
495
- $this->_curlError = !($this->_curlErrorCode === 0);
496
- $this->_httpStatusCode = curl_getinfo($this->_curl, CURLINFO_HTTP_CODE);
497
- $this->_httpError = in_array(floor($this->_httpStatusCode / 100), array(4, 5));
498
- $this->_error = $this->_curlError || $this->_httpError;
499
- $this->_errorCode = $this->_error ? ($this->_curlError ? $this->_curlErrorCode : $this->_httpStatusCode) : 0;
500
 
501
  // NOTE: CURLINFO_HEADER_OUT set to true is required for requestHeaders
502
  // to not be empty (e.g. $curl->setOpt(CURLINFO_HEADER_OUT, true);).
503
  if ($this->getOpt(CURLINFO_HEADER_OUT) === true) {
504
- $this->_requestHeaders = $this->_parseRequestHeaders(curl_getinfo($this->_curl, CURLINFO_HEADER_OUT));
505
  }
506
- $this->_responseHeaders = $this->_parseResponseHeaders($this->_rawResponseHeaders);
507
- list($this->_response, $this->_rawResponse) = $this->_parseResponse($this->_responseHeaders, $this->_rawResponse);
508
 
509
- $this->_httpErrorMessage = '';
510
- if ($this->_error) {
511
- if (isset($this->_responseHeaders['Status-Line'])) {
512
- $this->_httpErrorMessage = $this->_responseHeaders['Status-Line'];
513
  }
514
  }
515
- $this->_errorMessage = $this->_curlError ? $this->_curlErrorMessage : $this->_httpErrorMessage;
516
 
517
- if (!$this->_error) {
518
- $this->call($this->_successFunction);
519
  } else {
520
- $this->call($this->_errorFunction);
521
  }
522
 
523
- $this->call($this->_completeFunction);
524
 
525
- return $this->_response;
526
  }
527
 
528
  /**
@@ -538,7 +540,7 @@ class OnePica_AvaTax16_IO_Curl
538
  {
539
  if (is_array($url)) {
540
  $data = $url;
541
- $url = $this->_baseUrl;
542
  }
543
  $this->setURL($url, $data);
544
  $this->setOpt(CURLOPT_CUSTOMREQUEST, 'GET');
@@ -556,7 +558,7 @@ class OnePica_AvaTax16_IO_Curl
556
  */
557
  public function getOpt($option)
558
  {
559
- return $this->_options[$option];
560
  }
561
 
562
  /**
@@ -572,7 +574,7 @@ class OnePica_AvaTax16_IO_Curl
572
  {
573
  if (is_array($url)) {
574
  $data = $url;
575
- $url = $this->_baseUrl;
576
  }
577
  $this->setURL($url, $data);
578
  $this->setOpt(CURLOPT_CUSTOMREQUEST, 'HEAD');
@@ -592,9 +594,9 @@ class OnePica_AvaTax16_IO_Curl
592
  public function headerCallback($ch, $header)
593
  {
594
  if (preg_match('/^Set-Cookie:\s*([^=]+)=([^;]+)/mi', $header, $cookie) == 1) {
595
- $this->_responseCookies[$cookie[1]] = $cookie[2];
596
  }
597
- $this->_rawResponseHeaders .= $header;
598
  return strlen($header);
599
  }
600
 
@@ -611,7 +613,7 @@ class OnePica_AvaTax16_IO_Curl
611
  {
612
  if (is_array($url)) {
613
  $data = $url;
614
- $url = $this->_baseUrl;
615
  }
616
  $this->setURL($url, $data);
617
  $this->unsetHeader('Content-Length');
@@ -632,7 +634,7 @@ class OnePica_AvaTax16_IO_Curl
632
  {
633
  if (is_array($url)) {
634
  $data = $url;
635
- $url = $this->_baseUrl;
636
  }
637
 
638
  if (is_array($data) && empty($data)) {
@@ -658,7 +660,7 @@ class OnePica_AvaTax16_IO_Curl
658
  {
659
  if (is_array($url)) {
660
  $data = $url;
661
- $url = $this->_baseUrl;
662
  }
663
 
664
  $this->setURL($url);
@@ -681,12 +683,12 @@ class OnePica_AvaTax16_IO_Curl
681
  {
682
  if (is_array($url)) {
683
  $data = $url;
684
- $url = $this->_baseUrl;
685
  }
686
  $this->setURL($url);
687
  $this->setOpt(CURLOPT_CUSTOMREQUEST, 'PUT');
688
  $put_data = $this->buildPostData($data);
689
- if (empty($this->_options[CURLOPT_INFILE]) && empty($this->_options[CURLOPT_INFILESIZE])) {
690
  $this->setHeader('Content-Length', strlen($put_data));
691
  }
692
  $this->setOpt(CURLOPT_POSTFIELDS, $put_data);
@@ -728,8 +730,8 @@ class OnePica_AvaTax16_IO_Curl
728
  */
729
  public function setCookie($key, $value)
730
  {
731
- $this->_cookies[$key] = $value;
732
- $this->setOpt(CURLOPT_COOKIE, str_replace(' ', '%20', urldecode(http_build_query($this->_cookies, '', '; '))));
733
  }
734
 
735
  /**
@@ -751,7 +753,7 @@ class OnePica_AvaTax16_IO_Curl
751
  */
752
  public function getResponseCookie($key)
753
  {
754
- return isset($this->_responseCookies[$key]) ? $this->_responseCookies[$key] : null;
755
  }
756
 
757
  /**
@@ -805,7 +807,7 @@ class OnePica_AvaTax16_IO_Curl
805
  */
806
  public function setDefaultJsonDecoder()
807
  {
808
- $this->_jsonDecoder = function($response) {
809
  $json_obj = json_decode($response, false);
810
  if (!($json_obj === null)) {
811
  $response = $json_obj;
@@ -849,9 +851,9 @@ class OnePica_AvaTax16_IO_Curl
849
  */
850
  public function setHeader($key, $value)
851
  {
852
- $this->_headers[$key] = $value;
853
  $headers = array();
854
- foreach ($this->_headers as $key => $value) {
855
  $headers[] = $key . ': ' . $value;
856
  }
857
  $this->setOpt(CURLOPT_HTTPHEADER, $headers);
@@ -866,7 +868,7 @@ class OnePica_AvaTax16_IO_Curl
866
  public function setJsonDecoder($function)
867
  {
868
  if (is_callable($function)) {
869
- $this->_jsonDecoder = $function;
870
  }
871
  }
872
 
@@ -889,8 +891,8 @@ class OnePica_AvaTax16_IO_Curl
889
  trigger_error($required_options[$option] . ' is a required option', E_USER_WARNING);
890
  }
891
 
892
- $this->_options[$option] = $value;
893
- return curl_setopt($this->_curl, $option, $value);
894
  }
895
 
896
  /**
@@ -935,9 +937,9 @@ class OnePica_AvaTax16_IO_Curl
935
  */
936
  public function setURL($url, $data = array())
937
  {
938
- $this->_baseUrl = $url;
939
- $this->_url = $this->_buildURL($url, $data);
940
- $this->setOpt(CURLOPT_URL, $this->_url);
941
  }
942
 
943
  /**
@@ -959,7 +961,7 @@ class OnePica_AvaTax16_IO_Curl
959
  */
960
  public function success($callback)
961
  {
962
- $this->_successFunction = $callback;
963
  }
964
 
965
  /**
@@ -971,7 +973,7 @@ class OnePica_AvaTax16_IO_Curl
971
  public function unsetHeader($key)
972
  {
973
  $this->setHeader($key, '');
974
- unset($this->_headers[$key]);
975
  }
976
 
977
  /**
@@ -1004,7 +1006,7 @@ class OnePica_AvaTax16_IO_Curl
1004
  *
1005
  * @return string
1006
  */
1007
- protected function _buildURL($url, $data = array())
1008
  {
1009
  return $url . (empty($data) ? '' : '?' . http_build_query($data));
1010
  }
@@ -1017,10 +1019,10 @@ class OnePica_AvaTax16_IO_Curl
1017
  *
1018
  * @return array
1019
  */
1020
- protected function _parseHeaders($raw_headers)
1021
  {
1022
  $raw_headers = preg_split('/\r\n/', $raw_headers, null, PREG_SPLIT_NO_EMPTY);
1023
- $http_headers = new OnePica_AvaTax16_IO_CaseInsensitiveArray();
1024
 
1025
  $raw_headers_count = count($raw_headers);
1026
  for ($i = 1; $i < $raw_headers_count; $i++) {
@@ -1046,10 +1048,10 @@ class OnePica_AvaTax16_IO_Curl
1046
  *
1047
  * @return array
1048
  */
1049
- protected function _parseRequestHeaders($raw_headers)
1050
  {
1051
- $request_headers = new OnePica_AvaTax16_IO_CaseInsensitiveArray();
1052
- list($first_line, $headers) = $this->_parseHeaders($raw_headers);
1053
  $request_headers['Request-Line'] = $first_line;
1054
  foreach ($headers as $key => $value) {
1055
  $request_headers[$key] = $value;
@@ -1066,16 +1068,16 @@ class OnePica_AvaTax16_IO_Curl
1066
  *
1067
  * @return array
1068
  */
1069
- protected function _parseResponse($response_headers, $raw_response)
1070
  {
1071
  $response = $raw_response;
1072
  if (isset($response_headers['Content-Type'])) {
1073
- if (preg_match($this->_jsonPattern, $response_headers['Content-Type'])) {
1074
- $json_decoder = $this->_jsonDecoder;
1075
  if (is_callable($json_decoder)) {
1076
  $response = $json_decoder($response);
1077
  }
1078
- } elseif (preg_match($this->_xmlPattern, $response_headers['Content-Type'])) {
1079
  $xml_obj = @simplexml_load_string($response);
1080
  if (!($xml_obj === false)) {
1081
  $response = $xml_obj;
@@ -1094,7 +1096,7 @@ class OnePica_AvaTax16_IO_Curl
1094
  *
1095
  * @return array
1096
  */
1097
- protected function _parseResponseHeaders($raw_response_headers)
1098
  {
1099
  $response_header_array = explode("\r\n\r\n", $raw_response_headers);
1100
  $response_header = '';
@@ -1105,8 +1107,8 @@ class OnePica_AvaTax16_IO_Curl
1105
  }
1106
  }
1107
 
1108
- $response_headers = new OnePica_AvaTax16_IO_CaseInsensitiveArray();
1109
- list($first_line, $headers) = $this->_parseHeaders($response_header);
1110
  $response_headers['Status-Line'] = $first_line;
1111
  foreach ($headers as $key => $value) {
1112
  $response_headers[$key] = $value;
@@ -1183,7 +1185,7 @@ class OnePica_AvaTax16_IO_Curl
1183
  */
1184
  public function getError()
1185
  {
1186
- return $this->_error;
1187
  }
1188
 
1189
  /**
@@ -1193,7 +1195,7 @@ class OnePica_AvaTax16_IO_Curl
1193
  */
1194
  public function getErrorCode()
1195
  {
1196
- return $this->_errorCode;
1197
  }
1198
 
1199
  /**
@@ -1203,7 +1205,7 @@ class OnePica_AvaTax16_IO_Curl
1203
  */
1204
  public function getErrorMessage()
1205
  {
1206
- return $this->_errorMessage;
1207
  }
1208
 
1209
  /**
@@ -1213,7 +1215,7 @@ class OnePica_AvaTax16_IO_Curl
1213
  */
1214
  public function getCurlError()
1215
  {
1216
- return $this->_curlError;
1217
  }
1218
 
1219
  /**
@@ -1223,7 +1225,7 @@ class OnePica_AvaTax16_IO_Curl
1223
  */
1224
  public function getCurlErrorCode()
1225
  {
1226
- return $this->_curlErrorCode;
1227
  }
1228
 
1229
  /**
@@ -1233,7 +1235,7 @@ class OnePica_AvaTax16_IO_Curl
1233
  */
1234
  public function getCurlErrorMessage()
1235
  {
1236
- return $this->_curlErrorMessage;
1237
  }
1238
 
1239
  /**
@@ -1243,7 +1245,7 @@ class OnePica_AvaTax16_IO_Curl
1243
  */
1244
  public function getHttpError()
1245
  {
1246
- return $this->_httpError;
1247
  }
1248
 
1249
  /**
@@ -1253,7 +1255,7 @@ class OnePica_AvaTax16_IO_Curl
1253
  */
1254
  public function getHttpStatusCode()
1255
  {
1256
- return $this->_httpStatusCode;
1257
  }
1258
 
1259
  /**
@@ -1263,7 +1265,7 @@ class OnePica_AvaTax16_IO_Curl
1263
  */
1264
  public function getHttpErrorMessage()
1265
  {
1266
- return $this->_httpErrorMessage;
1267
  }
1268
 
1269
  /**
@@ -1273,7 +1275,7 @@ class OnePica_AvaTax16_IO_Curl
1273
  */
1274
  public function getBaseUrl()
1275
  {
1276
- return $this->_baseUrl;
1277
  }
1278
 
1279
  /**
@@ -1283,7 +1285,7 @@ class OnePica_AvaTax16_IO_Curl
1283
  */
1284
  public function getUrl()
1285
  {
1286
- return $this->_url;
1287
  }
1288
 
1289
  /**
@@ -1293,7 +1295,7 @@ class OnePica_AvaTax16_IO_Curl
1293
  */
1294
  public function getRequestHeaders()
1295
  {
1296
- return $this->_requestHeaders;
1297
  }
1298
 
1299
  /**
@@ -1303,7 +1305,7 @@ class OnePica_AvaTax16_IO_Curl
1303
  */
1304
  public function getResponseHeaders()
1305
  {
1306
- return $this->_responseHeaders;
1307
  }
1308
 
1309
  /**
@@ -1313,7 +1315,7 @@ class OnePica_AvaTax16_IO_Curl
1313
  */
1314
  public function getRawResponseHeaders()
1315
  {
1316
- return $this->_rawResponseHeaders;
1317
  }
1318
 
1319
  /**
@@ -1323,7 +1325,7 @@ class OnePica_AvaTax16_IO_Curl
1323
  */
1324
  public function getResponse()
1325
  {
1326
- return $this->_response;
1327
  }
1328
 
1329
  /**
@@ -1333,7 +1335,7 @@ class OnePica_AvaTax16_IO_Curl
1333
  */
1334
  public function getRawResponse()
1335
  {
1336
- return $this->_rawResponse;
1337
  }
1338
 
1339
  /**
@@ -1343,7 +1345,7 @@ class OnePica_AvaTax16_IO_Curl
1343
  */
1344
  public function getBeforeSendFunction()
1345
  {
1346
- return $this->_beforeSendFunction;
1347
  }
1348
 
1349
  /**
@@ -1354,7 +1356,7 @@ class OnePica_AvaTax16_IO_Curl
1354
  */
1355
  public function setBeforeSendFunction($function)
1356
  {
1357
- $this->_beforeSendFunction = $function;
1358
  return $this;
1359
  }
1360
 
@@ -1365,7 +1367,7 @@ class OnePica_AvaTax16_IO_Curl
1365
  */
1366
  public function getDownloadCompleteFunction()
1367
  {
1368
- return $this->_downloadCompleteFunction;
1369
  }
1370
 
1371
  /**
@@ -1376,7 +1378,7 @@ class OnePica_AvaTax16_IO_Curl
1376
  */
1377
  public function setDownloadCompleteFunction($function)
1378
  {
1379
- $this->_downloadCompleteFunction = $function;
1380
  return $this;
1381
  }
1382
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\IO;
19
 
20
  /**
21
+ * Class \OnePica\AvaTax16\IO\Curl
22
  */
23
+ class Curl
24
  {
25
  /**
26
  * Version
37
  *
38
  * @var resource
39
  */
40
+ protected $curl;
41
 
42
  /**
43
  * Id
44
  *
45
  * @var string
46
  */
47
+ protected $id = null;
48
 
49
  /**
50
  * Error
51
  *
52
  * @var bool
53
  */
54
+ protected $error = false;
55
 
56
  /**
57
  * Error code
58
  *
59
  * @var int
60
  */
61
+ protected $errorCode = 0;
62
 
63
  /**
64
  * Error message
65
  *
66
  * @var string
67
  */
68
+ protected $errorMessage = null;
69
 
70
  /**
71
  * Curl error
72
  *
73
  * @var bool
74
  */
75
+ protected $curlError = false;
76
 
77
  /**
78
  * Curl error code
79
  *
80
  * @var int
81
  */
82
+ protected $curlErrorCode = 0;
83
 
84
  /**
85
  * Curl error message
86
  *
87
  * @var string
88
  */
89
+ protected $curlErrorMessage = null;
90
 
91
  /**
92
  * Http error
93
  *
94
  * @var bool
95
  */
96
+ protected $httpError = false;
97
 
98
  /**
99
  * Http status code
100
  *
101
  * @var int
102
  */
103
+ protected $httpStatusCode = 0;
104
 
105
  /**
106
  * Http error message
107
  *
108
  * @var string
109
  */
110
+ protected $httpErrorMessage = null;
111
 
112
  /**
113
  * Base url
114
  *
115
  * @var string
116
  */
117
+ protected $baseUrl = null;
118
 
119
  /**
120
  * Url
121
  *
122
  * @var string
123
  */
124
+ protected $url = null;
125
 
126
  /**
127
  * Request headers
128
  *
129
  * @var array
130
  */
131
+ protected $requestHeaders = null;
132
 
133
  /**
134
  * Response headers
135
  *
136
  * @var array
137
  */
138
+ protected $responseHeaders = null;
139
 
140
  /**
141
  * Raw response headers
142
  *
143
  * @var string
144
  */
145
+ protected $rawResponseHeaders = '';
146
 
147
  /**
148
  * Response
149
  *
150
  * @var mixed
151
  */
152
+ protected $response = null;
153
 
154
  /**
155
  * Raw response
156
  *
157
  * @var string
158
  */
159
+ protected $rawResponse = null;
160
 
161
  /**
162
  * Before send function
163
  *
164
  * @var string
165
  */
166
+ protected $beforeSendFunction = null;
167
 
168
  /**
169
  * Download complete function
170
  *
171
  * @var string
172
  */
173
+ protected $downloadCompleteFunction = null;
174
 
175
  /**
176
  * Success function
177
  *
178
  * @var string
179
  */
180
+ protected $successFunction = null;
181
 
182
  /**
183
  * Error function
184
  *
185
  * @var string
186
  */
187
+ protected $errorFunction = null;
188
 
189
  /**
190
  * Complete function
191
  *
192
  * @var string
193
  */
194
+ protected $completeFunction = null;
195
 
196
  /**
197
  * Cookies
198
  *
199
  * @var array
200
  */
201
+ protected $cookies = array();
202
 
203
  /**
204
  * Response cookies
205
  *
206
  * @var array
207
  */
208
+ protected $responseCookies = array();
209
 
210
  /**
211
  * Headers
212
  *
213
  * @var array
214
  */
215
+ protected $headers = array();
216
 
217
  /**
218
  * Options
219
  *
220
  * @var array
221
  */
222
+ protected $options = array();
223
 
224
  /**
225
  * Options
226
  *
227
  * @var function
228
  */
229
+ protected $jsonDecoder = null;
230
 
231
  /**
232
  * Json pattern
233
  *
234
  * @var string
235
  */
236
+ protected $jsonPattern = '/^(?:application|text)\/(?:[a-z]+(?:[\.-][0-9a-z]+){0,}[\+\.]|x-)?json(?:-[a-z]+)?/i';
237
 
238
  /**
239
  * XML pattern
240
  *
241
  * @var string
242
  */
243
+ protected $xmlPattern = '~^(?:text/|application/(?:atom\+|rss\+)?)xml~i';
244
 
245
  /**
246
  * Construct
255
  throw new \ErrorException('cURL library is not loaded');
256
  }
257
 
258
+ $this->curl = curl_init();
259
+ $this->id = 1;
260
  $this->setDefaultUserAgent();
261
  $this->setDefaultJsonDecoder();
262
  $this->setDefaultTimeout();
263
  $this->setOpt(CURLINFO_HEADER_OUT, true);
264
  $this->setOpt(CURLOPT_HEADERFUNCTION, array($this, 'headerCallback'));
265
  $this->setOpt(CURLOPT_RETURNTRANSFER, true);
266
+ $this->setOpt(CURLOPT_SSL_VERIFYPEER, false);
267
+ $this->headers = new CaseInsensitiveArray();
268
  $this->setURL($base_url);
269
  }
270
 
280
  {
281
  if (is_array($data)) {
282
  if (self::is_array_multidim($data)) {
283
+ if (isset($this->headers['Content-Type']) &&
284
+ preg_match($this->jsonPattern, $this->headers['Content-Type'])) {
285
  $json_str = json_encode($data);
286
  if (!($json_str === false)) {
287
  $data = $json_str;
311
  }
312
 
313
  if (!$binary_data) {
314
+ if (isset($this->headers['Content-Type']) &&
315
+ preg_match($this->jsonPattern, $this->headers['Content-Type'])) {
316
  $json_str = json_encode($data);
317
  if (!($json_str === false)) {
318
  $data = $json_str;
349
  */
350
  public function close()
351
  {
352
+ if (is_resource($this->curl)) {
353
+ curl_close($this->curl);
354
  }
355
+ $this->options = null;
356
+ $this->jsonDecoder = null;
357
  }
358
 
359
  /**
364
  */
365
  public function complete($callback)
366
  {
367
+ $this->completeFunction = $callback;
368
  }
369
 
370
  /**
394
  if (is_array($url)) {
395
  $data = $query_parameters;
396
  $query_parameters = $url;
397
+ $url = $this->baseUrl;
398
  }
399
 
400
  $this->setURL($url, $query_parameters);
411
  */
412
  public function downloadComplete($fh)
413
  {
414
+ if (!$this->error && $this->downloadCompleteFunction) {
415
  rewind($fh);
416
+ $this->call($this->downloadCompleteFunction, $fh);
417
+ $this->downloadCompleteFunction = null;
418
  }
419
 
420
  if (is_resource($fh)) {
450
  public function download($url, $mixed_filename)
451
  {
452
  if (is_callable($mixed_filename)) {
453
+ $this->downloadCompleteFunction = $mixed_filename;
454
  $fh = tmpfile();
455
  } else {
456
  $filename = $mixed_filename;
461
  $this->get($url);
462
  $this->downloadComplete($fh);
463
 
464
+ return !$this->error;
465
  }
466
 
467
  /**
472
  */
473
  public function error($callback)
474
  {
475
+ $this->errorFunction = $callback;
476
  }
477
 
478
  /**
485
  */
486
  public function exec($ch = null)
487
  {
488
+ $this->responseCookies = array();
489
  if (!($ch === null)) {
490
+ $this->rawResponse = curl_multi_getcontent($ch);
491
  } else {
492
+ $this->call($this->beforeSendFunction);
493
+ $this->rawResponse = curl_exec($this->curl);
494
+ $this->curlErrorCode = curl_errno($this->curl);
495
  }
496
+ $this->curlErrorMessage = curl_error($this->curl);
497
+ $this->curlError = !($this->curlErrorCode === 0);
498
+ $this->httpStatusCode = curl_getinfo($this->curl, CURLINFO_HTTP_CODE);
499
+ $this->httpError = in_array(floor($this->httpStatusCode / 100), array(4, 5));
500
+ $this->error = $this->curlError || $this->httpError;
501
+ $this->errorCode = $this->error ? ($this->curlError ? $this->curlErrorCode : $this->httpStatusCode) : 0;
502
 
503
  // NOTE: CURLINFO_HEADER_OUT set to true is required for requestHeaders
504
  // to not be empty (e.g. $curl->setOpt(CURLINFO_HEADER_OUT, true);).
505
  if ($this->getOpt(CURLINFO_HEADER_OUT) === true) {
506
+ $this->requestHeaders = $this->parseRequestHeaders(curl_getinfo($this->curl, CURLINFO_HEADER_OUT));
507
  }
508
+ $this->responseHeaders = $this->parseResponseHeaders($this->rawResponseHeaders);
509
+ list($this->response, $this->rawResponse) = $this->parseResponse($this->responseHeaders, $this->rawResponse);
510
 
511
+ $this->httpErrorMessage = '';
512
+ if ($this->error) {
513
+ if (isset($this->responseHeaders['Status-Line'])) {
514
+ $this->httpErrorMessage = $this->responseHeaders['Status-Line'];
515
  }
516
  }
517
+ $this->errorMessage = $this->curlError ? $this->curlErrorMessage : $this->httpErrorMessage;
518
 
519
+ if (!$this->error) {
520
+ $this->call($this->successFunction);
521
  } else {
522
+ $this->call($this->errorFunction);
523
  }
524
 
525
+ $this->call($this->completeFunction);
526
 
527
+ return $this->response;
528
  }
529
 
530
  /**
540
  {
541
  if (is_array($url)) {
542
  $data = $url;
543
+ $url = $this->baseUrl;
544
  }
545
  $this->setURL($url, $data);
546
  $this->setOpt(CURLOPT_CUSTOMREQUEST, 'GET');
558
  */
559
  public function getOpt($option)
560
  {
561
+ return $this->options[$option];
562
  }
563
 
564
  /**
574
  {
575
  if (is_array($url)) {
576
  $data = $url;
577
+ $url = $this->baseUrl;
578
  }
579
  $this->setURL($url, $data);
580
  $this->setOpt(CURLOPT_CUSTOMREQUEST, 'HEAD');
594
  public function headerCallback($ch, $header)
595
  {
596
  if (preg_match('/^Set-Cookie:\s*([^=]+)=([^;]+)/mi', $header, $cookie) == 1) {
597
+ $this->responseCookies[$cookie[1]] = $cookie[2];
598
  }
599
+ $this->rawResponseHeaders .= $header;
600
  return strlen($header);
601
  }
602
 
613
  {
614
  if (is_array($url)) {
615
  $data = $url;
616
+ $url = $this->baseUrl;
617
  }
618
  $this->setURL($url, $data);
619
  $this->unsetHeader('Content-Length');
634
  {
635
  if (is_array($url)) {
636
  $data = $url;
637
+ $url = $this->baseUrl;
638
  }
639
 
640
  if (is_array($data) && empty($data)) {
660
  {
661
  if (is_array($url)) {
662
  $data = $url;
663
+ $url = $this->baseUrl;
664
  }
665
 
666
  $this->setURL($url);
683
  {
684
  if (is_array($url)) {
685
  $data = $url;
686
+ $url = $this->baseUrl;
687
  }
688
  $this->setURL($url);
689
  $this->setOpt(CURLOPT_CUSTOMREQUEST, 'PUT');
690
  $put_data = $this->buildPostData($data);
691
+ if (empty($this->options[CURLOPT_INFILE]) && empty($this->options[CURLOPT_INFILESIZE])) {
692
  $this->setHeader('Content-Length', strlen($put_data));
693
  }
694
  $this->setOpt(CURLOPT_POSTFIELDS, $put_data);
730
  */
731
  public function setCookie($key, $value)
732
  {
733
+ $this->cookies[$key] = $value;
734
+ $this->setOpt(CURLOPT_COOKIE, str_replace(' ', '%20', urldecode(http_build_query($this->cookies, '', '; '))));
735
  }
736
 
737
  /**
753
  */
754
  public function getResponseCookie($key)
755
  {
756
+ return isset($this->responseCookies[$key]) ? $this->responseCookies[$key] : null;
757
  }
758
 
759
  /**
807
  */
808
  public function setDefaultJsonDecoder()
809
  {
810
+ $this->jsonDecoder = function($response) {
811
  $json_obj = json_decode($response, false);
812
  if (!($json_obj === null)) {
813
  $response = $json_obj;
851
  */
852
  public function setHeader($key, $value)
853
  {
854
+ $this->headers[$key] = $value;
855
  $headers = array();
856
+ foreach ($this->headers as $key => $value) {
857
  $headers[] = $key . ': ' . $value;
858
  }
859
  $this->setOpt(CURLOPT_HTTPHEADER, $headers);
868
  public function setJsonDecoder($function)
869
  {
870
  if (is_callable($function)) {
871
+ $this->jsonDecoder = $function;
872
  }
873
  }
874
 
891
  trigger_error($required_options[$option] . ' is a required option', E_USER_WARNING);
892
  }
893
 
894
+ $this->options[$option] = $value;
895
+ return curl_setopt($this->curl, $option, $value);
896
  }
897
 
898
  /**
937
  */
938
  public function setURL($url, $data = array())
939
  {
940
+ $this->baseUrl = $url;
941
+ $this->url = $this->buildURL($url, $data);
942
+ $this->setOpt(CURLOPT_URL, $this->url);
943
  }
944
 
945
  /**
961
  */
962
  public function success($callback)
963
  {
964
+ $this->successFunction = $callback;
965
  }
966
 
967
  /**
973
  public function unsetHeader($key)
974
  {
975
  $this->setHeader($key, '');
976
+ unset($this->headers[$key]);
977
  }
978
 
979
  /**
1006
  *
1007
  * @return string
1008
  */
1009
+ protected function buildURL($url, $data = array())
1010
  {
1011
  return $url . (empty($data) ? '' : '?' . http_build_query($data));
1012
  }
1019
  *
1020
  * @return array
1021
  */
1022
+ protected function parseHeaders($raw_headers)
1023
  {
1024
  $raw_headers = preg_split('/\r\n/', $raw_headers, null, PREG_SPLIT_NO_EMPTY);
1025
+ $http_headers = new CaseInsensitiveArray();
1026
 
1027
  $raw_headers_count = count($raw_headers);
1028
  for ($i = 1; $i < $raw_headers_count; $i++) {
1048
  *
1049
  * @return array
1050
  */
1051
+ protected function parseRequestHeaders($raw_headers)
1052
  {
1053
+ $request_headers = new CaseInsensitiveArray();
1054
+ list($first_line, $headers) = $this->parseHeaders($raw_headers);
1055
  $request_headers['Request-Line'] = $first_line;
1056
  foreach ($headers as $key => $value) {
1057
  $request_headers[$key] = $value;
1068
  *
1069
  * @return array
1070
  */
1071
+ protected function parseResponse($response_headers, $raw_response)
1072
  {
1073
  $response = $raw_response;
1074
  if (isset($response_headers['Content-Type'])) {
1075
+ if (preg_match($this->jsonPattern, $response_headers['Content-Type'])) {
1076
+ $json_decoder = $this->jsonDecoder;
1077
  if (is_callable($json_decoder)) {
1078
  $response = $json_decoder($response);
1079
  }
1080
+ } elseif (preg_match($this->xmlPattern, $response_headers['Content-Type'])) {
1081
  $xml_obj = @simplexml_load_string($response);
1082
  if (!($xml_obj === false)) {
1083
  $response = $xml_obj;
1096
  *
1097
  * @return array
1098
  */
1099
+ protected function parseResponseHeaders($raw_response_headers)
1100
  {
1101
  $response_header_array = explode("\r\n\r\n", $raw_response_headers);
1102
  $response_header = '';
1107
  }
1108
  }
1109
 
1110
+ $response_headers = new CaseInsensitiveArray();
1111
+ list($first_line, $headers) = $this->parseHeaders($response_header);
1112
  $response_headers['Status-Line'] = $first_line;
1113
  foreach ($headers as $key => $value) {
1114
  $response_headers[$key] = $value;
1185
  */
1186
  public function getError()
1187
  {
1188
+ return $this->error;
1189
  }
1190
 
1191
  /**
1195
  */
1196
  public function getErrorCode()
1197
  {
1198
+ return $this->errorCode;
1199
  }
1200
 
1201
  /**
1205
  */
1206
  public function getErrorMessage()
1207
  {
1208
+ return $this->errorMessage;
1209
  }
1210
 
1211
  /**
1215
  */
1216
  public function getCurlError()
1217
  {
1218
+ return $this->curlError;
1219
  }
1220
 
1221
  /**
1225
  */
1226
  public function getCurlErrorCode()
1227
  {
1228
+ return $this->curlErrorCode;
1229
  }
1230
 
1231
  /**
1235
  */
1236
  public function getCurlErrorMessage()
1237
  {
1238
+ return $this->curlErrorMessage;
1239
  }
1240
 
1241
  /**
1245
  */
1246
  public function getHttpError()
1247
  {
1248
+ return $this->httpError;
1249
  }
1250
 
1251
  /**
1255
  */
1256
  public function getHttpStatusCode()
1257
  {
1258
+ return $this->httpStatusCode;
1259
  }
1260
 
1261
  /**
1265
  */
1266
  public function getHttpErrorMessage()
1267
  {
1268
+ return $this->httpErrorMessage;
1269
  }
1270
 
1271
  /**
1275
  */
1276
  public function getBaseUrl()
1277
  {
1278
+ return $this->baseUrl;
1279
  }
1280
 
1281
  /**
1285
  */
1286
  public function getUrl()
1287
  {
1288
+ return $this->url;
1289
  }
1290
 
1291
  /**
1295
  */
1296
  public function getRequestHeaders()
1297
  {
1298
+ return $this->requestHeaders;
1299
  }
1300
 
1301
  /**
1305
  */
1306
  public function getResponseHeaders()
1307
  {
1308
+ return $this->responseHeaders;
1309
  }
1310
 
1311
  /**
1315
  */
1316
  public function getRawResponseHeaders()
1317
  {
1318
+ return $this->rawResponseHeaders;
1319
  }
1320
 
1321
  /**
1325
  */
1326
  public function getResponse()
1327
  {
1328
+ return $this->response;
1329
  }
1330
 
1331
  /**
1335
  */
1336
  public function getRawResponse()
1337
  {
1338
+ return $this->rawResponse;
1339
  }
1340
 
1341
  /**
1345
  */
1346
  public function getBeforeSendFunction()
1347
  {
1348
+ return $this->beforeSendFunction;
1349
  }
1350
 
1351
  /**
1356
  */
1357
  public function setBeforeSendFunction($function)
1358
  {
1359
+ $this->beforeSendFunction = $function;
1360
  return $this;
1361
  }
1362
 
1367
  */
1368
  public function getDownloadCompleteFunction()
1369
  {
1370
+ return $this->downloadCompleteFunction;
1371
  }
1372
 
1373
  /**
1378
  */
1379
  public function setDownloadCompleteFunction($function)
1380
  {
1381
+ $this->downloadCompleteFunction = $function;
1382
  return $this;
1383
  }
1384
  }
lib/OnePica/AvaTax16/ResourceAbstract.php CHANGED
@@ -11,73 +11,77 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Abstract class OnePica_AvaTax16_ResourceAbstract
21
  */
22
- abstract class OnePica_AvaTax16_ResourceAbstract
23
  {
24
  /**
25
  * Config
26
  *
27
- * @var OnePica_AvaTax16_Config
28
  */
29
- protected $_config;
30
 
31
  /**
32
  * Construct
33
  *
34
- * @param OnePica_AvaTax16_Config $config
35
  */
36
  public function __construct($config)
37
  {
38
- $this->_config = $config;
39
  }
40
 
41
  /**
42
  * Get config
43
  *
44
- * @return OnePica_AvaTax16_Config
45
  */
46
  public function getConfig()
47
  {
48
- return $this->_config;
49
  }
50
 
51
  /**
52
  * Get Curl Object with headers from config
53
  *
54
- * @return OnePica_AvaTax16_IO_Curl
55
  */
56
- protected function _getCurlObjectWithHeaders()
57
  {
58
- $curl = new OnePica_AvaTax16_IO_Curl();
59
  $config = $this->getConfig();
60
  $curl->setHeader('Authorization', $config->getAuthorizationHeader());
61
  $curl->setHeader('Accept', $config->getAcceptHeader());
62
  $curl->setHeader('Content-Type', $config->getContentTypeHeader());
63
  $curl->setHeader('User-Agent', $config->getUserAgent());
 
64
  return $curl;
65
  }
66
 
67
  /**
68
  * Set Error Data To Response If Exists
69
  *
70
- * @param OnePica_AvaTax16_Document_Part $response
71
- * @param OnePica_AvaTax16_IO_Curl $curl
72
  * @return $this
73
  */
74
- protected function _setErrorDataToResponseIfExists($response, $curl)
75
  {
76
  if ($curl->getError()) {
77
  $response->setHasError(true);
78
  $errors = array();
79
  $responseData = $curl->getResponse();
80
- if ($responseData instanceof stdClass) {
81
  if (isset($responseData->errors) && count($responseData->errors)) {
82
  foreach ($responseData->errors as $value) {
83
  if (is_array($value)) {
@@ -90,8 +94,6 @@ abstract class OnePica_AvaTax16_ResourceAbstract
90
  if (isset($responseData->message)) {
91
  $errors['message'] = $responseData->message;
92
  }
93
- } else {
94
- $errors['message'] = $responseData;
95
  }
96
  $response->setErrors($errors);
97
  }
@@ -101,15 +103,15 @@ abstract class OnePica_AvaTax16_ResourceAbstract
101
  * Send Request To Service And Get Response Object
102
  *
103
  * @param string $url
104
- * @param array $options
105
  * @return mixed $result
106
  */
107
- protected function _sendRequest($url, $options = array())
108
  {
109
  $requestType = (isset($options['requestType'])) ? $options['requestType'] : 'GET';
110
  $data = (isset($options['data'])) ? $options['data'] : null;
111
  $returnClass = (isset($options['returnClass'])) ? $options['returnClass'] : null;
112
- $curl = $this->_getCurlObjectWithHeaders();
113
  $result = null;
114
  switch ($requestType) {
115
  case 'GET':
@@ -121,7 +123,7 @@ abstract class OnePica_AvaTax16_ResourceAbstract
121
  }
122
  if (isset($returnClass)) {
123
  $responseObject = new $returnClass();
124
- $this->_setErrorDataToResponseIfExists($responseObject, $curl);
125
  if (!$responseObject->getHasError()) {
126
  $responseData = $curl->getResponse();
127
  $responseObject->fillData($responseData);
@@ -130,6 +132,7 @@ abstract class OnePica_AvaTax16_ResourceAbstract
130
  } else {
131
  $result = $curl->getResponse();
132
  }
 
133
  return $result;
134
  }
135
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16;
19
+
20
+ use OnePica\AvaTax16\IO\Curl;
21
 
22
  /**
23
+ * Abstract class \OnePica\AvaTax16\ResourceAbstract
24
  */
25
+ abstract class ResourceAbstract
26
  {
27
  /**
28
  * Config
29
  *
30
+ * @var \OnePica\AvaTax16\Config
31
  */
32
+ protected $config;
33
 
34
  /**
35
  * Construct
36
  *
37
+ * @param \OnePica\AvaTax16\Config $config
38
  */
39
  public function __construct($config)
40
  {
41
+ $this->config = $config;
42
  }
43
 
44
  /**
45
  * Get config
46
  *
47
+ * @return \OnePica\AvaTax16\Config
48
  */
49
  public function getConfig()
50
  {
51
+ return $this->config;
52
  }
53
 
54
  /**
55
  * Get Curl Object with headers from config
56
  *
57
+ * @return \OnePica\AvaTax16\IO\Curl
58
  */
59
+ protected function getCurlObjectWithHeaders()
60
  {
61
+ $curl = new Curl();
62
  $config = $this->getConfig();
63
  $curl->setHeader('Authorization', $config->getAuthorizationHeader());
64
  $curl->setHeader('Accept', $config->getAcceptHeader());
65
  $curl->setHeader('Content-Type', $config->getContentTypeHeader());
66
  $curl->setHeader('User-Agent', $config->getUserAgent());
67
+
68
  return $curl;
69
  }
70
 
71
  /**
72
  * Set Error Data To Response If Exists
73
  *
74
+ * @param \OnePica\AvaTax16\Document\Part $response
75
+ * @param Curl $curl
76
  * @return $this
77
  */
78
+ protected function setErrorDataToResponseIfExists($response, $curl)
79
  {
80
  if ($curl->getError()) {
81
  $response->setHasError(true);
82
  $errors = array();
83
  $responseData = $curl->getResponse();
84
+ if ($responseData instanceof \stdClass) {
85
  if (isset($responseData->errors) && count($responseData->errors)) {
86
  foreach ($responseData->errors as $value) {
87
  if (is_array($value)) {
94
  if (isset($responseData->message)) {
95
  $errors['message'] = $responseData->message;
96
  }
 
 
97
  }
98
  $response->setErrors($errors);
99
  }
103
  * Send Request To Service And Get Response Object
104
  *
105
  * @param string $url
106
+ * @param array $options
107
  * @return mixed $result
108
  */
109
+ protected function sendRequest($url, $options = array())
110
  {
111
  $requestType = (isset($options['requestType'])) ? $options['requestType'] : 'GET';
112
  $data = (isset($options['data'])) ? $options['data'] : null;
113
  $returnClass = (isset($options['returnClass'])) ? $options['returnClass'] : null;
114
+ $curl = $this->getCurlObjectWithHeaders();
115
  $result = null;
116
  switch ($requestType) {
117
  case 'GET':
123
  }
124
  if (isset($returnClass)) {
125
  $responseObject = new $returnClass();
126
+ $this->setErrorDataToResponseIfExists($responseObject, $curl);
127
  if (!$responseObject->getHasError()) {
128
  $responseData = $curl->getResponse();
129
  $responseObject->fillData($responseData);
132
  } else {
133
  $result = $curl->getResponse();
134
  }
135
+
136
  return $result;
137
  }
138
  }
lib/OnePica/AvaTax16/TaxService.php CHANGED
@@ -11,45 +11,32 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_TaxService
21
  */
22
- class OnePica_AvaTax16_TaxService extends OnePica_AvaTax16_ResourceAbstract
23
  {
24
- /**
25
- * Config
26
- *
27
- * @var OnePica_AvaTax16_Config
28
- */
29
- protected $_config;
30
-
31
  /**
32
  * Construct
33
  *
34
- * @param OnePica_AvaTax16_Config $config
35
- * @throws OnePica_AvaTax16_Exception
36
  */
37
  public function __construct($config)
38
  {
39
  if (!$config->isValid()) {
40
- throw new OnePica_AvaTax16_Exception("Not valid data in config!");
41
  }
42
- $this->_config = $config;
43
- }
44
-
45
- /**
46
- * Get config
47
- *
48
- * @return OnePica_AvaTax16_Config
49
- */
50
- public function getConfig()
51
- {
52
- return $this->_config;
53
  }
54
 
55
  /**
@@ -58,19 +45,19 @@ class OnePica_AvaTax16_TaxService extends OnePica_AvaTax16_ResourceAbstract
58
  * @param string $type
59
  * @return mixed $taxResource
60
  */
61
- protected function _getTaxResource($type)
62
  {
63
  $config = $this->getConfig();
64
  $taxResource = null;
65
  switch ($type) {
66
  case 'calculation':
67
- $taxResource = new OnePica_AvaTax16_Calculation($config);
68
  break;
69
  case 'transaction':
70
- $taxResource = new OnePica_AvaTax16_Transaction($config);
71
  break;
72
  case 'addressResolution':
73
- $taxResource = new OnePica_AvaTax16_AddressResolution($config);
74
  break;
75
  }
76
  return $taxResource;
@@ -79,12 +66,12 @@ class OnePica_AvaTax16_TaxService extends OnePica_AvaTax16_ResourceAbstract
79
  /**
80
  * Create Transaction
81
  *
82
- * @param OnePica_AvaTax16_Document_Request $documentRequest
83
- * @return OnePica_AvaTax16_Document_Response $documentResponse
84
  */
85
  public function createCalculation($documentRequest)
86
  {
87
- $calculationResource = $this->_getTaxResource('calculation');
88
  $documentResponse = $calculationResource->createCalculation($documentRequest);
89
  return $documentResponse;
90
  }
@@ -94,11 +81,11 @@ class OnePica_AvaTax16_TaxService extends OnePica_AvaTax16_ResourceAbstract
94
  *
95
  * @param string $transactionType
96
  * @param string $documentCode
97
- * @return OnePica_AvaTax16_Document_Response $documentResponse
98
  */
99
  public function getCalculation($transactionType, $documentCode)
100
  {
101
- $calculationResource = $this->_getTaxResource('calculation');
102
  $documentResponse = $calculationResource->getCalculation($transactionType, $documentCode);
103
  return $documentResponse;
104
  }
@@ -111,26 +98,27 @@ class OnePica_AvaTax16_TaxService extends OnePica_AvaTax16_ResourceAbstract
111
  * @param string $startDate
112
  * @param string $endDate
113
  * @param string $startCode (not implemented)
114
- * @return OnePica_AvaTax16_Calculation_ListResponse $calculationListResponse
115
  */
116
  public function getListOfCalculations($transactionType, $limit = null, $startDate = null, $endDate = null,
117
  $startCode = null)
118
  {
119
- $calculationResource = $this->_getTaxResource('calculation');
120
- $calculationListResponse = $calculationResource->getListOfCalculations($transactionType, $limit, $startDate,
121
- $endDate, $startCode);
 
122
  return $calculationListResponse;
123
  }
124
 
125
  /**
126
  * Create Transaction
127
  *
128
- * @param OnePica_AvaTax16_Document_Request $documentRequest
129
- * @return OnePica_AvaTax16_Document_Response $documentResponse
130
  */
131
  public function createTransaction($documentRequest)
132
  {
133
- $transactionResource = $this->_getTaxResource('transaction');
134
  $documentResponse = $transactionResource->createTransaction($documentRequest);
135
  return $documentResponse;
136
  }
@@ -142,14 +130,15 @@ class OnePica_AvaTax16_TaxService extends OnePica_AvaTax16_ResourceAbstract
142
  * @param string $documentCode
143
  * @param bool $recalculate
144
  * @param string $comment
145
- * @return OnePica_AvaTax16_Document_Response $documentResponse
146
  */
147
  public function createTransactionFromCalculation($transactionType, $documentCode, $recalculate = null,
148
  $comment = null)
149
  {
150
- $transactionResource = $this->_getTaxResource('transaction');
151
- $documentResponse = $transactionResource->createTransactionFromCalculation($transactionType, $documentCode,
152
- $recalculate, $comment);
 
153
  return $documentResponse;
154
  }
155
 
@@ -158,11 +147,11 @@ class OnePica_AvaTax16_TaxService extends OnePica_AvaTax16_ResourceAbstract
158
  *
159
  * @param string $transactionType
160
  * @param string $documentCode
161
- * @return OnePica_AvaTax16_Document_Response $documentResponse
162
  */
163
  public function getTransaction($transactionType, $documentCode)
164
  {
165
- $transactionResource = $this->_getTaxResource('transaction');
166
  $documentResponse = $transactionResource->getTransaction($transactionType, $documentCode);
167
  return $documentResponse;
168
  }
@@ -175,14 +164,15 @@ class OnePica_AvaTax16_TaxService extends OnePica_AvaTax16_ResourceAbstract
175
  * @param string $startDate
176
  * @param string $endDate
177
  * @param string $startCode (not implemented)
178
- * @return OnePica_AvaTax16_Transaction_ListResponse $transactionListResponse
179
  */
180
  public function getListOfTransactions($transactionType, $limit = null, $startDate = null, $endDate = null,
181
  $startCode = null)
182
  {
183
- $transactionResource = $this->_getTaxResource('transaction');
184
- $transactionListResponse = $transactionResource->getListOfTransactions($transactionType, $limit, $startDate,
185
- $endDate, $startCode);
 
186
  return $transactionListResponse;
187
  }
188
 
@@ -191,11 +181,11 @@ class OnePica_AvaTax16_TaxService extends OnePica_AvaTax16_ResourceAbstract
191
  *
192
  * @param string $transactionType
193
  * @param string $documentCode
194
- * @return OnePica_AvaTax16_Document_Request $transactionInput
195
  */
196
  public function getTransactionInput($transactionType, $documentCode)
197
  {
198
- $transactionResource = $this->_getTaxResource('transaction');
199
  $transactionInput = $transactionResource->getTransactionInput($transactionType, $documentCode);
200
  return $transactionInput;
201
  }
@@ -207,25 +197,26 @@ class OnePica_AvaTax16_TaxService extends OnePica_AvaTax16_ResourceAbstract
207
  * @param string $documentCode
208
  * @param string $type
209
  * @param string $comment
210
- * @return OnePica_AvaTax16_Transaction_TransitionTransactionStateResponse $transitionTransactionStateResponse
211
  */
212
  public function transitionTransactionState($transactionType, $documentCode, $type, $comment)
213
  {
214
- $transactionResource = $this->_getTaxResource('transaction');
215
- $transitionTransactionStateResponse = $transactionResource->transitionTransactionState($transactionType,
216
- $documentCode, $type, $comment);
 
217
  return $transitionTransactionStateResponse;
218
  }
219
 
220
  /**
221
  * Resolve a Single Address
222
  *
223
- * @param OnePica_AvaTax16_Document_Part_Location_Address $address
224
- * @return OnePica_AvaTax16_AddressResolution_ResolveSingleAddressResponse $resolvedAddressResponse
225
  */
226
  public function resolveSingleAddress($address)
227
  {
228
- $addressResolutionResource = $this->_getTaxResource('addressResolution');
229
  $resolvedAddressResponse = $addressResolutionResource->resolveSingleAddress($address);
230
  return $resolvedAddressResponse;
231
  }
@@ -234,19 +225,19 @@ class OnePica_AvaTax16_TaxService extends OnePica_AvaTax16_ResourceAbstract
234
  * Ping
235
  * Is used to test if service is available
236
  *
237
- * @return OnePica_AvaTax16_AddressResolution_PingResponse $pingResponse
238
  */
239
  public function ping()
240
  {
241
  // set some predefined address to ping API service
242
- $address = new OnePica_AvaTax16_Document_Part_Location_Address();
243
  $address->setLine1('Avenue');
244
  $address->setZipcode('10022');
245
  $address->setCountry('USA');
246
- $addressResolutionResource = $this->_getTaxResource('addressResolution');
247
  $resolvedAddress = $addressResolutionResource->resolveSingleAddress($address);
248
  // set data to response object
249
- $pingResponse = new OnePica_AvaTax16_AddressResolution_PingResponse();
250
  $pingResponse->setHasError($resolvedAddress->getHasError());
251
  $pingResponse->setErrors($resolvedAddress->getErrors());
252
  return $pingResponse;
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16;
19
+
20
+ use OnePica\AvaTax16\Document\Part\Location\Address;
21
+ use OnePica\AvaTax16\AddressResolution\PingResponse;
22
 
23
  /**
24
+ * Class \OnePica\AvaTax16\TaxService
25
  */
26
+ class TaxService extends ResourceAbstract
27
  {
 
 
 
 
 
 
 
28
  /**
29
  * Construct
30
  *
31
+ * @param \OnePica\AvaTax16\Config $config
32
+ * @throws \OnePica\AvaTax16\Exception
33
  */
34
  public function __construct($config)
35
  {
36
  if (!$config->isValid()) {
37
+ throw new Exception("Not valid data in config!");
38
  }
39
+ $this->config = $config;
 
 
 
 
 
 
 
 
 
 
40
  }
41
 
42
  /**
45
  * @param string $type
46
  * @return mixed $taxResource
47
  */
48
+ protected function getTaxResource($type)
49
  {
50
  $config = $this->getConfig();
51
  $taxResource = null;
52
  switch ($type) {
53
  case 'calculation':
54
+ $taxResource = new Calculation($config);
55
  break;
56
  case 'transaction':
57
+ $taxResource = new Transaction($config);
58
  break;
59
  case 'addressResolution':
60
+ $taxResource = new AddressResolution($config);
61
  break;
62
  }
63
  return $taxResource;
66
  /**
67
  * Create Transaction
68
  *
69
+ * @param \OnePica\AvaTax16\Document\Request $documentRequest
70
+ * @return \OnePica\AvaTax16\Document\Response $documentResponse
71
  */
72
  public function createCalculation($documentRequest)
73
  {
74
+ $calculationResource = $this->getTaxResource('calculation');
75
  $documentResponse = $calculationResource->createCalculation($documentRequest);
76
  return $documentResponse;
77
  }
81
  *
82
  * @param string $transactionType
83
  * @param string $documentCode
84
+ * @return \OnePica\AvaTax16\Document\Response $documentResponse
85
  */
86
  public function getCalculation($transactionType, $documentCode)
87
  {
88
+ $calculationResource = $this->getTaxResource('calculation');
89
  $documentResponse = $calculationResource->getCalculation($transactionType, $documentCode);
90
  return $documentResponse;
91
  }
98
  * @param string $startDate
99
  * @param string $endDate
100
  * @param string $startCode (not implemented)
101
+ * @return \OnePica\AvaTax16\Calculation\ListResponse $calculationListResponse
102
  */
103
  public function getListOfCalculations($transactionType, $limit = null, $startDate = null, $endDate = null,
104
  $startCode = null)
105
  {
106
+ $calculationResource = $this->getTaxResource('calculation');
107
+ $calculationListResponse = $calculationResource->getListOfCalculations(
108
+ $transactionType, $limit, $startDate, $endDate, $startCode
109
+ );
110
  return $calculationListResponse;
111
  }
112
 
113
  /**
114
  * Create Transaction
115
  *
116
+ * @param \OnePica\AvaTax16\Document\Request $documentRequest
117
+ * @return \OnePica\AvaTax16\Document\Response $documentResponse
118
  */
119
  public function createTransaction($documentRequest)
120
  {
121
+ $transactionResource = $this->getTaxResource('transaction');
122
  $documentResponse = $transactionResource->createTransaction($documentRequest);
123
  return $documentResponse;
124
  }
130
  * @param string $documentCode
131
  * @param bool $recalculate
132
  * @param string $comment
133
+ * @return \OnePica\AvaTax16\Document\Response $documentResponse
134
  */
135
  public function createTransactionFromCalculation($transactionType, $documentCode, $recalculate = null,
136
  $comment = null)
137
  {
138
+ $transactionResource = $this->getTaxResource('transaction');
139
+ $documentResponse = $transactionResource->createTransactionFromCalculation(
140
+ $transactionType, $documentCode, $recalculate, $comment
141
+ );
142
  return $documentResponse;
143
  }
144
 
147
  *
148
  * @param string $transactionType
149
  * @param string $documentCode
150
+ * @return \OnePica\AvaTax16\Document\Response $documentResponse
151
  */
152
  public function getTransaction($transactionType, $documentCode)
153
  {
154
+ $transactionResource = $this->getTaxResource('transaction');
155
  $documentResponse = $transactionResource->getTransaction($transactionType, $documentCode);
156
  return $documentResponse;
157
  }
164
  * @param string $startDate
165
  * @param string $endDate
166
  * @param string $startCode (not implemented)
167
+ * @return \OnePica\AvaTax16\Transaction\ListResponse $transactionListResponse
168
  */
169
  public function getListOfTransactions($transactionType, $limit = null, $startDate = null, $endDate = null,
170
  $startCode = null)
171
  {
172
+ $transactionResource = $this->getTaxResource('transaction');
173
+ $transactionListResponse = $transactionResource->getListOfTransactions(
174
+ $transactionType, $limit, $startDate, $endDate, $startCode
175
+ );
176
  return $transactionListResponse;
177
  }
178
 
181
  *
182
  * @param string $transactionType
183
  * @param string $documentCode
184
+ * @return \OnePica\AvaTax16\Document\Request $transactionInput
185
  */
186
  public function getTransactionInput($transactionType, $documentCode)
187
  {
188
+ $transactionResource = $this->getTaxResource('transaction');
189
  $transactionInput = $transactionResource->getTransactionInput($transactionType, $documentCode);
190
  return $transactionInput;
191
  }
197
  * @param string $documentCode
198
  * @param string $type
199
  * @param string $comment
200
+ * @return \OnePica\AvaTax16\Transaction\TransitionTransactionStateResponse $transitionTransactionStateResponse
201
  */
202
  public function transitionTransactionState($transactionType, $documentCode, $type, $comment)
203
  {
204
+ $transactionResource = $this->getTaxResource('transaction');
205
+ $transitionTransactionStateResponse = $transactionResource->transitionTransactionState(
206
+ $transactionType, $documentCode, $type, $comment
207
+ );
208
  return $transitionTransactionStateResponse;
209
  }
210
 
211
  /**
212
  * Resolve a Single Address
213
  *
214
+ * @param \OnePica\AvaTax16\Document\Part\Location\Address $address
215
+ * @return \OnePica\AvaTax16\AddressResolution\ResolveSingleAddressResponse $resolvedAddressResponse
216
  */
217
  public function resolveSingleAddress($address)
218
  {
219
+ $addressResolutionResource = $this->getTaxResource('addressResolution');
220
  $resolvedAddressResponse = $addressResolutionResource->resolveSingleAddress($address);
221
  return $resolvedAddressResponse;
222
  }
225
  * Ping
226
  * Is used to test if service is available
227
  *
228
+ * @return \OnePica\AvaTax16\AddressResolution\PingResponse $pingResponse
229
  */
230
  public function ping()
231
  {
232
  // set some predefined address to ping API service
233
+ $address = new Address();
234
  $address->setLine1('Avenue');
235
  $address->setZipcode('10022');
236
  $address->setCountry('USA');
237
+ $addressResolutionResource = $this->getTaxResource('addressResolution');
238
  $resolvedAddress = $addressResolutionResource->resolveSingleAddress($address);
239
  // set data to response object
240
+ $pingResponse = new PingResponse();
241
  $pingResponse->setHasError($resolvedAddress->getHasError());
242
  $pingResponse->setErrors($resolvedAddress->getErrors());
243
  return $pingResponse;
lib/OnePica/AvaTax16/Transaction.php CHANGED
@@ -11,15 +11,18 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Transaction
21
  */
22
- class OnePica_AvaTax16_Transaction extends OnePica_AvaTax16_ResourceAbstract
23
  {
24
  /**
25
  * Url path for calculations
@@ -34,19 +37,19 @@ class OnePica_AvaTax16_Transaction extends OnePica_AvaTax16_ResourceAbstract
34
  /**
35
  * Create Transaction
36
  *
37
- * @param OnePica_AvaTax16_Document_Request $documentRequest
38
- * @return OnePica_AvaTax16_Document_Response $documentResponse
39
  */
40
  public function createTransaction($documentRequest)
41
  {
42
- $postUrl = $this->_config->getBaseUrl() . self::TRANSACTION_URL_PATH;
43
  $postData = $documentRequest->toArray();
44
  $requestOptions = array(
45
  'requestType' => 'POST',
46
  'data' => $postData,
47
- 'returnClass' => 'OnePica_AvaTax16_Document_Response'
48
  );
49
- $documentResponse = $this->_sendRequest($postUrl, $requestOptions);
50
  return $documentResponse;
51
  }
52
 
@@ -57,7 +60,7 @@ class OnePica_AvaTax16_Transaction extends OnePica_AvaTax16_ResourceAbstract
57
  * @param string $documentCode
58
  * @param bool $recalculate
59
  * @param string $comment
60
- * @return OnePica_AvaTax16_Document_Response $documentResponse
61
  */
62
  public function createTransactionFromCalculation($transactionType, $documentCode, $recalculate = null,
63
  $comment = null)
@@ -84,9 +87,9 @@ class OnePica_AvaTax16_Transaction extends OnePica_AvaTax16_ResourceAbstract
84
  $requestOptions = array(
85
  'requestType' => 'POST',
86
  'data' => $postData,
87
- 'returnClass' => 'OnePica_AvaTax16_Document_Response'
88
  );
89
- $documentResponse = $this->_sendRequest($postUrl, $requestOptions);
90
  return $documentResponse;
91
  }
92
 
@@ -95,7 +98,7 @@ class OnePica_AvaTax16_Transaction extends OnePica_AvaTax16_ResourceAbstract
95
  *
96
  * @param string $transactionType
97
  * @param string $documentCode
98
- * @return OnePica_AvaTax16_Document_Response $documentResponse
99
  */
100
  public function getTransaction($transactionType, $documentCode)
101
  {
@@ -113,9 +116,9 @@ class OnePica_AvaTax16_Transaction extends OnePica_AvaTax16_ResourceAbstract
113
 
114
  $requestOptions = array(
115
  'requestType' => 'GET',
116
- 'returnClass' => 'OnePica_AvaTax16_Document_Response'
117
  );
118
- $documentResponse = $this->_sendRequest($getUrl, $requestOptions);
119
  return $documentResponse;
120
  }
121
 
@@ -127,7 +130,7 @@ class OnePica_AvaTax16_Transaction extends OnePica_AvaTax16_ResourceAbstract
127
  * @param string $startDate
128
  * @param string $endDate
129
  * @param string $startCode (not implemented)
130
- * @return OnePica_AvaTax16_Transaction_ListResponse $transactionListResponse
131
  */
132
  public function getListOfTransactions($transactionType, $limit = null, $startDate = null, $endDate = null,
133
  $startCode = null)
@@ -152,9 +155,9 @@ class OnePica_AvaTax16_Transaction extends OnePica_AvaTax16_ResourceAbstract
152
  $requestOptions = array(
153
  'requestType' => 'GET',
154
  'data' => $filterData,
155
- 'returnClass' => 'OnePica_AvaTax16_Transaction_ListResponse'
156
  );
157
- $transactionListResponse = $this->_sendRequest($getUrl, $requestOptions);
158
  return $transactionListResponse;
159
  }
160
 
@@ -163,7 +166,7 @@ class OnePica_AvaTax16_Transaction extends OnePica_AvaTax16_ResourceAbstract
163
  *
164
  * @param string $transactionType
165
  * @param string $documentCode
166
- * @return OnePica_AvaTax16_Document_Request $transactionInput
167
  */
168
  public function getTransactionInput($transactionType, $documentCode)
169
  {
@@ -182,9 +185,9 @@ class OnePica_AvaTax16_Transaction extends OnePica_AvaTax16_ResourceAbstract
182
 
183
  $requestOptions = array(
184
  'requestType' => 'GET',
185
- 'returnClass' => 'OnePica_AvaTax16_Document_Request'
186
  );
187
- $transactionInput = $this->_sendRequest($getUrl, $requestOptions);
188
  return $transactionInput;
189
  }
190
 
@@ -195,7 +198,7 @@ class OnePica_AvaTax16_Transaction extends OnePica_AvaTax16_ResourceAbstract
195
  * @param string $documentCode
196
  * @param string $type
197
  * @param string $comment
198
- * @return OnePica_AvaTax16_Transaction_TransitionTransactionStateResponse $transitionTransactionStateResponse
199
  */
200
  public function transitionTransactionState($transactionType, $documentCode, $type, $comment)
201
  {
@@ -217,10 +220,10 @@ class OnePica_AvaTax16_Transaction extends OnePica_AvaTax16_ResourceAbstract
217
  'comment' => $comment
218
  );
219
 
220
- $curl = $this->_getCurlObjectWithHeaders();
221
  $curl->post($postUrl, $postData);
222
- $transitionTransactionStateResponse = new OnePica_AvaTax16_Transaction_TransitionTransactionStateResponse();
223
- $this->_setErrorDataToResponseIfExists($transitionTransactionStateResponse, $curl);
224
  $transitionTransactionStateResponse->setHttpStatus($curl->getHttpStatusCode());
225
  return $transitionTransactionStateResponse;
226
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16;
19
+
20
+ use OnePica\AvaTax16\Transaction\TransitionTransactionStateResponse;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Transaction
24
  */
25
+ class Transaction extends ResourceAbstract
26
  {
27
  /**
28
  * Url path for calculations
37
  /**
38
  * Create Transaction
39
  *
40
+ * @param \OnePica\AvaTax16\Document\Request $documentRequest
41
+ * @return \OnePica\AvaTax16\Document\Response $documentResponse
42
  */
43
  public function createTransaction($documentRequest)
44
  {
45
+ $postUrl = $this->getConfig()->getBaseUrl() . self::TRANSACTION_URL_PATH;
46
  $postData = $documentRequest->toArray();
47
  $requestOptions = array(
48
  'requestType' => 'POST',
49
  'data' => $postData,
50
+ 'returnClass' => '\OnePica\AvaTax16\Document\Response'
51
  );
52
+ $documentResponse = $this->sendRequest($postUrl, $requestOptions);
53
  return $documentResponse;
54
  }
55
 
60
  * @param string $documentCode
61
  * @param bool $recalculate
62
  * @param string $comment
63
+ * @return \OnePica\AvaTax16\Document\Response $documentResponse
64
  */
65
  public function createTransactionFromCalculation($transactionType, $documentCode, $recalculate = null,
66
  $comment = null)
87
  $requestOptions = array(
88
  'requestType' => 'POST',
89
  'data' => $postData,
90
+ 'returnClass' => '\OnePica\AvaTax16\Document\Response'
91
  );
92
+ $documentResponse = $this->sendRequest($postUrl, $requestOptions);
93
  return $documentResponse;
94
  }
95
 
98
  *
99
  * @param string $transactionType
100
  * @param string $documentCode
101
+ * @return \OnePica\AvaTax16\Document\Response $documentResponse
102
  */
103
  public function getTransaction($transactionType, $documentCode)
104
  {
116
 
117
  $requestOptions = array(
118
  'requestType' => 'GET',
119
+ 'returnClass' => '\OnePica\AvaTax16\Document\Response'
120
  );
121
+ $documentResponse = $this->sendRequest($getUrl, $requestOptions);
122
  return $documentResponse;
123
  }
124
 
130
  * @param string $startDate
131
  * @param string $endDate
132
  * @param string $startCode (not implemented)
133
+ * @return \OnePica\AvaTax16\Transaction\ListResponse $transactionListResponse
134
  */
135
  public function getListOfTransactions($transactionType, $limit = null, $startDate = null, $endDate = null,
136
  $startCode = null)
155
  $requestOptions = array(
156
  'requestType' => 'GET',
157
  'data' => $filterData,
158
+ 'returnClass' => '\OnePica\AvaTax16\Transaction\ListResponse'
159
  );
160
+ $transactionListResponse = $this->sendRequest($getUrl, $requestOptions);
161
  return $transactionListResponse;
162
  }
163
 
166
  *
167
  * @param string $transactionType
168
  * @param string $documentCode
169
+ * @return \OnePica\AvaTax16\Document\Request $transactionInput
170
  */
171
  public function getTransactionInput($transactionType, $documentCode)
172
  {
185
 
186
  $requestOptions = array(
187
  'requestType' => 'GET',
188
+ 'returnClass' => '\OnePica\AvaTax16\Document\Request'
189
  );
190
+ $transactionInput = $this->sendRequest($getUrl, $requestOptions);
191
  return $transactionInput;
192
  }
193
 
198
  * @param string $documentCode
199
  * @param string $type
200
  * @param string $comment
201
+ * @return \OnePica\AvaTax16\Transaction\TransitionTransactionStateResponse $transitionTransactionStateResponse
202
  */
203
  public function transitionTransactionState($transactionType, $documentCode, $type, $comment)
204
  {
220
  'comment' => $comment
221
  );
222
 
223
+ $curl = $this->getCurlObjectWithHeaders();
224
  $curl->post($postUrl, $postData);
225
+ $transitionTransactionStateResponse = new TransitionTransactionStateResponse();
226
+ $this->setErrorDataToResponseIfExists($transitionTransactionStateResponse, $curl);
227
  $transitionTransactionStateResponse->setHttpStatus($curl->getHttpStatusCode());
228
  return $transitionTransactionStateResponse;
229
  }
lib/OnePica/AvaTax16/Transaction/ListItemResponse.php CHANGED
@@ -11,15 +11,17 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Transaction_ListItemResponse
21
  */
22
- class OnePica_AvaTax16_Transaction_ListItemResponse
23
- extends OnePica_AvaTax16_Calculation_ListItemResponse
24
  {
25
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Transaction;
19
+
20
+ use OnePica\AvaTax16\Calculation\ListItemResponse as CalculationListItemResponse;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Transaction\ListItemResponse
24
  */
25
+ class ListItemResponse extends CalculationListItemResponse
 
26
  {
27
  }
lib/OnePica/AvaTax16/Transaction/ListResponse.php CHANGED
@@ -11,41 +11,51 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Transaction_ListResponse
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Transaction_ListResponse extends OnePica_AvaTax16_Document_Part
23
  {
24
  /**
25
  * Has error
26
  *
27
  * @var bool
28
  */
29
- protected $_hasError = false;
30
 
31
  /**
32
  * Errors
33
  *
34
  * @var array
35
  */
36
- protected $_errors;
37
 
38
  /**
39
  * List items
40
  *
41
- * @var OnePica_AvaTax16_Transaction_ListItemResponse[]
42
  */
43
- protected $_items;
44
 
45
  /**
46
  * Fill data from object
47
  *
48
- * @param StdClass|array $data
49
  * @return $this
50
  */
51
  public function fillData($data)
@@ -53,7 +63,7 @@ class OnePica_AvaTax16_Transaction_ListResponse extends OnePica_AvaTax16_Documen
53
  $result = array();
54
  if (is_array($data)) {
55
  foreach ($data as $dataItem) {
56
- $calculationListItem = new OnePica_AvaTax16_Transaction_ListItemResponse();
57
  $result[] = $calculationListItem->fillData($dataItem);
58
  }
59
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Transaction;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Transaction\ListResponse
24
+ *
25
+ * @method bool getHasError()
26
+ * @method setHasError(bool $value)
27
+ * @method array getErrors()
28
+ * @method setErrors(array $value)
29
+ * @method array getItems()
30
+ * @method setItems(array $value)
31
  */
32
+ class ListResponse extends Part
33
  {
34
  /**
35
  * Has error
36
  *
37
  * @var bool
38
  */
39
+ protected $hasError = false;
40
 
41
  /**
42
  * Errors
43
  *
44
  * @var array
45
  */
46
+ protected $errors = array();
47
 
48
  /**
49
  * List items
50
  *
51
+ * @var \OnePica\AvaTax16\Transaction\ListItemResponse[]
52
  */
53
+ protected $items;
54
 
55
  /**
56
  * Fill data from object
57
  *
58
+ * @param \StdClass|array $data
59
  * @return $this
60
  */
61
  public function fillData($data)
63
  $result = array();
64
  if (is_array($data)) {
65
  foreach ($data as $dataItem) {
66
+ $calculationListItem = new ListItemResponse();
67
  $result[] = $calculationListItem->fillData($dataItem);
68
  }
69
  }
lib/OnePica/AvaTax16/Transaction/TransitionTransactionStateResponse.php CHANGED
@@ -11,35 +11,44 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
 
 
 
18
 
19
  /**
20
- * Class OnePica_AvaTax16_Transaction_TransitionTransactionStateResponse
 
 
 
 
 
 
 
21
  */
22
- class OnePica_AvaTax16_Transaction_TransitionTransactionStateResponse
23
- extends OnePica_AvaTax16_Document_Part
24
  {
25
  /**
26
  * Has error
27
  *
28
  * @var bool
29
  */
30
- protected $_hasError = false;
31
 
32
  /**
33
  * Errors
34
  *
35
  * @var array
36
  */
37
- protected $_errors;
38
 
39
  /**
40
  * Http Status (code)
41
  *
42
  * @var int
43
  */
44
- protected $_httpStatus;
45
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
+ namespace OnePica\AvaTax16\Transaction;
19
+
20
+ use OnePica\AvaTax16\Document\Part;
21
 
22
  /**
23
+ * Class \OnePica\AvaTax16\Transaction\TransitionTransactionStateResponse
24
+ *
25
+ * @method bool getHasError()
26
+ * @method setHasError(bool $value)
27
+ * @method array getErrors()
28
+ * @method setErrors(array $value)
29
+ * @method int getHttpStatus()
30
+ * @method setHttpStatus(int $value)
31
  */
32
+ class TransitionTransactionStateResponse extends Part
 
33
  {
34
  /**
35
  * Has error
36
  *
37
  * @var bool
38
  */
39
+ protected $hasError = false;
40
 
41
  /**
42
  * Errors
43
  *
44
  * @var array
45
  */
46
+ protected $errors = array();
47
 
48
  /**
49
  * Http Status (code)
50
  *
51
  * @var int
52
  */
53
+ protected $httpStatus;
54
  }
lib/OnePica/autoload.php CHANGED
@@ -11,8 +11,8 @@
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
- * @package OnePica_AvaTax
15
- * @copyright Copyright (c) 2015 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
 
@@ -26,13 +26,13 @@ spl_autoload_register(
26
  * @param string $className
27
  */
28
  function ($className) {
29
- $classPath = explode('_', $className);
30
  if ($classPath[0] != 'OnePica') {
31
  return;
32
  }
33
- // Drop 'OnePica', and maximum class file path depth in this project is 8.
34
- $classPath = array_slice($classPath, 1, 8);
35
- $filePath = dirname(__FILE__) . '/' . implode('/', $classPath) . '.php';
36
  if (file_exists($filePath)) {
37
  require_once($filePath);
38
  }
11
  * to codemaster@onepica.com so we can send you a copy immediately.
12
  *
13
  * @category OnePica
14
+ * @package OnePica_AvaTax16
15
+ * @copyright Copyright (c) 2016 One Pica, Inc. (http://www.onepica.com)
16
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
  */
18
 
26
  * @param string $className
27
  */
28
  function ($className) {
29
+ $classPath = explode('\\', $className);
30
  if ($classPath[0] != 'OnePica') {
31
  return;
32
  }
33
+ // Drop 'OnePica'
34
+ $classPath = array_slice($classPath, 1);
35
+ $filePath = dirname(__FILE__) . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $classPath) . '.php';
36
  if (file_exists($filePath)) {
37
  require_once($filePath);
38
  }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>OnePica_AvaTax</name>
4
- <version>3.2.1</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL 3.0)</license>
7
  <channel>community</channel>
@@ -18,11 +18,17 @@ Released as a commercial extension, this software will not work unless you have
18
  &#xD;
19
  &#xD;
20
  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>
21
- <notes>Fixed issue: special Jurisdiction taxes with the same name overrides each other in tax summary</notes>
 
 
 
 
 
 
22
  <authors><author><name>Rostyslav Redko</name><user>marketing</user><email>avalara@onepica.com</email></author></authors>
23
- <date>2016-05-10</date>
24
- <time>08:54:19</time>
25
- <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="5f96ca490c5f7bd3fac23e30b00336e5"/></dir><dir name="Log"><file name="Grid.php" hash="3a87a71f7f51b3247a0717f0b3f8abf0"/><file name="View.php" hash="097d82a3e2b1a8820d335a63f212451b"/></dir><dir name="Queue"><file name="Grid.php" hash="1ef8ba9bf3e0870ea6dc50bb202a0b91"/></dir></dir><dir name="Notification"><file name="Toolbar.php" hash="26f7e382432289c3ff07647141cf9324"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Export.php" hash="3e019b9551b95c71f4cfd67a14d62a27"/></dir></dir></dir></dir><dir name="Tax"><dir name="Class"><dir name="Edit"><file name="Form.php" hash="0e78c592366ee2746f3891cf91a388d3"/></dir><file name="Grid.php" hash="d731eb160457b8a22cfcd28682a1c485"/></dir></dir></dir><dir name="Checkout"><dir name="Onepage"><dir name="Shipping"><dir name="Method"><file name="Available.php" hash="a0bdc5f63955148cf7e755c8803e01de"/></dir></dir></dir></dir></dir><file name="Exception.php" hash="fc752f8da808a402baae2425c4072d22"/><dir name="Helper"><file name="Address.php" hash="df731a75957cf712d0b1410b1d831dd6"/><file name="Calculation.php" hash="3a3bcbd4a33a061700c495a14afd8b3a"/><file name="Config.php" hash="b7a48f682638fca9b53e2db1460e45f4"/><file name="Data.php" hash="447fc46dcdc7ff5b97ed69125845f8a3"/><file name="Errors.php" hash="1fc34a932db296ecd1617a4e50e150d7"/><file name="Lib.php" hash="ce05e31b4aba7ba84bfc016df8c2a559"/><file name="RequestFilter.php" hash="6806cce9e1ff8ed7b821c4501ee15499"/><dir name="Tax"><file name="Data.php" hash="ce4688b06cabe61ac43993fc77a175ca"/></dir></dir><dir name="Model"><dir name="Action"><file name="Abstract.php" hash="de2bc126be0cfe69ffe6af60a8307d16"/><file name="Calculator.php" hash="3d189195c43305879bd351334a8811e9"/><file name="Creditmemo.php" hash="23639271a8fad749a3ee3a13fc8b0b27"/><file name="Invoice.php" hash="20458660bda4a277c0677b1406feb481"/><file name="Ping.php" hash="7e08308fff72493e0cb75b9244551de6"/><file name="Validator.php" hash="003f31bbb0a381b770f71f8b2de7f214"/></dir><dir name="Admin"><file name="Session.php" hash="e3dc3353c7eebf4e17c22ea4039585c5"/></dir><dir name="Adminhtml"><file name="Config.php" hash="388f532f03fa8dacc9fde122a2fe0c64"/><dir name="Sales"><dir name="Order"><file name="Create.php" hash="2a1b42b629b8da1373e11860c4a2c8c0"/></dir></dir></dir><dir name="Export"><dir name="Adapter"><file name="Abstract.php" hash="840c8b87acd97646572bba9bb3b8f5ea"/><file name="Sql.php" hash="0e9bedb400f411785311f78ebbf676da"/></dir><dir name="Entity"><file name="Abstract.php" hash="d38a2293452c31e92f81bf5be59c3e1c"/><file name="Log.php" hash="7788a9f5bfa13e39d98c9a9ac72508e2"/><file name="Queue.php" hash="14a97c283aa74f97982ab71160017aa3"/></dir></dir><file name="Export.php" hash="b94613b678b413d6268b07d314ba122e"/><dir name="Observer"><file name="Abstract.php" hash="4cef8e34c047b97e34ab08b0c937082c"/><file name="AdminSystemConfigChangedSectionTax.php" hash="d2d68bef7a9ef50be4c58b4498f81cb1"/><file name="CheckoutSubmitAllAfter.php" hash="4ee09c54a9098b568dac726964d782c0"/><file name="CheckoutTypeMultishippingCreateOrdersSingle.php" hash="eeaffffddd4e2ce387325dfb58381a77"/><file name="CleanLog.php" hash="4043bb0a3df982b756bfb1dfab5d56de"/><file name="ControllerActionLayoutGenerateXmlBefore.php" hash="d533cdc23c1749c87bccdb1e8fd7f947"/><file name="ControllerActionLayoutLoadBefore.php" hash="d2308911f499841ba9c449045b3e4220"/><file name="ControllerActionPostdispatchCheckoutMultishippingAddressEditShipping.php" hash="646fa503d7277c363b4613692f978d12"/><file name="ControllerActionPostdispatchCheckoutOnepageSaveShippingMethod.php" hash="0b600e585f4b008e457995676019c2b4"/><file name="ControllerActionPredispatchAdminhtmlSalesOrderCreateLoadBlock.php" hash="07ef318adffde6bba762da8300e17324"/><file name="ControllerActionPredispatchCheckoutCartEstimatePost.php" hash="2b2cce8f619488fd795a027b80d20d2a"/><file name="ControllerActionPredispatchCheckoutMultishippingAddressEditShippingPost.php" hash="3c0e54aaeec84c7a780f9159d17bf345"/><file name="ControllerActionPredispatchCheckoutMultishippingIndex.php" hash="d6d7a1d0272c51f3ec4cacbce8574da3"/><file name="ControllerActionPredispatchCheckoutOnepageIndex.php" hash="01c4280273e34a2f82ed6764792f3568"/><file name="LoadAvaTaxExternalLib.php" hash="0b10ed2f15ef8202362f4828fad15262"/><file name="MultishippingSetShippingItems.php" hash="b39fa0fb0579f5143d34f159048f39c3"/><file name="ProcessQueue.php" hash="35375793d039f6848e7b2af05e0eef41"/><file name="SalesModelServiceQuoteSubmitAfter.php" hash="6499cfe8e1c9176b12af58c0bce331eb"/><file name="SalesModelServiceQuoteSubmitBefore.php" hash="4e67278a1c20a969f8709237f817b6e0"/><file name="SalesOrderCreditmemoRefund.php" hash="3e9049e39b53ec06b8aa1ab274d1e00d"/><file name="SalesOrderCreditmemoSaveAfter.php" hash="a01af2f4a66912383b772be42fddbdea"/><file name="SalesOrderInvoicePay.php" hash="ac7884c312f986d123912f01346b031a"/><file name="SalesOrderInvoiceSaveAfter.php" hash="00279b77e0a3bbac120b9248d6f9223d"/><file name="SalesQuoteCollectTotalsBefore.php" hash="c0ae978e4895cec8a1b4c1ec2a3a5522"/></dir><dir name="Records"><file name="Log.php" hash="58e639c307610488a609c3aa39c38514"/><dir name="Mysql4"><dir name="Log"><file name="Collection.php" hash="29db8163f4dda862ff822ddffd04554d"/></dir><file name="Log.php" hash="d6fb7997768b7e0f1b39363fd4de5917"/><dir name="Queue"><file name="Collection.php" hash="11bba1561c81f39695f091b94bd81560"/></dir><file name="Queue.php" hash="12ba62949dab080c6dc6ae7fcbbf4838"/></dir><dir name="Queue"><file name="Process.php" hash="82d837f47b78b4a037938dd88dfe3217"/></dir><file name="Queue.php" hash="2906b0c99e686f2e85169cbd49c8af2e"/></dir><dir name="Sales"><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Tax.php" hash="680493de15a25919bf5ddff14b8a01fb"/></dir></dir><file name="Address.php" hash="7a9717d123bba20ce14144b80d1da5da"/></dir></dir><dir name="Service"><dir name="Abstract"><file name="Config.php" hash="2b5ebe4312f82b0c13b03db2c261964f"/><file name="Tools.php" hash="8338336a7dccd05c3956f93363a35d6d"/></dir><file name="Abstract.php" hash="29cee53a912adeb0f682bc931972823d"/><dir name="Avatax"><file name="Abstract.php" hash="629fc49a518505a87f1548c3b29ef666"/><file name="Address.php" hash="5f6d2257e4132a436dff7cc0cc08eb67"/><file name="Config.php" hash="25198070b781c8ce632b4f3d3c3b21e0"/><file name="Estimate.php" hash="9f925a78f3ca4019b40a2877801201f9"/><file name="Invoice.php" hash="856a2a33ee05d1f58bd5cde0171b3254"/><file name="Ping.php" hash="8dd09babe7e8b206564544b2ace9a661"/><file name="Tax.php" hash="3002e239f7f5a84f3377d288861cf4d2"/></dir><file name="Avatax.php" hash="b6fa49f95a3ab05546bd597689a14ed7"/><dir name="Avatax16"><file name="Abstract.php" hash="9b061b6d7bebc7539efa4a33789c23e2"/><file name="Address.php" hash="834681944f93504537e26217f9690cd5"/><file name="Config.php" hash="34c888b2db0c2c72bfea6ddad0dbf053"/><file name="Estimate.php" hash="441aaa66270e9a820774710776894b71"/><file name="Invoice.php" hash="dd62073b8f573932c3ee9c5cb8fffe0b"/><file name="Ping.php" hash="853a6c8078296263adc241befc5eaa92"/><file name="Tax.php" hash="0680fb53318af5eac219909162657037"/></dir><file name="Avatax16.php" hash="cd3743c413edb08904781900c0064eaf"/><dir name="Exception"><file name="Address.php" hash="2519f1a2b302db97337c933d99a6d116"/><file name="Commitfailure.php" hash="7f0c5a5bf9242651d2542336d0b4cb96"/><file name="Unbalanced.php" hash="43595e010b314e8a91dd0fef4fad96c2"/></dir><dir name="Result"><file name="Address.php" hash="7a711e27f7f5e478a8a290a1880586f6"/><file name="AddressValidate.php" hash="62d14d7f4147b83001ef7f64726276c1"/><file name="Creditmemo.php" hash="8b1ac1eda1a522c70bca574b938c6359"/><file name="Invoice.php" hash="83f157b7fd24e5e6c0b51f6a162ee316"/></dir></dir><file name="Service.php" hash="7fda34c9ce1db70ae9757561d505a5b7"/><file name="Session.php" hash="429142089e75418a702e70edc56374cf"/><dir name="Source"><file name="Actions.php" hash="b5392f0820f15c3159e76ea67148992a"/><file name="Addressvalidation.php" hash="c8430082f4ae4c22c533e586e5652506"/><dir name="Avatax"><file name="Actions.php" hash="c72aa0df9013c6d5c5fddc0c4b4027b0"/><file name="Logtype.php" hash="0bdc9563eeaa30b7c4ae301a79613375"/><file name="Url.php" hash="cff45c6a590360711867112533b068d8"/></dir><dir name="Avatax16"><file name="Actions.php" hash="86b7d4067faad9478f9b61101d0fd6ae"/><file name="Buyertype.php" hash="6b029a7bbacc0eda36ed4fbb6f6e467b"/><file name="Logtype.php" hash="4e3447c8b79faf0ca20e66d9a66d29df"/><file name="Url.php" hash="ef6524ae8f04b9cc63f0f6e8ba4e63ea"/><file name="Usetype.php" hash="107c03d384fb6a8b990e4c16f49fab87"/></dir><file name="Customercodeformat.php" hash="cfcfcbaa27ed29add072324816da0c9d"/><file name="Error.php" hash="7f5495a2f295ded2d0a30f2f7108d009"/><file name="Fieldlist.php" hash="18987603d4d58130959a8ac76716ed08"/><file name="Logmode.php" hash="24d61da578a3b4adb896fea7d4d4d8ec"/><file name="Logtype.php" hash="2bd6decac6b972549d4bdfe2c8968d51"/><file name="Onerrorfrontend.php" hash="ef4154ae563d8157c1083f20e0adf563"/><dir name="Regionfilter"><file name="List.php" hash="d73ebe7197a2c6cfa45d52775d6f0977"/><file name="Mode.php" hash="2216d28bf9adba614025538cc62a49b6"/></dir><file name="Url.php" hash="794ec57a2b350931f70e95eb6677c253"/></dir><dir name="Tax"><file name="Calculation.php" hash="8b3ad0ace3967a13364d1475e286b70c"/><file name="Config.php" hash="f30f3801f7d94760121042a6dd85e383"/></dir><dir name="Total"><dir name="Quote"><dir name="Tax"><file name="Giftwrapping.php" hash="7b264455ac9084a751468ef6dbc36fe5"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="AvaTax"><file name="ExportController.php" hash="ead5ebea03db8f885d0ec6114dcb185c"/><file name="GridController.php" hash="5c7e822890a6feaec2db348e6c5a19e1"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="aca07ae89478c72fd1d2d41228c28b8e"/><file name="config.xml" hash="301cf15559fc5dc1fe302ba6bbb8ae0d"/><file name="system-avatax16-disabled.xml" hash="b24027def3daab9000047bf7fee41c4f"/><file name="system-avatax16.xml" hash="b5a9543409521633ceec2af4d9c5d1b7"/><file name="system-disabled.xml" hash="bf89784beaef115a1408bd6fa9547b6a"/><file name="system.xml" hash="e98e02663953acc15c9db405153bf1e8"/></dir><dir name="sql"><dir name="avatax_records_setup"><file name="mysql4-data-upgrade-2.2.0-2.2.1.php" hash="260d1c57754ebadba00d8ccdbb0ec996"/><file name="mysql4-install-0.1.0.php" hash="3d16899179b36bfde69609a99a2faae6"/><file name="mysql4-upgrade-0.1.4-0.1.5.php" hash="94d0cf2fc0e9bbe2de2829198ce3026f"/><file name="mysql4-upgrade-1.0.1-2.0.0.php" hash="905d7519328cdb1c46bba4221288c41c"/><file name="mysql4-upgrade-2.5.0.0-2.5.0.1.php" hash="4b439957397049bbe01d458fd7cfe0a2"/><file name="mysql4-upgrade-3.0.0.1-3.0.0.2.php" hash="46caa743f17221575b4a639b262a9275"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="OnePica_AvaTax.xml" hash="07fd9423811b4dc084060d6131b889d7"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="onepica"><file name="avatax.xml" hash="de338ca651fcce096d089b2bbbcc1374"/></dir></dir><dir name="template"><dir name="onepica"><dir name="avatax"><dir name="log"><file name="view.phtml" hash="df14eee805bbedd484cf500dbf2335ed"/></dir><dir name="notification"><file name="toolbar.phtml" hash="fd368e043843df76ec3a74290b87dc3e"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="onepica"><file name="avatax.xml" hash="38c6ce2165f6ccfd6641eb1487faad39"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="OnePica_AvaTax.csv" hash="43d2dee74aee6f15abd471a65b4f407c"/></dir><dir name="en_US"><file name="OnePica_AvaTax.csv" hash="43d2dee74aee6f15abd471a65b4f407c"/></dir><dir name="es_ES"><file name="OnePica_AvaTax.csv" hash="43d2dee74aee6f15abd471a65b4f407c"/></dir><dir name="fr_FR"><file name="OnePica_AvaTax.csv" hash="43d2dee74aee6f15abd471a65b4f407c"/></dir><dir name="nl_NL"><file name="OnePica_AvaTax.csv" hash="43d2dee74aee6f15abd471a65b4f407c"/></dir><dir name="pt_BR"><file name="OnePica_AvaTax.csv" hash="43d2dee74aee6f15abd471a65b4f407c"/></dir><dir name="zh_CN"><file name="OnePica_AvaTax.csv" hash="43d2dee74aee6f15abd471a65b4f407c"/></dir></target><target name="magelib"><dir name="AvaTax"><file name="AvaTax.php" hash="4d841acee4dab29ff39317cea6858e0d"/><dir name="classes"><file name="ATConfig.class.php" hash="4bc7673d3d65e38a2d80b1884e27f301"/><file name="ATObject.class.php" hash="83359fd7639c98449836dc11d08c899d"/><file name="AccountServiceSoap.class.php" hash="7049f00dfb40529e2cf7447f0cd5461e"/><file name="Address.class.php" hash="68bf4fe1306a60e672b7345a0dc7fcc6"/><file name="AddressServiceSoap.class.php" hash="c59bf4a586da207611f7bace4f08c880"/><file name="AddressType.class.php" hash="62c9ff3c533aaf5ad1fd4de95702be40"/><file name="AdjustTaxRequest.class.php" hash="47dbfa8044ca893bf214d8e71ab4864e"/><file name="AdjustTaxResult.class.php" hash="cf63aa5b7c3b52b3ec86695c4cdf0fcc"/><file name="ApplyPaymentRequest.class.php" hash="69d69dff63cbd284d8aea62247142692"/><file name="ApplyPaymentResult.class.php" hash="0e37bda0f1221c2ed2432717a2d8cc08"/><dir name="AvaCert2Svc"><file name="AvaCert2Soap.class.php" hash="0567793d9e4e496b45c3e8a0459f944a"/><file name="Certificate.class.php" hash="dd3f0dd2a2b03c97552f9dbd5c6463ba"/><file name="CertificateGetRequest.class.php" hash="4c11fd111cab99fa4dbc2c2250e0f3ad"/><file name="CertificateGetResult.class.php" hash="6a95a06e71bd13839c6142bba08bfba5"/><file name="CertificateImageGetRequest.class.php" hash="32f61011abe3d1c74ea7fc209e3e4224"/><file name="CertificateImageGetResult.class.php" hash="beda0f1fd54951b84b7dd77ead92bda3"/><file name="CertificateJurisdiction.class.php" hash="e666d572fb34d17fcd91127a50616195"/><file name="CertificateRequest.class.php" hash="7b76dc3675e507975ae6cf01abfa6059"/><file name="CertificateRequestGetRequest.class.php" hash="0cf2fafae88f795a754d75291947cb56"/><file name="CertificateRequestGetResult.class.php" hash="eceffe3acec787506649669b1b5edcf7"/><file name="CertificateRequestInitiateRequest.class.php" hash="148a5c4c881c885be863f403582b4974"/><file name="CertificateRequestInitiateResult.class.php" hash="a7a55cb398cd2fb9f0e11b8c6b09498d"/><file name="CertificateRequestStage.class.php" hash="92dec7da28f83f1a419d9573e6cec1fa"/><file name="CertificateRequestStatus.class.php" hash="a5d5c1629ce4f5ee0c18a8924204ca22"/><file name="CertificateStatus.class.php" hash="6ae43ab57ae9df37d07ac4203270c25e"/><file name="CertificateUsage.class.php" hash="bad34570daa7679b267f1288bf0a371f"/><file name="CommunicationMode.class.php" hash="71d2743c1d2afffe11d2903e89ff9c0e"/><file name="Customer.class.php" hash="e9f13f38f75cb4e1b845c55e6f26a5ab"/><file name="CustomerSaveRequest.class.php" hash="58ff71b04bb3a308b7f0199c6fae1e56"/><file name="CustomerSaveResult.class.php" hash="98cf79bdb7c0558963670b21e66b7d85"/><file name="FormatType.class.php" hash="714d183d3d365a07ef606d1211c732b0"/><file name="RequestType.class.php" hash="6144c2731baaf67400ea34e50440c1df"/><file name="ReviewStatus.class.php" hash="0dd208ecbf6b45196f51f304b1d48b03"/></dir><file name="AvalaraSoapClient.class.php" hash="dd605cefabb4396ef1b46b6d23b439b5"/><file name="BaseResult.class.php" hash="b672ec2ce2c6b5cf5cce7ce733aff482"/><dir name="BatchSvc"><file name="AuditMessage.class.php" hash="798d8169506357af02e6912b4bca9148"/><file name="AvaTaxBatchSvc.php" hash="8d65fd4a02cd4fc1104aa9c24b35e4fb"/><file name="BaseResult.class.php" hash="727ef623b821e95a73cf6d1eda891379"/><file name="Batch.class.php" hash="c028822bcf2a4f1fae6fc7dca76f247a"/><file name="BatchDelete.class.php" hash="0bcff09309ccad969d65c2d27fa63dda"/><file name="BatchDeleteResponse.class.php" hash="46afd464673459efb54ccaf509d37eef"/><file name="BatchFetch.class.php" hash="74f96ecc3c2df87271d60c4c969e43f8"/><file name="BatchFetchResponse.class.php" hash="b2acf63deea2c0fd374f80745b60fef5"/><file name="BatchFetchResult.class.php" hash="83d8de067f4bd59acafe4cd065f90163"/><file name="BatchFile.class.php" hash="65cee20383c8040fac1d4c45bbe757dd"/><file name="BatchFileDelete.class.php" hash="01d0bc10cb0ada43a9a00ca0efffef17"/><file name="BatchFileDeleteResponse.class.php" hash="b4e7881d26b7071303650973144f418b"/><file name="BatchFileFetch.class.php" hash="c5e91b8073fb756545d0f74803fdf3d6"/><file name="BatchFileFetchResponse.class.php" hash="c37ce819a975cdae5e7a82432b4b2334"/><file name="BatchFileFetchResult.class.php" hash="6bc54523d34356a83cdc4ecd2f696ea5"/><file name="BatchFileSave.class.php" hash="8434b0ffdd1fba4991535248ee3d618e"/><file name="BatchFileSaveResponse.class.php" hash="d52f79b42467b59f2177359f8a73cd3a"/><file name="BatchFileSaveResult.class.php" hash="19d3a2f20ccc42e80759b280842cf03c"/><file name="BatchProcess.class.php" hash="44d9efe13d01fce15bd444e5729b320c"/><file name="BatchProcessRequest.class.php" hash="04684b987c6d77319cc6881941091de9"/><file name="BatchProcessResponse.class.php" hash="c22b08c125eefc4006495c55984ed91e"/><file name="BatchProcessResult.class.php" hash="f9cac2270aafae49fc0892ea729c3713"/><file name="BatchSave.class.php" hash="d3a397348b905d49a0c91be780f3ec04"/><file name="BatchSaveResponse.class.php" hash="4c3088b85590fd697b5686aa1dddd89e"/><file name="BatchSaveResult.class.php" hash="7ea7fe3dc7d580711f6b52d991c43dce"/><file name="BatchSvc.class.php" hash="fa903f70b06d1e3b86384f2b6fb60616"/><file name="DeleteRequest.class.php" hash="43f945ef1e59ef02494df6df6ec3d1b6"/><file name="DeleteResult.class.php" hash="f7d64582f1182ae0337d6d84a5f60e8d"/><file name="FetchRequest.class.php" hash="7271317a8909672261ea0e00867e810b"/><file name="FilterRequest.class.php" hash="3c1eaec68f84531931a3cd6143533576"/><file name="FilterResult.class.php" hash="f4c0eeac0153b735ec589fcff7accd86"/><file name="IsAuthorized.class.php" hash="8339a2b249d954efaaf64f10665976fc"/><file name="IsAuthorizedResponse.class.php" hash="613c91f36370dc38ca07b83a29f2a45f"/><file name="IsAuthorizedResult.class.php" hash="65f9665508a5e7f33e4aee2835a9806e"/><file name="Message.class.php" hash="576327c8d9cd74bd96d9ccd62a2daa5b"/><file name="Ping.class.php" hash="3a2246f5557a5279fa260c65b36a9b44"/><file name="PingResponse.class.php" hash="b9f5e8b43382ee605d93768db8af1805"/><file name="PingResult.class.php" hash="2e05acfe74aad28003ad7d8ed102c3c6"/><file name="Profile.class.php" hash="a16a4819018dd8510ddab8feb9ee0f7e"/><file name="SeverityLevel.class.php" hash="5736530f3b5fd0cd932c783418563647"/></dir><file name="BoundaryLevel.class.php" hash="e9c2f2e3173e44fa8351f2a6dbb578fe"/><file name="CancelCode.class.php" hash="fd0b8ad2865e8fcf622b1faafc677527"/><file name="CancelTaxRequest.class.php" hash="08a114e32ec9eda9268ec337f79cb86f"/><file name="CancelTaxResult.class.php" hash="687be65bab85e6c6e8f99764c0475d9b"/><file name="CommitTaxRequest.class.php" hash="66ef55bc094d233b75e36b029995aed7"/><file name="CommitTaxResult.class.php" hash="ef90276817207e63e4e96ea518618f50"/><file name="DetailLevel.class.php" hash="2439f7137a4f9f52e28a6b321c4bcf16"/><file name="DocStatus.class.php" hash="9e3384a0f2ace05fa67fe05eba295fcd"/><file name="DocumentType.class.php" hash="0578e29121cb747e1e80a269eedd4b5a"/><file name="DynamicSoapClient.class.php" hash="5bb36f2d4db3955ae059488eb9511ca9"/><file name="Enum.class.php" hash="d3ff4c898aff49f3c425042433826257"/><file name="GetTaxHistoryRequest.class.php" hash="3ed4c54de1e015f476ce7aa58c802468"/><file name="GetTaxHistoryResult.class.php" hash="7e8209e1f64df52b538927312b1bd934"/><file name="GetTaxRequest.class.php" hash="7267cb5676ecbcbbb0b73c587b082b57"/><file name="GetTaxResult.class.php" hash="7e2b7415a018fd76b62ab49637833533"/><file name="IsAuthorizedResult.class.php" hash="58164457677a61e93309f788fe61dc0c"/><file name="JurisdictionType.class.php" hash="a345fe5db379af87a6f7ec833ff86586"/><file name="Line.class.php" hash="7fefbd0230ee2fe8a8e6468abf338b80"/><file name="Message.class.php" hash="073be6cbcccacf2d1d55a04c045eab63"/><file name="PingResult.class.php" hash="18f88589588f08b619488c926cf5547c"/><file name="PostTaxRequest.class.php" hash="be8ea4ee2fddb10b62cb1be7e38179e3"/><file name="PostTaxResult.class.php" hash="bf2ee0b1293301ee00ac9b8b8390e780"/><file name="ReconcileTaxHistoryRequest.class.php" hash="41f2cfe04495612a9c293b1bc19220ce"/><file name="ReconcileTaxHistoryResult.class.php" hash="dd20684e0e017f56c98e29297180a0d7"/><file name="SearchTaxHistoryResult.class.php" hash="e3171e00482f7c2c0ed9753ffd05cd14"/><file name="ServiceMode.class.php" hash="0c66b3e25f4466461cebf32735e207e0"/><file name="SeverityLevel.class.php" hash="68fc81e651fe7f01c81b43b0d28ff0dc"/><file name="TaxDetail.class.php" hash="56065f8ea68505152b23e41238b80dfb"/><file name="TaxLine.class.php" hash="05376f01ad9a14f438ad0f1d5d423b61"/><file name="TaxOverride.class.php" hash="94d28efa3cdf58a87ba45a313ce93fc7"/><file name="TaxOverrideType.class.php" hash="d23f90c9ac639954c8fcee57ba763b21"/><file name="TaxRequest.class.php" hash="7339016da0c3cbe51843767987e7fbed"/><file name="TaxServiceSoap.class.php" hash="bc7e4eb0e66dd1bd956e19e0da337171"/><file name="TaxType.class.php" hash="ee87ecc8721076f0cda67fe1cc5b0db7"/><file name="TextCase.class.php" hash="8fb2eccc49eacdc1a4f5624c0716a750"/><file name="ValidAddress.class.php" hash="2f8eebcd379208198cd38632f1e34b0a"/><file name="ValidateRequest.class.php" hash="98faedd50b2f4ea7ffb9d53ab1ca116c"/><file name="ValidateResult.class.php" hash="23de6a26defed9324ddcdcedfd2228bf"/><dir name="wsdl"><file name="Account.wsdl" hash="1635751a852ff5c036e4522381101680"/><file name="Address.wsdl" hash="0650cb8f516bec67e57eb7fa05ee6433"/><file name="AvaCert2Svc.wsdl" hash="9ca666be9851884f3e7fc9e28dc08f4a"/><file name="AvaCertSvc.wsdl" hash="7fb2b12cfe320462cf094225454f0d6c"/><file name="BatchSvc.wsdl" hash="639d2913500639145d95ee8e1166e08f"/><file name="Tax.wsdl" hash="76e1ff6c041d12da77a4632f376422ed"/></dir></dir><file name="functions.php" hash="57734d162b59cbc65933d25bf3950270"/></dir><dir name="OnePica"><dir name="AvaTax16"><dir name="AddressResolution"><file name="PingResponse.php" hash="42cf1ee8601e559d025b009ecb7201b3"/><file name="ResolveSingleAddressResponse.php" hash="7305c3bbe38e5c440678361847c43e84"/><file name="TaxAuthority.php" hash="86b3584391c9ef8af8ffeda1b7162637"/></dir><file name="AddressResolution.php" hash="3acfa74ff528a1d50d539a756614137c"/><dir name="Calculation"><dir name="ListItemResponse"><dir name="CalculatedTaxSummary"><dir name="TaxByType"><file name="Details.php" hash="53ffdc3b1df7f9ffbe1418d863b279f9"/></dir><file name="TaxByType.php" hash="182d258bad391e4b82406d43dcf9eaca"/></dir><file name="CalculatedTaxSummary.php" hash="d4ae2eeb74d7641db65226f76ee965de"/><file name="Header.php" hash="846a2ef2aa31b271b864b908e43f59e5"/><file name="Line.php" hash="974554064e6a61a4e2b9ab6db5e2fd34"/><file name="ProcessingInfo.php" hash="6ea7c0a0c86036c648ef4e0476eea99e"/></dir><file name="ListItemResponse.php" hash="bbdc204f0d848e992119280761d8d7cc"/><file name="ListResponse.php" hash="2d15f8cdf48993d8ab90938cd4d37190"/></dir><file name="Calculation.php" hash="5311fefa3e82c63ef725f32f84a04aab"/><file name="Config.php" hash="5eb6a3001370bca29d977fe9b24800ea"/><dir name="Document"><dir name="Part"><dir name="Feedback"><file name="LatencyData.php" hash="4f5c765cf6d028bcb4107b01f2e5b807"/></dir><file name="Feedback.php" hash="fac9eb4e3478fc4386567cd41668e1e1"/><dir name="Location"><file name="Address.php" hash="15ee70c3901080d53cef56cd63d4cf57"/><file name="LatLong.php" hash="97b968fdca26d5a8f5602e4f28162190"/></dir><file name="Location.php" hash="6054bcad769a7d7287445aa590ef2a2d"/></dir><file name="Part.php" hash="b1ef99e465e25df5338080610daa977d"/><dir name="Request"><file name="Header.php" hash="92bac296417f904a70287dc55dee9d1c"/><file name="Line.php" hash="0acdeea9894a70410cb64398e90ab7d0"/></dir><file name="Request.php" hash="1440ad02232e98d286ce37f696a086a7"/><dir name="Response"><dir name="CalculatedTaxSummary"><dir name="TaxByType"><file name="Details.php" hash="b0bf6211fa2744285d3b42cd8660c8e5"/></dir><file name="TaxByType.php" hash="6a427c932fe5b60588864fcf5a0c81f2"/></dir><file name="CalculatedTaxSummary.php" hash="86c0321b176d6c52222f6d688408b87c"/><file name="Header.php" hash="787e68feae0eacc4b0359f66cd180cd1"/><dir name="Line"><dir name="CalculatedTax"><file name="Details.php" hash="5a80a57a785b7e4d9b2ce6c946319279"/><file name="TaxByType.php" hash="3267edf3a25c9313dc7f838da7669add"/></dir><file name="CalculatedTax.php" hash="f47fc24daeb236106e52c6309bc1f3e5"/></dir><file name="Line.php" hash="a068c319dfcdc79f63b8ad1291eaf3b2"/><file name="ProcessingInfo.php" hash="b175ab3cffde010db67a666a0ac1f6c6"/></dir><file name="Response.php" hash="b0d922b0a0ff81d9c690828e7149bc29"/></dir><file name="Exception.php" hash="62f3fb8c7fee6758dbf00e9a90053dde"/><dir name="IO"><file name="CaseInsensitiveArray.php" hash="5ff9551b29e56f6fe92ee4f802a983f3"/><file name="Curl.php" hash="90f0df8763a82d597fc0f93deaa13249"/></dir><file name="ResourceAbstract.php" hash="86bb4526bc73b7cf63d675c1f6eaac44"/><file name="TaxService.php" hash="03f1799cd82cd95e5412d4a2ac915361"/><dir name="Transaction"><file name="ListItemResponse.php" hash="3cbe80a9923a0b25e2350c4c6daaa3fc"/><file name="ListResponse.php" hash="491506f6f1e4044e14f1c43b2082a03a"/><file name="TransitionTransactionStateResponse.php" hash="7b9e0beb239ff0679a360d1d14945fba"/></dir><file name="Transaction.php" hash="282113bda5b0abe544fd58c844c9ee87"/></dir><file name="autoload.php" hash="997d00ba2d67253ec64a95c89c92c36b"/></dir></target></contents>
26
  <compatible/>
27
  <dependencies><required><php><min>5.2.3</min><max>6.0.0</max></php><extension><name>Core</name><min/><max/></extension><extension><name>curl</name><min/><max/></extension><extension><name>soap</name><min/><max/></extension></required></dependencies>
28
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>OnePica_AvaTax</name>
4
+ <version>3.2.2</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL 3.0)</license>
7
  <channel>community</channel>
18
  &#xD;
19
  &#xD;
20
  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>
21
+ <notes>Implemented show up plugin version in System configuration&#xD;
22
+ Fixed Unexpected tax class is used for simple child of configurable products&#xD;
23
+ Fixed Filter logs being saved in Log grid, although not selected in configuration&#xD;
24
+ Fixed Composer install issue&#xD;
25
+ Fixed Validation requests are not sent during Multiple checkout each time user changes Shipping address via Change button&#xD;
26
+ Fixed Invoice and Credit memo is sent from AvaTax Order Sync Queue to AvaTax admin Console after clicking "Process Queue Now" button when AvaTax is disabled&#xD;
27
+ Fixed Size, color attributes values are incorrect in GetTax request after they were configured in Data Mapping block</notes>
28
  <authors><author><name>Rostyslav Redko</name><user>marketing</user><email>avalara@onepica.com</email></author></authors>
29
+ <date>2016-06-02</date>
30
+ <time>13:14:09</time>
31
+ <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="5f96ca490c5f7bd3fac23e30b00336e5"/></dir><dir name="Log"><file name="Grid.php" hash="3a87a71f7f51b3247a0717f0b3f8abf0"/><file name="View.php" hash="097d82a3e2b1a8820d335a63f212451b"/></dir><dir name="Queue"><file name="Grid.php" hash="1ef8ba9bf3e0870ea6dc50bb202a0b91"/></dir></dir><dir name="Notification"><file name="Toolbar.php" hash="26f7e382432289c3ff07647141cf9324"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Export.php" hash="3e019b9551b95c71f4cfd67a14d62a27"/></dir></dir></dir></dir><dir name="Tax"><dir name="Class"><dir name="Edit"><file name="Form.php" hash="0e78c592366ee2746f3891cf91a388d3"/></dir><file name="Grid.php" hash="d731eb160457b8a22cfcd28682a1c485"/></dir></dir></dir><dir name="Checkout"><dir name="Onepage"><dir name="Shipping"><dir name="Method"><file name="Available.php" hash="a0bdc5f63955148cf7e755c8803e01de"/></dir></dir></dir></dir></dir><file name="Exception.php" hash="fc752f8da808a402baae2425c4072d22"/><dir name="Helper"><file name="Address.php" hash="1ec273c34d78731b51e7097dfe20ccfb"/><file name="Calculation.php" hash="3a3bcbd4a33a061700c495a14afd8b3a"/><file name="Config.php" hash="b7a48f682638fca9b53e2db1460e45f4"/><file name="Data.php" hash="447fc46dcdc7ff5b97ed69125845f8a3"/><file name="Errors.php" hash="1fc34a932db296ecd1617a4e50e150d7"/><file name="Lib.php" hash="ce05e31b4aba7ba84bfc016df8c2a559"/><file name="RequestFilter.php" hash="6806cce9e1ff8ed7b821c4501ee15499"/><dir name="Tax"><file name="Data.php" hash="ce4688b06cabe61ac43993fc77a175ca"/></dir></dir><dir name="Model"><dir name="Action"><file name="Abstract.php" hash="de2bc126be0cfe69ffe6af60a8307d16"/><file name="Calculator.php" hash="3d189195c43305879bd351334a8811e9"/><file name="Creditmemo.php" hash="23639271a8fad749a3ee3a13fc8b0b27"/><file name="Invoice.php" hash="20458660bda4a277c0677b1406feb481"/><file name="Ping.php" hash="7e08308fff72493e0cb75b9244551de6"/><file name="Validator.php" hash="17aa7c777560ee3598283493ec394715"/></dir><dir name="Admin"><file name="Session.php" hash="e3dc3353c7eebf4e17c22ea4039585c5"/></dir><dir name="Adminhtml"><file name="Config.php" hash="d1db594cea4853cafc049f324da7457b"/><dir name="Sales"><dir name="Order"><file name="Create.php" hash="2a1b42b629b8da1373e11860c4a2c8c0"/></dir></dir></dir><dir name="Export"><dir name="Adapter"><file name="Abstract.php" hash="840c8b87acd97646572bba9bb3b8f5ea"/><file name="Sql.php" hash="0e9bedb400f411785311f78ebbf676da"/></dir><dir name="Entity"><file name="Abstract.php" hash="d38a2293452c31e92f81bf5be59c3e1c"/><file name="Log.php" hash="7788a9f5bfa13e39d98c9a9ac72508e2"/><file name="Queue.php" hash="14a97c283aa74f97982ab71160017aa3"/></dir></dir><file name="Export.php" hash="b94613b678b413d6268b07d314ba122e"/><dir name="Observer"><file name="Abstract.php" hash="4cef8e34c047b97e34ab08b0c937082c"/><file name="AdminSystemConfigChangedSectionTax.php" hash="d2d68bef7a9ef50be4c58b4498f81cb1"/><file name="CheckoutSubmitAllAfter.php" hash="4ee09c54a9098b568dac726964d782c0"/><file name="CheckoutTypeMultishippingCreateOrdersSingle.php" hash="eeaffffddd4e2ce387325dfb58381a77"/><file name="CleanLog.php" hash="4043bb0a3df982b756bfb1dfab5d56de"/><file name="ControllerActionLayoutGenerateXmlBefore.php" hash="d533cdc23c1749c87bccdb1e8fd7f947"/><file name="ControllerActionLayoutLoadBefore.php" hash="d2308911f499841ba9c449045b3e4220"/><file name="ControllerActionPostdispatchCheckoutOnepageSaveShippingMethod.php" hash="0b600e585f4b008e457995676019c2b4"/><file name="ControllerActionPredispatchAdminhtmlSalesOrderCreateLoadBlock.php" hash="07ef318adffde6bba762da8300e17324"/><file name="ControllerActionPredispatchCheckoutCartEstimatePost.php" hash="2b2cce8f619488fd795a027b80d20d2a"/><file name="ControllerActionPredispatchCheckoutMultishippingIndex.php" hash="d6d7a1d0272c51f3ec4cacbce8574da3"/><file name="ControllerActionPredispatchCheckoutOnepageIndex.php" hash="01c4280273e34a2f82ed6764792f3568"/><file name="ControllerActionPredispatchCustomerAddressFormPost.php" hash="2fbb23b935a8ebd6c8db63d8f56768ea"/><file name="LoadAvaTaxExternalLib.php" hash="0b10ed2f15ef8202362f4828fad15262"/><file name="MultishippingSetShippingItems.php" hash="b39fa0fb0579f5143d34f159048f39c3"/><file name="ProcessQueue.php" hash="35375793d039f6848e7b2af05e0eef41"/><file name="SalesModelServiceQuoteSubmitAfter.php" hash="6499cfe8e1c9176b12af58c0bce331eb"/><file name="SalesModelServiceQuoteSubmitBefore.php" hash="4e67278a1c20a969f8709237f817b6e0"/><file name="SalesOrderCreditmemoRefund.php" hash="3e9049e39b53ec06b8aa1ab274d1e00d"/><file name="SalesOrderCreditmemoSaveAfter.php" hash="a01af2f4a66912383b772be42fddbdea"/><file name="SalesOrderInvoicePay.php" hash="ac7884c312f986d123912f01346b031a"/><file name="SalesOrderInvoiceSaveAfter.php" hash="00279b77e0a3bbac120b9248d6f9223d"/><file name="SalesQuoteCollectTotalsBefore.php" hash="c0ae978e4895cec8a1b4c1ec2a3a5522"/></dir><dir name="Records"><file name="Log.php" hash="58e639c307610488a609c3aa39c38514"/><dir name="Mysql4"><dir name="Log"><file name="Collection.php" hash="29db8163f4dda862ff822ddffd04554d"/></dir><file name="Log.php" hash="d6fb7997768b7e0f1b39363fd4de5917"/><dir name="Queue"><file name="Collection.php" hash="11bba1561c81f39695f091b94bd81560"/></dir><file name="Queue.php" hash="12ba62949dab080c6dc6ae7fcbbf4838"/></dir><dir name="Queue"><file name="Process.php" hash="2183d01eeaf07f14da0f319c1bbe5e5f"/></dir><file name="Queue.php" hash="2906b0c99e686f2e85169cbd49c8af2e"/></dir><dir name="Sales"><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Tax.php" hash="680493de15a25919bf5ddff14b8a01fb"/></dir></dir><file name="Address.php" hash="7a9717d123bba20ce14144b80d1da5da"/></dir></dir><dir name="Service"><dir name="Abstract"><file name="Config.php" hash="2b5ebe4312f82b0c13b03db2c261964f"/><file name="Tools.php" hash="0cb22ec9975f1a0a5b7b0eddf2d5111a"/></dir><file name="Abstract.php" hash="29cee53a912adeb0f682bc931972823d"/><dir name="Avatax"><file name="Abstract.php" hash="629fc49a518505a87f1548c3b29ef666"/><file name="Address.php" hash="5f6d2257e4132a436dff7cc0cc08eb67"/><file name="Config.php" hash="25198070b781c8ce632b4f3d3c3b21e0"/><file name="Estimate.php" hash="45667dd249513244eb054866457b16db"/><file name="Invoice.php" hash="9a20d14ea740751e09e2caa43dc1e22a"/><file name="Ping.php" hash="8dd09babe7e8b206564544b2ace9a661"/><file name="Tax.php" hash="3002e239f7f5a84f3377d288861cf4d2"/></dir><file name="Avatax.php" hash="b6fa49f95a3ab05546bd597689a14ed7"/><dir name="Avatax16"><file name="Abstract.php" hash="36c45dd983b7663019e7c928a7171b93"/><file name="Address.php" hash="8c09fc2da465ad3f0ac4d843ff61a793"/><file name="Config.php" hash="c38ca34431669793d6ee2a9e88d98b19"/><file name="Estimate.php" hash="7926340261d560429ff2dd42ce7c2c83"/><file name="Invoice.php" hash="a2ad0470dbae31d0d93af803dcb23524"/><file name="Ping.php" hash="8278e36dc22b1712b9d1c090ca6fead6"/><file name="Tax.php" hash="84e70803c77a23baaed89de4f2d4ea35"/></dir><file name="Avatax16.php" hash="cd3743c413edb08904781900c0064eaf"/><dir name="Exception"><file name="Address.php" hash="2519f1a2b302db97337c933d99a6d116"/><file name="Commitfailure.php" hash="7f0c5a5bf9242651d2542336d0b4cb96"/><file name="Unbalanced.php" hash="43595e010b314e8a91dd0fef4fad96c2"/></dir><dir name="Result"><file name="Address.php" hash="7a711e27f7f5e478a8a290a1880586f6"/><file name="AddressValidate.php" hash="62d14d7f4147b83001ef7f64726276c1"/><file name="Creditmemo.php" hash="8b1ac1eda1a522c70bca574b938c6359"/><file name="Invoice.php" hash="83f157b7fd24e5e6c0b51f6a162ee316"/></dir></dir><file name="Service.php" hash="7fda34c9ce1db70ae9757561d505a5b7"/><file name="Session.php" hash="429142089e75418a702e70edc56374cf"/><dir name="Source"><file name="Actions.php" hash="b5392f0820f15c3159e76ea67148992a"/><file name="Addressvalidation.php" hash="c8430082f4ae4c22c533e586e5652506"/><dir name="Avatax"><file name="Actions.php" hash="c72aa0df9013c6d5c5fddc0c4b4027b0"/><file name="Logtype.php" hash="0bdc9563eeaa30b7c4ae301a79613375"/><file name="Url.php" hash="cff45c6a590360711867112533b068d8"/></dir><dir name="Avatax16"><file name="Actions.php" hash="86b7d4067faad9478f9b61101d0fd6ae"/><file name="Buyertype.php" hash="6b029a7bbacc0eda36ed4fbb6f6e467b"/><file name="Logtype.php" hash="4e3447c8b79faf0ca20e66d9a66d29df"/><file name="Url.php" hash="ef6524ae8f04b9cc63f0f6e8ba4e63ea"/><file name="Usetype.php" hash="107c03d384fb6a8b990e4c16f49fab87"/></dir><file name="Customercodeformat.php" hash="cfcfcbaa27ed29add072324816da0c9d"/><file name="Error.php" hash="7f5495a2f295ded2d0a30f2f7108d009"/><file name="Fieldlist.php" hash="18987603d4d58130959a8ac76716ed08"/><file name="Logmode.php" hash="24d61da578a3b4adb896fea7d4d4d8ec"/><file name="Logtype.php" hash="4ec82151f66b1e265b803aca998bafb5"/><file name="Onerrorfrontend.php" hash="ef4154ae563d8157c1083f20e0adf563"/><dir name="Regionfilter"><file name="List.php" hash="d73ebe7197a2c6cfa45d52775d6f0977"/><file name="Mode.php" hash="2216d28bf9adba614025538cc62a49b6"/></dir><file name="Url.php" hash="794ec57a2b350931f70e95eb6677c253"/></dir><dir name="Tax"><file name="Calculation.php" hash="8b3ad0ace3967a13364d1475e286b70c"/><file name="Config.php" hash="f30f3801f7d94760121042a6dd85e383"/></dir><dir name="Total"><dir name="Quote"><dir name="Tax"><file name="Giftwrapping.php" hash="7b264455ac9084a751468ef6dbc36fe5"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="AvaTax"><file name="ExportController.php" hash="ead5ebea03db8f885d0ec6114dcb185c"/><file name="GridController.php" hash="5c7e822890a6feaec2db348e6c5a19e1"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="aca07ae89478c72fd1d2d41228c28b8e"/><file name="config.xml" hash="8d75707f13151439aa1f823007c747f9"/><file name="system-avatax16-disabled.xml" hash="b24027def3daab9000047bf7fee41c4f"/><file name="system-avatax16.xml" hash="b5a9543409521633ceec2af4d9c5d1b7"/><file name="system-disabled.xml" hash="bf89784beaef115a1408bd6fa9547b6a"/><file name="system.xml" hash="13b1bba1ba4a910d1d52a67224637ca0"/></dir><dir name="sql"><dir name="avatax_records_setup"><file name="mysql4-data-upgrade-2.2.0-2.2.1.php" hash="260d1c57754ebadba00d8ccdbb0ec996"/><file name="mysql4-install-0.1.0.php" hash="3d16899179b36bfde69609a99a2faae6"/><file name="mysql4-upgrade-0.1.4-0.1.5.php" hash="94d0cf2fc0e9bbe2de2829198ce3026f"/><file name="mysql4-upgrade-1.0.1-2.0.0.php" hash="905d7519328cdb1c46bba4221288c41c"/><file name="mysql4-upgrade-2.5.0.0-2.5.0.1.php" hash="4b439957397049bbe01d458fd7cfe0a2"/><file name="mysql4-upgrade-3.0.0.1-3.0.0.2.php" hash="46caa743f17221575b4a639b262a9275"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="OnePica_AvaTax.xml" hash="07fd9423811b4dc084060d6131b889d7"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="onepica"><file name="avatax.xml" hash="de338ca651fcce096d089b2bbbcc1374"/></dir></dir><dir name="template"><dir name="onepica"><dir name="avatax"><dir name="log"><file name="view.phtml" hash="df14eee805bbedd484cf500dbf2335ed"/></dir><dir name="notification"><file name="toolbar.phtml" hash="fd368e043843df76ec3a74290b87dc3e"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="onepica"><file name="avatax.xml" hash="38c6ce2165f6ccfd6641eb1487faad39"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="OnePica_AvaTax.csv" hash="43d2dee74aee6f15abd471a65b4f407c"/></dir><dir name="en_US"><file name="OnePica_AvaTax.csv" hash="43d2dee74aee6f15abd471a65b4f407c"/></dir><dir name="es_ES"><file name="OnePica_AvaTax.csv" hash="43d2dee74aee6f15abd471a65b4f407c"/></dir><dir name="fr_FR"><file name="OnePica_AvaTax.csv" hash="43d2dee74aee6f15abd471a65b4f407c"/></dir><dir name="nl_NL"><file name="OnePica_AvaTax.csv" hash="43d2dee74aee6f15abd471a65b4f407c"/></dir><dir name="pt_BR"><file name="OnePica_AvaTax.csv" hash="43d2dee74aee6f15abd471a65b4f407c"/></dir><dir name="zh_CN"><file name="OnePica_AvaTax.csv" hash="43d2dee74aee6f15abd471a65b4f407c"/></dir></target><target name="magelib"><dir name="AvaTax"><file name="AvaTax.php" hash="4d841acee4dab29ff39317cea6858e0d"/><dir name="classes"><file name="ATConfig.class.php" hash="4bc7673d3d65e38a2d80b1884e27f301"/><file name="ATObject.class.php" hash="83359fd7639c98449836dc11d08c899d"/><file name="AccountServiceSoap.class.php" hash="7049f00dfb40529e2cf7447f0cd5461e"/><file name="Address.class.php" hash="68bf4fe1306a60e672b7345a0dc7fcc6"/><file name="AddressServiceSoap.class.php" hash="c59bf4a586da207611f7bace4f08c880"/><file name="AddressType.class.php" hash="62c9ff3c533aaf5ad1fd4de95702be40"/><file name="AdjustTaxRequest.class.php" hash="47dbfa8044ca893bf214d8e71ab4864e"/><file name="AdjustTaxResult.class.php" hash="cf63aa5b7c3b52b3ec86695c4cdf0fcc"/><file name="ApplyPaymentRequest.class.php" hash="69d69dff63cbd284d8aea62247142692"/><file name="ApplyPaymentResult.class.php" hash="0e37bda0f1221c2ed2432717a2d8cc08"/><dir name="AvaCert2Svc"><file name="AvaCert2Soap.class.php" hash="0567793d9e4e496b45c3e8a0459f944a"/><file name="Certificate.class.php" hash="dd3f0dd2a2b03c97552f9dbd5c6463ba"/><file name="CertificateGetRequest.class.php" hash="4c11fd111cab99fa4dbc2c2250e0f3ad"/><file name="CertificateGetResult.class.php" hash="6a95a06e71bd13839c6142bba08bfba5"/><file name="CertificateImageGetRequest.class.php" hash="32f61011abe3d1c74ea7fc209e3e4224"/><file name="CertificateImageGetResult.class.php" hash="beda0f1fd54951b84b7dd77ead92bda3"/><file name="CertificateJurisdiction.class.php" hash="e666d572fb34d17fcd91127a50616195"/><file name="CertificateRequest.class.php" hash="7b76dc3675e507975ae6cf01abfa6059"/><file name="CertificateRequestGetRequest.class.php" hash="0cf2fafae88f795a754d75291947cb56"/><file name="CertificateRequestGetResult.class.php" hash="eceffe3acec787506649669b1b5edcf7"/><file name="CertificateRequestInitiateRequest.class.php" hash="148a5c4c881c885be863f403582b4974"/><file name="CertificateRequestInitiateResult.class.php" hash="a7a55cb398cd2fb9f0e11b8c6b09498d"/><file name="CertificateRequestStage.class.php" hash="92dec7da28f83f1a419d9573e6cec1fa"/><file name="CertificateRequestStatus.class.php" hash="a5d5c1629ce4f5ee0c18a8924204ca22"/><file name="CertificateStatus.class.php" hash="6ae43ab57ae9df37d07ac4203270c25e"/><file name="CertificateUsage.class.php" hash="bad34570daa7679b267f1288bf0a371f"/><file name="CommunicationMode.class.php" hash="71d2743c1d2afffe11d2903e89ff9c0e"/><file name="Customer.class.php" hash="e9f13f38f75cb4e1b845c55e6f26a5ab"/><file name="CustomerSaveRequest.class.php" hash="58ff71b04bb3a308b7f0199c6fae1e56"/><file name="CustomerSaveResult.class.php" hash="98cf79bdb7c0558963670b21e66b7d85"/><file name="FormatType.class.php" hash="714d183d3d365a07ef606d1211c732b0"/><file name="RequestType.class.php" hash="6144c2731baaf67400ea34e50440c1df"/><file name="ReviewStatus.class.php" hash="0dd208ecbf6b45196f51f304b1d48b03"/></dir><file name="AvalaraSoapClient.class.php" hash="dd605cefabb4396ef1b46b6d23b439b5"/><file name="BaseResult.class.php" hash="b672ec2ce2c6b5cf5cce7ce733aff482"/><dir name="BatchSvc"><file name="AuditMessage.class.php" hash="798d8169506357af02e6912b4bca9148"/><file name="AvaTaxBatchSvc.php" hash="8d65fd4a02cd4fc1104aa9c24b35e4fb"/><file name="BaseResult.class.php" hash="727ef623b821e95a73cf6d1eda891379"/><file name="Batch.class.php" hash="c028822bcf2a4f1fae6fc7dca76f247a"/><file name="BatchDelete.class.php" hash="0bcff09309ccad969d65c2d27fa63dda"/><file name="BatchDeleteResponse.class.php" hash="46afd464673459efb54ccaf509d37eef"/><file name="BatchFetch.class.php" hash="74f96ecc3c2df87271d60c4c969e43f8"/><file name="BatchFetchResponse.class.php" hash="b2acf63deea2c0fd374f80745b60fef5"/><file name="BatchFetchResult.class.php" hash="83d8de067f4bd59acafe4cd065f90163"/><file name="BatchFile.class.php" hash="65cee20383c8040fac1d4c45bbe757dd"/><file name="BatchFileDelete.class.php" hash="01d0bc10cb0ada43a9a00ca0efffef17"/><file name="BatchFileDeleteResponse.class.php" hash="b4e7881d26b7071303650973144f418b"/><file name="BatchFileFetch.class.php" hash="c5e91b8073fb756545d0f74803fdf3d6"/><file name="BatchFileFetchResponse.class.php" hash="c37ce819a975cdae5e7a82432b4b2334"/><file name="BatchFileFetchResult.class.php" hash="6bc54523d34356a83cdc4ecd2f696ea5"/><file name="BatchFileSave.class.php" hash="8434b0ffdd1fba4991535248ee3d618e"/><file name="BatchFileSaveResponse.class.php" hash="d52f79b42467b59f2177359f8a73cd3a"/><file name="BatchFileSaveResult.class.php" hash="19d3a2f20ccc42e80759b280842cf03c"/><file name="BatchProcess.class.php" hash="44d9efe13d01fce15bd444e5729b320c"/><file name="BatchProcessRequest.class.php" hash="04684b987c6d77319cc6881941091de9"/><file name="BatchProcessResponse.class.php" hash="c22b08c125eefc4006495c55984ed91e"/><file name="BatchProcessResult.class.php" hash="f9cac2270aafae49fc0892ea729c3713"/><file name="BatchSave.class.php" hash="d3a397348b905d49a0c91be780f3ec04"/><file name="BatchSaveResponse.class.php" hash="4c3088b85590fd697b5686aa1dddd89e"/><file name="BatchSaveResult.class.php" hash="7ea7fe3dc7d580711f6b52d991c43dce"/><file name="BatchSvc.class.php" hash="fa903f70b06d1e3b86384f2b6fb60616"/><file name="DeleteRequest.class.php" hash="43f945ef1e59ef02494df6df6ec3d1b6"/><file name="DeleteResult.class.php" hash="f7d64582f1182ae0337d6d84a5f60e8d"/><file name="FetchRequest.class.php" hash="7271317a8909672261ea0e00867e810b"/><file name="FilterRequest.class.php" hash="3c1eaec68f84531931a3cd6143533576"/><file name="FilterResult.class.php" hash="f4c0eeac0153b735ec589fcff7accd86"/><file name="IsAuthorized.class.php" hash="8339a2b249d954efaaf64f10665976fc"/><file name="IsAuthorizedResponse.class.php" hash="613c91f36370dc38ca07b83a29f2a45f"/><file name="IsAuthorizedResult.class.php" hash="65f9665508a5e7f33e4aee2835a9806e"/><file name="Message.class.php" hash="576327c8d9cd74bd96d9ccd62a2daa5b"/><file name="Ping.class.php" hash="3a2246f5557a5279fa260c65b36a9b44"/><file name="PingResponse.class.php" hash="b9f5e8b43382ee605d93768db8af1805"/><file name="PingResult.class.php" hash="2e05acfe74aad28003ad7d8ed102c3c6"/><file name="Profile.class.php" hash="a16a4819018dd8510ddab8feb9ee0f7e"/><file name="SeverityLevel.class.php" hash="5736530f3b5fd0cd932c783418563647"/></dir><file name="BoundaryLevel.class.php" hash="e9c2f2e3173e44fa8351f2a6dbb578fe"/><file name="CancelCode.class.php" hash="fd0b8ad2865e8fcf622b1faafc677527"/><file name="CancelTaxRequest.class.php" hash="08a114e32ec9eda9268ec337f79cb86f"/><file name="CancelTaxResult.class.php" hash="687be65bab85e6c6e8f99764c0475d9b"/><file name="CommitTaxRequest.class.php" hash="66ef55bc094d233b75e36b029995aed7"/><file name="CommitTaxResult.class.php" hash="ef90276817207e63e4e96ea518618f50"/><file name="DetailLevel.class.php" hash="2439f7137a4f9f52e28a6b321c4bcf16"/><file name="DocStatus.class.php" hash="9e3384a0f2ace05fa67fe05eba295fcd"/><file name="DocumentType.class.php" hash="0578e29121cb747e1e80a269eedd4b5a"/><file name="DynamicSoapClient.class.php" hash="5bb36f2d4db3955ae059488eb9511ca9"/><file name="Enum.class.php" hash="d3ff4c898aff49f3c425042433826257"/><file name="GetTaxHistoryRequest.class.php" hash="3ed4c54de1e015f476ce7aa58c802468"/><file name="GetTaxHistoryResult.class.php" hash="7e8209e1f64df52b538927312b1bd934"/><file name="GetTaxRequest.class.php" hash="7267cb5676ecbcbbb0b73c587b082b57"/><file name="GetTaxResult.class.php" hash="7e2b7415a018fd76b62ab49637833533"/><file name="IsAuthorizedResult.class.php" hash="58164457677a61e93309f788fe61dc0c"/><file name="JurisdictionType.class.php" hash="a345fe5db379af87a6f7ec833ff86586"/><file name="Line.class.php" hash="7fefbd0230ee2fe8a8e6468abf338b80"/><file name="Message.class.php" hash="073be6cbcccacf2d1d55a04c045eab63"/><file name="PingResult.class.php" hash="18f88589588f08b619488c926cf5547c"/><file name="PostTaxRequest.class.php" hash="be8ea4ee2fddb10b62cb1be7e38179e3"/><file name="PostTaxResult.class.php" hash="bf2ee0b1293301ee00ac9b8b8390e780"/><file name="ReconcileTaxHistoryRequest.class.php" hash="41f2cfe04495612a9c293b1bc19220ce"/><file name="ReconcileTaxHistoryResult.class.php" hash="dd20684e0e017f56c98e29297180a0d7"/><file name="SearchTaxHistoryResult.class.php" hash="e3171e00482f7c2c0ed9753ffd05cd14"/><file name="ServiceMode.class.php" hash="0c66b3e25f4466461cebf32735e207e0"/><file name="SeverityLevel.class.php" hash="68fc81e651fe7f01c81b43b0d28ff0dc"/><file name="TaxDetail.class.php" hash="56065f8ea68505152b23e41238b80dfb"/><file name="TaxLine.class.php" hash="05376f01ad9a14f438ad0f1d5d423b61"/><file name="TaxOverride.class.php" hash="94d28efa3cdf58a87ba45a313ce93fc7"/><file name="TaxOverrideType.class.php" hash="d23f90c9ac639954c8fcee57ba763b21"/><file name="TaxRequest.class.php" hash="7339016da0c3cbe51843767987e7fbed"/><file name="TaxServiceSoap.class.php" hash="bc7e4eb0e66dd1bd956e19e0da337171"/><file name="TaxType.class.php" hash="ee87ecc8721076f0cda67fe1cc5b0db7"/><file name="TextCase.class.php" hash="8fb2eccc49eacdc1a4f5624c0716a750"/><file name="ValidAddress.class.php" hash="2f8eebcd379208198cd38632f1e34b0a"/><file name="ValidateRequest.class.php" hash="98faedd50b2f4ea7ffb9d53ab1ca116c"/><file name="ValidateResult.class.php" hash="23de6a26defed9324ddcdcedfd2228bf"/><dir name="wsdl"><file name="Account.wsdl" hash="1635751a852ff5c036e4522381101680"/><file name="Address.wsdl" hash="0650cb8f516bec67e57eb7fa05ee6433"/><file name="AvaCert2Svc.wsdl" hash="9ca666be9851884f3e7fc9e28dc08f4a"/><file name="AvaCertSvc.wsdl" hash="7fb2b12cfe320462cf094225454f0d6c"/><file name="BatchSvc.wsdl" hash="639d2913500639145d95ee8e1166e08f"/><file name="Tax.wsdl" hash="76e1ff6c041d12da77a4632f376422ed"/></dir></dir><file name="functions.php" hash="57734d162b59cbc65933d25bf3950270"/></dir><dir name="OnePica"><dir name="AvaTax16"><dir name="AddressResolution"><file name="PingResponse.php" hash="73f035170b3fb2f2303653844d3f6b81"/><file name="ResolveSingleAddressResponse.php" hash="ed0976dc43e85bf18b265ac8fc7e2d4c"/><file name="TaxAuthority.php" hash="619e31874cfda8986720e94adcfbd8f4"/></dir><file name="AddressResolution.php" hash="3b398405387bc9b4a0c7883a1972a307"/><dir name="Calculation"><dir name="ListItemResponse"><dir name="CalculatedTaxSummary"><dir name="TaxByType"><file name="Details.php" hash="831aeafef333d3dcaabcd15078040de5"/></dir><file name="TaxByType.php" hash="b062bad211363fd17a988d32934a4e8f"/></dir><file name="CalculatedTaxSummary.php" hash="b12b78a8b334f558f4606a4460fd0639"/><file name="Header.php" hash="d59a553c91083727059af1d622fb46d9"/><file name="Line.php" hash="e4f025fed9c713040e25b3f5c4ada936"/><file name="ProcessingInfo.php" hash="96c5e66f6a1f65ccb9ceb382f1ba3993"/></dir><file name="ListItemResponse.php" hash="7f39a379433f944686e2391a2e44a226"/><file name="ListResponse.php" hash="7e9ecdd7acab4685c5cb4d416ad81dde"/></dir><file name="Calculation.php" hash="7e9b351755676a9aa75f7c06a41c1424"/><file name="Config.php" hash="36f6fdb01fd971760a171316144fd461"/><dir name="Document"><dir name="Part"><dir name="Feedback"><file name="LatencyData.php" hash="0295f43209017929b9c6ff6223e01d2b"/></dir><file name="Feedback.php" hash="40a0014f1841c32346648ff64a3a5380"/><dir name="Location"><file name="Address.php" hash="f7f7885366aab408f8f4b1556c68f244"/><file name="LatLong.php" hash="f146759ae37f44ab90f89f5caec7a27d"/></dir><file name="Location.php" hash="a3d811387c97eed65fc36d5413eb2026"/></dir><file name="Part.php" hash="26cc047abd30b891d5baaab2232bea4c"/><dir name="Request"><file name="Header.php" hash="a2f1f0f9e6e9dfd49d0ab9c5b7e0211a"/><file name="Line.php" hash="04d282e9fe8664f0e583e2d0009d0d6d"/></dir><file name="Request.php" hash="d397cea51071a9dee0684da25315e36d"/><dir name="Response"><dir name="CalculatedTaxSummary"><dir name="TaxByType"><file name="Details.php" hash="d8492812287542935be8f085282ec88d"/></dir><file name="TaxByType.php" hash="f0a2f375cf590b87a21ceba6680d07cc"/></dir><file name="CalculatedTaxSummary.php" hash="c2d9ae6142c5aa6f42445eb053dc4aaa"/><file name="Header.php" hash="1dc15ca01877b770386d931c1cd190d3"/><dir name="Line"><dir name="CalculatedTax"><file name="Details.php" hash="61bf6d08bb30810fb766e102aae9ce06"/><file name="TaxByType.php" hash="bc89074b210dd6d90da2f477184f5bfe"/></dir><file name="CalculatedTax.php" hash="3e31527423d45052f34ac723c5c96916"/></dir><file name="Line.php" hash="6c5793d08cad8ed168d440ba8f2ccfa3"/><file name="ProcessingInfo.php" hash="3f5364a445ec054b93d74d1f2711e008"/></dir><file name="Response.php" hash="31832930dbb407f67bfa7387fea62084"/></dir><file name="Exception.php" hash="667fd0125f682cd30285dbef1c96729f"/><dir name="IO"><file name="CaseInsensitiveArray.php" hash="5571dca95bbf848a5f9486f738858324"/><file name="Curl.php" hash="ba10290f1de032ce2653161161626c01"/></dir><file name="ResourceAbstract.php" hash="641ade4b2a28aa342fc1070154f7ac22"/><file name="TaxService.php" hash="89906a6e7b29e010213f51e971440341"/><dir name="Transaction"><file name="ListItemResponse.php" hash="ba3b3099ca84f60c1bb4cb20ec7be665"/><file name="ListResponse.php" hash="860b86f6c937ad9171cc30390eec0c28"/><file name="TransitionTransactionStateResponse.php" hash="5e7478e0db1ca655c9c8516d536240d0"/></dir><file name="Transaction.php" hash="b498543d584fc5c458015113e61f614d"/></dir><file name="autoload.php" hash="0817cd303e31b20b5d8881e2824df0cc"/></dir></target></contents>
32
  <compatible/>
33
  <dependencies><required><php><min>5.2.3</min><max>6.0.0</max></php><extension><name>Core</name><min/><max/></extension><extension><name>curl</name><min/><max/></extension><extension><name>soap</name><min/><max/></extension></required></dependencies>
34
  </package>