Add checkout confirmation button for free carts with coupons #91

Merged
russellballestrini merged 1 commit from freebies into master 2025-10-15 09:14:01 -04:00
russellballestrini commented 2025-10-15 09:10:05 -04:00 (Migrated from git2.unturf.com)

When coupons reduced cart total to $0, the checkout page displayed no
button to finalize the order. This occurred because the Stripe button
only appears with active_card, and crypto buttons only appear when
cart.requires_payment is True. Users without saved payment methods
were unable to complete free orders.

Added dedicated "Confirm Free Checkout" button that displays when
cart.requires_payment is False, allowing users to finalize free orders.
Enhanced test coverage to verify button appears in checkout page HTML.

Summary by CodeRabbit

  • New Features

    • Added a dedicated confirmation step for free checkouts, displaying a “Yes, Confirm Free Checkout” button when no payment is required.
    • Provides an alternative confirmation path while leaving the paid checkout experience unchanged.
  • Tests

    • Updated functional tests to verify the presence and behavior of the free-checkout confirmation UI.
When coupons reduced cart total to $0, the checkout page displayed no button to finalize the order. This occurred because the Stripe button only appears with active_card, and crypto buttons only appear when cart.requires_payment is True. Users without saved payment methods were unable to complete free orders. Added dedicated "Confirm Free Checkout" button that displays when cart.requires_payment is False, allowing users to finalize free orders. Enhanced test coverage to verify button appears in checkout page HTML. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a dedicated confirmation step for free checkouts, displaying a “Yes, Confirm Free Checkout” button when no payment is required. * Provides an alternative confirmation path while leaving the paid checkout experience unchanged. * **Tests** * Updated functional tests to verify the presence and behavior of the free-checkout confirmation UI. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
coderabbitai commented 2025-10-15 09:10:16 -04:00 (Migrated from git2.unturf.com)

Walkthrough

Adds a conditional free-checkout confirmation form to the checkout template, displayed when cart.requires_payment is false. Updates functional tests to assert presence of the "Yes, Confirm Free Checkout" button and related HTML. Paid checkout flow remains unchanged.

Changes

Cohort / File(s) Summary
Free checkout UI update
make_post_sell/templates/cart_checkout.j2
Introduces conditional block rendering a “Yes, Confirm Free Checkout” form when cart.requires_payment is false; uses existing checkout route and CSRF; minor whitespace/comment adjustment.
Functional tests update
make_post_sell/tests/test_functional.py
Adds assertions verifying the free-checkout confirmation button appears in the HTML; includes a debug/log print for the new verification.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor User
    participant Browser
    participant Server as Checkout Controller
    participant Pay as Payment Gateway

    Note over Browser,Server: Render checkout page

    User->>Browser: Review cart
    alt cart.requires_payment == false
        User->>Browser: Click "Yes, Confirm Free Checkout"
        Browser->>Server: POST /checkout (CSRF, no payment)
        Server->>Server: Validate cart (no payment required)
        Server-->>Browser: 200 OK (Order confirmed)
        Note over Server,Browser: New free-checkout confirmation path
    else cart.requires_payment == true
        User->>Browser: Click "Yes, Confirm Purchase"
        Browser->>Server: POST /checkout (CSRF)
        Server->>Pay: Create/confirm payment
        Pay-->>Server: Payment result
        Server-->>Browser: 200/4xx (Order success/failure)
    end

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A hop, a skip, no coin to spend,
The checkout’s free—our journey’s end!
I thump approval, ears held high,
A button clicks, the orders fly.
With whiskered grin, I sign “OK,”
Free carrots shipped—hip-hop hooray! 🥕


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between c9afd3b893 and 400b4c042b.

📒 Files selected for processing (2)
  • make_post_sell/templates/cart_checkout.j2 (1 hunks)
  • make_post_sell/tests/test_functional.py (2 hunks)

📝 NOTE

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

