Interface SubscriptionFacade
- All Known Implementing Classes:
AbstractSubscriptionFacade,DefaultCisSubscriptionFacade,DefaultSubscriptionFacade
public interface SubscriptionFacade
Facade which provides functionality to manage subscriptions.
-
Method Summary
Modifier and TypeMethodDescriptionchangePaymentMethod(CCPaymentInfoData paymentInfo, String action, boolean propagate, Map<String, String> parameters) Changes an existing payment method.Updates the state of an existing subscription.createPaymentSubscription(Map<String, String> paymentParameters) Creates a payment subscription on the hybris side.createSubscriptions(OrderData order, Map<String, String> parameters) Creates subscriptions for the given order and current user.extendSubscriptionTermDuration(String subscriptionId, Integer contractDurationExtension, Map<String, String> parameters) Extends the subscription term duration of an existing subscription.finalizeTransaction(String authorizationRequestId, String authorizationRequestToken, Map<String, String> parameters) Finalizes an established subscription with the subscription billing provider.getBillingActivityDetail(String billingActivityId, Map<String, String> parameters) Returns a file stream containing detail information for the specified billing activity.getBillingActivityList(String subscriptionId, Map<String, String> parameters) Returns a list of billing activities for the given subscription.getOrderEntryForOrderCodeAndEntryNumber(String orderCode, int entryNumber) Returns theAbstractOrderEntryModelfor the given orderCode and entryNumber.getSubscription(String subscriptionId) Returns the subscription with the given ID.getSubscriptionEndDate(ProductData subscriptionProductData, Date startDate) Calculates an end date for a subscription product based on its subscription term details.Returns all subscriptions for the current user.getSubscriptionsForPaymentMethod(String paymentMethodId) Returns a list of subscriptions for the given paymentMethodId of the current user.getUpgradePreviewBillings(String subscriptionId, String upgradeId) Returns a list of the possible billing changes between the current subscription and an upgrade option.getUpsellingOptionsForSubscription(String productCode) Returns a list of possible upgrade options for the given subscription product.hpfUrl()Returns the HPF URL.initializeTransaction(String clientIpAddress, String returnUrl, String cancelReturnUrl, Map<String, String> parameters) Initializes a transaction with the subscription billing provider.replacePaymentMethod(String subscriptionId, String paymentMethodId, String effectiveFrom, Map<String, String> parameters) Replaces the payment method for the given subscription and effectiveFrom.Replaces the payment method for the given subscription.updateCreatedPaymentMethod(CCPaymentInfoData paymentType, Map<String, String> paramMap) Updates an newly-created Payment Type with the Subscription Service information.updateProfile(Map<String, String> parameters) Creates or updates a subscription profile for the current user.updateSubscription(String subscriptionId, boolean force, SubscriptionUpdateActionEnum action, Map<String, String> parameters) Updates the given subscription (e.g.updateSubscriptionAutorenewal(String subscriptionId, boolean isAutorenewal, Map<String, String> parameters) Updates the auto-renewal status of an existing subscription.
-
Method Details
-
updateCreatedPaymentMethod
@Nonnull CCPaymentInfoData updateCreatedPaymentMethod(@Nonnull CCPaymentInfoData paymentType, Map<String, String> paramMap) throws SubscriptionFacadeExceptionUpdates 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 Map<String, String> parameters) throws SubscriptionFacadeExceptionCreates 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, Map<String, String> parameters) throws SubscriptionFacadeExceptionCreates 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(String clientIpAddress, String returnUrl, String cancelReturnUrl, Map<String, String> parameters) throws SubscriptionFacadeExceptionInitializes 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 String authorizationRequestId, @Nullable String authorizationRequestToken, @Nullable Map<String, String> parameters) throws SubscriptionFacadeExceptionFinalizes 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 String action, boolean propagate, Map<String, String> parameters) throws SubscriptionFacadeExceptionChanges 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 String subscriptionId, @Nullable String paymentMethodId, @Nullable Map<String, String> parameters) throws SubscriptionFacadeExceptionReplaces 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(String subscriptionId, String paymentMethodId, String effectiveFrom, Map<String, String> parameters) throws SubscriptionFacadeExceptionReplaces the payment method for the given subscription and effectiveFrom.- 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(Map<String, String> paymentParameters) throws SubscriptionFacadeExceptionCreates 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(String subscriptionId, boolean force, SubscriptionUpdateActionEnum action, Map<String, String> parameters) throws SubscriptionFacadeExceptionUpdates 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
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(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
Returns the HPF URL.- Returns:
- the HPF URL
- Throws:
SubscriptionFacadeException- if operation cannot be performed
-
getSubscriptionEndDate
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
Returns a list of possible upgrade options for the given subscription product.- Parameters:
productCode- code of the subscription product- Returns:
ListofProductData
-
getUpgradePreviewBillings
List<SubscriptionBillingData> getUpgradePreviewBillings(String subscriptionId, 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
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(String subscriptionId, boolean isAutorenewal, Map<String, String> parameters) throws SubscriptionFacadeExceptionUpdates 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(String subscriptionId, String newStatus, Map<String, String> parameters) throws SubscriptionFacadeExceptionUpdates 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 String subscriptionId, @Nullable Integer contractDurationExtension, @Nullable Map<String, String> parameters) throws SubscriptionFacadeExceptionExtends 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
List<SubscriptionBillingData> getBillingActivityList(String subscriptionId, Map<String, String> parameters) throws SubscriptionFacadeExceptionReturns 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(String billingActivityId, Map<String, String> parameters) throws SubscriptionFacadeExceptionReturns 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 List<SubscriptionData> getSubscriptionsForPaymentMethod(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
-