mirror of
https://github.com/bitwarden/server
synced 2025-12-13 14:53:34 +00:00
resolve stripe plan upgrade when payment fails (#4783)
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
This commit is contained in:
@@ -230,11 +230,21 @@ public class UpgradeOrganizationPlanCommand : IUpgradeOrganizationPlanCommand
|
|||||||
await _organizationBillingService.Finalize(sale);
|
await _organizationBillingService.Finalize(sale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
paymentIntentClientSecret = await _paymentService.UpgradeFreeOrganizationAsync(organization,
|
paymentIntentClientSecret = await _paymentService.UpgradeFreeOrganizationAsync(organization,
|
||||||
newPlan, upgrade);
|
newPlan, upgrade);
|
||||||
success = string.IsNullOrWhiteSpace(paymentIntentClientSecret);
|
success = string.IsNullOrWhiteSpace(paymentIntentClientSecret);
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
await _paymentService.CancelAndRecoverChargesAsync(organization);
|
||||||
|
organization.GatewayCustomerId = null;
|
||||||
|
await _organizationService.ReplaceAndUpdateCacheAsync(organization);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user