mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
Changes as per requested from code review
Move the serialize method to the billing_schema Update variable names Improve tests Fix bug in command
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from datetime import datetime
|
||||
|
||||
create_or_update_free_sms_fragment_limit_schema = {
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"description": "POST annual billing schema",
|
||||
@@ -8,3 +10,17 @@ create_or_update_free_sms_fragment_limit_schema = {
|
||||
},
|
||||
"required": ["free_sms_fragment_limit"]
|
||||
}
|
||||
|
||||
|
||||
def serialize_ft_billing_remove_emails(data):
|
||||
results = []
|
||||
billed_notifications = [x for x in data if x.notification_type != 'email']
|
||||
for notifications in billed_notifications:
|
||||
json_result = {
|
||||
"month": (datetime.strftime(notifications.month, "%B")),
|
||||
"notification_type": notifications.notification_type,
|
||||
"billing_units": int(notifications.billable_units),
|
||||
"rate": float(notifications.rate),
|
||||
}
|
||||
results.append(json_result)
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user