Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to select a store using pickup-location-services.js::getLocation(sourceCode) #3209

Closed
maxlussier opened this issue Oct 5, 2020 · 6 comments · Fixed by #3237
Closed
Assignees

Comments

@maxlussier
Copy link
Contributor

Preconditions (*)

  1. Magento 2.4.0 Commerce Edition without sample data installed
  2. Magento Inventory Metapackage 1.2.0 installed with sources, stock and channels configured

Steps to reproduce (*)

  1. Call the getLocation(sourceCode) method of Magento_InventoryInStorePickupFrontend/js/model/pickup-locations-service:

Example of call:

pickupLocationsServices.getLocation('X1DF').always(function(location) {
    console.log(location);
});

Expected result (*)

  1. The API request is supposed to give you a response similar to this:
{
    "items": [
        {
            "pickup_location_code": "X1DF",
            "name": "Store name",
            "latitude": 43.71912,
            "longitude": 43.71912,
            "country_id": "CA",
            "region_id": 76,
            "region": "Region",
            "city": "City",
            "street": "123 street",
            "postcode": "X1X 1X1",
            "phone": "(555) 555-5555"
        }
    ],
    "search_request": {
        "filters": {
            "pickup_location_code": {
                "value": "X1DF",
                "condition_type": "eq"
            }
        },
        "current_page": 1,
        "scope_type": "website",
        "scope_code": "base"
    },
    "total_count": 1
}
  1. Then the code should format the received addresses into a single one.
  2. The formatted address should be displayed in the Checkout page.

