From 7d76473580ab594e098a4cc3107b9dc488a6ad3b Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Sat, 10 Aug 2019 19:51:49 -0400 Subject: [PATCH] sca card failure warning --- .../settings/adjust-seats.component.ts | 15 +++++++++++++-- src/app/settings/adjust-storage.component.ts | 15 +++++++++++++-- src/locales/en/messages.json | 3 +++ 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/app/organizations/settings/adjust-seats.component.ts b/src/app/organizations/settings/adjust-seats.component.ts index 2ca0a5fbbaa..92e8657d67f 100644 --- a/src/app/organizations/settings/adjust-seats.component.ts +++ b/src/app/organizations/settings/adjust-seats.component.ts @@ -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; 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())); diff --git a/src/app/settings/adjust-storage.component.ts b/src/app/settings/adjust-storage.component.ts index 49f1e6abfa0..e0ce027afbb 100644 --- a/src/app/settings/adjust-storage.component.ts +++ b/src/app/settings/adjust-storage.component.ts @@ -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; 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())); diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json index b8843a7fbc2..ef45e902ca9 100644 --- a/src/locales/en/messages.json +++ b/src/locales/en/messages.json @@ -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." } }