Implemented tax collection for subscriptions (#215)

This commit is contained in:
Addison Beck 2020-12-04 12:05:31 -05:00 committed by GitHub
parent 93a3053f54
commit 0565d6f667
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 0 deletions

View File

@ -99,6 +99,7 @@ import { SendResponse } from '../models/response/sendResponse';
import { SubscriptionResponse } from '../models/response/subscriptionResponse';
import { SyncResponse } from '../models/response/syncResponse';
import { TaxInfoResponse } from '../models/response/taxInfoResponse';
import { TaxRateResponse } from '../models/response/taxRateResponse';
import { TwoFactorAuthenticatorResponse } from '../models/response/twoFactorAuthenticatorResponse';
import { TwoFactorDuoResponse } from '../models/response/twoFactorDuoResponse';
import { TwoFactorEmailResponse } from '../models/response/twoFactorEmailResponse';
@ -299,6 +300,7 @@ export abstract class ApiService {
postOrganizationReinstate: (id: string) => Promise<any>;
deleteOrganization: (id: string, request: PasswordVerificationRequest) => Promise<any>;
getPlans: () => Promise<ListResponse<PlanResponse>>;
getTaxRates: () => Promise<ListResponse<TaxRateResponse>>;
getEvents: (start: string, end: string, token: string) => Promise<ListResponse<EventResponse>>;
getEventsCipher: (id: string, start: string, end: string, token: string) => Promise<ListResponse<EventResponse>>;

View File

@ -6,4 +6,6 @@ export class OrganizationUpgradeRequest {
additionalSeats: number;
additionalStorageGb: number;
premiumAccessAddon: boolean;
billingAddressCountry: string;
billingAddressPostalCode: string;
}

View 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');
}
}

View File

@ -104,6 +104,7 @@ import { SendResponse } from '../models/response/sendResponse';
import { SubscriptionResponse } from '../models/response/subscriptionResponse';
import { SyncResponse } from '../models/response/syncResponse';
import { TaxInfoResponse } from '../models/response/taxInfoResponse';
import { TaxRateResponse } from '../models/response/taxRateResponse';
import { TwoFactorAuthenticatorResponse } from '../models/response/twoFactorAuthenticatorResponse';
import { TwoFactorDuoResponse } from '../models/response/twoFactorDuoResponse';
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);
}
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
async getSettingsDomains(): Promise<DomainsResponse> {