Uploaded image for project: 'PUBLIC - Liferay Commerce'
  1. PUBLIC - Liferay Commerce
  2. COMMERCE-2153

serviceContext userId not set in CommerceAccount.addPersonalCommerceAccount(..)

Details

    Description

      When creating a Personal Commerce Account via the dedicated method addPersonalCommerceAccount in CommerceAccountLocalServiceImpl, an exception is thrown by the subsequent method addCommerceAccount because there is no userId in serviceContext :

      ...
      public CommerceAccount addPersonalCommerceAccount(
      			long userId, String taxId, String externalReferenceCode,
      			ServiceContext serviceContext)
      		throws PortalException {
      ...
      
      ...
      public CommerceAccount addCommerceAccount(
      			String name, long parentCommerceAccountId, String email,
      			String taxId, int type, boolean active,
      			String externalReferenceCode, ServiceContext serviceContext)
      		throws PortalException {
      
      		// Commerce Account
      
      		User user = userLocalService.getUser(serviceContext.getUserId());
      ...
      

      The userId should be set by the first method, using the passed parameter.

      Attachments

        Activity

          People

            alessandro.iovane Alessandro Iovane
            cariou Christophe Cariou
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Packages

                Version Package
                2.0.6