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

Liferay Commerce Admin Account API issue

Details

    • Commerce Sprint 01 - Feb/2022

    Description

      Following API would be used for creating and modifying:
      https://localhost/o/api?endpoint=https://localhost/o/headless-commerce-admin-account/v1.0/openapi.json,
      addresses to be associated with an existing Account, via externalReferenceCode.

      If the address is created from the interface, it is created with className com.liferay.account.model.AccountEntry.

      If the address is created via api call, it is created with className com.liferay.commerce.account.model.CommerceAccount.

      The problem is that, once you enter in detail an Account (Control Pannel - Accounts - edit Account), the addresses created via API request aren't shown in the Address tab.

      They are not shown because, the creation method called by the api https://github.com/liferay/liferay-portal/blob/b6b15b3ef60b75305dfb9cee9a9e6ac769f7b7f0/modules/apps/commerce/headless/headless-commerce/headless-commerce-admin-account-impl/src/main/java/com/liferay/headless/commerce/admin/account/internal/resource/v1_0/AccountAddressResourceImpl.java#L243,
      create address with className com.liferay.commerce.account.model.CommerceAccount,

      while the search, in the account detail, retrieves only the addresses with className com.liferay.account.model.AccountEntry:

      https://github.com/liferay/liferay-portal/blob/01516c60492ae15dd318e3f582451fcfaab7578c/modules/apps/account/account-admin-web/src/main/java/com/liferay/account/admin/web/internal/dao/search/AccountEntryAddressDisplaySearchContainerFactory.java#L83.

      If we try to change the className of an address generated via API call, setting it as com.liferay.account.model.AccountEntry, the address is shown in the account detail.

      Moreover, it has also been reported that In a talend job when creating and modifying through the following api:
      https://localhost/o/api?endpoint=https://localhost/o/headless-commerce-admin-account/v1.0/openapi.json, addresses to be associated with an existing Account, via externalReferenceCode.

      If they address is created from the interface, tit is created with className com.liferay.account.model.AccountEntry.

      If the address is created via api call, it is created with className com.liferay.commerce.account.model.CommerceAccount.

      http://localhost:8080/o/headless-commerce-admin-account/v1.0/accounts/by-externalReferenceCode/XXXX/accountAddresses

      or use

      http://localhost:8080/o/api?endpoint=http://localhost:8080/o/headless-commerce-admin-account/v1.0/openapi.json

      XXXX is the externalReferenceCode of Account

      Body:

      { "city": "test", "countryISOCode": "AF", "defaultBilling": true, "defaultShipping": true, "description": "test", "externalReferenceCode": "SAP-456", "id": 10, "latitude": 0, "longitude": 0, "name": "test", "phoneNumber": "", "regionISOCode": "", "street1": "test", "street2": "", "street3": "", "type": 2, "zip": "123" }

      The problem is that, once you enter in detail of an Account (Control Pannel - Accounts - edit Account), the addresses created via API call aren't shown in the Address tab and in the order check-out step (select shipping and/or billing address).

      Attachments

        Activity

          People

            riccardo.alberti Riccardo Alberti
            katalin.gyorgyovics Katalin Györgyövics (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Packages

                Version Package
                7.4 DXP U9