1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-25 13:18:48 -05:00

[PM 18208]Cancel self-serve trials with no payment method (#5916)

* cancel self-serve trials with no payment method

* Remove unnecessary code block

* Update the invoice create  for missing paymentMethod

* Remove the create_invoice implementation

* Remove empty spaces
This commit is contained in:
cyprain-okeke 2025-06-24 16:58:43 +01:00 committed by GitHub
parent 34580f0472
commit d33b0ce1cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -426,6 +426,19 @@ public class OrganizationBillingService(
TrialPeriodDays = subscriptionSetup.SkipTrial ? 0 : plan.TrialPeriodDays
};
// Only set trial_settings.end_behavior.missing_payment_method to "cancel" if there is no payment method
if (string.IsNullOrEmpty(customer.InvoiceSettings?.DefaultPaymentMethodId) &&
!customer.Metadata.ContainsKey(BraintreeCustomerIdKey))
{
subscriptionCreateOptions.TrialSettings = new SubscriptionTrialSettingsOptions
{
EndBehavior = new SubscriptionTrialSettingsEndBehaviorOptions
{
MissingPaymentMethod = "cancel"
}
};
}
var setNonUSBusinessUseToReverseCharge =
featureService.IsEnabled(FeatureFlagKeys.PM21092_SetNonUSBusinessUseToReverseCharge);