-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[PM 18208]Cancel self-serve trials with no payment method #5916
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 8000 send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[PM 18208]Cancel self-serve trials with no payment method #5916
Conversation
Great job, no security vulnerabilities found in this Pull Request |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5916 +/- ##
==========================================
- Coverage 50.95% 47.61% -3.35%
==========================================
Files 1665 1665
Lines 75106 75112 +6
Branches 6768 6769 +1
==========================================
- Hits 38274 35768 -2506
- Misses 35316 37889 +2573
+ Partials 1516 1455 -61 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@@ -417,6 +417,18 @@ private async Task<Subscription> CreateSubscriptionAsync( | |||
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)) |
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.
Is PayPal a valid payment method for this scenario? If so, this would not catch a PayPal customer.
@@ -76,6 +76,25 @@ public async Task Credit(User user, decimal amount) | |||
}; | |||
|
|||
await stripeAdapter.CustomerUpdateAsync(customer.Id, options); | |||
|
|||
// If the user has a subscription in trial, update the trial settings | |||
if (!string.IsNullOrEmpty(user.GatewaySubscriptionId)) |
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.
❓ Isn't create_invoice
the default setting for this switch? You can verify this by creating a subscription against main
and checking the trial_settings
. If so, this block of code is unnecessary.
|
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-18208
📔 Objective
Acceptance criteria
GIVEN: a free trial is being created without a payment method (applies to PM/SM, Families, Teams, and Enterprise)
THEN: trial_settings.end_behavior.missing_payment_method should be set to cancel
GIVEN: ALL the following
a subscription is in a trialing status
the trial_settings.end_behavior.missing_payment_method is set to cancel
WHEN: account credit is added (any amount)
THEN: update trial_settings.end_behavior.missing_payment_method to create-invoice
Description
The finance and billing teams have requested that the following changes be made to how we handle payment optional trials in order to better align with accounting best practices.
📸 Screenshots
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes