mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 00:33:44 +00:00
Implemented tax collection for subscriptions (#215)
This commit is contained in:
@@ -99,6 +99,7 @@ import { SendResponse } from '../models/response/sendResponse';
|
|||||||
import { SubscriptionResponse } from '../models/response/subscriptionResponse';
|
import { SubscriptionResponse } from '../models/response/subscriptionResponse';
|
||||||
import { SyncResponse } from '../models/response/syncResponse';
|
import { SyncResponse } from '../models/response/syncResponse';
|
||||||
import { TaxInfoResponse } from '../models/response/taxInfoResponse';
|
import { TaxInfoResponse } from '../models/response/taxInfoResponse';
|
||||||
|
import { TaxRateResponse } from '../models/response/taxRateResponse';
|
||||||
import { TwoFactorAuthenticatorResponse } from '../models/response/twoFactorAuthenticatorResponse';
|
import { TwoFactorAuthenticatorResponse } from '../models/response/twoFactorAuthenticatorResponse';
|
||||||
import { TwoFactorDuoResponse } from '../models/response/twoFactorDuoResponse';
|
import { TwoFactorDuoResponse } from '../models/response/twoFactorDuoResponse';
|
||||||
import { TwoFactorEmailResponse } from '../models/response/twoFactorEmailResponse';
|
import { TwoFactorEmailResponse } from '../models/response/twoFactorEmailResponse';
|
||||||
@@ -299,6 +300,7 @@ export abstract class ApiService {
|
|||||||
postOrganizationReinstate: (id: string) => Promise<any>;
|
postOrganizationReinstate: (id: string) => Promise<any>;
|
||||||
deleteOrganization: (id: string, request: PasswordVerificationRequest) => Promise<any>;
|
deleteOrganization: (id: string, request: PasswordVerificationRequest) => Promise<any>;
|
||||||
getPlans: () => Promise<ListResponse<PlanResponse>>;
|
getPlans: () => Promise<ListResponse<PlanResponse>>;
|
||||||
|
getTaxRates: () => Promise<ListResponse<TaxRateResponse>>;
|
||||||
|
|
||||||
getEvents: (start: string, end: string, token: string) => Promise<ListResponse<EventResponse>>;
|
getEvents: (start: string, end: string, token: string) => Promise<ListResponse<EventResponse>>;
|
||||||
getEventsCipher: (id: string, start: string, end: string, token: string) => Promise<ListResponse<EventResponse>>;
|
getEventsCipher: (id: string, start: string, end: string, token: string) => Promise<ListResponse<EventResponse>>;
|
||||||
|
|||||||
@@ -6,4 +6,6 @@ export class OrganizationUpgradeRequest {
|
|||||||
additionalSeats: number;
|
additionalSeats: number;
|
||||||
additionalStorageGb: number;
|
additionalStorageGb: number;
|
||||||
premiumAccessAddon: boolean;
|
premiumAccessAddon: boolean;
|
||||||
|
billingAddressCountry: string;
|
||||||
|
billingAddressPostalCode: string;
|
||||||
}
|
}
|
||||||
|
|||||||
18
src/models/response/taxRateResponse.ts
Normal file
18
src/models/response/taxRateResponse.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { BaseResponse } from './baseResponse';
|
||||||
|
|
||||||
|
export class TaxRateResponse extends BaseResponse {
|
||||||
|
id: string;
|
||||||
|
country: string;
|
||||||
|
state: string;
|
||||||
|
postalCode: string;
|
||||||
|
rate: number;
|
||||||
|
|
||||||
|
constructor(response: any) {
|
||||||
|
super(response);
|
||||||
|
this.id = this.getResponseProperty('Id');
|
||||||
|
this.country = this.getResponseProperty('Country');
|
||||||
|
this.state = this.getResponseProperty('State');
|
||||||
|
this.postalCode = this.getResponseProperty('PostalCode');
|
||||||
|
this.rate = this.getResponseProperty('Rate');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -104,6 +104,7 @@ import { SendResponse } from '../models/response/sendResponse';
|
|||||||
import { SubscriptionResponse } from '../models/response/subscriptionResponse';
|
import { SubscriptionResponse } from '../models/response/subscriptionResponse';
|
||||||
import { SyncResponse } from '../models/response/syncResponse';
|
import { SyncResponse } from '../models/response/syncResponse';
|
||||||
import { TaxInfoResponse } from '../models/response/taxInfoResponse';
|
import { TaxInfoResponse } from '../models/response/taxInfoResponse';
|
||||||
|
import { TaxRateResponse } from '../models/response/taxRateResponse';
|
||||||
import { TwoFactorAuthenticatorResponse } from '../models/response/twoFactorAuthenticatorResponse';
|
import { TwoFactorAuthenticatorResponse } from '../models/response/twoFactorAuthenticatorResponse';
|
||||||
import { TwoFactorDuoResponse } from '../models/response/twoFactorDuoResponse';
|
import { TwoFactorDuoResponse } from '../models/response/twoFactorDuoResponse';
|
||||||
import { TwoFactorEmailResponse } from '../models/response/twoFactorEmailResponse';
|
import { TwoFactorEmailResponse } from '../models/response/twoFactorEmailResponse';
|
||||||
@@ -760,6 +761,11 @@ export class ApiService implements ApiServiceAbstraction {
|
|||||||
return this.send('POST', '/organizations/' + organizationId + '/import', request, true, false);
|
return this.send('POST', '/organizations/' + organizationId + '/import', request, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getTaxRates(): Promise<ListResponse<TaxRateResponse>> {
|
||||||
|
const r = await this.send('GET', '/plans/sales-tax-rates/', null, true, true);
|
||||||
|
return new ListResponse(r, TaxRateResponse);
|
||||||
|
}
|
||||||
|
|
||||||
// Settings APIs
|
// Settings APIs
|
||||||
|
|
||||||
async getSettingsDomains(): Promise<DomainsResponse> {
|
async getSettingsDomains(): Promise<DomainsResponse> {
|
||||||
|
|||||||
Reference in New Issue
Block a user