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