Interface CustomerAccountService

    • Method Detail

      • createPaymentSubscription

        CreditCardPaymentInfoModel createPaymentSubscription​(CustomerModel customerModel,
                                                             CardInfo cardInfo,
                                                             BillingInfo billingInfo,
                                                             java.lang.String titleCode,
                                                             java.lang.String paymentProvider,
                                                             boolean saveInAccount)
        Creates a payment subscription using specified paymentProvider.
        Parameters:
        customerModel - the customer model to add a new payment subscription cardPaymentInfoModel
        cardInfo - the card details
        billingInfo - the payment address details
        titleCode - the title code of the payment address details. this parameter can be null
        paymentProvider - the payment provider value specifies provider that will be used to create subscription ID.
        saveInAccount - true to save in customer account to reuse the subscription for other transactions
        Returns:
        The created payment info holding the card details and the subscription id
      • setDefaultPaymentInfo

        void setDefaultPaymentInfo​(CustomerModel customerModel,
                                   PaymentInfoModel paymentInfoModel)
        Sets the default paymentInfoModel for the specified customerModel. Both arguments must be set and paymentInfoModel must belong to the specified customerModel.
        Parameters:
        customerModel - the customer model to set default paymentInfoModel
        paymentInfoModel - the payment info model to be set as default
        Throws:
        java.lang.IllegalArgumentException - the illegal argument exception if any argument is null
      • getCreditCardPaymentInfos

        java.util.List<CreditCardPaymentInfoModel> getCreditCardPaymentInfos​(CustomerModel customerModel,
                                                                             boolean saved)
        Retrieves the customer's list of credit card payment information.
        Parameters:
        customerModel - the customer model for which to retrieve payment info
        saved - true to retrieve only saved credit card payment information
        Returns:
        the customer's list of credit card payment info
      • getCreditCardPaymentInfoForCode

        CreditCardPaymentInfoModel getCreditCardPaymentInfoForCode​(CustomerModel customerModel,
                                                                   java.lang.String code)
        Retrieves the customer's credit card payment info given its code
        Parameters:
        customerModel - the customer
        code - the code
        Returns:
        The credit card payment info
      • deleteCCPaymentInfo

        void deleteCCPaymentInfo​(CustomerModel customerModel,
                                 CreditCardPaymentInfoModel creditCardPaymentInfo)
        Delete credit card payment info. Before deleting it is checked if the given payment info belongs to the given customer.
        Parameters:
        customerModel - the customer model that should be the address owner
        creditCardPaymentInfo - payment info model that will be deleted
        Throws:
        java.lang.IllegalArgumentException - the illegal argument exception is thrown when given payment info does not belong to the given customer or any argument is null
      • unlinkCCPaymentInfo

        @Deprecated(since="6.7")
        void unlinkCCPaymentInfo​(CustomerModel customerModel,
                                 CreditCardPaymentInfoModel creditCardPaymentInfo)
        unlink credit card payment info. Before deleting it is checked if the given payment info belongs to the given customer.
        Parameters:
        customerModel - the customer model that should be the address owner
        creditCardPaymentInfo - payment info model that will be unlinked
        Throws:
        java.lang.IllegalArgumentException - the illegal argument exception is thrown when given payment info does not belong to the given customer or any argument is null
      • getTitles

        java.util.Collection<TitleModel> getTitles()
        Returns all available customer titles in the system.
        Returns:
        the titles
      • getAllAddressEntries

        java.util.List<AddressModel> getAllAddressEntries​(CustomerModel customerModel)
        Returns all address book entries from the given customer.
        Parameters:
        customerModel - the customer model to retrieve addresses from
        Returns:
        the address book entries of the given user
        Throws:
        java.lang.IllegalArgumentException - the illegal argument exception if any argument is null
      • getAddressBookEntries

        java.util.List<AddressModel> getAddressBookEntries​(CustomerModel customerModel)
        Returns all visible address book entries from the given customer.
        Parameters:
        customerModel - the customer model to retrieve addresses from
        Returns:
        the address book entries of the given user
        Throws:
        java.lang.IllegalArgumentException - the illegal argument exception if any argument is null
      • getAddressBookDeliveryEntries

        java.util.List<AddressModel> getAddressBookDeliveryEntries​(CustomerModel customerModel)
        Returns all delivery address book entries from the given customer.
        Parameters:
        customerModel - the customer model to retrieve addresses from
        Returns:
        the address book entries of the given user
        Throws:
        java.lang.IllegalArgumentException - the illegal argument exception if any argument is null
      • getAddressForCode

        AddressModel getAddressForCode​(CustomerModel customerModel,
                                       java.lang.String code)
        Get a customer address given its code
        Parameters:
        customerModel - the customer
        code - the address code
        Returns:
        the address
      • getDefaultAddress

        AddressModel getDefaultAddress​(CustomerModel customerModel)
        Returns a customer default shipping address
        Parameters:
        customerModel -
        Returns:
        the default customer address or null if no address is set as default
      • saveAddressEntry

        void saveAddressEntry​(CustomerModel customerModel,
                              AddressModel addressModel)
        Save address entry. If the given address model is not saved it will be assigned to the given customer and saved. If address is saved and belongs to other user it will be cloned, assigned to the given customer and the original address will be left as it is.
        Parameters:
        customerModel - the customer model to save/reassign address.
        addressModel - the address model to save/create
        Throws:
        java.lang.IllegalArgumentException - the illegal argument exception if any argument is null
      • deleteAddressEntry

        void deleteAddressEntry​(CustomerModel customerModel,
                                AddressModel addressModel)
        Delete address entry. Before deleting it is checked if the given address belongs to the given customer.
        Parameters:
        customerModel - the customer model that should be the address owner
        addressModel - the address model that will be deleted
        Throws:
        java.lang.IllegalArgumentException - the illegal argument exception is thrown when given address does not belong to the given customer or any argument is null
      • setDefaultAddressEntry

        void setDefaultAddressEntry​(CustomerModel customerModel,
                                    AddressModel addressModel)
        Sets the default address entry. Because customer addresses are not sorted it sets given address as default customer payment address. If the address is not saved it will be created and assigned to the given user. If given address belongs to other user it will be cloned and assigned to the given customer and the original address will be left as it is.
        Parameters:
        customerModel - the customer model to set default payment address for
        addressModel - the address model to be set as default one
        Throws:
        java.lang.IllegalArgumentException - the illegal argument exception if any argument is null
      • clearDefaultAddressEntry

        void clearDefaultAddressEntry​(CustomerModel customerModel)
        Clears default address on the given customer
        Parameters:
        customerModel - the customer
      • register

        void register​(CustomerModel customerModel,
                      java.lang.String password)
               throws DuplicateUidException
        Register a user with given parameters
        Parameters:
        customerModel - the user data the user will be registered with
        password - the user's password
        Throws:
        java.lang.IllegalArgumentException - if required data is missing
        DuplicateUidException - if the login is not unique
      • updateProfile

        void updateProfile​(CustomerModel customerModel,
                           java.lang.String titleCode,
                           java.lang.String name,
                           java.lang.String login)
                    throws DuplicateUidException
        Updates the current user with the given parameters
        Parameters:
        customerModel - the customer to update
        titleCode - the code for the title to set
        name - the full name to set on the customer
        login - the UID to set on the customer
        Throws:
        DuplicateUidException - if the email is not unique
      • changePassword

        void changePassword​(UserModel userModel,
                            java.lang.String oldPassword,
                            java.lang.String newPassword)
                     throws PasswordMismatchException
        Changes user password.
        Parameters:
        userModel - the user to change the password for
        oldPassword - old password to confirm
        newPassword - new password to set
        Throws:
        PasswordMismatchException - if the given old password does not match the one stored in the system
      • forgottenPassword

        void forgottenPassword​(CustomerModel customerModel)
        Sends a forgotten password event
        Parameters:
        customerModel - the user
      • updatePassword

        void updatePassword​(java.lang.String token,
                            java.lang.String newPassword)
                     throws TokenInvalidatedException
        Update the password for the user by decrypting and validating the token.
        Parameters:
        token - the password reset token
        newPassword - the new plain text password
        Throws:
        java.lang.IllegalArgumentException - If the new password is empty or the token is invalid or expired
        TokenInvalidatedException - if the token was already used or there is a newer token
      • getOrderForCode

        OrderModel getOrderForCode​(CustomerModel customerModel,
                                   java.lang.String code,
                                   BaseStoreModel store)
        Returns the specified order for the supplied user.
        Parameters:
        customerModel - the user to retrieve order for
        code - the code of the order to retrieve
        store - the current store
        Returns:
        the order
      • getOrderList

        java.util.List<OrderModel> getOrderList​(CustomerModel customerModel,
                                                BaseStoreModel store,
                                                OrderStatus[] status)
        Returns the order of the supplied user filtering by OrderStatus
        Parameters:
        customerModel - the user to retrieve orders for
        store - the current store
        status - One or more OrderStatuses to include in the result
        Returns:
        the list of orders
      • getOrderList

        SearchPageData<OrderModel> getOrderList​(CustomerModel customerModel,
                                                BaseStoreModel store,
                                                OrderStatus[] status,
                                                PageableData pageableData)
        Returns the order of the supplied user filtering by OrderStatus
        Parameters:
        customerModel - the user to retrieve orders for
        store - the current store
        status - One or more OrderStatuses to include in the result
        pageableData - pagination information
        Returns:
        the list of orders
      • getGuestOrderForGUID

        OrderModel getGuestOrderForGUID​(java.lang.String guid,
                                        BaseStoreModel store)
        Fetch the OrderModel for the given GUID,Store details and the expiry date for Guest Customers.
        Parameters:
        guid - GUID of the order which was created from the CartModel
        store - BaseStoreModel for the current store which the Guest Customer is accessing.
        Returns:
        the order
      • registerGuestForAnonymousCheckout

        void registerGuestForAnonymousCheckout​(CustomerModel customerModel,
                                               java.lang.String password)
                                        throws DuplicateUidException
        Registers the Guest customer to session cart for anonymous checkout
        Parameters:
        customerModel -
        password -
        Throws:
        DuplicateUidException
      • getOrderDetailsForGUID

        OrderModel getOrderDetailsForGUID​(java.lang.String guid,
                                          BaseStoreModel store)
        Returns the orderModel based on the guid and base store
        Parameters:
        guid -
        store -
        Returns:
        the order
      • convertGuestToCustomer

        void convertGuestToCustomer​(java.lang.String pwd,
                                    java.lang.String orderGUID)
                             throws DuplicateUidException
        Converts a Guest Customer of anonymous checkout to a regular customer
        Parameters:
        pwd -
        orderGUID -
        Throws:
        DuplicateUidException
      • getOrderForCode

        OrderModel getOrderForCode​(java.lang.String code,
                                   BaseStoreModel store)
        Returns the orderModel based on order code and base store
        Parameters:
        code -
        store -
        Returns:
        the order