Skip to content

Commit

Permalink
Merge branch 'master' into sm/sm-891
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-Avery authored Oct 16, 2023
2 parents ac557d9 + eec2763 commit 009baf9
Show file tree
Hide file tree
Showing 48 changed files with 2,843 additions and 558 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
version: ${{ github.event.inputs.version_number }}
file_path: "Directory.Build.props"

- name: Refresh lockfiles
run: dotnet restore -f --force-evaluate --no-cache

- name: Setup git
run: |
git config --local user.email "[email protected]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ public async Task AddOrganization(Guid providerId, Guid organizationId, string k
var organization = await _organizationRepository.GetByIdAsync(organizationId);
ThrowOnInvalidPlanType(organization.PlanType);

if (organization.UseSecretsManager)
{
throw new BadRequestException(
"The organization is subscribed to Secrets Manager. Please contact Customer Support to manage the subscription.");
}

var providerOrganization = new ProviderOrganization
{
ProviderId = providerId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,23 @@ public async Task AddOrganization_OrganizationAlreadyBelongsToAProvider_Throws(P
Assert.Equal("Organization already belongs to a provider.", exception.Message);
}

[Theory, BitAutoData]
public async Task AddOrganization_OrganizationHasSecretsManager_Throws(Provider provider, Organization organization, string key,
SutProvider<ProviderService> sutProvider)
{
organization.PlanType = PlanType.EnterpriseAnnually;
organization.UseSecretsManager = true;

sutProvider.GetDependency<IProviderRepository>().GetByIdAsync(provider.Id).Returns(provider);
var providerOrganizationRepository = sutProvider.GetDependency<IProviderOrganizationRepository>();
providerOrganizationRepository.GetByOrganizationId(organization.Id).ReturnsNull();
sutProvider.GetDependency<IOrganizationRepository>().GetByIdAsync(organization.Id).Returns(organization);

var exception = await Assert.ThrowsAsync<BadRequestException>(
() => sutProvider.Sut.AddOrganization(provider.Id, organization.Id, key));
Assert.Equal("The organization is subscribed to Secrets Manager. Please contact Customer Support to manage the subscription.", exception.Message);
}

[Theory, BitAutoData]
public async Task AddOrganization_Success(Provider provider, Organization organization, string key,
SutProvider<ProviderService> sutProvider)
Expand Down
1 change: 1 addition & 0 deletions src/Billing/Constants/HandledStripeWebhook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ public static class HandledStripeWebhook
public const string PaymentFailed = "invoice.payment_failed";
public const string InvoiceCreated = "invoice.created";
public const string PaymentMethodAttached = "payment_method.attached";
public const string CustomerUpdated = "customer.updated";
}
Loading

0 comments on commit 009baf9

Please sign in to comment.