New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AC-2471] Prevent calls to Stripe when unlinking client org has no Stripe objects #3999
[AC-2471] Prevent calls to Stripe when unlinking client org has no Stripe objects #3999
Conversation
New Issues
Fixed Issues
|
..._license/src/Commercial.Core/AdminConsole/Providers/RemoveOrganizationFromProviderCommand.cs
Outdated
Show resolved
Hide resolved
..._license/src/Commercial.Core/AdminConsole/Providers/RemoveOrganizationFromProviderCommand.cs
Outdated
Show resolved
Hide resolved
if (!string.IsNullOrEmpty(organization.GatewayCustomerId) && | ||
!string.IsNullOrEmpty(organization.GatewaySubscriptionId)) | ||
{ | ||
await _removePaymentMethodCommand.RemovePaymentMethod(organization); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be part of the command? Or are you trying to avoid calling a command from within a command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, originally I had RemoveOrganizationFromProviderCommand
invoke RemovePaymentMethodCommand
, but I was told not to do so when this was originally implemented.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3999 +/- ##
=======================================
Coverage 38.33% 38.33%
=======================================
Files 1209 1209
Lines 58686 58703 +17
Branches 5589 5594 +5
=======================================
+ Hits 22495 22503 +8
- Misses 35147 35156 +9
Partials 1044 1044 ☔ View full report in Codecov by Sentry. |
6003d10
@eliykat @cturnbull-bitwarden Thank you both for the reviews - had to resolve a conflict unfortunately. Would you both mind re-stamping whenever you have a chance? |
# Conflicts: # bitwarden_license/src/Commercial.Core/AdminConsole/Providers/RemoveOrganizationFromProviderCommand.cs # bitwarden_license/test/Commercial.Core.Test/AdminConsole/ProviderFeatures/RemoveOrganizationFromProviderCommandTests.cs
Type of change
Objective
In our
RemoveOrganizationFromProviderCommand
, we make calls to Stripe to update theCustomer
andSubscription
. However, client organizations in a sales-enabled trial do not have any associated Stripe objects, resulting in a cryptic error.This PR only invokes the Stripe API if both the
GatewayCustomerId
andGatewaySubscriptionId
are present on the client organization being unlinked.