1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-08 20:50:28 +00:00

feat(billing): Add purchase premium subscription mehod to client

This commit is contained in:
Stephon Brown
2025-09-24 15:55:03 -04:00
parent e8da108aae
commit e6a4a40f88

View File

@@ -62,6 +62,16 @@ export class SubscriberBillingClient {
}
};
purchasePremiumSubscription = async (
subscriber: BitwardenSubscriber,
paymentMethod: TokenizedPaymentMethod,
billingAddress: Pick<BillingAddress, "country" | "postalCode">,
): Promise<void> => {
const path = `${this.getEndpoint(subscriber)}/subscription`;
const request = { tokenizedPaymentMethod: paymentMethod, billingAddress: billingAddress };
await this.apiService.send("POST", path, request, true, true);
};
getBillingAddress = async (subscriber: BitwardenSubscriber): Promise<BillingAddress | null> => {
const path = `${this.getEndpoint(subscriber)}/address`;
const data = await this.apiService.send("GET", path, null, true, true);