Skip to content

Commit 2cfa261

Browse files
committed
add pricing page
1 parent 111848b commit 2cfa261

3 files changed

Lines changed: 36 additions & 0 deletions

File tree

findthatpostcode/blueprints/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from findthatpostcode.controllers.areas import area_types_count
1515
from findthatpostcode.db import ElasticsearchDep
1616
from findthatpostcode.limiter import limiter
17+
from findthatpostcode.settings import STRIPE_PRICING_TABLE_ID, STRIPE_PUBLISHABLE_KEY
1718
from findthatpostcode.utils import templates
1819

1920
app = APIRouter()
@@ -50,6 +51,20 @@ def about(request: Request):
5051
)
5152

5253

54+
@app.get("/pricing")
55+
@limiter.exempt
56+
def pricing(request: Request):
57+
return templates.TemplateResponse(
58+
request=request,
59+
name="pricing.html.j2",
60+
media_type="text/html",
61+
context={
62+
"stripe_pricing_table_id": STRIPE_PRICING_TABLE_ID,
63+
"stripe_publishable_key": STRIPE_PUBLISHABLE_KEY,
64+
},
65+
)
66+
67+
5368
app.include_router(areas.bp)
5469
app.include_router(addtocsv.bp)
5570
app.include_router(areatypes.bp)

findthatpostcode/settings.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,8 @@ def get_es_url(default):
4545
AREA_INDEX = "geo_area"
4646
POSTCODE_INDEX = "geo_postcode"
4747
PLACENAME_INDEX = "geo_placename"
48+
49+
STRIPE_PRICING_TABLE_ID = os.environ.get("STRIPE_PRICING_TABLE_ID")
50+
STRIPE_PUBLISHABLE_KEY = os.environ.get("STRIPE_PUBLISHABLE_KEY")
51+
STRIPE_SECRET_KEY = os.environ.get("STRIPE_SECRET_KEY")
52+
STRIPE_SIGNING_SECRET = os.environ.get("STRIPE_SIGNING_SECRET")
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{% set title = 'Pricing' %}
2+
{% extends "base.html.j2" %}
3+
{% block content %}
4+
<section class="section entry-content" id="pricing">
5+
<div class="container">
6+
<stripe-pricing-table pricing-table-id="{{ stripe_pricing_table_id }}"
7+
publishable-key="{{ stripe_publishable_key }}">
8+
</stripe-pricing-table>
9+
</div>
10+
</section>
11+
{% endblock %}
12+
13+
{% block bodyscripts %}
14+
{{ super() }}
15+
<script async src="https://js.stripe.com/v3/pricing-table.js"></script>
16+
{% endblock %}

0 commit comments

Comments
 (0)