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

Updated customer metadata to only store one old btCustomerId #4997

Merged
merged 5 commits into from
Nov 19, 2024

Conversation

cturnbull-bitwarden
Copy link
Contributor

🎟️ Tracking

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

📔 Objective

Previously, we would store older braintree customers using the Stripe customer metadata field key of $"btCustomerId_{Utilities.CoreHelpers.ToEpocSeconds(DateTime.UtcNow)}". This led to some customers with a lot of metadata records, which would slow down our reporting ChartMogul software. This PR addresses this by limiting the number of older braintree customers retained to 1.

📸 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 Nov 7, 2024

Logo
Checkmarx One – Scan Summary & Details11ceda4f-89d9-4137-8b16-9d02ddd7b188

Fixed Issues

Severity Issue Source File / Package
MEDIUM CSRF /src/Api/AdminConsole/Controllers/PoliciesController.cs: 68
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 106
MEDIUM CSRF /src/Api/AdminConsole/Controllers/GroupsController.cs: 81
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 238
MEDIUM CSRF /src/Api/AdminConsole/Controllers/GroupsController.cs: 81
MEDIUM CSRF /src/Api/AdminConsole/Controllers/GroupsController.cs: 131
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationsController.cs: 122
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 362
MEDIUM CSRF /src/Api/AdminConsole/Controllers/PoliciesController.cs: 89
MEDIUM CSRF /src/Api/AdminConsole/Controllers/PoliciesController.cs: 159
MEDIUM CSRF /src/Api/AdminConsole/Public/Controllers/PoliciesController.cs: 42
MEDIUM CSRF /src/Api/AdminConsole/Public/Controllers/PoliciesController.cs: 61
MEDIUM CSRF /src/Admin/AdminConsole/Controllers/OrganizationsController.cs: 372
LOW Log_Forging /src/Api/AdminConsole/Controllers/ProvidersController.cs: 72
LOW Log_Forging /src/Api/AdminConsole/Controllers/ProvidersController.cs: 72
LOW Log_Forging /src/Api/AdminConsole/Controllers/ProvidersController.cs: 72
LOW Log_Forging /src/Api/Auth/Controllers/EmergencyAccessController.cs: 102

Copy link

codecov bot commented Nov 7, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 42.67%. Comparing base (df21d57) to head (104879d).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...e/Services/Implementations/StripePaymentService.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4997   +/-   ##
=======================================
  Coverage   42.66%   42.67%           
=======================================
  Files        1411     1411           
  Lines       65087    65087           
  Branches     5959     5959           
=======================================
+ Hits        27772    27773    +1     
+ Misses      36075    36074    -1     
  Partials     1240     1240           

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


🚨 Try these New Features:

@cturnbull-bitwarden cturnbull-bitwarden merged commit 44bf561 into main Nov 19, 2024
52 checks passed
@cturnbull-bitwarden cturnbull-bitwarden deleted the billing/PM-14610/btcustomerid branch November 19, 2024 16:38
vgrassia pushed a commit to vgrassia/server that referenced this pull request Nov 21, 2024
…en#4997)

* Updated customer metadata to only store one old btCustomerId

* Updated to include case where old key already exists

* Updated SubscriberService to also save btCustomerId_old on the Stripe Customer's metadata

---------

Co-authored-by: Matt Bishop <[email protected]>
vgrassia pushed a commit to vgrassia/server that referenced this pull request Nov 21, 2024
…en#4997)

* Updated customer metadata to only store one old btCustomerId

* Updated to include case where old key already exists

* Updated SubscriberService to also save btCustomerId_old on the Stripe Customer's metadata

---------

Co-authored-by: Matt Bishop <[email protected]>
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.

4 participants