diff --git a/opengever/api/transition.py b/opengever/api/transition.py index 4c7101b61a..7d8888e320 100644 --- a/opengever/api/transition.py +++ b/opengever/api/transition.py @@ -385,8 +385,10 @@ class GEVERDocumentWorkflowTransition(GEVERWorkflowTransition): def reply(self): response = super(GEVERDocumentWorkflowTransition, self).reply() if self.transition in self.SIGNING_TRANSITIONS: - response['redirect_url'] = Signer( - self.context).serialize_pending_signing_job().get('redirect_url') + pending_signing_job = Signer( + self.context).serialize_pending_signing_job() + response['redirect_url'] = pending_signing_job.get('redirect_url') + response['invite_url'] = pending_signing_job.get('invite_url') return response diff --git a/opengever/document/tests/test_document_workflow.py b/opengever/document/tests/test_document_workflow.py index 3b686e444f..51014b5afa 100644 --- a/opengever/document/tests/test_document_workflow.py +++ b/opengever/document/tests/test_document_workflow.py @@ -228,6 +228,7 @@ def test_can_start_signing_a_document_in_draft_state(self, mocker): 'created': u'2024-02-18T15:45:00', 'job_id': '1', 'redirect_url': 'http://external.example.org/signing-requests/123', + 'invite_url': 'http://external.example.org/invite/signing-requests/123', 'signers': [], 'editors': [ { @@ -261,6 +262,7 @@ def test_can_start_signing_a_document_in_final_state(self, mocker): 'created': u'2024-02-18T15:45:00', 'job_id': '1', 'redirect_url': 'http://external.example.org/signing-requests/123', + 'invite_url': 'http://external.example.org/invite/signing-requests/123', 'signers': [], 'editors': [ { diff --git a/opengever/sign/pending_signing_job.py b/opengever/sign/pending_signing_job.py index 375a2a1232..5c71812e0e 100644 --- a/opengever/sign/pending_signing_job.py +++ b/opengever/sign/pending_signing_job.py @@ -18,6 +18,7 @@ def __init__(self, editors=list(), job_id='', redirect_url='', + invite_url='', ): self.created = created or datetime.now() @@ -27,6 +28,7 @@ def __init__(self, self.editors = PendingEditors([PendingEditor(email=editors) for editors in editors]) self.job_id = job_id self.redirect_url = redirect_url + self.invite_url = invite_url def serialize(self): return json_compatible({ @@ -34,6 +36,7 @@ def serialize(self): 'userid': self.userid, 'job_id': self.job_id, 'redirect_url': self.redirect_url, + 'invite_url': self.invite_url, 'signers': self.signers.serialize(), 'editors': self.editors.serialize(), 'version': self.version, diff --git a/opengever/sign/sign.py b/opengever/sign/sign.py index 51a069a594..33c3161aa3 100644 --- a/opengever/sign/sign.py +++ b/opengever/sign/sign.py @@ -43,6 +43,7 @@ def start_signing(self, signers=[], editors=[]): editors=editors, job_id=response.get('id'), redirect_url=response.get('redirect_url'), + invite_url=response.get('invite_url'), ) return token diff --git a/opengever/sign/tests/test_pending_signing_job.py b/opengever/sign/tests/test_pending_signing_job.py index 94e86c15b5..5d925baeca 100644 --- a/opengever/sign/tests/test_pending_signing_job.py +++ b/opengever/sign/tests/test_pending_signing_job.py @@ -29,7 +29,8 @@ def test_can_be_serialized(self): signers=['foo.bar@example.com'], editors=['bar.foo@example.com'], job_id='1', - redirect_url='redirect@example.com') + redirect_url='redirect@example.com', + invite_url='redirect@example.com/invite') self.assertDictEqual( { @@ -49,7 +50,8 @@ def test_can_be_serialized(self): } ], 'job_id': '1', - 'redirect_url': 'redirect@example.com' + 'redirect_url': 'redirect@example.com', + 'invite_url': 'redirect@example.com/invite', }, metadata.serialize()) def test_can_be_converted_to_a_signed_version(self): diff --git a/opengever/sign/tests/test_sign.py b/opengever/sign/tests/test_sign.py index dbcaee37dd..fc16711281 100644 --- a/opengever/sign/tests/test_sign.py +++ b/opengever/sign/tests/test_sign.py @@ -17,6 +17,7 @@ DEFAULT_MOCK_RESPONSE = { 'id': '1', 'redirect_url': 'http://external.example.org/signing-requests/123', + 'invite_url': 'http://external.example.org/invite/signing-requests/123', } @@ -59,6 +60,7 @@ def test_store_signing_document_metadata_when_starting_sign_process(self, mocker 'created': u'2024-02-18T15:45:00', 'job_id': '1', 'redirect_url': 'http://external.example.org/signing-requests/123', + 'invite_url': 'http://external.example.org/invite/signing-requests/123', 'signers': [{u'email': u'foo.bar@example.com', u'userid': u''}], 'editors': [{u'email': u'bar.foo@example.com', u'userid': u''}], 'userid': 'regular_user',