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 a6863eb36..1a1977f57 100644
--- a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html
+++ b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html
@@ -355,7 +355,7 @@
@if (invoice) {
Pay {{ cost | number }} sats
-
+
} @else {
Loading invoice...
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 61b03d553..661b78c11 100644
--- a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts
+++ b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.ts
@@ -1,5 +1,5 @@
import { Component, OnInit, OnDestroy, Output, EventEmitter, Input, ChangeDetectorRef, SimpleChanges, HostListener } from '@angular/core';
-import { Subscription, tap, of, catchError, Observable } from 'rxjs';
+import { Subscription, tap, of, catchError, Observable, switchMap } from 'rxjs';
import { ServicesApiServices } from '../../services/services-api.service';
import { nextRoundNumber } from '../../shared/common.utils';
import { StateService } from '../../services/state.service';
@@ -443,15 +443,20 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
* BTCPay
*/
async requestBTCPayInvoice() {
- this.servicesApiService.generateBTCPayAcceleratorInvoice$(this.tx.txid, this.userBid).subscribe({
- next: (response) => {
- this.invoice = response;
+ this.servicesApiService.generateBTCPayAcceleratorInvoice$(this.tx.txid, this.userBid).pipe(
+ switchMap(response => {
+ return this.servicesApiService.retreiveInvoice$(response.btcpayInvoiceId);
+ }),
+ catchError(error => {
+ console.log(error);
+ return of(null);
+ })
+ ).subscribe((invoice) => {
+ this.invoice = invoice;
this.cd.markForCheck();
- this.scrollToElementWithTimeout('acceleratePreviewAnchor', 'start', 500);
- },
- error: (response) => {
- console.log(response);
- }
+ if (invoice) {
+ this.scrollToElementWithTimeout('acceleratePreviewAnchor', 'start', 500);
+ }
});
}
diff --git a/frontend/src/app/components/bitcoin-invoice/bitcoin-invoice.component.ts b/frontend/src/app/components/bitcoin-invoice/bitcoin-invoice.component.ts
index b220a63b1..cb7e78ebd 100644
--- a/frontend/src/app/components/bitcoin-invoice/bitcoin-invoice.component.ts
+++ b/frontend/src/app/components/bitcoin-invoice/bitcoin-invoice.component.ts
@@ -77,7 +77,7 @@ export class BitcoinInvoiceComponent implements OnInit, OnChanges, OnDestroy {
if (this.paymentStatusSubscription) {
this.paymentStatusSubscription.unsubscribe();
}
- this.paymentStatusSubscription = ((this.invoice && (this.invoice.btcpayInvoiceId || this.invoice.id) === invoiceId) ? of(this.invoice) : this.apiService.retreiveInvoice$(invoiceId)).pipe(
+ this.paymentStatusSubscription = ((this.invoice && this.invoice.id === invoiceId) ? of(this.invoice) : this.apiService.retreiveInvoice$(invoiceId)).pipe(
tap((invoice: any) => {
this.loadedInvoice = invoice;
if (this.loadedInvoice.btcDue > 0) {