-
Notifications
You must be signed in to change notification settings - Fork 63
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
feat: Consider order number from Checkout cookie #2592
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
orderFormId
from Checkout cookie
orderFormId
from Checkout cookieba6ccba
to
5c99afb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Tested the checkout placing an order using https://teste.paladino.co/ and also tested the minicart and the navigation to checkout page using the preview https://sfj-1573732--starter.preview.vtex.app/
5c99afb
to
2d0af99
Compare
## What's the purpose of this pull request? This PR intends to change how we set the order number value on `@faststore/api`. ## How it works? Currently, we set the `orderNumber` value as the one we receive from client-side's storage context. After the order placed, Checkout generates a new order number (a new cart) and send it through the `checkout.vtex.com` cookie, but we do not update this value in the client-side's storage context until the `validateCart` resolver is executed (in the next `ValidateCartMutation` request). At the resolver, we always consider the order number's default value as being the one from client-side's storage context, not the updated one incoming from Checkout cookie. So with this change we will consider the order number value from the `checkout.vtex.com` cookie as the default one, and change the other to be the fallback case. ## How to test it? The following store was created to validate the scenario with both storefront and checkout integrated on the same domain: https://teste.paladino.co/ Perform the entire checkout flow. The payment type should be with "money". After the order placed, check the `orderFormId` in `checkout.vtex.com` cookie, it should be a new one. When returning to the store also check the `orderFormId` from storage context, it should be the same as the cookie one. The cart should be empty too. We need to check if, aside from the order placed flow, everything is working properly on a current store (use the `starter.store` preview, with the secure subdomain), add/remove items in the cart, clear the cart, go to checkout etc. ### Starters Deploy Preview vtex-sites/starter.store#647 --------- Co-authored-by: Emerson Laurentino <[email protected]>
What's the purpose of this pull request?
This PR intends to change how we set the order number value on
@faststore/api
.How it works?
Currently, we set the
orderNumber
value as the one we receive from client-side's storage context. After the order placed, Checkout generates a new order number (a new cart) and send it through thecheckout.vtex.com
cookie, but we do not update this value in the client-side's storage context until thevalidateCart
resolver is executed (in the nextValidateCartMutation
request). At the resolver, we always consider the order number's default value as being the one from client-side's storage context, not the updated one incoming from Checkout cookie.So with this change we will consider the order number value from the
checkout.vtex.com
cookie as the default one, and change the other to be the fallback case.How to test it?
The following store was created to validate the scenario with both storefront and checkout integrated on the same domain: https://teste.paladino.co/
Perform the entire checkout flow. The payment type should be with "money". After the order placed, check the
orderFormId
incheckout.vtex.com
cookie, it should be a new one. When returning to the store also check theorderFormId
from storage context, it should be the same as the cookie one. The cart should be empty too.We need to check if, aside from the order placed flow, everything is working properly on a current store (use the
starter.store
preview, with the secure subdomain), add/remove items in the cart, clear the cart, go to checkout etc.Starters Deploy Preview
vtex-sites/starter.store#647