Skip to content

[PM-13717] Fix legacy credit rebate for migrated MSPs#4906

Merged
amorask-bitwarden merged 3 commits intomainfrom
billing/PM-13717/cb-migration-legacy-credit-defect
Oct 21, 2024
Merged

[PM-13717] Fix legacy credit rebate for migrated MSPs#4906
amorask-bitwarden merged 3 commits intomainfrom
billing/PM-13717/cb-migration-legacy-credit-defect

Conversation

@amorask-bitwarden
Copy link
Copy Markdown
Contributor

🎟️ Tracking

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

📔 Objective

This PR fixes 2 issues:

  1. Legacy credit rebates were originally not working because they were checking the migrating organization's plan type. However, by the time we're applying credit, the organization has already had their plan type changed to one of the Consolidated Billing-supported types in order for the organization to work in the platform. As such, I had to use the organization's migration record to determine their legacy rebate.
  2. The credit for the organization's cancellation proration and legacy rebate were being applied in the same request. I broke those up into two different requests and added a description to the credit application so it's easier for CS to track.

📸 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

@amorask-bitwarden amorask-bitwarden requested a review from a team as a code owner October 16, 2024 17:07
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 16, 2024

Codecov Report

Attention: Patch coverage is 4.00000% with 24 lines in your changes missing coverage. Please review.

Project coverage is 41.78%. Comparing base (c809794) to head (01743ad).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ation/Services/Implementations/ProviderMigrator.cs 0.00% 23 Missing ⚠️
src/Core/Services/Implementations/StripeAdapter.cs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4906      +/-   ##
==========================================
- Coverage   41.79%   41.78%   -0.01%     
==========================================
  Files        1364     1364              
  Lines       64003    64018      +15     
  Branches     5871     5872       +1     
==========================================
+ Hits        26751    26752       +1     
- Misses      36048    36062      +14     
  Partials     1204     1204              

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 16, 2024

Logo
Checkmarx One – Scan Summary & Details0e8affc5-8fa0-4baf-8397-1da21563b705

New Issues

Severity Issue Source File / Package Checkmarx Insight
HIGH Passwords And Secrets - Generic Password /test-database.yml: 104 Query to find passwords and secrets in infrastructure code.
HIGH Passwords And Secrets - Generic Password /test-database.yml: 181 Query to find passwords and secrets in infrastructure code.
HIGH Passwords And Secrets - Generic Password /test-database.yml: 79 Query to find passwords and secrets in infrastructure code.
HIGH Passwords And Secrets - Generic Password /test-database.yml: 188 Query to find passwords and secrets in infrastructure code.
HIGH Passwords And Secrets - Generic Password /test-database.yml: 68 Query to find passwords and secrets in infrastructure code.
HIGH Passwords And Secrets - Generic Password /test-database.yml: 110 Query to find passwords and secrets in infrastructure code.
HIGH Passwords And Secrets - Generic Password /test-database.yml: 184 Query to find passwords and secrets in infrastructure code.
HIGH Passwords And Secrets - Generic Password /test-database.yml: 91 Query to find passwords and secrets in infrastructure code.
MEDIUM Privacy_Violation /src/Api/Vault/Models/Request/CipherRequestModel.cs: 169 Attack Vector
MEDIUM Privacy_Violation /src/Api/Vault/Models/Request/CipherRequestModel.cs: 198 Attack Vector
MEDIUM Unpinned Actions Full Length Commit SHA /_move_finalization_db_scripts.yml: 26 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...
MEDIUM Unpinned Actions Full Length Commit SHA /build.yml: 630 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...
MEDIUM Unpinned Actions Full Length Commit SHA /cleanup-rc-branch.yml: 20 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...
MEDIUM Unpinned Actions Full Length Commit SHA /build.yml: 581 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...
MEDIUM Unpinned Actions Full Length Commit SHA /build.yml: 514 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...
MEDIUM Unpinned Actions Full Length Commit SHA /build.yml: 206 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...
MEDIUM Unpinned Actions Full Length Commit SHA /build.yml: 547 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...
MEDIUM Unpinned Actions Full Length Commit SHA /_move_finalization_db_scripts.yml: 102 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...
LOW Log_Forging /src/Api/Vault/Controllers/CiphersController.cs: 217 Attack Vector
LOW Unpinned Actions Full Length Commit SHA /build.yml: 514 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...
LOW Unpinned Actions Full Length Commit SHA /_move_finalization_db_scripts.yml: 102 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...
LOW Unpinned Actions Full Length Commit SHA /cleanup-rc-branch.yml: 20 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...
LOW Unpinned Actions Full Length Commit SHA /_move_finalization_db_scripts.yml: 26 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...
LOW Unpinned Actions Full Length Commit SHA /build.yml: 630 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...
LOW Unpinned Actions Full Length Commit SHA /build.yml: 206 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...
LOW Unpinned Actions Full Length Commit SHA /build.yml: 581 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...
LOW Unpinned Actions Full Length Commit SHA /build.yml: 547 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
HIGH Passwords And Secrets - Generic Password /test-database.yml: 111
HIGH Passwords And Secrets - Generic Password /test-database.yml: 182
HIGH Passwords And Secrets - Generic Password /test-database.yml: 105
HIGH Passwords And Secrets - Generic Password /test-database.yml: 69
HIGH Passwords And Secrets - Generic Password /test-database.yml: 185
HIGH Passwords And Secrets - Generic Password /test-database.yml: 92
HIGH Passwords And Secrets - Generic Password /test-database.yml: 80
HIGH Passwords And Secrets - Generic Password /test-database.yml: 189
MEDIUM CSRF /src/Api/Billing/Controllers/OrganizationsController.cs: 49
MEDIUM CSRF /src/Billing/Controllers/RecoveryController.cs: 38
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 121
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 107
MEDIUM CSRF /src/Billing/Controllers/StripeController.cs: 164
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 664
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 936
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 121
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 455
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 107
MEDIUM Unpinned Actions Full Length Commit SHA /build.yml: 207
MEDIUM Unpinned Actions Full Length Commit SHA /build.yml: 515
MEDIUM Unpinned Actions Full Length Commit SHA /build.yml: 548
MEDIUM Unpinned Actions Full Length Commit SHA /cleanup-rc-branch.yml: 21
MEDIUM Unpinned Actions Full Length Commit SHA /build.yml: 582
MEDIUM Unpinned Actions Full Length Commit SHA /build.yml: 631
MEDIUM Unpinned Actions Full Length Commit SHA /_move_finalization_db_scripts.yml: 27
MEDIUM Unpinned Actions Full Length Commit SHA /_move_finalization_db_scripts.yml: 103
LOW Unpinned Actions Full Length Commit SHA /build.yml: 515
LOW Unpinned Actions Full Length Commit SHA /build.yml: 548
LOW Unpinned Actions Full Length Commit SHA /build.yml: 582
LOW Unpinned Actions Full Length Commit SHA /build.yml: 631

@amorask-bitwarden amorask-bitwarden merged commit 5d15750 into main Oct 21, 2024
@amorask-bitwarden amorask-bitwarden deleted the billing/PM-13717/cb-migration-legacy-credit-defect branch October 21, 2024 12:54
cyprain-okeke pushed a commit that referenced this pull request Oct 30, 2024
* Fix legacy credit rebate for migrated MSPs

* Run dotnet format
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.

3 participants