;
- deprecateStripeSourcesAPI: boolean;
isSubscriptionCanceled: boolean = false;
private destroy$ = new Subject();
@@ -210,7 +203,6 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
private messagingService: MessagingService,
private formBuilder: FormBuilder,
private organizationApiService: OrganizationApiServiceAbstraction,
- private configService: ConfigService,
private billingApiService: BillingApiServiceAbstraction,
private taxService: TaxServiceAbstraction,
private accountService: AccountService,
@@ -218,10 +210,6 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
) {}
async ngOnInit(): Promise {
- this.deprecateStripeSourcesAPI = await this.configService.getFeatureFlag(
- FeatureFlag.AC2476_DeprecateStripeSourcesAPI,
- );
-
if (this.dialogParams.organizationId) {
this.currentPlanName = this.resolvePlanName(this.dialogParams.productTierType);
this.sub =
@@ -239,14 +227,10 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
.organizations$(userId)
.pipe(getOrganizationById(this.organizationId)),
);
- if (this.deprecateStripeSourcesAPI) {
- const { accountCredit, paymentSource } =
- await this.billingApiService.getOrganizationPaymentMethod(this.organizationId);
- this.accountCredit = accountCredit;
- this.paymentSource = paymentSource;
- } else {
- this.billing = await this.organizationApiService.getBilling(this.organizationId);
- }
+ const { accountCredit, paymentSource } =
+ await this.billingApiService.getOrganizationPaymentMethod(this.organizationId);
+ this.accountCredit = accountCredit;
+ this.paymentSource = paymentSource;
}
if (!this.selfHosted) {
@@ -333,16 +317,8 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
return this.selectableProducts.find((product) => product.productTier === productTier);
}
- secretsManagerTrialDiscount() {
- return this.sub?.customerDiscount?.appliesTo?.includes("sm-standalone")
- ? this.discountPercentage
- : this.discountPercentageFromSub + this.discountPercentage;
- }
-
isPaymentSourceEmpty() {
- return this.deprecateStripeSourcesAPI
- ? this.paymentSource === null || this.paymentSource === undefined
- : this.billing?.paymentSource === null || this.billing?.paymentSource === undefined;
+ return this.paymentSource === null || this.paymentSource === undefined;
}
isSecretsManagerTrial(): boolean {
@@ -486,9 +462,7 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
get upgradeRequiresPaymentMethod() {
const isFreeTier = this.organization?.productTierType === ProductTierType.Free;
const shouldHideFree = !this.showFree;
- const hasNoPaymentSource = this.deprecateStripeSourcesAPI
- ? !this.paymentSource
- : !this.billing?.paymentSource;
+ const hasNoPaymentSource = !this.paymentSource;
return isFreeTier && shouldHideFree && hasNoPaymentSource;
}
@@ -721,25 +695,13 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
}
changedCountry() {
- if (this.deprecateStripeSourcesAPI && this.paymentV2Component) {
- this.paymentV2Component.showBankAccount = this.taxInformation.country === "US";
+ this.paymentComponent.showBankAccount = this.taxInformation.country === "US";
- if (
- !this.paymentV2Component.showBankAccount &&
- this.paymentV2Component.selected === PaymentMethodType.BankAccount
- ) {
- this.paymentV2Component.select(PaymentMethodType.Card);
- }
- } else if (this.paymentComponent && this.taxInformation) {
- this.paymentComponent!.hideBank = this.taxInformation.country !== "US";
- // Bank Account payments are only available for US customers
- if (
- this.paymentComponent.hideBank &&
- this.paymentComponent.method === PaymentMethodType.BankAccount
- ) {
- this.paymentComponent.method = PaymentMethodType.Card;
- this.paymentComponent.changeMethod();
- }
+ if (
+ !this.paymentComponent.showBankAccount &&
+ this.paymentComponent.selected === PaymentMethodType.BankAccount
+ ) {
+ this.paymentComponent.select(PaymentMethodType.Card);
}
}
@@ -821,14 +783,8 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
plan.secretsManagerSeats = org.smSeats;
}
- let paymentMethod: [string, PaymentMethodType];
-
- if (this.deprecateStripeSourcesAPI) {
- const { type, token } = await this.paymentV2Component.tokenize();
- paymentMethod = [token, type];
- } else {
- paymentMethod = await this.paymentComponent.createPaymentToken();
- }
+ const { type, token } = await this.paymentComponent.tokenize();
+ const paymentMethod: [string, PaymentMethodType] = [token, type];
const payment: PaymentInformation = {
paymentMethod,
@@ -864,27 +820,17 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
this.buildSecretsManagerRequest(request);
if (this.upgradeRequiresPaymentMethod || this.showPayment || this.isPaymentSourceEmpty()) {
- if (this.deprecateStripeSourcesAPI) {
- const tokenizedPaymentSource = await this.paymentV2Component.tokenize();
- const updatePaymentMethodRequest = new UpdatePaymentMethodRequest();
- updatePaymentMethodRequest.paymentSource = tokenizedPaymentSource;
- updatePaymentMethodRequest.taxInformation = ExpandedTaxInfoUpdateRequest.From(
- this.taxInformation,
- );
+ const tokenizedPaymentSource = await this.paymentComponent.tokenize();
+ const updatePaymentMethodRequest = new UpdatePaymentMethodRequest();
+ updatePaymentMethodRequest.paymentSource = tokenizedPaymentSource;
+ updatePaymentMethodRequest.taxInformation = ExpandedTaxInfoUpdateRequest.From(
+ this.taxInformation,
+ );
- await this.billingApiService.updateOrganizationPaymentMethod(
- this.organizationId,
- updatePaymentMethodRequest,
- );
- } else {
- const tokenResult = await this.paymentComponent.createPaymentToken();
- const paymentRequest = new PaymentRequest();
- paymentRequest.paymentToken = tokenResult[0];
- paymentRequest.paymentMethodType = tokenResult[1];
- paymentRequest.country = this.taxInformation.country;
- paymentRequest.postalCode = this.taxInformation.postalCode;
- await this.organizationApiService.updatePayment(this.organizationId, paymentRequest);
- }
+ await this.billingApiService.updateOrganizationPaymentMethod(
+ this.organizationId,
+ updatePaymentMethodRequest,
+ );
}
// Backfill pub/priv key if necessary
@@ -894,10 +840,7 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
request.keys = new OrganizationKeysRequest(orgKeys[0], orgKeys[1].encryptedString);
}
- const result = await this.organizationApiService.upgrade(this.organizationId, request);
- if (!result.success && result.paymentIntentClientSecret != null) {
- await this.paymentComponent.handleStripeCardPayment(result.paymentIntentClientSecret, null);
- }
+ await this.organizationApiService.upgrade(this.organizationId, request);
return this.organizationId;
}
@@ -994,38 +937,20 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy {
}
get paymentSourceClasses() {
- if (this.deprecateStripeSourcesAPI) {
- if (this.paymentSource == null) {
+ if (this.paymentSource == null) {
+ return [];
+ }
+ switch (this.paymentSource.type) {
+ case PaymentMethodType.Card:
+ return ["bwi-credit-card"];
+ case PaymentMethodType.BankAccount:
+ return ["bwi-bank"];
+ case PaymentMethodType.Check:
+ return ["bwi-money"];
+ case PaymentMethodType.PayPal:
+ return ["bwi-paypal text-primary"];
+ default:
return [];
- }
- switch (this.paymentSource.type) {
- case PaymentMethodType.Card:
- return ["bwi-credit-card"];
- case PaymentMethodType.BankAccount:
- return ["bwi-bank"];
- case PaymentMethodType.Check:
- return ["bwi-money"];
- case PaymentMethodType.PayPal:
- return ["bwi-paypal text-primary"];
- default:
- return [];
- }
- } else {
- if (this.billing.paymentSource == null) {
- return [];
- }
- switch (this.billing.paymentSource.type) {
- case PaymentMethodType.Card:
- return ["bwi-credit-card"];
- case PaymentMethodType.BankAccount:
- return ["bwi-bank"];
- case PaymentMethodType.Check:
- return ["bwi-money"];
- case PaymentMethodType.PayPal:
- return ["bwi-paypal text-primary"];
- default:
- return [];
- }
}
}
diff --git a/apps/web/src/app/billing/organizations/organization-billing-routing.module.ts b/apps/web/src/app/billing/organizations/organization-billing-routing.module.ts
index 3d4c8dd3870..1bfb9fc4912 100644
--- a/apps/web/src/app/billing/organizations/organization-billing-routing.module.ts
+++ b/apps/web/src/app/billing/organizations/organization-billing-routing.module.ts
@@ -1,14 +1,11 @@
import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
-import { featureFlaggedRoute } from "@bitwarden/angular/platform/utils/feature-flagged-route";
import { canAccessBillingTab } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
-import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { organizationPermissionsGuard } from "../../admin-console/organizations/guards/org-permissions.guard";
import { organizationIsUnmanaged } from "../../billing/guards/organization-is-unmanaged.guard";
import { WebPlatformUtilsService } from "../../core/web-platform-utils.service";
-import { PaymentMethodComponent } from "../shared";
import { OrgBillingHistoryViewComponent } from "./organization-billing-history-view.component";
import { OrganizationSubscriptionCloudComponent } from "./organization-subscription-cloud.component";
@@ -28,21 +25,17 @@ const routes: Routes = [
: OrganizationSubscriptionCloudComponent,
data: { titleId: "subscription" },
},
- ...featureFlaggedRoute({
- defaultComponent: PaymentMethodComponent,
- flaggedComponent: OrganizationPaymentMethodComponent,
- featureFlag: FeatureFlag.AC2476_DeprecateStripeSourcesAPI,
- routeOptions: {
- path: "payment-method",
- canActivate: [
- organizationPermissionsGuard((org) => org.canEditPaymentMethods),
- organizationIsUnmanaged,
- ],
- data: {
- titleId: "paymentMethod",
- },
+ {
+ path: "payment-method",
+ component: OrganizationPaymentMethodComponent,
+ canActivate: [
+ organizationPermissionsGuard((org) => org.canEditPaymentMethods),
+ organizationIsUnmanaged,
+ ],
+ data: {
+ titleId: "paymentMethod",
},
- }),
+ },
{
path: "history",
component: OrgBillingHistoryViewComponent,
diff --git a/apps/web/src/app/billing/organizations/organization-plans.component.html b/apps/web/src/app/billing/organizations/organization-plans.component.html
index d37f95e3aa2..2566250c823 100644
--- a/apps/web/src/app/billing/organizations/organization-plans.component.html
+++ b/apps/web/src/app/billing/organizations/organization-plans.component.html
@@ -433,13 +433,7 @@
{{ paymentDesc }}
-
-
+