Tariff: add margins and uplifts (#16855)

This commit is contained in:
andig 2024-10-27 22:41:29 +01:00 • committed by GitHub
parent 98d2dc556b
commit 520d54b4d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,10 +1,12 @@
package tariff
type embed struct {
Margin float64 `mapstructure:"margin"`
Charges float64 `mapstructure:"charges"`
Tax float64 `mapstructure:"tax"`
Uplifts float64 `mapstructure:"uplifts"`
}
func (t *embed) totalPrice(price float64) float64 {
return (price + t.Charges) * (1 + t.Tax)
return (price*(1+t.Margin)+t.Charges)*(1+t.Tax) + t.Uplifts
}