mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-30 13:03:53 +01:00
add cancel and reinstate premium
This commit is contained in:
parent
1565140024
commit
3726d9e6d8
@ -65,6 +65,8 @@ export abstract class ApiService {
|
|||||||
postPasswordHint: (request: PasswordHintRequest) => Promise<any>;
|
postPasswordHint: (request: PasswordHintRequest) => Promise<any>;
|
||||||
postRegister: (request: RegisterRequest) => Promise<any>;
|
postRegister: (request: RegisterRequest) => Promise<any>;
|
||||||
postPremium: (data: FormData) => Promise<any>;
|
postPremium: (data: FormData) => Promise<any>;
|
||||||
|
postReinstatePremium: () => Promise<any>;
|
||||||
|
postCancelPremium: () => Promise<any>;
|
||||||
postFolder: (request: FolderRequest) => Promise<FolderResponse>;
|
postFolder: (request: FolderRequest) => Promise<FolderResponse>;
|
||||||
putFolder: (id: string, request: FolderRequest) => Promise<FolderResponse>;
|
putFolder: (id: string, request: FolderRequest) => Promise<FolderResponse>;
|
||||||
deleteFolder: (id: string) => Promise<any>;
|
deleteFolder: (id: string) => Promise<any>;
|
||||||
|
@ -4,11 +4,27 @@ export class BillingResponse {
|
|||||||
storageName: string;
|
storageName: string;
|
||||||
storageGb: number;
|
storageGb: number;
|
||||||
maxStorageGb: number;
|
maxStorageGb: number;
|
||||||
|
paymentSource: BillingSourceResponse;
|
||||||
|
subscription: BillingSubscriptionResponse;
|
||||||
|
upcomingInvoice: BillingInvoiceResponse;
|
||||||
|
charges: BillingChargeResponse[] = [];
|
||||||
|
license: any;
|
||||||
|
expiration: Date;
|
||||||
|
|
||||||
constructor(response: any) {
|
constructor(response: any) {
|
||||||
this.storageName = response.StorageName;
|
this.storageName = response.StorageName;
|
||||||
this.storageGb = response.StorageGb;
|
this.storageGb = response.StorageGb;
|
||||||
this.maxStorageGb = response.MaxStorageGb;
|
this.maxStorageGb = response.MaxStorageGb;
|
||||||
|
this.paymentSource = response.PaymentSource == null ? null : new BillingSourceResponse(response.PaymentSource);
|
||||||
|
this.subscription = response.Subscription == null ?
|
||||||
|
null : new BillingSubscriptionResponse(response.Subscription);
|
||||||
|
this.upcomingInvoice = response.UpcomingInvoice == null ?
|
||||||
|
null : new BillingInvoiceResponse(response.UpcomingInvoice);
|
||||||
|
if (response.Charges != null) {
|
||||||
|
this.charges = response.Charges.map((c: any) => new BillingChargeResponse(c));
|
||||||
|
}
|
||||||
|
this.license = response.License;
|
||||||
|
this.expiration = response.Expiration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +63,7 @@ export class BillingSubscriptionResponse {
|
|||||||
this.status = response.Status;
|
this.status = response.Status;
|
||||||
this.cancelled = response.Cancelled;
|
this.cancelled = response.Cancelled;
|
||||||
if (response.Items != null) {
|
if (response.Items != null) {
|
||||||
this.items = response.Items.map((i) => new BillingSubscriptionItemResponse(i));
|
this.items = response.Items.map((i: any) => new BillingSubscriptionItemResponse(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,15 @@ export class ApiService implements ApiServiceAbstraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
postPremium(data: FormData): Promise<any> {
|
postPremium(data: FormData): Promise<any> {
|
||||||
return this.send('POST', '/accounts/premium', data, true, true);
|
return this.send('POST', '/accounts/premium', data, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
postReinstatePremium(): Promise<any> {
|
||||||
|
return this.send('POST', '/accounts/reinstate-premium', null, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
postCancelPremium(): Promise<any> {
|
||||||
|
return this.send('POST', '/accounts/cancel-premium', null, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Folder APIs
|
// Folder APIs
|
||||||
|
Loading…
Reference in New Issue
Block a user