1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-24 08:33:29 +00:00

Merge branch 'main' into km/tmp-ownership-2

This commit is contained in:
Bernd Schoolmann
2025-01-24 19:41:40 +01:00
39 changed files with 802 additions and 2220 deletions

View File

@@ -4,7 +4,6 @@
import { OrganizationResponse } from "../../admin-console/models/response/organization.response";
import { InitiationPath } from "../../models/request/reference-event.request";
import { PaymentMethodType, PlanType } from "../enums";
import { BillingSourceResponse } from "../models/response/billing.response";
import { PaymentSourceResponse } from "../models/response/payment-source.response";
export type OrganizationInformation = {
@@ -46,9 +45,7 @@ export type SubscriptionInformation = {
};
export abstract class OrganizationBillingServiceAbstraction {
getPaymentSource: (
organizationId: string,
) => Promise<BillingSourceResponse | PaymentSourceResponse>;
getPaymentSource: (organizationId: string) => Promise<PaymentSourceResponse>;
purchaseSubscription: (subscription: SubscriptionInformation) => Promise<OrganizationResponse>;

View File

@@ -7,10 +7,8 @@ import { OrganizationApiServiceAbstraction as OrganizationApiService } from "../
import { OrganizationCreateRequest } from "../../admin-console/models/request/organization-create.request";
import { OrganizationKeysRequest } from "../../admin-console/models/request/organization-keys.request";
import { OrganizationResponse } from "../../admin-console/models/response/organization.response";
import { FeatureFlag } from "../../enums/feature-flag.enum";
import { EncryptService } from "../../key-management/crypto/abstractions/encrypt.service";
import { EncString } from "../../key-management/crypto/models/domain/enc-string";
import { ConfigService } from "../../platform/abstractions/config/config.service";
import { I18nService } from "../../platform/abstractions/i18n.service";
import { SyncService } from "../../platform/sync";
import { OrgKey } from "../../types/key";
@@ -24,7 +22,6 @@ import {
} from "../abstractions";
import { PlanType } from "../enums";
import { OrganizationNoPaymentMethodCreateRequest } from "../models/request/organization-no-payment-method-create-request";
import { BillingSourceResponse } from "../models/response/billing.response";
import { PaymentSourceResponse } from "../models/response/payment-source.response";
interface OrganizationKeys {
@@ -38,7 +35,6 @@ export class OrganizationBillingService implements OrganizationBillingServiceAbs
constructor(
private apiService: ApiService,
private billingApiService: BillingApiServiceAbstraction,
private configService: ConfigService,
private keyService: KeyService,
private encryptService: EncryptService,
private i18nService: I18nService,
@@ -46,21 +42,9 @@ export class OrganizationBillingService implements OrganizationBillingServiceAbs
private syncService: SyncService,
) {}
async getPaymentSource(
organizationId: string,
): Promise<BillingSourceResponse | PaymentSourceResponse> {
const deprecateStripeSourcesAPI = await this.configService.getFeatureFlag(
FeatureFlag.AC2476_DeprecateStripeSourcesAPI,
);
if (deprecateStripeSourcesAPI) {
const paymentMethod =
await this.billingApiService.getOrganizationPaymentMethod(organizationId);
return paymentMethod.paymentSource;
} else {
const billing = await this.organizationApiService.getBilling(organizationId);
return billing.paymentSource;
}
async getPaymentSource(organizationId: string): Promise<PaymentSourceResponse> {
const paymentMethod = await this.billingApiService.getOrganizationPaymentMethod(organizationId);
return paymentMethod.paymentSource;
}
async purchaseSubscription(subscription: SubscriptionInformation): Promise<OrganizationResponse> {

View File

@@ -34,7 +34,6 @@ export enum FeatureFlag {
UnauthenticatedExtensionUIRefresh = "unauth-ui-refresh",
SSHKeyVaultItem = "ssh-key-vault-item",
SSHAgent = "ssh-agent",
AC2476_DeprecateStripeSourcesAPI = "AC-2476-deprecate-stripe-sources-api",
CipherKeyEncryption = "cipher-key-encryption",
PM11901_RefactorSelfHostingLicenseUploader = "PM-11901-refactor-self-hosting-license-uploader",
CriticalApps = "pm-14466-risk-insights-critical-application",
@@ -92,7 +91,6 @@ export const DefaultFeatureFlagValue = {
[FeatureFlag.UnauthenticatedExtensionUIRefresh]: FALSE,
[FeatureFlag.SSHKeyVaultItem]: FALSE,
[FeatureFlag.SSHAgent]: FALSE,
[FeatureFlag.AC2476_DeprecateStripeSourcesAPI]: FALSE,
[FeatureFlag.CipherKeyEncryption]: FALSE,
[FeatureFlag.PM11901_RefactorSelfHostingLicenseUploader]: FALSE,
[FeatureFlag.CriticalApps]: FALSE,