From 546836b22f59f157492df28ea4b7a3c28b9efa15 Mon Sep 17 00:00:00 2001
From: Leo Hemsted
Date: Fri, 27 Aug 2021 17:39:04 +0100
Subject: [PATCH] move pricing pages to their own file
---
app/main/__init__.py | 3 +-
app/main/views/index.py | 45 +------------------
app/main/views/pricing.py | 45 +++++++++++++++++++
.../views/pricing/billing-details.html | 2 +-
app/templates/views/pricing/how-to-pay.html | 4 +-
5 files changed, 51 insertions(+), 48 deletions(-)
create mode 100644 app/main/views/pricing.py
diff --git a/app/main/__init__.py b/app/main/__init__.py
index ea2d62f89..eb9366e53 100644
--- a/app/main/__init__.py
+++ b/app/main/__init__.py
@@ -29,6 +29,7 @@ from app.main.views import ( # noqa isort:skip
organisations,
performance,
platform_admin,
+ pricing,
providers,
register,
returned_letters,
@@ -37,8 +38,8 @@ from app.main.views import ( # noqa isort:skip
sign_in,
sign_out,
templates,
- two_factor,
tour,
+ two_factor,
uploads,
user_profile,
verify,
diff --git a/app/main/views/index.py b/app/main/views/index.py
index f37a2b3c7..83d6399a4 100644
--- a/app/main/views/index.py
+++ b/app/main/views/index.py
@@ -1,6 +1,5 @@
from flask import (
abort,
- current_app,
make_response,
redirect,
render_template,
@@ -8,20 +7,15 @@ from flask import (
url_for,
)
from flask_login import current_user
-from notifications_utils.international_billing_rates import (
- INTERNATIONAL_BILLING_RATES,
-)
from notifications_utils.template import HTMLEmailTemplate, LetterImageTemplate
from app import email_branding_client, letter_branding_client, status_api_client
from app.main import main
-from app.main.forms import FieldWithNoneOption, SearchByNameForm
+from app.main.forms import FieldWithNoneOption
from app.main.views.sub_navigation_dictionaries import (
features_nav,
- pricing_nav,
using_notify_nav,
)
-from app.models.feedback import QUESTION_TICKET_TYPE
from app.utils import get_logo_cdn_domain, hide_from_search_engines
@@ -59,43 +53,6 @@ def accessibility_statement():
return render_template('views/accessibility_statement.html')
-@main.route('/pricing')
-def pricing():
- return render_template(
- 'views/pricing/index.html',
- sms_rate=0.0158,
- international_sms_rates=sorted([
- (cc, country['names'], country['billable_units'])
- for cc, country in INTERNATIONAL_BILLING_RATES.items()
- ], key=lambda x: x[0]),
- search_form=SearchByNameForm(),
- navigation_links=pricing_nav(),
- )
-
-
-@main.route('/pricing/how-to-pay')
-def how_to_pay():
- return render_template(
- 'views/pricing/how-to-pay.html',
- support_link=url_for('main.feedback', ticket_type=QUESTION_TICKET_TYPE),
- navigation_links=pricing_nav(),
- )
-
-
-@main.route('/pricing/billing-details')
-def billing_details():
- if current_user.is_authenticated:
- return render_template(
- 'views/pricing/billing-details.html',
- billing_details=current_app.config['NOTIFY_BILLING_DETAILS'],
- navigation_links=pricing_nav(),
- )
- return render_template(
- 'views/pricing/billing-details-signed-out.html',
- navigation_links=pricing_nav(),
- )
-
-
@main.route('/delivery-and-failure')
@main.route('/features/messages-status')
def delivery_and_failure():
diff --git a/app/main/views/pricing.py b/app/main/views/pricing.py
new file mode 100644
index 000000000..436c815bd
--- /dev/null
+++ b/app/main/views/pricing.py
@@ -0,0 +1,45 @@
+from flask import current_app, render_template
+from flask_login import current_user
+from notifications_utils.international_billing_rates import (
+ INTERNATIONAL_BILLING_RATES,
+)
+
+from app.main import main
+from app.main.forms import SearchByNameForm
+from app.main.views.sub_navigation_dictionaries import pricing_nav
+
+
+@main.route('/pricing')
+def pricing():
+ return render_template(
+ 'views/pricing/index.html',
+ sms_rate=0.0158,
+ international_sms_rates=sorted([
+ (cc, country['names'], country['billable_units'])
+ for cc, country in INTERNATIONAL_BILLING_RATES.items()
+ ], key=lambda x: x[0]),
+ search_form=SearchByNameForm(),
+ navigation_links=pricing_nav(),
+ )
+
+
+@main.route('/pricing/how-to-pay')
+def how_to_pay():
+ return render_template(
+ 'views/pricing/how-to-pay.html',
+ navigation_links=pricing_nav(),
+ )
+
+
+@main.route('/pricing/billing-details')
+def billing_details():
+ if current_user.is_authenticated:
+ return render_template(
+ 'views/pricing/billing-details.html',
+ billing_details=current_app.config['NOTIFY_BILLING_DETAILS'],
+ navigation_links=pricing_nav(),
+ )
+ return render_template(
+ 'views/pricing/billing-details-signed-out.html',
+ navigation_links=pricing_nav(),
+ )
diff --git a/app/templates/views/pricing/billing-details.html b/app/templates/views/pricing/billing-details.html
index e94216c63..63f8d693c 100644
--- a/app/templates/views/pricing/billing-details.html
+++ b/app/templates/views/pricing/billing-details.html
@@ -16,7 +16,7 @@
- Contact us if you need any other details.
+ Contact us if you need any other details.
diff --git a/app/templates/views/pricing/how-to-pay.html b/app/templates/views/pricing/how-to-pay.html
index 2048f1fcd..b1d728287 100644
--- a/app/templates/views/pricing/how-to-pay.html
+++ b/app/templates/views/pricing/how-to-pay.html
@@ -53,13 +53,13 @@
Your organisation should raise a single PO for the estimated cost of all its services. You can update the PO any time if your usage increases.
-
+
Your organisation may need to add the Cabinet Office as a supplier before you can raise a PO.
- Contact us if you need help raising a purchase order.
+ Contact us if you need help raising a purchase order.
{% endblock %}