New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SalesTaxService.php - Request could not be completed #34
Comments
Thinking about this a bit further, my solution that I found was to force the variable to give its current value (by calling |
Today I updated my composer packages for this Craft, Commerce, and this package. The issue as I described is still there, but the exception that is thrown no longer occurs. Here are my updated packages: |
@curtismorte - For 2.1.4 we changed how errors are handled and the plugin now still logs the error now also with the request and response, but will fail silently instead of throwing an exception. But I'll see if we can look into your issue with the Transaction Builder. Also, if you don't need or want to use Avalara's address validation service you can disable that in the plugin settings. That's the reason the plugin is being called when saving a default address. |
Hey Guys, An adjuster that was adding adjustments per LineItem was the source of the problem. Within SalesTaxService.php there is a condition that checks to see if the product has it's own tax code specified. Per the documentation, when you setup the product field with handle Here is a simple fix for SalesTaxService.php: // ------------------------------------------------------------------
// Null Coalescing - Concise.
// ------------------------------------------------------------------
// check to see if there is an Avatax Tax Code override specified
if(!empty($adjustmentLineItem->purchasable->product->avataxTaxCode))
{
// Usage specific tor avataxTaxCode being a type "dropdown" or "plaintext"
$discountCode = $adjustmentLineItem->purchasable->product->avataxTaxCode->value ?? $adjustmentLineItem->purchasable->product->avataxTaxCode;
}
// ------------------------------------------------------------------
// Simple Conditional - Easy to read
// ------------------------------------------------------------------
// check to see if there is an Avatax Tax Code override specified
if(!empty($adjustmentLineItem->purchasable->product->avataxTaxCode))
{
// Usage specific tor avataxTaxCode being a type "plaintext"
$discountCode = $adjustmentLineItem->purchasable->product->avataxTaxCode;
// Usage specific tor avataxTaxCode being a type "dropdown"
if(isset($adjustmentLineItem->purchasable->product->avataxTaxCode->value)) {
$discountCode = $adjustmentLineItem->purchasable->product->avataxTaxCode->value;
}
} |
Thanks for this! Being able to use a dropdown makes sense, and at one I feel like that worked, but maybe not. At any rate I'll add that check and push an update in the next day or so, hopefully tomorrow. |
Craft Version: 3.6.14
Craft Commerce Version: 3.2.14.1
Craft Avatax Version: 2.1.3
PHP Version: 8.0.2
When posting to action
commerce/customer-addresses/save
, I get the following error:The issue is that my tax code value of
PA3000100
is somehow being converted to{"label":"PA3000100","value":"PA3000100","selected":true,"valid":true}
from $t->withLine().I realize
$t
is actually an instance ofvendor/avalara/avataxclient/src/TransactionBuilder.php
.I was able to verify this issue by using the built in logger for the plugin. These were my modifications to SalesTaxService.php:614 and TransactionBuilder.php:446
Here is the corresponding log entries:
The problem is the value of
$taxCode
somehow turns into{"label":"PA3000100","value":"PA3000100","selected":true,"valid":true}
.A solution found during testing
I figured out that if you wrap the
$taxCode
parameter withstrval()
, then the issue doesn't happen and the request succeeds for TransactionBuilder.php:446Here is the full stack trace:
The text was updated successfully, but these errors were encountered: