Skip to content

Commit 6f4c82f

Browse files
committed
Zapier migration to V10
1 parent 9339c4f commit 6f4c82f

File tree

10 files changed

+31
-59
lines changed

10 files changed

+31
-59
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,8 @@ src/Umbraco.Forms.Integrations.TestSite/Umbraco
398398
src/Umbraco.Forms.Integrations.TestSite/Views
399399
src/Umbraco.Forms.Integrations.TestSite.V9/App_Plugins
400400
src/Umbraco.Forms.Integrations.TestSite.V9/Views
401+
src/Umbraco.Forms.Integrations.TestSite.V10/App_Plugins
402+
src/Umbraco.Forms.Integrations.TestSite.V10/Views
401403
*.zip
402404
appsettings.Local.json
403405
src/Umbraco.Forms.Integrations.Automation.Zapier/app.config

src/Umbraco.Forms.Integrations.Automation.Zapier/Components/NewFormSubmittedNotification.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
using Microsoft.Extensions.Logging;
22

33
using Umbraco.Cms.Core.Events;
4-
using Umbraco.Cms.Core.Models.PublishedContent;
5-
using Umbraco.Cms.Core.Routing;
6-
using Umbraco.Cms.Web.Common;
7-
using Umbraco.Extensions;
84
using Umbraco.Forms.Core.Services;
95
using Umbraco.Forms.Core.Services.Notifications;
106
using Umbraco.Forms.Integrations.Automation.Zapier.Extensions;
@@ -53,13 +49,13 @@ public void Handle(RecordCreatingNotification notification)
5349
if (_zapierFormSubscriptionHookService.TryGetById(form.Id.ToString(), out var subscriptionHooks))
5450
{
5551
var content = form.ToFormDictionary(notificationSavedEntity, _umbUrlHelper.GetPageUrl(notificationSavedEntity.UmbracoPageId));
56-
52+
5753
foreach (var subscriptionHook in subscriptionHooks)
5854
{
5955
var result =
6056
triggerHelper.FormExecute(subscriptionHook.HookUrl, content);
6157

62-
if(!string.IsNullOrEmpty(result))
58+
if (!string.IsNullOrEmpty(result))
6359
_logger.LogError(result);
6460
}
6561
}

