Files
go-cart-actor/pkg/cart/price.go
T
mats aa8b2bdedc
Build and Publish / BuildAndDeployAmd64 (push) Failing after 5s
Build and Publish / BuildAndDeployArm64 (push) Failing after 6s
all the refactor
2026-06-28 17:51:52 +02:00

27 lines
942 B
Go

package cart
import (
"git.k6n.net/mats/platform/money"
"git.k6n.net/mats/platform/tax"
)
// Price represents a monetary amount with optional VAT breakdown by rate.
// The canonical definition is now in platform/tax; this is a type alias
// for backward compatibility.
type Price = tax.Price
// NewPrice returns a new zero Price.
func NewPrice() *Price { return tax.NewPrice() }
// NewPriceFromIncVat creates a Price from an inc-VAT total and a tax rate in
// basis points (2500 = 25%, 1250 = 12.5%). Re-exported from platform/tax.
func NewPriceFromIncVat(incVat int64, rateBp int) *Price {
return tax.NewPriceFromIncVat(money.Cents(incVat), rateBp)
}
// MultiplyPrice multiplies a Price by quantity and returns a new Price.
func MultiplyPrice(p Price, qty int64) *Price { return tax.MultiplyPrice(p, qty) }
// SumPrices aggregates multiple Prices into one.
func SumPrices(prices ...Price) *Price { return tax.SumPrices(prices...) }