-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
fix(core-flows): refresh payment collection inside updateCartPromotionsWorkflow #13963
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
base: develop
Are you sure you want to change the base?
fix(core-flows): refresh payment collection inside updateCartPromotionsWorkflow #13963
Conversation
🦋 Changeset detectedLatest commit: ee3f16f The changes in this PR will be included in the next version bump. This PR includes changesets to release 74 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 8 Skipped Deployments
|
.changeset/large-loops-yell.md
Outdated
| @@ -0,0 +1,6 @@ | |||
| --- | |||
| "@medusajs/core-flows": patch | |||
| "integration-tests-http": patch | |||
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.
todo: integration tests does not have to be in the changeset
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.
Looks good overall. Just wondering if we should refresh payment collections as part of updateCartPromotionsWorkflow workflow, or if we should separate those and call refreshPaymentCollectionForCartWorkflow outside. Some flows like refreshCartItemsWorkflow call the update workflow, then the refresh workflow explicitly and in those cases, payment refresh will be called twice. Alternatively, in that case we can pass a flag to updateCartPromotionsWorkflow to skip the refresh workflow?
Hey Frane so far from what I saw from current usage of I think I am more inclined to your second suggestion, since with the first one one would need to remember/know of the |
Summary
What — What changes are introduced in this PR?
Refresh cart payment collection inside of
updateCartPromotionsWorkflowWhy — Why are these changes relevant or necessary?
Without updating the cart payment collection after the workflow runs, you would end up with stale payment_collection amounts, that don't account for the removal/addition of the promotions
How — How have these changes been implemented?
Added a call to
refreshPaymentCollectionForCartWorkflowright after the promotions are updatedTesting — How have these changes been tested, or how can the reviewer test the feature?
I've included missing integration test for the delete cart promotions endpoint
Examples
Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.
This helps with documentation and ensures maintainers can quickly understand and verify the change.
// Example usageChecklist
Please ensure the following before requesting a review:
yarn changesetand follow the promptsAdditional Context
Add any additional context, related issues, or references that might help the reviewer understand this PR.
fixes #13936