Skip to content

Commit

Permalink
Merge pull request #36 from surprisehighway/release/v2.1.5
Browse files Browse the repository at this point in the history
Release/v2.1.5
  • Loading branch information
imagehat committed Jul 7, 2021
2 parents 7a1377d + b8f86b4 commit 67c93a8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## 2.1.5
### Fixed
- Fixed an error that could occur when logging a tax calculation error. [#35](https://github.com/surprisehighway/craft-avatax/issues/35)
- Fixed an error when using a dropdown for the product tax code field. [#34](https://github.com/surprisehighway/craft-avatax/issues/34)

## 2.1.4
### Added
- Allow for live and sandbox credentials to be set as ENV variables with autosuggest fields in the plugin settings to keep sensitive info out of Project Config. [#11](https://github.com/surprisehighway/craft-avatax/issues/11) [30](https://github.com/surprisehighway/craft-avatax/issues/30)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "surprisehighway/craft-avatax",
"description": "Calculate and add sales tax to an order's base tax using Avalara's Avatax service.",
"type": "craft-plugin",
"version": "2.1.4",
"version": "2.1.5",
"keywords": [
"craft",
"cms",
Expand Down
15 changes: 6 additions & 9 deletions src/services/SalesTaxService.php
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,8 @@ private function getTotalTax($order, $transaction)

$taxCode = $defaultTaxCode;

if(isset($lineItem->purchasable->product->avataxTaxCode)) {
$taxCode = $lineItem->purchasable->product->avataxTaxCode ?: $defaultTaxCode;
if($this->getFieldValue('avataxTaxCode', $lineItem->purchasable->product)) {
$taxCode = $this->getFieldValue('avataxTaxCode', $lineItem->purchasable->product);
}

$itemCode = $lineItem->id;
Expand Down Expand Up @@ -639,9 +639,9 @@ private function getTotalTax($order, $transaction)
$discountCode = $defaultTaxCode;

// check to see if there is an Avatax Tax Code override specified
if(!empty($adjustmentLineItem->purchasable->product->avataxTaxCode))
if($this->getFieldValue('avataxTaxCode', $lineItem->purchasable->product))
{
$discountCode = $adjustmentLineItem->purchasable->product->avataxTaxCode;
$discountCode = $this->getFieldValue('avataxTaxCode', $lineItem->purchasable->product);
}
}

Expand Down Expand Up @@ -679,11 +679,8 @@ private function getTotalTax($order, $transaction)
}
}

if($this->debug)
{
// workaround to save the model as array for debug logging
$m = $t; $model = $m->createAdjustmentRequest(null, null)['newTransaction'];
}
// workaround to save the model as array for debug logging
$m = $t; $model = $m->createAdjustmentRequest(null, null)['newTransaction'];

$signature = $this->getOrderSignature($order);
$cacheKey = 'avatax-'.$this->type.'-'.$signature;
Expand Down

0 comments on commit 67c93a8

Please sign in to comment.