Skip to content

Commit 272b222

Browse files
committed
Merge branch 'main' into feature/payment-provider-integration
# Conflicts: # src/Umbraco.Forms.Integrations.Commerce.EMerchantPay/Services/MappingService.cs
2 parents 30ef6b1 + 28473a3 commit 272b222

24 files changed

+278
-83
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ This repository houses open-source extensions, created for Umbraco Forms, that i
1010

1111
### Automation
1212

13-
[Zapier](./src/Umbraco.Forms.Integrations.Automation.Zapier) - a custom workflow allowing form entries to be mapped to the fields of a Zap tool trigger from Zapier.
13+
[Zapier](./src/Umbraco.Forms.Integrations.Automation.Zapier) - a dashboard interface that allows users to vizualize registered subscription hooks for their Umbraco Forms and to call Zapier triggers when a specific forms gets submitted.

azure-pipeline - Automation.Zapier.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
trigger:
22
- main
3+
- main-v10
34

45
pool:
56
vmImage: 'windows-latest'
@@ -45,6 +46,7 @@ steps:
4546
cd src/$(projectName)/
4647
umbpack pack .\package.xml -o $(Build.ArtifactStagingDirectory)
4748
cd ../../
49+
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
4850
- task: PublishBuildArtifacts@1
4951
displayName: 'Publish Build Artifacts'
5052
inputs:

azure-pipeline - Cms.OAuthProxy.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ steps:
5454
"name": "AppSettings:GoogleClientSecret",
5555
"value": "$(googleAppSecretKey)",
5656
"slotSetting": false
57+
},
58+
{
59+
"name": "AppSettings:DynamicsClientSecret",
60+
"value": "$(dynamicsAppSecretKey)",
61+
"slotSetting": false
5762
}
5863
]
5964
- task: AzureWebApp@1
@@ -88,5 +93,10 @@ steps:
8893
"name": "AppSettings:GoogleClientSecret",
8994
"value": "$(googleAppSecretKey)",
9095
"slotSetting": false
96+
},
97+
{
98+
"name": "AppSettings:DynamicsClientSecret",
99+
"value": "$(dynamicsAppSecretKey)",
100+
"slotSetting": false
91101
}
92102
]

azure-pipeline - Commerce.EMerchantPay.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
trigger:
2-
- feature/payment-provider-integration
2+
- main
33

44
pool:
55
vmImage: 'windows-latest'

azure-pipeline - Crm.Hubspot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
trigger:
22
- main
3+
- main-v10
34

45
pool:
56
vmImage: 'windows-latest'
@@ -59,6 +60,7 @@ steps:
5960
cd src/$(projectName)/
6061
umbpack pack .\package.xml -o $(Build.ArtifactStagingDirectory)
6162
cd ../../
63+
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
6264

6365
- task: PublishBuildArtifacts@1
6466
displayName: 'Publish Build Artifacts'

src/Umbraco.Cms.Integrations.OAuthProxy/Configuration/AppSettings.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ public class AppSettings
1212

1313
public string GoogleClientSecret { get; set; }
1414

15+
public string DynamicsClientSecret { get; set; }
16+
1517
public string this[string propertyName] => (string)GetType().GetProperty(propertyName)?.GetValue(this, null);
1618
}
1719
}

src/Umbraco.Cms.Integrations.OAuthProxy/Configuration/ServiceConfiguration.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ public static class ServiceConfiguration
1010
/// <summary>
1111
/// Integrated services with their token URIs
1212
/// </summary>
13-
public static Dictionary<string, string> ServiceProviders = new Dictionary<string, string>
13+
public static Dictionary<string, string> ServiceProviders = new()
1414
{
1515
{ "Hubspot", "oauth/v1/token" },
1616
{ "HubspotForms", "oauth/v1/token" },
1717
{ "Semrush", "oauth2/access_token" },
1818
{ "Shopify", "oauth/access_token" },
19-
{ "Google", "token"}
19+
{ "Google", "token"},
20+
{ "Dynamics", "oauth2/v2.0/token" }
2021
};
2122

2223
public static void AddServiceClients(this IServiceCollection services)
@@ -41,6 +42,10 @@ public static void AddServiceClients(this IServiceCollection services)
4142
{
4243
c.BaseAddress = new Uri("https://oauth2.googleapis.com/");
4344
});
45+
services.AddHttpClient("DynamicsToken", c =>
46+
{
47+
c.BaseAddress = new Uri("https://login.microsoftonline.com/common/");
48+
});
4449
}
4550
}
4651
}

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class NewFormSubmittedComposer : ComponentComposer<NewFormSubmittedCompon
1717

