From 11bd55613304350a5478fd4c001e2309cca3a995 Mon Sep 17 00:00:00 2001 From: Riqwan Thamir Date: Sun, 1 Dec 2024 20:59:26 +0100 Subject: [PATCH] feat(core-flows,framework,medusa): list shipping options pass in cart as pricing context (#10374) * feat(core-flows,framework,medusa): list shipping options pass in cart as pricing context * chore: add test for shipping options returning free shipping --- .changeset/spicy-beds-rescue.md | 7 + .../admin/shipping-option.spec.ts | 20 +-- .../store/shipping-option.spec.ts} | 88 +++++++++++ .../cart/store/cart.workflows.spec.ts | 43 ++---- .../list-shipping-options-for-cart.ts | 145 ++++++++++++------ packages/core/core-flows/src/common/index.ts | 3 +- .../src/common/steps/validate-presence-of.ts | 33 ++++ packages/core/framework/src/http/types.ts | 16 +- .../api/admin/shipping-options/validators.ts | 2 +- .../src/api/store/shipping-options/route.ts | 49 +----- .../api/store/shipping-options/validators.ts | 12 +- .../pricing-module/calculate-price.spec.ts | 22 +-- 12 files changed, 284 insertions(+), 156 deletions(-) create mode 100644 .changeset/spicy-beds-rescue.md rename integration-tests/{modules/__tests__/shipping-options/store/shipping-options.spec.ts => http/__tests__/shipping-option/store/shipping-option.spec.ts} (73%) create mode 100644 packages/core/core-flows/src/common/steps/validate-presence-of.ts diff --git a/.changeset/spicy-beds-rescue.md b/.changeset/spicy-beds-rescue.md new file mode 100644 index 0000000000..e279088b5b --- /dev/null +++ b/.changeset/spicy-beds-rescue.md @@ -0,0 +1,7 @@ +--- +"@medusajs/core-flows": patch +"@medusajs/framework": patch +"@medusajs/medusa": patch +--- + +feat(core-flows,framework,medusa): list shipping options pass in cart as pricing context diff --git a/integration-tests/http/__tests__/shipping-option/admin/shipping-option.spec.ts b/integration-tests/http/__tests__/shipping-option/admin/shipping-option.spec.ts index 6e3e61411f..47320a5865 100644 --- a/integration-tests/http/__tests__/shipping-option/admin/shipping-option.spec.ts +++ b/integration-tests/http/__tests__/shipping-option/admin/shipping-option.spec.ts @@ -152,12 +152,12 @@ medusaIntegrationTestRunner({ amount: 500, rules: [ { - attribute: "cart_total", + attribute: "total", operator: "gte", value: 100, }, { - attribute: "cart_total", + attribute: "total", operator: "lte", value: 200, }, @@ -218,12 +218,12 @@ medusaIntegrationTestRunner({ rules_count: 2, price_rules: expect.arrayContaining([ expect.objectContaining({ - attribute: "cart_total", + attribute: "total", operator: "gte", value: "100", }), expect.objectContaining({ - attribute: "cart_total", + attribute: "total", operator: "lte", value: "200", }), @@ -327,7 +327,7 @@ medusaIntegrationTestRunner({ amount: 500, rules: [ { - attribute: "cart_total", + attribute: "total", operator: "gt", value: 200, }, @@ -378,7 +378,7 @@ medusaIntegrationTestRunner({ rules_count: 2, price_rules: expect.arrayContaining([ expect.objectContaining({ - attribute: "cart_total", + attribute: "total", operator: "gt", value: "200", }), @@ -458,7 +458,7 @@ medusaIntegrationTestRunner({ amount: 500, rules: [ { - attribute: "cart_total", + attribute: "total", operator: "not_whitelisted", value: 100, }, @@ -496,7 +496,7 @@ medusaIntegrationTestRunner({ amount: 500, rules: [ { - attribute: "cart_total", + attribute: "total", operator: "gt", value: "string", }, @@ -626,7 +626,7 @@ medusaIntegrationTestRunner({ amount: 5, rules: [ { - attribute: "cart_total", + attribute: "total", operator: "gt", value: 200, }, @@ -702,7 +702,7 @@ medusaIntegrationTestRunner({ amount: 5, price_rules: [ expect.objectContaining({ - attribute: "cart_total", + attribute: "total", operator: "gt", value: "200", }), diff --git a/integration-tests/modules/__tests__/shipping-options/store/shipping-options.spec.ts b/integration-tests/http/__tests__/shipping-option/store/shipping-option.spec.ts similarity index 73% rename from integration-tests/modules/__tests__/shipping-options/store/shipping-options.spec.ts rename to integration-tests/http/__tests__/shipping-option/store/shipping-option.spec.ts index 8faf838655..5c6e49a394 100644 --- a/integration-tests/modules/__tests__/shipping-options/store/shipping-options.spec.ts +++ b/integration-tests/http/__tests__/shipping-option/store/shipping-option.spec.ts @@ -190,6 +190,17 @@ medusaIntegrationTestRunner({ region_id: region.id, amount: 1100, }, + { + region_id: region.id, + amount: 0, + rules: [ + { + operator: "gt", + attribute: "total", + value: 2000, + }, + ], + }, { region_id: regionTwo.id, amount: 500, @@ -266,6 +277,83 @@ medusaIntegrationTestRunner({ }) ) }) + + it("should return prices based on cart total", async () => { + cart = ( + await api.post( + `/store/carts`, + { + region_id: region.id, + sales_channel_id: salesChannel.id, + currency_code: "usd", + email: "test@admin.com", + items: [ + { + variant_id: product.variants[0].id, + // Adding a quantity of 100 to emulate total being greater than 2000 + quantity: 100, + }, + ], + }, + storeHeaders + ) + ).data.cart + + const resp = await api.get( + `/store/shipping-options?cart_id=${cart.id}`, + storeHeaders + ) + + const shippingOptions = resp.data.shipping_options + + expect(shippingOptions).toHaveLength(1) + expect(shippingOptions[0]).toEqual( + expect.objectContaining({ + id: shippingOption.id, + name: "Test shipping option", + // Free shipping due to cart total being greater than 2000 + amount: 0, + price_type: "flat", + }) + ) + }) + + it("should throw when required fields of a cart are not present", async () => { + cart = ( + await api.post( + `/store/carts`, + { + region_id: region.id, + currency_code: "usd", + sales_channel_id: null, + email: "test@admin.com", + items: [], + }, + storeHeaders + ) + ).data.cart + + const { response } = await api + .get(`/store/shipping-options?cart_id=${cart.id}`, storeHeaders) + .catch((e) => e) + + expect(response.data).toEqual({ + type: "invalid_data", + message: + "Field(s) are required to have value to continue - sales_channel_id", + }) + }) + + it("should throw error when cart_id is not passed as a parameter", async () => { + const { response } = await api + .get(`/store/shipping-options`, storeHeaders) + .catch((e) => e) + + expect(response.data).toEqual({ + type: "invalid_data", + message: "Invalid request: Field 'cart_id' is required", + }) + }) }) }) }, diff --git a/integration-tests/modules/__tests__/cart/store/cart.workflows.spec.ts b/integration-tests/modules/__tests__/cart/store/cart.workflows.spec.ts index 21cd151bf5..32cdc7e052 100644 --- a/integration-tests/modules/__tests__/cart/store/cart.workflows.spec.ts +++ b/integration-tests/modules/__tests__/cart/store/cart.workflows.spec.ts @@ -13,6 +13,7 @@ import { updatePaymentCollectionStepId, updateTaxLinesWorkflow, } from "@medusajs/core-flows" +import { medusaIntegrationTestRunner } from "@medusajs/test-utils" import { ICartModuleService, ICustomerModuleService, @@ -30,7 +31,6 @@ import { Modules, RuleOperator, } from "@medusajs/utils" -import { medusaIntegrationTestRunner } from "@medusajs/test-utils" import { adminHeaders, createAdminUser, @@ -1835,6 +1835,15 @@ medusaIntegrationTestRunner({ }) describe("listShippingOptionsForCartWorkflow", () => { + let region + + beforeEach(async () => { + region = await regionModuleService.createRegions({ + name: "US", + currency_code: "usd", + }) + }) + it("should list shipping options for cart", async () => { const salesChannel = await scModuleService.createSalesChannels({ name: "Webshop", @@ -1846,6 +1855,7 @@ medusaIntegrationTestRunner({ let cart = await cartModuleService.createCarts({ currency_code: "usd", + region_id: region.id, sales_channel_id: salesChannel.id, shipping_address: { city: "CPH", @@ -1935,13 +1945,6 @@ medusaIntegrationTestRunner({ ).run({ input: { cart_id: cart.id, - sales_channel_id: salesChannel.id, - currency_code: "usd", - shipping_address: { - city: cart.shipping_address?.city, - province: cart.shipping_address?.province, - country_code: cart.shipping_address?.country_code, - }, }, }) @@ -1965,6 +1968,7 @@ medusaIntegrationTestRunner({ let cart = await cartModuleService.createCarts({ currency_code: "usd", + region_id: region.id, sales_channel_id: salesChannel.id, shipping_address: { city: "CPH", @@ -2044,16 +2048,7 @@ medusaIntegrationTestRunner({ const { result } = await listShippingOptionsForCartWorkflow( appContainer ).run({ - input: { - cart_id: cart.id, - sales_channel_id: salesChannel.id, - currency_code: "usd", - shipping_address: { - city: cart.shipping_address?.city, - province: cart.shipping_address?.province, - country_code: cart.shipping_address?.country_code, - }, - }, + input: { cart_id: cart.id }, }) expect(result).toEqual([]) @@ -2070,6 +2065,7 @@ medusaIntegrationTestRunner({ let cart = await cartModuleService.createCarts({ currency_code: "usd", + region_id: region.id, sales_channel_id: salesChannel.id, shipping_address: { city: "CPH", @@ -2140,16 +2136,7 @@ medusaIntegrationTestRunner({ const { errors } = await listShippingOptionsForCartWorkflow( appContainer ).run({ - input: { - cart_id: cart.id, - sales_channel_id: salesChannel.id, - currency_code: "usd", - shipping_address: { - city: cart.shipping_address?.city, - province: cart.shipping_address?.province, - country_code: cart.shipping_address?.country_code, - }, - }, + input: { cart_id: cart.id }, throwOnError: false, }) diff --git a/packages/core/core-flows/src/cart/workflows/list-shipping-options-for-cart.ts b/packages/core/core-flows/src/cart/workflows/list-shipping-options-for-cart.ts index b2190a948b..a2ada51ac1 100644 --- a/packages/core/core-flows/src/cart/workflows/list-shipping-options-for-cart.ts +++ b/packages/core/core-flows/src/cart/workflows/list-shipping-options-for-cart.ts @@ -1,11 +1,12 @@ -import { ListShippingOptionsForCartWorkflowInputDTO } from "@medusajs/framework/types" import { deepFlatMap, isPresent, MedusaError } from "@medusajs/framework/utils" import { createWorkflow, transform, + when, WorkflowData, WorkflowResponse, } from "@medusajs/framework/workflows-sdk" +import { useQueryGraphStep, validatePresenceOfStep } from "../../common" import { useRemoteQueryStep } from "../../common/steps/use-remote-query" export const listShippingOptionsForCartWorkflowId = @@ -15,26 +16,52 @@ export const listShippingOptionsForCartWorkflowId = */ export const listShippingOptionsForCartWorkflow = createWorkflow( listShippingOptionsForCartWorkflowId, - (input: WorkflowData) => { - const scLocationFulfillmentSets = useRemoteQueryStep({ - entry_point: "sales_channels", + (input: WorkflowData<{ cart_id: string; is_return?: boolean }>) => { + const cartQuery = useQueryGraphStep({ + entity: "cart", + filters: { id: input.cart_id }, + fields: [ + "id", + "sales_channel_id", + "currency_code", + "region_id", + "shipping_address.city", + "shipping_address.country_code", + "shipping_address.province", + "total", + ], + options: { throwIfKeyNotFound: true }, + }).config({ name: "get-cart" }) + + const cart = transform({ cartQuery }, ({ cartQuery }) => cartQuery.data[0]) + + validatePresenceOfStep({ + entity: cart, + fields: ["sales_channel_id", "region_id", "currency_code"], + }) + + const scFulfillmentSetQuery = useQueryGraphStep({ + entity: "sales_channels", + filters: { id: cart.sales_channel_id }, fields: ["stock_locations.fulfillment_sets.id"], - variables: { - id: input.sales_channel_id, - }, }).config({ name: "sales_channels-fulfillment-query" }) + const scFulfillmentSets = transform( + { scFulfillmentSetQuery }, + ({ scFulfillmentSetQuery }) => scFulfillmentSetQuery.data[0] + ) + const fulfillmentSetIds = transform( - { options: scLocationFulfillmentSets }, + { options: scFulfillmentSets }, (data) => { const fulfillmentSetIds = new Set() deepFlatMap( data.options, "stock_locations.fulfillment_sets", - ({ fulfillment_sets }) => { - if (fulfillment_sets?.id) { - fulfillmentSetIds.add(fulfillment_sets.id) + ({ fulfillment_sets: fulfillmentSet }) => { + if (fulfillmentSet?.id) { + fulfillmentSetIds.add(fulfillmentSet.id) } } ) @@ -43,6 +70,36 @@ export const listShippingOptionsForCartWorkflow = createWorkflow( } ) + const customerGroupIds = when({ cart }, ({ cart }) => { + return !!cart.id + }).then(() => { + const customerQuery = useQueryGraphStep({ + entity: "customer", + filters: { id: cart.customer_id }, + fields: ["groups.id"], + }).config({ name: "get-customer" }) + + return transform({ customerQuery }, ({ customerQuery }) => { + const customer = customerQuery.data[0] + + if (!isPresent(customer)) { + return [] + } + + const { groups = [] } = customer + + return groups.map((group) => group.id) + }) + }) + + const pricingContext = transform( + { cart, customerGroupIds }, + ({ cart, customerGroupIds }) => ({ + ...cart, + customer_group_id: customerGroupIds, + }) + ) + const shippingOptions = useRemoteQueryStep({ entry_point: "shipping_options", fields: [ @@ -71,61 +128,53 @@ export const listShippingOptionsForCartWorkflow = createWorkflow( ], variables: { context: { - is_return: input.is_return, + is_return: !!input.is_return, enabled_in_store: "true", }, filters: { fulfillment_set_id: fulfillmentSetIds, address: { - city: input.shipping_address?.city, - country_code: input.shipping_address?.country_code, - province_code: input.shipping_address?.province, + city: cart.shipping_address?.city, + country_code: cart.shipping_address?.country_code, + province_code: cart.shipping_address?.province, }, }, calculated_price: { - context: { - currency_code: input.currency_code, - region_id: input.region_id, - }, + context: pricingContext, }, }, }).config({ name: "shipping-options-query" }) - const shippingOptionsWithPrice = transform( - { - shippingOptions, - }, - (data) => { - const optionsMissingPrices: string[] = [] + const shippingOptionsWithPrice = transform({ shippingOptions }, (data) => { + const optionsMissingPrices: string[] = [] - const options = data.shippingOptions.map((shippingOption) => { - const { calculated_price, ...options } = shippingOption ?? {} + const options = data.shippingOptions.map((shippingOption) => { + const { calculated_price, ...options } = shippingOption ?? {} - if (options?.id && !isPresent(calculated_price?.calculated_amount)) { - optionsMissingPrices.push(options.id) - } - - return { - ...options, - amount: calculated_price?.calculated_amount, - is_tax_inclusive: - !!calculated_price?.is_calculated_price_tax_inclusive, - } - }) - - if (optionsMissingPrices.length) { - throw new MedusaError( - MedusaError.Types.INVALID_DATA, - `Shipping options with IDs ${optionsMissingPrices.join( - ", " - )} do not have a price` - ) + if (options?.id && !isPresent(calculated_price?.calculated_amount)) { + optionsMissingPrices.push(options.id) } - return options + return { + ...options, + amount: calculated_price?.calculated_amount, + is_tax_inclusive: + !!calculated_price?.is_calculated_price_tax_inclusive, + } + }) + + if (optionsMissingPrices.length) { + const ids = optionsMissingPrices.join(", ") + + throw new MedusaError( + MedusaError.Types.INVALID_DATA, + `Shipping options with IDs ${ids} do not have a price` + ) } - ) + + return options + }) return new WorkflowResponse(shippingOptionsWithPrice) } diff --git a/packages/core/core-flows/src/common/index.ts b/packages/core/core-flows/src/common/index.ts index 90f9183dad..fc63feaac6 100644 --- a/packages/core/core-flows/src/common/index.ts +++ b/packages/core/core-flows/src/common/index.ts @@ -1,10 +1,11 @@ export * from "./steps/create-remote-links" export * from "./steps/dismiss-remote-links" -export * from "./steps/remove-remote-links" export * from "./steps/emit-event" +export * from "./steps/remove-remote-links" export * from "./steps/update-remote-links" export * from "./steps/use-query-graph" export * from "./steps/use-remote-query" +export * from "./steps/validate-presence-of" export * from "./workflows/batch-links" export * from "./workflows/create-links" export * from "./workflows/dismiss-links" diff --git a/packages/core/core-flows/src/common/steps/validate-presence-of.ts b/packages/core/core-flows/src/common/steps/validate-presence-of.ts new file mode 100644 index 0000000000..598a7d4451 --- /dev/null +++ b/packages/core/core-flows/src/common/steps/validate-presence-of.ts @@ -0,0 +1,33 @@ +import { isPresent, MedusaError } from "@medusajs/framework/utils" +import { createStep } from "@medusajs/framework/workflows-sdk" + +/** + * This step validates the presence of attributes on an object + */ +export const validatePresenceOfStep = createStep( + "validate-presence-of", + async function ({ + entity, + fields, + }: { + entity: Record + fields: string[] + }) { + const invalid: string[] = [] + + for (const field of fields) { + if (!isPresent(entity[field])) { + invalid.push(field) + } + } + + if (invalid.length) { + const invalidFields = invalid.join(", ") + + throw new MedusaError( + MedusaError.Types.INVALID_DATA, + `Field(s) are required to have value to continue - ${invalidFields}` + ) + } + } +) diff --git a/packages/core/framework/src/http/types.ts b/packages/core/framework/src/http/types.ts index b193b0a2c7..1adff9d130 100644 --- a/packages/core/framework/src/http/types.ts +++ b/packages/core/framework/src/http/types.ts @@ -90,16 +90,12 @@ export type GlobalMiddlewareDescriptor = { config?: MiddlewaresConfig } -export interface MedusaRequest - extends Request< - { - [key: string]: string - }, - any, - Body - > { +export interface MedusaRequest< + Body = unknown, + QueryFields = Record +> extends Request<{ [key: string]: string }, any, Body> { validatedBody: Body - validatedQuery: RequestQueryFields & Record + validatedQuery: RequestQueryFields & QueryFields /** * TODO: shouldn't this correspond to returnable fields instead of allowed fields? also it is used by the cleanResponseData util */ @@ -122,7 +118,7 @@ export interface MedusaRequest /** * An object containing the fields that are filterable e.g `{ id: Any }` */ - filterableFields: Record + filterableFields: QueryFields includes?: Record /** diff --git a/packages/medusa/src/api/admin/shipping-options/validators.ts b/packages/medusa/src/api/admin/shipping-options/validators.ts index 27225c25a4..e63e6215ab 100644 --- a/packages/medusa/src/api/admin/shipping-options/validators.ts +++ b/packages/medusa/src/api/admin/shipping-options/validators.ts @@ -86,7 +86,7 @@ export const AdminCreateShippingOptionTypeObject = z const AdminPriceRules = z.array( z.object({ - attribute: z.literal("cart_total"), + attribute: z.literal("total"), operator: z.nativeEnum(PricingRuleOperator), value: z.number(), }) diff --git a/packages/medusa/src/api/store/shipping-options/route.ts b/packages/medusa/src/api/store/shipping-options/route.ts index 41a3e416ff..26324739f3 100644 --- a/packages/medusa/src/api/store/shipping-options/route.ts +++ b/packages/medusa/src/api/store/shipping-options/route.ts @@ -1,52 +1,17 @@ import { listShippingOptionsForCartWorkflow } from "@medusajs/core-flows" import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http" -import { HttpTypes, ICartModuleService } from "@medusajs/framework/types" -import { MedusaError, Modules } from "@medusajs/framework/utils" -import { StoreGetShippingOptionsType } from "./validators" +import { HttpTypes } from "@medusajs/framework/types" export const GET = async ( - req: MedusaRequest, + req: MedusaRequest<{}, HttpTypes.StoreGetShippingOptionList>, res: MedusaResponse ) => { - const { cart_id, is_return } = - req.filterableFields as StoreGetShippingOptionsType + const { cart_id, is_return } = req.filterableFields - if (!cart_id) { - throw new MedusaError( - MedusaError.Types.NOT_ALLOWED, - "You must provide the cart_id to list shipping options" - ) - } - - const cartService = req.scope.resolve(Modules.CART) - - const cart = await cartService.retrieveCart(cart_id, { - select: [ - "id", - "sales_channel_id", - "currency_code", - "region_id", - "shipping_address.city", - "shipping_address.country_code", - "shipping_address.province", - ], - relations: ["shipping_address"], + const workflow = listShippingOptionsForCartWorkflow(req.scope) + const { result: shipping_options } = await workflow.run({ + input: { cart_id, is_return: !!is_return }, }) - const { result } = await listShippingOptionsForCartWorkflow(req.scope).run({ - input: { - cart_id: cart.id, - sales_channel_id: cart.sales_channel_id, - currency_code: cart.currency_code, - region_id: cart.region_id, - is_return: !!is_return, - shipping_address: { - city: cart.shipping_address?.city, - country_code: cart.shipping_address?.country_code, - province: cart.shipping_address?.province, - }, - }, - }) - - res.json({ shipping_options: result }) + res.json({ shipping_options }) } diff --git a/packages/medusa/src/api/store/shipping-options/validators.ts b/packages/medusa/src/api/store/shipping-options/validators.ts index b036471e2e..c44e9891a0 100644 --- a/packages/medusa/src/api/store/shipping-options/validators.ts +++ b/packages/medusa/src/api/store/shipping-options/validators.ts @@ -1,11 +1,13 @@ import { z } from "zod" -import { createFindParams } from "../../utils/validators" import { applyAndAndOrOperators } from "../../utils/common-validators" +import { createFindParams } from "../../utils/validators" -export const StoreGetShippingOptionsFields = z.object({ - cart_id: z.string(), - is_return: z.boolean().optional(), -}) +export const StoreGetShippingOptionsFields = z + .object({ + cart_id: z.string(), + is_return: z.boolean().optional(), + }) + .strict() export type StoreGetShippingOptionsType = z.infer< typeof StoreGetShippingOptions diff --git a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/calculate-price.spec.ts b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/calculate-price.spec.ts index e1f4ab4e5d..c2e6c42699 100644 --- a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/calculate-price.spec.ts +++ b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/calculate-price.spec.ts @@ -1870,7 +1870,7 @@ moduleIntegrationTestRunner({ currency_code: "usd", rules: { region_id: "de", - cart_total: withOperator("between", 300, 400), + total: withOperator("between", 300, 400), }, }, { @@ -1878,7 +1878,7 @@ moduleIntegrationTestRunner({ currency_code: "usd", rules: { region_id: "de", - cart_total: withOperator("betweenEquals", 400, 500), + total: withOperator("betweenEquals", 400, 500), }, }, { @@ -1886,7 +1886,7 @@ moduleIntegrationTestRunner({ currency_code: "usd", rules: { region_id: "de", - cart_total: withOperator("excludingMin", 500, 600), + total: withOperator("excludingMin", 500, 600), }, }, { @@ -1894,7 +1894,7 @@ moduleIntegrationTestRunner({ currency_code: "usd", rules: { region_id: "de", - cart_total: withOperator("excludingMax", 600, 700), + total: withOperator("excludingMax", 600, 700), }, }, ], @@ -1906,7 +1906,7 @@ moduleIntegrationTestRunner({ context: { currency_code: "usd", region_id: "de", - cart_total: 350, + total: 350, }, } ) @@ -1951,7 +1951,7 @@ moduleIntegrationTestRunner({ context: { currency_code: "usd", region_id: "de", - cart_total: 300, + total: 300, }, } ) @@ -1964,7 +1964,7 @@ moduleIntegrationTestRunner({ context: { currency_code: "usd", region_id: "de", - cart_total: 400, + total: 400, }, } ) @@ -1979,7 +1979,7 @@ moduleIntegrationTestRunner({ context: { currency_code: "usd", region_id: "de", - cart_total: 500, + total: 500, }, } ) @@ -1994,7 +1994,7 @@ moduleIntegrationTestRunner({ context: { currency_code: "usd", region_id: "de", - cart_total: 501, + total: 501, }, } ) @@ -2009,7 +2009,7 @@ moduleIntegrationTestRunner({ context: { currency_code: "usd", region_id: "de", - cart_total: 601, + total: 601, }, } ) @@ -2024,7 +2024,7 @@ moduleIntegrationTestRunner({ context: { currency_code: "usd", region_id: "de", - cart_total: 900, + total: 900, }, } )