taxjar / taxjar-go Goto Github PK
View Code? Open in Web Editor NEWSales Tax API Client for Go
Home Page: https://developers.taxjar.com/api/reference/?go
License: MIT License
Sales Tax API Client for Go
Home Page: https://developers.taxjar.com/api/reference/?go
License: MIT License
This type
type UpdateOrderParams struct {
TransactionID string `json:"transaction_id,omitempty"`
TransactionDate string `json:"transaction_date,omitempty"`
FromCountry string `json:"from_country,omitempty"`
FromZip string `json:"from_zip,omitempty"`
FromState string `json:"from_state,omitempty"`
FromCity string `json:"from_city,omitempty"`
FromStreet string `json:"from_street,omitempty"`
ToCountry string `json:"to_country,omitempty"`
ToZip string `json:"to_zip,omitempty"`
ToState string `json:"to_state,omitempty"`
ToCity string `json:"to_city,omitempty"`
ToStreet string `json:"to_street,omitempty"`
Amount float64 `json:"amount,omitempty"`
Shipping float64 `json:"shipping,omitempty"`
SalesTax float64 `json:"sales_tax,omitempty"`
CustomerID string `json:"customer_id,omitempty"`
ExemptionType string `json:"exemption_type,omitempty"`
LineItems []OrderLineItem `json:"line_items,omitempty"`
}
Has amount
, shipping
, and salesTax
as omitempty
ed, but this means that you can't actually update the values to zero.
Use case, is super common; Customer gives us tax exempt information after the order processed, we update a transaction as exempt, and set the sales tax to zero, but the sales tax update never goes through because it's being dropped from the marshalled json. So we have a few transactions that look like we charged tax on orders we shouldn't have, but we really didn't.
My suggestion here would be to make at least those three fields pointers, so we can optionally send a zero if needed, or nothing and still work with the optionalness of the API. PR: #14
Also, weird other issue that's not completely related, but if I try to create a refund transaction to remove the sales tax instead, I get this error
taxjar: 400 Bad Request - exemption_type must be 'non_exempt' or 'marketplace' if any present sales_tax parameter values are non-zero
This is my request.
{
"amount": 0,
"exemption_type": "government",
"from_city": "My City",
"from_country": "US",
"from_state": "FL",
"from_street": "My Street",
"from_zip": "32707",
"line_items": [
{
"description": "Cool Product",
"id": "1",
"quantity": 150,
"unit_price": 5.75
},
{
"description": "Sales Tax Exempt",
"id": "10",
"quantity": 1
},
{
"description": "Shipping",
"id": "11",
"quantity": 1
}
],
"sales_tax": -95.2,
"shipping": 0,
"to_city": "Some City",
"to_country": "US",
"to_state": "GA",
"to_street": "12354 Their Street"
"to_zip": "32707",
"transaction_date": "2022/01/04",
"transaction_id": "adbc1234"
}
Seems like it's telling me that I can't have an exemption on the order if the tax amount is "non zero", which is technically true with this request because I'm trying to give it a negative number for the tax (which is non zero), but then I have no way of removing the tax for this transaction? Do I have to remove the exemption, then remove the sales tax, then put the exemption back?
Issue: Although v2.0.0 was released on github, it is not released to go.pkg.dev
. Reference the below screenshot. go get github.com/taxjar/taxjar-go@latest
results in v1.1.1 being added to go.mod
.
https://pkg.go.dev/github.com/taxjar/taxjar-go
Workaround: I can pin the v2.0.0 commit in my go.mod
file. But this is not ideal.
github.com/taxjar/taxjar-go v1.1.2-0.20231030152100-dda5556387a5 // pinned to v2.0.0 commit
Proposed solution: Publish the v2.0.0 release to go.pkg.dev
.
Calling CreateOrder()
with CreateOrderParams{}
:
// CreateOrderParams should be passed to `CreateOrder` to create an order․
type CreateOrderParams struct {
...
Amount float64 `json:"amount"`
Shipping float64 `json:"shipping"`
SalesTax float64 `json:"sales_tax"`
...
}
Amount is an optional field in the API, however this will always be the zero value of the struct member when posting to the endpoint (so, 0
)
This could possibly be solved by making this a pointer to float64 and checking for nil, as I am now required to work out this before calling CreateOrder()
or I will get an error.
Hello TaxJar folks. I am running into an issue where I am attempting to validate an address via the Go SDK. I am using the *taxjar.Config.ValidateAddress(taxjar.ValidateAddressParams{...})
method, and I am getting the following error:
0 Not Found - No such route 'POST /v2/addresses/validate'
A few pertinent details:
Updating to the latest version of taxjar go broke our existing integration with this commit: 04f3fd0
The line item IDs are strings per the TaxJar Documentation:
We currently use UUIDs for our line items and so switching to json.Number would not be an insignificant refactor with our integration, as well as not being per the API documentation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.