Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Introducing `Spreee::Checkout::Requirements`
Damian Legawiec629eee96348c
diff --git a/docs/api-reference/store.yaml b/docs/api-reference/store.yamlindex a85cc08d48..c5c1a38eec 100644--- a/docs/api-reference/store.yaml+++ b/docs/api-reference/store.yaml@@ -661,16 +661,16 @@ paths:content:application/json:example:- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImNkN2QyY2FhLTkyOWQtNDkzYS05NTQ0LTgwZDMyYTc0YmRjZSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzczMjYzNzY5fQ.ziT9ugb9kC8vLE8q41j5UM9vJb_dMea0feoumRqgBgA+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjI4NGQ4YTMzLWFlN2UtNGRhZi04NjllLTI5NWQ2ZTYyNTEyNiIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzczMzEwNTQ4fQ.yAWJcJfwuPf2xhzYFY-VTklDlNXqpEmLu2jg7kPdMEouser:id: cus_UkLWZg9DAJemail: [email protected]- first_name: Mallory- last_name: Schmitt+ first_name: Rodrick+ last_name: Kshlerinphone:accepts_email_marketing: false- created_at: '2026-03-11T20:16:08.948Z'- updated_at: '2026-03-11T20:16:08.948Z'+ created_at: '2026-03-12T09:15:48.006Z'+ updated_at: '2026-03-12T09:15:48.006Z'addresses: []default_billing_address:default_shipping_address:@@ -747,16 +747,16 @@ paths:content:application/json:example:- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjY4MTg5MjBmLTM5ODYtNDdiYy04NjE1LWUxMDBhMDFjYmMwNyIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzczMjYzNzcwfQ.QAFfl9n0ftXwpVd8NcRfD7pg39I8Eo7jibXguYer7vk+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjA1NDlhYTcyLWFiZTMtNGEwZC05NmVmLTI4MjZhYTlhZDYwMSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzczMzEwNTQ5fQ.A6Z_Eewbap_WUk8k_WI8oPvnu8zY7FmXlNHj2OOxJlouser:id: cus_UkLWZg9DAJemail: [email protected]- first_name: Loma- last_name: Hickle+ first_name: Marcel+ last_name: Vandervortphone:accepts_email_marketing: false- created_at: '2026-03-11T20:16:10.379Z'- updated_at: '2026-03-11T20:16:10.379Z'+ created_at: '2026-03-12T09:15:49.445Z'+ updated_at: '2026-03-12T09:15:49.445Z'addresses: []default_billing_address:default_shipping_address:@@ -828,19 +828,13 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R234338485- state: cart- checkout_steps:- - address- - delivery- - complete- token: 1WFmOSYStXOjNKWBoA9RTg1773260171159+ number: R499009231+ token: 60QazEbZa7-Um7T3oyRyiA1773306950226email:special_instructions:currency: USDlocale: enitem_count: 0- state_lock_version: 0item_total: '0.0'display_item_total: "$0.00"ship_total: '0.0'@@ -857,8 +851,23 @@ paths:display_additional_tax_total: "$0.00"total: '0.0'display_total: "$0.00"- created_at: '2026-03-11T20:16:11.160Z'- updated_at: '2026-03-11T20:16:11.160Z'+ created_at: '2026-03-12T09:15:50.227Z'+ updated_at: '2026-03-12T09:15:50.227Z'+ current_step: address+ completed_steps: []+ requirements:+ - step: cart+ field: line_items+ message: Add at least one item to your cart+ - step: address+ field: email+ message: Email address is required+ - step: address+ field: ship_address+ message: Shipping address is required+ - step: delivery+ field: shipping_method+ message: Select a shipping method for all shipmentsorder_promotions: []line_items: []shipments: []@@ -984,20 +993,13 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R984383391- state: cart- checkout_steps:- - address- - delivery- - payment- - complete- token: RvY28jX4f7dPXw7cPnHeEJPE4CELLvXSpBM- email: [email protected]+ number: R626687381+ token: jSwsK2nfC2wZ1TgbJhdxv7HXPUuAFU6d7tC+ email: [email protected]special_instructions:currency: USDlocale: enitem_count: 1- state_lock_version: 0item_total: '10.0'display_item_total: "$10.00"ship_total: '100.0'@@ -1014,16 +1016,22 @@ paths:display_additional_tax_total: "$0.00"total: '110.0'display_total: "$110.00"- created_at: '2026-03-11T20:16:12.161Z'- updated_at: '2026-03-11T20:16:12.218Z'+ created_at: '2026-03-12T09:15:51.312Z'+ updated_at: '2026-03-12T09:15:51.371Z'+ current_step: address+ completed_steps: []+ requirements:+ - step: payment+ field: payment+ message: Add a payment methodorder_promotions: []line_items:- id: li_UkLWZg9DAJvariant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 36316- slug: product-36316+ name: Product 36511+ slug: product-36511options_text: ''price: '10.0'display_price: "$10.00"@@ -1042,23 +1050,23 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-11T20:16:12.196Z'- updated_at: '2026-03-11T20:16:12.196Z'+ created_at: '2026-03-12T09:15:51.345Z'+ updated_at: '2026-03-12T09:15:51.345Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []shipments:- id: ship_UkLWZg9DAJ- number: H91527585123+ number: H50818630911state: pendingtracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"shipped_at:- created_at: '2026-03-11T20:16:12.201Z'- updated_at: '2026-03-11T20:16:12.215Z'+ created_at: '2026-03-12T09:15:51.352Z'+ updated_at: '2026-03-12T09:15:51.368Z'shipping_method:id: shpm_UkLWZg9DAJname: UPS Ground@@ -1066,7 +1074,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_42- name: Idalia Predovic+ name: Debra Mayertaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -1225,20 +1233,13 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R300345614- state: cart- checkout_steps:- - address- - delivery- - payment- - complete- token: WoRC24UvkSqpTXHRP2sX23Gs6m7hoHPNjCQ- email: [email protected]+ number: R608743303+ token: VhjaK3YhvMZDCAdghEGJkm4TbQEyTC23qPz+ email: [email protected]special_instructions:currency: USDlocale: enitem_count: 1- state_lock_version: 0item_total: '10.0'display_item_total: "$10.00"ship_total: '100.0'@@ -1255,16 +1256,22 @@ paths:display_additional_tax_total: "$0.00"total: '110.0'display_total: "$110.00"- created_at: '2026-03-11T20:16:13.450Z'- updated_at: '2026-03-11T20:16:13.517Z'+ created_at: '2026-03-12T09:15:52.596Z'+ updated_at: '2026-03-12T09:15:52.646Z'+ current_step: address+ completed_steps: []+ requirements:+ - step: payment+ field: payment+ message: Add a payment methodorder_promotions: []line_items:- id: li_UkLWZg9DAJvariant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 51231- slug: product-51231+ name: Product 54502+ slug: product-54502options_text: ''price: '10.0'display_price: "$10.00"@@ -1283,23 +1290,23 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-11T20:16:13.487Z'- updated_at: '2026-03-11T20:16:13.487Z'+ created_at: '2026-03-12T09:15:52.626Z'+ updated_at: '2026-03-12T09:15:52.626Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []shipments:- id: ship_UkLWZg9DAJ- number: H00139797754+ number: H62160033361state: pendingtracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"shipped_at:- created_at: '2026-03-11T20:16:13.493Z'- updated_at: '2026-03-11T20:16:13.515Z'+ created_at: '2026-03-12T09:15:52.631Z'+ updated_at: '2026-03-12T09:15:52.643Z'shipping_method:id: shpm_UkLWZg9DAJname: UPS Ground@@ -1307,7 +1314,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_50- name: Lai Harvey+ name: Holli Wizaaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -1426,20 +1433,13 @@ paths:example:data:- id: cart_gbHJdmfrXB- number: R086891701- state: cart- checkout_steps:- - address- - delivery- - payment- - complete- token: phVNSmF8sKw7t33JchC8ymQo4JN5wQjyugD- email: [email protected]+ number: R151314057+ token: Zc4Woyn2doGc6WVfSWYm8rmiVwuiJb8LpKM+ email: [email protected]special_instructions:currency: USDlocale: enitem_count: 1- state_lock_version: 0item_total: '10.0'display_item_total: "$10.00"ship_total: '100.0'@@ -1456,16 +1456,22 @@ paths:display_additional_tax_total: "$0.00"total: '110.0'display_total: "$110.00"- created_at: '2026-03-11T20:16:16.260Z'- updated_at: '2026-03-11T20:16:16.311Z'+ created_at: '2026-03-12T09:15:55.412Z'+ updated_at: '2026-03-12T09:15:55.456Z'+ current_step: address+ completed_steps: []+ requirements:+ - step: payment+ field: payment+ message: Add a payment methodorder_promotions: []line_items:- id: li_gbHJdmfrXBvariant_id: variant_gbHJdmfrXBquantity: 1currency: USD- name: Product 108397- slug: product-108397+ name: Product 107565+ slug: product-107565options_text: ''price: '10.0'display_price: "$10.00"@@ -1484,23 +1490,23 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-11T20:16:16.289Z'- updated_at: '2026-03-11T20:16:16.289Z'+ created_at: '2026-03-12T09:15:55.437Z'+ updated_at: '2026-03-12T09:15:55.437Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []shipments:- id: ship_gbHJdmfrXB- number: H42649481070+ number: H54853402827state: pendingtracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"shipped_at:- created_at: '2026-03-11T20:16:16.297Z'- updated_at: '2026-03-11T20:16:16.309Z'+ created_at: '2026-03-12T09:15:55.444Z'+ updated_at: '2026-03-12T09:15:55.454Z'shipping_method:id: shpm_gbHJdmfrXBname: UPS Ground@@ -1508,7 +1514,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_66- name: Janise Gaylord+ name: Ozella McKenzieaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -1563,20 +1569,13 @@ paths:state_name: STATE_NAME_71payment_methods: []- id: cart_UkLWZg9DAJ- number: R768632994- state: cart- checkout_steps:- - address- - delivery- - payment- - complete- token: UgphxzbfnFWinPDepo4CheaxB4HVG8m6Ms7- email: [email protected]+ number: R916575973+ token: WZuuRH9CBcvENZhDDyaBgbfBP8Vn6fXgJgV+ email: [email protected]special_instructions:currency: USDlocale: enitem_count: 1- state_lock_version: 0item_total: '10.0'display_item_total: "$10.00"ship_total: '100.0'@@ -1593,16 +1592,22 @@ paths:display_additional_tax_total: "$0.00"total: '110.0'display_total: "$110.00"- created_at: '2026-03-11T20:16:16.196Z'- updated_at: '2026-03-11T20:16:16.248Z'+ created_at: '2026-03-12T09:15:55.331Z'+ updated_at: '2026-03-12T09:15:55.405Z'+ current_step: address+ completed_steps: []+ requirements:+ - step: payment+ field: payment+ message: Add a payment methodorder_promotions: []line_items:- id: li_UkLWZg9DAJvariant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 95834- slug: product-95834+ name: Product 91699+ slug: product-91699options_text: ''price: '10.0'display_price: "$10.00"@@ -1621,23 +1626,23 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-11T20:16:16.226Z'- updated_at: '2026-03-11T20:16:16.226Z'+ created_at: '2026-03-12T09:15:55.376Z'+ updated_at: '2026-03-12T09:15:55.376Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []shipments:- id: ship_UkLWZg9DAJ- number: H16511579350+ number: H15664343601state: pendingtracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"shipped_at:- created_at: '2026-03-11T20:16:16.231Z'- updated_at: '2026-03-11T20:16:16.245Z'+ created_at: '2026-03-12T09:15:55.385Z'+ updated_at: '2026-03-12T09:15:55.402Z'shipping_method:id: shpm_UkLWZg9DAJname: UPS Ground@@ -1645,7 +1650,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_66- name: Janise Gaylord+ name: Ozella McKenzieaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -1787,8 +1792,8 @@ paths:meta_description:meta_keywords:children_count: 1- created_at: '2026-03-11T20:16:16.754Z'- updated_at: '2026-03-11T20:16:16.814Z'+ created_at: '2026-03-12T09:15:55.915Z'+ updated_at: '2026-03-12T09:15:55.963Z'parent_id:description: ''description_html: ''@@ -1806,8 +1811,8 @@ paths:meta_description:meta_keywords:children_count: 1- created_at: '2026-03-11T20:16:16.764Z'- updated_at: '2026-03-11T20:16:16.814Z'+ created_at: '2026-03-12T09:15:55.923Z'+ updated_at: '2026-03-12T09:15:55.963Z'parent_id: ctg_UkLWZg9DAJdescription: ''description_html: ''@@ -1825,8 +1830,8 @@ paths:meta_description:meta_keywords:children_count: 0- created_at: '2026-03-11T20:16:16.776Z'- updated_at: '2026-03-11T20:16:16.783Z'+ created_at: '2026-03-12T09:15:55.932Z'+ updated_at: '2026-03-12T09:15:55.937Z'parent_id: ctg_gbHJdmfrXBdescription: ''description_html: ''@@ -1927,8 +1932,8 @@ paths:meta_description:meta_keywords:children_count: 1- created_at: '2026-03-11T20:16:17.226Z'- updated_at: '2026-03-11T20:16:17.263Z'+ created_at: '2026-03-12T09:15:56.391Z'+ updated_at: '2026-03-12T09:15:56.429Z'parent_id: ctg_UkLWZg9DAJdescription: ''description_html: ''@@ -2055,17 +2060,17 @@ paths:example:data:- id: prod_UkLWZg9DAJ- name: Product 208355+ name: Product 203371description: |-- Consectetur tenetur pariatur totam soluta. Quasi temporibus odio provident incidunt. Aut molestiae at maxime ullam consequatur laborum voluptatum. Illo autem eos modi quasi dicta fuga.- Modi cumque laudantium quod animi reprehenderit totam. Minus corporis consectetur temporibus est blanditiis iure quae. Alias eos consequatur delectus eaque quidem reprehenderit amet. Tempora numquam dolorem rem nemo autem quo blanditiis commodi.- slug: product-208355+ Odio excepturi autem repellendus a. Pariatur architecto repudiandae reiciendis corrupti nobis. Quas doloremque enim soluta id voluptates.+ Optio officiis totam quae id. Enim numquam adipisci alias voluptas sequi distinctio impedit. Quis aspernatur deserunt esse veniam eos enim aut. Distinctio dolores neque quia atque. Sed laboriosam omnis ullam dicta voluptates.+ slug: product-203371meta_description:meta_keywords:variant_count: 0- available_on: '2025-03-11T20:16:17.712Z'- created_at: '2026-03-11T20:16:17.731Z'- updated_at: '2026-03-11T20:16:17.746Z'+ available_on: '2025-03-12T09:15:56.899Z'+ created_at: '2026-03-12T09:15:56.914Z'+ updated_at: '2026-03-12T09:15:56.928Z'purchasable: truein_stock: falsebackorderable: true@@ -2188,20 +2193,13 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R588561123- state: cart- checkout_steps:- - address- - delivery- - payment- - complete- token: MWAPtS8LeQokYsy4vPCw8KLhHkZoh6yT5Q3- email: [email protected]+ number: R232840484+ token: M2ZjMQxhkpPrJWKqZtXX5t86Woa2Au7PZMS+ email: [email protected]special_instructions: Leave at doorcurrency: USDlocale: enitem_count: 1- state_lock_version: 1item_total: '10.0'display_item_total: "$10.00"ship_total: '100.0'@@ -2218,16 +2216,22 @@ paths:display_additional_tax_total: "$0.00"total: '110.0'display_total: "$110.00"- created_at: '2026-03-11T20:16:18.705Z'- updated_at: '2026-03-11T20:16:18.781Z'+ created_at: '2026-03-12T09:15:57.863Z'+ updated_at: '2026-03-12T09:15:57.934Z'+ current_step: address+ completed_steps: []+ requirements:+ - step: payment+ field: payment+ message: Add a payment methodorder_promotions: []line_items:- id: li_UkLWZg9DAJvariant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 237577- slug: product-237577+ name: Product 235056+ slug: product-235056options_text: ''price: '10.0'display_price: "$10.00"@@ -2246,23 +2250,23 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-11T20:16:18.738Z'- updated_at: '2026-03-11T20:16:18.738Z'+ created_at: '2026-03-12T09:15:57.893Z'+ updated_at: '2026-03-12T09:15:57.893Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []shipments:- id: ship_UkLWZg9DAJ- number: H23404285089+ number: H71035350624state: pendingtracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"shipped_at:- created_at: '2026-03-11T20:16:18.743Z'- updated_at: '2026-03-11T20:16:18.759Z'+ created_at: '2026-03-12T09:15:57.898Z'+ updated_at: '2026-03-12T09:15:57.913Z'shipping_method:id: shpm_UkLWZg9DAJname: UPS Ground@@ -2270,7 +2274,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_86- name: Weldon Towne+ name: Jeanelle Feestaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -2440,8 +2444,8 @@ paths:application/json:example:id: or_gbHJdmfrXB- number: R870413854- email: [email protected]+ number: R880956650+ email: [email protected]special_instructions:currency: USDlocale: en@@ -2464,17 +2468,17 @@ paths:display_additional_tax_total: "$0.00"total: '29.99'display_total: "$29.99"- completed_at: '2026-03-11T20:16:19.602Z'- created_at: '2026-03-11T20:16:19.386Z'- updated_at: '2026-03-11T20:16:19.602Z'+ completed_at: '2026-03-12T09:15:58.772Z'+ created_at: '2026-03-12T09:15:58.554Z'+ updated_at: '2026-03-12T09:15:58.772Z'order_promotions: []line_items:- id: li_gbHJdmfrXBvariant_id: variant_gbHJdmfrXBquantity: 1currency: USD- name: Product 251178- slug: product-251178+ name: Product 251236+ slug: product-251236options_text: ''price: '19.99'display_price: "$19.99"@@ -2493,23 +2497,23 @@ paths:discounted_amount: '19.99'display_discounted_amount: "$19.99"display_compare_at_amount: "$0.00"- created_at: '2026-03-11T20:16:19.410Z'- updated_at: '2026-03-11T20:16:19.457Z'+ created_at: '2026-03-12T09:15:58.580Z'+ updated_at: '2026-03-12T09:15:58.628Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []shipments:- id: ship_EfhxLZ9ck8- number: H68645938166+ number: H17784765265state: pendingtracking:tracking_url:cost: '10.0'display_cost: "$10.00"shipped_at:- created_at: '2026-03-11T20:16:19.478Z'- updated_at: '2026-03-11T20:16:19.597Z'+ created_at: '2026-03-12T09:15:58.647Z'+ updated_at: '2026-03-12T09:15:58.766Z'shipping_method:id: shpm_UkLWZg9DAJname: UPS Ground@@ -2517,7 +2521,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_90- name: Jack Sipes+ name: Rosaura Leuschkeaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -2550,11 +2554,11 @@ paths:payment_method_id: pm_UkLWZg9DAJstate: completedresponse_code: '12345'- number: PJAIOR48+ number: PL2AWR0Xamount: '29.99'display_amount: "$29.99"- created_at: '2026-03-11T20:16:19.556Z'- updated_at: '2026-03-11T20:16:19.583Z'+ created_at: '2026-03-12T09:15:58.723Z'+ updated_at: '2026-03-12T09:15:58.750Z'source_type: credit_cardsource_id: card_UkLWZg9DAJsource:@@ -2824,20 +2828,13 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R684605333- state: cart- checkout_steps:- - address- - delivery- - payment- - complete- token: VE67cEJ9DR1dx51rgSvwWVWHs5ESp8JSseM- email: [email protected]+ number: R171344928+ token: dhxagu7sCqDXm3rg37EejP61rYyrB2nEKx1+ email: [email protected]special_instructions:currency: USDlocale: enitem_count: 1- state_lock_version: 1item_total: '10.0'display_item_total: "$10.00"ship_total: '100.0'@@ -2854,16 +2851,22 @@ paths:display_additional_tax_total: "$0.00"total: '110.0'display_total: "$110.00"- created_at: '2026-03-11T20:16:21.735Z'- updated_at: '2026-03-11T20:16:21.835Z'+ created_at: '2026-03-12T09:16:00.964Z'+ updated_at: '2026-03-12T09:16:01.117Z'+ current_step: address+ completed_steps: []+ requirements:+ - step: payment+ field: payment+ message: Add a payment methodorder_promotions: []line_items:- id: li_UkLWZg9DAJvariant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 286411- slug: product-286411+ name: Product 285504+ slug: product-285504options_text: ''price: '10.0'display_price: "$10.00"@@ -2882,23 +2885,23 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-11T20:16:21.765Z'- updated_at: '2026-03-11T20:16:21.765Z'+ created_at: '2026-03-12T09:16:01.014Z'+ updated_at: '2026-03-12T09:16:01.014Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []shipments:- id: ship_UkLWZg9DAJ- number: H84193505229+ number: H48407680008state: pendingtracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"shipped_at:- created_at: '2026-03-11T20:16:21.770Z'- updated_at: '2026-03-11T20:16:21.784Z'+ created_at: '2026-03-12T09:16:01.021Z'+ updated_at: '2026-03-12T09:16:01.036Z'shipping_method:id: shpm_UkLWZg9DAJname: UPS Ground@@ -2906,7 +2909,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_104- name: Angelina Tromp+ name: Valrie McKenzieaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -2928,12 +2931,12 @@ paths:- id: py_UkLWZg9DAJpayment_method_id: pm_UkLWZg9DAJstate: checkout- response_code: 1-SC-20260311201621829283- number: PMEGFU0N+ response_code: 1-SC-20260312091601109175+ number: PQ587MJDamount: '50.0'display_amount: "$50.00"- created_at: '2026-03-11T20:16:21.830Z'- updated_at: '2026-03-11T20:16:21.830Z'+ created_at: '2026-03-12T09:16:01.110Z'+ updated_at: '2026-03-12T09:16:01.110Z'source_type: store_creditsource_id: credit_UkLWZg9DAJsource:@@ -3070,20 +3073,13 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R561946058- state: cart- checkout_steps:- - address- - delivery- - payment- - complete- token: N2ffiZoKdeftYDG5LBx7fkPmaJhGXaeijYV- email: [email protected]+ number: R421628859+ token: Peuh7kyRkdR3aZhAeJw8DVfXheHQUjdScnt+ email: [email protected]special_instructions:currency: USDlocale: enitem_count: 1- state_lock_version: 1item_total: '10.0'display_item_total: "$10.00"ship_total: '100.0'@@ -3100,16 +3096,22 @@ paths:display_additional_tax_total: "$0.00"total: '110.0'display_total: "$110.00"- created_at: '2026-03-11T20:16:22.999Z'- updated_at: '2026-03-11T20:16:23.104Z'+ created_at: '2026-03-12T09:16:02.304Z'+ updated_at: '2026-03-12T09:16:02.418Z'+ current_step: address+ completed_steps: []+ requirements:+ - step: payment+ field: payment+ message: Add a payment methodorder_promotions: []line_items:- id: li_UkLWZg9DAJvariant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 30599- slug: product-30599+ name: Product 307733+ slug: product-307733options_text: ''price: '10.0'display_price: "$10.00"@@ -3128,23 +3130,23 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-11T20:16:23.029Z'- updated_at: '2026-03-11T20:16:23.099Z'+ created_at: '2026-03-12T09:16:02.337Z'+ updated_at: '2026-03-12T09:16:02.414Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []shipments:- id: ship_UkLWZg9DAJ- number: H95858592120+ number: H26651858682state: pendingtracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"shipped_at:- created_at: '2026-03-11T20:16:23.034Z'- updated_at: '2026-03-11T20:16:23.047Z'+ created_at: '2026-03-12T09:16:02.343Z'+ updated_at: '2026-03-12T09:16:02.358Z'shipping_method:id: shpm_UkLWZg9DAJname: UPS Ground@@ -3152,7 +3154,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_112- name: Aileen Murray+ name: Felicitas Swaniawskiaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -3544,8 +3546,8 @@ paths:example:data:- id: or_UkLWZg9DAJ- number: R749102215- email: [email protected]+ number: R615290401+ email: [email protected]special_instructions:currency: USDlocale: en@@ -3568,17 +3570,17 @@ paths:display_additional_tax_total: "$0.00"total: '110.0'display_total: "$110.00"- completed_at: '2026-03-11T20:16:27.795Z'- created_at: '2026-03-11T20:16:27.710Z'- updated_at: '2026-03-11T20:16:27.794Z'+ completed_at: '2026-03-12T09:16:07.134Z'+ created_at: '2026-03-12T09:16:07.080Z'+ updated_at: '2026-03-12T09:16:07.134Z'order_promotions: []line_items:- id: li_UkLWZg9DAJvariant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 328144- slug: product-328144+ name: Product 328748+ slug: product-328748options_text: ''price: '10.0'display_price: "$10.00"@@ -3597,23 +3599,23 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-11T20:16:27.761Z'- updated_at: '2026-03-11T20:16:27.761Z'+ created_at: '2026-03-12T09:16:07.111Z'+ updated_at: '2026-03-12T09:16:07.111Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []shipments:- id: ship_UkLWZg9DAJ- number: H69766910536+ number: H72164232623state: pendingtracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"shipped_at:- created_at: '2026-03-11T20:16:27.769Z'- updated_at: '2026-03-11T20:16:27.791Z'+ created_at: '2026-03-12T09:16:07.116Z'+ updated_at: '2026-03-12T09:16:07.132Z'shipping_method:id: shpm_UkLWZg9DAJname: UPS Ground@@ -3621,7 +3623,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_132- name: Darla Franecki+ name: Jerrica Muelleraddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -3741,8 +3743,8 @@ paths:application/json:example:id: or_UkLWZg9DAJ- number: R094723322- email: [email protected]+ number: R866772594+ email: [email protected]special_instructions:currency: USDlocale: en@@ -3765,17 +3767,17 @@ paths:display_additional_tax_total: "$0.00"total: '110.0'display_total: "$110.00"- completed_at: '2026-03-11T20:16:28.486Z'- created_at: '2026-03-11T20:16:28.437Z'- updated_at: '2026-03-11T20:16:28.486Z'+ completed_at: '2026-03-12T09:16:07.805Z'+ created_at: '2026-03-12T09:16:07.758Z'+ updated_at: '2026-03-12T09:16:07.805Z'order_promotions: []line_items:- id: li_UkLWZg9DAJvariant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 341755- slug: product-341755+ name: Product 346963+ slug: product-346963options_text: ''price: '10.0'display_price: "$10.00"@@ -3794,23 +3796,23 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-11T20:16:28.467Z'- updated_at: '2026-03-11T20:16:28.467Z'+ created_at: '2026-03-12T09:16:07.786Z'+ updated_at: '2026-03-12T09:16:07.786Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []shipments:- id: ship_UkLWZg9DAJ- number: H68136358737+ number: H24666627910state: pendingtracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"shipped_at:- created_at: '2026-03-11T20:16:28.472Z'- updated_at: '2026-03-11T20:16:28.484Z'+ created_at: '2026-03-12T09:16:07.790Z'+ updated_at: '2026-03-12T09:16:07.803Z'shipping_method:id: shpm_UkLWZg9DAJname: UPS Ground@@ -3818,7 +3820,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_138- name: Leopoldo Monahan+ name: Jani Smithamaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -3926,7 +3928,7 @@ paths:content:application/json:example:- token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImU4NjQwMzgwLWI2NjAtNDZhNy05NDM4LTk3NmY4YjcwMDk0YiIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzczMjYzNzg5fQ.YMTjgRA2s6FXRb7KqeYDobu_TQEKQbBdfyHRPWCdsDY+ token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImM4MGRjYWRmLWExOGQtNDMwYS04ZDVhLTM2ZDU4Zjg5M2E1MiIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzczMzEwNTY5fQ.fI9N_jETSyJCtggRZdqgGEN02rmOeMzemBNPghH6sq0user:id: cus_UkLWZg9DAJemail: [email protected]@@ -3934,8 +3936,8 @@ paths:last_name: Doephone: "+1234567890"accepts_email_marketing: true- created_at: '2026-03-11T20:16:29.684Z'- updated_at: '2026-03-11T20:16:29.684Z'+ created_at: '2026-03-12T09:16:09.013Z'+ updated_at: '2026-03-12T09:16:09.013Z'addresses: []default_billing_address:default_shipping_address:@@ -4039,13 +4041,13 @@ paths:application/json:example:id: cus_UkLWZg9DAJ- email: [email protected]- first_name: Cortney- last_name: Cartwright+ email: [email protected]+ first_name: Louvenia+ last_name: Cristphone: 555-555-0199accepts_email_marketing: false- created_at: '2026-03-11T20:16:30.230Z'- updated_at: '2026-03-11T20:16:30.496Z'+ created_at: '2026-03-12T09:16:09.558Z'+ updated_at: '2026-03-12T09:16:09.824Z'addresses:- id: addr_gbHJdmfrXBfirstname: John@@ -4169,13 +4171,13 @@ paths:application/json:example:id: cus_UkLWZg9DAJ- email: [email protected]+ email: [email protected]first_name: Updatedlast_name: Namephone: 555-555-0199accepts_email_marketing: false- created_at: '2026-03-11T20:16:30.791Z'- updated_at: '2026-03-11T20:16:31.073Z'+ created_at: '2026-03-12T09:16:10.125Z'+ updated_at: '2026-03-12T09:16:10.403Z'addresses:- id: addr_gbHJdmfrXBfirstname: John@@ -4399,7 +4401,7 @@ paths:example:data:- id: gc_UkLWZg9DAJ- code: C7706CBAF6DA86AB+ code: 3E4DD37149EC053Bstate: activecurrency: USDamount: '10.0'@@ -4413,8 +4415,8 @@ paths:redeemed_at:expired: falseactive: true- created_at: '2026-03-11T20:16:34.340Z'- updated_at: '2026-03-11T20:16:34.340Z'+ created_at: '2026-03-12T09:16:13.488Z'+ updated_at: '2026-03-12T09:16:13.488Z'meta:page: 1limit: 25@@ -4497,7 +4499,7 @@ paths:application/json:example:id: gc_UkLWZg9DAJ- code: A8CECCF67EA14278+ code: 37DE86DA57381B3Cstate: activecurrency: USDamount: '10.0'@@ -4511,8 +4513,8 @@ paths:redeemed_at:expired: falseactive: true- created_at: '2026-03-11T20:16:35.429Z'- updated_at: '2026-03-11T20:16:35.429Z'+ created_at: '2026-03-12T09:16:14.590Z'+ updated_at: '2026-03-12T09:16:14.590Z'schema:"$ref": "#/components/schemas/GiftCard"'404':@@ -4583,20 +4585,13 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R516823008- state: cart- checkout_steps:- - address- - delivery- - payment- - complete- token: PedZ9zcDBZR1Bhyd2mF9nnzXAmNJQXpjrtP- email: [email protected]+ number: R941027820+ token: 4dfyuRuDvjBw6BUVVdPU9YngkPU37GmiZ4w+ email: [email protected]special_instructions:currency: USDlocale: enitem_count: 2- state_lock_version: 1item_total: '29.99'display_item_total: "$29.99"ship_total: '0.0'@@ -4613,16 +4608,28 @@ paths:display_additional_tax_total: "$0.00"total: '29.99'display_total: "$29.99"- created_at: '2026-03-11T20:16:37.178Z'- updated_at: '2026-03-11T20:16:37.272Z'+ created_at: '2026-03-12T09:16:16.415Z'+ updated_at: '2026-03-12T09:16:16.523Z'+ current_step: address+ completed_steps: []+ requirements:+ - step: address+ field: ship_address+ message: Shipping address is required+ - step: delivery+ field: shipping_method+ message: Select a shipping method for all shipments+ - step: payment+ field: payment+ message: Add a payment methodorder_promotions: []line_items:- id: li_UkLWZg9DAJvariant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 449502- slug: product-449502+ name: Product 442792+ slug: product-442792options_text: ''price: '10.0'display_price: "$10.00"@@ -4641,8 +4648,8 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-11T20:16:37.204Z'- updated_at: '2026-03-11T20:16:37.204Z'+ created_at: '2026-03-12T09:16:16.444Z'+ updated_at: '2026-03-12T09:16:16.444Z'compare_at_amount:thumbnail_url:option_values: []@@ -4651,8 +4658,8 @@ paths:variant_id: variant_gbHJdmfrXBquantity: 1currency: USD- name: Product 458133- slug: product-458133+ name: Product 453921+ slug: product-453921options_text: ''price: '19.99'display_price: "$19.99"@@ -4671,8 +4678,8 @@ paths:discounted_amount: '19.99'display_discounted_amount: "$19.99"display_compare_at_amount: "$0.00"- created_at: '2026-03-11T20:16:37.239Z'- updated_at: '2026-03-11T20:16:37.239Z'+ created_at: '2026-03-12T09:16:16.497Z'+ updated_at: '2026-03-12T09:16:16.497Z'compare_at_amount:thumbnail_url:option_values: []@@ -4786,19 +4793,13 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R467731208- state: cart- checkout_steps:- - address- - delivery- - complete- token: XmefX8ayavKS3bKQeYx57guiYpJMBRcHoXM- email: [email protected]+ number: R691705517+ token: EWR4oZxAiBMjzzr4YnL3GkjmQwhSuL983MM+ email: [email protected]special_instructions:currency: USDlocale: enitem_count: 0- state_lock_version: 1item_total: '0.0'display_item_total: "$0.00"ship_total: '0.0'@@ -4815,16 +4816,25 @@ paths:display_additional_tax_total: "$0.00"total: '0.0'display_total: "$0.00"- created_at: '2026-03-11T20:16:39.006Z'- updated_at: '2026-03-11T20:16:39.040Z'+ created_at: '2026-03-12T09:16:18.286Z'+ updated_at: '2026-03-12T09:16:18.316Z'+ current_step: address+ completed_steps: []+ requirements:+ - step: address+ field: ship_address+ message: Shipping address is required+ - step: delivery+ field: shipping_method+ message: Select a shipping method for all shipmentsorder_promotions: []line_items:- id: li_UkLWZg9DAJvariant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 487545- slug: product-487545+ name: Product 481521+ slug: product-481521options_text: ''price: '10.0'display_price: "$10.00"@@ -4843,8 +4853,8 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-11T20:16:39.039Z'- updated_at: '2026-03-11T20:16:39.060Z'+ created_at: '2026-03-12T09:16:18.315Z'+ updated_at: '2026-03-12T09:16:18.348Z'compare_at_amount:thumbnail_url:option_values: []@@ -4938,19 +4948,13 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R770244240- state: cart- checkout_steps:- - address- - delivery- - complete- token: 2wDhy4RHwbhhSD3voBxYTt5x8VmEtrDTweh- email: [email protected]+ number: R844378796+ token: mPfnnKWeKzSTHgGmKMazDuWc3Wx9WCWpp9G+ email: [email protected]special_instructions:currency: USDlocale: enitem_count: 0- state_lock_version: 1item_total: '0.0'display_item_total: "$0.00"ship_total: '0.0'@@ -4967,8 +4971,20 @@ paths:display_additional_tax_total: "$0.00"total: '0.0'display_total: "$0.00"- created_at: '2026-03-11T20:16:39.615Z'- updated_at: '2026-03-11T20:16:39.702Z'+ created_at: '2026-03-12T09:16:18.912Z'+ updated_at: '2026-03-12T09:16:19.017Z'+ current_step: address+ completed_steps: []+ requirements:+ - step: cart+ field: line_items+ message: Add at least one item to your cart+ - step: address+ field: ship_address+ message: Shipping address is required+ - step: delivery+ field: shipping_method+ message: Select a shipping method for all shipmentsorder_promotions: []line_items: []shipments: []@@ -5510,7 +5526,7 @@ paths:application/json:example:id: or_UkLWZg9DAJ- number: R286057069+ number: R629853947email: [email protected]special_instructions:currency: USD@@ -5534,17 +5550,17 @@ paths:display_additional_tax_total: "$0.00"total: '110.0'display_total: "$110.00"- completed_at: '2026-03-11T20:16:41.401Z'- created_at: '2026-03-11T20:16:41.353Z'- updated_at: '2026-03-11T20:16:41.401Z'+ completed_at: '2026-03-12T09:16:20.797Z'+ created_at: '2026-03-12T09:16:20.749Z'+ updated_at: '2026-03-12T09:16:20.797Z'order_promotions: []line_items:- id: li_UkLWZg9DAJvariant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 526850- slug: product-526850+ name: Product 52522+ slug: product-52522options_text: ''price: '10.0'display_price: "$10.00"@@ -5563,23 +5579,23 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-11T20:16:41.380Z'- updated_at: '2026-03-11T20:16:41.380Z'+ created_at: '2026-03-12T09:16:20.777Z'+ updated_at: '2026-03-12T09:16:20.777Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []shipments:- id: ship_UkLWZg9DAJ- number: H90765027023+ number: H72182556184state: pendingtracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"shipped_at:- created_at: '2026-03-11T20:16:41.385Z'- updated_at: '2026-03-11T20:16:41.398Z'+ created_at: '2026-03-12T09:16:20.782Z'+ updated_at: '2026-03-12T09:16:20.795Z'shipping_method:id: shpm_UkLWZg9DAJname: UPS Ground@@ -5587,7 +5603,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_197- name: Toni Hessel+ name: Willette Wuckertaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -5782,13 +5798,13 @@ paths:id: ps_gbHJdmfrXBstatus: pendingcurrency: USD- external_id: bogus_939206b9e39cf38a11c26a57+ external_id: bogus_6e271386d876ecf70966484fexternal_data:- client_secret: bogus_secret_f4c6242151dd9228+ client_secret: bogus_secret_9cf8b7fec7696687customer_external_id:expires_at:- created_at: '2026-03-11T20:16:43.811Z'- updated_at: '2026-03-11T20:16:43.811Z'+ created_at: '2026-03-12T09:16:23.240Z'+ updated_at: '2026-03-12T09:16:23.240Z'amount: '110.0'payment_method_id: pm_UkLWZg9DAJorder_id: or_UkLWZg9DAJ@@ -5877,13 +5893,13 @@ paths:id: ps_UkLWZg9DAJstatus: pendingcurrency: USD- external_id: bogus_bc82c2673de64ed729f48e41+ external_id: bogus_5768847c2cdf415629f8709cexternal_data:client_secret: secret_123customer_external_id:expires_at:- created_at: '2026-03-11T20:16:44.400Z'- updated_at: '2026-03-11T20:16:44.400Z'+ created_at: '2026-03-12T09:16:23.843Z'+ updated_at: '2026-03-12T09:16:23.843Z'amount: '110.0'payment_method_id: pm_UkLWZg9DAJorder_id: or_UkLWZg9DAJ@@ -5940,13 +5956,13 @@ paths:id: ps_UkLWZg9DAJstatus: pendingcurrency: USD- external_id: bogus_f316a00803e0c9e1401ae1c3+ external_id: bogus_2666c07bda0c167f4ae48bc3external_data:client_secret: secret_123customer_external_id:expires_at:- created_at: '2026-03-11T20:16:45.634Z'- updated_at: '2026-03-11T20:16:45.647Z'+ created_at: '2026-03-12T09:16:25.089Z'+ updated_at: '2026-03-12T09:16:25.102Z'amount: '50.0'payment_method_id: pm_UkLWZg9DAJorder_id: or_UkLWZg9DAJ@@ -6037,13 +6053,13 @@ paths:id: ps_UkLWZg9DAJstatus: completedcurrency: USD- external_id: bogus_62e29b242af47209c88c5c5f+ external_id: bogus_c592e2e176a379eea8d3d70aexternal_data:client_secret: secret_123customer_external_id:expires_at:- created_at: '2026-03-11T20:16:46.249Z'- updated_at: '2026-03-11T20:16:46.262Z'+ created_at: '2026-03-12T09:16:25.707Z'+ updated_at: '2026-03-12T09:16:25.721Z'amount: '110.0'payment_method_id: pm_UkLWZg9DAJorder_id: or_UkLWZg9DAJ@@ -6123,11 +6139,11 @@ paths:example:id: pss_gbHJdmfrXBstatus: pending- external_id: bogus_seti_01a4dd0b5363cfafaa72ac6e- external_client_secret: bogus_seti_secret_16408d9c954c43f8+ external_id: bogus_seti_058c9a088f6b00e703d74733+ external_client_secret: bogus_seti_secret_ea3be35a6b9d6cf7external_data: {}- created_at: '2026-03-11T20:16:47.484Z'- updated_at: '2026-03-11T20:16:47.484Z'+ created_at: '2026-03-12T09:16:27.050Z'+ updated_at: '2026-03-12T09:16:27.050Z'payment_method_id: pm_UkLWZg9DAJpayment_source_id:payment_source_type:@@ -6224,12 +6240,12 @@ paths:example:id: pss_UkLWZg9DAJstatus: pending- external_id: seti_test_a011106e2f58cb1c542cb4d1- external_client_secret: seti_secret_0b2f92f40bd0afbbf7044da3+ external_id: seti_test_3ce26f6ba67fe132b945e418+ external_client_secret: seti_secret_71fa514934b449ae898e8d67external_data:client_secret: secret_123- created_at: '2026-03-11T20:16:49.187Z'- updated_at: '2026-03-11T20:16:49.187Z'+ created_at: '2026-03-12T09:16:28.707Z'+ updated_at: '2026-03-12T09:16:28.707Z'payment_method_id: pm_UkLWZg9DAJpayment_source_id:payment_source_type:@@ -6302,12 +6318,12 @@ paths:example:id: pss_UkLWZg9DAJstatus: completed- external_id: seti_test_66940b447b5069ab23b8d9fe- external_client_secret: seti_secret_ed8707996cca86b59bc6b1e7+ external_id: seti_test_5cfb5dd8a36cc4bcf9731e23+ external_client_secret: seti_secret_95ae516a56c5b4607c2c124fexternal_data:client_secret: secret_123- created_at: '2026-03-11T20:16:50.300Z'- updated_at: '2026-03-11T20:16:50.313Z'+ created_at: '2026-03-12T09:16:29.792Z'+ updated_at: '2026-03-12T09:16:29.804Z'payment_method_id: pm_UkLWZg9DAJpayment_source_id: card_UkLWZg9DAJpayment_source_type: Spree::CreditCard@@ -6389,11 +6405,11 @@ paths:payment_method_id: pm_UkLWZg9DAJstate: checkoutresponse_code: '12345'- number: PJP8HO3U+ number: PEKKKT4Wamount: '110.0'display_amount: "$110.00"- created_at: '2026-03-11T20:16:51.472Z'- updated_at: '2026-03-11T20:16:51.472Z'+ created_at: '2026-03-12T09:16:30.954Z'+ updated_at: '2026-03-12T09:16:30.954Z'source_type: credit_cardsource_id: card_UkLWZg9DAJsource:@@ -6474,11 +6490,11 @@ paths:payment_method_id: pm_UkLWZg9DAJstate: checkoutresponse_code:- number: PL969YAG+ number: PGJ3BUP1amount: '110.0'display_amount: "$110.00"- created_at: '2026-03-11T20:16:52.105Z'- updated_at: '2026-03-11T20:16:52.105Z'+ created_at: '2026-03-12T09:16:31.592Z'+ updated_at: '2026-03-12T09:16:31.592Z'source_type:source_id:source:@@ -6635,17 +6651,20 @@ paths:example:data:- id: prod_UkLWZg9DAJ- name: Product 648748+ name: Product 646269description: |-- Odio a officia sit perferendis vel quod doloremque. Dolore libero consectetur veniam aperiam odit consequatur eius. Aliquid praesentium illum facilis deleniti perspiciatis alias.- Beatae recusandae in odio impedit amet perferendis. Consequuntur repudiandae quis debitis quos aliquid necessitatibus totam. Ipsam commodi reprehenderit aperiam voluptatibus debitis odit dolorum itaque. Labore repellat perferendis ullam repudiandae.- slug: product-648748+ Voluptatem nihil hic id provident incidunt nemo. Odio nisi consequatur corrupti alias error accusantium. Debitis et voluptatem corporis sed. Mollitia dignissimos error ducimus deleniti. Quibusdam nisi modi error unde iste.+ Blanditiis nihil quam at sapiente odit impedit. Necessitatibus dolorum quasi quis nobis. Illo similique asperiores modi dicta aspernatur eum. Occaecati facilis quas consequatur nisi optio.+ Rem voluptatem soluta eum explicabo eligendi. Aspernatur eligendi nihil incidunt et dicta ea ipsa ducimus. Et quas officia dolorum nostrum occaecati. Adipisci molestiae aliquam laborum quae quod fugiat. Labore totam unde asperiores beatae commodi nulla dolores atque.+ Numquam earum vero magni ea amet. Ipsum sed autem doloribus provident. Cupiditate eos unde nisi impedit ad facilis iure fugiat. Officiis sunt et consequatur quo similique. A possimus nulla fuga excepturi voluptate.+ Consequatur necessitatibus ipsa esse repellendus at impedit. Sapiente officiis incidunt nobis laudantium placeat. Fugit animi cum culpa tempore occaecati voluptatibus fuga. Odit nulla saepe aperiam quod. Pariatur vitae consectetur exercitationem quod provident dolorem aspernatur occaecati.+ slug: product-646269meta_description:meta_keywords:variant_count: 1- available_on: '2025-03-11T20:16:52.791Z'- created_at: '2026-03-11T20:16:52.814Z'- updated_at: '2026-03-11T20:16:52.868Z'+ available_on: '2025-03-12T09:16:32.253Z'+ created_at: '2026-03-12T09:16:32.266Z'+ updated_at: '2026-03-12T09:16:32.302Z'purchasable: truein_stock: falsebackorderable: true@@ -6665,18 +6684,17 @@ paths:price_list_id:original_price:- id: prod_gbHJdmfrXB- name: Product 654485+ name: Product 658929description: |-- Occaecati deserunt voluptates quis quam optio quidem libero. Nobis cum nulla incidunt vitae optio. Ullam cumque molestiae hic sit nulla vel ratione. Voluptatem voluptas harum nihil quae expedita vel. Veritatis reprehenderit cupiditate tempora eos consectetur placeat iusto adipisci.- Quis necessitatibus et debitis explicabo nesciunt. Possimus earum neque nisi tempore. Dicta sint illo numquam culpa a.- Quia eligendi autem corporis vero tempora corrupti ducimus. Sit non necessitatibus delectus ullam doloribus. Explicabo laudantium voluptatibus doloribus atque corrupti odio.- slug: product-654485+ Non dolore est sint quasi placeat excepturi modi temporibus. Incidunt cum atque eveniet expedita reprehenderit amet voluptates. Iusto exercitationem odit ipsam magnam aliquid reiciendis necessitatibus.+ Repudiandae vitae aperiam ad ex. Neque minima commodi inventore magni earum. Incidunt mollitia ipsum possimus harum rem ipsa excepturi odit.+ slug: product-658929meta_description:meta_keywords:variant_count: 0- available_on: '2025-03-11T20:16:52.874Z'- created_at: '2026-03-11T20:16:52.884Z'- updated_at: '2026-03-11T20:16:52.898Z'+ available_on: '2025-03-12T09:16:32.307Z'+ created_at: '2026-03-12T09:16:32.316Z'+ updated_at: '2026-03-12T09:16:32.327Z'purchasable: truein_stock: falsebackorderable: true@@ -6782,18 +6800,18 @@ paths:application/json:example:id: prod_UkLWZg9DAJ- name: Product 767469+ name: Product 767950description: |-- Eum dolore accusantium temporibus ab nemo nulla itaque architecto. Quibusdam deserunt iste beatae magni nesciunt inventore porro. Aspernatur quos eius minus incidunt ratione cupiditate harum. Praesentium eum porro quasi sed placeat.- Facere voluptatum illo aspernatur dolore eligendi eveniet quae veniam. Veritatis voluptas officiis eligendi totam illum. Qui dolore deleniti voluptatum quidem.- Esse itaque magnam eligendi alias architecto a. Est dolorum dolorem magnam hic quo aperiam modi. Nesciunt suscipit vitae occaecati vel corporis.- slug: product-767469+ Cupiditate illum architecto possimus blanditiis. Placeat nam autem beatae veritatis nisi officia culpa nesciunt. Veniam ut neque beatae alias. Est eaque sed quae ducimus. Itaque officiis quos ab consequuntur.+ Pariatur dolores ducimus eaque minus. Incidunt nulla nostrum possimus libero assumenda suscipit pariatur. Eaque illo eos delectus voluptas minima aliquid explicabo.+ Iure sequi nam quidem quas ad reiciendis nisi. Blanditiis porro tempore atque dolorem architecto. Suscipit repellat quo unde enim omnis dolorem. Possimus velit provident occaecati repellat omnis.+ slug: product-767950meta_description:meta_keywords:variant_count: 1- available_on: '2025-03-11T20:16:53.494Z'- created_at: '2026-03-11T20:16:53.508Z'- updated_at: '2026-03-11T20:16:53.549Z'+ available_on: '2025-03-12T09:16:32.871Z'+ created_at: '2026-03-12T09:16:32.888Z'+ updated_at: '2026-03-12T09:16:32.927Z'purchasable: truein_stock: falsebackorderable: true@@ -7005,15 +7023,15 @@ paths:example:data:- id: ship_UkLWZg9DAJ- number: H39889652757+ number: H22884700230state: pendingtracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"shipped_at:- created_at: '2026-03-11T20:16:55.577Z'- updated_at: '2026-03-11T20:16:55.591Z'+ created_at: '2026-03-12T09:16:34.891Z'+ updated_at: '2026-03-12T09:16:34.904Z'shipping_method:id: shpm_UkLWZg9DAJname: UPS Ground@@ -7021,7 +7039,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_269- name: Leonida Christiansen+ name: Elsa Hermanaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -7097,20 +7115,13 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R486934809- state: delivery- checkout_steps:- - address- - delivery- - payment- - complete- token: cFrQenShmVNV7uTV2ETsHJQGn1PWq1wbvt6- email: [email protected]+ number: R411812718+ token: 7UBRx54Po8joHP633fg8vbCLstacktmyuhu+ email: [email protected]special_instructions:currency: USDlocale: enitem_count: 1- state_lock_version: 1item_total: '10.0'display_item_total: "$10.00"ship_total: '100.0'@@ -7127,16 +7138,23 @@ paths:display_additional_tax_total: "$0.00"total: '110.0'display_total: "$110.00"- created_at: '2026-03-11T20:16:56.155Z'- updated_at: '2026-03-11T20:16:56.243Z'+ created_at: '2026-03-12T09:16:35.468Z'+ updated_at: '2026-03-12T09:16:35.549Z'+ current_step: delivery+ completed_steps:+ - address+ requirements:+ - step: payment+ field: payment+ message: Add a payment methodorder_promotions: []line_items:- id: li_UkLWZg9DAJvariant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 105702- slug: product-105702+ name: Product 1053693+ slug: product-1053693options_text: ''price: '10.0'display_price: "$10.00"@@ -7155,23 +7173,23 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-11T20:16:56.197Z'- updated_at: '2026-03-11T20:16:56.197Z'+ created_at: '2026-03-12T09:16:35.507Z'+ updated_at: '2026-03-12T09:16:35.507Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []shipments:- id: ship_UkLWZg9DAJ- number: H42723789632+ number: H48004239465state: pendingtracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"shipped_at:- created_at: '2026-03-11T20:16:56.204Z'- updated_at: '2026-03-11T20:16:56.242Z'+ created_at: '2026-03-12T09:16:35.513Z'+ updated_at: '2026-03-12T09:16:35.548Z'shipping_method:id: shpm_UkLWZg9DAJname: UPS Ground@@ -7179,7 +7197,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_273- name: Lizeth Bashirian+ name: Elodia Thieladdress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -7310,20 +7328,13 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R769411673- state: cart- checkout_steps:- - address- - delivery- - payment- - complete- token: 6kgCjWuw9VxQ4SuvK3KaBi3L5fF5sxoAiud- email: [email protected]+ number: R017505750+ token: J1tqA7U9v1UkX3cjTBoLryPYsDRWkBA5u1X+ email: [email protected]special_instructions:currency: USDlocale: enitem_count: 1- state_lock_version: 1item_total: '10.0'display_item_total: "$10.00"ship_total: '100.0'@@ -7340,16 +7351,22 @@ paths:display_additional_tax_total: "$0.00"total: '110.0'display_total: "$110.00"- created_at: '2026-03-11T20:16:57.400Z'- updated_at: '2026-03-11T20:16:57.447Z'+ created_at: '2026-03-12T09:16:36.713Z'+ updated_at: '2026-03-12T09:16:36.788Z'+ current_step: address+ completed_steps: []+ requirements:+ - step: payment+ field: payment+ message: Add a payment methodorder_promotions: []line_items:- id: li_UkLWZg9DAJvariant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 1072748- slug: product-1072748+ name: Product 1071314+ slug: product-1071314options_text: ''price: '10.0'display_price: "$10.00"@@ -7368,23 +7385,23 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-11T20:16:57.427Z'- updated_at: '2026-03-11T20:16:57.427Z'+ created_at: '2026-03-12T09:16:36.749Z'+ updated_at: '2026-03-12T09:16:36.749Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []shipments:- id: ship_UkLWZg9DAJ- number: H32477969001+ number: H04422519647state: pendingtracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"shipped_at:- created_at: '2026-03-11T20:16:57.432Z'- updated_at: '2026-03-11T20:16:57.444Z'+ created_at: '2026-03-12T09:16:36.759Z'+ updated_at: '2026-03-12T09:16:36.784Z'shipping_method:id: shpm_UkLWZg9DAJname: UPS Ground@@ -7392,7 +7409,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_281- name: Mendy Koss+ name: Basilia Torphyaddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -7414,12 +7431,12 @@ paths:- id: py_UkLWZg9DAJpayment_method_id: pm_UkLWZg9DAJstate: checkout- response_code: 1-SC-20260311201657780014- number: PNEWMSZ6+ response_code: 1-SC-20260312091637134595+ number: PUHHRWX1amount: '10.0'display_amount: "$10.00"- created_at: '2026-03-11T20:16:57.785Z'- updated_at: '2026-03-11T20:16:57.785Z'+ created_at: '2026-03-12T09:16:37.140Z'+ updated_at: '2026-03-12T09:16:37.140Z'source_type: store_creditsource_id: credit_UkLWZg9DAJsource:@@ -7544,20 +7561,13 @@ paths:application/json:example:id: cart_UkLWZg9DAJ- number: R023223592- state: cart- checkout_steps:- - address- - delivery- - payment- - complete- token: G1Sdq5jhpBeq29pYqvnq3Jcd1mxJ7fseXb8- email: [email protected]+ number: R426571297+ token: vwPVWQvhLRwXGc6KB7LqAz24PmmQ7iHCpb2+ email: [email protected]special_instructions:currency: USDlocale: enitem_count: 1- state_lock_version: 1item_total: '10.0'display_item_total: "$10.00"ship_total: '100.0'@@ -7574,16 +7584,22 @@ paths:display_additional_tax_total: "$0.00"total: '110.0'display_total: "$110.00"- created_at: '2026-03-11T20:16:59.026Z'- updated_at: '2026-03-11T20:16:59.073Z'+ created_at: '2026-03-12T09:16:38.311Z'+ updated_at: '2026-03-12T09:16:38.358Z'+ current_step: address+ completed_steps: []+ requirements:+ - step: payment+ field: payment+ message: Add a payment methodorder_promotions: []line_items:- id: li_UkLWZg9DAJvariant_id: variant_UkLWZg9DAJquantity: 1currency: USD- name: Product 1096204- slug: product-1096204+ name: Product 1092715+ slug: product-1092715options_text: ''price: '10.0'display_price: "$10.00"@@ -7602,23 +7618,23 @@ paths:discounted_amount: '10.0'display_discounted_amount: "$10.00"display_compare_at_amount: "$0.00"- created_at: '2026-03-11T20:16:59.053Z'- updated_at: '2026-03-11T20:16:59.053Z'+ created_at: '2026-03-12T09:16:38.338Z'+ updated_at: '2026-03-12T09:16:38.338Z'compare_at_amount:thumbnail_url:option_values: []digital_links: []shipments:- id: ship_UkLWZg9DAJ- number: H82284414826+ number: H94897631388state: pendingtracking: U10000tracking_url:cost: '100.0'display_cost: "$100.00"shipped_at:- created_at: '2026-03-11T20:16:59.058Z'- updated_at: '2026-03-11T20:16:59.071Z'+ created_at: '2026-03-12T09:16:38.343Z'+ updated_at: '2026-03-12T09:16:38.356Z'shipping_method:id: shpm_UkLWZg9DAJname: UPS Ground@@ -7626,7 +7642,7 @@ paths:stock_location:id: sloc_UkLWZg9DAJstate_abbr: STATE_ABBR_289- name: Marcelene Smitham+ name: Yessenia Hettingeraddress1: 1600 Pennsylvania Ave NWcity: Washingtonzipcode: '20500'@@ -7742,9 +7758,9 @@ paths:data:- id: wl_UkLWZg9DAJname: My Wishlist- token: 3YQ4fd4a1CvqbKLtNEPHG1ZF- created_at: '2026-03-11T20:16:59.638Z'- updated_at: '2026-03-11T20:16:59.638Z'+ token: 2iHmZ51BPyq4an6gjALiqHBn+ created_at: '2026-03-12T09:16:38.933Z'+ updated_at: '2026-03-12T09:16:38.933Z'is_default: falseis_private: truemeta:@@ -7820,9 +7836,9 @@ paths:example:id: wl_gbHJdmfrXBname: Birthday Ideas- token: 86y11tQTHf5Lahkkds4Z4mT1- created_at: '2026-03-11T20:17:00.852Z'- updated_at: '2026-03-11T20:17:00.852Z'+ token: ds89ih2cPLFaLTUjFb5Z9fVA+ created_at: '2026-03-12T09:16:40.116Z'+ updated_at: '2026-03-12T09:16:40.116Z'is_default: falseis_private: trueschema:@@ -7918,9 +7934,9 @@ paths:example:id: wl_UkLWZg9DAJname: My Wishlist- token: bKWGSxheujTMekoudUVVkktL- created_at: '2026-03-11T20:17:01.972Z'- updated_at: '2026-03-11T20:17:01.972Z'+ token: xYnFQpEEhvC7FdK4emLTP1dz+ created_at: '2026-03-12T09:16:41.264Z'+ updated_at: '2026-03-12T09:16:41.264Z'is_default: falseis_private: trueschema:@@ -7982,9 +7998,9 @@ paths:example:id: wl_UkLWZg9DAJname: Updated Name- token: tpGAt3HC5t39Mz1fxesJt9Ez- created_at: '2026-03-11T20:17:03.122Z'- updated_at: '2026-03-11T20:17:03.160Z'+ token: 3eEH9rUH9qUfbeUmck6C35dR+ created_at: '2026-03-12T09:16:42.401Z'+ updated_at: '2026-03-12T09:16:42.446Z'is_default: falseis_private: trueschema:@@ -8096,8 +8112,8 @@ paths:variant_id: variant_gbHJdmfrXBwishlist_id: wl_UkLWZg9DAJquantity: 1- created_at: '2026-03-11T20:17:04.425Z'- updated_at: '2026-03-11T20:17:04.425Z'+ created_at: '2026-03-12T09:16:43.621Z'+ updated_at: '2026-03-12T09:16:43.621Z'variant:id: variant_gbHJdmfrXBproduct_id: prod_gbHJdmfrXB@@ -8106,8 +8122,8 @@ paths:options_text: ''track_inventory: trueimage_count: 0- created_at: '2026-03-11T20:17:04.402Z'- updated_at: '2026-03-11T20:17:04.412Z'+ created_at: '2026-03-12T09:16:43.598Z'+ updated_at: '2026-03-12T09:16:43.606Z'thumbnail:purchasable: truein_stock: false@@ -8357,6 +8373,25 @@ components:required:- token- user+ CheckoutRequirement:+ type: object+ properties:+ step:+ type: string+ description: Checkout step this requirement belongs to+ example: payment+ field:+ type: string+ description: Field that needs to be satisfied+ example: payment+ message:+ type: string+ description: Human-readable requirement message+ example: Add a payment method+ required:+ - step+ - field+ - messageAddress:type: objectproperties:@@ -8468,12 +8503,6 @@ components:type: stringnumber:type: string- state:- type: string- checkout_steps:- type: array- items:- type: stringtoken:type: stringemail:@@ -8489,8 +8518,6 @@ components:nullable: trueitem_count:type: number- state_lock_version:- type: numberitem_total:type: stringdisplay_item_total:@@ -8527,6 +8554,16 @@ components:type: stringupdated_at:type: string+ current_step:+ type: string+ completed_steps:+ type: array+ items:+ type: string+ requirements:+ type: array+ items:+ "$ref": "#/components/schemas/CheckoutRequirement"order_promotions:type: arrayitems:@@ -8558,15 +8595,12 @@ components:required:- id- number- - state- - checkout_steps- token- special_instructions- currency- locale- item_count- - state_lock_version- item_total- display_item_total- ship_total@@ -8585,6 +8619,9 @@ components:- display_total- created_at- updated_at+ - current_step+ - completed_steps+ - requirements- order_promotions- line_items- shipmentsdiff --git a/packages/next/CHANGELOG.md b/packages/next/CHANGELOG.mdindex 943cec57fb..82d8d4a411 100644--- a/packages/next/CHANGELOG.md+++ b/packages/next/CHANGELOG.md@@ -1,5 +1,16 @@# @spree/next+## 0.9.0++### Minor Changes++- **Breaking:** Cart responses no longer include `state`, `checkout_steps`, or `state_lock_version`. Use `current_step`, `completed_steps`, and `requirements` instead.++### Patch Changes++- Updated dependencies:+ - @spree/[email protected]+## 0.8.2### Patch Changesdiff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.mdindex 030ef0f7c6..050d79ae2e 100644--- a/packages/sdk/CHANGELOG.md+++ b/packages/sdk/CHANGELOG.md@@ -1,5 +1,18 @@# @spree/sdk+## 0.9.0++### Minor Changes++- **Breaking:** Cart API no longer returns `state`, `checkout_steps`, or `state_lock_version`. These are replaced by:+ - `current_step` — the current checkout step (e.g. `"address"`, `"delivery"`, `"payment"`)+ - `completed_steps` — array of steps already completed+ - `requirements` — array of `{ step, field, message }` objects describing what's still needed to complete checkout++- Added `CheckoutRequirement` type for the new `requirements` field on `Cart`.++- Zod generator now supports inline object types (`Array<{...}>`) and correctly handles nested braces in TypeScript type definitions.+## 0.8.2### Patch Changesdiff --git a/packages/sdk/scripts/generate-zod.ts b/packages/sdk/scripts/generate-zod.tsindex d07ef08ec3..7a4521b4c5 100644--- a/packages/sdk/scripts/generate-zod.ts+++ b/packages/sdk/scripts/generate-zod.ts@@ -20,10 +20,18 @@ function parseTypeFile(content: string): ParsedType | null {if (!typeNameMatch) return null;const typeName = typeNameMatch[1];- const bodyMatch = content.match(/type\s+\w+\s*=\s*\{([\s\S]*?)\}/);- if (!bodyMatch) return null;-- const body = bodyMatch[1];+ // Find the body between braces, handling nested braces (e.g., inline object types)+ const typeStart = content.indexOf('{', content.search(/^type\s+\w+\s*=\s*\{/m));+ if (typeStart === -1) return null;+ let depth = 1;+ let i = typeStart + 1;+ while (i < content.length && depth > 0) {+ if (content[i] === '{') depth++;+ else if (content[i] === '}') depth--;+ i++;+ }+ if (depth !== 0) return null;+ const body = content.slice(typeStart + 1, i - 1);const fields: FieldDef[] = [];const fieldRegex = /^\s+(\w+)(\?)?\s*:\s*(.+?)\s*;?\s*$/gm;let match: RegExpExecArray | null;@@ -58,6 +66,22 @@ function primitiveOrRef(inner: string, referencedTypes: Set<string>, cyclicTypesreturn 'z.any()';}+/** Parse an inline object type like {step: string, field: string} into a z.object() expression */+function inlineObjectToZod(inner: string, referencedTypes: Set<string>, cyclicTypes: Set<string>): string | null {+ const trimmed = inner.trim();+ if (!trimmed.startsWith('{') || !trimmed.endsWith('}')) return null;+ const body = trimmed.slice(1, -1);+ const fields = body.split(',').map(f => f.trim()).filter(Boolean);+ const zodFields: string[] = [];+ for (const field of fields) {+ const match = field.match(/^(\w+)\s*:\s*(.+)$/);+ if (!match) return null;+ const [, name, type] = match;+ zodFields.push(`${name}: ${typeToZod(type.trim(), referencedTypes, cyclicTypes)}`);+ }+ return `z.object({ ${zodFields.join(', ')} })`;+}+function typeToZod(typeStr: string, referencedTypes: Set<string>, cyclicTypes: Set<string>): string {const t = typeStr.trim();@@ -73,13 +97,19 @@ function typeToZod(typeStr: string, referencedTypes: Set<string>, cyclicTypes: S// Array<T> | nullconst arrayNullableMatch = t.match(/^Array<(.+)>\s*\|\s*null$/);if (arrayNullableMatch) {- return `z.array(${primitiveOrRef(arrayNullableMatch[1].trim(), referencedTypes, cyclicTypes)}).nullable()`;+ const inner = arrayNullableMatch[1].trim();+ const inlineObj = inlineObjectToZod(inner, referencedTypes, cyclicTypes);+ if (inlineObj) return `z.array(${inlineObj}).nullable()`;+ return `z.array(${primitiveOrRef(inner, referencedTypes, cyclicTypes)}).nullable()`;}// Array<T>const arrayMatch = t.match(/^Array<(.+)>$/);if (arrayMatch) {- return `z.array(${primitiveOrRef(arrayMatch[1].trim(), referencedTypes, cyclicTypes)})`;+ const inner = arrayMatch[1].trim();+ const inlineObj = inlineObjectToZod(inner, referencedTypes, cyclicTypes);+ if (inlineObj) return `z.array(${inlineObj})`;+ return `z.array(${primitiveOrRef(inner, referencedTypes, cyclicTypes)})`;}// String literal unions: 'a' | 'b' | 'c'diff --git a/packages/sdk/src/types/generated/Cart.ts b/packages/sdk/src/types/generated/Cart.tsindex a2dc50d125..a42fe7f8ce 100644--- a/packages/sdk/src/types/generated/Cart.ts+++ b/packages/sdk/src/types/generated/Cart.ts@@ -1,4 +1,4 @@-// Typelizer digest 636fc64e20299ec2f2808ce74a3346d8+// Typelizer digest 2f4e6497b509653a633fccb660cfbd77//// DO NOT MODIFY: This file was automatically generated by Typelizer.import type {OrderPromotion, LineItem, Shipment, Payment, Address, PaymentMethod} from '@/types'@@ -6,15 +6,12 @@ import type {OrderPromotion, LineItem, Shipment, Payment, Address, PaymentMethodtype Cart = {id: string;number: string;- state: string;- checkout_steps: Array<string>;token: string;email: string | null;special_instructions: string | null;currency: string;locale: string | null;item_count: number;- state_lock_version: number;item_total: string;display_item_total: string;ship_total: string;@@ -33,6 +30,9 @@ type Cart = {display_total: string;created_at: string;updated_at: string;+ current_step: string;+ completed_steps: Array<string>;+ requirements: Array<{step: string, field: string, message: string}>;order_promotions: Array<OrderPromotion>;line_items: Array<LineItem>;shipments: Array<Shipment>;diff --git a/packages/sdk/src/types/index.ts b/packages/sdk/src/types/index.tsindex 3c71c314b8..2a7084734d 100644--- a/packages/sdk/src/types/index.ts+++ b/packages/sdk/src/types/index.ts@@ -107,6 +107,16 @@ export type { Variant as StoreVariant } from './generated';export type { WishedItem as StoreWishedItem } from './generated';export type { Wishlist as StoreWishlist } from './generated';+// Checkout requirement — a single unsatisfied checkout prerequisite+export interface CheckoutRequirement {+ /** Checkout step this requirement belongs to (e.g. "address", "payment") */+ step: string;+ /** Field that needs to be satisfied (e.g. "email", "ship_address") */+ field: string;+ /** Human-readable message describing what's needed */+ message: string;+}+// Hand-written domain typesexport type {LocaleDefaults,diff --git a/packages/sdk/src/zod/generated/Cart.ts b/packages/sdk/src/zod/generated/Cart.tsindex f5ae3f041b..a46d143720 100644--- a/packages/sdk/src/zod/generated/Cart.ts+++ b/packages/sdk/src/zod/generated/Cart.ts@@ -10,15 +10,12 @@ import { ShipmentSchema } from './Shipment';export const CartSchema = z.object({id: z.string(),number: z.string(),- state: z.string(),- checkout_steps: z.array(z.string()),token: z.string(),email: z.string().nullable(),special_instructions: z.string().nullable(),currency: z.string(),locale: z.string().nullable(),item_count: z.number(),- state_lock_version: z.number(),item_total: z.string(),display_item_total: z.string(),ship_total: z.string(),@@ -37,6 +34,9 @@ export const CartSchema = z.object({display_total: z.string(),created_at: z.string(),updated_at: z.string(),+ current_step: z.string(),+ completed_steps: z.array(z.string()),+ requirements: z.array(z.object({ step: z.string(), field: z.string(), message: z.string() })),order_promotions: z.array(OrderPromotionSchema),line_items: z.array(LineItemSchema),shipments: z.array(ShipmentSchema),diff --git a/spree/api/app/serializers/spree/api/v3/cart_serializer.rb b/spree/api/app/serializers/spree/api/v3/cart_serializer.rbindex 7239101f41..ee75aecb8d 100644--- a/spree/api/app/serializers/spree/api/v3/cart_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/cart_serializer.rb@@ -4,9 +4,9 @@ module Spree# Store API Cart Serializer# Pre-purchase cart data with checkout progression infoclass CartSerializer < BaseSerializer- typelize number: :string, state: :string, checkout_steps: 'string[]', token: :string, email: [:string, nullable: true],+ typelize number: :string, current_step: :string, completed_steps: 'string[]', token: :string, email: [:string, nullable: true],special_instructions: [:string, nullable: true], currency: :string, locale: [:string, nullable: true], item_count: :number,- state_lock_version: :number,+ requirements: 'Array<{step: string, field: string, message: string}>',item_total: :string, display_item_total: :string,ship_total: :string, display_ship_total: :string,adjustment_total: :string, display_adjustment_total: :string,@@ -22,14 +22,26 @@ module Spree"cart_#{Spree::PrefixedId::SQIDS.encode([order.id])}"end- attributes :number, :state, :checkout_steps, :token, :email, :special_instructions,- :currency, :locale, :item_count, :state_lock_version,+ attributes :number, :token, :email, :special_instructions,+ :currency, :locale, :item_count,:item_total, :display_item_total, :ship_total, :display_ship_total,:adjustment_total, :display_adjustment_total, :promo_total, :display_promo_total,:tax_total, :display_tax_total, :included_tax_total, :display_included_tax_total,:additional_tax_total, :display_additional_tax_total, :total, :display_total,created_at: :iso8601, updated_at: :iso8601+ attribute :current_step do |order|+ order.current_checkout_step+ end++ attribute :completed_steps do |order|+ order.completed_checkout_steps+ end++ attribute :requirements do |order|+ Spree::Checkout::Requirements.new(order).call+ end+many :order_promotions, resource: Spree.api.order_promotion_serializermany :line_items, resource: Spree.api.line_item_serializermany :shipments, resource: Spree.api.shipment_serializerdiff --git a/spree/api/lib/spree/api/openapi/schema_helper.rb b/spree/api/lib/spree/api/openapi/schema_helper.rbindex 3666e8b019..c6fee36554 100644--- a/spree/api/lib/spree/api/openapi/schema_helper.rb+++ b/spree/api/lib/spree/api/openapi/schema_helper.rb@@ -84,6 +84,15 @@ module Spreeuser: { '$ref' => '#/components/schemas/Customer' }},required: %w[token user]+ },+ CheckoutRequirement: {+ type: :object,+ properties: {+ step: { type: :string, description: 'Checkout step this requirement belongs to', example: 'payment' },+ field: { type: :string, description: 'Field that needs to be satisfied', example: 'payment' },+ message: { type: :string, description: 'Human-readable requirement message', example: 'Add a payment method' }+ },+ required: %w[step field message]}}end@@ -110,10 +119,29 @@ module Sprees[:'x-typelizer'] = truestrip_null_from_enums(s)end+ patch_cart_schema(schemas)schemasendend+ # Typelizer cannot represent Array<{...}> inline object types in OpenAPI,+ # so we patch them to reference manually-defined component schemas.+ def patch_cart_schema(schemas)+ cart = schemas['Cart'] || schemas[:Cart]+ return unless cart++ props = cart[:properties]+ return unless props++ req_key = props.key?('requirements') ? 'requirements' : :requirements+ if props[req_key]+ props[req_key] = {+ type: :array,+ items: { '$ref' => '#/components/schemas/CheckoutRequirement' }+ }+ end+ end+# Typelizer adds nil to enum arrays for nullable fields.# OpenAPI 3.0 handles nullability via `nullable: true`, so the nil entry is redundant# and causes issues with code generators.diff --git a/spree/api/spec/controllers/spree/api/v3/store/cart_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/store/cart_controller_spec.rbindex d43322f03e..3b3706e7cd 100644--- a/spree/api/spec/controllers/spree/api/v3/store/cart_controller_spec.rb+++ b/spree/api/spec/controllers/spree/api/v3/store/cart_controller_spec.rb@@ -17,7 +17,7 @@ RSpec.describe Spree::Api::V3::Store::CartController, type: :controller doexpect(response).to have_http_status(:created)expect(json_response['number']).to be_present- expect(json_response['state']).to eq('cart')+ expect(json_response['current_step']).to eq('address')endit 'returns token for guest access' do@@ -151,7 +151,7 @@ RSpec.describe Spree::Api::V3::Store::CartController, type: :controller doexpect(response).to have_http_status(:ok)expect(json_response['number']).to eq(cart.number)- expect(json_response['state']).to eq('cart')+ expect(json_response['current_step']).to eq('address')endit 'returns cart with line items' do@@ -274,7 +274,9 @@ RSpec.describe Spree::Api::V3::Store::CartController, type: :controller doexpect(json_response).to include('id','number',- 'state',+ 'current_step',+ 'completed_steps',+ 'requirements','token','currency','item_count',@@ -283,6 +285,9 @@ RSpec.describe Spree::Api::V3::Store::CartController, type: :controller do'total','display_total')+ expect(json_response).not_to have_key('state')+ expect(json_response).not_to have_key('checkout_steps')+ expect(json_response).not_to have_key('state_lock_version')endit 'returns line item attributes' dodiff --git a/spree/api/spec/integration/spree/api/v3/store/cart_spec.rb b/spree/api/spec/integration/spree/api/v3/store/cart_spec.rbindex 88d4976605..0e6c9787b1 100644--- a/spree/api/spec/integration/spree/api/v3/store/cart_spec.rb+++ b/spree/api/spec/integration/spree/api/v3/store/cart_spec.rb@@ -62,7 +62,9 @@ RSpec.describe 'Cart API', type: :request, swagger_doc: 'api-reference/store.yamdata = JSON.parse(response.body)expect(data['id']).to start_with('cart_')expect(data['number']).to be_present- expect(data['state']).to eq('cart')+ expect(data['current_step']).to eq('address')+ expect(data['completed_steps']).to eq([])+ expect(data['requirements']).to be_an(Array)expect(data['token']).to be_presentendenddiff --git a/spree/core/app/models/spree/checkout/default_requirements.rb b/spree/core/app/models/spree/checkout/default_requirements.rbnew file mode 100644index 0000000000..f895f76312--- /dev/null+++ b/spree/core/app/models/spree/checkout/default_requirements.rb@@ -0,0 +1,51 @@+module Spree+ module Checkout+ # Built-in checkout requirements that map to the standard Spree checkout flow.+ #+ # Checks line items, email, shipping address, shipping method, and payment.+ # In Spree 6 these same checks will read from the +Cart+ model instead of+ # the state machine — the API contract stays identical.+ #+ # @see Requirements+ class DefaultRequirements+ # @param order [Spree::Order]+ def initialize(order)+ @order = order+ end++ # @return [Array<Hash{Symbol => String}>] unmet default requirements as+ # +{ step:, field:, message: }+ hashes+ def call+ [].tap do |r|+ r << req('cart', 'line_items', Spree.t('checkout_requirements.line_items_required')) unless @order.line_items.any?+ r << req('address', 'email', Spree.t('checkout_requirements.email_required')) unless @order.email.present?+ r << req('address', 'ship_address', Spree.t('checkout_requirements.ship_address_required')) if @order.requires_ship_address? && @order.ship_address.blank?+ r << req('delivery', 'shipping_method', Spree.t('checkout_requirements.shipping_method_required')) if delivery_required? && !shipping_method_selected?+ r << req('payment', 'payment', Spree.t('checkout_requirements.payment_required')) if payment_required? && !payment_satisfied?+ end+ end++ private++ def delivery_required?+ @order.has_checkout_step?('delivery') && @order.delivery_required?+ end++ def shipping_method_selected?+ @order.shipments.any? && @order.shipments.all? { |s| s.shipping_method.present? }+ end++ def payment_required?+ @order.has_checkout_step?('payment') && @order.payment_required?+ end++ def payment_satisfied?+ @order.payments.valid.any?+ end++ def req(step, field, message)+ { step: step, field: field, message: message }+ end+ end+ end+enddiff --git a/spree/core/app/models/spree/checkout/registry.rb b/spree/core/app/models/spree/checkout/registry.rbnew file mode 100644index 0000000000..28116ba220--- /dev/null+++ b/spree/core/app/models/spree/checkout/registry.rb@@ -0,0 +1,112 @@+module Spree+ module Checkout+ # Global registry for custom checkout steps and requirements.+ #+ # Provides a composable extension point so developers can add, remove, or+ # reorder checkout steps and attach extra requirements to existing steps —+ # all without subclassing or monkey-patching.+ #+ # Registered steps and requirements are evaluated by {Requirements} at+ # serialization time to produce the +requirements+ array on the Cart API.+ #+ # @example Add a custom step+ # Spree::Checkout::Registry.register_step(+ # name: :loyalty,+ # before: :payment,+ # satisfied: ->(order) { order.loyalty_verified? },+ # requirements: ->(order) { [{ step: 'loyalty', field: 'loyalty_number', message: 'Required' }] }+ # )+ #+ # @example Add a requirement to an existing step+ # Spree::Checkout::Registry.add_requirement(+ # step: :payment,+ # field: :po_number,+ # message: 'PO number is required',+ # satisfied: ->(order) { order.po_number.present? }+ # )+ #+ # @example Remove a step+ # Spree::Checkout::Registry.remove_step(:loyalty)+ class Registry+ class << self+ # Register a new custom checkout step.+ #+ # @param name [String, Symbol] unique step identifier+ # @param satisfied [Proc] lambda accepting an order, returns true when step is complete+ # @param requirements [Proc] lambda accepting an order, returns Array of requirement hashes+ # @param options [Hash] additional options forwarded to {Step} (+:before+, +:after+, +:applicable+)+ # @return [Array<Step>] the updated steps list+ def register_step(name:, satisfied:, requirements:, **options)+ steps << Step.new(name: name, satisfied: satisfied, requirements: requirements, **options)+ end++ # Add an extra requirement to an existing checkout step.+ #+ # @param step [String, Symbol] checkout step this requirement belongs to+ # @param field [String, Symbol] field identifier+ # @param message [String] human-readable validation message+ # @param satisfied [Proc] lambda accepting an order, returns true when met+ # @param options [Hash] additional options forwarded to {Requirement} (+:applicable+)+ # @return [Array<Requirement>] the updated requirements list+ def add_requirement(step:, field:, message:, satisfied:, **options)+ requirements << Requirement.new(step: step, field: field, message: message, satisfied: satisfied, **options)+ end++ # Remove a previously registered step by name.+ #+ # @param name [String, Symbol] step name to remove+ # @return [Array<Step>] the updated steps list+ def remove_step(name)+ steps.reject! { |s| s.name == name.to_s }+ end++ # Remove a previously registered requirement by step and field.+ #+ # @param step [String, Symbol] checkout step the requirement belongs to+ # @param field [String, Symbol] field identifier+ # @return [Array<Requirement>] the updated requirements list+ def remove_requirement(step:, field:)+ requirements.reject! { |r| r.step == step.to_s && r.field == field.to_s }+ end++ # Returns steps sorted by +before+/+after+ constraints relative to the checkout flow.+ #+ # The sort order is derived from {Spree::Order.checkout_step_names} so it+ # stays in sync with any customizations to the checkout state machine.+ # Steps with +before:+/+after:+ anchors are ordered by the anchor's position;+ # steps without constraints are appended at the end.+ #+ # @return [Array<Step>] steps in display order+ def ordered_steps+ return steps if steps.empty?++ step_order = Spree::Order.checkout_step_names.map(&:to_s)+ positioned, unpositioned = steps.partition { |s| s.before || s.after }++ sorted = positioned.sort_by do |s|+ anchor = s.before || s.after+ idx = step_order.index(anchor)+ # before: inserts just before the anchor, after: just after+ idx ? (s.before ? idx - 0.5 : idx + 0.5) : Float::INFINITY+ end++ sorted + unpositioned+ end++ # @return [Array<Step>] all registered steps+ def steps = (@steps ||= [])++ # @return [Array<Requirement>] all registered requirements+ def requirements = (@requirements ||= [])++ # Clear all registered steps and requirements. Intended for testing.+ #+ # @return [void]+ def reset!+ @steps = []+ @requirements = []+ end+ end+ end+ end+enddiff --git a/spree/core/app/models/spree/checkout/requirement.rb b/spree/core/app/models/spree/checkout/requirement.rbnew file mode 100644index 0000000000..4e49f2b04e--- /dev/null+++ b/spree/core/app/models/spree/checkout/requirement.rb@@ -0,0 +1,49 @@+module Spree+ module Checkout+ # Value object representing a single additional requirement registered via {Registry}.+ #+ # Unlike {Step}, a Requirement attaches extra validation to an *existing* checkout step+ # rather than introducing a new step.+ #+ # @example Require a PO number for B2B orders at the payment step+ # Spree::Checkout::Registry.add_requirement(+ # step: :payment,+ # field: :po_number,+ # message: 'PO number is required for business accounts',+ # satisfied: ->(order) { order.po_number.present? },+ # applicable: ->(order) { order.account&.business? }+ # )+ class Requirement+ # @return [String] checkout step this requirement belongs to+ attr_reader :step++ # @return [String] field identifier (e.g. +"po_number"+, +"tax_id"+)+ attr_reader :field++ # @return [String] human-readable message shown when the requirement is not met+ attr_reader :message++ # @param step [String, Symbol] checkout step this requirement belongs to+ # @param field [String, Symbol] field identifier+ # @param message [String] human-readable validation message+ # @param satisfied [Proc] lambda accepting an order, returns true when met+ # @param applicable [Proc] lambda accepting an order, returns true when this requirement applies+ # (defaults to always applicable)+ def initialize(step:, field:, message:, satisfied:, applicable: ->(_) { true })+ @step = step.to_s+ @field = field.to_s+ @message = message+ @satisfied_proc = satisfied+ @applicable_proc = applicable+ end++ # @param order [Spree::Order]+ # @return [Boolean] whether the requirement has been met+ def satisfied?(order) = @satisfied_proc.call(order)++ # @param order [Spree::Order]+ # @return [Boolean] whether this requirement applies to the given order+ def applicable?(order) = @applicable_proc.call(order)+ end+ end+enddiff --git a/spree/core/app/models/spree/checkout/requirements.rb b/spree/core/app/models/spree/checkout/requirements.rbnew file mode 100644index 0000000000..07a6b0d6b0--- /dev/null+++ b/spree/core/app/models/spree/checkout/requirements.rb@@ -0,0 +1,56 @@+module Spree+ module Checkout+ # Aggregates all checkout requirements for an order.+ #+ # Combines built-in checks from {DefaultRequirements} with custom steps and+ # requirements registered in {Registry}. The resulting array of hashes is+ # exposed on the Cart API as the +requirements+ attribute.+ #+ # Each requirement hash has the shape:+ # { step: String, field: String, message: String }+ #+ # @example+ # reqs = Spree::Checkout::Requirements.new(order)+ # reqs.call # => [{ step: "address", field: "email", message: "Email address is required" }]+ # reqs.met? # => false+ class Requirements+ # @param order [Spree::Order]+ def initialize(order)+ @order = order+ end++ # @return [Array<Hash{Symbol => String}>] all unmet requirements+ def call+ default + from_registered_steps + from_additional_requirements+ end++ # @return [Boolean] true when all requirements are satisfied+ def met?+ call.empty?+ end++ private++ # @return [Array<Hash>] built-in checkout requirements+ def default+ DefaultRequirements.new(@order).call+ end++ # @return [Array<Hash>] requirements from unsatisfied registered steps+ def from_registered_steps+ Registry.ordered_steps+ .select { |s| s.applicable?(@order) }+ .reject { |s| s.satisfied?(@order) }+ .flat_map { |s| s.requirements(@order) }+ end++ # @return [Array<Hash>] requirements from unsatisfied registered requirements+ def from_additional_requirements+ Registry.requirements+ .select { |r| r.applicable?(@order) }+ .reject { |r| r.satisfied?(@order) }+ .map { |r| { step: r.step, field: r.field, message: r.message } }+ end+ end+ end+enddiff --git a/spree/core/app/models/spree/checkout/step.rb b/spree/core/app/models/spree/checkout/step.rbnew file mode 100644index 0000000000..5a48277657--- /dev/null+++ b/spree/core/app/models/spree/checkout/step.rb@@ -0,0 +1,52 @@+module Spree+ module Checkout+ # Value object representing a custom checkout step registered via {Registry}.+ #+ # @example Register a loyalty step before payment+ # Spree::Checkout::Registry.register_step(+ # name: :loyalty,+ # before: :payment,+ # satisfied: ->(order) { order.loyalty_verified? },+ # requirements: ->(order) { [{ step: 'loyalty', field: 'loyalty_number', message: 'Enter loyalty number' }] }+ # )+ class Step+ # @return [String] step name+ attr_reader :name++ # @return [String, nil] name of the checkout step this should be placed after+ attr_reader :after++ # @return [String, nil] name of the checkout step this should be placed before+ attr_reader :before++ # @param name [String, Symbol] unique step identifier+ # @param satisfied [Proc] lambda accepting an order, returns true when the step is complete+ # @param requirements [Proc] lambda accepting an order, returns Array of requirement hashes+ # (+{ step:, field:, message: }+) describing what is still needed+ # @param applicable [Proc] lambda accepting an order, returns true when this step applies+ # (defaults to always applicable)+ # @param after [String, Symbol, nil] place this step after the named checkout step+ # @param before [String, Symbol, nil] place this step before the named checkout step+ def initialize(name:, satisfied:, requirements:, applicable: ->(_) { true }, after: nil, before: nil)+ @name = name.to_s+ @after = after&.to_s+ @before = before&.to_s+ @satisfied_proc = satisfied+ @requirements_proc = requirements+ @applicable_proc = applicable+ end++ # @param order [Spree::Order]+ # @return [Boolean] whether the step's conditions have been met+ def satisfied?(order) = @satisfied_proc.call(order)++ # @param order [Spree::Order]+ # @return [Array<Hash{Symbol => String}>] outstanding requirement hashes (+{ step:, field:, message: }+)+ def requirements(order) = @requirements_proc.call(order)++ # @param order [Spree::Order]+ # @return [Boolean] whether this step applies to the given order+ def applicable?(order) = @applicable_proc.call(order)+ end+ end+enddiff --git a/spree/core/app/models/spree/order/checkout.rb b/spree/core/app/models/spree/order/checkout.rbindex 509ad634fd..60e6d3081d 100644--- a/spree/core/app/models/spree/order/checkout.rb+++ b/spree/core/app/models/spree/order/checkout.rb@@ -227,6 +227,24 @@ module Spreeself.checkout_steps.index(step).to_iend+ # Customer-facing checkout step derived from the internal state machine state.+ # Maps +'cart'+ to +'address'+ since cart is not a user-facing checkout step.+ #+ # @return [String] current checkout step name (e.g. +"address"+, +"delivery"+, +"payment"+)+ def current_checkout_step+ state == 'cart' ? 'address' : state+ end++ # Checkout steps that have already been completed, i.e. all steps before+ # {#current_checkout_step}. Does not include +'complete'+.+ #+ # @return [Array<String>] completed step names in order+ def completed_checkout_steps+ steps = checkout_steps.reject { |s| s == 'complete' }+ idx = steps.index(current_checkout_step) || 0+ steps.first(idx)+ end+def can_go_to_state?(state)return false unless has_checkout_step?(self.state) && has_checkout_step?(state)diff --git a/spree/core/config/locales/en.yml b/spree/core/config/locales/en.ymlindex f21cae57cd..5a7f9e1bbb 100644--- a/spree/core/config/locales/en.yml+++ b/spree/core/config/locales/en.yml@@ -864,6 +864,12 @@ en:charged: Chargedcheckout: Checkoutcheckout_message: Checkout message+ checkout_requirements:+ email_required: Email address is required+ line_items_required: Add at least one item to your cart+ payment_required: Add a payment method+ ship_address_required: Shipping address is required+ shipping_method_required: Select a shipping method for all shipmentschoose_a_customer: Choose a customerchoose_a_taxon_to_sort_products_for: Choose a taxon to sort products forchoose_currency: Choose Currencydiff --git a/spree/core/spec/models/spree/checkout/registry_spec.rb b/spree/core/spec/models/spree/checkout/registry_spec.rbnew file mode 100644index 0000000000..9ee73220a5--- /dev/null+++ b/spree/core/spec/models/spree/checkout/registry_spec.rb@@ -0,0 +1,108 @@+require 'spec_helper'++RSpec.describe Spree::Checkout::Registry do+ after { described_class.reset! }++ describe '.register_step' do+ it 'adds a step' do+ described_class.register_step(+ name: :custom_step,+ satisfied: ->(_order) { false },+ requirements: ->(_order) { [{ step: 'custom_step', field: 'custom_field', message: 'Required' }] }+ )++ expect(described_class.steps.size).to eq(1)+ expect(described_class.steps.first.name).to eq('custom_step')+ end+ end++ describe '.add_requirement' do+ it 'adds a requirement' do+ described_class.add_requirement(+ step: :payment,+ field: :po_number,+ message: 'PO number is required',+ satisfied: ->(_order) { false }+ )++ expect(described_class.requirements.size).to eq(1)+ expect(described_class.requirements.first.field).to eq('po_number')+ end+ end++ describe '.remove_step' do+ it 'removes a step by name' do+ described_class.register_step(+ name: :custom_step,+ satisfied: ->(_order) { false },+ requirements: ->(_order) { [] }+ )++ expect { described_class.remove_step(:custom_step) }.to change { described_class.steps.size }.from(1).to(0)+ end+ end++ describe '.remove_requirement' do+ it 'removes a requirement by step and field' do+ described_class.add_requirement(+ step: :payment,+ field: :po_number,+ message: 'PO number is required',+ satisfied: ->(_order) { false }+ )++ expect { described_class.remove_requirement(step: :payment, field: :po_number) }+ .to change { described_class.requirements.size }.from(1).to(0)+ end+ end++ describe '.ordered_steps' do+ let(:noop) { ->(_) { false } }+ let(:empty_reqs) { ->(_) { [] } }++ it 'places step with before: constraint ahead of that step' do+ described_class.register_step(name: :loyalty, satisfied: noop, requirements: empty_reqs, before: :payment)+ described_class.register_step(name: :custom, satisfied: noop, requirements: empty_reqs, before: :delivery)++ names = described_class.ordered_steps.map(&:name)+ expect(names.index('custom')).to be < names.index('loyalty')+ end++ it 'places step with after: constraint following that step' do+ described_class.register_step(name: :verification, satisfied: noop, requirements: empty_reqs, after: :address)+ described_class.register_step(name: :review, satisfied: noop, requirements: empty_reqs, after: :payment)++ names = described_class.ordered_steps.map(&:name)+ expect(names.index('verification')).to be < names.index('review')+ end++ it 'appends steps without constraints at the end' do+ described_class.register_step(name: :positioned, satisfied: noop, requirements: empty_reqs, before: :delivery)+ described_class.register_step(name: :unpositioned, satisfied: noop, requirements: empty_reqs)++ names = described_class.ordered_steps.map(&:name)+ expect(names.last).to eq('unpositioned')+ end+ end++ describe '.reset!' do+ it 'clears all steps and requirements' do+ described_class.register_step(+ name: :custom_step,+ satisfied: ->(_order) { false },+ requirements: ->(_order) { [] }+ )+ described_class.add_requirement(+ step: :payment,+ field: :po_number,+ message: 'Required',+ satisfied: ->(_order) { false }+ )++ described_class.reset!++ expect(described_class.steps).to be_empty+ expect(described_class.requirements).to be_empty+ end+ end+enddiff --git a/spree/core/spec/models/spree/checkout/requirements_spec.rb b/spree/core/spec/models/spree/checkout/requirements_spec.rbnew file mode 100644index 0000000000..5560cccb83--- /dev/null+++ b/spree/core/spec/models/spree/checkout/requirements_spec.rb@@ -0,0 +1,223 @@+require 'spec_helper'++RSpec.describe Spree::Checkout::Requirements do+ after { Spree::Checkout::Registry.reset! }++ let(:store) { create(:store) }+ let(:order) { create(:order, store: store) }++ subject { described_class.new(order).call }++ describe 'line items requirement' do+ it 'requires line_items when cart is empty' do+ expect(subject).to include(+ a_hash_including(step: 'cart', field: 'line_items')+ )+ end++ it 'does not require line_items when cart has items' do+ create(:line_item, order: order)+ order.reload++ expect(subject).not_to include(+ a_hash_including(step: 'cart', field: 'line_items')+ )+ end+ end++ describe 'email requirement' do+ it 'requires email when not set' do+ order.update_column(:email, nil)+ order.reload++ expect(subject).to include(+ a_hash_including(step: 'address', field: 'email')+ )+ end++ it 'does not require email when set' do+ order.update_column(:email, '[email protected]')+ order.reload++ expect(subject).not_to include(+ a_hash_including(step: 'address', field: 'email')+ )+ end+ end++ describe 'ship_address requirement' do+ it 'requires ship_address for physical orders without address' do+ allow(order).to receive(:requires_ship_address?).and_return(true)+ order.ship_address = nil++ expect(subject).to include(+ a_hash_including(step: 'address', field: 'ship_address')+ )+ end++ it 'does not require ship_address for digital orders' do+ allow(order).to receive(:requires_ship_address?).and_return(false)++ expect(subject).not_to include(+ a_hash_including(step: 'address', field: 'ship_address')+ )+ end+ end++ describe 'shipping_method requirement' do+ let(:order) { create(:order_with_line_items, store: store) }++ it 'requires shipping_method when delivery step exists and no shipments have methods' do+ allow(order).to receive(:has_checkout_step?).with('delivery').and_return(true)+ allow(order).to receive(:has_checkout_step?).with('payment').and_return(true)+ allow(order).to receive(:delivery_required?).and_return(true)+ order.shipments.destroy_all++ expect(subject).to include(+ a_hash_including(step: 'delivery', field: 'shipping_method')+ )+ end++ it 'does not require shipping_method when no delivery step' do+ allow(order).to receive(:has_checkout_step?).with('delivery').and_return(false)+ allow(order).to receive(:has_checkout_step?).with('payment').and_return(true)++ expect(subject).not_to include(+ a_hash_including(step: 'delivery', field: 'shipping_method')+ )+ end+ end++ describe 'payment requirement' do+ let(:order) { create(:order_with_line_items, store: store) }++ it 'requires payment when payment is required and no valid payments' do+ allow(order).to receive(:has_checkout_step?).with('delivery').and_return(true)+ allow(order).to receive(:has_checkout_step?).with('payment').and_return(true)+ allow(order).to receive(:payment_required?).and_return(true)++ expect(subject).to include(+ a_hash_including(step: 'payment', field: 'payment')+ )+ end++ it 'does not require payment for free orders' do+ allow(order).to receive(:has_checkout_step?).with('delivery').and_return(true)+ allow(order).to receive(:has_checkout_step?).with('payment').and_return(true)+ allow(order).to receive(:payment_required?).and_return(false)++ expect(subject).not_to include(+ a_hash_including(step: 'payment', field: 'payment')+ )+ end+ end++ describe 'fully ready order' do+ let(:order) { create(:order_with_line_items, store: store, state: 'payment') }++ before do+ create(:payment, amount: order.total, order: order)+ order.reload+ end++ it 'returns empty array' do+ expect(subject).to eq([])+ end+ end++ describe 'custom registered step' do+ it 'includes requirements from unsatisfied applicable steps' do+ Spree::Checkout::Registry.register_step(+ name: :custom,+ satisfied: ->(_order) { false },+ requirements: ->(_order) { [{ step: 'custom', field: 'custom_field', message: 'Custom required' }] },+ applicable: ->(_order) { true }+ )++ expect(subject).to include(+ a_hash_including(step: 'custom', field: 'custom_field', message: 'Custom required')+ )+ end++ it 'excludes requirements from satisfied steps' do+ Spree::Checkout::Registry.register_step(+ name: :custom,+ satisfied: ->(_order) { true },+ requirements: ->(_order) { [{ step: 'custom', field: 'custom_field', message: 'Custom required' }] }+ )++ expect(subject).not_to include(+ a_hash_including(step: 'custom', field: 'custom_field')+ )+ end++ it 'excludes requirements from non-applicable steps' do+ Spree::Checkout::Registry.register_step(+ name: :custom,+ satisfied: ->(_order) { false },+ requirements: ->(_order) { [{ step: 'custom', field: 'custom_field', message: 'Custom required' }] },+ applicable: ->(_order) { false }+ )++ expect(subject).not_to include(+ a_hash_including(step: 'custom', field: 'custom_field')+ )+ end+ end++ describe 'custom additional requirement' do+ it 'includes unsatisfied applicable requirements' do+ Spree::Checkout::Registry.add_requirement(+ step: :payment,+ field: :po_number,+ message: 'PO number is required for B2B',+ satisfied: ->(_order) { false },+ applicable: ->(_order) { true }+ )++ expect(subject).to include(+ a_hash_including(step: 'payment', field: 'po_number', message: 'PO number is required for B2B')+ )+ end++ it 'excludes satisfied requirements' do+ Spree::Checkout::Registry.add_requirement(+ step: :payment,+ field: :po_number,+ message: 'PO number is required for B2B',+ satisfied: ->(_order) { true }+ )++ expect(subject).not_to include(+ a_hash_including(step: 'payment', field: 'po_number')+ )+ end++ it 'excludes non-applicable requirements' do+ Spree::Checkout::Registry.add_requirement(+ step: :payment,+ field: :po_number,+ message: 'PO number is required for B2B',+ satisfied: ->(_order) { false },+ applicable: ->(_order) { false }+ )++ expect(subject).not_to include(+ a_hash_including(step: 'payment', field: 'po_number')+ )+ end+ end++ describe '#met?' do+ it 'returns false when requirements exist' do+ expect(described_class.new(order).met?).to be false+ end++ it 'returns true when all requirements are met' do+ order = create(:order_with_line_items, store: store, state: 'payment')+ create(:payment, amount: order.total, order: order)+ order.reload+ expect(described_class.new(order).met?).to be true+ end+ end+end