1
0
mirror of https://github.com/bitwarden/web synced 2026-01-03 17:13:58 +00:00

Implemented tax collection for subscriptions (#723)

* Implemented tax collection for subscriptions

* Cleanup for Sales Tax

* Code review fixes for Tax Rate implementation

* Code review fixes for Tax Rate implementation
This commit is contained in:
Addison Beck
2020-12-04 12:05:44 -05:00
committed by GitHub
parent 512b9e0a92
commit 7c4d0a15dd
4 changed files with 53 additions and 9 deletions

View File

@@ -159,6 +159,16 @@ export class OrganizationPlansComponent implements OnInit {
return subTotal;
}
get taxCharges() {
return this.taxComponent != null && this.taxComponent.taxRate != null ?
(this.taxComponent.taxRate / 100) * this.subtotal :
0;
}
get total() {
return (this.subtotal + this.taxCharges) || 0;
}
changedProduct() {
this.plan = this.selectablePlans[0].type;
if (!this.selectedPlan.hasPremiumAccessOption) {
@@ -278,6 +288,9 @@ export class OrganizationPlansComponent implements OnInit {
request.premiumAccessAddon = this.selectedPlan.hasPremiumAccessOption &&
this.premiumAccessAddon;
request.planType = this.selectedPlan.type;
request.billingAddressCountry = this.taxComponent.taxInfo.country;
request.billingAddressPostalCode = this.taxComponent.taxInfo.postalCode;
const result = await this.apiService.postOrganizationUpgrade(this.organizationId, request);
if (!result.success && result.paymentIntentClientSecret != null) {
await this.paymentComponent.handleStripeCardPayment(result.paymentIntentClientSecret, null);