10.01.2024
This commit is contained in:
@@ -7,6 +7,8 @@ Imports System.Security.Cryptography
|
||||
Imports System.IO
|
||||
Imports EnvelopeGenerator.Common.Jobs.FinalizeDocument.FinalizeDocumentExceptions
|
||||
Imports EnvelopeGenerator.Common.Jobs.FinalizeDocument
|
||||
Imports EnvelopeGenerator.Common.My.Resources
|
||||
Imports EnvelopeGenerator.Common.Constants
|
||||
|
||||
Namespace Jobs
|
||||
Public Class FinalizeDocumentJob
|
||||
@@ -142,6 +144,8 @@ Namespace Jobs
|
||||
Throw New ExportDocumentException("Could not export final document to disk!", ex)
|
||||
End Try
|
||||
|
||||
SendFinalEmails(oEnvelope, oOutputFilePath)
|
||||
|
||||
oCurrent += 1
|
||||
Logger.Info("Envelope finalized!")
|
||||
|
||||
@@ -162,7 +166,62 @@ Namespace Jobs
|
||||
Return Task.FromResult(True)
|
||||
End Function
|
||||
|
||||
Private Function SendFinalEmails(pEnvelope As Envelope, pAttachment As String) As Boolean
|
||||
Dim oMailToCreator = pEnvelope.FinalEmailToCreator
|
||||
Dim oMailToReceivers = pEnvelope.FinalEmailToReceivers
|
||||
|
||||
If oMailToCreator <> FinalEmailType.No Then
|
||||
SendFinalEmailToCreator(pEnvelope, pAttachment)
|
||||
End If
|
||||
|
||||
If oMailToReceivers <> FinalEmailType.No Then
|
||||
SendFinalEmailToReceivers(pEnvelope, pAttachment)
|
||||
End If
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function SendFinalEmailToCreator(pEnvelope As Envelope, pAttachment As String) As Boolean
|
||||
Dim oIncludeAttachment = SendFinalEmailWithAttachment(pEnvelope.FinalEmailToCreator)
|
||||
Dim oAttachment = Nothing
|
||||
|
||||
If oIncludeAttachment Then
|
||||
oAttachment = pAttachment
|
||||
End If
|
||||
|
||||
If ActionService.CompleteEnvelope(pEnvelope, oAttachment) = False Then
|
||||
Logger.Error("Envelope could not be completed for receiver [{0}]", pEnvelope.User.Email)
|
||||
Return False
|
||||
End If
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function SendFinalEmailToReceivers(pEnvelope As Envelope, pAttachment As String) As Boolean
|
||||
Dim oIncludeAttachment = SendFinalEmailWithAttachment(pEnvelope.FinalEmailToReceivers)
|
||||
Dim oAttachment = Nothing
|
||||
|
||||
If oIncludeAttachment Then
|
||||
oAttachment = pAttachment
|
||||
End If
|
||||
|
||||
For Each oReceiver In pEnvelope.Receivers
|
||||
If ActionService.CompleteEnvelope(pEnvelope, oReceiver, oAttachment) = False Then
|
||||
Logger.Error("Envelope could not be completed for receiver [{0}]", oReceiver.Email)
|
||||
Return False
|
||||
End If
|
||||
Next
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function SendFinalEmailWithAttachment(pType As FinalEmailType)
|
||||
If pType = FinalEmailType.YesWithAttachment Then
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function BurnAnnotationsToPdf(pData As EnvelopeData) As Byte()
|
||||
Dim pEnvelopeId = pData.EnvelopeId
|
||||
|
||||
Reference in New Issue
Block a user