public void PercentOff(Voucher voucher, Basket basket, BasketVoucher basketVoucher) { if (voucher.MinSpend > basket.BasketTotal()) { basketVoucher.Value = (voucher.Value * (basket.BasketTotal() / 100)) * -1; basketVoucher.VoucherCode = voucher.VoucherCode; basketVoucher.VoucherDescription = voucher.VoucherDescription; basketVoucher.VoucherId = voucher.VoucherId; basket.AddBasketVoucher(basketVoucher); } }
public void MoneyOff(Voucher voucher, Basket basket, BasketVoucher basketVoucher) { decimal basketTotal = basket.BasketTotal(); if (voucher.MinSpend <= basketTotal) { basketVoucher.Value = voucher.Value * -1; basketVoucher.VoucherCode = voucher.VoucherCode; basketVoucher.VoucherDescription = voucher.VoucherDescription; basketVoucher.VoucherId = voucher.VoucherId; basket.AddBasketVoucher(basketVoucher); } }