Skip to content

Commit

Permalink
Fix Org service StripeOptions injection
Browse files Browse the repository at this point in the history
  • Loading branch information
ejsmith committed Feb 13, 2024
1 parent 84efc2f commit 5ac9d15
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/Exceptionless.Core/Services/OrganizationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ public class OrganizationService : IStartupAction
private readonly IUserRepository _userRepository;
private readonly IWebHookRepository _webHookRepository;
private readonly ICacheClient _cache;
private readonly StripeOptions _stripeOptions;
private readonly AppOptions _appOptions;
private readonly UsageService _usageService;
private readonly ILogger _logger;

public OrganizationService(IOrganizationRepository organizationRepository, ITokenRepository tokenRepository, IUserRepository userRepository, IWebHookRepository webHookRepository, ICacheClient cache, StripeOptions stripeOptions, UsageService usageService, ILoggerFactory loggerFactory)
public OrganizationService(IOrganizationRepository organizationRepository, ITokenRepository tokenRepository, IUserRepository userRepository, IWebHookRepository webHookRepository, ICacheClient cache, AppOptions appOptions, UsageService usageService, ILoggerFactory loggerFactory)
{
_organizationRepository = organizationRepository;
_tokenRepository = tokenRepository;
_userRepository = userRepository;
_webHookRepository = webHookRepository;
_cache = cache;
_stripeOptions = stripeOptions;
_appOptions = appOptions;
_usageService = usageService;
_logger = loggerFactory.CreateLogger<OrganizationService>();
}
Expand Down Expand Up @@ -61,7 +61,7 @@ public async Task CancelSubscriptionsAsync(Organization organization)
if (String.IsNullOrEmpty(organization.StripeCustomerId))
return;

var client = new StripeClient(_stripeOptions.StripeApiKey);
var client = new StripeClient(_appOptions.StripeOptions.StripeApiKey);
var subscriptionService = new SubscriptionService(client);
var subscriptions = await subscriptionService.ListAsync(new SubscriptionListOptions { Customer = organization.StripeCustomerId }).AnyContext();
foreach (var subscription in subscriptions.Where(s => !s.CanceledAt.HasValue))
Expand Down
6 changes: 3 additions & 3 deletions tests/Exceptionless.Tests/TestWithServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
using Foundatio.Utility;
using Foundatio.Xunit;
using Xunit.Abstractions;
using IAsyncLifetime = Foundatio.Utility.IAsyncLifetime;
using IAsyncLifetime = Xunit.IAsyncLifetime;

namespace Exceptionless.Tests;

Expand Down Expand Up @@ -71,9 +71,9 @@ private IServiceProvider CreateContainer()
return services.BuildServiceProvider();
}

public ValueTask DisposeAsync()
public Task DisposeAsync()
{
_testSystemClock.Dispose();
return new ValueTask(Task.CompletedTask);
return Task.CompletedTask;
}
}

0 comments on commit 5ac9d15

Please sign in to comment.