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-11525] Tax calculation shown to customers potentially incorrect #4874

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jonashendrickx
Copy link
Member

🎟️ Tracking

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

📔 Objective

This value is calculated using our exiting TaxRate records that we store in our own database and are managed via the Bitwarden Admin Portal. However, after we transitioned to using Stripe Tax for automatic tax calculations, there’s a likelihood that this “Estimated tax” value will be incorrect because whatever value we have saved could be different from the value Stripe calculates on the fly for the same zip code.

📸 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

@jonashendrickx jonashendrickx requested a review from a team as a code owner October 10, 2024 07:55
Copy link

codecov bot commented Oct 10, 2024

Codecov Report

Attention: Patch coverage is 2.04082% with 48 lines in your changes missing coverage. Please review.

Project coverage is 41.64%. Comparing base (d4c486e) to head (58cf8b1).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/Api/Billing/Controllers/StripeController.cs 0.00% 38 Missing ⚠️
...ling/Models/Responses/CalculateTaxResponseModel.cs 0.00% 4 Missing ⚠️
...illing/Models/Requests/CalculateTaxRequestModel.cs 0.00% 3 Missing ⚠️
src/Core/Services/Implementations/StripeAdapter.cs 25.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4874      +/-   ##
==========================================
- Coverage   41.66%   41.64%   -0.02%     
==========================================
  Files        1360     1363       +3     
  Lines       63888    63950      +62     
  Branches     5862     5863       +1     
==========================================
+ Hits        26620    26634      +14     
- Misses      36061    36109      +48     
  Partials     1207     1207              

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

Copy link
Contributor

github-actions bot commented Oct 10, 2024

Logo
Checkmarx One – Scan Summary & Details6b11b94c-851c-4341-b8dd-376629e7fca3

New Issues

Severity Issue Source File / Package Checkmarx Insight
LOW Unpinned Actions Full Length Commit SHA /build.yml: 598 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...

Fixed Issues

Severity Issue Source File / Package
LOW Unpinned Actions Full Length Commit SHA /build.yml: 582
LOW Unpinned Actions Full Length Commit SHA /build.yml: 631

Copy link
Contributor

@cyprain-okeke cyprain-okeke left a comment

Choose a reason for hiding this comment

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

Looks good, Please attach the recording

@jonashendrickx
Copy link
Member Author

Looks good, Please attach the recording

@cyprain-okeke This is just the backend part though.

Request

{
    "amount": 100,
    "billingAddressCountry": "ES",
    "billingAddressPostalCode": "30709"
}

Response

{
    "salesTaxAmount": 0,
    "salesTaxRate": 0.0,
    "taxableAmount": 100,
    "totalAmount": 100
}

For New York:

Response

{
    "salesTaxAmount": 8,
    "salesTaxRate": 0.08,
    "taxableAmount": 100,
    "totalAmount": 108
}

Copy link
Contributor

@amorask-bitwarden amorask-bitwarden left a comment

Choose a reason for hiding this comment

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

Looks good - just a few requests.

src/Api/Billing/Controllers/TaxController.cs Outdated Show resolved Hide resolved
},
LineItems = new()
{
new()
Copy link
Member Author

Choose a reason for hiding this comment

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

If it gets more complex we need to calculate this with the product identifier from Stripe if we use different tax codes per product.

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

Successfully merging this pull request may close these issues.

3 participants