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 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 Breakdown ¶
type Breakdown struct { Shipping Shipping `json:"shipping"` LineItems []TaxLineItem `json:"line_items"` TaxCollectable float64 `json:"tax_collectable"` TaxableAmount float64 `json:"taxable_amount"` // For US transactions StateTaxableAmount float64 `json:"state_taxable_amount"` StateTaxRate float64 `json:"state_tax_rate"` StateTaxCollectable float64 `json:"state_tax_collectable"` CountyTaxableAmount float64 `json:"county_taxable_amount"` CountyTaxRate float64 `json:"county_tax_rate"` CountyTaxCollectable float64 `json:"county_tax_collectable"` CityTaxableAmount float64 `json:"city_taxable_amount"` CityTaxRate float64 `json:"city_tax_rate"` CityTaxCollectable float64 `json:"city_tax_collectable"` SpecialTaxableAmount float64 `json:"special_district_taxable_amount"` SpecialTaxRate float64 `json:"special_tax_rate"` SpecialTaxCollectable float64 `json:"special_district_tax_collectable"` // For CA transactions GstTaxableAmount float64 `json:"gst_taxable_amount"` GstTaxCollectable float64 `json:"gst"` GstTaxRate float64 `json:"gst_tax_rate"` PstTaxableAmount float64 `json:"pst_taxable_amount"` PstTaxCollectable float64 `json:"pst"` PstTaxRate float64 `json:"pst_tax_rate"` QstTaxableAmount float64 `json:"qst_taxable_amount"` QstTaxCollectable float64 `json:"qst"` QstTaxRate float64 `json:"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 // contains filtered or unexported fields }
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"` StateSalesTaxRate float64 `json:"state_sales_tax_rate"` StateAmount float64 `json:"state_amount"` CountyTaxableAmount float64 `json:"county_taxable_amount"` CountyTaxRate float64 `json:"county_tax_rate"` CountyAmount float64 `json:"county_amount"` CityTaxableAmount float64 `json:"city_taxable_amount"` CityTaxRate float64 `json:"city_tax_rate"` CityAmount float64 `json:"city_amount"` SpecialTaxableAmount float64 `json:"special_district_taxable_amount"` SpecialTaxRate float64 `json:"special_tax_rate"` SpecialAmount float64 `json:"special_district_amount"` // For CA transactions GstTaxableAmount float64 `json:"gst_taxable_amount"` GstTaxRate float64 `json:"gst_tax_rate"` GstAmount float64 `json:"gst"` PstTaxableAmount float64 `json:"pst_taxable_amount"` PstTaxRate float64 `json:"pst_tax_rate"` PstAmount float64 `json:"pst"` QstTaxableAmount float64 `json:"qst_taxable_amount"` QstTaxRate float64 `json:"qst_tax_rate"` QstAmount float64 `json:"qst"` }
type Tax ¶
type Tax struct { Breakdown Breakdown `json:"breakdown"` OrderTotalAmount float64 `json:"order_total_amount"` Shipping float64 `json:"shipping"` TaxableAmount float64 `json:"taxable_amount"` Rate float64 `json:"rate"` AmountToCollect float64 `json:"amount_to_collect"` HasNexus bool `json:"has_nexus"` FreightTaxable bool `json:"freight_taxable"` TaxSource string `json:"tax_source"` }
type TaxApi ¶
type TaxApi struct {
// contains filtered or unexported fields
}
TaxApi implements TaxRepository
type TaxLineItem ¶
type TaxLineItem struct { Id string `json:"id"` // For US transactions StateTaxableAmount float64 `json:"state_taxable_amount"` StateSalesTaxRate float64 `json:"state_sales_tax_rate"` StateAmount float64 `json:"state_amount"` CountyTaxableAmount float64 `json:"county_taxable_amount"` CountyTaxRate float64 `json:"county_tax_rate"` CountyAmount float64 `json:"county_amount"` CityTaxableAmount float64 `json:"city_taxable_amount"` CityTaxRate float64 `json:"city_tax_rate"` CityAmount float64 `json:"city_amount"` SpecialTaxableAmount float64 `json:"special_district_taxable_amount"` SpecialTaxRate float64 `json:"special_tax_rate"` SpecialAmount float64 `json:"special_district_amount"` TaxCollectable float64 `json:"tax_collectable"` TaxableAmount float64 `json:"taxable_amount"` // For CA transactions GstTaxableAmount float64 `json:"gst_taxable_amount"` GstTaxRate float64 `json:"gst_tax_rate"` GstAmount float64 `json:"gst"` PstTaxableAmount float64 `json:"pst_taxable_amount"` PstTaxRate float64 `json:"pst_tax_rate"` PstAmount float64 `json:"pst"` QstTaxableAmount float64 `json:"qst_taxable_amount"` QstTaxRate float64 `json:"qst_tax_rate"` QstAmount float64 `json:"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 ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.