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

fix(medusa): add payments default relation to getTotalsRelations #5875

Merged
merged 4 commits into from
Dec 22, 2023

Conversation

cyf0e
Copy link
Contributor

@cyf0e cyf0e commented Dec 14, 2023

  • What - add "payments" relation to getTotalsRelations in order service
  • Why - fixes bug where order.paid_total is always 0 by default
  • How - add "payments" relation to getTotalsRelations in order service
  • Testing - manual testing

Fixes #5874

This line https://github.com/medusajs/medusa/blob/1c6c759aa895db4a5888257fac1ccadb2ea74162/packages/medusa/src/services/order.ts#L1858C12-L1858C12 in the order service looks to beresponsible for calculating paid_total when you try to retrieve an order with totals.

By default if the user doesnt pass in the "payments" relation manually by himself, the paid total will always be 0 which is probably not the expected behaviour.

Adding the payments relation to default getTotalsRelations fixes this.

@cyf0e cyf0e requested a review from a team as a code owner December 14, 2023 14:08
Copy link

changeset-bot bot commented Dec 14, 2023

⚠️ No Changeset found

Latest commit: deae99f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Dec 14, 2023

@cyf0e is attempting to deploy a commit to the medusajs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Member

@adrien2p adrien2p left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adrien2p adrien2p requested a review from olivermrbl December 14, 2023 14:17
Copy link

vercel bot commented Dec 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Visit Preview Dec 22, 2023 7:13am
docs-ui ⬜️ Ignored (Inspect) Visit Preview Dec 22, 2023 7:13am
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Dec 22, 2023 7:13am

@olivermrbl olivermrbl changed the title bugfix: add payments default relation to getTotalsRelations fix(medusa): add payments default relation to getTotalsRelations Dec 15, 2023
@olivermrbl
Copy link
Contributor

@cyf0e please fix the integration tests, so we can merge :)

@cyf0e
Copy link
Contributor Author

cyf0e commented Dec 16, 2023

@olivermrbl should be good, having trouble running the integration tests locally so cant really validate. sorry about that

@olivermrbl olivermrbl merged commit b5a07cf into medusajs:develop Dec 22, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: order.paid_total by default always 0
3 participants