fix(core-flows): refresh payment collections upon shipping changes (#10673)
* fix(core-flows): refresh payment collections upon shipping changes * chore: fix spec
This commit is contained in:
1 parent
3efd25d06d
commit
5d1098ceb9
4 files changed
+120
-47
No files matched your search
@@ -17,8 +17,7 @@ import { validateAndReturnShippingMethodsDataStep } from "../steps/validate-ship
|
||||
import { validateCartShippingOptionsPriceStep } from "../steps/validate-shipping-options-price"
|
||||
import { cartFieldsForRefreshSteps } from "../utils/fields"
|
||||
import { listShippingOptionsForCartWithPricingWorkflow } from "./list-shipping-options-for-cart-with-pricing"
|
||||
import { updateCartPromotionsWorkflow } from "./update-cart-promotions"
|
||||
import { updateTaxLinesWorkflow } from "./update-tax-lines"
|
||||
import { refreshCartItemsWorkflow } from "./refresh-cart-items"
|
||||
|
||||
export interface AddShippingMethodToCartWorkflowInput {
|
||||
cart_id: string
|
||||
@@ -132,9 +131,9 @@ export const addShippingMethodToCartWorkflow = createWorkflow(
|
||||
}
|
||||
)
|
||||
|
||||
const currentShippingMethods = transform({ cart }, ({ cart }) => {
|
||||
return cart.shipping_methods.map((sm) => sm.id)
|
||||
})
|
||||
const currentShippingMethods = transform({ cart }, ({ cart }) =>
|
||||
cart.shipping_methods.map((sm) => sm.id)
|
||||
)
|
||||
|
||||
parallelize(
|
||||
removeShippingMethodFromCartStep({
|
||||
@@ -149,16 +148,8 @@ export const addShippingMethodToCartWorkflow = createWorkflow(
|
||||
})
|
||||
)
|
||||
|
||||
updateTaxLinesWorkflow.runAsStep({
|
||||
input: {
|
||||
cart_id: input.cart_id,
|
||||
},
|
||||
})
|
||||
|
||||
updateCartPromotionsWorkflow.runAsStep({
|
||||
input: {
|
||||
cart_id: input.cart_id,
|
||||
},
|
||||
refreshCartItemsWorkflow.runAsStep({
|
||||
input: { cart_id: cart.id },
|
||||
})
|
||||
}
|
||||
)
|
||||
@@ -28,16 +28,15 @@ export const defaultStoreCartFields = [
|
||||
"original_shipping_subtotal",
|
||||
"original_shipping_total",
|
||||
"metadata",
|
||||
"sales_channel_id",
|
||||
"promotions.id",
|
||||
"promotions.code",
|
||||
"promotions.is_automatic",
|
||||
"promotions.application_method.value",
|
||||
"promotions.application_method.type",
|
||||
"promotions.application_method.currency_code",
|
||||
"items",
|
||||
"items.thumbnail",
|
||||
"region",
|
||||
"items.id",
|
||||
"items.thumbnail",
|
||||
"items.product",
|
||||
"items.product.id",
|
||||
"items.variant",
|
||||
@@ -118,10 +117,7 @@ export const defaultStoreCartFields = [
|
||||
"region.currency_code",
|
||||
"region.automatic_taxes",
|
||||
"*region.countries",
|
||||
"sales_channel_id",
|
||||
|
||||
"payment_collection.id",
|
||||
"payment_collection.amount",
|
||||
"*payment_collection",
|
||||
"*payment_collection.payment_sessions",
|
||||
]
|
||||
|
||||
|
||||
Reference in new issue
Block a user