From e11fc2ff79c773ca30fab7b33d5348f9a02fd0ed Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Wed, 27 Apr 2022 18:48:28 +0300 Subject: [PATCH] backend: updated packages version --- common/ASC.Common/Utils/JsonWebToken.cs | 2 ++ common/ASC.Core.Common/ASC.Core.Common.csproj | 2 +- products/ASC.Files/Core/ASC.Files.Core.csproj | 2 +- .../ASC.Files/Core/Helpers/DocuSignHelper.cs | 21 +++++++++---------- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/common/ASC.Common/Utils/JsonWebToken.cs b/common/ASC.Common/Utils/JsonWebToken.cs index 6585c3b579..d270c1a0c8 100644 --- a/common/ASC.Common/Utils/JsonWebToken.cs +++ b/common/ASC.Common/Utils/JsonWebToken.cs @@ -53,7 +53,9 @@ public static class JsonWebToken private static (IJsonSerializer, IJwtAlgorithm, IBase64UrlEncoder) GetSettings(bool baseSerializer = false) { +#pragma warning disable CS0618 // Type or member is obsolete return (baseSerializer ? (IJsonSerializer)new JsonNetSerializer() : new JwtSerializer(), new HMACSHA256Algorithm(), new JwtBase64UrlEncoder()); +#pragma warning restore CS0618 // Type or member is obsolete } } diff --git a/common/ASC.Core.Common/ASC.Core.Common.csproj b/common/ASC.Core.Common/ASC.Core.Common.csproj index 35fff38f1b..96a30165b4 100644 --- a/common/ASC.Core.Common/ASC.Core.Common.csproj +++ b/common/ASC.Core.Common/ASC.Core.Common.csproj @@ -56,7 +56,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/products/ASC.Files/Core/ASC.Files.Core.csproj b/products/ASC.Files/Core/ASC.Files.Core.csproj index aa3a6afd09..3a356295b3 100644 --- a/products/ASC.Files/Core/ASC.Files.Core.csproj +++ b/products/ASC.Files/Core/ASC.Files.Core.csproj @@ -21,7 +21,7 @@ - + diff --git a/products/ASC.Files/Core/Helpers/DocuSignHelper.cs b/products/ASC.Files/Core/Helpers/DocuSignHelper.cs index 9cee63ed6b..60952b99e3 100644 --- a/products/ASC.Files/Core/Helpers/DocuSignHelper.cs +++ b/products/ASC.Files/Core/Helpers/DocuSignHelper.cs @@ -181,10 +181,10 @@ public class DocuSignHelper var token = _docuSignToken.GetToken(); var account = GetDocuSignAccount(token); - var configuration = GetConfiguration(account, token); + var apiClient = GetApiClient(account, token); var (document, sourceFile) = await CreateDocumentAsync(fileId, docuSignData.Name, docuSignData.FolderId); - var url = CreateEnvelope(account.AccountId, document, docuSignData, configuration); + var url = CreateEnvelope(account.AccountId, document, docuSignData, apiClient); _filesMessageService.Send(sourceFile, requestHeaders, MessageAction.DocumentSendToSign, "DocuSign", sourceFile.Title); @@ -212,17 +212,16 @@ public class DocuSignHelper return account; } - private DocuSign.eSign.Client.Configuration GetConfiguration(DocuSignAccount account, OAuth20Token token) + private ApiClient GetApiClient(DocuSignAccount account, OAuth20Token token) { ArgumentNullException.ThrowIfNull(account); ArgumentNullException.ThrowIfNull(token); var apiClient = new ApiClient(account.BaseUri + "/restapi"); + + apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + _docuSignToken.GetRefreshedToken(token)); - var configuration = new DocuSign.eSign.Client.Configuration { ApiClient = apiClient }; - configuration.AddDefaultHeader("Authorization", "Bearer " + _docuSignToken.GetRefreshedToken(token)); - - return configuration; + return apiClient; } private async Task<(Document document, File file)> CreateDocumentAsync(T fileId, string documentName, string folderId) @@ -281,7 +280,7 @@ public class DocuSignHelper return (document, file); } - private string CreateEnvelope(string accountId, Document document, DocuSignData docuSignData, DocuSign.eSign.Client.Configuration configuration) + private string CreateEnvelope(string accountId, Document document, DocuSignData docuSignData, ApiClient apiClient) { var eventNotification = new EventNotification { @@ -347,7 +346,7 @@ public class DocuSignHelper Status = "created", }; - var envelopesApi = new EnvelopesApi(configuration); + var envelopesApi = new EnvelopesApi(apiClient); var envelopeSummary = envelopesApi.CreateEnvelope(accountId, envelopeDefinition); Logger.Debug("DocuSign createdEnvelope: " + envelopeSummary.EnvelopeId); @@ -369,7 +368,7 @@ public class DocuSignHelper var token = _docuSignToken.GetToken(); var account = GetDocuSignAccount(token); - var configuration = GetConfiguration(account, token); + var apiClient = GetApiClient(account, token); var fileDao = _daoFactory.GetFileDao(); var folderDao = _daoFactory.GetFolderDao(); @@ -399,7 +398,7 @@ public class DocuSignHelper file.Comment = FilesCommonResource.CommentCreateByDocuSign; file.Title = FileUtility.ReplaceFileExtension(documentName, ".pdf"); - var envelopesApi = new EnvelopesApi(configuration); + var envelopesApi = new EnvelopesApi(apiClient); Logger.Info("DocuSign webhook get stream: " + documentId); using (var stream = await envelopesApi.GetDocumentAsync(account.AccountId, envelopeId, documentId)) {