1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 07:36:14 -05:00

[PM-153] Extend Freshdesk integration (#2939)

* Move keys into FreshDeskSettings class

* Add configurable custom fields for user and org

In FreshDesk we currently use the custom fields `cf_user` and `cf_org`.

- For the US instance these will be set to those values.
- For the EU instance these will likely be configured to `cf_user_eu` and `cf_org_eu`

* Fix file encoding

* Add region to notes

* Use customizable org field value in condition check
This commit is contained in:
Daniel James Smith
2023-05-23 14:43:44 +02:00
committed by GitHub
parent a1fb847233
commit 09144ddb52
4 changed files with 34 additions and 11 deletions

View File

@ -19,6 +19,9 @@ public class FreshdeskControllerTests
private const string ApiKey = "TESTFRESHDESKAPIKEY";
private const string WebhookKey = "TESTKEY";
private const string UserFieldName = "cf_user";
private const string OrgFieldName = "cf_org";
[Theory]
[BitAutoData((string)null, null)]
[BitAutoData((string)null)]
@ -26,7 +29,7 @@ public class FreshdeskControllerTests
public async Task PostWebhook_NullRequiredParameters_BadRequest(string freshdeskWebhookKey, FreshdeskWebhookModel model,
BillingSettings billingSettings, SutProvider<FreshdeskController> sutProvider)
{
sutProvider.GetDependency<IOptions<BillingSettings>>().Value.FreshdeskWebhookKey.Returns(billingSettings.FreshdeskWebhookKey);
sutProvider.GetDependency<IOptions<BillingSettings>>().Value.FreshDesk.WebhookKey.Returns(billingSettings.FreshDesk.WebhookKey);
var response = await sutProvider.Sut.PostWebhook(freshdeskWebhookKey, model);
@ -52,8 +55,10 @@ public class FreshdeskControllerTests
sutProvider.GetDependency<IHttpClientFactory>().CreateClient("FreshdeskApi").Returns(httpClient);
sutProvider.GetDependency<IOptions<BillingSettings>>().Value.FreshdeskWebhookKey.Returns(WebhookKey);
sutProvider.GetDependency<IOptions<BillingSettings>>().Value.FreshdeskApiKey.Returns(ApiKey);
sutProvider.GetDependency<IOptions<BillingSettings>>().Value.FreshDesk.WebhookKey.Returns(WebhookKey);
sutProvider.GetDependency<IOptions<BillingSettings>>().Value.FreshDesk.ApiKey.Returns(ApiKey);
sutProvider.GetDependency<IOptions<BillingSettings>>().Value.FreshDesk.UserFieldName.Returns(UserFieldName);
sutProvider.GetDependency<IOptions<BillingSettings>>().Value.FreshDesk.OrgFieldName.Returns(OrgFieldName);
var response = await sutProvider.Sut.PostWebhook(WebhookKey, model);