use of org.killbill.billing.catalog.DefaultPriceList in project killbill by killbill.
the class TestCasePhase method testWildCardBillingPeriod.
@Test(groups = "fast")
public void testWildCardBillingPeriod() {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product = cat.getCurrentProduct(0);
final DefaultPriceList priceList = cat.getPriceLists().getDefaultPricelist();
final DefaultCaseResult cr = new DefaultCaseResult(product, ProductCategory.BASE, null, priceList, PhaseType.EVERGREEN, Result.FOO);
assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, cat.getCurrentProduct(1).getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.ANNUAL, priceList.getName(), PhaseType.EVERGREEN, cat);
assertionException(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", PhaseType.EVERGREEN, cat);
assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.TRIAL, cat);
}
use of org.killbill.billing.catalog.DefaultPriceList in project killbill by killbill.
the class DefaultPlanRules method findPriceList.
private DefaultPriceList findPriceList(final PlanSpecifier specifier, final StaticCatalog catalog) throws CatalogApiException {
DefaultPriceList result = DefaultCasePriceList.getResult(priceListCase, specifier, catalog);
if (result == null) {
final String priceListName = specifier.getPlanName() != null ? catalog.findCurrentPlan(specifier.getPlanName()).getPriceListName() : specifier.getPriceListName();
result = (DefaultPriceList) catalog.findCurrentPricelist(priceListName);
}
return result;
}
use of org.killbill.billing.catalog.DefaultPriceList in project killbill by killbill.
the class TestCasePhase method testWildCardPhaseType.
@Test(groups = "fast")
public void testWildCardPhaseType() {
final MockCatalog cat = new MockCatalog();
final DefaultProduct product = cat.getCurrentProduct(0);
final DefaultPriceList priceList = cat.getPriceLists().getDefaultPricelist();
final DefaultCaseResult cr = new DefaultCaseResult(product, ProductCategory.BASE, BillingPeriod.MONTHLY, priceList, null, Result.FOO);
assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, cat.getCurrentProduct(1).getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.EVERGREEN, cat);
assertionNull(cr, product.getName(), ProductCategory.BASE, BillingPeriod.ANNUAL, priceList.getName(), PhaseType.EVERGREEN, cat);
assertionException(cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, "dipsy", PhaseType.EVERGREEN, cat);
assertion(Result.FOO, cr, product.getName(), ProductCategory.BASE, BillingPeriod.MONTHLY, priceList.getName(), PhaseType.TRIAL, cat);
}
use of org.killbill.billing.catalog.DefaultPriceList in project killbill by killbill.
the class TestPlanRules method testExistingPriceListIsKept.
@Test(groups = "fast")
public void testExistingPriceListIsKept() throws CatalogApiException {
final DefaultProduct product1 = cat.getCurrentProduct(0);
final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
final PlanPhaseSpecifier from = new PlanPhaseSpecifier(product1.getName(), BillingPeriod.MONTHLY, priceList1.getName(), PhaseType.EVERGREEN);
final PlanSpecifier to = new PlanSpecifier(product1.getName(), BillingPeriod.ANNUAL, priceList1.getName());
PlanChangeResult result = null;
try {
result = cat.getPlanRules().planChange(from, to, cat);
} catch (IllegalPlanChange e) {
Assert.fail("We should not have triggered this error");
} catch (CatalogApiException e) {
Assert.fail("", e);
}
Assert.assertEquals(result.getPolicy(), BillingActionPolicy.END_OF_TERM);
Assert.assertEquals(result.getAlignment(), PlanAlignmentChange.START_OF_SUBSCRIPTION);
Assert.assertEquals(result.getNewPriceList(), priceList1);
}
use of org.killbill.billing.catalog.DefaultPriceList in project killbill by killbill.
the class TestPlanRules method testBaseCase.
@Test(groups = "fast")
public void testBaseCase() throws CatalogApiException {
final DefaultProduct product1 = cat.getCurrentProduct(0);
final DefaultProduct product2 = cat.getCurrentProduct(1);
final DefaultPriceList priceList1 = cat.findCurrentPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
final DefaultPriceList priceList2 = cat.getPriceLists().getChildPriceLists()[0];
final PlanPhaseSpecifier from = new PlanPhaseSpecifier(product1.getName(), BillingPeriod.MONTHLY, priceList1.getName(), PhaseType.EVERGREEN);
final PlanSpecifier to = new PlanSpecifier(product2.getName(), BillingPeriod.MONTHLY, null);
PlanChangeResult result = null;
try {
result = cat.getPlanRules().planChange(from, to, cat);
} catch (IllegalPlanChange e) {
Assert.fail("We should not have triggered this error");
} catch (CatalogApiException e) {
Assert.fail("", e);
}
Assert.assertEquals(result.getPolicy(), BillingActionPolicy.END_OF_TERM);
Assert.assertEquals(result.getAlignment(), PlanAlignmentChange.START_OF_SUBSCRIPTION);
Assert.assertEquals(result.getNewPriceList(), priceList2);
}
Aggregations