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

Add "Add to cart" api endpoint #87

Open
Tracked by #69
valincius opened this issue Nov 16, 2021 · 8 comments · Fixed by #90
Open
Tracked by #69

Add "Add to cart" api endpoint #87

valincius opened this issue Nov 16, 2021 · 8 comments · Fixed by #90
Assignees
Labels
api anything related to the back-end task Describes a child task of a user story
Projects

Comments

@valincius
Copy link
Member

valincius commented Nov 16, 2021

Need to add a endpoint to the cart controller that takes a product id & quantity and adds to our cart

@valincius valincius changed the title Requires api endpoint to add this item to the cart Add "Add to cart" api endpoint Nov 16, 2021
@valincius valincius added this to To do in API via automation Nov 16, 2021
@valincius valincius added api anything related to the back-end task Describes a child task of a user story labels Nov 16, 2021
@valincius
Copy link
Member Author

Might need more of a discussion but I think here is where we should also build the cart record if one isn't passed in.
We can have a cookie with the cart id that is passed with the "add to cart" request, if we don't pass one in, we can have this action create the cart then return the id then can use that for subsequent requests?

@pobiega
Copy link
Collaborator

pobiega commented Nov 17, 2021

That's the kind of flow we want to enable, and a cookie with cart ID seems like a good solution. So just to be clear, the API endpoint will either respond with 204 No Content or 200 OK with a cartID as the response body, assuming happy flow. Is that ok with you guys?

@Palisar
Copy link
Contributor

Palisar commented Nov 17, 2021

Sounds good i have no idea how cookies work but i guess now is as good a time as any

@Palisar Palisar self-assigned this Nov 17, 2021
@valincius
Copy link
Member Author

I think we may be able to avoid the round trip and just have the client generate the cart id since it's a guid.
Then the server won't have to send anything back. It can just create the cart record if it's a cart id that doesn't exist in the system, then add the item to it.

@Palisar
Copy link
Contributor

Palisar commented Nov 18, 2021

yeah and this action would only happen once the first item is added right ? after that would we not want the cookie to store the guid ?
FYI i may have to wait until the weekend to finish this properly, im running on very little sleep today

@Palisar
Copy link
Contributor

Palisar commented Nov 20, 2021

Gonna setup a PR draft for this as I think its going to require a few steps to complete

@valincius
Copy link
Member Author

yeah and this action would only happen once the first item is added right ? after that would we not want the cookie to store the guid ?
FYI i may have to wait until the weekend to finish this properly, im running on very little sleep today

We would still want to store the cart id, we’d just already have it before sending the request if we go with this route. You can go with whatever approach though, whichever you think is easier!

@Palisar
Copy link
Contributor

Palisar commented Nov 28, 2021

This task is complete I forgot to add the PR to the issue

@Palisar Palisar closed this as completed Nov 28, 2021
@Palisar Palisar reopened this Feb 13, 2022
API automation moved this from Done to In progress Feb 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api anything related to the back-end task Describes a child task of a user story
Projects
API
In progress
Development

Successfully merging a pull request may close this issue.

3 participants