bitwarden-estensione-browser/src/app/settings/premium.component.ts

40 lines
924 B
TypeScript
Raw Normal View History

import {
Component,
2018-06-29 04:27:32 +02:00
ViewChild,
} from '@angular/core';
import { I18nService } from 'jslib/abstractions/i18n.service';
2018-06-29 04:27:32 +02:00
import { PaymentComponent } from './payment.component';
@Component({
selector: 'app-premium',
templateUrl: 'premium.component.html',
})
2018-06-29 04:27:32 +02:00
export class PremiumComponent {
@ViewChild(PaymentComponent) paymentComponent: PaymentComponent;
premiumPrice = 10;
storageGbPrice = 4;
additionalStorage = 0;
2018-06-29 04:27:32 +02:00
constructor(private i18nService: I18nService) { }
async submit() {
try {
2018-06-29 04:27:32 +02:00
const token = await this.paymentComponent.createPaymentToken();
console.log(token);
} catch (e) {
2018-06-29 04:27:32 +02:00
console.log(e);
}
}
get additionalStorageTotal(): number {
return this.storageGbPrice * this.additionalStorage;
}
get total(): number {
return this.additionalStorageTotal + this.premiumPrice;
}
}