Skip to content

Commit 00fff5a

Browse files
committed
Updating to 2024 R1
1 parent b6fb84c commit 00fff5a

12 files changed

Lines changed: 105 additions & 71 deletions

File tree

AcumaticaESign/AcumaticaESign.csproj

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,49 +15,53 @@
1515
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
1616
<DebugType>pdbonly</DebugType>
1717
</PropertyGroup>
18+
<ItemGroup>
19+
<PackageReference Include="Microsoft.CodeAnalysis.Metrics" Version="3.3.4" />
20+
</ItemGroup>
1821
<ItemGroup>
1922
<Reference Include="CsvHelper">
20-
<HintPath>C:\Program Files (x86)\Acumatica ERP\EP2021R100\Bin\CsvHelper.dll</HintPath>
23+
<HintPath>C:\Program Files\Acumatica ERP\EP2024R100\Bin\CsvHelper.dll</HintPath>
2124
</Reference>
2225
<Reference Include="DocuSign">
2326
<HintPath>..\References\DocuSign.dll</HintPath>
2427
<Private>true</Private>
2528
</Reference>
26-
<Reference Include="Microsoft.AspNet.SignalR.Core">
27-
<HintPath>C:\Program Files (x86)\Acumatica ERP\EP2021R100\Bin\Microsoft.AspNet.SignalR.Core.dll</HintPath>
29+
<Reference Include="Microsoft.AspNetCore.SignalR.Core">
30+
<HintPath>C:\Program Files\Acumatica ERP\EP2024R100\Bin\Microsoft.AspNetCore.SignalR.Core.dll</HintPath>
2831
</Reference>
2932
<Reference Include="Microsoft.CSharp" />
3033
<Reference Include="Newtonsoft.Json">
31-
<HintPath>C:\Program Files (x86)\Acumatica ERP\EP2021R100\Bin\Newtonsoft.Json.dll</HintPath>
34+
<HintPath>C:\Program Files\Acumatica ERP\EP2024R100\Bin\Newtonsoft.Json.dll</HintPath>
3235
</Reference>
3336
<Reference Include="PX.Common">
34-
<HintPath>C:\Program Files (x86)\Acumatica ERP\EP2021R100\Bin\PX.Common.dll</HintPath>
37+
<HintPath>C:\Program Files\Acumatica ERP\EP2024R100\Bin\PX.Common.dll</HintPath>
3538
</Reference>
3639
<Reference Include="PX.Common.Std">
37-
<HintPath>C:\Program Files (x86)\Acumatica ERP\EP2021R100\Bin\PX.Common.Std.dll</HintPath>
40+
<HintPath>C:\Program Files\Acumatica ERP\EP2024R100\Bin\PX.Common.Std.dll</HintPath>
3841
</Reference>
3942
<Reference Include="PX.Web.UI">
40-
<HintPath>C:\Program Files (x86)\Acumatica ERP\EP2021R100\Bin\PX.Web.UI.dll</HintPath>
43+
<HintPath>C:\Program Files\Acumatica ERP\EP2024R100\Bin\PX.Web.UI.dll</HintPath>
4144
</Reference>
4245
<Reference Include="PX.CS.Contracts">
43-
<HintPath>C:\Program Files (x86)\Acumatica ERP\EP2021R100\Bin\PX.CS.Contracts.dll</HintPath>
46+
<HintPath>C:\Program Files\Acumatica ERP\EP2024R100\Bin\PX.CS.Contracts.dll</HintPath>
4447
</Reference>
4548
<Reference Include="PX.Data">
46-
<HintPath>C:\Program Files (x86)\Acumatica ERP\EP2021R100\Bin\PX.Data.dll</HintPath>
49+
<HintPath>C:\Program Files\Acumatica ERP\EP2024R100\Bin\PX.Data.dll</HintPath>
4750
</Reference>
4851
<Reference Include="PX.OAuthClient">
49-
<HintPath>C:\Program Files (x86)\Acumatica ERP\EP2021R100\Bin\PX.OAuthClient.dll</HintPath>
52+
<HintPath>C:\Program Files\Acumatica ERP\EP2024R100\Bin\PX.OAuthClient.dll</HintPath>
5053
</Reference>
5154
<Reference Include="PX.Objects">
52-
<HintPath>C:\Program Files (x86)\Acumatica ERP\EP2021R100\Bin\PX.Objects.dll</HintPath>
55+
<HintPath>C:\Program Files\Acumatica ERP\EP2024R100\Bin\PX.Objects.dll</HintPath>
5356
</Reference>
5457
<Reference Include="RestSharp">
55-
<HintPath>C:\Program Files (x86)\Acumatica ERP\EP2021R100\Bin\RestSharp.dll</HintPath>
58+
<HintPath>C:\Program Files\Acumatica ERP\EP2024R100\Bin\RestSharp.dll</HintPath>
5659
</Reference>
5760
<Reference Include="System" />
5861
<Reference Include="System.Core">
5962
<RequiredTargetFramework>3.5</RequiredTargetFramework>
6063
</Reference>
64+
<Reference Include="System.Net.Http" />
6165
<Reference Include="System.Web" />
6266
<Reference Include="System.Xml" />
6367
</ItemGroup>