src/Umbraco.Forms.Integrations.Automation.Zapier/Configuration/ZapierSettings.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
{
33
public class ZapierSettings
44
{
5-
public ZapierSettings()
6-
{
7-
8-
}
9-
105
public string UserGroupAlias { get; set; }
116

127
public string ApiKey { get; set; }

src/Umbraco.Forms.Integrations.Automation.Zapier/Controllers/FormController.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
using Umbraco.Forms.Integrations.Automation.Zapier.Models.Dtos;
55
using Umbraco.Forms.Integrations.Automation.Zapier.Services;
6+
using Umbraco.Forms.Integrations.Automation.Zapier.Configuration;
67

78
using Microsoft.Extensions.Options;
89

9-
using Umbraco.Forms.Integrations.Automation.Zapier.Configuration;
10-
1110
namespace Umbraco.Forms.Integrations.Automation.Zapier.Controllers
1211
{
1312
/// <summary>

src/Umbraco.Forms.Integrations.Automation.Zapier/Controllers/FormPollingController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
using System.Collections.Generic;
22
using System.Linq;
3+
4+
using Microsoft.Extensions.Options;
5+
36
using Umbraco.Forms.Core.Data.Storage;
47
using Umbraco.Forms.Integrations.Automation.Zapier.Extensions;
58
using Umbraco.Forms.Integrations.Automation.Zapier.Helpers;
69
using Umbraco.Forms.Integrations.Automation.Zapier.Services;
7-
8-
using Microsoft.Extensions.Options;
9-
1010
using Umbraco.Forms.Integrations.Automation.Zapier.Configuration;
1111

1212
namespace Umbraco.Forms.Integrations.Automation.Zapier.Controllers

src/Umbraco.Forms.Integrations.Automation.Zapier/Controllers/ZapierFormAuthorizedApiController.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
using System.Linq;
22

3-
using Umbraco.Forms.Integrations.Automation.Zapier.Configuration;
4-
using Umbraco.Forms.Integrations.Automation.Zapier.Services;
5-
63
using Microsoft.Extensions.Options;
74

5+
using Umbraco.Forms.Integrations.Automation.Zapier.Configuration;
6+
using Umbraco.Forms.Integrations.Automation.Zapier.Services;
87
using Umbraco.Cms.Web.Common.Controllers;
98

109
namespace Umbraco.Forms.Integrations.Automation.Zapier.Controllers

src/Umbraco.Forms.Integrations.Automation.Zapier/Models/Dtos/FormDto.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-

2-
using Newtonsoft.Json;
1+
using Newtonsoft.Json;
32

43
namespace Umbraco.Forms.Integrations.Automation.Zapier.Models.Dtos
54
{

src/Umbraco.Forms.Integrations.Automation.Zapier/Services/UserValidationService.cs

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,38 @@
11
using System.Linq;
22
using System.Threading.Tasks;
33

4-
using Umbraco.Forms.Integrations.Automation.Zapier.Configuration;
5-
6-
#if NETCOREAPP
74
using Microsoft.Extensions.Options;
85

6+
using Umbraco.Forms.Integrations.Automation.Zapier.Configuration;
97
using Umbraco.Cms.Core.Security;
108
using Umbraco.Cms.Core.Services;
11-
#else
12-
using System.Configuration;
13-
using Umbraco.Core.Services;
14-
#endif
159

1610
namespace Umbraco.Forms.Integrations.Automation.Zapier.Services
1711
{
1812
public class UserValidationService : IUserValidationService
1913
{
20-
private readonly IUserService _userService;
21-
2214
private readonly ZapierSettings _zapierSettings;
2315

24-
#if NETCOREAPP
16+
private readonly IUserService _userService;
17+
2518
private readonly IBackOfficeUserManager _backOfficeUserManager;
2619

27-
public UserValidationService(IOptions<ZapierSettings> options, IBackOfficeUserManager backOfficeUserManager, IUserService userService)
20+
public UserValidationService(IOptions<ZapierSettings> options, IUserService userService, IBackOfficeUserManager backOfficeUserManager)
2821
{
22+
_zapierSettings = options.Value;
23+
2924
_backOfficeUserManager = backOfficeUserManager;
3025

31-
_zapierSettings = options.Value;
32-
}
33-
#else
34-
public UserValidationService(IUserService userService)
35-
{
3626
_userService = userService;
37-
38-
_zapierSettings = new ZapierSettings(ConfigurationManager.AppSettings);
3927
}
40-
#endif
4128

4229
public async Task<bool> Validate(string username, string password, string apiKey)
4330
{
4431
if (!string.IsNullOrEmpty(apiKey))
4532
return apiKey == _zapierSettings.ApiKey;
4633

47-
#if NETCOREAPP
4834
var isUserValid =
4935
await _backOfficeUserManager.ValidateCredentialsAsync(username, password);
50-
#else
51-
var isUserValid = Umbraco.Web.Composing.Current.UmbracoContext.Security.ValidateBackOfficeCredentials(username, password);
52-
#endif
5336

5437
if (!isUserValid) return false;
5538

src/Umbraco.Forms.Integrations.Automation.Zapier/ZapierFormsComposer.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
using Umbraco.Cms.Core.Composing;
44
using Umbraco.Cms.Core.DependencyInjection;
5+
using Umbraco.Forms.Core.Services.Notifications;
6+
using Umbraco.Forms.Integrations.Automation.Zapier.Components;
57
using Umbraco.Forms.Integrations.Automation.Zapier.Configuration;
68
using Umbraco.Forms.Integrations.Automation.Zapier.Helpers;
79
using Umbraco.Forms.Integrations.Automation.Zapier.Services;
@@ -16,6 +18,9 @@ public void Compose(IUmbracoBuilder builder)
1618
.AddOptions<ZapierSettings>()
1719
.Bind(builder.Config.GetSection(Constants.Configuration.Settings));
1820

21+
builder
22+
.AddNotificationHandler<RecordCreatingNotification, NewFormSubmittedNotification>();
23+
1924
builder.Services.AddSingleton<ZapierFormService>();
2025

2126
builder.Services.AddSingleton<ZapierFormSubscriptionHookService>();

src/Umbraco.Forms.Integrations.sln

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.31402.337
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.2.32616.157
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Forms.Integrations.Crm.Hubspot", "Umbraco.Forms.Integrations.Crm.Hubspot\Umbraco.Forms.Integrations.Crm.Hubspot.csproj", "{E7F3F2CC-DCB6-4158-AABA-D2EA9E1B9FA8}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Forms.Integrations.TestSite", "Umbraco.Forms.Integrations.TestSite\Umbraco.Forms.Integrations.TestSite.csproj", "{B34FD8A8-EA3E-4FD0-9A95-ACFE5F54CED4}"
9-
EndProject
108
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CRM", "CRM", "{B068CD05-EA88-4457-B8D9-6DB899E7EBE1}"
119
EndProject
1210
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Hubspot", "Hubspot", "{621A30D4-2251-43FF-BB4A-A4808C6A67D6}"
@@ -29,13 +27,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Zapier", "Zapier", "{B05E7F
2927
EndProject
3028
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Forms.Integrations.Automation.Zapier", "Umbraco.Forms.Integrations.Automation.Zapier\Umbraco.Forms.Integrations.Automation.Zapier.csproj", "{9602AB40-C74D-4067-814F-AF7EC33A5F8C}"
3129
EndProject
32-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Forms.Integrations.Testsite.V9", "Umbraco.Forms.Integrations.Testsite.V9\Umbraco.Forms.Integrations.Testsite.V9.csproj", "{35CBD238-126D-4A9C-93E4-D92F75960D3A}"
33-
EndProject
3430
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Commerce", "Commerce", "{F436249E-0796-4FCC-85A5-180A0DCDB05F}"
3531
EndProject
3632
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "eMerchantPay", "eMerchantPay", "{854D0DF1-AAEE-406A-82A8-B05992A0A74B}"
3733
EndProject
38-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Forms.Integrations.Commerce.EMerchantPay", "Umbraco.Forms.Integrations.Commerce.EMerchantPay\Umbraco.Forms.Integrations.Commerce.EMerchantPay.csproj", "{FD1A8505-A19E-4281-8701-6BA708C03CBE}"
34+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Forms.Integrations.Commerce.EMerchantPay", "Umbraco.Forms.Integrations.Commerce.EMerchantPay\Umbraco.Forms.Integrations.Commerce.EMerchantPay.csproj", "{FD1A8505-A19E-4281-8701-6BA708C03CBE}"
35+
EndProject
36+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Forms.Integrations.Testsite.V10", "Umbraco.Forms.Integrations.Testsite.V10\Umbraco.Forms.Integrations.Testsite.V10.csproj", "{4A475341-A17E-419F-B5A1-415FF1911046}"
3937
EndProject
4038
Global
4139
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -47,10 +45,6 @@ Global
4745
{E7F3F2CC-DCB6-4158-AABA-D2EA9E1B9FA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
4846
{E7F3F2CC-DCB6-4158-AABA-D2EA9E1B9FA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
4947
{E7F3F2CC-DCB6-4158-AABA-D2EA9E1B9FA8}.Release|Any CPU.Build.0 = Release|Any CPU
50-
{B34FD8A8-EA3E-4FD0-9A95-ACFE5F54CED4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
51-
{B34FD8A8-EA3E-4FD0-9A95-ACFE5F54CED4}.Debug|Any CPU.Build.0 = Debug|Any CPU
52-
{B34FD8A8-EA3E-4FD0-9A95-ACFE5F54CED4}.Release|Any CPU.ActiveCfg = Release|Any CPU
53-
{B34FD8A8-EA3E-4FD0-9A95-ACFE5F54CED4}.Release|Any CPU.Build.0 = Release|Any CPU
5448
{53742941-B77B-4A95-B247-F3ADD944C2FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
5549
{53742941-B77B-4A95-B247-F3ADD944C2FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
5650
{53742941-B77B-4A95-B247-F3ADD944C2FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -63,14 +57,14 @@ Global
6357
{9602AB40-C74D-4067-814F-AF7EC33A5F8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
6458
{9602AB40-C74D-4067-814F-AF7EC33A5F8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
6559
{9602AB40-C74D-4067-814F-AF7EC33A5F8C}.Release|Any CPU.Build.0 = Release|Any CPU
66-
{35CBD238-126D-4A9C-93E4-D92F75960D3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
67-
{35CBD238-126D-4A9C-93E4-D92F75960D3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
68-
{35CBD238-126D-4A9C-93E4-D92F75960D3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
69-
{35CBD238-126D-4A9C-93E4-D92F75960D3A}.Release|Any CPU.Build.0 = Release|Any CPU
7060
{FD1A8505-A19E-4281-8701-6BA708C03CBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
7161
{FD1A8505-A19E-4281-8701-6BA708C03CBE}.Debug|Any CPU.Build.0 = Debug|Any CPU
7262
{FD1A8505-A19E-4281-8701-6BA708C03CBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
7363
{FD1A8505-A19E-4281-8701-6BA708C03CBE}.Release|Any CPU.Build.0 = Release|Any CPU
64+
{4A475341-A17E-419F-B5A1-415FF1911046}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
65+
{4A475341-A17E-419F-B5A1-415FF1911046}.Debug|Any CPU.Build.0 = Debug|Any CPU
66+
{4A475341-A17E-419F-B5A1-415FF1911046}.Release|Any CPU.ActiveCfg = Release|Any CPU
67+
{4A475341-A17E-419F-B5A1-415FF1911046}.Release|Any CPU.Build.0 = Release|Any CPU
7468
EndGlobalSection
7569
GlobalSection(SolutionProperties) = preSolution
7670
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)