Magento2: Adding billing information via mine API expects costumer id

Created on 10 Aug 2018  路  7Comments  路  Source: magento/magento2

Preconditions

  • Magento 2.2.5 installed with sample data , PHP 7.1 and MYSQL 5.6 With Ngnix
  • Create Customer token and a quote with items that would be used to add shipping and billing information
  • A saved customer address .

Steps to reproduce

Hit the products REST api rest/V1/carts/mine/billing-address with generated customer token in above state with a similar body as below

{
"address": {
      "customerAddressId":"{{ saved customer address id }}",
      "countryId":"MY",
      "regionId":"572",
      "regionCode":"MLK",
      "region":"Melaka",
      "street":[  
         "My home Any Floor, any Tower ,",
         "Unknown  Road"
      ],
      "telephone":"",
      "postcode":"12345",
      "city":"Melaka",
      "firstname":"Vishwas",
      "lastname":"Bhatnagar"
   }
}

Check the response of the Call

Expected result
Success and Returns quote address id

Actual result

"message": "Unable to save address. Please check input data.",
"trace": "#0 [internal function]: Magento\Quote\Model\BillingAddressManagement->assign(26, Object(Magento\Quote\Model\Quote\Address\Interceptor), false)n#1 /vagrant/digi-magento/vendor/magento/module-webapi/Controller/Rest.php(330): call_user_func_array(Array, Array)n#2 /vagrant/digi-magento/vendor/magento/module-webapi/Controller/Rest.php(239): Magento\Webapi\Controller\Rest->processApiRequest()n#3 /vagrant/digi-magento/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))n#4 /vagrant/digi-magento/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent('dispatch', Array)n#5 /vagrant/digi-magento/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))n#6 /vagrant/digi-magento/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(26): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins('dispatch', Array, Array)n#7 /magento2/vendor/magento/framework/App/Http.php(135)

and a exception is generated

[2018-08-10 07:32:12] report.CRITICAL: No such entity with customerId = {"exception":"[object] (Magento\Framework\Exception\NoSuchEntityException(code: 0): No such entity with customerId = at vendor/magento/framework/Exception/NoSuchEntityException.php:50)"} []

Same stands for

  • /V1/carts/mine/shipping-information

As it is a mine api the customer id should be populated from customer token

FrameworWebapi Fixed in 2.2.x Fixed in 2.3.x Clear Description Confirmed Format is valid Ready for Work Reproduced on 2.2.x Reproduced on 2.3.x up for grabs

All 7 comments

Hi @wittyvishwas. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me {$VERSION} instance

where {$VERSION} is version tags (starting from 2.2.0+) or develop branches (2.2-develop +).
For more details, please, review the Magento Contributor Assistant documentation.

@wittyvishwas do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

@wittyvishwas, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. Please provide more detailed steps to reproduce or try to reproduce this issue on a clean installation or latest release.
default

@engcom-backlog-pb Thank you for the prompt response , So the catch is if you have put in a random id that doesn't not exists it works , i am assuming that customerAddressId that you passed '65' is just copy pasted from my report does not actually exists . As mentioned in prerequisite you must have a saved address for the customer and pass that address id in above response

And if you add a node "customerId":"2", like below it works

{
"address": {
      "customerAddressId":"65",
       "customerId":"2",
      "countryId":"MY",
      "regionId":"572",
      "regionCode":"MLK",
      "region":"Melaka",
      "street":[  
         "My home Any Floor, any Tower ,",
         "Unknown  Road"
      ],
      "telephone":"",
      "postcode":"12345",
      "city":"Melaka",
      "firstname":"Vishwas",
      "lastname":"Bhatnagar"
   }
}

Replace the above response with your customer_address_id and customerId of the user that you are using

@wittyvishwas, thank you for your report.
We've acknowledged the issue and added to our backlog.

Hi @pmclain. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:

  • [x] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [x] 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

Hi @wittyvishwas. Thank you for your report.
The issue has been fixed in magento/magento2#18704 by @pmclain in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.1 release.

Hi @wittyvishwas. Thank you for your report.
The issue has been fixed in magento/magento2#18872 by @gelanivishal in 2.2-develop branch
Related commit(s):

The fix will be available with the upcoming 2.2.8 release.

Was this page helpful?
0 / 5 - 0 ratings