Documentation ¶
Index ¶
- func RateCity(city string) func(*rateParams) error
- func RateCountry(country string) func(*rateParams) error
- type Address
- type Breakdown
- type Category
- type CategoryApi
- type CategoryList
- type CategoryRepository
- type CategoryService
- type Client
- type LineItem
- type Order
- type OrderApi
- type OrderDetails
- type OrderList
- type OrderRepository
- type OrderService
- type Rate
- type RateApi
- type RateList
- type RateRepository
- type RateService
- type Shipping
- type Tax
- type TaxApi
- type TaxLineItem
- type TaxList
- type TaxRepository
- type TaxService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RateCountry ¶
Types ¶
type Address ¶
type Address struct { Street string `json:"street,omitempty" bson:"street,omitempty"` City string `json:"city,omitempty" bson:"city,omitempty"` State string `json:"state,omitempty" bson:"state,omitempty"` Zip string `json:"zip,omitempty" bson:"zip,omitempty"` Country string `json:"country,omitempty" bson:"country,omitempty"` }
type Breakdown ¶
type Breakdown struct { Shipping Shipping `json:"shipping" bson:"shipping"` LineItems []TaxLineItem `json:"line_items" bson:"line_items"` TaxCollectable float64 `json:"tax_collectable" bson:"tax_collectable"` TaxableAmount float64 `json:"taxable_amount" bson:"taxable_amount"` // For US transactions StateTaxableAmount float64 `json:"state_taxable_amount" bson:"state_taxable_amount"` StateTaxRate float64 `json:"state_tax_rate" bson:"state_tax_rate"` StateTaxCollectable float64 `json:"state_tax_collectable" bson:"state_tax_collectable"` CountyTaxableAmount float64 `json:"county_taxable_amount" bson:"county_taxable_amount"` CountyTaxRate float64 `json:"county_tax_rate" bson:"county_tax_rate"` CountyTaxCollectable float64 `json:"county_tax_collectable" bson:"county_tax_collectable"` CityTaxableAmount float64 `json:"city_taxable_amount" bson:"city_taxable_amount"` CityTaxRate float64 `json:"city_tax_rate" bson:"city_tax_rate"` CityTaxCollectable float64 `json:"city_tax_collectable" bson:"city_tax_collectable"` SpecialTaxableAmount float64 `json:"special_district_taxable_amount" bson:"special_district_taxable_amount"` SpecialTaxRate float64 `json:"special_tax_rate" bson:"special_tax_rate"` SpecialTaxCollectable float64 `json:"special_district_tax_collectable" bson:"special_district_tax_collectable"` // For CA transactions GstTaxableAmount float64 `json:"gst_taxable_amount" bson:"gst_taxable_amount"` GstTaxCollectable float64 `json:"gst" bson:"gst"` GstTaxRate float64 `json:"gst_tax_rate" bson:"gst_tax_rate"` PstTaxableAmount float64 `json:"pst_taxable_amount" bson:"pst_taxable_amount"` PstTaxCollectable float64 `json:"pst" bson:"pst"` PstTaxRate float64 `json:"pst_tax_rate" bson:"pst_tax_rate"` QstTaxableAmount float64 `json:"qst_taxable_amount" bson:"qst_taxable_amount"` QstTaxCollectable float64 `json:"qst" bson:"qst"` QstTaxRate float64 `json:"qst_tax_rate" bson:"qst_tax_rate"` }
type CategoryApi ¶
type CategoryApi struct {
// contains filtered or unexported fields
}
CategoryApi implements CategoryRepository
type CategoryList ¶
type CategoryList struct {
Categories []Category `json:"categories"`
}
type CategoryRepository ¶
type CategoryRepository interface {
// contains filtered or unexported methods
}
CategoryRepository defines the interface for working with Categories through the API.
type CategoryService ¶
type CategoryService struct {
Repository CategoryRepository
}
func (*CategoryService) List ¶
func (s *CategoryService) List() (CategoryList, error)
List all Categories
type Client ¶
type Client struct { *http.Client Debug bool Categories CategoryService Rates RateService Taxes TaxService Orders OrderService // contains filtered or unexported fields }
type LineItem ¶
type LineItem struct { Id string `json:"id,omitempty" bson:"id,omitempty"` Quantity int64 `json:"quantity,omitempty" bson:"quantity,omitempty"` ProductTaxCode string `json:"product_tax_code,omitempty" bson:"product_tax_code,omitempty"` UnitPrice float64 `json:"unit_price,omitempty" bson:"unit_price,omitempty"` Discount float64 `json:"discount,omitempty" bson:"discount,omitempty"` }
type OrderApi ¶
type OrderApi struct {
// contains filtered or unexported fields
}
OrderApi implements OrderRepository
type OrderDetails ¶
type OrderDetails struct { ID string `json:"transaction_id" bson:"transaction_id"` Date string `json:"transaction_date" bson:"transaction_date"` Amount float64 `json:"amount" bson:"amount"` Shipping float64 `json:"shipping" bson:"shipping"` SalesTax float64 `json:"sales_tax" bson:"sales_tax"` LineItems []LineItem `json:"line_items,omitempty" bson:"line_items,omitempty"` }
type OrderRepository ¶
type OrderRepository interface {
// contains filtered or unexported methods
}
OrderRepository defines the interface for working with Order through the API.
type OrderService ¶
type OrderService struct {
Repository OrderRepository
}
func (*OrderService) Create ¶
func (s *OrderService) Create(details OrderDetails, from, to Address) (Order, error)
type Rate ¶
type Rate struct { Zip string `json:"zip"` State string `json:"state` StateRate float64 `json:"state_rate,string"` County string `json:"county"` CountyRate float64 `json:"county_rate,string"` City string `json:"city"` CityRate float64 `json:"city_rate,string"` CombinedDistrictRate float64 `json:"combined_district_rate,string"` CombinedRate float64 `json:"combined_rate,string"` Country string `json:"country"` Name string `json:"name"` StandardRate float64 `json:"standard_rate,string"` ReducedRate float64 `json:"reduced_rate,string"` SuperReducedRate float64 `json:"super_reduced_rate,string"` ParkingRate float64 `json:"parking_rate,string"` DistanceSaleThreshold float64 `json:"distance_sale_threshold,string"` FreightTaxable *bool `json:"freight_taxable"` }
type RateApi ¶
type RateApi struct {
// contains filtered or unexported fields
}
RateApi implements RateRepository
type RateRepository ¶
type RateRepository interface {
// contains filtered or unexported methods
}
RateRepository defines the interface for working with Rates through the API.
type RateService ¶
type RateService struct {
Repository RateRepository
}
type Shipping ¶
type Shipping struct { StateTaxableAmount float64 `json:"state_taxable_amount" bson:"state_taxable_amount"` StateSalesTaxRate float64 `json:"state_sales_tax_rate" bson:"state_sales_tax_rate"` StateAmount float64 `json:"state_amount" bson:"state_amount"` CountyTaxableAmount float64 `json:"county_taxable_amount" bson:"county_taxable_amount"` CountyTaxRate float64 `json:"county_tax_rate" bson:"county_tax_rate"` CountyAmount float64 `json:"county_amount" bson:"county_amount"` CityTaxableAmount float64 `json:"city_taxable_amount" bson:"city_taxable_amount"` CityTaxRate float64 `json:"city_tax_rate" bson:"city_tax_rate"` CityAmount float64 `json:"city_amount" bson:"city_amount"` SpecialTaxableAmount float64 `json:"special_district_taxable_amount" bson:"special_district_taxable_amount"` SpecialTaxRate float64 `json:"special_tax_rate" bson:"special_tax_rate"` SpecialAmount float64 `json:"special_district_amount" bson:"special_district_amount"` // For CA transactions GstTaxableAmount float64 `json:"gst_taxable_amount" bson:"gst_taxable_amount"` GstTaxRate float64 `json:"gst_tax_rate" bson:"gst_tax_rate"` GstAmount float64 `json:"gst" bson:"gst"` PstTaxableAmount float64 `json:"pst_taxable_amount" bson:"pst_taxable_amount"` PstTaxRate float64 `json:"pst_tax_rate" bson:"pst_tax_rate"` PstAmount float64 `json:"pst" bson:"pst"` QstTaxableAmount float64 `json:"qst_taxable_amount" bson:"qst_taxable_amount"` QstTaxRate float64 `json:"qst_tax_rate" bson:"qst_tax_rate"` QstAmount float64 `json:"qst" bson:"qst"` }
type Tax ¶
type Tax struct { Breakdown Breakdown `json:"breakdown" bson:"breakdown"` OrderTotalAmount float64 `json:"order_total_amount" bson:"order_total_amount"` Shipping float64 `json:"shipping" bson:"shipping"` TaxableAmount float64 `json:"taxable_amount" bson:"taxable_amount"` Rate float64 `json:"rate" bson:"rate"` AmountToCollect float64 `json:"amount_to_collect" bson:"amount_to_collect"` HasNexus bool `json:"has_nexus" bson:"has_nexus"` FreightTaxable bool `json:"freight_taxable" bson:"freight_taxable"` TaxSource string `json:"tax_source" bson:"tax_source"` }
type TaxApi ¶
type TaxApi struct {
// contains filtered or unexported fields
}
TaxApi implements TaxRepository
type TaxLineItem ¶
type TaxLineItem struct { Id string `json:"id" bson:"id"` // For US transactions StateTaxableAmount float64 `json:"state_taxable_amount" bson:"state_taxable_amount"` StateSalesTaxRate float64 `json:"state_sales_tax_rate" bson:"state_sales_tax_rate"` StateAmount float64 `json:"state_amount" bson:"state_amount"` CountyTaxableAmount float64 `json:"county_taxable_amount" bson:"county_taxable_amount"` CountyTaxRate float64 `json:"county_tax_rate" bson:"county_tax_rate"` CountyAmount float64 `json:"county_amount" bson:"county_amount"` CityTaxableAmount float64 `json:"city_taxable_amount" bson:"city_taxable_amount"` CityTaxRate float64 `json:"city_tax_rate" bson:"city_tax_rate"` CityAmount float64 `json:"city_amount" bson:"city_amount"` SpecialTaxableAmount float64 `json:"special_district_taxable_amount" bson:"special_district_taxable_amount"` SpecialTaxRate float64 `json:"special_tax_rate" bson:"special_tax_rate"` SpecialAmount float64 `json:"special_district_amount" bson:"special_district_amount"` // For CA transactions GstTaxableAmount float64 `json:"gst_taxable_amount" bson:"gst_taxable_amount"` GstTaxRate float64 `json:"gst_tax_rate" bson:"gst_tax_rate"` GstAmount float64 `json:"gst" bson:"gst"` PstTaxableAmount float64 `json:"pst_taxable_amount" bson:"pst_taxable_amount"` PstTaxRate float64 `json:"pst_tax_rate" bson:"pst_tax_rate"` PstAmount float64 `json:"pst" bson:"pst"` QstTaxableAmount float64 `json:"qst_taxable_amount" bson:"qst_taxable_amount"` QstTaxRate float64 `json:"qst_tax_rate" bson:"qst_tax_rate"` QstAmount float64 `json:"qst" bson:"qst"` }
type TaxRepository ¶
type TaxRepository interface {
// contains filtered or unexported methods
}
TaxRepository defines the interface for working with Tax through the API.
type TaxService ¶
type TaxService struct {
Repository TaxRepository
}
func (*TaxService) Calculate ¶
func (s *TaxService) Calculate(from, to Address, shipping, amount float64) (Tax, error)
Calculate sales Tax for a given order
func (*TaxService) CalculateItems ¶
Click to show internal directories.
Click to hide internal directories.