mirror of
https://github.com/bitwarden/browser
synced 2024-12-25 09:32:06 +01:00
adjust storage with payment intent/method handling
This commit is contained in:
parent
a4571a2617
commit
80c5dff5ad
2
jslib
2
jslib
@ -1 +1 @@
|
||||
Subproject commit e28e820286870df0111bd4feb8a219a3ae360ba7
|
||||
Subproject commit de9bcac0ec9f4429c17af4b952f58a2054aad02e
|
@ -27,3 +27,4 @@
|
||||
</small>
|
||||
</div>
|
||||
</form>
|
||||
<app-payment [showMethods]="false"></app-payment>
|
||||
|
@ -3,6 +3,7 @@ import {
|
||||
EventEmitter,
|
||||
Input,
|
||||
Output,
|
||||
ViewChild,
|
||||
} from '@angular/core';
|
||||
|
||||
import { ToasterService } from 'angular2-toaster';
|
||||
@ -13,6 +14,10 @@ import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
|
||||
import { StorageRequest } from 'jslib/models/request/storageRequest';
|
||||
|
||||
import { PaymentResponse } from 'jslib/models/response/paymentResponse';
|
||||
|
||||
import { PaymentComponent } from './payment.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-adjust-storage',
|
||||
templateUrl: 'adjust-storage.component.html',
|
||||
@ -25,8 +30,10 @@ export class AdjustStorageComponent {
|
||||
@Output() onAdjusted = new EventEmitter<number>();
|
||||
@Output() onCanceled = new EventEmitter();
|
||||
|
||||
@ViewChild(PaymentComponent) paymentComponent: PaymentComponent;
|
||||
|
||||
storageAdjustment = 0;
|
||||
formPromise: Promise<any>;
|
||||
formPromise: Promise<PaymentResponse>;
|
||||
|
||||
constructor(private apiService: ApiService, private i18nService: I18nService,
|
||||
private analytics: Angulartics2, private toasterService: ToasterService) { }
|
||||
@ -44,7 +51,10 @@ export class AdjustStorageComponent {
|
||||
} else {
|
||||
this.formPromise = this.apiService.postOrganizationStorage(this.organizationId, request);
|
||||
}
|
||||
await this.formPromise;
|
||||
const result = await this.formPromise;
|
||||
if (result != null && result.paymentIntentClientSecret != null) {
|
||||
await this.paymentComponent.handleStripeCardPayment(result.paymentIntentClientSecret, null);
|
||||
}
|
||||
this.analytics.eventTrack.next({ action: this.add ? 'Added Storage' : 'Removed Storage' });
|
||||
this.toasterService.popAsync('success', null,
|
||||
this.i18nService.t('adjustedStorage', request.storageGbAdjustment.toString()));
|
||||
|
Loading…
Reference in New Issue
Block a user