mirror of
https://github.com/bitwarden/server.git
synced 2025-07-07 10:55:43 -05:00
Resolve RisksSubscriptionFailure bugs (#3790)
This commit is contained in:
@ -133,6 +133,7 @@ public static class FeatureFlagKeys
|
||||
public const string PM5766AutomaticTax = "PM-5766-automatic-tax";
|
||||
public const string PM5864DollarThreshold = "PM-5864-dollar-threshold";
|
||||
public const string AC2101UpdateTrialInitiationEmail = "AC-2101-update-trial-initiation-email";
|
||||
public const string ShowPaymentMethodWarningBanners = "show-payment-method-warning-banners";
|
||||
|
||||
public static List<string> GetAllKeys()
|
||||
{
|
||||
|
@ -42,6 +42,7 @@ public class SubscriptionInfo
|
||||
{
|
||||
Items = sub.Items.Data.Select(i => new BillingSubscriptionItem(i));
|
||||
}
|
||||
CollectionMethod = sub.CollectionMethod;
|
||||
}
|
||||
|
||||
public DateTime? TrialStartDate { get; set; }
|
||||
@ -54,6 +55,7 @@ public class SubscriptionInfo
|
||||
public string Status { get; set; }
|
||||
public bool Cancelled { get; set; }
|
||||
public IEnumerable<BillingSubscriptionItem> Items { get; set; } = new List<BillingSubscriptionItem>();
|
||||
public string CollectionMethod { get; set; }
|
||||
|
||||
public class BillingSubscriptionItem
|
||||
{
|
||||
|
@ -1738,13 +1738,17 @@ public class StripePaymentService : IPaymentService
|
||||
{
|
||||
var subscriptionInfo = await GetSubscriptionAsync(organization);
|
||||
|
||||
if (subscriptionInfo.Subscription is not { Status: "active" or "trialing" or "past_due" } ||
|
||||
subscriptionInfo.UpcomingInvoice == null)
|
||||
if (subscriptionInfo.Subscription is not
|
||||
{
|
||||
Status: "active" or "trialing" or "past_due",
|
||||
CollectionMethod: "charge_automatically"
|
||||
}
|
||||
|| subscriptionInfo.UpcomingInvoice == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var customer = await GetCustomerAsync(organization.GatewayCustomerId);
|
||||
var customer = await GetCustomerAsync(organization.GatewayCustomerId, GetCustomerPaymentOptions());
|
||||
|
||||
var paymentSource = await GetBillingPaymentSourceAsync(customer);
|
||||
|
||||
|
Reference in New Issue
Block a user