Actual result (*)

  1. The API request gives the following 500 error response:
{
 	"message": "Property \"FilterSet\" does not have accessor method \"getFilterSet\" in class \"Magento\\InventoryInStorePickupApi\\Api\\Data\\SearchRequestInterface\".",
 	"trace": "#0 \/mywebsite\/vendor\/magento\/framework\/Reflection\/NameFinder.php(62): Magento\\Framework\\Reflection\\NameFinder->findAccessorMethodName(Object(Laminas\\Code\\Reflection\\ClassReflection), 'FilterSet', 'getFilterSet', 'isFilterSet')\n#1 \/mywebsite\/vendor\/magento\/framework\/Webapi\/ServiceInputProcessor.php(260): Magento\\Framework\\Reflection\\NameFinder->getGetterMethodName(Object(Laminas\\Code\\Reflection\\ClassReflection), 'FilterSet')\n#2 \/mywebsite\/vendor\/magento\/framework\/Webapi\/ServiceInputProcessor.php(478): Magento\\Framework\\Webapi\\ServiceInputProcessor->_createFromArray('Magento\\\\Invento...', Array)\n#3 \/mywebsite\/vendor\/magento\/framework\/Webapi\/ServiceInputProcessor.php(165): Magento\\Framework\\Webapi\\ServiceInputProcessor->convertValue(Array, 'Magento\\\\Invento...')\n#4 \/mywebsite\/vendor\/magento\/module-webapi\/Controller\/Rest\/InputParamsResolver.php(84): Magento\\Framework\\Webapi\\ServiceInputProcessor->process('Magento\\\\Invento...', 'execute', Array)\n#5 \/mywebsite\/vendor\/magento\/framework\/Interception\/Interceptor.php(58): Magento\\Webapi\\Controller\\Rest\\InputParamsResolver->resolve()\n#6 \/mywebsite\/vendor\/magento\/framework\/Interception\/Interceptor.php(138): Magento\\Webapi\\Controller\\Rest\\InputParamsResolver\\Interceptor->___callParent('resolve', Array)\n#7 \/mywebsite\/vendor\/magento\/framework\/Interception\/Interceptor.php(153): Magento\\Webapi\\Controller\\Rest\\InputParamsResolver\\Interceptor->Magento\\Framework\\Interception\\{closure}()\n#8 \/mywebsite\/generated\/code\/Magento\/Webapi\/Controller\/Rest\/InputParamsResolver\/Interceptor.php(26): Magento\\Webapi\\Controller\\Rest\\InputParamsResolver\\Interceptor->___callPlugins('resolve', Array, Array)\n#9 \/mywebsite\/vendor\/magento\/module-webapi\/Controller\/Rest\/SynchronousRequestProcessor.php(85): Magento\\Webapi\\Controller\\Rest\\InputParamsResolver\\Interceptor->resolve()\n#10 \/mywebsite\/vendor\/magento\/module-webapi\/Controller\/Rest.php(188): Magento\\Webapi\\Controller\\Rest\\SynchronousRequestProcessor->process(Object(Magento\\Framework\\Webapi\\Rest\\Request\\Proxy))\n#11 \/mywebsite\/vendor\/magento\/framework\/Interception\/Interceptor.php(58): Magento\\Webapi\\Controller\\Rest->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#12 \/mywebsite\/vendor\/magento\/framework\/Interception\/Interceptor.php(138): Magento\\Webapi\\Controller\\Rest\\Interceptor->___callParent('dispatch', Array)\n#13 \/mywebsite\/vendor\/fastly\/magento2\/Model\/FrontControllerPlugin.php(131): Magento\\Webapi\\Controller\\Rest\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Framework\\App\\Request\\Http))\n#14 \/mywebsite\/vendor\/magento\/framework\/Interception\/Interceptor.php(135): Fastly\\Cdn\\Model\\FrontControllerPlugin->aroundDispatch(Object(Magento\\Webapi\\Controller\\Rest\\Interceptor), Object(Closure), Object(Magento\\Framework\\App\\Request\\Http))\n#15 \/mywebsite\/vendor\/magento\/framework\/Interception\/Interceptor.php(153): Magento\\Webapi\\Controller\\Rest\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Framework\\App\\Request\\Http))\n#16 \/mywebsite\/generated\/code\/Magento\/Webapi\/Controller\/Rest\/Interceptor.php(26): Magento\\Webapi\\Controller\\Rest\\Interceptor->___callPlugins('dispatch', Array, Array)\n#17 \/mywebsite\/vendor\/magento\/framework\/App\/Http.php(116): Magento\\Webapi\\Controller\\Rest\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#18 \/mywebsite\/generated\/code\/Magento\/Framework\/App\/Http\/Interceptor.php(24): Magento\\Framework\\App\\Http->launch()\n#19 \/mywebsite\/vendor\/magento\/framework\/App\/Bootstrap.php(263): Magento\\Framework\\App\\Http\\Interceptor->launch()\n#20 \/mywebsite\/pub\/index.php(40): Magento\\Framework\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http\\Interceptor))\n#21 {main}"
 }

Additional information

When looking at the code, we can see that there is a discrepancy between the JS component Magento_InventoryInStorePickupFrontend/js/model/resource-url-manager and the current documentation: https://devdocs.magento.com/guides/v2.4/rest/modules/inventory/in-store-pickup.html

According to the dev documentation, the following parameter for the API request is wrong: searchRequest[filterSets][pickupLocationCodeFilter][value] and should be this instead: searchRequest[filters][pickupLocationCode][value]

@m2-assistant
Copy link

m2-assistant bot commented Oct 5, 2020

Hi @maxlussier-magentocontrib. Thank you for your report.
To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


@maxlussier
Copy link
Contributor Author

@magento I am working on this

@m2-assistant
Copy link

m2-assistant bot commented Nov 7, 2020

Hi @maxlussier! 👋
Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team command to join Contributors team.

@maxlussier
Copy link
Contributor Author

@magento add to contributors team

@m2-assistant
Copy link

m2-assistant bot commented Nov 7, 2020

Hi @maxlussier! 👋
Thank you for joining. Please accept team invitation 👉 here 👈 and add your comment one more time.

@maxlussier
Copy link
Contributor Author

@magento i am working on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants