Commit 059f0651 authored by Jérome Perrin's avatar Jérome Perrin

ERP5ShortMessage: record in workflow that gateway could send SMS

parent f5792613
"""Save the message id of the relative document""" """Save the message id on the event and mark the message as stopped
"""
from Products.ERP5Type.Message import translateString
if document_relative_url: if document_relative_url:
document = context.getPortalObject().restrictedTraverse(document_relative_url) document = context.getPortalObject().restrictedTraverse(document_relative_url)
document.edit(destination_reference=message_id, document.edit(destination_reference=message_id,
gateway=gateway_relative_url) gateway=gateway_relative_url)
if document.getSimulationState() == 'started':
document.stop(comment=translateString(
'Confirmed by gateway as ${message_id}', mapping={'message_id': message_id}))
...@@ -96,3 +96,5 @@ class TestShortMessageSending(ShortMessageTestCase): ...@@ -96,3 +96,5 @@ class TestShortMessageSending(ShortMessageTestCase):
# sending message should have updated the document with message id and gateway # sending message should have updated the document with message id and gateway
self.assertTrue(short_message.getDestinationReference()) self.assertTrue(short_message.getDestinationReference())
self.assertEqual(gateway, short_message.getGatewayValue()) self.assertEqual(gateway, short_message.getGatewayValue())
# if gateway confirm, the short message becomes stopped
self.assertEqual('stopped', short_message.getSimulationState())
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment