Code Monkey home page Code Monkey logo

taxjar.net's Issues

TaxJar not loading

We have a .net core 2 project that we are having issues with TaxJar running on our servers but not our local developer machines. We are getting "could not load TaxJar" because file can't be found. The file is clearly on the server along with all other dependencies. We have uninstalled/re-installed the package. We have insured we have the latest version (3.0.2). The server only has .net core installed. Are there any other dependencies or requirements for deployment?

RatesForLocation chokes on EU countries

Using the example provided here: https://developers.taxjar.com/api/reference/#get-show-tax-rates-for-a-location

Throws the following:

InvalidCastException: Null object cannot be converted to a value type.
System.Convert.ChangeType(object value, Type conversionType, IFormatProvider provider)

JsonSerializationException: Error converting value {null} to type 'System.Decimal'. Path 'rate.super_reduced_rate', line 1, position 34.
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, object value, CultureInfo culture, JsonContract contract, Type targetType) in JsonSerializerInternalReader.cs, line 989

props maybe need to be marked as nullable?

Taxjar API Version

Am I correct in thinking I can pass the x-api-version HTTP request header:

HEADER: "x-api-version: 2022-01-24"

via the following line of code:

client.headers.Add("x-api-version", "2022-01-24");

Or is this already hard-coded somewhen in the library?

Not compatible with co-existing package relying on RestSharpSigned

This package requires the unsigned version of RestSharp package. If there is a need for a co-existing package in the same project that relies on the signed version of RestSharp - RestSharpSigned, then the two cannot work in the same project.

Would it be possible to provide a second option for a signed version of taxjar.net? In the meantime I'll have to maintain my own version.

Need help with generic error troubleshooting

Taxjar.TaxjarException: 'Unprocessable Entity - Something could not be processed'

I'm getting this generic error when creating an error.

Is there any way to get more info to help with troubleshooting?

Is there a way to expose the raw request and raw response so I could paste that into PostMan and troubleshoot?

Running off V3 now.

Thanks for your help!

Async methods are ignoring 'TransactionId' property.

I noticed in the source code that async versions of 'UpdateOrder' and 'UpdateRefund' (there might be others) are ignoring the 'TransactionId' property from the dotnet entities.

this is from the async method:
var transactionId = parameters.GetType().GetProperty("transaction_id").GetValue(parameters).ToString();

this was leading to a NullReferenceException when using the Taxjar.Order object.
Problem was solved when after switching to the synchronous version of UpdateOrder.

this is from the synchronous method:
var transactionIdProp = parameters.GetType().GetProperty("transaction_id") ?? parameters.GetType().GetProperty("TransactionId");

RestSharp Method Not Found - RestSharp

Issue

After installing version 4.0.0 of TaxJar and attempting to instantiate a new instance of TaxjarApi. When calling a new instance, the program is throwing a Method Not Found error.

Error