<!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- walkthrough_start --> ## Walkthrough Adds a conditional free-checkout confirmation form to the checkout template, displayed when cart.requires_payment is false. Updates functional tests to assert presence of the "Yes, Confirm Free Checkout" button and related HTML. Paid checkout flow remains unchanged. ## Changes | Cohort / File(s) | Summary | | --- | --- | | **Free checkout UI update**<br>`make_post_sell/templates/cart_checkout.j2` | Introduces conditional block rendering a “Yes, Confirm Free Checkout” form when cart.requires_payment is false; uses existing checkout route and CSRF; minor whitespace/comment adjustment. | | **Functional tests update**<br>`make_post_sell/tests/test_functional.py` | Adds assertions verifying the free-checkout confirmation button appears in the HTML; includes a debug/log print for the new verification. | ## Sequence Diagram(s) ```mermaid sequenceDiagram autonumber actor User participant Browser participant Server as Checkout Controller participant Pay as Payment Gateway Note over Browser,Server: Render checkout page User->>Browser: Review cart alt cart.requires_payment == false User->>Browser: Click "Yes, Confirm Free Checkout" Browser->>Server: POST /checkout (CSRF, no payment) Server->>Server: Validate cart (no payment required) Server-->>Browser: 200 OK (Order confirmed) Note over Server,Browser: New free-checkout confirmation path else cart.requires_payment == true User->>Browser: Click "Yes, Confirm Purchase" Browser->>Server: POST /checkout (CSRF) Server->>Pay: Create/confirm payment Pay-->>Server: Payment result Server-->>Browser: 200/4xx (Order success/failure) end ``` ## Estimated code review effort 🎯 2 (Simple) | ⏱️ ~10 minutes ## Poem > A hop, a skip, no coin to spend, > The checkout’s free—our journey’s end! > I thump approval, ears held high, > A button clicks, the orders fly. > With whiskered grin, I sign “OK,” > Free carrots shipped—hip-hop hooray! 🥕✨ <!-- walkthrough_end --> --- <details> <summary>📜 Recent review details</summary> **Configuration used**: CodeRabbit UI **Review profile**: CHILL **Plan**: Free <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between c9afd3b893e6fdd76c897cd2f9f78316c76ae847 and 400b4c042b7ab1a80a4bb54ddd0f3e5a5282fcf8. </details> <details> <summary>📒 Files selected for processing (2)</summary> * `make_post_sell/templates/cart_checkout.j2` (1 hunks) * `make_post_sell/tests/test_functional.py` (2 hunks) </details> </details> <!-- tips_start --> --- > 📝 **NOTE** > <details> > <summary>🎁 Summarized by CodeRabbit Free</summary> > > Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting <https://app.coderabbit.ai/login>. > > </details> <sub>Comment `@coderabbitai help` to get the list of available commands and usage tips.</sub> <!-- tips_end --> <!-- internal state start --> <!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyRUDuki2VmgoBPSACMxTWpTTjx8XADo08SBAB8AKB2gIO5mgDWJAPoAHfIlynEJADb2A9DWbn71EoicNhNhrAkDEb4eEoAVgBMHFoARPFaAMSJkACCAJLEZLI09AJCopD4AGaMsJikiDpQqbS0yGiQ5HxMGLSK8PgYaPYS9vjBkATcZDIU6JCxAJpeADSQAMJdxfAUzJAAYhQkJIuBwaG4sZDF+GsnZ4x+yLjluJC0+E3499sAjtiru+ZoImwYyhgCGQp3O2DsN0C/DQbG4h12mHoCwAygAlDYoDAMezgzpYNCQ76qegBIIhPAXNbzREoZCIWD4HhYLr2MQ8QJYXwUZTvT7bRAWX7/e6oYo9OxKIG7EgADyQuHgGCIkB+8FoYFJBwpxX6fG2hkVyGwWPKSrokrgqEVuAo+Fo2AYXnQ+PsNAo3QVADddpryfdWis1tQ8SrqLBKSdtj79n6Gm10LRwuDcIT+NgKLbje0lZB2YovD9HbnFOHMAn2gquj1GCxhUodDpkmlXTk8TcnrddjJscJg11kCVILLLNy6EVxuZsOJ7PAGEOAR0vNVIAA5J6T6ezpzDs65MDsRRiRDwIge9PRipOmQ0Bi5etaACi1nghlyNZkI098BIfBIxVBnCQAAsnQ8CCHECRaBAYAGMYZiWNYtgOM4NDWN4qE2MUxq3niPRKOYIgxPEsRJCkGRZOQVBvvkhiFIOASXlUWjQF4KaQNg5i0J49DDJ6PRqp4kAAKrpGUl4RsUUZlGShwnLqFpQmgdRjgSdjcm20mDLc1BDFCAAS0BAQAMhGnaRjsml+qGtyYti2AyA0kwzIg8xLBggbrFsFkLDGhzHOIeAEBg8xkAIFCKsqZmSTsGq+RSPw2TuEK6Qi5jmLa6XwIJAarK+IYiZKqQ1hmBZdNmyoyAFRBOP0yqZQCkAzuQuYEuWY7DIq7S+DQKVND+kDeuFKzdXi96NmRLZURpwxmd2HhTf2RSlDuo70JcG4znOB4KkuUGrk8DFmu2Q4yiOb7rVOm0PEE819hgiD3k+CqvmO0i7NsX79X+AFcCB7TgcR1RgNoWh6FAoxLTgBAUTkr21uwXC8GmBRiJI76yPIigqGomig+AUBMKwiimGqAofd+PB0KY0VmNYfjqMDuj45AAAsAAMbPiCzDBsyzkTiAA7HIACMaAABxs2gLPyAArCzdS0GzxQAMwkDLaAy5EYuRMUDDFGLDMg2DNZEzYpOmOTP5UzTpgQ5oQA --> <!-- internal state end -->
coderabbitai commented 2025-10-15 09:11:07 -04:00 (Migrated from git2.unturf.com)

changed the description

changed the description
russellballestrini (Migrated from git2.unturf.com) scheduled this pull request to auto merge when all checks succeed 2025-10-15 09:13:26 -04:00
russellballestrini commented 2025-10-15 09:14:01 -04:00 (Migrated from git2.unturf.com)

mentioned in commit 30ee39bbe5

mentioned in commit 30ee39bbe50012c701d6462d02508187ec22e2e3
russellballestrini (Migrated from git2.unturf.com) merged commit 30ee39bbe5 into master 2025-10-15 09:14:01 -04:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: engineering/make_post_sell#91
No description provided.