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

[AC-1486] Feature: SM Billing Round 1 #5747

Merged
merged 18 commits into from
Jul 24, 2023
Merged

[AC-1486] Feature: SM Billing Round 1 #5747

merged 18 commits into from
Jul 24, 2023

Conversation

vvolkgang
Copy link
Member

@vvolkgang vvolkgang commented Jul 5, 2023

Type of change

- [ ] Bug fix
- [x] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

Long-lived feature branch to support billing for Secrets Manager.

Requires server PR: bitwarden/server#3073

Screenshots

Before you submit

  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team
  • Ensure that all UI additions follow WCAG AA requirements

shane-melton and others added 7 commits June 23, 2023 09:17
* [AC-1423] Add ProgressModule to shared.module.ts

* [AC-1423] Update cloud subscription page styles

- Remove bootstrap styles
- Use CL components where applicable
- Use CL typography directives
- Update heading levels to prepare for new SM sections

* [AC-1423] Add usePasswordManager boolean to organization domain

* [AC-1423] Introduce BitwardenProductType enum

* [AC-1423] Update Organization subscription line items

- Add product type prefix
- Indent addon services like additional storage and service accounts
- Show line items for free plans

* [AC-1423] Simply sort function

* [AC-1423] Remove header border

* [AC-1423] Make "Password Manager" the default fallback for product name
* [AC-1423] Add minWidth input to bit-progress component

* [AC-1423] Add ProgressModule to shared.module.ts

* [AC-1423] Update cloud subscription page styles

- Remove bootstrap styles
- Use CL components where applicable
- Use CL typography directives
- Update heading levels to prepare for new SM sections

* [AC-1423] Add usePasswordManager boolean to organization domain

* [AC-1423] Introduce BitwardenProductType enum

* [AC-1423] Update Organization subscription line items

- Add product type prefix
- Indent addon services like additional storage and service accounts
- Show line items for free plans

* [AC-1423] Simply sort function

* [AC-1423] Remove header border

* [AC-1423] Remove redundant condition

* [AC-1423] Remove ineffective div

* [AC-1423] Make "Password Manager" the default fallback for product name

* Revert "[AC-1423] Add minWidth input to bit-progress component"

This reverts commit 95b2223.

* [AC-1423] Remove minWidth attribute

* [AC-1423] Switch to AddonProductType enum instead of boolean

* Revert "[AC-1423] Switch to AddonProductType enum instead of boolean"

This reverts commit 204f64b.

* [AC-1423] Tweak sorting comment

* [AC-1418] Add initial SecretsManagerAdjustSubscription component

* [AC-1418] Add initial SM adjustment form

* [AC-1418] Adjust organization-subscription-update.request.ts to support both PM and SM

* [AC-1418] Rename service account fields in the options interface

* [AC-1418] Add api service call to update SM subscription

* [AC-1418] Cleanup form html

* [AC-1418] Add missing SM plan properties

* [AC-1418] Add SM subscription adjust form and logic to hide it

* [AC-1418] Add better docs to options interface

* [AC-1418] Fix conflicting required/optional labels for auto-scaling limits

* [AC-1418] Adjust labels and appearance to better match design

* [AC-1418] Use the SM plan for billing interval

* [AC-1418] Hide SM billing adjustment component behind feature flag

* [AC-1418] Update request model to match server

* [AC-1418] Cleanup BitwardenProductType after merge

Add to barrel file and update applicable imports.

* [AC-1418] Revert change to update PM subscription request model

* [AC-1418] Add new update SM subscription request model

* [AC-1418] Add new service method to update SM subscription

* [AC-1418] Use new model and service method

* [AC-1418] Cleanup SM subscription UI flags

* [AC-1418] Move SM adjust subscription component into SM billing module

* [AC-1418] Update SM seat count minimum to 1

* [AC-1418] Add missing currency codes

* [AC-1418] Simplify monthly price calculation

* [AC-1418] Increase PM adjust subscription form input width

* [AC-1418] Add check for null subscription

---------

Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
@vvolkgang vvolkgang changed the title Feature: SM Billing [AC-1486] Feature: SM Billing Jul 5, 2023
@bitwarden-bot
Copy link

bitwarden-bot commented Jul 10, 2023

Logo
Checkmarx One – Scan Summary & Detailsc1b900e1-5b73-4aea-8165-1fb39f8ac8a5

No New Or Fixed Issues Found

eliykat and others added 3 commits July 11, 2023 20:01
#5784)

