From 48db3a5e11d73ed8f37df17ddbd757f099b549b8 Mon Sep 17 00:00:00 2001 From: Katie Smith Date: Mon, 24 Sep 2018 14:32:52 +0100 Subject: [PATCH] Delete unused functions These deleted functions were only used for the old billing endpoints which no longer exist. --- app/billing/rest.py | 67 --------------------------------------------- 1 file changed, 67 deletions(-) diff --git a/app/billing/rest.py b/app/billing/rest.py index 418bb39d5..9a09f6611 100644 --- a/app/billing/rest.py +++ b/app/billing/rest.py @@ -1,5 +1,3 @@ -from datetime import datetime - from flask import Blueprint, jsonify, request from app.billing.billing_schemas import ( @@ -18,9 +16,7 @@ from app.dao.fact_billing_dao import fetch_monthly_billing_for_year, fetch_billi from app.errors import InvalidRequest from app.errors import register_errors -from app.models import SMS_TYPE, EMAIL_TYPE, LETTER_TYPE from app.schema_validation import validate -from app.utils import convert_utc_to_bst billing_blueprint = Blueprint( 'billing', @@ -57,69 +53,6 @@ def get_yearly_billing_usage_summary_from_ft_billing(service_id): return jsonify(data) -def _get_total_billable_units_and_rate_for_notification_type(billing_data, noti_type): - total_sent = 0 - rate = 0 - letter_total = 0 - for entry in billing_data: - for monthly_total in entry.monthly_totals: - if entry.notification_type == noti_type: - if entry.notification_type == EMAIL_TYPE: - total_sent += monthly_total['billing_units'] - rate = monthly_total['rate'] - elif entry.notification_type == SMS_TYPE: - total_sent += (monthly_total['billing_units'] * monthly_total['rate_multiplier']) - rate = monthly_total['rate'] - elif entry.notification_type == LETTER_TYPE: - total_sent += monthly_total['billing_units'] - letter_total += (monthly_total['billing_units'] * monthly_total['rate']) - - return { - "notification_type": noti_type, - "billing_units": total_sent, - "rate": float(rate), - "letter_total": round(float(letter_total), 3) - } - - -def _transform_billing_for_month_sms(billing_for_month): - month_name = datetime.strftime(convert_utc_to_bst(billing_for_month.start_date), "%B") - billing_units = rate = 0 - - for total in billing_for_month.monthly_totals: - billing_units += (total['billing_units'] * total['rate_multiplier']) - rate = total['rate'] - - return { - "month": month_name, - "billing_units": billing_units, - "notification_type": billing_for_month.notification_type, - "rate": rate - } - - -def _transform_billing_for_month_letters(billing_for_month): - month_name = datetime.strftime(convert_utc_to_bst(billing_for_month.start_date), "%B") - x = list() - - for total in billing_for_month.monthly_totals: - y = { - "month": month_name, - "billing_units": (total['billing_units'] * total['rate_multiplier']), - "notification_type": billing_for_month.notification_type, - "rate": float(total['rate']) - } - x.append(y) - if len(billing_for_month.monthly_totals) == 0: - x.append({ - "month": month_name, - "billing_units": 0, - "notification_type": billing_for_month.notification_type, - "rate": 0 - }) - return x - - @billing_blueprint.route('/free-sms-fragment-limit', methods=["GET"]) def get_free_sms_fragment_limit(service_id):