From f4a9aeacc7c2ee148c84c3100ea26bf2d0071d7c Mon Sep 17 00:00:00 2001 From: Mononaut Date: Sat, 6 Jul 2024 08:24:18 +0000 Subject: [PATCH] [accelerator] error message after timeout --- .../accelerate-checkout.component.html | 7 +++++-- .../accelerate-checkout.component.ts | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html index ed381d7c3..fba41f2c3 100644 --- a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html +++ b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html @@ -503,9 +503,12 @@
-
+
Confirming your acceleration with our mining pool partners... -
+ @if (timeSincePaid > 20000) { + ...sorry, this is taking longer than expected... + } +
diff --git a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts index 68ed74ad6..18e4dbe3f 100644 --- a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts +++ b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts @@ -77,6 +77,7 @@ export class AccelerateCheckout implements OnInit, OnDestroy { private _step: CheckoutStep = 'summary'; simpleMode: boolean = true; paymentMethod: 'cashapp' | 'btcpay'; + timeoutTimer: any; authSubscription$: Subscription; auth: IAuth | null = null; @@ -187,6 +188,9 @@ export class AccelerateCheckout implements OnInit, OnDestroy { moveToStep(step: CheckoutStep) { this._step = step; + if (this.timeoutTimer) { + clearTimeout(this.timeoutTimer); + } if (!this.estimate && ['quote', 'summary', 'checkout'].includes(this.step)) { this.fetchEstimate(); } @@ -199,6 +203,13 @@ export class AccelerateCheckout implements OnInit, OnDestroy { this.loadingCashapp = true; this.insertSquare(); this.setupSquare(); + } else if (this._step === 'paid') { + this.timePaid = Date.now(); + this.timeoutTimer = setTimeout(() => { + if (this.step === 'paid') { + this.accelerateError = 'internal_server_error'; + } + }, 120000) } this.hasDetails.emit(this._step === 'quote'); } @@ -595,6 +606,10 @@ export class AccelerateCheckout implements OnInit, OnDestroy { return this.isLoggedIn() && this.estimate?.hasAccess; } + get timeSincePaid(): number { + return Date.now() - this.timePaid; + } + @HostListener('window:resize', ['$event']) onResize(): void { this.isMobile = window.innerWidth <= 767.98;