class DiscountingPaymentPricer {

  public double presentValueAmount(Payment payment, BaseProvider provider) {
    // duplicated code to avoid looking up in the provider when not necessary
    if (provider.getValuationDate().isAfter(payment.getDate())) {
      return 0d;
    }
    double df = provider.discountFactor(payment.getCurrency(), payment.getDate());
    return payment.getAmount() * df;
  }

  public  DiscountingPaymentPricer();

}