mirror of
https://github.com/bitwarden/browser
synced 2025-12-22 19:23:52 +00:00
restrict changing payment method with iap
This commit is contained in:
@@ -9,6 +9,7 @@ import { Angulartics2 } from 'angulartics2';
|
||||
|
||||
import { ApiService } from 'jslib/abstractions/api.service';
|
||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||
|
||||
import { UserBillingComponent } from '../../settings/user-billing.component';
|
||||
|
||||
@@ -19,8 +20,8 @@ import { UserBillingComponent } from '../../settings/user-billing.component';
|
||||
export class OrganizationBillingComponent extends UserBillingComponent implements OnInit {
|
||||
constructor(apiService: ApiService, i18nService: I18nService,
|
||||
analytics: Angulartics2, toasterService: ToasterService,
|
||||
private route: ActivatedRoute) {
|
||||
super(apiService, i18nService, analytics, toasterService);
|
||||
private route: ActivatedRoute, platformUtilsService: PlatformUtilsService) {
|
||||
super(apiService, i18nService, analytics, toasterService, platformUtilsService);
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
|
||||
@@ -50,8 +50,11 @@
|
||||
</app-callout>
|
||||
<p>
|
||||
<i class="fa fa-fw" [ngClass]="{'fa-credit-card': paymentSource.type === paymentMethodType.Card,
|
||||
'fa-university': paymentSource.type === paymentMethodType.BankAccount,
|
||||
'fa-paypal text-primary': paymentSource.type === paymentMethodType.PayPal}"></i>
|
||||
'fa-university': paymentSource.type === paymentMethodType.BankAccount,
|
||||
'fa-paypal text-primary': paymentSource.type === paymentMethodType.PayPal,
|
||||
'fa-apple text-muted': paymentSource.type === paymentMethodType.AppleInApp,
|
||||
'fa-google text-muted': paymentSource.type === paymentMethodType.GoogleInApp}"></i>
|
||||
<span *ngIf="paymentSourceInApp">{{'inAppPurchase' | i18n}}</span>
|
||||
{{paymentSource.description}}
|
||||
</p>
|
||||
</ng-container>
|
||||
|
||||
@@ -10,6 +10,7 @@ import { BillingResponse } from 'jslib/models/response/billingResponse';
|
||||
|
||||
import { ApiService } from 'jslib/abstractions/api.service';
|
||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||
|
||||
import { PaymentMethodType } from 'jslib/enums/paymentMethodType';
|
||||
import { TransactionType } from 'jslib/enums/transactionType';
|
||||
@@ -34,7 +35,8 @@ export class UserBillingComponent implements OnInit {
|
||||
verifyBankPromise: Promise<any>;
|
||||
|
||||
constructor(protected apiService: ApiService, protected i18nService: I18nService,
|
||||
protected analytics: Angulartics2, protected toasterService: ToasterService) { }
|
||||
protected analytics: Angulartics2, protected toasterService: ToasterService,
|
||||
protected platformUtilsService: PlatformUtilsService) { }
|
||||
|
||||
async ngOnInit() {
|
||||
await this.load();
|
||||
@@ -72,6 +74,10 @@ export class UserBillingComponent implements OnInit {
|
||||
}
|
||||
|
||||
addCredit() {
|
||||
if (this.paymentSourceInApp) {
|
||||
this.platformUtilsService.showDialog(this.i18nService.t('cannotPerformInAppPurchase'));
|
||||
return;
|
||||
}
|
||||
this.showAddCredit = true;
|
||||
}
|
||||
|
||||
@@ -83,6 +89,10 @@ export class UserBillingComponent implements OnInit {
|
||||
}
|
||||
|
||||
changePayment() {
|
||||
if (this.paymentSourceInApp) {
|
||||
this.platformUtilsService.showDialog(this.i18nService.t('cannotPerformInAppPurchase'));
|
||||
return;
|
||||
}
|
||||
this.showAdjustPayment = true;
|
||||
}
|
||||
|
||||
@@ -105,6 +115,12 @@ export class UserBillingComponent implements OnInit {
|
||||
return this.billing != null ? this.billing.paymentSource : null;
|
||||
}
|
||||
|
||||
get paymentSourceInApp() {
|
||||
return this.paymentSource != null &&
|
||||
(this.paymentSource.type === PaymentMethodType.AppleInApp ||
|
||||
this.paymentSource.type === PaymentMethodType.GoogleInApp);
|
||||
}
|
||||
|
||||
get invoices() {
|
||||
return this.billing != null ? this.billing.invoices : null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user