diff --git a/pydocusign/models.py b/pydocusign/models.py index 1e2b7cd..40fb0c3 100644 --- a/pydocusign/models.py +++ b/pydocusign/models.py @@ -396,7 +396,7 @@ class Envelope(DocuSignObject): attributes = ['documents', 'emailBlurb', 'emailSubject', 'eventNotification', 'recipients', 'templateId', 'templateRoles', 'status', 'envelopeId', 'userId', - 'enableWetSign'] + 'enableWetSign', 'notification'] required_attributes = ['envelopeId', 'userId'] attribute_defaults = { 'emailBlurb': '', @@ -437,6 +437,8 @@ def to_dict(self): } if self.eventNotification: data['eventNotification'] = self.eventNotification.to_dict() + if self.notification: + data['notification'] = self.notification if self.templateId: data.update({ 'templateId': self.templateId, diff --git a/tests/test_models.py b/tests/test_models.py index 0475433..ce82bdc 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -313,3 +313,31 @@ def test_void_method_calls_api(self): envelope.void('reason') client.void_envelope.assert_called_once_with('fake-envelope-id', 'reason') + + + def test_serialize_envelope_with_notification(self): + document = Document( + documentId=2, + name='document.pdf') + envelope = Envelope( + documents=[document], + emailBlurb='This is the email body', + emailSubject='This is the email subject', + status=ENVELOPE_STATUS_DRAFT, + notification={ + 'expirations': { + 'expireEnabled': True, + 'expireAfter': 365, + 'expireWarn': 5, + }, + }, + ) + self.assertDictContainsSubset({ + 'notification': { + 'expirations': { + 'expireEnabled': True, + 'expireAfter': 365, + 'expireWarn': 5, + }, + }, + }, envelope.to_dict())