25 lines
834 B
Go
25 lines
834 B
Go
package cart
|
|
|
|
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 now in platform/tax; this is a type alias
|
|
// for backward compatibility.
|
|
type TaxProvider = tax.Provider
|
|
|
|
// ComputeTax returns the VAT portion of an inc-VAT total. rateBp is basis points
|
|
// (2500 = 25%). Re-exported from platform/tax.
|
|
func ComputeTax(total money.Cents, rateBp int) money.Cents {
|
|
return money.Cents(tax.Compute(total.Int64(), rateBp))
|
|
}
|
|
|
|
// StaticTaxProvider is a stateless, always-available TaxProvider.
|
|
// Re-exported from platform/tax for backward compatibility.
|
|
type StaticTaxProvider = tax.Static
|
|
|
|
// NewStaticTaxProvider returns a new StaticTaxProvider.
|
|
func NewStaticTaxProvider() *StaticTaxProvider { return tax.NewStatic() }
|