@Override public List<Listing> getAvailableAddOnListings(final String baseProductName, @Nullable final String priceListName) { final List<Listing> availAddons = new ArrayList<Listing>(); try { final Product product = findCurrentProduct(baseProductName); if (product != null) { for (final Product availAddon : product.getAvailable()) { for (final BillingPeriod billingPeriod : BillingPeriod.values()) { for (final PriceList priceList : getPriceLists().getAllPriceLists()) { if (priceListName == null || priceListName.equals(priceList.getName())) { final Collection<Plan> addonInList = priceList.findPlans(availAddon, billingPeriod); for (final Plan cur : addonInList) { availAddons.add(new DefaultListing(cur, priceList)); } } } } } } } catch (final CatalogApiException e) { // No such product - just return an empty list } return availAddons; }
final LocalDate[] perBillingPeriodMostRecentConsumableInArrearItemEndDate = new LocalDate[BillingPeriod.values().length - 1]; // Exclude the NO_BILLING_PERIOD int idx = 0; for (final BillingPeriod bp : BillingPeriod.values()) { if (bp != BillingPeriod.NO_BILLING_PERIOD) { final LocalDate makerDateThanCannotBeChosenAsTheMinOfAllDates = InvoiceDateUtils.advanceByNPeriods(targetDate, bp, config.getMaxRawUsagePreviousPeriod(internalCallContext)); for (final BillingPeriod bp : BillingPeriod.values()) { if (bp != BillingPeriod.NO_BILLING_PERIOD) { final LocalDate tmp = perBillingPeriodMostRecentConsumableInArrearItemEndDate[idx];
@Override public List<Listing> getAvailableAddOnListings(final String baseProductName, @Nullable final String priceListName) { final List<Listing> availAddons = new ArrayList<Listing>(); try { final Product product = findCurrentProduct(baseProductName); if (product != null) { for (final Product availAddon : product.getAvailable()) { for (final BillingPeriod billingPeriod : BillingPeriod.values()) { for (final PriceList priceList : getPriceLists().getAllPriceLists()) { if (priceListName == null || priceListName.equals(priceList.getName())) { final Collection<Plan> addonInList = priceList.findPlans(availAddon, billingPeriod); for (final Plan cur : addonInList) { availAddons.add(new DefaultListing(cur, priceList)); } } } } } } } catch (final CatalogApiException e) { // No such product - just return an empty list } return availAddons; }