You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.6 KiB
Go
57 lines
1.6 KiB
Go
package order
|
|
|
|
import (
|
|
"cls/internal/domain/coupon"
|
|
price2 "cls/internal/domain/price"
|
|
"testing"
|
|
)
|
|
|
|
func TestCreateOrder(t *testing.T) {
|
|
price := &price2.Price{
|
|
ID: 0,
|
|
TargetID: 2000798,
|
|
Type: 1,
|
|
Amount: 11,
|
|
OneMonthPrice: 0,
|
|
ThreeMonthsPrice: 0,
|
|
SixMonthsPrice: 0,
|
|
OneYearPrice: 0,
|
|
FirstMontDiscount: 0,
|
|
Discount: 0.1,
|
|
}
|
|
|
|
c := coupon.Coupon{Status: coupon.CouponStatusNormal, MinAmount: 2, Value: 2}
|
|
t.Log(c.CanUse(price.GetFinalAmount()))
|
|
|
|
//v := price.GetFinalAmount()
|
|
//t.Log("0.1", price.GetFinalAmountWitCoupon(1))
|
|
t.Log("0.1", price.GetFinalAmount())
|
|
price.Discount = 0.2
|
|
//t.Log("0.2", price.GetFinalAmountWitCoupon(1))
|
|
t.Log("0.2", price.GetFinalAmount())
|
|
price.Discount = 0.3
|
|
//t.Log("0.3", price.GetFinalAmountWitCoupon(1))
|
|
t.Log("0.3", price.GetFinalAmount())
|
|
price.Discount = 0.4
|
|
t.Log("0.4", price.GetFinalAmountWitCoupon(1))
|
|
//t.Log("0.4", price.GetFinalAmount())
|
|
price.Discount = 0.5
|
|
t.Log("0.5", price.GetFinalAmountWitCoupon(1))
|
|
//t.Log("0.5", price.GetFinalAmount())
|
|
price.Discount = 0.6
|
|
//t.Log("0.6", price.GetFinalAmountWitCoupon(1))
|
|
t.Log("0.6", price.GetFinalAmount())
|
|
price.Discount = 0.7
|
|
//t.Log("0.7", price.GetFinalAmountWitCoupon(1))
|
|
t.Log("0.7", price.GetFinalAmount())
|
|
price.Discount = 0.8
|
|
//t.Log("0.8", price.GetFinalAmountWitCoupon(1))
|
|
t.Log("0.8", price.GetFinalAmount())
|
|
price.Discount = 0.9
|
|
//t.Log("0.9", price.GetFinalAmountWitCoupon(1))
|
|
t.Log("0.9", price.GetFinalAmount())
|
|
price.Discount = 1
|
|
//t.Log("1", price.GetFinalAmountWitCoupon(1))
|
|
t.Log("1", price.GetFinalAmount())
|
|
}
|