-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
fix: Handle region updates on cart (1/n) #9369
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
6 Skipped Deployments
|
@@ -316,6 +316,49 @@ medusaIntegrationTestRunner({ | |||
) |
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.
These are all tests of the HTTP layer, so I'll move these to integration-tests/http
before merging. Keeping them as is, because the diff would otherwise be off
4fd1016
to
f26552f
Compare
60096d9
to
77956ae
Compare
Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
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.
noice!
const region = await regionModule.createRegions({ | ||
name: "US", | ||
currency_code: "usd", | ||
countries: ["us"], | ||
}) |
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.
const region = await regionModule.createRegions({ | |
name: "US", | |
currency_code: "usd", | |
countries: ["us"], | |
}) | |
const region = (await api.post( | |
`/admin/regions`, | |
{ | |
name: "US", | |
currency_code: "usd", | |
countries: ["us"], | |
}, | |
adminHeaders | |
)).data.region |
const region = await regionModule.createRegions({ | ||
name: "US", | ||
currency_code: "usd", | ||
automatic_taxes: false, | ||
}) |
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.
const region = await regionModule.createRegions({ | |
name: "US", | |
currency_code: "usd", | |
automatic_taxes: false, | |
}) | |
const region = (await api.post( | |
`/admin/regions`, | |
{ | |
name: "US", | |
currency_code: "usd", | |
automatic_taxes: false | |
}, | |
adminHeaders | |
)).data.region |
**What** On cart creation: - If region only has one country -> create cart with country code On cart updates: - If shipping address country code is provided in input -> - If cart region doesn't include that country -> throw - If cart includes the country -> update shipping address - If region is provided in input and is different from the one currently on the cart -> - If there is a shipping address on the cart -> clear the address - If the region only has one country -> set country code of address - If there is not a shipping address on the cart -> - If the region only has one country -> set country code of address Closes CC-545
What
On cart creation:
On cart updates:
Closes CC-545