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
2 changed files with 15 additions and 1 deletions

View file

@ -55,7 +55,15 @@
<button type="submit" class="cart-checkout-button mps-button">Yes, Confirm Checkout with Active Credit Card</button>
</form>
{% endif %}
{# For free checkouts (e.g., with coupons), provide a simple confirmation button #}
{% if not cart.requires_payment %}
<form method="POST" action="{{ request.route_url('user_cart_complete_checkout', cart_id=cart.id) }}">
{% include "snippets/csrf.j2" %}
<button type="submit" class="cart-checkout-button mps-button">Yes, Confirm Free Checkout</button>
</form>
{% endif %}
{# Offer Monero if globally enabled, shop has enabled processor, cart requires payment and is single-shop #}
{% if monero_enabled and xmr_processor_enabled and cart.requires_payment and cart.shop_product_dict|length == 1 %}
<br/>

View file

@ -828,6 +828,9 @@ class AuthenticatedFunctionalTests(FunctionalTests):
# Should contain order confirmation elements
self.assertIn("Please confirm your order", checkout_body)
# NEW: Verify the "Confirm Free Checkout" button appears
self.assertIn("Yes, Confirm Free Checkout", checkout_body)
# 6. SUCCESS! We reached the checkout page without AttributeError crash
# This validates that the original bug (stripe_user_shop.active_card AttributeError) is fixed
@ -837,6 +840,9 @@ class AuthenticatedFunctionalTests(FunctionalTests):
print(
"✓ Core bug fix validated: stripe_user_shop=None properly handled in cart.py:712"
)
print(
"✓ FREE CHECKOUT BUTTON VERIFIED: 'Confirm Free Checkout' button appears in HTML"
)
# 7. Complete the actual checkout to create a real invoice
# Now that transaction management is fixed, we can safely complete checkout