mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 06:21:50 -05:00
Fix cancel broadcast by converting reference date to string
Datetime oobject is not json serializable, we have to convert it to string for the created_at field of previous broadcast provider messages.
This commit is contained in:
@@ -165,12 +165,16 @@ class CBCProxyEE(CBCProxyClientBase):
|
||||
identifier, previous_provider_messages,
|
||||
sent, message_number=None
|
||||
):
|
||||
from app import DATETIME_FORMAT
|
||||
payload = {
|
||||
'message_type': 'cancel',
|
||||
'identifier': identifier,
|
||||
'message_format': 'cap',
|
||||
"references": [
|
||||
{"message_id": str(message.id), "sent": message.created_at} for message in previous_provider_messages
|
||||
{
|
||||
"message_id": str(message.id),
|
||||
"sent": message.created_at.strftime(DATETIME_FORMAT)
|
||||
} for message in previous_provider_messages
|
||||
],
|
||||
'sent': sent,
|
||||
}
|
||||
@@ -219,6 +223,7 @@ class CBCProxyVodafone(CBCProxyClientBase):
|
||||
):
|
||||
# avoid cyclical import
|
||||
from app.utils import format_sequential_number
|
||||
from app import DATETIME_FORMAT
|
||||
|
||||
payload = {
|
||||
'message_type': 'cancel',
|
||||
@@ -229,7 +234,7 @@ class CBCProxyVodafone(CBCProxyClientBase):
|
||||
{
|
||||
"message_id": str(message.id),
|
||||
"message_number": format_sequential_number(message.message_number),
|
||||
"sent": message.created_at
|
||||
"sent": message.created_at.strftime(DATETIME_FORMAT)
|
||||
} for message in previous_provider_messages
|
||||
],
|
||||
'sent': sent,
|
||||
|
||||
Reference in New Issue
Block a user