AcumaticaESign/AcumaticaESign/DAC/ESignAccount.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ public static class ProviderTypes
590590
public static class ProviderTypesIconPath
591591
{
592592
public const string DocuSign = "~/Icons/DocuSignIcon.png";
593-
public const string AdobeSign = "~/Icons/AdobeSignIcon.png";
593+
public const string AdobeSign = "~/Icons/AcrobatSignIcon.png";
594594
public const string Empty = "";
595595
}
596596

AcumaticaESign/AcumaticaESign/DAC/ESignEnvelopeInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ public static class ProviderTypes
927927
public static class ProviderTypesIconPath
928928
{
929929
public const string DocuSign = "~/Icons/DocuSignIcon.png";
930-
public const string AdobeSign = "~/Icons/AdobeSignIcon.png";
930+
public const string AdobeSign = "~/Icons/AcrobatSignIcon.png";
931931
public const string Empty = "";
932932
}
933933

AcumaticaESign/AcumaticaESign/Descriptor/Messages.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public static class ESignIntegrationStatus
148148
public static class ESignProviderType
149149
{
150150
public const string DocuSign = "DocuSign";
151-
public const string AdobeSign = "AdobeSign";
151+
public const string AdobeSign = "AcrobatSign";
152152
}
153153

154154
public static class ESignAccountType
@@ -224,6 +224,8 @@ public static class ESignEnvelopeStatus
224224

225225
#region Validation messages
226226

227+
public const string ConnectionSuccess = "The connection to the eSign provider was successful.";
228+
227229
public const string EnvelopeStatusChanged =
228230
"This document was already sent previously. Please refresh your screen to see latest status information.";
229231

@@ -250,10 +252,10 @@ public static class ESignEnvelopeStatus
250252

251253
public const string DocumentWasDeletedMessage = "Document was deleted from web version.";
252254
public const string EnvelopeWithoutRecipientMessage = "You cannot send a document without recipient.";
253-
public const string MessagePattern = "Unsupported values ({0}) have been sent to Adobe Sign.";
255+
public const string MessagePattern = "Unsupported values ({0}) have been sent to Acrobat Sign.";
254256
public const string AccessIsNotAllowedMessage = "Access is not allowed.";
255257
public const string InvalidFileTypeMessage = "Invalid file type chosen for E Sign.";
256-
public const string NotFoundMessage = "Adobe Sign entity has not been found.";
258+
public const string NotFoundMessage = "Acrobat Sign entity has not been found.";
257259
public const string SentToYourselfMessage = "You cannot send a document only to yourself to complete.";
258260

259261
#endregion

AcumaticaESign/AcumaticaESign/ESignAccountEntry.cs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Microsoft.AspNet.SignalR.Infrastructure;
1+
using Microsoft.AspNetCore.SignalR;
22
using PX.Data;
33
using PX.Data.DependencyInjection;
44
using PX.OAuthClient.Hubs;
@@ -9,7 +9,7 @@ namespace AcumaticaESign
99
public class ESignAccountEntry : PXGraph<ESignAccountEntry, ESignAccount>, IGraphWithInitialization
1010
{
1111
[InjectDependency]
12-
private IConnectionManager _signalRConnectionManager { get; set; }
12+
private IHubContext<RefreshHub> _signalRConnectionManager { get; set; }
1313

1414
public void Initialize()
1515
{
@@ -51,6 +51,7 @@ public virtual void connect()
5151
}
5252
}
5353

