chore(medusa): do not use transaction id on cart operations (#13931)
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
} from "@medusajs/framework/workflows-sdk"
|
||||
import { useQueryGraphStep } from "../../common"
|
||||
import { acquireLockStep, releaseLockStep } from "../../locking"
|
||||
import { updateLineItemsStep } from "../steps"
|
||||
import { updateLineItemsStep, validateCartStep } from "../steps"
|
||||
import { cartFieldsForRefreshSteps } from "../utils/fields"
|
||||
import { pricingContextResult } from "../utils/schemas"
|
||||
import { getVariantsAndItemsWithPrices } from "./get-variants-and-items-with-prices"
|
||||
@@ -155,6 +155,8 @@ export const refreshCartItemsWorkflow = createWorkflow(
|
||||
},
|
||||
})
|
||||
|
||||
validateCartStep({ cart })
|
||||
|
||||
const { lineItems } = getVariantsAndItemsWithPrices.runAsStep({
|
||||
input: {
|
||||
cart,
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
import { AdditionalData } from "@medusajs/types"
|
||||
import { useQueryGraphStep } from "../../common"
|
||||
import { acquireLockStep, releaseLockStep } from "../../locking"
|
||||
import { removeShippingMethodFromCartStep } from "../steps"
|
||||
import { removeShippingMethodFromCartStep, validateCartStep } from "../steps"
|
||||
import { updateShippingMethodsStep } from "../steps/update-shipping-methods"
|
||||
import { listShippingOptionsForCartWithPricingWorkflow } from "./list-shipping-options-for-cart-with-pricing"
|
||||
|
||||
@@ -109,6 +109,8 @@ export const refreshCartShippingMethodsWorkflow = createWorkflow(
|
||||
return fetchCart ?? input.cart
|
||||
})
|
||||
|
||||
validateCartStep({ cart })
|
||||
|
||||
acquireLockStep({
|
||||
key: cart.id,
|
||||
timeout: 2,
|
||||
|
||||
@@ -12,6 +12,7 @@ import { useQueryGraphStep } from "../../common"
|
||||
import { acquireLockStep, releaseLockStep } from "../../locking"
|
||||
import { updatePaymentCollectionStep } from "../../payment-collection"
|
||||
import { deletePaymentSessionsWorkflow } from "../../payment-collection/workflows/delete-payment-sessions"
|
||||
import { validateCartStep } from "../steps"
|
||||
|
||||
/**
|
||||
* The details of the cart to refresh.
|
||||
@@ -107,6 +108,8 @@ export const refreshPaymentCollectionForCartWorkflow = createWorkflow(
|
||||
return fetchCart ?? input.cart
|
||||
})
|
||||
|
||||
validateCartStep({ cart })
|
||||
|
||||
acquireLockStep({
|
||||
key: cart.id,
|
||||
timeout: 2,
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
prepareAdjustmentsFromPromotionActionsStep,
|
||||
removeLineItemAdjustmentsStep,
|
||||
removeShippingMethodAdjustmentsStep,
|
||||
validateCartStep,
|
||||
} from "../steps"
|
||||
import { updateCartPromotionsStep } from "../steps/update-cart-promotions"
|
||||
import { cartFieldsForRefreshSteps } from "../utils/fields"
|
||||
@@ -96,6 +97,8 @@ export const updateCartPromotionsWorkflow = createWorkflow(
|
||||
return input.cart ?? fetchCart
|
||||
})
|
||||
|
||||
validateCartStep({ cart })
|
||||
|
||||
acquireLockStep({
|
||||
key: cart.id,
|
||||
timeout: 2,
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
findOrCreateCustomerStep,
|
||||
findSalesChannelStep,
|
||||
updateCartsStep,
|
||||
validateCartStep,
|
||||
} from "../steps"
|
||||
import { validateSalesChannelStep } from "../steps/validate-sales-channel"
|
||||
import { refreshCartItemsWorkflow } from "./refresh-cart-items"
|
||||
@@ -111,6 +112,8 @@ export const updateCartWorkflow = createWorkflow(
|
||||
},
|
||||
}).config({ name: "get-cart" })
|
||||
|
||||
validateCartStep({ cart: cartToUpdate })
|
||||
|
||||
const cartDataInput = transform(
|
||||
{ input, cartToUpdate },
|
||||
(data: { input: UpdateCartWorkflowInput; cartToUpdate: CartDTO }) => {
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
import { useQueryGraphStep } from "../../common"
|
||||
import { acquireLockStep, releaseLockStep } from "../../locking"
|
||||
import { getItemTaxLinesStep } from "../../tax/steps/get-item-tax-lines"
|
||||
import { setTaxLinesForItemsStep } from "../steps"
|
||||
import { setTaxLinesForItemsStep, validateCartStep } from "../steps"
|
||||
|
||||
const cartFields = [
|
||||
"id",
|
||||
@@ -144,6 +144,8 @@ export const updateTaxLinesWorkflow = createWorkflow(
|
||||
return input.cart ?? fetchCart
|
||||
})
|
||||
|
||||
validateCartStep({ cart })
|
||||
|
||||
acquireLockStep({
|
||||
key: cart.id,
|
||||
timeout: 2,
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
} from "@medusajs/framework/workflows-sdk"
|
||||
import { useQueryGraphStep } from "../../common"
|
||||
import { getItemTaxLinesStep } from "../../tax/steps/get-item-tax-lines"
|
||||
import { validateCartStep } from "../steps"
|
||||
import { upsertTaxLinesForItemsStep } from "../steps/upsert-tax-lines-for-items"
|
||||
|
||||
const cartFields = [
|
||||
@@ -141,6 +142,8 @@ export const upsertTaxLinesWorkflow = createWorkflow(
|
||||
return input.cart ?? fetchCart
|
||||
})
|
||||
|
||||
validateCartStep({ cart })
|
||||
|
||||
const taxLineItems = getItemTaxLinesStep(
|
||||
transform({ input, cart }, (data) => ({
|
||||
orderOrCart: data.cart,
|
||||
|
||||
@@ -25,7 +25,6 @@ export const completeCartAfterPaymentStep = createStep(
|
||||
input: {
|
||||
id: input.cart_id,
|
||||
},
|
||||
transactionId: input.cart_id,
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user