Comments (3)
@calvinanderson Thanks for the issue!
Amount is actually a required field per the API reference:
If it helps work out the logic, there are (at least) two different cases with the client as-is:
- Amount & LineItems add up correctly
201 Order created
taxjar.CreateOrderParams{
// ...
Amount: 36.21,
Shipping: 5,
SalesTax: 0,
LineItems: []taxjar.OrderLineItem{
{
ID: "1",
Quantity: 1,
ProductIdentifier: "12-34243-9",
Description: "Fuzzy Sweater",
ProductTaxCode: "20010",
UnitPrice: 36.72,
Discount: 5.51,
SalesTax: 0,
},
},
}
- Amount is empty or zero and LineItems includes items
400 Bad Request - Order amount must be equal to the sum of line items and shipping
taxjar.CreateOrderParams{
// ...
// Amount: 36.21,
Shipping: 5,
SalesTax: 0,
LineItems: []taxjar.OrderLineItem{
{
ID: "1",
Quantity: 1,
ProductIdentifier: "12-34243-9",
Description: "Fuzzy Sweater",
ProductTaxCode: "20010",
UnitPrice: 36.72,
Discount: 5.51,
SalesTax: 0,
},
},
}
If we pass nil
for an empty Amount instead of 0
, a different error would be returned since Amount is required:
406 Not Acceptable - amount is missing, amount is empty
type CreateOrderParams struct {
// ...
Amount float64 `json:"amount,omitempty"`
Shipping float64 `json:"shipping"`
SalesTax float64 `json:"sales_tax"`
...
}
Since Amount is required, our inclination is to pass 0
when omitted.
from taxjar-go.
No worries! We know this is confusing since Amount
excludes shipping when calculating tax, but includes shipping when creating an order as well. We hope to offer more consistency in a future version of the API.
from taxjar-go.
Thanks, sorry, I had thought that is was an optional param like in the calculate sales tax endpoint.
from taxjar-go.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from taxjar-go.