public CatalogUpdater(final StandaloneCatalog standaloneCatalog) { this.catalog = new DefaultMutableStaticCatalog(standaloneCatalog); this.catalog.setRecurringBillingMode(BillingMode.IN_ADVANCE); }
@Override public void addCurrency(final Currency currency) throws CatalogApiException { final Currency[] newEntries = allocateNewEntries(getCurrentSupportedCurrencies(), currency); setSupportedCurrencies(newEntries); }
private Plan getExistingPlan(final String planName) { try { return catalog.findCurrentPlan(planName); } catch (CatalogApiException e) { return null; } }
@Override public void addPriceList(final PriceList priceList) throws CatalogApiException { final PriceList[] newEntries = allocateNewEntries(getPriceLists().getChildPriceLists(), priceList); final DefaultPriceListSet priceListSet = new DefaultPriceListSet((PriceListDefault) getPriceLists().getDefaultPricelist(), (DefaultPriceList[]) newEntries); setPriceLists(priceListSet); }
product.setCatagory(desc.getProductCategory()); product.initialize(catalog); catalog.addProduct(product); plan.setPriceListName(PriceListSet.DEFAULT_PRICELIST_NAME); plan.setProduct(product); plan.setRecurringBillingMode(catalog.getRecurringBillingMode()); plan.setInitialPhases(new DefaultPlanPhase[]{trialPhase}); catalog.addPlan(plan); } else { validateExistingPlan(plan, desc); catalog.addCurrency(desc.getCurrency()); catalog.addRecurringPriceToPlan(recurring.getRecurringPrice(), new DefaultPrice().setCurrency(desc.getCurrency()).setValue(desc.getAmount())); catalog.addProductAvailableAO(getExistingProduct(bp), product); catalog.initialize(catalog);
public CatalogUpdater(final DateTime effectiveDate, final Currency... currencies) { final DefaultPriceList defaultPriceList = new DefaultPriceList().setName(PriceListSet.DEFAULT_PRICELIST_NAME); final StandaloneCatalog tmp = new StandaloneCatalog() .setCatalogName(DEFAULT_CATALOG_NAME) .setEffectiveDate(effectiveDate.toDate()) .setRecurringBillingMode(BillingMode.IN_ADVANCE) .setProducts(ImmutableList.<Product>of()) .setPlans(ImmutableList.<Plan>of()) .setPriceLists(new DefaultPriceListSet(defaultPriceList, new DefaultPriceList[0])) .setPlanRules(getSaneDefaultPlanRules(defaultPriceList)); if (currencies != null && currencies.length > 0) { tmp.setSupportedCurrencies(currencies); } else { tmp.setSupportedCurrencies(new Currency[0]); } tmp.initialize(tmp); this.catalog = new DefaultMutableStaticCatalog(tmp); }
@Override public void addPlan(final Plan plan) throws CatalogApiException { getCatalogEntityCollectionPlan().add(plan); final DefaultPriceList priceList = getPriceLists().findPriceListFrom(plan.getPriceListName()); priceList.getCatalogEntityCollectionPlan().add(plan); }
private Product getExistingProduct(final String productName) { try { return catalog.findCurrentProduct(productName); } catch (final CatalogApiException e) { return null; } }
public void addRecurringPriceToPlan(final DefaultInternationalPrice currentPrices, final Price newPrice) throws CatalogApiException { final Price[] newEntries = allocateNewEntries(currentPrices.getPrices(), newPrice); currentPrices.setPrices((DefaultPrice[]) newEntries); }
product.setCatagory(desc.getProductCategory()); product.initialize(catalog); catalog.addProduct(product); plan.setPriceListName(PriceListSet.DEFAULT_PRICELIST_NAME); plan.setProduct(product); plan.setRecurringBillingMode(catalog.getRecurringBillingMode()); plan.setInitialPhases(new DefaultPlanPhase[]{trialPhase}); catalog.addPlan(plan); } else { validateExistingPlan(plan, desc); catalog.addCurrency(desc.getCurrency()); catalog.addRecurringPriceToPlan(recurring.getRecurringPrice(), new DefaultPrice().setCurrency(desc.getCurrency()).setValue(desc.getAmount())); catalog.addProductAvailableAO(getExistingProduct(bp), product); catalog.initialize(catalog);
final StandaloneCatalog catalog = XMLLoader.getObjectFromString(Resources.getResource("SpyCarBasic.xml").toExternalForm(), StandaloneCatalog.class); final MutableStaticCatalog mutableCatalog = new DefaultMutableStaticCatalog(catalog);
@Override public void addPriceList(final PriceList priceList) throws CatalogApiException { final PriceList[] newEntries = allocateNewEntries(getPriceLists().getChildPriceLists(), priceList); final DefaultPriceListSet priceListSet = new DefaultPriceListSet((PriceListDefault) getPriceLists().getDefaultPricelist(), (DefaultPriceList[]) newEntries); setPriceLists(priceListSet); }
@Override public void addPlan(final Plan plan) throws CatalogApiException { getCatalogEntityCollectionPlan().add(plan); final DefaultPriceList priceList = getPriceLists().findPriceListFrom(plan.getPriceListName()); priceList.getCatalogEntityCollectionPlan().add(plan); }
private Product getExistingProduct(final String productName) { try { return catalog.findCurrentProduct(productName); } catch (final CatalogApiException e) { return null; } }
public void addRecurringPriceToPlan(final DefaultInternationalPrice currentPrices, final Price newPrice) throws CatalogApiException { final Price[] newEntries = allocateNewEntries(currentPrices.getPrices(), newPrice); currentPrices.setPrices((DefaultPrice[]) newEntries); }
final MutableStaticCatalog mutableCatalog = new DefaultMutableStaticCatalog(catalog);
@Override public void addCurrency(final Currency currency) throws CatalogApiException { final Currency[] newEntries = allocateNewEntries(getCurrentSupportedCurrencies(), currency); setSupportedCurrencies(newEntries); }
public CatalogUpdater(final StandaloneCatalog standaloneCatalog) { this.catalog = new DefaultMutableStaticCatalog(standaloneCatalog); this.catalog.setRecurringBillingMode(BillingMode.IN_ADVANCE); }
private Plan getExistingPlan(final String planName) { try { return catalog.findCurrentPlan(planName); } catch (CatalogApiException e) { return null; } }
final MutableStaticCatalog mutableCatalog = new DefaultMutableStaticCatalog(catalog);