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

feat(billing): add account billing client

This commit is contained in:
Stephon Brown
2025-10-01 18:32:27 -04:00
parent c0add31460
commit 1fe7e40cc8
2 changed files with 25 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import { Injectable } from "@angular/core";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { BillingAddress, TokenizedPaymentMethod } from "../payment/types";
@Injectable()
export class AccountBillingClient {
private endpoint = "/account/billing/vnext";
private apiService: ApiService;
constructor(apiService: ApiService) {
this.apiService = apiService;
}
purchasePremiumSubscription = async (
paymentMethod: TokenizedPaymentMethod,
billingAddress: Pick<BillingAddress, "country" | "postalCode">,
): Promise<void> => {
const path = `${this.endpoint}/subscription`;
const request = { tokenizedPaymentMethod: paymentMethod, billingAddress: billingAddress };
await this.apiService.send("POST", path, request, true, true);
};
}

View File

@@ -1,2 +1,3 @@
export * from "./organization-billing.client";
export * from "./subscriber-billing.client";
export * from "./account-billing.client";