killbill-memoizeit

catalog: Trivial renaming cleanup

3/8/2019 6:15:36 PM

Details

diff --git a/api/src/main/java/org/killbill/billing/subscription/api/user/SubscriptionBillingEvent.java b/api/src/main/java/org/killbill/billing/subscription/api/user/SubscriptionBillingEvent.java
index 91be9fb..43719a9 100644
--- a/api/src/main/java/org/killbill/billing/subscription/api/user/SubscriptionBillingEvent.java
+++ b/api/src/main/java/org/killbill/billing/subscription/api/user/SubscriptionBillingEvent.java
@@ -34,6 +34,6 @@ public interface SubscriptionBillingEvent {
 
     DateTime getLastChangePlanDate();
 
-    public Integer getBcdLocal();
+    Integer getBcdLocal();
 
 }
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/DefaultVersionedCatalog.java b/catalog/src/main/java/org/killbill/billing/catalog/DefaultVersionedCatalog.java
index 4eb9ff3..f6badd5 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/DefaultVersionedCatalog.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/DefaultVersionedCatalog.java
@@ -124,7 +124,7 @@ public class DefaultVersionedCatalog extends ValidatingConfig<DefaultVersionedCa
 
     private CatalogPlanEntry findCatalogPlanEntry(final PlanRequestWrapper wrapper,
                                                   final DateTime requestedDate,
-                                                  final DateTime subscriptionStartDate) throws CatalogApiException {
+                                                  final DateTime subscriptionChangePlanDate) throws CatalogApiException {
         final List<StandaloneCatalog> catalogs = versionsBeforeDate(requestedDate.toDate());
         if (catalogs.isEmpty()) {
             throw new CatalogApiException(ErrorCode.CAT_NO_CATALOG_FOR_GIVEN_DATE, requestedDate.toDate().toString());
@@ -149,9 +149,9 @@ public class DefaultVersionedCatalog extends ValidatingConfig<DefaultVersionedCa
 
             final boolean oldestCatalog = (i == 0);
             final DateTime catalogEffectiveDate = CatalogDateHelper.toUTCDateTime(c.getEffectiveDate());
-            final boolean catalogOlderThanSubscriptionStartDate = !subscriptionStartDate.isBefore(catalogEffectiveDate);
+            final boolean catalogOlderThanSubscriptionChangePlanDate = !subscriptionChangePlanDate.isBefore(catalogEffectiveDate);
             if (oldestCatalog || // Prevent issue with time granularity -- see #760
-                catalogOlderThanSubscriptionStartDate) { // It's a new subscription, this plan always applies
+                catalogOlderThanSubscriptionChangePlanDate) { // It's a new subscription, this plan always applies
                 return new CatalogPlanEntry(c, plan);
             } else { // It's an existing subscription
                 if (plan.getEffectiveDateForExistingSubscriptions() != null) { // If it is null, any change to this catalog does not apply to existing subscriptions
@@ -248,9 +248,9 @@ public class DefaultVersionedCatalog extends ValidatingConfig<DefaultVersionedCa
     @Override
     public Plan findPlan(final String name,
                          final DateTime requestedDate,
-                         final DateTime subscriptionStartDate)
+                         final DateTime subscriptionChangePlanDate)
             throws CatalogApiException {
-        final CatalogPlanEntry entry = findCatalogPlanEntry(new PlanRequestWrapper(name), requestedDate, subscriptionStartDate);
+        final CatalogPlanEntry entry = findCatalogPlanEntry(new PlanRequestWrapper(name), requestedDate, subscriptionChangePlanDate);
         return entry.getPlan();
     }
 
@@ -258,9 +258,9 @@ public class DefaultVersionedCatalog extends ValidatingConfig<DefaultVersionedCa
     public Plan createOrFindPlan(final PlanSpecifier spec,
                                  final PlanPhasePriceOverridesWithCallContext overrides,
                                  final DateTime requestedDate,
-                                 final DateTime subscriptionStartDate)
+                                 final DateTime subscriptionChangePlanDate)
             throws CatalogApiException {
-        final CatalogPlanEntry entry = findCatalogPlanEntry(new PlanRequestWrapper(spec, overrides), requestedDate, subscriptionStartDate);
+        final CatalogPlanEntry entry = findCatalogPlanEntry(new PlanRequestWrapper(spec, overrides), requestedDate, subscriptionChangePlanDate);
         return entry.getPlan();
     }
 
@@ -272,43 +272,43 @@ public class DefaultVersionedCatalog extends ValidatingConfig<DefaultVersionedCa
     @Override
     public PlanPhase findPhase(final String phaseName,
                                final DateTime requestedDate,
-                               final DateTime subscriptionStartDate)
+                               final DateTime subscriptionChangePlanDate)
             throws CatalogApiException {
         final String planName = DefaultPlanPhase.planName(phaseName);
-        final Plan plan = findPlan(planName, requestedDate, subscriptionStartDate);
+        final Plan plan = findPlan(planName, requestedDate, subscriptionChangePlanDate);
         return plan.findPhase(phaseName);
     }
 
     @Override
     public PriceList findPriceListForPlan(final String planName,
                                           final DateTime requestedDate,
-                                          final DateTime subscriptionStartDate)
+                                          final DateTime subscriptionChangePlanDate)
             throws CatalogApiException {
-        final CatalogPlanEntry entry = findCatalogPlanEntry(new PlanRequestWrapper(planName), requestedDate, subscriptionStartDate);
+        final CatalogPlanEntry entry = findCatalogPlanEntry(new PlanRequestWrapper(planName), requestedDate, subscriptionChangePlanDate);
         return entry.getStaticCatalog().findCurrentPricelist(entry.getPlan().getPriceListName());
     }
 
     @Override
     public BillingActionPolicy planCancelPolicy(final PlanPhaseSpecifier planPhase,
                                                 final DateTime requestedDate,
-                                                final DateTime subscriptionStartDate) throws CatalogApiException {
-        final StaticCatalog staticCatalog = getStaticCatalog(planPhase, requestedDate, subscriptionStartDate);
+                                                final DateTime subscriptionChangePlanDate) throws CatalogApiException {
+        final StaticCatalog staticCatalog = getStaticCatalog(planPhase, requestedDate, subscriptionChangePlanDate);
         return staticCatalog.planCancelPolicy(planPhase);
     }
 
     @Override
     public PlanAlignmentCreate planCreateAlignment(final PlanSpecifier specifier,
                                                    final DateTime requestedDate,
-                                                   final DateTime subscriptionStartDate) throws CatalogApiException {
-        final StaticCatalog staticCatalog = getStaticCatalog(specifier, requestedDate, subscriptionStartDate);
+                                                   final DateTime subscriptionChangePlanDate) throws CatalogApiException {
+        final StaticCatalog staticCatalog = getStaticCatalog(specifier, requestedDate, subscriptionChangePlanDate);
         return staticCatalog.planCreateAlignment(specifier);
     }
 
     @Override
     public BillingAlignment billingAlignment(final PlanPhaseSpecifier planPhase,
                                              final DateTime requestedDate,
-                                             final DateTime subscriptionStartDate) throws CatalogApiException {
-        final StaticCatalog staticCatalog = getStaticCatalog(planPhase, requestedDate, subscriptionStartDate);
+                                             final DateTime subscriptionChangePlanDate) throws CatalogApiException {
+        final StaticCatalog staticCatalog = getStaticCatalog(planPhase, requestedDate, subscriptionChangePlanDate);
         return staticCatalog.billingAlignment(planPhase);
     }
 
