Пример #1
0
func (this *OrderCoupon) Clone(coupon promotion.ICoupon,
	orderId int, orderFee float32) *OrderCoupon {
	v := coupon.GetValue()
	this.CouponCode = v.Code
	this.CouponId = v.Id
	this.OrderId = orderId
	this.Fee = coupon.GetCouponFee(orderFee)
	this.Describe = coupon.GetDescribe()
	this.SendIntegral = v.Integral
	return this
}
Пример #2
0
func (this *Order) ApplyCoupon(coupon promotion.ICoupon) error {
	if this._coupons == nil {
		this._coupons = []promotion.ICoupon{}
	}
	this._coupons = append(this._coupons, coupon)

	//val := coupon.GetValue()
	v := this._value
	//v.CouponCode = val.Code
	//v.CouponDescribe = coupon.GetDescribe()
	v.CouponFee = coupon.GetCouponFee(v.Fee)
	v.PayFee = v.Fee - v.CouponFee
	v.DiscountFee = v.DiscountFee + v.CouponFee
	return nil
}