54+
5455
public PXAction<ESignAccount> Disconnect;
5556
[PXButton]
5657
[PXUIField(DisplayName = Messages.Actions.Disconnect, MapEnableRights = PXCacheRights.Update,
@@ -287,8 +288,7 @@ protected virtual void _(Events.FieldUpdated<ESignAccount.ownerID> args)
287288

288289
private void SendRefreshCall()
289290
{
290-
var hubContext = _signalRConnectionManager.GetHubContext<RefreshHub>();
291-
hubContext.Clients.All.RefreshPage();
291+
_signalRConnectionManager?.Clients?.All?.SendCoreAsync("refreshScreen", null);
292292
}
293293

294294
private static bool IsDisconnected(ESignAccount account)
@@ -300,12 +300,10 @@ private void AuthenticateAdobeSignAccount(ESignAccount account)
300300
{
301301
var companyId = PXAccess.GetCompanyName();
302302
var client = AdobeSignClientBuilder.BuildUnauthorized(account, companyId);
303-
PXLongOperation.StartOperation(this, () =>
304-
{
305-
var loginUrl = client.Authentication.GetLoginPageUrl();
306-
throw new PXRedirectToUrlException(loginUrl, PXBaseRedirectException.WindowMode.InlineWindow,
307-
string.Empty, false);
308-
});
303+
304+
var loginUrl = client.Authentication.GetLoginPageUrl();
305+
throw new PXRedirectToUrlException(loginUrl, PXBaseRedirectException.WindowMode.InlineWindow,
306+
string.Empty, false);
309307
}
310308

311309
private void AuthenticateDocuSignAccount(ESignAccount account)

AcumaticaESign/AcumaticaESign/Providers/AdobeSign/AdobeSignClientBuilder.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Text.RegularExpressions;
23
using System.Web;
34

45
namespace AcumaticaESign
@@ -13,11 +14,15 @@ public static AdobeSignClient Build(ESignAccount account, string companyId = nul
1314

1415
public static AdobeSignClient BuildUnauthorized(ESignAccount account, string companyId = null)
1516
{
17+
string leftPart = IsSecureConnection() && HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority).StartsWith("http:", StringComparison.OrdinalIgnoreCase) ?
18+
Regex.Replace(HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority), "http:", "https:", RegexOptions.IgnoreCase) :
19+
HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority);
20+
1621
var credentials = CreateCredentials(account, companyId);
1722
if (HttpContext.Current != null)
1823
{
1924
var url = string.Concat(
20-
HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority),
25+
leftPart,
2126
HttpContext.Current.Request.ApplicationPath != null && HttpContext.Current.Request.ApplicationPath.EndsWith("/")
2227
? string.Concat(HttpContext.Current.Request.ApplicationPath, "Pages/ES/ESign.aspx")
2328
: string.Concat(HttpContext.Current.Request.ApplicationPath, "/", "Pages/ES/ESign.aspx"));
@@ -40,5 +45,14 @@ private static Credentials CreateCredentials(ESignAccount setup, string companyI
4045
CompanyId = companyId
4146
};
4247
}
48+
49+
private static bool IsSecureConnection()
50+
{
51+
return
52+
HttpContext.Current.Request.IsSecureConnection
53+
|| string.Equals(HttpContext.Current.Request.Headers["X-Forwarded-Proto"],
54+
"https",
55+
StringComparison.InvariantCultureIgnoreCase);
56+
}
4357
}
4458
}

AcumaticaESign/AcumaticaESign/Providers/AdobeSign/Infrastructure/Request.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ public class Request
2121
public Dictionary<string, byte[]> FileParameters { get; } = new Dictionary<string, byte[]>();
2222
public Dictionary<string, object> UrlParameters { get; set; } = new Dictionary<string, object>();
2323

24-
public IRestResponse Execute()
24+
public RestResponse Execute()
2525
{
2626
var request = BuildRestRequest();
2727
return Dependencies.RestClient.Execute(request);
2828
}
2929

30-
public IRestResponse<T> Execute<T>()
30+
public RestResponse<T> Execute<T>()
3131
where T : new()
3232
{
3333
var request = BuildRestRequest();
@@ -49,55 +49,55 @@ public RestRequest BuildRestRequest()
4949
return request;
5050
}
5151

52-
private void AddUseFormContentTypeHeader(IRestRequest request)
52+
private void AddUseFormContentTypeHeader(RestRequest request)
5353
{
5454
if (UseFormContentTypeHeader)
5555
{
5656
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
5757
}
5858
}
5959

