Add new 'Billing' page for organisations

We want organisation team members to be able to see the MOU details for
their organisation. This change creates a new page called billing, which
contains these details. It's only visible to platform admin users now -
the plan is to add more information to this page, then to make it visible
to all organisation users.

The page showing the MOU covers the case of when agreement_signed is
True, when an agreement_signed is False, and when agreement_signed is
None. The case when an agreement_signed is None is very rare - it
signifies that the agreement is not signed but that we have some
service-specific agreements in place. We only have a few organisations
in this state, so it's unlikely that the content for this scenario will
be seen.

When an organisation has signed the agreement we may know the full
details (signing date, version signed, the person who signed it or who it
was signed on behalf of), or we may only have the name of the person who
signed the agreement. We show the more detailed content if possible, and
a less detailed version of the content if not.

There's a new route for downloading the agreement which is almost
identical to the existing `.service_download_agreement` route (plus the
test is almost the same), except that it takes an organisation ID
instead of a service ID.
This commit is contained in:
Katie Smith
2021-12-07 13:42:44 +00:00
parent 14e249a2d9
commit 66c50abc38
7 changed files with 227 additions and 4 deletions

View File

@@ -2,7 +2,15 @@ from collections import OrderedDict
from datetime import datetime
from functools import partial
from flask import flash, redirect, render_template, request, session, url_for
from flask import (
flash,
redirect,
render_template,
request,
send_file,
session,
url_for,
)
from flask_login import current_user
from notifications_python_client.errors import HTTPError
from werkzeug.exceptions import abort
@@ -44,6 +52,7 @@ from app.main.views.dashboard import (
from app.main.views.service_settings import get_branding_as_value_and_label
from app.models.organisation import AllOrganisations, Organisation
from app.models.user import InvitedOrgUser, User
from app.s3_client.s3_mou_client import get_mou
from app.utils.csv import Spreadsheet
from app.utils.user import user_has_permissions, user_is_platform_admin
@@ -640,3 +649,19 @@ def edit_organisation_billing_details(org_id):
'views/organisations/organisation/settings/edit-organisation-billing-details.html',
form=form,
)
@main.route("/organisations/<uuid:org_id>/billing")
@user_is_platform_admin
def organisation_billing(org_id):
return render_template(
'views/organisations/organisation/billing.html'
)
@main.route('/organisations/<uuid:org_id>/agreement.pdf')
@user_is_platform_admin
def organisation_download_agreement(org_id):
return send_file(**get_mou(
current_organisation.crown_status_or_404
))

View File

@@ -349,5 +349,8 @@ class OrgNavigation(Navigation):
},
'trial-services': {
'organisation_trial_mode_services',
},
'billing': {
'organisation_billing',
}
}

View File

@@ -5,6 +5,7 @@
{% if current_user.platform_admin %}
<li><a class="govuk-link govuk-link--no-visited-state{{ org_navigation.is_selected('settings') }}" href="{{ url_for('.organisation_settings', org_id=current_org.id) }}">Settings</a></li>
<li><a class="govuk-link govuk-link--no-visited-state{{ org_navigation.is_selected('trial-services') }}" href="{{ url_for('.organisation_trial_mode_services', org_id=current_org.id) }}">Trial mode services</a></li>
<li><a class="govuk-link govuk-link--no-visited-state{{ org_navigation.is_selected('billing') }}" href="{{ url_for('.organisation_billing', org_id=current_org.id) }}">Billing</a></li>
{% endif %}
</ul>
</nav>

View File

@@ -0,0 +1,50 @@
{% extends "org_template.html" %}
{% from "components/page-header.html" import page_header %}
{% block org_page_title %}
Billing
{% endblock %}
{% block maincolumn_content %}
{{ page_header("Billing", size="medium") }}
<div class="govuk-grid-row">
<div class="govuk-grid-column-five-sixths">
<h2 class="heading-small">
Data sharing and financial agreement
</h2>
{% if current_org.agreement_signed_at %}
<p class="govuk-body">
Your organisation accepted version {{ current_org.agreement_signed_version }} of the GOV.UK Notify data sharing
and financial agreement on {{ current_org.agreement_signed_at | format_date_normal }}.
</p>
<p class="govuk-body">
{{ current_org.agreement_signed_by.name or current_org.agreement_signed_on_behalf_of_name }} signed the agreement
on behalf of {{ current_org.name}}.
</p>
<p class="govuk-body">
<a class="govuk-link govuk-link--no-visited-state"
href="{{ url_for('.organisation_download_agreement', org_id=current_org.id) }}">Download the current version of the agreement
</a>
</p>
{% elif current_org.agreement_signed %}
<p class="govuk-body">
{{ current_org.name}} has accepted the GOV.UK Notify data sharing and financial agreement.
</p>
<p class="govuk-body">
<a class="govuk-link govuk-link--no-visited-state"
href="{{ url_for('.organisation_download_agreement', org_id=current_org.id) }}">Download the current version of the agreement
</a>
</p>
{% elif current_org.agreement_signed is false %}
<p class="govuk-body">
{{ current_org.name}} needs to accept the GOV.UK Notify data sharing and financial agreement.
</p>
{% elif current_org.agreement_signed is none %}
<p class="govuk-body">
{{ current_org.name}} has not accepted the GOV.UK Notify data sharing and financial agreement, but we have some service-specific agreements in place.
</p>
{% endif %}
</div>
</div>
{% endblock %}