System.MissingMethodException: 'Method not found: 'Void RestSharp.RestClient..ctor(RestSharp.RestClientOptions, System.Action`1<System.Net.Http.Headers.HttpRequestHeaders>)'.'

Code Causing Error

public TaxJarInterface(ITaxJarSecurity taxJarSecurity, int timeout = 0)
{
    if (string.IsNullOrEmpty(taxJarSecurity.ApiKey))
        throw new ArgumentNullException("apiToken", "Please provide an API token");

    ApiInterface = new TaxjarApi(taxJarSecurity.ApiKey)
    {
        apiUrl = $"https://{(!taxJarSecurity.DemoMode ? TaxJarConstants.DefaultApiUrl : TaxJarConstants.SandboxApiUrl)}",
        timeout = timeout
    };
}

Use Inheritance for some models

The Breakdown object has Shipping and LineBreadowns. All 3 of these objects have very similar properties. The common properties be put into a BaseBreakdown and individual breakdowns (Shipping, Line) could inherit. Any reason this couldn't be done?

Request entity examples

Our README examples mainly use anonymous types to pass data for API requests. Let's add new examples using request entities so the data is easier to manage prior to passing it to a client method.

Cannot run with Newtonsoft.Json version 13

TaxJar version 3.3.2 in NuGet requires Newtonsoft.Json minimum version 12.0.3 (if I'm reading the NPM description properly). I have Newtonsoft.Json v 13.0.1 already installed and I'm getting "Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0....The located assembly's manifest definition does not match the assembly reference" when I call a TaxJar method at runtime.

I've tried downgrading Newtonsoft to v12, which works for this problem but causes others which depend on v13.

Can TaxJar be updated to accept Newtonsoft.Json 13?

Thanks, Dave

Example code

Can you post example code where multiple line items are added to a TaxForOrder call but the line items are stored in an array which needs to be looped through using foreach?

Cannot specify decimal timeouts

The client's timeout property is of type int. It gets multiplied internally by 1000 to convert to milliseconds.

This is a limitation as it does not allow me to set a timeout of 1.5 seconds (1500 milliseconds).

The property should be more flexible (e.g. TimeSpan).

Shouldn't some properties be nullable?

Hi,
I was comparing this Tax class to the API for Calculating sales tax for an order and noticed shouldn't certain fields be nullable? For example, Tax.Amount and Tax.Shipping should be of type decimal?, right? Shouldn't any parameter that is considered optional in the API docs be nullable? When serializing any classes before sending them to the API (

request.AddParameter("application/json", JsonConvert.SerializeObject(body), ParameterType.RequestBody);
), the default values for certain types are being set and sent instead of null (or nothing if NullValueHandling = NullValueHandling.Ignore is being set).

This should be changed in all classes that have optional API parameters not just the Tax class referenced above.

Thanks!

RestSharp dependency

Requesting validation of RestSharp latest, 108.0.1, and update of package references.

Serialization issue - RestSharp does not use Newtonsoft JsonNetSerializer by default

All of the API entities rely on the Newtonsoft JsonProperty attribute to serialize correctly. By default RestSharp does not use Newtonsoft JsonNetSerializer which means the request body does not get serialized with the correct property names

For example nexus_addresses should look like this:

"nexus_addresses": [{
    "id": null,
    "country": "US",
    "zip": null,
    "state": "AZ",
    "city": null,
    "street": null
}],

instead it gets serialized (When using the NexusAddress class instead of just a dynamic) as:

"nexus_addresses": [{
    "Id": null,
    "Country": "US",
    "Zip": null,
    "State": "AZ",
    "City": null,
    "Street": null
}],

Notice the casing.

This caused the API to return incorrect tax information as I'm assuming the nexus addresses do not get deserialized properly and are required for my use case.

To fix this we could set the Serializer when building the RestRequest Note: you will need to reference the package RestSharp.Serializers.NewtonsoftJson

var request = new RestRequest(action, method)
{
      RequestFormat = DataFormat.Json, JsonSerializer = new JsonNetSerializer()
};

.Net Standard DLLs not Updated in NuGet

The binaries for 3.2.0 on NuGet for .Net Standard are Assembly version 3.1.1 and are referencing RestSharp 106.6.9, but the package installs RestSharp 106.10.1. In the absence of proper Assembly Redirection in .Net Core, this is a large issue. 3.2.0 is not working in .Net Core.

image

No extensibility points (such as retry policies)

Hey thanks for the SDK its useful, however we are finding several gaps that we'd like to be able to include ourselves such as retry policies and things of that nature.

Any plans for this, or would you be willing to look at a PR contribution to open up some extensibility points?

@kdcllc has a PR out that appears to be a very good start but we'd like to open up access to be able to hook in Polly retry policies maybe as an optional parameter to the TaxJarApi or some such.

Polly in the .NET world is somewhat ubiquitous nowadays for people to implement really effective retry policies and most projects that require resiliency are very likely to already have some set of Polly policy builders and such so we believe this would be a great addition to the TaxJar .NET SDK.

RestSharp failures swallowed silently

While using the API, I came across an issue where I was getting an "object reference not set to an instance of an object" error. Debugging led me to the TaxForOrder method, but there was no further information about the error.

Eventually I was able to determine the issue was that I was missing the System.ValueTuple reference, which was causing RestSharp to fail (the request never went out). RestSharp in turn handled this error internally and returned a response object (without throwing any errors). the response object contains an error message which is how I was able to figure out I was missing a reference. This information, however, was not available as a consumer of the client. I had to use the source code to figure out what was going on.

The SendRequest method is not handling error conditions from RestSharp and simply returns a response with null content, which causes the null reference error mentioned above in TaxForOrder when attempting to deserialize the response.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.