36 lines
1.2 KiB
Go
36 lines
1.2 KiB
Go
package order
|
|
|
|
import (
|
|
"git.k6n.net/mats/platform/money"
|
|
"git.k6n.net/mats/platform/tax"
|
|
)
|
|
|
|
// TaxProvider computes taxes for orders and line items.
|
|
// The canonical definition is in platform/tax; this is a type alias
|
|
// for backward compatibility.
|
|
type TaxProvider = tax.Provider
|
|
|
|
// ComputeTax is the shared ex-VAT-first tax formula. rateBp is basis points
|
|
// (2500 = 25%). Re-exported from platform/tax for backward compatibility.
|
|
func ComputeTax(total money.Cents, rateBp int) money.Cents {
|
|
return money.Cents(tax.Compute(total.Int64(), rateBp))
|
|
}
|
|
|
|
// NordicTaxProvider implements TaxProvider for the Nordic countries.
|
|
// Re-exported from platform/tax for backward compatibility.
|
|
type NordicTaxProvider = tax.Nordic
|
|
|
|
// NewNordicTaxProvider returns a new NordicTaxProvider.
|
|
func NewNordicTaxProvider(defaultCountry string) *NordicTaxProvider {
|
|
return tax.NewNordic(defaultCountry)
|
|
}
|
|
|
|
// StaticTaxProvider is a stateless TaxProvider with no country awareness.
|
|
// Re-exported from platform/tax for backward compatibility.
|
|
type StaticTaxProvider = tax.Static
|
|
|
|
// NewStaticTaxProvider returns a new StaticTaxProvider.
|
|
func NewStaticTaxProvider() *StaticTaxProvider {
|
|
return tax.NewStatic()
|
|
}
|