Пример #1
0
  @Override
  public double getGpl(String partNumber, Map<String, Pricelist> pricelistsMap) {
    Pricelist pricelist = pricelistsMap.get(partNumber);

    if (pricelist == null) {
      throw new CiscoException(String.format("NO price found for part number %s", partNumber));
    }

    double gpl = pricelist.getGpl();

    return gpl;
  }
Пример #2
0
  @Override
  public double getDiscount(
      Dart selectedDart, Promo promo, Pricelist pricelist, long shippedDateInMillis) {

    if (selectedDart != EMPTY_DART) {
      return selectedDart.getDistiDiscount();
    }

    boolean promoIsValid = promoValidator.isValid(promo, shippedDateInMillis);
    if (promoIsValid) {
      return promo.getDiscount();
    }

    if (pricelist != null) {
      return pricelist.getDiscount();
    }

    logger.debug(NO_PRICE_FOUND_MESSAGE);
    throw new CiscoException(NO_PRICE_FOUND_MESSAGE);
  }