Details
diff --git a/api/src/main/java/com/ning/billing/beatrix/bus/api/ExtBusEvent.java b/api/src/main/java/com/ning/billing/beatrix/bus/api/ExtBusEvent.java
index ef84bd3..2804dbd 100644
--- a/api/src/main/java/com/ning/billing/beatrix/bus/api/ExtBusEvent.java
+++ b/api/src/main/java/com/ning/billing/beatrix/bus/api/ExtBusEvent.java
@@ -49,10 +49,9 @@ public interface ExtBusEvent {
public UUID getAccountId();
- /*
public UUID getTenantId();
-
+/*
public UUID getUserToken();
- */
+ */
}
diff --git a/api/src/main/java/com/ning/billing/beatrix/bus/api/ExtBusEventType.java b/api/src/main/java/com/ning/billing/beatrix/bus/api/ExtBusEventType.java
index 6ca5900..53358e1 100644
--- a/api/src/main/java/com/ning/billing/beatrix/bus/api/ExtBusEventType.java
+++ b/api/src/main/java/com/ning/billing/beatrix/bus/api/ExtBusEventType.java
@@ -16,7 +16,7 @@
package com.ning.billing.beatrix.bus.api;
/**
- * User visible bus event types.
+ * The enum {@code ExtBusEventType} rerpesents the user visible bus event types.
*/
public enum ExtBusEventType {
ACCOUNT_CREATION,
diff --git a/api/src/main/java/com/ning/billing/beatrix/bus/api/ExternalBus.java b/api/src/main/java/com/ning/billing/beatrix/bus/api/ExternalBus.java
index 7e5b814..10b2887 100644
--- a/api/src/main/java/com/ning/billing/beatrix/bus/api/ExternalBus.java
+++ b/api/src/main/java/com/ning/billing/beatrix/bus/api/ExternalBus.java
@@ -16,9 +16,23 @@
package com.ning.billing.beatrix.bus.api;
+/**
+ * The interface {@code ExternalBus} represents the bus on which Killbill users can register handlers
+ * to receive notifications when change happen in the system
+ */
public interface ExternalBus {
+ /**
+ * Registers a callback.
+ *
+ * @param handlerInstance the handler that will be called back by the system when something changed
+ */
public void register(final Object handlerInstance); /* throws EventBusException */
+ /**
+ * Unregister a callback.
+ *
+ * @param handlerInstance the handler that was previously registered
+ */
public void unregister(final Object handlerInstance); /* throws EventBusException */
}
diff --git a/api/src/main/java/com/ning/billing/entitlement/api/EntitlementService.java b/api/src/main/java/com/ning/billing/entitlement/api/EntitlementService.java
index 50d45a1..357c37c 100644
--- a/api/src/main/java/com/ning/billing/entitlement/api/EntitlementService.java
+++ b/api/src/main/java/com/ning/billing/entitlement/api/EntitlementService.java
@@ -18,5 +18,8 @@ package com.ning.billing.entitlement.api;
import com.ning.billing.lifecycle.KillbillService;
+/**
+ * The interface {@code EntitlementService} is a {@code KillbillService} required to handle entitlement operations
+ */
public interface EntitlementService extends KillbillService {
}
diff --git a/api/src/main/java/com/ning/billing/entitlement/api/migration/EntitlementMigrationApi.java b/api/src/main/java/com/ning/billing/entitlement/api/migration/EntitlementMigrationApi.java
index f0352e7..04a41a6 100644
--- a/api/src/main/java/com/ning/billing/entitlement/api/migration/EntitlementMigrationApi.java
+++ b/api/src/main/java/com/ning/billing/entitlement/api/migration/EntitlementMigrationApi.java
@@ -24,37 +24,98 @@ import com.ning.billing.catalog.api.PlanPhaseSpecifier;
import com.ning.billing.catalog.api.ProductCategory;
import com.ning.billing.util.callcontext.CallContext;
+/**
+ * The interface {@code EntitlementMigrationApi} is used to migrate entitlement data from third party system
+ * in an atomic way.
+ */
public interface EntitlementMigrationApi {
+ /**
+ * The interface {@code EntitlementAccountMigration} captures all the {@code SubscriptionBundle} associated with
+ * that account.
+ */
public interface EntitlementAccountMigration {
+
+ /**
+ *
+ * @return the unique id for the account
+ */
public UUID getAccountKey();
+ /**
+ *
+ * @return an array of {@code EntitlementBundleMigration}
+ */
public EntitlementBundleMigration[] getBundles();
}
+ /**
+ * The interface {@code EntitlementBundleMigration} captures all the {@code Subscription} asociated with a given
+ * {@code SubscriptionBundle}
+ */
public interface EntitlementBundleMigration {
+
+ /**
+ *
+ * @return the bundle external key
+ */
public String getBundleKey();
+ /**
+ *
+ * @return an array of {@code Subscription}
+ */
public EntitlementSubscriptionMigration[] getSubscriptions();
}
+ /**
+ * The interface {@code EntitlementSubscriptionMigration} captures the detail for each {@code Subscription} to be
+ * migrated.
+ */
public interface EntitlementSubscriptionMigration {
+
+ /**
+ *
+ * @return the {@code ProductCategory}
+ */
public ProductCategory getCategory();
+ /**
+ *
+ * @return the chargeTroughDate for that {@code Subscription}
+ */
public DateTime getChargedThroughDate();
+ /**
+ *
+ * @return the various phase information for that {@code Subscription}
+ */
public EntitlementSubscriptionMigrationCase[] getSubscriptionCases();
}
/**
- * Each case is either a PHASE or a different PlanSpecifier
+ * The interface {@code EntitlementSubscriptionMigrationCase} captures the details of
+ * phase for a {@code Subscription}.
+ *
*/
public interface EntitlementSubscriptionMigrationCase {
+ /**
+ *
+ * @return the {@code PlanPhaseSpecifier}
+ */
public PlanPhaseSpecifier getPlanPhaseSpecifier();
+ /**
+ *
+ * @return the date at which this phase starts.
+ */
public DateTime getEffectiveDate();
+ /**
+ *
+ * @return the date at which this phase is stopped.
+ */
public DateTime getCancelledDate();
}
diff --git a/api/src/main/java/com/ning/billing/entitlement/api/SubscriptionTransitionType.java b/api/src/main/java/com/ning/billing/entitlement/api/SubscriptionTransitionType.java
index 939b56b..6e6947e 100644
--- a/api/src/main/java/com/ning/billing/entitlement/api/SubscriptionTransitionType.java
+++ b/api/src/main/java/com/ning/billing/entitlement/api/SubscriptionTransitionType.java
@@ -15,18 +15,52 @@
*/
package com.ning.billing.entitlement.api;
+/**
+ * The {@code SubscriptionTransitionType}
+ */
public enum SubscriptionTransitionType {
+ /**
+ * Occurs when a {@code Subscription} got migrated to mark the start of the entitlement
+ */
MIGRATE_ENTITLEMENT,
+ /**
+ * Occurs when a a user created a {@code Subscription} (not migrated)
+ */
CREATE,
+ /**
+ * Occurs when a {@code Subscription} got migrated to mark the start of the billing
+ */
MIGRATE_BILLING,
+ /**
+ * Occurs when a {@code Subscription} got transferred to mark the start of the entitlement
+ */
TRANSFER,
+ /**
+ * Occurs when a user changed the current {@code Plan} of the {@code Subscription}
+ */
CHANGE,
+ /**
+ * Occurs when a user restarted a {@code Subscription} after it had been cancelled
+ */
RE_CREATE,
+ /**
+ * Occurs when a user cancelled the {@code Subscription}
+ */
CANCEL,
+ /**
+ * Occurs when a user uncancelled the {@code Subscription} before it reached its cancellation date
+ */
UNCANCEL,
+ /**
+ * Generated by the system to mark a change of phase
+ */
PHASE,
- // Transition to start of blocked billing overdue state
+ /**
+ * Generated by the system to mark the start of blocked billing overdue state
+ */
START_BILLING_DISABLED,
- // Transition to end of blocked billing overdue state
+ /**
+ * Generated by the system to mark the end of blocked billing overdue state
+ */
END_BILLING_DISABLED
}
diff --git a/api/src/main/java/com/ning/billing/entitlement/api/timeline/BundleTimeline.java b/api/src/main/java/com/ning/billing/entitlement/api/timeline/BundleTimeline.java
index 150af02..cfc3bab 100644
--- a/api/src/main/java/com/ning/billing/entitlement/api/timeline/BundleTimeline.java
+++ b/api/src/main/java/com/ning/billing/entitlement/api/timeline/BundleTimeline.java
@@ -19,13 +19,34 @@ package com.ning.billing.entitlement.api.timeline;
import java.util.List;
import java.util.UUID;
+/**
+ * The interface {@code BundleTimeline} shows a view of all the entitlement events for a specific
+ * {@code SubscriptionBundle}.
+ *
+ */
public interface BundleTimeline {
+ /**
+ *
+ * @return a unique viewId to identify whether two calls who display the same view or a different view
+ */
String getViewId();
+ /**
+ *
+ * @return the unique id for the {@SubscriptionBundle}
+ */
UUID getBundleId();
+ /**
+ *
+ * @return the external Key for the {@SubscriptionBundle}
+ */
String getExternalKey();
+ /**
+ *
+ * @return the list of {@code SubscriptionTimeline}
+ */
List<SubscriptionTimeline> getSubscriptions();
}
diff --git a/api/src/main/java/com/ning/billing/entitlement/api/timeline/SubscriptionTimeline.java b/api/src/main/java/com/ning/billing/entitlement/api/timeline/SubscriptionTimeline.java
index 81ed298..a521e89 100644
--- a/api/src/main/java/com/ning/billing/entitlement/api/timeline/SubscriptionTimeline.java
+++ b/api/src/main/java/com/ning/billing/entitlement/api/timeline/SubscriptionTimeline.java
@@ -23,34 +23,87 @@ import org.joda.time.DateTime;
import com.ning.billing.catalog.api.PlanPhaseSpecifier;
import com.ning.billing.entitlement.api.SubscriptionTransitionType;
+/**
+ * The interface {@code} shows a view of all the events for a particular {@code Subscription}.
+ * <p>
+ * It can be used to display information, or it can be used to modify the entitlement stream of events
+ * and 'repair' the stream by versioning the events.
+ */
public interface SubscriptionTimeline {
+ /**
+ *
+ * @return the unique id for that {@code Subscription}
+ */
public UUID getId();
+ /**
+ *
+ * @return the list of events that should be deleted when repairing the stream.
+ */
public List<DeletedEvent> getDeletedEvents();
+ /**
+ *
+ * @return the list of events that should be added when repairing the stream
+ */
public List<NewEvent> getNewEvents();
+ /**
+ *
+ * @return the current list of events for that {@code Subscription}
+ */
public List<ExistingEvent> getExistingEvents();
+ /**
+ *
+ * @return the active version for the event stream
+ */
public long getActiveVersion();
+
public interface DeletedEvent {
+
+ /**
+ *
+ * @return the unique if for the event to delete
+ */
public UUID getEventId();
}
public interface NewEvent {
+
+ /**
+ *
+ * @return the description for the event to be added
+ */
public PlanPhaseSpecifier getPlanPhaseSpecifier();
+ /**
+ *
+ * @return the date at which this event should be inserted into the stream
+ */
public DateTime getRequestedDate();
+ /**
+ *
+ * @return the {@code SubscriptionTransitionType} for the event
+ */
public SubscriptionTransitionType getSubscriptionTransitionType();
}
public interface ExistingEvent extends DeletedEvent, NewEvent {
+ /**
+ *
+ * @return the date at which this event was effective
+ */
public DateTime getEffectiveDate();
+ /**
+ *
+ * @return the name of the phase
+ */
public String getPlanPhaseName();
}
}
diff --git a/api/src/main/java/com/ning/billing/entitlement/api/transfer/EntitlementTransferApi.java b/api/src/main/java/com/ning/billing/entitlement/api/transfer/EntitlementTransferApi.java
index 71e325f..4d2b3dd 100644
--- a/api/src/main/java/com/ning/billing/entitlement/api/transfer/EntitlementTransferApi.java
+++ b/api/src/main/java/com/ning/billing/entitlement/api/transfer/EntitlementTransferApi.java
@@ -23,8 +23,24 @@ import org.joda.time.DateTime;
import com.ning.billing.entitlement.api.user.SubscriptionBundle;
import com.ning.billing.util.callcontext.CallContext;
+/**
+ * The interface {@code EntitlementTransferApi} is used to transfer a bundle from one account to another account.
+ */
public interface EntitlementTransferApi {
+ /**
+ *
+ * @param sourceAccountId the unique id for the account on which the bundle will be transferred from
+ * @param destAccountId the unique id for the account on which the bundle will be transferred to
+ * @param bundleKey the externalKey for the bundle
+ * @param requestedDate the date at which this transfer should occur
+ * @param transferAddOn whether or not we should also transfer ADD_ON subscriptions existing on that {@code SubscriptionBundle}
+ * @param cancelImmediately whether cancellation on the sourceAccount occurs immediately
+ * @param context the user context
+ * @return the newly created {@code SubscriptionBundle}
+ *
+ * @throws EntitlementTransferApiException if the system could not transfer the {@code SubscriptionBundle}
+ */
public SubscriptionBundle transferBundle(final UUID sourceAccountId, final UUID destAccountId, final String bundleKey, final DateTime requestedDate,
final boolean transferAddOn, final boolean cancelImmediately, final CallContext context)
throws EntitlementTransferApiException;
diff --git a/beatrix/src/main/java/com/ning/billing/beatrix/extbus/DefaultBusEvent.java b/beatrix/src/main/java/com/ning/billing/beatrix/extbus/DefaultBusEvent.java
index e95ec0e..70edcce 100644
--- a/beatrix/src/main/java/com/ning/billing/beatrix/extbus/DefaultBusEvent.java
+++ b/beatrix/src/main/java/com/ning/billing/beatrix/extbus/DefaultBusEvent.java
@@ -61,12 +61,12 @@ public class DefaultBusEvent implements ExtBusEvent {
public UUID getAccountId() {
return accountId;
}
-/*
+
@Override
public UUID getTenantId() {
return tenantId;
}
-*/
+
@Override
public String toString() {
return "DefaultBusEvent [eventType=" + eventType + ", objectType="