mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 15:31:15 -05:00
Prepare to replace "billing_units" in usage APIs
There is no such thing as a "billing unit". The data this field contained was also a confusing mixture of two types: - For emails and letters, it was just "notifications_sent". - For SMS, it was the "chargeable_units" (billable * multiplier). This replaces the single, ambiguous "billing_units" field with "chargeable_units" and "notifications_sent" in both usage APIs. Once Admin is using them we can remove the old field.
This commit is contained in:
@@ -17,7 +17,10 @@ def serialize_ft_billing_remove_emails(rows):
|
||||
{
|
||||
"month": (datetime.strftime(row.month, "%B")),
|
||||
"notification_type": row.notification_type,
|
||||
# TEMPORARY: while we migrate away from "billing_units"
|
||||
"billing_units": row.billable_units,
|
||||
"chargeable_units": row.chargeable_units,
|
||||
"notifications_sent": row.notifications_sent,
|
||||
"rate": float(row.rate),
|
||||
"postage": row.postage,
|
||||
}
|
||||
@@ -30,7 +33,10 @@ def serialize_ft_billing_yearly_totals(rows):
|
||||
return [
|
||||
{
|
||||
"notification_type": row.notification_type,
|
||||
# TEMPORARY: while we migrate away from "billing_units"
|
||||
"billing_units": row.billable_units,
|
||||
"chargeable_units": row.chargeable_units,
|
||||
"notifications_sent": row.notifications_sent,
|
||||
"rate": float(row.rate),
|
||||
"letter_total": float(row.billable_units * row.rate) if row.notification_type == 'letter' else 0,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user