Merge pull request #115 from bitwarden/feature/tax-info-collection
Support tax collection info
This commit is contained in:
commit
7fd52c62f3
|
@ -25,6 +25,7 @@ import { ImportOrganizationCiphersRequest } from '../models/request/importOrgani
|
|||
import { KdfRequest } from '../models/request/kdfRequest';
|
||||
import { KeysRequest } from '../models/request/keysRequest';
|
||||
import { OrganizationCreateRequest } from '../models/request/organizationCreateRequest';
|
||||
import { OrganizationTaxInfoUpdateRequest } from '../models/request/organizationTaxInfoUpdateRequest';
|
||||
import { OrganizationUpdateRequest } from '../models/request/organizationUpdateRequest';
|
||||
import { OrganizationUpgradeRequest } from '../models/request/organizationUpgradeRequest';
|
||||
import { OrganizationUserAcceptRequest } from '../models/request/organizationUserAcceptRequest';
|
||||
|
@ -42,6 +43,7 @@ import { RegisterRequest } from '../models/request/registerRequest';
|
|||
import { SeatRequest } from '../models/request/seatRequest';
|
||||
import { SelectionReadOnlyRequest } from '../models/request/selectionReadOnlyRequest';
|
||||
import { StorageRequest } from '../models/request/storageRequest';
|
||||
import { TaxInfoUpdateRequest } from '../models/request/taxInfoUpdateRequest';
|
||||
import { TokenRequest } from '../models/request/tokenRequest';
|
||||
import { TwoFactorEmailRequest } from '../models/request/twoFactorEmailRequest';
|
||||
import { TwoFactorProviderRequest } from '../models/request/twoFactorProviderRequest';
|
||||
|
@ -90,6 +92,7 @@ import { ProfileResponse } from '../models/response/profileResponse';
|
|||
import { SelectionReadOnlyResponse } from '../models/response/selectionReadOnlyResponse';
|
||||
import { SubscriptionResponse } from '../models/response/subscriptionResponse';
|
||||
import { SyncResponse } from '../models/response/syncResponse';
|
||||
import { TaxInfoResponse } from '../models/response/taxInfoResponse';
|
||||
import { TwoFactorAuthenticatorResponse } from '../models/response/twoFactorAuthenticatorResponse';
|
||||
import { TwoFactorDuoResponse } from '../models/response/twoFactorDuoResponse';
|
||||
import { TwoFactorEmailResponse } from '../models/response/twoFactorEmailResponse';
|
||||
|
@ -115,7 +118,9 @@ export abstract class ApiService {
|
|||
getProfile: () => Promise<ProfileResponse>;
|
||||
getUserBilling: () => Promise<BillingResponse>;
|
||||
getUserSubscription: () => Promise<SubscriptionResponse>;
|
||||
getTaxInfo: () => Promise<TaxInfoResponse>;
|
||||
putProfile: (request: UpdateProfileRequest) => Promise<ProfileResponse>;
|
||||
putTaxInfo: (request: TaxInfoUpdateRequest) => Promise<any>;
|
||||
postPrelogin: (request: PreloginRequest) => Promise<PreloginResponse>;
|
||||
postEmailToken: (request: EmailTokenRequest) => Promise<any>;
|
||||
postEmail: (request: EmailRequest) => Promise<any>;
|
||||
|
@ -255,8 +260,10 @@ export abstract class ApiService {
|
|||
getOrganizationBilling: (id: string) => Promise<BillingResponse>;
|
||||
getOrganizationSubscription: (id: string) => Promise<OrganizationSubscriptionResponse>;
|
||||
getOrganizationLicense: (id: string, installationId: string) => Promise<any>;
|
||||
getOrganizationTaxInfo: (id: string) => Promise<TaxInfoResponse>;
|
||||
postOrganization: (request: OrganizationCreateRequest) => Promise<OrganizationResponse>;
|
||||
putOrganization: (id: string, request: OrganizationUpdateRequest) => Promise<OrganizationResponse>;
|
||||
putOrganizationTaxInfo: (id: string, request: OrganizationTaxInfoUpdateRequest) => Promise<any>;
|
||||
postLeaveOrganization: (id: string) => Promise<any>;
|
||||
postOrganizationLicense: (data: FormData) => Promise<OrganizationResponse>;
|
||||
postOrganizationLicenseUpdate: (id: string, data: FormData) => Promise<any>;
|
||||
|
|
|
@ -13,4 +13,11 @@ export class OrganizationCreateRequest {
|
|||
additionalStorageGb: number;
|
||||
premiumAccessAddon: boolean;
|
||||
collectionName: string;
|
||||
taxIdNumber: string;
|
||||
billingAddressLine1: string;
|
||||
billingAddressLine2: string;
|
||||
billingAddressCity: string;
|
||||
billingAddressState: string;
|
||||
billingAddressPostalCode: string;
|
||||
billingAddressCountry: string;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
import { TaxInfoUpdateRequest } from './taxInfoUpdateRequest';
|
||||
|
||||
export class OrganizationTaxInfoUpdateRequest extends TaxInfoUpdateRequest {
|
||||
taxId: string;
|
||||
line1: string;
|
||||
line2: string;
|
||||
city: string;
|
||||
state: string;
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
export class TaxInfoUpdateRequest {
|
||||
country: string;
|
||||
postalCode: string;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
import { BaseResponse } from './baseResponse';
|
||||
|
||||
export class TaxInfoResponse extends BaseResponse {
|
||||
taxId: string;
|
||||
taxIdType: string;
|
||||
line1: string;
|
||||
line2: string;
|
||||
city: string;
|
||||
state: string;
|
||||
country: string;
|
||||
postalCode: string;
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
this.taxId = this.getResponseProperty('TaxIdNumber');
|
||||
this.taxIdType = this.getResponseProperty('TaxIdType');
|
||||
this.line1 = this.getResponseProperty('Line1');
|
||||
this.line2 = this.getResponseProperty('Line2');
|
||||
this.city = this.getResponseProperty('City');
|
||||
this.state = this.getResponseProperty('State');
|
||||
this.postalCode = this.getResponseProperty('PostalCode');
|
||||
this.country = this.getResponseProperty('Country');
|
||||
}
|
||||
}
|
|
@ -29,6 +29,7 @@ import { ImportOrganizationCiphersRequest } from '../models/request/importOrgani
|
|||
import { KdfRequest } from '../models/request/kdfRequest';
|
||||
import { KeysRequest } from '../models/request/keysRequest';
|
||||
import { OrganizationCreateRequest } from '../models/request/organizationCreateRequest';
|
||||
import { OrganizationTaxInfoUpdateRequest } from '../models/request/organizationTaxInfoUpdateRequest';
|
||||
import { OrganizationUpdateRequest } from '../models/request/organizationUpdateRequest';
|
||||
import { OrganizationUpgradeRequest } from '../models/request/organizationUpgradeRequest';
|
||||
import { OrganizationUserAcceptRequest } from '../models/request/organizationUserAcceptRequest';
|
||||
|
@ -46,6 +47,7 @@ import { RegisterRequest } from '../models/request/registerRequest';
|
|||
import { SeatRequest } from '../models/request/seatRequest';
|
||||
import { SelectionReadOnlyRequest } from '../models/request/selectionReadOnlyRequest';
|
||||
import { StorageRequest } from '../models/request/storageRequest';
|
||||
import { TaxInfoUpdateRequest } from '../models/request/taxInfoUpdateRequest';
|
||||
import { TokenRequest } from '../models/request/tokenRequest';
|
||||
import { TwoFactorEmailRequest } from '../models/request/twoFactorEmailRequest';
|
||||
import { TwoFactorProviderRequest } from '../models/request/twoFactorProviderRequest';
|
||||
|
@ -95,6 +97,7 @@ import { ProfileResponse } from '../models/response/profileResponse';
|
|||
import { SelectionReadOnlyResponse } from '../models/response/selectionReadOnlyResponse';
|
||||
import { SubscriptionResponse } from '../models/response/subscriptionResponse';
|
||||
import { SyncResponse } from '../models/response/syncResponse';
|
||||
import { TaxInfoResponse } from '../models/response/taxInfoResponse';
|
||||
import { TwoFactorAuthenticatorResponse } from '../models/response/twoFactorAuthenticatorResponse';
|
||||
import { TwoFactorDuoResponse } from '../models/response/twoFactorDuoResponse';
|
||||
import { TwoFactorEmailResponse } from '../models/response/twoFactorEmailResponse';
|
||||
|
@ -220,11 +223,20 @@ export class ApiService implements ApiServiceAbstraction {
|
|||
return new SubscriptionResponse(r);
|
||||
}
|
||||
|
||||
async getTaxInfo(): Promise<TaxInfoResponse> {
|
||||
const r = await this.send('GET', '/accounts/tax', null, true, true);
|
||||
return new TaxInfoResponse(r);
|
||||
}
|
||||
|
||||
async putProfile(request: UpdateProfileRequest): Promise<ProfileResponse> {
|
||||
const r = await this.send('PUT', '/accounts/profile', request, true, true);
|
||||
return new ProfileResponse(r);
|
||||
}
|
||||
|
||||
putTaxInfo(request: TaxInfoUpdateRequest): Promise<any> {
|
||||
return this.send('PUT', '/accounts/tax', request, true, false);
|
||||
}
|
||||
|
||||
async postPrelogin(request: PreloginRequest): Promise<PreloginResponse> {
|
||||
const r = await this.send('POST', '/accounts/prelogin', request, false, true);
|
||||
return new PreloginResponse(r);
|
||||
|
@ -817,6 +829,11 @@ export class ApiService implements ApiServiceAbstraction {
|
|||
null, true, true);
|
||||
}
|
||||
|
||||
async getOrganizationTaxInfo(id: string): Promise<TaxInfoResponse> {
|
||||
const r = await this.send('GET', '/organizations/' + id + '/tax', null, true, true);
|
||||
return new TaxInfoResponse(r);
|
||||
}
|
||||
|
||||
async postOrganization(request: OrganizationCreateRequest): Promise<OrganizationResponse> {
|
||||
const r = await this.send('POST', '/organizations', request, true, true);
|
||||
return new OrganizationResponse(r);
|
||||
|
@ -827,6 +844,10 @@ export class ApiService implements ApiServiceAbstraction {
|
|||
return new OrganizationResponse(r);
|
||||
}
|
||||
|
||||
async putOrganizationTaxInfo(id: string, request: OrganizationTaxInfoUpdateRequest): Promise<any> {
|
||||
return this.send('PUT', '/organizations/' + id + '/tax', request, true, false);
|
||||
}
|
||||
|
||||
postLeaveOrganization(id: string): Promise<any> {
|
||||
return this.send('POST', '/organizations/' + id + '/leave', null, true, false);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue