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

[Forwardport] Coupon API not working for guest user #16562

Merged

Conversation

gelanivishal
Copy link
Contributor

@gelanivishal gelanivishal commented Jul 5, 2018

Original Pull Request

#15320

issue/14056 - Coupon API not working for guest user
#14056

Description

This is a forward port for the following PR: #15320

I think everything is fine with the code. Reason is that programmers don't use API properly. With 1 step when cart is being created it's already wrong because quote doesn't contain proper store id. When cart is being added by API it has store id 0. So instead of adding by

/rest/V1/guest-carts (which is standard in swagger)

we should use

/rest/default/V1/guest-carts

By using store code in URL we provide store id to quote.

Then coupon code added by API works like charm.

So reason is some kind of ignorance. We've decided to provide better validation message while adding coupon code to inform programmer that he has wrong quote and that problem is rather there.

I think that some example would be useful in API documentation to show how to use API properly.

Fixed Issues (if relevant)

  1. Coupon API not working for guest user #14056: Coupon API not working for guest user

Manual testing scenarios

  1. Create guest cart by API
  2. Add product to cart by API
  3. Create coupon and rule in admin panel
  4. Add coupon to cart by API
  5. See exception "Coupon code is not valid"

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-engcom-team
Copy link
Contributor

Hi @gelanivishal. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me {$VERSION} instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@ishakhsuvarov
Copy link
Contributor

Hi @gelanivishal
Please make sure you include a link to the original PR when porting.

Thanks

@gelanivishal
Copy link
Contributor Author

gelanivishal commented Jul 5, 2018

Hi @ishakhsuvarov
I have updated.

Thank you.

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.0 milestone Jul 6, 2018
@orlangur orlangur self-assigned this Jul 6, 2018
@orlangur orlangur changed the title issue/14056 - Coupon API not working for guest user [Forwardport] Coupon API not working for guest user Jul 6, 2018
@orlangur orlangur removed their assignment Jul 6, 2018
@orlangur orlangur self-assigned this Jul 6, 2018
@magento-engcom-team
Copy link
Contributor

Hi @orlangur, thank you for the review.
ENGCOM-2201 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

Hi @gelanivishal. Thank you for your contribution.
We will aim to release these changes as part of 2.3.0.
Please check the release notes for final confirmation.

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

Successfully merging this pull request may close these issues.

5 participants