Skip to content
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

[PM-19147] Automatic Tax Improvements #5510

Closed
wants to merge 9 commits into from
Closed

[PM-19147] Automatic Tax Improvements #5510

wants to merge 9 commits into from

Conversation

jonashendrickx
Copy link
Member

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-19147

📔 Objective

📸 Screenshots

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 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

Copy link
Contributor

github-actions bot commented Mar 17, 2025

Logo
Checkmarx One – Scan Summary & Detailsc087104c-8508-4cd9-8dad-8c7eccee55c2

Great job, no security vulnerabilities found in this Pull Request

@jonashendrickx jonashendrickx changed the title Pm 19147 [PM-19147] Automatic Tax Improvements Mar 17, 2025

ArgumentNullException.ThrowIfNull(options);

if (subscription.AutomaticTax.Enabled == ShouldEnable(subscription.Customer))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Is this part necessary? Seems like line 31 would handle everything correctly - setting in the case it should set and unsetting in the case it should unset.


public Task<SubscriptionUpdateOptions> GetUpdateOptionsAsync(Subscription subscription)
{
if (subscription.AutomaticTax.Enabled == ShouldEnable(subscription.Customer))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Same question here.

@@ -605,6 +602,8 @@ public async Task<Subscription> SetupSubscription(
ProrationBehavior = StripeConstants.ProrationBehavior.CreateProrations
};

await organizationAutomaticTaxStrategy.SetCreateOptionsAsync(subscriptionCreateOptions, customer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ It looks strange to me to be calling something named for organizations for providers. My suggestion is that we align your new tax strategies with our actual domain use cases:

  • PersonalUseTaxStrategy: Premium users and family organizations
  • BusinessUseTaxStrategy: Non-family organizations and providers

sub.Id == subscriber.GatewaySubscriptionId &&
!sub.AutomaticTax.Enabled) &&
customer.HasTaxLocationVerified())
customer.Subscriptions.Any(sub => sub.Id == subscriber.GatewaySubscriptionId))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⛏️ You can leave this change if you want, but this code path is no longer ever invoked. This is a byproduct of necessary cleanup I haven't gotten around to.

Copy link

codecov bot commented Mar 18, 2025

Codecov Report

Attention: Patch coverage is 17.21854% with 125 lines in your changes missing coverage. Please review.

Project coverage is 44.55%. Comparing base (0153d9d) to head (126af70).
Report is 20 commits behind head on main.

Files with missing lines Patch % Lines
...s/AutomaticTax/OrganizationAutomaticTaxStrategy.cs 7.93% 58 Missing ⚠️
...ons/AutomaticTax/IndividualAutomaticTaxStrategy.cs 0.00% 30 Missing ⚠️
...e/Services/Implementations/StripePaymentService.cs 0.00% 17 Missing ⚠️
...Services/Implementations/UpcomingInvoiceHandler.cs 0.00% 8 Missing ⚠️
...ling/Services/Implementations/SubscriberService.cs 53.84% 3 Missing and 3 partials ⚠️
.../Core/Billing/Extensions/SubscriptionExtensions.cs 0.00% 3 Missing ⚠️
src/Core/Billing/Extensions/CustomerExtensions.cs 0.00% 1 Missing ⚠️
...ices/Implementations/OrganizationBillingService.cs 66.66% 1 Missing ⚠️
...vices/Implementations/PremiumUserBillingService.cs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5510      +/-   ##
==========================================
+ Coverage   44.52%   44.55%   +0.03%     
==========================================
  Files        1538     1543       +5     
  Lines       70582    70615      +33     
  Branches     6316     6317       +1     
==========================================
+ Hits        31426    31463      +37     
+ Misses      37810    37807       -3     
+ Partials     1346     1345       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants