1
0
mirror of https://github.com/bitwarden/server synced 2025-12-24 20:23:21 +00:00

[PM-27117] Sync Stripe Customer details for Organizations and Providers in API & Admin (#6679)

* Sync Stripe customer details for Provider / Organization in API & Admin

* Remove unnecessary var

* Fix logical operator

* Remove customer ID check from callers

* Fix failing tests

* Missed conflicts
This commit is contained in:
Alex Morask
2025-12-16 07:59:05 -06:00
committed by GitHub
parent 2ecd6c8d5f
commit 39a6719361
11 changed files with 377 additions and 34 deletions

View File

@@ -30,7 +30,7 @@ public class OrganizationUpdateCommandTests
var organizationBillingService = sutProvider.GetDependency<IOrganizationBillingService>();
organization.Id = organizationId;
organization.GatewayCustomerId = null; // No Stripe customer, so no billing update
organization.GatewayCustomerId = null; // No Stripe customer, but billing update is still called
organizationRepository
.GetByIdAsync(organizationId)
@@ -61,8 +61,8 @@ public class OrganizationUpdateCommandTests
result,
EventType.Organization_Updated);
await organizationBillingService
.DidNotReceiveWithAnyArgs()
.UpdateOrganizationNameAndEmail(Arg.Any<Organization>());
.Received(1)
.UpdateOrganizationNameAndEmail(result);
}
[Theory, BitAutoData]
@@ -93,7 +93,7 @@ public class OrganizationUpdateCommandTests
[Theory]
[BitAutoData("")]
[BitAutoData((string)null)]
public async Task UpdateAsync_WhenGatewayCustomerIdIsNullOrEmpty_SkipsBillingUpdate(
public async Task UpdateAsync_WhenGatewayCustomerIdIsNullOrEmpty_CallsBillingUpdateButHandledGracefully(
string gatewayCustomerId,
Guid organizationId,
Organization organization,
@@ -133,8 +133,8 @@ public class OrganizationUpdateCommandTests
result,
EventType.Organization_Updated);
await organizationBillingService
.DidNotReceiveWithAnyArgs()
.UpdateOrganizationNameAndEmail(Arg.Any<Organization>());
.Received(1)
.UpdateOrganizationNameAndEmail(result);
}
[Theory, BitAutoData]