class DiscountingCmsLegPricer {

  public CurrencyAmount currentCash(
      ResolvedCmsLeg cmsLeg,
      RatesProvider ratesProvider) {

    return cmsLeg.getCmsPeriods()
        .stream()
        .filter(x -> x.getPaymentDate().equals(ratesProvider.getValuationDate()))
        .map(x -> cmsPeriodPricer.presentValue(x, ratesProvider))
        .reduce((c1, c2) -> c1.plus(c2))
        .orElse(CurrencyAmount.zero(cmsLeg.getCurrency()));
  }

  public  DiscountingCmsLegPricer(DiscountingCmsPeriodPricer cmsPeriodPricer);

}