60-
private void AddAuthorizationHeader(IRestRequest request)
60+
private void AddAuthorizationHeader(RestRequest request)
6161
{
6262
if (UseAuthorizationHeader)
6363
{
6464
request.AddHeader("Access-Token", Dependencies.Credentials.AccessToken);
6565
}
6666
}
6767

68-
private void AddDownloadParameter(IRestRequest request)
68+
private void AddDownloadParameter(RestRequest request)
6969
{
7070
if (IsDownload)
7171
{
7272
request.AddHeader("Accept", "*/*");
7373
}
7474
}
7575

76-
private void AddQueryParameters(IRestRequest request)
76+
private void AddQueryParameters(RestRequest request)
7777
{
7878
foreach (var pair in QueryParameters)
7979
{
80-
request.AddParameter(pair.Key, pair.Value);
80+
request.AddParameter(pair.Key, pair.Value.ToString());
8181
}
8282
}
8383

84-
private void AddUrlSegment(IRestRequest request)
84+
private void AddUrlSegment(RestRequest request)
8585
{
8686
foreach (var pair in UrlParameters)
8787
{
8888
request.AddUrlSegment(pair.Key, (string) pair.Value);
8989
}
9090
}
9191

92-
private void AddFileParameters(IRestRequest request)
92+
private void AddFileParameters(RestRequest request)
9393
{
9494
foreach (var pair in FileParameters)
9595
{
96-
request.AddFileBytes("File", pair.Value, pair.Key);
96+
request.AddFile("File", pair.Value, pair.Key);
9797
}
9898
}
9999

100-
private void AddBodyParameters(IRestRequest request)
100+
private void AddBodyParameters(RestRequest request)
101101
{
102102
if (BodyParameters.Count > 0)
103103
{

AcumaticaESign/AcumaticaESign/Providers/AdobeSign/Infrastructure/RequestBuilder.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ public T Execute<T>(bool checkStatusCode = true)
9898
return HandleResponse(() => Request.Execute<T>(), checkStatusCode).Data;
9999
}
100100

101-
public IRestResponse Execute(bool checkStatusCode = true)
101+
public RestResponse Execute(bool checkStatusCode = true)
102102
{
103103
return HandleResponse(() => Request.Execute(), checkStatusCode);
104104
}
105105

106106
private T HandleResponse<T>(Func<T> getResponse, bool checkStatusCode)
107-
where T : IRestResponse
107+
where T : RestResponse
108108
{
109109
var response = getResponse();
110110

@@ -113,7 +113,7 @@ private T HandleResponse<T>(Func<T> getResponse, bool checkStatusCode)
113113
return response;
114114
}
115115

116-
private void HandleStatusCode(IRestResponse response, bool required)
116+
private void HandleStatusCode(RestResponse response, bool required)
117117
{
118118
if (required && !expectedStatuses.Contains(response.StatusCode))
119119
{
@@ -134,7 +134,7 @@ private void HandleStatusCode(IRestResponse response, bool required)
134134
}
135135
}
136136

137-
private void HandleValidationErrors(IRestResponse response)
137+
private void HandleValidationErrors(RestResponse response)
138138
{
139139
dynamic errors = null;
140140
string message = null;

AcumaticaESign/AcumaticaESign/Providers/AdobeSign/Services/AuthenticationService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public string GetLoginPageUrl()
2020

2121
public AccessTokenEntity CreateAccessToken(string authorizationCode)
2222
{
23-
return new RequestBuilder(Dependencies, Method.POST, "oauth/v2/token")
23+
return new RequestBuilder(Dependencies, Method.Post, "oauth/v2/token")
2424
.AddFormContentTypeHeader()
2525
.AddQueryParameter("code", authorizationCode)
2626
.AddQueryParameter("client_id", Dependencies.Credentials.ClientId)
@@ -32,7 +32,7 @@ public AccessTokenEntity CreateAccessToken(string authorizationCode)
3232

3333
public AccessTokenEntity RefreshAccessToken()
3434
{
35-
return new RequestBuilder(Dependencies, Method.POST, "/oauth/v2/refresh")
35+
return new RequestBuilder(Dependencies, Method.Post, "/oauth/v2/refresh")
3636
.AddFormContentTypeHeader()
3737
.AddQueryParameter("grant_type", "refresh_token")
3838
.AddQueryParameter("client_id", Dependencies.Credentials.ClientId)

0 commit comments

Comments
 (0)