* Allow autoscale limits to be removed, update naming

* Display additional service accounts only

---------

Co-authored-by: Shane Melton <smelton@bitwarden.com>
@vvolkgang vvolkgang changed the title [AC-1486] Feature: SM Billing [AC-1486] Feature: SM Billing Round 1 Jul 11, 2023
@eliykat eliykat marked this pull request as ready for review July 12, 2023 00:28
@eliykat eliykat requested review from a team as code owners July 12, 2023 00:28
Hinton
Hinton previously approved these changes Jul 12, 2023
Copy link
Member

@Hinton Hinton left a comment

Choose a reason for hiding this comment

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

Platform changes looks good. Some confusion around how the billing portions are implemented. In some places we reference a SM plan, but not in create or update? And plans seems to be a union between PM and SM.

@@ -62,6 +63,8 @@ export class BillingSubscriptionItemResponse extends BaseResponse {
quantity: number;
interval: string;
sponsoredSubscriptionItem: boolean;
addonSubscriptionItem: boolean;
bitwardenProduct: BitwardenProductType;
Copy link
Member

Choose a reason for hiding this comment

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

Reason we prefix this with bitwarden?

Copy link
Member

Choose a reason for hiding this comment

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

We already have a ProductType enum, which is basically the same as the PlanType but without any reference to monthly/annually billing cycle or the year:

export enum ProductType {
  Free = 0,
  Families = 1,
  Teams = 2,
  Enterprise = 3,
}

We might be able to reduce the duplication between PlanType/ProductType (which in turn would reduce this confusion) when we refactor plans.

Comment on lines +53 to +59
additionalPricePerServiceAccount: number;
baseServiceAccount: number;
maxServiceAccount: number;
hasAdditionalServiceAccountOption: boolean;
maxProjects: number;
maxAdditionalServiceAccounts: number;
stripeServiceAccountPlanId: string;
Copy link
Member

Choose a reason for hiding this comment

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

I would kind of have expected there to be two plan models, one for PM and another for SM. That both extends a common model?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, the plan models are the biggest thing we need to refactor post GA. I actually think there should be 1 plan object per subscription level (e.g. teams/enterprise/families/free) showing what features and products that subscription level supports. Given that an org can only ever have 1 subscription level. Happy to discuss further if you like, but in any case this is top of my list for followup.

@@ -27,6 +28,11 @@ export class OrganizationResponse extends BaseResponse {
useResetPassword: boolean;
useSecretsManager: boolean;
hasPublicAndPrivateKeys: boolean;
usePasswordManager: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this if we have the plan from which we can deduct that they use pm? (Same for useSecretsManager)

Copy link
Member

Choose a reason for hiding this comment

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

The plan object shows what the plan supports (in general, e.g. enterprise plans support different features to teams plans), not what this particular organization is using.

@github-actions github-actions bot temporarily deployed to Web Vault - QA July 14, 2023 12:45 Inactive
@github-actions github-actions bot temporarily deployed to Web Vault - QA July 14, 2023 21:18 Inactive
@github-actions github-actions bot temporarily deployed to Web Vault - QA July 17, 2023 15:00 Inactive
@github-actions github-actions bot temporarily deployed to Web Vault - QA July 17, 2023 17:01 Inactive
…tab (#5848)

Also:

* Fix spacing in layout

* Send zero values for free plans
@github-actions github-actions bot temporarily deployed to Web Vault - QA July 20, 2023 11:26 Inactive
Copy link
Member

@eliykat eliykat left a comment

Choose a reason for hiding this comment

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

Approved in principle, but I've done some of this work so I will ask for a final review and merge from either @cyprain-okeke or @r-tome.

✅ each commit is approved in a separate PR or has otherwise been reviewed & approved now
✅ list of change files does not show any unexpected changes

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 Great

@eliykat eliykat enabled auto-merge (squash) July 24, 2023 22:34
@@ -0,0 +1,4 @@
export enum BitwardenProductType {
Copy link
Member

Choose a reason for hiding this comment

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

ProductType is an existing enum that defines free, teams, enterprise, etc.

Can we rename this to BitwardenProduct? Type really isn't adding anything to this name anyway.

Copy link
Member

Choose a reason for hiding this comment

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

yay for docs! boo that we lose our inline properties

@eliykat eliykat merged commit 34533f6 into master Jul 24, 2023
56 checks passed
@eliykat eliykat deleted the feature/sm-billing branch July 24, 2023 23:07
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.

8 participants