1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

Make payment optional trial banner work with Stripe sources API deprecation (#12146)

This commit is contained in:
Alex Morask
2024-12-02 09:12:49 -05:00
committed by GitHub
parent 3fe11b7e5a
commit 0544100e83
6 changed files with 82 additions and 51 deletions

View File

@@ -32,11 +32,11 @@ import {
} from "rxjs/operators";
import {
Unassigned,
CollectionService,
CollectionData,
CollectionDetailsResponse,
CollectionService,
CollectionView,
Unassigned,
} from "@bitwarden/admin-console/common";
import { SearchPipe } from "@bitwarden/angular/pipes/search.pipe";
import { ModalService } from "@bitwarden/angular/services/modal.service";
@@ -47,6 +47,7 @@ import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-conso
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { OrganizationBillingServiceAbstraction } from "@bitwarden/common/billing/abstractions";
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
import { BillingApiServiceAbstraction } from "@bitwarden/common/billing/abstractions/billing-api.service.abstraction";
import { EventType } from "@bitwarden/common/enums";
@@ -241,6 +242,7 @@ export class VaultComponent implements OnInit, OnDestroy {
private organizationApiService: OrganizationApiServiceAbstraction,
protected billingApiService: BillingApiServiceAbstraction,
private trialFlowService: TrialFlowService,
private organizationBillingService: OrganizationBillingServiceAbstraction,
) {}
async ngOnInit() {
@@ -437,13 +439,13 @@ export class VaultComponent implements OnInit, OnDestroy {
.map((org) =>
combineLatest([
this.organizationApiService.getSubscription(org.id),
this.organizationApiService.getBilling(org.id),
this.organizationBillingService.getPaymentSource(org.id),
]).pipe(
map(([subscription, billing]) => {
map(([subscription, paymentSource]) => {
return this.trialFlowService.checkForOrgsWithUpcomingPaymentIssues(
org,
subscription,
billing?.paymentSource,
paymentSource,
);
}),
),

View File

@@ -48,6 +48,7 @@ import { SearchService } from "@bitwarden/common/abstractions/search.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { OrganizationBillingServiceAbstraction } from "@bitwarden/common/billing/abstractions";
import { BillingApiServiceAbstraction } from "@bitwarden/common/billing/abstractions/billing-api.service.abstraction";
import { EventType } from "@bitwarden/common/enums";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
@@ -252,6 +253,7 @@ export class VaultComponent implements OnInit, OnDestroy {
private organizationApiService: OrganizationApiServiceAbstraction,
private trialFlowService: TrialFlowService,
protected billingApiService: BillingApiServiceAbstraction,
private organizationBillingService: OrganizationBillingServiceAbstraction,
) {}
async ngOnInit() {
@@ -595,15 +597,11 @@ export class VaultComponent implements OnInit, OnDestroy {
combineLatest([
of(org),
this.organizationApiService.getSubscription(org.id),
this.organizationApiService.getBilling(org.id),
this.organizationBillingService.getPaymentSource(org.id),
]),
),
map(([org, sub, billing]) => {
return this.trialFlowService.checkForOrgsWithUpcomingPaymentIssues(
org,
sub,
billing?.paymentSource,
);
map(([org, sub, paymentSource]) => {
return this.trialFlowService.checkForOrgsWithUpcomingPaymentIssues(org, sub, paymentSource);
}),
);