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(core-flows): use useQueryGraphStep instead of useQueryStep #10643

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/heavy-spies-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/core-flows": patch
---

fix(core-flows): use useQueryGraphStep instead of useQueryStep
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import {
import {
createRemoteLinkStep,
emitEventStep,
useQueryGraphStep,
useRemoteQueryStep,
} from "../../common"
import { useQueryStep } from "../../common/steps/use-query"
import { createOrdersStep } from "../../order/steps/create-orders"
import { authorizePaymentSessionStep } from "../../payment/steps/authorize-payment-session"
import { registerUsageStep } from "../../promotion/steps/register-usage"
Expand Down Expand Up @@ -54,7 +54,7 @@ export const completeCartWorkflow = createWorkflow(
(
input: WorkflowData<CompleteCartWorkflowInput>
): WorkflowResponse<{ id: string }> => {
const orderCart = useQueryStep({
const orderCart = useQueryGraphStep({
entity: "order_cart",
fields: ["cart_id", "order_id"],
filters: { cart_id: input.id },
Expand Down
21 changes: 0 additions & 21 deletions packages/core/core-flows/src/common/steps/use-query.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@ import { WebhookActionResult } from "@medusajs/types"
import { PaymentActions } from "@medusajs/utils"
import { createWorkflow, when } from "@medusajs/workflows-sdk"
import { completeCartWorkflow } from "../../cart/workflows/complete-cart"
import { useQueryStep } from "../../common/steps/use-query"
import { authorizePaymentSessionStep } from "../steps"
import { capturePaymentWorkflow } from "./capture-payment"
import { useQueryGraphStep } from "../../common"

interface ProcessPaymentWorkflowInput extends WebhookActionResult {}

export const processPaymentWorkflowId = "process-payment-workflow"
export const processPaymentWorkflow = createWorkflow(
processPaymentWorkflowId,
(input: ProcessPaymentWorkflowInput) => {
const paymentData = useQueryStep({
const paymentData = useQueryGraphStep({
entity: "payment",
fields: ["id"],
filters: { payment_session_id: input.data?.session_id },
}).config({
name: "payment-query",
})

const paymentSessionResult = useQueryStep({
const paymentSessionResult = useQueryGraphStep({
entity: "payment_session",
fields: ["payment_collection_id"],
filters: { id: input.data?.session_id },
}).config({
name: "payment-session-query",
})

const cartPaymentCollection = useQueryStep({
const cartPaymentCollection = useQueryGraphStep({
entity: "cart_payment_collection",
fields: ["cart_id"],
filters: {
Expand Down
Loading