package com.ning.billing.catalog;
import com.ning.billing.catalog.api.BillingPeriod;
import com.ning.billing.catalog.api.PhaseType;
import com.ning.billing.catalog.api.ProductCategory;
import com.ning.billing.catalog.rules.CaseCancelPolicy;
import com.ning.billing.catalog.rules.CaseChangePlanAlignment;
import com.ning.billing.catalog.rules.CaseChangePlanPolicy;
import com.ning.billing.catalog.rules.CaseCreateAlignment;
import com.ning.billing.catalog.rules.PlanRules;
import java.util.Date;
public class MockCatalog extends StandaloneCatalog {
private static final String[] PRODUCT_NAMES = new String[]{ "TestProduct1", "TestProduct2", "TestProduct3"};
public MockCatalog() {
setEffectiveDate(new Date());
setProducts(MockProduct.createAll());
setPlans(MockPlan.createAll());
populateRules();
populatePriceLists();
}
public void populateRules(){
setPlanRules(new PlanRules());
}
public void setRules(
CaseChangePlanPolicy[] caseChangePlanPolicy,
CaseChangePlanAlignment[] caseChangePlanAlignment,
CaseCancelPolicy[] caseCancelPolicy,
CaseCreateAlignment[] caseCreateAlignment
){
}
public void populatePriceLists() {
DefaultPlan[] plans = getCurrentPlans();
DefaultPriceList[] priceList = new DefaultPriceList[plans.length - 1];
for(int i = 1; i < plans.length; i++) {
priceList[i-1] = new DefaultPriceList(new DefaultPlan[]{plans[i]},plans[i].getName()+ "-pl");
}
DefaultPriceListSet set = new DefaultPriceListSet(new PriceListDefault(new DefaultPlan[]{plans[0]}),priceList);
setPriceLists(set);
}
public String[] getProductNames() {
return PRODUCT_NAMES;
}
}