getCoupon function

double getCoupon()

Implementation

double getCoupon(){
  if (couponId.isEmpty)
    return 0;
  double total = getCostWidthCount();
  total += getAddonsTotal();
  if (discountType == "percent" || discountType == "percentage")
    return total*discount/100;
  return discount;
}