@@ -316,7 +316,7 @@ public class DefaultVersionedCatalog extends ValidatingConfig<DefaultVersionedCa
     public PlanChangeResult planChange(final PlanPhaseSpecifier from,
                                        final PlanSpecifier to,
                                        final DateTime requestedDate,
-                                       final DateTime subscriptionStartDate)
+                                       final DateTime subscriptionChangePlanDate)
             throws CatalogApiException {
         // Use the "to" specifier, to make sure the new plan always exists
         final StaticCatalog staticCatalog = versionForDate(requestedDate);
@@ -324,8 +324,8 @@ public class DefaultVersionedCatalog extends ValidatingConfig<DefaultVersionedCa
     }
 
     // Note that the PlanSpecifier billing period must refer here to the recurring phase one when a plan name isn't specified
-    private StaticCatalog getStaticCatalog(final PlanSpecifier spec, final DateTime requestedDate, final DateTime subscriptionStartDate) throws CatalogApiException {
-        final CatalogPlanEntry entry = findCatalogPlanEntry(new PlanRequestWrapper(spec), requestedDate, subscriptionStartDate);
+    private StaticCatalog getStaticCatalog(final PlanSpecifier spec, final DateTime requestedDate, final DateTime subscriptionChangePlanDate) throws CatalogApiException {
+        final CatalogPlanEntry entry = findCatalogPlanEntry(new PlanRequestWrapper(spec), requestedDate, subscriptionChangePlanDate);
         return entry.getStaticCatalog();
     }
 
diff --git a/catalog/src/test/java/org/killbill/billing/catalog/MockCatalog.java b/catalog/src/test/java/org/killbill/billing/catalog/MockCatalog.java
index dbdfce6..72b3c67 100644
--- a/catalog/src/test/java/org/killbill/billing/catalog/MockCatalog.java
+++ b/catalog/src/test/java/org/killbill/billing/catalog/MockCatalog.java
@@ -118,14 +118,14 @@ public class MockCatalog extends StandaloneCatalog implements Catalog {
     }
 
     @Override
-    public Plan findPlan(final String name, final DateTime effectiveDate, final DateTime subscriptionStartDate)
+    public Plan findPlan(final String name, final DateTime effectiveDate, final DateTime subscriptionChangePlanDate)
             throws CatalogApiException {
         return findCurrentPlan(name);
     }
 
     @Override
     public Plan createOrFindPlan(final PlanSpecifier spec, final PlanPhasePriceOverridesWithCallContext overrides, final DateTime requestedDate,
-                                 final DateTime subscriptionStartDate) throws CatalogApiException {
+                                 final DateTime subscriptionChangePlanDate) throws CatalogApiException {
         return createOrFindCurrentPlan(spec, overrides);
     }
 
@@ -135,34 +135,34 @@ public class MockCatalog extends StandaloneCatalog implements Catalog {
     }
 
     @Override
-    public PlanPhase findPhase(final String name, final DateTime requestedDate, final DateTime subscriptionStartDate)
+    public PlanPhase findPhase(final String name, final DateTime requestedDate, final DateTime subscriptionChangePlanDate)
             throws CatalogApiException {
         return findCurrentPhase(name);
     }
 
     @Override
-    public PriceList findPriceListForPlan(final String name, final DateTime requestedDate, final DateTime subscriptionStartDate) throws CatalogApiException {
+    public PriceList findPriceListForPlan(final String name, final DateTime requestedDate, final DateTime subscriptionChangePlanDate) throws CatalogApiException {
         return findCurrentPricelist(findCurrentPlan(name).getPriceListName());
     }
 
     @Override
-    public PlanChangeResult planChange(final PlanPhaseSpecifier from, final PlanSpecifier to, final DateTime requestedDate, final DateTime subscriptionStartDate) {
+    public PlanChangeResult planChange(final PlanPhaseSpecifier from, final PlanSpecifier to, final DateTime requestedDate, final DateTime subscriptionChangePlanDate) {
         return planChange(from, to);
     }
 
     @Override
-    public BillingActionPolicy planCancelPolicy(final PlanPhaseSpecifier planPhase, final DateTime requestedDate, final DateTime subscriptionStartDate)
+    public BillingActionPolicy planCancelPolicy(final PlanPhaseSpecifier planPhase, final DateTime requestedDate, final DateTime subscriptionChangePlanDate)
             throws CatalogApiException {
         return planCancelPolicy(planPhase);
     }
 
     @Override
-    public PlanAlignmentCreate planCreateAlignment(final PlanSpecifier specifier, final DateTime requestedDate, final DateTime subscriptionStartDate) {
+    public PlanAlignmentCreate planCreateAlignment(final PlanSpecifier specifier, final DateTime requestedDate, final DateTime subscriptionChangePlanDate) {
         return planCreateAlignment(specifier);
     }
 
     @Override
-    public BillingAlignment billingAlignment(final PlanPhaseSpecifier planPhase, final DateTime requestedDate, final DateTime subscriptionStartDate) {
+    public BillingAlignment billingAlignment(final PlanPhaseSpecifier planPhase, final DateTime requestedDate, final DateTime subscriptionChangePlanDate) {
         return billingAlignment(planPhase);
     }
 
diff --git a/catalog/src/test/java/org/killbill/billing/catalog/TestVersionedCatalog.java b/catalog/src/test/java/org/killbill/billing/catalog/TestVersionedCatalog.java
index 4a24cf6..6f1709a 100644
--- a/catalog/src/test/java/org/killbill/billing/catalog/TestVersionedCatalog.java
+++ b/catalog/src/test/java/org/killbill/billing/catalog/TestVersionedCatalog.java
@@ -77,14 +77,14 @@ public class TestVersionedCatalog extends CatalogTestSuiteNoDB {
     public void testFindPlanAcrossVersions() throws Exception {
 
         // Existing subscription
-        final DateTime subscriptionStartDate = new DateTime("2011-02-02T00:01:00+00:00"); // dt2 (v2) < subscriptionStartDate < dt2a (v2a)
+        final DateTime subscriptionChangePlanDate = new DateTime("2011-02-02T00:01:00+00:00"); // dt2 (v2) < subscriptionChangePlanDate < dt2a (v2a)
 
 
-        Plan plan = vc.findPlan("shotgun-quarterly", dt2, subscriptionStartDate);
+        Plan plan = vc.findPlan("shotgun-quarterly", dt2, subscriptionChangePlanDate);
         Assert.assertEquals(plan.getAllPhases()[1].getRecurring().getRecurringPrice().getPrice(Currency.USD), new BigDecimal("249.95"));
 
         // We still see old price because the requested date is >= dt2a and there is no effectiveDateForExistingSubscriptions
-        plan = vc.findPlan("shotgun-quarterly", dt2a, subscriptionStartDate);
+        plan = vc.findPlan("shotgun-quarterly", dt2a, subscriptionChangePlanDate);
         Assert.assertEquals(plan.getAllPhases()[1].getRecurring().getRecurringPrice().getPrice(Currency.USD), new BigDecimal("249.95"));
     }
 
@@ -97,7 +97,7 @@ public class TestVersionedCatalog extends CatalogTestSuiteNoDB {
     @Test(groups = "fast")
     public void testFindPlanAcrossVersionsUsingEffectiveDateForExistingSubscriptions() throws Exception {
 
-        // Easy cases where subscriptionStartDate = requestedDate -> fetch date from the only valid version
+        // Easy cases where subscriptionChangePlanDate = requestedDate -> fetch date from the only valid version
         Plan plan = vc.findPlan("pistol-monthly", dt1, dt1);
         Assert.assertEquals(plan.getAllPhases()[1].getRecurring().getRecurringPrice().getPrice(Currency.USD), new BigDecimal("29.95"));
 
@@ -111,17 +111,17 @@ public class TestVersionedCatalog extends CatalogTestSuiteNoDB {
         Assert.assertEquals(plan.getAllPhases()[1].getRecurring().getRecurringPrice().getPrice(Currency.USD), new BigDecimal("49.95"));
 
         // Case with an existing subscription (prior first price change)
-        final DateTime subscriptionStartDate = new DateTime("2011-01-01T00:01:00+00:00"); // dt1 (v1) < subscriptionStartDate < dt2 (v2)
+        final DateTime subscriptionChangePlanDate = new DateTime("2011-01-01T00:01:00+00:00"); // dt1 (v1) < subscriptionChangePlanDate < dt2 (v2)
 
         // Returns old price because of effectiveDateForExistingSubscriptions > requestedDate = dt2
-        plan = vc.findPlan("pistol-monthly", dt2, subscriptionStartDate);
+        plan = vc.findPlan("pistol-monthly", dt2, subscriptionChangePlanDate);
         Assert.assertEquals(plan.getAllPhases()[1].getRecurring().getRecurringPrice().getPrice(Currency.USD), new BigDecimal("29.95"));
 
         // Returns nw  price because of effectiveDateForExistingSubscriptions = requestedDate = dt2
-        plan = vc.findPlan("pistol-monthly", dEffectiveDateForExistingSubscriptions, subscriptionStartDate);
+        plan = vc.findPlan("pistol-monthly", dEffectiveDateForExistingSubscriptions, subscriptionChangePlanDate);
         Assert.assertEquals(plan.getAllPhases()[1].getRecurring().getRecurringPrice().getPrice(Currency.USD), new BigDecimal("39.95"));
 
-        plan = vc.findPlan("pistol-monthly", dt3, subscriptionStartDate);
+        plan = vc.findPlan("pistol-monthly", dt3, subscriptionChangePlanDate);
         Assert.assertEquals(plan.getAllPhases()[1].getRecurring().getRecurringPrice().getPrice(Currency.USD), new BigDecimal("39.95"));
     }
 
@@ -133,7 +133,7 @@ public class TestVersionedCatalog extends CatalogTestSuiteNoDB {
 
         final PlanSpecifier pistolMonthly = new PlanSpecifier("Pistol", BillingPeriod.MONTHLY, "DEFAULT");
 
-        // Easy cases where subscriptionStartDate = requestedDate -> fetch date from the only valid version
+        // Easy cases where subscriptionChangePlanDate = requestedDate -> fetch date from the only valid version
         Plan plan = vc.createOrFindPlan(pistolMonthly, null, dt1, dt1);
         Assert.assertEquals(plan.getAllPhases()[1].getRecurring().getRecurringPrice().getPrice(Currency.USD), new BigDecimal("29.95"));