Interface EntitlementApi
-
- All Superinterfaces:
KillbillApi
public interface EntitlementApi extends KillbillApi
Primary API to manage the creation and retrieval ofEntitlement.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description UUIDaddEntitlement(UUID bundleId, EntitlementSpecifier spec, org.joda.time.LocalDate entitlementEffectiveDate, org.joda.time.LocalDate billingEffectiveDate, boolean isMigrated, Iterable<PluginProperty> properties, CallContext context)Adds an ADD_ON|STANDALONE entitlement to previously created entitlement.UUIDcreateBaseEntitlement(UUID accountId, EntitlementSpecifier spec, String bundleExternalKey, org.joda.time.LocalDate entitlementEffectiveDate, org.joda.time.LocalDate billingEffectiveDate, boolean isMigrated, boolean renameCancelledBundleIfExist, Iterable<PluginProperty> properties, CallContext context)Create a new entitlement for that account.List<UUID>createBaseEntitlementsWithAddOns(UUID accountId, Iterable<BaseEntitlementWithAddOnsSpecifier> baseEntitlementWithAddOnsSpecifier, boolean renameCancelledBundleIfExist, Iterable<PluginProperty> properties, CallContext context)Create multiple new entitlements with addOn entitlements for that account.List<Entitlement>getAllEntitlementsForAccountId(UUID accountId, TenantContext context)Retrieves all theEntitlementfor a given account.List<Entitlement>getAllEntitlementsForAccountIdAndBundleExternalKey(UUID accountId, String bundleExternalKey, TenantContext context)Retrieves all theEntitlementfor a given account and matching an external key.List<Entitlement>getAllEntitlementsForBundle(UUID bundleId, TenantContext context)Retrieves all theEntitlementattached to the base entitlement.List<EntitlementAOStatusDryRun>getDryRunStatusForChange(UUID bundleId, String targetProductName, org.joda.time.LocalDate effectiveDate, TenantContext context)Simulate a change of product for the BP on that bundle and return the effect it would have on the existing ADD_ON-- if any.EntitlementgetEntitlementForId(UUID id, boolean includeDeletedEvents, TenantContext context)Retrieves anEntitlementusing its id.voidpause(UUID bundleId, org.joda.time.LocalDate effectiveDate, Iterable<PluginProperty> properties, CallContext context)Will pause all entitlements associated with the base entitlement.voidresume(UUID bundleId, org.joda.time.LocalDate effectiveDate, Iterable<PluginProperty> properties, CallContext context)Will resume all entitlements associated with the base entitlement.UUIDtransferEntitlements(UUID sourceAccountId, UUID destAccountId, String bundleExternalKey, org.joda.time.LocalDate effectiveDate, Map<UUID,String> subExtKeys, BcdTransfer bcdTransfer, Iterable<PluginProperty> properties, CallContext context)Transfer all theEntitlementFor the source account and matching the external key to the destination account.UUIDtransferEntitlementsOverrideBillingPolicy(UUID sourceAccountId, UUID destAccountId, String bundleExternalKey, org.joda.time.LocalDate effectiveDate, Map<UUID,String> subExtKeys, BillingActionPolicy billingPolicy, BcdTransfer bcdTransfer, Iterable<PluginProperty> properties, CallContext context)Transfer all theEntitlementfor the source account and matching the external key to the destination account.
-
-
-
Method Detail
-
createBaseEntitlement
UUID createBaseEntitlement(UUID accountId, EntitlementSpecifier spec, String bundleExternalKey, org.joda.time.LocalDate entitlementEffectiveDate, org.joda.time.LocalDate billingEffectiveDate, boolean isMigrated, boolean renameCancelledBundleIfExist, Iterable<PluginProperty> properties, CallContext context) throws EntitlementApiException
Create a new entitlement for that account. ThePlanPhaseSpecifiershould refer to aProductCategory.BASEofProductCategory.STANDALONE.- Parameters:
accountId- the account idspec- the product specification for that new entitlementbundleExternalKey- the bundle external keyentitlementEffectiveDate- the date at which the entitlement should start. if this is null this is assumed nowbillingEffectiveDate- the date at which the billing for the subscription should start. if this is null this is assumed nowisMigrated- whether this subscription comes from a different system (migrated into Kill Bill)renameCancelledBundleIfExist- rename bundle external key associated to other bundles with same key where subscriptions were cancelledproperties- plugin specific propertiescontext- the context- Returns:
- the entitlement id created
- Throws:
EntitlementApiException- if the system fail to create theEntitlement.
-
createBaseEntitlementsWithAddOns
List<UUID> createBaseEntitlementsWithAddOns(UUID accountId, Iterable<BaseEntitlementWithAddOnsSpecifier> baseEntitlementWithAddOnsSpecifier, boolean renameCancelledBundleIfExist, Iterable<PluginProperty> properties, CallContext context) throws EntitlementApiException
Create multiple new entitlements with addOn entitlements for that account.- Parameters:
accountId- the account idbaseEntitlementWithAddOnsSpecifier- a list of baseEntitlementWithAddOns specifierrenameCancelledBundleIfExist- rename bundle external key associated to other bundles with same key where subscriptions were cancelledproperties- plugin specific propertiescontext- the context- Returns:
- the list of entitlement id created
- Throws:
EntitlementApiException- if the system fail to create the List ofEntitlement.
-
addEntitlement
UUID addEntitlement(UUID bundleId, EntitlementSpecifier spec, org.joda.time.LocalDate entitlementEffectiveDate, org.joda.time.LocalDate billingEffectiveDate, boolean isMigrated, Iterable<PluginProperty> properties, CallContext context) throws EntitlementApiException
Adds an ADD_ON|STANDALONE entitlement to previously created entitlement. ThePlanPhaseSpecifiershould refer to aProductCategory.ADD_ON or ProductCategory.STANDALONE. The new entitlement will be bundled using the bundleExternalKey that was specified when creating the base entitlement.- Parameters:
bundleId- the id of the bundlespec- the product specification for that new entitlemententitlementEffectiveDate- the date at which the entitlement should start. if this is null this is assumed nowbillingEffectiveDate- the date at which the billing for the subscription should start. if this is null this is assumed nowisMigrated- whether this subscription comes from a different system (migrated into Kill Bill)properties- plugin specific propertiescontext- the context- Returns:
- the entitlement id created
- Throws:
EntitlementApiException- if the system fail to create theEntitlement
-
getDryRunStatusForChange
List<EntitlementAOStatusDryRun> getDryRunStatusForChange(UUID bundleId, String targetProductName, org.joda.time.LocalDate effectiveDate, TenantContext context) throws EntitlementApiException
Simulate a change of product for the BP on that bundle and return the effect it would have on the existing ADD_ON-- if any.- Parameters:
bundleId- the id of the bundletargetProductName- the target product name for the BPeffectiveDate- the date at which the change would occurcontext- the context- Returns:
- the status for the existing ADD_ON
Entitlement - Throws:
EntitlementApiException- if this operation is not carried on a base plan.
-
pause
void pause(UUID bundleId, org.joda.time.LocalDate effectiveDate, Iterable<PluginProperty> properties, CallContext context) throws EntitlementApiException
Will pause all entitlements associated with the base entitlement. If there are no ADD_ONN this is only the base entitlement.- Parameters:
bundleId-effectiveDate-properties- plugin specific propertiescontext-- Throws:
EntitlementApiException- if the system fail to find the baseEntitlement
-
resume
void resume(UUID bundleId, org.joda.time.LocalDate effectiveDate, Iterable<PluginProperty> properties, CallContext context) throws EntitlementApiException
Will resume all entitlements associated with the base entitlement. If there are no ADD_ONN this is only the base entitlement.- Parameters:
bundleId-effectiveDate-properties- plugin specific propertiescontext-- Throws:
EntitlementApiException- if the system fail to find the baseEntitlement
-
getEntitlementForId
Entitlement getEntitlementForId(UUID id, boolean includeDeletedEvents, TenantContext context) throws EntitlementApiException
Retrieves anEntitlementusing its id.- Parameters:
id- the id of the entitlementincludeDeletedEvents- flag that specifies whether deleted events should be returnedcontext- the context- Returns:
- the entitlement
- Throws:
EntitlementApiException- if the entitlement does not exist
-
getAllEntitlementsForBundle
List<Entitlement> getAllEntitlementsForBundle(UUID bundleId, TenantContext context) throws EntitlementApiException
Retrieves all theEntitlementattached to the base entitlement.- Parameters:
bundleId- the id of the bundlecontext- the context- Returns:
- a list of entitlements
- Throws:
EntitlementApiException- if the entitlement does not exist
-
getAllEntitlementsForAccountIdAndBundleExternalKey
List<Entitlement> getAllEntitlementsForAccountIdAndBundleExternalKey(UUID accountId, String bundleExternalKey, TenantContext context) throws EntitlementApiException
Retrieves all theEntitlementfor a given account and matching an external key.- Parameters:
accountId- the account idbundleExternalKey- the bundle external keycontext- the context- Returns:
- a list of entitlements
- Throws:
EntitlementApiException- if the account does not exist
-
getAllEntitlementsForAccountId
List<Entitlement> getAllEntitlementsForAccountId(UUID accountId, TenantContext context) throws EntitlementApiException
Retrieves all theEntitlementfor a given account.- Parameters:
accountId- the account idcontext- the context- Returns:
- a list of entitlements
- Throws:
EntitlementApiException- if the account does not exist
-
transferEntitlements
UUID transferEntitlements(UUID sourceAccountId, UUID destAccountId, String bundleExternalKey, org.joda.time.LocalDate effectiveDate, Map<UUID,String> subExtKeys, BcdTransfer bcdTransfer, Iterable<PluginProperty> properties, CallContext context) throws EntitlementApiException
Transfer all theEntitlementFor the source account and matching the external key to the destination account. The date is interpreted by the system to be in the timezone specified at the destinationAccount. TheEntitlementon the source account will be cancelled at effective date and theEntitlementon the destination account will be created at the effectiveDate.- Parameters:
sourceAccountId- the unique id for the account on which the bundle will be transferred FordestAccountId- the unique id for the account on which the bundle will be transferred tobundleExternalKey- the bundle external key for the bundleeffectiveDate- the date at which this transfer should occursubExtKeys- an optional map to set subscription external keysbcdTransfer- a policy to determine how to transfer per-subscription BCD valuesproperties- plugin specific propertiescontext- the user context- Returns:
- the id of the newly created bundle for the destination account
- Throws:
EntitlementApiException- if the system could not transfer the entitlements
-
transferEntitlementsOverrideBillingPolicy
UUID transferEntitlementsOverrideBillingPolicy(UUID sourceAccountId, UUID destAccountId, String bundleExternalKey, org.joda.time.LocalDate effectiveDate, Map<UUID,String> subExtKeys, BillingActionPolicy billingPolicy, BcdTransfer bcdTransfer, Iterable<PluginProperty> properties, CallContext context) throws EntitlementApiException
Transfer all theEntitlementfor the source account and matching the external key to the destination account. The date is interpreted by the system to be in the timezone specified at the destinationAccount. TheEntitlementon the source account will be cancelled at effective date and theEntitlementon the destination account will be created at the effectiveDate. The billingPolicy will be used to override the default billing behavior for the cancellation of the subscriptions on the source account.- Parameters:
sourceAccountId- the unique id for the account on which the bundle will be transferred FordestAccountId- the unique id for the account on which the bundle will be transferred tobundleExternalKey- the bundle external Key for the bundleeffectiveDate- the date at which this transfer should occursubExtKeys- an optional map to set subscription external keysbcdTransfer- a policy to determine how to transfer per-subscription BCD valuesbillingPolicy- the override billing policyproperties- plugin specific propertiescontext- the user context- Returns:
- the id of the newly created base entitlement for the destination account
- Throws:
EntitlementApiException- if the system could not transfer the entitlements
-
-