2018-05-08 12:09:29 +01:00
|
|
|
from datetime import datetime
|
|
|
|
|
|
2017-10-24 13:23:24 +01:00
|
|
|
create_or_update_free_sms_fragment_limit_schema = {
|
|
|
|
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
|
|
|
"description": "POST annual billing schema",
|
|
|
|
|
"type": "object",
|
|
|
|
|
"title": "Create",
|
|
|
|
|
"properties": {
|
|
|
|
|
"free_sms_fragment_limit": {"type": "integer", "minimum": 1},
|
|
|
|
|
},
|
2017-11-02 12:19:17 +00:00
|
|
|
"required": ["free_sms_fragment_limit"]
|
2017-10-24 13:23:24 +01:00
|
|
|
}
|
2018-05-08 12:09:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|