Configure PayPal integration and cart checkout error display

This commit is contained in:
Zach committed 2026-12-01 04:20:38 +00:00
1 parent 62065828e1
commit cf07fc5d9b
98 files changed
+1430 -281

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
{% if product.verified_by_seller %}
<span style="display:inline-block;border:1px solid #a7f3d0;border-radius:999px;background:#064e3b;color:#ecfdf5;padding:.2rem .55rem;font-size:.8rem;font-weight:700;"><span aria-hidden="true">✓</span> Verified by Seller</span>
{% endif %}
+10
View File
@@ -0,0 +1,10 @@
<article class="store-card">
<a class="store-cover" href="{% url 'shop-product' product.slug %}">{% if product.image %}<img src="{{ product.image.url }}" alt="{{ product.title }}" loading="lazy">{% else %}<span>SLX</span>{% endif %}</a>
<h2><a href="{% url 'shop-product' product.slug %}">{{ product.title }}</a></h2>
<small>{{ product.get_kind_display }}</small>
{% include 'shop/_seller_badge.html' %}
<p class="store-stock">{% if product.kind == 'physical' %}{% if product.in_stock %}In stock{% else %}Sold out{% endif %}{% elif product.kind == 'digital' %}Digital edition{% else %}Fan Club{% endif %}</p>
<strong>${{ product.price_usd }}{% if product.kind == 'subscription' %} / {{ product.billing_interval }}{% endif %}</strong>
{% if product.kind != 'subscription' and product.in_stock %}<form method="post" action="{% url 'shop-cart-add' product.pk %}">{% csrf_token %}<input type="hidden" name="quantity" value="1"><button class="store-button">Add to cart</button></form>
{% else %}<a class="store-button" href="{% url 'shop-product' product.slug %}">View details</a>{% endif %}
</article>
+6 -37
View File
@@ -1,40 +1,9 @@
{% extends 'base.html' %}
{% extends 'base.html' %}{% load static %}
{% block scripts %}<link rel="stylesheet" href="{% static 'storefront.css' %}">{% endblock %}
{% block title %}Shop · SLUMP X LAND{% endblock %}
{% block content %}
<main class="page-shell theme-shop">
<header class="section-head" style="display:flex;justify-content:space-between;align-items:center;gap:1rem;">
<h1>Shop</h1>
<a class="btn" href="{% url 'shop-cart' %}">Cart ({{ cart_count }})</a>
</header>
{% if request.GET.subscribed %}
<p class="notice">Thank you! Your subscription is processing and will activate momentarily.</p>
{% endif %}
<div class="shop-grid">
{% for product in products %}
<article class="card shop-product">
<a href="{% url 'shop-product' product.slug %}" style="text-decoration:none;color:inherit;display:block;padding:1rem 1rem 0;">
<div class="shop-image{% if product.image %} has-shop-image{% endif %}" data-shop-image>
{% if product.image %}
<img src="{{ product.image.url }}" alt="{{ product.title }}" onerror="this.style.display='none';this.parentElement.classList.remove('has-shop-image');">
{% endif %}
<div class="shop-image-placeholder">SLX</div>
</div>
</a>
<header>
<span class="badge">{{ product.get_kind_display }}</span>
<h2 style="margin-top:.4rem;"><a href="{% url 'shop-product' product.slug %}">{{ product.title }}</a></h2>
{% if product.summary %}<p>{{ product.summary }}</p>{% endif %}
</header>
<div class="shop-option" style="display:flex;justify-content:space-between;align-items:center;gap:.75rem;">
<strong>${{ product.price_usd }}{% if product.kind == 'subscription' %} / {{ product.billing_interval }}{% endif %}</strong>
<a class="btn" href="{% url 'shop-product' product.slug %}">View Details</a>
</div>
</article>
{% empty %}
<p>No shop items are live yet. Check back soon.</p>
{% endfor %}
</div>
</main>
<main class="section slx-store"><div class="store-bar"><a href="{% url 'world-map' %}">← Sol’Terra map</a><a href="{% url 'shop-cart' %}">Cart ({{ cart_count }})</a></div>
<header class="store-banner"><h1>Slump X Land Shop</h1><p>Books, digital editions, and the Monthly Fan Club.</p></header>
{% if request.GET.subscribed %}<p>Your access will update after Stripe confirms the subscription.</p>{% endif %}
<div class="store-grid">{% for product in products %}{% include 'shop/card.html' %}{% empty %}<p>No products are available yet.</p>{% endfor %}</div></main>
{% endblock %}
+2 -1
View File
@@ -10,12 +10,13 @@
{% for item in order.items.all %}
<li>
{{ item.quantity }} &times; {{ item.title_snapshot }} (${{ item.line_total }})
{% if item.product.kind == 'digital' and order.status in 'paid,shipped,delivered' %}
{% if item.chapter %} — <a href="{% url 'chapter' item.chapter.number %}">Open chapter reader</a>{% elif item.product.digital_file and order.status in 'paid,shipped,delivered' %}
— <a href="{% url 'shop-download' order.order_id item.pk %}"><strong>Download File</strong></a>
{% endif %}
</li>
{% endfor %}
</ul>
{% if user.is_authenticated and order.user_id == user.pk %}<p><a href="{% url 'collector-preferences' %}">Choose how you appear on the collector thank-you list →</a></p>{% endif %}
<p><a href="{% url 'shop-index' %}">&larr; Return to Shop</a></p>
</main>
{% endblock %}
+24 -41
View File
@@ -1,45 +1,28 @@
{% extends 'base.html' %}
{% extends 'base.html' %}{% load static %}
{% block scripts %}<link rel="stylesheet" href="{% static 'storefront.css' %}">{% endblock %}
{% block title %}{{ product.title }} · Shop · SLUMP X LAND{% endblock %}
{% block content %}
<main class="page-shell">
<p><a href="{% url 'shop-index' %}">&larr; Back to Shop</a></p>
<article class="product-detail" style="display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:2rem;">
{% if product.image %}
<div><img src="{{ product.image.url }}" alt="{{ product.title }}" style="width:100%;border-radius:8px;"></div>
{% endif %}
<div>
<span class="badge">{{ product.get_kind_display }}</span>
<h1>{{ product.title }}</h1>
<p style="font-size:1.35rem;"><strong>${{ product.price_usd }}{% if product.kind == 'subscription' %} / {{ product.billing_interval }}{% endif %}</strong></p>
{% if product.description %}<div class="prose">{{ product.description|linebreaks }}</div>{% endif %}
{% if product.kind == 'subscription' %}
<form method="post" action="{% url 'shop-subscribe' product.slug %}" style="margin-top:1.5rem;display:grid;gap:.75rem;max-width:360px;">
{% csrf_token %}
{% if not request.user.is_authenticated or not request.user.email %}
<label>Email for membership receipts
<input type="email" name="email" required placeholder="you@example.com">
</label>
{% endif %}
{% if stripe_enabled %}
<button type="submit" name="gateway" value="stripe" class="btn">Subscribe with Card (Stripe)</button>
{% endif %}
{% if paypal_enabled and product.paypal_plan_id %}
<button type="submit" name="gateway" value="paypal" class="btn">Subscribe with PayPal</button>
{% endif %}
</form>
{% else %}
{% if product.in_stock %}
<form method="post" action="{% url 'shop-cart-add' product.pk %}" style="margin-top:1.5rem;display:flex;gap:.75rem;align-items:center;">
{% csrf_token %}
<input type="number" name="quantity" value="1" min="1" max="20" style="width:72px;">
<button type="submit" class="btn">Add to Cart</button>
</form>
{% else %}
<p><strong>Sold Out</strong></p>
{% endif %}
{% endif %}
</div>
</article>
<main class="section slx-store">
<div class="store-bar"><a href="{% url 'shop-index' %}">← Back to Shop</a><a href="{% url 'shop-cart' %}">Cart ({{ cart_count }})</a></div>
<article class="store-detail">
<div class="store-cover">{% if product.image %}<img src="{{ product.image.url }}" alt="{{ product.title }}">{% else %}<span>SLX</span>{% endif %}</div>
<div class="store-product-info"><h1>{{ product.title }}</h1><p>{{ product.get_kind_display }}</p>{% include "shop/_seller_badge.html" %}
<p>{{ product.summary }}</p><p class="store-price">${{ product.price_usd }}{% if product.kind == 'subscription' %} / {{ product.billing_interval }}{% endif %}</p>
{% if product.kind == 'subscription' %}
<p><a href="{% url 'membership' %}#compare-plans">Compare Fan Club plans →</a></p>
{% if not user.is_authenticated %}<a class="store-button" href="{% url 'fan-login' %}?next={% url 'shop-product' product.slug %}">Sign in to subscribe</a>
{% else %}<form method="post" action="{% url 'shop-subscribe' product.slug %}">{% csrf_token %}
{% if not user.email %}<label>Email for receipts <input type="email" name="email" required></label>{% endif %}
{% if stripe_enabled %}<button name="gateway" value="stripe" class="store-button">Subscribe with Stripe</button>{% endif %}
{% if not product.member_tier and paypal_enabled and product.paypal_plan_id %}<button name="gateway" value="paypal" class="store-button">Subscribe with PayPal</button>{% endif %}
</form>{% endif %}
{% elif product.in_stock %}
<form method="post" action="{% url 'shop-cart-add' product.pk %}">{% csrf_token %}<label>Quantity <input type="number" name="quantity" value="1" min="1" max="20"></label><button class="store-button">Add to cart</button></form>
{% else %}<p>Sold out</p>{% endif %}
</div>
<aside class="store-format"><h2>Format &amp; delivery</h2>{% if product.kind == 'physical' %}<p>Ships to you · {% if product.in_stock %}In stock{% else %}Sold out{% endif %}</p>{% elif product.kind == 'digital' %}<p>Digital edition</p>{% else %}<p>Recurring membership · {{ product.get_member_tier_display }}</p>{% endif %}{% if sample_chapter %}<a href="{% url 'chapter' sample_chapter.number %}">Open chapter reader →</a>{% endif %}</aside>
</article>
{% if product.description %}<section class="store-section"><h2>Overview</h2><div>{{ product.description|linebreaks }}</div></section>{% endif %}
{% if related_products %}<section class="store-section"><h2>You may also like</h2><div class="store-grid">{% for product in related_products %}{% include 'shop/card.html' %}{% endfor %}</div></section>{% endif %}
</main>
{% endblock %}