Interface SubscriptionFacade

    • Method Detail

      • 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:
        SubscriptionPaymentData containing 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
      • 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 - CCPaymentInfoData the updated payment information
        action - String the change action to perform (currently supported: "enable", "disable")
        propagate - determines whether to propagate the change to all billing subscriptions using the given payment method
        parameters - provider specific parameters
        Returns:
        CCPaymentInfoData containing 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 for
        paymentMethodId - the ID of the new payment method which replaces the current one
        parameters - provider specific parameters
        Returns:
        SubscriptionPaymentData containing 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 subscription
        paymentMethodId - the ID of the payment method to set
        effectiveFrom - determines when the replacement will take effect
        parameters - provider specific parameters
        Returns:
        SubscriptionData containing the results of the operation
        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 update
        force - determines whether to force the update or not
        action - the update action to perform
        parameters - provider specific parameters
        Returns:
        SubscriptionPaymentData containing the results of the operation
        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 terms
        startDate - 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:
        List of ProductData
      • getOrderEntryForOrderCodeAndEntryNumber

        AbstractOrderEntryModel getOrderEntryForOrderCodeAndEntryNumber​(java.lang.String orderCode,
                                                                        int entryNumber)
        Returns the AbstractOrderEntryModel for the given orderCode and entryNumber.
        Parameters:
        orderCode - code of the given order
        entryNumber - entry number in the order
        Returns:
        AbstractOrderEntryModel or null if 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 subscription
        isAutorenewal - the new auto-renewal status of the subscription
        parameters - provider specific parameters
        Returns:
        SubscriptionData containing 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 subscription
        newStatus - new status of the subscription
        parameters - provider specific parameters
        Returns:
        SubscriptionData containing 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 subscription
        contractDurationExtension - extends the duration x times
        parameters - provider specific parameters
        Returns:
        SubscriptionData containing the results of the operation
        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