mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Monthly billing has been updated to populate for letters.
This commit is contained in:
@@ -9,8 +9,8 @@ from app.models import (
|
||||
SMS_TYPE,
|
||||
EMAIL_TYPE,
|
||||
MonthlyBilling,
|
||||
NotificationHistory
|
||||
)
|
||||
NotificationHistory,
|
||||
LETTER_TYPE)
|
||||
from app.statsd_decorators import statsd
|
||||
from app.utils import convert_utc_to_bst
|
||||
|
||||
@@ -31,6 +31,7 @@ def create_or_update_monthly_billing(service_id, billing_month):
|
||||
start_date, end_date = get_month_start_and_end_date_in_utc(billing_month)
|
||||
_update_monthly_billing(service_id, start_date, end_date, SMS_TYPE)
|
||||
_update_monthly_billing(service_id, start_date, end_date, EMAIL_TYPE)
|
||||
_update_monthly_billing(service_id, start_date, end_date, LETTER_TYPE)
|
||||
|
||||
|
||||
def _monthly_billing_data_to_json(billing_data):
|
||||
|
||||
@@ -50,6 +50,11 @@ def get_billing_data_for_month(service_id, start_date, end_date, notification_ty
|
||||
)
|
||||
)
|
||||
|
||||
if notification_type == LETTER_TYPE:
|
||||
results.extend(billing_letter_data_per_month_query(
|
||||
service_id=service_id, start_date=start_date, end_date=end_date)
|
||||
)
|
||||
|
||||
return results
|
||||
|
||||
|
||||
@@ -165,10 +170,11 @@ def billing_letter_data_per_month_query(service_id, start_date, end_date):
|
||||
NotificationHistory.notification_type,
|
||||
month,
|
||||
NotificationHistory.rate_multiplier,
|
||||
NotificationHistory.international
|
||||
NotificationHistory.international,
|
||||
LetterRate.rate
|
||||
).order_by(
|
||||
month,
|
||||
rate_multiplier()
|
||||
).all()
|
||||
|
||||
return results
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user