Interface SubscriptionFacade
-
- All Known Subinterfaces:
SapRevenueCloudSubscriptionFacade
- All Known Implementing Classes:
AbstractSubscriptionFacade,DefaultCisSubscriptionFacade,DefaultSapRevenueCloudSubscriptionFacade,DefaultSubscriptionFacade
public interface SubscriptionFacadeFacade which provides functionality to manage subscriptions.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CCPaymentInfoDatachangePaymentMethod(CCPaymentInfoData paymentInfo, java.lang.String action, boolean propagate, java.util.Map<java.lang.String,java.lang.String> parameters)Changes an existing payment method.SubscriptionDatachangeSubscriptionState(java.lang.String subscriptionId, java.lang.String newStatus, java.util.Map<java.lang.String,java.lang.String> parameters)Updates the state of an existing subscription.CCPaymentInfoDatacreatePaymentSubscription(java.util.Map<java.lang.String,java.lang.String> paymentParameters)Creates a payment subscription on the hybris side.SubscriptionPaymentDatacreateSubscriptions(OrderData order, java.util.Map<java.lang.String,java.lang.String> parameters)Creates subscriptions for the given order and current user.SubscriptionDataextendSubscriptionTermDuration(java.lang.String subscriptionId, java.lang.Integer contractDurationExtension, java.util.Map<java.lang.String,java.lang.String> parameters)Extends the subscription term duration of an existing subscription.SubscriptionPaymentDatafinalizeTransaction(java.lang.String authorizationRequestId, java.lang.String authorizationRequestToken, java.util.Map<java.lang.String,java.lang.String> parameters)Finalizes an established subscription with the subscription billing provider.SubscriptionBillingDetailFileStreamgetBillingActivityDetail(java.lang.String billingActivityId, java.util.Map<java.lang.String,java.lang.String> parameters)Returns a file stream containing detail information for the specified billing activity.java.util.List<SubscriptionBillingData>getBillingActivityList(java.lang.String subscriptionId, java.util.Map<java.lang.String,java.lang.String> parameters)Returns a list of billing activities for the given subscription.AbstractOrderEntryModelgetOrderEntryForOrderCodeAndEntryNumber(java.lang.String orderCode, int entryNumber)Returns theAbstractOrderEntryModelfor the given orderCode and entryNumber.SubscriptionDatagetSubscription(java.lang.String subscriptionId)Returns the subscription with the given ID.java.util.DategetSubscriptionEndDate(ProductData subscriptionProductData, java.util.Date startDate)Calculates an end date for a subscription product based on its subscription term details.java.util.Collection<SubscriptionData>getSubscriptions()Returns all subscriptions for the current user.java.util.List<SubscriptionData>getSubscriptionsForPaymentMethod(java.lang.String paymentMethodId)Returns a list of subscriptions for the given paymentMethodId of the current user.java.util.List<SubscriptionBillingData>getUpgradePreviewBillings(java.lang.String subscriptionId, java.lang.String upgradeId)Returns a list of the possible billing changes between the current subscription and an upgrade option.java.util.List<ProductData>getUpsellingOptionsForSubscription(java.lang.String productCode)Returns a list of possible upgrade options for the given subscription product.java.lang.StringhpfUrl()Returns the HPF URL.SubscriptionPaymentDatainitializeTransaction(java.lang.String clientIpAddress, java.lang.String returnUrl, java.lang.String cancelReturnUrl, java.util.Map<java.lang.String,java.lang.String> parameters)Initializes a transaction with the subscription billing provider.SubscriptionDatareplacePaymentMethod(java.lang.String subscriptionId, java.lang.String paymentMethodId, java.lang.String effectiveFrom, java.util.Map<java.lang.String,java.lang.String> parameters)SubscriptionPaymentDatareplacePaymentMethod(java.lang.String subscriptionId, java.lang.String paymentMethodId, java.util.Map<java.lang.String,java.lang.String> parameters)Replaces the payment method for the given subscription.CCPaymentInfoDataupdateCreatedPaymentMethod(CCPaymentInfoData paymentType, java.util.Map<java.lang.String,java.lang.String> paramMap)Updates an newly-created Payment Type with the Subscription Service information.SubscriptionPaymentDataupdateProfile(java.util.Map<java.lang.String,java.lang.String> parameters)Creates or updates a subscription profile for the current user.SubscriptionPaymentDataupdateSubscription(java.lang.String subscriptionId, boolean force, SubscriptionUpdateActionEnum action, java.util.Map<java.lang.String,java.lang.String> parameters)Updates the given subscription (e.g.SubscriptionDataupdateSubscriptionAutorenewal(java.lang.String subscriptionId, boolean isAutorenewal, java.util.Map<java.lang.String,java.lang.String> parameters)Updates the auto-renewal status of an existing subscription.
-
-
-
Method Detail
-
updateCreatedPaymentMethod
@Nonnull CCPaymentInfoData updateCreatedPaymentMethod(@Nonnull CCPaymentInfoData paymentType, java.util.Map<java.lang.String,java.lang.String> paramMap) throws SubscriptionFacadeException
Updates an newly-created Payment Type with the Subscription Service information. This method differs fromchangePaymentMethod(CCPaymentInfoData, String, boolean, Map)because it must be used only during the creation of a new payment method (created by the PaymentFacade).changePaymentMethod(CCPaymentInfoData, String, boolean, Map)must be used changing details at a later time.- Parameters:
paymentType- the payment info data relating to the recently-created Payment TypeparamMap- the detail map containing new subscription information.- Returns:
- an updated paymentInfo, or null if the update fails.
- Throws:
SubscriptionFacadeException- if created payment method cannot be updated
-
updateProfile
@Nonnull SubscriptionPaymentData updateProfile(@Nullable java.util.Map<java.lang.String,java.lang.String> parameters) throws SubscriptionFacadeException
Creates or updates a subscription profile for the current user.- Parameters:
parameters- provider specific parameters- Returns:
SubscriptionPaymentDatacontaining the results of the operation- Throws:
SubscriptionFacadeException- if operation cannot be performed
-
createSubscriptions
SubscriptionPaymentData createSubscriptions(@Nonnull OrderData order, java.util.Map<java.lang.String,java.lang.String> parameters) throws SubscriptionFacadeException
Creates subscriptions for the given order and current user.- Parameters:
order- the order to create the subscriptions forparameters- provider specific parameters- Returns:
SubscriptionPaymentDatacontaining the results of the operation- Throws:
SubscriptionFacadeException- if subscription cannot be created
-
initializeTransaction
@Nonnull SubscriptionPaymentData initializeTransaction(java.lang.String clientIpAddress, java.lang.String returnUrl, java.lang.String cancelReturnUrl, java.util.Map<java.lang.String,java.lang.String> parameters) throws SubscriptionFacadeException
Initializes a transaction with the subscription billing provider.- Parameters:
clientIpAddress- the IP address of the calling client. May be empty.returnUrl- the URL to redirect to after the silent from post. May not be null or empty.cancelReturnUrl- the URL to redirect to in case of errors after the silent from post. May not be null or empty.parameters- provider specific parameters- Returns:
SubscriptionPaymentDatacontaining the results of the operation (hpfUrl and session token). result.getParameters().get("sessionTransactionToken") returns not-null String value.- Throws:
SubscriptionFacadeException- if operation cannot be performed
-
finalizeTransaction
@Nonnull SubscriptionPaymentData finalizeTransaction(@Nullable java.lang.String authorizationRequestId, @Nullable java.lang.String authorizationRequestToken, @Nullable java.util.Map<java.lang.String,java.lang.String> parameters) throws SubscriptionFacadeException
Finalizes an established subscription with the subscription billing provider.- Parameters:
authorizationRequestId- the request IDauthorizationRequestToken- the request token retrieved from the result of ainitializeTransaction(java.lang.String, java.lang.String, java.lang.String, java.util.Map<java.lang.String, java.lang.String>)call.parameters- provider specific parameters- Returns:
SubscriptionPaymentDatacontaining the results of the operation- Throws:
SubscriptionFacadeException- if operation cannot be performed
-
changePaymentMethod
@Nonnull CCPaymentInfoData changePaymentMethod(@Nonnull CCPaymentInfoData paymentInfo, @Nullable java.lang.String action, boolean propagate, java.util.Map<java.lang.String,java.lang.String> parameters) throws SubscriptionFacadeException
Changes an existing payment method.- Parameters:
paymentInfo-CCPaymentInfoDatathe updated payment informationaction-Stringthe change action to perform (currently supported: "enable", "disable")propagate- determines whether to propagate the change to all billing subscriptions using the given payment methodparameters- provider specific parameters- Returns:
CCPaymentInfoDatacontaining the results of the operation- Throws:
SubscriptionFacadeException- if payment method cannot be changed
-
replacePaymentMethod
@Nonnull SubscriptionPaymentData replacePaymentMethod(@Nullable java.lang.String subscriptionId, @Nullable java.lang.String paymentMethodId, @Nullable java.util.Map<java.lang.String,java.lang.String> parameters) throws SubscriptionFacadeException
Replaces the payment method for the given subscription.- Parameters:
subscriptionId- the ID of the subscription to replace the payment method forpaymentMethodId- the ID of the new payment method which replaces the current oneparameters- provider specific parameters- Returns:
SubscriptionPaymentDatacontaining the results of the operation- Throws:
SubscriptionFacadeException- if payment method cannot be replaced
-
replacePaymentMethod
@Nonnull SubscriptionData replacePaymentMethod(java.lang.String subscriptionId, java.lang.String paymentMethodId, java.lang.String effectiveFrom, java.util.Map<java.lang.String,java.lang.String> parameters) throws SubscriptionFacadeException
- Parameters:
subscriptionId- the ID of the subscriptionpaymentMethodId- the ID of the payment method to seteffectiveFrom- determines when the replacement will take effectparameters- provider specific parameters- Returns:
SubscriptionDatacontaining the results of the operation- Throws:
SubscriptionFacadeException- if operation cannot be performed
-
createPaymentSubscription
CCPaymentInfoData createPaymentSubscription(java.util.Map<java.lang.String,java.lang.String> paymentParameters) throws SubscriptionFacadeException
Creates a payment subscription on the hybris side.- Parameters:
paymentParameters- parameters retrieved from the result of afinalizeTransaction(java.lang.String, java.lang.String, java.util.Map<java.lang.String, java.lang.String>)call.- Returns:
CCPaymentInfoDatathe payment information created based on the given parameters- Throws:
SubscriptionFacadeException- if operation cannot be performed
-
updateSubscription
@Nonnull SubscriptionPaymentData updateSubscription(java.lang.String subscriptionId, boolean force, SubscriptionUpdateActionEnum action, java.util.Map<java.lang.String,java.lang.String> parameters) throws SubscriptionFacadeException
Updates the given subscription (e.g. cancel)- Parameters:
subscriptionId- the subscription to updateforce- determines whether to force the update or notaction- the update action to performparameters- provider specific parameters- Returns:
SubscriptionPaymentDatacontaining the results of the operation- Throws:
SubscriptionFacadeException- if operation cannot be performed
-
getSubscriptions
@Nonnull java.util.Collection<SubscriptionData> getSubscriptions() throws SubscriptionFacadeException
Returns all subscriptions for the current user.- Returns:
Collection<SubscriptionData> the current user's subscription- Throws:
SubscriptionFacadeException- if operation cannot be performed
-
getSubscription
@Nullable SubscriptionData getSubscription(java.lang.String subscriptionId) throws SubscriptionFacadeException
Returns the subscription with the given ID.- Parameters:
subscriptionId- the ID of the subscription- Returns:
SubscriptionDatathe subscription with the given ID- Throws:
SubscriptionFacadeException- if operation cannot be performed
-
hpfUrl
java.lang.String hpfUrl() throws SubscriptionFacadeExceptionReturns the HPF URL.- Returns:
- the HPF URL
- Throws:
SubscriptionFacadeException- if operation cannot be performed
-
getSubscriptionEndDate
java.util.Date getSubscriptionEndDate(@Nonnull ProductData subscriptionProductData, java.util.Date startDate)Calculates an end date for a subscription product based on its subscription term details.- Parameters:
subscriptionProductData- ptoduct data with information about subscription termsstartDate- start date of the subscription- Returns:
- the calculated end date
-
getUpsellingOptionsForSubscription
java.util.List<ProductData> getUpsellingOptionsForSubscription(java.lang.String productCode)
Returns a list of possible upgrade options for the given subscription product.- Parameters:
productCode- code of the subscription product- Returns:
ListofProductData
-
getUpgradePreviewBillings
java.util.List<SubscriptionBillingData> getUpgradePreviewBillings(java.lang.String subscriptionId, java.lang.String upgradeId) throws SubscriptionFacadeException
Returns a list of the possible billing changes between the current subscription and an upgrade option.- Parameters:
subscriptionId- the current subscriptionupgradeId- the upgrade option- Returns:
ListofSubscriptionBillingData- Throws:
SubscriptionFacadeException- if operation cannot be performed
-
getOrderEntryForOrderCodeAndEntryNumber
AbstractOrderEntryModel getOrderEntryForOrderCodeAndEntryNumber(java.lang.String orderCode, int entryNumber)
Returns theAbstractOrderEntryModelfor the given orderCode and entryNumber.- Parameters:
orderCode- code of the given orderentryNumber- entry number in the order- Returns:
AbstractOrderEntryModelornullif not found
-
updateSubscriptionAutorenewal
@Nonnull SubscriptionData updateSubscriptionAutorenewal(java.lang.String subscriptionId, boolean isAutorenewal, java.util.Map<java.lang.String,java.lang.String> parameters) throws SubscriptionFacadeException
Updates the auto-renewal status of an existing subscription.- Parameters:
subscriptionId- the ID of the subscriptionisAutorenewal- the new auto-renewal status of the subscriptionparameters- provider specific parameters- Returns:
SubscriptionDatacontaining the results of the operation- Throws:
SubscriptionFacadeException- if operation cannot be performed
-
changeSubscriptionState
@Nonnull SubscriptionData changeSubscriptionState(java.lang.String subscriptionId, java.lang.String newStatus, java.util.Map<java.lang.String,java.lang.String> parameters) throws SubscriptionFacadeException
Updates the state of an existing subscription.- Parameters:
subscriptionId- the ID of the subscriptionnewStatus- new status of the subscriptionparameters- provider specific parameters- Returns:
SubscriptionDatacontaining the results of the operation- Throws:
SubscriptionFacadeException- if operation cannot be performed
-
extendSubscriptionTermDuration
@Nonnull SubscriptionData extendSubscriptionTermDuration(@Nullable java.lang.String subscriptionId, @Nullable java.lang.Integer contractDurationExtension, @Nullable java.util.Map<java.lang.String,java.lang.String> parameters) throws SubscriptionFacadeException
Extends the subscription term duration of an existing subscription.- Parameters:
subscriptionId- the ID of the subscriptioncontractDurationExtension- extends the duration x timesparameters- provider specific parameters- Returns:
SubscriptionDatacontaining the results of the operation- Throws:
SubscriptionFacadeException- if operation cannot be performed
-
getBillingActivityList
java.util.List<SubscriptionBillingData> getBillingActivityList(java.lang.String subscriptionId, java.util.Map<java.lang.String,java.lang.String> parameters) throws SubscriptionFacadeException
Returns a list of billing activities for the given subscription.- Parameters:
subscriptionId- the ID of the subscriptionparameters- provider specific parameters- Returns:
List<SubscriptionBillingData>- Throws:
SubscriptionFacadeException- if operation cannot be performed
-
getBillingActivityDetail
SubscriptionBillingDetailFileStream getBillingActivityDetail(java.lang.String billingActivityId, java.util.Map<java.lang.String,java.lang.String> parameters) throws SubscriptionFacadeException
Returns a file stream containing detail information for the specified billing activity.- Parameters:
billingActivityId- the ID of the billing activityparameters- provider specific parameters- Returns:
SubscriptionBillingDetailFileStream- Throws:
SubscriptionFacadeException- if operation cannot be performed
-
getSubscriptionsForPaymentMethod
@Nonnull java.util.List<SubscriptionData> getSubscriptionsForPaymentMethod(java.lang.String paymentMethodId) throws SubscriptionFacadeException
Returns a list of subscriptions for the given paymentMethodId of the current user.- Parameters:
paymentMethodId- the ID of the payment method- Returns:
- list of subscriptions
- Throws:
SubscriptionFacadeException- if operation cannot be performed
-
-