1818
public class NewFormSubmittedComponent : IComponent
1919
{
20-
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
20+
private readonly UmbUrlHelper _umbUrlHelper;
2121

2222
private readonly IRecordStorage _recordStorage;
2323

@@ -27,12 +27,14 @@ public class NewFormSubmittedComponent : IComponent
2727

2828
private readonly ILogger _logger;
2929

30-
public NewFormSubmittedComponent(IUmbracoContextAccessor umbracoContextAccessor, IRecordStorage recordStorage,
30+
public NewFormSubmittedComponent(
31+
UmbUrlHelper umbUrlHelper,
32+
IRecordStorage recordStorage,
3133
ZapierService zapierService,
3234
ZapierFormSubscriptionHookService zapierFormSubscriptionHookService,
3335
ILogger logger)
3436
{
35-
_umbracoContextAccessor = umbracoContextAccessor;
37+
_umbUrlHelper = umbUrlHelper;
3638

3739
_recordStorage = recordStorage;
3840

@@ -56,13 +58,9 @@ private void RecordStorage_RecordInserting(object sender, Core.RecordEventArgs e
5658
{
5759
var triggerHelper = new TriggerHelper(_zapierService);
5860

59-
UmbracoContext umbracoContext = _umbracoContextAccessor.UmbracoContext;
60-
var umbracoPageId = e.Record.UmbracoPageId;
61-
var pageUrl = umbracoContext.UrlProvider.GetUrl(umbracoPageId, UrlMode.Absolute);
62-
6361
if (_zapierFormSubscriptionHookService.TryGetById(e.Form.Id.ToString(), out var subscriptionHooks))
6462
{
65-
var content = e.Form.ToFormDictionary(e.Record, pageUrl);
63+
var content = e.Form.ToFormDictionary(e.Record, _umbUrlHelper.GetPageUrl(e.Record.UmbracoPageId));
6664

6765
foreach (var subscriptionHook in subscriptionHooks)
6866
{

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

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ namespace Umbraco.Forms.Integrations.Automation.Zapier.Components
1616
{
1717
public class NewFormSubmittedNotification : INotificationHandler<RecordCreatingNotification>
1818
{
19-
private readonly IUmbracoHelperAccessor _umbracoHelperAccessor;
20-
21-
private readonly IPublishedUrlProvider _publishedUrlProvider;
19+
private readonly UmbUrlHelper _umbUrlHelper;
2220

2321
private readonly IFormService _formService;
2422

@@ -29,15 +27,12 @@ public class NewFormSubmittedNotification : INotificationHandler<RecordCreatingN
2927
private readonly ILogger<NewFormSubmittedNotification> _logger;
3028

3129
public NewFormSubmittedNotification(
32-
IUmbracoHelperAccessor umbracoHelperAccessor,
33-
IPublishedUrlProvider publishedUrlProvider,
30+
UmbUrlHelper umbUrlHelper,
3431
IFormService formService,
3532
ZapierService zapierService, ZapierFormSubscriptionHookService zapierFormSubscriptionHookService,
3633
ILogger<NewFormSubmittedNotification> logger)
3734
{
38-
_umbracoHelperAccessor = umbracoHelperAccessor;
39-
40-
_publishedUrlProvider = publishedUrlProvider;
35+
_umbUrlHelper = umbUrlHelper;
4136

4237
_formService = formService;
4338

@@ -58,17 +53,7 @@ public void Handle(RecordCreatingNotification notification)
5853

5954
if (_zapierFormSubscriptionHookService.TryGetById(form.Id.ToString(), out var subscriptionHooks))
6055
{
61-
string pageUrl = string.Empty;
62-
if (_umbracoHelperAccessor.TryGetUmbracoHelper(out UmbracoHelper umbracoHelper))
63-
{
64-
IPublishedContent publishedContent = umbracoHelper.Content(notificationSavedEntity.UmbracoPageId);
65-
if (publishedContent != null)
66-
{
67-
pageUrl = publishedContent.Url(_publishedUrlProvider, mode: UrlMode.Absolute);
68-
}
69-
}
70-
71-
var content = form.ToFormDictionary(notificationSavedEntity, pageUrl);
56+
var content = form.ToFormDictionary(notificationSavedEntity, _umbUrlHelper.GetPageUrl(notificationSavedEntity.UmbracoPageId));
7257

7358
foreach (var subscriptionHook in subscriptionHooks)
7459
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public FormController(ZapierFormService zapierFormService, IUserValidationServic
3232

3333
public IEnumerable<FormDto> GetForms()
3434
{
35-
if (!IsUserValid()) return Enumerable.Empty<FormDto>();
35+
if (!IsAccessValid()) return Enumerable.Empty<FormDto>();
3636

3737
return _zapierFormService.GetAll();
3838
}

0 commit comments

Comments
 (0)