sca card failure warning

This commit is contained in:
Kyle Spearrin 2019-08-10 19:51:49 -04:00
parent 8bafbbd2ff
commit 7d76473580
3 changed files with 29 additions and 4 deletions

View File

@ -6,6 +6,11 @@ import {
ViewChild,
} from '@angular/core';
import {
ActivatedRoute,
Router,
} from '@angular/router';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
@ -34,7 +39,8 @@ export class AdjustSeatsComponent {
formPromise: Promise<any>;
constructor(private apiService: ApiService, private i18nService: I18nService,
private analytics: Angulartics2, private toasterService: ToasterService) { }
private analytics: Angulartics2, private toasterService: ToasterService,
private router: Router, private activatedRoute: ActivatedRoute) { }
async submit() {
try {
@ -60,7 +66,12 @@ export class AdjustSeatsComponent {
this.analytics.eventTrack.next({ action: this.add ? 'Added Seats' : 'Removed Seats' });
this.onAdjusted.emit(this.seatAdjustment);
if (paymentFailed) {
// TODO: Go to billing page
this.toasterService.popAsync({
body: this.i18nService.t('couldNotChargeCardPayInvoice'),
type: 'warning',
timeout: 10000,
});
this.router.navigate(['../billing'], { relativeTo: this.activatedRoute });
} else {
this.toasterService.popAsync('success', null,
this.i18nService.t('adjustedSeats', request.seatAdjustment.toString()));

View File

@ -6,6 +6,11 @@ import {
ViewChild,
} from '@angular/core';
import {
ActivatedRoute,
Router,
} from '@angular/router';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
@ -36,7 +41,8 @@ export class AdjustStorageComponent {
formPromise: Promise<any>;
constructor(private apiService: ApiService, private i18nService: I18nService,
private analytics: Angulartics2, private toasterService: ToasterService) { }
private analytics: Angulartics2, private toasterService: ToasterService,
private router: Router, private activatedRoute: ActivatedRoute) { }
async submit() {
try {
@ -68,7 +74,12 @@ export class AdjustStorageComponent {
this.analytics.eventTrack.next({ action: this.add ? 'Added Storage' : 'Removed Storage' });
this.onAdjusted.emit(this.storageAdjustment);
if (paymentFailed) {
// TOOD: go to billing page
this.toasterService.popAsync({
body: this.i18nService.t('couldNotChargeCardPayInvoice'),
type: 'warning',
timeout: 10000,
});
this.router.navigate(['../billing'], { relativeTo: this.activatedRoute });
} else {
this.toasterService.popAsync('success', null,
this.i18nService.t('adjustedStorage', request.storageGbAdjustment.toString()));

View File

@ -2926,5 +2926,8 @@
},
"selectOneCollection": {
"message": "You must select at least one collection."
},
"couldNotChargeCardPayInvoice": {
"message": "We were not able to charge your card. Please view and pay the unpaid invoice listed below."
}
}