1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

new payment api changes

This commit is contained in:
Kyle Spearrin
2019-08-09 23:56:55 -04:00
parent 393f6c9c20
commit e28e820286
3 changed files with 34 additions and 6 deletions

View File

@@ -85,6 +85,7 @@ import {
OrganizationUserDetailsResponse,
OrganizationUserUserDetailsResponse,
} from '../models/response/organizationUserResponse';
import { PaymentResponse } from '../models/response/paymentResponse';
import { PreloginResponse } from '../models/response/preloginResponse';
import { ProfileResponse } from '../models/response/profileResponse';
import { SelectionReadOnlyResponse } from '../models/response/selectionReadOnlyResponse';
@@ -253,8 +254,9 @@ export class ApiService implements ApiServiceAbstraction {
return this.send('POST', '/accounts/register', request, false, false);
}
postPremium(data: FormData): Promise<any> {
return this.send('POST', '/accounts/premium', data, true, false);
async postPremium(data: FormData): Promise<PaymentResponse> {
const r = await this.send('POST', '/accounts/premium', data, true, true);
return new PaymentResponse(r);
}
postReinstatePremium(): Promise<any> {
@@ -780,8 +782,9 @@ export class ApiService implements ApiServiceAbstraction {
return new ApiKeyResponse(r);
}
postOrganizationUpgrade(id: string, request: OrganizationUpgradeRequest): Promise<any> {
return this.send('POST', '/organizations/' + id + '/upgrade', request, true, false);
async postOrganizationUpgrade(id: string, request: OrganizationUpgradeRequest): Promise<PaymentResponse> {
const r = await this.send('POST', '/organizations/' + id + '/upgrade', request, true, true);
return new PaymentResponse(r);
}
postOrganizationSeat(id: string, request: SeatRequest): Promise<any> {
@@ -881,6 +884,11 @@ export class ApiService implements ApiServiceAbstraction {
return r as string;
}
async postSetupPayment(): Promise<string> {
const r = await this.send('POST', '/setup-payment', null, true, true);
return r as string;
}
// Helpers
async getActiveBearerToken(): Promise<string> {