package ordercalc
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func Test_DistributionPrice(t *testing.T) {
|
|
business := map[string]string{"Id": "4", "LevelId": "3", "Grade": "3"}
|
|
productSpecialPrice := make([]map[string]string, 0)
|
|
|
|
price := make(map[string]string)
|
|
price["BusinessId"] = "0"
|
|
price["BusinessLevelId"] = "2"
|
|
// price["DistributionPrice"] = "#distribution_price#+5"
|
|
price["DistributionPrice"] = "0.05"
|
|
|
|
// productSpecialPrice = append(productSpecialPrice, price)
|
|
|
|
price = make(map[string]string)
|
|
price["BusinessId"] = "0"
|
|
price["BusinessLevelId"] = "3"
|
|
price["DistributionPrice"] = "0.05"
|
|
|
|
// productSpecialPrice = append(productSpecialPrice, price)
|
|
|
|
price = make(map[string]string)
|
|
price["BusinessId"] = "0"
|
|
price["BusinessLevelId"] = ""
|
|
price["DistributionPrice"] = "12"
|
|
|
|
// productSpecialPrice = append(productSpecialPrice, price)
|
|
|
|
dis, err := DistributionPrice(business, productSpecialPrice, 0.07, "7:2:1", 0.5)
|
|
|
|
t.Log(dis)
|
|
t.Log(err)
|
|
}
|